@firecms/user_management 3.1.0-canary.1df3b2c → 3.1.0-canary.501d471

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import React, { useEffect, useCallback, useContext, useState } from "react";
2
2
  import equal from "react-fast-compare";
3
- import { removeUndefined, useAuthController, toSnakeCase, FieldCaption, ConfirmationDialog, useNavigationController, useSnackbarController, useCustomizationController, defaultDateFormat } from "@firecms/core";
3
+ import { removeUndefined, useTranslation, useAuthController, toSnakeCase, FieldCaption, ConfirmationDialog, useNavigationController, useSnackbarController, useCustomizationController, defaultDateFormat } from "@firecms/core";
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
5
  import { c } from "react-compiler-runtime";
6
- import { getColorSchemeForSeed, Chip, TextField, TableRow, TableCell, Checkbox, Tooltip, Button, Typography, DialogTitle, TableHeader, Paper, Table, TableBody, SelectItem, Select, DialogContent, LoadingButton, DialogActions, Dialog, IconButton, DeleteIcon, CenteredView, AddIcon, Container, MultiSelectItem, MultiSelect, Avatar } from "@firecms/ui";
6
+ import { getColorSchemeForSeed, Chip, TableRow, TableCell, Checkbox, Tooltip, Button, Typography, DialogTitle, TextField, TableHeader, TableBody, Paper, Table, SelectItem, Select, DialogContent, LoadingButton, DialogActions, Dialog, IconButton, DeleteIcon, CenteredView, AddIcon, Container, CopyIcon, MultiSelectItem, MultiSelect, Avatar } from "@firecms/ui";
7
7
  import * as Yup from "yup";
8
8
  import { useCreateFormex, getIn, Formex } from "@firecms/formex";
9
9
  import { format } from "date-fns";
@@ -489,19 +489,19 @@ function RoleChip(t0) {
489
489
  }
490
490
  return t1;
491
491
  }
492
- const RoleYupSchema = Yup.object().shape({
493
- id: Yup.string().required("Required"),
494
- name: Yup.string().required("Required")
492
+ const getRoleYupSchema = (t) => Yup.object().shape({
493
+ id: Yup.string().required(t("required")),
494
+ name: Yup.string().required(t("required"))
495
495
  });
496
- function canRoleBeEdited(loggedUser) {
496
+ function canRoleBeEdited(loggedUser, t) {
497
497
  const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
498
498
  if (!loggedUserIsAdmin) {
499
- throw new Error("Only admins can edit roles");
499
+ throw new Error(t("only_admins_edit_roles"));
500
500
  }
501
501
  return true;
502
502
  }
503
503
  function RolesDetailsForm(t0) {
504
- const $ = c(164);
504
+ const $ = c(311);
505
505
  const {
506
506
  open,
507
507
  role,
@@ -509,6 +509,9 @@ function RolesDetailsForm(t0) {
509
509
  handleClose,
510
510
  collections
511
511
  } = t0;
512
+ const {
513
+ t
514
+ } = useTranslation();
512
515
  const {
513
516
  saveRole
514
517
  } = useUserManagement();
@@ -518,34 +521,35 @@ function RolesDetailsForm(t0) {
518
521
  } = useAuthController();
519
522
  const [savingError, setSavingError] = useState();
520
523
  let t1;
521
- if ($[0] !== loggedInUser || $[1] !== saveRole) {
524
+ if ($[0] !== loggedInUser || $[1] !== saveRole || $[2] !== t) {
522
525
  t1 = (role_0) => {
523
526
  setSavingError(void 0);
524
527
  if (!loggedInUser) {
525
- throw new Error("User not found");
528
+ throw new Error(t("error_user_not_found"));
526
529
  }
527
- canRoleBeEdited(loggedInUser);
530
+ canRoleBeEdited(loggedInUser, t);
528
531
  return saveRole(role_0);
529
532
  };
530
533
  $[0] = loggedInUser;
531
534
  $[1] = saveRole;
532
- $[2] = t1;
535
+ $[2] = t;
536
+ $[3] = t1;
533
537
  } else {
534
- t1 = $[2];
538
+ t1 = $[3];
535
539
  }
536
540
  const onRoleUpdated = t1;
537
541
  let t2;
538
- if ($[3] !== role) {
542
+ if ($[4] !== role) {
539
543
  t2 = role ?? {
540
544
  name: ""
541
545
  };
542
- $[3] = role;
543
- $[4] = t2;
546
+ $[4] = role;
547
+ $[5] = t2;
544
548
  } else {
545
- t2 = $[4];
549
+ t2 = $[5];
546
550
  }
547
551
  let t3;
548
- if ($[5] !== handleClose || $[6] !== onRoleUpdated) {
552
+ if ($[6] !== handleClose || $[7] !== onRoleUpdated) {
549
553
  t3 = (role_1, formexController) => {
550
554
  try {
551
555
  return onRoleUpdated(role_1).then(() => {
@@ -562,26 +566,37 @@ function RolesDetailsForm(t0) {
562
566
  return Promise.resolve();
563
567
  }
564
568
  };
565
- $[5] = handleClose;
566
- $[6] = onRoleUpdated;
567
- $[7] = t3;
569
+ $[6] = handleClose;
570
+ $[7] = onRoleUpdated;
571
+ $[8] = t3;
568
572
  } else {
569
- t3 = $[7];
573
+ t3 = $[8];
570
574
  }
571
575
  let t4;
572
- if ($[8] !== t2 || $[9] !== t3) {
573
- t4 = {
576
+ if ($[9] !== t) {
577
+ t4 = (values) => getRoleYupSchema(t).validate(values, {
578
+ abortEarly: false
579
+ }).then(_temp$3).catch(_temp2$1);
580
+ $[9] = t;
581
+ $[10] = t4;
582
+ } else {
583
+ t4 = $[10];
584
+ }
585
+ let t5;
586
+ if ($[11] !== t2 || $[12] !== t3 || $[13] !== t4) {
587
+ t5 = {
574
588
  initialValues: t2,
575
589
  onSubmit: t3,
576
- validation: _temp3$1
590
+ validation: t4
577
591
  };
578
- $[8] = t2;
579
- $[9] = t3;
580
- $[10] = t4;
592
+ $[11] = t2;
593
+ $[12] = t3;
594
+ $[13] = t4;
595
+ $[14] = t5;
581
596
  } else {
582
- t4 = $[10];
597
+ t5 = $[14];
583
598
  }
584
- const formex = useCreateFormex(t4);
599
+ const formex = useCreateFormex(t5);
585
600
  const {
586
601
  isSubmitting,
587
602
  touched,
@@ -597,606 +612,1058 @@ function RolesDetailsForm(t0) {
597
612
  const defaultRead = values_0.defaultPermissions?.read ?? false;
598
613
  const defaultEdit = values_0.defaultPermissions?.edit ?? false;
599
614
  const defaultDelete = values_0.defaultPermissions?.delete ?? false;
600
- let t5;
601
- if ($[11] !== setFieldValue || $[12] !== touched || $[13] !== values_0.name) {
602
- t5 = () => {
615
+ let t6;
616
+ if ($[15] !== setFieldValue || $[16] !== touched || $[17] !== values_0.name) {
617
+ t6 = () => {
603
618
  const idTouched = getIn(touched, "id");
604
619
  if (!idTouched && values_0.name) {
605
620
  setFieldValue("id", toSnakeCase(values_0.name));
606
621
  }
607
622
  };
608
- $[11] = setFieldValue;
609
- $[12] = touched;
610
- $[13] = values_0.name;
611
- $[14] = t5;
623
+ $[15] = setFieldValue;
624
+ $[16] = touched;
625
+ $[17] = values_0.name;
626
+ $[18] = t6;
612
627
  } else {
613
- t5 = $[14];
628
+ t6 = $[18];
614
629
  }
615
- let t6;
616
- if ($[15] !== touched || $[16] !== values_0.name) {
617
- t6 = [touched, values_0.name];
618
- $[15] = touched;
619
- $[16] = values_0.name;
620
- $[17] = t6;
630
+ let t7;
631
+ if ($[19] !== touched || $[20] !== values_0.name) {
632
+ t7 = [touched, values_0.name];
633
+ $[19] = touched;
634
+ $[20] = values_0.name;
635
+ $[21] = t7;
621
636
  } else {
622
- t6 = $[17];
637
+ t7 = $[21];
623
638
  }
624
- React.useEffect(t5, t6);
625
- let t7;
626
- let t8;
627
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
628
- t7 = {
639
+ React.useEffect(t6, t7);
640
+ const t8 = formex.handleSubmit;
641
+ let t9;
642
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
643
+ t9 = {
629
644
  display: "flex",
630
645
  flexDirection: "column",
631
646
  position: "relative",
632
647
  height: "100%"
633
648
  };
634
- t8 = /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: "Role" });
635
- $[18] = t7;
636
- $[19] = t8;
637
- } else {
638
- t7 = $[18];
639
- t8 = $[19];
640
- }
641
- const t9 = touched.name && Boolean(errors_0.name);
642
- const t10 = isAdmin || !editable;
643
- let t11;
644
- if ($[20] !== handleChange || $[21] !== t10 || $[22] !== t9 || $[23] !== values_0.name) {
645
- t11 = /* @__PURE__ */ jsx(TextField, { name: "name", required: true, error: t9, value: values_0.name, disabled: t10, onChange: handleChange, "aria-describedby": "name-helper-text", label: "Name" });
646
- $[20] = handleChange;
647
- $[21] = t10;
648
649
  $[22] = t9;
649
- $[23] = values_0.name;
650
- $[24] = t11;
651
650
  } else {
652
- t11 = $[24];
651
+ t9 = $[22];
653
652
  }
654
- const t12 = touched.name && Boolean(errors_0.name) ? errors_0.name : "Name of this role";
655
- let t13;
656
- if ($[25] !== t12) {
657
- t13 = /* @__PURE__ */ jsx(FieldCaption, { children: t12 });
658
- $[25] = t12;
659
- $[26] = t13;
653
+ let t10;
654
+ if ($[23] !== t) {
655
+ t10 = t("role");
656
+ $[23] = t;
657
+ $[24] = t10;
660
658
  } else {
661
- t13 = $[26];
659
+ t10 = $[24];
662
660
  }
663
- let t14;
664
- if ($[27] !== t11 || $[28] !== t13) {
665
- t14 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-8", children: [
666
- t11,
667
- t13
668
- ] });
669
- $[27] = t11;
670
- $[28] = t13;
671
- $[29] = t14;
661
+ let t11;
662
+ if ($[25] !== t10) {
663
+ t11 = /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: t10 });
664
+ $[25] = t10;
665
+ $[26] = t11;
672
666
  } else {
673
- t14 = $[29];
667
+ t11 = $[26];
674
668
  }
675
- const t15 = touched.id && Boolean(errors_0.id);
676
- const t16 = !isNewRole || !editable;
677
- let t17;
678
- if ($[30] !== handleChange || $[31] !== setFieldTouched) {
679
- t17 = (e_2) => {
680
- handleChange(e_2);
681
- setFieldTouched("id", true);
682
- };
683
- $[30] = handleChange;
684
- $[31] = setFieldTouched;
685
- $[32] = t17;
669
+ const t12 = touched.name && Boolean(errors_0.name);
670
+ const t13 = values_0.name;
671
+ const t14 = isAdmin || !editable;
672
+ let t15;
673
+ if ($[27] !== t) {
674
+ t15 = t("name");
675
+ $[27] = t;
676
+ $[28] = t15;
686
677
  } else {
687
- t17 = $[32];
678
+ t15 = $[28];
688
679
  }
689
- let t18;
690
- if ($[33] !== t15 || $[34] !== t16 || $[35] !== t17 || $[36] !== values_0.id) {
691
- t18 = /* @__PURE__ */ jsx(TextField, { name: "id", required: true, error: t15, value: values_0.id, disabled: t16, onChange: t17, "aria-describedby": "id-helper-text", label: "ID" });
692
- $[33] = t15;
680
+ let t16;
681
+ if ($[29] !== handleChange || $[30] !== t12 || $[31] !== t14 || $[32] !== t15 || $[33] !== values_0.name) {
682
+ t16 = /* @__PURE__ */ jsx(TextField, { name: "name", required: true, error: t12, value: t13, disabled: t14, onChange: handleChange, "aria-describedby": "name-helper-text", label: t15 });
683
+ $[29] = handleChange;
684
+ $[30] = t12;
685
+ $[31] = t14;
686
+ $[32] = t15;
687
+ $[33] = values_0.name;
693
688
  $[34] = t16;
694
- $[35] = t17;
695
- $[36] = values_0.id;
696
- $[37] = t18;
697
689
  } else {
698
- t18 = $[37];
690
+ t16 = $[34];
699
691
  }
700
- const t19 = touched.id && Boolean(errors_0.id) ? errors_0.id : "ID of this role";
701
- let t20;
702
- if ($[38] !== t19) {
703
- t20 = /* @__PURE__ */ jsx(FieldCaption, { children: t19 });
704
- $[38] = t19;
705
- $[39] = t20;
692
+ let t17;
693
+ if ($[35] !== errors_0 || $[36] !== t || $[37] !== touched.name) {
694
+ t17 = touched.name && Boolean(errors_0.name) ? errors_0.name : t("name_of_this_role");
695
+ $[35] = errors_0;
696
+ $[36] = t;
697
+ $[37] = touched.name;
698
+ $[38] = t17;
706
699
  } else {
707
- t20 = $[39];
700
+ t17 = $[38];
708
701
  }
709
- let t21;
710
- if ($[40] !== t18 || $[41] !== t20) {
711
- t21 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
712
- t18,
713
- t20
714
- ] });
702
+ let t18;
703
+ if ($[39] !== t17) {
704
+ t18 = /* @__PURE__ */ jsx(FieldCaption, { children: t17 });
705
+ $[39] = t17;
715
706
  $[40] = t18;
716
- $[41] = t20;
717
- $[42] = t21;
718
707
  } else {
719
- t21 = $[42];
708
+ t18 = $[40];
720
709
  }
721
- let t22;
722
- if ($[43] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
723
- t22 = /* @__PURE__ */ jsxs(TableHeader, { className: "rounded-md", children: [
724
- /* @__PURE__ */ jsx(TableCell, {}),
725
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: "Create entities" }),
726
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: "Read entities" }),
727
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: "Update entities" }),
728
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: "Delete entities" }),
729
- /* @__PURE__ */ jsx(TableCell, { align: "center" })
710
+ let t19;
711
+ if ($[41] !== t16 || $[42] !== t18) {
712
+ t19 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-8", children: [
713
+ t16,
714
+ t18
730
715
  ] });
731
- $[43] = t22;
716
+ $[41] = t16;
717
+ $[42] = t18;
718
+ $[43] = t19;
732
719
  } else {
733
- t22 = $[43];
720
+ t19 = $[43];
734
721
  }
722
+ const t20 = touched.id && Boolean(errors_0.id);
723
+ const t21 = values_0.id;
724
+ const t22 = !isNewRole || !editable;
735
725
  let t23;
736
- if ($[44] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
737
- t23 = /* @__PURE__ */ jsx(TableCell, { scope: "row", children: /* @__PURE__ */ jsx("strong", { children: "All collections" }) });
738
- $[44] = t23;
726
+ if ($[44] !== handleChange || $[45] !== setFieldTouched) {
727
+ t23 = (e_2) => {
728
+ handleChange(e_2);
729
+ setFieldTouched("id", true);
730
+ };
731
+ $[44] = handleChange;
732
+ $[45] = setFieldTouched;
733
+ $[46] = t23;
739
734
  } else {
740
- t23 = $[44];
735
+ t23 = $[46];
736
+ }
737
+ let t24;
738
+ if ($[47] !== t) {
739
+ t24 = t("id");
740
+ $[47] = t;
741
+ $[48] = t24;
742
+ } else {
743
+ t24 = $[48];
744
+ }
745
+ let t25;
746
+ if ($[49] !== t20 || $[50] !== t22 || $[51] !== t23 || $[52] !== t24 || $[53] !== values_0.id) {
747
+ t25 = /* @__PURE__ */ jsx(TextField, { name: "id", required: true, error: t20, value: t21, disabled: t22, onChange: t23, "aria-describedby": "id-helper-text", label: t24 });
748
+ $[49] = t20;
749
+ $[50] = t22;
750
+ $[51] = t23;
751
+ $[52] = t24;
752
+ $[53] = values_0.id;
753
+ $[54] = t25;
754
+ } else {
755
+ t25 = $[54];
741
756
  }
742
- const t24 = isAdmin || !editable;
743
- const t25 = (isAdmin || defaultCreate) ?? false;
744
757
  let t26;
745
- if ($[45] !== setFieldValue) {
746
- t26 = (checked) => setFieldValue("defaultPermissions.create", checked);
747
- $[45] = setFieldValue;
748
- $[46] = t26;
758
+ if ($[55] !== errors_0 || $[56] !== t || $[57] !== touched.id) {
759
+ t26 = touched.id && Boolean(errors_0.id) ? errors_0.id : t("id_of_this_role");
760
+ $[55] = errors_0;
761
+ $[56] = t;
762
+ $[57] = touched.id;
763
+ $[58] = t26;
749
764
  } else {
750
- t26 = $[46];
765
+ t26 = $[58];
751
766
  }
752
767
  let t27;
753
- if ($[47] !== t24 || $[48] !== t25 || $[49] !== t26) {
754
- t27 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: "Create entities in collections", children: /* @__PURE__ */ jsx(Checkbox, { disabled: t24, checked: t25, onCheckedChange: t26 }) }) });
755
- $[47] = t24;
756
- $[48] = t25;
757
- $[49] = t26;
758
- $[50] = t27;
768
+ if ($[59] !== t26) {
769
+ t27 = /* @__PURE__ */ jsx(FieldCaption, { children: t26 });
770
+ $[59] = t26;
771
+ $[60] = t27;
772
+ } else {
773
+ t27 = $[60];
774
+ }
775
+ let t28;
776
+ if ($[61] !== t25 || $[62] !== t27) {
777
+ t28 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
778
+ t25,
779
+ t27
780
+ ] });
781
+ $[61] = t25;
782
+ $[62] = t27;
783
+ $[63] = t28;
759
784
  } else {
760
- t27 = $[50];
785
+ t28 = $[63];
786
+ }
787
+ let t29;
788
+ if ($[64] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
789
+ t29 = /* @__PURE__ */ jsx(TableCell, {});
790
+ $[64] = t29;
791
+ } else {
792
+ t29 = $[64];
761
793
  }
762
- const t28 = isAdmin || !editable;
763
- const t29 = (isAdmin || defaultRead) ?? false;
764
794
  let t30;
765
- if ($[51] !== setFieldValue) {
766
- t30 = (checked_0) => setFieldValue("defaultPermissions.read", checked_0);
767
- $[51] = setFieldValue;
768
- $[52] = t30;
795
+ if ($[65] !== t) {
796
+ t30 = t("create_entities");
797
+ $[65] = t;
798
+ $[66] = t30;
769
799
  } else {
770
- t30 = $[52];
800
+ t30 = $[66];
771
801
  }
772
802
  let t31;
773
- if ($[53] !== t28 || $[54] !== t29 || $[55] !== t30) {
774
- t31 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: "Access all data in every collection", children: /* @__PURE__ */ jsx(Checkbox, { disabled: t28, checked: t29, onCheckedChange: t30 }) }) });
775
- $[53] = t28;
776
- $[54] = t29;
777
- $[55] = t30;
778
- $[56] = t31;
803
+ if ($[67] !== t30) {
804
+ t31 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: t30 });
805
+ $[67] = t30;
806
+ $[68] = t31;
807
+ } else {
808
+ t31 = $[68];
809
+ }
810
+ let t32;
811
+ if ($[69] !== t) {
812
+ t32 = t("read_entities");
813
+ $[69] = t;
814
+ $[70] = t32;
815
+ } else {
816
+ t32 = $[70];
817
+ }
818
+ let t33;
819
+ if ($[71] !== t32) {
820
+ t33 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: t32 });
821
+ $[71] = t32;
822
+ $[72] = t33;
779
823
  } else {
780
- t31 = $[56];
824
+ t33 = $[72];
781
825
  }
782
- const t32 = isAdmin || !editable;
783
- const t33 = (isAdmin || defaultEdit) ?? false;
784
826
  let t34;
785
- if ($[57] !== setFieldValue) {
786
- t34 = (checked_1) => setFieldValue("defaultPermissions.edit", checked_1);
787
- $[57] = setFieldValue;
788
- $[58] = t34;
827
+ if ($[73] !== t) {
828
+ t34 = t("update_entities");
829
+ $[73] = t;
830
+ $[74] = t34;
789
831
  } else {
790
- t34 = $[58];
832
+ t34 = $[74];
791
833
  }
792
834
  let t35;
793
- if ($[59] !== t32 || $[60] !== t33 || $[61] !== t34) {
794
- t35 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: "Update data in any collection", children: /* @__PURE__ */ jsx(Checkbox, { disabled: t32, checked: t33, onCheckedChange: t34 }) }) });
795
- $[59] = t32;
796
- $[60] = t33;
797
- $[61] = t34;
798
- $[62] = t35;
835
+ if ($[75] !== t34) {
836
+ t35 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: t34 });
837
+ $[75] = t34;
838
+ $[76] = t35;
839
+ } else {
840
+ t35 = $[76];
841
+ }
842
+ let t36;
843
+ if ($[77] !== t) {
844
+ t36 = t("delete_entities");
845
+ $[77] = t;
846
+ $[78] = t36;
799
847
  } else {
800
- t35 = $[62];
848
+ t36 = $[78];
849
+ }
850
+ let t37;
851
+ if ($[79] !== t36) {
852
+ t37 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: t36 });
853
+ $[79] = t36;
854
+ $[80] = t37;
855
+ } else {
856
+ t37 = $[80];
801
857
  }
802
- const t36 = isAdmin || !editable;
803
- const t37 = (isAdmin || defaultDelete) ?? false;
804
858
  let t38;
805
- if ($[63] !== setFieldValue) {
806
- t38 = (checked_2) => setFieldValue("defaultPermissions.delete", checked_2);
807
- $[63] = setFieldValue;
808
- $[64] = t38;
859
+ if ($[81] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
860
+ t38 = /* @__PURE__ */ jsx(TableCell, { align: "center" });
861
+ $[81] = t38;
809
862
  } else {
810
- t38 = $[64];
863
+ t38 = $[81];
811
864
  }
812
865
  let t39;
813
- if ($[65] !== t36 || $[66] !== t37 || $[67] !== t38) {
814
- t39 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: "Delete data in any collection", children: /* @__PURE__ */ jsx(Checkbox, { disabled: t36, checked: t37, onCheckedChange: t38 }) }) });
815
- $[65] = t36;
816
- $[66] = t37;
817
- $[67] = t38;
818
- $[68] = t39;
866
+ if ($[82] !== t31 || $[83] !== t33 || $[84] !== t35 || $[85] !== t37) {
867
+ t39 = /* @__PURE__ */ jsxs(TableHeader, { className: "rounded-md", children: [
868
+ t29,
869
+ t31,
870
+ t33,
871
+ t35,
872
+ t37,
873
+ t38
874
+ ] });
875
+ $[82] = t31;
876
+ $[83] = t33;
877
+ $[84] = t35;
878
+ $[85] = t37;
879
+ $[86] = t39;
819
880
  } else {
820
- t39 = $[68];
881
+ t39 = $[86];
821
882
  }
822
883
  let t40;
823
- if ($[69] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
824
- t40 = /* @__PURE__ */ jsx(TableCell, { align: "center" });
825
- $[69] = t40;
884
+ if ($[87] !== t) {
885
+ t40 = t("all_collections");
886
+ $[87] = t;
887
+ $[88] = t40;
826
888
  } else {
827
- t40 = $[69];
889
+ t40 = $[88];
828
890
  }
829
891
  let t41;
830
- if ($[70] !== t27 || $[71] !== t31 || $[72] !== t35 || $[73] !== t39) {
831
- t41 = /* @__PURE__ */ jsxs(TableRow, { children: [
832
- t23,
833
- t27,
834
- t31,
835
- t35,
836
- t39,
837
- t40
838
- ] });
839
- $[70] = t27;
840
- $[71] = t31;
841
- $[72] = t35;
842
- $[73] = t39;
843
- $[74] = t41;
892
+ if ($[89] !== t40) {
893
+ t41 = /* @__PURE__ */ jsx(TableCell, { scope: "row", children: /* @__PURE__ */ jsx("strong", { children: t40 }) });
894
+ $[89] = t40;
895
+ $[90] = t41;
844
896
  } else {
845
- t41 = $[74];
897
+ t41 = $[90];
846
898
  }
847
899
  let t42;
848
- if ($[75] !== collections || $[76] !== defaultCreate || $[77] !== defaultDelete || $[78] !== defaultEdit || $[79] !== defaultRead || $[80] !== editable || $[81] !== isAdmin || $[82] !== setFieldValue || $[83] !== values_0) {
849
- t42 = collections && collections.map((col) => /* @__PURE__ */ jsxs(TableRow, { children: [
850
- /* @__PURE__ */ jsx(TableCell, { scope: "row", children: col.name }),
851
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultCreate || !editable, checked: (isAdmin || defaultCreate || getIn(values_0, `collectionPermissions.${col.id}.create`)) ?? false, onCheckedChange: (checked_3) => setFieldValue(`collectionPermissions.${col.id}.create`, checked_3) }) }),
852
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultRead || !editable, checked: (isAdmin || defaultRead || getIn(values_0, `collectionPermissions.${col.id}.read`)) ?? false, onCheckedChange: (checked_4) => setFieldValue(`collectionPermissions.${col.id}.read`, checked_4) }) }),
853
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultEdit || !editable, checked: (isAdmin || defaultEdit || getIn(values_0, `collectionPermissions.${col.id}.edit`)) ?? false, onCheckedChange: (checked_5) => setFieldValue(`collectionPermissions.${col.id}.edit`, checked_5) }) }),
854
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultDelete || !editable, checked: (isAdmin || defaultDelete || getIn(values_0, `collectionPermissions.${col.id}.delete`)) ?? false, onCheckedChange: (checked_6) => setFieldValue(`collectionPermissions.${col.id}.delete`, checked_6) }) }),
855
- /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: "Allow all permissions in this collections", children: /* @__PURE__ */ jsx(Button, { className: "color-inherit", onClick: () => {
856
- setFieldValue(`collectionPermissions.${col.id}.create`, true);
857
- setFieldValue(`collectionPermissions.${col.id}.read`, true);
858
- setFieldValue(`collectionPermissions.${col.id}.edit`, true);
859
- setFieldValue(`collectionPermissions.${col.id}.delete`, true);
860
- }, disabled: isAdmin || !editable, variant: "text", children: "All" }) }) })
861
- ] }, col.name));
862
- $[75] = collections;
863
- $[76] = defaultCreate;
864
- $[77] = defaultDelete;
865
- $[78] = defaultEdit;
866
- $[79] = defaultRead;
867
- $[80] = editable;
868
- $[81] = isAdmin;
869
- $[82] = setFieldValue;
870
- $[83] = values_0;
871
- $[84] = t42;
872
- } else {
873
- t42 = $[84];
874
- }
875
- let t43;
876
- if ($[85] !== t41 || $[86] !== t42) {
877
- t43 = /* @__PURE__ */ jsx(Paper, { className: "bg-inherit overflow-hidden", children: /* @__PURE__ */ jsxs(Table, { className: "w-full rounded-md", children: [
878
- t22,
879
- /* @__PURE__ */ jsxs(TableBody, { children: [
880
- t41,
881
- t42
882
- ] })
883
- ] }) });
884
- $[85] = t41;
885
- $[86] = t42;
886
- $[87] = t43;
900
+ if ($[91] !== t) {
901
+ t42 = t("create_entities_in_collections");
902
+ $[91] = t;
903
+ $[92] = t42;
887
904
  } else {
888
- t43 = $[87];
905
+ t42 = $[92];
889
906
  }
890
- let t44;
891
- if ($[88] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
892
- t44 = /* @__PURE__ */ jsx(FieldCaption, { children: "You can customise the permissions that the users related to this role can perform in the entities of each collection" });
893
- $[88] = t44;
907
+ const t43 = isAdmin || !editable;
908
+ const t44 = (isAdmin || defaultCreate) ?? false;
909
+ let t45;
910
+ if ($[93] !== setFieldValue) {
911
+ t45 = (checked) => setFieldValue("defaultPermissions.create", checked);
912
+ $[93] = setFieldValue;
913
+ $[94] = t45;
894
914
  } else {
895
- t44 = $[88];
915
+ t45 = $[94];
896
916
  }
897
- let t45;
898
- if ($[89] !== t43) {
899
- t45 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
900
- t43,
901
- t44
902
- ] });
903
- $[89] = t43;
904
- $[90] = t45;
917
+ let t46;
918
+ if ($[95] !== t43 || $[96] !== t44 || $[97] !== t45) {
919
+ t46 = /* @__PURE__ */ jsx(Checkbox, { disabled: t43, checked: t44, onCheckedChange: t45 });
920
+ $[95] = t43;
921
+ $[96] = t44;
922
+ $[97] = t45;
923
+ $[98] = t46;
924
+ } else {
925
+ t46 = $[98];
926
+ }
927
+ let t47;
928
+ if ($[99] !== t42 || $[100] !== t46) {
929
+ t47 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: t42, children: t46 }) });
930
+ $[99] = t42;
931
+ $[100] = t46;
932
+ $[101] = t47;
905
933
  } else {
906
- t45 = $[90];
934
+ t47 = $[101];
907
935
  }
908
- const t46 = touched.config && Boolean(errors_0.config);
909
- const t47 = isAdmin || !editable;
910
936
  let t48;
911
- if ($[91] !== setFieldValue) {
912
- t48 = (event) => setFieldValue("config.createCollections", event.target.value === "true");
913
- $[91] = setFieldValue;
914
- $[92] = t48;
937
+ if ($[102] !== t) {
938
+ t48 = t("access_all_data_in_every_collection");
939
+ $[102] = t;
940
+ $[103] = t48;
915
941
  } else {
916
- t48 = $[92];
942
+ t48 = $[103];
917
943
  }
918
- const t49 = isAdmin || values_0.config?.createCollections ? "true" : "false";
919
- let t50;
944
+ const t49 = isAdmin || !editable;
945
+ const t50 = (isAdmin || defaultRead) ?? false;
920
946
  let t51;
921
- if ($[93] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
922
- t50 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: " Yes " });
923
- t51 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: " No " });
924
- $[93] = t50;
925
- $[94] = t51;
947
+ if ($[104] !== setFieldValue) {
948
+ t51 = (checked_0) => setFieldValue("defaultPermissions.read", checked_0);
949
+ $[104] = setFieldValue;
950
+ $[105] = t51;
926
951
  } else {
927
- t50 = $[93];
928
- t51 = $[94];
952
+ t51 = $[105];
929
953
  }
930
954
  let t52;
931
- if ($[95] !== t46 || $[96] !== t47 || $[97] !== t48 || $[98] !== t49) {
932
- t52 = /* @__PURE__ */ jsxs(Select, { error: t46, size: "large", fullWidth: true, id: "createCollections", name: "createCollections", label: "Create collections", position: "item-aligned", disabled: t47, onChange: t48, value: t49, renderValue: _temp4$1, children: [
933
- t50,
934
- t51
935
- ] });
936
- $[95] = t46;
937
- $[96] = t47;
938
- $[97] = t48;
939
- $[98] = t49;
940
- $[99] = t52;
955
+ if ($[106] !== t49 || $[107] !== t50 || $[108] !== t51) {
956
+ t52 = /* @__PURE__ */ jsx(Checkbox, { disabled: t49, checked: t50, onCheckedChange: t51 });
957
+ $[106] = t49;
958
+ $[107] = t50;
959
+ $[108] = t51;
960
+ $[109] = t52;
961
+ } else {
962
+ t52 = $[109];
963
+ }
964
+ let t53;
965
+ if ($[110] !== t48 || $[111] !== t52) {
966
+ t53 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: t48, children: t52 }) });
967
+ $[110] = t48;
968
+ $[111] = t52;
969
+ $[112] = t53;
941
970
  } else {
942
- t52 = $[99];
971
+ t53 = $[112];
943
972
  }
944
- const t53 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user create collections";
945
973
  let t54;
946
- if ($[100] !== t53) {
947
- t54 = /* @__PURE__ */ jsx(FieldCaption, { children: t53 });
948
- $[100] = t53;
949
- $[101] = t54;
950
- } else {
951
- t54 = $[101];
952
- }
953
- let t55;
954
- if ($[102] !== t52 || $[103] !== t54) {
955
- t55 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
956
- t52,
957
- t54
958
- ] });
959
- $[102] = t52;
960
- $[103] = t54;
961
- $[104] = t55;
974
+ if ($[113] !== t) {
975
+ t54 = t("update_data_in_any_collection");
976
+ $[113] = t;
977
+ $[114] = t54;
978
+ } else {
979
+ t54 = $[114];
980
+ }
981
+ const t55 = isAdmin || !editable;
982
+ const t56 = (isAdmin || defaultEdit) ?? false;
983
+ let t57;
984
+ if ($[115] !== setFieldValue) {
985
+ t57 = (checked_1) => setFieldValue("defaultPermissions.edit", checked_1);
986
+ $[115] = setFieldValue;
987
+ $[116] = t57;
962
988
  } else {
963
- t55 = $[104];
989
+ t57 = $[116];
964
990
  }
965
- const t56 = touched.config && Boolean(errors_0.config);
966
- const t57 = isAdmin || !editable;
967
991
  let t58;
968
- if ($[105] !== setFieldValue) {
969
- t58 = (event_0) => setFieldValue("config.editCollections", event_0.target.value === "own" ? "own" : event_0.target.value === "true");
970
- $[105] = setFieldValue;
971
- $[106] = t58;
992
+ if ($[117] !== t55 || $[118] !== t56 || $[119] !== t57) {
993
+ t58 = /* @__PURE__ */ jsx(Checkbox, { disabled: t55, checked: t56, onCheckedChange: t57 });
994
+ $[117] = t55;
995
+ $[118] = t56;
996
+ $[119] = t57;
997
+ $[120] = t58;
998
+ } else {
999
+ t58 = $[120];
1000
+ }
1001
+ let t59;
1002
+ if ($[121] !== t54 || $[122] !== t58) {
1003
+ t59 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: t54, children: t58 }) });
1004
+ $[121] = t54;
1005
+ $[122] = t58;
1006
+ $[123] = t59;
972
1007
  } else {
973
- t58 = $[106];
1008
+ t59 = $[123];
974
1009
  }
975
- const t59 = isAdmin ? "true" : values_0.config?.editCollections === "own" ? "own" : values_0.config?.editCollections ? "true" : "false";
976
1010
  let t60;
977
- let t61;
978
- let t62;
979
- if ($[107] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
980
- t60 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: " Yes " });
981
- t61 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: " No " });
982
- t62 = /* @__PURE__ */ jsx(SelectItem, { value: "own", children: " Only his/her own " });
983
- $[107] = t60;
984
- $[108] = t61;
985
- $[109] = t62;
986
- } else {
987
- t60 = $[107];
988
- t61 = $[108];
989
- t62 = $[109];
1011
+ if ($[124] !== t) {
1012
+ t60 = t("delete_data_in_any_collection");
1013
+ $[124] = t;
1014
+ $[125] = t60;
1015
+ } else {
1016
+ t60 = $[125];
990
1017
  }
1018
+ const t61 = isAdmin || !editable;
1019
+ const t62 = (isAdmin || defaultDelete) ?? false;
991
1020
  let t63;
992
- if ($[110] !== t56 || $[111] !== t57 || $[112] !== t58 || $[113] !== t59) {
993
- t63 = /* @__PURE__ */ jsxs(Select, { size: "large", fullWidth: true, error: t56, id: "editCollections", name: "editCollections", label: "Edit collections", disabled: t57, position: "item-aligned", onChange: t58, value: t59, renderValue: _temp5$1, children: [
994
- t60,
995
- t61,
996
- t62
997
- ] });
998
- $[110] = t56;
999
- $[111] = t57;
1000
- $[112] = t58;
1001
- $[113] = t59;
1002
- $[114] = t63;
1021
+ if ($[126] !== setFieldValue) {
1022
+ t63 = (checked_2) => setFieldValue("defaultPermissions.delete", checked_2);
1023
+ $[126] = setFieldValue;
1024
+ $[127] = t63;
1003
1025
  } else {
1004
- t63 = $[114];
1026
+ t63 = $[127];
1027
+ }
1028
+ let t64;
1029
+ if ($[128] !== t61 || $[129] !== t62 || $[130] !== t63) {
1030
+ t64 = /* @__PURE__ */ jsx(Checkbox, { disabled: t61, checked: t62, onCheckedChange: t63 });
1031
+ $[128] = t61;
1032
+ $[129] = t62;
1033
+ $[130] = t63;
1034
+ $[131] = t64;
1035
+ } else {
1036
+ t64 = $[131];
1005
1037
  }
1006
- const t64 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user edit collections";
1007
1038
  let t65;
1008
- if ($[115] !== t64) {
1009
- t65 = /* @__PURE__ */ jsx(FieldCaption, { children: t64 });
1010
- $[115] = t64;
1011
- $[116] = t65;
1039
+ if ($[132] !== t60 || $[133] !== t64) {
1040
+ t65 = /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: t60, children: t64 }) });
1041
+ $[132] = t60;
1042
+ $[133] = t64;
1043
+ $[134] = t65;
1012
1044
  } else {
1013
- t65 = $[116];
1045
+ t65 = $[134];
1014
1046
  }
1015
1047
  let t66;
1016
- if ($[117] !== t63 || $[118] !== t65) {
1017
- t66 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1018
- t63,
1019
- t65
1048
+ if ($[135] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1049
+ t66 = /* @__PURE__ */ jsx(TableCell, { align: "center" });
1050
+ $[135] = t66;
1051
+ } else {
1052
+ t66 = $[135];
1053
+ }
1054
+ let t67;
1055
+ if ($[136] !== t41 || $[137] !== t47 || $[138] !== t53 || $[139] !== t59 || $[140] !== t65) {
1056
+ t67 = /* @__PURE__ */ jsxs(TableRow, { children: [
1057
+ t41,
1058
+ t47,
1059
+ t53,
1060
+ t59,
1061
+ t65,
1062
+ t66
1020
1063
  ] });
1021
- $[117] = t63;
1022
- $[118] = t65;
1023
- $[119] = t66;
1024
- } else {
1025
- t66 = $[119];
1064
+ $[136] = t41;
1065
+ $[137] = t47;
1066
+ $[138] = t53;
1067
+ $[139] = t59;
1068
+ $[140] = t65;
1069
+ $[141] = t67;
1070
+ } else {
1071
+ t67 = $[141];
1072
+ }
1073
+ let t68;
1074
+ if ($[142] !== collections || $[143] !== defaultCreate || $[144] !== defaultDelete || $[145] !== defaultEdit || $[146] !== defaultRead || $[147] !== editable || $[148] !== isAdmin || $[149] !== setFieldValue || $[150] !== t || $[151] !== values_0) {
1075
+ t68 = collections && collections.map((col) => /* @__PURE__ */ jsxs(TableRow, { children: [
1076
+ /* @__PURE__ */ jsx(TableCell, { scope: "row", children: col.name }),
1077
+ /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultCreate || !editable, checked: (isAdmin || defaultCreate || getIn(values_0, `collectionPermissions.${col.id}.create`)) ?? false, onCheckedChange: (checked_3) => setFieldValue(`collectionPermissions.${col.id}.create`, checked_3) }) }),
1078
+ /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultRead || !editable, checked: (isAdmin || defaultRead || getIn(values_0, `collectionPermissions.${col.id}.read`)) ?? false, onCheckedChange: (checked_4) => setFieldValue(`collectionPermissions.${col.id}.read`, checked_4) }) }),
1079
+ /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultEdit || !editable, checked: (isAdmin || defaultEdit || getIn(values_0, `collectionPermissions.${col.id}.edit`)) ?? false, onCheckedChange: (checked_5) => setFieldValue(`collectionPermissions.${col.id}.edit`, checked_5) }) }),
1080
+ /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Checkbox, { disabled: isAdmin || defaultDelete || !editable, checked: (isAdmin || defaultDelete || getIn(values_0, `collectionPermissions.${col.id}.delete`)) ?? false, onCheckedChange: (checked_6) => setFieldValue(`collectionPermissions.${col.id}.delete`, checked_6) }) }),
1081
+ /* @__PURE__ */ jsx(TableCell, { align: "center", children: /* @__PURE__ */ jsx(Tooltip, { title: t("allow_all_permissions_in_this_collections"), children: /* @__PURE__ */ jsx(Button, { className: "color-inherit", onClick: () => {
1082
+ setFieldValue(`collectionPermissions.${col.id}.create`, true);
1083
+ setFieldValue(`collectionPermissions.${col.id}.read`, true);
1084
+ setFieldValue(`collectionPermissions.${col.id}.edit`, true);
1085
+ setFieldValue(`collectionPermissions.${col.id}.delete`, true);
1086
+ }, disabled: isAdmin || !editable, variant: "text", children: t("all") }) }) })
1087
+ ] }, col.name));
1088
+ $[142] = collections;
1089
+ $[143] = defaultCreate;
1090
+ $[144] = defaultDelete;
1091
+ $[145] = defaultEdit;
1092
+ $[146] = defaultRead;
1093
+ $[147] = editable;
1094
+ $[148] = isAdmin;
1095
+ $[149] = setFieldValue;
1096
+ $[150] = t;
1097
+ $[151] = values_0;
1098
+ $[152] = t68;
1099
+ } else {
1100
+ t68 = $[152];
1026
1101
  }
1027
- const t67 = touched.config && Boolean(errors_0.config);
1028
- const t68 = isAdmin || !editable;
1029
1102
  let t69;
1030
- if ($[120] !== setFieldValue) {
1031
- t69 = (event_1) => setFieldValue("config.deleteCollections", event_1.target.value === "own" ? "own" : event_1.target.value === "true");
1032
- $[120] = setFieldValue;
1033
- $[121] = t69;
1103
+ if ($[153] !== t67 || $[154] !== t68) {
1104
+ t69 = /* @__PURE__ */ jsxs(TableBody, { children: [
1105
+ t67,
1106
+ t68
1107
+ ] });
1108
+ $[153] = t67;
1109
+ $[154] = t68;
1110
+ $[155] = t69;
1034
1111
  } else {
1035
- t69 = $[121];
1112
+ t69 = $[155];
1113
+ }
1114
+ let t70;
1115
+ if ($[156] !== t39 || $[157] !== t69) {
1116
+ t70 = /* @__PURE__ */ jsx(Paper, { className: "bg-inherit overflow-hidden", children: /* @__PURE__ */ jsxs(Table, { className: "w-full rounded-md", children: [
1117
+ t39,
1118
+ t69
1119
+ ] }) });
1120
+ $[156] = t39;
1121
+ $[157] = t69;
1122
+ $[158] = t70;
1123
+ } else {
1124
+ t70 = $[158];
1036
1125
  }
1037
- const t70 = isAdmin ? "true" : values_0.config?.deleteCollections === "own" ? "own" : values_0.config?.deleteCollections ? "true" : "false";
1038
1126
  let t71;
1127
+ if ($[159] !== t) {
1128
+ t71 = t("customise_permissions_description");
1129
+ $[159] = t;
1130
+ $[160] = t71;
1131
+ } else {
1132
+ t71 = $[160];
1133
+ }
1039
1134
  let t72;
1135
+ if ($[161] !== t71) {
1136
+ t72 = /* @__PURE__ */ jsx(FieldCaption, { children: t71 });
1137
+ $[161] = t71;
1138
+ $[162] = t72;
1139
+ } else {
1140
+ t72 = $[162];
1141
+ }
1040
1142
  let t73;
1041
- if ($[122] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1042
- t71 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: " Yes " });
1043
- t72 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: " No " });
1044
- t73 = /* @__PURE__ */ jsx(SelectItem, { value: "own", children: " Only his/her own " });
1045
- $[122] = t71;
1046
- $[123] = t72;
1047
- $[124] = t73;
1048
- } else {
1049
- t71 = $[122];
1050
- t72 = $[123];
1051
- t73 = $[124];
1052
- }
1053
- let t74;
1054
- if ($[125] !== t67 || $[126] !== t68 || $[127] !== t69 || $[128] !== t70) {
1055
- t74 = /* @__PURE__ */ jsxs(Select, { size: "large", fullWidth: true, error: t67, id: "deleteCollections", name: "deleteCollections", label: "Delete collections", disabled: t68, position: "item-aligned", onChange: t69, value: t70, renderValue: _temp6$1, children: [
1056
- t71,
1057
- t72,
1058
- t73
1143
+ if ($[163] !== t70 || $[164] !== t72) {
1144
+ t73 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
1145
+ t70,
1146
+ t72
1059
1147
  ] });
1060
- $[125] = t67;
1061
- $[126] = t68;
1062
- $[127] = t69;
1063
- $[128] = t70;
1064
- $[129] = t74;
1148
+ $[163] = t70;
1149
+ $[164] = t72;
1150
+ $[165] = t73;
1065
1151
  } else {
1066
- t74 = $[129];
1152
+ t73 = $[165];
1067
1153
  }
1068
- const t75 = touched.config && Boolean(errors_0.config) ? errors_0.config : "Can the user delete collections";
1069
- let t76;
1070
- if ($[130] !== t75) {
1071
- t76 = /* @__PURE__ */ jsx(FieldCaption, { children: t75 });
1072
- $[130] = t75;
1073
- $[131] = t76;
1154
+ const t74 = touched.config && Boolean(errors_0.config);
1155
+ let t75;
1156
+ if ($[166] !== t) {
1157
+ t75 = t("create_collections");
1158
+ $[166] = t;
1159
+ $[167] = t75;
1074
1160
  } else {
1075
- t76 = $[131];
1161
+ t75 = $[167];
1076
1162
  }
1163
+ const t76 = isAdmin || !editable;
1077
1164
  let t77;
1078
- if ($[132] !== t74 || $[133] !== t76) {
1079
- t77 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1080
- t74,
1081
- t76
1082
- ] });
1083
- $[132] = t74;
1084
- $[133] = t76;
1085
- $[134] = t77;
1086
- } else {
1087
- t77 = $[134];
1088
- }
1089
- let t78;
1090
- if ($[135] !== t14 || $[136] !== t21 || $[137] !== t45 || $[138] !== t55 || $[139] !== t66 || $[140] !== t77) {
1091
- t78 = /* @__PURE__ */ jsx(DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1092
- t14,
1093
- t21,
1094
- t45,
1095
- t55,
1096
- t66,
1097
- t77
1098
- ] }) });
1099
- $[135] = t14;
1100
- $[136] = t21;
1101
- $[137] = t45;
1102
- $[138] = t55;
1103
- $[139] = t66;
1104
- $[140] = t77;
1105
- $[141] = t78;
1165
+ if ($[168] !== setFieldValue) {
1166
+ t77 = (event) => setFieldValue("config.createCollections", event.target.value === "true");
1167
+ $[168] = setFieldValue;
1168
+ $[169] = t77;
1106
1169
  } else {
1107
- t78 = $[141];
1170
+ t77 = $[169];
1108
1171
  }
1172
+ const t78 = isAdmin || values_0.config?.createCollections ? "true" : "false";
1109
1173
  let t79;
1110
- if ($[142] !== savingError) {
1111
- t79 = savingError && /* @__PURE__ */ jsx(Typography, { className: "text-red-500 dark:text-red-500", children: savingError.message ?? "There was an error saving this role" });
1112
- $[142] = savingError;
1113
- $[143] = t79;
1174
+ if ($[170] !== t) {
1175
+ t79 = (value) => value === "true" ? t("yes") : t("no");
1176
+ $[170] = t;
1177
+ $[171] = t79;
1114
1178
  } else {
1115
- t79 = $[143];
1179
+ t79 = $[171];
1116
1180
  }
1117
1181
  let t80;
1118
- if ($[144] !== handleClose) {
1119
- t80 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
1120
- handleClose();
1121
- }, children: "Cancel" });
1122
- $[144] = handleClose;
1123
- $[145] = t80;
1182
+ if ($[172] !== t) {
1183
+ t80 = t("yes");
1184
+ $[172] = t;
1185
+ $[173] = t80;
1124
1186
  } else {
1125
- t80 = $[145];
1187
+ t80 = $[173];
1188
+ }
1189
+ let t81;
1190
+ if ($[174] !== t80) {
1191
+ t81 = /* @__PURE__ */ jsxs(SelectItem, { value: "true", children: [
1192
+ " ",
1193
+ t80,
1194
+ " "
1195
+ ] });
1196
+ $[174] = t80;
1197
+ $[175] = t81;
1198
+ } else {
1199
+ t81 = $[175];
1200
+ }
1201
+ let t82;
1202
+ if ($[176] !== t) {
1203
+ t82 = t("no");
1204
+ $[176] = t;
1205
+ $[177] = t82;
1206
+ } else {
1207
+ t82 = $[177];
1126
1208
  }
1127
- const t81 = !dirty;
1128
- const t82 = isNewRole ? "Create role" : "Update";
1129
1209
  let t83;
1130
- if ($[146] !== isSubmitting || $[147] !== t81 || $[148] !== t82) {
1131
- t83 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t81, loading: isSubmitting, children: t82 });
1132
- $[146] = isSubmitting;
1133
- $[147] = t81;
1134
- $[148] = t82;
1135
- $[149] = t83;
1210
+ if ($[178] !== t82) {
1211
+ t83 = /* @__PURE__ */ jsxs(SelectItem, { value: "false", children: [
1212
+ " ",
1213
+ t82,
1214
+ " "
1215
+ ] });
1216
+ $[178] = t82;
1217
+ $[179] = t83;
1136
1218
  } else {
1137
- t83 = $[149];
1219
+ t83 = $[179];
1138
1220
  }
1139
1221
  let t84;
1140
- if ($[150] !== t79 || $[151] !== t80 || $[152] !== t83) {
1141
- t84 = /* @__PURE__ */ jsxs(DialogActions, { position: "sticky", children: [
1142
- t79,
1143
- t80,
1222
+ if ($[180] !== t74 || $[181] !== t75 || $[182] !== t76 || $[183] !== t77 || $[184] !== t78 || $[185] !== t79 || $[186] !== t81 || $[187] !== t83) {
1223
+ t84 = /* @__PURE__ */ jsxs(Select, { error: t74, size: "large", fullWidth: true, id: "createCollections", name: "createCollections", label: t75, position: "item-aligned", disabled: t76, onChange: t77, value: t78, renderValue: t79, children: [
1224
+ t81,
1144
1225
  t83
1145
1226
  ] });
1146
- $[150] = t79;
1147
- $[151] = t80;
1148
- $[152] = t83;
1149
- $[153] = t84;
1150
- } else {
1151
- t84 = $[153];
1227
+ $[180] = t74;
1228
+ $[181] = t75;
1229
+ $[182] = t76;
1230
+ $[183] = t77;
1231
+ $[184] = t78;
1232
+ $[185] = t79;
1233
+ $[186] = t81;
1234
+ $[187] = t83;
1235
+ $[188] = t84;
1236
+ } else {
1237
+ t84 = $[188];
1152
1238
  }
1153
1239
  let t85;
1154
- if ($[154] !== formex.handleSubmit || $[155] !== t78 || $[156] !== t84) {
1155
- t85 = /* @__PURE__ */ jsxs("form", { noValidate: true, autoComplete: "off", onSubmit: formex.handleSubmit, style: t7, children: [
1156
- t8,
1157
- t78,
1158
- t84
1159
- ] });
1160
- $[154] = formex.handleSubmit;
1161
- $[155] = t78;
1162
- $[156] = t84;
1163
- $[157] = t85;
1240
+ if ($[189] !== errors_0 || $[190] !== t || $[191] !== touched.config) {
1241
+ t85 = touched.config && Boolean(errors_0.config) ? errors_0.config : t("can_user_create_collections");
1242
+ $[189] = errors_0;
1243
+ $[190] = t;
1244
+ $[191] = touched.config;
1245
+ $[192] = t85;
1164
1246
  } else {
1165
- t85 = $[157];
1247
+ t85 = $[192];
1166
1248
  }
1167
1249
  let t86;
1168
- if ($[158] !== formex || $[159] !== t85) {
1169
- t86 = /* @__PURE__ */ jsx(Formex, { value: formex, children: t85 });
1170
- $[158] = formex;
1171
- $[159] = t85;
1172
- $[160] = t86;
1250
+ if ($[193] !== t85) {
1251
+ t86 = /* @__PURE__ */ jsx(FieldCaption, { children: t85 });
1252
+ $[193] = t85;
1253
+ $[194] = t86;
1173
1254
  } else {
1174
- t86 = $[160];
1255
+ t86 = $[194];
1175
1256
  }
1176
1257
  let t87;
1177
- if ($[161] !== open || $[162] !== t86) {
1178
- t87 = /* @__PURE__ */ jsx(Dialog, { open, maxWidth: "4xl", children: t86 });
1179
- $[161] = open;
1180
- $[162] = t86;
1181
- $[163] = t87;
1258
+ if ($[195] !== t84 || $[196] !== t86) {
1259
+ t87 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1260
+ t84,
1261
+ t86
1262
+ ] });
1263
+ $[195] = t84;
1264
+ $[196] = t86;
1265
+ $[197] = t87;
1266
+ } else {
1267
+ t87 = $[197];
1268
+ }
1269
+ const t88 = touched.config && Boolean(errors_0.config);
1270
+ let t89;
1271
+ if ($[198] !== t) {
1272
+ t89 = t("edit_collections");
1273
+ $[198] = t;
1274
+ $[199] = t89;
1275
+ } else {
1276
+ t89 = $[199];
1277
+ }
1278
+ const t90 = isAdmin || !editable;
1279
+ let t91;
1280
+ if ($[200] !== setFieldValue) {
1281
+ t91 = (event_0) => setFieldValue("config.editCollections", event_0.target.value === "own" ? "own" : event_0.target.value === "true");
1282
+ $[200] = setFieldValue;
1283
+ $[201] = t91;
1284
+ } else {
1285
+ t91 = $[201];
1286
+ }
1287
+ const t92 = isAdmin ? "true" : values_0.config?.editCollections === "own" ? "own" : values_0.config?.editCollections ? "true" : "false";
1288
+ let t93;
1289
+ if ($[202] !== t) {
1290
+ t93 = (value_0) => value_0 === "own" ? t("own") : value_0 === "true" ? t("yes") : t("no");
1291
+ $[202] = t;
1292
+ $[203] = t93;
1293
+ } else {
1294
+ t93 = $[203];
1295
+ }
1296
+ let t94;
1297
+ if ($[204] !== t) {
1298
+ t94 = t("yes");
1299
+ $[204] = t;
1300
+ $[205] = t94;
1301
+ } else {
1302
+ t94 = $[205];
1303
+ }
1304
+ let t95;
1305
+ if ($[206] !== t94) {
1306
+ t95 = /* @__PURE__ */ jsxs(SelectItem, { value: "true", children: [
1307
+ " ",
1308
+ t94,
1309
+ " "
1310
+ ] });
1311
+ $[206] = t94;
1312
+ $[207] = t95;
1182
1313
  } else {
1183
- t87 = $[163];
1314
+ t95 = $[207];
1184
1315
  }
1185
- return t87;
1186
- }
1187
- function _temp6$1(value_1) {
1188
- return value_1 === "own" ? "Own" : value_1 === "true" ? "Yes" : "No";
1189
- }
1190
- function _temp5$1(value_0) {
1191
- return value_0 === "own" ? "Own" : value_0 === "true" ? "Yes" : "No";
1192
- }
1193
- function _temp4$1(value) {
1194
- return value === "true" ? "Yes" : "No";
1195
- }
1196
- function _temp3$1(values) {
1197
- return RoleYupSchema.validate(values, {
1198
- abortEarly: false
1199
- }).then(_temp$3).catch(_temp2$1);
1316
+ let t96;
1317
+ if ($[208] !== t) {
1318
+ t96 = t("no");
1319
+ $[208] = t;
1320
+ $[209] = t96;
1321
+ } else {
1322
+ t96 = $[209];
1323
+ }
1324
+ let t97;
1325
+ if ($[210] !== t96) {
1326
+ t97 = /* @__PURE__ */ jsxs(SelectItem, { value: "false", children: [
1327
+ " ",
1328
+ t96,
1329
+ " "
1330
+ ] });
1331
+ $[210] = t96;
1332
+ $[211] = t97;
1333
+ } else {
1334
+ t97 = $[211];
1335
+ }
1336
+ let t98;
1337
+ if ($[212] !== t) {
1338
+ t98 = t("only_own_collections");
1339
+ $[212] = t;
1340
+ $[213] = t98;
1341
+ } else {
1342
+ t98 = $[213];
1343
+ }
1344
+ let t99;
1345
+ if ($[214] !== t98) {
1346
+ t99 = /* @__PURE__ */ jsxs(SelectItem, { value: "own", children: [
1347
+ " ",
1348
+ t98,
1349
+ " "
1350
+ ] });
1351
+ $[214] = t98;
1352
+ $[215] = t99;
1353
+ } else {
1354
+ t99 = $[215];
1355
+ }
1356
+ let t100;
1357
+ if ($[216] !== t88 || $[217] !== t89 || $[218] !== t90 || $[219] !== t91 || $[220] !== t92 || $[221] !== t93 || $[222] !== t95 || $[223] !== t97 || $[224] !== t99) {
1358
+ t100 = /* @__PURE__ */ jsxs(Select, { size: "large", fullWidth: true, error: t88, id: "editCollections", name: "editCollections", label: t89, disabled: t90, position: "item-aligned", onChange: t91, value: t92, renderValue: t93, children: [
1359
+ t95,
1360
+ t97,
1361
+ t99
1362
+ ] });
1363
+ $[216] = t88;
1364
+ $[217] = t89;
1365
+ $[218] = t90;
1366
+ $[219] = t91;
1367
+ $[220] = t92;
1368
+ $[221] = t93;
1369
+ $[222] = t95;
1370
+ $[223] = t97;
1371
+ $[224] = t99;
1372
+ $[225] = t100;
1373
+ } else {
1374
+ t100 = $[225];
1375
+ }
1376
+ let t101;
1377
+ if ($[226] !== errors_0 || $[227] !== t || $[228] !== touched.config) {
1378
+ t101 = touched.config && Boolean(errors_0.config) ? errors_0.config : t("can_user_edit_collections");
1379
+ $[226] = errors_0;
1380
+ $[227] = t;
1381
+ $[228] = touched.config;
1382
+ $[229] = t101;
1383
+ } else {
1384
+ t101 = $[229];
1385
+ }
1386
+ let t102;
1387
+ if ($[230] !== t101) {
1388
+ t102 = /* @__PURE__ */ jsx(FieldCaption, { children: t101 });
1389
+ $[230] = t101;
1390
+ $[231] = t102;
1391
+ } else {
1392
+ t102 = $[231];
1393
+ }
1394
+ let t103;
1395
+ if ($[232] !== t100 || $[233] !== t102) {
1396
+ t103 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1397
+ t100,
1398
+ t102
1399
+ ] });
1400
+ $[232] = t100;
1401
+ $[233] = t102;
1402
+ $[234] = t103;
1403
+ } else {
1404
+ t103 = $[234];
1405
+ }
1406
+ const t104 = touched.config && Boolean(errors_0.config);
1407
+ let t105;
1408
+ if ($[235] !== t) {
1409
+ t105 = t("delete_collections");
1410
+ $[235] = t;
1411
+ $[236] = t105;
1412
+ } else {
1413
+ t105 = $[236];
1414
+ }
1415
+ const t106 = isAdmin || !editable;
1416
+ let t107;
1417
+ if ($[237] !== setFieldValue) {
1418
+ t107 = (event_1) => setFieldValue("config.deleteCollections", event_1.target.value === "own" ? "own" : event_1.target.value === "true");
1419
+ $[237] = setFieldValue;
1420
+ $[238] = t107;
1421
+ } else {
1422
+ t107 = $[238];
1423
+ }
1424
+ const t108 = isAdmin ? "true" : values_0.config?.deleteCollections === "own" ? "own" : values_0.config?.deleteCollections ? "true" : "false";
1425
+ let t109;
1426
+ if ($[239] !== t) {
1427
+ t109 = (value_1) => value_1 === "own" ? t("own") : value_1 === "true" ? t("yes") : t("no");
1428
+ $[239] = t;
1429
+ $[240] = t109;
1430
+ } else {
1431
+ t109 = $[240];
1432
+ }
1433
+ let t110;
1434
+ if ($[241] !== t) {
1435
+ t110 = t("yes");
1436
+ $[241] = t;
1437
+ $[242] = t110;
1438
+ } else {
1439
+ t110 = $[242];
1440
+ }
1441
+ let t111;
1442
+ if ($[243] !== t110) {
1443
+ t111 = /* @__PURE__ */ jsxs(SelectItem, { value: "true", children: [
1444
+ " ",
1445
+ t110,
1446
+ " "
1447
+ ] });
1448
+ $[243] = t110;
1449
+ $[244] = t111;
1450
+ } else {
1451
+ t111 = $[244];
1452
+ }
1453
+ let t112;
1454
+ if ($[245] !== t) {
1455
+ t112 = t("no");
1456
+ $[245] = t;
1457
+ $[246] = t112;
1458
+ } else {
1459
+ t112 = $[246];
1460
+ }
1461
+ let t113;
1462
+ if ($[247] !== t112) {
1463
+ t113 = /* @__PURE__ */ jsxs(SelectItem, { value: "false", children: [
1464
+ " ",
1465
+ t112,
1466
+ " "
1467
+ ] });
1468
+ $[247] = t112;
1469
+ $[248] = t113;
1470
+ } else {
1471
+ t113 = $[248];
1472
+ }
1473
+ let t114;
1474
+ if ($[249] !== t) {
1475
+ t114 = t("only_own_collections");
1476
+ $[249] = t;
1477
+ $[250] = t114;
1478
+ } else {
1479
+ t114 = $[250];
1480
+ }
1481
+ let t115;
1482
+ if ($[251] !== t114) {
1483
+ t115 = /* @__PURE__ */ jsxs(SelectItem, { value: "own", children: [
1484
+ " ",
1485
+ t114,
1486
+ " "
1487
+ ] });
1488
+ $[251] = t114;
1489
+ $[252] = t115;
1490
+ } else {
1491
+ t115 = $[252];
1492
+ }
1493
+ let t116;
1494
+ if ($[253] !== t104 || $[254] !== t105 || $[255] !== t106 || $[256] !== t107 || $[257] !== t108 || $[258] !== t109 || $[259] !== t111 || $[260] !== t113 || $[261] !== t115) {
1495
+ t116 = /* @__PURE__ */ jsxs(Select, { size: "large", fullWidth: true, error: t104, id: "deleteCollections", name: "deleteCollections", label: t105, disabled: t106, position: "item-aligned", onChange: t107, value: t108, renderValue: t109, children: [
1496
+ t111,
1497
+ t113,
1498
+ t115
1499
+ ] });
1500
+ $[253] = t104;
1501
+ $[254] = t105;
1502
+ $[255] = t106;
1503
+ $[256] = t107;
1504
+ $[257] = t108;
1505
+ $[258] = t109;
1506
+ $[259] = t111;
1507
+ $[260] = t113;
1508
+ $[261] = t115;
1509
+ $[262] = t116;
1510
+ } else {
1511
+ t116 = $[262];
1512
+ }
1513
+ let t117;
1514
+ if ($[263] !== errors_0 || $[264] !== t || $[265] !== touched.config) {
1515
+ t117 = touched.config && Boolean(errors_0.config) ? errors_0.config : t("can_user_delete_collections");
1516
+ $[263] = errors_0;
1517
+ $[264] = t;
1518
+ $[265] = touched.config;
1519
+ $[266] = t117;
1520
+ } else {
1521
+ t117 = $[266];
1522
+ }
1523
+ let t118;
1524
+ if ($[267] !== t117) {
1525
+ t118 = /* @__PURE__ */ jsx(FieldCaption, { children: t117 });
1526
+ $[267] = t117;
1527
+ $[268] = t118;
1528
+ } else {
1529
+ t118 = $[268];
1530
+ }
1531
+ let t119;
1532
+ if ($[269] !== t116 || $[270] !== t118) {
1533
+ t119 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1534
+ t116,
1535
+ t118
1536
+ ] });
1537
+ $[269] = t116;
1538
+ $[270] = t118;
1539
+ $[271] = t119;
1540
+ } else {
1541
+ t119 = $[271];
1542
+ }
1543
+ let t120;
1544
+ if ($[272] !== t103 || $[273] !== t119 || $[274] !== t19 || $[275] !== t28 || $[276] !== t73 || $[277] !== t87) {
1545
+ t120 = /* @__PURE__ */ jsx(DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1546
+ t19,
1547
+ t28,
1548
+ t73,
1549
+ t87,
1550
+ t103,
1551
+ t119
1552
+ ] }) });
1553
+ $[272] = t103;
1554
+ $[273] = t119;
1555
+ $[274] = t19;
1556
+ $[275] = t28;
1557
+ $[276] = t73;
1558
+ $[277] = t87;
1559
+ $[278] = t120;
1560
+ } else {
1561
+ t120 = $[278];
1562
+ }
1563
+ let t121;
1564
+ if ($[279] !== savingError || $[280] !== t) {
1565
+ t121 = savingError && /* @__PURE__ */ jsx(Typography, { className: "text-red-500 dark:text-red-500", children: savingError.message ?? t("error_saving_role") });
1566
+ $[279] = savingError;
1567
+ $[280] = t;
1568
+ $[281] = t121;
1569
+ } else {
1570
+ t121 = $[281];
1571
+ }
1572
+ let t122;
1573
+ if ($[282] !== handleClose) {
1574
+ t122 = () => {
1575
+ handleClose();
1576
+ };
1577
+ $[282] = handleClose;
1578
+ $[283] = t122;
1579
+ } else {
1580
+ t122 = $[283];
1581
+ }
1582
+ let t123;
1583
+ if ($[284] !== t) {
1584
+ t123 = t("cancel");
1585
+ $[284] = t;
1586
+ $[285] = t123;
1587
+ } else {
1588
+ t123 = $[285];
1589
+ }
1590
+ let t124;
1591
+ if ($[286] !== t122 || $[287] !== t123) {
1592
+ t124 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: t122, children: t123 });
1593
+ $[286] = t122;
1594
+ $[287] = t123;
1595
+ $[288] = t124;
1596
+ } else {
1597
+ t124 = $[288];
1598
+ }
1599
+ const t125 = !dirty;
1600
+ let t126;
1601
+ if ($[289] !== isNewRole || $[290] !== t) {
1602
+ t126 = isNewRole ? t("create_role") : t("update");
1603
+ $[289] = isNewRole;
1604
+ $[290] = t;
1605
+ $[291] = t126;
1606
+ } else {
1607
+ t126 = $[291];
1608
+ }
1609
+ let t127;
1610
+ if ($[292] !== isSubmitting || $[293] !== t125 || $[294] !== t126) {
1611
+ t127 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t125, loading: isSubmitting, children: t126 });
1612
+ $[292] = isSubmitting;
1613
+ $[293] = t125;
1614
+ $[294] = t126;
1615
+ $[295] = t127;
1616
+ } else {
1617
+ t127 = $[295];
1618
+ }
1619
+ let t128;
1620
+ if ($[296] !== t121 || $[297] !== t124 || $[298] !== t127) {
1621
+ t128 = /* @__PURE__ */ jsxs(DialogActions, { position: "sticky", children: [
1622
+ t121,
1623
+ t124,
1624
+ t127
1625
+ ] });
1626
+ $[296] = t121;
1627
+ $[297] = t124;
1628
+ $[298] = t127;
1629
+ $[299] = t128;
1630
+ } else {
1631
+ t128 = $[299];
1632
+ }
1633
+ let t129;
1634
+ if ($[300] !== formex.handleSubmit || $[301] !== t11 || $[302] !== t120 || $[303] !== t128) {
1635
+ t129 = /* @__PURE__ */ jsxs("form", { noValidate: true, autoComplete: "off", onSubmit: t8, style: t9, children: [
1636
+ t11,
1637
+ t120,
1638
+ t128
1639
+ ] });
1640
+ $[300] = formex.handleSubmit;
1641
+ $[301] = t11;
1642
+ $[302] = t120;
1643
+ $[303] = t128;
1644
+ $[304] = t129;
1645
+ } else {
1646
+ t129 = $[304];
1647
+ }
1648
+ let t130;
1649
+ if ($[305] !== formex || $[306] !== t129) {
1650
+ t130 = /* @__PURE__ */ jsx(Formex, { value: formex, children: t129 });
1651
+ $[305] = formex;
1652
+ $[306] = t129;
1653
+ $[307] = t130;
1654
+ } else {
1655
+ t130 = $[307];
1656
+ }
1657
+ let t131;
1658
+ if ($[308] !== open || $[309] !== t130) {
1659
+ t131 = /* @__PURE__ */ jsx(Dialog, { open, maxWidth: "4xl", children: t130 });
1660
+ $[308] = open;
1661
+ $[309] = t130;
1662
+ $[310] = t131;
1663
+ } else {
1664
+ t131 = $[310];
1665
+ }
1666
+ return t131;
1200
1667
  }
1201
1668
  function _temp2$1(e_1) {
1202
1669
  const errors = {};
@@ -1239,11 +1706,14 @@ const DEFAULT_ROLES = [{
1239
1706
  }
1240
1707
  }];
1241
1708
  function RolesTable(t0) {
1242
- const $ = c(25);
1709
+ const $ = c(54);
1243
1710
  const {
1244
1711
  onRoleClicked,
1245
1712
  editable
1246
1713
  } = t0;
1714
+ const {
1715
+ t
1716
+ } = useTranslation();
1247
1717
  const {
1248
1718
  roles,
1249
1719
  saveRole,
@@ -1254,19 +1724,77 @@ function RolesTable(t0) {
1254
1724
  const [deleteInProgress, setDeleteInProgress] = useState(false);
1255
1725
  let t1;
1256
1726
  if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1257
- t1 = /* @__PURE__ */ jsxs(TableHeader, { children: [
1258
- /* @__PURE__ */ jsx(TableCell, { header: true, className: "w-16" }),
1259
- /* @__PURE__ */ jsx(TableCell, { header: true, children: "Role" }),
1260
- /* @__PURE__ */ jsx(TableCell, { header: true, className: "items-center", children: "Is Admin" }),
1261
- /* @__PURE__ */ jsx(TableCell, { header: true, children: "Default permissions" })
1262
- ] });
1727
+ t1 = /* @__PURE__ */ jsx(TableCell, { header: true, className: "w-16" });
1263
1728
  $[0] = t1;
1264
1729
  } else {
1265
1730
  t1 = $[0];
1266
1731
  }
1267
1732
  let t2;
1268
- if ($[1] !== editable || $[2] !== onRoleClicked || $[3] !== roles) {
1269
- t2 = roles && roles.map((role) => {
1733
+ if ($[1] !== t) {
1734
+ t2 = t("role");
1735
+ $[1] = t;
1736
+ $[2] = t2;
1737
+ } else {
1738
+ t2 = $[2];
1739
+ }
1740
+ let t3;
1741
+ if ($[3] !== t2) {
1742
+ t3 = /* @__PURE__ */ jsx(TableCell, { header: true, children: t2 });
1743
+ $[3] = t2;
1744
+ $[4] = t3;
1745
+ } else {
1746
+ t3 = $[4];
1747
+ }
1748
+ let t4;
1749
+ if ($[5] !== t) {
1750
+ t4 = t("is_admin");
1751
+ $[5] = t;
1752
+ $[6] = t4;
1753
+ } else {
1754
+ t4 = $[6];
1755
+ }
1756
+ let t5;
1757
+ if ($[7] !== t4) {
1758
+ t5 = /* @__PURE__ */ jsx(TableCell, { header: true, className: "items-center", children: t4 });
1759
+ $[7] = t4;
1760
+ $[8] = t5;
1761
+ } else {
1762
+ t5 = $[8];
1763
+ }
1764
+ let t6;
1765
+ if ($[9] !== t) {
1766
+ t6 = t("default_permissions");
1767
+ $[9] = t;
1768
+ $[10] = t6;
1769
+ } else {
1770
+ t6 = $[10];
1771
+ }
1772
+ let t7;
1773
+ if ($[11] !== t6) {
1774
+ t7 = /* @__PURE__ */ jsx(TableCell, { header: true, children: t6 });
1775
+ $[11] = t6;
1776
+ $[12] = t7;
1777
+ } else {
1778
+ t7 = $[12];
1779
+ }
1780
+ let t8;
1781
+ if ($[13] !== t3 || $[14] !== t5 || $[15] !== t7) {
1782
+ t8 = /* @__PURE__ */ jsxs(TableHeader, { children: [
1783
+ t1,
1784
+ t3,
1785
+ t5,
1786
+ t7
1787
+ ] });
1788
+ $[13] = t3;
1789
+ $[14] = t5;
1790
+ $[15] = t7;
1791
+ $[16] = t8;
1792
+ } else {
1793
+ t8 = $[16];
1794
+ }
1795
+ let t9;
1796
+ if ($[17] !== editable || $[18] !== onRoleClicked || $[19] !== roles || $[20] !== t) {
1797
+ t9 = roles && roles.map((role) => {
1270
1798
  const canCreateAll = role.isAdmin || role.defaultPermissions?.create;
1271
1799
  const canReadAll = role.isAdmin || role.defaultPermissions?.read;
1272
1800
  const canUpdateAll = role.isAdmin || role.defaultPermissions?.edit;
@@ -1276,63 +1804,74 @@ function RolesTable(t0) {
1276
1804
  }, children: [
1277
1805
  /* @__PURE__ */ jsx(TableCell, { style: {
1278
1806
  width: "64px"
1279
- }, children: !role.isAdmin && /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: "Delete this role", children: /* @__PURE__ */ jsx(IconButton, { size: "small", disabled: !editable, onClick: (event) => {
1807
+ }, children: !role.isAdmin && /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: t("delete_this_role"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", disabled: !editable, onClick: (event) => {
1280
1808
  event.stopPropagation();
1281
1809
  return setRoleToBeDeleted(role);
1282
1810
  }, children: /* @__PURE__ */ jsx(DeleteIcon, {}) }) }) }),
1283
1811
  /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(RoleChip, { role }) }),
1284
1812
  /* @__PURE__ */ jsx(TableCell, { className: "items-center", children: /* @__PURE__ */ jsx(Checkbox, { checked: role.isAdmin ?? false }) }),
1285
1813
  /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("ul", { children: [
1286
- canCreateAll && /* @__PURE__ */ jsx("li", { children: "Create" }),
1287
- canReadAll && /* @__PURE__ */ jsx("li", { children: "Read" }),
1288
- canUpdateAll && /* @__PURE__ */ jsx("li", { children: "Update" }),
1289
- canDeleteAll && /* @__PURE__ */ jsx("li", { children: "Delete" })
1814
+ canCreateAll && /* @__PURE__ */ jsx("li", { children: t("create") }),
1815
+ canReadAll && /* @__PURE__ */ jsx("li", { children: t("read") }),
1816
+ canUpdateAll && /* @__PURE__ */ jsx("li", { children: t("update") }),
1817
+ canDeleteAll && /* @__PURE__ */ jsx("li", { children: t("delete") })
1290
1818
  ] }) })
1291
1819
  ] }, role.name);
1292
1820
  });
1293
- $[1] = editable;
1294
- $[2] = onRoleClicked;
1295
- $[3] = roles;
1296
- $[4] = t2;
1821
+ $[17] = editable;
1822
+ $[18] = onRoleClicked;
1823
+ $[19] = roles;
1824
+ $[20] = t;
1825
+ $[21] = t9;
1297
1826
  } else {
1298
- t2 = $[4];
1827
+ t9 = $[21];
1299
1828
  }
1300
- let t3;
1301
- if ($[5] !== allowDefaultRolesCreation || $[6] !== roles || $[7] !== saveRole) {
1302
- t3 = (!roles || roles.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 4, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
1303
- /* @__PURE__ */ jsx(Typography, { variant: "label", children: "You don't have any roles yet." }),
1829
+ let t10;
1830
+ if ($[22] !== allowDefaultRolesCreation || $[23] !== roles || $[24] !== saveRole || $[25] !== t) {
1831
+ t10 = (!roles || roles.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 4, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
1832
+ /* @__PURE__ */ jsx(Typography, { variant: "label", children: t("no_roles_yet") }),
1304
1833
  allowDefaultRolesCreation && /* @__PURE__ */ jsx(Button, { onClick: () => {
1305
1834
  DEFAULT_ROLES.forEach((role_0) => {
1306
1835
  saveRole(role_0);
1307
1836
  });
1308
- }, children: "Create default roles" })
1837
+ }, children: t("create_default_roles") })
1309
1838
  ] }) }) });
1310
- $[5] = allowDefaultRolesCreation;
1311
- $[6] = roles;
1312
- $[7] = saveRole;
1313
- $[8] = t3;
1839
+ $[22] = allowDefaultRolesCreation;
1840
+ $[23] = roles;
1841
+ $[24] = saveRole;
1842
+ $[25] = t;
1843
+ $[26] = t10;
1314
1844
  } else {
1315
- t3 = $[8];
1845
+ t10 = $[26];
1316
1846
  }
1317
- let t4;
1318
- if ($[9] !== t2 || $[10] !== t3) {
1319
- t4 = /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
1320
- t1,
1321
- /* @__PURE__ */ jsxs(TableBody, { children: [
1322
- t2,
1323
- t3
1324
- ] })
1847
+ let t11;
1848
+ if ($[27] !== t10 || $[28] !== t9) {
1849
+ t11 = /* @__PURE__ */ jsxs(TableBody, { children: [
1850
+ t9,
1851
+ t10
1325
1852
  ] });
1326
- $[9] = t2;
1327
- $[10] = t3;
1328
- $[11] = t4;
1853
+ $[27] = t10;
1854
+ $[28] = t9;
1855
+ $[29] = t11;
1329
1856
  } else {
1330
- t4 = $[11];
1857
+ t11 = $[29];
1331
1858
  }
1332
- const t5 = Boolean(roleToBeDeleted);
1333
- let t6;
1334
- if ($[12] !== deleteRole || $[13] !== roleToBeDeleted) {
1335
- t6 = () => {
1859
+ let t12;
1860
+ if ($[30] !== t11 || $[31] !== t8) {
1861
+ t12 = /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
1862
+ t8,
1863
+ t11
1864
+ ] });
1865
+ $[30] = t11;
1866
+ $[31] = t8;
1867
+ $[32] = t12;
1868
+ } else {
1869
+ t12 = $[32];
1870
+ }
1871
+ const t13 = Boolean(roleToBeDeleted);
1872
+ let t14;
1873
+ if ($[33] !== deleteRole || $[34] !== roleToBeDeleted) {
1874
+ t14 = () => {
1336
1875
  if (roleToBeDeleted) {
1337
1876
  setDeleteInProgress(true);
1338
1877
  deleteRole(roleToBeDeleted).then(() => {
@@ -1342,58 +1881,87 @@ function RolesTable(t0) {
1342
1881
  });
1343
1882
  }
1344
1883
  };
1345
- $[12] = deleteRole;
1346
- $[13] = roleToBeDeleted;
1347
- $[14] = t6;
1884
+ $[33] = deleteRole;
1885
+ $[34] = roleToBeDeleted;
1886
+ $[35] = t14;
1348
1887
  } else {
1349
- t6 = $[14];
1888
+ t14 = $[35];
1350
1889
  }
1351
- let t7;
1352
- let t8;
1353
- let t9;
1354
- if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1355
- t7 = () => {
1890
+ let t15;
1891
+ if ($[36] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1892
+ t15 = () => {
1356
1893
  setRoleToBeDeleted(void 0);
1357
1894
  };
1358
- t8 = /* @__PURE__ */ jsx(Fragment, { children: "Delete?" });
1359
- t9 = /* @__PURE__ */ jsx(Fragment, { children: "Are you sure you want to delete this role?" });
1360
- $[15] = t7;
1361
- $[16] = t8;
1362
- $[17] = t9;
1895
+ $[36] = t15;
1363
1896
  } else {
1364
- t7 = $[15];
1365
- t8 = $[16];
1366
- t9 = $[17];
1897
+ t15 = $[36];
1367
1898
  }
1368
- let t10;
1369
- if ($[18] !== deleteInProgress || $[19] !== t5 || $[20] !== t6) {
1370
- t10 = /* @__PURE__ */ jsx(ConfirmationDialog, { open: t5, loading: deleteInProgress, onAccept: t6, onCancel: t7, title: t8, body: t9 });
1371
- $[18] = deleteInProgress;
1372
- $[19] = t5;
1373
- $[20] = t6;
1374
- $[21] = t10;
1899
+ let t16;
1900
+ if ($[37] !== t) {
1901
+ t16 = t("delete_confirmation_title");
1902
+ $[37] = t;
1903
+ $[38] = t16;
1375
1904
  } else {
1376
- t10 = $[21];
1905
+ t16 = $[38];
1377
1906
  }
1378
- let t11;
1379
- if ($[22] !== t10 || $[23] !== t4) {
1380
- t11 = /* @__PURE__ */ jsxs("div", { className: "w-full overflow-auto", children: [
1381
- t4,
1382
- t10
1907
+ let t17;
1908
+ if ($[39] !== t16) {
1909
+ t17 = /* @__PURE__ */ jsx(Fragment, { children: t16 });
1910
+ $[39] = t16;
1911
+ $[40] = t17;
1912
+ } else {
1913
+ t17 = $[40];
1914
+ }
1915
+ let t18;
1916
+ if ($[41] !== t) {
1917
+ t18 = t("delete_role_confirmation");
1918
+ $[41] = t;
1919
+ $[42] = t18;
1920
+ } else {
1921
+ t18 = $[42];
1922
+ }
1923
+ let t19;
1924
+ if ($[43] !== t18) {
1925
+ t19 = /* @__PURE__ */ jsx(Fragment, { children: t18 });
1926
+ $[43] = t18;
1927
+ $[44] = t19;
1928
+ } else {
1929
+ t19 = $[44];
1930
+ }
1931
+ let t20;
1932
+ if ($[45] !== deleteInProgress || $[46] !== t13 || $[47] !== t14 || $[48] !== t17 || $[49] !== t19) {
1933
+ t20 = /* @__PURE__ */ jsx(ConfirmationDialog, { open: t13, loading: deleteInProgress, onAccept: t14, onCancel: t15, title: t17, body: t19 });
1934
+ $[45] = deleteInProgress;
1935
+ $[46] = t13;
1936
+ $[47] = t14;
1937
+ $[48] = t17;
1938
+ $[49] = t19;
1939
+ $[50] = t20;
1940
+ } else {
1941
+ t20 = $[50];
1942
+ }
1943
+ let t21;
1944
+ if ($[51] !== t12 || $[52] !== t20) {
1945
+ t21 = /* @__PURE__ */ jsxs("div", { className: "w-full overflow-auto", children: [
1946
+ t12,
1947
+ t20
1383
1948
  ] });
1384
- $[22] = t10;
1385
- $[23] = t4;
1386
- $[24] = t11;
1949
+ $[51] = t12;
1950
+ $[52] = t20;
1951
+ $[53] = t21;
1387
1952
  } else {
1388
- t11 = $[24];
1953
+ t21 = $[53];
1389
1954
  }
1390
- return t11;
1955
+ return t21;
1391
1956
  }
1392
1957
  const RolesView = React.memo(function RolesView2(t0) {
1393
- const $ = c(13);
1958
+ const $ = c(25);
1394
1959
  const {
1395
1960
  children
1396
1961
  } = t0;
1962
+ const {
1963
+ t
1964
+ } = useTranslation();
1397
1965
  const {
1398
1966
  collections
1399
1967
  } = useNavigationController();
@@ -1422,79 +1990,124 @@ const RolesView = React.memo(function RolesView2(t0) {
1422
1990
  }
1423
1991
  const handleClose = t2;
1424
1992
  let t3;
1425
- if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1426
- t3 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Roles" });
1427
- $[2] = t3;
1993
+ if ($[2] !== t) {
1994
+ t3 = t("roles");
1995
+ $[2] = t;
1996
+ $[3] = t3;
1428
1997
  } else {
1429
- t3 = $[2];
1998
+ t3 = $[3];
1430
1999
  }
1431
2000
  let t4;
2001
+ if ($[4] !== t3) {
2002
+ t4 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: t3 });
2003
+ $[4] = t3;
2004
+ $[5] = t4;
2005
+ } else {
2006
+ t4 = $[5];
2007
+ }
1432
2008
  let t5;
1433
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1434
- t4 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
1435
- t3,
1436
- /* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
1437
- ] });
1438
- t5 = /* @__PURE__ */ jsx(RolesTable, { onRoleClicked, editable: true });
1439
- $[3] = t4;
1440
- $[4] = t5;
2009
+ let t6;
2010
+ if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2011
+ t5 = /* @__PURE__ */ jsx(AddIcon, {});
2012
+ t6 = () => setDialogOpen(true);
2013
+ $[6] = t5;
2014
+ $[7] = t6;
1441
2015
  } else {
1442
- t4 = $[3];
1443
- t5 = $[4];
2016
+ t5 = $[6];
2017
+ t6 = $[7];
1444
2018
  }
1445
- const t6 = selectedRole?.id ?? "new";
1446
2019
  let t7;
1447
- if ($[5] !== collections || $[6] !== dialogOpen || $[7] !== selectedRole || $[8] !== t6) {
1448
- t7 = /* @__PURE__ */ jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t6);
1449
- $[5] = collections;
1450
- $[6] = dialogOpen;
1451
- $[7] = selectedRole;
1452
- $[8] = t6;
2020
+ if ($[8] !== t) {
2021
+ t7 = t("add_role");
2022
+ $[8] = t;
1453
2023
  $[9] = t7;
1454
2024
  } else {
1455
2025
  t7 = $[9];
1456
2026
  }
1457
2027
  let t8;
1458
- if ($[10] !== children || $[11] !== t7) {
1459
- t8 = /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
1460
- children,
2028
+ if ($[10] !== t7) {
2029
+ t8 = /* @__PURE__ */ jsx(Button, { size: "large", startIcon: t5, onClick: t6, children: t7 });
2030
+ $[10] = t7;
2031
+ $[11] = t8;
2032
+ } else {
2033
+ t8 = $[11];
2034
+ }
2035
+ let t9;
2036
+ if ($[12] !== t4 || $[13] !== t8) {
2037
+ t9 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
1461
2038
  t4,
1462
- t5,
1463
- t7
2039
+ t8
2040
+ ] });
2041
+ $[12] = t4;
2042
+ $[13] = t8;
2043
+ $[14] = t9;
2044
+ } else {
2045
+ t9 = $[14];
2046
+ }
2047
+ let t10;
2048
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2049
+ t10 = /* @__PURE__ */ jsx(RolesTable, { onRoleClicked, editable: true });
2050
+ $[15] = t10;
2051
+ } else {
2052
+ t10 = $[15];
2053
+ }
2054
+ const t11 = selectedRole?.id ?? "new";
2055
+ let t12;
2056
+ if ($[16] !== collections || $[17] !== dialogOpen || $[18] !== selectedRole || $[19] !== t11) {
2057
+ t12 = /* @__PURE__ */ jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t11);
2058
+ $[16] = collections;
2059
+ $[17] = dialogOpen;
2060
+ $[18] = selectedRole;
2061
+ $[19] = t11;
2062
+ $[20] = t12;
2063
+ } else {
2064
+ t12 = $[20];
2065
+ }
2066
+ let t13;
2067
+ if ($[21] !== children || $[22] !== t12 || $[23] !== t9) {
2068
+ t13 = /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2069
+ children,
2070
+ t9,
2071
+ t10,
2072
+ t12
1464
2073
  ] });
1465
- $[10] = children;
1466
- $[11] = t7;
1467
- $[12] = t8;
2074
+ $[21] = children;
2075
+ $[22] = t12;
2076
+ $[23] = t9;
2077
+ $[24] = t13;
1468
2078
  } else {
1469
- t8 = $[12];
2079
+ t13 = $[24];
1470
2080
  }
1471
- return t8;
2081
+ return t13;
1472
2082
  });
1473
- const UserYupSchema = Yup.object().shape({
1474
- displayName: Yup.string().required("Required"),
1475
- email: Yup.string().email().required("Required"),
2083
+ const getUserYupSchema = (t) => Yup.object().shape({
2084
+ displayName: Yup.string().required(t("required")),
2085
+ email: Yup.string().email().required(t("required")),
1476
2086
  roles: Yup.array().min(1)
1477
2087
  });
1478
- function canUserBeEdited(loggedUser, user, users, roles, prevUser) {
2088
+ function canUserBeEdited(loggedUser, user, users, roles, t, prevUser) {
1479
2089
  const admins = users.filter((u) => u.roles?.map((r) => r.id).includes("admin"));
1480
2090
  const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
1481
2091
  const didRolesChange = !prevUser || !areRolesEqual(prevUser.roles ?? [], user.roles ?? []);
1482
2092
  if (didRolesChange && !loggedUserIsAdmin) {
1483
- throw new Error("Only admins can change roles");
2093
+ throw new Error(t("only_admins_change_roles"));
1484
2094
  }
1485
2095
  const adminRoleRemoved = prevUser && prevUser.roles?.map((r) => r.id).includes("admin") && !user.roles?.map((r) => r.id).includes("admin");
1486
2096
  if (adminRoleRemoved && admins.length === 1) {
1487
- throw new Error("There must be at least one admin");
2097
+ throw new Error(t("must_be_at_least_one_admin"));
1488
2098
  }
1489
2099
  return true;
1490
2100
  }
1491
2101
  function UserDetailsForm(t0) {
1492
- const $ = c(73);
2102
+ const $ = c(114);
1493
2103
  const {
1494
2104
  open,
1495
2105
  user: userProp,
1496
2106
  handleClose
1497
2107
  } = t0;
2108
+ const {
2109
+ t
2110
+ } = useTranslation();
1498
2111
  const snackbarController = useSnackbarController();
1499
2112
  const {
1500
2113
  user: loggedInUser
@@ -1506,13 +2119,13 @@ function UserDetailsForm(t0) {
1506
2119
  } = useUserManagement();
1507
2120
  const isNewUser = !userProp;
1508
2121
  let t1;
1509
- if ($[0] !== loggedInUser || $[1] !== roles || $[2] !== saveUser || $[3] !== userProp || $[4] !== users) {
2122
+ if ($[0] !== loggedInUser || $[1] !== roles || $[2] !== saveUser || $[3] !== t || $[4] !== userProp || $[5] !== users) {
1510
2123
  t1 = (savedUser) => {
1511
2124
  if (!loggedInUser) {
1512
- throw new Error("Logged user not found");
2125
+ throw new Error(t("logged_user_not_found"));
1513
2126
  }
1514
2127
  try {
1515
- canUserBeEdited(loggedInUser, savedUser, users, roles, userProp);
2128
+ canUserBeEdited(loggedInUser, savedUser, users, roles, t, userProp);
1516
2129
  return saveUser(savedUser);
1517
2130
  } catch (t210) {
1518
2131
  const e = t210;
@@ -1522,29 +2135,40 @@ function UserDetailsForm(t0) {
1522
2135
  $[0] = loggedInUser;
1523
2136
  $[1] = roles;
1524
2137
  $[2] = saveUser;
1525
- $[3] = userProp;
1526
- $[4] = users;
1527
- $[5] = t1;
2138
+ $[3] = t;
2139
+ $[4] = userProp;
2140
+ $[5] = users;
2141
+ $[6] = t1;
1528
2142
  } else {
1529
- t1 = $[5];
2143
+ t1 = $[6];
1530
2144
  }
1531
2145
  const onUserUpdated = t1;
1532
2146
  let t2;
1533
- if ($[6] !== roles || $[7] !== userProp) {
2147
+ if ($[7] !== roles || $[8] !== userProp) {
1534
2148
  t2 = userProp ?? {
1535
2149
  displayName: "",
1536
2150
  email: "",
1537
2151
  roles: roles.filter(_temp$2)
1538
2152
  };
1539
- $[6] = roles;
1540
- $[7] = userProp;
1541
- $[8] = t2;
2153
+ $[7] = roles;
2154
+ $[8] = userProp;
2155
+ $[9] = t2;
1542
2156
  } else {
1543
- t2 = $[8];
2157
+ t2 = $[9];
1544
2158
  }
1545
2159
  let t3;
1546
- if ($[9] !== handleClose || $[10] !== onUserUpdated || $[11] !== snackbarController) {
1547
- t3 = (user, formexController) => onUserUpdated(user).then(() => {
2160
+ if ($[10] !== t) {
2161
+ t3 = (values) => getUserYupSchema(t).validate(values, {
2162
+ abortEarly: false
2163
+ }).then(_temp2).catch(_temp4);
2164
+ $[10] = t;
2165
+ $[11] = t3;
2166
+ } else {
2167
+ t3 = $[11];
2168
+ }
2169
+ let t4;
2170
+ if ($[12] !== handleClose || $[13] !== onUserUpdated || $[14] !== snackbarController) {
2171
+ t4 = (user, formexController) => onUserUpdated(user).then(() => {
1548
2172
  handleClose();
1549
2173
  formexController.resetForm({
1550
2174
  values: user
@@ -1555,27 +2179,28 @@ function UserDetailsForm(t0) {
1555
2179
  message: e_1.message
1556
2180
  });
1557
2181
  });
1558
- $[9] = handleClose;
1559
- $[10] = onUserUpdated;
1560
- $[11] = snackbarController;
1561
- $[12] = t3;
2182
+ $[12] = handleClose;
2183
+ $[13] = onUserUpdated;
2184
+ $[14] = snackbarController;
2185
+ $[15] = t4;
1562
2186
  } else {
1563
- t3 = $[12];
2187
+ t4 = $[15];
1564
2188
  }
1565
- let t4;
1566
- if ($[13] !== t2 || $[14] !== t3) {
1567
- t4 = {
2189
+ let t5;
2190
+ if ($[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
2191
+ t5 = {
1568
2192
  initialValues: t2,
1569
- validation: _temp5,
1570
- onSubmit: t3
2193
+ validation: t3,
2194
+ onSubmit: t4
1571
2195
  };
1572
- $[13] = t2;
1573
- $[14] = t3;
1574
- $[15] = t4;
2196
+ $[16] = t2;
2197
+ $[17] = t3;
2198
+ $[18] = t4;
2199
+ $[19] = t5;
1575
2200
  } else {
1576
- t4 = $[15];
2201
+ t5 = $[19];
1577
2202
  }
1578
- const formex = useCreateFormex(t4);
2203
+ const formex = useCreateFormex(t5);
1579
2204
  const {
1580
2205
  isSubmitting,
1581
2206
  handleChange,
@@ -1586,225 +2211,335 @@ function UserDetailsForm(t0) {
1586
2211
  handleSubmit,
1587
2212
  submitCount
1588
2213
  } = formex;
1589
- let t5;
1590
- if ($[16] !== handleClose) {
1591
- t5 = (open_0) => !open_0 ? handleClose() : void 0;
1592
- $[16] = handleClose;
1593
- $[17] = t5;
2214
+ let t6;
2215
+ if ($[20] !== handleClose) {
2216
+ t6 = (open_0) => !open_0 ? handleClose() : void 0;
2217
+ $[20] = handleClose;
2218
+ $[21] = t6;
1594
2219
  } else {
1595
- t5 = $[17];
2220
+ t6 = $[21];
1596
2221
  }
1597
- let t6;
1598
2222
  let t7;
1599
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1600
- t6 = {
2223
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2224
+ t7 = {
1601
2225
  display: "flex",
1602
2226
  flexDirection: "column",
1603
2227
  position: "relative",
1604
2228
  height: "100%"
1605
2229
  };
1606
- t7 = /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: "User" });
1607
- $[18] = t6;
1608
- $[19] = t7;
2230
+ $[22] = t7;
1609
2231
  } else {
1610
- t6 = $[18];
1611
- t7 = $[19];
2232
+ t7 = $[22];
1612
2233
  }
1613
- const t8 = submitCount > 0 && Boolean(errors.displayName);
1614
- const t9 = values_0.displayName ?? "";
1615
- let t10;
1616
- if ($[20] !== handleChange || $[21] !== t8 || $[22] !== t9) {
1617
- t10 = /* @__PURE__ */ jsx(TextField, { name: "displayName", required: true, error: t8, value: t9, onChange: handleChange, "aria-describedby": "name-helper-text", label: "Name" });
1618
- $[20] = handleChange;
1619
- $[21] = t8;
1620
- $[22] = t9;
1621
- $[23] = t10;
2234
+ let t8;
2235
+ if ($[23] !== t) {
2236
+ t8 = t("user");
2237
+ $[23] = t;
2238
+ $[24] = t8;
1622
2239
  } else {
1623
- t10 = $[23];
2240
+ t8 = $[24];
1624
2241
  }
1625
- const t11 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : "Name of this user";
1626
- let t12;
1627
- if ($[24] !== t11) {
1628
- t12 = /* @__PURE__ */ jsx(FieldCaption, { children: t11 });
1629
- $[24] = t11;
1630
- $[25] = t12;
2242
+ let t9;
2243
+ if ($[25] !== t8) {
2244
+ t9 = /* @__PURE__ */ jsx("div", { children: t8 });
2245
+ $[25] = t8;
2246
+ $[26] = t9;
1631
2247
  } else {
1632
- t12 = $[25];
2248
+ t9 = $[26];
1633
2249
  }
1634
- let t13;
1635
- if ($[26] !== t10 || $[27] !== t12) {
1636
- t13 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
1637
- t10,
1638
- t12
2250
+ let t10;
2251
+ if ($[27] !== isNewUser || $[28] !== snackbarController || $[29] !== t || $[30] !== userProp) {
2252
+ t10 = !isNewUser && userProp?.uid && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2253
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-surface-accent-500 dark:text-surface-accent-400 font-normal", children: userProp.uid }),
2254
+ /* @__PURE__ */ jsx(Tooltip, { title: t("copy"), children: /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: () => {
2255
+ navigator.clipboard.writeText(userProp.uid);
2256
+ snackbarController.open({
2257
+ type: "success",
2258
+ message: t("copied")
2259
+ });
2260
+ }, children: /* @__PURE__ */ jsx(CopyIcon, { size: "smallest" }) }) })
1639
2261
  ] });
1640
- $[26] = t10;
1641
- $[27] = t12;
1642
- $[28] = t13;
2262
+ $[27] = isNewUser;
2263
+ $[28] = snackbarController;
2264
+ $[29] = t;
2265
+ $[30] = userProp;
2266
+ $[31] = t10;
1643
2267
  } else {
1644
- t13 = $[28];
2268
+ t10 = $[31];
1645
2269
  }
1646
- const t14 = submitCount > 0 && Boolean(errors.email);
1647
- const t15 = values_0.email ?? "";
1648
- let t16;
1649
- if ($[29] !== handleChange || $[30] !== t14 || $[31] !== t15) {
1650
- t16 = /* @__PURE__ */ jsx(TextField, { required: true, error: t14, name: "email", value: t15, onChange: handleChange, "aria-describedby": "email-helper-text", label: "Email" });
1651
- $[29] = handleChange;
1652
- $[30] = t14;
1653
- $[31] = t15;
1654
- $[32] = t16;
2270
+ let t11;
2271
+ if ($[32] !== t10 || $[33] !== t9) {
2272
+ t11 = /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2273
+ t9,
2274
+ t10
2275
+ ] }) });
2276
+ $[32] = t10;
2277
+ $[33] = t9;
2278
+ $[34] = t11;
1655
2279
  } else {
1656
- t16 = $[32];
2280
+ t11 = $[34];
1657
2281
  }
1658
- const t17 = submitCount > 0 && Boolean(errors.email) ? errors.email : "Email of this user";
1659
- let t18;
1660
- if ($[33] !== t17) {
1661
- t18 = /* @__PURE__ */ jsx(FieldCaption, { children: t17 });
1662
- $[33] = t17;
1663
- $[34] = t18;
2282
+ const t12 = submitCount > 0 && Boolean(errors.displayName);
2283
+ const t13 = values_0.displayName ?? "";
2284
+ let t14;
2285
+ if ($[35] !== t) {
2286
+ t14 = t("name");
2287
+ $[35] = t;
2288
+ $[36] = t14;
1664
2289
  } else {
1665
- t18 = $[34];
2290
+ t14 = $[36];
1666
2291
  }
1667
- let t19;
1668
- if ($[35] !== t16 || $[36] !== t18) {
1669
- t19 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
1670
- t16,
1671
- t18
1672
- ] });
1673
- $[35] = t16;
1674
- $[36] = t18;
1675
- $[37] = t19;
2292
+ let t15;
2293
+ if ($[37] !== handleChange || $[38] !== t12 || $[39] !== t13 || $[40] !== t14) {
2294
+ t15 = /* @__PURE__ */ jsx(TextField, { name: "displayName", required: true, error: t12, value: t13, onChange: handleChange, "aria-describedby": "name-helper-text", label: t14 });
2295
+ $[37] = handleChange;
2296
+ $[38] = t12;
2297
+ $[39] = t13;
2298
+ $[40] = t14;
2299
+ $[41] = t15;
1676
2300
  } else {
1677
- t19 = $[37];
2301
+ t15 = $[41];
1678
2302
  }
1679
- let t20;
1680
- if ($[38] !== values_0.roles) {
1681
- t20 = values_0.roles?.map(_temp6) ?? [];
1682
- $[38] = values_0.roles;
1683
- $[39] = t20;
2303
+ let t16;
2304
+ if ($[42] !== errors || $[43] !== submitCount || $[44] !== t) {
2305
+ t16 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : t("name_of_this_user");
2306
+ $[42] = errors;
2307
+ $[43] = submitCount;
2308
+ $[44] = t;
2309
+ $[45] = t16;
1684
2310
  } else {
1685
- t20 = $[39];
2311
+ t16 = $[45];
1686
2312
  }
2313
+ let t17;
2314
+ if ($[46] !== t16) {
2315
+ t17 = /* @__PURE__ */ jsx(FieldCaption, { children: t16 });
2316
+ $[46] = t16;
2317
+ $[47] = t17;
2318
+ } else {
2319
+ t17 = $[47];
2320
+ }
2321
+ let t18;
2322
+ if ($[48] !== t15 || $[49] !== t17) {
2323
+ t18 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
2324
+ t15,
2325
+ t17
2326
+ ] });
2327
+ $[48] = t15;
2328
+ $[49] = t17;
2329
+ $[50] = t18;
2330
+ } else {
2331
+ t18 = $[50];
2332
+ }
2333
+ const t19 = submitCount > 0 && Boolean(errors.email);
2334
+ const t20 = values_0.email ?? "";
1687
2335
  let t21;
1688
- if ($[40] !== roles || $[41] !== setFieldValue) {
1689
- t21 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
1690
- $[40] = roles;
1691
- $[41] = setFieldValue;
1692
- $[42] = t21;
2336
+ if ($[51] !== t) {
2337
+ t21 = t("email");
2338
+ $[51] = t;
2339
+ $[52] = t21;
1693
2340
  } else {
1694
- t21 = $[42];
2341
+ t21 = $[52];
1695
2342
  }
1696
2343
  let t22;
1697
- if ($[43] !== roles) {
1698
- t22 = roles.map(_temp7);
1699
- $[43] = roles;
1700
- $[44] = t22;
2344
+ if ($[53] !== handleChange || $[54] !== t19 || $[55] !== t20 || $[56] !== t21) {
2345
+ t22 = /* @__PURE__ */ jsx(TextField, { required: true, error: t19, name: "email", value: t20, onChange: handleChange, "aria-describedby": "email-helper-text", label: t21 });
2346
+ $[53] = handleChange;
2347
+ $[54] = t19;
2348
+ $[55] = t20;
2349
+ $[56] = t21;
2350
+ $[57] = t22;
1701
2351
  } else {
1702
- t22 = $[44];
2352
+ t22 = $[57];
1703
2353
  }
1704
2354
  let t23;
1705
- if ($[45] !== t20 || $[46] !== t21 || $[47] !== t22) {
1706
- t23 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(MultiSelect, { className: "w-full", label: "Roles", value: t20, onValueChange: t21, children: t22 }) });
1707
- $[45] = t20;
1708
- $[46] = t21;
1709
- $[47] = t22;
1710
- $[48] = t23;
2355
+ if ($[58] !== errors || $[59] !== submitCount || $[60] !== t) {
2356
+ t23 = submitCount > 0 && Boolean(errors.email) ? errors.email : t("email_of_this_user");
2357
+ $[58] = errors;
2358
+ $[59] = submitCount;
2359
+ $[60] = t;
2360
+ $[61] = t23;
1711
2361
  } else {
1712
- t23 = $[48];
2362
+ t23 = $[61];
1713
2363
  }
1714
2364
  let t24;
1715
- if ($[49] !== t13 || $[50] !== t19 || $[51] !== t23) {
1716
- t24 = /* @__PURE__ */ jsx(DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1717
- t13,
1718
- t19,
1719
- t23
1720
- ] }) });
1721
- $[49] = t13;
1722
- $[50] = t19;
1723
- $[51] = t23;
1724
- $[52] = t24;
2365
+ if ($[62] !== t23) {
2366
+ t24 = /* @__PURE__ */ jsx(FieldCaption, { children: t23 });
2367
+ $[62] = t23;
2368
+ $[63] = t24;
1725
2369
  } else {
1726
- t24 = $[52];
2370
+ t24 = $[63];
1727
2371
  }
1728
2372
  let t25;
1729
- if ($[53] !== handleClose) {
1730
- t25 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
1731
- handleClose();
1732
- }, children: "Cancel" });
1733
- $[53] = handleClose;
1734
- $[54] = t25;
2373
+ if ($[64] !== t22 || $[65] !== t24) {
2374
+ t25 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
2375
+ t22,
2376
+ t24
2377
+ ] });
2378
+ $[64] = t22;
2379
+ $[65] = t24;
2380
+ $[66] = t25;
1735
2381
  } else {
1736
- t25 = $[54];
2382
+ t25 = $[66];
2383
+ }
2384
+ let t26;
2385
+ if ($[67] !== t) {
2386
+ t26 = t("roles");
2387
+ $[67] = t;
2388
+ $[68] = t26;
2389
+ } else {
2390
+ t26 = $[68];
2391
+ }
2392
+ let t27;
2393
+ if ($[69] !== values_0.roles) {
2394
+ t27 = values_0.roles?.map(_temp5) ?? [];
2395
+ $[69] = values_0.roles;
2396
+ $[70] = t27;
2397
+ } else {
2398
+ t27 = $[70];
1737
2399
  }
1738
- const t26 = !dirty;
1739
- const t27 = isNewUser ? "Create user" : "Update";
1740
2400
  let t28;
1741
- if ($[55] !== isSubmitting || $[56] !== t26 || $[57] !== t27) {
1742
- t28 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t26, loading: isSubmitting, children: t27 });
1743
- $[55] = isSubmitting;
1744
- $[56] = t26;
1745
- $[57] = t27;
1746
- $[58] = t28;
2401
+ if ($[71] !== roles || $[72] !== setFieldValue) {
2402
+ t28 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
2403
+ $[71] = roles;
2404
+ $[72] = setFieldValue;
2405
+ $[73] = t28;
1747
2406
  } else {
1748
- t28 = $[58];
2407
+ t28 = $[73];
1749
2408
  }
1750
2409
  let t29;
1751
- if ($[59] !== t25 || $[60] !== t28) {
1752
- t29 = /* @__PURE__ */ jsxs(DialogActions, { children: [
1753
- t25,
1754
- t28
1755
- ] });
1756
- $[59] = t25;
1757
- $[60] = t28;
1758
- $[61] = t29;
2410
+ if ($[74] !== roles) {
2411
+ t29 = roles.map(_temp6);
2412
+ $[74] = roles;
2413
+ $[75] = t29;
1759
2414
  } else {
1760
- t29 = $[61];
2415
+ t29 = $[75];
1761
2416
  }
1762
2417
  let t30;
1763
- if ($[62] !== handleSubmit || $[63] !== t24 || $[64] !== t29) {
1764
- t30 = /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t6, children: [
1765
- t7,
1766
- t24,
1767
- t29
1768
- ] });
1769
- $[62] = handleSubmit;
1770
- $[63] = t24;
1771
- $[64] = t29;
1772
- $[65] = t30;
2418
+ if ($[76] !== t26 || $[77] !== t27 || $[78] !== t28 || $[79] !== t29) {
2419
+ t30 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(MultiSelect, { className: "w-full", label: t26, value: t27, onValueChange: t28, children: t29 }) });
2420
+ $[76] = t26;
2421
+ $[77] = t27;
2422
+ $[78] = t28;
2423
+ $[79] = t29;
2424
+ $[80] = t30;
1773
2425
  } else {
1774
- t30 = $[65];
2426
+ t30 = $[80];
1775
2427
  }
1776
2428
  let t31;
1777
- if ($[66] !== formex || $[67] !== t30) {
1778
- t31 = /* @__PURE__ */ jsx(Formex, { value: formex, children: t30 });
1779
- $[66] = formex;
1780
- $[67] = t30;
1781
- $[68] = t31;
2429
+ if ($[81] !== t18 || $[82] !== t25 || $[83] !== t30) {
2430
+ t31 = /* @__PURE__ */ jsx(DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
2431
+ t18,
2432
+ t25,
2433
+ t30
2434
+ ] }) });
2435
+ $[81] = t18;
2436
+ $[82] = t25;
2437
+ $[83] = t30;
2438
+ $[84] = t31;
1782
2439
  } else {
1783
- t31 = $[68];
2440
+ t31 = $[84];
1784
2441
  }
1785
2442
  let t32;
1786
- if ($[69] !== open || $[70] !== t31 || $[71] !== t5) {
1787
- t32 = /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: t5, maxWidth: "4xl", children: t31 });
1788
- $[69] = open;
1789
- $[70] = t31;
1790
- $[71] = t5;
1791
- $[72] = t32;
2443
+ if ($[85] !== handleClose) {
2444
+ t32 = () => {
2445
+ handleClose();
2446
+ };
2447
+ $[85] = handleClose;
2448
+ $[86] = t32;
2449
+ } else {
2450
+ t32 = $[86];
2451
+ }
2452
+ let t33;
2453
+ if ($[87] !== t) {
2454
+ t33 = t("cancel");
2455
+ $[87] = t;
2456
+ $[88] = t33;
2457
+ } else {
2458
+ t33 = $[88];
2459
+ }
2460
+ let t34;
2461
+ if ($[89] !== t32 || $[90] !== t33) {
2462
+ t34 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: t32, children: t33 });
2463
+ $[89] = t32;
2464
+ $[90] = t33;
2465
+ $[91] = t34;
2466
+ } else {
2467
+ t34 = $[91];
2468
+ }
2469
+ const t35 = !dirty;
2470
+ let t36;
2471
+ if ($[92] !== isNewUser || $[93] !== t) {
2472
+ t36 = isNewUser ? t("create_user") : t("update");
2473
+ $[92] = isNewUser;
2474
+ $[93] = t;
2475
+ $[94] = t36;
2476
+ } else {
2477
+ t36 = $[94];
2478
+ }
2479
+ let t37;
2480
+ if ($[95] !== isSubmitting || $[96] !== t35 || $[97] !== t36) {
2481
+ t37 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t35, loading: isSubmitting, children: t36 });
2482
+ $[95] = isSubmitting;
2483
+ $[96] = t35;
2484
+ $[97] = t36;
2485
+ $[98] = t37;
2486
+ } else {
2487
+ t37 = $[98];
2488
+ }
2489
+ let t38;
2490
+ if ($[99] !== t34 || $[100] !== t37) {
2491
+ t38 = /* @__PURE__ */ jsxs(DialogActions, { children: [
2492
+ t34,
2493
+ t37
2494
+ ] });
2495
+ $[99] = t34;
2496
+ $[100] = t37;
2497
+ $[101] = t38;
2498
+ } else {
2499
+ t38 = $[101];
2500
+ }
2501
+ let t39;
2502
+ if ($[102] !== handleSubmit || $[103] !== t11 || $[104] !== t31 || $[105] !== t38) {
2503
+ t39 = /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t7, children: [
2504
+ t11,
2505
+ t31,
2506
+ t38
2507
+ ] });
2508
+ $[102] = handleSubmit;
2509
+ $[103] = t11;
2510
+ $[104] = t31;
2511
+ $[105] = t38;
2512
+ $[106] = t39;
2513
+ } else {
2514
+ t39 = $[106];
2515
+ }
2516
+ let t40;
2517
+ if ($[107] !== formex || $[108] !== t39) {
2518
+ t40 = /* @__PURE__ */ jsx(Formex, { value: formex, children: t39 });
2519
+ $[107] = formex;
2520
+ $[108] = t39;
2521
+ $[109] = t40;
1792
2522
  } else {
1793
- t32 = $[72];
2523
+ t40 = $[109];
1794
2524
  }
1795
- return t32;
2525
+ let t41;
2526
+ if ($[110] !== open || $[111] !== t40 || $[112] !== t6) {
2527
+ t41 = /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: t6, maxWidth: "4xl", children: t40 });
2528
+ $[110] = open;
2529
+ $[111] = t40;
2530
+ $[112] = t6;
2531
+ $[113] = t41;
2532
+ } else {
2533
+ t41 = $[113];
2534
+ }
2535
+ return t41;
1796
2536
  }
1797
- function _temp7(userRole) {
2537
+ function _temp6(userRole) {
1798
2538
  return /* @__PURE__ */ jsx(MultiSelectItem, { value: userRole.id, children: /* @__PURE__ */ jsx(RoleChip, { role: userRole }, userRole?.id) }, userRole.id);
1799
2539
  }
1800
- function _temp6(r_0) {
2540
+ function _temp5(r_0) {
1801
2541
  return r_0.id;
1802
2542
  }
1803
- function _temp5(values) {
1804
- return UserYupSchema.validate(values, {
1805
- abortEarly: false
1806
- }).then(_temp2).catch(_temp4);
1807
- }
1808
2543
  function _temp4(e_0) {
1809
2544
  return e_0.inner.reduce(_temp3, {});
1810
2545
  }
@@ -1819,10 +2554,13 @@ function _temp$2(r) {
1819
2554
  return r.id === "editor";
1820
2555
  }
1821
2556
  function UsersTable(t0) {
1822
- const $ = c(28);
2557
+ const $ = c(63);
1823
2558
  const {
1824
2559
  onUserClicked
1825
2560
  } = t0;
2561
+ const {
2562
+ t
2563
+ } = useTranslation();
1826
2564
  const {
1827
2565
  users,
1828
2566
  saveUser,
@@ -1837,21 +2575,103 @@ function UsersTable(t0) {
1837
2575
  const [deleteInProgress, setDeleteInProgress] = useState(false);
1838
2576
  let t1;
1839
2577
  if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1840
- t1 = /* @__PURE__ */ jsxs(TableHeader, { children: [
1841
- /* @__PURE__ */ jsx(TableCell, { className: "w-12" }),
1842
- /* @__PURE__ */ jsx(TableCell, { children: "Email" }),
1843
- /* @__PURE__ */ jsx(TableCell, { children: "Name" }),
1844
- /* @__PURE__ */ jsx(TableCell, { children: "Roles" }),
1845
- /* @__PURE__ */ jsx(TableCell, { children: "Created on" }),
1846
- /* @__PURE__ */ jsx(TableCell, { className: "w-12" })
1847
- ] });
2578
+ t1 = /* @__PURE__ */ jsx(TableCell, { className: "w-12" });
1848
2579
  $[0] = t1;
1849
2580
  } else {
1850
2581
  t1 = $[0];
1851
2582
  }
1852
2583
  let t2;
1853
- if ($[1] !== dateFormat || $[2] !== dateUtilsLocale || $[3] !== onUserClicked || $[4] !== users) {
1854
- t2 = users && users.map((user) => {
2584
+ if ($[1] !== t) {
2585
+ t2 = t("email");
2586
+ $[1] = t;
2587
+ $[2] = t2;
2588
+ } else {
2589
+ t2 = $[2];
2590
+ }
2591
+ let t3;
2592
+ if ($[3] !== t2) {
2593
+ t3 = /* @__PURE__ */ jsx(TableCell, { children: t2 });
2594
+ $[3] = t2;
2595
+ $[4] = t3;
2596
+ } else {
2597
+ t3 = $[4];
2598
+ }
2599
+ let t4;
2600
+ if ($[5] !== t) {
2601
+ t4 = t("name");
2602
+ $[5] = t;
2603
+ $[6] = t4;
2604
+ } else {
2605
+ t4 = $[6];
2606
+ }
2607
+ let t5;
2608
+ if ($[7] !== t4) {
2609
+ t5 = /* @__PURE__ */ jsx(TableCell, { children: t4 });
2610
+ $[7] = t4;
2611
+ $[8] = t5;
2612
+ } else {
2613
+ t5 = $[8];
2614
+ }
2615
+ let t6;
2616
+ if ($[9] !== t) {
2617
+ t6 = t("roles");
2618
+ $[9] = t;
2619
+ $[10] = t6;
2620
+ } else {
2621
+ t6 = $[10];
2622
+ }
2623
+ let t7;
2624
+ if ($[11] !== t6) {
2625
+ t7 = /* @__PURE__ */ jsx(TableCell, { children: t6 });
2626
+ $[11] = t6;
2627
+ $[12] = t7;
2628
+ } else {
2629
+ t7 = $[12];
2630
+ }
2631
+ let t8;
2632
+ if ($[13] !== t) {
2633
+ t8 = t("created_on");
2634
+ $[13] = t;
2635
+ $[14] = t8;
2636
+ } else {
2637
+ t8 = $[14];
2638
+ }
2639
+ let t9;
2640
+ if ($[15] !== t8) {
2641
+ t9 = /* @__PURE__ */ jsx(TableCell, { children: t8 });
2642
+ $[15] = t8;
2643
+ $[16] = t9;
2644
+ } else {
2645
+ t9 = $[16];
2646
+ }
2647
+ let t10;
2648
+ if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2649
+ t10 = /* @__PURE__ */ jsx(TableCell, { className: "w-12" });
2650
+ $[17] = t10;
2651
+ } else {
2652
+ t10 = $[17];
2653
+ }
2654
+ let t11;
2655
+ if ($[18] !== t3 || $[19] !== t5 || $[20] !== t7 || $[21] !== t9) {
2656
+ t11 = /* @__PURE__ */ jsxs(TableHeader, { children: [
2657
+ t1,
2658
+ t3,
2659
+ t5,
2660
+ t7,
2661
+ t9,
2662
+ t10
2663
+ ] });
2664
+ $[18] = t3;
2665
+ $[19] = t5;
2666
+ $[20] = t7;
2667
+ $[21] = t9;
2668
+ $[22] = t11;
2669
+ } else {
2670
+ t11 = $[22];
2671
+ }
2672
+ let t12;
2673
+ if ($[23] !== dateFormat || $[24] !== dateUtilsLocale || $[25] !== onUserClicked || $[26] !== t || $[27] !== users) {
2674
+ t12 = users && users.map((user) => {
1855
2675
  const userRoles = user.roles;
1856
2676
  const formattedDate = user.created_on ? format(user.created_on, dateFormat, {
1857
2677
  locale: dateUtilsLocale
@@ -1860,28 +2680,32 @@ function UsersTable(t0) {
1860
2680
  onUserClicked(user);
1861
2681
  }, children: [
1862
2682
  /* @__PURE__ */ jsx(TableCell, { className: "w-12", children: /* @__PURE__ */ jsx(Avatar, { src: user.photoURL ?? void 0, outerClassName: "w-8 h-8 min-w-8 min-h-8 p-0", className: "text-sm", hover: false, children: user.displayName ? user.displayName[0].toUpperCase() : user.email ? user.email[0].toUpperCase() : "U" }) }),
1863
- /* @__PURE__ */ jsx(TableCell, { children: user.email }),
2683
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
2684
+ /* @__PURE__ */ jsx("div", { children: user.email }),
2685
+ user.uid && /* @__PURE__ */ jsx("div", { className: "text-xs text-surface-accent-500 dark:text-surface-accent-400 font-mono mt-1", children: user.uid })
2686
+ ] }) }),
1864
2687
  /* @__PURE__ */ jsx(TableCell, { className: "font-medium align-left", children: user.displayName }),
1865
2688
  /* @__PURE__ */ jsx(TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp$1) }) : null }),
1866
2689
  /* @__PURE__ */ jsx(TableCell, { children: formattedDate }),
1867
- /* @__PURE__ */ jsx(TableCell, { className: "w-12", children: /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: "Delete this user", children: /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: (event) => {
2690
+ /* @__PURE__ */ jsx(TableCell, { className: "w-12", children: /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: t("delete_this_user"), children: /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: (event) => {
1868
2691
  event.stopPropagation();
1869
2692
  return setUserToBeDeleted(user);
1870
2693
  }, children: /* @__PURE__ */ jsx(DeleteIcon, { size: "small" }) }) }) })
1871
2694
  ] }, "row_" + user.uid);
1872
2695
  });
1873
- $[1] = dateFormat;
1874
- $[2] = dateUtilsLocale;
1875
- $[3] = onUserClicked;
1876
- $[4] = users;
1877
- $[5] = t2;
2696
+ $[23] = dateFormat;
2697
+ $[24] = dateUtilsLocale;
2698
+ $[25] = onUserClicked;
2699
+ $[26] = t;
2700
+ $[27] = users;
2701
+ $[28] = t12;
1878
2702
  } else {
1879
- t2 = $[5];
2703
+ t12 = $[28];
1880
2704
  }
1881
- let t3;
1882
- if ($[6] !== authController || $[7] !== saveUser || $[8] !== snackbarController || $[9] !== users) {
1883
- t3 = (!users || users.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 6, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
1884
- /* @__PURE__ */ jsx(Typography, { variant: "label", children: "There are no users yet" }),
2705
+ let t13;
2706
+ if ($[29] !== authController || $[30] !== saveUser || $[31] !== snackbarController || $[32] !== t || $[33] !== users) {
2707
+ t13 = (!users || users.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 6, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
2708
+ /* @__PURE__ */ jsx(Typography, { variant: "label", children: t("no_users_yet") }),
1885
2709
  /* @__PURE__ */ jsx(Button, { onClick: () => {
1886
2710
  if (!authController.user?.uid) {
1887
2711
  throw Error("UsersTable, authController misconfiguration");
@@ -1909,35 +2733,45 @@ function UsersTable(t0) {
1909
2733
  message: "Error adding user: " + error.message
1910
2734
  });
1911
2735
  });
1912
- }, children: "Add the logged user as an admin" })
2736
+ }, children: t("add_logged_user_as_admin") })
1913
2737
  ] }) }) });
1914
- $[6] = authController;
1915
- $[7] = saveUser;
1916
- $[8] = snackbarController;
1917
- $[9] = users;
1918
- $[10] = t3;
2738
+ $[29] = authController;
2739
+ $[30] = saveUser;
2740
+ $[31] = snackbarController;
2741
+ $[32] = t;
2742
+ $[33] = users;
2743
+ $[34] = t13;
1919
2744
  } else {
1920
- t3 = $[10];
2745
+ t13 = $[34];
1921
2746
  }
1922
- let t4;
1923
- if ($[11] !== t2 || $[12] !== t3) {
1924
- t4 = /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
1925
- t1,
1926
- /* @__PURE__ */ jsxs(TableBody, { children: [
1927
- t2,
1928
- t3
1929
- ] })
2747
+ let t14;
2748
+ if ($[35] !== t12 || $[36] !== t13) {
2749
+ t14 = /* @__PURE__ */ jsxs(TableBody, { children: [
2750
+ t12,
2751
+ t13
1930
2752
  ] });
1931
- $[11] = t2;
1932
- $[12] = t3;
1933
- $[13] = t4;
2753
+ $[35] = t12;
2754
+ $[36] = t13;
2755
+ $[37] = t14;
1934
2756
  } else {
1935
- t4 = $[13];
2757
+ t14 = $[37];
1936
2758
  }
1937
- const t5 = Boolean(userToBeDeleted);
1938
- let t6;
1939
- if ($[14] !== deleteUser || $[15] !== snackbarController || $[16] !== userToBeDeleted) {
1940
- t6 = () => {
2759
+ let t15;
2760
+ if ($[38] !== t11 || $[39] !== t14) {
2761
+ t15 = /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
2762
+ t11,
2763
+ t14
2764
+ ] });
2765
+ $[38] = t11;
2766
+ $[39] = t14;
2767
+ $[40] = t15;
2768
+ } else {
2769
+ t15 = $[40];
2770
+ }
2771
+ const t16 = Boolean(userToBeDeleted);
2772
+ let t17;
2773
+ if ($[41] !== deleteUser || $[42] !== snackbarController || $[43] !== userToBeDeleted) {
2774
+ t17 = () => {
1941
2775
  if (userToBeDeleted) {
1942
2776
  setDeleteInProgress(true);
1943
2777
  deleteUser(userToBeDeleted).then(() => {
@@ -1952,62 +2786,91 @@ function UsersTable(t0) {
1952
2786
  });
1953
2787
  }
1954
2788
  };
1955
- $[14] = deleteUser;
1956
- $[15] = snackbarController;
1957
- $[16] = userToBeDeleted;
1958
- $[17] = t6;
2789
+ $[41] = deleteUser;
2790
+ $[42] = snackbarController;
2791
+ $[43] = userToBeDeleted;
2792
+ $[44] = t17;
1959
2793
  } else {
1960
- t6 = $[17];
2794
+ t17 = $[44];
1961
2795
  }
1962
- let t7;
1963
- let t8;
1964
- let t9;
1965
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1966
- t7 = () => {
2796
+ let t18;
2797
+ if ($[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2798
+ t18 = () => {
1967
2799
  setUserToBeDeleted(void 0);
1968
2800
  };
1969
- t8 = /* @__PURE__ */ jsx(Fragment, { children: "Delete?" });
1970
- t9 = /* @__PURE__ */ jsx(Fragment, { children: "Are you sure you want to delete this user?" });
1971
- $[18] = t7;
1972
- $[19] = t8;
1973
- $[20] = t9;
2801
+ $[45] = t18;
1974
2802
  } else {
1975
- t7 = $[18];
1976
- t8 = $[19];
1977
- t9 = $[20];
2803
+ t18 = $[45];
1978
2804
  }
1979
- let t10;
1980
- if ($[21] !== deleteInProgress || $[22] !== t5 || $[23] !== t6) {
1981
- t10 = /* @__PURE__ */ jsx(ConfirmationDialog, { open: t5, loading: deleteInProgress, onAccept: t6, onCancel: t7, title: t8, body: t9 });
1982
- $[21] = deleteInProgress;
1983
- $[22] = t5;
1984
- $[23] = t6;
1985
- $[24] = t10;
2805
+ let t19;
2806
+ if ($[46] !== t) {
2807
+ t19 = t("delete_confirmation_title");
2808
+ $[46] = t;
2809
+ $[47] = t19;
1986
2810
  } else {
1987
- t10 = $[24];
2811
+ t19 = $[47];
1988
2812
  }
1989
- let t11;
1990
- if ($[25] !== t10 || $[26] !== t4) {
1991
- t11 = /* @__PURE__ */ jsxs("div", { className: "overflow-auto", children: [
1992
- t4,
1993
- t10
2813
+ let t20;
2814
+ if ($[48] !== t19) {
2815
+ t20 = /* @__PURE__ */ jsx(Fragment, { children: t19 });
2816
+ $[48] = t19;
2817
+ $[49] = t20;
2818
+ } else {
2819
+ t20 = $[49];
2820
+ }
2821
+ let t21;
2822
+ if ($[50] !== t) {
2823
+ t21 = t("delete_user_confirmation");
2824
+ $[50] = t;
2825
+ $[51] = t21;
2826
+ } else {
2827
+ t21 = $[51];
2828
+ }
2829
+ let t22;
2830
+ if ($[52] !== t21) {
2831
+ t22 = /* @__PURE__ */ jsx(Fragment, { children: t21 });
2832
+ $[52] = t21;
2833
+ $[53] = t22;
2834
+ } else {
2835
+ t22 = $[53];
2836
+ }
2837
+ let t23;
2838
+ if ($[54] !== deleteInProgress || $[55] !== t16 || $[56] !== t17 || $[57] !== t20 || $[58] !== t22) {
2839
+ t23 = /* @__PURE__ */ jsx(ConfirmationDialog, { open: t16, loading: deleteInProgress, onAccept: t17, onCancel: t18, title: t20, body: t22 });
2840
+ $[54] = deleteInProgress;
2841
+ $[55] = t16;
2842
+ $[56] = t17;
2843
+ $[57] = t20;
2844
+ $[58] = t22;
2845
+ $[59] = t23;
2846
+ } else {
2847
+ t23 = $[59];
2848
+ }
2849
+ let t24;
2850
+ if ($[60] !== t15 || $[61] !== t23) {
2851
+ t24 = /* @__PURE__ */ jsxs("div", { className: "overflow-auto", children: [
2852
+ t15,
2853
+ t23
1994
2854
  ] });
1995
- $[25] = t10;
1996
- $[26] = t4;
1997
- $[27] = t11;
2855
+ $[60] = t15;
2856
+ $[61] = t23;
2857
+ $[62] = t24;
1998
2858
  } else {
1999
- t11 = $[27];
2859
+ t24 = $[62];
2000
2860
  }
2001
- return t11;
2861
+ return t24;
2002
2862
  }
2003
2863
  function _temp$1(userRole) {
2004
2864
  return /* @__PURE__ */ jsx(RoleChip, { role: userRole }, userRole?.id);
2005
2865
  }
2006
2866
  const UsersView = function UsersView2(t0) {
2007
- const $ = c(13);
2867
+ const $ = c(24);
2008
2868
  const {
2009
2869
  children
2010
2870
  } = t0;
2871
+ const {
2872
+ t
2873
+ } = useTranslation();
2011
2874
  const [dialogOpen, setDialogOpen] = useState(false);
2012
2875
  const [selectedUser, setSelectedUser] = useState();
2013
2876
  const [newFormKey, setNewFormKey] = useState(0);
@@ -2047,52 +2910,90 @@ const UsersView = function UsersView2(t0) {
2047
2910
  }
2048
2911
  const handleAddUser = t3;
2049
2912
  let t4;
2050
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2051
- t4 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
2052
- $[3] = t4;
2913
+ if ($[3] !== t) {
2914
+ t4 = t("users");
2915
+ $[3] = t;
2916
+ $[4] = t4;
2053
2917
  } else {
2054
- t4 = $[3];
2918
+ t4 = $[4];
2055
2919
  }
2056
2920
  let t5;
2921
+ if ($[5] !== t4) {
2922
+ t5 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: t4 });
2923
+ $[5] = t4;
2924
+ $[6] = t5;
2925
+ } else {
2926
+ t5 = $[6];
2927
+ }
2057
2928
  let t6;
2058
- if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2059
- t5 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
2060
- t4,
2061
- /* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleAddUser, children: "Add user" })
2062
- ] });
2063
- t6 = /* @__PURE__ */ jsx(UsersTable, { onUserClicked });
2064
- $[4] = t5;
2065
- $[5] = t6;
2929
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2930
+ t6 = /* @__PURE__ */ jsx(AddIcon, {});
2931
+ $[7] = t6;
2932
+ } else {
2933
+ t6 = $[7];
2934
+ }
2935
+ let t7;
2936
+ if ($[8] !== t) {
2937
+ t7 = t("add_user");
2938
+ $[8] = t;
2939
+ $[9] = t7;
2066
2940
  } else {
2067
- t5 = $[4];
2068
- t6 = $[5];
2941
+ t7 = $[9];
2069
2942
  }
2070
- const t7 = selectedUser?.uid ?? `new-${newFormKey}`;
2071
2943
  let t8;
2072
- if ($[6] !== dialogOpen || $[7] !== selectedUser || $[8] !== t7) {
2073
- t8 = /* @__PURE__ */ jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t7);
2074
- $[6] = dialogOpen;
2075
- $[7] = selectedUser;
2076
- $[8] = t7;
2077
- $[9] = t8;
2944
+ if ($[10] !== t7) {
2945
+ t8 = /* @__PURE__ */ jsx(Button, { size: "large", startIcon: t6, onClick: handleAddUser, children: t7 });
2946
+ $[10] = t7;
2947
+ $[11] = t8;
2078
2948
  } else {
2079
- t8 = $[9];
2949
+ t8 = $[11];
2080
2950
  }
2081
2951
  let t9;
2082
- if ($[10] !== children || $[11] !== t8) {
2083
- t9 = /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2084
- children,
2952
+ if ($[12] !== t5 || $[13] !== t8) {
2953
+ t9 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
2085
2954
  t5,
2086
- t6,
2087
2955
  t8
2088
2956
  ] });
2089
- $[10] = children;
2090
- $[11] = t8;
2091
- $[12] = t9;
2957
+ $[12] = t5;
2958
+ $[13] = t8;
2959
+ $[14] = t9;
2092
2960
  } else {
2093
- t9 = $[12];
2961
+ t9 = $[14];
2094
2962
  }
2095
- return t9;
2963
+ let t10;
2964
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2965
+ t10 = /* @__PURE__ */ jsx(UsersTable, { onUserClicked });
2966
+ $[15] = t10;
2967
+ } else {
2968
+ t10 = $[15];
2969
+ }
2970
+ const t11 = selectedUser?.uid ?? `new-${newFormKey}`;
2971
+ let t12;
2972
+ if ($[16] !== dialogOpen || $[17] !== selectedUser || $[18] !== t11) {
2973
+ t12 = /* @__PURE__ */ jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t11);
2974
+ $[16] = dialogOpen;
2975
+ $[17] = selectedUser;
2976
+ $[18] = t11;
2977
+ $[19] = t12;
2978
+ } else {
2979
+ t12 = $[19];
2980
+ }
2981
+ let t13;
2982
+ if ($[20] !== children || $[21] !== t12 || $[22] !== t9) {
2983
+ t13 = /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2984
+ children,
2985
+ t9,
2986
+ t10,
2987
+ t12
2988
+ ] });
2989
+ $[20] = children;
2990
+ $[21] = t12;
2991
+ $[22] = t9;
2992
+ $[23] = t13;
2993
+ } else {
2994
+ t13 = $[23];
2995
+ }
2996
+ return t13;
2096
2997
  };
2097
2998
  function _temp(k) {
2098
2999
  return k + 1;
@@ -2167,7 +3068,7 @@ function useUserManagementPlugin(t0) {
2167
3068
  return t5;
2168
3069
  }
2169
3070
  function IntroWidget(t0) {
2170
- const $ = c(17);
3071
+ const $ = c(31);
2171
3072
  const {
2172
3073
  noUsers,
2173
3074
  noRoles,
@@ -2175,21 +3076,55 @@ function IntroWidget(t0) {
2175
3076
  } = t0;
2176
3077
  const authController = useAuthController();
2177
3078
  const snackbarController = useSnackbarController();
2178
- const buttonLabel = noUsers && noRoles ? "Create default roles and add current user as admin" : noUsers ? "Add current user as admin" : noRoles ? "Create default roles" : void 0;
3079
+ const {
3080
+ t
3081
+ } = useTranslation();
2179
3082
  let t1;
3083
+ if ($[0] !== noRoles || $[1] !== noUsers || $[2] !== t) {
3084
+ t1 = noUsers && noRoles ? t("create_default_roles_and_add_admin") : noUsers ? t("add_current_user_as_admin") : noRoles ? t("create_default_roles") : void 0;
3085
+ $[0] = noRoles;
3086
+ $[1] = noUsers;
3087
+ $[2] = t;
3088
+ $[3] = t1;
3089
+ } else {
3090
+ t1 = $[3];
3091
+ }
3092
+ const buttonLabel = t1;
2180
3093
  let t2;
2181
- if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2182
- t1 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "uppercase", children: "Create your users and roles" });
2183
- t2 = /* @__PURE__ */ jsx(Typography, { children: "You have no users or roles defined. You can create default roles and add the current user as admin." });
2184
- $[0] = t1;
2185
- $[1] = t2;
3094
+ if ($[4] !== t) {
3095
+ t2 = t("create_your_users_and_roles");
3096
+ $[4] = t;
3097
+ $[5] = t2;
2186
3098
  } else {
2187
- t1 = $[0];
2188
- t2 = $[1];
3099
+ t2 = $[5];
2189
3100
  }
2190
3101
  let t3;
2191
- if ($[2] !== authController.user?.displayName || $[3] !== authController.user?.email || $[4] !== authController.user?.isAnonymous || $[5] !== authController.user?.photoURL || $[6] !== authController.user?.providerId || $[7] !== authController.user?.uid || $[8] !== noRoles || $[9] !== noUsers || $[10] !== snackbarController || $[11] !== userManagement) {
2192
- t3 = () => {
3102
+ if ($[6] !== t2) {
3103
+ t3 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "uppercase", children: t2 });
3104
+ $[6] = t2;
3105
+ $[7] = t3;
3106
+ } else {
3107
+ t3 = $[7];
3108
+ }
3109
+ let t4;
3110
+ if ($[8] !== t) {
3111
+ t4 = t("no_users_or_roles_defined");
3112
+ $[8] = t;
3113
+ $[9] = t4;
3114
+ } else {
3115
+ t4 = $[9];
3116
+ }
3117
+ let t5;
3118
+ if ($[10] !== t4) {
3119
+ t5 = /* @__PURE__ */ jsx(Typography, { children: t4 });
3120
+ $[10] = t4;
3121
+ $[11] = t5;
3122
+ } else {
3123
+ t5 = $[11];
3124
+ }
3125
+ let t6;
3126
+ if ($[12] !== authController.user?.displayName || $[13] !== authController.user?.email || $[14] !== authController.user?.isAnonymous || $[15] !== authController.user?.photoURL || $[16] !== authController.user?.providerId || $[17] !== authController.user?.uid || $[18] !== noRoles || $[19] !== noUsers || $[20] !== snackbarController || $[21] !== userManagement) {
3127
+ t6 = () => {
2193
3128
  if (!authController.user?.uid) {
2194
3129
  throw Error("UsersTable, authController misconfiguration");
2195
3130
  }
@@ -2224,54 +3159,64 @@ function IntroWidget(t0) {
2224
3159
  });
2225
3160
  }
2226
3161
  };
2227
- $[2] = authController.user?.displayName;
2228
- $[3] = authController.user?.email;
2229
- $[4] = authController.user?.isAnonymous;
2230
- $[5] = authController.user?.photoURL;
2231
- $[6] = authController.user?.providerId;
2232
- $[7] = authController.user?.uid;
2233
- $[8] = noRoles;
2234
- $[9] = noUsers;
2235
- $[10] = snackbarController;
2236
- $[11] = userManagement;
2237
- $[12] = t3;
3162
+ $[12] = authController.user?.displayName;
3163
+ $[13] = authController.user?.email;
3164
+ $[14] = authController.user?.isAnonymous;
3165
+ $[15] = authController.user?.photoURL;
3166
+ $[16] = authController.user?.providerId;
3167
+ $[17] = authController.user?.uid;
3168
+ $[18] = noRoles;
3169
+ $[19] = noUsers;
3170
+ $[20] = snackbarController;
3171
+ $[21] = userManagement;
3172
+ $[22] = t6;
3173
+ } else {
3174
+ t6 = $[22];
3175
+ }
3176
+ let t7;
3177
+ if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3178
+ t7 = /* @__PURE__ */ jsx(AddIcon, {});
3179
+ $[23] = t7;
2238
3180
  } else {
2239
- t3 = $[12];
3181
+ t7 = $[23];
2240
3182
  }
2241
- let t4;
2242
- if ($[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2243
- t4 = /* @__PURE__ */ jsx(AddIcon, {});
2244
- $[13] = t4;
3183
+ let t8;
3184
+ if ($[24] !== buttonLabel || $[25] !== t6) {
3185
+ t8 = /* @__PURE__ */ jsxs(Button, { onClick: t6, children: [
3186
+ t7,
3187
+ buttonLabel
3188
+ ] });
3189
+ $[24] = buttonLabel;
3190
+ $[25] = t6;
3191
+ $[26] = t8;
2245
3192
  } else {
2246
- t4 = $[13];
3193
+ t8 = $[26];
2247
3194
  }
2248
- let t5;
2249
- if ($[14] !== buttonLabel || $[15] !== t3) {
2250
- t5 = /* @__PURE__ */ jsxs(Paper, { className: "my-4 flex flex-col px-4 py-6 bg-white dark:bg-surface-accent-800 gap-2", children: [
2251
- t1,
2252
- t2,
2253
- /* @__PURE__ */ jsxs(Button, { onClick: t3, children: [
2254
- t4,
2255
- buttonLabel
2256
- ] })
3195
+ let t9;
3196
+ if ($[27] !== t3 || $[28] !== t5 || $[29] !== t8) {
3197
+ t9 = /* @__PURE__ */ jsxs(Paper, { className: "my-4 flex flex-col px-4 py-6 bg-white dark:bg-surface-accent-800 gap-2", children: [
3198
+ t3,
3199
+ t5,
3200
+ t8
2257
3201
  ] });
2258
- $[14] = buttonLabel;
2259
- $[15] = t3;
2260
- $[16] = t5;
3202
+ $[27] = t3;
3203
+ $[28] = t5;
3204
+ $[29] = t8;
3205
+ $[30] = t9;
2261
3206
  } else {
2262
- t5 = $[16];
3207
+ t9 = $[30];
2263
3208
  }
2264
- return t5;
3209
+ return t9;
2265
3210
  }
2266
3211
  const userManagementAdminViews = [{
2267
3212
  path: "users",
2268
- name: "CMS Users",
3213
+ name: "cms_users",
2269
3214
  group: "Admin",
2270
3215
  icon: "face",
2271
3216
  view: /* @__PURE__ */ jsx(UsersView, {})
2272
3217
  }, {
2273
3218
  path: "roles",
2274
- name: "Roles",
3219
+ name: "roles_menu",
2275
3220
  group: "Admin",
2276
3221
  icon: "gpp_good",
2277
3222
  view: /* @__PURE__ */ jsx(RolesView, {})
@@ -2281,14 +3226,12 @@ export {
2281
3226
  IntroWidget,
2282
3227
  RESERVED_GROUPS,
2283
3228
  RoleChip,
2284
- RoleYupSchema,
2285
3229
  RolesDetailsForm,
2286
3230
  RolesTable,
2287
3231
  RolesView,
2288
3232
  UserDetailsForm,
2289
3233
  UserManagementContext,
2290
3234
  UserManagementProvider,
2291
- UserYupSchema,
2292
3235
  UsersTable,
2293
3236
  UsersView,
2294
3237
  areRolesEqual,
@@ -2296,7 +3239,9 @@ export {
2296
3239
  clearDelegatedLoginTokensCache,
2297
3240
  darkenColor,
2298
3241
  getDelegatedLoginTokenFromCache,
3242
+ getRoleYupSchema,
2299
3243
  getUserRoles,
3244
+ getUserYupSchema,
2300
3245
  hexToRgbaWithOpacity,
2301
3246
  resolveUserRolePermissions,
2302
3247
  useBuildUserManagement,