From 9acfc15f62f3948cd1a71ea254e8e3f7ffa755f5 Mon Sep 17 00:00:00 2001 From: yaschalew Date: Sat, 11 Jul 2026 12:17:33 +0300 Subject: [PATCH 1/3] fix ui --- .../_um/assets/ActivityLogPage-CaXVQavd.js | 1 - .../_um/assets/ActivityLogPage-FTC3K49Y.js | 1 - .../assets/AdminRegistrationPage-B1pquG94.js | 1 - .../assets/AdminRegistrationPage-DvAhYHqv.js | 1 - .../_um/assets/AdvancedTable-CC9ioMU-.js | 33 - .../_um/assets/AdvancedTable-vWyUWUDX.js | 33 - .../_um/assets/ArchiveUsersPage-B2jF61Wl.js | 1 - .../_um/assets/ArchiveUsersPage-CqS3Mog2.js | 1 - .../ArchivedUnitsPositionsPage-Il0g91Gb.js | 6 - .../ArchivedUnitsPositionsPage-m1hNEzal.js | 6 - .../assets/ArchivedUserColumnDefn-DQXeUrrA.js | 1 - .../assets/ArchivedUserColumnDefn-Ja27QDEy.js | 1 - .../_um/assets/BulkUploadPage-DmWpBNfY.js | 1 - .../_um/assets/BulkUploadPage-DwoaDuCZ.js | 1 - .../_um/assets/ChangePassword-DnAAu07A.js | 1 - .../_um/assets/ChangePassword-zChdks8-.js | 1 - .../public/_um/assets/Checkbox-CAXGYFGh.js | 1 - .../public/_um/assets/Checkbox-IILksgz0.js | 1 - .../_um/assets/ConfigurationPage-C9o7hgIH.js | 16 - .../_um/assets/ConfigurationPage-tOdQq5-t.js | 16 - .../assets/ContentManagementPage-CLduruyz.js | 259 - .../assets/ContentManagementPage-DOfthgvB.js | 259 - .../_um/assets/DashboardPage-CGoXLUrj.js | 1 - .../_um/assets/DashboardPage-Ci5_Ntjr.js | 1 - .../assets/EditOrganizationPage-B3RI_a-y.js | 1 - .../assets/EditOrganizationPage-C2QJGrYB.js | 1 - .../_um/assets/ForgotPassword-CyFdgyUu.js | 1 - .../_um/assets/ForgotPassword-Cz6Ky6Go.js | 1 - .../public/_um/assets/FormFields-BA7SVWfi.js | 1 - .../public/_um/assets/FormFields-DeF71qnl.js | 1 - .../assets/InputsGroupFieldset-B16dMH0P.js | 1 - .../assets/InputsGroupFieldset-COkNgcEo.js | 1 - .../public/_um/assets/LoginPage-CpY519LO.js | 1 - .../public/_um/assets/LoginPage-l5cw_Ij0.js | 1 - .../MigratedDataManagementPage--fzsv4lI.js | 1 - .../MigratedDataManagementPage-CT4uCyO9.js | 1 - .../assets/NewOrganizationPage-C0u3U4kS.js | 1 - .../assets/NewOrganizationPage-S4CT6ysT.js | 1 - .../_um/assets/OrgAdminDashboard-DhPmvSML.js | 6 - .../_um/assets/OrgAdminDashboard-bZmhZgbZ.js | 6 - .../assets/OrganizationAdminsPage-BvY4PVex.js | 6 - .../assets/OrganizationAdminsPage-DCQEuGHQ.js | 6 - .../assets/OrganizationDetailPage-By0FINz9.js | 6 - .../assets/OrganizationDetailPage-C-bRL7xT.js | 6 - .../_um/assets/OrganizationForm-BNuDw3k3.js | 1 - .../_um/assets/OrganizationForm-Dc20iiRT.js | 1 - .../_um/assets/OrganizationsPage-Cai8R-Dj.js | 8 - .../_um/assets/OrganizationsPage-sU-lwO2G.js | 8 - .../assets/PendingExternalUsers-DTQ4H5AP.js | 1 - .../assets/PendingExternalUsers-hqFaYBPx.js | 1 - .../public/_um/assets/Popover-BSKEfTKH.js | 1 - .../public/_um/assets/Popover-CzANYrEa.js | 1 - .../public/_um/assets/Radio-C3SNvFel.js | 1 - .../public/_um/assets/Radio-D43EoWlg.js | 1 - .../_um/assets/ResetPassword-DGVl7BJb.js | 1 - .../_um/assets/ResetPassword-DeJuLwFx.js | 1 - .../public/_um/assets/SetPassword-FBLxgeIW.js | 1 - .../public/_um/assets/SetPassword-bCvH9rTk.js | 1 - .../_um/assets/SettingsPage-DLv7kKUv.js | 6 - .../_um/assets/SettingsPage-Dm5BoWlS.js | 6 - .../public/_um/assets/Skeleton-BJECajc_.js | 1 - .../public/_um/assets/Skeleton-BOu0YqbY.js | 1 - .../assets/SmartOfficeAuditPage-BQ86seID.css | 1 - .../assets/SmartOfficeAuditPage-DLN72875.js | 35 - .../assets/SmartOfficeAuditPage-Dcwrs1dM.js | 35 - .../public/_um/assets/StatusCell-BAmClBhM.js | 1 - .../public/_um/assets/StatusCell-D7zi31G6.js | 1 - .../SuperAdminArchiveUsersPage-CkrXNJUY.js | 1 - .../SuperAdminArchiveUsersPage-DOLQicng.js | 1 - .../assets/SuperAdminArchivedPage-BdhC08Eo.js | 6 - .../assets/SuperAdminArchivedPage-C74WkLLY.js | 6 - .../public/_um/assets/Switch-ByfhjkDo.js | 1 - .../public/_um/assets/Switch-DSHMk-sj.js | 1 - .../UploadedDocumentViewPage-Cc6C7odK.js | 1 - .../UploadedDocumentViewPage-lpdNqwqn.js | 1 - .../_um/assets/UserManagementPage-DEaScvmg.js | 357 - .../_um/assets/UserManagementPage-DR2Y3pv2.js | 372 - .../assets/UserManagementPage-g5QT08nf.css | 1 - .../assets/UserProfileEditPage-CR2hIt1q.js | 1 - .../assets/UserProfileEditPage-D-vsT2xU.js | 1 - .../public/_um/assets/Utils-BP0IYDrC.js | 1 - .../assets/ViewMigratedDataPage-BKcu67Dm.js | 31 - .../assets/ViewMigratedDataPage-BW9AQOFu.js | 31 - .../_um/assets/WebManagementPage-BJZcVtz_.js | 43 - .../_um/assets/WebManagementPage-eEhih19q.js | 43 - .../_um/assets/XSSUploadValidator-BMXKraj-.js | 1 - .../public/_um/assets/alert-8Xu28MAD.js | 1 - .../public/_um/assets/alert-CCWXLU2U.js | 1 - .../_um/assets/alert-dialog-B5Y0wlSz.js | 1 - .../_um/assets/alert-dialog-DwppaTz4.js | 1 - .../_um/assets/archive-restore-CST5LuiK.js | 6 - .../_um/assets/archive-restore-CbEMfc7_.js | 6 - .../public/_um/assets/arrow-left-CE5-YfaQ.js | 6 - .../public/_um/assets/arrow-left-mae9HpSL.js | 6 - .../public/_um/assets/avatar-BU_IHgzI.js | 1 - .../public/_um/assets/avatar-C2-XEZ4v.js | 1 - .../public/_um/assets/badge-D4t6Wb1T.js | 1 - .../public/_um/assets/badge-D7JvaQeJ.js | 1 - .../public/_um/assets/building-B2uZxFCD.js | 6 - .../public/_um/assets/building-BTGMe3qn.js | 6 - .../public/_um/assets/card-BBWyxDss.js | 1 - .../public/_um/assets/card-_ldW-koX.js | 1 - .../public/_um/assets/checkbox-CTVlz2xL.js | 1 - .../public/_um/assets/checkbox-Dd0VhnrO.js | 1 - .../_um/assets/chevron-left-DCpEaNzo.js | 6 - .../_um/assets/chevron-left-G_a9-f9o.js | 6 - .../_um/assets/circle-alert-Cd_zeQMw.js | 6 - .../_um/assets/circle-alert-HVqsZpe-.js | 6 - .../public/_um/assets/command-B6S1IvD4.js | 5 - .../public/_um/assets/command-Cr0tMDDu.js | 5 - .../public/_um/assets/create-CKkKJa2c.js | 1 - .../public/_um/assets/create-kZturlCx.js | 1 - .../create-scoped-keydown-handler-O-eo68DQ.js | 1 - .../public/_um/assets/download-Btm1n-GQ.js | 6 - .../public/_um/assets/download-CX6rsOqt.js | 6 - .../public/_um/assets/edit-4l5haqpm.js | 1 - .../public/_um/assets/edit-C8FjiyEI.js | 1 - .../public/_um/assets/ellipsis-CbtaBcvT.js | 6 - .../public/_um/assets/ellipsis-DBW5EePE.js | 6 - .../_um/assets/ellipsis-vertical-CoMd89ns.js | 6 - .../_um/assets/ellipsis-vertical-Cs1B3vez.js | 6 - .../employeePositionsService-C7MSoCNC.js | 1 - .../employeePositionsService-CkHoE9xG.js | 1 - .../public/_um/assets/en-US-Cc-9gH5A.js | 1 - .../public/_um/assets/endOfMonth-DmxQbzXi.js | 1 - .../public/_um/assets/eye-Bhud4znU.js | 6 - .../public/_um/assets/eye-DYwZYJcQ.js | 6 - .../public/_um/assets/eye-off-AoIvdwmO.js | 6 - .../public/_um/assets/eye-off-CDMvHElM.js | 6 - .../public/_um/assets/form-BeLK5rTt.js | 1 - .../public/_um/assets/form-lLGtsTgY.js | 1 - .../public/_um/assets/format-DvwV82px.js | 1 - .../assets/formatDistanceToNow-DU8jvZv6.js | 1 - .../get-auto-contrast-value-Da6zqqWm.js | 1 - .../public/_um/assets/index-7T7TTikv.js | 327 - .../public/_um/assets/index-CKOfyDP0.css | 1 - .../public/_um/assets/index-Ccb-1Emz.js | 7 - .../public/_um/assets/index-Db-xuq0b.js | 327 - .../public/_um/assets/index-GOIG67wS.js | 7 - .../public/_um/assets/index.esm-BG4gweZJ.js | 1 - .../public/_um/assets/index.esm-BRNlF2G3.js | 1 - .../public/_um/assets/label-CABYEcfW.js | 1 - .../public/_um/assets/label-CsFy6wpo.js | 1 - .../public/_um/assets/loader-CLp1W4Fa.js | 6 - .../public/_um/assets/loader-mVRAFg0f.js | 6 - .../public/_um/assets/lock-BCybB-Lq.js | 6 - .../public/_um/assets/lock-DGEqses-.js | 6 - .../public/_um/assets/mail-bwr0seHR.js | 6 - .../public/_um/assets/mail-q8lHlEPt.js | 6 - .../_um/assets/message-square-BDJ0WXpX.js | 6 - .../_um/assets/message-square-BPZTcbJs.js | 6 - .../_um/assets/multi-select-C9K8HXhI.js | 1 - .../_um/assets/multi-select-CZLBnGmP.js | 1 - .../assets/organizationService-B_C-b9EH.js | 4 - .../assets/organizationService-DPKKJMFw.js | 4 - .../assets/organizationsService-BEVk8qa1.js | 1 - .../assets/organizationsService-DIFVjoLn.js | 1 - .../public/_um/assets/pencil-BBczLcc3.js | 6 - .../public/_um/assets/pencil-cYosDPxl.js | 6 - .../public/_um/assets/phone-Ce15UUGI.js | 6 - .../public/_um/assets/phone-w_VmAt3l.js | 6 - .../public/_um/assets/plus-BdjS2Pc-.js | 6 - .../public/_um/assets/plus-CC3ol2sL.js | 6 - .../public/_um/assets/popover-CSKEA8hg.js | 1 - .../public/_um/assets/popover-X-j_SRnG.js | 1 - .../_um/assets/positionService-BwPU5sNe.js | 1 - .../_um/assets/positionService-JD0NEiGK.js | 1 - .../_um/assets/presignedAxios-BChDCNPv.js | 1 - .../_um/assets/presignedAxios-BunkFbUr.js | 1 - .../public/_um/assets/proxy-B5PBxN2F.js | 6 - .../public/_um/assets/proxy-i8Py-I0x.js | 6 - .../public/_um/assets/radio-group-C9tEhs3a.js | 1 - .../public/_um/assets/radio-group-DqG5gUnT.js | 1 - .../public/_um/assets/refresh-cw-B7fipPS4.js | 6 - .../public/_um/assets/refresh-cw-JB7N413f.js | 6 - .../public/_um/assets/save-BBDkdyVg.js | 6 - .../public/_um/assets/save-BpdaNhEd.js | 6 - .../public/_um/assets/scroll-area-7Hggnc7C.js | 1 - .../public/_um/assets/scroll-area-zSBvHuIO.js | 1 - .../public/_um/assets/search-CM5F2ZRy.js | 6 - .../public/_um/assets/search-y8VSu0lZ.js | 6 - .../public/_um/assets/select--i8koVXg.js | 6 - .../public/_um/assets/select-BoQxM42A.js | 6 - .../public/_um/assets/separator-BXi_hr72.js | 1 - .../public/_um/assets/separator-BaOOgzZX.js | 1 - .../public/_um/assets/shield-D3luOm6l.js | 6 - .../_um/assets/shield-check-BeHB0C5s.js | 6 - .../_um/assets/shield-check-CfyQTFAv.js | 6 - .../public/_um/assets/shield-uC_usZTb.js | 6 - .../_um/assets/single-select-CqAjmX3L.js | 1 - .../_um/assets/single-select-D9ZG1edj.js | 1 - .../public/_um/assets/skeleton-BCpLdfqO.js | 1 - .../public/_um/assets/skeleton-CIiqp2Y5.js | 1 - .../public/_um/assets/square-pen-B91TPB19.js | 6 - .../public/_um/assets/square-pen-Dh1zj83N.js | 6 - .../public/_um/assets/switch-BNCD27Bd.js | 1 - .../public/_um/assets/switch-D9hx8CZw.js | 1 - .../public/_um/assets/table-D3n3VABd.js | 1 - .../public/_um/assets/table-D_B7hhqb.js | 1 - .../public/_um/assets/templates-BkP239QJ.js | 3 - .../public/_um/assets/templates-UXO1Vode.js | 3 - .../public/_um/assets/textarea-BNzPMo41.js | 1 - .../public/_um/assets/textarea-Bq1wvmIA.js | 1 - .../public/_um/assets/unitService-CmGVtFHQ.js | 1 - .../public/_um/assets/unitService-DTtkt-Pb.js | 1 - .../public/_um/assets/use-toast-CdbbItn1.js | 1 - .../public/_um/assets/use-toast-mIxmYSs4.js | 1 - .../_um/assets/use-uncontrolled-C3HRHW6t.js | 1 - .../_um/assets/use-uncontrolled-tg0LIUAX.js | 1 - .../_um/assets/useApplications-Czki0Urb.js | 1 - .../_um/assets/useApplications-DVlMarnX.js | 1 - .../public/_um/assets/useArchived-5V0W60Gf.js | 1 - .../public/_um/assets/useArchived-D2u5xEKl.js | 1 - .../public/_um/assets/useConfig-B72ZZHmV.js | 1 - .../public/_um/assets/useConfig-DEF3qQqh.js | 1 - .../assets/useEmployeePostions-BZG3u-zs.js | 6 - .../assets/useEmployeePostions-CMraotEg.js | 6 - .../_um/assets/useEmployees-CygwM5u6.js | 1 - .../_um/assets/useEmployees-DreGarUD.js | 1 - .../assets/useOrganizationAdmins-Bl-gbkwr.js | 1 - .../assets/useOrganizationAdmins-a9snXrfR.js | 1 - .../assets/useOrganizationReport-Btcu9b-4.js | 1 - .../assets/useOrganizationReport-D3QtWTPL.js | 1 - .../assets/useOrganizationTypes-B6vCp97C.js | 1 - .../assets/useOrganizationTypes-CQm1BLlI.js | 1 - .../_um/assets/useOrganizations-CPt4mkXS.js | 1 - .../_um/assets/useOrganizations-DiuNBweX.js | 1 - .../public/_um/assets/usePosition-B4V039Jv.js | 1 - .../public/_um/assets/usePosition-Y8Dhf3qk.js | 1 - .../_um/assets/usePositionTypes-BW1bd5Uk.js | 1 - .../_um/assets/usePositionTypes-BnS1UB0m.js | 1 - .../public/_um/assets/useQueries-DzmDq0fy.js | 1 - .../public/_um/assets/useQueries-XKsSk0XW.js | 1 - .../public/_um/assets/useSettings-BtSYqn9W.js | 1 - .../public/_um/assets/useSettings-CvxIOArb.js | 1 - .../public/_um/assets/useTemplate-CcP413sN.js | 30 - .../public/_um/assets/useTemplate-YHjX1fxO.js | 30 - .../public/_um/assets/useUnit-C4s9nepK.js | 1 - .../public/_um/assets/useUnit-CRt6YBLp.js | 1 - .../assets/useUnitConfiguration-BYTU44Fr.js | 1 - .../assets/useUnitConfiguration-CKdECszp.js | 1 - .../public/_um/assets/user-plus-CBq7Z0dQ.js | 6 - .../public/_um/assets/user-plus-tzUBEFtH.js | 6 - .../public/_um/assets/userService-BHeFzZdn.js | 1 - .../public/_um/assets/userService-CFvyXTYe.js | 1 - .../public/_um/assets/users-DNqydOCy.js | 6 - .../public/_um/assets/users-bn5-xqQf.js | 6 - .../public/_um/assets/utils-BncSPdK1.js | 1 - .../public/_um/assets/utils-N2wtfq7C.js | 1 - .../public/_um/assets/xlsx-sUI8S2SR.js | 104 - .../public/_um/assets/zod-D-9d3Txu.js | 1 - .../public/_um/assets/zod-Df58YiJ6.js | 1 - .../backoffice/public/_um/index.html | 17 - .../public/_um/tinymce/CHANGELOG.md | 3802 -- .../backoffice/public/_um/tinymce/README.md | 77 - .../backoffice/public/_um/tinymce/bower.json | 27 - .../public/_um/tinymce/composer.json | 52 - .../public/_um/tinymce/icons/default/icons.js | 231 - .../_um/tinymce/icons/default/icons.min.js | 1 - .../public/_um/tinymce/icons/default/index.js | 7 - .../backoffice/public/_um/tinymce/license.md | 6 - .../public/_um/tinymce/models/dom/index.js | 7 - .../public/_um/tinymce/models/dom/model.js | 8994 ---- .../_um/tinymce/models/dom/model.min.js | 1 - .../backoffice/public/_um/tinymce/notices.txt | 21 - .../public/_um/tinymce/package.json | 32 - .../_um/tinymce/plugins/accordion/index.js | 7 - .../_um/tinymce/plugins/accordion/plugin.js | 1349 - .../tinymce/plugins/accordion/plugin.min.js | 1 - .../_um/tinymce/plugins/advlist/index.js | 7 - .../_um/tinymce/plugins/advlist/plugin.js | 471 - .../_um/tinymce/plugins/advlist/plugin.min.js | 1 - .../_um/tinymce/plugins/anchor/index.js | 7 - .../_um/tinymce/plugins/anchor/plugin.js | 237 - .../_um/tinymce/plugins/anchor/plugin.min.js | 1 - .../_um/tinymce/plugins/autolink/index.js | 7 - .../_um/tinymce/plugins/autolink/plugin.js | 318 - .../tinymce/plugins/autolink/plugin.min.js | 1 - .../_um/tinymce/plugins/autoresize/index.js | 7 - .../_um/tinymce/plugins/autoresize/plugin.js | 223 - .../tinymce/plugins/autoresize/plugin.min.js | 1 - .../_um/tinymce/plugins/autosave/index.js | 7 - .../_um/tinymce/plugins/autosave/plugin.js | 252 - .../tinymce/plugins/autosave/plugin.min.js | 1 - .../_um/tinymce/plugins/charmap/index.js | 7 - .../_um/tinymce/plugins/charmap/plugin.js | 997 - .../_um/tinymce/plugins/charmap/plugin.min.js | 1 - .../public/_um/tinymce/plugins/code/index.js | 7 - .../public/_um/tinymce/plugins/code/plugin.js | 97 - .../_um/tinymce/plugins/code/plugin.min.js | 1 - .../_um/tinymce/plugins/codesample/index.js | 7 - .../_um/tinymce/plugins/codesample/plugin.js | 3654 -- .../tinymce/plugins/codesample/plugin.min.js | 9 - .../tinymce/plugins/directionality/index.js | 7 - .../tinymce/plugins/directionality/plugin.js | 636 - .../plugins/directionality/plugin.min.js | 1 - .../_um/tinymce/plugins/emoticons/index.js | 7 - .../plugins/emoticons/js/emojiimages.js | 1 - .../plugins/emoticons/js/emojiimages.min.js | 1 - .../tinymce/plugins/emoticons/js/emojis.js | 1 - .../plugins/emoticons/js/emojis.min.js | 1 - .../_um/tinymce/plugins/emoticons/plugin.js | 809 - .../tinymce/plugins/emoticons/plugin.min.js | 1 - .../_um/tinymce/plugins/fullscreen/index.js | 7 - .../_um/tinymce/plugins/fullscreen/plugin.js | 1609 - .../tinymce/plugins/fullscreen/plugin.min.js | 1 - .../public/_um/tinymce/plugins/help/index.js | 7 - .../tinymce/plugins/help/js/i18n/keynav/ar.js | 93 - .../plugins/help/js/i18n/keynav/bg_BG.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/ca.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/cs.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/da.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/de.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/el.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/en.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/es.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/eu.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/fa.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/fi.js | 93 - .../plugins/help/js/i18n/keynav/fr_FR.js | 93 - .../plugins/help/js/i18n/keynav/he_IL.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/hi.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/hr.js | 93 - .../plugins/help/js/i18n/keynav/hu_HU.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/id.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/it.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/ja.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/kk.js | 93 - .../plugins/help/js/i18n/keynav/ko_KR.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/ms.js | 93 - .../plugins/help/js/i18n/keynav/nb_NO.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/nl.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/pl.js | 93 - .../plugins/help/js/i18n/keynav/pt_BR.js | 93 - .../plugins/help/js/i18n/keynav/pt_PT.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/ro.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/ru.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/sk.js | 93 - .../plugins/help/js/i18n/keynav/sl_SI.js | 93 - .../plugins/help/js/i18n/keynav/sv_SE.js | 93 - .../plugins/help/js/i18n/keynav/th_TH.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/tr.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/uk.js | 93 - .../tinymce/plugins/help/js/i18n/keynav/vi.js | 93 - .../plugins/help/js/i18n/keynav/zh_CN.js | 87 - .../plugins/help/js/i18n/keynav/zh_TW.js | 93 - .../public/_um/tinymce/plugins/help/plugin.js | 828 - .../_um/tinymce/plugins/help/plugin.min.js | 1 - .../public/_um/tinymce/plugins/image/index.js | 7 - .../_um/tinymce/plugins/image/plugin.js | 1689 - .../_um/tinymce/plugins/image/plugin.min.js | 1 - .../_um/tinymce/plugins/importcss/index.js | 7 - .../_um/tinymce/plugins/importcss/plugin.js | 403 - .../tinymce/plugins/importcss/plugin.min.js | 1 - .../tinymce/plugins/insertdatetime/index.js | 7 - .../tinymce/plugins/insertdatetime/plugin.js | 186 - .../plugins/insertdatetime/plugin.min.js | 1 - .../public/_um/tinymce/plugins/link/index.js | 7 - .../public/_um/tinymce/plugins/link/plugin.js | 1577 - .../_um/tinymce/plugins/link/plugin.min.js | 1 - .../public/_um/tinymce/plugins/lists/index.js | 7 - .../_um/tinymce/plugins/lists/plugin.js | 2544 - .../_um/tinymce/plugins/lists/plugin.min.js | 1 - .../public/_um/tinymce/plugins/media/index.js | 7 - .../_um/tinymce/plugins/media/plugin.js | 1475 - .../_um/tinymce/plugins/media/plugin.min.js | 1 - .../_um/tinymce/plugins/nonbreaking/index.js | 7 - .../_um/tinymce/plugins/nonbreaking/plugin.js | 128 - .../tinymce/plugins/nonbreaking/plugin.min.js | 1 - .../_um/tinymce/plugins/pagebreak/index.js | 7 - .../_um/tinymce/plugins/pagebreak/plugin.js | 123 - .../tinymce/plugins/pagebreak/plugin.min.js | 1 - .../_um/tinymce/plugins/preview/index.js | 7 - .../_um/tinymce/plugins/preview/plugin.js | 765 - .../_um/tinymce/plugins/preview/plugin.min.js | 1 - .../_um/tinymce/plugins/quickbars/index.js | 7 - .../_um/tinymce/plugins/quickbars/plugin.js | 654 - .../tinymce/plugins/quickbars/plugin.min.js | 1 - .../public/_um/tinymce/plugins/save/index.js | 7 - .../public/_um/tinymce/plugins/save/plugin.js | 136 - .../_um/tinymce/plugins/save/plugin.min.js | 1 - .../tinymce/plugins/searchreplace/index.js | 7 - .../tinymce/plugins/searchreplace/plugin.js | 1370 - .../plugins/searchreplace/plugin.min.js | 1 - .../public/_um/tinymce/plugins/table/index.js | 7 - .../_um/tinymce/plugins/table/plugin.js | 4019 -- .../_um/tinymce/plugins/table/plugin.min.js | 1 - .../_um/tinymce/plugins/visualblocks/index.js | 7 - .../tinymce/plugins/visualblocks/plugin.js | 106 - .../plugins/visualblocks/plugin.min.js | 1 - .../_um/tinymce/plugins/visualchars/index.js | 7 - .../_um/tinymce/plugins/visualchars/plugin.js | 809 - .../tinymce/plugins/visualchars/plugin.min.js | 1 - .../_um/tinymce/plugins/wordcount/index.js | 7 - .../_um/tinymce/plugins/wordcount/plugin.js | 480 - .../tinymce/plugins/wordcount/plugin.min.js | 1 - .../tinymce/skins/content/dark/content.css | 75 - .../_um/tinymce/skins/content/dark/content.js | 10 - .../skins/content/dark/content.min.css | 10 - .../tinymce/skins/content/default/content.css | 70 - .../tinymce/skins/content/default/content.js | 10 - .../skins/content/default/content.min.css | 10 - .../skins/content/document/content.css | 75 - .../tinymce/skins/content/document/content.js | 10 - .../skins/content/document/content.min.css | 10 - .../skins/content/tinymce-5-dark/content.css | 75 - .../skins/content/tinymce-5-dark/content.js | 10 - .../content/tinymce-5-dark/content.min.css | 10 - .../skins/content/tinymce-5/content.css | 70 - .../skins/content/tinymce-5/content.js | 10 - .../skins/content/tinymce-5/content.min.css | 10 - .../tinymce/skins/content/writer/content.css | 71 - .../tinymce/skins/content/writer/content.js | 10 - .../skins/content/writer/content.min.css | 10 - .../tinymce/skins/ui/oxide-dark/content.css | 881 - .../skins/ui/oxide-dark/content.inline.css | 887 - .../skins/ui/oxide-dark/content.inline.js | 10 - .../ui/oxide-dark/content.inline.min.css | 10 - .../tinymce/skins/ui/oxide-dark/content.js | 10 - .../skins/ui/oxide-dark/content.min.css | 10 - .../_um/tinymce/skins/ui/oxide-dark/skin.css | 5144 -- .../_um/tinymce/skins/ui/oxide-dark/skin.js | 1 - .../tinymce/skins/ui/oxide-dark/skin.min.css | 1 - .../skins/ui/oxide-dark/skin.shadowdom.css | 30 - .../skins/ui/oxide-dark/skin.shadowdom.js | 1 - .../ui/oxide-dark/skin.shadowdom.min.css | 1 - .../_um/tinymce/skins/ui/oxide/content.css | 893 - .../tinymce/skins/ui/oxide/content.inline.css | 887 - .../tinymce/skins/ui/oxide/content.inline.js | 10 - .../skins/ui/oxide/content.inline.min.css | 10 - .../_um/tinymce/skins/ui/oxide/content.js | 10 - .../tinymce/skins/ui/oxide/content.min.css | 10 - .../_um/tinymce/skins/ui/oxide/skin.css | 5141 -- .../public/_um/tinymce/skins/ui/oxide/skin.js | 1 - .../_um/tinymce/skins/ui/oxide/skin.min.css | 1 - .../tinymce/skins/ui/oxide/skin.shadowdom.css | 30 - .../tinymce/skins/ui/oxide/skin.shadowdom.js | 1 - .../skins/ui/oxide/skin.shadowdom.min.css | 1 - .../skins/ui/tinymce-5-dark/content.css | 881 - .../ui/tinymce-5-dark/content.inline.css | 887 - .../skins/ui/tinymce-5-dark/content.inline.js | 10 - .../ui/tinymce-5-dark/content.inline.min.css | 10 - .../skins/ui/tinymce-5-dark/content.js | 10 - .../skins/ui/tinymce-5-dark/content.min.css | 10 - .../tinymce/skins/ui/tinymce-5-dark/skin.css | 5260 --- .../tinymce/skins/ui/tinymce-5-dark/skin.js | 1 - .../skins/ui/tinymce-5-dark/skin.min.css | 1 - .../ui/tinymce-5-dark/skin.shadowdom.css | 30 - .../skins/ui/tinymce-5-dark/skin.shadowdom.js | 1 - .../ui/tinymce-5-dark/skin.shadowdom.min.css | 1 - .../tinymce/skins/ui/tinymce-5/content.css | 893 - .../skins/ui/tinymce-5/content.inline.css | 887 - .../skins/ui/tinymce-5/content.inline.js | 10 - .../skins/ui/tinymce-5/content.inline.min.css | 10 - .../_um/tinymce/skins/ui/tinymce-5/content.js | 10 - .../skins/ui/tinymce-5/content.min.css | 10 - .../_um/tinymce/skins/ui/tinymce-5/skin.css | 5260 --- .../_um/tinymce/skins/ui/tinymce-5/skin.js | 1 - .../tinymce/skins/ui/tinymce-5/skin.min.css | 1 - .../skins/ui/tinymce-5/skin.shadowdom.css | 30 - .../skins/ui/tinymce-5/skin.shadowdom.js | 1 - .../skins/ui/tinymce-5/skin.shadowdom.min.css | 1 - .../public/_um/tinymce/themes/silver/index.js | 7 - .../public/_um/tinymce/themes/silver/theme.js | 34802 -------------- .../_um/tinymce/themes/silver/theme.min.js | 1 - .../public/_um/tinymce/tinymce.d.ts | 3351 -- .../backoffice/public/_um/tinymce/tinymce.js | 38748 ---------------- .../public/_um/tinymce/tinymce.min.js | 10 - 468 files changed, 153754 deletions(-) delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-CaXVQavd.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-FTC3K49Y.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-B1pquG94.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-DvAhYHqv.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-CC9ioMU-.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-vWyUWUDX.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-B2jF61Wl.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-CqS3Mog2.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-Il0g91Gb.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-m1hNEzal.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-DQXeUrrA.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-Ja27QDEy.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DmWpBNfY.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DwoaDuCZ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-DnAAu07A.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-zChdks8-.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-CAXGYFGh.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-IILksgz0.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-C9o7hgIH.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-tOdQq5-t.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-CLduruyz.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-DOfthgvB.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-CGoXLUrj.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-Ci5_Ntjr.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-B3RI_a-y.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-C2QJGrYB.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-CyFdgyUu.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-Cz6Ky6Go.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/FormFields-BA7SVWfi.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/FormFields-DeF71qnl.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-B16dMH0P.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-COkNgcEo.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-CpY519LO.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-l5cw_Ij0.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage--fzsv4lI.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage-CT4uCyO9.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-C0u3U4kS.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-S4CT6ysT.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-DhPmvSML.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-bZmhZgbZ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-BvY4PVex.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-DCQEuGHQ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-By0FINz9.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-C-bRL7xT.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-BNuDw3k3.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-Dc20iiRT.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-Cai8R-Dj.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-sU-lwO2G.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-DTQ4H5AP.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-hqFaYBPx.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Popover-BSKEfTKH.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Popover-CzANYrEa.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Radio-C3SNvFel.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Radio-D43EoWlg.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DGVl7BJb.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DeJuLwFx.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-FBLxgeIW.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-bCvH9rTk.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-DLv7kKUv.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-Dm5BoWlS.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BJECajc_.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BOu0YqbY.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-BQ86seID.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-DLN72875.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-Dcwrs1dM.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/StatusCell-BAmClBhM.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/StatusCell-D7zi31G6.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SuperAdminArchiveUsersPage-CkrXNJUY.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SuperAdminArchiveUsersPage-DOLQicng.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SuperAdminArchivedPage-BdhC08Eo.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/SuperAdminArchivedPage-C74WkLLY.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Switch-ByfhjkDo.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Switch-DSHMk-sj.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/UploadedDocumentViewPage-Cc6C7odK.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/UploadedDocumentViewPage-lpdNqwqn.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/UserManagementPage-DEaScvmg.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/UserManagementPage-DR2Y3pv2.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/UserManagementPage-g5QT08nf.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/UserProfileEditPage-CR2hIt1q.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/UserProfileEditPage-D-vsT2xU.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/Utils-BP0IYDrC.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ViewMigratedDataPage-BKcu67Dm.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ViewMigratedDataPage-BW9AQOFu.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/WebManagementPage-BJZcVtz_.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/WebManagementPage-eEhih19q.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/XSSUploadValidator-BMXKraj-.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/alert-8Xu28MAD.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/alert-CCWXLU2U.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/alert-dialog-B5Y0wlSz.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/alert-dialog-DwppaTz4.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/archive-restore-CST5LuiK.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/archive-restore-CbEMfc7_.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/arrow-left-CE5-YfaQ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/arrow-left-mae9HpSL.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/avatar-BU_IHgzI.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/avatar-C2-XEZ4v.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/badge-D4t6Wb1T.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/badge-D7JvaQeJ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/building-B2uZxFCD.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/building-BTGMe3qn.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/card-BBWyxDss.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/card-_ldW-koX.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/checkbox-CTVlz2xL.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/checkbox-Dd0VhnrO.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/chevron-left-DCpEaNzo.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/chevron-left-G_a9-f9o.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/circle-alert-Cd_zeQMw.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/circle-alert-HVqsZpe-.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/command-B6S1IvD4.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/command-Cr0tMDDu.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/create-CKkKJa2c.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/create-kZturlCx.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/create-scoped-keydown-handler-O-eo68DQ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/download-Btm1n-GQ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/download-CX6rsOqt.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/edit-4l5haqpm.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/edit-C8FjiyEI.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ellipsis-CbtaBcvT.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ellipsis-DBW5EePE.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ellipsis-vertical-CoMd89ns.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/ellipsis-vertical-Cs1B3vez.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/employeePositionsService-C7MSoCNC.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/employeePositionsService-CkHoE9xG.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/en-US-Cc-9gH5A.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/endOfMonth-DmxQbzXi.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/eye-Bhud4znU.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/eye-DYwZYJcQ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/eye-off-AoIvdwmO.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/eye-off-CDMvHElM.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/form-BeLK5rTt.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/form-lLGtsTgY.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/format-DvwV82px.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/formatDistanceToNow-DU8jvZv6.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/get-auto-contrast-value-Da6zqqWm.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/index-7T7TTikv.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/index-CKOfyDP0.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/index-Ccb-1Emz.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/index-Db-xuq0b.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/index-GOIG67wS.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/index.esm-BG4gweZJ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/index.esm-BRNlF2G3.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/label-CABYEcfW.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/label-CsFy6wpo.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/loader-CLp1W4Fa.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/loader-mVRAFg0f.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/lock-BCybB-Lq.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/lock-DGEqses-.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/mail-bwr0seHR.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/mail-q8lHlEPt.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/message-square-BDJ0WXpX.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/message-square-BPZTcbJs.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/multi-select-C9K8HXhI.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/multi-select-CZLBnGmP.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/organizationService-B_C-b9EH.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/organizationService-DPKKJMFw.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/organizationsService-BEVk8qa1.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/organizationsService-DIFVjoLn.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/pencil-BBczLcc3.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/pencil-cYosDPxl.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/phone-Ce15UUGI.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/phone-w_VmAt3l.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/plus-BdjS2Pc-.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/plus-CC3ol2sL.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/popover-CSKEA8hg.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/popover-X-j_SRnG.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/positionService-BwPU5sNe.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/positionService-JD0NEiGK.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/presignedAxios-BChDCNPv.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/presignedAxios-BunkFbUr.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/proxy-B5PBxN2F.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/proxy-i8Py-I0x.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/radio-group-C9tEhs3a.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/radio-group-DqG5gUnT.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/refresh-cw-B7fipPS4.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/refresh-cw-JB7N413f.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/save-BBDkdyVg.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/save-BpdaNhEd.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/scroll-area-7Hggnc7C.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/scroll-area-zSBvHuIO.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/search-CM5F2ZRy.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/search-y8VSu0lZ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/select--i8koVXg.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/select-BoQxM42A.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/separator-BXi_hr72.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/separator-BaOOgzZX.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/shield-D3luOm6l.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/shield-check-BeHB0C5s.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/shield-check-CfyQTFAv.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/shield-uC_usZTb.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/single-select-CqAjmX3L.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/single-select-D9ZG1edj.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/skeleton-BCpLdfqO.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/skeleton-CIiqp2Y5.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/square-pen-B91TPB19.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/square-pen-Dh1zj83N.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/switch-BNCD27Bd.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/switch-D9hx8CZw.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/table-D3n3VABd.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/table-D_B7hhqb.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/templates-BkP239QJ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/templates-UXO1Vode.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/textarea-BNzPMo41.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/textarea-Bq1wvmIA.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/unitService-CmGVtFHQ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/unitService-DTtkt-Pb.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/use-toast-CdbbItn1.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/use-toast-mIxmYSs4.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/use-uncontrolled-C3HRHW6t.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/use-uncontrolled-tg0LIUAX.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useApplications-Czki0Urb.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useApplications-DVlMarnX.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useArchived-5V0W60Gf.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useArchived-D2u5xEKl.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useConfig-B72ZZHmV.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useConfig-DEF3qQqh.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useEmployeePostions-BZG3u-zs.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useEmployeePostions-CMraotEg.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useEmployees-CygwM5u6.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useEmployees-DreGarUD.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizationAdmins-Bl-gbkwr.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizationAdmins-a9snXrfR.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizationReport-Btcu9b-4.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizationReport-D3QtWTPL.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizationTypes-B6vCp97C.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizationTypes-CQm1BLlI.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizations-CPt4mkXS.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useOrganizations-DiuNBweX.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/usePosition-B4V039Jv.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/usePosition-Y8Dhf3qk.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/usePositionTypes-BW1bd5Uk.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/usePositionTypes-BnS1UB0m.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useQueries-DzmDq0fy.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useQueries-XKsSk0XW.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useSettings-BtSYqn9W.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useSettings-CvxIOArb.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useTemplate-CcP413sN.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useTemplate-YHjX1fxO.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useUnit-C4s9nepK.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useUnit-CRt6YBLp.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useUnitConfiguration-BYTU44Fr.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/useUnitConfiguration-CKdECszp.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/user-plus-CBq7Z0dQ.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/user-plus-tzUBEFtH.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/userService-BHeFzZdn.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/userService-CFvyXTYe.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/users-DNqydOCy.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/users-bn5-xqQf.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/utils-BncSPdK1.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/utils-N2wtfq7C.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/xlsx-sUI8S2SR.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/zod-D-9d3Txu.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/assets/zod-Df58YiJ6.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/index.html delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/CHANGELOG.md delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/README.md delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/bower.json delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/composer.json delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/icons/default/icons.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/icons/default/icons.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/icons/default/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/license.md delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/models/dom/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/models/dom/model.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/models/dom/model.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/notices.txt delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/package.json delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/accordion/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/accordion/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/accordion/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/advlist/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/advlist/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/advlist/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/anchor/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/anchor/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/anchor/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autolink/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autolink/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autolink/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autoresize/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autoresize/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autoresize/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autosave/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autosave/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/autosave/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/charmap/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/charmap/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/charmap/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/code/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/code/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/code/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/codesample/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/codesample/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/codesample/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/directionality/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/directionality/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/directionality/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/emoticons/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/emoticons/js/emojiimages.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/emoticons/js/emojiimages.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/emoticons/js/emojis.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/emoticons/js/emojis.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/emoticons/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/emoticons/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/fullscreen/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/fullscreen/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/fullscreen/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/ar.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/bg_BG.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/ca.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/cs.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/da.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/de.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/el.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/en.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/es.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/eu.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/fa.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/fi.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/fr_FR.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/he_IL.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/hi.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/hr.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/hu_HU.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/id.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/it.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/ja.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/kk.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/ko_KR.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/ms.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/nb_NO.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/nl.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/pl.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/pt_BR.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/pt_PT.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/ro.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/ru.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/sk.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/sl_SI.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/sv_SE.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/th_TH.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/tr.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/uk.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/vi.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/zh_CN.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/js/i18n/keynav/zh_TW.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/help/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/image/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/image/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/image/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/importcss/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/importcss/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/importcss/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/insertdatetime/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/insertdatetime/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/insertdatetime/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/link/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/link/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/link/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/lists/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/lists/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/lists/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/media/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/media/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/media/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/nonbreaking/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/nonbreaking/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/nonbreaking/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/pagebreak/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/pagebreak/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/pagebreak/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/preview/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/preview/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/preview/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/quickbars/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/quickbars/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/quickbars/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/save/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/save/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/save/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/searchreplace/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/searchreplace/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/searchreplace/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/table/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/table/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/table/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/visualblocks/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/visualblocks/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/visualblocks/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/visualchars/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/visualchars/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/visualchars/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/wordcount/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/wordcount/plugin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/plugins/wordcount/plugin.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/dark/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/dark/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/dark/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/default/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/default/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/default/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/document/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/document/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/document/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/tinymce-5-dark/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/tinymce-5-dark/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/tinymce-5-dark/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/tinymce-5/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/tinymce-5/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/tinymce-5/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/writer/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/writer/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/content/writer/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/content.inline.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/content.inline.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/content.inline.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/skin.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/skin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/skin.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/skin.shadowdom.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/skin.shadowdom.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/content.inline.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/content.inline.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/content.inline.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/skin.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/skin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/skin.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/skin.shadowdom.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/skin.shadowdom.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/oxide/skin.shadowdom.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/content.inline.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/content.inline.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/skin.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/skin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/skin.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/content.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/content.inline.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/content.inline.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/content.inline.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/content.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/content.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/skin.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/skin.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/skin.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/skin.shadowdom.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/skin.shadowdom.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/themes/silver/index.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/themes/silver/theme.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/themes/silver/theme.min.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/tinymce.d.ts delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/tinymce.js delete mode 100644 apps/edr-freight-web/backoffice/public/_um/tinymce/tinymce.min.js diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-CaXVQavd.js b/apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-CaXVQavd.js deleted file mode 100644 index a19e1c041..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-CaXVQavd.js +++ /dev/null @@ -1 +0,0 @@ -import{r as x,j as r,B as v,I as O}from"./index-Db-xuq0b.js";import{C as A,a as E,b as L,d as B}from"./card-BBWyxDss.js";import{T as F,a as R,b as y,c as f,d as z,e as p}from"./table-D3n3VABd.js";import{S as j,a as S,b as T,c as b,d as g}from"./select-BoQxM42A.js";import{f as M}from"./formatDistanceToNow-DU8jvZv6.js";import{d as C,f as I}from"./en-US-Cc-9gH5A.js";import{D as Y}from"./download-CX6rsOqt.js";import{S as H}from"./search-CM5F2ZRy.js";import"./endOfMonth-DmxQbzXi.js";function J(t,e){const a=W(t);let i;if(a.date){const o=V(a.date,2);i=G(o.restDateString,o.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const d=i.getTime();let l=0,c;if(a.time&&(l=Q(a.time),isNaN(l)))return new Date(NaN);if(a.timezone){if(c=_(a.timezone),isNaN(c))return new Date(NaN)}else{const o=new Date(d+l),u=new Date(0);return u.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),u.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),u}return new Date(d+l+c)}const D={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Z=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,$=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,P=/^([+-])(\d{2})(?::?(\d{2}))?$/;function W(t){const e={},s=t.split(D.dateTimeDelimiter);let a;if(s.length>2)return e;if(/:/.test(s[0])?a=s[0]:(e.date=s[0],a=s[1],D.timeZoneDelimiter.test(e.date)&&(e.date=t.split(D.timeZoneDelimiter)[0],a=t.substr(e.date.length,t.length))),a){const i=D.timezone.exec(a);i?(e.time=a.replace(i[1],""),e.timezone=i[1]):e.time=a}return e}function V(t,e){const s=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),a=t.match(s);if(!a)return{year:NaN,restDateString:""};const i=a[1]?parseInt(a[1]):null,d=a[2]?parseInt(a[2]):null;return{year:d===null?i:d*100,restDateString:t.slice((a[1]||a[2]).length)}}function G(t,e){if(e===null)return new Date(NaN);const s=t.match(Z);if(!s)return new Date(NaN);const a=!!s[4],i=h(s[1]),d=h(s[2])-1,l=h(s[3]),c=h(s[4]),o=h(s[5])-1;if(a)return te(e,c,o)?X(e,c,o):new Date(NaN);{const u=new Date(0);return!K(e,d,l)||!ee(e,i)?new Date(NaN):(u.setUTCFullYear(e,d,Math.max(i,l)),u)}}function h(t){return t?parseInt(t):1}function Q(t){const e=t.match($);if(!e)return NaN;const s=N(e[1]),a=N(e[2]),i=N(e[3]);return re(s,a,i)?s*C+a*I+i*1e3:NaN}function N(t){return t&&parseFloat(t.replace(",","."))||0}function _(t){if(t==="Z")return 0;const e=t.match(P);if(!e)return 0;const s=e[1]==="+"?-1:1,a=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return se(a,i)?s*(a*C+i*I):NaN}function X(t,e,s){const a=new Date(0);a.setUTCFullYear(t,0,4);const i=a.getUTCDay()||7,d=(e-1)*7+s+1-i;return a.setUTCDate(a.getUTCDate()+d),a}const q=[31,null,31,30,31,30,31,31,30,31,30,31];function U(t){return t%400===0||t%4===0&&t%100!==0}function K(t,e,s){return e>=0&&e<=11&&s>=1&&s<=(q[e]||(U(t)?29:28))}function ee(t,e){return e>=1&&e<=(U(t)?366:365)}function te(t,e,s){return e>=1&&e<=53&&s>=0&&s<=6}function re(t,e,s){return t===24?e===0&&s===0:s>=0&&s<60&&e>=0&&e<60&&t>=0&&t<25}function se(t,e){return e>=0&&e<=59}const ae=t=>M(J(t),{addSuffix:!0}),w=[{id:"1",action:"CREATE",description:"Created new organization",performedBy:"John Doe",timestamp:new Date(Date.now()-36e5).toISOString(),module:"Organizations",resourceId:"org-123",status:"success"},{id:"2",action:"UPDATE",description:"Updated user permissions",performedBy:"Sarah Johnson",timestamp:new Date(Date.now()-72e5).toISOString(),module:"Users",resourceId:"user-456",status:"success"},{id:"3",action:"DELETE",description:"Deleted document template",performedBy:"Ahmed Mohamed",timestamp:new Date(Date.now()-864e5).toISOString(),module:"Templates",resourceId:"template-789",status:"success"},{id:"4",action:"LOGIN",description:"User login",performedBy:"John Doe",timestamp:new Date(Date.now()-18e5).toISOString(),module:"Authentication",status:"success"},{id:"5",action:"LOGIN",description:"Failed login attempt",performedBy:"Unknown User",timestamp:new Date(Date.now()-12e5).toISOString(),module:"Authentication",status:"failure"},{id:"6",action:"UPDATE",description:"Updated organization settings",performedBy:"Sarah Johnson",timestamp:new Date(Date.now()-72e5).toISOString(),module:"Settings",resourceId:"org-123",status:"success"},{id:"7",action:"CREATE",description:"Created new user account",performedBy:"John Doe",timestamp:new Date(Date.now()-1728e5).toISOString(),module:"Users",resourceId:"user-789",status:"success"},{id:"8",action:"EXPORT",description:"Exported organization data",performedBy:"Ahmed Mohamed",timestamp:new Date(Date.now()-2592e5).toISOString(),module:"Reports",status:"pending"}];function fe(){const[t,e]=x.useState(""),[s,a]=x.useState("all"),[i,d]=x.useState("all"),[l,c]=x.useState(w),o=Array.from(new Set(w?.map(n=>n.module))),u=Array.from(new Set(w?.map(n=>n.action)));x.useEffect(()=>{let n=[...w];t&&(n=n.filter(m=>m.description.toLowerCase().includes(t.toLowerCase())||m.performedBy.toLowerCase().includes(t.toLowerCase())||m.resourceId&&m.resourceId.toLowerCase().includes(t.toLowerCase()))),s!=="all"&&(n=n.filter(m=>m.module===s)),i!=="all"&&(n=n.filter(m=>m.action===i)),c(n)},[t,s,i]);const k=n=>{switch(n){case"success":return"bg-primary-100 text-primary-800 border-primary-300 dark:bg-primary-900/40 dark:text-primary-300 dark:border-primary-800";case"failure":return"bg-red-100 text-red-800 border-red-300 dark:bg-red-900/40 dark:text-red-300 dark:border-red-800";case"pending":return"bg-yellow-100 text-yellow-800 border-yellow-300 dark:bg-yellow-900/40 dark:text-yellow-300 dark:border-yellow-800";default:return"bg-gray-100 text-gray-800 border-gray-300 dark:bg-gray-800 dark:text-gray-200 dark:border-gray-700"}};return r.jsx("div",{className:"p-6 space-y-6",children:r.jsxs(A,{className:"shadow-lg border-gray-200 dark:border-gray-700",children:[r.jsx(E,{children:r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(L,{className:"text-xl font-semibold",children:"Activity Log"}),r.jsxs(v,{variant:"outline",className:"flex items-center gap-2",children:[r.jsx(Y,{className:"w-4 h-4"}),"Export"]})]})}),r.jsxs(B,{children:[r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(H,{className:"absolute left-3 top-3 h-4 w-4 text-gray-400 dark:text-gray-500"}),r.jsx(O,{placeholder:"Search logs...",value:t,onChange:n=>e(n.target.value),className:"pl-10"})]}),r.jsxs(j,{value:s,onValueChange:a,children:[r.jsx(S,{className:"w-[180px]",children:r.jsx(T,{placeholder:"Filter by module"})}),r.jsxs(b,{children:[r.jsx(g,{value:"all",children:"All modules"}),o?.map(n=>r.jsx(g,{value:n,children:n},n))]})]}),r.jsxs(j,{value:i,onValueChange:d,children:[r.jsx(S,{className:"w-[180px]",children:r.jsx(T,{placeholder:"Filter by action"})}),r.jsxs(b,{children:[r.jsx(g,{value:"all",children:"All actions"}),u?.map(n=>r.jsx(g,{value:n,children:n},n))]})]})]}),r.jsx("div",{className:"rounded-md border border-gray-200 dark:border-gray-700",children:r.jsxs(F,{children:[r.jsx(R,{children:r.jsxs(y,{children:[r.jsx(f,{className:"w-[180px]",children:"Time"}),r.jsx(f,{children:"Action"}),r.jsx(f,{className:"w-[300px]",children:"Description"}),r.jsx(f,{children:"Performed By"}),r.jsx(f,{children:"Module"}),r.jsx(f,{children:"Status"})]})}),r.jsx(z,{children:l.length>0?l?.map(n=>r.jsxs(y,{children:[r.jsx(p,{className:"font-medium",children:ae(n.timestamp)}),r.jsx(p,{children:n.action}),r.jsx(p,{children:n.description}),r.jsx(p,{children:n.performedBy}),r.jsx(p,{children:n.module}),r.jsx(p,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-semibold ${k(n.status)}`})})]},n.id)):r.jsx(y,{children:r.jsx(p,{colSpan:6,className:"h-24 text-center text-muted-foreground",children:"No activity logs found."})})})]})})]})]})})}export{fe as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-FTC3K49Y.js b/apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-FTC3K49Y.js deleted file mode 100644 index ee11b8143..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ActivityLogPage-FTC3K49Y.js +++ /dev/null @@ -1 +0,0 @@ -import{r as x,j as r,B as v,I as O}from"./index-7T7TTikv.js";import{C as A,a as E,b as L,d as B}from"./card-_ldW-koX.js";import{T as F,a as R,b as y,c as f,d as z,e as p}from"./table-D_B7hhqb.js";import{S as j,a as S,b as T,c as b,d as g}from"./select--i8koVXg.js";import{f as M}from"./formatDistanceToNow-DU8jvZv6.js";import{d as C,f as I}from"./en-US-Cc-9gH5A.js";import{D as Y}from"./download-Btm1n-GQ.js";import{S as H}from"./search-y8VSu0lZ.js";import"./endOfMonth-DmxQbzXi.js";function J(t,e){const a=W(t);let i;if(a.date){const o=V(a.date,2);i=G(o.restDateString,o.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const d=i.getTime();let l=0,c;if(a.time&&(l=Q(a.time),isNaN(l)))return new Date(NaN);if(a.timezone){if(c=_(a.timezone),isNaN(c))return new Date(NaN)}else{const o=new Date(d+l),u=new Date(0);return u.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),u.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),u}return new Date(d+l+c)}const D={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Z=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,$=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,P=/^([+-])(\d{2})(?::?(\d{2}))?$/;function W(t){const e={},s=t.split(D.dateTimeDelimiter);let a;if(s.length>2)return e;if(/:/.test(s[0])?a=s[0]:(e.date=s[0],a=s[1],D.timeZoneDelimiter.test(e.date)&&(e.date=t.split(D.timeZoneDelimiter)[0],a=t.substr(e.date.length,t.length))),a){const i=D.timezone.exec(a);i?(e.time=a.replace(i[1],""),e.timezone=i[1]):e.time=a}return e}function V(t,e){const s=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),a=t.match(s);if(!a)return{year:NaN,restDateString:""};const i=a[1]?parseInt(a[1]):null,d=a[2]?parseInt(a[2]):null;return{year:d===null?i:d*100,restDateString:t.slice((a[1]||a[2]).length)}}function G(t,e){if(e===null)return new Date(NaN);const s=t.match(Z);if(!s)return new Date(NaN);const a=!!s[4],i=h(s[1]),d=h(s[2])-1,l=h(s[3]),c=h(s[4]),o=h(s[5])-1;if(a)return te(e,c,o)?X(e,c,o):new Date(NaN);{const u=new Date(0);return!K(e,d,l)||!ee(e,i)?new Date(NaN):(u.setUTCFullYear(e,d,Math.max(i,l)),u)}}function h(t){return t?parseInt(t):1}function Q(t){const e=t.match($);if(!e)return NaN;const s=N(e[1]),a=N(e[2]),i=N(e[3]);return re(s,a,i)?s*C+a*I+i*1e3:NaN}function N(t){return t&&parseFloat(t.replace(",","."))||0}function _(t){if(t==="Z")return 0;const e=t.match(P);if(!e)return 0;const s=e[1]==="+"?-1:1,a=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return se(a,i)?s*(a*C+i*I):NaN}function X(t,e,s){const a=new Date(0);a.setUTCFullYear(t,0,4);const i=a.getUTCDay()||7,d=(e-1)*7+s+1-i;return a.setUTCDate(a.getUTCDate()+d),a}const q=[31,null,31,30,31,30,31,31,30,31,30,31];function U(t){return t%400===0||t%4===0&&t%100!==0}function K(t,e,s){return e>=0&&e<=11&&s>=1&&s<=(q[e]||(U(t)?29:28))}function ee(t,e){return e>=1&&e<=(U(t)?366:365)}function te(t,e,s){return e>=1&&e<=53&&s>=0&&s<=6}function re(t,e,s){return t===24?e===0&&s===0:s>=0&&s<60&&e>=0&&e<60&&t>=0&&t<25}function se(t,e){return e>=0&&e<=59}const ae=t=>M(J(t),{addSuffix:!0}),w=[{id:"1",action:"CREATE",description:"Created new organization",performedBy:"John Doe",timestamp:new Date(Date.now()-36e5).toISOString(),module:"Organizations",resourceId:"org-123",status:"success"},{id:"2",action:"UPDATE",description:"Updated user permissions",performedBy:"Sarah Johnson",timestamp:new Date(Date.now()-72e5).toISOString(),module:"Users",resourceId:"user-456",status:"success"},{id:"3",action:"DELETE",description:"Deleted document template",performedBy:"Ahmed Mohamed",timestamp:new Date(Date.now()-864e5).toISOString(),module:"Templates",resourceId:"template-789",status:"success"},{id:"4",action:"LOGIN",description:"User login",performedBy:"John Doe",timestamp:new Date(Date.now()-18e5).toISOString(),module:"Authentication",status:"success"},{id:"5",action:"LOGIN",description:"Failed login attempt",performedBy:"Unknown User",timestamp:new Date(Date.now()-12e5).toISOString(),module:"Authentication",status:"failure"},{id:"6",action:"UPDATE",description:"Updated organization settings",performedBy:"Sarah Johnson",timestamp:new Date(Date.now()-72e5).toISOString(),module:"Settings",resourceId:"org-123",status:"success"},{id:"7",action:"CREATE",description:"Created new user account",performedBy:"John Doe",timestamp:new Date(Date.now()-1728e5).toISOString(),module:"Users",resourceId:"user-789",status:"success"},{id:"8",action:"EXPORT",description:"Exported organization data",performedBy:"Ahmed Mohamed",timestamp:new Date(Date.now()-2592e5).toISOString(),module:"Reports",status:"pending"}];function fe(){const[t,e]=x.useState(""),[s,a]=x.useState("all"),[i,d]=x.useState("all"),[l,c]=x.useState(w),o=Array.from(new Set(w.map(n=>n.module))),u=Array.from(new Set(w.map(n=>n.action)));x.useEffect(()=>{let n=[...w];t&&(n=n.filter(m=>m.description.toLowerCase().includes(t.toLowerCase())||m.performedBy.toLowerCase().includes(t.toLowerCase())||m.resourceId&&m.resourceId.toLowerCase().includes(t.toLowerCase()))),s!=="all"&&(n=n.filter(m=>m.module===s)),i!=="all"&&(n=n.filter(m=>m.action===i)),c(n)},[t,s,i]);const k=n=>{switch(n){case"success":return"bg-primary-100 text-primary-800 border-primary-300 dark:bg-primary-900/40 dark:text-primary-300 dark:border-primary-800";case"failure":return"bg-red-100 text-red-800 border-red-300 dark:bg-red-900/40 dark:text-red-300 dark:border-red-800";case"pending":return"bg-yellow-100 text-yellow-800 border-yellow-300 dark:bg-yellow-900/40 dark:text-yellow-300 dark:border-yellow-800";default:return"bg-gray-100 text-gray-800 border-gray-300 dark:bg-gray-800 dark:text-gray-200 dark:border-gray-700"}};return r.jsx("div",{className:"p-6 space-y-6",children:r.jsxs(A,{className:"shadow-lg border-gray-200 dark:border-gray-700",children:[r.jsx(E,{children:r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(L,{className:"text-xl font-semibold",children:"Activity Log"}),r.jsxs(v,{variant:"outline",className:"flex items-center gap-2",children:[r.jsx(Y,{className:"w-4 h-4"}),"Export"]})]})}),r.jsxs(B,{children:[r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(H,{className:"absolute left-3 top-3 h-4 w-4 text-gray-400 dark:text-gray-500"}),r.jsx(O,{placeholder:"Search logs...",value:t,onChange:n=>e(n.target.value),className:"pl-10"})]}),r.jsxs(j,{value:s,onValueChange:a,children:[r.jsx(S,{className:"w-[180px]",children:r.jsx(T,{placeholder:"Filter by module"})}),r.jsxs(b,{children:[r.jsx(g,{value:"all",children:"All modules"}),o.map(n=>r.jsx(g,{value:n,children:n},n))]})]}),r.jsxs(j,{value:i,onValueChange:d,children:[r.jsx(S,{className:"w-[180px]",children:r.jsx(T,{placeholder:"Filter by action"})}),r.jsxs(b,{children:[r.jsx(g,{value:"all",children:"All actions"}),u.map(n=>r.jsx(g,{value:n,children:n},n))]})]})]}),r.jsx("div",{className:"rounded-md border border-gray-200 dark:border-gray-700",children:r.jsxs(F,{children:[r.jsx(R,{children:r.jsxs(y,{children:[r.jsx(f,{className:"w-[180px]",children:"Time"}),r.jsx(f,{children:"Action"}),r.jsx(f,{className:"w-[300px]",children:"Description"}),r.jsx(f,{children:"Performed By"}),r.jsx(f,{children:"Module"}),r.jsx(f,{children:"Status"})]})}),r.jsx(z,{children:l.length>0?l.map(n=>r.jsxs(y,{children:[r.jsx(p,{className:"font-medium",children:ae(n.timestamp)}),r.jsx(p,{children:n.action}),r.jsx(p,{children:n.description}),r.jsx(p,{children:n.performedBy}),r.jsx(p,{children:n.module}),r.jsx(p,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-semibold ${k(n.status)}`})})]},n.id)):r.jsx(y,{children:r.jsx(p,{colSpan:6,className:"h-24 text-center text-muted-foreground",children:"No activity logs found."})})})]})})]})]})})}export{fe as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-B1pquG94.js b/apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-B1pquG94.js deleted file mode 100644 index 6adddb2cb..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-B1pquG94.js +++ /dev/null @@ -1 +0,0 @@ -import{f as L,az as U,d as O,r as c,j as e,v as r,I as m,B as V}from"./index-7T7TTikv.js";import{u as T}from"./index.esm-BRNlF2G3.js";import{u as q,o as z,s as i}from"./zod-D-9d3Txu.js";import{u as w}from"./useOrganizations-CPt4mkXS.js";import{C as B,a as D,b as P,c as R,d as H}from"./card-_ldW-koX.js";import{S,a as y,b,c as I,d as v}from"./select--i8koVXg.js";import{L as n}from"./label-CABYEcfW.js";import{u as M}from"./useOrganizationAdmins-a9snXrfR.js";import{u as _}from"./useUnit-CRt6YBLp.js";import"./organizationsService-DIFVjoLn.js";import"./unitService-DTtkt-Pb.js";const $=z({name:z({am:i().min(1,r("organization.amharicNameRequired")),en:i().min(1,r("organization.englishNameRequired"))}),email:i().email(r("organization.invalidEmail")),username:i().min(3,r("organization.usernameMinLength")),unitId:i().min(1,r("organization.organizationRequired")),phone:i().regex(/^(\+251|0)?9\d{8}$/,r("organization.invalidPhoneNumber"))}),G=()=>{var u,j,N,f;const A=L(),x=U(),{organizationsResponse:l}=w("Org",{take:3e3}),{createUnitAdmin:C,isCreating:h}=M(),{user:J}=O(),[d,E]=c.useState(""),{data:t,isLoading:F}=_().getList(d||"",{take:300,skip:0}),[g,p]=c.useState("All");c.useEffect(()=>{var s,o;g||((o=(s=t==null?void 0:t.data)==null?void 0:s.items)!=null&&o.length?p(t.data.items[0].id):p("All"))},[t,g]);const a=T({resolver:q($),defaultValues:{name:{am:"",en:""},email:"",username:"",unitId:"",phone:""}}),k=async s=>{const o={email:s.email,name:s.name,unitId:s.unitId,username:s.username,phoneNumber:s.phone};C({payload:o,successCallback:()=>{A("/user-management/organization_admins")}})};return e.jsxs(B,{className:"max-w-2xl mx-auto shadow-md border-gray-200 dark:border-gray-700",children:[e.jsxs(D,{children:[e.jsx(P,{className:"text-xl font-semibold text-gray-800 dark:text-gray-100",children:r("organization.registerAdminTitle")}),e.jsx(R,{className:"text-gray-500 dark:text-gray-400",children:r("organization.registerAdminDescription")})]}),e.jsx(H,{children:e.jsxs("form",{onSubmit:a.handleSubmit(k),className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"name.en",children:[r("organization.nameEnglish")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"name.en",...a.register("name.en"),placeholder:r("organization.enterEnglishName")}),((u=a.formState.errors.name)==null?void 0:u.en)&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.name.en.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"name.am",children:[r("organization.nameAmharic")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"name.am",...a.register("name.am"),placeholder:r("organization.enterAmharicName")}),((j=a.formState.errors.name)==null?void 0:j.am)&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.name.am.message})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"email",children:[r("organization.email")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"email",type:"email",...a.register("email"),placeholder:r("organization.emailExample")}),a.formState.errors.email&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.email.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"username",children:[r("organization.username")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"username",...a.register("username"),placeholder:r("organization.enterUsername")}),a.formState.errors.username&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.username.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"phone",children:[r("organization.phoneNumber")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"phone",type:"tel",...a.register("phone"),placeholder:r("organization.phoneNumberExample")}),a.formState.errors.phone&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.phone.message})]}),e.jsxs("div",{className:"space-y-2 ",children:[e.jsxs(n,{htmlFor:"organizationId",children:[r("organization.organization")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(S,{value:d,onValueChange:s=>{E(s),a.setValue("unitId","")},children:[e.jsx(y,{children:e.jsx(b,{placeholder:r("organization.selectOrganization")})}),e.jsx(I,{children:l==null?void 0:l.items.filter(s=>s.status==="Active").map(s=>e.jsx(v,{value:s.id,children:x(s.name)},s.id))})]}),a.formState.errors.unitId&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.unitId.message})]}),e.jsxs(S,{value:a.watch("unitId"),onValueChange:s=>a.setValue("unitId",s),disabled:!d||F,children:[e.jsx(y,{children:e.jsx(b,{placeholder:r("organization.selectUnit")})}),e.jsx(I,{children:(f=(N=t==null?void 0:t.data)==null?void 0:N.items)==null?void 0:f.map(s=>e.jsx(v,{value:s.id,children:x(s.name)},s.id))})]}),a.formState.errors.unitId&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.unitId.message}),e.jsx("div",{className:"pt-4",children:e.jsx(V,{type:"submit",disabled:h,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:h?r("organization.registering"):r("organization.registerAdmin")})})]})})]})};function ie(){return e.jsx("div",{className:"p-6",children:e.jsx(G,{})})}export{ie as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-DvAhYHqv.js b/apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-DvAhYHqv.js deleted file mode 100644 index d8a3cd18b..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/AdminRegistrationPage-DvAhYHqv.js +++ /dev/null @@ -1 +0,0 @@ -import{f as L,az as U,d as O,r as c,j as e,v as r,I as m,B as V}from"./index-Db-xuq0b.js";import{u as T}from"./index.esm-BG4gweZJ.js";import{u as q,o as z,s as i}from"./zod-Df58YiJ6.js";import{u as w}from"./useOrganizations-DiuNBweX.js";import{C as B,a as D,b as P,c as R,d as H}from"./card-BBWyxDss.js";import{S,a as y,b,c as I,d as v}from"./select-BoQxM42A.js";import{L as n}from"./label-CsFy6wpo.js";import{u as M}from"./useOrganizationAdmins-Bl-gbkwr.js";import{u as _}from"./useUnit-C4s9nepK.js";import"./organizationsService-BEVk8qa1.js";import"./unitService-CmGVtFHQ.js";const $=z({name:z({am:i().min(1,r("organization.amharicNameRequired")),en:i().min(1,r("organization.englishNameRequired"))}),email:i().email(r("organization.invalidEmail")),username:i().min(3,r("organization.usernameMinLength")),unitId:i().min(1,r("organization.organizationRequired")),phone:i().regex(/^(\+251|0)?9\d{8}$/,r("organization.invalidPhoneNumber"))}),G=()=>{var u,j,N,f;const A=L(),x=U(),{organizationsResponse:l}=w("Org",{take:3e3}),{createUnitAdmin:C,isCreating:h}=M(),{user:J}=O(),[d,E]=c.useState(""),{data:t,isLoading:F}=_().getList(d||"",{take:300,skip:0}),[g,p]=c.useState("All");c.useEffect(()=>{var s,o;g||((o=(s=t==null?void 0:t.data)==null?void 0:s.items)!=null&&o.length?p(t.data.items[0].id):p("All"))},[t,g]);const a=T({resolver:q($),defaultValues:{name:{am:"",en:""},email:"",username:"",unitId:"",phone:""}}),k=async s=>{const o={email:s.email,name:s.name,unitId:s.unitId,username:s.username,phoneNumber:s.phone};C({payload:o,successCallback:()=>{A("/user-management/organization_admins")}})};return e.jsxs(B,{className:"max-w-2xl mx-auto shadow-md border-gray-200 dark:border-gray-700",children:[e.jsxs(D,{children:[e.jsx(P,{className:"text-xl font-semibold text-gray-800 dark:text-gray-100",children:r("organization.registerAdminTitle")}),e.jsx(R,{className:"text-gray-500 dark:text-gray-400",children:r("organization.registerAdminDescription")})]}),e.jsx(H,{children:e.jsxs("form",{onSubmit:a.handleSubmit(k),className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"name.en",children:[r("organization.nameEnglish")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"name.en",...a.register("name.en"),placeholder:r("organization.enterEnglishName")}),((u=a.formState.errors.name)==null?void 0:u.en)&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.name.en.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"name.am",children:[r("organization.nameAmharic")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"name.am",...a.register("name.am"),placeholder:r("organization.enterAmharicName")}),((j=a.formState.errors.name)==null?void 0:j.am)&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.name.am.message})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"email",children:[r("organization.email")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"email",type:"email",...a.register("email"),placeholder:r("organization.emailExample")}),a.formState.errors.email&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.email.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"username",children:[r("organization.username")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"username",...a.register("username"),placeholder:r("organization.enterUsername")}),a.formState.errors.username&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.username.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(n,{htmlFor:"phone",children:[r("organization.phoneNumber")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(m,{id:"phone",type:"tel",...a.register("phone"),placeholder:r("organization.phoneNumberExample")}),a.formState.errors.phone&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.phone.message})]}),e.jsxs("div",{className:"space-y-2 ",children:[e.jsxs(n,{htmlFor:"organizationId",children:[r("organization.organization")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(S,{value:d,onValueChange:s=>{E(s),a.setValue("unitId","")},children:[e.jsx(y,{children:e.jsx(b,{placeholder:r("organization.selectOrganization")})}),e.jsx(I,{children:l==null?void 0:l.items.filter(s=>s.status==="Active")?.map(s=>e.jsx(v,{value:s.id,children:x(s.name)},s.id))})]}),a.formState.errors.unitId&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.unitId.message})]}),e.jsxs(S,{value:a.watch("unitId"),onValueChange:s=>a.setValue("unitId",s),disabled:!d||F,children:[e.jsx(y,{children:e.jsx(b,{placeholder:r("organization.selectUnit")})}),e.jsx(I,{children:(f=(N=t==null?void 0:t.data)==null?void 0:N.items)==null?void 0:f?.map(s=>e.jsx(v,{value:s.id,children:x(s.name)},s.id))})]}),a.formState.errors.unitId&&e.jsx("p",{className:"text-red-500 text-xs",children:a.formState.errors.unitId.message}),e.jsx("div",{className:"pt-4",children:e.jsx(V,{type:"submit",disabled:h,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:h?r("organization.registering"):r("organization.registerAdmin")})})]})})]})};function ie(){return e.jsx("div",{className:"p-6",children:e.jsx(G,{})})}export{ie as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-CC9ioMU-.js b/apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-CC9ioMU-.js deleted file mode 100644 index a6797602d..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-CC9ioMU-.js +++ /dev/null @@ -1,33 +0,0 @@ -import{y as ve,r as A,j as p,B as z,b8 as De,aJ as Ee,aP as je,u as Ce,aA as Ae,aB as Ge,aC as He,aD as Le,b_ as ze,cD as Ne,I as ke,aS as Oe}from"./index-Db-xuq0b.js";import{T as Te,a as Be,b as B,c as qe,d as Ue,e as Q}from"./table-D3n3VABd.js";import{S as Xe,a as Ke,b as Je,c as Qe,d as We}from"./select-BoQxM42A.js";import{C as Ye}from"./chevron-left-DCpEaNzo.js";import{c as fe}from"./utils-BncSPdK1.js";import{B as W}from"./badge-D7JvaQeJ.js";import{C as Ze,a as be,b as et,c as tt,d as pe,e as me,f as nt}from"./command-Cr0tMDDu.js";import{P as ot,a as rt,b as it}from"./popover-X-j_SRnG.js";import{S as lt}from"./separator-BaOOgzZX.js";import{R as st}from"./refresh-cw-JB7N413f.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ut=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],at=ve("circle-plus",ut);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gt=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],dt=ve("settings-2",gt);/** - * table-core - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function G(e,o){return typeof e=="function"?e(o):e}function V(e,o){return t=>{o.setState(n=>({...n,[e]:G(t,n[e])}))}}function J(e){return e instanceof Function}function ct(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function ft(e,o){const t=[],n=r=>{r.forEach(i=>{t.push(i);const l=o(i);l!=null&&l.length&&n(l)})};return n(e),t}function h(e,o,t){let n=[],r;return i=>{let l;t.key&&t.debug&&(l=Date.now());const s=e(i);if(!(s.length!==n.length||s?.some((c,S)=>n[S]!==c)))return r;n=s;let g;if(t.key&&t.debug&&(g=Date.now()),r=o(...s),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const c=Math.round((Date.now()-l)*100)/100,d=Math.round((Date.now()-g)*100)/100/16,u=(f,m)=>{for(f=String(f);f.length{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[o]},key:!1,onChange:n}}function pt(e,o,t,n){const r=()=>{var l;return(l=i.getValue())!=null?l:e.options.renderFallbackValue},i={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:r,getContext:h(()=>[e,t,o,i],(l,s,a,g)=>({table:l,column:s,row:a,cell:g,getValue:g.getValue,renderValue:g.renderValue}),w(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(i,t,o,e)},{}),i}function mt(e,o,t,n){var r,i;const s={...e._getDefaultColumnDef(),...o},a=s.accessorKey;let g=(r=(i=s.id)!=null?i:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?r:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:a&&(a.includes(".")?c=d=>{let u=d;for(const m of a.split(".")){var f;u=(f=u)==null?void 0:f[m]}return u}:c=d=>d[s.accessorKey]),!g)throw new Error;let S={id:`${String(g)}`,accessorFn:c,parent:n,depth:t,columnDef:s,columns:[],getFlatColumns:h(()=>[!0],()=>{var d;return[S,...(d=S.columns)==null?void 0:d.flatMap(u=>u.getFlatColumns())]},w(e.options,"debugColumns")),getLeafColumns:h(()=>[e._getOrderColumnsFn()],d=>{var u;if((u=S.columns)!=null&&u.length){let f=S.columns.flatMap(m=>m.getLeafColumns());return d(f)}return[S]},w(e.options,"debugColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(S,e);return S}const y="debugHeaders";function Se(e,o,t){var n;let i={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders?.map(s),l.push(a)};return s(i),l},getContext:()=>({table:e,header:i,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(i,e)}),i}const St={createTable:e=>{e.getHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>{var i,l;const s=(i=n==null?void 0:n?.map(S=>t.find(d=>d.id===S)).filter(Boolean))!=null?i:[],a=(l=r==null?void 0:r?.map(S=>t.find(d=>d.id===S)).filter(Boolean))!=null?l:[],g=t.filter(S=>!(n!=null&&n.includes(S.id))&&!(r!=null&&r.includes(S.id)));return q(o,[...s,...g,...a],e)},w(e.options,y)),e.getCenterHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>(t=t.filter(i=>!(n!=null&&n.includes(i.id))&&!(r!=null&&r.includes(i.id))),q(o,t,e,"center")),w(e.options,y)),e.getLeftHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var r;const i=(r=n==null?void 0:n?.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return q(o,i,e,"left")},w(e.options,y)),e.getRightHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var r;const i=(r=n==null?void 0:n?.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return q(o,i,e,"right")},w(e.options,y)),e.getFooterGroups=h(()=>[e.getHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getLeftFooterGroups=h(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getCenterFooterGroups=h(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getRightFooterGroups=h(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getFlatHeaders=h(()=>[e.getHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getLeftFlatHeaders=h(()=>[e.getLeftHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getCenterFlatHeaders=h(()=>[e.getCenterHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getRightFlatHeaders=h(()=>[e.getRightHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getCenterLeafHeaders=h(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getLeftLeafHeaders=h(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getRightLeafHeaders=h(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getLeafHeaders=h(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,i,l,s,a,g;return[...(r=(i=o[0])==null?void 0:i.headers)!=null?r:[],...(l=(s=t[0])==null?void 0:s.headers)!=null?l:[],...(a=(g=n[0])==null?void 0:g.headers)!=null?a:[]]?.map(c=>c.getLeafHeaders()).flat()},w(e.options,y))}};function q(e,o,t,n){var r,i;let l=0;const s=function(d,u){u===void 0&&(u=1),l=Math.max(l,u),d.filter(f=>f.getIsVisible()).forEach(f=>{var m;(m=f.columns)!=null&&m.length&&s(f.columns,u+1)},0)};s(e);let a=[];const g=(d,u)=>{const f={depth:u,id:[n,`${u}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(v=>{const C=[...m].reverse()[0],R=v.column.depth===f.depth;let x,M=!1;if(R&&v.column.parent?x=v.column.parent:(x=v.column,M=!0),C&&(C==null?void 0:C.column)===x)C.subHeaders.push(v);else{const F=Se(t,x,{id:[n,u,x.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${m.filter(D=>D.column===x).length}`:void 0,depth:u,index:m.length});F.subHeaders.push(v),m.push(F)}f.headers.push(v),v.headerGroup=f}),a.push(f),u>0&&g(m,u-1)},c=o?.map((d,u)=>Se(t,d,{depth:l,index:u}));g(c,l-1),a.reverse();const S=d=>d.filter(f=>f.column.getIsVisible())?.map(f=>{let m=0,v=0,C=[0];f.subHeaders&&f.subHeaders.length?(C=[],S(f.subHeaders).forEach(x=>{let{colSpan:M,rowSpan:F}=x;m+=M,C.push(F)})):m=1;const R=Math.min(...C);return v=v+R,f.colSpan=m,f.rowSpan=v,{colSpan:m,rowSpan:v}});return S((r=(i=a[0])==null?void 0:i.headers)!=null?r:[]),a}const ae=(e,o,t,n,r,i,l)=>{let s={id:o,index:n,original:t,depth:r,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return s._valuesCache[a]=g.accessorFn(s.original,n),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=g.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var g;return(g=s.getValue(a))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>ft(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let a=[],g=s;for(;;){const c=g.getParentRow();if(!c)break;a.push(c),g=c}return a.reverse()},getAllCells:h(()=>[e.getAllLeafColumns()],a=>a?.map(g=>pt(e,s,g,g.id)),w(e.options,"debugRows")),_getAllCellsByColumnId:h(()=>[s.getAllCells()],a=>a.reduce((g,c)=>(g[c.column.id]=c,g),{}),w(e.options,"debugRows"))};for(let a=0;a{e._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():o.getPreFilteredRowModel(),e._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Re=(e,o,t)=>{var n,r;const i=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((r=e.getValue(o))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(i))};Re.autoRemove=e=>P(e);const xe=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};xe.autoRemove=e=>P(e);const _e=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};_e.autoRemove=e=>P(e);const Fe=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};Fe.autoRemove=e=>P(e);const ye=(e,o,t)=>!t?.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});ye.autoRemove=e=>P(e)||!(e!=null&&e.length);const $e=(e,o,t)=>t?.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});$e.autoRemove=e=>P(e)||!(e!=null&&e.length);const Me=(e,o,t)=>e.getValue(o)===t;Me.autoRemove=e=>P(e);const Ve=(e,o,t)=>e.getValue(o)==t;Ve.autoRemove=e=>P(e);const ge=(e,o,t)=>{let[n,r]=t;const i=e.getValue(o);return i>=n&&i<=r};ge.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,r=typeof t!="number"?parseFloat(t):t,i=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(r)?1/0:r;if(i>l){const s=i;i=l,l=s}return[i,l]};ge.autoRemove=e=>P(e)||P(e[0])&&P(e[1]);const j={includesString:Re,includesStringSensitive:xe,equalsString:_e,arrIncludes:Fe,arrIncludesAll:ye,arrIncludesSome:$e,equals:Me,weakEquals:Ve,inNumberRange:ge};function P(e){return e==null||e===""}const wt={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:V("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?j.includesString:typeof n=="number"?j.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?j.equals:Array.isArray(n)?j.arrIncludes:j.weakEquals},e.getFilterFn=()=>{var t,n;return J(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:j[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const r=e.getFilterFn(),i=n==null?void 0:n.find(c=>c.id===e.id),l=G(t,i?i.value:void 0);if(he(r,l,e)){var s;return(s=n==null?void 0:n.filter(c=>c.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(i){var g;return(g=n==null?void 0:n?.map(c=>c.id===e.id?a:c))!=null?g:[]}return n!=null&&n.length?[...n,a]:[a]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=r=>{var i;return(i=G(o,r))==null?void 0:i.filter(l=>{const s=t.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(he(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function he(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const vt=(e,o,t)=>t.reduce((n,r)=>{const i=r.getValue(e);return n+(typeof i=="number"?i:0)},0),Ct=(e,o,t)=>{let n;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}),n},Rt=(e,o,t)=>{let n;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(n=i)&&(n=i)}),n},xt=(e,o,t)=>{let n,r;return t.forEach(i=>{const l=i.getValue(e);l!=null&&(n===void 0?l>=l&&(n=r=l):(n>l&&(n=l),r{let t=0,n=0;if(o.forEach(r=>{let i=r.getValue(e);i!=null&&(i=+i)>=i&&(++t,n+=i)}),t)return n/t},Ft=(e,o)=>{if(!o.length)return;const t=o?.map(i=>i.getValue(e));if(!ct(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),r=t.sort((i,l)=>i-l);return t.length%2!==0?r[n]:(r[n-1]+r[n])/2},yt=(e,o)=>Array.from(new Set(o?.map(t=>t.getValue(e))).values()),$t=(e,o)=>new Set(o?.map(t=>t.getValue(e))).size,Mt=(e,o)=>o.length,Y={sum:vt,min:Ct,max:Rt,extent:xt,mean:_t,median:Ft,unique:yt,uniqueCount:$t,count:Mt},Vt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:V("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return Y.sum;if(Object.prototype.toString.call(n)==="[object Date]")return Y.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return J(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=o.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:Y[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function It(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(i=>!o.includes(i.id));return t==="remove"?n:[...o?.map(i=>e.find(l=>l.id===i)).filter(Boolean),...n]}const Pt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:V("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=h(t=>[T(o,t)],t=>t.findIndex(n=>n.id===e.id),w(o.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=T(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=T(o,t);return((n=r[r.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=h(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>r=>{let i=[];if(!(o!=null&&o.length))i=r;else{const l=[...o],s=[...r];for(;s.length&&l.length;){const a=l.shift(),g=s.findIndex(c=>c.id===a);g>-1&&i.push(s.splice(g,1)[0])}i=[...i,...s]}return It(i,t,n)},w(e.options,"debugTable"))}},Z=()=>({left:[],right:[]}),Dt={getInitialState:e=>({columnPinning:Z(),...e}),getDefaultOptions:e=>({onColumnPinningChange:V("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns()?.map(r=>r.id).filter(Boolean);o.setColumnPinning(r=>{var i,l;if(t==="right"){var s,a;return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(S=>!(n!=null&&n.includes(S))),right:[...((a=r==null?void 0:r.right)!=null?a:[]).filter(S=>!(n!=null&&n.includes(S))),...n]}}if(t==="left"){var g,c;return{left:[...((g=r==null?void 0:r.left)!=null?g:[]).filter(S=>!(n!=null&&n.includes(S))),...n],right:((c=r==null?void 0:r.right)!=null?c:[]).filter(S=>!(n!=null&&n.includes(S)))}}return{left:((i=r==null?void 0:r.left)!=null?i:[]).filter(S=>!(n!=null&&n.includes(S))),right:((l=r==null?void 0:r.right)!=null?l:[]).filter(S=>!(n!=null&&n.includes(S)))}})},e.getCanPin=()=>e.getLeafColumns()?.some(n=>{var r,i,l;return((r=n.columnDef.enablePinning)!=null?r:!0)&&((i=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns()?.map(s=>s.id),{left:n,right:r}=o.getState().columnPinning,i=t?.some(s=>n==null?void 0:n.includes(s)),l=t?.some(s=>r==null?void 0:r.includes(s));return i?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();return r?(t=(n=o.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(l=>!i.includes(l.column.id))},w(o.options,"debugRows")),e.getLeftVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[])?.map(i=>t.find(l=>l.column.id===i)).filter(Boolean)?.map(i=>({...i,position:"left"})),w(o.options,"debugRows")),e.getRightVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[])?.map(i=>t.find(l=>l.column.id===i)).filter(Boolean)?.map(i=>({...i,position:"right"})),w(o.options,"debugRows"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?Z():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:Z())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var r,i;return!!((r=n.left)!=null&&r.length||(i=n.right)!=null&&i.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[])?.map(n=>o.find(r=>r.id===n)).filter(Boolean),w(e.options,"debugColumns")),e.getRightLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[])?.map(n=>o.find(r=>r.id===n)).filter(Boolean),w(e.options,"debugColumns")),e.getCenterLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const r=[...t??[],...n??[]];return o.filter(i=>!r.includes(i.id))},w(e.options,"debugColumns"))}};function Et(e){return e||(typeof document<"u"?document:null)}const U={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},b=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),jt={getDefaultColumnDef:()=>U,getInitialState:e=>({columnSizing:{},columnSizingInfo:b(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:V("columnSizing",e),onColumnSizingInfoChange:V("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,r;const i=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:U.minSize,(n=i??e.columnDef.size)!=null?n:U.size),(r=e.columnDef.maxSize)!=null?r:U.maxSize)},e.getStart=h(t=>[t,T(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((r,i)=>r+i.getSize(),0),w(o.options,"debugColumns")),e.getAfter=h(t=>[t,T(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((r,i)=>r+i.getSize(),0),w(o.options,"debugColumns")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=r=>{if(r.subHeaders.length)r.subHeaders.forEach(n);else{var i;t+=(i=r.column.getSize())!=null?i:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return i=>{if(!n||!r||(i.persist==null||i.persist(),ee(i)&&i.touches&&i.touches.length>1))return;const l=e.getSize(),s=e?e.getLeafHeaders()?.map(C=>[C.column.id,C.column.getSize()]):[[n.id,n.getSize()]],a=ee(i)?Math.round(i.touches[0].clientX):i.clientX,g={},c=(C,R)=>{typeof R=="number"&&(o.setColumnSizingInfo(x=>{var M,F;const D=o.options.columnResizeDirection==="rtl"?-1:1,L=(R-((M=x==null?void 0:x.startOffset)!=null?M:0))*D,N=Math.max(L/((F=x==null?void 0:x.startSize)!=null?F:0),-.999999);return x.columnSizingStart.forEach(k=>{let[E,_]=k;g[E]=Math.round(Math.max(_+_*N,0)*100)/100}),{...x,deltaOffset:L,deltaPercentage:N}}),(o.options.columnResizeMode==="onChange"||C==="end")&&o.setColumnSizing(x=>({...x,...g})))},S=C=>c("move",C),d=C=>{c("end",C),o.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=Et(t),f={moveHandler:C=>S(C.clientX),upHandler:C=>{u==null||u.removeEventListener("mousemove",f.moveHandler),u==null||u.removeEventListener("mouseup",f.upHandler),d(C.clientX)}},m={moveHandler:C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),S(C.touches[0].clientX),!1),upHandler:C=>{var R;u==null||u.removeEventListener("touchmove",m.moveHandler),u==null||u.removeEventListener("touchend",m.upHandler),C.cancelable&&(C.preventDefault(),C.stopPropagation()),d((R=C.touches[0])==null?void 0:R.clientX)}},v=At()?{passive:!1}:!1;ee(i)?(u==null||u.addEventListener("touchmove",m.moveHandler,v),u==null||u.addEventListener("touchend",m.upHandler,v)):(u==null||u.addEventListener("mousemove",f.moveHandler,v),u==null||u.addEventListener("mouseup",f.upHandler,v)),o.setColumnSizingInfo(C=>({...C,startOffset:a,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=o=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(o),e.setColumnSizingInfo=o=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(o),e.resetColumnSizing=o=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?b():(t=e.initialState.columnSizingInfo)!=null?t:b())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0}}};let X=null;function At(){if(typeof X=="boolean")return X;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return X=e,X}function ee(e){return e.type==="touchstart"}const Gt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:V("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const r=e.columns;return(t=r.length?r?.some(i=>i.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=h(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),w(o.options,"debugRows")),e.getVisibleCells=h(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,r)=>[...t,...n,...r],w(o.options,"debugRows"))},createTable:e=>{const o=(t,n)=>h(()=>[n(),n().filter(r=>r.getIsVisible())?.map(r=>r.id).join("_")],r=>r.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),w(e.options,"debugColumns"));e.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,i)=>({...r,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns()?.some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns()?.some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function T(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Ht={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Lt={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:V("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,r,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&((i=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>j.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return J(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:j[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},zt={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:V("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var r,i;e.setExpanded(n?{}:(r=(i=e.initialState)==null?void 0:i.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows?.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n)?.some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows?.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const l=i.split(".");n=Math.max(n,l.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var r;const i=n===!0?!0:!!(n!=null&&n[e.id]);let l={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=n,t=(r=t)!=null?r:!i,!i&&t)return{...l,[e.id]:!0};if(i&&!t){const{[e.id]:s,...a}=l;return a}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,r;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},re=0,ie=10,te=()=>({pageIndex:re,pageSize:ie}),Nt={getInitialState:e=>({...e,pagination:{...te(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:V("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const r=i=>G(n,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=n=>{var r;e.setPagination(n?te():(r=e.initialState.pagination)!=null?r:te())},e.setPageIndex=n=>{e.setPagination(r=>{let i=G(n,r.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,l)),{...r,pageIndex:i}})},e.resetPageIndex=n=>{var r,i;e.setPageIndex(n?re:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?r:re)},e.resetPageSize=n=>{var r,i;e.setPageSize(n?ie:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?r:ie)},e.setPageSize=n=>{e.setPagination(r=>{const i=Math.max(1,G(n,r.pageSize)),l=r.pageSize*r.pageIndex,s=Math.floor(l/i);return{...r,pageIndex:s,pageSize:i}})},e.setPageCount=n=>e.setPagination(r=>{var i;let l=G(n,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...r,pageCount:l}}),e.getPageOptions=h(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null)?.map((i,l)=>l)),r},w(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:ne.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},ne=()=>({top:[],bottom:[]}),kt={getInitialState:e=>({rowPinning:ne(),...e}),getDefaultOptions:e=>({onRowPinningChange:V("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,r)=>{const i=n?e.getLeafRows()?.map(a=>{let{id:g}=a;return g}):[],l=r?e.getParentRows()?.map(a=>{let{id:g}=a;return g}):[],s=new Set([...l,e.id,...i]);o.setRowPinning(a=>{var g,c;if(t==="bottom"){var S,d;return{top:((S=a==null?void 0:a.top)!=null?S:[]).filter(m=>!(s!=null&&s.has(m))),bottom:[...((d=a==null?void 0:a.bottom)!=null?d:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)]}}if(t==="top"){var u,f;return{top:[...((u=a==null?void 0:a.top)!=null?u:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)],bottom:((f=a==null?void 0:a.bottom)!=null?f:[]).filter(m=>!(s!=null&&s.has(m)))}}return{top:((g=a==null?void 0:a.top)!=null?g:[]).filter(m=>!(s!=null&&s.has(m))),bottom:((c=a==null?void 0:a.bottom)!=null?c:[]).filter(m=>!(s!=null&&s.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:r}=o.options;return typeof n=="function"?n(e):(t=n??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:r}=o.getState().rowPinning,i=t?.some(s=>n==null?void 0:n.includes(s)),l=t?.some(s=>r==null?void 0:r.includes(s));return i?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();if(!r)return-1;const i=(t=r==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t?.map(l=>{let{id:s}=l;return s});return(n=i==null?void 0:i.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?ne():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:ne())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var r,i;return!!((r=n.top)!=null&&r.length||(i=n.bottom)!=null&&i.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[])?.map(l=>{const s=e.getRow(l,!0);return s.getIsAllParentsExpanded()?s:null}):(t??[])?.map(l=>o.find(s=>s.id===l))).filter(Boolean)?.map(l=>({...l,position:n}))},e.getTopRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),w(e.options,"debugRows")),e.getBottomRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),w(e.options,"debugRows")),e.getCenterRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const r=new Set([...t??[],...n??[]]);return o.filter(i=>!r.has(i.id))},w(e.options,"debugRows"))}},Ot={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:V("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},r=e.getPreGroupedRowModel().flatRows;return o?r.forEach(i=>{i.getCanSelect()&&(n[i.id]=!0)}):r.forEach(i=>{delete n[i.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(i=>{le(r,i.id,n,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=h(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getFilteredSelectedRowModel=h(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getGroupedSelectedRowModel=h(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o?.some(r=>r.getCanSelect()&&!t[r.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o?.some(r=>!t[r.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect())?.some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const r=e.getIsSelected();o.setRowSelection(i=>{var l;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return i;const s={...i};return le(s,e.id,t,(l=n==null?void 0:n.selectChildren)!=null?l:!0,o),s})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return de(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return se(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return se(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected((r=n.target)==null?void 0:r.checked)}}}},le=(e,o,t,n,r)=>{var i;const l=r.getRow(o,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),l.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(i=l.subRows)!=null&&i.length&&l.getCanSelectSubRows()&&l.subRows.forEach(s=>le(e,s.id,t,n,r))};function oe(e,o){const t=e.getState().rowSelection,n=[],r={},i=function(l,s){return l?.map(a=>{var g;const c=de(a,t);if(c&&(n.push(a),r[a.id]=a),(g=a.subRows)!=null&&g.length&&(a={...a,subRows:i(a.subRows)}),c)return a}).filter(Boolean)};return{rows:i(o.rows),flatRows:n,rowsById:r}}function de(e,o){var t;return(t=o[e.id])!=null?t:!1}function se(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let r=!0,i=!1;return e.subRows.forEach(l=>{if(!(i&&!r)&&(l.getCanSelect()&&(de(l,o)?i=!0:r=!1),l.subRows&&l.subRows.length)){const s=se(l,o);s==="all"?i=!0:(s==="some"&&(i=!0),r=!1)}}),r?"all":i?"some":!1}const ue=/([0-9]+)/gm,Tt=(e,o,t)=>Ie(H(e.getValue(t)).toLowerCase(),H(o.getValue(t)).toLowerCase()),Bt=(e,o,t)=>Ie(H(e.getValue(t)),H(o.getValue(t))),qt=(e,o,t)=>ce(H(e.getValue(t)).toLowerCase(),H(o.getValue(t)).toLowerCase()),Ut=(e,o,t)=>ce(H(e.getValue(t)),H(o.getValue(t))),Xt=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:nce(e.getValue(t),o.getValue(t));function ce(e,o){return e===o?0:e>o?1:-1}function H(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Ie(e,o){const t=e.split(ue).filter(Boolean),n=o.split(ue).filter(Boolean);for(;t.length&&n.length;){const r=t.shift(),i=n.shift(),l=parseInt(r,10),s=parseInt(i,10),a=[l,s].sort();if(isNaN(a[0])){if(r>i)return 1;if(i>r)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return t.length-n.length}const O={alphanumeric:Tt,alphanumericCaseSensitive:Bt,text:qt,textCaseSensitive:Ut,datetime:Xt,basic:Kt},Jt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:V("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const r of t){const i=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return O.datetime;if(typeof i=="string"&&(n=!0,i.split(ue).length>1))return O.alphanumeric}return n?O.text:O.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return J(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:O[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const r=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;o.setSorting(l=>{const s=l==null?void 0:l.find(u=>u.id===e.id),a=l==null?void 0:l.findIndex(u=>u.id===e.id);let g=[],c,S=i?t:r==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?s?c="toggle":c="add":l!=null&&l.length&&a!==l.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(i||r||(c="remove")),c==="add"){var d;g=[...l,{id:e.id,desc:S}],g.splice(0,g.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?g=l?.map(u=>u.id===e.id?{...u,desc:S}:u):c==="remove"?g=l.filter(u=>u.id!==e.id):g=[{id:e.id,desc:S}];return g})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,r;const i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(r=o.options.enableMultiRemove)!=null)||r)?!1:l==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Qt=[St,Gt,Pt,Dt,ht,wt,Ht,Lt,Jt,Vt,zt,Nt,kt,Ot,jt];function Wt(e){var o,t;const n=[...Qt,...(o=e._features)!=null?o:[]];let r={_features:n};const i=r._features.reduce((d,u)=>Object.assign(d,u.getDefaultOptions==null?void 0:u.getDefaultOptions(r)),{}),l=d=>r.options.mergeOptions?r.options.mergeOptions(i,d):{...i,...d};let a={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(d=>{var u;a=(u=d.getInitialState==null?void 0:d.getInitialState(a))!=null?u:a});const g=[];let c=!1;const S={_features:n,options:{...i,...e},initialState:a,_queue:d=>{g.push(d),c||(c=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();c=!1}).catch(u=>setTimeout(()=>{throw u})))},reset:()=>{r.setState(r.initialState)},setOptions:d=>{const u=G(d,r.options);r.options=l(u)},getState:()=>r.options.state,setState:d=>{r.options.onStateChange==null||r.options.onStateChange(d)},_getRowId:(d,u,f)=>{var m;return(m=r.options.getRowId==null?void 0:r.options.getRowId(d,u,f))!=null?m:`${f?[f.id,u].join("."):u}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(d,u)=>{let f=(u?r.getPrePaginationRowModel():r.getRowModel()).rowsById[d];if(!f&&(f=r.getCoreRowModel().rowsById[d],!f))throw new Error;return f},_getDefaultColumnDef:h(()=>[r.options.defaultColumn],d=>{var u;return d=(u=d)!=null?u:{},{header:f=>{const m=f.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:f=>{var m,v;return(m=(v=f.renderValue())==null||v.toString==null?void 0:v.toString())!=null?m:null},...r._features.reduce((f,m)=>Object.assign(f,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...d}},w(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:h(()=>[r._getColumnDefs()],d=>{const u=function(f,m,v){return v===void 0&&(v=0),f?.map(C=>{const R=mt(r,C,v,m),x=C;return R.columns=x.columns?u(x.columns,R,v+1):[],R})};return u(d)},w(e,"debugColumns")),getAllFlatColumns:h(()=>[r.getAllColumns()],d=>d.flatMap(u=>u.getFlatColumns()),w(e,"debugColumns")),_getAllFlatColumnsById:h(()=>[r.getAllFlatColumns()],d=>d.reduce((u,f)=>(u[f.id]=f,u),{}),w(e,"debugColumns")),getAllLeafColumns:h(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(d,u)=>{let f=d.flatMap(m=>m.getLeafColumns());return u(f)},w(e,"debugColumns")),getColumn:d=>r._getAllFlatColumnsById()[d]};Object.assign(r,S);for(let d=0;dh(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,i,l){i===void 0&&(i=0);const s=[];for(let g=0;ge._autoResetPageIndex()))}function Pe(e,o,t){return t.options.filterFromLeafRows?Zt(e,o,t):bt(e,o,t)}function Zt(e,o,t){var n;const r=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,s=function(a,g){g===void 0&&(g=0);const c=[];for(let d=0;dh(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r)return t;const i=[...n?.map(s=>s.id).filter(s=>s!==o),r?"__global__":void 0].filter(Boolean),l=s=>{for(let a=0;ah(()=>{var t;return[(t=e.getColumn(o))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let n=new Map;for(let i=0;ih(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let d=0;d{var u;const f=e.getColumn(d.id);if(!f)return;const m=f.getFilterFn();m&&r.push({id:d.id,filterFn:m,resolvedValue:(u=m.resolveFilterValue==null?void 0:m.resolveFilterValue(d.value))!=null?u:d.value})});const l=(t??[])?.map(d=>d.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&s&&a.length&&(l.push("__global__"),a.forEach(d=>{var u;i.push({id:d.id,filterFn:s,resolvedValue:(u=s.resolveFilterValue==null?void 0:s.resolveFilterValue(n))!=null?u:n})}));let g,c;for(let d=0;d{u.columnFiltersMeta[m]=v})}if(i.length){for(let f=0;f{u.columnFiltersMeta[m]=v})){u.columnFilters.__global__=!0;break}}u.columnFilters.__global__!==!0&&(u.columnFilters.__global__=!1)}}const S=d=>{for(let u=0;ue._autoResetPageIndex()))}function on(){return e=>h(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,r=[],i=n.filter(a=>{var g;return(g=e.getColumn(a.id))==null?void 0:g.getCanSort()}),l={};i.forEach(a=>{const g=e.getColumn(a.id);g&&(l[a.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const s=a=>{const g=a?.map(c=>({...c}));return g.sort((c,S)=>{for(let u=0;u{var S;r.push(c),(S=c.subRows)!=null&&S.length&&(c.subRows=s(c.subRows))}),g};return{rows:s(t.rows),flatRows:r,rowsById:t.rowsById}},w(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** - * react-table - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function we(e,o){return e?rn(e)?A.createElement(e,o):e:null}function rn(e){return ln(e)||typeof e=="function"||sn(e)}function ln(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function sn(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function un(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=A.useState(()=>({current:Wt(o)})),[n,r]=A.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...n,...e.state},onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}const K="…";function an(e,o,t){const n=t*2+5;if(o<=n)return Array.from({length:o},(g,c)=>c+1);const r=Math.max(e-t,2),i=Math.min(e+t,o-1),l=r>2,s=i0,v=A.useMemo(()=>an(u,d,g),[u,d,g]);if(e?e.getCoreRowModel().rows.length===0&&(!n||n===0):n!==void 0&&n===0)return null;const R=!!e||!!i;if(d<=1&&!R)return null;const x=()=>{f&&(e?e.nextPage():r==null||r(S+1),l==null||l())},M=()=>{m&&(e?e.previousPage():r==null||r(S-1),s==null||s())},F=_=>{const $=Math.min(Math.max(_,1),d);$-1!==S&&(e?e.setPageIndex($-1):r==null||r($-1))},D=_=>{e?e.setPageSize(_):i==null||i(_)},L=S*c+1,N=Math.min(L+c-1,n??0);return p.jsxs("nav",{role:"navigation","aria-label":"Pagination",className:"flex flex-col gap-3 px-2 py-3 text-sm sm:flex-row sm:items-center sm:justify-between",children:[R?p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx("p",{className:"text-xs sm:text-sm font-medium whitespace-nowrap",children:"Rows per page"}),p.jsxs(Xe,{value:`${c}`,onValueChange:_=>{D(Number(_))},children:[p.jsx(Ke,{className:"h-9 sm:h-8 w-[70px] min-w-[70px] text-sm",children:p.jsx(Je,{placeholder:c})}),p.jsx(Qe,{side:"top",children:[10,20,30,40,50]?.map(_=>p.jsx(We,{value:`${_}`,children:_},_))})]})]}):p.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground dark:text-gray-400",children:["Showing"," ",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:L}),"–",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:N})," ","of"," ",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:n})]}),p.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1",children:[p.jsxs(z,{variant:"outline",size:"sm",onClick:M,disabled:!m,"aria-label":"Previous page",className:"h-8 gap-1 px-3 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[p.jsx(Ye,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Previous"})]}),p.jsx("ul",{className:"flex items-center gap-1",children:v?.map((_,$)=>{if(_===K)return p.jsx("li",{"aria-hidden":"true",className:"flex h-8 w-8 items-center justify-center text-gray-400 dark:text-gray-500",children:K},`ellipsis-${$}`);const I=_===u;return p.jsx("li",{children:p.jsx(z,{type:"button",variant:I?"default":"ghost",size:"sm",onClick:()=>F(_),"aria-current":I?"page":void 0,"aria-label":`Go to page ${_}`,className:De("h-8 min-w-8 px-2 text-sm transition-colors",I?"bg-primary text-primary-foreground font-bold hover:bg-primary/90 dark:bg-primary dark:text-primary-foreground":"font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700"),children:_})},_)})}),p.jsxs(z,{variant:"outline",size:"sm",onClick:x,disabled:!f,"aria-label":"Next page",className:"h-8 gap-1 px-3 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[p.jsx("span",{className:"hidden sm:inline",children:"Next"}),p.jsx(Ee,{className:"h-4 w-4"})]})]})]})}function dn({column:e,title:o,options:t}){const n=e==null?void 0:e.getFacetedUniqueValues(),r=new Set(e==null?void 0:e.getFilterValue());return p.jsxs(ot,{children:[p.jsx(rt,{asChild:!0,children:p.jsxs(z,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[p.jsx(at,{className:"mr-2 h-4 w-4"}),o,(r==null?void 0:r.size)>0&&p.jsxs(p.Fragment,{children:[p.jsx(lt,{orientation:"vertical",className:"mx-2 h-4"}),p.jsx(W,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),p.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?p.jsxs(W,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(i=>r.has(i.value))?.map(i=>p.jsx(W,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),p.jsx(it,{className:"w-[200px] p-0",align:"start",children:p.jsxs(Ze,{children:[p.jsx(be,{placeholder:o}),p.jsxs(et,{children:[p.jsx(tt,{children:"No results found."}),p.jsx(pe,{children:t?.map(i=>{const l=r.has(i.value);return p.jsxs(me,{onSelect:()=>{l?r.delete(i.value):r.add(i.value);const s=Array.from(r);e==null||e.setFilterValue(s.length?s:void 0)},children:[p.jsx("div",{className:fe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:p.jsx(je,{className:fe("h-4 w-4")})}),i.icon&&p.jsx(i.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),p.jsx("span",{children:i.label}),(n==null?void 0:n.get(i.value))&&p.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(i.value)})]},i.value)})}),r.size>0&&p.jsxs(p.Fragment,{children:[p.jsx(nt,{}),p.jsx(pe,{children:p.jsx(me,{onSelect:()=>e==null?void 0:e.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function cn({table:e,refreshTable:o}){const[t,n]=A.useState(!1),r=async()=>{if(o)try{n(!0),await o()}finally{n(!1)}},{t:i}=Ce();return p.jsxs("div",{className:"flex flex-wrap justify-end gap-2 sm:gap-3 mt-2",children:[p.jsxs(z,{variant:"outline",size:"sm",className:"h-8",onClick:r,children:[p.jsx(st,{className:`mr-2 transition-transform duration-500 ${t?"animate-spin":""}`}),i("dashboard.refresh")]}),p.jsxs(Ae,{children:[p.jsx(Ge,{asChild:!0,children:p.jsxs(z,{variant:"outline",size:"sm",className:"h-8",children:[p.jsx(dt,{className:"mr-2"}),i("viewDetail.view")]})}),p.jsxs(He,{align:"end",className:"w-[150px]",children:[p.jsx(Le,{children:i("viewDetail.toogleColumns")}),p.jsx(ze,{}),e.getAllColumns().filter(l=>typeof l.accessorFn<"u"&&l.getCanHide())?.map(l=>p.jsx(Ne,{className:"capitalize",checked:l.getIsVisible(),onCheckedChange:s=>l.toggleVisibility(!!s),children:i(`toogle.${l.id}`)},l.id))]})]})]})}function fn({table:e,tableName:o,toolBarPosition:t="left",extraToolbar:n,filters:r=[],refreshTable:i,onGlobalFilterChange:l,hideToolbarFilter:s=!1}){const a=e.getState().columnFilters.length>0;return p.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!s&&p.jsx(ke,{placeholder:`Filter ${o}...`,onChange:g=>{const c=g.target.value;e.setGlobalFilter(c),l==null||l(c)},className:"h-8 w-full sm:w-[150px] lg:w-[250px]"}),r?.map(({columnKey:g,title:c,options:S,isVisible:d=!0})=>d&&e.getColumn(g)&&p.jsx(dn,{column:e.getColumn(g),title:c,options:S},g)),a&&p.jsxs(z,{variant:"ghost",onClick:()=>e.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",p.jsx(Oe,{className:"ml-2 h-4 w-4"})]})]}),p.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${t==="center"?"justify-center":t==="left"?"justify-start":"justify-end"}`,children:[n,p.jsx(cn,{table:e,refreshTable:i})]})]})}function Fn({columns:e,data:o,tableName:t,initialColumnVisibility:n,extraToolbar:r,toolBarPosition:i="right",isLoading:l=!1,itemCount:s,onPageChange:a,onPageSizeChange:g,nextFunction:c,prevFunction:S,pageIndex:d,pageSize:u=10,refresh:f,onGlobalFilterChange:m,hideToolbarFilter:v=!1}){var _;const[C,R]=A.useState([]),[x,M]=A.useState([]),[F,D]=A.useState(()=>({letterName:!1,fileName:!1,...n??{}})),[L,N]=A.useState({}),{t:k}=Ce(),E=un({data:o,columns:e,pageCount:u>0?Math.ceil(s/u):1,state:{sorting:C,columnVisibility:F,rowSelection:L,columnFilters:x,pagination:{pageIndex:d,pageSize:u}},manualPagination:!0,enableRowSelection:!0,onRowSelectionChange:N,onSortingChange:R,onColumnFiltersChange:M,onColumnVisibilityChange:D,getCoreRowModel:Yt(),getFilteredRowModel:nn(),getSortedRowModel:on(),getFacetedRowModel:en(),getFacetedUniqueValues:tn()});return p.jsxs("div",{className:"space-y-4",children:[p.jsx(fn,{table:E,tableName:t,extraToolbar:r,toolBarPosition:i,refreshTable:f,onGlobalFilterChange:m,hideToolbarFilter:v}),p.jsx("div",{className:"rounded-md border dark:border-gray-700 bg-white dark:bg-gray-900 overflow-x-auto font-urbanist custom-scrollbar",children:p.jsxs(Te,{className:"w-full text-base text-gray-700 dark:text-gray-300 font-urbanist",children:[p.jsx(Be,{className:"bg-gray-50 dark:bg-gray-800",children:E.getHeaderGroups()?.map($=>p.jsx(B,{className:"dark:border-gray-700",children:$.headers?.map(I=>p.jsx(qe,{className:"text-base text-gray-500 dark:text-gray-400 dark:bg-gray-800",children:I.isPlaceholder?null:we(I.column.columnDef.header,I.getContext())},I.id))},$.id))}),p.jsx(Ue,{children:l?p.jsx(B,{children:p.jsx(Q,{colSpan:e.length,className:"text-center py-6",children:"Loading..."})}):(_=E.getRowModel().rows)!=null&&_.length?E.getRowModel().rows?.map($=>p.jsx(B,{"data-state":$.getIsSelected()&&"selected",className:` - transition-colors duration-150 - ${$.original.isUrgent===!0&&t==="Pending Records"||$.original.signStatus==="draft"&&t==="Collaborations"||$.original.action==="inprogress"&&t==="My Approval Records"?"bg-yellow-200 dark:bg-yellow-900/30 hover:bg-yellow-300 dark:hover:bg-yellow-900/50":"hover:bg-gray-100 dark:hover:bg-gray-800"} - ${t==="Pending Approval Tasks"&&"bg-primary-50 dark:bg-primary-900/20 hover:bg-primary-100 dark:hover:bg-primary-900/30 font-semibold border-l-4 border-l-primary-500 dark:border-l-primary-400"} - `,children:$.getVisibleCells()?.map(I=>p.jsx(Q,{className:"py-4",children:p.jsx("div",{className:"max-h-[110px] max-w-[460px] overflow-y-auto overflow-x-auto scrollbar-hidden hover:cursor-pointer custom-scrollbar",children:we(I.column.columnDef.cell,I.getContext())})},I.id))},$.id)):p.jsx(B,{children:p.jsx(Q,{colSpan:e.length,className:"text-center py-6",children:k("common.noResult")})})})]})}),s>u&&p.jsx(gn,{pageIndex:d,pageSize:u,itemCount:s,onPageChange:a,onPageSizeChange:g,nextFunction:c,prevFunction:S})]})}export{Fn as A,at as C}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-vWyUWUDX.js b/apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-vWyUWUDX.js deleted file mode 100644 index 1c26f7c34..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/AdvancedTable-vWyUWUDX.js +++ /dev/null @@ -1,33 +0,0 @@ -import{y as ve,r as A,j as p,B as z,b8 as De,aJ as Ee,aP as je,u as Ce,aA as Ae,aB as Ge,aC as He,aD as Le,b_ as ze,cD as Ne,I as ke,aS as Oe}from"./index-7T7TTikv.js";import{T as Te,a as Be,b as B,c as qe,d as Ue,e as Q}from"./table-D_B7hhqb.js";import{S as Xe,a as Ke,b as Je,c as Qe,d as We}from"./select--i8koVXg.js";import{C as Ye}from"./chevron-left-G_a9-f9o.js";import{c as fe}from"./utils-N2wtfq7C.js";import{B as W}from"./badge-D4t6Wb1T.js";import{C as Ze,a as be,b as et,c as tt,d as pe,e as me,f as nt}from"./command-B6S1IvD4.js";import{P as ot,a as rt,b as it}from"./popover-CSKEA8hg.js";import{S as lt}from"./separator-BXi_hr72.js";import{R as st}from"./refresh-cw-B7fipPS4.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ut=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],at=ve("circle-plus",ut);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gt=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],dt=ve("settings-2",gt);/** - * table-core - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function G(e,o){return typeof e=="function"?e(o):e}function V(e,o){return t=>{o.setState(n=>({...n,[e]:G(t,n[e])}))}}function J(e){return e instanceof Function}function ct(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function ft(e,o){const t=[],n=r=>{r.forEach(i=>{t.push(i);const l=o(i);l!=null&&l.length&&n(l)})};return n(e),t}function h(e,o,t){let n=[],r;return i=>{let l;t.key&&t.debug&&(l=Date.now());const s=e(i);if(!(s.length!==n.length||s.some((c,S)=>n[S]!==c)))return r;n=s;let g;if(t.key&&t.debug&&(g=Date.now()),r=o(...s),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const c=Math.round((Date.now()-l)*100)/100,d=Math.round((Date.now()-g)*100)/100/16,u=(f,m)=>{for(f=String(f);f.length{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[o]},key:!1,onChange:n}}function pt(e,o,t,n){const r=()=>{var l;return(l=i.getValue())!=null?l:e.options.renderFallbackValue},i={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:r,getContext:h(()=>[e,t,o,i],(l,s,a,g)=>({table:l,column:s,row:a,cell:g,getValue:g.getValue,renderValue:g.renderValue}),w(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(i,t,o,e)},{}),i}function mt(e,o,t,n){var r,i;const s={...e._getDefaultColumnDef(),...o},a=s.accessorKey;let g=(r=(i=s.id)!=null?i:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?r:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:a&&(a.includes(".")?c=d=>{let u=d;for(const m of a.split(".")){var f;u=(f=u)==null?void 0:f[m]}return u}:c=d=>d[s.accessorKey]),!g)throw new Error;let S={id:`${String(g)}`,accessorFn:c,parent:n,depth:t,columnDef:s,columns:[],getFlatColumns:h(()=>[!0],()=>{var d;return[S,...(d=S.columns)==null?void 0:d.flatMap(u=>u.getFlatColumns())]},w(e.options,"debugColumns")),getLeafColumns:h(()=>[e._getOrderColumnsFn()],d=>{var u;if((u=S.columns)!=null&&u.length){let f=S.columns.flatMap(m=>m.getLeafColumns());return d(f)}return[S]},w(e.options,"debugColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(S,e);return S}const y="debugHeaders";function Se(e,o,t){var n;let i={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(s),l.push(a)};return s(i),l},getContext:()=>({table:e,header:i,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(i,e)}),i}const St={createTable:e=>{e.getHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>{var i,l;const s=(i=n==null?void 0:n.map(S=>t.find(d=>d.id===S)).filter(Boolean))!=null?i:[],a=(l=r==null?void 0:r.map(S=>t.find(d=>d.id===S)).filter(Boolean))!=null?l:[],g=t.filter(S=>!(n!=null&&n.includes(S.id))&&!(r!=null&&r.includes(S.id)));return q(o,[...s,...g,...a],e)},w(e.options,y)),e.getCenterHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>(t=t.filter(i=>!(n!=null&&n.includes(i.id))&&!(r!=null&&r.includes(i.id))),q(o,t,e,"center")),w(e.options,y)),e.getLeftHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var r;const i=(r=n==null?void 0:n.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return q(o,i,e,"left")},w(e.options,y)),e.getRightHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var r;const i=(r=n==null?void 0:n.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return q(o,i,e,"right")},w(e.options,y)),e.getFooterGroups=h(()=>[e.getHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getLeftFooterGroups=h(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getCenterFooterGroups=h(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getRightFooterGroups=h(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getFlatHeaders=h(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),w(e.options,y)),e.getLeftFlatHeaders=h(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),w(e.options,y)),e.getCenterFlatHeaders=h(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),w(e.options,y)),e.getRightFlatHeaders=h(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),w(e.options,y)),e.getCenterLeafHeaders=h(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getLeftLeafHeaders=h(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getRightLeafHeaders=h(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getLeafHeaders=h(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,i,l,s,a,g;return[...(r=(i=o[0])==null?void 0:i.headers)!=null?r:[],...(l=(s=t[0])==null?void 0:s.headers)!=null?l:[],...(a=(g=n[0])==null?void 0:g.headers)!=null?a:[]].map(c=>c.getLeafHeaders()).flat()},w(e.options,y))}};function q(e,o,t,n){var r,i;let l=0;const s=function(d,u){u===void 0&&(u=1),l=Math.max(l,u),d.filter(f=>f.getIsVisible()).forEach(f=>{var m;(m=f.columns)!=null&&m.length&&s(f.columns,u+1)},0)};s(e);let a=[];const g=(d,u)=>{const f={depth:u,id:[n,`${u}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(v=>{const C=[...m].reverse()[0],R=v.column.depth===f.depth;let x,M=!1;if(R&&v.column.parent?x=v.column.parent:(x=v.column,M=!0),C&&(C==null?void 0:C.column)===x)C.subHeaders.push(v);else{const F=Se(t,x,{id:[n,u,x.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${m.filter(D=>D.column===x).length}`:void 0,depth:u,index:m.length});F.subHeaders.push(v),m.push(F)}f.headers.push(v),v.headerGroup=f}),a.push(f),u>0&&g(m,u-1)},c=o.map((d,u)=>Se(t,d,{depth:l,index:u}));g(c,l-1),a.reverse();const S=d=>d.filter(f=>f.column.getIsVisible()).map(f=>{let m=0,v=0,C=[0];f.subHeaders&&f.subHeaders.length?(C=[],S(f.subHeaders).forEach(x=>{let{colSpan:M,rowSpan:F}=x;m+=M,C.push(F)})):m=1;const R=Math.min(...C);return v=v+R,f.colSpan=m,f.rowSpan=v,{colSpan:m,rowSpan:v}});return S((r=(i=a[0])==null?void 0:i.headers)!=null?r:[]),a}const ae=(e,o,t,n,r,i,l)=>{let s={id:o,index:n,original:t,depth:r,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return s._valuesCache[a]=g.accessorFn(s.original,n),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=g.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var g;return(g=s.getValue(a))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>ft(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let a=[],g=s;for(;;){const c=g.getParentRow();if(!c)break;a.push(c),g=c}return a.reverse()},getAllCells:h(()=>[e.getAllLeafColumns()],a=>a.map(g=>pt(e,s,g,g.id)),w(e.options,"debugRows")),_getAllCellsByColumnId:h(()=>[s.getAllCells()],a=>a.reduce((g,c)=>(g[c.column.id]=c,g),{}),w(e.options,"debugRows"))};for(let a=0;a{e._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():o.getPreFilteredRowModel(),e._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Re=(e,o,t)=>{var n,r;const i=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((r=e.getValue(o))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(i))};Re.autoRemove=e=>P(e);const xe=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};xe.autoRemove=e=>P(e);const _e=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};_e.autoRemove=e=>P(e);const Fe=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};Fe.autoRemove=e=>P(e);const ye=(e,o,t)=>!t.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});ye.autoRemove=e=>P(e)||!(e!=null&&e.length);const $e=(e,o,t)=>t.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});$e.autoRemove=e=>P(e)||!(e!=null&&e.length);const Me=(e,o,t)=>e.getValue(o)===t;Me.autoRemove=e=>P(e);const Ve=(e,o,t)=>e.getValue(o)==t;Ve.autoRemove=e=>P(e);const ge=(e,o,t)=>{let[n,r]=t;const i=e.getValue(o);return i>=n&&i<=r};ge.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,r=typeof t!="number"?parseFloat(t):t,i=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(r)?1/0:r;if(i>l){const s=i;i=l,l=s}return[i,l]};ge.autoRemove=e=>P(e)||P(e[0])&&P(e[1]);const j={includesString:Re,includesStringSensitive:xe,equalsString:_e,arrIncludes:Fe,arrIncludesAll:ye,arrIncludesSome:$e,equals:Me,weakEquals:Ve,inNumberRange:ge};function P(e){return e==null||e===""}const wt={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:V("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?j.includesString:typeof n=="number"?j.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?j.equals:Array.isArray(n)?j.arrIncludes:j.weakEquals},e.getFilterFn=()=>{var t,n;return J(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:j[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const r=e.getFilterFn(),i=n==null?void 0:n.find(c=>c.id===e.id),l=G(t,i?i.value:void 0);if(he(r,l,e)){var s;return(s=n==null?void 0:n.filter(c=>c.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(i){var g;return(g=n==null?void 0:n.map(c=>c.id===e.id?a:c))!=null?g:[]}return n!=null&&n.length?[...n,a]:[a]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=r=>{var i;return(i=G(o,r))==null?void 0:i.filter(l=>{const s=t.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(he(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function he(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const vt=(e,o,t)=>t.reduce((n,r)=>{const i=r.getValue(e);return n+(typeof i=="number"?i:0)},0),Ct=(e,o,t)=>{let n;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}),n},Rt=(e,o,t)=>{let n;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(n=i)&&(n=i)}),n},xt=(e,o,t)=>{let n,r;return t.forEach(i=>{const l=i.getValue(e);l!=null&&(n===void 0?l>=l&&(n=r=l):(n>l&&(n=l),r{let t=0,n=0;if(o.forEach(r=>{let i=r.getValue(e);i!=null&&(i=+i)>=i&&(++t,n+=i)}),t)return n/t},Ft=(e,o)=>{if(!o.length)return;const t=o.map(i=>i.getValue(e));if(!ct(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),r=t.sort((i,l)=>i-l);return t.length%2!==0?r[n]:(r[n-1]+r[n])/2},yt=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),$t=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,Mt=(e,o)=>o.length,Y={sum:vt,min:Ct,max:Rt,extent:xt,mean:_t,median:Ft,unique:yt,uniqueCount:$t,count:Mt},Vt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:V("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return Y.sum;if(Object.prototype.toString.call(n)==="[object Date]")return Y.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return J(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=o.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:Y[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function It(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(i=>!o.includes(i.id));return t==="remove"?n:[...o.map(i=>e.find(l=>l.id===i)).filter(Boolean),...n]}const Pt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:V("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=h(t=>[T(o,t)],t=>t.findIndex(n=>n.id===e.id),w(o.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=T(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=T(o,t);return((n=r[r.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=h(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>r=>{let i=[];if(!(o!=null&&o.length))i=r;else{const l=[...o],s=[...r];for(;s.length&&l.length;){const a=l.shift(),g=s.findIndex(c=>c.id===a);g>-1&&i.push(s.splice(g,1)[0])}i=[...i,...s]}return It(i,t,n)},w(e.options,"debugTable"))}},Z=()=>({left:[],right:[]}),Dt={getInitialState:e=>({columnPinning:Z(),...e}),getDefaultOptions:e=>({onColumnPinningChange:V("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(r=>r.id).filter(Boolean);o.setColumnPinning(r=>{var i,l;if(t==="right"){var s,a;return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(S=>!(n!=null&&n.includes(S))),right:[...((a=r==null?void 0:r.right)!=null?a:[]).filter(S=>!(n!=null&&n.includes(S))),...n]}}if(t==="left"){var g,c;return{left:[...((g=r==null?void 0:r.left)!=null?g:[]).filter(S=>!(n!=null&&n.includes(S))),...n],right:((c=r==null?void 0:r.right)!=null?c:[]).filter(S=>!(n!=null&&n.includes(S)))}}return{left:((i=r==null?void 0:r.left)!=null?i:[]).filter(S=>!(n!=null&&n.includes(S))),right:((l=r==null?void 0:r.right)!=null?l:[]).filter(S=>!(n!=null&&n.includes(S)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var r,i,l;return((r=n.columnDef.enablePinning)!=null?r:!0)&&((i=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(s=>s.id),{left:n,right:r}=o.getState().columnPinning,i=t.some(s=>n==null?void 0:n.includes(s)),l=t.some(s=>r==null?void 0:r.includes(s));return i?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();return r?(t=(n=o.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(l=>!i.includes(l.column.id))},w(o.options,"debugRows")),e.getLeftVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),w(o.options,"debugRows")),e.getRightVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),w(o.options,"debugRows"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?Z():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:Z())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var r,i;return!!((r=n.left)!=null&&r.length||(i=n.right)!=null&&i.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),w(e.options,"debugColumns")),e.getRightLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),w(e.options,"debugColumns")),e.getCenterLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const r=[...t??[],...n??[]];return o.filter(i=>!r.includes(i.id))},w(e.options,"debugColumns"))}};function Et(e){return e||(typeof document<"u"?document:null)}const U={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},b=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),jt={getDefaultColumnDef:()=>U,getInitialState:e=>({columnSizing:{},columnSizingInfo:b(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:V("columnSizing",e),onColumnSizingInfoChange:V("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,r;const i=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:U.minSize,(n=i??e.columnDef.size)!=null?n:U.size),(r=e.columnDef.maxSize)!=null?r:U.maxSize)},e.getStart=h(t=>[t,T(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((r,i)=>r+i.getSize(),0),w(o.options,"debugColumns")),e.getAfter=h(t=>[t,T(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((r,i)=>r+i.getSize(),0),w(o.options,"debugColumns")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=r=>{if(r.subHeaders.length)r.subHeaders.forEach(n);else{var i;t+=(i=r.column.getSize())!=null?i:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return i=>{if(!n||!r||(i.persist==null||i.persist(),ee(i)&&i.touches&&i.touches.length>1))return;const l=e.getSize(),s=e?e.getLeafHeaders().map(C=>[C.column.id,C.column.getSize()]):[[n.id,n.getSize()]],a=ee(i)?Math.round(i.touches[0].clientX):i.clientX,g={},c=(C,R)=>{typeof R=="number"&&(o.setColumnSizingInfo(x=>{var M,F;const D=o.options.columnResizeDirection==="rtl"?-1:1,L=(R-((M=x==null?void 0:x.startOffset)!=null?M:0))*D,N=Math.max(L/((F=x==null?void 0:x.startSize)!=null?F:0),-.999999);return x.columnSizingStart.forEach(k=>{let[E,_]=k;g[E]=Math.round(Math.max(_+_*N,0)*100)/100}),{...x,deltaOffset:L,deltaPercentage:N}}),(o.options.columnResizeMode==="onChange"||C==="end")&&o.setColumnSizing(x=>({...x,...g})))},S=C=>c("move",C),d=C=>{c("end",C),o.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=Et(t),f={moveHandler:C=>S(C.clientX),upHandler:C=>{u==null||u.removeEventListener("mousemove",f.moveHandler),u==null||u.removeEventListener("mouseup",f.upHandler),d(C.clientX)}},m={moveHandler:C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),S(C.touches[0].clientX),!1),upHandler:C=>{var R;u==null||u.removeEventListener("touchmove",m.moveHandler),u==null||u.removeEventListener("touchend",m.upHandler),C.cancelable&&(C.preventDefault(),C.stopPropagation()),d((R=C.touches[0])==null?void 0:R.clientX)}},v=At()?{passive:!1}:!1;ee(i)?(u==null||u.addEventListener("touchmove",m.moveHandler,v),u==null||u.addEventListener("touchend",m.upHandler,v)):(u==null||u.addEventListener("mousemove",f.moveHandler,v),u==null||u.addEventListener("mouseup",f.upHandler,v)),o.setColumnSizingInfo(C=>({...C,startOffset:a,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=o=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(o),e.setColumnSizingInfo=o=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(o),e.resetColumnSizing=o=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?b():(t=e.initialState.columnSizingInfo)!=null?t:b())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0}}};let X=null;function At(){if(typeof X=="boolean")return X;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return X=e,X}function ee(e){return e.type==="touchstart"}const Gt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:V("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const r=e.columns;return(t=r.length?r.some(i=>i.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=h(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),w(o.options,"debugRows")),e.getVisibleCells=h(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,r)=>[...t,...n,...r],w(o.options,"debugRows"))},createTable:e=>{const o=(t,n)=>h(()=>[n(),n().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),w(e.options,"debugColumns"));e.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,i)=>({...r,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function T(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Ht={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Lt={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:V("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,r,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&((i=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>j.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return J(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:j[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},zt={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:V("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var r,i;e.setExpanded(n?{}:(r=(i=e.initialState)==null?void 0:i.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const l=i.split(".");n=Math.max(n,l.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var r;const i=n===!0?!0:!!(n!=null&&n[e.id]);let l={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=n,t=(r=t)!=null?r:!i,!i&&t)return{...l,[e.id]:!0};if(i&&!t){const{[e.id]:s,...a}=l;return a}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,r;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},re=0,ie=10,te=()=>({pageIndex:re,pageSize:ie}),Nt={getInitialState:e=>({...e,pagination:{...te(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:V("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const r=i=>G(n,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=n=>{var r;e.setPagination(n?te():(r=e.initialState.pagination)!=null?r:te())},e.setPageIndex=n=>{e.setPagination(r=>{let i=G(n,r.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,l)),{...r,pageIndex:i}})},e.resetPageIndex=n=>{var r,i;e.setPageIndex(n?re:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?r:re)},e.resetPageSize=n=>{var r,i;e.setPageSize(n?ie:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?r:ie)},e.setPageSize=n=>{e.setPagination(r=>{const i=Math.max(1,G(n,r.pageSize)),l=r.pageSize*r.pageIndex,s=Math.floor(l/i);return{...r,pageIndex:s,pageSize:i}})},e.setPageCount=n=>e.setPagination(r=>{var i;let l=G(n,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...r,pageCount:l}}),e.getPageOptions=h(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null).map((i,l)=>l)),r},w(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:ne.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},ne=()=>({top:[],bottom:[]}),kt={getInitialState:e=>({rowPinning:ne(),...e}),getDefaultOptions:e=>({onRowPinningChange:V("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,r)=>{const i=n?e.getLeafRows().map(a=>{let{id:g}=a;return g}):[],l=r?e.getParentRows().map(a=>{let{id:g}=a;return g}):[],s=new Set([...l,e.id,...i]);o.setRowPinning(a=>{var g,c;if(t==="bottom"){var S,d;return{top:((S=a==null?void 0:a.top)!=null?S:[]).filter(m=>!(s!=null&&s.has(m))),bottom:[...((d=a==null?void 0:a.bottom)!=null?d:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)]}}if(t==="top"){var u,f;return{top:[...((u=a==null?void 0:a.top)!=null?u:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)],bottom:((f=a==null?void 0:a.bottom)!=null?f:[]).filter(m=>!(s!=null&&s.has(m)))}}return{top:((g=a==null?void 0:a.top)!=null?g:[]).filter(m=>!(s!=null&&s.has(m))),bottom:((c=a==null?void 0:a.bottom)!=null?c:[]).filter(m=>!(s!=null&&s.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:r}=o.options;return typeof n=="function"?n(e):(t=n??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:r}=o.getState().rowPinning,i=t.some(s=>n==null?void 0:n.includes(s)),l=t.some(s=>r==null?void 0:r.includes(s));return i?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();if(!r)return-1;const i=(t=r==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(l=>{let{id:s}=l;return s});return(n=i==null?void 0:i.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?ne():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:ne())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var r,i;return!!((r=n.top)!=null&&r.length||(i=n.bottom)!=null&&i.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[]).map(l=>{const s=e.getRow(l,!0);return s.getIsAllParentsExpanded()?s:null}):(t??[]).map(l=>o.find(s=>s.id===l))).filter(Boolean).map(l=>({...l,position:n}))},e.getTopRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),w(e.options,"debugRows")),e.getBottomRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),w(e.options,"debugRows")),e.getCenterRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const r=new Set([...t??[],...n??[]]);return o.filter(i=>!r.has(i.id))},w(e.options,"debugRows"))}},Ot={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:V("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},r=e.getPreGroupedRowModel().flatRows;return o?r.forEach(i=>{i.getCanSelect()&&(n[i.id]=!0)}):r.forEach(i=>{delete n[i.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(i=>{le(r,i.id,n,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=h(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getFilteredSelectedRowModel=h(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getGroupedSelectedRowModel=h(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(r=>r.getCanSelect()&&!t[r.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(r=>!t[r.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const r=e.getIsSelected();o.setRowSelection(i=>{var l;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return i;const s={...i};return le(s,e.id,t,(l=n==null?void 0:n.selectChildren)!=null?l:!0,o),s})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return de(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return se(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return se(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected((r=n.target)==null?void 0:r.checked)}}}},le=(e,o,t,n,r)=>{var i;const l=r.getRow(o,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),l.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(i=l.subRows)!=null&&i.length&&l.getCanSelectSubRows()&&l.subRows.forEach(s=>le(e,s.id,t,n,r))};function oe(e,o){const t=e.getState().rowSelection,n=[],r={},i=function(l,s){return l.map(a=>{var g;const c=de(a,t);if(c&&(n.push(a),r[a.id]=a),(g=a.subRows)!=null&&g.length&&(a={...a,subRows:i(a.subRows)}),c)return a}).filter(Boolean)};return{rows:i(o.rows),flatRows:n,rowsById:r}}function de(e,o){var t;return(t=o[e.id])!=null?t:!1}function se(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let r=!0,i=!1;return e.subRows.forEach(l=>{if(!(i&&!r)&&(l.getCanSelect()&&(de(l,o)?i=!0:r=!1),l.subRows&&l.subRows.length)){const s=se(l,o);s==="all"?i=!0:(s==="some"&&(i=!0),r=!1)}}),r?"all":i?"some":!1}const ue=/([0-9]+)/gm,Tt=(e,o,t)=>Ie(H(e.getValue(t)).toLowerCase(),H(o.getValue(t)).toLowerCase()),Bt=(e,o,t)=>Ie(H(e.getValue(t)),H(o.getValue(t))),qt=(e,o,t)=>ce(H(e.getValue(t)).toLowerCase(),H(o.getValue(t)).toLowerCase()),Ut=(e,o,t)=>ce(H(e.getValue(t)),H(o.getValue(t))),Xt=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:nce(e.getValue(t),o.getValue(t));function ce(e,o){return e===o?0:e>o?1:-1}function H(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Ie(e,o){const t=e.split(ue).filter(Boolean),n=o.split(ue).filter(Boolean);for(;t.length&&n.length;){const r=t.shift(),i=n.shift(),l=parseInt(r,10),s=parseInt(i,10),a=[l,s].sort();if(isNaN(a[0])){if(r>i)return 1;if(i>r)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return t.length-n.length}const O={alphanumeric:Tt,alphanumericCaseSensitive:Bt,text:qt,textCaseSensitive:Ut,datetime:Xt,basic:Kt},Jt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:V("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const r of t){const i=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return O.datetime;if(typeof i=="string"&&(n=!0,i.split(ue).length>1))return O.alphanumeric}return n?O.text:O.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return J(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:O[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const r=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;o.setSorting(l=>{const s=l==null?void 0:l.find(u=>u.id===e.id),a=l==null?void 0:l.findIndex(u=>u.id===e.id);let g=[],c,S=i?t:r==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?s?c="toggle":c="add":l!=null&&l.length&&a!==l.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(i||r||(c="remove")),c==="add"){var d;g=[...l,{id:e.id,desc:S}],g.splice(0,g.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?g=l.map(u=>u.id===e.id?{...u,desc:S}:u):c==="remove"?g=l.filter(u=>u.id!==e.id):g=[{id:e.id,desc:S}];return g})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,r;const i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(r=o.options.enableMultiRemove)!=null)||r)?!1:l==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Qt=[St,Gt,Pt,Dt,ht,wt,Ht,Lt,Jt,Vt,zt,Nt,kt,Ot,jt];function Wt(e){var o,t;const n=[...Qt,...(o=e._features)!=null?o:[]];let r={_features:n};const i=r._features.reduce((d,u)=>Object.assign(d,u.getDefaultOptions==null?void 0:u.getDefaultOptions(r)),{}),l=d=>r.options.mergeOptions?r.options.mergeOptions(i,d):{...i,...d};let a={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(d=>{var u;a=(u=d.getInitialState==null?void 0:d.getInitialState(a))!=null?u:a});const g=[];let c=!1;const S={_features:n,options:{...i,...e},initialState:a,_queue:d=>{g.push(d),c||(c=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();c=!1}).catch(u=>setTimeout(()=>{throw u})))},reset:()=>{r.setState(r.initialState)},setOptions:d=>{const u=G(d,r.options);r.options=l(u)},getState:()=>r.options.state,setState:d=>{r.options.onStateChange==null||r.options.onStateChange(d)},_getRowId:(d,u,f)=>{var m;return(m=r.options.getRowId==null?void 0:r.options.getRowId(d,u,f))!=null?m:`${f?[f.id,u].join("."):u}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(d,u)=>{let f=(u?r.getPrePaginationRowModel():r.getRowModel()).rowsById[d];if(!f&&(f=r.getCoreRowModel().rowsById[d],!f))throw new Error;return f},_getDefaultColumnDef:h(()=>[r.options.defaultColumn],d=>{var u;return d=(u=d)!=null?u:{},{header:f=>{const m=f.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:f=>{var m,v;return(m=(v=f.renderValue())==null||v.toString==null?void 0:v.toString())!=null?m:null},...r._features.reduce((f,m)=>Object.assign(f,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...d}},w(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:h(()=>[r._getColumnDefs()],d=>{const u=function(f,m,v){return v===void 0&&(v=0),f.map(C=>{const R=mt(r,C,v,m),x=C;return R.columns=x.columns?u(x.columns,R,v+1):[],R})};return u(d)},w(e,"debugColumns")),getAllFlatColumns:h(()=>[r.getAllColumns()],d=>d.flatMap(u=>u.getFlatColumns()),w(e,"debugColumns")),_getAllFlatColumnsById:h(()=>[r.getAllFlatColumns()],d=>d.reduce((u,f)=>(u[f.id]=f,u),{}),w(e,"debugColumns")),getAllLeafColumns:h(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(d,u)=>{let f=d.flatMap(m=>m.getLeafColumns());return u(f)},w(e,"debugColumns")),getColumn:d=>r._getAllFlatColumnsById()[d]};Object.assign(r,S);for(let d=0;dh(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,i,l){i===void 0&&(i=0);const s=[];for(let g=0;ge._autoResetPageIndex()))}function Pe(e,o,t){return t.options.filterFromLeafRows?Zt(e,o,t):bt(e,o,t)}function Zt(e,o,t){var n;const r=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,s=function(a,g){g===void 0&&(g=0);const c=[];for(let d=0;dh(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r)return t;const i=[...n.map(s=>s.id).filter(s=>s!==o),r?"__global__":void 0].filter(Boolean),l=s=>{for(let a=0;ah(()=>{var t;return[(t=e.getColumn(o))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let n=new Map;for(let i=0;ih(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let d=0;d{var u;const f=e.getColumn(d.id);if(!f)return;const m=f.getFilterFn();m&&r.push({id:d.id,filterFn:m,resolvedValue:(u=m.resolveFilterValue==null?void 0:m.resolveFilterValue(d.value))!=null?u:d.value})});const l=(t??[]).map(d=>d.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&s&&a.length&&(l.push("__global__"),a.forEach(d=>{var u;i.push({id:d.id,filterFn:s,resolvedValue:(u=s.resolveFilterValue==null?void 0:s.resolveFilterValue(n))!=null?u:n})}));let g,c;for(let d=0;d{u.columnFiltersMeta[m]=v})}if(i.length){for(let f=0;f{u.columnFiltersMeta[m]=v})){u.columnFilters.__global__=!0;break}}u.columnFilters.__global__!==!0&&(u.columnFilters.__global__=!1)}}const S=d=>{for(let u=0;ue._autoResetPageIndex()))}function on(){return e=>h(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,r=[],i=n.filter(a=>{var g;return(g=e.getColumn(a.id))==null?void 0:g.getCanSort()}),l={};i.forEach(a=>{const g=e.getColumn(a.id);g&&(l[a.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const s=a=>{const g=a.map(c=>({...c}));return g.sort((c,S)=>{for(let u=0;u{var S;r.push(c),(S=c.subRows)!=null&&S.length&&(c.subRows=s(c.subRows))}),g};return{rows:s(t.rows),flatRows:r,rowsById:t.rowsById}},w(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** - * react-table - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function we(e,o){return e?rn(e)?A.createElement(e,o):e:null}function rn(e){return ln(e)||typeof e=="function"||sn(e)}function ln(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function sn(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function un(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=A.useState(()=>({current:Wt(o)})),[n,r]=A.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...n,...e.state},onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}const K="…";function an(e,o,t){const n=t*2+5;if(o<=n)return Array.from({length:o},(g,c)=>c+1);const r=Math.max(e-t,2),i=Math.min(e+t,o-1),l=r>2,s=i0,v=A.useMemo(()=>an(u,d,g),[u,d,g]);if(e?e.getCoreRowModel().rows.length===0&&(!n||n===0):n!==void 0&&n===0)return null;const R=!!e||!!i;if(d<=1&&!R)return null;const x=()=>{f&&(e?e.nextPage():r==null||r(S+1),l==null||l())},M=()=>{m&&(e?e.previousPage():r==null||r(S-1),s==null||s())},F=_=>{const $=Math.min(Math.max(_,1),d);$-1!==S&&(e?e.setPageIndex($-1):r==null||r($-1))},D=_=>{e?e.setPageSize(_):i==null||i(_)},L=S*c+1,N=Math.min(L+c-1,n??0);return p.jsxs("nav",{role:"navigation","aria-label":"Pagination",className:"flex flex-col gap-3 px-2 py-3 text-sm sm:flex-row sm:items-center sm:justify-between",children:[R?p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx("p",{className:"text-xs sm:text-sm font-medium whitespace-nowrap",children:"Rows per page"}),p.jsxs(Xe,{value:`${c}`,onValueChange:_=>{D(Number(_))},children:[p.jsx(Ke,{className:"h-9 sm:h-8 w-[70px] min-w-[70px] text-sm",children:p.jsx(Je,{placeholder:c})}),p.jsx(Qe,{side:"top",children:[10,20,30,40,50].map(_=>p.jsx(We,{value:`${_}`,children:_},_))})]})]}):p.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground dark:text-gray-400",children:["Showing"," ",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:L}),"–",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:N})," ","of"," ",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:n})]}),p.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1",children:[p.jsxs(z,{variant:"outline",size:"sm",onClick:M,disabled:!m,"aria-label":"Previous page",className:"h-8 gap-1 px-3 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[p.jsx(Ye,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Previous"})]}),p.jsx("ul",{className:"flex items-center gap-1",children:v.map((_,$)=>{if(_===K)return p.jsx("li",{"aria-hidden":"true",className:"flex h-8 w-8 items-center justify-center text-gray-400 dark:text-gray-500",children:K},`ellipsis-${$}`);const I=_===u;return p.jsx("li",{children:p.jsx(z,{type:"button",variant:I?"default":"ghost",size:"sm",onClick:()=>F(_),"aria-current":I?"page":void 0,"aria-label":`Go to page ${_}`,className:De("h-8 min-w-8 px-2 text-sm transition-colors",I?"bg-primary text-primary-foreground font-bold hover:bg-primary/90 dark:bg-primary dark:text-primary-foreground":"font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700"),children:_})},_)})}),p.jsxs(z,{variant:"outline",size:"sm",onClick:x,disabled:!f,"aria-label":"Next page",className:"h-8 gap-1 px-3 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[p.jsx("span",{className:"hidden sm:inline",children:"Next"}),p.jsx(Ee,{className:"h-4 w-4"})]})]})]})}function dn({column:e,title:o,options:t}){const n=e==null?void 0:e.getFacetedUniqueValues(),r=new Set(e==null?void 0:e.getFilterValue());return p.jsxs(ot,{children:[p.jsx(rt,{asChild:!0,children:p.jsxs(z,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[p.jsx(at,{className:"mr-2 h-4 w-4"}),o,(r==null?void 0:r.size)>0&&p.jsxs(p.Fragment,{children:[p.jsx(lt,{orientation:"vertical",className:"mx-2 h-4"}),p.jsx(W,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),p.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?p.jsxs(W,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(i=>r.has(i.value)).map(i=>p.jsx(W,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),p.jsx(it,{className:"w-[200px] p-0",align:"start",children:p.jsxs(Ze,{children:[p.jsx(be,{placeholder:o}),p.jsxs(et,{children:[p.jsx(tt,{children:"No results found."}),p.jsx(pe,{children:t.map(i=>{const l=r.has(i.value);return p.jsxs(me,{onSelect:()=>{l?r.delete(i.value):r.add(i.value);const s=Array.from(r);e==null||e.setFilterValue(s.length?s:void 0)},children:[p.jsx("div",{className:fe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:p.jsx(je,{className:fe("h-4 w-4")})}),i.icon&&p.jsx(i.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),p.jsx("span",{children:i.label}),(n==null?void 0:n.get(i.value))&&p.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(i.value)})]},i.value)})}),r.size>0&&p.jsxs(p.Fragment,{children:[p.jsx(nt,{}),p.jsx(pe,{children:p.jsx(me,{onSelect:()=>e==null?void 0:e.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function cn({table:e,refreshTable:o}){const[t,n]=A.useState(!1),r=async()=>{if(o)try{n(!0),await o()}finally{n(!1)}},{t:i}=Ce();return p.jsxs("div",{className:"flex flex-wrap justify-end gap-2 sm:gap-3 mt-2",children:[p.jsxs(z,{variant:"outline",size:"sm",className:"h-8",onClick:r,children:[p.jsx(st,{className:`mr-2 transition-transform duration-500 ${t?"animate-spin":""}`}),i("dashboard.refresh")]}),p.jsxs(Ae,{children:[p.jsx(Ge,{asChild:!0,children:p.jsxs(z,{variant:"outline",size:"sm",className:"h-8",children:[p.jsx(dt,{className:"mr-2"}),i("viewDetail.view")]})}),p.jsxs(He,{align:"end",className:"w-[150px]",children:[p.jsx(Le,{children:i("viewDetail.toogleColumns")}),p.jsx(ze,{}),e.getAllColumns().filter(l=>typeof l.accessorFn<"u"&&l.getCanHide()).map(l=>p.jsx(Ne,{className:"capitalize",checked:l.getIsVisible(),onCheckedChange:s=>l.toggleVisibility(!!s),children:i(`toogle.${l.id}`)},l.id))]})]})]})}function fn({table:e,tableName:o,toolBarPosition:t="left",extraToolbar:n,filters:r=[],refreshTable:i,onGlobalFilterChange:l,hideToolbarFilter:s=!1}){const a=e.getState().columnFilters.length>0;return p.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!s&&p.jsx(ke,{placeholder:`Filter ${o}...`,onChange:g=>{const c=g.target.value;e.setGlobalFilter(c),l==null||l(c)},className:"h-8 w-full sm:w-[150px] lg:w-[250px]"}),r.map(({columnKey:g,title:c,options:S,isVisible:d=!0})=>d&&e.getColumn(g)&&p.jsx(dn,{column:e.getColumn(g),title:c,options:S},g)),a&&p.jsxs(z,{variant:"ghost",onClick:()=>e.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",p.jsx(Oe,{className:"ml-2 h-4 w-4"})]})]}),p.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${t==="center"?"justify-center":t==="left"?"justify-start":"justify-end"}`,children:[n,p.jsx(cn,{table:e,refreshTable:i})]})]})}function Fn({columns:e,data:o,tableName:t,initialColumnVisibility:n,extraToolbar:r,toolBarPosition:i="right",isLoading:l=!1,itemCount:s,onPageChange:a,onPageSizeChange:g,nextFunction:c,prevFunction:S,pageIndex:d,pageSize:u=10,refresh:f,onGlobalFilterChange:m,hideToolbarFilter:v=!1}){var _;const[C,R]=A.useState([]),[x,M]=A.useState([]),[F,D]=A.useState(()=>({letterName:!1,fileName:!1,...n??{}})),[L,N]=A.useState({}),{t:k}=Ce(),E=un({data:o,columns:e,pageCount:u>0?Math.ceil(s/u):1,state:{sorting:C,columnVisibility:F,rowSelection:L,columnFilters:x,pagination:{pageIndex:d,pageSize:u}},manualPagination:!0,enableRowSelection:!0,onRowSelectionChange:N,onSortingChange:R,onColumnFiltersChange:M,onColumnVisibilityChange:D,getCoreRowModel:Yt(),getFilteredRowModel:nn(),getSortedRowModel:on(),getFacetedRowModel:en(),getFacetedUniqueValues:tn()});return p.jsxs("div",{className:"space-y-4",children:[p.jsx(fn,{table:E,tableName:t,extraToolbar:r,toolBarPosition:i,refreshTable:f,onGlobalFilterChange:m,hideToolbarFilter:v}),p.jsx("div",{className:"rounded-md border dark:border-gray-700 bg-white dark:bg-gray-900 overflow-x-auto font-urbanist custom-scrollbar",children:p.jsxs(Te,{className:"w-full text-base text-gray-700 dark:text-gray-300 font-urbanist",children:[p.jsx(Be,{className:"bg-gray-50 dark:bg-gray-800",children:E.getHeaderGroups().map($=>p.jsx(B,{className:"dark:border-gray-700",children:$.headers.map(I=>p.jsx(qe,{className:"text-base text-gray-500 dark:text-gray-400 dark:bg-gray-800",children:I.isPlaceholder?null:we(I.column.columnDef.header,I.getContext())},I.id))},$.id))}),p.jsx(Ue,{children:l?p.jsx(B,{children:p.jsx(Q,{colSpan:e.length,className:"text-center py-6",children:"Loading..."})}):(_=E.getRowModel().rows)!=null&&_.length?E.getRowModel().rows.map($=>p.jsx(B,{"data-state":$.getIsSelected()&&"selected",className:` - transition-colors duration-150 - ${$.original.isUrgent===!0&&t==="Pending Records"||$.original.signStatus==="draft"&&t==="Collaborations"||$.original.action==="inprogress"&&t==="My Approval Records"?"bg-yellow-200 dark:bg-yellow-900/30 hover:bg-yellow-300 dark:hover:bg-yellow-900/50":"hover:bg-gray-100 dark:hover:bg-gray-800"} - ${t==="Pending Approval Tasks"&&"bg-primary-50 dark:bg-primary-900/20 hover:bg-primary-100 dark:hover:bg-primary-900/30 font-semibold border-l-4 border-l-primary-500 dark:border-l-primary-400"} - `,children:$.getVisibleCells().map(I=>p.jsx(Q,{className:"py-4",children:p.jsx("div",{className:"max-h-[110px] max-w-[460px] overflow-y-auto overflow-x-auto scrollbar-hidden hover:cursor-pointer custom-scrollbar",children:we(I.column.columnDef.cell,I.getContext())})},I.id))},$.id)):p.jsx(B,{children:p.jsx(Q,{colSpan:e.length,className:"text-center py-6",children:k("common.noResult")})})})]})}),s>u&&p.jsx(gn,{pageIndex:d,pageSize:u,itemCount:s,onPageChange:a,onPageSizeChange:g,nextFunction:c,prevFunction:S})]})}export{Fn as A,at as C}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-B2jF61Wl.js b/apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-B2jF61Wl.js deleted file mode 100644 index f6ccd9ac2..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-B2jF61Wl.js +++ /dev/null @@ -1 +0,0 @@ -import{d as N,r as c,az as S,j as t,v as u}from"./index-Db-xuq0b.js";import{C as U,a as A,b as y,d as z}from"./card-BBWyxDss.js";import{S as I,a as k,b as w,c as P,d as E}from"./select-BoQxM42A.js";import{A as T}from"./AdvancedTable-CC9ioMU-.js";import{u as F,A as L}from"./ArchivedUserColumnDefn-DQXeUrrA.js";import{u as V}from"./useUnit-C4s9nepK.js";import"./table-D3n3VABd.js";import"./chevron-left-DCpEaNzo.js";import"./utils-BncSPdK1.js";import"./badge-D7JvaQeJ.js";import"./command-Cr0tMDDu.js";import"./search-CM5F2ZRy.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./separator-BaOOgzZX.js";import"./refresh-cw-JB7N413f.js";import"./organizationsService-BEVk8qa1.js";import"./alert-dialog-B5Y0wlSz.js";import"./useEmployeePostions-CMraotEg.js";import"./employeePositionsService-CkHoE9xG.js";import"./ellipsis-vertical-Cs1B3vez.js";import"./square-pen-B91TPB19.js";import"./user-plus-CBq7Z0dQ.js";import"./unitService-CmGVtFHQ.js";const ce=()=>{var p,h,x,g,f;const{user:i}=N(),{getList:j}=V(),[o,b]=c.useState(0),s=10,v=S(),l=i!=null&&i.employee&&i.employee.length>0?i.employee[0].organizationId:void 0,{data:e}=l?j(l,{take:300,skip:0}):{data:void 0},[d,n]=c.useState(((h=(p=e==null?void 0:e.data)==null?void 0:p.items[0])==null?void 0:h.id)||"All");c.useEffect(()=>{var r;((r=e==null?void 0:e.data)==null?void 0:r.items.length)>0&&n(e==null?void 0:e.data.items[0].id)},[(x=e==null?void 0:e.data)==null?void 0:x.items]);const m=r=>{b(r)},{data:a,refetch:C}=F(d,{take:s,skip:o*s});return t.jsx("div",{className:"p-6 space-y-6",children:t.jsxs(U,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[t.jsx(A,{className:"flex flex-row justify-between items-center px-0",children:t.jsx(y,{className:"text-xl font-semibold ",children:u("setting.archivedUsers")})}),((f=(g=e==null?void 0:e.data)==null?void 0:g.items)==null?void 0:f.length)>0&&t.jsxs("div",{className:"mb-4 w-1/2",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700",children:u("organization.selectUnit")}),t.jsxs(I,{value:d,onValueChange:r=>n(r),children:[t.jsx(k,{className:"mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",children:t.jsx(w,{placeholder:"Select a Unit"})}),t.jsx(P,{children:e==null?void 0:e.data.items?.map(r=>t.jsx(E,{value:r.id,children:v(r.name)},r.id))})]})]}),t.jsx(z,{className:"px-0",children:t.jsx(T,{columns:L,data:(a==null?void 0:a.items)||[],tableName:"ArchivedUsers",toolBarPosition:"right",itemCount:(a==null?void 0:a.count)||0,pageIndex:o,onPageChange:m,nextFunction:a!=null&&a.count&&a.count>(o+1)*s?()=>m(o+1):()=>{},prevFunction:o>0?()=>m(Math.max(o-1,0)):()=>{},refresh:C})})]})})};export{ce as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-CqS3Mog2.js b/apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-CqS3Mog2.js deleted file mode 100644 index 2b4956e19..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ArchiveUsersPage-CqS3Mog2.js +++ /dev/null @@ -1 +0,0 @@ -import{d as N,r as c,az as S,j as t,v as u}from"./index-7T7TTikv.js";import{C as U,a as A,b as y,d as z}from"./card-_ldW-koX.js";import{S as I,a as k,b as w,c as P,d as E}from"./select--i8koVXg.js";import{A as T}from"./AdvancedTable-vWyUWUDX.js";import{u as F,A as L}from"./ArchivedUserColumnDefn-Ja27QDEy.js";import{u as V}from"./useUnit-CRt6YBLp.js";import"./table-D_B7hhqb.js";import"./chevron-left-G_a9-f9o.js";import"./utils-N2wtfq7C.js";import"./badge-D4t6Wb1T.js";import"./command-B6S1IvD4.js";import"./search-y8VSu0lZ.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./separator-BXi_hr72.js";import"./refresh-cw-B7fipPS4.js";import"./organizationsService-DIFVjoLn.js";import"./alert-dialog-DwppaTz4.js";import"./useEmployeePostions-BZG3u-zs.js";import"./employeePositionsService-C7MSoCNC.js";import"./ellipsis-vertical-CoMd89ns.js";import"./square-pen-Dh1zj83N.js";import"./user-plus-tzUBEFtH.js";import"./unitService-DTtkt-Pb.js";const ce=()=>{var p,h,x,g,f;const{user:i}=N(),{getList:j}=V(),[o,b]=c.useState(0),s=10,v=S(),l=i!=null&&i.employee&&i.employee.length>0?i.employee[0].organizationId:void 0,{data:e}=l?j(l,{take:300,skip:0}):{data:void 0},[d,n]=c.useState(((h=(p=e==null?void 0:e.data)==null?void 0:p.items[0])==null?void 0:h.id)||"All");c.useEffect(()=>{var r;((r=e==null?void 0:e.data)==null?void 0:r.items.length)>0&&n(e==null?void 0:e.data.items[0].id)},[(x=e==null?void 0:e.data)==null?void 0:x.items]);const m=r=>{b(r)},{data:a,refetch:C}=F(d,{take:s,skip:o*s});return t.jsx("div",{className:"p-6 space-y-6",children:t.jsxs(U,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[t.jsx(A,{className:"flex flex-row justify-between items-center px-0",children:t.jsx(y,{className:"text-xl font-semibold ",children:u("setting.archivedUsers")})}),((f=(g=e==null?void 0:e.data)==null?void 0:g.items)==null?void 0:f.length)>0&&t.jsxs("div",{className:"mb-4 w-1/2",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700",children:u("organization.selectUnit")}),t.jsxs(I,{value:d,onValueChange:r=>n(r),children:[t.jsx(k,{className:"mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",children:t.jsx(w,{placeholder:"Select a Unit"})}),t.jsx(P,{children:e==null?void 0:e.data.items.map(r=>t.jsx(E,{value:r.id,children:v(r.name)},r.id))})]})]}),t.jsx(z,{className:"px-0",children:t.jsx(T,{columns:L,data:(a==null?void 0:a.items)||[],tableName:"ArchivedUsers",toolBarPosition:"right",itemCount:(a==null?void 0:a.count)||0,pageIndex:o,onPageChange:m,nextFunction:a!=null&&a.count&&a.count>(o+1)*s?()=>m(o+1):()=>{},prevFunction:o>0?()=>m(Math.max(o-1,0)):()=>{},refresh:C})})]})})};export{ce as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-Il0g91Gb.js b/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-Il0g91Gb.js deleted file mode 100644 index c57643049..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-Il0g91Gb.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as S,u as R,d as T,az as B,r as l,j as e,B as d,A as F}from"./index-7T7TTikv.js";import{C as K,a as L,b as M,d as q}from"./card-_ldW-koX.js";import{S as E,a as V,b as _,c as H,d as G}from"./select--i8koVXg.js";import{A as j}from"./AdvancedTable-vWyUWUDX.js";import{u as J}from"./useUnit-CRt6YBLp.js";import{a as O,b as Q,u as W}from"./useArchived-5V0W60Gf.js";import{A as N}from"./archive-restore-CbEMfc7_.js";import"./table-D_B7hhqb.js";import"./chevron-left-G_a9-f9o.js";import"./utils-N2wtfq7C.js";import"./badge-D4t6Wb1T.js";import"./command-B6S1IvD4.js";import"./search-y8VSu0lZ.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./separator-BXi_hr72.js";import"./refresh-cw-B7fipPS4.js";import"./unitService-DTtkt-Pb.js";import"./positionService-BwPU5sNe.js";import"./organizationsService-DIFVjoLn.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X=[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Y=S("square-user-round",X),fe=()=>{var y;const{t}=R(),{user:i}=T(),m=B(),{getList:A}=J(),h=i!=null&&i.employee&&i.employee.length>0?i.employee[0].organizationId:void 0,[r,x]=l.useState("units"),[u,g]=l.useState(""),{data:p}=h?A(h,{take:300,skip:0}):{data:void 0},c=((y=p==null?void 0:p.data)==null?void 0:y.items)??[];!u&&c.length>0&&g(c[0].id);const{data:a,refetch:b}=O(h),{data:n,refetch:k}=Q(u||void 0),{restoreUnit:C,isRestoringUnit:U,restorePosition:z,isRestoringPosition:P}=W(),v=l.useMemo(()=>(a==null?void 0:a.items)??a??[],[a]),f=l.useMemo(()=>(n==null?void 0:n.items)??n??[],[n]),I=[{id:"name",header:t("organization.name","Name"),cell:({row:s})=>{var o;return m((o=s.original)==null?void 0:o.name)||"—"}},{id:"key",header:t("organization.key","Key"),accessorKey:"key"},{id:"actions",header:t("userIncomingretun.Actions","Actions"),cell:({row:s})=>e.jsxs(d,{size:"sm",variant:"outline",disabled:U,onClick:()=>C(s.original.id),className:"flex items-center gap-2 text-primary-700 hover:bg-primary-50",children:[e.jsx(N,{className:"h-4 w-4"}),t("archive.restore","Restore")]})}],w=[{id:"name",header:t("organization.name","Name"),cell:({row:s})=>{var o;return m((o=s.original)==null?void 0:o.name)||"—"}},{id:"key",header:t("organization.key","Key"),accessorKey:"key"},{id:"actions",header:t("userIncomingretun.Actions","Actions"),cell:({row:s})=>e.jsxs(d,{size:"sm",variant:"outline",disabled:P,onClick:()=>z(s.original.id),className:"flex items-center gap-2 text-primary-700 hover:bg-primary-50",children:[e.jsx(N,{className:"h-4 w-4"}),t("archive.restore","Restore")]})}];return e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(K,{className:"shadow-none border-none bg-transparent px-0",children:[e.jsx(L,{className:"flex flex-row justify-between items-center px-0",children:e.jsx(M,{className:"text-xl font-semibold",children:t("archive.archivedItems","Archived Items")})}),e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsxs(d,{variant:r==="units"?"default":"outline",onClick:()=>x("units"),className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4"}),t("archive.archivedUnits","Archived Units")]}),e.jsxs(d,{variant:r==="positions"?"default":"outline",onClick:()=>x("positions"),className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-4 w-4"}),t("archive.archivedPositions","Archived Positions")]})]}),r==="positions"&&c.length>0&&e.jsxs("div",{className:"mb-4 w-full sm:w-1/2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-200",children:t("organization.selectUnit","Select Unit")}),e.jsxs(E,{value:u,onValueChange:s=>g(s),children:[e.jsx(V,{className:"mt-1 block w-full",children:e.jsx(_,{placeholder:t("organization.selectUnit")})}),e.jsx(H,{children:c.map(s=>e.jsx(G,{value:s.id,children:m(s.name)},s.id))})]})]}),e.jsx(q,{className:"px-0",children:r==="units"?e.jsx(j,{columns:I,data:v,tableName:"ArchivedUnits",toolBarPosition:"right",itemCount:v.length,pageIndex:0,onPageChange:()=>{},nextFunction:()=>{},prevFunction:()=>{},refresh:b}):e.jsx(j,{columns:w,data:f,tableName:"ArchivedPositions",toolBarPosition:"right",itemCount:f.length,pageIndex:0,onPageChange:()=>{},nextFunction:()=>{},prevFunction:()=>{},refresh:k})})]})})};export{fe as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-m1hNEzal.js b/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-m1hNEzal.js deleted file mode 100644 index fd33a93ba..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUnitsPositionsPage-m1hNEzal.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as S,u as R,d as T,az as B,r as l,j as e,B as d,A as F}from"./index-Db-xuq0b.js";import{C as K,a as L,b as M,d as q}from"./card-BBWyxDss.js";import{S as E,a as V,b as _,c as H,d as G}from"./select-BoQxM42A.js";import{A as j}from"./AdvancedTable-CC9ioMU-.js";import{u as J}from"./useUnit-C4s9nepK.js";import{a as O,b as Q,u as W}from"./useArchived-D2u5xEKl.js";import{A as N}from"./archive-restore-CST5LuiK.js";import"./table-D3n3VABd.js";import"./chevron-left-DCpEaNzo.js";import"./utils-BncSPdK1.js";import"./badge-D7JvaQeJ.js";import"./command-Cr0tMDDu.js";import"./search-CM5F2ZRy.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./separator-BaOOgzZX.js";import"./refresh-cw-JB7N413f.js";import"./unitService-CmGVtFHQ.js";import"./positionService-JD0NEiGK.js";import"./organizationsService-BEVk8qa1.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X=[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Y=S("square-user-round",X),fe=()=>{var y;const{t}=R(),{user:i}=T(),m=B(),{getList:A}=J(),h=i!=null&&i.employee&&i.employee.length>0?i.employee[0].organizationId:void 0,[r,x]=l.useState("units"),[u,g]=l.useState(""),{data:p}=h?A(h,{take:300,skip:0}):{data:void 0},c=((y=p==null?void 0:p.data)==null?void 0:y.items)??[];!u&&c.length>0&&g(c[0].id);const{data:a,refetch:b}=O(h),{data:n,refetch:k}=Q(u||void 0),{restoreUnit:C,isRestoringUnit:U,restorePosition:z,isRestoringPosition:P}=W(),v=l.useMemo(()=>(a==null?void 0:a.items)??a??[],[a]),f=l.useMemo(()=>(n==null?void 0:n.items)??n??[],[n]),I=[{id:"name",header:t("organization.name","Name"),cell:({row:s})=>{var o;return m((o=s.original)==null?void 0:o.name)||"—"}},{id:"key",header:t("organization.key","Key"),accessorKey:"key"},{id:"actions",header:t("userIncomingretun.Actions","Actions"),cell:({row:s})=>e.jsxs(d,{size:"sm",variant:"outline",disabled:U,onClick:()=>C(s.original.id),className:"flex items-center gap-2 text-primary-700 hover:bg-primary-50",children:[e.jsx(N,{className:"h-4 w-4"}),t("archive.restore","Restore")]})}],w=[{id:"name",header:t("organization.name","Name"),cell:({row:s})=>{var o;return m((o=s.original)==null?void 0:o.name)||"—"}},{id:"key",header:t("organization.key","Key"),accessorKey:"key"},{id:"actions",header:t("userIncomingretun.Actions","Actions"),cell:({row:s})=>e.jsxs(d,{size:"sm",variant:"outline",disabled:P,onClick:()=>z(s.original.id),className:"flex items-center gap-2 text-primary-700 hover:bg-primary-50",children:[e.jsx(N,{className:"h-4 w-4"}),t("archive.restore","Restore")]})}];return e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(K,{className:"shadow-none border-none bg-transparent px-0",children:[e.jsx(L,{className:"flex flex-row justify-between items-center px-0",children:e.jsx(M,{className:"text-xl font-semibold",children:t("archive.archivedItems","Archived Items")})}),e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsxs(d,{variant:r==="units"?"default":"outline",onClick:()=>x("units"),className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4"}),t("archive.archivedUnits","Archived Units")]}),e.jsxs(d,{variant:r==="positions"?"default":"outline",onClick:()=>x("positions"),className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-4 w-4"}),t("archive.archivedPositions","Archived Positions")]})]}),r==="positions"&&c.length>0&&e.jsxs("div",{className:"mb-4 w-full sm:w-1/2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-200",children:t("organization.selectUnit","Select Unit")}),e.jsxs(E,{value:u,onValueChange:s=>g(s),children:[e.jsx(V,{className:"mt-1 block w-full",children:e.jsx(_,{placeholder:t("organization.selectUnit")})}),e.jsx(H,{children:c?.map(s=>e.jsx(G,{value:s.id,children:m(s.name)},s.id))})]})]}),e.jsx(q,{className:"px-0",children:r==="units"?e.jsx(j,{columns:I,data:v,tableName:"ArchivedUnits",toolBarPosition:"right",itemCount:v.length,pageIndex:0,onPageChange:()=>{},nextFunction:()=>{},prevFunction:()=>{},refresh:b}):e.jsx(j,{columns:w,data:f,tableName:"ArchivedPositions",toolBarPosition:"right",itemCount:f.length,pageIndex:0,onPageChange:()=>{},nextFunction:()=>{},prevFunction:()=>{},refresh:k})})]})})};export{fe as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-DQXeUrrA.js b/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-DQXeUrrA.js deleted file mode 100644 index d592b891f..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-DQXeUrrA.js +++ /dev/null @@ -1 +0,0 @@ -import{d as v}from"./organizationsService-BEVk8qa1.js";import{n as j,r as d,u as A,k as f,j as e,B as g,aF as w,f as D,aA as y,aB as b,aC as C,aD as N,v as o,aE as x,b_ as S,az as E}from"./index-Db-xuq0b.js";import{A as O,a as M,b as R,c as U,d as T,e as B,f as L}from"./alert-dialog-B5Y0wlSz.js";import{u as z,T as F}from"./useEmployeePostions-CMraotEg.js";import{E as I}from"./ellipsis-vertical-Cs1B3vez.js";import{S as k}from"./square-pen-B91TPB19.js";import{U as q}from"./user-plus-CBq7Z0dQ.js";import{B as K}from"./badge-D7JvaQeJ.js";const Z=(s,r)=>j({queryKey:["archived-users",s,r],queryFn:async()=>{if(!s)return{items:[],count:0};const{data:a}=await v(s,r);return a},enabled:!!s}),P=({isOpen:s,onClose:r,userId:a})=>{const{activateUser:t,isActivatingUser:i}=z(),[n,c]=d.useState(!1),{t:l}=A(),{handleError:u}=f(l),h=async()=>{try{await t({payload:a,successCallback:()=>{r()}}),c(!0)}catch(m){u(m)}};return e.jsx(O,{open:s,onOpenChange:r,children:e.jsxs(M,{children:[e.jsxs(R,{children:[e.jsx(U,{children:"Remove team member from this position?"}),e.jsx(T,{children:"Are you sure you want to activate this archived user? This action will restore the user's access and data within the organization."})]}),e.jsxs(B,{children:[e.jsx(L,{disabled:n,children:"Cancel"}),e.jsxs(g,{variant:"destructive",onClick:h,disabled:n,children:[i&&e.jsx(w,{className:"h-4 w-4 mr-2 animate-spin"}),"Confirm"]})]})]})})},H=({row:s})=>{const r=D(),[a,t]=d.useState(!1),[i,n]=d.useState(!1),[c,l]=d.useState(!1),u=()=>{r(`/user-management/archive/edit/${s==null?void 0:s.userId}`)},h=p=>{p.preventDefault(),t(!1),n(!0)},m=()=>{l(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs(y,{open:a,onOpenChange:t,children:[e.jsx(b,{asChild:!0,children:e.jsxs(g,{variant:"ghost",className:"h-8 w-8 p-0",children:[e.jsx(I,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Open actions menu"})]})}),e.jsxs(C,{align:"end",onInteractOutside:p=>{p.target.closest('[role="dialog"]')||t(!1)},children:[e.jsx(N,{children:o("userRecord.Actions")}),e.jsxs(x,{onSelect:u,className:"cursor-pointer hover:!text-primary-700 !bg-transparent !transition-colors duration-200",children:[e.jsx(k,{className:"mr-2 h-4 w-4 group-hover:text-white transition-colors duration-200"}),e.jsxs("span",{children:[" ",o("userRecord.Edit")]})]}),e.jsxs(x,{onSelect:m,className:"cursor-pointer hover:!text-primary-700 !bg-transparent !transition-colors duration-200",children:[e.jsx(q,{className:"mr-2 h-4 w-4 group-hover:text-white transition-colors duration-200"}),e.jsxs("span",{children:[" ",o("userRecord.Activate")]})]}),e.jsx(S,{}),e.jsxs(x,{onSelect:h,className:"text-red-600 cursor-pointer hover:!text-red-800 !bg-transparent !transition-colors duration-200",children:[e.jsx(F,{className:"mr-2 h-4 w-4 text-red-600 group-hover:text-white transition-colors duration-200"}),e.jsxs("span",{children:[" ",o("userRecord.Delete")]})]})]})]}),c&&e.jsx(P,{isOpen:c,onClose:()=>l(!1),userId:s.id})]})},ee=[{accessorKey:"name",header:()=>o("setting.Name"),cell:({row:s})=>{var t;const r=E(),a=(t=s.original)==null?void 0:t.name;return e.jsx("span",{children:r(a)})}},{accessorKey:"status",header:()=>o("userRecord.Status"),cell:({row:s})=>{var i;const r=(i=s.original)==null?void 0:i.status,a=n=>{switch(n.toLowerCase()){case"inactive":return"bg-red-100 text-red-600 hover:bg-red-100";case"active":return"bg-primary-100 text-primary-600 hover:bg-primary-100";default:return"bg-gray-100 text-gray-600 hover:bg-gray-100"}},t=n=>{switch(n.toLowerCase()){case"inactive":return"InActive";case"active":return"Active";default:return"Not Available"}};return e.jsx("div",{children:e.jsx(K,{className:`${a(r)} rounded-full px-6 py-1 font-medium`,children:t(r)})})}},{id:"actions",header:()=>o("userRecord.Actions"),cell:({row:s})=>e.jsx(H,{row:s.original})}];export{ee as A,Z as u}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-Ja27QDEy.js b/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-Ja27QDEy.js deleted file mode 100644 index 166d0b8f6..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ArchivedUserColumnDefn-Ja27QDEy.js +++ /dev/null @@ -1 +0,0 @@ -import{d as v}from"./organizationsService-DIFVjoLn.js";import{n as j,r as d,u as A,k as f,j as e,B as g,aF as w,f as D,aA as y,aB as b,aC as C,aD as N,v as o,aE as x,b_ as S,az as E}from"./index-7T7TTikv.js";import{A as O,a as M,b as R,c as U,d as T,e as B,f as L}from"./alert-dialog-DwppaTz4.js";import{u as z,T as F}from"./useEmployeePostions-BZG3u-zs.js";import{E as I}from"./ellipsis-vertical-CoMd89ns.js";import{S as k}from"./square-pen-Dh1zj83N.js";import{U as q}from"./user-plus-tzUBEFtH.js";import{B as K}from"./badge-D4t6Wb1T.js";const Z=(s,r)=>j({queryKey:["archived-users",s,r],queryFn:async()=>{if(!s)return{items:[],count:0};const{data:a}=await v(s,r);return a},enabled:!!s}),P=({isOpen:s,onClose:r,userId:a})=>{const{activateUser:t,isActivatingUser:i}=z(),[n,c]=d.useState(!1),{t:l}=A(),{handleError:u}=f(l),h=async()=>{try{await t({payload:a,successCallback:()=>{r()}}),c(!0)}catch(m){u(m)}};return e.jsx(O,{open:s,onOpenChange:r,children:e.jsxs(M,{children:[e.jsxs(R,{children:[e.jsx(U,{children:"Remove team member from this position?"}),e.jsx(T,{children:"Are you sure you want to activate this archived user? This action will restore the user's access and data within the organization."})]}),e.jsxs(B,{children:[e.jsx(L,{disabled:n,children:"Cancel"}),e.jsxs(g,{variant:"destructive",onClick:h,disabled:n,children:[i&&e.jsx(w,{className:"h-4 w-4 mr-2 animate-spin"}),"Confirm"]})]})]})})},H=({row:s})=>{const r=D(),[a,t]=d.useState(!1),[i,n]=d.useState(!1),[c,l]=d.useState(!1),u=()=>{r(`/user-management/archive/edit/${s==null?void 0:s.userId}`)},h=p=>{p.preventDefault(),t(!1),n(!0)},m=()=>{l(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs(y,{open:a,onOpenChange:t,children:[e.jsx(b,{asChild:!0,children:e.jsxs(g,{variant:"ghost",className:"h-8 w-8 p-0",children:[e.jsx(I,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Open actions menu"})]})}),e.jsxs(C,{align:"end",onInteractOutside:p=>{p.target.closest('[role="dialog"]')||t(!1)},children:[e.jsx(N,{children:o("userRecord.Actions")}),e.jsxs(x,{onSelect:u,className:"cursor-pointer hover:!text-primary-700 !bg-transparent !transition-colors duration-200",children:[e.jsx(k,{className:"mr-2 h-4 w-4 group-hover:text-white transition-colors duration-200"}),e.jsxs("span",{children:[" ",o("userRecord.Edit")]})]}),e.jsxs(x,{onSelect:m,className:"cursor-pointer hover:!text-primary-700 !bg-transparent !transition-colors duration-200",children:[e.jsx(q,{className:"mr-2 h-4 w-4 group-hover:text-white transition-colors duration-200"}),e.jsxs("span",{children:[" ",o("userRecord.Activate")]})]}),e.jsx(S,{}),e.jsxs(x,{onSelect:h,className:"text-red-600 cursor-pointer hover:!text-red-800 !bg-transparent !transition-colors duration-200",children:[e.jsx(F,{className:"mr-2 h-4 w-4 text-red-600 group-hover:text-white transition-colors duration-200"}),e.jsxs("span",{children:[" ",o("userRecord.Delete")]})]})]})]}),c&&e.jsx(P,{isOpen:c,onClose:()=>l(!1),userId:s.id})]})},ee=[{accessorKey:"name",header:()=>o("setting.Name"),cell:({row:s})=>{var t;const r=E(),a=(t=s.original)==null?void 0:t.name;return e.jsx("span",{children:r(a)})}},{accessorKey:"status",header:()=>o("userRecord.Status"),cell:({row:s})=>{var i;const r=(i=s.original)==null?void 0:i.status,a=n=>{switch(n.toLowerCase()){case"inactive":return"bg-red-100 text-red-600 hover:bg-red-100";case"active":return"bg-primary-100 text-primary-600 hover:bg-primary-100";default:return"bg-gray-100 text-gray-600 hover:bg-gray-100"}},t=n=>{switch(n.toLowerCase()){case"inactive":return"InActive";case"active":return"Active";default:return"Not Available"}};return e.jsx("div",{children:e.jsx(K,{className:`${a(r)} rounded-full px-6 py-1 font-medium`,children:t(r)})})}},{id:"actions",header:()=>o("userRecord.Actions"),cell:({row:s})=>e.jsx(H,{row:s.original})}];export{ee as A,Z as u}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DmWpBNfY.js b/apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DmWpBNfY.js deleted file mode 100644 index b1bf810ed..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DmWpBNfY.js +++ /dev/null @@ -1 +0,0 @@ -import{l as ye,r as p,d as je,aR as we,k as ve,v as l,j as e,B as E,aF as I,t as N,aS as ne}from"./index-7T7TTikv.js";import{r as ke,u as ie}from"./xlsx-sUI8S2SR.js";import{u as Ee}from"./useQueries-DzmDq0fy.js";import{A as oe,b as le,a as de}from"./alert-CCWXLU2U.js";import{u as Se}from"./useUnit-CRt6YBLp.js";import{S as Pe,a as Ue,b as $e,c as _e,d as Ae}from"./select--i8koVXg.js";import{g as Ce}from"./unitService-DTtkt-Pb.js";import{C as me}from"./circle-alert-HVqsZpe-.js";const Re=async R=>ye.post("/employees/upload-user-csv-2",R,{}),Fe=()=>{var Q,H,K;const R=p.useRef(null),[O,B]=p.useState(null),[v,D]=p.useState(""),[S,T]=p.useState(null),[k,V]=p.useState(!1),[F,W]=p.useState(!1),[q,L]=p.useState(!1),[y,j]=p.useState(null),[w,P]=p.useState(null),{user:U}=je(),ce=we.language,{getErrorMessage:ue}=ve(l),X=U!=null&&U.employee&&U.employee.length>0?U.employee[0].organizationId:void 0,{getList:he}=Se(),{data:M,isLoading:xe}=X?he(X):{data:void 0,isLoading:!1},G=((Q=M==null?void 0:M.data)==null?void 0:Q.items)??[],J=Ee({queries:G.map(t=>({queryKey:["unitChildren",t.id],queryFn:()=>Ce(t.id),enabled:!!t.id,staleTime:0}))}),$=p.useMemo(()=>{const t=[];G.forEach((u,g)=>{var a,i;t.push({id:u.id,name:u.name,depth:0});const m=(i=(a=J[g])==null?void 0:a.data)==null?void 0:i.data;(Array.isArray(m)?m:(m==null?void 0:m.items)??[]).forEach(s=>{s!=null&&s.id&&t.push({id:s.id,name:s.name,depth:1})})});const c=new Set;return t.filter(u=>c.has(u.id)?!1:(c.add(u.id),!0))},[M,J.map(t=>t.data).join("|")]);p.useEffect(()=>{$.length===1&&D($[0].id)},[$]);const _=()=>{T(null),L(!1)},pe=t=>{const c=a=>a.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase()),u=a=>{const i=a.indexOf(":");return i>=0?{reason:a.slice(0,i).trim(),value:a.slice(i+1).trim()}:{reason:a.trim(),value:""}},g=(a,i)=>{const{reason:s,value:o}=u(i),f=c(a);if(s.endsWith("_already_exists"))return o?`${f} "${o}" already exists`:`${f} already exists`;const h=c(s);return o?`${f}: ${h} (${o})`:`${f}: ${h}`},m=[],b=(a,i)=>{const s=/(\d+)/.exec(a),o=s?Number(s[1]):Number.MAX_SAFE_INTEGER,f=s?`Row ${s[1]}`:a;for(const[h,A]of Object.entries(i))typeof A!="string"||!A.trim()||m.push({row:o,text:`${f} — ${g(h,A)}`})};if(Array.isArray(t)){for(const a of t)if(!(!a||typeof a!="object"))for(const[i,s]of Object.entries(a))s&&typeof s=="object"&&b(i,s)}else if(t&&typeof t=="object"){const a=t;for(const[i,s]of Object.entries(a))s&&typeof s=="object"?b(i,s):typeof s=="string"&&s.trim()&&m.push({row:Number.MAX_SAFE_INTEGER,text:g(i,s)})}return m.sort((a,i)=>a.row-i.row).map(a=>a.text)},ge=async t=>{var g,m,b,a,i;const c=await ue(t),u=c.split(",").map(s=>s.trim()).filter(Boolean);if(typeof t=="object"&&t!==null&&"response"in t){let s=(g=t.response)==null?void 0:g.data;if(s instanceof Blob)try{s=JSON.parse(await s.text())}catch{s=null}const o=(s==null?void 0:s.message)??((b=(m=s==null?void 0:s.exception)==null?void 0:m.response)==null?void 0:b.message),f=(s==null?void 0:s.errors)??((i=(a=s==null?void 0:s.exception)==null?void 0:a.response)==null?void 0:i.errors);if(s&&typeof s=="object"&&o==="duplicate_values_found"){const h=pe(f);return{title:"Duplicate values found",message:h.length>0?`Found ${h.length} duplicate value${h.length>1?"s":""}. Fix the rows below in your Excel file and try again.`:"Some values already exist in the system. Review the conflicts and update the file before trying again.",errors:h.length>0?h:void 0}}}return u.length>1?{title:"We could not submit these users",message:"Some records could not be submitted. Review the issues below, update the file, and try again.",errors:u}:{title:"We could not submit these users",message:c}},fe=async t=>{var g;const c=(g=t.target.files)==null?void 0:g[0],u=t.target;if(c)try{W(!0),_(),j(null),P(null),B(c.name);const m=await c.arrayBuffer(),b=ke(m,{type:"array"}),a=b.Sheets.Positions,i=b.Sheets.OrgStructure;if(!a&&!i){N.error(l("contentManagement.posMissing")),j({title:"Missing template sheets",message:"The file must include the 'Positions' and 'OrgStructure' sheets before it can be imported."}),_();return}const s=(r,n)=>{if(r[n]!==void 0)return r[n];const d=Object.keys(r).find(C=>C.trim().toLowerCase()===n.toLowerCase());return d?r[d]:""},o=r=>String(r??"").trim(),f=(r,n)=>{const d=r.__rowNum__;return typeof d=="number"?d+1:n+2},h=r=>Object.values(r).some(n=>o(n)!==""),A=r=>[r.EnglishFirstName,r.EnglishLastName,r.Email,r.PhoneNumber,r.Username,r.Position].some(n=>o(n)!==""),Y=a?ie.sheet_to_json(a,{defval:""}).map(r=>{const n=r;return{Position:o(s(n,"EnglishPosition")),AmharicPosition:o(s(n,"AmharicPosition")),ReportsTo:o(s(n,"ReportsTo")),PositionType:o(s(n,"PositionType"))}}).filter(r=>h(r)):[],z=i?ie.sheet_to_json(i,{defval:""}).map((r,n)=>{const d=r;return{AmharicFirstName:o(s(d,"AmharicFirstName")),AmharicLastName:o(s(d,"AmharicLastName")),EnglishFirstName:o(s(d,"EnglishFirstName")),EnglishLastName:o(s(d,"EnglishLastName")),Email:o(s(d,"Email")),PhoneNumber:o(s(d,"PhoneNumber")),Position:o(s(d,"Position")),Username:o(s(d,"Username")),__rowNumber:f(d,n)}}).filter(r=>A(r)):[];if(!Y.length&&!z.length){N.error(l("contentManagement.invalidFile")),j({title:"No importable rows found",message:"We could not find any valid rows in the uploaded file. Check that the template columns are filled and try again."}),_();return}const x=[];if(z.forEach(r=>{var d,C,Z,ee,se,te,re,ae;const n=r.__rowNumber;(d=r.EnglishFirstName)!=null&&d.trim()||x.push(`Row ${n}: English First Name is required`),(C=r.EnglishLastName)!=null&&C.trim()||x.push(`Row ${n}: English Last Name is required`),(Z=r.Email)!=null&&Z.trim()||x.push(`Row ${n}: Email is required`),(ee=r.PhoneNumber)!=null&&ee.trim()||x.push(`Row ${n}: Phone Number is required`),(se=r.Username)!=null&&se.trim()||x.push(`Row ${n}: Username is required`),(te=r.Position)!=null&&te.trim()||x.push(`Row ${n}: Position is required`),(re=r.Email)!=null&&re.trim()&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.Email.trim())&&x.push(`Row ${n}: Invalid email format`),(ae=r.PhoneNumber)!=null&&ae.trim()&&!/^\+?[\d\s\-\(\)]+$/.test(r.PhoneNumber.trim())&&x.push(`Row ${n}: Invalid phone number format`)}),x.length>0){N.error(`Found ${x.length} validation errors.`),j({title:"Please fix the highlighted rows",message:"Some rows are missing required values or contain invalid formats. Update the file and upload it again.",errors:x}),_();return}const Ne={unitId:v,positions:Y,users:z.map(({__rowNumber:r,...n})=>n)};T(Ne),j(null),P(null),N.success(l("contentManagement.parseSuccess"))}catch(m){N.error(l("contentManagement.parseError")),j({title:"We could not read this file",message:m instanceof Error?m.message:"The uploaded file could not be parsed. Please verify the Excel format and try again."}),_()}finally{W(!1),u.value=""}},be=async()=>{if(!S){N.error(l("contentManagement.noData"));return}if(!v){N.warning(l("organization.selectUnit"));return}try{V(!0),P(null),await Re({...S,unitId:v}),N.success(l("organization.uploadSuccess")),T(null),B(null),L(!1)}catch(t){P(await ge(t))}finally{V(!1)}};return e.jsxs("div",{className:"p-4 border rounded-xl bg-white shadow-sm dark:bg-gray-900 mt-10",children:[e.jsx("div",{children:$.length>0&&e.jsxs("div",{className:"mb-4 w-1/2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:l("organization.selectUnit")}),e.jsxs(Pe,{value:v,onValueChange:t=>D(t),children:[e.jsx(Ue,{className:"mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",children:e.jsx($e,{placeholder:xe?l("organization.loading"):l("organization.selectUnit")})}),e.jsx(_e,{children:$.map(t=>{var c,u;return e.jsx(Ae,{value:t.id,children:e.jsxs("span",{style:{paddingLeft:t.depth*12},children:[t.depth>0?"└─ ":"",ce==="en"?(c=t.name)==null?void 0:c.en:(u=t.name)==null?void 0:u.am]})},t.id)})})]})]})}),e.jsx("p",{className:"text-sm mb-2 text-gray-700 dark:text-gray-300 font-medium",children:l("contentManagement.bulkMsg")}),e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(E,{variant:"outline",onClick:()=>{var t;if(!v){N.warning(l("organization.selectUnit"));return}(t=R.current)==null||t.click()},disabled:k||F||!v,children:F?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4 animate-spin"}),"Parsing file..."]}):k?l("userIncoming.Processing..."):l("contentManagement.selectFile")}),O&&e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:O})]}),e.jsx("input",{ref:R,type:"file",accept:".xlsx, .xls",onChange:fe,className:"hidden"}),F&&e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-700 shadow-sm dark:border-slate-800 dark:bg-slate-900/60 dark:text-slate-200",children:[e.jsx(I,{className:"h-4 w-4 animate-spin text-slate-600 dark:text-slate-300"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium",children:"Reading and validating your Excel file"}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Please wait while we parse the sheets and check for errors."})]})]}),y&&e.jsxs(oe,{className:"mb-4 border-red-200 bg-red-50/80 text-red-950 shadow-sm dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-100",children:[e.jsx(me,{className:"h-4 w-4"}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(le,{className:"text-sm font-semibold",children:y.title}),e.jsx(de,{className:"text-sm text-red-800 dark:text-red-200",children:y.message})]}),e.jsxs(E,{type:"button",variant:"ghost",size:"sm",className:"h-8 self-start px-2 text-red-700 hover:bg-red-100 hover:text-red-900 dark:text-red-200 dark:hover:bg-red-900/40 dark:hover:text-red-50",onClick:()=>j(null),children:[e.jsx(ne,{className:"mr-1 h-4 w-4"}),l("common.close")]})]}),(H=y.errors)!=null&&H.length?e.jsxs("div",{className:"rounded-lg border border-red-200/80 bg-white/80 p-3 dark:border-red-900/60 dark:bg-red-950/20",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-red-900 dark:text-red-100",children:"Validation details"}),e.jsxs("span",{className:"rounded-full bg-red-100 px-2 py-0.5 text-xs font-medium text-red-700 dark:bg-red-900/50 dark:text-red-100",children:[y.errors.length," issue",y.errors.length>1?"s":""]})]}),e.jsx("div",{className:"max-h-56 overflow-y-auto pr-1",children:e.jsx("ul",{className:"grid gap-2 text-sm text-red-800 dark:text-red-200 sm:grid-cols-2",children:y.errors.map(t=>e.jsx("li",{className:"rounded-md border border-red-100 bg-red-50 px-3 py-2 leading-relaxed dark:border-red-900/50 dark:bg-red-950/30",children:t},t))})})]}):null]})]}),S&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(E,{variant:"outline",onClick:()=>L(!q),disabled:k,children:q?l("common.Cancel"):l("contentManagement.preview")}),e.jsx(E,{onClick:be,disabled:k||F,children:k?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4 animate-spin"}),"Uploading users..."]}):l("contentManagement.submitUsers")})]}),k&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary-200 bg-primary-50 px-4 py-3 text-sm text-primary-900 shadow-sm dark:border-primary-900/60 dark:bg-primary-950/30 dark:text-primary-100",children:[e.jsx(I,{className:"h-4 w-4 animate-spin text-primary-700 dark:text-primary-200"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium",children:"Submitting users to the server"}),e.jsx("p",{className:"text-xs text-primary-700/80 dark:text-primary-200/80",children:"Please wait while we create the uploaded users and positions."})]})]}),w&&e.jsxs(oe,{className:"border-amber-200 bg-amber-50/80 text-amber-950 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:[e.jsx(me,{className:"h-4 w-4"}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(le,{className:"text-sm font-semibold",children:w.title}),e.jsx(de,{className:"text-sm text-amber-800 dark:text-amber-200",children:w.message})]}),e.jsxs(E,{type:"button",variant:"ghost",size:"sm",className:"h-8 self-start px-2 text-amber-700 hover:bg-amber-100 hover:text-amber-900 dark:text-amber-200 dark:hover:bg-amber-900/40 dark:hover:text-amber-50",onClick:()=>P(null),children:[e.jsx(ne,{className:"mr-1 h-4 w-4"}),l("common.close")]})]}),(K=w.errors)!=null&&K.length?e.jsxs("div",{className:"rounded-lg border border-amber-200/80 bg-white/80 p-3 dark:border-amber-900/60 dark:bg-amber-950/20",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:"Submission details"}),e.jsxs("span",{className:"rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700 dark:bg-amber-900/50 dark:text-amber-100",children:[w.errors.length," issue",w.errors.length>1?"s":""]})]}),e.jsx("div",{className:"max-h-56 overflow-y-auto pr-1",children:e.jsx("ul",{className:"grid gap-2 text-sm text-amber-800 dark:text-amber-200 sm:grid-cols-2",children:w.errors.map(t=>e.jsx("li",{className:"rounded-md border border-amber-100 bg-amber-50 px-3 py-2 leading-relaxed dark:border-amber-900/50 dark:bg-amber-950/30",children:t},t))})})]}):null]})]})]}),q&&S&&e.jsxs("div",{className:"mt-4 p-4 border rounded-lg bg-gray-50 dark:bg-gray-800 max-h-96 overflow-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:l("contentManagement.preview")}),e.jsx(E,{variant:"ghost",size:"sm",onClick:()=>L(!1),children:"✕"})]}),e.jsx("pre",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:JSON.stringify(S,null,2)})]})]})},De=()=>e.jsx(Fe,{});export{De as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DwoaDuCZ.js b/apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DwoaDuCZ.js deleted file mode 100644 index a63cee3c0..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/BulkUploadPage-DwoaDuCZ.js +++ /dev/null @@ -1 +0,0 @@ -import{l as ye,r as p,d as je,aR as we,k as ve,v as l,j as e,B as E,aF as I,t as N,aS as ne}from"./index-Db-xuq0b.js";import{r as ke,u as ie}from"./xlsx-sUI8S2SR.js";import{u as Ee}from"./useQueries-XKsSk0XW.js";import{A as oe,b as le,a as de}from"./alert-8Xu28MAD.js";import{u as Se}from"./useUnit-C4s9nepK.js";import{S as Pe,a as Ue,b as $e,c as _e,d as Ae}from"./select-BoQxM42A.js";import{g as Ce}from"./unitService-CmGVtFHQ.js";import{C as me}from"./circle-alert-Cd_zeQMw.js";const Re=async R=>ye.post("/employees/upload-user-csv-2",R,{}),Fe=()=>{var Q,H,K;const R=p.useRef(null),[O,B]=p.useState(null),[v,D]=p.useState(""),[S,T]=p.useState(null),[k,V]=p.useState(!1),[F,W]=p.useState(!1),[q,L]=p.useState(!1),[y,j]=p.useState(null),[w,P]=p.useState(null),{user:U}=je(),ce=we.language,{getErrorMessage:ue}=ve(l),X=U!=null&&U.employee&&U.employee.length>0?U.employee[0].organizationId:void 0,{getList:he}=Se(),{data:M,isLoading:xe}=X?he(X):{data:void 0,isLoading:!1},G=((Q=M==null?void 0:M.data)==null?void 0:Q.items)??[],J=Ee({queries:G?.map(t=>({queryKey:["unitChildren",t.id],queryFn:()=>Ce(t.id),enabled:!!t.id,staleTime:0}))}),$=p.useMemo(()=>{const t=[];G.forEach((u,g)=>{var a,i;t.push({id:u.id,name:u.name,depth:0});const m=(i=(a=J[g])==null?void 0:a.data)==null?void 0:i.data;(Array.isArray(m)?m:(m==null?void 0:m.items)??[]).forEach(s=>{s!=null&&s.id&&t.push({id:s.id,name:s.name,depth:1})})});const c=new Set;return t.filter(u=>c.has(u.id)?!1:(c.add(u.id),!0))},[M,J?.map(t=>t.data).join("|")]);p.useEffect(()=>{$.length===1&&D($[0].id)},[$]);const _=()=>{T(null),L(!1)},pe=t=>{const c=a=>a.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase()),u=a=>{const i=a.indexOf(":");return i>=0?{reason:a.slice(0,i).trim(),value:a.slice(i+1).trim()}:{reason:a.trim(),value:""}},g=(a,i)=>{const{reason:s,value:o}=u(i),f=c(a);if(s.endsWith("_already_exists"))return o?`${f} "${o}" already exists`:`${f} already exists`;const h=c(s);return o?`${f}: ${h} (${o})`:`${f}: ${h}`},m=[],b=(a,i)=>{const s=/(\d+)/.exec(a),o=s?Number(s[1]):Number.MAX_SAFE_INTEGER,f=s?`Row ${s[1]}`:a;for(const[h,A]of Object.entries(i))typeof A!="string"||!A.trim()||m.push({row:o,text:`${f} — ${g(h,A)}`})};if(Array.isArray(t)){for(const a of t)if(!(!a||typeof a!="object"))for(const[i,s]of Object.entries(a))s&&typeof s=="object"&&b(i,s)}else if(t&&typeof t=="object"){const a=t;for(const[i,s]of Object.entries(a))s&&typeof s=="object"?b(i,s):typeof s=="string"&&s.trim()&&m.push({row:Number.MAX_SAFE_INTEGER,text:g(i,s)})}return m.sort((a,i)=>a.row-i.row)?.map(a=>a.text)},ge=async t=>{var g,m,b,a,i;const c=await ue(t),u=c.split(",")?.map(s=>s.trim()).filter(Boolean);if(typeof t=="object"&&t!==null&&"response"in t){let s=(g=t.response)==null?void 0:g.data;if(s instanceof Blob)try{s=JSON.parse(await s.text())}catch{s=null}const o=(s==null?void 0:s.message)??((b=(m=s==null?void 0:s.exception)==null?void 0:m.response)==null?void 0:b.message),f=(s==null?void 0:s.errors)??((i=(a=s==null?void 0:s.exception)==null?void 0:a.response)==null?void 0:i.errors);if(s&&typeof s=="object"&&o==="duplicate_values_found"){const h=pe(f);return{title:"Duplicate values found",message:h.length>0?`Found ${h.length} duplicate value${h.length>1?"s":""}. Fix the rows below in your Excel file and try again.`:"Some values already exist in the system. Review the conflicts and update the file before trying again.",errors:h.length>0?h:void 0}}}return u.length>1?{title:"We could not submit these users",message:"Some records could not be submitted. Review the issues below, update the file, and try again.",errors:u}:{title:"We could not submit these users",message:c}},fe=async t=>{var g;const c=(g=t.target.files)==null?void 0:g[0],u=t.target;if(c)try{W(!0),_(),j(null),P(null),B(c.name);const m=await c.arrayBuffer(),b=ke(m,{type:"array"}),a=b.Sheets.Positions,i=b.Sheets.OrgStructure;if(!a&&!i){N.error(l("contentManagement.posMissing")),j({title:"Missing template sheets",message:"The file must include the 'Positions' and 'OrgStructure' sheets before it can be imported."}),_();return}const s=(r,n)=>{if(r[n]!==void 0)return r[n];const d=Object.keys(r).find(C=>C.trim().toLowerCase()===n.toLowerCase());return d?r[d]:""},o=r=>String(r??"").trim(),f=(r,n)=>{const d=r.__rowNum__;return typeof d=="number"?d+1:n+2},h=r=>Object.values(r)?.some(n=>o(n)!==""),A=r=>[r.EnglishFirstName,r.EnglishLastName,r.Email,r.PhoneNumber,r.Username,r.Position]?.some(n=>o(n)!==""),Y=a?ie.sheet_to_json(a,{defval:""})?.map(r=>{const n=r;return{Position:o(s(n,"EnglishPosition")),AmharicPosition:o(s(n,"AmharicPosition")),ReportsTo:o(s(n,"ReportsTo")),PositionType:o(s(n,"PositionType"))}}).filter(r=>h(r)):[],z=i?ie.sheet_to_json(i,{defval:""})?.map((r,n)=>{const d=r;return{AmharicFirstName:o(s(d,"AmharicFirstName")),AmharicLastName:o(s(d,"AmharicLastName")),EnglishFirstName:o(s(d,"EnglishFirstName")),EnglishLastName:o(s(d,"EnglishLastName")),Email:o(s(d,"Email")),PhoneNumber:o(s(d,"PhoneNumber")),Position:o(s(d,"Position")),Username:o(s(d,"Username")),__rowNumber:f(d,n)}}).filter(r=>A(r)):[];if(!Y.length&&!z.length){N.error(l("contentManagement.invalidFile")),j({title:"No importable rows found",message:"We could not find any valid rows in the uploaded file. Check that the template columns are filled and try again."}),_();return}const x=[];if(z.forEach(r=>{var d,C,Z,ee,se,te,re,ae;const n=r.__rowNumber;(d=r.EnglishFirstName)!=null&&d.trim()||x.push(`Row ${n}: English First Name is required`),(C=r.EnglishLastName)!=null&&C.trim()||x.push(`Row ${n}: English Last Name is required`),(Z=r.Email)!=null&&Z.trim()||x.push(`Row ${n}: Email is required`),(ee=r.PhoneNumber)!=null&&ee.trim()||x.push(`Row ${n}: Phone Number is required`),(se=r.Username)!=null&&se.trim()||x.push(`Row ${n}: Username is required`),(te=r.Position)!=null&&te.trim()||x.push(`Row ${n}: Position is required`),(re=r.Email)!=null&&re.trim()&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.Email.trim())&&x.push(`Row ${n}: Invalid email format`),(ae=r.PhoneNumber)!=null&&ae.trim()&&!/^\+?[\d\s\-\(\)]+$/.test(r.PhoneNumber.trim())&&x.push(`Row ${n}: Invalid phone number format`)}),x.length>0){N.error(`Found ${x.length} validation errors.`),j({title:"Please fix the highlighted rows",message:"Some rows are missing required values or contain invalid formats. Update the file and upload it again.",errors:x}),_();return}const Ne={unitId:v,positions:Y,users:z?.map(({__rowNumber:r,...n})=>n)};T(Ne),j(null),P(null),N.success(l("contentManagement.parseSuccess"))}catch(m){N.error(l("contentManagement.parseError")),j({title:"We could not read this file",message:m instanceof Error?m.message:"The uploaded file could not be parsed. Please verify the Excel format and try again."}),_()}finally{W(!1),u.value=""}},be=async()=>{if(!S){N.error(l("contentManagement.noData"));return}if(!v){N.warning(l("organization.selectUnit"));return}try{V(!0),P(null),await Re({...S,unitId:v}),N.success(l("organization.uploadSuccess")),T(null),B(null),L(!1)}catch(t){P(await ge(t))}finally{V(!1)}};return e.jsxs("div",{className:"p-4 border rounded-xl bg-white shadow-sm dark:bg-gray-900 mt-10",children:[e.jsx("div",{children:$.length>0&&e.jsxs("div",{className:"mb-4 w-1/2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:l("organization.selectUnit")}),e.jsxs(Pe,{value:v,onValueChange:t=>D(t),children:[e.jsx(Ue,{className:"mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",children:e.jsx($e,{placeholder:xe?l("organization.loading"):l("organization.selectUnit")})}),e.jsx(_e,{children:$?.map(t=>{var c,u;return e.jsx(Ae,{value:t.id,children:e.jsxs("span",{style:{paddingLeft:t.depth*12},children:[t.depth>0?"└─ ":"",ce==="en"?(c=t.name)==null?void 0:c.en:(u=t.name)==null?void 0:u.am]})},t.id)})})]})]})}),e.jsx("p",{className:"text-sm mb-2 text-gray-700 dark:text-gray-300 font-medium",children:l("contentManagement.bulkMsg")}),e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(E,{variant:"outline",onClick:()=>{var t;if(!v){N.warning(l("organization.selectUnit"));return}(t=R.current)==null||t.click()},disabled:k||F||!v,children:F?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4 animate-spin"}),"Parsing file..."]}):k?l("userIncoming.Processing..."):l("contentManagement.selectFile")}),O&&e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:O})]}),e.jsx("input",{ref:R,type:"file",accept:".xlsx, .xls",onChange:fe,className:"hidden"}),F&&e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-700 shadow-sm dark:border-slate-800 dark:bg-slate-900/60 dark:text-slate-200",children:[e.jsx(I,{className:"h-4 w-4 animate-spin text-slate-600 dark:text-slate-300"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium",children:"Reading and validating your Excel file"}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Please wait while we parse the sheets and check for errors."})]})]}),y&&e.jsxs(oe,{className:"mb-4 border-red-200 bg-red-50/80 text-red-950 shadow-sm dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-100",children:[e.jsx(me,{className:"h-4 w-4"}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(le,{className:"text-sm font-semibold",children:y.title}),e.jsx(de,{className:"text-sm text-red-800 dark:text-red-200",children:y.message})]}),e.jsxs(E,{type:"button",variant:"ghost",size:"sm",className:"h-8 self-start px-2 text-red-700 hover:bg-red-100 hover:text-red-900 dark:text-red-200 dark:hover:bg-red-900/40 dark:hover:text-red-50",onClick:()=>j(null),children:[e.jsx(ne,{className:"mr-1 h-4 w-4"}),l("common.close")]})]}),(H=y.errors)!=null&&H.length?e.jsxs("div",{className:"rounded-lg border border-red-200/80 bg-white/80 p-3 dark:border-red-900/60 dark:bg-red-950/20",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-red-900 dark:text-red-100",children:"Validation details"}),e.jsxs("span",{className:"rounded-full bg-red-100 px-2 py-0.5 text-xs font-medium text-red-700 dark:bg-red-900/50 dark:text-red-100",children:[y.errors.length," issue",y.errors.length>1?"s":""]})]}),e.jsx("div",{className:"max-h-56 overflow-y-auto pr-1",children:e.jsx("ul",{className:"grid gap-2 text-sm text-red-800 dark:text-red-200 sm:grid-cols-2",children:y.errors?.map(t=>e.jsx("li",{className:"rounded-md border border-red-100 bg-red-50 px-3 py-2 leading-relaxed dark:border-red-900/50 dark:bg-red-950/30",children:t},t))})})]}):null]})]}),S&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(E,{variant:"outline",onClick:()=>L(!q),disabled:k,children:q?l("common.Cancel"):l("contentManagement.preview")}),e.jsx(E,{onClick:be,disabled:k||F,children:k?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4 animate-spin"}),"Uploading users..."]}):l("contentManagement.submitUsers")})]}),k&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary-200 bg-primary-50 px-4 py-3 text-sm text-primary-900 shadow-sm dark:border-primary-900/60 dark:bg-primary-950/30 dark:text-primary-100",children:[e.jsx(I,{className:"h-4 w-4 animate-spin text-primary-700 dark:text-primary-200"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium",children:"Submitting users to the server"}),e.jsx("p",{className:"text-xs text-primary-700/80 dark:text-primary-200/80",children:"Please wait while we create the uploaded users and positions."})]})]}),w&&e.jsxs(oe,{className:"border-amber-200 bg-amber-50/80 text-amber-950 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:[e.jsx(me,{className:"h-4 w-4"}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(le,{className:"text-sm font-semibold",children:w.title}),e.jsx(de,{className:"text-sm text-amber-800 dark:text-amber-200",children:w.message})]}),e.jsxs(E,{type:"button",variant:"ghost",size:"sm",className:"h-8 self-start px-2 text-amber-700 hover:bg-amber-100 hover:text-amber-900 dark:text-amber-200 dark:hover:bg-amber-900/40 dark:hover:text-amber-50",onClick:()=>P(null),children:[e.jsx(ne,{className:"mr-1 h-4 w-4"}),l("common.close")]})]}),(K=w.errors)!=null&&K.length?e.jsxs("div",{className:"rounded-lg border border-amber-200/80 bg-white/80 p-3 dark:border-amber-900/60 dark:bg-amber-950/20",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:"Submission details"}),e.jsxs("span",{className:"rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700 dark:bg-amber-900/50 dark:text-amber-100",children:[w.errors.length," issue",w.errors.length>1?"s":""]})]}),e.jsx("div",{className:"max-h-56 overflow-y-auto pr-1",children:e.jsx("ul",{className:"grid gap-2 text-sm text-amber-800 dark:text-amber-200 sm:grid-cols-2",children:w.errors?.map(t=>e.jsx("li",{className:"rounded-md border border-amber-100 bg-amber-50 px-3 py-2 leading-relaxed dark:border-amber-900/50 dark:bg-amber-950/30",children:t},t))})})]}):null]})]})]}),q&&S&&e.jsxs("div",{className:"mt-4 p-4 border rounded-lg bg-gray-50 dark:bg-gray-800 max-h-96 overflow-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:l("contentManagement.preview")}),e.jsx(E,{variant:"ghost",size:"sm",onClick:()=>L(!1),children:"✕"})]}),e.jsx("pre",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:JSON.stringify(S,null,2)})]})]})},De=()=>e.jsx(Fe,{});export{De as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-DnAAu07A.js b/apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-DnAAu07A.js deleted file mode 100644 index 385950970..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-DnAAu07A.js +++ /dev/null @@ -1 +0,0 @@ -import{l as h,w as H,m as $,u as D,k as Y,f as O,d as Z,n as U,o as S,t as j,p as c,q as Q,r as m,j as e,v as t,I as L,B as z,x as G}from"./index-Db-xuq0b.js";import{L as I}from"./lock-BCybB-Lq.js";import{E as K}from"./eye-off-CDMvHElM.js";import{E as R}from"./eye-Bhud4znU.js";import{R as J}from"./refresh-cw-JB7N413f.js";import{A as V}from"./arrow-left-CE5-YfaQ.js";const W=async(r,s)=>h.post("/auth/login",r,{headers:{"x-organization-tenant-key":s.tenantKey,...s.unitId&&{"x-organization-unit-id":s.unitId}}}),X=async r=>h.get("/auth/me",{headers:{"x-organization-tenant-key":r.tenantKey,...r.unitId&&{"x-organization-unit-id":r.unitId}}}),ee=async()=>h.patch("/auth/logout"),se=async(r,s)=>h.put(`/account-configurations/my-config/${s}`,r,{headers:H()}),te=async r=>h.post("/account-configurations/set-my-config",r),ae=async()=>h.get("/account-configurations/my-config"),re=()=>{var x;const r=$(),{t:s}=D(),{handleError:y}=Y(s),g=O(),{setUser:b,user:p,selectedPositionId:T,setSelectedPositionId:w}=Z(),{data:o,isLoading:k,isError:n,refetch:d}=U({queryKey:["authUser"],queryFn:async()=>{const{data:a}=await X({tenantKey:c.get("tenant-key"),unitId:c.get("unit-id")||""});return a},staleTime:300*1e3,retry:!1}),{mutate:N,isError:f,isSuccess:P}=S({mutationFn:async({email:a,password:u,tenantKey:B,unitId:_})=>(await W({email:a,password:u},{tenantKey:B,unitId:_})).data,onSuccess:(a,u)=>{c.set("auth-token",a.token,{expires:1}),c.set("tenant-key",u.tenantKey,{expires:1}),c.set("unit-id",u.unitId||"",{expires:1}),j.success(s("msg.loginSuccess"),{description:s("msg.redirecting")}),r.invalidateQueries({queryKey:["authUser"]}),g("/dashboard")},onError:a=>{y(a)}}),{mutate:C,isError:E,isSuccess:q}=S({mutationFn:async()=>{await ee()},onSuccess:()=>{b(null),w(null),Object.keys(c.get()).forEach(a=>{c.remove(a)}),Q(),localStorage.removeItem("token"),r.invalidateQueries({queryKey:["authUser"]}),j.success(s("msg.logoutSuccess")||"Logged out successfully"),window.location.replace("/")},onError:a=>{b(null),w(null),Object.keys(c.get()).forEach(u=>{c.remove(u)}),Q(),localStorage.removeItem("token"),r.invalidateQueries({queryKey:["authUser"]}),y(a),window.location.replace("/")}}),{mutate:i,isPending:M}=S({mutationFn:async({isMFARequired:a})=>{await te({isMFARequired:a})},onSuccess:()=>{j.success("Two-Factor Authentication setting updated"),r.invalidateQueries({queryKey:["twoFAStatus"]})},onError:a=>{y(a)}}),{data:v,isLoading:F}=U({queryKey:["twoFAStatus",o],queryFn:ae,enabled:!!o}),{mutate:A}=S({mutationFn:async({id:a,isEnabled:u})=>{await se({isMFARequired:u},a)},onSuccess:()=>{r.invalidateQueries({queryKey:["twoFAStatus"]})}}),l=(o==null?void 0:o.selectedPositionPermissionKeys)||[];return{userDetails:o,selectedPositionPermissionKeys:l,isLoading:k,isError:n,refetch:d,login:N,logout:C,loginSuccess:P,loginError:f,logoutSuccess:q,logoutError:E,setTwoFactorAuth:i,twoFactorData:(x=v==null?void 0:v.data)==null?void 0:x.items,isLoadingStatus:F,editTwoFA:A}},me=()=>{const r=O(),[s,y]=m.useState(""),[g,b]=m.useState(""),[p,T]=m.useState(""),[w,o]=m.useState(!1),[k,n]=m.useState(""),[d,N]=m.useState(!1),[f,P]=m.useState(!1),{logout:C}=re(),E=()=>{C()},q=async i=>{if(i.preventDefault(),n(""),!g){n(t("msg.currentPasswordRequired"));return}if(!s){n(t("msg.newPasswordRequired"));return}if(s.length<8){n(t("msg.passwordMinLength"));return}if(s===g){n(t("msg.passwordMustBeDifferent"));return}if(!p){n(t("msg.confirmPasswordRequired"));return}if(s!==p){n(t("msg.passwordMismatch"));return}const M=/[A-Z]/.test(s),v=/[a-z]/.test(s),F=/\d/.test(s),A=/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(s),l=[];if(M||l.push(t("msg.uppercaseLetter")),v||l.push(t("msg.lowercaseLetter")),F||l.push(t("msg.number")),A||l.push(t("msg.specialCharacter")),l.length>0){n(t("msg.passwordComplexity")+" "+l.join(", "));return}o(!0);try{await G({oldPassword:g,newPassword:s,confirmPassword:p}),j.success(t("msg.successChange"),{description:"Your password has been changed successfully"}),setTimeout(E,1200)}catch(x){const a=(x==null?void 0:x.message)||t("msg.failedChange");n(a),j.error(t("msg.failedChange"),{description:a})}finally{o(!1)}};return e.jsx("div",{className:"flex items-center justify-center bg-gray-100 dark:bg-gray-900 p-4",style:{height:"100vh"},children:e.jsxs("div",{className:"w-full max-w-md bg-white dark:bg-gray-800 rounded-xl shadow-lg p-8",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsx("img",{src:"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-10 mb-6 mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:t("change_password")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("msg.changePasswordMsg")})]}),e.jsxs("form",{onSubmit:q,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(I,{className:"h-5 w-5 text-gray-400 dark:text-gray-500"})}),e.jsx(L,{type:d?"text":"password",placeholder:t("msg.oldPassword"),className:"h-10 rounded-md border dark:border-gray-600 px-4 text-sm ps-10 dark:bg-gray-700 dark:text-gray-100",value:g,onChange:i=>b(i.target.value),required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>N(!d),children:d?e.jsx(K,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}):e.jsx(R,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(I,{className:"h-5 w-5 text-gray-400 dark:text-gray-500"})}),e.jsx(L,{type:d?"text":"password",placeholder:t("msg.newPassword"),className:"h-10 rounded-md border dark:border-gray-600 px-4 text-sm ps-10 dark:bg-gray-700 dark:text-gray-100",value:s,onChange:i=>y(i.target.value),required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>N(!d),children:d?e.jsx(K,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}):e.jsx(R,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(I,{className:"h-5 w-5 text-gray-400 dark:text-gray-500"})}),e.jsx(L,{type:f?"text":"password",placeholder:t("msg.confirmNewPassword"),className:"h-10 rounded-md border dark:border-gray-600 px-4 text-sm ps-10 dark:bg-gray-700 dark:text-gray-100",value:p,onChange:i=>T(i.target.value),required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>P(!f),children:f?e.jsx(K,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}):e.jsx(R,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"})})]}),k&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md p-3 md:p-4",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400 font-medium",children:k})})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(z,{type:"submit",className:"w-full h-10 bg-primary hover:bg-primary-300 text-white text-sm",disabled:w,children:w?e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsx(J,{className:"animate-spin h-5 w-5 mr-2"}),"changing..."]}):t("change_password")}),e.jsxs(z,{type:"button",variant:"outline",className:"w-full h-10 text-sm",onClick:()=>r(-1),children:[e.jsx(V,{className:"h-4 w-4 mr-2"}),t("userRecord.Back")]})]})]})]})})};export{me as ResetPassword,me as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-zChdks8-.js b/apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-zChdks8-.js deleted file mode 100644 index 275918ccf..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ChangePassword-zChdks8-.js +++ /dev/null @@ -1 +0,0 @@ -import{l as h,w as H,m as $,u as D,k as Y,f as O,d as Z,n as U,o as S,t as j,p as c,q as Q,r as m,j as e,v as t,I as L,B as z,x as G}from"./index-7T7TTikv.js";import{L as I}from"./lock-DGEqses-.js";import{E as K}from"./eye-off-AoIvdwmO.js";import{E as R}from"./eye-DYwZYJcQ.js";import{R as J}from"./refresh-cw-B7fipPS4.js";import{A as V}from"./arrow-left-mae9HpSL.js";const W=async(r,s)=>h.post("/auth/login",r,{headers:{"x-organization-tenant-key":s.tenantKey,...s.unitId&&{"x-organization-unit-id":s.unitId}}}),X=async r=>h.get("/auth/me",{headers:{"x-organization-tenant-key":r.tenantKey,...r.unitId&&{"x-organization-unit-id":r.unitId}}}),ee=async()=>h.patch("/auth/logout"),se=async(r,s)=>h.put(`/account-configurations/my-config/${s}`,r,{headers:H()}),te=async r=>h.post("/account-configurations/set-my-config",r),ae=async()=>h.get("/account-configurations/my-config"),re=()=>{var x;const r=$(),{t:s}=D(),{handleError:y}=Y(s),g=O(),{setUser:b,user:p,selectedPositionId:T,setSelectedPositionId:w}=Z(),{data:o,isLoading:k,isError:n,refetch:d}=U({queryKey:["authUser"],queryFn:async()=>{const{data:a}=await X({tenantKey:c.get("tenant-key"),unitId:c.get("unit-id")||""});return a},staleTime:300*1e3,retry:!1}),{mutate:N,isError:f,isSuccess:P}=S({mutationFn:async({email:a,password:u,tenantKey:B,unitId:_})=>(await W({email:a,password:u},{tenantKey:B,unitId:_})).data,onSuccess:(a,u)=>{c.set("auth-token",a.token,{expires:1}),c.set("tenant-key",u.tenantKey,{expires:1}),c.set("unit-id",u.unitId||"",{expires:1}),j.success(s("msg.loginSuccess"),{description:s("msg.redirecting")}),r.invalidateQueries({queryKey:["authUser"]}),g("/dashboard")},onError:a=>{y(a)}}),{mutate:C,isError:E,isSuccess:q}=S({mutationFn:async()=>{await ee()},onSuccess:()=>{b(null),w(null),Object.keys(c.get()).forEach(a=>{c.remove(a)}),Q(),localStorage.removeItem("token"),r.invalidateQueries({queryKey:["authUser"]}),j.success(s("msg.logoutSuccess")||"Logged out successfully"),window.location.replace("/")},onError:a=>{b(null),w(null),Object.keys(c.get()).forEach(u=>{c.remove(u)}),Q(),localStorage.removeItem("token"),r.invalidateQueries({queryKey:["authUser"]}),y(a),window.location.replace("/")}}),{mutate:i,isPending:M}=S({mutationFn:async({isMFARequired:a})=>{await te({isMFARequired:a})},onSuccess:()=>{j.success("Two-Factor Authentication setting updated"),r.invalidateQueries({queryKey:["twoFAStatus"]})},onError:a=>{y(a)}}),{data:v,isLoading:F}=U({queryKey:["twoFAStatus",o],queryFn:ae,enabled:!!o}),{mutate:A}=S({mutationFn:async({id:a,isEnabled:u})=>{await se({isMFARequired:u},a)},onSuccess:()=>{r.invalidateQueries({queryKey:["twoFAStatus"]})}}),l=(o==null?void 0:o.selectedPositionPermissionKeys)||[];return{userDetails:o,selectedPositionPermissionKeys:l,isLoading:k,isError:n,refetch:d,login:N,logout:C,loginSuccess:P,loginError:f,logoutSuccess:q,logoutError:E,setTwoFactorAuth:i,twoFactorData:(x=v==null?void 0:v.data)==null?void 0:x.items,isLoadingStatus:F,editTwoFA:A}},me=()=>{const r=O(),[s,y]=m.useState(""),[g,b]=m.useState(""),[p,T]=m.useState(""),[w,o]=m.useState(!1),[k,n]=m.useState(""),[d,N]=m.useState(!1),[f,P]=m.useState(!1),{logout:C}=re(),E=()=>{C()},q=async i=>{if(i.preventDefault(),n(""),!g){n(t("msg.currentPasswordRequired"));return}if(!s){n(t("msg.newPasswordRequired"));return}if(s.length<8){n(t("msg.passwordMinLength"));return}if(s===g){n(t("msg.passwordMustBeDifferent"));return}if(!p){n(t("msg.confirmPasswordRequired"));return}if(s!==p){n(t("msg.passwordMismatch"));return}const M=/[A-Z]/.test(s),v=/[a-z]/.test(s),F=/\d/.test(s),A=/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(s),l=[];if(M||l.push(t("msg.uppercaseLetter")),v||l.push(t("msg.lowercaseLetter")),F||l.push(t("msg.number")),A||l.push(t("msg.specialCharacter")),l.length>0){n(t("msg.passwordComplexity")+" "+l.join(", "));return}o(!0);try{await G({oldPassword:g,newPassword:s,confirmPassword:p}),j.success(t("msg.successChange"),{description:"Your password has been changed successfully"}),setTimeout(E,1200)}catch(x){const a=(x==null?void 0:x.message)||t("msg.failedChange");n(a),j.error(t("msg.failedChange"),{description:a})}finally{o(!1)}};return e.jsx("div",{className:"flex items-center justify-center bg-gray-100 dark:bg-gray-900 p-4",style:{height:"100vh"},children:e.jsxs("div",{className:"w-full max-w-md bg-white dark:bg-gray-800 rounded-xl shadow-lg p-8",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsx("img",{src:"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-10 mb-6 mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:t("change_password")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("msg.changePasswordMsg")})]}),e.jsxs("form",{onSubmit:q,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(I,{className:"h-5 w-5 text-gray-400 dark:text-gray-500"})}),e.jsx(L,{type:d?"text":"password",placeholder:t("msg.oldPassword"),className:"h-10 rounded-md border dark:border-gray-600 px-4 text-sm ps-10 dark:bg-gray-700 dark:text-gray-100",value:g,onChange:i=>b(i.target.value),required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>N(!d),children:d?e.jsx(K,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}):e.jsx(R,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(I,{className:"h-5 w-5 text-gray-400 dark:text-gray-500"})}),e.jsx(L,{type:d?"text":"password",placeholder:t("msg.newPassword"),className:"h-10 rounded-md border dark:border-gray-600 px-4 text-sm ps-10 dark:bg-gray-700 dark:text-gray-100",value:s,onChange:i=>y(i.target.value),required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>N(!d),children:d?e.jsx(K,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}):e.jsx(R,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(I,{className:"h-5 w-5 text-gray-400 dark:text-gray-500"})}),e.jsx(L,{type:f?"text":"password",placeholder:t("msg.confirmNewPassword"),className:"h-10 rounded-md border dark:border-gray-600 px-4 text-sm ps-10 dark:bg-gray-700 dark:text-gray-100",value:p,onChange:i=>T(i.target.value),required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>P(!f),children:f?e.jsx(K,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}):e.jsx(R,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"})})]}),k&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md p-3 md:p-4",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400 font-medium",children:k})})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(z,{type:"submit",className:"w-full h-10 bg-primary hover:bg-primary-300 text-white text-sm",disabled:w,children:w?e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsx(J,{className:"animate-spin h-5 w-5 mr-2"}),"changing..."]}):t("change_password")}),e.jsxs(z,{type:"button",variant:"outline",className:"w-full h-10 text-sm",onClick:()=>r(-1),children:[e.jsx(V,{className:"h-4 w-4 mr-2"}),t("userRecord.Back")]})]})]})]})})};export{me as ResetPassword,me as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-CAXGYFGh.js b/apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-CAXGYFGh.js deleted file mode 100644 index 15302cd37..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-CAXGYFGh.js +++ /dev/null @@ -1 +0,0 @@ -import{r as N,as as de,K as V,N as z,V as B,j as c,a0 as ue,W as T,Y as A,ae as Q,X as M,Q as $,am as X,aa as S,an as Y,_ as q,au as he,a8 as pe}from"./index-7T7TTikv.js";import{g as D}from"./get-auto-contrast-value-Da6zqqWm.js";import{I as xe,a as Ce,b as be}from"./InputsGroupFieldset-B16dMH0P.js";import{u as H}from"./use-uncontrolled-tg0LIUAX.js";const J=N.createContext(null),ve=J.Provider,Z=()=>N.useContext(J),[ke,me]=de();var ee={card:"m_26775b0a"};const fe={withBorder:!0},ye=T((e,{radius:o})=>({card:{"--card-radius":A(o)}})),E=V((e,o)=>{const s=z("CheckboxCard",fe,e),{classNames:t,className:n,style:l,styles:a,unstyled:r,vars:d,checked:v,mod:i,withBorder:f,value:k,onClick:h,defaultChecked:b,onChange:p,...y}=s,g=B({name:"CheckboxCard",classes:ee,props:s,className:n,style:l,classNames:t,styles:a,unstyled:r,vars:d,varsResolver:ye,rootSelector:"card"}),u=Z(),_=typeof v=="boolean"?v:u?u.value.includes(k||""):void 0,[x,C]=H({value:_,defaultValue:b,finalValue:!1,onChange:p});return c.jsx(ke,{value:{checked:x},children:c.jsx(ue,{ref:o,mod:[{"with-border":f,checked:x},i],...g("card"),...y,role:"checkbox","aria-checked":x,onClick:m=>{h==null||h(m),u==null||u.onChange(k||""),C(!x)}})})});E.displayName="@mantine/core/CheckboxCard";E.classes=ee;const ge={},W=V((e,o)=>{const{value:s,defaultValue:t,onChange:n,size:l,wrapperProps:a,children:r,readOnly:d,...v}=z("CheckboxGroup",ge,e),[i,f]=H({value:s,defaultValue:t,finalValue:[],onChange:n}),k=h=>{const b=typeof h=="string"?h:h.currentTarget.value;!d&&f(i.includes(b)?i.filter(p=>p!==b):[...i,b])};return c.jsx(ve,{value:{value:i,onChange:k,size:l},children:c.jsx(Q.Wrapper,{size:l,ref:o,...a,...v,labelElement:"div",__staticSelector:"CheckboxGroup",children:c.jsx(xe,{role:"group",children:r})})})});W.classes=Q.Wrapper.classes;W.displayName="@mantine/core/CheckboxGroup";function _e({size:e,style:o,...s}){const t=e!==void 0?{width:M(e),height:M(e),...o}:o;return c.jsx("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,"aria-hidden":!0,...s,children:c.jsx("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function oe({indeterminate:e,...o}){return e?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...o,children:c.jsx("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})}):c.jsx(_e,{...o})}var se={indicator:"m_5e5256ee",icon:"m_1b1c543a","indicator--outline":"m_76e20374"};const je={icon:oe},we=T((e,{radius:o,color:s,size:t,iconColor:n,variant:l,autoContrast:a})=>{const r=X({color:s||e.primaryColor,theme:e}),d=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{indicator:{"--checkbox-size":q(t,"checkbox-size"),"--checkbox-radius":o===void 0?void 0:A(o),"--checkbox-color":l==="outline"?d:S(s,e),"--checkbox-icon-color":n?S(n,e):D(a,e)?Y({color:s,theme:e,autoContrast:a}):void 0}}}),L=V((e,o)=>{const s=z("CheckboxIndicator",je,e),{classNames:t,className:n,style:l,styles:a,unstyled:r,vars:d,icon:v,indeterminate:i,radius:f,color:k,iconColor:h,autoContrast:b,checked:p,mod:y,variant:g,disabled:u,..._}=s,x=v,C=B({name:"CheckboxIndicator",classes:se,props:s,className:n,style:l,classNames:t,styles:a,unstyled:r,vars:d,varsResolver:we,rootSelector:"indicator"}),m=me(),G=typeof p=="boolean"||typeof i=="boolean"?p||i:(m==null?void 0:m.checked)||!1;return c.jsx($,{ref:o,...C("indicator",{variant:g}),variant:g,mod:[{checked:G,disabled:u},y],..._,children:c.jsx(x,{indeterminate:i,...C("icon")})})});L.displayName="@mantine/core/CheckboxIndicator";L.classes=se;var re={root:"m_bf2d988c",inner:"m_26062bec",input:"m_26063560",icon:"m_bf295423","input--outline":"m_215c4542"};const Ie={labelPosition:"right",icon:oe},Pe=T((e,{radius:o,color:s,size:t,iconColor:n,variant:l,autoContrast:a})=>{const r=X({color:s||e.primaryColor,theme:e}),d=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{root:{"--checkbox-size":q(t,"checkbox-size"),"--checkbox-radius":o===void 0?void 0:A(o),"--checkbox-color":l==="outline"?d:S(s,e),"--checkbox-icon-color":n?S(n,e):D(a,e)?Y({color:s,theme:e,autoContrast:a}):void 0}}}),I=V((e,o)=>{const s=z("Checkbox",Ie,e),{classNames:t,className:n,style:l,styles:a,unstyled:r,vars:d,color:v,label:i,id:f,size:k,radius:h,wrapperProps:b,checked:p,labelPosition:y,description:g,error:u,disabled:_,variant:x,indeterminate:C,icon:m,rootRef:G,iconColor:Re,onChange:P,autoContrast:Ne,mod:ce,...te}=s,j=Z(),ae=k||(j==null?void 0:j.size),ne=m,R=B({name:"Checkbox",props:s,classes:re,className:n,style:l,classNames:t,styles:a,unstyled:r,vars:d,varsResolver:Pe}),{styleProps:le,rest:O}=he(te),U=pe(f),F=j?{checked:j.value.includes(O.value),onChange:K=>{j.onChange(K),P==null||P(K)}}:{},ie=N.useRef(null),w=o||ie;return N.useEffect(()=>{w&&"current"in w&&w.current&&(w.current.indeterminate=C||!1)},[C,w]),c.jsx(Ce,{...R("root"),__staticSelector:"Checkbox",__stylesApiProps:s,id:U,size:ae,labelPosition:y,label:i,description:g,error:u,disabled:_,classNames:t,styles:a,unstyled:r,"data-checked":F.checked||p||void 0,variant:x,ref:G,mod:ce,...le,...b,children:c.jsxs($,{...R("inner"),mod:{"data-label-position":y},children:[c.jsx($,{component:"input",id:U,ref:w,checked:p,disabled:_,mod:{error:!!u,indeterminate:C},...R("input",{focusable:!0,variant:x}),onChange:P,...O,...F,type:"checkbox"}),c.jsx(ne,{indeterminate:C,...R("icon")})]})})});I.classes={...re,...be};I.displayName="@mantine/core/Checkbox";I.Group=W;I.Indicator=L;I.Card=E;export{_e as C,I as a}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-IILksgz0.js b/apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-IILksgz0.js deleted file mode 100644 index 0a9a3f319..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Checkbox-IILksgz0.js +++ /dev/null @@ -1 +0,0 @@ -import{r as N,as as de,K as V,N as z,V as B,j as c,a0 as ue,W as T,Y as A,ae as Q,X as M,Q as $,am as X,aa as S,an as Y,_ as q,au as he,a8 as pe}from"./index-Db-xuq0b.js";import{g as D}from"./get-auto-contrast-value-Da6zqqWm.js";import{I as xe,a as Ce,b as be}from"./InputsGroupFieldset-COkNgcEo.js";import{u as H}from"./use-uncontrolled-C3HRHW6t.js";const J=N.createContext(null),ve=J.Provider,Z=()=>N.useContext(J),[ke,me]=de();var ee={card:"m_26775b0a"};const fe={withBorder:!0},ye=T((e,{radius:o})=>({card:{"--card-radius":A(o)}})),E=V((e,o)=>{const s=z("CheckboxCard",fe,e),{classNames:t,className:n,style:l,styles:a,unstyled:r,vars:d,checked:v,mod:i,withBorder:f,value:k,onClick:h,defaultChecked:b,onChange:p,...y}=s,g=B({name:"CheckboxCard",classes:ee,props:s,className:n,style:l,classNames:t,styles:a,unstyled:r,vars:d,varsResolver:ye,rootSelector:"card"}),u=Z(),_=typeof v=="boolean"?v:u?u.value.includes(k||""):void 0,[x,C]=H({value:_,defaultValue:b,finalValue:!1,onChange:p});return c.jsx(ke,{value:{checked:x},children:c.jsx(ue,{ref:o,mod:[{"with-border":f,checked:x},i],...g("card"),...y,role:"checkbox","aria-checked":x,onClick:m=>{h==null||h(m),u==null||u.onChange(k||""),C(!x)}})})});E.displayName="@mantine/core/CheckboxCard";E.classes=ee;const ge={},W=V((e,o)=>{const{value:s,defaultValue:t,onChange:n,size:l,wrapperProps:a,children:r,readOnly:d,...v}=z("CheckboxGroup",ge,e),[i,f]=H({value:s,defaultValue:t,finalValue:[],onChange:n}),k=h=>{const b=typeof h=="string"?h:h.currentTarget.value;!d&&f(i.includes(b)?i.filter(p=>p!==b):[...i,b])};return c.jsx(ve,{value:{value:i,onChange:k,size:l},children:c.jsx(Q.Wrapper,{size:l,ref:o,...a,...v,labelElement:"div",__staticSelector:"CheckboxGroup",children:c.jsx(xe,{role:"group",children:r})})})});W.classes=Q.Wrapper.classes;W.displayName="@mantine/core/CheckboxGroup";function _e({size:e,style:o,...s}){const t=e!==void 0?{width:M(e),height:M(e),...o}:o;return c.jsx("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,"aria-hidden":!0,...s,children:c.jsx("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function oe({indeterminate:e,...o}){return e?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...o,children:c.jsx("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})}):c.jsx(_e,{...o})}var se={indicator:"m_5e5256ee",icon:"m_1b1c543a","indicator--outline":"m_76e20374"};const je={icon:oe},we=T((e,{radius:o,color:s,size:t,iconColor:n,variant:l,autoContrast:a})=>{const r=X({color:s||e.primaryColor,theme:e}),d=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{indicator:{"--checkbox-size":q(t,"checkbox-size"),"--checkbox-radius":o===void 0?void 0:A(o),"--checkbox-color":l==="outline"?d:S(s,e),"--checkbox-icon-color":n?S(n,e):D(a,e)?Y({color:s,theme:e,autoContrast:a}):void 0}}}),L=V((e,o)=>{const s=z("CheckboxIndicator",je,e),{classNames:t,className:n,style:l,styles:a,unstyled:r,vars:d,icon:v,indeterminate:i,radius:f,color:k,iconColor:h,autoContrast:b,checked:p,mod:y,variant:g,disabled:u,..._}=s,x=v,C=B({name:"CheckboxIndicator",classes:se,props:s,className:n,style:l,classNames:t,styles:a,unstyled:r,vars:d,varsResolver:we,rootSelector:"indicator"}),m=me(),G=typeof p=="boolean"||typeof i=="boolean"?p||i:(m==null?void 0:m.checked)||!1;return c.jsx($,{ref:o,...C("indicator",{variant:g}),variant:g,mod:[{checked:G,disabled:u},y],..._,children:c.jsx(x,{indeterminate:i,...C("icon")})})});L.displayName="@mantine/core/CheckboxIndicator";L.classes=se;var re={root:"m_bf2d988c",inner:"m_26062bec",input:"m_26063560",icon:"m_bf295423","input--outline":"m_215c4542"};const Ie={labelPosition:"right",icon:oe},Pe=T((e,{radius:o,color:s,size:t,iconColor:n,variant:l,autoContrast:a})=>{const r=X({color:s||e.primaryColor,theme:e}),d=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{root:{"--checkbox-size":q(t,"checkbox-size"),"--checkbox-radius":o===void 0?void 0:A(o),"--checkbox-color":l==="outline"?d:S(s,e),"--checkbox-icon-color":n?S(n,e):D(a,e)?Y({color:s,theme:e,autoContrast:a}):void 0}}}),I=V((e,o)=>{const s=z("Checkbox",Ie,e),{classNames:t,className:n,style:l,styles:a,unstyled:r,vars:d,color:v,label:i,id:f,size:k,radius:h,wrapperProps:b,checked:p,labelPosition:y,description:g,error:u,disabled:_,variant:x,indeterminate:C,icon:m,rootRef:G,iconColor:Re,onChange:P,autoContrast:Ne,mod:ce,...te}=s,j=Z(),ae=k||(j==null?void 0:j.size),ne=m,R=B({name:"Checkbox",props:s,classes:re,className:n,style:l,classNames:t,styles:a,unstyled:r,vars:d,varsResolver:Pe}),{styleProps:le,rest:O}=he(te),U=pe(f),F=j?{checked:j.value.includes(O.value),onChange:K=>{j.onChange(K),P==null||P(K)}}:{},ie=N.useRef(null),w=o||ie;return N.useEffect(()=>{w&&"current"in w&&w.current&&(w.current.indeterminate=C||!1)},[C,w]),c.jsx(Ce,{...R("root"),__staticSelector:"Checkbox",__stylesApiProps:s,id:U,size:ae,labelPosition:y,label:i,description:g,error:u,disabled:_,classNames:t,styles:a,unstyled:r,"data-checked":F.checked||p||void 0,variant:x,ref:G,mod:ce,...le,...b,children:c.jsxs($,{...R("inner"),mod:{"data-label-position":y},children:[c.jsx($,{component:"input",id:U,ref:w,checked:p,disabled:_,mod:{error:!!u,indeterminate:C},...R("input",{focusable:!0,variant:x}),onChange:P,...O,...F,type:"checkbox"}),c.jsx(ne,{indeterminate:C,...R("icon")})]})})});I.classes={...re,...be};I.displayName="@mantine/core/Checkbox";I.Group=W;I.Indicator=L;I.Card=E;export{_e as C,I as a}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-C9o7hgIH.js b/apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-C9o7hgIH.js deleted file mode 100644 index 64c01a087..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-C9o7hgIH.js +++ /dev/null @@ -1,16 +0,0 @@ -import{y as Ke,d as Ue,m as Ee,az as He,r as d,o as b,v as t,j as e,bn as Te,B as U,aK as Ae,aL as Be,aM as Pe,aN as Fe,bo as Nt,I as _a,ba as Ct,l as Le,w as De,u as Ga,k as Ja,n as Xa,t as C,aF as We,b7 as Za,bp as xt,b6 as es,A as ts}from"./index-7T7TTikv.js";import{S as Z,a as ee,b as te,c as ae,d as f}from"./select--i8koVXg.js";import{u as Me}from"./useUnit-CRt6YBLp.js";import{u as Qe,p as N,E as le}from"./useUnitConfiguration-BYTU44Fr.js";import{T as ze,a as Ye,b as p,c as T,d as Ve,e as n}from"./table-D_B7hhqb.js";import{u as as}from"./usePosition-B4V039Jv.js";import{C as ss,d as ns}from"./card-_ldW-koX.js";import{S as g}from"./switch-D9hx8CZw.js";import{F as ht,b as E,c as H,a as Q,d as z,e as Oe}from"./form-lLGtsTgY.js";import{B as we}from"./badge-D4t6Wb1T.js";import{A as is,a as rs}from"./alert-CCWXLU2U.js";import{A as ls,h as ds,a as os,b as cs,c as us,d as ms,e as xs,f as hs,g as gs}from"./alert-dialog-DwppaTz4.js";import{u as fs}from"./index.esm-BRNlF2G3.js";import{u as bs,o as js,e as ps,b as Ie,s as Ns}from"./zod-D-9d3Txu.js";import{C as gt}from"./circle-alert-HVqsZpe-.js";import{P as Cs}from"./plus-CC3ol2sL.js";import{M as ft}from"./message-square-BDJ0WXpX.js";import{M as bt}from"./mail-q8lHlEPt.js";import{S as vs}from"./square-pen-Dh1zj83N.js";import{L as jt}from"./label-CABYEcfW.js";import{S as ks}from"./shield-check-CfyQTFAv.js";import"./unitService-DTtkt-Pb.js";import"./positionService-BwPU5sNe.js";import"./Switch-ByfhjkDo.js";import"./InputsGroupFieldset-B16dMH0P.js";import"./use-uncontrolled-tg0LIUAX.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ss=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],ys=Ke("pen-line",Ss);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rs=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],vt=Ke("pen",Rs);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ws=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],pt=Ke("workflow",ws),Is="relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",As=()=>{var ie,y,q,X,S,W,o;const{user:x}=Ue(),c=Ee(),Y=((y=(ie=x==null?void 0:x.employee)==null?void 0:ie[0])==null?void 0:y.organizationId)||"",B=He(),{getList:L}=Me(),{data:u,isLoading:R}=L(Y,{take:1e3}),[r,I]=d.useState(""),[P,v]=d.useState(!1),[k,h]=d.useState(null),[V,_]=d.useState(0);d.useEffect(()=>{var j,O,re;((O=(j=u==null?void 0:u.data)==null?void 0:j.items)==null?void 0:O.length)>0&&!r&&I((re=u==null?void 0:u.data)==null?void 0:re.items[0].id)},[u]);const{data:F,isLoading:G,error:$}=Qe(r),m=(X=(q=F==null?void 0:F.data)==null?void 0:q.items)==null?void 0:X[0],{mutate:se,isPending:D}=b({mutationFn:({id:j,key:O,value:re})=>N.updateInternalPrefixSuffix({[O]:re,unitId:r},j),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),v(!1),h(null)},onError:j=>{}}),M=(j,O)=>{h(j),_(O),v(!0)},ne=()=>{!(m!=null&&m.id)||!k||se({id:m.id,key:k,value:V})},J=[{key:"escalationHour",label:t("setting.escalationHour"),value:m==null?void 0:m.escalationHour},{key:"urgentLetterEscalationHour",label:t("setting.urgentLetterEscalationHour"),value:m==null?void 0:m.urgentLetterEscalationHour},{key:"onReviewLetterEscalationHour",label:t("setting.onReviewLetterEscalationHour"),value:m==null?void 0:m.onReviewLetterEscalationHour},{key:"urgentOnReviewLetterEscalationHour",label:t("setting.urgentOnReviewLetterEscalationHour"),value:m==null?void 0:m.urgentOnReviewLetterEscalationHour}];return e.jsxs("div",{className:Is,children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-4 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold text-slate-900 sm:text-3xl dark:text-slate-100",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.escalationTitle")]}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:t("setting.escalationDescription")})]}),e.jsx("div",{className:"w-full sm:ml-auto sm:w-auto",children:e.jsxs(Z,{value:r,onValueChange:j=>I(j),children:[e.jsx(ee,{className:"h-10 w-full bg-white/90 dark:border-slate-700 dark:bg-slate-900 sm:w-56",children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:R?e.jsx(f,{value:"loading",disabled:!0,children:t("setting.loading")}):((W=(S=u==null?void 0:u.data)==null?void 0:S.items)==null?void 0:W.length)>0?(o=u==null?void 0:u.data)==null?void 0:o.items.map(j=>e.jsx(f,{value:j.id,children:B(j.name)},j.id)):e.jsx(f,{value:"no-units",disabled:!0,children:t("setting.noUnit")})})]})})]}),e.jsxs("div",{className:"space-y-3",children:[G&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:t("setting.loadingConfig")}),$&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:t("setting.loadError")}),!m&&!G&&!$&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:t("setting.noConfigFound")}),m&&e.jsx("div",{className:"overflow-x-auto rounded-xl border border-slate-200 bg-white/90 dark:border-slate-700 dark:bg-slate-900/70",children:e.jsxs(ze,{children:[e.jsx(Ye,{children:e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Name")}),e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Value")}),e.jsx(T,{className:"text-right text-slate-600 dark:text-slate-300",children:t("setting.Action")})]})}),e.jsx(Ve,{children:J.map(j=>e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"text-slate-900 dark:text-slate-100",children:j.label}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:j.value??"-"}),e.jsx(n,{className:"text-right",children:e.jsx(U,{onClick:()=>M(j.key,j.value),variant:"outline",size:"sm",className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(vt,{className:"h-4 w-4"})})})]},j.key))})]})})]}),e.jsx(Ae,{open:P,onOpenChange:v,children:e.jsxs(Be,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsxs(Pe,{children:[e.jsxs(Fe,{className:"dark:text-slate-100",children:[t("setting.edit")," ",k&&t(`setting.${k}`)]}),e.jsx(Nt,{className:"dark:text-slate-400",children:t("setting.updateEscalationMsg")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:k&&t(`setting.${k}`)}),e.jsx(_a,{type:"number",value:V??"",onChange:j=>_(Number(j.target.value)),className:"dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100"})]}),e.jsxs(Ct,{className:"flex justify-end gap-2 mt-4",children:[e.jsx(U,{variant:"secondary",onClick:()=>v(!1),className:"dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",children:t("common.Cancel")}),e.jsx(U,{onClick:ne,disabled:D,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:D?t("setting.saving"):t("setting.saveChanges")})]})]})})]})},Bs=async x=>Le.post("/position-configurations",x,{headers:De()}),Ps=async x=>Le.get(`/position-configurations/list/${x}`,{headers:De()}),Fs=async(x,c)=>Le.put(`/position-configurations/${x}`,c,{headers:De()}),Us=async x=>Le.delete(`/position-configurations/${x}`,{headers:De()}),Es=x=>{const c=Ee(),{t:Y}=Ga(),{handleError:B}=Ja(Y),{data:L,isLoading:u,isError:R,error:r,refetch:I}=Xa({queryKey:["position-configurations",x],queryFn:()=>Ps(x),select:h=>h&&h.data&&typeof h.data=="object"&&!Array.isArray(h.data)&&"items"in h.data?h.data.items:Array.isArray(h==null?void 0:h.data)?h.data:Array.isArray(h)?h:[],enabled:!!x}),P=b({mutationFn:Bs,onSuccess:()=>{c.invalidateQueries({queryKey:["position-configurations",x]}),C.success("Position configuration created successfully")},onError:h=>{B(h)}}),v=b({mutationFn:({id:h,payload:V})=>Fs(h,V),onSuccess:()=>{c.invalidateQueries({queryKey:["position-configurations",x]}),C.success("Position configuration updated successfully")},onError:h=>{B(h)}}),k=b({mutationFn:Us,onSuccess:()=>{c.invalidateQueries({queryKey:["position-configurations",x]}),C.success("Position configuration deleted successfully")},onError:h=>{B(h)}});return{configurations:L||[],isLoading:u,isError:R,error:r,refetch:I,createConfiguration:P.mutate,updateConfiguration:v.mutate,deleteConfiguration:k.mutate,isCreating:P.isPending,isUpdating:v.isPending,isDeleting:k.isPending}},kt=["all","immediate_child","parallel_with_immediate_child"],Hs=js({positionId:Ns().min(1,"Position is required"),smsNotificationWhenRecordSubmitted:Ie(),emailNotificationWhenRecordSubmitted:Ie(),inboxNotificationWhenRecordSubmitted:Ie(),skipWorkflowIfNotAssigned:Ie(),positionScopeToFetch:ps(kt)}),Ts=()=>{var ce,ue,me,xe,he,ge,fe,be,je,pe;const{user:x}=Ue(),c=((ue=(ce=x==null?void 0:x.employee)==null?void 0:ce[0])==null?void 0:ue.unitId)||"",Y=((xe=(me=x==null?void 0:x.employee)==null?void 0:me[0])==null?void 0:xe.organizationId)||"",B=He(),[L,u]=d.useState(!1),[R,r]=d.useState(null),[I,P]=d.useState(!1),[v,k]=d.useState(""),{configurations:h,isLoading:V,isError:_,error:F,refetch:G,createConfiguration:$,updateConfiguration:m,deleteConfiguration:se,isCreating:D,isUpdating:M,isDeleting:ne}=Es(c),J=Array.isArray(h)?h:[],{getList:ie}=Me(),{data:y,isLoading:q}=ie(Y,{take:1e3}),{usePositionListByUnitId:X}=as(),{data:S,isLoading:W}=X(v,{take:1e3}),o=fs({resolver:bs(Hs),defaultValues:{positionId:"",smsNotificationWhenRecordSubmitted:!0,emailNotificationWhenRecordSubmitted:!0,inboxNotificationWhenRecordSubmitted:!0,skipWorkflowIfNotAssigned:!1,positionScopeToFetch:"all"}}),j=i=>{$(i,{onSuccess:()=>{u(!1),k(""),o.reset()}})},O=i=>{R!=null&&R.id&&m({id:R==null?void 0:R.id,payload:i},{onSuccess:()=>{P(!1),r(null),k(""),o.reset()}})},re=i=>{var K;r(i);const w=(K=S==null?void 0:S.items)==null?void 0:K.find(de=>de.id===i.positionId),A=(w==null?void 0:w.unitId)||"";k(A),o.reset({positionId:i.positionId,smsNotificationWhenRecordSubmitted:i.smsNotificationWhenRecordSubmitted,emailNotificationWhenRecordSubmitted:i.emailNotificationWhenRecordSubmitted,inboxNotificationWhenRecordSubmitted:i.inboxNotificationWhenRecordSubmitted,skipWorkflowIfNotAssigned:i.skipWorkflowIfNotAssigned}),P(!0)},ve=i=>{se(i)},ke=i=>{var A;const w=(A=S==null?void 0:S.items)==null?void 0:A.find(K=>K.id===i);return B(w==null?void 0:w.name)||"Unknown Position"},Se=i=>{var de,Ne,Ce;const w=(de=S==null?void 0:S.items)==null?void 0:de.find(oe=>oe.id===i),A=w==null?void 0:w.unitId;if(!A)return"Unknown Unit";const K=(Ce=(Ne=y==null?void 0:y.data)==null?void 0:Ne.items)==null?void 0:Ce.find(oe=>oe.id===A);return B(K==null?void 0:K.name)||"Unknown Unit"};return Y?V?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(We,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.msg2")})]})}):e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-4 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold text-slate-900 sm:text-3xl dark:text-slate-100",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.positionConfig")]}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:t("setting.positionConfigMsg")})]}),e.jsxs(Ae,{open:L,onOpenChange:u,children:[e.jsx(Za,{asChild:!0,children:e.jsxs(U,{className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(Cs,{className:"h-4 w-4 mr-2"}),t("setting.add")]})}),e.jsxs(Be,{className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-white shadow-2xl border-2 dark:bg-gray-900 dark:border-gray-700",children:[e.jsx(Pe,{className:"sticky top-0 bg-white z-10 pb-4 border-b dark:bg-gray-900 dark:border-gray-700",children:e.jsx(Fe,{className:"dark:text-gray-100",children:t("setting.create")})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-1",children:e.jsx(ht,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(j),className:"space-y-6 pb-4",children:[e.jsxs(E,{children:[e.jsx(H,{className:"dark:text-gray-200",children:"Unit"}),e.jsxs(Z,{onValueChange:i=>{k(i)},value:v,children:[e.jsx(ee,{children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{children:q?e.jsx(f,{value:"loading",disabled:!0,children:"Loading units..."}):((ge=(he=y==null?void 0:y.data)==null?void 0:he.items)==null?void 0:ge.length)>0?(be=(fe=y==null?void 0:y.data)==null?void 0:fe.items)==null?void 0:be.map(i=>e.jsx(f,{value:i.id,children:B(i.name)},i.id)):e.jsx(f,{value:"no-units",disabled:!0,children:"No units found"})})]})]}),e.jsx(Q,{control:o.control,name:"positionId",render:({field:i})=>{var w;return e.jsxs(E,{children:[e.jsx(H,{className:"dark:text-gray-200",children:t("setting.position")}),e.jsxs(Z,{onValueChange:i.onChange,value:i.value,disabled:!v,children:[e.jsx(z,{children:e.jsx(ee,{children:e.jsx(te,{placeholder:v?t("setting.select"):t("setting.select2")})})}),e.jsx(ae,{children:v?W?e.jsx(f,{value:"loading",disabled:!0,children:"Loading positions..."}):((w=S==null?void 0:S.items)==null?void 0:w.length)>0?S.items.map(A=>e.jsx(f,{value:A.id,children:B(A.name)},A.id)):e.jsx(f,{value:"no-positions",disabled:!0,children:"No positions found in this unit"}):e.jsx(f,{value:"no-unit-selected",disabled:!0,children:t("setting.select2")})})]}),e.jsx(Oe,{}),!v&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t("setting.plsSelect")})]})}}),e.jsx(Q,{control:o.control,name:"positionScopeToFetch",render:({field:i})=>e.jsxs(E,{children:[e.jsx(H,{className:"dark:text-gray-200",children:t("setting.positionScope")}),e.jsxs(Z,{onValueChange:i.onChange,value:i.value,children:[e.jsx(z,{children:e.jsx(ee,{children:e.jsx(te,{placeholder:t("setting.positionScope")})})}),e.jsxs(ae,{children:[e.jsx(f,{value:"all",children:t("setting.all")}),e.jsx(f,{value:"immediate_child",children:t("setting.immediateChild")}),e.jsx(f,{value:"parallel_with_immediate_child",children:t("setting.parallel")})]})]}),e.jsx(Oe,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("setting.notification")}),e.jsx(Q,{control:o.control,name:"smsNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"h-4 w-4"}),t("setting.sms")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.smsMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"emailNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(bt,{className:"h-4 w-4"}),t("setting.email")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.emailMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"inboxNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-4 w-4"}),t("setting.inbox")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.inboxMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx("h3",{className:"text-lg font-semibold",children:t("setting.workflow")}),e.jsx(Q,{control:o.control,name:"skipWorkflowIfNotAssigned",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(pt,{className:"h-4 w-4"}),t("setting.workflowMsg")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.workflowMsg1")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(U,{type:"button",variant:"outline",onClick:()=>{u(!1),k(""),o.reset()},disabled:D,children:t("common.Cancel")}),e.jsx(U,{type:"submit",disabled:D,className:"bg-primary hover:bg-primary/90",children:D?e.jsxs(e.Fragment,{children:[e.jsx(We,{className:"h-4 w-4 mr-2 animate-spin"}),t("setting.creating")]}):t("setting.createConfig")})]})]})})})]})]})]}),e.jsx(ss,{className:"border-slate-200 bg-white/90 dark:border-slate-700 dark:bg-slate-900/70",children:e.jsxs(ns,{className:"pt-6",children:[_&&e.jsxs(is,{variant:"destructive",className:"mb-4",children:[e.jsx(gt,{className:"h-4 w-4"}),e.jsxs(rs,{children:[t("setting.error")," ",(F==null?void 0:F.message)||"Unknown error",e.jsx(U,{variant:"outline",size:"sm",onClick:()=>G(),className:"ml-2",children:t("setting.retry")})]})]}),J.length===0?e.jsx("div",{className:"text-center py-8"}):e.jsx("div",{className:"overflow-x-auto rounded-xl border border-slate-200 dark:border-slate-700",children:e.jsxs(ze,{children:[e.jsx(Ye,{children:e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.position")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("contentManagement.unit")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.SMS")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("organization.email")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.Inbox")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.skipWF")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.Action")})]})}),e.jsx(Ve,{children:J.map(i=>e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:ke(i.positionId)}),e.jsx(n,{className:"text-center text-slate-700 dark:text-slate-300",children:Se(i.positionId)}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.smsNotificationWhenRecordSubmitted?"default":"secondary",className:i.smsNotificationWhenRecordSubmitted?"bg-primary-100 text-primary-800":"",children:i.smsNotificationWhenRecordSubmitted?"Enabled":"Disabled"})}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.emailNotificationWhenRecordSubmitted?"default":"secondary",className:i.emailNotificationWhenRecordSubmitted?"bg-primary-100 text-primary-800":"",children:i.emailNotificationWhenRecordSubmitted?"Enabled":"Disabled"})}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.inboxNotificationWhenRecordSubmitted?"default":"secondary",className:i.inboxNotificationWhenRecordSubmitted?"bg-primary-100 text-primary-800":"",children:i.inboxNotificationWhenRecordSubmitted?"Enabled":"Disabled"})}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.skipWorkflowIfNotAssigned?"destructive":"secondary",children:i.skipWorkflowIfNotAssigned?"Skip":"Process"})}),e.jsx(n,{className:"text-center",children:e.jsxs("div",{className:"flex justify-center gap-2",children:[e.jsx(U,{variant:"outline",size:"sm",onClick:()=>re(i),disabled:M||ne,className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(vs,{className:"h-4 w-4"})}),e.jsxs(ls,{children:[e.jsx(ds,{asChild:!0,children:e.jsx(U,{variant:"outline",size:"sm",disabled:ne,className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(es,{className:"h-4 w-4 text-red-500"})})}),e.jsxs(os,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsxs(cs,{children:[e.jsx(us,{className:"dark:text-slate-100",children:t("setting.delete")}),e.jsx(ms,{className:"dark:text-slate-400",children:t("setting.deleteMsg")})]}),e.jsxs(xs,{children:[e.jsx(hs,{className:"dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",children:"Cancel"}),e.jsx(gs,{onClick:()=>i.id&&ve(i.id),className:"bg-red-600 hover:bg-red-700",children:t("userRecord.Delete")})]})]})]})]})})]},i.id))})]})})]})}),e.jsx(Ae,{open:I,onOpenChange:P,children:e.jsxs(Be,{className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-white shadow-2xl border-2 dark:bg-slate-900 dark:border-slate-700",children:[e.jsx(Pe,{className:"sticky top-0 bg-white z-10 pb-4 border-b dark:bg-slate-900 dark:border-slate-700",children:e.jsx(Fe,{className:"dark:text-slate-100",children:t("setting.edit")})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-1",children:e.jsx(ht,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(O),className:"space-y-6 pb-4",children:[e.jsxs(E,{children:[e.jsx(H,{children:t("contentManagement.unit")}),e.jsxs(Z,{onValueChange:i=>{k(i)},value:v,children:[e.jsx(ee,{children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{children:q?e.jsx(f,{value:"loading",disabled:!0,children:"Loading units..."}):((pe=(je=y==null?void 0:y.data)==null?void 0:je.items)==null?void 0:pe.length)>0?y==null?void 0:y.data.items.map(i=>e.jsx(f,{value:i.id,children:B(i.name)},i.id)):e.jsx(f,{value:"no-units",disabled:!0,children:"No units found"})})]})]}),e.jsx(Q,{control:o.control,name:"positionId",render:({field:i})=>{var w;return e.jsxs(E,{children:[e.jsx(H,{children:t("setting.position")}),e.jsxs(Z,{onValueChange:i.onChange,value:i.value,disabled:!v,children:[e.jsx(z,{children:e.jsx(ee,{children:e.jsx(te,{placeholder:v?t("setting.select"):t("setting.select2")})})}),e.jsx(ae,{children:v?W?e.jsx(f,{value:"loading",disabled:!0,children:"Loading positions..."}):((w=S==null?void 0:S.items)==null?void 0:w.length)>0?S.items.map(A=>e.jsx(f,{value:A.id,children:B(A.name)},A.id)):e.jsx(f,{value:"no-positions",disabled:!0,children:"No positions found in this unit"}):e.jsx(f,{value:"no-unit-selected",disabled:!0,children:t("setting.select2")})})]}),e.jsx(Oe,{}),!v&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t("setting.plsSelect")})]})}}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("setting.notification")}),e.jsx(Q,{control:o.control,name:"smsNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"h-4 w-4"}),t("setting.sms")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.smsMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"emailNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(bt,{className:"h-4 w-4"}),t("setting.email")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.emailMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"inboxNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-4 w-4"}),t("setting.inbox")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.inboxMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsxs("h3",{className:"text-lg font-semibold",children:[" ",t("setting.workflow")]}),e.jsx(Q,{control:o.control,name:"skipWorkflowIfNotAssigned",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(pt,{className:"h-4 w-4"}),t("setting.workflowMsg")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.workflowMsg1")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(U,{type:"button",variant:"outline",onClick:()=>{P(!1),r(null),k(""),o.reset()},disabled:M,children:t("common.Cancel")}),e.jsx(U,{type:"submit",disabled:M,className:"bg-primary hover:bg-primary/90",children:M?e.jsxs(e.Fragment,{children:[e.jsx(We,{className:"h-4 w-4 mr-2 animate-spin"}),t("setting.updating")]}):t("setting.UpdateConfig")})]})]})})})]})})]}):e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(gt,{className:"h-8 w-8 text-red-500"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.msg1")})]})})},Ls="relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",Ds=()=>{var it,rt,lt,dt,ot,ct,ut,mt;const{user:x}=Ue(),c=Ee(),Y=((rt=(it=x==null?void 0:x.employee)==null?void 0:it[0])==null?void 0:rt.organizationId)||"",B=He(),{getList:L}=Me(),{data:u,isLoading:R}=L(Y,{take:1e3}),[r,I]=d.useState(""),[P,v]=d.useState(!1),[k,h]=d.useState(""),[V,_]=d.useState(le.NAME),[F,G]=d.useState(!1),[$,m]=d.useState(!1),[se,D]=d.useState(!1),[M,ne]=d.useState(!1),[J,ie]=d.useState(!1),[y,q]=d.useState(!1),[X,S]=d.useState(!1),[W,o]=d.useState(!1),[j,O]=d.useState(!1),[re,ve]=d.useState(!1),[ke,Se]=d.useState(!1),[ce,ue]=d.useState(!1),[me,xe]=d.useState(!1),[he,ge]=d.useState(!1),[fe,be]=d.useState(!1),[je,pe]=d.useState(!1),[i,w]=d.useState(!1),[A,K]=d.useState(!1),[de,Ne]=d.useState(!1),[Ce,oe]=d.useState(!1),[_e,Ge]=d.useState(!1),[Je,Xe]=d.useState(!1),[Ze,et]=d.useState(!1),[tt,at]=d.useState(!1);d.useEffect(()=>{var a,l;if(((l=(a=u==null?void 0:u.data)==null?void 0:a.items)==null?void 0:l.length)>0){const Va=u==null?void 0:u.data.items[0];I(Va.id)}},[u]);const{data:$e,isLoading:ye,error:Re}=Qe(r,{enabled:!!r}),s=(dt=(lt=$e==null?void 0:$e.data)==null?void 0:lt.items)==null?void 0:dt[0],[$s,qs]=d.useState(!1);d.useEffect(()=>{s&&(G(s.canAssignCustomReferenceNumber||!1),_(s.recordSenderInformationScope||le.NAME),m(s.canInternalMemosHaveSenderInformation||!1),ie(s.canRecordDateLabelHasLocalization||!1),q(s.canRecordDateHaveTime||!1),S(s.forwardWithTeeterSignature||!1),o(s.waitAllCollaboratorsBeforeAction||!1),O(s.shouldCollaboratorAlwaysSign||!1),ve(s.shouldIncludeForYourReferenceInCC||!1),Se(s.canCollaborationBeCreatedForAll||!1),ue(s.canCreateDirectRecord||!1),xe(s.canPositionBasedRecordsBeCreated||!1),ge(s.canPositionBasedReferenceBeUsedForAllTypes||!1),pe(s.shouldDirectRecordHaveHeaderAndFooter||!1),be(s.canInternalMemoRequirePositionBasedReferenceNumber||!1),w(s.canRecordBeEditedByCollaborators||!1),K(s.canRecordHaveCollaboratorsName||!1),Ne(s.canRecordBeEditedOnWorkflow||!1),oe(s.canIncomingAssignmentsBeSeparated||!1),Ge(s.canROReturn||!1),Xe(s.internalMemoHasReferenceNumber||!1),et(s.isMultipleDelegationAllowed||!1),at(s.attachSignatureOnAttachment||!1),D(s.canHaveTagBasedReferenceNumber||!1),ne(s.canUserSkipLevel||!1))},[s]);const St=a=>{s!=null&&s.id&&(D(a),Rt({id:s.id,value:a}))},yt=a=>{s!=null&&s.id&&(ne(a),It({id:s.id,value:a}))},{mutate:Rt,isPending:wt}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canHaveTagBasedReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canHaveTagBasedReferenceNumber","Can Have Tag Based Reference Number")} ${se?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:It,isPending:At}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canUserSkipLevel:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canUserSkipLevel","User Can Skip Level")} ${M?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Bt,isPending:Pt}=b({mutationFn:({id:a,scope:l})=>N.updateInternalPrefixSuffix({recordSenderInformationScope:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.recordSenderInformationScope","Record Sender Information Scope")} updated`)},onError:a=>{}}),{mutate:Ft,isPending:Ut}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canAssignCustomReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canAssignCustomReferenceNumber")} ${F?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Et,isPending:Ht}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canInternalMemosHaveSenderInformation:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canUseNewInternalMemoFormat")} ${$?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Tt,isPending:Lt}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordDateLabelHasLocalization:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordDateLabelHasLocalization")} ${J?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Dt,isPending:Mt}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordDateHaveTime:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordDateHaveTime","Record Date Can Have Time")} ${y?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:$t,isPending:st}=b({mutationFn:({id:a,scope:l})=>N.updateInternalPrefixSuffix({positionScopeToFetch:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),v(!1)},onError:a=>{}}),{mutate:qt,isPending:Wt}=b({mutationFn:({id:a,signature:l})=>N.updateInternalPrefixSuffix({forwardWithTeeterSignature:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`Signature & Teeter ${X?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Ot,isPending:Kt}=b({mutationFn:({id:a,wait:l})=>N.updateInternalPrefixSuffix({waitAllCollaboratorsBeforeAction:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.title6")} ${W?"enabled":"disabled"}`)},onError:a=>{}}),Qt=()=>{s!=null&&s.id&&(h(s.positionScopeToFetch),v(!0))},zt=()=>{s!=null&&s.id&&k&&k!==s.positionScopeToFetch&&$t({id:s.id,scope:k})},Yt=a=>{s!=null&&s.id&&(S(a),qt({id:s.id,signature:a}))},Vt=a=>{s!=null&&s.id&&(G(a),Ft({id:s.id,value:a}))},_t=a=>{s!=null&&s.id&&(m(a),Et({id:s.id,value:a}))},Gt=a=>{s!=null&&s.id&&(ie(a),Tt({id:s.id,value:a}))},Jt=a=>{s!=null&&s.id&&(q(a),Dt({id:s.id,value:a}))},Xt=a=>{s!=null&&s.id&&(o(a),Ot({id:s.id,wait:a}))},{mutate:Zt,isPending:ea}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({shouldCollaboratorAlwaysSign:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.shouldCollaboratorAlwaysSign")} ${j?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:ta,isPending:aa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({shouldIncludeForYourReferenceInCC:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.shouldIncludeForYourReferenceInCC")} ${re?"enabled":"disabled"}`)},onError:a=>{}}),sa=a=>{s!=null&&s.id&&(O(a),Zt({id:s.id,value:a}))},na=a=>{s!=null&&s.id&&(_(a),Bt({id:s.id,scope:a}))},ia=a=>{s!=null&&s.id&&(ve(a),ta({id:s.id,value:a}))},{mutate:ra,isPending:la}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canCollaborationBeCreatedForAll:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canCollaborationBeCreatedForAll")} ${ke?"enabled":"disabled"}`)},onError:a=>{}}),da=a=>{s!=null&&s.id&&(Se(a),ra({id:s.id,value:a}))},{mutate:oa,isPending:ca}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canCreateDirectRecord:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canCreateDirectRecord")} ${ce?"enabled":"disabled"}`)},onError:a=>{}}),ua=a=>{s!=null&&s.id&&(ue(a),oa({id:s.id,value:a}))},{mutate:ma,isPending:xa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canPositionBasedRecordsBeCreated:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canPositionBasedRecordsBeCreated")} ${me?"enabled":"disabled"}`)},onError:a=>{}}),ha=a=>{s!=null&&s.id&&(xe(a),ma({id:s.id,value:a}))},{mutate:ga,isPending:fa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canPositionBasedReferenceBeUsedForAllTypes:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canPositionBasedReferenceBeUsedForAllTypes")} ${he?"enabled":"disabled"}`)},onError:a=>{}}),ba=a=>{s!=null&&s.id&&(ge(a),ga({id:s.id,value:a}))},{mutate:ja,isPending:pa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({shouldDirectRecordHaveHeaderAndFooter:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.shouldDirectRecordHaveHeaderAndFooter")} ${je?t("setting.enabled"):t("setting.disabled")}`)},onError:a=>{}}),Na=a=>{s!=null&&s.id&&(pe(a),ja({id:s.id,value:a}))},{mutate:Ca,isPending:va}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordBeEditedByCollaborators:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordBeEditedByCollaborators")} ${i?"enabled":"disabled"}`)},onError:a=>{}}),ka=a=>{s!=null&&s.id&&(w(a),Ca({id:s.id,value:a}))},{mutate:Sa,isPending:ya}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordHaveCollaboratorsName:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordHaveCollaboratorsName")} ${A?"enabled":"disabled"}`)},onError:a=>{}}),Ra=a=>{s!=null&&s.id&&(K(a),Sa({id:s.id,value:a}))},{mutate:wa,isPending:Ia}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordBeEditedOnWorkflow:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordBeEditedOnWorkflow")} ${de?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Aa,isPending:Ba}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canIncomingAssignmentsBeSeparated:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canIncomingAssignmentsBeSeparated")} ${Ce?"enabled":"disabled"}`)},onError:a=>{}}),Pa=a=>{s!=null&&s.id&&(Ne(a),wa({id:s.id,value:a}))},Fa=a=>{s!=null&&s.id&&(oe(a),Aa({id:s.id,value:a}))},{mutate:Ua,isPending:Ea}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canROReturn:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canROReturn")} ${_e?"enabled":"disabled"}`)},onError:a=>{}}),Ha=a=>{s!=null&&s.id&&(Ge(a),Ua({id:s.id,value:a}))},{mutate:Ta,isPending:La}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({internalMemoHasReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.internalMemoHasReferenceNumber")} ${Je?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Da,isPending:Ma}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canInternalMemoRequirePositionBasedReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canInternalMemoRequirePositionBasedReferenceNumber","Internal Memo Require Position Based Reference Number")} ${fe?"enabled":"disabled"}`)},onError:a=>{}}),$a=a=>{s!=null&&s.id&&(be(a),Da({id:s.id,value:a}))},qa=a=>{s!=null&&s.id&&(Xe(a),Ta({id:s.id,value:a}))},{mutate:Wa,isPending:Oa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({isMultipleDelegationAllowed:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.isMultipleDelegationAllowed","Multiple Delegation Allowed")} ${Ze?"enabled":"disabled"}`)},onError:a=>{}}),Ka=a=>{s!=null&&s.id&&(et(a),Wa({id:s.id,value:a}))},{mutate:Qa,isPending:za}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({attachSignatureOnAttachment:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.attachSignatureOnAttachment","Attach Signature On Attachment")} ${tt?"enabled":"disabled"}`)},onError:a=>{}}),Ya=a=>{s!=null&&s.id&&(at(a),Qa({id:s.id,value:a}))},{mutate:nt,isPending:qe}=b({mutationFn:a=>N.createInternalPrefixSuffix({unitId:a}),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]})},onError:a=>{}});return d.useEffect(()=>{!s&&!ye&&!Re&&r&&!qe&&nt(r)},[s,ye,Re,r,qe,nt]),e.jsxs("div",{className:Ls,children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-4 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold text-slate-900 sm:text-3xl dark:text-slate-100",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.title1")]}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:t("setting.title2")})]}),e.jsx("div",{className:"w-full sm:ml-auto sm:w-auto",children:e.jsxs(Z,{value:r,onValueChange:a=>I(a),children:[e.jsx(ee,{className:"h-10 w-full bg-white/90 dark:border-slate-700 dark:bg-slate-900 sm:w-56",children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:R?e.jsx(f,{value:"loading",disabled:!0,children:t("setting.loading")}):((ct=(ot=u==null?void 0:u.data)==null?void 0:ot.items)==null?void 0:ct.length)>0?(mt=(ut=u==null?void 0:u.data)==null?void 0:ut.items)==null?void 0:mt.map(a=>e.jsx(f,{value:a.id,children:B(a.name)},a.id)):e.jsx(f,{value:"no-units",disabled:!0,children:t("setting.noUnit")})})]})})]}),e.jsxs("div",{className:"space-y-3",children:[ye&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:"Loading configuration..."}),Re&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Failed to load configuration"}),!s&&!ye&&!Re&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:qe?t("setting.preparingDefaults","Preparing default configuration..."):t("setting.loading","Loading...")}),s&&e.jsx("div",{className:"max-h-128 overflow-x-auto overflow-y-auto rounded-xl border border-slate-200 bg-white/90 dark:border-slate-700 dark:bg-slate-900/70",children:e.jsxs(ze,{children:[e.jsx(Ye,{className:"sticky top-0 z-10 bg-white/95 backdrop-blur dark:bg-slate-900/95",children:e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Name")}),e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Value")}),e.jsx(T,{className:"text-right text-slate-600 dark:text-slate-300",children:t("setting.Action")})]})}),e.jsxs(Ve,{children:[e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:t("setting.title3")}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:s.positionScopeToFetch}),e.jsx(n,{className:"text-right",children:e.jsx(U,{onClick:Qt,variant:"outline",size:"sm",className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(vt,{className:"h-4 w-4"})})})]}),e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:t("setting.title5")}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:s.forwardWithTeeterSignature?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"add-teeter-assign",checked:X,onCheckedChange:Yt,disabled:Wt})})]}),e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:t("setting.title6")}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:s.waitAllCollaboratorsBeforeAction?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"wait-for-all-collaborators-before-action",checked:W,onCheckedChange:Xt,disabled:Kt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canAssignCustomReferenceNumber","Can Assign Custom Reference Number")}),e.jsx(n,{children:s.canAssignCustomReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-assign-custom-reference-number",checked:F,onCheckedChange:Vt,disabled:Ut})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canUseNewInternalMemoFormat","New Internal Memo Format")}),e.jsx(n,{children:s.canInternalMemosHaveSenderInformation?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-use-new-internal-memo-format",checked:$,onCheckedChange:_t,disabled:Ht})})]}),$&&e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.recordSenderInformationScope","Record Sender Information Scope")}),e.jsx(n,{children:s.recordSenderInformationScope||"NAME"}),e.jsx(n,{className:"text-right",children:e.jsxs(Z,{value:V,onValueChange:a=>na(a),disabled:Pt,children:[e.jsx(ee,{className:"w-40 dark:border-slate-700 dark:bg-slate-900",children:e.jsx(te,{})}),e.jsxs(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsx(f,{value:le.NAME,children:"Name"}),e.jsx(f,{value:le.SIGNATURE,children:"Signature"}),e.jsx(f,{value:le.STAMP,children:"Stamp"}),e.jsx(f,{value:le.NAME_AND_SIGNATURE,children:"Name & Signature"}),e.jsx(f,{value:le.NAME_AND_STAMP,children:"Name & Stamp"}),e.jsx(f,{value:le.ALL,children:"All"})]})]})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordDateLabelHasLocalization","Does Record Date Label Have Localization?")}),e.jsx(n,{children:s.canRecordDateLabelHasLocalization?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-date-label-has-localization",checked:J,onCheckedChange:Gt,disabled:Lt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordDateHaveTime","Record Date Can Have Time")}),e.jsx(n,{children:s.canRecordDateHaveTime?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-date-have-time",checked:y,onCheckedChange:Jt,disabled:Mt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canCreateDirectRecord")}),e.jsx(n,{children:s.canCreateDirectRecord?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-create-direct-record",checked:ce,onCheckedChange:ua,disabled:ca})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canPositionBasedRecordsBeCreated")}),e.jsx(n,{children:s.canPositionBasedRecordsBeCreated?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-position-based-records-be-created",checked:me,onCheckedChange:ha,disabled:xa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canPositionBasedReferenceBeUsedForAllTypes")}),e.jsx(n,{children:s.canPositionBasedReferenceBeUsedForAllTypes?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-position-based-reference-be-used-for-all-types",checked:he,onCheckedChange:ba,disabled:fa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canInternalMemoRequirePositionBasedReferenceNumber","Internal Memo Require Position Based Reference Number")}),e.jsx(n,{children:s.canInternalMemoRequirePositionBasedReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-internal-memo-require-position-based-reference-number",checked:fe,onCheckedChange:$a,disabled:Ma})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.shouldDirectRecordHaveHeaderAndFooter")}),e.jsx(n,{children:s.shouldDirectRecordHaveHeaderAndFooter?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"should-direct-record-have-header-and-footer",checked:je,onCheckedChange:Na,disabled:pa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.shouldCollaboratorAlwaysSign")}),e.jsx(n,{children:s.shouldCollaboratorAlwaysSign?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"should-collaborator-always-sign",checked:j,onCheckedChange:sa,disabled:ea})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.shouldIncludeForYourReferenceInCC")}),e.jsx(n,{children:s.shouldIncludeForYourReferenceInCC?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"should-include-for-your-reference",checked:re,onCheckedChange:ia,disabled:aa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canCollaborationBeCreatedForAll")}),e.jsx(n,{children:s.canCollaborationBeCreatedForAll?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-collaboration-be-created-for-all",checked:ke,onCheckedChange:da,disabled:la})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordBeEditedByCollaborators")}),e.jsx(n,{children:s.canRecordBeEditedByCollaborators?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-be-edited-by-collaborators",checked:i,onCheckedChange:ka,disabled:va})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordHaveCollaboratorsName")}),e.jsx(n,{children:s.canRecordHaveCollaboratorsName?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-have-collaborators-name",checked:A,onCheckedChange:Ra,disabled:ya})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordBeEditedOnWorkflow")}),e.jsx(n,{children:s.canRecordBeEditedOnWorkflow?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-be-edited-on-workflow",checked:de,onCheckedChange:Pa,disabled:Ia})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canIncomingAssignmentsBeSeparated")}),e.jsx(n,{children:s.canIncomingAssignmentsBeSeparated?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-incoming-assignements-be-separated",checked:Ce,onCheckedChange:Fa,disabled:Ba})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canROReturn")}),e.jsx(n,{children:s.canROReturn?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-ro-return",checked:_e,onCheckedChange:Ha,disabled:Ea})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.internalMemoHasReferenceNumber")}),e.jsx(n,{children:s.internalMemoHasReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"internal-memo-has-reference-number",checked:Je,onCheckedChange:qa,disabled:La})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.isMultipleDelegationAllowed","Multiple Delegation Allowed")}),e.jsx(n,{children:s.isMultipleDelegationAllowed?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"is-multiple-delegation-allowed",checked:Ze,onCheckedChange:Ka,disabled:Oa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.attachSignatureOnAttachment","Attach Signature On Attachment")}),e.jsx(n,{children:s.attachSignatureOnAttachment?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"attach-signature-on-attachment",checked:tt,onCheckedChange:Ya,disabled:za})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canHaveTagBasedReferenceNumber","Can Have Tag Based Reference Number")}),e.jsx(n,{children:s.canHaveTagBasedReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-have-tag-based-reference-number",checked:se,onCheckedChange:St,disabled:wt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canUserSkipLevel","User Can Skip Level")}),e.jsx(n,{children:s.canUserSkipLevel?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-user-skip-level",checked:M,onCheckedChange:yt,disabled:At})})]})]})]})})]}),e.jsx(Ae,{open:P,onOpenChange:v,children:e.jsxs(Be,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsxs(Pe,{children:[e.jsx(Fe,{className:"dark:text-slate-100",children:t("setting.editTitle")}),e.jsx(Nt,{className:"dark:text-slate-400",children:t("setting.editMsg")})]}),e.jsx("div",{className:"my-4",children:e.jsxs(Z,{value:k,onValueChange:a=>h(a),children:[e.jsx(ee,{className:"w-full dark:border-slate-700 dark:bg-slate-900",children:e.jsx(te,{placeholder:"Select scope"})}),e.jsx(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:kt.map(a=>e.jsx(f,{value:a,children:a.replace(/_/g," ").toUpperCase()},a))})]})}),e.jsxs(Ct,{className:"flex justify-end gap-2",children:[e.jsx(U,{variant:"secondary",onClick:()=>v(!1),className:"dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",children:t("common.Cancel")}),e.jsx(U,{onClick:zt,disabled:st,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:st?t("contentManagement.saving"):t("delegation.save")})]})]})})]})},Ms=()=>{var y,q,X,S,W;const{user:x}=Ue(),c=Ee(),Y=((q=(y=x==null?void 0:x.employee)==null?void 0:y[0])==null?void 0:q.organizationId)||"",B=He(),L=d.useId(),{getList:u}=Me(),{data:R,isLoading:r}=u(Y,{take:1e3}),[I,P]=d.useState(""),[v,k]=d.useState(null);d.useEffect(()=>{var o,j;!I&&((j=(o=R==null?void 0:R.data)==null?void 0:o.items)!=null&&j.length)&&P(R.data.items[0].id)},[I,R]);const h=((X=R==null?void 0:R.data)==null?void 0:X.items)??[],V=h.length>0,_=(S=h.find(o=>o.id===I))==null?void 0:S.name,{data:F,isLoading:G}=Qe(I),$=((W=F==null?void 0:F.data)==null?void 0:W.items)||[],m=$.find(o=>o.unitId===I)||$[0],se=!!(m!=null&&m.attachSignatureOnAttachment),D=!!(m!=null&&m.id),M=v===null?se:v;d.useEffect(()=>{k(null)},[I,se]);const{mutate:ne,isPending:J}=b({mutationFn:({id:o,value:j})=>N.updateInternalPrefixSuffix({attachSignatureOnAttachment:j,unitId:I},o),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",I]})},onError:()=>{k(null)}}),ie=o=>{!(m!=null&&m.id)||J||(k(o),ne({id:m.id,value:o}))};return e.jsx("section",{className:"w-full",children:e.jsx("div",{className:"relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",children:e.jsxs("div",{className:"relative space-y-5",children:[e.jsx("header",{className:"flex flex-col gap-2 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"inline-flex w-fit items-center gap-2 rounded-full bg-white/80 px-3 py-1 text-xs font-medium text-slate-700 ring-1 ring-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:ring-slate-700",children:[e.jsx(ks,{className:"h-3.5 w-3.5"}),t("setting.attachmentSignature.badge")]}),e.jsxs("h2",{className:"text-xl font-semibold tracking-tight text-slate-900 dark:text-slate-100 sm:text-2xl flex gap-2",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.attachmentSignature.title")]}),e.jsx("p",{className:"max-w-2xl text-sm text-slate-600 dark:text-slate-400",children:t("setting.attachmentSignature.description")})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 rounded-xl border border-slate-200/80 bg-white/80 p-4 backdrop-blur-sm dark:border-slate-700 dark:bg-slate-900/70",children:[e.jsx(jt,{className:"text-sm font-medium text-slate-800 dark:text-slate-200",children:t("setting.attachmentSignature.unit")}),e.jsxs(Z,{value:I,onValueChange:o=>P(o),children:[e.jsx(ee,{className:"h-11 w-full bg-white/90 dark:border-slate-700 dark:bg-slate-900","aria-label":t("setting.attachmentSignature.unit"),children:e.jsx(te,{placeholder:t("setting.attachmentSignature.selectUnit")})}),e.jsx(ae,{children:r?e.jsx(f,{value:"loading",disabled:!0,children:t("setting.attachmentSignature.loadingUnits")}):V?h.map(o=>e.jsx(f,{value:o.id,children:B(o.name)},o.id)):e.jsx(f,{value:"no-units",disabled:!0,children:t("setting.attachmentSignature.noUnitsFound")})})]}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:t("setting.attachmentSignature.unitHint")})]}),e.jsxs("div",{className:"space-y-3 rounded-xl border border-slate-200/80 bg-white/80 p-4 backdrop-blur-sm dark:border-slate-700 dark:bg-slate-900/70",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(jt,{htmlFor:L,className:"text-sm font-medium text-slate-800 dark:text-slate-200",children:t("setting.attachmentSignature.toggleLabel")}),e.jsx("p",{id:`${L}-description`,className:"text-xs text-slate-500 dark:text-slate-400",children:t("setting.attachmentSignature.toggleDescription")})]}),e.jsx(g,{id:L,checked:M,onCheckedChange:ie,"aria-describedby":`${L}-description`,disabled:!D||G||J})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dashed border-slate-300/80 bg-slate-50/80 px-3 py-2 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-300",children:[e.jsx(ys,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400"}),e.jsxs("span",{children:[t("setting.attachmentSignature.status")," ",e.jsx("span",{className:"font-semibold",children:M?t("profile.enabled"):t("profile.disabled")})]})]}),!D&&!G&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:t("setting.noConfigFound")})]})]}),e.jsxs("footer",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-slate-200/80 bg-white/70 px-3 py-2 text-xs text-slate-600 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-300",children:[e.jsx(ts,{className:"h-3.5 w-3.5 text-slate-500 dark:text-slate-400"}),e.jsxs("span",{children:[t("setting.attachmentSignature.activeUnit")," ",e.jsx("strong",{className:"font-semibold",children:_?B(_):t("common.None")})]})]})]})})})},gn=()=>e.jsx("div",{className:"mx-auto w-full max-w-[1500px] space-y-6 p-4 sm:p-6",children:e.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2",children:[e.jsx(Ts,{}),e.jsx(Ds,{}),e.jsx(As,{}),e.jsx(Ms,{})]})});export{gn as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-tOdQq5-t.js b/apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-tOdQq5-t.js deleted file mode 100644 index daba9f176..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ConfigurationPage-tOdQq5-t.js +++ /dev/null @@ -1,16 +0,0 @@ -import{y as Ke,d as Ue,m as Ee,az as He,r as d,o as b,v as t,j as e,bn as Te,B as U,aK as Ae,aL as Be,aM as Pe,aN as Fe,bo as Nt,I as _a,ba as Ct,l as Le,w as De,u as Ga,k as Ja,n as Xa,t as C,aF as We,b7 as Za,bp as xt,b6 as es,A as ts}from"./index-Db-xuq0b.js";import{S as Z,a as ee,b as te,c as ae,d as f}from"./select-BoQxM42A.js";import{u as Me}from"./useUnit-C4s9nepK.js";import{u as Qe,p as N,E as le}from"./useUnitConfiguration-CKdECszp.js";import{T as ze,a as Ye,b as p,c as T,d as Ve,e as n}from"./table-D3n3VABd.js";import{u as as}from"./usePosition-Y8Dhf3qk.js";import{C as ss,d as ns}from"./card-BBWyxDss.js";import{S as g}from"./switch-BNCD27Bd.js";import{F as ht,b as E,c as H,a as Q,d as z,e as Oe}from"./form-BeLK5rTt.js";import{B as we}from"./badge-D7JvaQeJ.js";import{A as is,a as rs}from"./alert-8Xu28MAD.js";import{A as ls,h as ds,a as os,b as cs,c as us,d as ms,e as xs,f as hs,g as gs}from"./alert-dialog-B5Y0wlSz.js";import{u as fs}from"./index.esm-BG4gweZJ.js";import{u as bs,o as js,e as ps,b as Ie,s as Ns}from"./zod-Df58YiJ6.js";import{C as gt}from"./circle-alert-Cd_zeQMw.js";import{P as Cs}from"./plus-BdjS2Pc-.js";import{M as ft}from"./message-square-BPZTcbJs.js";import{M as bt}from"./mail-bwr0seHR.js";import{S as vs}from"./square-pen-B91TPB19.js";import{L as jt}from"./label-CsFy6wpo.js";import{S as ks}from"./shield-check-BeHB0C5s.js";import"./unitService-CmGVtFHQ.js";import"./positionService-JD0NEiGK.js";import"./Switch-DSHMk-sj.js";import"./InputsGroupFieldset-COkNgcEo.js";import"./use-uncontrolled-C3HRHW6t.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ss=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],ys=Ke("pen-line",Ss);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rs=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],vt=Ke("pen",Rs);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ws=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],pt=Ke("workflow",ws),Is="relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",As=()=>{var ie,y,q,X,S,W,o;const{user:x}=Ue(),c=Ee(),Y=((y=(ie=x==null?void 0:x.employee)==null?void 0:ie[0])==null?void 0:y.organizationId)||"",B=He(),{getList:L}=Me(),{data:u,isLoading:R}=L(Y,{take:1e3}),[r,I]=d.useState(""),[P,v]=d.useState(!1),[k,h]=d.useState(null),[V,_]=d.useState(0);d.useEffect(()=>{var j,O,re;((O=(j=u==null?void 0:u.data)==null?void 0:j.items)==null?void 0:O.length)>0&&!r&&I((re=u==null?void 0:u.data)==null?void 0:re.items[0].id)},[u]);const{data:F,isLoading:G,error:$}=Qe(r),m=(X=(q=F==null?void 0:F.data)==null?void 0:q.items)==null?void 0:X[0],{mutate:se,isPending:D}=b({mutationFn:({id:j,key:O,value:re})=>N.updateInternalPrefixSuffix({[O]:re,unitId:r},j),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),v(!1),h(null)},onError:j=>{}}),M=(j,O)=>{h(j),_(O),v(!0)},ne=()=>{!(m!=null&&m.id)||!k||se({id:m.id,key:k,value:V})},J=[{key:"escalationHour",label:t("setting.escalationHour"),value:m==null?void 0:m.escalationHour},{key:"urgentLetterEscalationHour",label:t("setting.urgentLetterEscalationHour"),value:m==null?void 0:m.urgentLetterEscalationHour},{key:"onReviewLetterEscalationHour",label:t("setting.onReviewLetterEscalationHour"),value:m==null?void 0:m.onReviewLetterEscalationHour},{key:"urgentOnReviewLetterEscalationHour",label:t("setting.urgentOnReviewLetterEscalationHour"),value:m==null?void 0:m.urgentOnReviewLetterEscalationHour}];return e.jsxs("div",{className:Is,children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-4 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold text-slate-900 sm:text-3xl dark:text-slate-100",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.escalationTitle")]}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:t("setting.escalationDescription")})]}),e.jsx("div",{className:"w-full sm:ml-auto sm:w-auto",children:e.jsxs(Z,{value:r,onValueChange:j=>I(j),children:[e.jsx(ee,{className:"h-10 w-full bg-white/90 dark:border-slate-700 dark:bg-slate-900 sm:w-56",children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:R?e.jsx(f,{value:"loading",disabled:!0,children:t("setting.loading")}):((W=(S=u==null?void 0:u.data)==null?void 0:S.items)==null?void 0:W.length)>0?(o=u==null?void 0:u.data)==null?void 0:o.items?.map(j=>e.jsx(f,{value:j.id,children:B(j.name)},j.id)):e.jsx(f,{value:"no-units",disabled:!0,children:t("setting.noUnit")})})]})})]}),e.jsxs("div",{className:"space-y-3",children:[G&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:t("setting.loadingConfig")}),$&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:t("setting.loadError")}),!m&&!G&&!$&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:t("setting.noConfigFound")}),m&&e.jsx("div",{className:"overflow-x-auto rounded-xl border border-slate-200 bg-white/90 dark:border-slate-700 dark:bg-slate-900/70",children:e.jsxs(ze,{children:[e.jsx(Ye,{children:e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Name")}),e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Value")}),e.jsx(T,{className:"text-right text-slate-600 dark:text-slate-300",children:t("setting.Action")})]})}),e.jsx(Ve,{children:J?.map(j=>e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"text-slate-900 dark:text-slate-100",children:j.label}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:j.value??"-"}),e.jsx(n,{className:"text-right",children:e.jsx(U,{onClick:()=>M(j.key,j.value),variant:"outline",size:"sm",className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(vt,{className:"h-4 w-4"})})})]},j.key))})]})})]}),e.jsx(Ae,{open:P,onOpenChange:v,children:e.jsxs(Be,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsxs(Pe,{children:[e.jsxs(Fe,{className:"dark:text-slate-100",children:[t("setting.edit")," ",k&&t(`setting.${k}`)]}),e.jsx(Nt,{className:"dark:text-slate-400",children:t("setting.updateEscalationMsg")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:k&&t(`setting.${k}`)}),e.jsx(_a,{type:"number",value:V??"",onChange:j=>_(Number(j.target.value)),className:"dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100"})]}),e.jsxs(Ct,{className:"flex justify-end gap-2 mt-4",children:[e.jsx(U,{variant:"secondary",onClick:()=>v(!1),className:"dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",children:t("common.Cancel")}),e.jsx(U,{onClick:ne,disabled:D,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:D?t("setting.saving"):t("setting.saveChanges")})]})]})})]})},Bs=async x=>Le.post("/position-configurations",x,{headers:De()}),Ps=async x=>Le.get(`/position-configurations/list/${x}`,{headers:De()}),Fs=async(x,c)=>Le.put(`/position-configurations/${x}`,c,{headers:De()}),Us=async x=>Le.delete(`/position-configurations/${x}`,{headers:De()}),Es=x=>{const c=Ee(),{t:Y}=Ga(),{handleError:B}=Ja(Y),{data:L,isLoading:u,isError:R,error:r,refetch:I}=Xa({queryKey:["position-configurations",x],queryFn:()=>Ps(x),select:h=>h&&h.data&&typeof h.data=="object"&&!Array.isArray(h.data)&&"items"in h.data?h.data.items:Array.isArray(h==null?void 0:h.data)?h.data:Array.isArray(h)?h:[],enabled:!!x}),P=b({mutationFn:Bs,onSuccess:()=>{c.invalidateQueries({queryKey:["position-configurations",x]}),C.success("Position configuration created successfully")},onError:h=>{B(h)}}),v=b({mutationFn:({id:h,payload:V})=>Fs(h,V),onSuccess:()=>{c.invalidateQueries({queryKey:["position-configurations",x]}),C.success("Position configuration updated successfully")},onError:h=>{B(h)}}),k=b({mutationFn:Us,onSuccess:()=>{c.invalidateQueries({queryKey:["position-configurations",x]}),C.success("Position configuration deleted successfully")},onError:h=>{B(h)}});return{configurations:L||[],isLoading:u,isError:R,error:r,refetch:I,createConfiguration:P.mutate,updateConfiguration:v.mutate,deleteConfiguration:k.mutate,isCreating:P.isPending,isUpdating:v.isPending,isDeleting:k.isPending}},kt=["all","immediate_child","parallel_with_immediate_child"],Hs=js({positionId:Ns().min(1,"Position is required"),smsNotificationWhenRecordSubmitted:Ie(),emailNotificationWhenRecordSubmitted:Ie(),inboxNotificationWhenRecordSubmitted:Ie(),skipWorkflowIfNotAssigned:Ie(),positionScopeToFetch:ps(kt)}),Ts=()=>{var ce,ue,me,xe,he,ge,fe,be,je,pe;const{user:x}=Ue(),c=((ue=(ce=x==null?void 0:x.employee)==null?void 0:ce[0])==null?void 0:ue.unitId)||"",Y=((xe=(me=x==null?void 0:x.employee)==null?void 0:me[0])==null?void 0:xe.organizationId)||"",B=He(),[L,u]=d.useState(!1),[R,r]=d.useState(null),[I,P]=d.useState(!1),[v,k]=d.useState(""),{configurations:h,isLoading:V,isError:_,error:F,refetch:G,createConfiguration:$,updateConfiguration:m,deleteConfiguration:se,isCreating:D,isUpdating:M,isDeleting:ne}=Es(c),J=Array.isArray(h)?h:[],{getList:ie}=Me(),{data:y,isLoading:q}=ie(Y,{take:1e3}),{usePositionListByUnitId:X}=as(),{data:S,isLoading:W}=X(v,{take:1e3}),o=fs({resolver:bs(Hs),defaultValues:{positionId:"",smsNotificationWhenRecordSubmitted:!0,emailNotificationWhenRecordSubmitted:!0,inboxNotificationWhenRecordSubmitted:!0,skipWorkflowIfNotAssigned:!1,positionScopeToFetch:"all"}}),j=i=>{$(i,{onSuccess:()=>{u(!1),k(""),o.reset()}})},O=i=>{R!=null&&R.id&&m({id:R==null?void 0:R.id,payload:i},{onSuccess:()=>{P(!1),r(null),k(""),o.reset()}})},re=i=>{var K;r(i);const w=(K=S==null?void 0:S.items)==null?void 0:K.find(de=>de.id===i.positionId),A=(w==null?void 0:w.unitId)||"";k(A),o.reset({positionId:i.positionId,smsNotificationWhenRecordSubmitted:i.smsNotificationWhenRecordSubmitted,emailNotificationWhenRecordSubmitted:i.emailNotificationWhenRecordSubmitted,inboxNotificationWhenRecordSubmitted:i.inboxNotificationWhenRecordSubmitted,skipWorkflowIfNotAssigned:i.skipWorkflowIfNotAssigned}),P(!0)},ve=i=>{se(i)},ke=i=>{var A;const w=(A=S==null?void 0:S.items)==null?void 0:A.find(K=>K.id===i);return B(w==null?void 0:w.name)||"Unknown Position"},Se=i=>{var de,Ne,Ce;const w=(de=S==null?void 0:S.items)==null?void 0:de.find(oe=>oe.id===i),A=w==null?void 0:w.unitId;if(!A)return"Unknown Unit";const K=(Ce=(Ne=y==null?void 0:y.data)==null?void 0:Ne.items)==null?void 0:Ce.find(oe=>oe.id===A);return B(K==null?void 0:K.name)||"Unknown Unit"};return Y?V?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(We,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.msg2")})]})}):e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-4 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold text-slate-900 sm:text-3xl dark:text-slate-100",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.positionConfig")]}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:t("setting.positionConfigMsg")})]}),e.jsxs(Ae,{open:L,onOpenChange:u,children:[e.jsx(Za,{asChild:!0,children:e.jsxs(U,{className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(Cs,{className:"h-4 w-4 mr-2"}),t("setting.add")]})}),e.jsxs(Be,{className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-white shadow-2xl border-2 dark:bg-gray-900 dark:border-gray-700",children:[e.jsx(Pe,{className:"sticky top-0 bg-white z-10 pb-4 border-b dark:bg-gray-900 dark:border-gray-700",children:e.jsx(Fe,{className:"dark:text-gray-100",children:t("setting.create")})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-1",children:e.jsx(ht,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(j),className:"space-y-6 pb-4",children:[e.jsxs(E,{children:[e.jsx(H,{className:"dark:text-gray-200",children:"Unit"}),e.jsxs(Z,{onValueChange:i=>{k(i)},value:v,children:[e.jsx(ee,{children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{children:q?e.jsx(f,{value:"loading",disabled:!0,children:"Loading units..."}):((ge=(he=y==null?void 0:y.data)==null?void 0:he.items)==null?void 0:ge.length)>0?(be=(fe=y==null?void 0:y.data)==null?void 0:fe.items)==null?void 0:be?.map(i=>e.jsx(f,{value:i.id,children:B(i.name)},i.id)):e.jsx(f,{value:"no-units",disabled:!0,children:"No units found"})})]})]}),e.jsx(Q,{control:o.control,name:"positionId",render:({field:i})=>{var w;return e.jsxs(E,{children:[e.jsx(H,{className:"dark:text-gray-200",children:t("setting.position")}),e.jsxs(Z,{onValueChange:i.onChange,value:i.value,disabled:!v,children:[e.jsx(z,{children:e.jsx(ee,{children:e.jsx(te,{placeholder:v?t("setting.select"):t("setting.select2")})})}),e.jsx(ae,{children:v?W?e.jsx(f,{value:"loading",disabled:!0,children:"Loading positions..."}):((w=S==null?void 0:S.items)==null?void 0:w.length)>0?S.items?.map(A=>e.jsx(f,{value:A.id,children:B(A.name)},A.id)):e.jsx(f,{value:"no-positions",disabled:!0,children:"No positions found in this unit"}):e.jsx(f,{value:"no-unit-selected",disabled:!0,children:t("setting.select2")})})]}),e.jsx(Oe,{}),!v&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t("setting.plsSelect")})]})}}),e.jsx(Q,{control:o.control,name:"positionScopeToFetch",render:({field:i})=>e.jsxs(E,{children:[e.jsx(H,{className:"dark:text-gray-200",children:t("setting.positionScope")}),e.jsxs(Z,{onValueChange:i.onChange,value:i.value,children:[e.jsx(z,{children:e.jsx(ee,{children:e.jsx(te,{placeholder:t("setting.positionScope")})})}),e.jsxs(ae,{children:[e.jsx(f,{value:"all",children:t("setting.all")}),e.jsx(f,{value:"immediate_child",children:t("setting.immediateChild")}),e.jsx(f,{value:"parallel_with_immediate_child",children:t("setting.parallel")})]})]}),e.jsx(Oe,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("setting.notification")}),e.jsx(Q,{control:o.control,name:"smsNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"h-4 w-4"}),t("setting.sms")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.smsMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"emailNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(bt,{className:"h-4 w-4"}),t("setting.email")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.emailMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"inboxNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-4 w-4"}),t("setting.inbox")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.inboxMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx("h3",{className:"text-lg font-semibold",children:t("setting.workflow")}),e.jsx(Q,{control:o.control,name:"skipWorkflowIfNotAssigned",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(pt,{className:"h-4 w-4"}),t("setting.workflowMsg")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.workflowMsg1")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(U,{type:"button",variant:"outline",onClick:()=>{u(!1),k(""),o.reset()},disabled:D,children:t("common.Cancel")}),e.jsx(U,{type:"submit",disabled:D,className:"bg-primary hover:bg-primary/90",children:D?e.jsxs(e.Fragment,{children:[e.jsx(We,{className:"h-4 w-4 mr-2 animate-spin"}),t("setting.creating")]}):t("setting.createConfig")})]})]})})})]})]})]}),e.jsx(ss,{className:"border-slate-200 bg-white/90 dark:border-slate-700 dark:bg-slate-900/70",children:e.jsxs(ns,{className:"pt-6",children:[_&&e.jsxs(is,{variant:"destructive",className:"mb-4",children:[e.jsx(gt,{className:"h-4 w-4"}),e.jsxs(rs,{children:[t("setting.error")," ",(F==null?void 0:F.message)||"Unknown error",e.jsx(U,{variant:"outline",size:"sm",onClick:()=>G(),className:"ml-2",children:t("setting.retry")})]})]}),J.length===0?e.jsx("div",{className:"text-center py-8"}):e.jsx("div",{className:"overflow-x-auto rounded-xl border border-slate-200 dark:border-slate-700",children:e.jsxs(ze,{children:[e.jsx(Ye,{children:e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.position")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("contentManagement.unit")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.SMS")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("organization.email")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.Inbox")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.skipWF")}),e.jsx(T,{className:"text-center text-slate-600 dark:text-slate-300",children:t("setting.Action")})]})}),e.jsx(Ve,{children:J?.map(i=>e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:ke(i.positionId)}),e.jsx(n,{className:"text-center text-slate-700 dark:text-slate-300",children:Se(i.positionId)}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.smsNotificationWhenRecordSubmitted?"default":"secondary",className:i.smsNotificationWhenRecordSubmitted?"bg-primary-100 text-primary-800":"",children:i.smsNotificationWhenRecordSubmitted?"Enabled":"Disabled"})}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.emailNotificationWhenRecordSubmitted?"default":"secondary",className:i.emailNotificationWhenRecordSubmitted?"bg-primary-100 text-primary-800":"",children:i.emailNotificationWhenRecordSubmitted?"Enabled":"Disabled"})}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.inboxNotificationWhenRecordSubmitted?"default":"secondary",className:i.inboxNotificationWhenRecordSubmitted?"bg-primary-100 text-primary-800":"",children:i.inboxNotificationWhenRecordSubmitted?"Enabled":"Disabled"})}),e.jsx(n,{className:"text-center",children:e.jsx(we,{variant:i.skipWorkflowIfNotAssigned?"destructive":"secondary",children:i.skipWorkflowIfNotAssigned?"Skip":"Process"})}),e.jsx(n,{className:"text-center",children:e.jsxs("div",{className:"flex justify-center gap-2",children:[e.jsx(U,{variant:"outline",size:"sm",onClick:()=>re(i),disabled:M||ne,className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(vs,{className:"h-4 w-4"})}),e.jsxs(ls,{children:[e.jsx(ds,{asChild:!0,children:e.jsx(U,{variant:"outline",size:"sm",disabled:ne,className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(es,{className:"h-4 w-4 text-red-500"})})}),e.jsxs(os,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsxs(cs,{children:[e.jsx(us,{className:"dark:text-slate-100",children:t("setting.delete")}),e.jsx(ms,{className:"dark:text-slate-400",children:t("setting.deleteMsg")})]}),e.jsxs(xs,{children:[e.jsx(hs,{className:"dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",children:"Cancel"}),e.jsx(gs,{onClick:()=>i.id&&ve(i.id),className:"bg-red-600 hover:bg-red-700",children:t("userRecord.Delete")})]})]})]})]})})]},i.id))})]})})]})}),e.jsx(Ae,{open:I,onOpenChange:P,children:e.jsxs(Be,{className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-white shadow-2xl border-2 dark:bg-slate-900 dark:border-slate-700",children:[e.jsx(Pe,{className:"sticky top-0 bg-white z-10 pb-4 border-b dark:bg-slate-900 dark:border-slate-700",children:e.jsx(Fe,{className:"dark:text-slate-100",children:t("setting.edit")})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-1",children:e.jsx(ht,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(O),className:"space-y-6 pb-4",children:[e.jsxs(E,{children:[e.jsx(H,{children:t("contentManagement.unit")}),e.jsxs(Z,{onValueChange:i=>{k(i)},value:v,children:[e.jsx(ee,{children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{children:q?e.jsx(f,{value:"loading",disabled:!0,children:"Loading units..."}):((pe=(je=y==null?void 0:y.data)==null?void 0:je.items)==null?void 0:pe.length)>0?y==null?void 0:y.data.items?.map(i=>e.jsx(f,{value:i.id,children:B(i.name)},i.id)):e.jsx(f,{value:"no-units",disabled:!0,children:"No units found"})})]})]}),e.jsx(Q,{control:o.control,name:"positionId",render:({field:i})=>{var w;return e.jsxs(E,{children:[e.jsx(H,{children:t("setting.position")}),e.jsxs(Z,{onValueChange:i.onChange,value:i.value,disabled:!v,children:[e.jsx(z,{children:e.jsx(ee,{children:e.jsx(te,{placeholder:v?t("setting.select"):t("setting.select2")})})}),e.jsx(ae,{children:v?W?e.jsx(f,{value:"loading",disabled:!0,children:"Loading positions..."}):((w=S==null?void 0:S.items)==null?void 0:w.length)>0?S.items?.map(A=>e.jsx(f,{value:A.id,children:B(A.name)},A.id)):e.jsx(f,{value:"no-positions",disabled:!0,children:"No positions found in this unit"}):e.jsx(f,{value:"no-unit-selected",disabled:!0,children:t("setting.select2")})})]}),e.jsx(Oe,{}),!v&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t("setting.plsSelect")})]})}}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("setting.notification")}),e.jsx(Q,{control:o.control,name:"smsNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"h-4 w-4"}),t("setting.sms")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.smsMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"emailNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(bt,{className:"h-4 w-4"}),t("setting.email")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.emailMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsx(Q,{control:o.control,name:"inboxNotificationWhenRecordSubmitted",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-4 w-4"}),t("setting.inbox")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.inboxMsg")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})}),e.jsxs("h3",{className:"text-lg font-semibold",children:[" ",t("setting.workflow")]}),e.jsx(Q,{control:o.control,name:"skipWorkflowIfNotAssigned",render:({field:i})=>e.jsxs(E,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(pt,{className:"h-4 w-4"}),t("setting.workflowMsg")]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.workflowMsg1")})]}),e.jsx(z,{children:e.jsx(g,{checked:i.value,onCheckedChange:i.onChange})})]})})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(U,{type:"button",variant:"outline",onClick:()=>{P(!1),r(null),k(""),o.reset()},disabled:M,children:t("common.Cancel")}),e.jsx(U,{type:"submit",disabled:M,className:"bg-primary hover:bg-primary/90",children:M?e.jsxs(e.Fragment,{children:[e.jsx(We,{className:"h-4 w-4 mr-2 animate-spin"}),t("setting.updating")]}):t("setting.UpdateConfig")})]})]})})})]})})]}):e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(gt,{className:"h-8 w-8 text-red-500"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("setting.msg1")})]})})},Ls="relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",Ds=()=>{var it,rt,lt,dt,ot,ct,ut,mt;const{user:x}=Ue(),c=Ee(),Y=((rt=(it=x==null?void 0:x.employee)==null?void 0:it[0])==null?void 0:rt.organizationId)||"",B=He(),{getList:L}=Me(),{data:u,isLoading:R}=L(Y,{take:1e3}),[r,I]=d.useState(""),[P,v]=d.useState(!1),[k,h]=d.useState(""),[V,_]=d.useState(le.NAME),[F,G]=d.useState(!1),[$,m]=d.useState(!1),[se,D]=d.useState(!1),[M,ne]=d.useState(!1),[J,ie]=d.useState(!1),[y,q]=d.useState(!1),[X,S]=d.useState(!1),[W,o]=d.useState(!1),[j,O]=d.useState(!1),[re,ve]=d.useState(!1),[ke,Se]=d.useState(!1),[ce,ue]=d.useState(!1),[me,xe]=d.useState(!1),[he,ge]=d.useState(!1),[fe,be]=d.useState(!1),[je,pe]=d.useState(!1),[i,w]=d.useState(!1),[A,K]=d.useState(!1),[de,Ne]=d.useState(!1),[Ce,oe]=d.useState(!1),[_e,Ge]=d.useState(!1),[Je,Xe]=d.useState(!1),[Ze,et]=d.useState(!1),[tt,at]=d.useState(!1);d.useEffect(()=>{var a,l;if(((l=(a=u==null?void 0:u.data)==null?void 0:a.items)==null?void 0:l.length)>0){const Va=u==null?void 0:u.data.items[0];I(Va.id)}},[u]);const{data:$e,isLoading:ye,error:Re}=Qe(r,{enabled:!!r}),s=(dt=(lt=$e==null?void 0:$e.data)==null?void 0:lt.items)==null?void 0:dt[0],[$s,qs]=d.useState(!1);d.useEffect(()=>{s&&(G(s.canAssignCustomReferenceNumber||!1),_(s.recordSenderInformationScope||le.NAME),m(s.canInternalMemosHaveSenderInformation||!1),ie(s.canRecordDateLabelHasLocalization||!1),q(s.canRecordDateHaveTime||!1),S(s.forwardWithTeeterSignature||!1),o(s.waitAllCollaboratorsBeforeAction||!1),O(s.shouldCollaboratorAlwaysSign||!1),ve(s.shouldIncludeForYourReferenceInCC||!1),Se(s.canCollaborationBeCreatedForAll||!1),ue(s.canCreateDirectRecord||!1),xe(s.canPositionBasedRecordsBeCreated||!1),ge(s.canPositionBasedReferenceBeUsedForAllTypes||!1),pe(s.shouldDirectRecordHaveHeaderAndFooter||!1),be(s.canInternalMemoRequirePositionBasedReferenceNumber||!1),w(s.canRecordBeEditedByCollaborators||!1),K(s.canRecordHaveCollaboratorsName||!1),Ne(s.canRecordBeEditedOnWorkflow||!1),oe(s.canIncomingAssignmentsBeSeparated||!1),Ge(s.canROReturn||!1),Xe(s.internalMemoHasReferenceNumber||!1),et(s.isMultipleDelegationAllowed||!1),at(s.attachSignatureOnAttachment||!1),D(s.canHaveTagBasedReferenceNumber||!1),ne(s.canUserSkipLevel||!1))},[s]);const St=a=>{s!=null&&s.id&&(D(a),Rt({id:s.id,value:a}))},yt=a=>{s!=null&&s.id&&(ne(a),It({id:s.id,value:a}))},{mutate:Rt,isPending:wt}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canHaveTagBasedReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canHaveTagBasedReferenceNumber","Can Have Tag Based Reference Number")} ${se?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:It,isPending:At}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canUserSkipLevel:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canUserSkipLevel","User Can Skip Level")} ${M?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Bt,isPending:Pt}=b({mutationFn:({id:a,scope:l})=>N.updateInternalPrefixSuffix({recordSenderInformationScope:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.recordSenderInformationScope","Record Sender Information Scope")} updated`)},onError:a=>{}}),{mutate:Ft,isPending:Ut}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canAssignCustomReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canAssignCustomReferenceNumber")} ${F?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Et,isPending:Ht}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canInternalMemosHaveSenderInformation:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canUseNewInternalMemoFormat")} ${$?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Tt,isPending:Lt}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordDateLabelHasLocalization:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordDateLabelHasLocalization")} ${J?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Dt,isPending:Mt}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordDateHaveTime:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordDateHaveTime","Record Date Can Have Time")} ${y?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:$t,isPending:st}=b({mutationFn:({id:a,scope:l})=>N.updateInternalPrefixSuffix({positionScopeToFetch:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),v(!1)},onError:a=>{}}),{mutate:qt,isPending:Wt}=b({mutationFn:({id:a,signature:l})=>N.updateInternalPrefixSuffix({forwardWithTeeterSignature:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`Signature & Teeter ${X?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Ot,isPending:Kt}=b({mutationFn:({id:a,wait:l})=>N.updateInternalPrefixSuffix({waitAllCollaboratorsBeforeAction:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.title6")} ${W?"enabled":"disabled"}`)},onError:a=>{}}),Qt=()=>{s!=null&&s.id&&(h(s.positionScopeToFetch),v(!0))},zt=()=>{s!=null&&s.id&&k&&k!==s.positionScopeToFetch&&$t({id:s.id,scope:k})},Yt=a=>{s!=null&&s.id&&(S(a),qt({id:s.id,signature:a}))},Vt=a=>{s!=null&&s.id&&(G(a),Ft({id:s.id,value:a}))},_t=a=>{s!=null&&s.id&&(m(a),Et({id:s.id,value:a}))},Gt=a=>{s!=null&&s.id&&(ie(a),Tt({id:s.id,value:a}))},Jt=a=>{s!=null&&s.id&&(q(a),Dt({id:s.id,value:a}))},Xt=a=>{s!=null&&s.id&&(o(a),Ot({id:s.id,wait:a}))},{mutate:Zt,isPending:ea}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({shouldCollaboratorAlwaysSign:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.shouldCollaboratorAlwaysSign")} ${j?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:ta,isPending:aa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({shouldIncludeForYourReferenceInCC:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.shouldIncludeForYourReferenceInCC")} ${re?"enabled":"disabled"}`)},onError:a=>{}}),sa=a=>{s!=null&&s.id&&(O(a),Zt({id:s.id,value:a}))},na=a=>{s!=null&&s.id&&(_(a),Bt({id:s.id,scope:a}))},ia=a=>{s!=null&&s.id&&(ve(a),ta({id:s.id,value:a}))},{mutate:ra,isPending:la}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canCollaborationBeCreatedForAll:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canCollaborationBeCreatedForAll")} ${ke?"enabled":"disabled"}`)},onError:a=>{}}),da=a=>{s!=null&&s.id&&(Se(a),ra({id:s.id,value:a}))},{mutate:oa,isPending:ca}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canCreateDirectRecord:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canCreateDirectRecord")} ${ce?"enabled":"disabled"}`)},onError:a=>{}}),ua=a=>{s!=null&&s.id&&(ue(a),oa({id:s.id,value:a}))},{mutate:ma,isPending:xa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canPositionBasedRecordsBeCreated:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canPositionBasedRecordsBeCreated")} ${me?"enabled":"disabled"}`)},onError:a=>{}}),ha=a=>{s!=null&&s.id&&(xe(a),ma({id:s.id,value:a}))},{mutate:ga,isPending:fa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canPositionBasedReferenceBeUsedForAllTypes:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canPositionBasedReferenceBeUsedForAllTypes")} ${he?"enabled":"disabled"}`)},onError:a=>{}}),ba=a=>{s!=null&&s.id&&(ge(a),ga({id:s.id,value:a}))},{mutate:ja,isPending:pa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({shouldDirectRecordHaveHeaderAndFooter:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.shouldDirectRecordHaveHeaderAndFooter")} ${je?t("setting.enabled"):t("setting.disabled")}`)},onError:a=>{}}),Na=a=>{s!=null&&s.id&&(pe(a),ja({id:s.id,value:a}))},{mutate:Ca,isPending:va}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordBeEditedByCollaborators:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordBeEditedByCollaborators")} ${i?"enabled":"disabled"}`)},onError:a=>{}}),ka=a=>{s!=null&&s.id&&(w(a),Ca({id:s.id,value:a}))},{mutate:Sa,isPending:ya}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordHaveCollaboratorsName:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordHaveCollaboratorsName")} ${A?"enabled":"disabled"}`)},onError:a=>{}}),Ra=a=>{s!=null&&s.id&&(K(a),Sa({id:s.id,value:a}))},{mutate:wa,isPending:Ia}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canRecordBeEditedOnWorkflow:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canRecordBeEditedOnWorkflow")} ${de?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Aa,isPending:Ba}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canIncomingAssignmentsBeSeparated:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canIncomingAssignmentsBeSeparated")} ${Ce?"enabled":"disabled"}`)},onError:a=>{}}),Pa=a=>{s!=null&&s.id&&(Ne(a),wa({id:s.id,value:a}))},Fa=a=>{s!=null&&s.id&&(oe(a),Aa({id:s.id,value:a}))},{mutate:Ua,isPending:Ea}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canROReturn:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canROReturn")} ${_e?"enabled":"disabled"}`)},onError:a=>{}}),Ha=a=>{s!=null&&s.id&&(Ge(a),Ua({id:s.id,value:a}))},{mutate:Ta,isPending:La}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({internalMemoHasReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.internalMemoHasReferenceNumber")} ${Je?"enabled":"disabled"}`)},onError:a=>{}}),{mutate:Da,isPending:Ma}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({canInternalMemoRequirePositionBasedReferenceNumber:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.canInternalMemoRequirePositionBasedReferenceNumber","Internal Memo Require Position Based Reference Number")} ${fe?"enabled":"disabled"}`)},onError:a=>{}}),$a=a=>{s!=null&&s.id&&(be(a),Da({id:s.id,value:a}))},qa=a=>{s!=null&&s.id&&(Xe(a),Ta({id:s.id,value:a}))},{mutate:Wa,isPending:Oa}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({isMultipleDelegationAllowed:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.isMultipleDelegationAllowed","Multiple Delegation Allowed")} ${Ze?"enabled":"disabled"}`)},onError:a=>{}}),Ka=a=>{s!=null&&s.id&&(et(a),Wa({id:s.id,value:a}))},{mutate:Qa,isPending:za}=b({mutationFn:({id:a,value:l})=>N.updateInternalPrefixSuffix({attachSignatureOnAttachment:l,unitId:r},a),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]}),C.success(`${t("setting.attachSignatureOnAttachment","Attach Signature On Attachment")} ${tt?"enabled":"disabled"}`)},onError:a=>{}}),Ya=a=>{s!=null&&s.id&&(at(a),Qa({id:s.id,value:a}))},{mutate:nt,isPending:qe}=b({mutationFn:a=>N.createInternalPrefixSuffix({unitId:a}),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",r]})},onError:a=>{}});return d.useEffect(()=>{!s&&!ye&&!Re&&r&&!qe&&nt(r)},[s,ye,Re,r,qe,nt]),e.jsxs("div",{className:Ls,children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-4 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold text-slate-900 sm:text-3xl dark:text-slate-100",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.title1")]}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:t("setting.title2")})]}),e.jsx("div",{className:"w-full sm:ml-auto sm:w-auto",children:e.jsxs(Z,{value:r,onValueChange:a=>I(a),children:[e.jsx(ee,{className:"h-10 w-full bg-white/90 dark:border-slate-700 dark:bg-slate-900 sm:w-56",children:e.jsx(te,{placeholder:"Select a unit"})}),e.jsx(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:R?e.jsx(f,{value:"loading",disabled:!0,children:t("setting.loading")}):((ct=(ot=u==null?void 0:u.data)==null?void 0:ot.items)==null?void 0:ct.length)>0?(mt=(ut=u==null?void 0:u.data)==null?void 0:ut.items)==null?void 0:mt?.map(a=>e.jsx(f,{value:a.id,children:B(a.name)},a.id)):e.jsx(f,{value:"no-units",disabled:!0,children:t("setting.noUnit")})})]})})]}),e.jsxs("div",{className:"space-y-3",children:[ye&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:"Loading configuration..."}),Re&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Failed to load configuration"}),!s&&!ye&&!Re&&e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:qe?t("setting.preparingDefaults","Preparing default configuration..."):t("setting.loading","Loading...")}),s&&e.jsx("div",{className:"max-h-128 overflow-x-auto overflow-y-auto rounded-xl border border-slate-200 bg-white/90 dark:border-slate-700 dark:bg-slate-900/70",children:e.jsxs(ze,{children:[e.jsx(Ye,{className:"sticky top-0 z-10 bg-white/95 backdrop-blur dark:bg-slate-900/95",children:e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Name")}),e.jsx(T,{className:"text-slate-600 dark:text-slate-300",children:t("setting.Value")}),e.jsx(T,{className:"text-right text-slate-600 dark:text-slate-300",children:t("setting.Action")})]})}),e.jsxs(Ve,{children:[e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:t("setting.title3")}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:s.positionScopeToFetch}),e.jsx(n,{className:"text-right",children:e.jsx(U,{onClick:Qt,variant:"outline",size:"sm",className:"dark:border-slate-700 dark:bg-slate-900 dark:hover:bg-slate-800",children:e.jsx(vt,{className:"h-4 w-4"})})})]}),e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:t("setting.title5")}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:s.forwardWithTeeterSignature?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"add-teeter-assign",checked:X,onCheckedChange:Yt,disabled:Wt})})]}),e.jsxs(p,{className:"dark:border-slate-700",children:[e.jsx(n,{className:"font-medium text-slate-900 dark:text-slate-100",children:t("setting.title6")}),e.jsx(n,{className:"text-slate-700 dark:text-slate-300",children:s.waitAllCollaboratorsBeforeAction?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"wait-for-all-collaborators-before-action",checked:W,onCheckedChange:Xt,disabled:Kt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canAssignCustomReferenceNumber","Can Assign Custom Reference Number")}),e.jsx(n,{children:s.canAssignCustomReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-assign-custom-reference-number",checked:F,onCheckedChange:Vt,disabled:Ut})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canUseNewInternalMemoFormat","New Internal Memo Format")}),e.jsx(n,{children:s.canInternalMemosHaveSenderInformation?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-use-new-internal-memo-format",checked:$,onCheckedChange:_t,disabled:Ht})})]}),$&&e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.recordSenderInformationScope","Record Sender Information Scope")}),e.jsx(n,{children:s.recordSenderInformationScope||"NAME"}),e.jsx(n,{className:"text-right",children:e.jsxs(Z,{value:V,onValueChange:a=>na(a),disabled:Pt,children:[e.jsx(ee,{className:"w-40 dark:border-slate-700 dark:bg-slate-900",children:e.jsx(te,{})}),e.jsxs(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsx(f,{value:le.NAME,children:"Name"}),e.jsx(f,{value:le.SIGNATURE,children:"Signature"}),e.jsx(f,{value:le.STAMP,children:"Stamp"}),e.jsx(f,{value:le.NAME_AND_SIGNATURE,children:"Name & Signature"}),e.jsx(f,{value:le.NAME_AND_STAMP,children:"Name & Stamp"}),e.jsx(f,{value:le.ALL,children:"All"})]})]})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordDateLabelHasLocalization","Does Record Date Label Have Localization?")}),e.jsx(n,{children:s.canRecordDateLabelHasLocalization?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-date-label-has-localization",checked:J,onCheckedChange:Gt,disabled:Lt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordDateHaveTime","Record Date Can Have Time")}),e.jsx(n,{children:s.canRecordDateHaveTime?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-date-have-time",checked:y,onCheckedChange:Jt,disabled:Mt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canCreateDirectRecord")}),e.jsx(n,{children:s.canCreateDirectRecord?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-create-direct-record",checked:ce,onCheckedChange:ua,disabled:ca})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canPositionBasedRecordsBeCreated")}),e.jsx(n,{children:s.canPositionBasedRecordsBeCreated?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-position-based-records-be-created",checked:me,onCheckedChange:ha,disabled:xa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canPositionBasedReferenceBeUsedForAllTypes")}),e.jsx(n,{children:s.canPositionBasedReferenceBeUsedForAllTypes?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-position-based-reference-be-used-for-all-types",checked:he,onCheckedChange:ba,disabled:fa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canInternalMemoRequirePositionBasedReferenceNumber","Internal Memo Require Position Based Reference Number")}),e.jsx(n,{children:s.canInternalMemoRequirePositionBasedReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-internal-memo-require-position-based-reference-number",checked:fe,onCheckedChange:$a,disabled:Ma})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.shouldDirectRecordHaveHeaderAndFooter")}),e.jsx(n,{children:s.shouldDirectRecordHaveHeaderAndFooter?t("common.yes"):t("common.no")}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"should-direct-record-have-header-and-footer",checked:je,onCheckedChange:Na,disabled:pa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.shouldCollaboratorAlwaysSign")}),e.jsx(n,{children:s.shouldCollaboratorAlwaysSign?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"should-collaborator-always-sign",checked:j,onCheckedChange:sa,disabled:ea})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.shouldIncludeForYourReferenceInCC")}),e.jsx(n,{children:s.shouldIncludeForYourReferenceInCC?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"should-include-for-your-reference",checked:re,onCheckedChange:ia,disabled:aa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canCollaborationBeCreatedForAll")}),e.jsx(n,{children:s.canCollaborationBeCreatedForAll?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-collaboration-be-created-for-all",checked:ke,onCheckedChange:da,disabled:la})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordBeEditedByCollaborators")}),e.jsx(n,{children:s.canRecordBeEditedByCollaborators?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-be-edited-by-collaborators",checked:i,onCheckedChange:ka,disabled:va})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordHaveCollaboratorsName")}),e.jsx(n,{children:s.canRecordHaveCollaboratorsName?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-have-collaborators-name",checked:A,onCheckedChange:Ra,disabled:ya})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canRecordBeEditedOnWorkflow")}),e.jsx(n,{children:s.canRecordBeEditedOnWorkflow?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-record-be-edited-on-workflow",checked:de,onCheckedChange:Pa,disabled:Ia})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canIncomingAssignmentsBeSeparated")}),e.jsx(n,{children:s.canIncomingAssignmentsBeSeparated?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-incoming-assignements-be-separated",checked:Ce,onCheckedChange:Fa,disabled:Ba})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canROReturn")}),e.jsx(n,{children:s.canROReturn?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-ro-return",checked:_e,onCheckedChange:Ha,disabled:Ea})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.internalMemoHasReferenceNumber")}),e.jsx(n,{children:s.internalMemoHasReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"internal-memo-has-reference-number",checked:Je,onCheckedChange:qa,disabled:La})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.isMultipleDelegationAllowed","Multiple Delegation Allowed")}),e.jsx(n,{children:s.isMultipleDelegationAllowed?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"is-multiple-delegation-allowed",checked:Ze,onCheckedChange:Ka,disabled:Oa})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.attachSignatureOnAttachment","Attach Signature On Attachment")}),e.jsx(n,{children:s.attachSignatureOnAttachment?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"attach-signature-on-attachment",checked:tt,onCheckedChange:Ya,disabled:za})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canHaveTagBasedReferenceNumber","Can Have Tag Based Reference Number")}),e.jsx(n,{children:s.canHaveTagBasedReferenceNumber?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-have-tag-based-reference-number",checked:se,onCheckedChange:St,disabled:wt})})]}),e.jsxs(p,{children:[e.jsx(n,{className:"font-medium",children:t("setting.canUserSkipLevel","User Can Skip Level")}),e.jsx(n,{children:s.canUserSkipLevel?"Yes":"No"}),e.jsx(n,{className:"text-right",children:e.jsx(g,{id:"can-user-skip-level",checked:M,onCheckedChange:yt,disabled:At})})]})]})]})})]}),e.jsx(Ae,{open:P,onOpenChange:v,children:e.jsxs(Be,{className:"dark:border-slate-700 dark:bg-slate-900",children:[e.jsxs(Pe,{children:[e.jsx(Fe,{className:"dark:text-slate-100",children:t("setting.editTitle")}),e.jsx(Nt,{className:"dark:text-slate-400",children:t("setting.editMsg")})]}),e.jsx("div",{className:"my-4",children:e.jsxs(Z,{value:k,onValueChange:a=>h(a),children:[e.jsx(ee,{className:"w-full dark:border-slate-700 dark:bg-slate-900",children:e.jsx(te,{placeholder:"Select scope"})}),e.jsx(ae,{className:"dark:border-slate-700 dark:bg-slate-900",children:kt?.map(a=>e.jsx(f,{value:a,children:a.replace(/_/g," ").toUpperCase()},a))})]})}),e.jsxs(Ct,{className:"flex justify-end gap-2",children:[e.jsx(U,{variant:"secondary",onClick:()=>v(!1),className:"dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",children:t("common.Cancel")}),e.jsx(U,{onClick:zt,disabled:st,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:st?t("contentManagement.saving"):t("delegation.save")})]})]})})]})},Ms=()=>{var y,q,X,S,W;const{user:x}=Ue(),c=Ee(),Y=((q=(y=x==null?void 0:x.employee)==null?void 0:y[0])==null?void 0:q.organizationId)||"",B=He(),L=d.useId(),{getList:u}=Me(),{data:R,isLoading:r}=u(Y,{take:1e3}),[I,P]=d.useState(""),[v,k]=d.useState(null);d.useEffect(()=>{var o,j;!I&&((j=(o=R==null?void 0:R.data)==null?void 0:o.items)!=null&&j.length)&&P(R.data.items[0].id)},[I,R]);const h=((X=R==null?void 0:R.data)==null?void 0:X.items)??[],V=h.length>0,_=(S=h.find(o=>o.id===I))==null?void 0:S.name,{data:F,isLoading:G}=Qe(I),$=((W=F==null?void 0:F.data)==null?void 0:W.items)||[],m=$.find(o=>o.unitId===I)||$[0],se=!!(m!=null&&m.attachSignatureOnAttachment),D=!!(m!=null&&m.id),M=v===null?se:v;d.useEffect(()=>{k(null)},[I,se]);const{mutate:ne,isPending:J}=b({mutationFn:({id:o,value:j})=>N.updateInternalPrefixSuffix({attachSignatureOnAttachment:j,unitId:I},o),onSuccess:()=>{c.invalidateQueries({queryKey:["unitConfig",I]})},onError:()=>{k(null)}}),ie=o=>{!(m!=null&&m.id)||J||(k(o),ne({id:m.id,value:o}))};return e.jsx("section",{className:"w-full",children:e.jsx("div",{className:"relative overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-slate-100/60 p-4 shadow-sm sm:p-6 dark:border-slate-700/80 dark:bg-gradient-to-br dark:from-slate-950 dark:via-slate-900 dark:to-slate-900",children:e.jsxs("div",{className:"relative space-y-5",children:[e.jsx("header",{className:"flex flex-col gap-2 border-b border-slate-200 pb-4 dark:border-slate-700 sm:flex-row sm:items-start sm:justify-between",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"inline-flex w-fit items-center gap-2 rounded-full bg-white/80 px-3 py-1 text-xs font-medium text-slate-700 ring-1 ring-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:ring-slate-700",children:[e.jsx(ks,{className:"h-3.5 w-3.5"}),t("setting.attachmentSignature.badge")]}),e.jsxs("h2",{className:"text-xl font-semibold tracking-tight text-slate-900 dark:text-slate-100 sm:text-2xl flex gap-2",children:[e.jsx(Te,{className:"h-8 w-8 text-primary"}),t("setting.attachmentSignature.title")]}),e.jsx("p",{className:"max-w-2xl text-sm text-slate-600 dark:text-slate-400",children:t("setting.attachmentSignature.description")})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 rounded-xl border border-slate-200/80 bg-white/80 p-4 backdrop-blur-sm dark:border-slate-700 dark:bg-slate-900/70",children:[e.jsx(jt,{className:"text-sm font-medium text-slate-800 dark:text-slate-200",children:t("setting.attachmentSignature.unit")}),e.jsxs(Z,{value:I,onValueChange:o=>P(o),children:[e.jsx(ee,{className:"h-11 w-full bg-white/90 dark:border-slate-700 dark:bg-slate-900","aria-label":t("setting.attachmentSignature.unit"),children:e.jsx(te,{placeholder:t("setting.attachmentSignature.selectUnit")})}),e.jsx(ae,{children:r?e.jsx(f,{value:"loading",disabled:!0,children:t("setting.attachmentSignature.loadingUnits")}):V?h?.map(o=>e.jsx(f,{value:o.id,children:B(o.name)},o.id)):e.jsx(f,{value:"no-units",disabled:!0,children:t("setting.attachmentSignature.noUnitsFound")})})]}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:t("setting.attachmentSignature.unitHint")})]}),e.jsxs("div",{className:"space-y-3 rounded-xl border border-slate-200/80 bg-white/80 p-4 backdrop-blur-sm dark:border-slate-700 dark:bg-slate-900/70",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(jt,{htmlFor:L,className:"text-sm font-medium text-slate-800 dark:text-slate-200",children:t("setting.attachmentSignature.toggleLabel")}),e.jsx("p",{id:`${L}-description`,className:"text-xs text-slate-500 dark:text-slate-400",children:t("setting.attachmentSignature.toggleDescription")})]}),e.jsx(g,{id:L,checked:M,onCheckedChange:ie,"aria-describedby":`${L}-description`,disabled:!D||G||J})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dashed border-slate-300/80 bg-slate-50/80 px-3 py-2 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-300",children:[e.jsx(ys,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400"}),e.jsxs("span",{children:[t("setting.attachmentSignature.status")," ",e.jsx("span",{className:"font-semibold",children:M?t("profile.enabled"):t("profile.disabled")})]})]}),!D&&!G&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:t("setting.noConfigFound")})]})]}),e.jsxs("footer",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-slate-200/80 bg-white/70 px-3 py-2 text-xs text-slate-600 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-300",children:[e.jsx(ts,{className:"h-3.5 w-3.5 text-slate-500 dark:text-slate-400"}),e.jsxs("span",{children:[t("setting.attachmentSignature.activeUnit")," ",e.jsx("strong",{className:"font-semibold",children:_?B(_):t("common.None")})]})]})]})})})},gn=()=>e.jsx("div",{className:"mx-auto w-full max-w-[1500px] space-y-6 p-4 sm:p-6",children:e.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2",children:[e.jsx(Ts,{}),e.jsx(Ds,{}),e.jsx(As,{}),e.jsx(Ms,{})]})});export{gn as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-CLduruyz.js b/apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-CLduruyz.js deleted file mode 100644 index 9d283f100..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-CLduruyz.js +++ /dev/null @@ -1,259 +0,0 @@ -import{y as nt,l as re,w as ae,m as _e,u as Ie,k as dt,n as Ee,o as Ne,r as c,j as e,v as w,B as J,I as ke,aS as lt,t as ge,b4 as He,b5 as La,az as At,F as mt,b6 as Rt,aJ as vr,aK as Qe,aL as Ge,aM as We,aN as Ye,b7 as jr,aR as sa,aF as lr,b8 as be,aP as _a,b9 as Da,ba as Ia,aU as $a,R as pe,aI as za,a as qa,d as Ba,bb as Xt,bc as Ua}from"./index-Db-xuq0b.js";import{C as Ke,a as it,b as ot,c as ia,d as pt}from"./card-BBWyxDss.js";import{L as Ce}from"./label-CsFy6wpo.js";import{p as oa}from"./presignedAxios-BunkFbUr.js";import{P as ct}from"./plus-BdjS2Pc-.js";import{T as la,a as ca,b as Ze,c as Ve,d as da,e as Te}from"./table-D3n3VABd.js";import{S as ft,a as ht,b as xt,c as yt,d as bt}from"./select-BoQxM42A.js";import{u as ua,C as Ha}from"./index.esm-BG4gweZJ.js";import{T as Ka,u as Va}from"./useTemplate-CcP413sN.js";import{S as et}from"./skeleton-CIiqp2Y5.js";import{A as Bt,a as Ut,b as Ht,c as Kt,d as Vt,e as Qt,f as Gt,g as Wt}from"./alert-dialog-B5Y0wlSz.js";import{E as Qa}from"./eye-Bhud4znU.js";import{S as Ga}from"./square-pen-B91TPB19.js";import{C as ma}from"./chevron-left-DCpEaNzo.js";import{p as Pe,u as Wa}from"./useUnitConfiguration-CKdECszp.js";import{P as wr}from"./pencil-BBczLcc3.js";import{u as Ya}from"./useUnit-C4s9nepK.js";import{u as Er}from"./useSettings-BtSYqn9W.js";import{M as Xa}from"./multi-select-C9K8HXhI.js";import{u as Ja}from"./usePosition-Y8Dhf3qk.js";import{S as Za}from"./single-select-D9ZG1edj.js";import{P as en,a as tn,b as rn}from"./popover-X-j_SRnG.js";import{B as cr}from"./badge-D7JvaQeJ.js";import{C as an,a as nn,b as sn,c as on,d as ln,e as cn}from"./command-Cr0tMDDu.js";import{C as dn}from"./circle-alert-Cd_zeQMw.js";import{A as un}from"./AdvancedTable-CC9ioMU-.js";import{u as mn,o as gn,s as Lt}from"./zod-Df58YiJ6.js";import{F as pn,a as Jt,b as Zt,c as er,d as tr,e as rr}from"./form-BeLK5rTt.js";import{f as fn}from"./format-DvwV82px.js";import{X as hn}from"./XSSUploadValidator-BMXKraj-.js";import{L as kr}from"./loader-mVRAFg0f.js";import{A as xn}from"./arrow-left-CE5-YfaQ.js";import{B as yn}from"./building-B2uZxFCD.js";import"./Utils-BP0IYDrC.js";import"./Skeleton-BJECajc_.js";import"./unitService-CmGVtFHQ.js";import"./organizationService-DPKKJMFw.js";import"./separator-BaOOgzZX.js";import"./positionService-JD0NEiGK.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./search-CM5F2ZRy.js";import"./utils-BncSPdK1.js";import"./refresh-cw-JB7N413f.js";import"./en-US-Cc-9gH5A.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bn=[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]],vn=nt("book-image",bn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jn=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],wn=nt("chevrons-up-down",jn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kn=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]],Nn=nt("clipboard-type",kn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sn=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Cn=nt("pencil-ruler",Sn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]],Tn=nt("square-activity",Pn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const En=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]],ga=nt("stamp",En);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const An=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Rn=nt("tag",An);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mn=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],On=nt("triangle-alert",Mn),Je={createSeal:async t=>re.post("/seals",t,{headers:ae()}),getSeals:async()=>re.get("/seals",{headers:ae()}),getSeal:async t=>re.get(`/seals/${t}`,{headers:ae()}),getSealListsByUnitId:async t=>re.get(`/seals/list/${t}`,{headers:ae()}),updateSeal:async(t,r)=>re.put(`/seals/${t}`,r,{headers:ae()}),deleteSeal:async t=>re.delete(`/seals/${t}`,{headers:ae()}),changeSealStatus:async(t,r)=>re.put(`/seals/change-status/${t}`,r,{headers:ae()}),updateSealUploadStatus:async(t,r)=>re.patch(`/seals/${t}/upload-status`,r,{headers:ae()})},Fn=()=>{const t=_e(),{t:r}=Ie(),{handleError:a}=dt(r),{data:n,isLoading:s,isError:i,refetch:o}=Ee({queryKey:["seals"],queryFn:async()=>(await Je.getSeals()).data,enabled:!1}),d=x=>Ee({queryKey:["seal",x],queryFn:async()=>{if(x)return(await Je.getSealListsByUnitId(x)).data},enabled:!!x}),m=x=>Ee({queryKey:["seal",x],queryFn:async()=>{if(x)return(await Je.getSeal(x)).data},enabled:!!x}),l=Ne({mutationFn:async x=>(await Je.createSeal(x)).data,onSuccess:()=>{t.invalidateQueries({queryKey:["seals"]})},onError:x=>{a(x)}}),f=Ne({mutationFn:async({id:x,payload:v})=>(await Je.updateSeal(x,v)).data,onSuccess:()=>{t.invalidateQueries({queryKey:["seal"]})},onError:x=>{a(x)}}),y=Ne({mutationFn:async x=>{await Je.changeSealStatus(x,{isCurrent:!1})},onSuccess:()=>{t.invalidateQueries({queryKey:["seals"]})},onError:x=>{a(x)}}),g=Ne({mutationFn:async({id:x,updateSealStatusPayload:v})=>(await Je.updateSealUploadStatus(x,v)).data,onSuccess:()=>{t.invalidateQueries({queryKey:["seals"]})},onError:x=>{a(x)}});return{seals:(n==null?void 0:n.items)||[],totalSeals:(n==null?void 0:n.count)||0,isLoadingSeals:s,isSealsError:i,refetchSeals:o,getSealsByUnitId:d,getSealsById:m,createSeal:l.mutateAsync,isCreatingSeal:l.isPending,updateSeal:f.mutate,isUpdatingSeal:f.isPending,deleteSeal:y.mutate,isDeletingSeal:y.isPending,updateSealStatus:g.mutateAsync,isUpdatingStatus:g.isPending}},Ln=({unitId:t})=>{const{createSeal:r,isCreatingSeal:a,isLoadingSeals:n,deleteSeal:s,getSealsByUnitId:i}=Fn(),[o,d]=c.useState(),[m,l]=c.useState([]),f=c.useRef(null),y=_e(),[g,x]=c.useState(0),[v,p]=c.useState(!1),[j,E]=c.useState(""),[b,k]=c.useState(""),N=1*1024*1024,{data:u}=i(t);c.useEffect(()=>{let $=!0;return(async()=>{if(!(u!=null&&u.items))return;const _=u.items.filter(W=>W.uploadedSuccessfully&&W.isCurrent),X=(await Promise.all(_?.map(async W=>{try{const ie=(await Je.getSeal(W.id)).data.presigned;return ie?{type:"seal",file:new File([],W.fileInfo.fileName),url:ie,uploadedAt:new Date(W.createdAt),id:W.id}:null}catch{return null}}))).filter(W=>W!==null);$&&l(X)})(),()=>{$=!1,m.forEach(_=>{!_.id&&_.url.startsWith("blob:")&&URL.revokeObjectURL(_.url)})}},[u==null?void 0:u.items]);const C=$=>{if($.type!=="image/png"){ge.error(w("contentManagement.onlyPngAllowed"));return}if($.size>N){ge.error("Image size should be less than 1 MB");return}const F=URL.createObjectURL($),_=new Image;_.onload=()=>{if(_.width!==_.height){ge.error(w("contentManagement.onlySquareAllowed")),URL.revokeObjectURL(F);return}d($),E(""),k(""),l([{type:"seal",url:F,file:$,uploadedAt:new Date,id:null}])},_.onerror=()=>{ge.error(w("contentManagement.invalidImage")),URL.revokeObjectURL(F)},_.src=F},M=async()=>{if(!o){ge.error(w("contentManagement.noFileSelected"));return}if(!j.trim()){k(w("contentManagement.sealNameMsg"));return}try{const $={fileInfo:{fileName:o.name,contentType:o.type,size:o.size,originalname:o.name},name:{am:j,en:j},unitId:t},F=await r($);p(!0),x(0),await oa.put(F.presigned,o,{headers:{"Content-Type":o.type}}),p(!1),x(100),d(void 0),E(""),k(""),f.current&&(f.current.value=""),y.invalidateQueries({queryKey:["seal"]}),ge.success(w("contentManagement.sealSuccessMsg"))}catch{ge.error(w("contentManagement.sealErrorMsg")),p(!1),x(0),d(void 0)}},I=async $=>{if($)try{await s($),l(F=>F.filter(_=>_.id!==$)),ge.success(w("contentManagement.sealRemove"))}catch{ge.error(w("contentManagement.sealRemove"))}},se=$=>new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",hour12:!0,month:"short",day:"numeric"}).format($),Y=a||v;return e.jsxs(Ke,{className:"dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs(it,{children:[e.jsxs(ot,{className:"flex items-center dark:text-white",children:[e.jsx(ga,{className:"h-5 w-5 mr-2"}),w("contentManagement.seal")]}),e.jsxs(ia,{className:"dark:text-gray-400",children:[w("contentManagement.uploadSealMsg")," (PNG, max 1MB)"]})]}),e.jsxs(pt,{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Ce,{htmlFor:"seal",className:"dark:text-gray-200",children:w("contentManagement.sealImage")}),e.jsxs(J,{variant:"outline",className:"bg-primary hover:bg-primary/90 text-primary-foreground",onClick:()=>{var $;return($=f.current)==null?void 0:$.click()},disabled:Y,children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),w("contentManagement.addSeal")]})]}),e.jsx(ke,{ref:f,type:"file",accept:".png,image/png",className:"hidden",onChange:$=>{var F;return((F=$.target.files)==null?void 0:F[0])&&C($.target.files[0])},disabled:Y}),m.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:m?.map($=>e.jsxs("div",{className:"border rounded-lg p-3 bg-gray-50 dark:bg-gray-700 dark:border-gray-600",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground dark:text-gray-400",children:se($==null?void 0:$.uploadedAt)}),e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>I(($==null?void 0:$.id)||null),className:"text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-900/30",disabled:n,children:e.jsx(lt,{className:"h-4 w-4 text-red-500"})})]}),e.jsx("img",{src:$.url,alt:"Seal",className:"max-h-32 mx-auto object-contain"})]},($==null?void 0:$.id)||($==null?void 0:$.url)))}):e.jsxs("div",{className:"text-center p-4 border border-dashed rounded-lg dark:border-gray-600 dark:bg-gray-700/30",children:[e.jsx("p",{className:"text-muted-foreground dark:text-gray-400",children:w("contentManagement.noSealMsg")}),e.jsx("p",{className:"text-sm text-muted-foreground dark:text-gray-500 mt-1",children:w("contentManagement.addSealInstruction")})]}),o&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ce,{htmlFor:"sealName",className:"dark:text-gray-200",children:w("contentManagement.sealName")}),e.jsx(ke,{value:j,onChange:$=>{E($.target.value),k("")},placeholder:"Enter seal name",className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),b&&e.jsx("p",{className:"text-sm text-red-500",children:b})]}),o&&e.jsxs(J,{className:"w-full bg-primary hover:bg-primary/90",onClick:M,disabled:Y||!o,children:[a&&"Creating seal...",v&&`Uploading ${g}%`,!Y&&w("contentManagement.saveSeal")]})]})]})},_n=async(t,r)=>He.get(`/record-templates/list/${t}`,{headers:ae(),params:r}),Dn=async t=>He.get(`/record-templates/${t}`,{headers:ae()}),In=async t=>He.post("/record-templates",t,{headers:ae()}),$n=async(t,r)=>He.put(`/record-templates/${t}`,r,{headers:ae()}),zn=async t=>He.delete(`/record-templates/${t}`,{headers:ae()}),qn=(t,r={})=>{const a=_e(),{skip:n=0,take:s=20,orderBy:i="createdAt:DESC",order:o,enabled:d=!0}=r,m={skip:n,take:s,orderBy:i,...o?{order:o}:{}},{data:l,isLoading:f,isFetching:y,isError:g,refetch:x}=Ee({queryKey:["letter-templates",t,m],queryFn:async()=>{const{data:C}=await _n(t,m);return C},enabled:!!t&&d,staleTime:300*1e3,retry:!1,placeholderData:La}),{mutate:v,isPending:p}=Ne({mutationFn:async C=>{const{data:M}=await Dn(C);return M}}),{mutate:j,isPending:E}=Ne({mutationFn:async C=>{const{data:M}=await In(C);return M},onSuccess:(C,M)=>{a.invalidateQueries({queryKey:["letter-templates",M.unitId]})}}),{mutate:b,isPending:k}=Ne({mutationFn:async C=>{const{data:M}=await $n(C.id,C.data);return M},onSuccess:(C,M)=>{a.invalidateQueries({queryKey:["letter-templates",M.data.unitId]}),a.invalidateQueries({queryKey:["letter-template",M.id]})}}),{mutate:N,isPending:u}=Ne({mutationFn:async({id:C})=>{await zn(C)},onSuccess:()=>{a.invalidateQueries({queryKey:["letter-templates",t]})}});return{letterTemplatesResponse:l,items:(l==null?void 0:l.items)??[],count:(l==null?void 0:l.count)??0,isLoading:f,isFetching:y,isError:g,refetch:x,getTemplateByDetails:v,isFetchingTemplate:p,createLetterTemplate:j,isCreating:E,updateLetterTemplate:b,isUpdating:k,deleteLetterTemplate:N,isDeleting:u}},Bn={signature:{uploadKey:"/signatures/get-file-upload-key",create:"/signatures",parentField:"employeeId"},stamp:{uploadKey:"/employee-stamps/get-file-upload-key",create:"/employee-stamps",parentField:"employeePositionId"},header:{uploadKey:"/headers/get-file-upload-key",create:"/headers",parentField:"unitId"},footer:{uploadKey:"/footers/get-file-upload-key",create:"/footers",parentField:"unitId"}};async function Un(t,r,a,n,s){const i={fileName:r.name,originalname:r.name,contentType:r.type||"application/octet-stream",size:r.size,...n!=null&&n.length?{positionId:n}:{},recordTypeKey:s},{data:o}=await a.post(t,i,{headers:ae()});return o}async function Hn(t,r){if(!r)throw new Error("Presigned URL is required");const a=await oa.put(r,t,{headers:{"Content-Type":t.type}});if(a.status<200||a.status>=300)throw new Error(`Upload failed with status ${a.status}: ${a.statusText}`)}async function Ar(t,r,a,n){const{type:s,file:i,name:o,parentId:d}=t,m=Bn[s],l=await Un(m.uploadKey,i,r,a,n),f=l.presignedUrl||l.presigned;if(await Hn(i,f||""),s==="header"||s==="footer"){const x={fileInfo:l.fileInfo,name:o,[m.parentField]:d,positionIds:a,isCurrent:!0,recordTypeKey:n},{data:v}=await r.post(m.create,x,{headers:ae()});return v}const y={fileInfo:l.fileInfo,name:o,[m.parentField]:d,...s==="signature"?{isCurrent:!0}:{}},{data:g}=await r.post(m.create,y,{headers:ae()});return g}const Me={uploadAndCreateHeader:(t,r,a,n,s)=>Ar({type:"header",file:t,name:{am:r,en:r},parentId:a},re,n,s),uploadAndCreateFooter:(t,r,a,n,s)=>Ar({type:"footer",file:t,name:{am:r,en:r},parentId:a},re,n,s),createHeader:async t=>re.post("/headers",t,{headers:ae()}),getHeaders:async()=>re.get("/headers",{headers:ae()}),getHeadersByUnitId:async(t,r,a)=>re.get(`/headers/list/${t}?take=100${r?`&positionId=${r}`:""}${a?`&recordTypeKey=${a}`:""}`,{headers:ae()}),getHeaderById:async t=>re.get(`/headers/${t}`,{headers:ae()}),updateHeader:async(t,r)=>re.put(`/headers/${t}`,r,{headers:ae()}),deleteHeader:async t=>re.delete(`/headers/${t}`,{headers:ae()}),updateHeaderUploadStatus:async(t,r)=>re.patch(`/headers/${t}/upload-status`,r,{headers:ae()}),changeHeaderStatus:async(t,r)=>re.put(`/headers/change-status/${t}`,r,{headers:ae()}),createFooter:async t=>re.post("/footers",t,{headers:ae()}),getFooters:async()=>re.get("/footers",{headers:ae()}),getFootersByUnitId:async(t,r,a)=>re.get(`/footers/list/${t}?take=300${r?`&positionId=${r}`:""}${a?`&recordTypeKey=${a}`:""}`,{headers:ae()}),getFooterById:async t=>re.get(`/footers/${t}`,{headers:ae()}),updateFooter:async(t,r)=>re.put(`/footers/${t}`,r,{headers:ae()}),deleteFooter:async t=>re.delete(`/footers/${t}`,{headers:ae()}),updateFooterUploadStatus:async(t,r)=>re.patch(`/footers/${t}/upload-status`,r,{headers:ae()}),changeFooterStatus:async(t,r)=>re.put(`/footers/change-status/${t}`,r,{headers:ae()})},pa=(t,r,a)=>Ee({queryKey:["headers-footers",t,r,a],queryFn:async()=>{const[n,s]=await Promise.all([Me.getHeadersByUnitId(t,r,a),Me.getFootersByUnitId(t,r,a)]),i=n.data.items.filter(f=>f.isCurrent&&f.uploadedSuccessfully),o=s.data.items.filter(f=>f.isCurrent&&f.uploadedSuccessfully),d=async(f,y)=>Promise.all(f?.map(async g=>{try{const x=y==="header"?await Me.getHeaderById(g.id):await Me.getFooterById(g.id);return{...g,presigned:x.data.presigned}}catch{return g}})),m=await d(i,"header"),l=await d(o,"footer");return{headers:m,footers:l}},enabled:!!t,staleTime:600*1e3}),Rr=({unitId:t,template:r,isSubmitting:a,onCancel:n,onSubmitCreate:s})=>{var g,x,v,p;const{register:i,handleSubmit:o,reset:d,control:m,formState:{errors:l}}=ua({defaultValues:{name:{en:((g=r==null?void 0:r.name)==null?void 0:g.en)??"",am:((x=r==null?void 0:r.name)==null?void 0:x.am)??""},key:(r==null?void 0:r.key)??"",subject:(r==null?void 0:r.subject)??"",body:(r==null?void 0:r.body)??"",sincerelyText:(r==null?void 0:r.sincerelyText)??"",unitId:t}}),{data:f}=pa(t);c.useMemo(()=>(f==null?void 0:f.headers)||[],[f==null?void 0:f.headers]),c.useMemo(()=>(f==null?void 0:f.footers)||[],[f==null?void 0:f.footers]);const y=j=>{s(j),r||d()};return e.jsxs("form",{onSubmit:o(y),className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg p-8 shadow-sm space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Template Key"}),e.jsx(ke,{placeholder:"Template Key",...i("key",{required:"Template key is required"})}),l.key&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.key.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Subject"}),e.jsx(ke,{placeholder:"Subject",...i("subject",{required:"Subject is required"})}),l.subject&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.subject.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"English Name"}),e.jsx(ke,{placeholder:"English Name",...i("name.en",{required:"English name is required"})}),((v=l.name)==null?void 0:v.en)&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.name.en.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Amharic Name"}),e.jsx(ke,{placeholder:"Amharic Name",...i("name.am",{required:"Amharic name is required"})}),((p=l.name)==null?void 0:p.am)&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.name.am.message})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Body"}),e.jsx(Ha,{name:"body",control:m,rules:{required:!0},render:({field:j,fieldState:E})=>e.jsxs(e.Fragment,{children:[e.jsx(Ka,{value:j.value,onEditorChange:j.onChange,placeholders:[{key:"delegatorName",label:"Delegator Name"},{key:"delegatorDepartment",label:"Delegator Department"},{key:"delegateeName",label:"Delegatee Name"},{key:"delegateeDepartment",label:"Delegatee Department"},{key:"startDate",label:"Start Date"},{key:"endDate",label:"End Date"},{key:"startDateTime",label:"Start Date & Time"},{key:"endDateTime",label:"End Date & Time"}]}),E.invalid&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:"Body is required"})]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sincerely Text"}),e.jsx(ke,{placeholder:"Sincerely Text",...i("sincerelyText")})]}),e.jsxs("div",{className:"flex gap-2 pt-4 justify-end",children:[e.jsx(J,{type:"submit",disabled:a,children:a?"Saving...":r?"Update":"Save"}),e.jsx(J,{type:"button",variant:"outline",onClick:n,children:"Cancel"})]})]})},Kn=({unitId:t})=>{var ze,Se,H,ue;const{t:r}=Ie(),{handleError:a}=dt(r),[n,s]=c.useState(0),[i,o]=c.useState(10),{letterTemplatesResponse:d,count:m,isLoading:l,isFetching:f,isError:y,refetch:g,createLetterTemplate:x,updateLetterTemplate:v,deleteLetterTemplate:p,isCreating:j,isUpdating:E,isDeleting:b}=qn(t,{skip:n*i,take:i}),k=Math.max(1,Math.ceil(m/i)),{templates:N,isLoading:u,adoptTemplate:C,isAdoptingTemplate:M}=Va(),{data:I}=Ee({queryKey:["headers",t],queryFn:()=>Me.getHeadersByUnitId(t)}),{data:se}=Ee({queryKey:["footers",t],queryFn:()=>Me.getFootersByUnitId(t)}),Y=At(),[$,F]=c.useState(!1),[_,ne]=c.useState(!1),[X,W]=c.useState(!1),[xe,ie]=c.useState(!1),[Ae,je]=c.useState(!1),[z,O]=c.useState(null),[R,L]=c.useState(""),[T,h]=c.useState(""),U=z?Y(z.name):"",P=l||u,Z=y,ee=Array.isArray(N)?N:(N==null?void 0:N.items)||[],te=(d==null?void 0:d.items)||[],q=[...ee?.map(D=>({...D,isGlobal:!0})),...te?.map(D=>({...D,isGlobal:!1}))],de=D=>{const we=D.target;we!=null&&we.closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root")&&D.preventDefault()},fe=D=>{x(D,{onSuccess:we=>{ge.success(`${Y(we.name)} ${r("contentManagement.templateSuccessMsg")}`),g(),F(!1)},onError:we=>{a(we)}})},Q=D=>{z&&v({id:z.id,data:D},{onSuccess:()=>{ge.success(r("contentManagement.updateTemplate")),g(),ne(!1),O(null)},onError:we=>{a(we)}})},le=()=>{z&&p({id:z.id},{onSuccess:()=>{ge.success(r("contentManagement.deleteTemplate")),g(),ie(!1),O(null)},onError:D=>{a(D)}})},G=()=>{if(!z||!R||!T){ge.error(r("contentManagement.pleaseSelectHeaderAndFooter","Please select header and footer"));return}C({templateId:z.id,headerId:R,footerId:T},{onSuccess:()=>{ge.success(r("contentManagement.adoptSuccess","Successfully adopted global template")),g(),je(!1),O(null),L(""),h("")},onError:D=>{a(D)}})},oe=D=>{O(D),ne(!0)},Re=D=>{O(D),W(!0)},ye=D=>{O(D),ie(!0)},$e=D=>{O(D),je(!0)};return P?e.jsxs(Ke,{children:[e.jsx(it,{children:e.jsxs(ot,{className:"flex items-center",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),r("contentManagement.letterTemplate")]})}),e.jsx(pt,{children:e.jsx("div",{className:"space-y-3",children:Array(3).fill(0)?.map((D,we)=>e.jsx(et,{className:"h-12 w-full"},we))})})]}):Z?e.jsxs(Ke,{children:[e.jsx(it,{children:e.jsxs(ot,{className:"flex items-center",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),r("contentManagement.letterTemplate")]})}),e.jsx(pt,{children:e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:r("contentManagement.failedToLoadTemplates")})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ke,{children:[e.jsx(it,{children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs(ot,{className:"flex items-center",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),r("contentManagement.letterTemplate")]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:r("contentManagement.createMsg")})]}),e.jsxs(J,{onClick:()=>F(!0),size:"sm",className:"shrink-0",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),r("contentManagement.addTemplate")]})]})}),e.jsx(pt,{children:q.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(mt,{className:"mx-auto mb-4 h-12 w-12 text-gray-400 dark:text-gray-500"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:r("contentManagement.noTemplates")})]}):e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs(la,{children:[e.jsx(ca,{children:e.jsxs(Ze,{children:[e.jsx(Ve,{className:"min-w-[150px]",children:r("common.name")}),e.jsx(Ve,{className:"min-w-[200px] hidden md:table-cell",children:r("contentManagement.sincerelyText")}),e.jsx(Ve,{className:"min-w-[120px] hidden sm:table-cell",children:r("common.createdDate")}),e.jsx(Ve,{className:"text-right min-w-[120px]",children:r("common.actions")})]})}),e.jsx(da,{children:q?.map(D=>e.jsxs(Ze,{className:D.isGlobal?"bg-blue-50/50 hover:bg-blue-50 dark:bg-blue-950/30 dark:hover:bg-blue-900/40":"",children:[e.jsx(Te,{className:"font-medium",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[Y(D.name),D.isGlobal&&e.jsx("span",{className:"rounded bg-blue-100 px-2 py-0.5 text-[10px] font-semibold text-blue-700 dark:bg-blue-900/50 dark:text-blue-200",children:"Global"})]}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 md:hidden",children:D.sincerelyText&&D.sincerelyText.length>30?`${D.sincerelyText.substring(0,30)}...`:D.sincerelyText||r("common.notAvailable")})]})}),e.jsx(Te,{className:"max-w-xs truncate hidden md:table-cell",children:D.sincerelyText||r("common.notAvailable")}),e.jsx(Te,{className:"hidden sm:table-cell",children:D.createdAt?new Date(D.createdAt).toLocaleDateString():r("common.notAvailable")}),e.jsx(Te,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Re(D),title:r("contentManagement.viewTemplate"),children:e.jsx(Qa,{className:"h-4 w-4"})}),D.isGlobal?e.jsx(J,{variant:"outline",size:"sm",onClick:()=>$e(D),title:r("contentManagement.adoptTemplate","Adopt Template"),className:"h-8 border-blue-200 px-3 text-blue-700 hover:bg-blue-100 hover:text-blue-800 dark:border-blue-700/60 dark:text-blue-300 dark:hover:bg-blue-900/40 dark:hover:text-blue-200",children:r("common.adopt","Adopt")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>oe(D),title:r("contentManagement.editTemplate"),children:e.jsx(Ga,{className:"h-4 w-4"})}),e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>ye(D),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",title:r("contentManagement.deleteTemplate"),children:e.jsx(Rt,{className:"h-4 w-4"})})]})]})})]},D.id))})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:[r("common.page","Page")," ",n+1," / ",k,m>0&&e.jsxs(e.Fragment,{children:[" ","• ",m," ",r("contentManagement.letterTemplate","templates")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ft,{value:String(i),onValueChange:D=>{o(Number(D)),s(0)},children:[e.jsx(ht,{className:"h-8 w-[80px]",children:e.jsx(xt,{})}),e.jsx(yt,{children:[10,20,50,100]?.map(D=>e.jsx(bt,{value:String(D),children:D},D))})]}),e.jsxs(J,{variant:"outline",size:"sm",disabled:n===0||f,onClick:()=>s(D=>Math.max(0,D-1)),children:[e.jsx(ma,{className:"h-4 w-4"}),r("common.previous","Previous")]}),e.jsxs(J,{variant:"outline",size:"sm",disabled:n+1>=k||f,onClick:()=>s(D=>D+1),children:[r("common.next","Next"),e.jsx(vr,{className:"h-4 w-4"})]})]})]})]})})]}),e.jsx(Qe,{open:$,onOpenChange:F,children:e.jsxs(Ge,{className:"max-h-[90vh] w-full max-w-[95vw] overflow-y-auto lg:max-w-[1200px] dark:border-gray-700 dark:bg-gray-900",onInteractOutside:de,children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.createTemplate")})}),e.jsx(Rr,{unitId:t,isSubmitting:j,onCancel:()=>F(!1),onSubmitCreate:fe})]})}),e.jsx(Qe,{open:_,onOpenChange:ne,children:e.jsxs(Ge,{className:"max-h-[90vh] w-full max-w-[95vw] overflow-y-auto lg:max-w-[1200px] dark:border-gray-700 dark:bg-gray-900",onInteractOutside:de,children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.editTemplate")})}),e.jsx(Rr,{unitId:t,template:z,isSubmitting:E,onCancel:()=>{ne(!1),O(null)},onSubmitCreate:Q})]})}),e.jsx(Qe,{open:X,onOpenChange:W,children:e.jsxs(Ge,{className:"max-h-[90vh] w-full max-w-[95vw] overflow-y-auto lg:max-w-[1200px] dark:border-gray-700 dark:bg-gray-900",children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.viewTemplate")})}),z&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:r("common.name")}),e.jsx("p",{className:"mt-1 text-sm text-gray-900 dark:text-gray-100",children:Y(z.name)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:r("contentManagement.sincerelyText")}),e.jsx("p",{className:"mt-1 text-sm text-gray-900 dark:text-gray-100",children:z.sincerelyText||r("common.notAvailable")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:r("contentManagement.body")}),e.jsx("div",{className:"mt-1 max-h-60 overflow-y-auto rounded-md border bg-gray-50 p-3 text-sm text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100",dangerouslySetInnerHTML:{__html:z.body}})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(J,{onClick:()=>W(!1),children:r("common.close")})})]})]})}),e.jsx(Qe,{open:Ae,onOpenChange:je,children:e.jsxs(Ge,{className:"max-w-md dark:border-gray-700 dark:bg-gray-900",children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.adoptTemplate","Adopt Template")})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300",children:r("contentManagement.selectHeader","Select Header")}),e.jsxs(ft,{value:R,onValueChange:L,children:[e.jsx(ht,{children:e.jsx(xt,{placeholder:r("contentManagement.selectHeader","Select Header")})}),e.jsx(yt,{children:(Se=(ze=I==null?void 0:I.data)==null?void 0:ze.items)==null?void 0:Se?.map(D=>e.jsx(bt,{value:D.id,children:Y(D.name)},D.id))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300",children:r("contentManagement.selectFooter","Select Footer")}),e.jsxs(ft,{value:T,onValueChange:h,children:[e.jsx(ht,{children:e.jsx(xt,{placeholder:r("contentManagement.selectFooter","Select Footer")})}),e.jsx(yt,{children:(ue=(H=se==null?void 0:se.data)==null?void 0:H.items)==null?void 0:ue?.map(D=>e.jsx(bt,{value:D.id,children:Y(D.name)},D.id))})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(J,{variant:"outline",onClick:()=>je(!1),children:r("common.cancel")}),e.jsx(J,{onClick:G,disabled:M||!R||!T,children:M?r("common.adopting","Adopting..."):r("common.adopt","Adopt")})]})]})}),e.jsx(Bt,{open:xe,onOpenChange:ie,children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:r("contentManagement.deleteTemplate")}),e.jsx(Vt,{children:r("contentManagement.deleteTemplateConfirm",{name:U}).replace("{{name}}",U).replace("{name}",U)})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{children:r("common.cancel")}),e.jsx(Wt,{onClick:le,disabled:b,className:"bg-red-600 hover:bg-red-700",children:r(b?"common.deleting":"common.delete")})]})]})})]})},Vn=({activities:t})=>{const r=a=>new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",hour12:!0,month:"short",day:"numeric"}).format(a);return e.jsxs(Ke,{className:"bg-gradient-to-br from-gray-50 to-slate-50 dark:from-gray-800 dark:to-gray-900 dark:border-gray-700",children:[e.jsxs(it,{children:[e.jsxs(ot,{className:"flex items-center dark:text-white",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),"Recent Activities"]}),e.jsx(ia,{className:"dark:text-gray-400",children:"Recent content management activities"})]}),e.jsx(pt,{children:e.jsx("div",{className:"space-y-4",children:t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground dark:text-gray-400",children:"No recent activities."}):t?.map(({id:a,type:n,description:s,timestamp:i})=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium capitalize dark:text-white",children:n}),e.jsx("span",{className:"text-sm dark:text-gray-300",children:s}),e.jsx("span",{className:"text-xs text-muted-foreground dark:text-gray-400",children:r(i)})]},a))})})]})},Qn=(t,r)=>Ee({queryKey:["remark",t,r],queryFn:async()=>(await Pe.getRemarkList(t,r)).data}),Gn=({unitId:t})=>{const[r,a]=c.useState(""),[n,s]=c.useState(""),[i,o]=c.useState(null),[d,m]=c.useState(!1),[l,f]=c.useState(!1),[y,g]=c.useState(null),[x,v]=c.useState(""),p=_e(),{data:j,isLoading:E}=Qn(t,{skip:0,take:300}),b=Ne({mutationFn:async()=>{if(!r)throw new Error(w("contentManagement.remarkRequired"));const M={unitId:t,remark:r,description:n};return i?Pe.editRemark(i,M):Pe.createRemark(M)},onSuccess:()=>{p.invalidateQueries({queryKey:["remark",t]}),N(),m(!1)},onError:M=>v(M.message||w("contentManagement.failed"))}),k=Ne({mutationFn:M=>Pe.deleteRemarks(M),onSuccess:()=>{p.invalidateQueries({queryKey:["remark",t]}),f(!1),g(null)},onError:()=>v(w("contentManagement.failedToDelete"))}),N=()=>{a(""),s(""),o(null),v("")},u=M=>{o(M.id),a(M.remark),s(M.description||""),m(!0)},C=()=>b.mutate();return e.jsxs(Ke,{className:"p-4 border shadow-sm space-y-4 dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs(Qe,{open:d,onOpenChange:m,children:[e.jsx(jr,{asChild:!0,children:e.jsxs(J,{className:"w-[180px] bg-primary hover:bg-primary/90 text-primary-foreground flex items-center",children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),w("contentManagement.addRemark")]})}),e.jsxs(Ge,{className:"sm:max-w-xl w-full dark:bg-gray-800",children:[e.jsx(We,{children:e.jsx(Ye,{className:"dark:text-white",children:i?w("contentManagement.editRemark"):w("contentManagement.addRemark")})}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(Ce,{htmlFor:"remark",className:"mb-1 dark:text-gray-200",children:w("header.Remark")}),e.jsx(ke,{id:"remark",value:r,onChange:M=>a(M.target.value),placeholder:w("header.Remark"),disabled:E,className:"w-full dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),e.jsx(Ce,{htmlFor:"description",className:"mb-1 dark:text-gray-200",children:w("header.Description")}),e.jsx(ke,{id:"description",value:n,onChange:M=>s(M.target.value),placeholder:w("header.Description"),disabled:E,className:"w-full mb-2 dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),x&&e.jsx("p",{className:"text-sm text-red-500",children:x})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(J,{variant:"outline",onClick:()=>{N(),m(!1)},children:w("common.Cancel")}),e.jsx(J,{onClick:C,disabled:E,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:E?w("contentManagement.saving"):i?w("delegation.update"):w("delegation.save")})]})]})]}),e.jsx("h3",{className:"font-semibold text-md dark:text-white",children:w("contentManagement.commonRemarks")}),E?e.jsx("div",{className:"text-center py-4 dark:text-gray-400",children:w("contentManagement.loading")}):e.jsx("div",{className:"overflow-x-auto max-h-[380px] overflow-y-auto border rounded dark:border-gray-600",children:e.jsxs("table",{className:"min-w-full text-sm text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-gray-100 dark:bg-gray-700",children:[e.jsx("th",{className:"px-3 py-2 dark:text-white",children:"#"}),e.jsx("th",{className:"px-3 py-2 dark:text-white",children:w("header.Remark")}),e.jsx("th",{className:"px-3 py-2 dark:text-white",children:w("header.Description")}),e.jsx("th",{className:"px-3 py-2 dark:text-white",children:w("userRecord.Actions")})]})}),e.jsx("tbody",{children:j!=null&&j.items.length?j.items?.map((M,I)=>e.jsxs("tr",{className:"border-b hover:bg-gray-50 dark:hover:bg-gray-700 dark:border-gray-600",children:[e.jsx("td",{className:"px-3 py-2 dark:text-gray-300",children:I+1}),e.jsx("td",{className:"px-3 py-2 dark:text-gray-300",children:M.remark}),e.jsx("td",{className:"px-3 py-2 dark:text-gray-300",children:M.description}),e.jsxs("td",{className:"px-3 py-2 flex gap-2",children:[e.jsx(J,{variant:"outline",size:"sm",onClick:()=>u(M),children:e.jsx(wr,{className:"h-4 w-4"})}),e.jsx(J,{variant:"destructive",size:"sm",onClick:()=>{g(M.id),f(!0)},children:e.jsx(Rt,{className:"h-4 w-4"})})]})]},M.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"text-center py-4 text-gray-500 dark:text-gray-400",children:w("contentManagement.noRec")})})})]})}),e.jsx(Bt,{open:l,onOpenChange:M=>{k.isPending||(f(M),M||g(null))},children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:w("common.delete")}),e.jsx(Vt,{children:w("contentManagement.deleteMsg")})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{disabled:k.isPending,children:w("common.cancel")}),e.jsx(Wt,{className:"bg-red-600 hover:bg-red-700",disabled:k.isPending||!y,onClick:()=>{y&&k.mutate(y)},children:k.isPending?w("common.deleting","Deleting..."):w("common.delete")})]})]})})]})},Wn=({unitId:t})=>{var R,L;const[r,a]=c.useState([]),[n,s]=c.useState([]),[i,o]=c.useState(!0),[d,m]=c.useState(""),[l,f]=c.useState(null),[y,g]=c.useState("header"),[x,v]=c.useState(null),[p,j]=c.useState(!1),[E,b]=c.useState(null),k=c.useRef(null),N=_e(),u=sa.language,[C,M]=c.useState([]),{data:I}=Wa(t??"",{enabled:!!t}),se=(L=(R=I==null?void 0:I.data)==null?void 0:R.items)==null?void 0:L[0],Y=(se==null?void 0:se.canCreateDirectRecord)??!1,$=At(),[F,_]=c.useState(null),ne=T=>{var P,Z;const h=String(T.key||"").toLowerCase(),U=[(P=T.name)==null?void 0:P.en,(Z=T.name)==null?void 0:Z.am].filter(Boolean).join(" ").toLowerCase();return h.includes("direct")||U.includes("direct")},{recordTypes:X}=Er(),{allDepratments:W}=Er(),xe=c.useCallback(T=>T?u==="am"?T.am||T.en:T.en||T.am:"",[u]),ie=c.useCallback(async()=>{o(!0);try{const[T,h]=await Promise.all([Me.getHeadersByUnitId(t),Me.getFootersByUnitId(t)]),U=T.data.items.filter(q=>q.isCurrent&&q.uploadedSuccessfully),P=h.data.items.filter(q=>q.isCurrent&&q.uploadedSuccessfully),Z=async(q,de)=>Promise.all(q?.map(async fe=>{try{const Q=de==="header"?await Me.getHeaderById(fe.id):await Me.getFooterById(fe.id);return{...fe,presigned:Q.data.presigned}}catch{return fe}})),[ee,te]=await Promise.all([Z(U,"header"),Z(P,"footer")]);a(ee),s(te)}catch{ge.error(w("contentManagement.failedToLoadHeaderFooter"))}finally{o(!1)}},[t]),Ae=async(T,h,U)=>{try{const P={isCurrent:U};h==="header"?await Me.changeHeaderStatus(T,P):await Me.changeFooterStatus(T,P),N.invalidateQueries({queryKey:["headers-footers",t]}),ge.success(w("contentManagement.statusChanged")),ie()}catch{ge.error(w("contentManagement.statusChangeFailed"))}},je=async()=>{if(!d||!l){b(w("contentManagement.provideMsg"));return}j(!0),b(null);try{const T=await(y==="header"?Me.uploadAndCreateHeader(l,d,t,C,F):Me.uploadAndCreateFooter(l,d,t,C,F));T!=null&&T.id&&(y==="header"?await Me.changeHeaderStatus(T.id,{isCurrent:!0}):await Me.changeFooterStatus(T.id,{isCurrent:!0})),ge.success(`${y} ${w("contentManagement.uploadSuccess")}`),k.current&&(k.current.value=""),f(null),m(""),v(null),b(null),M([]),_(null),ie()}catch{b(w("contentManagement.uploadFailed")),ge.error(w("contentManagement.uploadFailed"))}finally{j(!1)}};c.useEffect(()=>{ie()},[ie]);const z=(X==null?void 0:X.filter(T=>Y?!0:!ne(T))?.map(T=>({label:T.key=="direct"?$({en:"Direct Letter",am:"ቀጥታ ደብዳቤ"}):$(T.name),value:T.key})))||[],O=(T,h,U)=>e.jsxs(Ke,{className:"p-6 border shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"font-semibold text-xl dark:text-white",children:T}),e.jsxs("span",{className:"text-sm text-muted-foreground dark:text-gray-400",children:[h.length," ",h.length===1?"item":"items"]})]}),i?e.jsx(et,{className:"h-40"}):h.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-2xl text-gray-400 dark:text-gray-500",children:U==="header"?"📄":"📋"})}),e.jsxs("p",{className:"text-sm text-muted-foreground dark:text-gray-400 mb-2",children:["No ",T.toLowerCase()," found"]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-gray-500",children:["Upload your first ",U," using the form below"]})]}):e.jsx("div",{className:"space-y-4",children:h?.map(P=>e.jsxs("div",{className:`border rounded-lg p-4 ${P.isCurrent?"bg-primary-50 dark:bg-primary-900/30 border-primary-200 dark:border-primary-800 shadow-sm":"bg-white dark:bg-gray-700"}`,children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-lg truncate dark:text-white",children:u==="en"?P.name.en:P.name.am}),P.isCurrent&&e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary-100 dark:bg-primary-900/50 text-primary-800 dark:text-primary-300 flex-shrink-0",children:w("contentManagement.currentlyActive")})]}),e.jsx("p",{className:"text-sm text-muted-foreground dark:text-gray-400 truncate",children:P.fileInfo.fileName})]})}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[P.presigned&&e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:"w-24 h-16 border rounded-md overflow-hidden bg-gray-50 dark:bg-gray-600",children:e.jsx("img",{src:P.presigned,alt:`${U} Preview`,className:"w-full h-full object-contain"})})}),e.jsx("div",{className:"flex items-center gap-2 ml-auto",children:e.jsx(J,{size:"sm",variant:"outline",onClick:()=>Ae(P.id,U,!1),className:"text-red-600 dark:text-red-400 border-red-300 dark:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/30 whitespace-nowrap",children:w("contentManagement.delete")})})]})]},P.id))})]});return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8",children:[O("Headers",r,"header"),O("Footers",n,"footer")]}),e.jsxs(Ke,{className:"p-4 border shadow-sm space-y-4 dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs("h2",{className:"font-semibold text-lg flex items-center gap-2 dark:text-white",children:[e.jsx(ct,{className:"h-5 w-5"})," ",w("contentManagement.addHeaderFooter")]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.name")}),e.jsx(ke,{value:d,onChange:T=>{m(T.target.value),b(null)},placeholder:w("contentManagement.name"),disabled:p,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.type")}),e.jsxs("select",{value:y,onChange:T=>g(T.target.value),className:"w-full rounded border px-3 py-2 text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white",disabled:p,children:[e.jsx("option",{value:"header",children:w("contentManagement.header")}),e.jsx("option",{value:"footer",children:w("contentManagement.footer")})]})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.uploadFile")}),e.jsx(ke,{type:"file",accept:"image/*",ref:k,onChange:T=>{var U;const h=((U=T.target.files)==null?void 0:U[0])||null;if(h){if(h.size>5*1024*1024){b("File size must be less than 5 MB"),k.current&&(k.current.value=""),f(null),v(null);return}f(h),v(URL.createObjectURL(h))}else f(null),v(null);b(null)},disabled:p})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.positions")}),e.jsx(Xa,{options:(W==null?void 0:W?.map(T=>({label:xe(T.name),value:T.id})))??[],value:C,onValueChange:M,placeholder:w("contentManagement.selectPositions"),maxCount:5,className:"w-full max-w-full sm:max-w-md overflow-x-auto",animation:0})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("addRecord.Record Type")}),e.jsxs(ft,{value:F??"",onValueChange:T=>_(T||null),children:[e.jsx(ht,{children:e.jsx(xt,{placeholder:w("addRecord.Select Record Type")})}),e.jsx(yt,{children:z?.map(T=>e.jsx(bt,{value:T.value,children:T.label},T.value))})]})]})]}),x&&e.jsxs("div",{className:"mt-2",children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.preview")}),e.jsx("div",{className:"border rounded p-2 inline-block mt-1 dark:border-gray-600",children:e.jsx("img",{src:x,alt:"Preview",className:"h-24 object-contain rounded"})})]}),E&&e.jsx("p",{className:"text-sm text-red-500",children:E}),e.jsx(J,{onClick:je,disabled:p,className:"bg-primary hover:bg-primary/90 text-primary-foreground w-full",children:p?w("PDF.uploading"):`${w("signatureUpload.upload")} ${y}`})]})]})},Yn=({items:t,isLoading:r,onEdit:a,onDelete:n,showPositionColumn:s=!1,showCountColumn:i=!1,positions:o=[]})=>{const d=_e(),m=b=>{var N,u;const k=o.find(C=>C.id===b);return((N=k==null?void 0:k.name)==null?void 0:N.en)||((u=k==null?void 0:k.name)==null?void 0:u.am)||b},[l,f]=c.useState(null),[y,g]=c.useState(""),x=b=>{var k,N;return((N=(k=b.recordSequences)==null?void 0:k[0])==null?void 0:N.count)??b.count??void 0},v=b=>{var k,N;return((N=(k=b.recordSequences)==null?void 0:k[0])==null?void 0:N.id)??b.sequenceId??void 0},p=b=>{const k=x(b)??0,N=v(b);N&&(f({itemId:N,currentCount:k}),g(String(k)))},j=()=>{f(null),g(""),d.invalidateQueries({queryKey:["prefixes-by-position"]}),d.invalidateQueries({queryKey:["unit-reference-numbers"]})},E=b=>{if(b.preventDefault(),!l)return;const k=parseInt(y,10);isNaN(k)||k<0||Pe.updateCount(l.itemId,k).then(()=>{j()})};return e.jsxs("div",{className:"overflow-x-auto border rounded-lg dark:border-gray-600",children:[e.jsxs("table",{className:"min-w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700 border-b dark:border-gray-600",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 dark:text-white",children:"#"}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("header.amharic")}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("header.english")}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("contentManagement.type")}),s&&e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("contentManagement.position")}),i&&e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("contentManagement.count")}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("userRecord.Actions")})]})}),e.jsx("tbody",{children:r?e.jsx("tr",{children:e.jsx("td",{colSpan:s?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:w("contentManagement.loading")})}):t.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:w("contentManagement.noRec")})}):t?.map((b,k)=>{var N,u;return e.jsxs("tr",{className:"border-b hover:bg-gray-50 dark:hover:bg-gray-700 dark:border-gray-600",children:[e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:k+1}),e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:((N=b.name)==null?void 0:N.am)||"-"}),e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:((u=b.name)==null?void 0:u.en)||"-"}),e.jsxs("td",{className:"px-4 py-3 capitalize dark:text-gray-300",children:[b.type,b.isForCC&&e.jsx("span",{className:"ml-1 text-xs text-purple-600 dark:text-purple-400",children:"(CC)"})]}),s&&e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:b.positionId?m(b.positionId):"-"}),i&&e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:(()=>{const C=x(b);return C===void 0?"-":e.jsx("button",{onClick:()=>p(b),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 underline cursor-pointer",children:C})})()}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>a(b),children:e.jsx(wr,{className:"h-4 w-4"})}),e.jsx(J,{variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300",onClick:()=>n(b.id,b.type,b.recordTypeKey),children:e.jsx(Rt,{className:"h-4 w-4"})})]})})]},b.id)})})]}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 w-80",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold dark:text-white",children:w("contentManagement.updateCount")}),e.jsx("button",{onClick:j,className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:e.jsx(lt,{className:"h-5 w-5"})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs(Ce,{htmlFor:"countValue",className:"dark:text-gray-200",children:[w("contentManagement.value")," *"]}),e.jsx(ke,{id:"countValue",type:"number",min:"0",value:y,onChange:b=>g(b.target.value),placeholder:w("contentManagement.enterValue"),className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[w("contentManagement.currentCount"),":"," ",l.currentCount]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(J,{type:"button",variant:"outline",onClick:j,children:w("common.cancel")}),e.jsx(J,{type:"submit",children:w("common.submit")})]})]})]})})]})},ut=(t,r)=>{var n,s;const a=t;return((s=(n=a==null?void 0:a.response)==null?void 0:n.data)==null?void 0:s.message)||(a==null?void 0:a.message)||r},wt=t=>{var n,s,i;const r=t,a=((s=(n=r==null?void 0:r.response)==null?void 0:n.data)==null?void 0:s.message)||(r==null?void 0:r.message)||"";return((i=r==null?void 0:r.response)==null?void 0:i.status)===400&&/unit not found/i.test(a)},Mr=t=>({data:t,status:200,statusText:"OK",headers:{},config:{}}),Yt={getReferenceNumbers:async t=>{try{return await re.get(`/unit-configurations/${t}/reference-number`)}catch(r){if(wt(r))return Mr([]);throw new Error(ut(r,"Failed to fetch reference numbers"))}},getTagBasedReferences:async(t,r)=>{try{return await re.get(`/record-prefixes/list/${t}/`)}catch(a){if(wt(a))return Mr([]);throw new Error(ut(a,"Failed to fetch reference numbers"))}},getUnitConfiguration:async t=>{try{return await re.get(`/unit-configurations/${t}`)}catch(r){throw new Error(ut(r,"Failed to fetch unit configuration"))}},addReferenceNumber:async(t,r)=>{try{return await re.post(`/unit-configurations/${t}/reference-number`,r)}catch(a){if(wt(a))return await re.post("/unit-configurations",{unitId:t}),await re.post(`/unit-configurations/${t}/reference-number`,r);throw new Error(ut(a,"Failed to add reference numbers"))}},updateInternalMemoReferencePrefix:async(t,r)=>{try{return await re.patch(`/unit-configurations/add-internal-memo-reference-number-prefix/${t}`,r)}catch(a){if(wt(a))return await re.post("/unit-configurations",{unitId:t}),await re.patch(`/unit-configurations/add-internal-memo-reference-number-prefix/${t}`,r);throw new Error(ut(a,"Failed to update internal memo reference prefix"))}},updateExternalReferencePrefix:async(t,r)=>{try{return await re.patch(`/unit-configurations/add-external-reference-number-prefix/${t}`,r)}catch(a){if(wt(a))return await re.post("/unit-configurations",{unitId:t}),await re.patch(`/unit-configurations/add-external-reference-number-prefix/${t}`,r);throw new Error(ut(a,"Failed to update external reference prefix"))}}},fa=t=>Ee({queryKey:["unit-reference-numbers",t],queryFn:()=>Yt.getReferenceNumbers(t),enabled:!!t}),Xn=()=>{const t=_e();return Ne({mutationFn:({unitId:r,payload:a})=>Yt.addReferenceNumber(r,a),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["unit-reference-numbers",a.unitId]}),t.invalidateQueries({queryKey:["unit-configuration",a.unitId]})}})},Jn=()=>{const t=_e();return Ne({mutationFn:({unitId:r,payload:a})=>Yt.updateInternalMemoReferencePrefix(r,a),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["unit-reference-numbers",a.unitId]}),t.invalidateQueries({queryKey:["unit-configuration",a.unitId]})}})},Zn=()=>{const t=_e();return Ne({mutationFn:({unitId:r,payload:a})=>Yt.updateExternalReferencePrefix(r,a),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["unit-reference-numbers",a.unitId]}),t.invalidateQueries({queryKey:["unit-configuration",a.unitId]})}})},es=({open:t,onClose:r,onSuccess:a,unitId:n,cardType:s,recordType:i,editingItem:o,positions:d=[]})=>{var Ae,je;const m=_e(),l=!!o,[f,y]=c.useState(""),[g,x]=c.useState(""),[v,p]=c.useState(""),j=["reference","externalReference","internalMemoReference"].includes(s),E=i==="positionPrefix",b=s.includes("CC"),k=s==="reference",N=s==="externalReference",u=s==="internalMemoReference",C=d.filter(z=>!!(z!=null&&z.id))?.map(z=>{var O,R;return{value:z.id,label:((O=z.name)==null?void 0:O.en)||((R=z.name)==null?void 0:R.am)||z.id}}),M=s==="internalPrefix"?"internal":s==="externalPrefix"?"external":s==="internalMemoPrefix"?"internal_memo":o==null?void 0:o.recordTypeKey,{data:I}=fa(j?n:""),se=Xn(),Y=Jn(),$=Zn(),{handleError:F}=dt(w),_=((je=(Ae=I==null?void 0:I.data)==null?void 0:Ae.items)==null?void 0:je[0])||(I==null?void 0:I.data)||{},ne=Array.isArray(_);ne&&(_==null||_.find(z=>z.name==="referenceNumberPrefix")),ne&&(_==null||_.find(z=>z.name==="externalReferenceNumberPrefix")),ne&&(_==null||_.find(z=>z.name==="internalMemoReferenceNumberPrefix")),c.useEffect(()=>{var z,O,R,L;o?(j?(y(((z=o.name)==null?void 0:z.am)||""),x(((O=o.name)==null?void 0:O.en)||"")):(y(((R=o.name)==null?void 0:R.am)||""),x(((L=o.name)==null?void 0:L.en)||"")),p(o.positionId||"")):(y(""),x(""),p(""))},[o,j]),c.useEffect(()=>{if(!(!j||o)){if(k){y(_.referenceNumberPrefix||""),x(_.referenceNumberPrefix||"");return}if(N){y(_.externalReferenceNumberPrefix||""),x(_.externalReferenceNumberPrefix||"");return}u&&(y(_.internalMemoReferenceNumberPrefix||""),x(_.internalMemoReferenceNumberPrefix||""))}},[o,j,k,N,u,_.referenceNumberPrefix,_.externalReferenceNumberPrefix,_.internalMemoReferenceNumberPrefix]);const{mutate:X,isPending:W}=Ne({mutationFn:async()=>{const z=i,O=j||E||s==="prefix"||s==="prefixCC"||s==="internalPrefix"||s==="externalPrefix"||s==="internalMemoPrefix";let R,L;if(j){if(k){await se.mutateAsync({unitId:n,payload:{referenceNumberPrefix:{am:f,en:g}}});return}if(N){await $.mutateAsync({unitId:n,payload:{externalReferenceNumberPrefix:{am:f,en:g}}});return}if(u){await Y.mutateAsync({unitId:n,payload:{internalMemoReferenceNumberPrefix:{am:f,en:g}}});return}}else if(E){if(M!=="internal"&&M!=="external"&&M!=="internal_memo")throw new Error("Position prefix requires internal, external, or internal_memo recordTypeKey");R={unitId:n,recordTypeKey:M,isForCC:!1,positionId:v,name:{am:f,en:g}}}else{const T={unitId:n,recordTypeKey:z,isForCC:b,name:{am:f,en:g}};s==="suffix"||s==="suffixCC"?L=T:R=T}if(l){if(O&&R)return Pe.editPrefix(o.id,R);if(L)return Pe.editSuffix(o.id,L);throw new Error("Invalid prefix/suffix payload for update")}if(O&&R)return Pe.createPrefix(R);if(L)return Pe.createSuffix(L);throw new Error("Invalid prefix/suffix payload for create")},onSuccess:()=>{m.invalidateQueries({queryKey:["prefixSuffix"]}),ge.success(w("msg.successfullyCompleted")),a()},onError:z=>{F(z)}}),xe=z=>{z.preventDefault(),X()},ie=()=>j?f.trim()!==""&&g.trim()!=="":E?f.trim()!==""&&g.trim()!==""&&v:f.trim()!==""&&g.trim()!=="";return e.jsx(Qe,{open:t,onOpenChange:r,children:e.jsxs(Ge,{className:"sm:max-w-[500px] dark:bg-gray-800",children:[e.jsx(We,{children:e.jsxs(Ye,{className:"dark:text-white",children:[l?w("contentManagement.edit"):w("contentManagement.add")," ",w(`contentManagement.${s}`)]})}),e.jsxs("form",{onSubmit:xe,className:"space-y-4",children:[j?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameAm",className:"dark:text-gray-200",children:[w("contentManagement.amharicName")," *"]}),e.jsx(ke,{id:"nameAm",value:f,onChange:z=>y(z.target.value),placeholder:w("contentManagement.amharicName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameEn",className:"dark:text-gray-200",children:[w("contentManagement.englishName")," *"]}),e.jsx(ke,{id:"nameEn",value:g,onChange:z=>x(z.target.value),placeholder:w("contentManagement.englishName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameAm",className:"dark:text-gray-200",children:[w("contentManagement.amharicName")," *"]}),e.jsx(ke,{id:"nameAm",value:f,onChange:z=>y(z.target.value),placeholder:w("contentManagement.amharicName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameEn",className:"dark:text-gray-200",children:[w("contentManagement.englishName")," *"]}),e.jsx(ke,{id:"nameEn",value:g,onChange:z=>x(z.target.value),placeholder:w("contentManagement.englishName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]})]}),E&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"position",className:"dark:text-gray-200",children:[w("contentManagement.position")," *"]}),e.jsx(Za,{options:C,value:v,onValueChange:p,placeholder:w("contentManagement.selectPosition"),className:W?"pointer-events-none opacity-60":""})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(J,{type:"button",variant:"outline",onClick:r,disabled:W,children:w("common.Cancel")}),e.jsx(J,{type:"submit",disabled:!ie()||W,className:"bg-purple-600 hover:bg-purple-700",children:W?w("contentManagement.saving"):k&&(_.referenceNumberPrefix||_.externalReferenceNumberPrefix||_.internalMemoReferenceNumberPrefix)||l?w("common.update"):w("common.save")})]})]})]})})},ts=(t,r,a=0,n=10)=>Ee({queryKey:["prefixes",t,r,{cc:!1}],queryFn:()=>Pe.getPrefix(t,r,a,n),enabled:!!t&&!!r}),rs=(t,r,a=0,n=10)=>Ee({queryKey:["prefixes",t,r,{cc:!0}],queryFn:()=>Pe.getPrefixCC(t,r,a,n),enabled:!!t&&!!r}),as=(t,r,a=0,n=10)=>Ee({queryKey:["prefixes-by-position",t,r],queryFn:()=>Pe.getPrefixByPosition(t,r,a,n),enabled:!!t&&!!r}),ns=()=>{const t=_e();return Ne({mutationFn:({id:r})=>Pe.deletePrefix(r),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["prefixes",a.unitId,a.recordTypeKey,{cc:a.isForCC}]}),t.invalidateQueries({queryKey:["prefix",a.id]})}})},ss=(t,r,a=0,n=10)=>Ee({queryKey:["suffixes",t,r,{cc:!1}],queryFn:()=>Pe.getSuffix(t,r,a,n),enabled:!!t&&!!r}),is=(t,r,a=0,n=10)=>Ee({queryKey:["suffixes",t,r,{cc:!0}],queryFn:()=>Pe.getSuffixCC(t,r,a,n),enabled:!!t&&!!r}),os=()=>{const t=_e();return Ne({mutationFn:({id:r})=>Pe.deleteSuffix(r),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["suffixes",a.unitId,a.recordTypeKey,{cc:a.isForCC}]}),t.invalidateQueries({queryKey:["suffix",a.id]})}})},ls=({unitId:t,recordTagId:r,skip:a=0,take:n=10})=>{const{t:s}=Ie(),{handleError:i}=dt(s),o=_e(),{data:d,isLoading:m,isError:l,refetch:f}=Ee({queryKey:["recordTagPrefixes",t,r,a,n],queryFn:async()=>{const{data:p}=await Pe.getPrefixByRecordTagId(t,r,a,n);return p},enabled:!!t&&!!r,staleTime:300*1e3,retry:!1}),{mutate:y,isPending:g}=Ne({mutationFn:async p=>{const{data:j}=await Pe.createPrefix(p);return j},onSuccess:()=>{ge.success(s("prefixes.createdSuccess")||"Prefix created successfully ✅"),o.invalidateQueries({queryKey:["recordTagPrefixes",t,r]})},onError:p=>{i(p)}}),{mutate:x,isPending:v}=Ne({mutationFn:async p=>{const{data:j}=await Pe.deletePrefix(p);return j},onSuccess:()=>{ge.success(s("prefixes.deletedSuccess")||"Prefix deleted successfully 🗑️"),o.invalidateQueries({queryKey:["recordTagPrefixes",t,r]})},onError:p=>{i(p)}});return{prefixes:(d==null?void 0:d.items)??[],total:(d==null?void 0:d.count)??0,isLoadingPrefixes:m,isErrorPrefixes:l,refetchPrefixes:f,createPrefix:y,isCreatingPrefix:g,deletePrefix:x,isDeletingPrefix:v}},kt={getRecordTags:t=>He.get(`/record-tags/${t}`,{headers:ae()}),getRecordTagsListWithUnitById:t=>He.get(`/record-tags/list/${t}`,{headers:ae()}),createRecordTags:t=>He.post("/record-tags",{...t,recordTypeKey:"external"},{headers:ae()}),updateEmployee:(t,r)=>He.put(`/record-tags/${t}`,r,{headers:ae()}),deleteEmployee:t=>He.delete(`/record-tags/${t}`,{headers:ae()})},Mt=({unitId:t,recordTagId:r})=>{const{t:a}=Ie(),{handleError:n}=dt(a),{data:s,isLoading:i,isError:o,refetch:d}=Ee({queryKey:["recordTagsList",t],queryFn:async()=>{const{data:b}=await kt.getRecordTagsListWithUnitById(t);return b},enabled:!!t,staleTime:300*1e3,retry:!1}),{data:m,isLoading:l,isError:f,refetch:y}=Ee({queryKey:["recordTag",r],queryFn:async()=>{const{data:b}=await kt.getRecordTags(r);return b},enabled:!!r,staleTime:300*1e3,retry:!1}),{mutate:g,isPending:x}=Ne({mutationFn:async b=>{const{data:k}=await kt.createRecordTags(b);return k},onSuccess:()=>{ge.success("Record Tag created successfully ✅"),d()},onError:b=>{n(b)}}),{mutate:v,isPending:p}=Ne({mutationFn:async({id:b,payload:k})=>{const{data:N}=await kt.updateEmployee(b,k);return N},onSuccess:()=>{ge.success("Record Tag updated successfully ✨"),d()},onError:b=>{n(b)}}),{mutate:j,isPending:E}=Ne({mutationFn:async b=>{const{data:k}=await kt.deleteEmployee(b);return k},onSuccess:()=>{ge.success("Record Tag deleted successfully 🗑️"),d()},onError:b=>{n(b)}});return{recordTagsList:s,isLoadingRecordTagsList:i,isErrorRecordTagsList:o,refetchRecordTagsList:d,recordTag:m,isLoadingRecordTag:l,isErrorRecordTag:f,refetchRecordTag:y,createRecordTag:g,isCreatingRecordTag:x,updateRecordTag:v,isUpdatingRecordTag:p,deleteRecordTag:j,isDeletingRecordTag:E}};function cs({unitId:t,selectedTagIds:r,onChange:a,placeholder:n="Select tags...",multiple:s=!0,disabled:i=!1,className:o,maxDisplayTags:d=3,error:m}){const{t:l}=Ie(),[f,y]=c.useState(!1),g=At(),{recordTagsList:x,isLoadingRecordTagsList:v,isErrorRecordTagsList:p}=Mt({unitId:t}),j=(x==null?void 0:x.items)??[],E=j.filter(u=>r.includes(u.id)),b=c.useCallback(u=>{s?a(r.includes(u)?r.filter(C=>C!==u):[...r,u]):(a(r.includes(u)?[]:[u]),y(!1))},[s,a,r]),k=c.useCallback((u,C)=>{u.stopPropagation(),a(r.filter(M=>M!==C))},[a,r]),N=c.useCallback(u=>{u.stopPropagation(),a([])},[a]);return e.jsxs("div",{className:be("flex flex-col gap-1.5",o),children:[e.jsxs(en,{open:f,onOpenChange:y,children:[e.jsx(tn,{asChild:!0,children:e.jsxs(J,{variant:"outline",role:"combobox","aria-expanded":f,disabled:i||v,className:be("w-full justify-between min-h-[40px] h-auto px-3 py-2",!s&&E.length>0&&"justify-start gap-2",m&&"border-destructive ring-destructive","hover:bg-accent"),children:[v?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(lr,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:l("common.loading")})]}):E.length===0?e.jsx("span",{className:"text-muted-foreground text-sm",children:n}):s?e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 flex-1",children:[E.slice(0,d)?.map(u=>e.jsxs(cr,{variant:"secondary",className:"gap-1 px-2 py-0.5 text-xs font-medium cursor-default",style:{backgroundColor:u.color?`${u.color}20`:void 0,color:u.color,borderColor:u.color},children:[u.name,e.jsx(lt,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:C=>k(C,u.id)})]},u.id)),E.length>d&&e.jsxs(cr,{variant:"secondary",className:"text-xs",children:["+",E.length-d]})]}):e.jsx("div",{className:"flex items-center gap-2 flex-1",children:e.jsx("span",{className:"text-sm",children:g(E[0].name)})}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[E.length>0&&!i&&e.jsx(lt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground cursor-pointer",onClick:N}),e.jsx(wn,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})]})}),e.jsx(rn,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(an,{children:[e.jsx(nn,{placeholder:l("common.search")||"Search tags..."}),e.jsxs(sn,{children:[e.jsx(on,{children:p?e.jsx("div",{className:"py-6 text-center text-sm text-destructive",children:l("common.errorLoading")}):l("common.noResults")||"No tags found."}),e.jsx(ln,{children:j?.map(u=>{const C=r.includes(u.id);return e.jsx(cn,{value:u.id,onSelect:()=>b(u.id),className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:be("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",C?"bg-primary text-primary-foreground":"opacity-50"),children:C&&e.jsx(_a,{className:"h-3 w-3"})}),e.jsx("span",{className:"flex-1 text-sm",children:g(u.name)})]})},u.id)})})]})]})})]}),m&&e.jsx("p",{className:"text-xs text-destructive",children:m})]})}function ds({className:t,...r}){return e.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:be("mx-auto flex w-full justify-center",t),...r})}function us({className:t,...r}){return e.jsx("ul",{"data-slot":"pagination-content",className:be("flex flex-row items-center gap-1",t),...r})}function ar({...t}){return e.jsx("li",{"data-slot":"pagination-item",...t})}function Nr({className:t,isActive:r,size:a="icon",...n}){return e.jsx("a",{"aria-current":r?"page":void 0,"data-slot":"pagination-link","data-active":r,className:be(Da({variant:r?"outline":"ghost",size:a}),t),...n})}function ms({className:t,...r}){return e.jsxs(Nr,{"aria-label":"Go to previous page",size:"default",className:be("gap-1 px-2.5 sm:pl-2.5",t),...r,children:[e.jsx(ma,{}),e.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function gs({className:t,...r}){return e.jsxs(Nr,{"aria-label":"Go to next page",size:"default",className:be("gap-1 px-2.5 sm:pr-2.5",t),...r,children:[e.jsx("span",{className:"hidden sm:block",children:"Next"}),e.jsx(vr,{})]})}function ps({unitId:t,className:r}){const{t:a}=Ie(),n=At(),[s,i]=c.useState(""),[o,d]=c.useState(!1),[m,l]=c.useState(null),[f,y]=c.useState(1),g=10,x=(f-1)*g,{recordTagsList:v,isLoadingRecordTagsList:p}=Mt({unitId:t}),{prefixes:j,total:E,isLoadingPrefixes:b,isErrorPrefixes:k,createPrefix:N,isCreatingPrefix:u,deletePrefix:C,isDeletingPrefix:M}=ls({unitId:t,recordTagId:s||void 0,skip:x,take:g}),I=Math.ceil(E/g);c.useEffect(()=>{y(1)},[s]);const se=c.useMemo(()=>{var F;return(F=v==null?void 0:v.items)==null?void 0:F.find(_=>_.id===s)},[v,s]),Y=c.useCallback(F=>{var xe,ie;F.preventDefault();const _=new FormData(F.currentTarget),ne=(xe=_.get("nameAm"))==null?void 0:xe.trim(),X=(ie=_.get("nameEn"))==null?void 0:ie.trim();if(!ne||!X)return;N({name:{am:ne,en:X},unitId:t,isForCC:!1,recordTagId:s||void 0},{onSuccess:()=>{d(!1)}})},[N,s,t]),$=c.useCallback(()=>{m&&C(m,{onSuccess:()=>l(null)})},[C,m]);return e.jsxs("div",{className:be("space-y-6",r),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-end gap-4",children:[e.jsxs("div",{className:"flex-1 w-full sm:w-auto space-y-2",children:[e.jsx(Ce,{className:"text-sm font-medium",children:a("nav.selectTag")||"Select Record Tag"}),e.jsx(cs,{unitId:t,selectedTagIds:s?[s]:[],onChange:F=>i(F[0]||""),placeholder:a("nav.selectTag")||"Choose a tag to view prefixes...",multiple:!1,disabled:p})]}),e.jsxs(Qe,{open:o,onOpenChange:d,children:[e.jsx(jr,{asChild:!0,children:e.jsxs(J,{className:"shrink-0",disabled:!s||b,children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),a("contentManagement.addPrefix")||"Add Prefix"]})}),e.jsxs(Ge,{className:"sm:max-w-[500px]",children:[e.jsx(We,{children:e.jsx(Ye,{children:a("contentManagement.addPrefix")||"Add New Prefix"})}),e.jsxs("form",{id:"add-prefix-form",onSubmit:Y,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameAm",className:"dark:text-gray-200",children:[a("contentManagement.amharicName")," *"]}),e.jsx(ke,{id:"nameAm",name:"nameAm",placeholder:a("contentManagement.amharicName"),required:!0,autoFocus:!0,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameEn",className:"dark:text-gray-200",children:[a("contentManagement.englishName")," *"]}),e.jsx(ke,{id:"nameEn",name:"nameEn",placeholder:a("contentManagement.englishName"),required:!0,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]})]}),e.jsxs(Ia,{children:[e.jsx(J,{type:"button",variant:"outline",onClick:()=>d(!1),children:a("common.cancel")||"Cancel"}),e.jsxs(J,{type:"submit",form:"add-prefix-form",disabled:u,children:[u&&e.jsx(lr,{className:"h-4 w-4 mr-2 animate-spin"}),a("common.save")||"Save"]})]})]})]})]}),se&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:"Showing prefixes for:"}),e.jsx(cr,{variant:"outline",children:n(se.name)}),e.jsxs("span",{className:"text-xs",children:["(",E," items)"]})]}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(la,{children:[e.jsx(ca,{children:e.jsxs(Ze,{children:[e.jsx(Ve,{className:"w-[80px]",children:a("common.no")||"#"}),e.jsx(Ve,{children:a("contentManagement.amharicName")}),e.jsx(Ve,{children:a("contentManagement.englishName")}),e.jsx(Ve,{children:a("contentManagement.createdAt")||"Created"}),e.jsx(Ve,{className:"w-[100px] text-right",children:a("common.actions")||"Actions"})]})}),e.jsxs(da,{children:[b&&e.jsx(e.Fragment,{children:Array.from({length:5})?.map((F,_)=>e.jsxs(Ze,{children:[e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-8"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-24"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-20"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-32"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-24"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-8 w-8 ml-auto"})})]},`skeleton-${_}`))}),k&&!b&&e.jsx(Ze,{children:e.jsx(Te,{colSpan:6,className:"h-32 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(dn,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm",children:a("common.errorLoading")||"Failed to load prefixes"}),e.jsx(J,{variant:"outline",size:"sm",onClick:()=>window.location.reload(),children:a("common.retry")||"Retry"})]})})}),!b&&!k&&e.jsxs(e.Fragment,{children:[!s&&e.jsx(Ze,{children:e.jsx(Te,{colSpan:6,className:"h-32 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("span",{className:"text-2xl",children:"🏷️"}),e.jsx("p",{className:"text-sm",children:a("nav.selectTag")||"Select a tag above to view its prefixes"})]})})}),s&&j.length===0&&e.jsx(Ze,{children:e.jsx(Te,{colSpan:6,className:"h-32 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx(ct,{className:"h-8 w-8 opacity-50"}),e.jsx("p",{className:"text-sm",children:a("nav.emptyState")||"No prefixes found for this tag"}),e.jsx(J,{variant:"outline",size:"sm",onClick:()=>d(!0),children:a("nav.addNew")||"Add your first prefix"})]})})}),j?.map((F,_)=>{var ne,X;return e.jsxs(Ze,{className:"group",children:[e.jsx(Te,{className:"text-muted-foreground text-sm",children:x+_+1}),e.jsx(Te,{className:"font-medium",children:((ne=F.name)==null?void 0:ne.am)||e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(Te,{children:((X=F.name)==null?void 0:X.en)||e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(Te,{className:"text-muted-foreground text-sm",children:new Date(F.createdAt).toLocaleDateString()}),e.jsx(Te,{className:"text-right",children:e.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>l(F.id),disabled:M,children:e.jsx(Rt,{className:"h-4 w-4"})})})]},F.id)})]})]})]})}),I>1&&e.jsx(ds,{children:e.jsxs(us,{children:[e.jsx(ar,{children:e.jsx(ms,{onClick:()=>y(F=>Math.max(1,F-1)),className:be(f===1&&"pointer-events-none opacity-50")})}),Array.from({length:I},(F,_)=>_+1)?.map(F=>e.jsx(ar,{children:e.jsx(Nr,{isActive:f===F,onClick:()=>y(F),children:F})},F)),e.jsx(ar,{children:e.jsx(gs,{onClick:()=>y(F=>Math.min(I,F+1)),className:be(f===I&&"pointer-events-none opacity-50")})})]})}),e.jsx(Bt,{open:!!m,onOpenChange:F=>!F&&l(null),children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:a("prefixes.deleteConfirmTitle")||"Delete Prefix?"}),e.jsx(Vt,{children:a("prefixes.deleteConfirmDescription")||"This action cannot be undone. This will permanently delete the prefix."})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{disabled:M,children:a("common.cancel")||"Cancel"}),e.jsxs(Wt,{onClick:$,disabled:M,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[M&&e.jsx(lr,{className:"h-4 w-4 mr-2 animate-spin"}),a("common.delete")||"Delete"]})]})]})})]})}const fs=[{id:"internal",label:"nav.internal"},{id:"external",label:"nav.external"},{id:"internal_memo",label:"nav.internal_memo"},{id:"branch",label:"nav.branch"},{id:"tag-based-reference",label:"nav.tagBasedReference"},{id:"referenceNumber",label:"userRecord.Reference"},{id:"positionPrefix",label:"contentManagement.positionPrefixes"}],Nt=t=>t==="positionPrefix"?"internalPrefix":t==="referenceNumber"?"reference":"prefix",hs=({unitId:t,initialTab:r="internal"})=>{var H,ue,D,we,S,B,V;const{handleError:a}=dt(w),[n,s]=c.useState(r),[i,o]=c.useState(Nt(r)),[d,m]=c.useState(!1),[l,f]=c.useState(null),y=_e(),{mutateAsync:g}=ns(),{mutateAsync:x}=os(),{usePositionListByUnitId:v}=Ja(),{data:p}=v(t,{take:1e3,skip:0}),j=(p==null?void 0:p.items)||[];c.useEffect(()=>{s(r),o(Nt(r))},[r]),c.useEffect(()=>{o(Nt(n))},[n]);const E=A=>{f({cardType:A,recordType:n}),m(!0)},b=A=>{f({cardType:A.type,recordType:n,editingItem:A}),m(!0)},k=async(A,K,he)=>{if(K==="reference"||K==="externalReference"||K==="internalMemoReference"){ge.error(w("msg.errorOccurred"));return}const Oe=K==="prefix"||K==="prefixCC"||K==="internalPrefix"||K==="externalPrefix"||K==="internalMemoPrefix",ce=K==="prefixCC"||K==="suffixCC",ve=he||(K==="internalPrefix"?"internal":K==="externalPrefix"?"external":K==="internalMemoPrefix"?"internal_memo":n);try{Oe?(await g({id:A,unitId:t,recordTypeKey:ve,isForCC:ce}),n==="positionPrefix"&&y.invalidateQueries({queryKey:["prefixes-by-position",t,ve]})):await x({id:A,unitId:t,recordTypeKey:ve,isForCC:ce}),y.invalidateQueries({queryKey:["prefixSuffix"]}),ge.success(w("contentManagement.deleted"))}catch(qe){a(qe)}},N=()=>{m(!1),f(null)},u=()=>{const A=(l==null?void 0:l.cardType)??i,K=(l==null?void 0:l.recordType)??n,he=A==="prefixCC"||A==="suffixCC",Ue=A==="prefix"||A==="prefixCC"||A==="internalPrefix"||A==="externalPrefix"||A==="internalMemoPrefix"||K==="referenceNumber",Oe=K==="referenceNumber"?A:K==="positionPrefix"?A==="internalPrefix"?"internal":A==="internalMemoPrefix"?"internal_memo":"external":K;Ue?(K==="positionPrefix"&&y.invalidateQueries({queryKey:["prefixes-by-position",t,Oe]}),y.invalidateQueries({queryKey:["prefixes",t,Oe,{cc:he}]})):y.invalidateQueries({queryKey:["suffixes",t,Oe,{cc:he}]}),y.invalidateQueries({queryKey:["prefixSuffix"]}),N()},M=n==="positionPrefix"?[{id:"internalPrefix",label:"contentManagement.internalPrefix"},{id:"externalPrefix",label:"contentManagement.externalPrefix"},{id:"internalMemoPrefix",label:"contentManagement.internalMemoPrefix"}]:n==="referenceNumber"?[{id:"reference",label:"contentManagement.reference"},{id:"externalReference",label:"contentManagement.externalReference"},{id:"internalMemoReference",label:"contentManagement.internalMemoReference"}]:[{id:"prefix",label:"contentManagement.prefix"},{id:"suffix",label:"contentManagement.suffix"},{id:"prefixCC",label:"contentManagement.prefixCC"},{id:"suffixCC",label:"contentManagement.suffixCC"}];c.useEffect(()=>{var A;M?.some(K=>K.id===i)||o(((A=M[0])==null?void 0:A.id)||Nt(n))},[M,i,n]);const I=i==="prefixCC"||i==="suffixCC",se=n==="referenceNumber",Y=n==="positionPrefix",$=n==="tag-based-reference",F=i==="prefix"||i==="prefixCC"||i==="internalPrefix"||i==="externalPrefix"||i==="internalMemoPrefix"||se,_=i==="internalPrefix"?"internal":i==="externalPrefix"?"external":i==="internalMemoPrefix"?"internal_memo":"",ne=n==="positionPrefix"?_:n,{data:X,isLoading:W,error:xe}=fa(se?t:""),{data:ie,isLoading:Ae,error:je}=ts(t,F&&!I&&!se&&!Y&&!$?ne:"",0,1e3),{data:z,isLoading:O,error:R}=as(t,Y?_:"",0,1e3),{data:L,isLoading:T,error:h}=rs(t,F&&I&&!se?ne:"",0,1e3),{data:U,isLoading:P,error:Z}=ss(t,!F&&!I&&!se?ne:"",0,1e3),{data:ee,isLoading:te,error:q}=is(t,!F&&I&&!se?ne:"",0,1e3),de=c.useMemo(()=>[xe,R,je,h,Z,q].find(Boolean),[xe,R,je,h,Z,q]),fe=c.useRef(null);c.useEffect(()=>{!de||de===fe.current||(fe.current=de,a(de))},[de,a]);const Q=(X==null?void 0:X.data)||[],le=Q==null?void 0:Q.find(A=>A.name==="referenceNumberPrefix"),G=Q==null?void 0:Q.find(A=>A.name==="externalReferenceNumberPrefix"),oe=Q==null?void 0:Q.find(A=>A.name==="internalMemoReferenceNumberPrefix"),Re=A=>{if(!A)return"";if(typeof A=="string")try{const K=JSON.parse(A);return(K==null?void 0:K.am)??A}catch{return A}return typeof A=="object"?(A==null?void 0:A.am)??"":""},ye=[{id:"referenceNumberPrefix",type:"reference",recordTypeKey:"reference",isForCC:!1,name:{am:Re(le==null?void 0:le.number),en:Re((H=le==null?void 0:le.number)==null?void 0:H.en)},count:(le==null?void 0:le.count)??0,sequenceId:le==null?void 0:le.sequenceId},{id:"externalReferenceNumberPrefix",type:"externalReference",recordTypeKey:"externalReference",isForCC:!1,name:{am:Re((ue=G==null?void 0:G.number)==null?void 0:ue.am),en:Re((D=G==null?void 0:G.number)==null?void 0:D.en)},count:(G==null?void 0:G.count)??0,sequenceId:G==null?void 0:G.sequenceId},{id:"internalMemoReferenceNumberPrefix",type:"internalMemoReference",recordTypeKey:"internalMemoReference",isForCC:!1,name:{am:Re((we=oe==null?void 0:oe.number)==null?void 0:we.am),en:Re((S=oe==null?void 0:oe.number)==null?void 0:S.en)},count:(oe==null?void 0:oe.count)??0,sequenceId:oe==null?void 0:oe.sequenceId}].filter(A=>A.type===i),$e=Y?z:F?I?L:ie:I?ee:U,ze=se?ye:((V=(B=$e==null?void 0:$e.data)==null?void 0:B.items)==null?void 0:V?.map(A=>({...A,type:n==="positionPrefix"?A.recordTypeKey==="internal"?"internalPrefix":A.recordTypeKey==="internal_memo"?"internalMemoPrefix":"externalPrefix":F?I?"prefixCC":"prefix":I?"suffixCC":"suffix",isForCC:I||A.isForCC})))||[],Se=W||O||Ae||T||P||te;return e.jsxs("div",{className:"space-y-6 p-4",children:[e.jsx("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:fs?.map(A=>e.jsx("button",{onClick:()=>{s(A.id),o(Nt(A.id))},className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${n===A.id?"border-purple-600 text-purple-600 dark:text-purple-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-300 dark:hover:border-gray-600"}`,children:w(A.label)},A.id))}),n==="tag-based-reference"?e.jsx(ps,{unitId:t,className:"w-full"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-4",children:M?.map(A=>e.jsx(Ke,{onClick:()=>o(A.id),className:`inline-flex w-fit min-w-[260px] max-w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer dark:bg-gray-800 dark:border-gray-700 ${i===A.id?"ring-2 ring-purple-600 dark:ring-purple-400":""}`,children:e.jsx(it,{className:"pb-2 items-center",children:e.jsx(ot,{className:"text-sm font-medium text-gray-700 dark:text-gray-200 text-center whitespace-nowrap",children:w(A.label)})})},A.id))}),e.jsx("div",{className:"flex justify-end mb-4",children:e.jsxs(J,{onClick:()=>E(i),children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),w("contentManagement.add")]})}),e.jsx(Yn,{items:ze,isLoading:Se,onEdit:b,onDelete:k,showPositionColumn:n==="positionPrefix",showCountColumn:n==="positionPrefix"||n==="referenceNumber",positions:j}),d&&l&&e.jsx(es,{open:d,onClose:N,onSuccess:u,unitId:t,cardType:l.cardType,recordType:l.recordType,editingItem:l.editingItem,positions:j})]})]})},xs=async t=>(await re.get(`/units/${t}/requirement-satisfied`,{headers:ae()})).data;function ys({unitId:t}){const[r,a]=c.useState(t||""),[n,s]=c.useState(!0);c.useEffect(()=>{const l=f=>a(f.detail);return window.addEventListener("unitChanged",l),()=>window.removeEventListener("unitChanged",l)},[]);const{data:i,isLoading:o,refetch:d}=Ee({queryKey:["admin-setup-requirements",r],queryFn:()=>xs(r),enabled:!!r}),m=i==null?void 0:i.requirements;return c.useEffect(()=>{r&&d()},[r,d]),!m||Object.values(m).every(Boolean)||!n?null:e.jsxs("div",{className:"relative flex items-center gap-6 p-2 border rounded bg-amber-50 shadow-2xl top-10 left-1/2 -translate-x-1/2 z-[1000] w-full",children:[e.jsx("h3",{className:"font-semibold text-amber-700 whitespace-nowrap",children:"Finish site setup"}),o?e.jsx("p",{className:"text-sm text-slate-600",children:"Loading requirements..."}):e.jsxs("div",{className:"flex flex-wrap gap-6 text-sm text-slate-600",children:[!m.hasFooter&&e.jsx("span",{children:"⚠️ Missing Footer"}),!m.hasSeal&&e.jsx("span",{children:"⚠️ Missing Seal"}),!m.hasHeader&&e.jsx("span",{children:"⚠️ Missing Header"}),!m.internalPrefix&&e.jsx("span",{children:"⚠️ Missing Internal Prefix"}),!m.externalPrefix&&e.jsx("span",{children:"⚠️ Missing External Prefix"}),!m.internalSuffix&&e.jsx("span",{children:"⚠️ Missing Internal Suffix"}),!m.externalSuffix&&e.jsx("span",{children:"⚠️ Missing External Suffix"})]}),e.jsx("button",{onClick:()=>s(!1),className:"absolute top-2 right-2 text-amber-700 hover:text-red-600",children:e.jsx(lt,{size:16})})]})}const bs=gn({nameAm:Lt().min(1,"Amharic name is required"),nameEn:Lt().min(1,"English name is required"),key:Lt().min(1,"Key is required"),unitId:Lt().min(1,"Unit is required")});function ha({defaultValues:t,unitId:r,mode:a,id:n,onSuccess:s}){const i=ua({resolver:mn(bs),defaultValues:{nameAm:(t==null?void 0:t.nameAm)??"",nameEn:(t==null?void 0:t.nameEn)??"",key:(t==null?void 0:t.key)??"",unitId:(t==null?void 0:t.unitId)??r}}),{createRecordTag:o,updateRecordTag:d,isCreatingRecordTag:m,isUpdatingRecordTag:l}=Mt({unitId:r}),f=y=>{if(a==="create"){const g={name:{am:y.nameAm,en:y.nameEn},key:y.key,unitId:y.unitId};o(g,{onSuccess:()=>{i.reset(),s==null||s()}})}else if(a==="edit"&&n){const g={name:{am:y.nameAm,en:y.nameEn},key:y.key,unitId:y.unitId};d({id:n,payload:g},{onSuccess:()=>{s==null||s()}})}};return e.jsx(pn,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(f),className:"space-y-4",children:[e.jsx(Jt,{control:i.control,name:"nameAm",render:({field:y})=>e.jsxs(Zt,{children:[e.jsx(er,{children:"Amharic Name"}),e.jsx(tr,{children:e.jsx(ke,{placeholder:"Enter Amharic name",...y})}),e.jsx(rr,{})]})}),e.jsx(Jt,{control:i.control,name:"nameEn",render:({field:y})=>e.jsxs(Zt,{children:[e.jsx(er,{children:"English Name"}),e.jsx(tr,{children:e.jsx(ke,{placeholder:"Enter English name",...y})}),e.jsx(rr,{})]})}),e.jsx(Jt,{control:i.control,name:"key",render:({field:y})=>e.jsxs(Zt,{children:[e.jsx(er,{children:"Key"}),e.jsx(tr,{children:e.jsx(ke,{placeholder:"Unique key",...y})}),e.jsx(rr,{})]})}),e.jsx(J,{type:"submit",disabled:m||l,children:a==="create"?m?"Creating...":"Create":l?"Updating...":"Update"})]})})}function vs({row:t,unitId:r}){var x,v,p;const[a,n]=c.useState(!1),[s,i]=c.useState(!1),[o,d]=c.useState(!1),{deleteRecordTag:m,refetchRecordTagsList:l}=Mt({unitId:r}),{t:f}=Ie(),{handleError:y}=dt(f),g=()=>{d(!0),m(t.id,{onSuccess:()=>{l(),i(!1)},onError:j=>{y(j)},onSettled:()=>{d(!1)}})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{variant:"outline",size:"sm",onClick:()=>n(!0),children:e.jsx(wr,{className:"h-4 w-4"})}),e.jsx(J,{variant:"destructive",size:"sm",onClick:()=>i(!0),children:e.jsx(Rt,{className:"h-4 w-4"})})]}),e.jsx(Qe,{open:a,onOpenChange:n,children:e.jsxs(Ge,{children:[e.jsx(We,{children:e.jsx(Ye,{children:"Edit Record Tag"})}),e.jsx(ha,{unitId:r,mode:"edit",id:t.id,defaultValues:{nameAm:((x=t.name)==null?void 0:x.am)??"",nameEn:((v=t.name)==null?void 0:v.en)??"",key:t.key,unitId:t.unitId},onSuccess:()=>{n(!1),l()}})]})}),e.jsx(Bt,{open:s,onOpenChange:i,children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:"Are you sure you want to delete this record tag?"}),e.jsxs(Vt,{children:["This action cannot be undone. The record tag ",e.jsx("b",{children:(p=t.name)==null?void 0:p.en})," ","will be permanently removed."]})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{disabled:o,children:"Cancel"}),e.jsx(Wt,{onClick:g,disabled:o,className:"bg-red-600 hover:bg-red-700",children:o?"Deleting...":"Delete"})]})]})})]})}const js=t=>[{accessorKey:"name",header:()=>w("recordTag.name"),cell:({row:r})=>{var s;const a=At(),n=(s=r.original)==null?void 0:s.name;return e.jsx("span",{children:a(n)})}},{accessorKey:"key",header:()=>w("recordTag.key"),cell:({row:r})=>{var n;const a=(n=r.original)==null?void 0:n.key;return e.jsx("span",{children:a||"--"})}},{accessorKey:"createdAt",header:()=>w("recordTag.CreatedAt"),cell:({row:r})=>{var n;const a=(n=r.original)==null?void 0:n.createdAt;return e.jsx("span",{children:a?fn(new Date(a),"MMM d, yyyy HH:mm"):"--"})}},{id:"actions",header:()=>w("recordTag.Actions"),cell:({row:r})=>e.jsx(vs,{row:r.original,unitId:t})}];function ws({unitId:t}){const[r,a]=c.useState(0),[n,s]=c.useState(!1),{t:i}=Ie(),{recordTagsList:o,isLoadingRecordTagsList:d,refetchRecordTagsList:m}=Mt({unitId:t??""}),l=f=>{a(f)};return d?e.jsx("div",{children:i("loading")}):e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(Ke,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsxs(it,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(ot,{className:"text-xl font-semibold",children:i("recordTag.title")}),e.jsxs(Qe,{open:n,onOpenChange:s,children:[e.jsx(jr,{asChild:!0,children:e.jsx(J,{children:i("recordTag.createNew")})}),e.jsxs(Ge,{children:[e.jsx(We,{children:e.jsx(Ye,{children:i("recordTag.createTitle")})}),e.jsx(ha,{unitId:t,mode:"create",onSuccess:()=>{s(!1),m()}})]})]})]}),e.jsx(pt,{className:"px-0",children:e.jsx(un,{columns:js(t),data:(o==null?void 0:o.items)||[],tableName:i("recordTag.tableName"),toolBarPosition:"right",itemCount:(o==null?void 0:o.count)||0,pageIndex:r,onPageChange:l,nextFunction:()=>l(r+1),prevFunction:()=>l(Math.max(r-1,0))})})]})})}const ks="adf98293-41ba-4bda-bdb4-70e30a70c1b7",Fe={"x-tenant-id":ks},Le=He,st=t=>({...t,name:t.name||{am:"",en:""},description:t.description||{am:"",en:""}}),St={async getResourceTypes(){return(await Le.get("/resource_types",{headers:Fe})).data},async getAllTemplates(t){try{const r=await Le.get("/templates",{params:t,headers:Fe});let a=(r.data.items||r.data||[])?.map(st);if(t!=null&&t.search&&typeof t.search=="string"){const n=t.search.toLowerCase();a=a.filter(s=>{var i,o,d,m,l,f,y,g;return((o=(i=s.name)==null?void 0:i.en)==null?void 0:o.toLowerCase().includes(n))||((m=(d=s.name)==null?void 0:d.am)==null?void 0:m.toLowerCase().includes(n))||((f=(l=s.description)==null?void 0:l.en)==null?void 0:f.toLowerCase().includes(n))||((g=(y=s.description)==null?void 0:y.am)==null?void 0:g.toLowerCase().includes(n))})}return{count:a.length,items:a}}catch{return{count:0,items:[]}}},async getTemplates(t){const{resourceTypeId:r,search:a,...n}=t||{};if(!r)return{count:0,items:[]};let i=((await Le.get(`/resources/list-with-presigned/${r}`,{params:n,headers:Fe})).data.items||[])?.map(st);if(a&&typeof a=="string"){const o=a.toLowerCase();i=i.filter(d=>{var m,l,f,y,g,x,v,p;return((l=(m=d.name)==null?void 0:m.en)==null?void 0:l.toLowerCase().includes(o))||((y=(f=d.name)==null?void 0:f.am)==null?void 0:y.toLowerCase().includes(o))||((x=(g=d.description)==null?void 0:g.en)==null?void 0:x.toLowerCase().includes(o))||((p=(v=d.description)==null?void 0:v.am)==null?void 0:p.toLowerCase().includes(o))})}return{count:i.length,items:i}},async getTemplate(t){const r=await Le.get(`/resources/with-presigned?id=${t}`,{headers:Fe});return st(r.data)},async getTemplateWithPresigned(t,r){var a;try{const i=((await Le.get(`/resources/list-with-presigned/${t}`,{headers:Fe})).data.items||[])?.map(st).find(o=>o.id===r);if(!i)throw new Error("Template not found");return i}catch(n){if(((a=n.response)==null?void 0:a.status)===400)try{const i=await Le.get(`/resources/with-presigned?id=${r}`,{headers:Fe});return st(i.data)}catch{throw n}throw n}},async createTemplate(t){const r=await Le.post("/resources",t,{headers:Fe});return st(r.data)},async updateTemplate(t,r){const a=await Le.put(`/resources/${t}`,r,{headers:Fe});return st(a.data)},async deleteTemplate(t){await Le.delete(`/resources/${t}`,{headers:Fe})},async uploadFile(t,r){var s,i,o,d;if(!r)return null;const a=await hn.validateFileForUpload(t,{allowedMimeTypes:["image/png","image/jpeg","image/gif","image/webp","application/pdf"],allowedExtensions:[".png",".jpg",".jpeg",".gif",".webp",".pdf"],maxSizeMB:50,uploadContext:"signature"});if(!a.isValid)throw new Error(((s=a.clientValidation.fileName)==null?void 0:s.error)||((i=a.clientValidation.extension)==null?void 0:i.error)||((o=a.clientValidation.mimeType)==null?void 0:o.error)||((d=a.clientValidation.size)==null?void 0:d.error)||"File validation failed");const n=await fetch(r,{method:"PUT",headers:{"Content-Type":t.type},body:t});if(!n.ok){const m=await n.text();throw new Error(`Upload failed: ${n.status} ${n.statusText} -${m}`)}return n},async updateUploadStatus(t,r){await Le.put(`/resources/change-status/${t}`,{isCurrent:r},{headers:Fe})},async generateSampleTemplate(t,r){try{const a=await Le.post(`/templates/${t}/sample`,r,{responseType:"arraybuffer",headers:Fe}),n=new Blob([a.data],{type:"application/pdf"});return{pdf:URL.createObjectURL(n),contentType:"application/pdf"}}catch(a){throw a}},async getTemplateSettingsByUnit(t){try{const a=(await Le.get(`/template-settings/by-unit/${t}`,{headers:Fe})).data||{};return{count:a.count||0,items:a.items||[]}}catch{return{count:0,items:[]}}},async saveTemplateSettingValues(t){try{await Promise.all(t?.map(r=>Le.post("/template-setting-values",r,{headers:Fe})))}catch(r){throw r}},async saveBulkTemplateSettingValues(t){try{await Le.post("/template-setting-values/bulk",t,{headers:Fe})}catch(r){throw r}}};var nr={exports:{}},me={};/** @license React v16.13.1 - * react-is.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Or;function Ns(){if(Or)return me;Or=1;var t=typeof Symbol=="function"&&Symbol.for,r=t?Symbol.for("react.element"):60103,a=t?Symbol.for("react.portal"):60106,n=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,d=t?Symbol.for("react.context"):60110,m=t?Symbol.for("react.async_mode"):60111,l=t?Symbol.for("react.concurrent_mode"):60111,f=t?Symbol.for("react.forward_ref"):60112,y=t?Symbol.for("react.suspense"):60113,g=t?Symbol.for("react.suspense_list"):60120,x=t?Symbol.for("react.memo"):60115,v=t?Symbol.for("react.lazy"):60116,p=t?Symbol.for("react.block"):60121,j=t?Symbol.for("react.fundamental"):60117,E=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function k(u){if(typeof u=="object"&&u!==null){var C=u.$$typeof;switch(C){case r:switch(u=u.type,u){case m:case l:case n:case i:case s:case y:return u;default:switch(u=u&&u.$$typeof,u){case d:case f:case v:case x:case o:return u;default:return C}}case a:return C}}}function N(u){return k(u)===l}return me.AsyncMode=m,me.ConcurrentMode=l,me.ContextConsumer=d,me.ContextProvider=o,me.Element=r,me.ForwardRef=f,me.Fragment=n,me.Lazy=v,me.Memo=x,me.Portal=a,me.Profiler=i,me.StrictMode=s,me.Suspense=y,me.isAsyncMode=function(u){return N(u)||k(u)===m},me.isConcurrentMode=N,me.isContextConsumer=function(u){return k(u)===d},me.isContextProvider=function(u){return k(u)===o},me.isElement=function(u){return typeof u=="object"&&u!==null&&u.$$typeof===r},me.isForwardRef=function(u){return k(u)===f},me.isFragment=function(u){return k(u)===n},me.isLazy=function(u){return k(u)===v},me.isMemo=function(u){return k(u)===x},me.isPortal=function(u){return k(u)===a},me.isProfiler=function(u){return k(u)===i},me.isStrictMode=function(u){return k(u)===s},me.isSuspense=function(u){return k(u)===y},me.isValidElementType=function(u){return typeof u=="string"||typeof u=="function"||u===n||u===l||u===i||u===s||u===y||u===g||typeof u=="object"&&u!==null&&(u.$$typeof===v||u.$$typeof===x||u.$$typeof===o||u.$$typeof===d||u.$$typeof===f||u.$$typeof===j||u.$$typeof===E||u.$$typeof===b||u.$$typeof===p)},me.typeOf=k,me}var Fr;function xa(){return Fr||(Fr=1,nr.exports=Ns()),nr.exports}var ya=xa();function Ss(t){function r(O,R,L,T,h){for(var U=0,P=0,Z=0,ee=0,te,q,de=0,fe=0,Q,le=Q=te=0,G=0,oe=0,Re=0,ye=0,$e=L.length,ze=$e-1,Se,H="",ue="",D="",we="",S;G<$e;){if(q=L.charCodeAt(G),G===ze&&P+ee+Z+U!==0&&(P!==0&&(q=P===47?10:47),ee=Z=U=0,$e++,ze++),P+ee+Z+U===0){if(G===ze&&(0te)&&(ye=(H=H.replace(" ",":")).length),0T&&(T=(R=R.trim()).charCodeAt(0)),T){case 38:return R.replace(E,"$1"+O.trim());case 58:return O.trim()+R.replace(E,"$1"+O.trim());default:if(0<1*L&&0P.charCodeAt(8))break;case 115:h=h.replace(P,"-webkit-"+P)+";"+h;break;case 207:case 102:h=h.replace(P,"-webkit-"+(102L.charCodeAt(0)&&(L=L.trim()),z=L,L=[z],01?r-1:0),n=1;n0?" Args: "+a.join(", "):""))}var Os=(function(){function t(a){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=a}var r=t.prototype;return r.indexOfGroup=function(a){for(var n=0,s=0;s=this.groupSizes.length){for(var s=this.groupSizes,i=s.length,o=i;a>=o;)(o<<=1)<0&&Ot(16,""+a);this.groupSizes=new Uint32Array(o),this.groupSizes.set(s),this.length=o;for(var d=i;d=this.length||this.groupSizes[a]===0)return n;for(var s=this.groupSizes[a],i=this.indexOfGroup(a),o=i+s,d=i;d=Ct&&(Ct=r+1),It.set(t,r),zt.set(r,t)},_s="style["+vt+'][data-styled-version="5.3.11"]',Ds=new RegExp("^"+vt+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),Is=function(t,r,a){for(var n,s=a.split(","),i=0,o=s.length;i=0;l--){var f=m[l];if(f&&f.nodeType===1&&f.hasAttribute(vt))return f}})(a),i=s!==void 0?s.nextSibling:null;n.setAttribute(vt,"active"),n.setAttribute("data-styled-version","5.3.11");var o=zs();return o&&n.setAttribute("nonce",o),a.insertBefore(n,i),n},qs=(function(){function t(a){var n=this.element=ba(a);n.appendChild(document.createTextNode("")),this.sheet=(function(s){if(s.sheet)return s.sheet;for(var i=document.styleSheets,o=0,d=i.length;o=0){var s=document.createTextNode(n),i=this.nodes[a];return this.element.insertBefore(s,i||null),this.length++,!0}return!1},r.deleteRule=function(a){this.element.removeChild(this.nodes[a]),this.length--},r.getRule=function(a){return a0&&(y+=g+",")})),i+=""+l+f+'{content:"'+y+`"}/*!sc*/ -`}}}return i})(this)},t})(),Ks=/(a)(d)/gi,zr=function(t){return String.fromCharCode(t+(t>25?39:97))};function ur(t){var r,a="";for(r=Math.abs(t);r>52;r=r/52|0)a=zr(r%52)+a;return(zr(r%52)+a).replace(Ks,"$1-$2")}var gt=function(t,r){for(var a=r.length;a;)t=33*t^r.charCodeAt(--a);return t},ja=function(t){return gt(5381,t)};function Vs(t){for(var r=0;r>>0);if(!a.hasNameForId(s,d)){var m=n(o,"."+d,void 0,s);a.insertRules(s,d,m)}i.push(d),this.staticRulesId=d}else{for(var l=this.rules.length,f=gt(this.baseHash,n.hash),y="",g=0;g>>0);if(!a.hasNameForId(s,j)){var E=n(y,"."+j,void 0,s);a.insertRules(s,j,E)}i.push(j)}}return i.join(" ")},t})(),Ws=/^\s*\/\/.*$/gm,Ys=[":","[",".","#"];function Xs(t){var r,a,n,s,i=rt,o=i.options,d=o===void 0?rt:o,m=i.plugins,l=m===void 0?$t:m,f=new Ss(d),y=[],g=(function(p){function j(E){if(E)try{p(E+"}")}catch{}}return function(E,b,k,N,u,C,M,I,se,Y){switch(E){case 1:if(se===0&&b.charCodeAt(0)===64)return p(b+";"),"";break;case 2:if(I===0)return b+"/*|*/";break;case 3:switch(I){case 102:case 112:return p(k[0]+b),"";default:return b+(Y===0?"/*|*/":"")}case-2:b.split("/*|*/}").forEach(j)}}})((function(p){y.push(p)})),x=function(p,j,E){return j===0&&Ys.indexOf(E[a.length])!==-1||E.match(s)?p:"."+r};function v(p,j,E,b){b===void 0&&(b="&");var k=p.replace(Ws,""),N=j&&E?E+" "+j+" { "+k+" }":k;return r=b,a=j,n=new RegExp("\\"+a+"\\b","g"),s=new RegExp("(\\"+a+"\\b){2,}"),f(E||!j?"":j,N)}return f.use([].concat(l,[function(p,j,E){p===2&&E.length&&E[0].lastIndexOf(a)>0&&(E[0]=E[0].replace(n,x))},g,function(p){if(p===-2){var j=y;return y=[],j}}])),v.hash=l.length?l.reduce((function(p,j){return j.name||Ot(15),gt(p,j.name)}),5381).toString():"",v}var wa=pe.createContext();wa.Consumer;var ka=pe.createContext(),Js=(ka.Consumer,new va),mr=Xs();function Zs(){return c.useContext(wa)||Js}function ei(){return c.useContext(ka)||mr}var ti=(function(){function t(r,a){var n=this;this.inject=function(s,i){i===void 0&&(i=mr);var o=n.name+i.hash;s.hasNameForId(n.id,o)||s.insertRules(n.id,o,i(n.rules,o,"@keyframes"))},this.toString=function(){return Ot(12,String(n.name))},this.name=r,this.id="sc-keyframes-"+r,this.rules=a}return t.prototype.getName=function(r){return r===void 0&&(r=mr),this.name+r.hash},t})(),ri=/([A-Z])/,ai=/([A-Z])/g,ni=/^ms-/,si=function(t){return"-"+t.toLowerCase()};function qr(t){return ri.test(t)?t.replace(ai,si).replace(ni,"-ms-"):t}var Br=function(t){return t==null||t===!1||t===""};function jt(t,r,a,n){if(Array.isArray(t)){for(var s,i=[],o=0,d=t.length;o1?r-1:0),n=1;n?@[\\\]^`{|}~-]+/g,ci=/(^-|-$)/g;function ir(t){return t.replace(li,"-").replace(ci,"")}var di=function(t){return ur(ja(t)>>>0)};function Dt(t){return typeof t=="string"&&!0}var gr=function(t){return typeof t=="function"||typeof t=="object"&&t!==null&&!Array.isArray(t)},ui=function(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"};function mi(t,r,a){var n=t[a];gr(r)&&gr(n)?Na(n,r):t[a]=r}function Na(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),n=1;n=0||(Y[I]=C[I]);return Y})(r,["componentId"]),u=k&&k+"-"+(Dt(b)?b:ir(Ir(b)));return Ca(b,Xe({},N,{attrs:g,componentId:u}),a)},Object.defineProperty(v,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(b){this._foldedDefaultProps=n?Na({},t.defaultProps,b):b}}),Object.defineProperty(v,"toString",{value:function(){return"."+v.styledComponentId}}),s&&Rs(v,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),v}var De=function(t){return(function r(a,n,s){if(s===void 0&&(s=rt),!ya.isValidElementType(n))return Ot(1,String(n));var i=function(){return a(n,s,ii.apply(void 0,arguments))};return i.withConfig=function(o){return r(a,n,Xe({},s,{},o))},i.attrs=function(o){return r(a,n,Xe({},s,{attrs:Array.prototype.concat(s.attrs,o).filter(Boolean)}))},i})(Ca,t)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(t){De[t]=De(t)}));var pr={accent:"#0096ff",background:"#ffffff",color:"#000000",inputBg:"#f3f4f8",inputColor:"#000000",inputError:"#e3005e",shadow:"0 5px 10px rgba(0, 0, 0, 0.04)",radius:4,spacing:8,fontSize:"13px"},at;(function(t){t[t.slider=0]="slider",t[t.text=1]="text",t[t.color=2]="color"})(at||(at={}));var tt=function(t,r,a){if(a||arguments.length===2)for(var n=0,s=r.length,i;n=0,f=l?d.slice(0,m):d,y=l?d.slice(m+1,d.length).trim():"";s.push({property:f,value:y,id:o})}),fr(s),s},xi=function(t){var r=[];t.forEach(function(n){n.property.trim()&&r.push("".concat(n.property.trim(),": ").concat(n.value.trim()))});var a=r.join(`; -`);return a},yi=function(t,r,a){c.useEffect(function(){if(r){var n=Aa(t);a(function(s){return JSON.stringify(s)===JSON.stringify(n)?s:n})}},[t,r])},bi=function(t){var r=c.useCallback(function(){var a=document.activeElement;if(!(!a||a.tagName.toLowerCase()!=="input")){var n=Number(a.getAttribute("data-editor-order")),s=t.current;if(s){var i=s.querySelector('input[data-editor-order="'.concat(n+1,'"]'));i&&i.select()}}},[]);return r},Ft=c.createContext(pr),vi=function(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t},hr=function(){return hr=Object.assign||function(t){for(var r,a=1,n=arguments.length;a`url('data:image/svg+xml;base64,${btoa('')}')`,ra=t=>{const r={};let a=0,n="";const s=i=>{if(i=i.trim(),!i)return;const o=i.indexOf(":");if(o<=0)return;const d=i.slice(0,o).trim(),m=i.slice(o+1).trim();d&&m&&(r[d]=m)};for(let i=0;iObject.entries(t)?.map(([r,a])=>`${r}: ${a};`).join(" "),Yi=({setting:t,index:r,onChange:a,isDefault:n,onToggleDefault:s})=>{const{t:i}=Ie(),[o,d]=c.useState(!1),m=c.useMemo(()=>typeof t.value=="string"?t.value:"",[t.value]),l=c.useMemo(()=>ra(m),[m]);c.useMemo(()=>{const p=new Set;return t.templateSettingValues&&t.templateSettingValues.length>0&&t.templateSettingValues.forEach(j=>{j.value&&typeof j.value=="object"&&Object.keys(j.value).forEach(E=>p.add(E))}),Array.from(p)},[t.templateSettingValues]);const f=c.useMemo(()=>{const p=t.code.toLowerCase();return p.includes("header")||p.includes("footer")},[t.code]),y=p=>{const j={...p};return j["list-style"]!=="disclosure-closed"&&delete j["list-style-image"],j["list-style"]==="disclosure-closed"&&(j["list-style-image"]=Wi()),j},g=c.useCallback((p,j)=>{let E={...l,[p]:j};p==="list-style"&&["disclosure-closed","disclosure-open","none"].includes(j)&&delete E["list-style-type"],E=y(E);const b=aa(E);a(r,b)},[l,r,a]);c.useEffect(()=>{const p=ra(m),j=y(p),E=aa(j);E!==m&&a(r,E)},[]);const x=c.useCallback(p=>{a(r,p)},[r,a]),v=c.useCallback(p=>{a(r,Gi[p])},[r,a]);return!t||!t.code||!t.id?null:e.jsxs("div",{className:"mt-4 p-4 bg-gray-50 dark:bg-gray-700 rounded-lg border border-gray-200 dark:border-gray-600 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:t.code.replace(/-/g," ")}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:()=>s(t.id),className:"w-4 h-4 rounded border-gray-300 dark:border-gray-500"}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:n?"Default":"Custom"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:i("template.quickPresets","Quick Presets")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("button",{onClick:()=>v("heading"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"Heading"}),e.jsx("button",{onClick:()=>v("body"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"Body"}),e.jsx("button",{onClick:()=>v("emphasis"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"Emphasis"}),e.jsx("button",{onClick:()=>v("list"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"List"}),e.jsx("button",{onClick:()=>v("title"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors col-span-2 dark:text-gray-200",children:"Title"})]})]}),e.jsxs("div",{className:"space-y-3 border-t border-gray-200 dark:border-gray-600 pt-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:i("template.commonProperties","Common Properties")}),f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.width","Width")}),e.jsx("input",{type:"text",value:l.width||"100%",onChange:p=>g("width",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.height","Height")}),e.jsx("input",{type:"text",value:l.height||"auto",onChange:p=>g("height",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.margin","Margin")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Top"}),e.jsx("input",{type:"text",value:l["margin-top"]||"0",onChange:p=>g("margin-top",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Right"}),e.jsx("input",{type:"text",value:l["margin-right"]||"0",onChange:p=>g("margin-right",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Bottom"}),e.jsx("input",{type:"text",value:l["margin-bottom"]||"0",onChange:p=>g("margin-bottom",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Left"}),e.jsx("input",{type:"text",value:l["margin-left"]||"0",onChange:p=>g("margin-left",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.padding","Padding")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Top"}),e.jsx("input",{type:"text",value:l["padding-top"]||"0",onChange:p=>g("padding-top",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Right"}),e.jsx("input",{type:"text",value:l["padding-right"]||"0",onChange:p=>g("padding-right",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Bottom"}),e.jsx("input",{type:"text",value:l["padding-bottom"]||"0",onChange:p=>g("padding-bottom",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Left"}),e.jsx("input",{type:"text",value:l["padding-left"]||"0",onChange:p=>g("padding-left",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.fontSize","Font Size")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"number",value:(l["font-size"]||"14px").replace("px",""),onChange:p=>g("font-size",`${p.target.value}px`),placeholder:"14",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"}),e.jsx("span",{className:"flex items-center text-gray-600 dark:text-gray-400 text-sm",children:"px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.fontWeight","Font Weight")}),e.jsxs("select",{value:l["font-weight"]||"normal",onChange:p=>g("font-weight",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"normal",children:"Normal (400)"}),e.jsx("option",{value:"500",children:"Medium (500)"}),e.jsx("option",{value:"600",children:"Semi-bold (600)"}),e.jsx("option",{value:"bold",children:"Bold (700)"}),e.jsx("option",{value:"800",children:"Extra Bold (800)"}),e.jsx("option",{value:"900",children:"Black (900)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.fontFamily","Font Family")}),e.jsxs("select",{value:l["font-family"]||"serif",onChange:p=>g("font-family",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"serif",children:"Serif"}),e.jsx("option",{value:"sans-serif",children:"Sans-serif"}),e.jsx("option",{value:"monospace",children:"Monospace"}),e.jsx("option",{value:"cursive",children:"Cursive"}),e.jsx("option",{value:"fantasy",children:"Fantasy"}),e.jsx("option",{value:"Georgia, serif",children:"Georgia"}),e.jsx("option",{value:"'Times New Roman', serif",children:"Times New Roman"}),e.jsx("option",{value:"Arial, sans-serif",children:"Arial"}),e.jsx("option",{value:"Verdana, sans-serif",children:"Verdana"}),e.jsx("option",{value:"'Courier New', monospace",children:"Courier New"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.textDecoration","Text Decoration")}),e.jsxs("select",{value:l["text-decoration"]||"none",onChange:p=>g("text-decoration",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"none",children:"None"}),e.jsx("option",{value:"underline",children:"Underline"}),e.jsx("option",{value:"overline",children:"Overline"}),e.jsx("option",{value:"line-through",children:"Line Through"}),e.jsx("option",{value:"underline overline",children:"Underline & Overline"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:i("template.textAlign","Text Align")}),e.jsxs("select",{value:l["text-align"]||"left",onChange:p=>g("text-align",p.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"Empty",children:"Empty"}),e.jsx("option",{value:"left",children:"Left"}),e.jsx("option",{value:"center",children:"Center"}),e.jsx("option",{value:"right",children:"Right"}),e.jsx("option",{value:"justify",children:"Justify"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.listStyle","List Style")}),e.jsxs("select",{value:l["list-style"]||"disc",onChange:p=>g("list-style",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"disc",children:"Bullet"}),e.jsx("option",{value:"circle",children:"Circle"}),e.jsx("option",{value:"square",children:"Square"}),e.jsx("option",{value:"disclosure-closed",children:"Black Right Triangle (▶)"}),e.jsx("option",{value:"decimal",children:"Numbers (1, 2, 3)"}),e.jsx("option",{value:"lower-alpha",children:"Lowercase Letters (a, b, c)"}),e.jsx("option",{value:"upper-alpha",children:"Uppercase Letters (A, B, C)"}),e.jsx("option",{value:"lower-roman",children:"Lowercase Roman (i, ii, iii)"}),e.jsx("option",{value:"upper-roman",children:"Uppercase Roman (I, II, III)"}),e.jsx("option",{value:"none",children:"None"})]})]})]})]}),e.jsxs("button",{onClick:()=>d(!o),className:"w-full flex items-center justify-between px-3 py-2 text-xs font-medium text-gray-600 dark:text-gray-300 hover:bg-white dark:hover:bg-gray-600 rounded transition-colors border border-gray-300 dark:border-gray-500",children:[e.jsx("span",{children:i("template.advancedCSS","Advanced CSS Editor")}),e.jsx(za,{className:`h-4 w-4 transition-transform ${o?"rotate-180":""}`})]}),o&&e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-600 pt-3 space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:i("template.customCSS","Custom CSS")}),e.jsx(Qi,{style:m,onChange:x})]})]})},Xi={collaborators:[{am:"ዮሃንስ ዶ",en:"John Doe"},{am:"ማርያም ስሚዝ",en:"Mary Smith"}],preferredLanguage:"am",content:{isWithDelegateSignature:!1,delegatorName:"",body:`This is a sample letter body demonstrating the template styling. - -The body can contain multiple paragraphs and formatting. - -- First bullet point item -- Second bullet point item -- Third bullet point item - -This allows you to see how list styles are applied.`,date:new Date().toISOString().split("T")[0],internalCC:["Finance Department","HR Department","Legal Department"],externalCC:["External Partner A","External Partner B"],prefixCC:"CC:",suffixCC:"---",from:["John Doe","Mary Smith"],subject:"Sample Template Subject – Style Preview",sincerelyText:"Sincerely",to:["Department Head","Project Manager","Team Lead"],prefix:"RE:",suffix:"---"},recordType:"external"},Ji=()=>`url('data:image/svg+xml;base64,${btoa(` - -`)}')`,Zi=t=>{const r=[];let a=0,n="";for(let i=0;i0){const l=d.slice(0,m).trim(),f=d.slice(m+1).trim();l&&f&&r.push([l,f])}}n=""}else n+=o}const s=n.trim();if(s){const i=s.indexOf(":");if(i>0){const o=s.slice(0,i).trim(),d=s.slice(i+1).trim();o&&d&&r.push([o,d])}}return r},eo=t=>{const r={...t},a=["disclosure-closed","disclosure-open","none"];if(r["list-style"]){const n=r["list-style"].split(" ")[0];if(a.includes(n))return delete r["list-style-type"],r;r["list-style-type"]||(r["list-style-type"]=n)}return r["list-style-type"]&&!r["list-style"]&&(r["list-style"]=r["list-style-type"]),r},na=t=>{const r={};Zi(t).forEach(([n,s])=>{r[n]=s});const a=eo(r);return a["list-style"]==="disclosure-closed"&&(a["list-style-image"]=Ji()),a};function br(t,r){const[a,n]=c.useState(t);return c.useEffect(()=>{const s=setTimeout(()=>{n(t)},r);return()=>{clearTimeout(s)}},[t,r]),a}const to=({isOpen:t,onConfirm:r,onCancel:a})=>{const{t:n}=Ie();return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl max-w-md w-full mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[e.jsx(On,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:n("common.warning","Warning")})]}),e.jsx("button",{onClick:a,className:"p-1 hover:bg-gray-100 rounded-lg transition-colors",children:e.jsx(lt,{className:"h-5 w-5 text-gray-500"})})]}),e.jsx("div",{className:"p-6",children:e.jsx("p",{className:"text-gray-700",children:n("template.unsavedChangesWarning","You have unsaved changes. Are you sure you want to leave?")})}),e.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-gray-200 bg-gray-50",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:n("common.cancel","Cancel")}),e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700 transition-colors",children:n("common.leave","Leave")})]})]})}):null},ro=({visible:t})=>t?e.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-600 animate-pulse"}),e.jsx("span",{className:"text-sm font-medium",children:"Unsaved changes"})]}):null,ao=({pdfUrl:t,loading:r,error:a,onApply:n})=>{const{t:s}=Ie(),[i,o]=c.useState(!0),[d,m]=c.useState(!1);c.useEffect(()=>{t&&(o(!0),m(!1))},[t]);const l=()=>o(!1),f=()=>{o(!1),m(!0)};return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"p-4 border-b",children:e.jsx("button",{onClick:n,disabled:r,className:"w-full px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r?s("template.generatingPreview","Generating..."):s("template.applyChanges","Apply Changes")})}),a&&e.jsxs("div",{className:"mx-4 mt-4 p-3 bg-red-50 border border-red-200 rounded-lg",children:[e.jsx("p",{className:"text-sm text-red-800",children:a}),e.jsx("button",{onClick:n,className:"mt-2 text-sm text-red-600 hover:text-red-800 font-medium underline",children:s("common.retry","Retry")})]}),e.jsx("div",{className:"flex-1 overflow-hidden relative",children:t?e.jsxs(e.Fragment,{children:[i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(kr,{className:"h-8 w-8 animate-spin text-purple-600"}),e.jsx("span",{className:"text-sm text-gray-600",children:s("template.loadingPdf","Loading PDF...")})]})}),d&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx("p",{className:"text-red-600 font-medium mb-2",children:s("template.pdfLoadError","Failed to load PDF preview")}),e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-purple-600 hover:text-purple-700 underline text-sm",children:s("template.openInNewTab","Open in new tab")})]})}),e.jsx("iframe",{src:t,className:"w-full h-full border-0",title:"PDF Preview",onLoad:l,onError:f})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:s("template.clickApplyToPreview",'Click "Apply Changes" to generate preview')})})]})},no=({templateId:t,onBack:r})=>{var H,ue,D,we;const{t:a}=Ie(),{userDetails:n}=qa(),s=(ue=(H=n==null?void 0:n.employee)==null?void 0:H[0])==null?void 0:ue.unitId,[i,o]=c.useState(!1),d=c.useRef(null),{data:m,isLoading:l}=pa(s),[f,y]=c.useState(null),[g,x]=c.useState([]),[v,p]=c.useState(!1),[j,E]=c.useState(null),[b,k]=c.useState(!1),[N,u]=c.useState(""),[C,M]=c.useState(""),[I,se]=c.useState([]),[Y,$]=c.useState([]),[F,_]=c.useState(!1),[ne,X]=c.useState(null),[W,xe]=c.useState(null),[ie,Ae]=c.useState(!0),[je,z]=c.useState(!0),O=c.useRef(null),[R,L]=c.useState({}),T=c.useRef({}),h=c.useCallback(S=>{const B=S.toLowerCase();return B.includes("header")?"header":B.includes("footer")?"footer":B.includes("subject")?"subject":B.includes("body")||B.includes("content")?"body":B.includes("receiver")?"receiver":B.includes("prefix")||B.includes("suffix")?"prefix-suffix":B.includes("cc")?"cc":B.includes("list")?"list":B==="letter-fonts"?"fonts":B==="letter-page-margin"?"page-margin":B.includes("reference-number")?"reference-number":"other"},[]),U={"letter-list-style":["receiver"],"letter-cc-list-style":["cc"]},P=c.useCallback(S=>U[S]?U[S]:[h(S)],[]),Z=c.useMemo(()=>{const S=new Map;return g.forEach(B=>{P(B.code).forEach(A=>{if(!S.has(A)){const K={header:a("template.headerStyle","Header Style"),footer:a("template.footerStyle","Footer Style"),subject:a("template.subjectStyle","Subject Style"),body:a("template.bodyStyle","Body Style"),receiver:a("template.receiverStyle","Receiver Style"),"prefix-suffix":a("template.prefixSuffix","Prefix / Suffix"),cc:a("template.ccStyles","CC Styles"),list:a("template.listStyle","List Style"),fonts:a("template.fonts","Fonts"),"page-margin":a("template.pageMargin","Page Margin"),"reference-number":a("template.referenceNumberStyles","Reference Number Styles"),other:a("template.other","Other")};S.set(A,{code:A,label:K[A]||A,settingIds:[]})}S.get(A).settingIds.push(B.id)})}),Array.from(S.values())},[g,a,P]),ee=c.useCallback(async()=>{try{const S=await St.getTemplate(t);y(S)}catch{X(a("error.loadingTemplate","Error loading template"))}},[t,a]),te=c.useCallback(async()=>{try{p(!0),X(null);const S=await St.getTemplateSettingsByUnit(t),V=(Array.isArray(S==null?void 0:S.items)?S.items:[])?.map(K=>{var Oe;if(!K.id||!K.code)return null;let he;if(K.value!==null&&K.value!==void 0)he=K.value;else if(((Oe=K.templateSettingValues)==null?void 0:Oe.length)>0){const ce=K.templateSettingValues.find(ve=>ve.unitId!==null&&ve.unitId!==void 0);if((ce==null?void 0:ce.value)!=null)he=ce.value;else{const ve=K.templateSettingValues.find(qe=>qe.value!==null&&qe.value!==void 0);he=ve==null?void 0:ve.value}}let Ue="";return typeof he=="object"&&he!==null&&Object.keys(he).length>0?Ue=Object.entries(he).filter(([,ce])=>ce!=null&&ce!=="null")?.map(([ce,ve])=>`${ce}: ${ve};`).join(" "):typeof he=="string"&&he.trim()&&(Ue=he),{...K,value:Ue}}).filter(K=>K!==null);x(V);const A={};V.forEach(K=>{K&&(A[K.id]=!0)}),L(A)}catch{X(a("error.loadingSettings","Error loading style settings"))}finally{p(!1)}},[t,a]),q=c.useCallback((S,B)=>{var A;x(K=>{const he=[...K];return he[S]={...he[S],value:B},he});const V=(A=g[S])==null?void 0:A.id;V&&L(K=>({...K,[V]:!1})),_(!0)},[g]),de=c.useCallback(S=>{L(B=>{var A,K;const V=!B[S];if(V){const he=g.findIndex(Ue=>Ue.id===S);if(he>=0){const Oe=((K=(A=g[he].templateSettingValues)==null?void 0:A[0])==null?void 0:K.value)||{};let ce="";typeof Oe=="object"&&Oe!==null&&(ce=Object.entries(Oe)?.map(([ve,qe])=>`${ve}: ${qe};`).join(" ")),x(ve=>{const qe=[...ve];return qe[he]={...qe[he],value:ce},qe})}}return{...B,[S]:V}})},[g]),fe=c.useCallback(async()=>{var S,B;if(!(!t||!s))try{k(!0),X(null);let V;if(N){const ce=I.find(ve=>ve.id===N);ce!=null&&ce.fileInfo&&(V=ce.fileInfo)}else I.length>0&&(V=I[0].fileInfo);let A;if(C){const ce=Y.find(ve=>ve.id===C);ce!=null&&ce.fileInfo&&(A=ce.fileInfo)}else Y.length>0&&(A=Y[0].fileInfo);const K={...Xi,unitId:s,...V&&{header:V},...A&&{footer:A}},he=g?.map(ce=>{const ve=typeof ce.value=="string"?ce.value:"",qe=na(ve);return{id:ce.id,code:ce.code,value:qe}}),Ue={data:K,settings:he},Oe=await St.generateSampleTemplate(t,Ue);if(Oe.pdf)E(Oe.pdf);else throw new Error(a("error.noPdfInResponse","No PDF in response"))}catch(V){const A=((B=(S=V==null?void 0:V.response)==null?void 0:S.data)==null?void 0:B.message)||(V==null?void 0:V.message)||a("error.generatingPreview","Error generating preview");X(A),ge.error(A)}finally{k(!1)}},[t,s,N,C,I,Y,g,a]),Q=c.useCallback(async()=>{var S,B;if(t)try{p(!0);const V=g?.map(A=>{const K=typeof A.value=="string"?A.value:"",he=na(K);return{templateSettingId:A.id,resourceId:null,value:he}});await St.saveBulkTemplateSettingValues(V),_(!1),ge.success(a("template.saveSuccess","Style settings saved successfully"))}catch(V){const A=((B=(S=V==null?void 0:V.response)==null?void 0:S.data)==null?void 0:B.message)||(V==null?void 0:V.message)||a("error.savingSettings","Error saving style settings");ge.error(A)}finally{p(!1)}},[t,g,a]),le=c.useCallback(()=>{F?(o(!0),d.current=r):r()},[F,r]),G=c.useCallback(()=>{o(!1),d.current&&(d.current(),d.current=null)},[]),oe=c.useCallback(()=>{o(!1),d.current=null},[]),Re=c.useCallback(S=>{u(S),_(!0)},[]),ye=c.useCallback(S=>{M(S),_(!0)},[]),$e=c.useCallback(S=>{var V;xe(S);const B=g.find(A=>h(A.code)===S);B&&T.current[B.id]&&((V=T.current[B.id])==null||V.scrollIntoView({behavior:"smooth",block:"start"}))},[g,h]);c.useEffect(()=>{var S,B;m&&(se(m.headers||[]),$(m.footers||[]),!N&&((S=m.headers)==null?void 0:S.length)>0&&u(m.headers[0].id),!C&&((B=m.footers)==null?void 0:B.length)>0&&M(m.footers[0].id))},[m,N,C]),c.useEffect(()=>{t&&(ee(),te())},[t,ee,te]),c.useEffect(()=>{Z.length>0&&!W&&xe(Z[0].code)},[Z,W]),c.useEffect(()=>{const S=B=>{F&&(B.preventDefault(),B.returnValue="")};return window.addEventListener("beforeunload",S),()=>window.removeEventListener("beforeunload",S)},[F]);const ze=c.useMemo(()=>JSON.stringify(g?.map(S=>({id:S.id,value:S.value}))),[g]),Se=br(ze,500);return c.useEffect(()=>{if(ie){if(je){z(!1);return}Se!==O.current&&(O.current=Se,fe())}},[Se,ie,fe]),v&&g.length===0?e.jsx("div",{className:"flex items-center justify-center h-screen",children:e.jsx(kr,{className:"h-8 w-8 animate-spin text-purple-600"})}):e.jsxs("div",{className:"flex flex-col h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("button",{onClick:le,className:"flex items-center gap-2 text-gray-600 hover:text-gray-900 transition-colors",children:[e.jsx(xn,{className:"h-5 w-5"}),e.jsx("span",{className:"font-medium",children:a("common.back","Back")})]}),e.jsx("div",{className:"h-6 w-px bg-gray-300"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900",children:((D=f==null?void 0:f.name)==null?void 0:D.en)||a("template.styleSettings","Style Settings")})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx("input",{type:"checkbox",checked:ie,onChange:S=>Ae(S.target.checked),className:"w-4 h-4 rounded border-gray-300"}),a("template.livePreview","Live Preview")]}),e.jsx(ro,{visible:F})]})]})}),ne&&e.jsxs("div",{className:"mx-6 mt-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:[e.jsx("p",{className:"text-sm text-red-800",children:ne}),e.jsx("button",{onClick:te,className:"mt-2 text-sm text-red-600 hover:text-red-800 font-medium",children:a("common.retry","Retry")})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsxs("div",{className:"w-1/2 flex overflow-hidden border-r border-gray-200",children:[e.jsx("div",{className:"w-56 flex-shrink-0 bg-gray-50 border-r border-gray-200 overflow-y-auto",children:e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:a("template.styleCategories","Style Categories")}),e.jsx("nav",{className:"space-y-1",children:Z?.map(S=>e.jsx("button",{onClick:()=>$e(S.code),className:be("w-full text-left px-3 py-2 rounded-lg text-sm transition-colors",W===S.code?"bg-purple-100 text-purple-700 font-medium":"text-gray-600 hover:bg-gray-100"),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:S.label}),e.jsx("span",{className:"text-xs text-gray-400",children:S.settingIds.length})]})},S.code))})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:a("template.styleEditor","Style Editor")}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-4 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:a("template.headerFooterSelection","Header & Footer")}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:a("addRecord.Header","Header")}),e.jsxs("select",{value:N,onChange:S=>Re(S.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500",children:[e.jsx("option",{value:"",children:I!=null&&I.length?a("addRecord.Select Header","Select Header"):a("addRecord.Loading Headers...","Loading Headers...")}),I==null?void 0:I?.map(S=>{var B,V;return e.jsx("option",{value:S.id,children:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)},S.id)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:a("addRecord.Footer","Footer")}),e.jsxs("select",{value:C,onChange:S=>ye(S.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500",children:[e.jsx("option",{value:"",children:Y!=null&&Y.length?a("addRecord.Select Footer","Select Footer"):a("addRecord.Loading Footers...","Loading Footers...")}),Y==null?void 0:Y?.map(S=>{var B,V;return e.jsx("option",{value:S.id,children:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)},S.id)})]})]})]}),N&&I.length>0&&(()=>{var B,V;const S=I.find(A=>A.id===N);return S!=null&&S.presigned?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 border-2 border-dashed border-gray-300",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 mb-2",children:a("addRecord.Header Preview","Header Preview")}),e.jsx("img",{src:S.presigned,alt:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)||"Header",className:"max-w-full h-auto"})]}):null})(),C&&Y.length>0&&(()=>{var B,V;const S=Y.find(A=>A.id===C);return S!=null&&S.presigned?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 border-2 border-dashed border-gray-300",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 mb-2",children:a("addRecord.Footer Preview","Footer Preview")}),e.jsx("img",{src:S.presigned,alt:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)||"Footer",className:"max-w-full h-auto"})]}):null})()]}),g.length===0&&!v?e.jsx("div",{className:"text-center py-8 text-gray-500",children:a("template.noSettings","No style settings available")}):W&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:((we=Z.find(S=>S.code===W))==null?void 0:we.label)||W}),g.filter(S=>P(S.code).includes(W))?.map(S=>{const B=g.findIndex(V=>V.id===S.id);return e.jsx("div",{ref:V=>{T.current[S.id]=V},children:e.jsx(Yi,{setting:S,index:B,onChange:q,isDefault:R[S.id]??!0,onToggleDefault:de})},S.id)}),g.filter(S=>P(S.code).includes(W)).length===0&&e.jsx("p",{className:"text-gray-500 text-sm",children:a("template.noSettingsForCategory","No settings in this category")})]})]})})]}),e.jsx("div",{className:"w-1/2 bg-white",children:e.jsx(ao,{pdfUrl:j,loading:b,error:ne,onApply:fe})})]}),e.jsx("div",{className:"bg-white border-t border-gray-200 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("button",{onClick:Q,disabled:v||!F,className:"px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:v?a("template.saving","Saving..."):a("common.save","Save")})})}),e.jsx(to,{isOpen:i,onConfirm:G,onCancel:oe})]})},so=()=>{const{t}=Ie(),[r,a]=c.useState([]),[n,s]=c.useState(null),[i,o]=c.useState(!0),[d,m]=c.useState(null);c.useEffect(()=>{l()},[]);const l=async()=>{var g;try{o(!0),m(null);const x=await St.getAllTemplates();a(x.items||[]),((g=x.items)==null?void 0:g.length)>0&&s(x.items[0].id)}catch{m(t("error.loadingTemplates","Error loading templates"))}finally{o(!1)}},f=g=>{s(g)},y=()=>{s(null)};return i?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx(kr,{className:"h-8 w-8 animate-spin text-purple-600"})}):d?e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-red-700",children:d}):r.length===0?e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-gray-500",children:t("template.noTemplates","No templates available")})}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700",children:t("template.selectTemplate","Select Template")}),e.jsxs(ft,{value:n||"",onValueChange:f,children:[e.jsx(ht,{className:"w-64",children:e.jsx(xt,{placeholder:t("template.selectTemplate")})}),e.jsx(yt,{children:r?.map(g=>{var x,v;return e.jsx(bt,{value:g.id,children:((x=g.name)==null?void 0:x.en)||((v=g.name)==null?void 0:v.am)},g.id)})})]})]})}),n&&e.jsx(no,{templateId:n,onBack:y})]})},io=()=>{var N,u;const{user:t}=Ba(),r=sa.language,[a,n]=c.useState(!1),[s,i]=c.useState(!1),[o,d]=c.useState(""),[m,l]=c.useState(0),f=br(o,300),y=t!=null&&t.employee&&t.employee.length>0?t.employee[0].organizationId:void 0,{getList:g}=Ya(),{data:x,isLoading:v}=y?g(y,{take:300,skip:0}):{data:void 0,isLoading:!1},p=br(C=>{window.dispatchEvent(new CustomEvent("unitChanged",{detail:C}))},300);c.useEffect(()=>{f&&window.dispatchEvent(new CustomEvent("unitChanged",{detail:f}))},[f]);const j=c.useCallback(C=>{d(C),p(C)},[p]);c.useEffect(()=>{const C=()=>{window.innerWidth>=768&&n(!1)};return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]),c.useEffect(()=>{var C,M;!v&&((M=(C=x==null?void 0:x.data)==null?void 0:C.items)!=null&&M.length)&&!o&&d(x.data.items[0].id)},[v,x,o]);const E=[{label:"contentManagement.seal",icon:e.jsx(ga,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Ln,{unitId:o})},{label:"contentManagement.letterTemplate",icon:e.jsx(Ua,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Kn,{unitId:o})},{label:"recordTag.title",icon:e.jsx(Rn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(ws,{unitId:o})},{label:"contentManagement.prefix",icon:e.jsx(Cn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(hs,{unitId:o,initialTab:"internal"})},{label:"contentManagement.commonRemarks",icon:e.jsx(Nn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Gn,{unitId:o})},{label:"contentManagement.headerAndFooter",icon:e.jsx(vn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Wn,{unitId:o})},{label:"template.sample",icon:e.jsx(mt,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(so,{})},{label:"dashboard.recentActivities",icon:e.jsx(Tn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Vn,{activities:[]})}],b=E[m],k=(b==null?void 0:b.label)==="template.sample";return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 to-gray-100/30 dark:from-gray-900 dark:to-gray-800",children:e.jsxs("div",{className:"w-full h-full p-4 lg:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row justify-between items-start lg:items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-2xl lg:text-3xl font-bold text-gray-900 dark:text-white tracking-tight",children:w("organization.contentManagement")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-2 text-sm lg:text-base",children:w("organization.contentMsg")})]}),e.jsx("div",{className:"w-full lg:w-auto",children:e.jsx(ys,{})})]}),((u=(N=x==null?void 0:x.data)==null?void 0:N.items)==null?void 0:u.length)>0&&e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 p-4 lg:p-6 transition-all duration-200 hover:shadow-md",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[e.jsx("div",{className:"p-2 bg-purple-50 dark:bg-purple-900/30 rounded-lg",children:e.jsx(yn,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),e.jsx("div",{children:e.jsx("label",{className:"block text-sm font-semibold text-gray-900 dark:text-white",children:w("organization.selectUnit")})})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(ft,{value:o,onValueChange:j,disabled:v,children:[e.jsx(ht,{className:be("w-full border-gray-300 dark:border-gray-600 rounded-xl shadow-sm transition-all duration-200 dark:bg-gray-700 dark:text-white","focus:ring-2 focus:ring-purple-500 focus:border-purple-500","hover:border-gray-400 dark:hover:border-gray-500",v&&"opacity-50 cursor-not-allowed"),children:e.jsx(xt,{placeholder:v?w("common.loading"):w("organization.selectUnit")})}),e.jsx(yt,{className:"rounded-xl border border-gray-200 dark:border-gray-600 shadow-lg dark:bg-gray-800",children:x==null?void 0:x.data.items?.map(C=>e.jsx(bt,{value:C.id,className:"rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors dark:text-gray-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 truncate",children:r==="en"?C.name.en:C.name.am}),C.id===o&&e.jsx("div",{className:"w-2 h-2 bg-purple-600 dark:bg-purple-400 rounded-full"})]})},C.id))})]})})]})}),e.jsxs("div",{className:be("flex w-full min-h-[calc(100vh-12rem)] bg-transparent rounded-2xl",k?"overflow-visible":"overflow-hidden"),children:[a&&e.jsx("div",{className:"fixed inset-0 bg-black/50 dark:bg-black/70 z-40 md:hidden backdrop-blur-sm transition-opacity duration-300",onClick:()=>n(!1)}),e.jsxs("div",{className:be("md:sticky top-0 flex flex-col bg-white dark:bg-gray-800 border-r border-gray-200/60 dark:border-gray-700 transition-all duration-300 ease-in-out","backdrop-blur-sm bg-white/95 md:bg-white dark:bg-gray-800/95",a?"absolute left-0 top-0 z-40 w-72 lg:w-80":"hidden md:flex",s?"md:w-16 lg:w-20":"md:w-72 lg:w-80","h-[calc(100vh-2rem)] md:h-screen rounded-2xl md:rounded-none shadow-xl md:shadow-none"),children:[e.jsxs("div",{className:be("flex items-center p-4 border-b border-gray-200/60 dark:border-gray-700 transition-all duration-300",s?"justify-center":"justify-between"),children:[!s&&e.jsx("div",{className:"flex items-center gap-3 min-w-0",children:e.jsx("h2",{className:"text-lg font-bold text-gray-900 dark:text-white truncate",children:w("organization.contentManagement")})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>i(!s),className:be("hidden md:flex p-2 rounded-xl hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-all duration-200","hover:shadow-sm border border-transparent hover:border-purple-200 dark:hover:border-purple-800"),title:s?w("expandSidebar"):w("collapseSidebar"),children:s?e.jsx(Xt,{className:"h-4 w-4 text-gray-600 dark:text-gray-300"}):e.jsx(Xt,{className:"h-4 w-4 text-gray-600 dark:text-gray-300"})}),e.jsx("button",{onClick:()=>n(!1),className:"md:hidden p-2 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(lt,{className:"h-4 w-4 text-gray-600 dark:text-gray-300"})})]})]}),e.jsx("nav",{className:"flex-1 p-3 space-y-1 overflow-y-auto",children:E?.map((C,M)=>e.jsxs("button",{onClick:()=>{l(M),n(!1)},className:be("w-full flex items-center gap-3 p-3 rounded-xl text-sm font-medium cursor-pointer transition-all duration-200","border border-transparent hover:border-gray-200 dark:hover:border-gray-600 hover:shadow-sm",s?"justify-center":"",m===M?"bg-gradient-to-r from-purple-50 to-purple-50 dark:from-purple-900/30 dark:to-purple-900/20 text-purple-700 dark:text-purple-300 border-purple-200 dark:border-purple-700 shadow-sm":"text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white"),children:[e.jsx("span",{className:be("transition-transform duration-200",m===M&&"scale-110"),children:C.icon}),!s&&e.jsx("span",{className:"flex-1 text-left truncate font-semibold",children:w(C.label)})]},M))})]}),e.jsxs("div",{className:be("flex-1 flex flex-col min-w-0 transition-all duration-300","md:ml-0"),children:[e.jsxs("div",{className:"md:hidden flex items-center justify-between p-4 bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm border-b border-gray-200/60 dark:border-gray-700 rounded-t-2xl",children:[e.jsx("button",{onClick:()=>n(!0),className:"p-2 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-sm border border-gray-200 dark:border-gray-600",children:e.jsx(Xt,{className:"h-5 w-5 text-gray-600 dark:text-gray-300"})}),e.jsx("div",{className:"flex-1 text-center",children:e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-white truncate",children:w((b==null?void 0:b.label)||"contentmanagement")})}),e.jsx("div",{className:"w-9"})]}),e.jsxs("div",{className:be("flex-1 p-4 md:p-6",k?"overflow-visible":"overflow-auto"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-6 flex-wrap",children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:w("content")}),b&&e.jsxs(e.Fragment,{children:[e.jsx(vr,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}),e.jsx("span",{className:"text-gray-900 dark:text-white font-semibold bg-gray-100 dark:bg-gray-700 px-3 py-1 rounded-full text-sm",children:w(b.label)})]})]}),e.jsx("div",{className:be("w-full transition-opacity duration-300"),children:e.jsx("div",{className:be("rounded-2xl shadow-sm border border-gray-200/60 dark:border-gray-700",k?"overflow-visible":"overflow-hidden"),children:b==null?void 0:b.element})})]})]})]})]})})},Zo=()=>e.jsx(io,{});export{Zo as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-DOfthgvB.js b/apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-DOfthgvB.js deleted file mode 100644 index b8ddb676c..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ContentManagementPage-DOfthgvB.js +++ /dev/null @@ -1,259 +0,0 @@ -import{y as nt,l as re,w as ae,m as _e,u as Ie,k as dt,n as Ee,o as Ne,r as c,j as e,v as w,B as J,I as ke,aS as lt,t as ge,b4 as He,b5 as La,az as At,F as mt,b6 as Rt,aJ as vr,aK as Qe,aL as Ge,aM as We,aN as Ye,b7 as jr,aR as sa,aF as lr,b8 as be,aP as _a,b9 as Da,ba as Ia,aU as $a,R as pe,aI as za,a as qa,d as Ba,bb as Xt,bc as Ua}from"./index-7T7TTikv.js";import{C as Ke,a as it,b as ot,c as ia,d as pt}from"./card-_ldW-koX.js";import{L as Ce}from"./label-CABYEcfW.js";import{p as oa}from"./presignedAxios-BChDCNPv.js";import{P as ct}from"./plus-CC3ol2sL.js";import{T as la,a as ca,b as Ze,c as Ve,d as da,e as Te}from"./table-D_B7hhqb.js";import{S as ft,a as ht,b as xt,c as yt,d as bt}from"./select--i8koVXg.js";import{u as ua,C as Ha}from"./index.esm-BRNlF2G3.js";import{T as Ka,u as Va}from"./useTemplate-YHjX1fxO.js";import{S as et}from"./skeleton-BCpLdfqO.js";import{A as Bt,a as Ut,b as Ht,c as Kt,d as Vt,e as Qt,f as Gt,g as Wt}from"./alert-dialog-DwppaTz4.js";import{E as Qa}from"./eye-DYwZYJcQ.js";import{S as Ga}from"./square-pen-Dh1zj83N.js";import{C as ma}from"./chevron-left-G_a9-f9o.js";import{p as Pe,u as Wa}from"./useUnitConfiguration-BYTU44Fr.js";import{P as wr}from"./pencil-cYosDPxl.js";import{u as Ya}from"./useUnit-CRt6YBLp.js";import{u as Er}from"./useSettings-CvxIOArb.js";import{M as Xa}from"./multi-select-CZLBnGmP.js";import{u as Ja}from"./usePosition-B4V039Jv.js";import{S as Za}from"./single-select-CqAjmX3L.js";import{P as en,a as tn,b as rn}from"./popover-CSKEA8hg.js";import{B as cr}from"./badge-D4t6Wb1T.js";import{C as an,a as nn,b as sn,c as on,d as ln,e as cn}from"./command-B6S1IvD4.js";import{C as dn}from"./circle-alert-HVqsZpe-.js";import{A as un}from"./AdvancedTable-vWyUWUDX.js";import{u as mn,o as gn,s as Lt}from"./zod-D-9d3Txu.js";import{F as pn,a as Jt,b as Zt,c as er,d as tr,e as rr}from"./form-lLGtsTgY.js";import{f as fn}from"./format-DvwV82px.js";import{X as hn}from"./XSSUploadValidator-BMXKraj-.js";import{L as kr}from"./loader-CLp1W4Fa.js";import{A as xn}from"./arrow-left-mae9HpSL.js";import{B as yn}from"./building-BTGMe3qn.js";import"./Utils-BP0IYDrC.js";import"./Skeleton-BOu0YqbY.js";import"./unitService-DTtkt-Pb.js";import"./organizationService-B_C-b9EH.js";import"./separator-BXi_hr72.js";import"./positionService-BwPU5sNe.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./search-y8VSu0lZ.js";import"./utils-N2wtfq7C.js";import"./refresh-cw-B7fipPS4.js";import"./en-US-Cc-9gH5A.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bn=[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]],vn=nt("book-image",bn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jn=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],wn=nt("chevrons-up-down",jn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kn=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]],Nn=nt("clipboard-type",kn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sn=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Cn=nt("pencil-ruler",Sn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]],Tn=nt("square-activity",Pn);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const En=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]],ga=nt("stamp",En);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const An=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Rn=nt("tag",An);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mn=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],On=nt("triangle-alert",Mn),Je={createSeal:async t=>re.post("/seals",t,{headers:ae()}),getSeals:async()=>re.get("/seals",{headers:ae()}),getSeal:async t=>re.get(`/seals/${t}`,{headers:ae()}),getSealListsByUnitId:async t=>re.get(`/seals/list/${t}`,{headers:ae()}),updateSeal:async(t,r)=>re.put(`/seals/${t}`,r,{headers:ae()}),deleteSeal:async t=>re.delete(`/seals/${t}`,{headers:ae()}),changeSealStatus:async(t,r)=>re.put(`/seals/change-status/${t}`,r,{headers:ae()}),updateSealUploadStatus:async(t,r)=>re.patch(`/seals/${t}/upload-status`,r,{headers:ae()})},Fn=()=>{const t=_e(),{t:r}=Ie(),{handleError:a}=dt(r),{data:n,isLoading:s,isError:i,refetch:o}=Ee({queryKey:["seals"],queryFn:async()=>(await Je.getSeals()).data,enabled:!1}),d=x=>Ee({queryKey:["seal",x],queryFn:async()=>{if(x)return(await Je.getSealListsByUnitId(x)).data},enabled:!!x}),m=x=>Ee({queryKey:["seal",x],queryFn:async()=>{if(x)return(await Je.getSeal(x)).data},enabled:!!x}),l=Ne({mutationFn:async x=>(await Je.createSeal(x)).data,onSuccess:()=>{t.invalidateQueries({queryKey:["seals"]})},onError:x=>{a(x)}}),f=Ne({mutationFn:async({id:x,payload:v})=>(await Je.updateSeal(x,v)).data,onSuccess:()=>{t.invalidateQueries({queryKey:["seal"]})},onError:x=>{a(x)}}),y=Ne({mutationFn:async x=>{await Je.changeSealStatus(x,{isCurrent:!1})},onSuccess:()=>{t.invalidateQueries({queryKey:["seals"]})},onError:x=>{a(x)}}),g=Ne({mutationFn:async({id:x,updateSealStatusPayload:v})=>(await Je.updateSealUploadStatus(x,v)).data,onSuccess:()=>{t.invalidateQueries({queryKey:["seals"]})},onError:x=>{a(x)}});return{seals:(n==null?void 0:n.items)||[],totalSeals:(n==null?void 0:n.count)||0,isLoadingSeals:s,isSealsError:i,refetchSeals:o,getSealsByUnitId:d,getSealsById:m,createSeal:l.mutateAsync,isCreatingSeal:l.isPending,updateSeal:f.mutate,isUpdatingSeal:f.isPending,deleteSeal:y.mutate,isDeletingSeal:y.isPending,updateSealStatus:g.mutateAsync,isUpdatingStatus:g.isPending}},Ln=({unitId:t})=>{const{createSeal:r,isCreatingSeal:a,isLoadingSeals:n,deleteSeal:s,getSealsByUnitId:i}=Fn(),[o,d]=c.useState(),[m,l]=c.useState([]),f=c.useRef(null),y=_e(),[g,x]=c.useState(0),[v,p]=c.useState(!1),[j,E]=c.useState(""),[b,k]=c.useState(""),N=1*1024*1024,{data:u}=i(t);c.useEffect(()=>{let $=!0;return(async()=>{if(!(u!=null&&u.items))return;const _=u.items.filter(W=>W.uploadedSuccessfully&&W.isCurrent),X=(await Promise.all(_.map(async W=>{try{const ie=(await Je.getSeal(W.id)).data.presigned;return ie?{type:"seal",file:new File([],W.fileInfo.fileName),url:ie,uploadedAt:new Date(W.createdAt),id:W.id}:null}catch{return null}}))).filter(W=>W!==null);$&&l(X)})(),()=>{$=!1,m.forEach(_=>{!_.id&&_.url.startsWith("blob:")&&URL.revokeObjectURL(_.url)})}},[u==null?void 0:u.items]);const C=$=>{if($.type!=="image/png"){ge.error(w("contentManagement.onlyPngAllowed"));return}if($.size>N){ge.error("Image size should be less than 1 MB");return}const F=URL.createObjectURL($),_=new Image;_.onload=()=>{if(_.width!==_.height){ge.error(w("contentManagement.onlySquareAllowed")),URL.revokeObjectURL(F);return}d($),E(""),k(""),l([{type:"seal",url:F,file:$,uploadedAt:new Date,id:null}])},_.onerror=()=>{ge.error(w("contentManagement.invalidImage")),URL.revokeObjectURL(F)},_.src=F},M=async()=>{if(!o){ge.error(w("contentManagement.noFileSelected"));return}if(!j.trim()){k(w("contentManagement.sealNameMsg"));return}try{const $={fileInfo:{fileName:o.name,contentType:o.type,size:o.size,originalname:o.name},name:{am:j,en:j},unitId:t},F=await r($);p(!0),x(0),await oa.put(F.presigned,o,{headers:{"Content-Type":o.type}}),p(!1),x(100),d(void 0),E(""),k(""),f.current&&(f.current.value=""),y.invalidateQueries({queryKey:["seal"]}),ge.success(w("contentManagement.sealSuccessMsg"))}catch{ge.error(w("contentManagement.sealErrorMsg")),p(!1),x(0),d(void 0)}},I=async $=>{if($)try{await s($),l(F=>F.filter(_=>_.id!==$)),ge.success(w("contentManagement.sealRemove"))}catch{ge.error(w("contentManagement.sealRemove"))}},se=$=>new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",hour12:!0,month:"short",day:"numeric"}).format($),Y=a||v;return e.jsxs(Ke,{className:"dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs(it,{children:[e.jsxs(ot,{className:"flex items-center dark:text-white",children:[e.jsx(ga,{className:"h-5 w-5 mr-2"}),w("contentManagement.seal")]}),e.jsxs(ia,{className:"dark:text-gray-400",children:[w("contentManagement.uploadSealMsg")," (PNG, max 1MB)"]})]}),e.jsxs(pt,{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Ce,{htmlFor:"seal",className:"dark:text-gray-200",children:w("contentManagement.sealImage")}),e.jsxs(J,{variant:"outline",className:"bg-primary hover:bg-primary/90 text-primary-foreground",onClick:()=>{var $;return($=f.current)==null?void 0:$.click()},disabled:Y,children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),w("contentManagement.addSeal")]})]}),e.jsx(ke,{ref:f,type:"file",accept:".png,image/png",className:"hidden",onChange:$=>{var F;return((F=$.target.files)==null?void 0:F[0])&&C($.target.files[0])},disabled:Y}),m.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:m.map($=>e.jsxs("div",{className:"border rounded-lg p-3 bg-gray-50 dark:bg-gray-700 dark:border-gray-600",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground dark:text-gray-400",children:se($==null?void 0:$.uploadedAt)}),e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>I(($==null?void 0:$.id)||null),className:"text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-900/30",disabled:n,children:e.jsx(lt,{className:"h-4 w-4 text-red-500"})})]}),e.jsx("img",{src:$.url,alt:"Seal",className:"max-h-32 mx-auto object-contain"})]},($==null?void 0:$.id)||($==null?void 0:$.url)))}):e.jsxs("div",{className:"text-center p-4 border border-dashed rounded-lg dark:border-gray-600 dark:bg-gray-700/30",children:[e.jsx("p",{className:"text-muted-foreground dark:text-gray-400",children:w("contentManagement.noSealMsg")}),e.jsx("p",{className:"text-sm text-muted-foreground dark:text-gray-500 mt-1",children:w("contentManagement.addSealInstruction")})]}),o&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ce,{htmlFor:"sealName",className:"dark:text-gray-200",children:w("contentManagement.sealName")}),e.jsx(ke,{value:j,onChange:$=>{E($.target.value),k("")},placeholder:"Enter seal name",className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),b&&e.jsx("p",{className:"text-sm text-red-500",children:b})]}),o&&e.jsxs(J,{className:"w-full bg-primary hover:bg-primary/90",onClick:M,disabled:Y||!o,children:[a&&"Creating seal...",v&&`Uploading ${g}%`,!Y&&w("contentManagement.saveSeal")]})]})]})},_n=async(t,r)=>He.get(`/record-templates/list/${t}`,{headers:ae(),params:r}),Dn=async t=>He.get(`/record-templates/${t}`,{headers:ae()}),In=async t=>He.post("/record-templates",t,{headers:ae()}),$n=async(t,r)=>He.put(`/record-templates/${t}`,r,{headers:ae()}),zn=async t=>He.delete(`/record-templates/${t}`,{headers:ae()}),qn=(t,r={})=>{const a=_e(),{skip:n=0,take:s=20,orderBy:i="createdAt:DESC",order:o,enabled:d=!0}=r,m={skip:n,take:s,orderBy:i,...o?{order:o}:{}},{data:l,isLoading:f,isFetching:y,isError:g,refetch:x}=Ee({queryKey:["letter-templates",t,m],queryFn:async()=>{const{data:C}=await _n(t,m);return C},enabled:!!t&&d,staleTime:300*1e3,retry:!1,placeholderData:La}),{mutate:v,isPending:p}=Ne({mutationFn:async C=>{const{data:M}=await Dn(C);return M}}),{mutate:j,isPending:E}=Ne({mutationFn:async C=>{const{data:M}=await In(C);return M},onSuccess:(C,M)=>{a.invalidateQueries({queryKey:["letter-templates",M.unitId]})}}),{mutate:b,isPending:k}=Ne({mutationFn:async C=>{const{data:M}=await $n(C.id,C.data);return M},onSuccess:(C,M)=>{a.invalidateQueries({queryKey:["letter-templates",M.data.unitId]}),a.invalidateQueries({queryKey:["letter-template",M.id]})}}),{mutate:N,isPending:u}=Ne({mutationFn:async({id:C})=>{await zn(C)},onSuccess:()=>{a.invalidateQueries({queryKey:["letter-templates",t]})}});return{letterTemplatesResponse:l,items:(l==null?void 0:l.items)??[],count:(l==null?void 0:l.count)??0,isLoading:f,isFetching:y,isError:g,refetch:x,getTemplateByDetails:v,isFetchingTemplate:p,createLetterTemplate:j,isCreating:E,updateLetterTemplate:b,isUpdating:k,deleteLetterTemplate:N,isDeleting:u}},Bn={signature:{uploadKey:"/signatures/get-file-upload-key",create:"/signatures",parentField:"employeeId"},stamp:{uploadKey:"/employee-stamps/get-file-upload-key",create:"/employee-stamps",parentField:"employeePositionId"},header:{uploadKey:"/headers/get-file-upload-key",create:"/headers",parentField:"unitId"},footer:{uploadKey:"/footers/get-file-upload-key",create:"/footers",parentField:"unitId"}};async function Un(t,r,a,n,s){const i={fileName:r.name,originalname:r.name,contentType:r.type||"application/octet-stream",size:r.size,...n!=null&&n.length?{positionId:n}:{},recordTypeKey:s},{data:o}=await a.post(t,i,{headers:ae()});return o}async function Hn(t,r){if(!r)throw new Error("Presigned URL is required");const a=await oa.put(r,t,{headers:{"Content-Type":t.type}});if(a.status<200||a.status>=300)throw new Error(`Upload failed with status ${a.status}: ${a.statusText}`)}async function Ar(t,r,a,n){const{type:s,file:i,name:o,parentId:d}=t,m=Bn[s],l=await Un(m.uploadKey,i,r,a,n),f=l.presignedUrl||l.presigned;if(await Hn(i,f||""),s==="header"||s==="footer"){const x={fileInfo:l.fileInfo,name:o,[m.parentField]:d,positionIds:a,isCurrent:!0,recordTypeKey:n},{data:v}=await r.post(m.create,x,{headers:ae()});return v}const y={fileInfo:l.fileInfo,name:o,[m.parentField]:d,...s==="signature"?{isCurrent:!0}:{}},{data:g}=await r.post(m.create,y,{headers:ae()});return g}const Me={uploadAndCreateHeader:(t,r,a,n,s)=>Ar({type:"header",file:t,name:{am:r,en:r},parentId:a},re,n,s),uploadAndCreateFooter:(t,r,a,n,s)=>Ar({type:"footer",file:t,name:{am:r,en:r},parentId:a},re,n,s),createHeader:async t=>re.post("/headers",t,{headers:ae()}),getHeaders:async()=>re.get("/headers",{headers:ae()}),getHeadersByUnitId:async(t,r,a)=>re.get(`/headers/list/${t}?take=100${r?`&positionId=${r}`:""}${a?`&recordTypeKey=${a}`:""}`,{headers:ae()}),getHeaderById:async t=>re.get(`/headers/${t}`,{headers:ae()}),updateHeader:async(t,r)=>re.put(`/headers/${t}`,r,{headers:ae()}),deleteHeader:async t=>re.delete(`/headers/${t}`,{headers:ae()}),updateHeaderUploadStatus:async(t,r)=>re.patch(`/headers/${t}/upload-status`,r,{headers:ae()}),changeHeaderStatus:async(t,r)=>re.put(`/headers/change-status/${t}`,r,{headers:ae()}),createFooter:async t=>re.post("/footers",t,{headers:ae()}),getFooters:async()=>re.get("/footers",{headers:ae()}),getFootersByUnitId:async(t,r,a)=>re.get(`/footers/list/${t}?take=300${r?`&positionId=${r}`:""}${a?`&recordTypeKey=${a}`:""}`,{headers:ae()}),getFooterById:async t=>re.get(`/footers/${t}`,{headers:ae()}),updateFooter:async(t,r)=>re.put(`/footers/${t}`,r,{headers:ae()}),deleteFooter:async t=>re.delete(`/footers/${t}`,{headers:ae()}),updateFooterUploadStatus:async(t,r)=>re.patch(`/footers/${t}/upload-status`,r,{headers:ae()}),changeFooterStatus:async(t,r)=>re.put(`/footers/change-status/${t}`,r,{headers:ae()})},pa=(t,r,a)=>Ee({queryKey:["headers-footers",t,r,a],queryFn:async()=>{const[n,s]=await Promise.all([Me.getHeadersByUnitId(t,r,a),Me.getFootersByUnitId(t,r,a)]),i=n.data.items.filter(f=>f.isCurrent&&f.uploadedSuccessfully),o=s.data.items.filter(f=>f.isCurrent&&f.uploadedSuccessfully),d=async(f,y)=>Promise.all(f.map(async g=>{try{const x=y==="header"?await Me.getHeaderById(g.id):await Me.getFooterById(g.id);return{...g,presigned:x.data.presigned}}catch{return g}})),m=await d(i,"header"),l=await d(o,"footer");return{headers:m,footers:l}},enabled:!!t,staleTime:600*1e3}),Rr=({unitId:t,template:r,isSubmitting:a,onCancel:n,onSubmitCreate:s})=>{var g,x,v,p;const{register:i,handleSubmit:o,reset:d,control:m,formState:{errors:l}}=ua({defaultValues:{name:{en:((g=r==null?void 0:r.name)==null?void 0:g.en)??"",am:((x=r==null?void 0:r.name)==null?void 0:x.am)??""},key:(r==null?void 0:r.key)??"",subject:(r==null?void 0:r.subject)??"",body:(r==null?void 0:r.body)??"",sincerelyText:(r==null?void 0:r.sincerelyText)??"",unitId:t}}),{data:f}=pa(t);c.useMemo(()=>(f==null?void 0:f.headers)||[],[f==null?void 0:f.headers]),c.useMemo(()=>(f==null?void 0:f.footers)||[],[f==null?void 0:f.footers]);const y=j=>{s(j),r||d()};return e.jsxs("form",{onSubmit:o(y),className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg p-8 shadow-sm space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Template Key"}),e.jsx(ke,{placeholder:"Template Key",...i("key",{required:"Template key is required"})}),l.key&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.key.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Subject"}),e.jsx(ke,{placeholder:"Subject",...i("subject",{required:"Subject is required"})}),l.subject&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.subject.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"English Name"}),e.jsx(ke,{placeholder:"English Name",...i("name.en",{required:"English name is required"})}),((v=l.name)==null?void 0:v.en)&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.name.en.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Amharic Name"}),e.jsx(ke,{placeholder:"Amharic Name",...i("name.am",{required:"Amharic name is required"})}),((p=l.name)==null?void 0:p.am)&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.name.am.message})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Body"}),e.jsx(Ha,{name:"body",control:m,rules:{required:!0},render:({field:j,fieldState:E})=>e.jsxs(e.Fragment,{children:[e.jsx(Ka,{value:j.value,onEditorChange:j.onChange,placeholders:[{key:"delegatorName",label:"Delegator Name"},{key:"delegatorDepartment",label:"Delegator Department"},{key:"delegateeName",label:"Delegatee Name"},{key:"delegateeDepartment",label:"Delegatee Department"},{key:"startDate",label:"Start Date"},{key:"endDate",label:"End Date"},{key:"startDateTime",label:"Start Date & Time"},{key:"endDateTime",label:"End Date & Time"}]}),E.invalid&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:"Body is required"})]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sincerely Text"}),e.jsx(ke,{placeholder:"Sincerely Text",...i("sincerelyText")})]}),e.jsxs("div",{className:"flex gap-2 pt-4 justify-end",children:[e.jsx(J,{type:"submit",disabled:a,children:a?"Saving...":r?"Update":"Save"}),e.jsx(J,{type:"button",variant:"outline",onClick:n,children:"Cancel"})]})]})},Kn=({unitId:t})=>{var ze,Se,H,ue;const{t:r}=Ie(),{handleError:a}=dt(r),[n,s]=c.useState(0),[i,o]=c.useState(10),{letterTemplatesResponse:d,count:m,isLoading:l,isFetching:f,isError:y,refetch:g,createLetterTemplate:x,updateLetterTemplate:v,deleteLetterTemplate:p,isCreating:j,isUpdating:E,isDeleting:b}=qn(t,{skip:n*i,take:i}),k=Math.max(1,Math.ceil(m/i)),{templates:N,isLoading:u,adoptTemplate:C,isAdoptingTemplate:M}=Va(),{data:I}=Ee({queryKey:["headers",t],queryFn:()=>Me.getHeadersByUnitId(t)}),{data:se}=Ee({queryKey:["footers",t],queryFn:()=>Me.getFootersByUnitId(t)}),Y=At(),[$,F]=c.useState(!1),[_,ne]=c.useState(!1),[X,W]=c.useState(!1),[xe,ie]=c.useState(!1),[Ae,je]=c.useState(!1),[z,O]=c.useState(null),[R,L]=c.useState(""),[T,h]=c.useState(""),U=z?Y(z.name):"",P=l||u,Z=y,ee=Array.isArray(N)?N:(N==null?void 0:N.items)||[],te=(d==null?void 0:d.items)||[],q=[...ee.map(D=>({...D,isGlobal:!0})),...te.map(D=>({...D,isGlobal:!1}))],de=D=>{const we=D.target;we!=null&&we.closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root")&&D.preventDefault()},fe=D=>{x(D,{onSuccess:we=>{ge.success(`${Y(we.name)} ${r("contentManagement.templateSuccessMsg")}`),g(),F(!1)},onError:we=>{a(we)}})},Q=D=>{z&&v({id:z.id,data:D},{onSuccess:()=>{ge.success(r("contentManagement.updateTemplate")),g(),ne(!1),O(null)},onError:we=>{a(we)}})},le=()=>{z&&p({id:z.id},{onSuccess:()=>{ge.success(r("contentManagement.deleteTemplate")),g(),ie(!1),O(null)},onError:D=>{a(D)}})},G=()=>{if(!z||!R||!T){ge.error(r("contentManagement.pleaseSelectHeaderAndFooter","Please select header and footer"));return}C({templateId:z.id,headerId:R,footerId:T},{onSuccess:()=>{ge.success(r("contentManagement.adoptSuccess","Successfully adopted global template")),g(),je(!1),O(null),L(""),h("")},onError:D=>{a(D)}})},oe=D=>{O(D),ne(!0)},Re=D=>{O(D),W(!0)},ye=D=>{O(D),ie(!0)},$e=D=>{O(D),je(!0)};return P?e.jsxs(Ke,{children:[e.jsx(it,{children:e.jsxs(ot,{className:"flex items-center",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),r("contentManagement.letterTemplate")]})}),e.jsx(pt,{children:e.jsx("div",{className:"space-y-3",children:Array(3).fill(0).map((D,we)=>e.jsx(et,{className:"h-12 w-full"},we))})})]}):Z?e.jsxs(Ke,{children:[e.jsx(it,{children:e.jsxs(ot,{className:"flex items-center",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),r("contentManagement.letterTemplate")]})}),e.jsx(pt,{children:e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:r("contentManagement.failedToLoadTemplates")})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ke,{children:[e.jsx(it,{children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs(ot,{className:"flex items-center",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),r("contentManagement.letterTemplate")]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:r("contentManagement.createMsg")})]}),e.jsxs(J,{onClick:()=>F(!0),size:"sm",className:"shrink-0",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),r("contentManagement.addTemplate")]})]})}),e.jsx(pt,{children:q.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(mt,{className:"mx-auto mb-4 h-12 w-12 text-gray-400 dark:text-gray-500"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:r("contentManagement.noTemplates")})]}):e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs(la,{children:[e.jsx(ca,{children:e.jsxs(Ze,{children:[e.jsx(Ve,{className:"min-w-[150px]",children:r("common.name")}),e.jsx(Ve,{className:"min-w-[200px] hidden md:table-cell",children:r("contentManagement.sincerelyText")}),e.jsx(Ve,{className:"min-w-[120px] hidden sm:table-cell",children:r("common.createdDate")}),e.jsx(Ve,{className:"text-right min-w-[120px]",children:r("common.actions")})]})}),e.jsx(da,{children:q.map(D=>e.jsxs(Ze,{className:D.isGlobal?"bg-blue-50/50 hover:bg-blue-50 dark:bg-blue-950/30 dark:hover:bg-blue-900/40":"",children:[e.jsx(Te,{className:"font-medium",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[Y(D.name),D.isGlobal&&e.jsx("span",{className:"rounded bg-blue-100 px-2 py-0.5 text-[10px] font-semibold text-blue-700 dark:bg-blue-900/50 dark:text-blue-200",children:"Global"})]}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 md:hidden",children:D.sincerelyText&&D.sincerelyText.length>30?`${D.sincerelyText.substring(0,30)}...`:D.sincerelyText||r("common.notAvailable")})]})}),e.jsx(Te,{className:"max-w-xs truncate hidden md:table-cell",children:D.sincerelyText||r("common.notAvailable")}),e.jsx(Te,{className:"hidden sm:table-cell",children:D.createdAt?new Date(D.createdAt).toLocaleDateString():r("common.notAvailable")}),e.jsx(Te,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Re(D),title:r("contentManagement.viewTemplate"),children:e.jsx(Qa,{className:"h-4 w-4"})}),D.isGlobal?e.jsx(J,{variant:"outline",size:"sm",onClick:()=>$e(D),title:r("contentManagement.adoptTemplate","Adopt Template"),className:"h-8 border-blue-200 px-3 text-blue-700 hover:bg-blue-100 hover:text-blue-800 dark:border-blue-700/60 dark:text-blue-300 dark:hover:bg-blue-900/40 dark:hover:text-blue-200",children:r("common.adopt","Adopt")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>oe(D),title:r("contentManagement.editTemplate"),children:e.jsx(Ga,{className:"h-4 w-4"})}),e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>ye(D),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",title:r("contentManagement.deleteTemplate"),children:e.jsx(Rt,{className:"h-4 w-4"})})]})]})})]},D.id))})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:[r("common.page","Page")," ",n+1," / ",k,m>0&&e.jsxs(e.Fragment,{children:[" ","• ",m," ",r("contentManagement.letterTemplate","templates")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ft,{value:String(i),onValueChange:D=>{o(Number(D)),s(0)},children:[e.jsx(ht,{className:"h-8 w-[80px]",children:e.jsx(xt,{})}),e.jsx(yt,{children:[10,20,50,100].map(D=>e.jsx(bt,{value:String(D),children:D},D))})]}),e.jsxs(J,{variant:"outline",size:"sm",disabled:n===0||f,onClick:()=>s(D=>Math.max(0,D-1)),children:[e.jsx(ma,{className:"h-4 w-4"}),r("common.previous","Previous")]}),e.jsxs(J,{variant:"outline",size:"sm",disabled:n+1>=k||f,onClick:()=>s(D=>D+1),children:[r("common.next","Next"),e.jsx(vr,{className:"h-4 w-4"})]})]})]})]})})]}),e.jsx(Qe,{open:$,onOpenChange:F,children:e.jsxs(Ge,{className:"max-h-[90vh] w-full max-w-[95vw] overflow-y-auto lg:max-w-[1200px] dark:border-gray-700 dark:bg-gray-900",onInteractOutside:de,children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.createTemplate")})}),e.jsx(Rr,{unitId:t,isSubmitting:j,onCancel:()=>F(!1),onSubmitCreate:fe})]})}),e.jsx(Qe,{open:_,onOpenChange:ne,children:e.jsxs(Ge,{className:"max-h-[90vh] w-full max-w-[95vw] overflow-y-auto lg:max-w-[1200px] dark:border-gray-700 dark:bg-gray-900",onInteractOutside:de,children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.editTemplate")})}),e.jsx(Rr,{unitId:t,template:z,isSubmitting:E,onCancel:()=>{ne(!1),O(null)},onSubmitCreate:Q})]})}),e.jsx(Qe,{open:X,onOpenChange:W,children:e.jsxs(Ge,{className:"max-h-[90vh] w-full max-w-[95vw] overflow-y-auto lg:max-w-[1200px] dark:border-gray-700 dark:bg-gray-900",children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.viewTemplate")})}),z&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:r("common.name")}),e.jsx("p",{className:"mt-1 text-sm text-gray-900 dark:text-gray-100",children:Y(z.name)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:r("contentManagement.sincerelyText")}),e.jsx("p",{className:"mt-1 text-sm text-gray-900 dark:text-gray-100",children:z.sincerelyText||r("common.notAvailable")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:r("contentManagement.body")}),e.jsx("div",{className:"mt-1 max-h-60 overflow-y-auto rounded-md border bg-gray-50 p-3 text-sm text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100",dangerouslySetInnerHTML:{__html:z.body}})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(J,{onClick:()=>W(!1),children:r("common.close")})})]})]})}),e.jsx(Qe,{open:Ae,onOpenChange:je,children:e.jsxs(Ge,{className:"max-w-md dark:border-gray-700 dark:bg-gray-900",children:[e.jsx(We,{children:e.jsx(Ye,{children:r("contentManagement.adoptTemplate","Adopt Template")})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300",children:r("contentManagement.selectHeader","Select Header")}),e.jsxs(ft,{value:R,onValueChange:L,children:[e.jsx(ht,{children:e.jsx(xt,{placeholder:r("contentManagement.selectHeader","Select Header")})}),e.jsx(yt,{children:(Se=(ze=I==null?void 0:I.data)==null?void 0:ze.items)==null?void 0:Se.map(D=>e.jsx(bt,{value:D.id,children:Y(D.name)},D.id))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300",children:r("contentManagement.selectFooter","Select Footer")}),e.jsxs(ft,{value:T,onValueChange:h,children:[e.jsx(ht,{children:e.jsx(xt,{placeholder:r("contentManagement.selectFooter","Select Footer")})}),e.jsx(yt,{children:(ue=(H=se==null?void 0:se.data)==null?void 0:H.items)==null?void 0:ue.map(D=>e.jsx(bt,{value:D.id,children:Y(D.name)},D.id))})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(J,{variant:"outline",onClick:()=>je(!1),children:r("common.cancel")}),e.jsx(J,{onClick:G,disabled:M||!R||!T,children:M?r("common.adopting","Adopting..."):r("common.adopt","Adopt")})]})]})}),e.jsx(Bt,{open:xe,onOpenChange:ie,children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:r("contentManagement.deleteTemplate")}),e.jsx(Vt,{children:r("contentManagement.deleteTemplateConfirm",{name:U}).replace("{{name}}",U).replace("{name}",U)})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{children:r("common.cancel")}),e.jsx(Wt,{onClick:le,disabled:b,className:"bg-red-600 hover:bg-red-700",children:r(b?"common.deleting":"common.delete")})]})]})})]})},Vn=({activities:t})=>{const r=a=>new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",hour12:!0,month:"short",day:"numeric"}).format(a);return e.jsxs(Ke,{className:"bg-gradient-to-br from-gray-50 to-slate-50 dark:from-gray-800 dark:to-gray-900 dark:border-gray-700",children:[e.jsxs(it,{children:[e.jsxs(ot,{className:"flex items-center dark:text-white",children:[e.jsx(mt,{className:"h-5 w-5 mr-2"}),"Recent Activities"]}),e.jsx(ia,{className:"dark:text-gray-400",children:"Recent content management activities"})]}),e.jsx(pt,{children:e.jsx("div",{className:"space-y-4",children:t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground dark:text-gray-400",children:"No recent activities."}):t.map(({id:a,type:n,description:s,timestamp:i})=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium capitalize dark:text-white",children:n}),e.jsx("span",{className:"text-sm dark:text-gray-300",children:s}),e.jsx("span",{className:"text-xs text-muted-foreground dark:text-gray-400",children:r(i)})]},a))})})]})},Qn=(t,r)=>Ee({queryKey:["remark",t,r],queryFn:async()=>(await Pe.getRemarkList(t,r)).data}),Gn=({unitId:t})=>{const[r,a]=c.useState(""),[n,s]=c.useState(""),[i,o]=c.useState(null),[d,m]=c.useState(!1),[l,f]=c.useState(!1),[y,g]=c.useState(null),[x,v]=c.useState(""),p=_e(),{data:j,isLoading:E}=Qn(t,{skip:0,take:300}),b=Ne({mutationFn:async()=>{if(!r)throw new Error(w("contentManagement.remarkRequired"));const M={unitId:t,remark:r,description:n};return i?Pe.editRemark(i,M):Pe.createRemark(M)},onSuccess:()=>{p.invalidateQueries({queryKey:["remark",t]}),N(),m(!1)},onError:M=>v(M.message||w("contentManagement.failed"))}),k=Ne({mutationFn:M=>Pe.deleteRemarks(M),onSuccess:()=>{p.invalidateQueries({queryKey:["remark",t]}),f(!1),g(null)},onError:()=>v(w("contentManagement.failedToDelete"))}),N=()=>{a(""),s(""),o(null),v("")},u=M=>{o(M.id),a(M.remark),s(M.description||""),m(!0)},C=()=>b.mutate();return e.jsxs(Ke,{className:"p-4 border shadow-sm space-y-4 dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs(Qe,{open:d,onOpenChange:m,children:[e.jsx(jr,{asChild:!0,children:e.jsxs(J,{className:"w-[180px] bg-primary hover:bg-primary/90 text-primary-foreground flex items-center",children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),w("contentManagement.addRemark")]})}),e.jsxs(Ge,{className:"sm:max-w-xl w-full dark:bg-gray-800",children:[e.jsx(We,{children:e.jsx(Ye,{className:"dark:text-white",children:i?w("contentManagement.editRemark"):w("contentManagement.addRemark")})}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(Ce,{htmlFor:"remark",className:"mb-1 dark:text-gray-200",children:w("header.Remark")}),e.jsx(ke,{id:"remark",value:r,onChange:M=>a(M.target.value),placeholder:w("header.Remark"),disabled:E,className:"w-full dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),e.jsx(Ce,{htmlFor:"description",className:"mb-1 dark:text-gray-200",children:w("header.Description")}),e.jsx(ke,{id:"description",value:n,onChange:M=>s(M.target.value),placeholder:w("header.Description"),disabled:E,className:"w-full mb-2 dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),x&&e.jsx("p",{className:"text-sm text-red-500",children:x})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(J,{variant:"outline",onClick:()=>{N(),m(!1)},children:w("common.Cancel")}),e.jsx(J,{onClick:C,disabled:E,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:E?w("contentManagement.saving"):i?w("delegation.update"):w("delegation.save")})]})]})]}),e.jsx("h3",{className:"font-semibold text-md dark:text-white",children:w("contentManagement.commonRemarks")}),E?e.jsx("div",{className:"text-center py-4 dark:text-gray-400",children:w("contentManagement.loading")}):e.jsx("div",{className:"overflow-x-auto max-h-[380px] overflow-y-auto border rounded dark:border-gray-600",children:e.jsxs("table",{className:"min-w-full text-sm text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-gray-100 dark:bg-gray-700",children:[e.jsx("th",{className:"px-3 py-2 dark:text-white",children:"#"}),e.jsx("th",{className:"px-3 py-2 dark:text-white",children:w("header.Remark")}),e.jsx("th",{className:"px-3 py-2 dark:text-white",children:w("header.Description")}),e.jsx("th",{className:"px-3 py-2 dark:text-white",children:w("userRecord.Actions")})]})}),e.jsx("tbody",{children:j!=null&&j.items.length?j.items.map((M,I)=>e.jsxs("tr",{className:"border-b hover:bg-gray-50 dark:hover:bg-gray-700 dark:border-gray-600",children:[e.jsx("td",{className:"px-3 py-2 dark:text-gray-300",children:I+1}),e.jsx("td",{className:"px-3 py-2 dark:text-gray-300",children:M.remark}),e.jsx("td",{className:"px-3 py-2 dark:text-gray-300",children:M.description}),e.jsxs("td",{className:"px-3 py-2 flex gap-2",children:[e.jsx(J,{variant:"outline",size:"sm",onClick:()=>u(M),children:e.jsx(wr,{className:"h-4 w-4"})}),e.jsx(J,{variant:"destructive",size:"sm",onClick:()=>{g(M.id),f(!0)},children:e.jsx(Rt,{className:"h-4 w-4"})})]})]},M.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"text-center py-4 text-gray-500 dark:text-gray-400",children:w("contentManagement.noRec")})})})]})}),e.jsx(Bt,{open:l,onOpenChange:M=>{k.isPending||(f(M),M||g(null))},children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:w("common.delete")}),e.jsx(Vt,{children:w("contentManagement.deleteMsg")})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{disabled:k.isPending,children:w("common.cancel")}),e.jsx(Wt,{className:"bg-red-600 hover:bg-red-700",disabled:k.isPending||!y,onClick:()=>{y&&k.mutate(y)},children:k.isPending?w("common.deleting","Deleting..."):w("common.delete")})]})]})})]})},Wn=({unitId:t})=>{var R,L;const[r,a]=c.useState([]),[n,s]=c.useState([]),[i,o]=c.useState(!0),[d,m]=c.useState(""),[l,f]=c.useState(null),[y,g]=c.useState("header"),[x,v]=c.useState(null),[p,j]=c.useState(!1),[E,b]=c.useState(null),k=c.useRef(null),N=_e(),u=sa.language,[C,M]=c.useState([]),{data:I}=Wa(t??"",{enabled:!!t}),se=(L=(R=I==null?void 0:I.data)==null?void 0:R.items)==null?void 0:L[0],Y=(se==null?void 0:se.canCreateDirectRecord)??!1,$=At(),[F,_]=c.useState(null),ne=T=>{var P,Z;const h=String(T.key||"").toLowerCase(),U=[(P=T.name)==null?void 0:P.en,(Z=T.name)==null?void 0:Z.am].filter(Boolean).join(" ").toLowerCase();return h.includes("direct")||U.includes("direct")},{recordTypes:X}=Er(),{allDepratments:W}=Er(),xe=c.useCallback(T=>T?u==="am"?T.am||T.en:T.en||T.am:"",[u]),ie=c.useCallback(async()=>{o(!0);try{const[T,h]=await Promise.all([Me.getHeadersByUnitId(t),Me.getFootersByUnitId(t)]),U=T.data.items.filter(q=>q.isCurrent&&q.uploadedSuccessfully),P=h.data.items.filter(q=>q.isCurrent&&q.uploadedSuccessfully),Z=async(q,de)=>Promise.all(q.map(async fe=>{try{const Q=de==="header"?await Me.getHeaderById(fe.id):await Me.getFooterById(fe.id);return{...fe,presigned:Q.data.presigned}}catch{return fe}})),[ee,te]=await Promise.all([Z(U,"header"),Z(P,"footer")]);a(ee),s(te)}catch{ge.error(w("contentManagement.failedToLoadHeaderFooter"))}finally{o(!1)}},[t]),Ae=async(T,h,U)=>{try{const P={isCurrent:U};h==="header"?await Me.changeHeaderStatus(T,P):await Me.changeFooterStatus(T,P),N.invalidateQueries({queryKey:["headers-footers",t]}),ge.success(w("contentManagement.statusChanged")),ie()}catch{ge.error(w("contentManagement.statusChangeFailed"))}},je=async()=>{if(!d||!l){b(w("contentManagement.provideMsg"));return}j(!0),b(null);try{const T=await(y==="header"?Me.uploadAndCreateHeader(l,d,t,C,F):Me.uploadAndCreateFooter(l,d,t,C,F));T!=null&&T.id&&(y==="header"?await Me.changeHeaderStatus(T.id,{isCurrent:!0}):await Me.changeFooterStatus(T.id,{isCurrent:!0})),ge.success(`${y} ${w("contentManagement.uploadSuccess")}`),k.current&&(k.current.value=""),f(null),m(""),v(null),b(null),M([]),_(null),ie()}catch{b(w("contentManagement.uploadFailed")),ge.error(w("contentManagement.uploadFailed"))}finally{j(!1)}};c.useEffect(()=>{ie()},[ie]);const z=(X==null?void 0:X.filter(T=>Y?!0:!ne(T)).map(T=>({label:T.key=="direct"?$({en:"Direct Letter",am:"ቀጥታ ደብዳቤ"}):$(T.name),value:T.key})))||[],O=(T,h,U)=>e.jsxs(Ke,{className:"p-6 border shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"font-semibold text-xl dark:text-white",children:T}),e.jsxs("span",{className:"text-sm text-muted-foreground dark:text-gray-400",children:[h.length," ",h.length===1?"item":"items"]})]}),i?e.jsx(et,{className:"h-40"}):h.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-2xl text-gray-400 dark:text-gray-500",children:U==="header"?"📄":"📋"})}),e.jsxs("p",{className:"text-sm text-muted-foreground dark:text-gray-400 mb-2",children:["No ",T.toLowerCase()," found"]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-gray-500",children:["Upload your first ",U," using the form below"]})]}):e.jsx("div",{className:"space-y-4",children:h.map(P=>e.jsxs("div",{className:`border rounded-lg p-4 ${P.isCurrent?"bg-primary-50 dark:bg-primary-900/30 border-primary-200 dark:border-primary-800 shadow-sm":"bg-white dark:bg-gray-700"}`,children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-lg truncate dark:text-white",children:u==="en"?P.name.en:P.name.am}),P.isCurrent&&e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary-100 dark:bg-primary-900/50 text-primary-800 dark:text-primary-300 flex-shrink-0",children:w("contentManagement.currentlyActive")})]}),e.jsx("p",{className:"text-sm text-muted-foreground dark:text-gray-400 truncate",children:P.fileInfo.fileName})]})}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[P.presigned&&e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:"w-24 h-16 border rounded-md overflow-hidden bg-gray-50 dark:bg-gray-600",children:e.jsx("img",{src:P.presigned,alt:`${U} Preview`,className:"w-full h-full object-contain"})})}),e.jsx("div",{className:"flex items-center gap-2 ml-auto",children:e.jsx(J,{size:"sm",variant:"outline",onClick:()=>Ae(P.id,U,!1),className:"text-red-600 dark:text-red-400 border-red-300 dark:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/30 whitespace-nowrap",children:w("contentManagement.delete")})})]})]},P.id))})]});return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8",children:[O("Headers",r,"header"),O("Footers",n,"footer")]}),e.jsxs(Ke,{className:"p-4 border shadow-sm space-y-4 dark:border-gray-700 dark:bg-gray-800",children:[e.jsxs("h2",{className:"font-semibold text-lg flex items-center gap-2 dark:text-white",children:[e.jsx(ct,{className:"h-5 w-5"})," ",w("contentManagement.addHeaderFooter")]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.name")}),e.jsx(ke,{value:d,onChange:T=>{m(T.target.value),b(null)},placeholder:w("contentManagement.name"),disabled:p,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.type")}),e.jsxs("select",{value:y,onChange:T=>g(T.target.value),className:"w-full rounded border px-3 py-2 text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white",disabled:p,children:[e.jsx("option",{value:"header",children:w("contentManagement.header")}),e.jsx("option",{value:"footer",children:w("contentManagement.footer")})]})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.uploadFile")}),e.jsx(ke,{type:"file",accept:"image/*",ref:k,onChange:T=>{var U;const h=((U=T.target.files)==null?void 0:U[0])||null;if(h){if(h.size>5*1024*1024){b("File size must be less than 5 MB"),k.current&&(k.current.value=""),f(null),v(null);return}f(h),v(URL.createObjectURL(h))}else f(null),v(null);b(null)},disabled:p})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.positions")}),e.jsx(Xa,{options:(W==null?void 0:W.map(T=>({label:xe(T.name),value:T.id})))??[],value:C,onValueChange:M,placeholder:w("contentManagement.selectPositions"),maxCount:5,className:"w-full max-w-full sm:max-w-md overflow-x-auto",animation:0})]}),e.jsxs("div",{children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("addRecord.Record Type")}),e.jsxs(ft,{value:F??"",onValueChange:T=>_(T||null),children:[e.jsx(ht,{children:e.jsx(xt,{placeholder:w("addRecord.Select Record Type")})}),e.jsx(yt,{children:z.map(T=>e.jsx(bt,{value:T.value,children:T.label},T.value))})]})]})]}),x&&e.jsxs("div",{className:"mt-2",children:[e.jsx(Ce,{className:"dark:text-gray-200",children:w("contentManagement.preview")}),e.jsx("div",{className:"border rounded p-2 inline-block mt-1 dark:border-gray-600",children:e.jsx("img",{src:x,alt:"Preview",className:"h-24 object-contain rounded"})})]}),E&&e.jsx("p",{className:"text-sm text-red-500",children:E}),e.jsx(J,{onClick:je,disabled:p,className:"bg-primary hover:bg-primary/90 text-primary-foreground w-full",children:p?w("PDF.uploading"):`${w("signatureUpload.upload")} ${y}`})]})]})},Yn=({items:t,isLoading:r,onEdit:a,onDelete:n,showPositionColumn:s=!1,showCountColumn:i=!1,positions:o=[]})=>{const d=_e(),m=b=>{var N,u;const k=o.find(C=>C.id===b);return((N=k==null?void 0:k.name)==null?void 0:N.en)||((u=k==null?void 0:k.name)==null?void 0:u.am)||b},[l,f]=c.useState(null),[y,g]=c.useState(""),x=b=>{var k,N;return((N=(k=b.recordSequences)==null?void 0:k[0])==null?void 0:N.count)??b.count??void 0},v=b=>{var k,N;return((N=(k=b.recordSequences)==null?void 0:k[0])==null?void 0:N.id)??b.sequenceId??void 0},p=b=>{const k=x(b)??0,N=v(b);N&&(f({itemId:N,currentCount:k}),g(String(k)))},j=()=>{f(null),g(""),d.invalidateQueries({queryKey:["prefixes-by-position"]}),d.invalidateQueries({queryKey:["unit-reference-numbers"]})},E=b=>{if(b.preventDefault(),!l)return;const k=parseInt(y,10);isNaN(k)||k<0||Pe.updateCount(l.itemId,k).then(()=>{j()})};return e.jsxs("div",{className:"overflow-x-auto border rounded-lg dark:border-gray-600",children:[e.jsxs("table",{className:"min-w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700 border-b dark:border-gray-600",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 dark:text-white",children:"#"}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("header.amharic")}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("header.english")}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("contentManagement.type")}),s&&e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("contentManagement.position")}),i&&e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("contentManagement.count")}),e.jsx("th",{className:"px-4 py-3 dark:text-white",children:w("userRecord.Actions")})]})}),e.jsx("tbody",{children:r?e.jsx("tr",{children:e.jsx("td",{colSpan:s?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:w("contentManagement.loading")})}):t.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:w("contentManagement.noRec")})}):t.map((b,k)=>{var N,u;return e.jsxs("tr",{className:"border-b hover:bg-gray-50 dark:hover:bg-gray-700 dark:border-gray-600",children:[e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:k+1}),e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:((N=b.name)==null?void 0:N.am)||"-"}),e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:((u=b.name)==null?void 0:u.en)||"-"}),e.jsxs("td",{className:"px-4 py-3 capitalize dark:text-gray-300",children:[b.type,b.isForCC&&e.jsx("span",{className:"ml-1 text-xs text-purple-600 dark:text-purple-400",children:"(CC)"})]}),s&&e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:b.positionId?m(b.positionId):"-"}),i&&e.jsx("td",{className:"px-4 py-3 dark:text-gray-300",children:(()=>{const C=x(b);return C===void 0?"-":e.jsx("button",{onClick:()=>p(b),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 underline cursor-pointer",children:C})})()}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(J,{variant:"ghost",size:"sm",onClick:()=>a(b),children:e.jsx(wr,{className:"h-4 w-4"})}),e.jsx(J,{variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300",onClick:()=>n(b.id,b.type,b.recordTypeKey),children:e.jsx(Rt,{className:"h-4 w-4"})})]})})]},b.id)})})]}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 w-80",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold dark:text-white",children:w("contentManagement.updateCount")}),e.jsx("button",{onClick:j,className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:e.jsx(lt,{className:"h-5 w-5"})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs(Ce,{htmlFor:"countValue",className:"dark:text-gray-200",children:[w("contentManagement.value")," *"]}),e.jsx(ke,{id:"countValue",type:"number",min:"0",value:y,onChange:b=>g(b.target.value),placeholder:w("contentManagement.enterValue"),className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[w("contentManagement.currentCount"),":"," ",l.currentCount]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(J,{type:"button",variant:"outline",onClick:j,children:w("common.cancel")}),e.jsx(J,{type:"submit",children:w("common.submit")})]})]})]})})]})},ut=(t,r)=>{var n,s;const a=t;return((s=(n=a==null?void 0:a.response)==null?void 0:n.data)==null?void 0:s.message)||(a==null?void 0:a.message)||r},wt=t=>{var n,s,i;const r=t,a=((s=(n=r==null?void 0:r.response)==null?void 0:n.data)==null?void 0:s.message)||(r==null?void 0:r.message)||"";return((i=r==null?void 0:r.response)==null?void 0:i.status)===400&&/unit not found/i.test(a)},Mr=t=>({data:t,status:200,statusText:"OK",headers:{},config:{}}),Yt={getReferenceNumbers:async t=>{try{return await re.get(`/unit-configurations/${t}/reference-number`)}catch(r){if(wt(r))return Mr([]);throw new Error(ut(r,"Failed to fetch reference numbers"))}},getTagBasedReferences:async(t,r)=>{try{return await re.get(`/record-prefixes/list/${t}/`)}catch(a){if(wt(a))return Mr([]);throw new Error(ut(a,"Failed to fetch reference numbers"))}},getUnitConfiguration:async t=>{try{return await re.get(`/unit-configurations/${t}`)}catch(r){throw new Error(ut(r,"Failed to fetch unit configuration"))}},addReferenceNumber:async(t,r)=>{try{return await re.post(`/unit-configurations/${t}/reference-number`,r)}catch(a){if(wt(a))return await re.post("/unit-configurations",{unitId:t}),await re.post(`/unit-configurations/${t}/reference-number`,r);throw new Error(ut(a,"Failed to add reference numbers"))}},updateInternalMemoReferencePrefix:async(t,r)=>{try{return await re.patch(`/unit-configurations/add-internal-memo-reference-number-prefix/${t}`,r)}catch(a){if(wt(a))return await re.post("/unit-configurations",{unitId:t}),await re.patch(`/unit-configurations/add-internal-memo-reference-number-prefix/${t}`,r);throw new Error(ut(a,"Failed to update internal memo reference prefix"))}},updateExternalReferencePrefix:async(t,r)=>{try{return await re.patch(`/unit-configurations/add-external-reference-number-prefix/${t}`,r)}catch(a){if(wt(a))return await re.post("/unit-configurations",{unitId:t}),await re.patch(`/unit-configurations/add-external-reference-number-prefix/${t}`,r);throw new Error(ut(a,"Failed to update external reference prefix"))}}},fa=t=>Ee({queryKey:["unit-reference-numbers",t],queryFn:()=>Yt.getReferenceNumbers(t),enabled:!!t}),Xn=()=>{const t=_e();return Ne({mutationFn:({unitId:r,payload:a})=>Yt.addReferenceNumber(r,a),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["unit-reference-numbers",a.unitId]}),t.invalidateQueries({queryKey:["unit-configuration",a.unitId]})}})},Jn=()=>{const t=_e();return Ne({mutationFn:({unitId:r,payload:a})=>Yt.updateInternalMemoReferencePrefix(r,a),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["unit-reference-numbers",a.unitId]}),t.invalidateQueries({queryKey:["unit-configuration",a.unitId]})}})},Zn=()=>{const t=_e();return Ne({mutationFn:({unitId:r,payload:a})=>Yt.updateExternalReferencePrefix(r,a),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["unit-reference-numbers",a.unitId]}),t.invalidateQueries({queryKey:["unit-configuration",a.unitId]})}})},es=({open:t,onClose:r,onSuccess:a,unitId:n,cardType:s,recordType:i,editingItem:o,positions:d=[]})=>{var Ae,je;const m=_e(),l=!!o,[f,y]=c.useState(""),[g,x]=c.useState(""),[v,p]=c.useState(""),j=["reference","externalReference","internalMemoReference"].includes(s),E=i==="positionPrefix",b=s.includes("CC"),k=s==="reference",N=s==="externalReference",u=s==="internalMemoReference",C=d.filter(z=>!!(z!=null&&z.id)).map(z=>{var O,R;return{value:z.id,label:((O=z.name)==null?void 0:O.en)||((R=z.name)==null?void 0:R.am)||z.id}}),M=s==="internalPrefix"?"internal":s==="externalPrefix"?"external":s==="internalMemoPrefix"?"internal_memo":o==null?void 0:o.recordTypeKey,{data:I}=fa(j?n:""),se=Xn(),Y=Jn(),$=Zn(),{handleError:F}=dt(w),_=((je=(Ae=I==null?void 0:I.data)==null?void 0:Ae.items)==null?void 0:je[0])||(I==null?void 0:I.data)||{},ne=Array.isArray(_);ne&&(_==null||_.find(z=>z.name==="referenceNumberPrefix")),ne&&(_==null||_.find(z=>z.name==="externalReferenceNumberPrefix")),ne&&(_==null||_.find(z=>z.name==="internalMemoReferenceNumberPrefix")),c.useEffect(()=>{var z,O,R,L;o?(j?(y(((z=o.name)==null?void 0:z.am)||""),x(((O=o.name)==null?void 0:O.en)||"")):(y(((R=o.name)==null?void 0:R.am)||""),x(((L=o.name)==null?void 0:L.en)||"")),p(o.positionId||"")):(y(""),x(""),p(""))},[o,j]),c.useEffect(()=>{if(!(!j||o)){if(k){y(_.referenceNumberPrefix||""),x(_.referenceNumberPrefix||"");return}if(N){y(_.externalReferenceNumberPrefix||""),x(_.externalReferenceNumberPrefix||"");return}u&&(y(_.internalMemoReferenceNumberPrefix||""),x(_.internalMemoReferenceNumberPrefix||""))}},[o,j,k,N,u,_.referenceNumberPrefix,_.externalReferenceNumberPrefix,_.internalMemoReferenceNumberPrefix]);const{mutate:X,isPending:W}=Ne({mutationFn:async()=>{const z=i,O=j||E||s==="prefix"||s==="prefixCC"||s==="internalPrefix"||s==="externalPrefix"||s==="internalMemoPrefix";let R,L;if(j){if(k){await se.mutateAsync({unitId:n,payload:{referenceNumberPrefix:{am:f,en:g}}});return}if(N){await $.mutateAsync({unitId:n,payload:{externalReferenceNumberPrefix:{am:f,en:g}}});return}if(u){await Y.mutateAsync({unitId:n,payload:{internalMemoReferenceNumberPrefix:{am:f,en:g}}});return}}else if(E){if(M!=="internal"&&M!=="external"&&M!=="internal_memo")throw new Error("Position prefix requires internal, external, or internal_memo recordTypeKey");R={unitId:n,recordTypeKey:M,isForCC:!1,positionId:v,name:{am:f,en:g}}}else{const T={unitId:n,recordTypeKey:z,isForCC:b,name:{am:f,en:g}};s==="suffix"||s==="suffixCC"?L=T:R=T}if(l){if(O&&R)return Pe.editPrefix(o.id,R);if(L)return Pe.editSuffix(o.id,L);throw new Error("Invalid prefix/suffix payload for update")}if(O&&R)return Pe.createPrefix(R);if(L)return Pe.createSuffix(L);throw new Error("Invalid prefix/suffix payload for create")},onSuccess:()=>{m.invalidateQueries({queryKey:["prefixSuffix"]}),ge.success(w("msg.successfullyCompleted")),a()},onError:z=>{F(z)}}),xe=z=>{z.preventDefault(),X()},ie=()=>j?f.trim()!==""&&g.trim()!=="":E?f.trim()!==""&&g.trim()!==""&&v:f.trim()!==""&&g.trim()!=="";return e.jsx(Qe,{open:t,onOpenChange:r,children:e.jsxs(Ge,{className:"sm:max-w-[500px] dark:bg-gray-800",children:[e.jsx(We,{children:e.jsxs(Ye,{className:"dark:text-white",children:[l?w("contentManagement.edit"):w("contentManagement.add")," ",w(`contentManagement.${s}`)]})}),e.jsxs("form",{onSubmit:xe,className:"space-y-4",children:[j?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameAm",className:"dark:text-gray-200",children:[w("contentManagement.amharicName")," *"]}),e.jsx(ke,{id:"nameAm",value:f,onChange:z=>y(z.target.value),placeholder:w("contentManagement.amharicName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameEn",className:"dark:text-gray-200",children:[w("contentManagement.englishName")," *"]}),e.jsx(ke,{id:"nameEn",value:g,onChange:z=>x(z.target.value),placeholder:w("contentManagement.englishName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameAm",className:"dark:text-gray-200",children:[w("contentManagement.amharicName")," *"]}),e.jsx(ke,{id:"nameAm",value:f,onChange:z=>y(z.target.value),placeholder:w("contentManagement.amharicName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameEn",className:"dark:text-gray-200",children:[w("contentManagement.englishName")," *"]}),e.jsx(ke,{id:"nameEn",value:g,onChange:z=>x(z.target.value),placeholder:w("contentManagement.englishName"),disabled:W,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]})]}),E&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"position",className:"dark:text-gray-200",children:[w("contentManagement.position")," *"]}),e.jsx(Za,{options:C,value:v,onValueChange:p,placeholder:w("contentManagement.selectPosition"),className:W?"pointer-events-none opacity-60":""})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(J,{type:"button",variant:"outline",onClick:r,disabled:W,children:w("common.Cancel")}),e.jsx(J,{type:"submit",disabled:!ie()||W,className:"bg-purple-600 hover:bg-purple-700",children:W?w("contentManagement.saving"):k&&(_.referenceNumberPrefix||_.externalReferenceNumberPrefix||_.internalMemoReferenceNumberPrefix)||l?w("common.update"):w("common.save")})]})]})]})})},ts=(t,r,a=0,n=10)=>Ee({queryKey:["prefixes",t,r,{cc:!1}],queryFn:()=>Pe.getPrefix(t,r,a,n),enabled:!!t&&!!r}),rs=(t,r,a=0,n=10)=>Ee({queryKey:["prefixes",t,r,{cc:!0}],queryFn:()=>Pe.getPrefixCC(t,r,a,n),enabled:!!t&&!!r}),as=(t,r,a=0,n=10)=>Ee({queryKey:["prefixes-by-position",t,r],queryFn:()=>Pe.getPrefixByPosition(t,r,a,n),enabled:!!t&&!!r}),ns=()=>{const t=_e();return Ne({mutationFn:({id:r})=>Pe.deletePrefix(r),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["prefixes",a.unitId,a.recordTypeKey,{cc:a.isForCC}]}),t.invalidateQueries({queryKey:["prefix",a.id]})}})},ss=(t,r,a=0,n=10)=>Ee({queryKey:["suffixes",t,r,{cc:!1}],queryFn:()=>Pe.getSuffix(t,r,a,n),enabled:!!t&&!!r}),is=(t,r,a=0,n=10)=>Ee({queryKey:["suffixes",t,r,{cc:!0}],queryFn:()=>Pe.getSuffixCC(t,r,a,n),enabled:!!t&&!!r}),os=()=>{const t=_e();return Ne({mutationFn:({id:r})=>Pe.deleteSuffix(r),onSuccess:(r,a)=>{t.invalidateQueries({queryKey:["suffixes",a.unitId,a.recordTypeKey,{cc:a.isForCC}]}),t.invalidateQueries({queryKey:["suffix",a.id]})}})},ls=({unitId:t,recordTagId:r,skip:a=0,take:n=10})=>{const{t:s}=Ie(),{handleError:i}=dt(s),o=_e(),{data:d,isLoading:m,isError:l,refetch:f}=Ee({queryKey:["recordTagPrefixes",t,r,a,n],queryFn:async()=>{const{data:p}=await Pe.getPrefixByRecordTagId(t,r,a,n);return p},enabled:!!t&&!!r,staleTime:300*1e3,retry:!1}),{mutate:y,isPending:g}=Ne({mutationFn:async p=>{const{data:j}=await Pe.createPrefix(p);return j},onSuccess:()=>{ge.success(s("prefixes.createdSuccess")||"Prefix created successfully ✅"),o.invalidateQueries({queryKey:["recordTagPrefixes",t,r]})},onError:p=>{i(p)}}),{mutate:x,isPending:v}=Ne({mutationFn:async p=>{const{data:j}=await Pe.deletePrefix(p);return j},onSuccess:()=>{ge.success(s("prefixes.deletedSuccess")||"Prefix deleted successfully 🗑️"),o.invalidateQueries({queryKey:["recordTagPrefixes",t,r]})},onError:p=>{i(p)}});return{prefixes:(d==null?void 0:d.items)??[],total:(d==null?void 0:d.count)??0,isLoadingPrefixes:m,isErrorPrefixes:l,refetchPrefixes:f,createPrefix:y,isCreatingPrefix:g,deletePrefix:x,isDeletingPrefix:v}},kt={getRecordTags:t=>He.get(`/record-tags/${t}`,{headers:ae()}),getRecordTagsListWithUnitById:t=>He.get(`/record-tags/list/${t}`,{headers:ae()}),createRecordTags:t=>He.post("/record-tags",{...t,recordTypeKey:"external"},{headers:ae()}),updateEmployee:(t,r)=>He.put(`/record-tags/${t}`,r,{headers:ae()}),deleteEmployee:t=>He.delete(`/record-tags/${t}`,{headers:ae()})},Mt=({unitId:t,recordTagId:r})=>{const{t:a}=Ie(),{handleError:n}=dt(a),{data:s,isLoading:i,isError:o,refetch:d}=Ee({queryKey:["recordTagsList",t],queryFn:async()=>{const{data:b}=await kt.getRecordTagsListWithUnitById(t);return b},enabled:!!t,staleTime:300*1e3,retry:!1}),{data:m,isLoading:l,isError:f,refetch:y}=Ee({queryKey:["recordTag",r],queryFn:async()=>{const{data:b}=await kt.getRecordTags(r);return b},enabled:!!r,staleTime:300*1e3,retry:!1}),{mutate:g,isPending:x}=Ne({mutationFn:async b=>{const{data:k}=await kt.createRecordTags(b);return k},onSuccess:()=>{ge.success("Record Tag created successfully ✅"),d()},onError:b=>{n(b)}}),{mutate:v,isPending:p}=Ne({mutationFn:async({id:b,payload:k})=>{const{data:N}=await kt.updateEmployee(b,k);return N},onSuccess:()=>{ge.success("Record Tag updated successfully ✨"),d()},onError:b=>{n(b)}}),{mutate:j,isPending:E}=Ne({mutationFn:async b=>{const{data:k}=await kt.deleteEmployee(b);return k},onSuccess:()=>{ge.success("Record Tag deleted successfully 🗑️"),d()},onError:b=>{n(b)}});return{recordTagsList:s,isLoadingRecordTagsList:i,isErrorRecordTagsList:o,refetchRecordTagsList:d,recordTag:m,isLoadingRecordTag:l,isErrorRecordTag:f,refetchRecordTag:y,createRecordTag:g,isCreatingRecordTag:x,updateRecordTag:v,isUpdatingRecordTag:p,deleteRecordTag:j,isDeletingRecordTag:E}};function cs({unitId:t,selectedTagIds:r,onChange:a,placeholder:n="Select tags...",multiple:s=!0,disabled:i=!1,className:o,maxDisplayTags:d=3,error:m}){const{t:l}=Ie(),[f,y]=c.useState(!1),g=At(),{recordTagsList:x,isLoadingRecordTagsList:v,isErrorRecordTagsList:p}=Mt({unitId:t}),j=(x==null?void 0:x.items)??[],E=j.filter(u=>r.includes(u.id)),b=c.useCallback(u=>{s?a(r.includes(u)?r.filter(C=>C!==u):[...r,u]):(a(r.includes(u)?[]:[u]),y(!1))},[s,a,r]),k=c.useCallback((u,C)=>{u.stopPropagation(),a(r.filter(M=>M!==C))},[a,r]),N=c.useCallback(u=>{u.stopPropagation(),a([])},[a]);return e.jsxs("div",{className:be("flex flex-col gap-1.5",o),children:[e.jsxs(en,{open:f,onOpenChange:y,children:[e.jsx(tn,{asChild:!0,children:e.jsxs(J,{variant:"outline",role:"combobox","aria-expanded":f,disabled:i||v,className:be("w-full justify-between min-h-[40px] h-auto px-3 py-2",!s&&E.length>0&&"justify-start gap-2",m&&"border-destructive ring-destructive","hover:bg-accent"),children:[v?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(lr,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:l("common.loading")})]}):E.length===0?e.jsx("span",{className:"text-muted-foreground text-sm",children:n}):s?e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 flex-1",children:[E.slice(0,d).map(u=>e.jsxs(cr,{variant:"secondary",className:"gap-1 px-2 py-0.5 text-xs font-medium cursor-default",style:{backgroundColor:u.color?`${u.color}20`:void 0,color:u.color,borderColor:u.color},children:[u.name,e.jsx(lt,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:C=>k(C,u.id)})]},u.id)),E.length>d&&e.jsxs(cr,{variant:"secondary",className:"text-xs",children:["+",E.length-d]})]}):e.jsx("div",{className:"flex items-center gap-2 flex-1",children:e.jsx("span",{className:"text-sm",children:g(E[0].name)})}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[E.length>0&&!i&&e.jsx(lt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground cursor-pointer",onClick:N}),e.jsx(wn,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})]})}),e.jsx(rn,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(an,{children:[e.jsx(nn,{placeholder:l("common.search")||"Search tags..."}),e.jsxs(sn,{children:[e.jsx(on,{children:p?e.jsx("div",{className:"py-6 text-center text-sm text-destructive",children:l("common.errorLoading")}):l("common.noResults")||"No tags found."}),e.jsx(ln,{children:j.map(u=>{const C=r.includes(u.id);return e.jsx(cn,{value:u.id,onSelect:()=>b(u.id),className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:be("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",C?"bg-primary text-primary-foreground":"opacity-50"),children:C&&e.jsx(_a,{className:"h-3 w-3"})}),e.jsx("span",{className:"flex-1 text-sm",children:g(u.name)})]})},u.id)})})]})]})})]}),m&&e.jsx("p",{className:"text-xs text-destructive",children:m})]})}function ds({className:t,...r}){return e.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:be("mx-auto flex w-full justify-center",t),...r})}function us({className:t,...r}){return e.jsx("ul",{"data-slot":"pagination-content",className:be("flex flex-row items-center gap-1",t),...r})}function ar({...t}){return e.jsx("li",{"data-slot":"pagination-item",...t})}function Nr({className:t,isActive:r,size:a="icon",...n}){return e.jsx("a",{"aria-current":r?"page":void 0,"data-slot":"pagination-link","data-active":r,className:be(Da({variant:r?"outline":"ghost",size:a}),t),...n})}function ms({className:t,...r}){return e.jsxs(Nr,{"aria-label":"Go to previous page",size:"default",className:be("gap-1 px-2.5 sm:pl-2.5",t),...r,children:[e.jsx(ma,{}),e.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function gs({className:t,...r}){return e.jsxs(Nr,{"aria-label":"Go to next page",size:"default",className:be("gap-1 px-2.5 sm:pr-2.5",t),...r,children:[e.jsx("span",{className:"hidden sm:block",children:"Next"}),e.jsx(vr,{})]})}function ps({unitId:t,className:r}){const{t:a}=Ie(),n=At(),[s,i]=c.useState(""),[o,d]=c.useState(!1),[m,l]=c.useState(null),[f,y]=c.useState(1),g=10,x=(f-1)*g,{recordTagsList:v,isLoadingRecordTagsList:p}=Mt({unitId:t}),{prefixes:j,total:E,isLoadingPrefixes:b,isErrorPrefixes:k,createPrefix:N,isCreatingPrefix:u,deletePrefix:C,isDeletingPrefix:M}=ls({unitId:t,recordTagId:s||void 0,skip:x,take:g}),I=Math.ceil(E/g);c.useEffect(()=>{y(1)},[s]);const se=c.useMemo(()=>{var F;return(F=v==null?void 0:v.items)==null?void 0:F.find(_=>_.id===s)},[v,s]),Y=c.useCallback(F=>{var xe,ie;F.preventDefault();const _=new FormData(F.currentTarget),ne=(xe=_.get("nameAm"))==null?void 0:xe.trim(),X=(ie=_.get("nameEn"))==null?void 0:ie.trim();if(!ne||!X)return;N({name:{am:ne,en:X},unitId:t,isForCC:!1,recordTagId:s||void 0},{onSuccess:()=>{d(!1)}})},[N,s,t]),$=c.useCallback(()=>{m&&C(m,{onSuccess:()=>l(null)})},[C,m]);return e.jsxs("div",{className:be("space-y-6",r),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-end gap-4",children:[e.jsxs("div",{className:"flex-1 w-full sm:w-auto space-y-2",children:[e.jsx(Ce,{className:"text-sm font-medium",children:a("nav.selectTag")||"Select Record Tag"}),e.jsx(cs,{unitId:t,selectedTagIds:s?[s]:[],onChange:F=>i(F[0]||""),placeholder:a("nav.selectTag")||"Choose a tag to view prefixes...",multiple:!1,disabled:p})]}),e.jsxs(Qe,{open:o,onOpenChange:d,children:[e.jsx(jr,{asChild:!0,children:e.jsxs(J,{className:"shrink-0",disabled:!s||b,children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),a("contentManagement.addPrefix")||"Add Prefix"]})}),e.jsxs(Ge,{className:"sm:max-w-[500px]",children:[e.jsx(We,{children:e.jsx(Ye,{children:a("contentManagement.addPrefix")||"Add New Prefix"})}),e.jsxs("form",{id:"add-prefix-form",onSubmit:Y,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameAm",className:"dark:text-gray-200",children:[a("contentManagement.amharicName")," *"]}),e.jsx(ke,{id:"nameAm",name:"nameAm",placeholder:a("contentManagement.amharicName"),required:!0,autoFocus:!0,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ce,{htmlFor:"nameEn",className:"dark:text-gray-200",children:[a("contentManagement.englishName")," *"]}),e.jsx(ke,{id:"nameEn",name:"nameEn",placeholder:a("contentManagement.englishName"),required:!0,className:"dark:bg-gray-700 dark:border-gray-600 dark:text-white"})]})]}),e.jsxs(Ia,{children:[e.jsx(J,{type:"button",variant:"outline",onClick:()=>d(!1),children:a("common.cancel")||"Cancel"}),e.jsxs(J,{type:"submit",form:"add-prefix-form",disabled:u,children:[u&&e.jsx(lr,{className:"h-4 w-4 mr-2 animate-spin"}),a("common.save")||"Save"]})]})]})]})]}),se&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:"Showing prefixes for:"}),e.jsx(cr,{variant:"outline",children:n(se.name)}),e.jsxs("span",{className:"text-xs",children:["(",E," items)"]})]}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(la,{children:[e.jsx(ca,{children:e.jsxs(Ze,{children:[e.jsx(Ve,{className:"w-[80px]",children:a("common.no")||"#"}),e.jsx(Ve,{children:a("contentManagement.amharicName")}),e.jsx(Ve,{children:a("contentManagement.englishName")}),e.jsx(Ve,{children:a("contentManagement.createdAt")||"Created"}),e.jsx(Ve,{className:"w-[100px] text-right",children:a("common.actions")||"Actions"})]})}),e.jsxs(da,{children:[b&&e.jsx(e.Fragment,{children:Array.from({length:5}).map((F,_)=>e.jsxs(Ze,{children:[e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-8"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-24"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-20"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-32"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-4 w-24"})}),e.jsx(Te,{children:e.jsx(et,{className:"h-8 w-8 ml-auto"})})]},`skeleton-${_}`))}),k&&!b&&e.jsx(Ze,{children:e.jsx(Te,{colSpan:6,className:"h-32 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(dn,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm",children:a("common.errorLoading")||"Failed to load prefixes"}),e.jsx(J,{variant:"outline",size:"sm",onClick:()=>window.location.reload(),children:a("common.retry")||"Retry"})]})})}),!b&&!k&&e.jsxs(e.Fragment,{children:[!s&&e.jsx(Ze,{children:e.jsx(Te,{colSpan:6,className:"h-32 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("span",{className:"text-2xl",children:"🏷️"}),e.jsx("p",{className:"text-sm",children:a("nav.selectTag")||"Select a tag above to view its prefixes"})]})})}),s&&j.length===0&&e.jsx(Ze,{children:e.jsx(Te,{colSpan:6,className:"h-32 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx(ct,{className:"h-8 w-8 opacity-50"}),e.jsx("p",{className:"text-sm",children:a("nav.emptyState")||"No prefixes found for this tag"}),e.jsx(J,{variant:"outline",size:"sm",onClick:()=>d(!0),children:a("nav.addNew")||"Add your first prefix"})]})})}),j.map((F,_)=>{var ne,X;return e.jsxs(Ze,{className:"group",children:[e.jsx(Te,{className:"text-muted-foreground text-sm",children:x+_+1}),e.jsx(Te,{className:"font-medium",children:((ne=F.name)==null?void 0:ne.am)||e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(Te,{children:((X=F.name)==null?void 0:X.en)||e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(Te,{className:"text-muted-foreground text-sm",children:new Date(F.createdAt).toLocaleDateString()}),e.jsx(Te,{className:"text-right",children:e.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>l(F.id),disabled:M,children:e.jsx(Rt,{className:"h-4 w-4"})})})]},F.id)})]})]})]})}),I>1&&e.jsx(ds,{children:e.jsxs(us,{children:[e.jsx(ar,{children:e.jsx(ms,{onClick:()=>y(F=>Math.max(1,F-1)),className:be(f===1&&"pointer-events-none opacity-50")})}),Array.from({length:I},(F,_)=>_+1).map(F=>e.jsx(ar,{children:e.jsx(Nr,{isActive:f===F,onClick:()=>y(F),children:F})},F)),e.jsx(ar,{children:e.jsx(gs,{onClick:()=>y(F=>Math.min(I,F+1)),className:be(f===I&&"pointer-events-none opacity-50")})})]})}),e.jsx(Bt,{open:!!m,onOpenChange:F=>!F&&l(null),children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:a("prefixes.deleteConfirmTitle")||"Delete Prefix?"}),e.jsx(Vt,{children:a("prefixes.deleteConfirmDescription")||"This action cannot be undone. This will permanently delete the prefix."})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{disabled:M,children:a("common.cancel")||"Cancel"}),e.jsxs(Wt,{onClick:$,disabled:M,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[M&&e.jsx(lr,{className:"h-4 w-4 mr-2 animate-spin"}),a("common.delete")||"Delete"]})]})]})})]})}const fs=[{id:"internal",label:"nav.internal"},{id:"external",label:"nav.external"},{id:"internal_memo",label:"nav.internal_memo"},{id:"branch",label:"nav.branch"},{id:"tag-based-reference",label:"nav.tagBasedReference"},{id:"referenceNumber",label:"userRecord.Reference"},{id:"positionPrefix",label:"contentManagement.positionPrefixes"}],Nt=t=>t==="positionPrefix"?"internalPrefix":t==="referenceNumber"?"reference":"prefix",hs=({unitId:t,initialTab:r="internal"})=>{var H,ue,D,we,S,B,V;const{handleError:a}=dt(w),[n,s]=c.useState(r),[i,o]=c.useState(Nt(r)),[d,m]=c.useState(!1),[l,f]=c.useState(null),y=_e(),{mutateAsync:g}=ns(),{mutateAsync:x}=os(),{usePositionListByUnitId:v}=Ja(),{data:p}=v(t,{take:1e3,skip:0}),j=(p==null?void 0:p.items)||[];c.useEffect(()=>{s(r),o(Nt(r))},[r]),c.useEffect(()=>{o(Nt(n))},[n]);const E=A=>{f({cardType:A,recordType:n}),m(!0)},b=A=>{f({cardType:A.type,recordType:n,editingItem:A}),m(!0)},k=async(A,K,he)=>{if(K==="reference"||K==="externalReference"||K==="internalMemoReference"){ge.error(w("msg.errorOccurred"));return}const Oe=K==="prefix"||K==="prefixCC"||K==="internalPrefix"||K==="externalPrefix"||K==="internalMemoPrefix",ce=K==="prefixCC"||K==="suffixCC",ve=he||(K==="internalPrefix"?"internal":K==="externalPrefix"?"external":K==="internalMemoPrefix"?"internal_memo":n);try{Oe?(await g({id:A,unitId:t,recordTypeKey:ve,isForCC:ce}),n==="positionPrefix"&&y.invalidateQueries({queryKey:["prefixes-by-position",t,ve]})):await x({id:A,unitId:t,recordTypeKey:ve,isForCC:ce}),y.invalidateQueries({queryKey:["prefixSuffix"]}),ge.success(w("contentManagement.deleted"))}catch(qe){a(qe)}},N=()=>{m(!1),f(null)},u=()=>{const A=(l==null?void 0:l.cardType)??i,K=(l==null?void 0:l.recordType)??n,he=A==="prefixCC"||A==="suffixCC",Ue=A==="prefix"||A==="prefixCC"||A==="internalPrefix"||A==="externalPrefix"||A==="internalMemoPrefix"||K==="referenceNumber",Oe=K==="referenceNumber"?A:K==="positionPrefix"?A==="internalPrefix"?"internal":A==="internalMemoPrefix"?"internal_memo":"external":K;Ue?(K==="positionPrefix"&&y.invalidateQueries({queryKey:["prefixes-by-position",t,Oe]}),y.invalidateQueries({queryKey:["prefixes",t,Oe,{cc:he}]})):y.invalidateQueries({queryKey:["suffixes",t,Oe,{cc:he}]}),y.invalidateQueries({queryKey:["prefixSuffix"]}),N()},M=n==="positionPrefix"?[{id:"internalPrefix",label:"contentManagement.internalPrefix"},{id:"externalPrefix",label:"contentManagement.externalPrefix"},{id:"internalMemoPrefix",label:"contentManagement.internalMemoPrefix"}]:n==="referenceNumber"?[{id:"reference",label:"contentManagement.reference"},{id:"externalReference",label:"contentManagement.externalReference"},{id:"internalMemoReference",label:"contentManagement.internalMemoReference"}]:[{id:"prefix",label:"contentManagement.prefix"},{id:"suffix",label:"contentManagement.suffix"},{id:"prefixCC",label:"contentManagement.prefixCC"},{id:"suffixCC",label:"contentManagement.suffixCC"}];c.useEffect(()=>{var A;M.some(K=>K.id===i)||o(((A=M[0])==null?void 0:A.id)||Nt(n))},[M,i,n]);const I=i==="prefixCC"||i==="suffixCC",se=n==="referenceNumber",Y=n==="positionPrefix",$=n==="tag-based-reference",F=i==="prefix"||i==="prefixCC"||i==="internalPrefix"||i==="externalPrefix"||i==="internalMemoPrefix"||se,_=i==="internalPrefix"?"internal":i==="externalPrefix"?"external":i==="internalMemoPrefix"?"internal_memo":"",ne=n==="positionPrefix"?_:n,{data:X,isLoading:W,error:xe}=fa(se?t:""),{data:ie,isLoading:Ae,error:je}=ts(t,F&&!I&&!se&&!Y&&!$?ne:"",0,1e3),{data:z,isLoading:O,error:R}=as(t,Y?_:"",0,1e3),{data:L,isLoading:T,error:h}=rs(t,F&&I&&!se?ne:"",0,1e3),{data:U,isLoading:P,error:Z}=ss(t,!F&&!I&&!se?ne:"",0,1e3),{data:ee,isLoading:te,error:q}=is(t,!F&&I&&!se?ne:"",0,1e3),de=c.useMemo(()=>[xe,R,je,h,Z,q].find(Boolean),[xe,R,je,h,Z,q]),fe=c.useRef(null);c.useEffect(()=>{!de||de===fe.current||(fe.current=de,a(de))},[de,a]);const Q=(X==null?void 0:X.data)||[],le=Q==null?void 0:Q.find(A=>A.name==="referenceNumberPrefix"),G=Q==null?void 0:Q.find(A=>A.name==="externalReferenceNumberPrefix"),oe=Q==null?void 0:Q.find(A=>A.name==="internalMemoReferenceNumberPrefix"),Re=A=>{if(!A)return"";if(typeof A=="string")try{const K=JSON.parse(A);return(K==null?void 0:K.am)??A}catch{return A}return typeof A=="object"?(A==null?void 0:A.am)??"":""},ye=[{id:"referenceNumberPrefix",type:"reference",recordTypeKey:"reference",isForCC:!1,name:{am:Re(le==null?void 0:le.number),en:Re((H=le==null?void 0:le.number)==null?void 0:H.en)},count:(le==null?void 0:le.count)??0,sequenceId:le==null?void 0:le.sequenceId},{id:"externalReferenceNumberPrefix",type:"externalReference",recordTypeKey:"externalReference",isForCC:!1,name:{am:Re((ue=G==null?void 0:G.number)==null?void 0:ue.am),en:Re((D=G==null?void 0:G.number)==null?void 0:D.en)},count:(G==null?void 0:G.count)??0,sequenceId:G==null?void 0:G.sequenceId},{id:"internalMemoReferenceNumberPrefix",type:"internalMemoReference",recordTypeKey:"internalMemoReference",isForCC:!1,name:{am:Re((we=oe==null?void 0:oe.number)==null?void 0:we.am),en:Re((S=oe==null?void 0:oe.number)==null?void 0:S.en)},count:(oe==null?void 0:oe.count)??0,sequenceId:oe==null?void 0:oe.sequenceId}].filter(A=>A.type===i),$e=Y?z:F?I?L:ie:I?ee:U,ze=se?ye:((V=(B=$e==null?void 0:$e.data)==null?void 0:B.items)==null?void 0:V.map(A=>({...A,type:n==="positionPrefix"?A.recordTypeKey==="internal"?"internalPrefix":A.recordTypeKey==="internal_memo"?"internalMemoPrefix":"externalPrefix":F?I?"prefixCC":"prefix":I?"suffixCC":"suffix",isForCC:I||A.isForCC})))||[],Se=W||O||Ae||T||P||te;return e.jsxs("div",{className:"space-y-6 p-4",children:[e.jsx("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:fs.map(A=>e.jsx("button",{onClick:()=>{s(A.id),o(Nt(A.id))},className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${n===A.id?"border-purple-600 text-purple-600 dark:text-purple-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-300 dark:hover:border-gray-600"}`,children:w(A.label)},A.id))}),n==="tag-based-reference"?e.jsx(ps,{unitId:t,className:"w-full"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-4",children:M.map(A=>e.jsx(Ke,{onClick:()=>o(A.id),className:`inline-flex w-fit min-w-[260px] max-w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer dark:bg-gray-800 dark:border-gray-700 ${i===A.id?"ring-2 ring-purple-600 dark:ring-purple-400":""}`,children:e.jsx(it,{className:"pb-2 items-center",children:e.jsx(ot,{className:"text-sm font-medium text-gray-700 dark:text-gray-200 text-center whitespace-nowrap",children:w(A.label)})})},A.id))}),e.jsx("div",{className:"flex justify-end mb-4",children:e.jsxs(J,{onClick:()=>E(i),children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),w("contentManagement.add")]})}),e.jsx(Yn,{items:ze,isLoading:Se,onEdit:b,onDelete:k,showPositionColumn:n==="positionPrefix",showCountColumn:n==="positionPrefix"||n==="referenceNumber",positions:j}),d&&l&&e.jsx(es,{open:d,onClose:N,onSuccess:u,unitId:t,cardType:l.cardType,recordType:l.recordType,editingItem:l.editingItem,positions:j})]})]})},xs=async t=>(await re.get(`/units/${t}/requirement-satisfied`,{headers:ae()})).data;function ys({unitId:t}){const[r,a]=c.useState(t||""),[n,s]=c.useState(!0);c.useEffect(()=>{const l=f=>a(f.detail);return window.addEventListener("unitChanged",l),()=>window.removeEventListener("unitChanged",l)},[]);const{data:i,isLoading:o,refetch:d}=Ee({queryKey:["admin-setup-requirements",r],queryFn:()=>xs(r),enabled:!!r}),m=i==null?void 0:i.requirements;return c.useEffect(()=>{r&&d()},[r,d]),!m||Object.values(m).every(Boolean)||!n?null:e.jsxs("div",{className:"relative flex items-center gap-6 p-2 border rounded bg-amber-50 shadow-2xl top-10 left-1/2 -translate-x-1/2 z-[1000] w-full",children:[e.jsx("h3",{className:"font-semibold text-amber-700 whitespace-nowrap",children:"Finish site setup"}),o?e.jsx("p",{className:"text-sm text-slate-600",children:"Loading requirements..."}):e.jsxs("div",{className:"flex flex-wrap gap-6 text-sm text-slate-600",children:[!m.hasFooter&&e.jsx("span",{children:"⚠️ Missing Footer"}),!m.hasSeal&&e.jsx("span",{children:"⚠️ Missing Seal"}),!m.hasHeader&&e.jsx("span",{children:"⚠️ Missing Header"}),!m.internalPrefix&&e.jsx("span",{children:"⚠️ Missing Internal Prefix"}),!m.externalPrefix&&e.jsx("span",{children:"⚠️ Missing External Prefix"}),!m.internalSuffix&&e.jsx("span",{children:"⚠️ Missing Internal Suffix"}),!m.externalSuffix&&e.jsx("span",{children:"⚠️ Missing External Suffix"})]}),e.jsx("button",{onClick:()=>s(!1),className:"absolute top-2 right-2 text-amber-700 hover:text-red-600",children:e.jsx(lt,{size:16})})]})}const bs=gn({nameAm:Lt().min(1,"Amharic name is required"),nameEn:Lt().min(1,"English name is required"),key:Lt().min(1,"Key is required"),unitId:Lt().min(1,"Unit is required")});function ha({defaultValues:t,unitId:r,mode:a,id:n,onSuccess:s}){const i=ua({resolver:mn(bs),defaultValues:{nameAm:(t==null?void 0:t.nameAm)??"",nameEn:(t==null?void 0:t.nameEn)??"",key:(t==null?void 0:t.key)??"",unitId:(t==null?void 0:t.unitId)??r}}),{createRecordTag:o,updateRecordTag:d,isCreatingRecordTag:m,isUpdatingRecordTag:l}=Mt({unitId:r}),f=y=>{if(a==="create"){const g={name:{am:y.nameAm,en:y.nameEn},key:y.key,unitId:y.unitId};o(g,{onSuccess:()=>{i.reset(),s==null||s()}})}else if(a==="edit"&&n){const g={name:{am:y.nameAm,en:y.nameEn},key:y.key,unitId:y.unitId};d({id:n,payload:g},{onSuccess:()=>{s==null||s()}})}};return e.jsx(pn,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(f),className:"space-y-4",children:[e.jsx(Jt,{control:i.control,name:"nameAm",render:({field:y})=>e.jsxs(Zt,{children:[e.jsx(er,{children:"Amharic Name"}),e.jsx(tr,{children:e.jsx(ke,{placeholder:"Enter Amharic name",...y})}),e.jsx(rr,{})]})}),e.jsx(Jt,{control:i.control,name:"nameEn",render:({field:y})=>e.jsxs(Zt,{children:[e.jsx(er,{children:"English Name"}),e.jsx(tr,{children:e.jsx(ke,{placeholder:"Enter English name",...y})}),e.jsx(rr,{})]})}),e.jsx(Jt,{control:i.control,name:"key",render:({field:y})=>e.jsxs(Zt,{children:[e.jsx(er,{children:"Key"}),e.jsx(tr,{children:e.jsx(ke,{placeholder:"Unique key",...y})}),e.jsx(rr,{})]})}),e.jsx(J,{type:"submit",disabled:m||l,children:a==="create"?m?"Creating...":"Create":l?"Updating...":"Update"})]})})}function vs({row:t,unitId:r}){var x,v,p;const[a,n]=c.useState(!1),[s,i]=c.useState(!1),[o,d]=c.useState(!1),{deleteRecordTag:m,refetchRecordTagsList:l}=Mt({unitId:r}),{t:f}=Ie(),{handleError:y}=dt(f),g=()=>{d(!0),m(t.id,{onSuccess:()=>{l(),i(!1)},onError:j=>{y(j)},onSettled:()=>{d(!1)}})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{variant:"outline",size:"sm",onClick:()=>n(!0),children:e.jsx(wr,{className:"h-4 w-4"})}),e.jsx(J,{variant:"destructive",size:"sm",onClick:()=>i(!0),children:e.jsx(Rt,{className:"h-4 w-4"})})]}),e.jsx(Qe,{open:a,onOpenChange:n,children:e.jsxs(Ge,{children:[e.jsx(We,{children:e.jsx(Ye,{children:"Edit Record Tag"})}),e.jsx(ha,{unitId:r,mode:"edit",id:t.id,defaultValues:{nameAm:((x=t.name)==null?void 0:x.am)??"",nameEn:((v=t.name)==null?void 0:v.en)??"",key:t.key,unitId:t.unitId},onSuccess:()=>{n(!1),l()}})]})}),e.jsx(Bt,{open:s,onOpenChange:i,children:e.jsxs(Ut,{children:[e.jsxs(Ht,{children:[e.jsx(Kt,{children:"Are you sure you want to delete this record tag?"}),e.jsxs(Vt,{children:["This action cannot be undone. The record tag ",e.jsx("b",{children:(p=t.name)==null?void 0:p.en})," ","will be permanently removed."]})]}),e.jsxs(Qt,{children:[e.jsx(Gt,{disabled:o,children:"Cancel"}),e.jsx(Wt,{onClick:g,disabled:o,className:"bg-red-600 hover:bg-red-700",children:o?"Deleting...":"Delete"})]})]})})]})}const js=t=>[{accessorKey:"name",header:()=>w("recordTag.name"),cell:({row:r})=>{var s;const a=At(),n=(s=r.original)==null?void 0:s.name;return e.jsx("span",{children:a(n)})}},{accessorKey:"key",header:()=>w("recordTag.key"),cell:({row:r})=>{var n;const a=(n=r.original)==null?void 0:n.key;return e.jsx("span",{children:a||"--"})}},{accessorKey:"createdAt",header:()=>w("recordTag.CreatedAt"),cell:({row:r})=>{var n;const a=(n=r.original)==null?void 0:n.createdAt;return e.jsx("span",{children:a?fn(new Date(a),"MMM d, yyyy HH:mm"):"--"})}},{id:"actions",header:()=>w("recordTag.Actions"),cell:({row:r})=>e.jsx(vs,{row:r.original,unitId:t})}];function ws({unitId:t}){const[r,a]=c.useState(0),[n,s]=c.useState(!1),{t:i}=Ie(),{recordTagsList:o,isLoadingRecordTagsList:d,refetchRecordTagsList:m}=Mt({unitId:t??""}),l=f=>{a(f)};return d?e.jsx("div",{children:i("loading")}):e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(Ke,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsxs(it,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(ot,{className:"text-xl font-semibold",children:i("recordTag.title")}),e.jsxs(Qe,{open:n,onOpenChange:s,children:[e.jsx(jr,{asChild:!0,children:e.jsx(J,{children:i("recordTag.createNew")})}),e.jsxs(Ge,{children:[e.jsx(We,{children:e.jsx(Ye,{children:i("recordTag.createTitle")})}),e.jsx(ha,{unitId:t,mode:"create",onSuccess:()=>{s(!1),m()}})]})]})]}),e.jsx(pt,{className:"px-0",children:e.jsx(un,{columns:js(t),data:(o==null?void 0:o.items)||[],tableName:i("recordTag.tableName"),toolBarPosition:"right",itemCount:(o==null?void 0:o.count)||0,pageIndex:r,onPageChange:l,nextFunction:()=>l(r+1),prevFunction:()=>l(Math.max(r-1,0))})})]})})}const ks="adf98293-41ba-4bda-bdb4-70e30a70c1b7",Fe={"x-tenant-id":ks},Le=He,st=t=>({...t,name:t.name||{am:"",en:""},description:t.description||{am:"",en:""}}),St={async getResourceTypes(){return(await Le.get("/resource_types",{headers:Fe})).data},async getAllTemplates(t){try{const r=await Le.get("/templates",{params:t,headers:Fe});let a=(r.data.items||r.data||[]).map(st);if(t!=null&&t.search&&typeof t.search=="string"){const n=t.search.toLowerCase();a=a.filter(s=>{var i,o,d,m,l,f,y,g;return((o=(i=s.name)==null?void 0:i.en)==null?void 0:o.toLowerCase().includes(n))||((m=(d=s.name)==null?void 0:d.am)==null?void 0:m.toLowerCase().includes(n))||((f=(l=s.description)==null?void 0:l.en)==null?void 0:f.toLowerCase().includes(n))||((g=(y=s.description)==null?void 0:y.am)==null?void 0:g.toLowerCase().includes(n))})}return{count:a.length,items:a}}catch{return{count:0,items:[]}}},async getTemplates(t){const{resourceTypeId:r,search:a,...n}=t||{};if(!r)return{count:0,items:[]};let i=((await Le.get(`/resources/list-with-presigned/${r}`,{params:n,headers:Fe})).data.items||[]).map(st);if(a&&typeof a=="string"){const o=a.toLowerCase();i=i.filter(d=>{var m,l,f,y,g,x,v,p;return((l=(m=d.name)==null?void 0:m.en)==null?void 0:l.toLowerCase().includes(o))||((y=(f=d.name)==null?void 0:f.am)==null?void 0:y.toLowerCase().includes(o))||((x=(g=d.description)==null?void 0:g.en)==null?void 0:x.toLowerCase().includes(o))||((p=(v=d.description)==null?void 0:v.am)==null?void 0:p.toLowerCase().includes(o))})}return{count:i.length,items:i}},async getTemplate(t){const r=await Le.get(`/resources/with-presigned?id=${t}`,{headers:Fe});return st(r.data)},async getTemplateWithPresigned(t,r){var a;try{const i=((await Le.get(`/resources/list-with-presigned/${t}`,{headers:Fe})).data.items||[]).map(st).find(o=>o.id===r);if(!i)throw new Error("Template not found");return i}catch(n){if(((a=n.response)==null?void 0:a.status)===400)try{const i=await Le.get(`/resources/with-presigned?id=${r}`,{headers:Fe});return st(i.data)}catch{throw n}throw n}},async createTemplate(t){const r=await Le.post("/resources",t,{headers:Fe});return st(r.data)},async updateTemplate(t,r){const a=await Le.put(`/resources/${t}`,r,{headers:Fe});return st(a.data)},async deleteTemplate(t){await Le.delete(`/resources/${t}`,{headers:Fe})},async uploadFile(t,r){var s,i,o,d;if(!r)return null;const a=await hn.validateFileForUpload(t,{allowedMimeTypes:["image/png","image/jpeg","image/gif","image/webp","application/pdf"],allowedExtensions:[".png",".jpg",".jpeg",".gif",".webp",".pdf"],maxSizeMB:50,uploadContext:"signature"});if(!a.isValid)throw new Error(((s=a.clientValidation.fileName)==null?void 0:s.error)||((i=a.clientValidation.extension)==null?void 0:i.error)||((o=a.clientValidation.mimeType)==null?void 0:o.error)||((d=a.clientValidation.size)==null?void 0:d.error)||"File validation failed");const n=await fetch(r,{method:"PUT",headers:{"Content-Type":t.type},body:t});if(!n.ok){const m=await n.text();throw new Error(`Upload failed: ${n.status} ${n.statusText} -${m}`)}return n},async updateUploadStatus(t,r){await Le.put(`/resources/change-status/${t}`,{isCurrent:r},{headers:Fe})},async generateSampleTemplate(t,r){try{const a=await Le.post(`/templates/${t}/sample`,r,{responseType:"arraybuffer",headers:Fe}),n=new Blob([a.data],{type:"application/pdf"});return{pdf:URL.createObjectURL(n),contentType:"application/pdf"}}catch(a){throw a}},async getTemplateSettingsByUnit(t){try{const a=(await Le.get(`/template-settings/by-unit/${t}`,{headers:Fe})).data||{};return{count:a.count||0,items:a.items||[]}}catch{return{count:0,items:[]}}},async saveTemplateSettingValues(t){try{await Promise.all(t.map(r=>Le.post("/template-setting-values",r,{headers:Fe})))}catch(r){throw r}},async saveBulkTemplateSettingValues(t){try{await Le.post("/template-setting-values/bulk",t,{headers:Fe})}catch(r){throw r}}};var nr={exports:{}},me={};/** @license React v16.13.1 - * react-is.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Or;function Ns(){if(Or)return me;Or=1;var t=typeof Symbol=="function"&&Symbol.for,r=t?Symbol.for("react.element"):60103,a=t?Symbol.for("react.portal"):60106,n=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,d=t?Symbol.for("react.context"):60110,m=t?Symbol.for("react.async_mode"):60111,l=t?Symbol.for("react.concurrent_mode"):60111,f=t?Symbol.for("react.forward_ref"):60112,y=t?Symbol.for("react.suspense"):60113,g=t?Symbol.for("react.suspense_list"):60120,x=t?Symbol.for("react.memo"):60115,v=t?Symbol.for("react.lazy"):60116,p=t?Symbol.for("react.block"):60121,j=t?Symbol.for("react.fundamental"):60117,E=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function k(u){if(typeof u=="object"&&u!==null){var C=u.$$typeof;switch(C){case r:switch(u=u.type,u){case m:case l:case n:case i:case s:case y:return u;default:switch(u=u&&u.$$typeof,u){case d:case f:case v:case x:case o:return u;default:return C}}case a:return C}}}function N(u){return k(u)===l}return me.AsyncMode=m,me.ConcurrentMode=l,me.ContextConsumer=d,me.ContextProvider=o,me.Element=r,me.ForwardRef=f,me.Fragment=n,me.Lazy=v,me.Memo=x,me.Portal=a,me.Profiler=i,me.StrictMode=s,me.Suspense=y,me.isAsyncMode=function(u){return N(u)||k(u)===m},me.isConcurrentMode=N,me.isContextConsumer=function(u){return k(u)===d},me.isContextProvider=function(u){return k(u)===o},me.isElement=function(u){return typeof u=="object"&&u!==null&&u.$$typeof===r},me.isForwardRef=function(u){return k(u)===f},me.isFragment=function(u){return k(u)===n},me.isLazy=function(u){return k(u)===v},me.isMemo=function(u){return k(u)===x},me.isPortal=function(u){return k(u)===a},me.isProfiler=function(u){return k(u)===i},me.isStrictMode=function(u){return k(u)===s},me.isSuspense=function(u){return k(u)===y},me.isValidElementType=function(u){return typeof u=="string"||typeof u=="function"||u===n||u===l||u===i||u===s||u===y||u===g||typeof u=="object"&&u!==null&&(u.$$typeof===v||u.$$typeof===x||u.$$typeof===o||u.$$typeof===d||u.$$typeof===f||u.$$typeof===j||u.$$typeof===E||u.$$typeof===b||u.$$typeof===p)},me.typeOf=k,me}var Fr;function xa(){return Fr||(Fr=1,nr.exports=Ns()),nr.exports}var ya=xa();function Ss(t){function r(O,R,L,T,h){for(var U=0,P=0,Z=0,ee=0,te,q,de=0,fe=0,Q,le=Q=te=0,G=0,oe=0,Re=0,ye=0,$e=L.length,ze=$e-1,Se,H="",ue="",D="",we="",S;G<$e;){if(q=L.charCodeAt(G),G===ze&&P+ee+Z+U!==0&&(P!==0&&(q=P===47?10:47),ee=Z=U=0,$e++,ze++),P+ee+Z+U===0){if(G===ze&&(0te)&&(ye=(H=H.replace(" ",":")).length),0T&&(T=(R=R.trim()).charCodeAt(0)),T){case 38:return R.replace(E,"$1"+O.trim());case 58:return O.trim()+R.replace(E,"$1"+O.trim());default:if(0<1*L&&0P.charCodeAt(8))break;case 115:h=h.replace(P,"-webkit-"+P)+";"+h;break;case 207:case 102:h=h.replace(P,"-webkit-"+(102L.charCodeAt(0)&&(L=L.trim()),z=L,L=[z],01?r-1:0),n=1;n0?" Args: "+a.join(", "):""))}var Os=(function(){function t(a){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=a}var r=t.prototype;return r.indexOfGroup=function(a){for(var n=0,s=0;s=this.groupSizes.length){for(var s=this.groupSizes,i=s.length,o=i;a>=o;)(o<<=1)<0&&Ot(16,""+a);this.groupSizes=new Uint32Array(o),this.groupSizes.set(s),this.length=o;for(var d=i;d=this.length||this.groupSizes[a]===0)return n;for(var s=this.groupSizes[a],i=this.indexOfGroup(a),o=i+s,d=i;d=Ct&&(Ct=r+1),It.set(t,r),zt.set(r,t)},_s="style["+vt+'][data-styled-version="5.3.11"]',Ds=new RegExp("^"+vt+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),Is=function(t,r,a){for(var n,s=a.split(","),i=0,o=s.length;i=0;l--){var f=m[l];if(f&&f.nodeType===1&&f.hasAttribute(vt))return f}})(a),i=s!==void 0?s.nextSibling:null;n.setAttribute(vt,"active"),n.setAttribute("data-styled-version","5.3.11");var o=zs();return o&&n.setAttribute("nonce",o),a.insertBefore(n,i),n},qs=(function(){function t(a){var n=this.element=ba(a);n.appendChild(document.createTextNode("")),this.sheet=(function(s){if(s.sheet)return s.sheet;for(var i=document.styleSheets,o=0,d=i.length;o=0){var s=document.createTextNode(n),i=this.nodes[a];return this.element.insertBefore(s,i||null),this.length++,!0}return!1},r.deleteRule=function(a){this.element.removeChild(this.nodes[a]),this.length--},r.getRule=function(a){return a0&&(y+=g+",")})),i+=""+l+f+'{content:"'+y+`"}/*!sc*/ -`}}}return i})(this)},t})(),Ks=/(a)(d)/gi,zr=function(t){return String.fromCharCode(t+(t>25?39:97))};function ur(t){var r,a="";for(r=Math.abs(t);r>52;r=r/52|0)a=zr(r%52)+a;return(zr(r%52)+a).replace(Ks,"$1-$2")}var gt=function(t,r){for(var a=r.length;a;)t=33*t^r.charCodeAt(--a);return t},ja=function(t){return gt(5381,t)};function Vs(t){for(var r=0;r>>0);if(!a.hasNameForId(s,d)){var m=n(o,"."+d,void 0,s);a.insertRules(s,d,m)}i.push(d),this.staticRulesId=d}else{for(var l=this.rules.length,f=gt(this.baseHash,n.hash),y="",g=0;g>>0);if(!a.hasNameForId(s,j)){var E=n(y,"."+j,void 0,s);a.insertRules(s,j,E)}i.push(j)}}return i.join(" ")},t})(),Ws=/^\s*\/\/.*$/gm,Ys=[":","[",".","#"];function Xs(t){var r,a,n,s,i=rt,o=i.options,d=o===void 0?rt:o,m=i.plugins,l=m===void 0?$t:m,f=new Ss(d),y=[],g=(function(p){function j(E){if(E)try{p(E+"}")}catch{}}return function(E,b,k,N,u,C,M,I,se,Y){switch(E){case 1:if(se===0&&b.charCodeAt(0)===64)return p(b+";"),"";break;case 2:if(I===0)return b+"/*|*/";break;case 3:switch(I){case 102:case 112:return p(k[0]+b),"";default:return b+(Y===0?"/*|*/":"")}case-2:b.split("/*|*/}").forEach(j)}}})((function(p){y.push(p)})),x=function(p,j,E){return j===0&&Ys.indexOf(E[a.length])!==-1||E.match(s)?p:"."+r};function v(p,j,E,b){b===void 0&&(b="&");var k=p.replace(Ws,""),N=j&&E?E+" "+j+" { "+k+" }":k;return r=b,a=j,n=new RegExp("\\"+a+"\\b","g"),s=new RegExp("(\\"+a+"\\b){2,}"),f(E||!j?"":j,N)}return f.use([].concat(l,[function(p,j,E){p===2&&E.length&&E[0].lastIndexOf(a)>0&&(E[0]=E[0].replace(n,x))},g,function(p){if(p===-2){var j=y;return y=[],j}}])),v.hash=l.length?l.reduce((function(p,j){return j.name||Ot(15),gt(p,j.name)}),5381).toString():"",v}var wa=pe.createContext();wa.Consumer;var ka=pe.createContext(),Js=(ka.Consumer,new va),mr=Xs();function Zs(){return c.useContext(wa)||Js}function ei(){return c.useContext(ka)||mr}var ti=(function(){function t(r,a){var n=this;this.inject=function(s,i){i===void 0&&(i=mr);var o=n.name+i.hash;s.hasNameForId(n.id,o)||s.insertRules(n.id,o,i(n.rules,o,"@keyframes"))},this.toString=function(){return Ot(12,String(n.name))},this.name=r,this.id="sc-keyframes-"+r,this.rules=a}return t.prototype.getName=function(r){return r===void 0&&(r=mr),this.name+r.hash},t})(),ri=/([A-Z])/,ai=/([A-Z])/g,ni=/^ms-/,si=function(t){return"-"+t.toLowerCase()};function qr(t){return ri.test(t)?t.replace(ai,si).replace(ni,"-ms-"):t}var Br=function(t){return t==null||t===!1||t===""};function jt(t,r,a,n){if(Array.isArray(t)){for(var s,i=[],o=0,d=t.length;o1?r-1:0),n=1;n?@[\\\]^`{|}~-]+/g,ci=/(^-|-$)/g;function ir(t){return t.replace(li,"-").replace(ci,"")}var di=function(t){return ur(ja(t)>>>0)};function Dt(t){return typeof t=="string"&&!0}var gr=function(t){return typeof t=="function"||typeof t=="object"&&t!==null&&!Array.isArray(t)},ui=function(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"};function mi(t,r,a){var n=t[a];gr(r)&&gr(n)?Na(n,r):t[a]=r}function Na(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),n=1;n=0||(Y[I]=C[I]);return Y})(r,["componentId"]),u=k&&k+"-"+(Dt(b)?b:ir(Ir(b)));return Ca(b,Xe({},N,{attrs:g,componentId:u}),a)},Object.defineProperty(v,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(b){this._foldedDefaultProps=n?Na({},t.defaultProps,b):b}}),Object.defineProperty(v,"toString",{value:function(){return"."+v.styledComponentId}}),s&&Rs(v,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),v}var De=function(t){return(function r(a,n,s){if(s===void 0&&(s=rt),!ya.isValidElementType(n))return Ot(1,String(n));var i=function(){return a(n,s,ii.apply(void 0,arguments))};return i.withConfig=function(o){return r(a,n,Xe({},s,{},o))},i.attrs=function(o){return r(a,n,Xe({},s,{attrs:Array.prototype.concat(s.attrs,o).filter(Boolean)}))},i})(Ca,t)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(t){De[t]=De(t)}));var pr={accent:"#0096ff",background:"#ffffff",color:"#000000",inputBg:"#f3f4f8",inputColor:"#000000",inputError:"#e3005e",shadow:"0 5px 10px rgba(0, 0, 0, 0.04)",radius:4,spacing:8,fontSize:"13px"},at;(function(t){t[t.slider=0]="slider",t[t.text=1]="text",t[t.color=2]="color"})(at||(at={}));var tt=function(t,r,a){if(a||arguments.length===2)for(var n=0,s=r.length,i;n=0,f=l?d.slice(0,m):d,y=l?d.slice(m+1,d.length).trim():"";s.push({property:f,value:y,id:o})}),fr(s),s},xi=function(t){var r=[];t.forEach(function(n){n.property.trim()&&r.push("".concat(n.property.trim(),": ").concat(n.value.trim()))});var a=r.join(`; -`);return a},yi=function(t,r,a){c.useEffect(function(){if(r){var n=Aa(t);a(function(s){return JSON.stringify(s)===JSON.stringify(n)?s:n})}},[t,r])},bi=function(t){var r=c.useCallback(function(){var a=document.activeElement;if(!(!a||a.tagName.toLowerCase()!=="input")){var n=Number(a.getAttribute("data-editor-order")),s=t.current;if(s){var i=s.querySelector('input[data-editor-order="'.concat(n+1,'"]'));i&&i.select()}}},[]);return r},Ft=c.createContext(pr),vi=function(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t},hr=function(){return hr=Object.assign||function(t){for(var r,a=1,n=arguments.length;a`url('data:image/svg+xml;base64,${btoa('')}')`,ra=t=>{const r={};let a=0,n="";const s=i=>{if(i=i.trim(),!i)return;const o=i.indexOf(":");if(o<=0)return;const d=i.slice(0,o).trim(),m=i.slice(o+1).trim();d&&m&&(r[d]=m)};for(let i=0;iObject.entries(t).map(([r,a])=>`${r}: ${a};`).join(" "),Yi=({setting:t,index:r,onChange:a,isDefault:n,onToggleDefault:s})=>{const{t:i}=Ie(),[o,d]=c.useState(!1),m=c.useMemo(()=>typeof t.value=="string"?t.value:"",[t.value]),l=c.useMemo(()=>ra(m),[m]);c.useMemo(()=>{const p=new Set;return t.templateSettingValues&&t.templateSettingValues.length>0&&t.templateSettingValues.forEach(j=>{j.value&&typeof j.value=="object"&&Object.keys(j.value).forEach(E=>p.add(E))}),Array.from(p)},[t.templateSettingValues]);const f=c.useMemo(()=>{const p=t.code.toLowerCase();return p.includes("header")||p.includes("footer")},[t.code]),y=p=>{const j={...p};return j["list-style"]!=="disclosure-closed"&&delete j["list-style-image"],j["list-style"]==="disclosure-closed"&&(j["list-style-image"]=Wi()),j},g=c.useCallback((p,j)=>{let E={...l,[p]:j};p==="list-style"&&["disclosure-closed","disclosure-open","none"].includes(j)&&delete E["list-style-type"],E=y(E);const b=aa(E);a(r,b)},[l,r,a]);c.useEffect(()=>{const p=ra(m),j=y(p),E=aa(j);E!==m&&a(r,E)},[]);const x=c.useCallback(p=>{a(r,p)},[r,a]),v=c.useCallback(p=>{a(r,Gi[p])},[r,a]);return!t||!t.code||!t.id?null:e.jsxs("div",{className:"mt-4 p-4 bg-gray-50 dark:bg-gray-700 rounded-lg border border-gray-200 dark:border-gray-600 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:t.code.replace(/-/g," ")}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:()=>s(t.id),className:"w-4 h-4 rounded border-gray-300 dark:border-gray-500"}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:n?"Default":"Custom"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:i("template.quickPresets","Quick Presets")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("button",{onClick:()=>v("heading"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"Heading"}),e.jsx("button",{onClick:()=>v("body"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"Body"}),e.jsx("button",{onClick:()=>v("emphasis"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"Emphasis"}),e.jsx("button",{onClick:()=>v("list"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors dark:text-gray-200",children:"List"}),e.jsx("button",{onClick:()=>v("title"),className:"px-2 py-1 text-xs bg-white dark:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded hover:bg-purple-50 dark:hover:bg-purple-900/30 transition-colors col-span-2 dark:text-gray-200",children:"Title"})]})]}),e.jsxs("div",{className:"space-y-3 border-t border-gray-200 dark:border-gray-600 pt-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:i("template.commonProperties","Common Properties")}),f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.width","Width")}),e.jsx("input",{type:"text",value:l.width||"100%",onChange:p=>g("width",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.height","Height")}),e.jsx("input",{type:"text",value:l.height||"auto",onChange:p=>g("height",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.margin","Margin")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Top"}),e.jsx("input",{type:"text",value:l["margin-top"]||"0",onChange:p=>g("margin-top",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Right"}),e.jsx("input",{type:"text",value:l["margin-right"]||"0",onChange:p=>g("margin-right",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Bottom"}),e.jsx("input",{type:"text",value:l["margin-bottom"]||"0",onChange:p=>g("margin-bottom",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Left"}),e.jsx("input",{type:"text",value:l["margin-left"]||"0",onChange:p=>g("margin-left",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.padding","Padding")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Top"}),e.jsx("input",{type:"text",value:l["padding-top"]||"0",onChange:p=>g("padding-top",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Right"}),e.jsx("input",{type:"text",value:l["padding-right"]||"0",onChange:p=>g("padding-right",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Bottom"}),e.jsx("input",{type:"text",value:l["padding-bottom"]||"0",onChange:p=>g("padding-bottom",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Left"}),e.jsx("input",{type:"text",value:l["padding-left"]||"0",onChange:p=>g("padding-left",p.target.value),className:"w-full px-2 py-1 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded text-sm"})]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.fontSize","Font Size")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"number",value:(l["font-size"]||"14px").replace("px",""),onChange:p=>g("font-size",`${p.target.value}px`),placeholder:"14",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"}),e.jsx("span",{className:"flex items-center text-gray-600 dark:text-gray-400 text-sm",children:"px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.fontWeight","Font Weight")}),e.jsxs("select",{value:l["font-weight"]||"normal",onChange:p=>g("font-weight",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"normal",children:"Normal (400)"}),e.jsx("option",{value:"500",children:"Medium (500)"}),e.jsx("option",{value:"600",children:"Semi-bold (600)"}),e.jsx("option",{value:"bold",children:"Bold (700)"}),e.jsx("option",{value:"800",children:"Extra Bold (800)"}),e.jsx("option",{value:"900",children:"Black (900)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.fontFamily","Font Family")}),e.jsxs("select",{value:l["font-family"]||"serif",onChange:p=>g("font-family",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"serif",children:"Serif"}),e.jsx("option",{value:"sans-serif",children:"Sans-serif"}),e.jsx("option",{value:"monospace",children:"Monospace"}),e.jsx("option",{value:"cursive",children:"Cursive"}),e.jsx("option",{value:"fantasy",children:"Fantasy"}),e.jsx("option",{value:"Georgia, serif",children:"Georgia"}),e.jsx("option",{value:"'Times New Roman', serif",children:"Times New Roman"}),e.jsx("option",{value:"Arial, sans-serif",children:"Arial"}),e.jsx("option",{value:"Verdana, sans-serif",children:"Verdana"}),e.jsx("option",{value:"'Courier New', monospace",children:"Courier New"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.textDecoration","Text Decoration")}),e.jsxs("select",{value:l["text-decoration"]||"none",onChange:p=>g("text-decoration",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"none",children:"None"}),e.jsx("option",{value:"underline",children:"Underline"}),e.jsx("option",{value:"overline",children:"Overline"}),e.jsx("option",{value:"line-through",children:"Line Through"}),e.jsx("option",{value:"underline overline",children:"Underline & Overline"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:i("template.textAlign","Text Align")}),e.jsxs("select",{value:l["text-align"]||"left",onChange:p=>g("text-align",p.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"Empty",children:"Empty"}),e.jsx("option",{value:"left",children:"Left"}),e.jsx("option",{value:"center",children:"Center"}),e.jsx("option",{value:"right",children:"Right"}),e.jsx("option",{value:"justify",children:"Justify"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:i("template.listStyle","List Style")}),e.jsxs("select",{value:l["list-style"]||"disc",onChange:p=>g("list-style",p.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm",children:[e.jsx("option",{value:"disc",children:"Bullet"}),e.jsx("option",{value:"circle",children:"Circle"}),e.jsx("option",{value:"square",children:"Square"}),e.jsx("option",{value:"disclosure-closed",children:"Black Right Triangle (▶)"}),e.jsx("option",{value:"decimal",children:"Numbers (1, 2, 3)"}),e.jsx("option",{value:"lower-alpha",children:"Lowercase Letters (a, b, c)"}),e.jsx("option",{value:"upper-alpha",children:"Uppercase Letters (A, B, C)"}),e.jsx("option",{value:"lower-roman",children:"Lowercase Roman (i, ii, iii)"}),e.jsx("option",{value:"upper-roman",children:"Uppercase Roman (I, II, III)"}),e.jsx("option",{value:"none",children:"None"})]})]})]})]}),e.jsxs("button",{onClick:()=>d(!o),className:"w-full flex items-center justify-between px-3 py-2 text-xs font-medium text-gray-600 dark:text-gray-300 hover:bg-white dark:hover:bg-gray-600 rounded transition-colors border border-gray-300 dark:border-gray-500",children:[e.jsx("span",{children:i("template.advancedCSS","Advanced CSS Editor")}),e.jsx(za,{className:`h-4 w-4 transition-transform ${o?"rotate-180":""}`})]}),o&&e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-600 pt-3 space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:i("template.customCSS","Custom CSS")}),e.jsx(Qi,{style:m,onChange:x})]})]})},Xi={collaborators:[{am:"ዮሃንስ ዶ",en:"John Doe"},{am:"ማርያም ስሚዝ",en:"Mary Smith"}],preferredLanguage:"am",content:{isWithDelegateSignature:!1,delegatorName:"",body:`This is a sample letter body demonstrating the template styling. - -The body can contain multiple paragraphs and formatting. - -- First bullet point item -- Second bullet point item -- Third bullet point item - -This allows you to see how list styles are applied.`,date:new Date().toISOString().split("T")[0],internalCC:["Finance Department","HR Department","Legal Department"],externalCC:["External Partner A","External Partner B"],prefixCC:"CC:",suffixCC:"---",from:["John Doe","Mary Smith"],subject:"Sample Template Subject – Style Preview",sincerelyText:"Sincerely",to:["Department Head","Project Manager","Team Lead"],prefix:"RE:",suffix:"---"},recordType:"external"},Ji=()=>`url('data:image/svg+xml;base64,${btoa(` - -`)}')`,Zi=t=>{const r=[];let a=0,n="";for(let i=0;i0){const l=d.slice(0,m).trim(),f=d.slice(m+1).trim();l&&f&&r.push([l,f])}}n=""}else n+=o}const s=n.trim();if(s){const i=s.indexOf(":");if(i>0){const o=s.slice(0,i).trim(),d=s.slice(i+1).trim();o&&d&&r.push([o,d])}}return r},eo=t=>{const r={...t},a=["disclosure-closed","disclosure-open","none"];if(r["list-style"]){const n=r["list-style"].split(" ")[0];if(a.includes(n))return delete r["list-style-type"],r;r["list-style-type"]||(r["list-style-type"]=n)}return r["list-style-type"]&&!r["list-style"]&&(r["list-style"]=r["list-style-type"]),r},na=t=>{const r={};Zi(t).forEach(([n,s])=>{r[n]=s});const a=eo(r);return a["list-style"]==="disclosure-closed"&&(a["list-style-image"]=Ji()),a};function br(t,r){const[a,n]=c.useState(t);return c.useEffect(()=>{const s=setTimeout(()=>{n(t)},r);return()=>{clearTimeout(s)}},[t,r]),a}const to=({isOpen:t,onConfirm:r,onCancel:a})=>{const{t:n}=Ie();return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl max-w-md w-full mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[e.jsx(On,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:n("common.warning","Warning")})]}),e.jsx("button",{onClick:a,className:"p-1 hover:bg-gray-100 rounded-lg transition-colors",children:e.jsx(lt,{className:"h-5 w-5 text-gray-500"})})]}),e.jsx("div",{className:"p-6",children:e.jsx("p",{className:"text-gray-700",children:n("template.unsavedChangesWarning","You have unsaved changes. Are you sure you want to leave?")})}),e.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-gray-200 bg-gray-50",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:n("common.cancel","Cancel")}),e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700 transition-colors",children:n("common.leave","Leave")})]})]})}):null},ro=({visible:t})=>t?e.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-600 animate-pulse"}),e.jsx("span",{className:"text-sm font-medium",children:"Unsaved changes"})]}):null,ao=({pdfUrl:t,loading:r,error:a,onApply:n})=>{const{t:s}=Ie(),[i,o]=c.useState(!0),[d,m]=c.useState(!1);c.useEffect(()=>{t&&(o(!0),m(!1))},[t]);const l=()=>o(!1),f=()=>{o(!1),m(!0)};return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"p-4 border-b",children:e.jsx("button",{onClick:n,disabled:r,className:"w-full px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r?s("template.generatingPreview","Generating..."):s("template.applyChanges","Apply Changes")})}),a&&e.jsxs("div",{className:"mx-4 mt-4 p-3 bg-red-50 border border-red-200 rounded-lg",children:[e.jsx("p",{className:"text-sm text-red-800",children:a}),e.jsx("button",{onClick:n,className:"mt-2 text-sm text-red-600 hover:text-red-800 font-medium underline",children:s("common.retry","Retry")})]}),e.jsx("div",{className:"flex-1 overflow-hidden relative",children:t?e.jsxs(e.Fragment,{children:[i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(kr,{className:"h-8 w-8 animate-spin text-purple-600"}),e.jsx("span",{className:"text-sm text-gray-600",children:s("template.loadingPdf","Loading PDF...")})]})}),d&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx("p",{className:"text-red-600 font-medium mb-2",children:s("template.pdfLoadError","Failed to load PDF preview")}),e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-purple-600 hover:text-purple-700 underline text-sm",children:s("template.openInNewTab","Open in new tab")})]})}),e.jsx("iframe",{src:t,className:"w-full h-full border-0",title:"PDF Preview",onLoad:l,onError:f})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:s("template.clickApplyToPreview",'Click "Apply Changes" to generate preview')})})]})},no=({templateId:t,onBack:r})=>{var H,ue,D,we;const{t:a}=Ie(),{userDetails:n}=qa(),s=(ue=(H=n==null?void 0:n.employee)==null?void 0:H[0])==null?void 0:ue.unitId,[i,o]=c.useState(!1),d=c.useRef(null),{data:m,isLoading:l}=pa(s),[f,y]=c.useState(null),[g,x]=c.useState([]),[v,p]=c.useState(!1),[j,E]=c.useState(null),[b,k]=c.useState(!1),[N,u]=c.useState(""),[C,M]=c.useState(""),[I,se]=c.useState([]),[Y,$]=c.useState([]),[F,_]=c.useState(!1),[ne,X]=c.useState(null),[W,xe]=c.useState(null),[ie,Ae]=c.useState(!0),[je,z]=c.useState(!0),O=c.useRef(null),[R,L]=c.useState({}),T=c.useRef({}),h=c.useCallback(S=>{const B=S.toLowerCase();return B.includes("header")?"header":B.includes("footer")?"footer":B.includes("subject")?"subject":B.includes("body")||B.includes("content")?"body":B.includes("receiver")?"receiver":B.includes("prefix")||B.includes("suffix")?"prefix-suffix":B.includes("cc")?"cc":B.includes("list")?"list":B==="letter-fonts"?"fonts":B==="letter-page-margin"?"page-margin":B.includes("reference-number")?"reference-number":"other"},[]),U={"letter-list-style":["receiver"],"letter-cc-list-style":["cc"]},P=c.useCallback(S=>U[S]?U[S]:[h(S)],[]),Z=c.useMemo(()=>{const S=new Map;return g.forEach(B=>{P(B.code).forEach(A=>{if(!S.has(A)){const K={header:a("template.headerStyle","Header Style"),footer:a("template.footerStyle","Footer Style"),subject:a("template.subjectStyle","Subject Style"),body:a("template.bodyStyle","Body Style"),receiver:a("template.receiverStyle","Receiver Style"),"prefix-suffix":a("template.prefixSuffix","Prefix / Suffix"),cc:a("template.ccStyles","CC Styles"),list:a("template.listStyle","List Style"),fonts:a("template.fonts","Fonts"),"page-margin":a("template.pageMargin","Page Margin"),"reference-number":a("template.referenceNumberStyles","Reference Number Styles"),other:a("template.other","Other")};S.set(A,{code:A,label:K[A]||A,settingIds:[]})}S.get(A).settingIds.push(B.id)})}),Array.from(S.values())},[g,a,P]),ee=c.useCallback(async()=>{try{const S=await St.getTemplate(t);y(S)}catch{X(a("error.loadingTemplate","Error loading template"))}},[t,a]),te=c.useCallback(async()=>{try{p(!0),X(null);const S=await St.getTemplateSettingsByUnit(t),V=(Array.isArray(S==null?void 0:S.items)?S.items:[]).map(K=>{var Oe;if(!K.id||!K.code)return null;let he;if(K.value!==null&&K.value!==void 0)he=K.value;else if(((Oe=K.templateSettingValues)==null?void 0:Oe.length)>0){const ce=K.templateSettingValues.find(ve=>ve.unitId!==null&&ve.unitId!==void 0);if((ce==null?void 0:ce.value)!=null)he=ce.value;else{const ve=K.templateSettingValues.find(qe=>qe.value!==null&&qe.value!==void 0);he=ve==null?void 0:ve.value}}let Ue="";return typeof he=="object"&&he!==null&&Object.keys(he).length>0?Ue=Object.entries(he).filter(([,ce])=>ce!=null&&ce!=="null").map(([ce,ve])=>`${ce}: ${ve};`).join(" "):typeof he=="string"&&he.trim()&&(Ue=he),{...K,value:Ue}}).filter(K=>K!==null);x(V);const A={};V.forEach(K=>{K&&(A[K.id]=!0)}),L(A)}catch{X(a("error.loadingSettings","Error loading style settings"))}finally{p(!1)}},[t,a]),q=c.useCallback((S,B)=>{var A;x(K=>{const he=[...K];return he[S]={...he[S],value:B},he});const V=(A=g[S])==null?void 0:A.id;V&&L(K=>({...K,[V]:!1})),_(!0)},[g]),de=c.useCallback(S=>{L(B=>{var A,K;const V=!B[S];if(V){const he=g.findIndex(Ue=>Ue.id===S);if(he>=0){const Oe=((K=(A=g[he].templateSettingValues)==null?void 0:A[0])==null?void 0:K.value)||{};let ce="";typeof Oe=="object"&&Oe!==null&&(ce=Object.entries(Oe).map(([ve,qe])=>`${ve}: ${qe};`).join(" ")),x(ve=>{const qe=[...ve];return qe[he]={...qe[he],value:ce},qe})}}return{...B,[S]:V}})},[g]),fe=c.useCallback(async()=>{var S,B;if(!(!t||!s))try{k(!0),X(null);let V;if(N){const ce=I.find(ve=>ve.id===N);ce!=null&&ce.fileInfo&&(V=ce.fileInfo)}else I.length>0&&(V=I[0].fileInfo);let A;if(C){const ce=Y.find(ve=>ve.id===C);ce!=null&&ce.fileInfo&&(A=ce.fileInfo)}else Y.length>0&&(A=Y[0].fileInfo);const K={...Xi,unitId:s,...V&&{header:V},...A&&{footer:A}},he=g.map(ce=>{const ve=typeof ce.value=="string"?ce.value:"",qe=na(ve);return{id:ce.id,code:ce.code,value:qe}}),Ue={data:K,settings:he},Oe=await St.generateSampleTemplate(t,Ue);if(Oe.pdf)E(Oe.pdf);else throw new Error(a("error.noPdfInResponse","No PDF in response"))}catch(V){const A=((B=(S=V==null?void 0:V.response)==null?void 0:S.data)==null?void 0:B.message)||(V==null?void 0:V.message)||a("error.generatingPreview","Error generating preview");X(A),ge.error(A)}finally{k(!1)}},[t,s,N,C,I,Y,g,a]),Q=c.useCallback(async()=>{var S,B;if(t)try{p(!0);const V=g.map(A=>{const K=typeof A.value=="string"?A.value:"",he=na(K);return{templateSettingId:A.id,resourceId:null,value:he}});await St.saveBulkTemplateSettingValues(V),_(!1),ge.success(a("template.saveSuccess","Style settings saved successfully"))}catch(V){const A=((B=(S=V==null?void 0:V.response)==null?void 0:S.data)==null?void 0:B.message)||(V==null?void 0:V.message)||a("error.savingSettings","Error saving style settings");ge.error(A)}finally{p(!1)}},[t,g,a]),le=c.useCallback(()=>{F?(o(!0),d.current=r):r()},[F,r]),G=c.useCallback(()=>{o(!1),d.current&&(d.current(),d.current=null)},[]),oe=c.useCallback(()=>{o(!1),d.current=null},[]),Re=c.useCallback(S=>{u(S),_(!0)},[]),ye=c.useCallback(S=>{M(S),_(!0)},[]),$e=c.useCallback(S=>{var V;xe(S);const B=g.find(A=>h(A.code)===S);B&&T.current[B.id]&&((V=T.current[B.id])==null||V.scrollIntoView({behavior:"smooth",block:"start"}))},[g,h]);c.useEffect(()=>{var S,B;m&&(se(m.headers||[]),$(m.footers||[]),!N&&((S=m.headers)==null?void 0:S.length)>0&&u(m.headers[0].id),!C&&((B=m.footers)==null?void 0:B.length)>0&&M(m.footers[0].id))},[m,N,C]),c.useEffect(()=>{t&&(ee(),te())},[t,ee,te]),c.useEffect(()=>{Z.length>0&&!W&&xe(Z[0].code)},[Z,W]),c.useEffect(()=>{const S=B=>{F&&(B.preventDefault(),B.returnValue="")};return window.addEventListener("beforeunload",S),()=>window.removeEventListener("beforeunload",S)},[F]);const ze=c.useMemo(()=>JSON.stringify(g.map(S=>({id:S.id,value:S.value}))),[g]),Se=br(ze,500);return c.useEffect(()=>{if(ie){if(je){z(!1);return}Se!==O.current&&(O.current=Se,fe())}},[Se,ie,fe]),v&&g.length===0?e.jsx("div",{className:"flex items-center justify-center h-screen",children:e.jsx(kr,{className:"h-8 w-8 animate-spin text-purple-600"})}):e.jsxs("div",{className:"flex flex-col h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("button",{onClick:le,className:"flex items-center gap-2 text-gray-600 hover:text-gray-900 transition-colors",children:[e.jsx(xn,{className:"h-5 w-5"}),e.jsx("span",{className:"font-medium",children:a("common.back","Back")})]}),e.jsx("div",{className:"h-6 w-px bg-gray-300"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900",children:((D=f==null?void 0:f.name)==null?void 0:D.en)||a("template.styleSettings","Style Settings")})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx("input",{type:"checkbox",checked:ie,onChange:S=>Ae(S.target.checked),className:"w-4 h-4 rounded border-gray-300"}),a("template.livePreview","Live Preview")]}),e.jsx(ro,{visible:F})]})]})}),ne&&e.jsxs("div",{className:"mx-6 mt-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:[e.jsx("p",{className:"text-sm text-red-800",children:ne}),e.jsx("button",{onClick:te,className:"mt-2 text-sm text-red-600 hover:text-red-800 font-medium",children:a("common.retry","Retry")})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsxs("div",{className:"w-1/2 flex overflow-hidden border-r border-gray-200",children:[e.jsx("div",{className:"w-56 flex-shrink-0 bg-gray-50 border-r border-gray-200 overflow-y-auto",children:e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:a("template.styleCategories","Style Categories")}),e.jsx("nav",{className:"space-y-1",children:Z.map(S=>e.jsx("button",{onClick:()=>$e(S.code),className:be("w-full text-left px-3 py-2 rounded-lg text-sm transition-colors",W===S.code?"bg-purple-100 text-purple-700 font-medium":"text-gray-600 hover:bg-gray-100"),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:S.label}),e.jsx("span",{className:"text-xs text-gray-400",children:S.settingIds.length})]})},S.code))})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:a("template.styleEditor","Style Editor")}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-4 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:a("template.headerFooterSelection","Header & Footer")}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:a("addRecord.Header","Header")}),e.jsxs("select",{value:N,onChange:S=>Re(S.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500",children:[e.jsx("option",{value:"",children:I!=null&&I.length?a("addRecord.Select Header","Select Header"):a("addRecord.Loading Headers...","Loading Headers...")}),I==null?void 0:I.map(S=>{var B,V;return e.jsx("option",{value:S.id,children:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)},S.id)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:a("addRecord.Footer","Footer")}),e.jsxs("select",{value:C,onChange:S=>ye(S.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500",children:[e.jsx("option",{value:"",children:Y!=null&&Y.length?a("addRecord.Select Footer","Select Footer"):a("addRecord.Loading Footers...","Loading Footers...")}),Y==null?void 0:Y.map(S=>{var B,V;return e.jsx("option",{value:S.id,children:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)},S.id)})]})]})]}),N&&I.length>0&&(()=>{var B,V;const S=I.find(A=>A.id===N);return S!=null&&S.presigned?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 border-2 border-dashed border-gray-300",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 mb-2",children:a("addRecord.Header Preview","Header Preview")}),e.jsx("img",{src:S.presigned,alt:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)||"Header",className:"max-w-full h-auto"})]}):null})(),C&&Y.length>0&&(()=>{var B,V;const S=Y.find(A=>A.id===C);return S!=null&&S.presigned?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 border-2 border-dashed border-gray-300",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 mb-2",children:a("addRecord.Footer Preview","Footer Preview")}),e.jsx("img",{src:S.presigned,alt:((B=S.name)==null?void 0:B.en)||((V=S.name)==null?void 0:V.am)||"Footer",className:"max-w-full h-auto"})]}):null})()]}),g.length===0&&!v?e.jsx("div",{className:"text-center py-8 text-gray-500",children:a("template.noSettings","No style settings available")}):W&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:((we=Z.find(S=>S.code===W))==null?void 0:we.label)||W}),g.filter(S=>P(S.code).includes(W)).map(S=>{const B=g.findIndex(V=>V.id===S.id);return e.jsx("div",{ref:V=>{T.current[S.id]=V},children:e.jsx(Yi,{setting:S,index:B,onChange:q,isDefault:R[S.id]??!0,onToggleDefault:de})},S.id)}),g.filter(S=>P(S.code).includes(W)).length===0&&e.jsx("p",{className:"text-gray-500 text-sm",children:a("template.noSettingsForCategory","No settings in this category")})]})]})})]}),e.jsx("div",{className:"w-1/2 bg-white",children:e.jsx(ao,{pdfUrl:j,loading:b,error:ne,onApply:fe})})]}),e.jsx("div",{className:"bg-white border-t border-gray-200 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("button",{onClick:Q,disabled:v||!F,className:"px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:v?a("template.saving","Saving..."):a("common.save","Save")})})}),e.jsx(to,{isOpen:i,onConfirm:G,onCancel:oe})]})},so=()=>{const{t}=Ie(),[r,a]=c.useState([]),[n,s]=c.useState(null),[i,o]=c.useState(!0),[d,m]=c.useState(null);c.useEffect(()=>{l()},[]);const l=async()=>{var g;try{o(!0),m(null);const x=await St.getAllTemplates();a(x.items||[]),((g=x.items)==null?void 0:g.length)>0&&s(x.items[0].id)}catch{m(t("error.loadingTemplates","Error loading templates"))}finally{o(!1)}},f=g=>{s(g)},y=()=>{s(null)};return i?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx(kr,{className:"h-8 w-8 animate-spin text-purple-600"})}):d?e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-red-700",children:d}):r.length===0?e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-gray-500",children:t("template.noTemplates","No templates available")})}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700",children:t("template.selectTemplate","Select Template")}),e.jsxs(ft,{value:n||"",onValueChange:f,children:[e.jsx(ht,{className:"w-64",children:e.jsx(xt,{placeholder:t("template.selectTemplate")})}),e.jsx(yt,{children:r.map(g=>{var x,v;return e.jsx(bt,{value:g.id,children:((x=g.name)==null?void 0:x.en)||((v=g.name)==null?void 0:v.am)},g.id)})})]})]})}),n&&e.jsx(no,{templateId:n,onBack:y})]})},io=()=>{var N,u;const{user:t}=Ba(),r=sa.language,[a,n]=c.useState(!1),[s,i]=c.useState(!1),[o,d]=c.useState(""),[m,l]=c.useState(0),f=br(o,300),y=t!=null&&t.employee&&t.employee.length>0?t.employee[0].organizationId:void 0,{getList:g}=Ya(),{data:x,isLoading:v}=y?g(y,{take:300,skip:0}):{data:void 0,isLoading:!1},p=br(C=>{window.dispatchEvent(new CustomEvent("unitChanged",{detail:C}))},300);c.useEffect(()=>{f&&window.dispatchEvent(new CustomEvent("unitChanged",{detail:f}))},[f]);const j=c.useCallback(C=>{d(C),p(C)},[p]);c.useEffect(()=>{const C=()=>{window.innerWidth>=768&&n(!1)};return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]),c.useEffect(()=>{var C,M;!v&&((M=(C=x==null?void 0:x.data)==null?void 0:C.items)!=null&&M.length)&&!o&&d(x.data.items[0].id)},[v,x,o]);const E=[{label:"contentManagement.seal",icon:e.jsx(ga,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Ln,{unitId:o})},{label:"contentManagement.letterTemplate",icon:e.jsx(Ua,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Kn,{unitId:o})},{label:"recordTag.title",icon:e.jsx(Rn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(ws,{unitId:o})},{label:"contentManagement.prefix",icon:e.jsx(Cn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(hs,{unitId:o,initialTab:"internal"})},{label:"contentManagement.commonRemarks",icon:e.jsx(Nn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Gn,{unitId:o})},{label:"contentManagement.headerAndFooter",icon:e.jsx(vn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Wn,{unitId:o})},{label:"template.sample",icon:e.jsx(mt,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(so,{})},{label:"dashboard.recentActivities",icon:e.jsx(Tn,{className:"h-5 w-5 flex-shrink-0"}),element:e.jsx(Vn,{activities:[]})}],b=E[m],k=(b==null?void 0:b.label)==="template.sample";return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 to-gray-100/30 dark:from-gray-900 dark:to-gray-800",children:e.jsxs("div",{className:"w-full h-full p-4 lg:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row justify-between items-start lg:items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-2xl lg:text-3xl font-bold text-gray-900 dark:text-white tracking-tight",children:w("organization.contentManagement")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-2 text-sm lg:text-base",children:w("organization.contentMsg")})]}),e.jsx("div",{className:"w-full lg:w-auto",children:e.jsx(ys,{})})]}),((u=(N=x==null?void 0:x.data)==null?void 0:N.items)==null?void 0:u.length)>0&&e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 p-4 lg:p-6 transition-all duration-200 hover:shadow-md",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[e.jsx("div",{className:"p-2 bg-purple-50 dark:bg-purple-900/30 rounded-lg",children:e.jsx(yn,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),e.jsx("div",{children:e.jsx("label",{className:"block text-sm font-semibold text-gray-900 dark:text-white",children:w("organization.selectUnit")})})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(ft,{value:o,onValueChange:j,disabled:v,children:[e.jsx(ht,{className:be("w-full border-gray-300 dark:border-gray-600 rounded-xl shadow-sm transition-all duration-200 dark:bg-gray-700 dark:text-white","focus:ring-2 focus:ring-purple-500 focus:border-purple-500","hover:border-gray-400 dark:hover:border-gray-500",v&&"opacity-50 cursor-not-allowed"),children:e.jsx(xt,{placeholder:v?w("common.loading"):w("organization.selectUnit")})}),e.jsx(yt,{className:"rounded-xl border border-gray-200 dark:border-gray-600 shadow-lg dark:bg-gray-800",children:x==null?void 0:x.data.items.map(C=>e.jsx(bt,{value:C.id,className:"rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors dark:text-gray-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 truncate",children:r==="en"?C.name.en:C.name.am}),C.id===o&&e.jsx("div",{className:"w-2 h-2 bg-purple-600 dark:bg-purple-400 rounded-full"})]})},C.id))})]})})]})}),e.jsxs("div",{className:be("flex w-full min-h-[calc(100vh-12rem)] bg-transparent rounded-2xl",k?"overflow-visible":"overflow-hidden"),children:[a&&e.jsx("div",{className:"fixed inset-0 bg-black/50 dark:bg-black/70 z-40 md:hidden backdrop-blur-sm transition-opacity duration-300",onClick:()=>n(!1)}),e.jsxs("div",{className:be("md:sticky top-0 flex flex-col bg-white dark:bg-gray-800 border-r border-gray-200/60 dark:border-gray-700 transition-all duration-300 ease-in-out","backdrop-blur-sm bg-white/95 md:bg-white dark:bg-gray-800/95",a?"absolute left-0 top-0 z-40 w-72 lg:w-80":"hidden md:flex",s?"md:w-16 lg:w-20":"md:w-72 lg:w-80","h-[calc(100vh-2rem)] md:h-screen rounded-2xl md:rounded-none shadow-xl md:shadow-none"),children:[e.jsxs("div",{className:be("flex items-center p-4 border-b border-gray-200/60 dark:border-gray-700 transition-all duration-300",s?"justify-center":"justify-between"),children:[!s&&e.jsx("div",{className:"flex items-center gap-3 min-w-0",children:e.jsx("h2",{className:"text-lg font-bold text-gray-900 dark:text-white truncate",children:w("organization.contentManagement")})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>i(!s),className:be("hidden md:flex p-2 rounded-xl hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-all duration-200","hover:shadow-sm border border-transparent hover:border-purple-200 dark:hover:border-purple-800"),title:s?w("expandSidebar"):w("collapseSidebar"),children:s?e.jsx(Xt,{className:"h-4 w-4 text-gray-600 dark:text-gray-300"}):e.jsx(Xt,{className:"h-4 w-4 text-gray-600 dark:text-gray-300"})}),e.jsx("button",{onClick:()=>n(!1),className:"md:hidden p-2 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(lt,{className:"h-4 w-4 text-gray-600 dark:text-gray-300"})})]})]}),e.jsx("nav",{className:"flex-1 p-3 space-y-1 overflow-y-auto",children:E.map((C,M)=>e.jsxs("button",{onClick:()=>{l(M),n(!1)},className:be("w-full flex items-center gap-3 p-3 rounded-xl text-sm font-medium cursor-pointer transition-all duration-200","border border-transparent hover:border-gray-200 dark:hover:border-gray-600 hover:shadow-sm",s?"justify-center":"",m===M?"bg-gradient-to-r from-purple-50 to-purple-50 dark:from-purple-900/30 dark:to-purple-900/20 text-purple-700 dark:text-purple-300 border-purple-200 dark:border-purple-700 shadow-sm":"text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white"),children:[e.jsx("span",{className:be("transition-transform duration-200",m===M&&"scale-110"),children:C.icon}),!s&&e.jsx("span",{className:"flex-1 text-left truncate font-semibold",children:w(C.label)})]},M))})]}),e.jsxs("div",{className:be("flex-1 flex flex-col min-w-0 transition-all duration-300","md:ml-0"),children:[e.jsxs("div",{className:"md:hidden flex items-center justify-between p-4 bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm border-b border-gray-200/60 dark:border-gray-700 rounded-t-2xl",children:[e.jsx("button",{onClick:()=>n(!0),className:"p-2 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-sm border border-gray-200 dark:border-gray-600",children:e.jsx(Xt,{className:"h-5 w-5 text-gray-600 dark:text-gray-300"})}),e.jsx("div",{className:"flex-1 text-center",children:e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-white truncate",children:w((b==null?void 0:b.label)||"contentmanagement")})}),e.jsx("div",{className:"w-9"})]}),e.jsxs("div",{className:be("flex-1 p-4 md:p-6",k?"overflow-visible":"overflow-auto"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-6 flex-wrap",children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:w("content")}),b&&e.jsxs(e.Fragment,{children:[e.jsx(vr,{className:"h-4 w-4 text-gray-400 dark:text-gray-500"}),e.jsx("span",{className:"text-gray-900 dark:text-white font-semibold bg-gray-100 dark:bg-gray-700 px-3 py-1 rounded-full text-sm",children:w(b.label)})]})]}),e.jsx("div",{className:be("w-full transition-opacity duration-300"),children:e.jsx("div",{className:be("rounded-2xl shadow-sm border border-gray-200/60 dark:border-gray-700",k?"overflow-visible":"overflow-hidden"),children:b==null?void 0:b.element})})]})]})]})]})})},Zo=()=>e.jsx(io,{});export{Zo as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-CGoXLUrj.js b/apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-CGoXLUrj.js deleted file mode 100644 index 1a2dec035..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-CGoXLUrj.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e,v as n,U as z,aO as C,A as T,f as B,u as O,aF as h,B as c,L as u}from"./index-7T7TTikv.js";import{C as d,d as g,a as b,b as f}from"./card-_ldW-koX.js";import{T as L,a as S,b as j,c as x,d as E,e as p}from"./table-D_B7hhqb.js";import{B as D}from"./badge-D4t6Wb1T.js";import{f as P}from"./formatDistanceToNow-DU8jvZv6.js";import{c as y}from"./utils-N2wtfq7C.js";import{u as N}from"./useOrganizations-CPt4mkXS.js";import{S as H}from"./SmartOfficeAuditPage-Dcwrs1dM.js";import{C as M}from"./circle-alert-HVqsZpe-.js";import{P as U}from"./plus-CC3ol2sL.js";import"./en-US-Cc-9gH5A.js";import"./endOfMonth-DmxQbzXi.js";import"./organizationsService-DIFVjoLn.js";import"./avatar-BU_IHgzI.js";import"./format-DvwV82px.js";import"./shield-D3luOm6l.js";import"./lock-DGEqses-.js";import"./eye-DYwZYJcQ.js";import"./square-pen-Dh1zj83N.js";import"./download-Btm1n-GQ.js";import"./select--i8koVXg.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./search-y8VSu0lZ.js";import"./label-CABYEcfW.js";import"./radio-group-C9tEhs3a.js";import"./Radio-D43EoWlg.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-B16dMH0P.js";import"./checkbox-CTVlz2xL.js";import"./Checkbox-CAXGYFGh.js";import"./refresh-cw-B7fipPS4.js";import"./eye-off-AoIvdwmO.js";const _=({organizations:t})=>!t||t.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border dark:border-gray-700 rounded-xl p-6 dark:bg-gray-800",children:"No organizations found"}):e.jsx("div",{className:"rounded-xl overflow-hidden shadow-sm border bg-white dark:bg-gray-800 dark:border-gray-700",children:e.jsxs(L,{children:[e.jsx(S,{className:"bg-white dark:bg-gray-800 text-muted-foreground",children:e.jsxs(j,{children:[e.jsx(x,{className:"px-6 py-3",children:n("organization.organizationName")}),e.jsx(x,{className:"px-6 py-3",children:n("organization.createdOn")}),e.jsx(x,{className:"px-6 py-3",children:n("dashboard.Status")})]})}),e.jsx(E,{children:t.map((a,r)=>{var s;return e.jsxs(j,{className:r%2?"bg-purple-50/20 dark:bg-gray-700/40":"bg-white dark:bg-gray-800",children:[e.jsx(p,{className:"px-6 py-3 font-medium",children:((s=a.name)==null?void 0:s.en)||"N/A"}),e.jsx(p,{className:"px-6 py-3",children:a.createdAt?P(new Date(a.createdAt),{addSuffix:!0}):"N/A"}),e.jsx(p,{className:"px-6 py-3",children:e.jsx(D,{variant:a.status==="Active"?"default":"outline",className:a.status==="Active"?"bg-primary-100 text-primary-800 hover:bg-primary-100 dark:bg-primary-900/50 dark:text-primary-300":"bg-gray-100 text-gray-800 hover:bg-gray-100 dark:bg-gray-700 dark:text-gray-300",children:a.status==="Active"?n("statusBar.activate"):n("statusBar.deactivate")})})]},a.id)})})]})}),F={building:T,clock:C,user:z},v=({title:t,value:a,indicator:r,color:s,icon:m,variant:l="default",onClick:o})=>{const i=F[m];return e.jsx(d,{onClick:o,className:y("p-4 rounded-xl shadow-sm transition-colors",l==="primary"?"bg-purple-600 text-white":"bg-white dark:bg-gray-800 dark:border-gray-700",o&&"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700"),children:e.jsxs(g,{className:"p-0",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("div",{className:"text-sm font-medium opacity-80",children:t}),e.jsx(i,{className:"w-5 h-5 opacity-60"})]}),e.jsx("div",{className:"text-3xl font-bold leading-snug",children:a}),r&&e.jsx("div",{className:y("text-xs mt-1",s),children:r})]})})},Ne=()=>{const t=B(),a=10,{t:r}=O(),{organizationsResponse:s,isLoading:m,isError:l,refetch:o}=N("Org",{take:a,orderBy:"createdAt",order:"createdAt:Desc"}),{organizationsAdminsResponse:i,isLoading:w,isError:k,refetch:A}=N("Admin",{take:a,orderBy:"updatedAt",order:"updatedAt: DESC"});return m||w?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading dashboard..."})]})}):l||k?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(M,{className:"h-12 w-12 text-red-500"}),e.jsx("div",{className:"text-red-500 font-medium",children:"Error loading dashboard"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-center max-w-md mb-4",children:"There was an issue loading the dashboard data. This could be due to network issues or server problems."}),e.jsxs(c,{onClick:()=>{o(),A()},className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(h,{className:"mr-2 h-4 w-4 animate-spin"}),r("organization.retry")]})]})}):e.jsxs("div",{className:"p-6 space-y-10",children:[e.jsxs(d,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsxs(b,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(f,{className:"text-xl font-semibold",children:r("organization.statistics")}),e.jsx(u,{to:"/user-management/organizations/new",children:e.jsxs(c,{className:"bg-primary hover:bg-primary/90 text-primary-foreground px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),r("organization.newOrganization")]})})]}),e.jsx(g,{className:"px-0",children:e.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsx(v,{title:r("organization.totalOrganizations"),value:(s==null?void 0:s.count)||0,color:"text-primary-500",icon:"building",variant:"primary",onClick:()=>{t("/user-management/organizations")}}),e.jsx(v,{title:r("organization.organizationAdmins"),value:(i==null?void 0:i.count)||0,color:"text-red-500",icon:"user",variant:"default",onClick:()=>{t("/user-management/organization_admins")}})]})})]}),e.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-[2fr_1fr] gap-4",children:[e.jsx(d,{className:"min-w-0 shadow-none border-none bg-transparent px-0",children:e.jsx(H,{})}),e.jsxs(d,{className:" min-w-0 shadow-none border-none bg-transparent px-0",children:[e.jsxs(b,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(f,{className:"text-base font-semibold",children:r("organization.recentOrganizations")}),e.jsx(u,{to:"/organizations",children:e.jsx(c,{variant:"link",className:"text-purple-600 dark:text-purple-400 text-sm px-0",children:r("organization.viewMore")})})]}),e.jsx(g,{className:"px-0 overflow-x-auto",children:e.jsx(_,{organizations:(s==null?void 0:s.items)||[]})})]})]})]})};export{Ne as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-Ci5_Ntjr.js b/apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-Ci5_Ntjr.js deleted file mode 100644 index 6fa5aa6b3..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/DashboardPage-Ci5_Ntjr.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e,v as n,U as z,aO as C,A as T,f as B,u as O,aF as h,B as c,L as u}from"./index-Db-xuq0b.js";import{C as d,d as g,a as b,b as f}from"./card-BBWyxDss.js";import{T as L,a as S,b as j,c as x,d as E,e as p}from"./table-D3n3VABd.js";import{B as D}from"./badge-D7JvaQeJ.js";import{f as P}from"./formatDistanceToNow-DU8jvZv6.js";import{c as y}from"./utils-BncSPdK1.js";import{u as N}from"./useOrganizations-DiuNBweX.js";import{S as H}from"./SmartOfficeAuditPage-DLN72875.js";import{C as M}from"./circle-alert-Cd_zeQMw.js";import{P as U}from"./plus-BdjS2Pc-.js";import"./en-US-Cc-9gH5A.js";import"./endOfMonth-DmxQbzXi.js";import"./organizationsService-BEVk8qa1.js";import"./avatar-C2-XEZ4v.js";import"./format-DvwV82px.js";import"./shield-uC_usZTb.js";import"./lock-BCybB-Lq.js";import"./eye-Bhud4znU.js";import"./square-pen-B91TPB19.js";import"./download-CX6rsOqt.js";import"./select-BoQxM42A.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./search-CM5F2ZRy.js";import"./label-CsFy6wpo.js";import"./radio-group-DqG5gUnT.js";import"./Radio-C3SNvFel.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-COkNgcEo.js";import"./checkbox-Dd0VhnrO.js";import"./Checkbox-IILksgz0.js";import"./refresh-cw-JB7N413f.js";import"./eye-off-CDMvHElM.js";const _=({organizations:t})=>!t||t.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border dark:border-gray-700 rounded-xl p-6 dark:bg-gray-800",children:"No organizations found"}):e.jsx("div",{className:"rounded-xl overflow-hidden shadow-sm border bg-white dark:bg-gray-800 dark:border-gray-700",children:e.jsxs(L,{children:[e.jsx(S,{className:"bg-white dark:bg-gray-800 text-muted-foreground",children:e.jsxs(j,{children:[e.jsx(x,{className:"px-6 py-3",children:n("organization.organizationName")}),e.jsx(x,{className:"px-6 py-3",children:n("organization.createdOn")}),e.jsx(x,{className:"px-6 py-3",children:n("dashboard.Status")})]})}),e.jsx(E,{children:t?.map((a,r)=>{var s;return e.jsxs(j,{className:r%2?"bg-purple-50/20 dark:bg-gray-700/40":"bg-white dark:bg-gray-800",children:[e.jsx(p,{className:"px-6 py-3 font-medium",children:((s=a.name)==null?void 0:s.en)||"N/A"}),e.jsx(p,{className:"px-6 py-3",children:a.createdAt?P(new Date(a.createdAt),{addSuffix:!0}):"N/A"}),e.jsx(p,{className:"px-6 py-3",children:e.jsx(D,{variant:a.status==="Active"?"default":"outline",className:a.status==="Active"?"bg-primary-100 text-primary-800 hover:bg-primary-100 dark:bg-primary-900/50 dark:text-primary-300":"bg-gray-100 text-gray-800 hover:bg-gray-100 dark:bg-gray-700 dark:text-gray-300",children:a.status==="Active"?n("statusBar.activate"):n("statusBar.deactivate")})})]},a.id)})})]})}),F={building:T,clock:C,user:z},v=({title:t,value:a,indicator:r,color:s,icon:m,variant:l="default",onClick:o})=>{const i=F[m];return e.jsx(d,{onClick:o,className:y("p-4 rounded-xl shadow-sm transition-colors",l==="primary"?"bg-purple-600 text-white":"bg-white dark:bg-gray-800 dark:border-gray-700",o&&"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700"),children:e.jsxs(g,{className:"p-0",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("div",{className:"text-sm font-medium opacity-80",children:t}),e.jsx(i,{className:"w-5 h-5 opacity-60"})]}),e.jsx("div",{className:"text-3xl font-bold leading-snug",children:a}),r&&e.jsx("div",{className:y("text-xs mt-1",s),children:r})]})})},Ne=()=>{const t=B(),a=10,{t:r}=O(),{organizationsResponse:s,isLoading:m,isError:l,refetch:o}=N("Org",{take:a,orderBy:"createdAt",order:"createdAt:Desc"}),{organizationsAdminsResponse:i,isLoading:w,isError:k,refetch:A}=N("Admin",{take:a,orderBy:"updatedAt",order:"updatedAt: DESC"});return m||w?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading dashboard..."})]})}):l||k?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(M,{className:"h-12 w-12 text-red-500"}),e.jsx("div",{className:"text-red-500 font-medium",children:"Error loading dashboard"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-center max-w-md mb-4",children:"There was an issue loading the dashboard data. This could be due to network issues or server problems."}),e.jsxs(c,{onClick:()=>{o(),A()},className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(h,{className:"mr-2 h-4 w-4 animate-spin"}),r("organization.retry")]})]})}):e.jsxs("div",{className:"p-6 space-y-10",children:[e.jsxs(d,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsxs(b,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(f,{className:"text-xl font-semibold",children:r("organization.statistics")}),e.jsx(u,{to:"/user-management/organizations/new",children:e.jsxs(c,{className:"bg-primary hover:bg-primary/90 text-primary-foreground px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),r("organization.newOrganization")]})})]}),e.jsx(g,{className:"px-0",children:e.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsx(v,{title:r("organization.totalOrganizations"),value:(s==null?void 0:s.count)||0,color:"text-primary-500",icon:"building",variant:"primary",onClick:()=>{t("/user-management/organizations")}}),e.jsx(v,{title:r("organization.organizationAdmins"),value:(i==null?void 0:i.count)||0,color:"text-red-500",icon:"user",variant:"default",onClick:()=>{t("/user-management/organization_admins")}})]})})]}),e.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-[2fr_1fr] gap-4",children:[e.jsx(d,{className:"min-w-0 shadow-none border-none bg-transparent px-0",children:e.jsx(H,{})}),e.jsxs(d,{className:" min-w-0 shadow-none border-none bg-transparent px-0",children:[e.jsxs(b,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(f,{className:"text-base font-semibold",children:r("organization.recentOrganizations")}),e.jsx(u,{to:"/organizations",children:e.jsx(c,{variant:"link",className:"text-purple-600 dark:text-purple-400 text-sm px-0",children:r("organization.viewMore")})})]}),e.jsx(g,{className:"px-0 overflow-x-auto",children:e.jsx(_,{organizations:(s==null?void 0:s.items)||[]})})]})]})]})};export{Ne as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-B3RI_a-y.js b/apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-B3RI_a-y.js deleted file mode 100644 index 02d8bc7c5..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-B3RI_a-y.js +++ /dev/null @@ -1 +0,0 @@ -import{r as n,j as r,bj as c}from"./index-7T7TTikv.js";import{u as z}from"./useOrganizations-CPt4mkXS.js";import{O}from"./OrganizationForm-BNuDw3k3.js";import"./organizationsService-DIFVjoLn.js";import"./select--i8koVXg.js";import"./card-_ldW-koX.js";import"./label-CABYEcfW.js";import"./useOrganizationTypes-CQm1BLlI.js";import"./index.esm-BRNlF2G3.js";import"./zod-D-9d3Txu.js";import"./switch-D9hx8CZw.js";import"./Switch-ByfhjkDo.js";import"./InputsGroupFieldset-B16dMH0P.js";import"./use-uncontrolled-tg0LIUAX.js";const f=({id:i})=>{const[a,e]=n.useState(),{editOrganization:s,isEditing:m,getOrganizationByDetails:p}=z("Org"),g=()=>{p(i,{onSuccess:t=>{e(t)}})};n.useEffect(()=>{g()},[]);const d=t=>{const o={key:t.key,name:t.name,organizationTypeId:t.organizationTypeId,isGovernmentOrganization:t.isGovernmentOrganization};t.parentId&&t.parentId!==""&&(o.parentId=t.parentId),s({id:i,payload:o})};return r.jsx(O,{isLoading:m,onSubmit:t=>d(t),type:"Edit",organizationDetails:a})},h=()=>{const{id:i}=c();return i&&r.jsx(f,{id:i})};export{h as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-C2QJGrYB.js b/apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-C2QJGrYB.js deleted file mode 100644 index 558892d5d..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/EditOrganizationPage-C2QJGrYB.js +++ /dev/null @@ -1 +0,0 @@ -import{r as n,j as r,bj as c}from"./index-Db-xuq0b.js";import{u as z}from"./useOrganizations-DiuNBweX.js";import{O}from"./OrganizationForm-Dc20iiRT.js";import"./organizationsService-BEVk8qa1.js";import"./select-BoQxM42A.js";import"./card-BBWyxDss.js";import"./label-CsFy6wpo.js";import"./useOrganizationTypes-B6vCp97C.js";import"./index.esm-BG4gweZJ.js";import"./zod-Df58YiJ6.js";import"./switch-BNCD27Bd.js";import"./Switch-DSHMk-sj.js";import"./InputsGroupFieldset-COkNgcEo.js";import"./use-uncontrolled-C3HRHW6t.js";const f=({id:i})=>{const[a,e]=n.useState(),{editOrganization:s,isEditing:m,getOrganizationByDetails:p}=z("Org"),g=()=>{p(i,{onSuccess:t=>{e(t)}})};n.useEffect(()=>{g()},[]);const d=t=>{const o={key:t.key,name:t.name,organizationTypeId:t.organizationTypeId,isGovernmentOrganization:t.isGovernmentOrganization};t.parentId&&t.parentId!==""&&(o.parentId=t.parentId),s({id:i,payload:o})};return r.jsx(O,{isLoading:m,onSubmit:t=>d(t),type:"Edit",organizationDetails:a})},h=()=>{const{id:i}=c();return i&&r.jsx(f,{id:i})};export{h as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-CyFdgyUu.js b/apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-CyFdgyUu.js deleted file mode 100644 index b9b30fb11..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-CyFdgyUu.js +++ /dev/null @@ -1 +0,0 @@ -import{u as b,f as w,r as l,j as e,H as j,I as N,B as h,h as y,t as p}from"./index-Db-xuq0b.js";import{b as v}from"./Utils-BP0IYDrC.js";import{L as k}from"./lock-BCybB-Lq.js";import{P as C}from"./phone-Ce15UUGI.js";import{M as f}from"./mail-bwr0seHR.js";import{R as P}from"./refresh-cw-JB7N413f.js";import{A as S}from"./arrow-left-CE5-YfaQ.js";const F=()=>{const{t:s}=b(),t=w(),[n,u]=l.useState(""),[d,c]=l.useState(!1),[m,a]=l.useState(""),g=async o=>{o.preventDefault(),a("");let r=n;if(!v(r)){a(s("forgotpassword.invalidphone"));return}r.startsWith("0")&&(r="+251"+r.slice(1)),c(!0);try{await y(r),p.success(s("forgotpassword.success"),{description:s("forgotpassword.successdesc")}),setTimeout(()=>t("/"),3e3)}catch(i){const x=(i==null?void 0:i.message)||s("forgotpassword.fail");a(x),p.error(s("forgotpassword.fail"),{description:x})}finally{c(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-cyan-50 via-white to-primary-50 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-cyan-100/30 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-96 h-96 bg-primary-100/30 rounded-full blur-3xl"}),e.jsxs("button",{onClick:()=>t("/"),className:"absolute top-6 left-6 z-10 flex items-center gap-2 px-4 py-2 bg-white/80 backdrop-blur-sm hover:bg-white rounded-full shadow-md hover:shadow-lg transition-all duration-300 group",children:[e.jsx(j,{className:"w-4 h-4 text-primary group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:s("forgotpassword.home")})]}),e.jsx("div",{className:"relative min-h-screen flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-primary to-primary-500 p-8 text-center relative",children:[e.jsx("div",{className:"absolute inset-0 bg-white/5"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-16 h-16 bg-white/20 backdrop-blur-sm rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(k,{className:"w-8 h-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:s("forgotpassword.title")}),e.jsx("p",{className:"text-cyan-50 text-sm",children:s("forgotpassword.subtitle")})]})]}),e.jsx("div",{className:"p-8",children:e.jsxs("form",{onSubmit:g,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[e.jsx(C,{className:"w-4 h-4 text-primary"}),s("forgotpassword.phone")]}),e.jsx("div",{className:"relative",children:e.jsx(N,{type:"tel",placeholder:s("forgotpassword.phoneplaceholder"),className:"h-12 rounded-lg border-gray-200 px-4 text-sm focus:border-primary focus:ring-primary transition-all",value:n,onChange:o=>{u(o.target.value),a("")},required:!0})}),m&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-red-50 border border-red-100 rounded-lg",children:[e.jsx("div",{className:"w-1 h-1 bg-red-500 rounded-full mt-1.5"}),e.jsx("p",{className:"text-sm text-red-600 flex-1",children:m})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-cyan-50 border border-cyan-100 rounded-lg",children:[e.jsx(f,{className:"w-5 h-5 text-primary flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-700 font-medium mb-1",children:s("forgotpassword.checkphone")}),e.jsx("p",{className:"text-xs text-gray-600",children:s("forgotpassword.checkdesc")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{type:"submit",className:"w-full h-12 bg-primary hover:bg-primary-500 text-white text-sm font-medium rounded-lg shadow-md hover:shadow-lg transition-all duration-300",disabled:d,children:d?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(P,{className:"animate-spin h-5 w-5"}),s("forgotpassword.sending")]}):e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(f,{className:"h-5 w-5"}),s("forgotpassword.sendresetlink")]})}),e.jsxs(h,{type:"button",variant:"outline",className:"w-full h-12 text-sm font-medium border-gray-200 hover:bg-gray-50 rounded-lg transition-all duration-300 bg-transparent",onClick:()=>t("/login"),children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),s("forgotpassword.backtologin")]})]})]})})]}),e.jsxs("p",{className:"text-center text-sm text-gray-500 mt-6",children:[s("forgotpassword.remember")," ",e.jsx("button",{onClick:()=>t("/login"),className:"text-primary hover:text-primary-500 font-medium transition-colors",children:s("forgotpassword.signin")})]})]})})]})};export{F as ForgotPassword,F as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-Cz6Ky6Go.js b/apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-Cz6Ky6Go.js deleted file mode 100644 index 1a7760711..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ForgotPassword-Cz6Ky6Go.js +++ /dev/null @@ -1 +0,0 @@ -import{u as b,f as w,r as l,j as e,H as j,I as N,B as h,h as y,t as p}from"./index-7T7TTikv.js";import{b as v}from"./Utils-BP0IYDrC.js";import{L as k}from"./lock-DGEqses-.js";import{P as C}from"./phone-w_VmAt3l.js";import{M as f}from"./mail-q8lHlEPt.js";import{R as P}from"./refresh-cw-B7fipPS4.js";import{A as S}from"./arrow-left-mae9HpSL.js";const F=()=>{const{t:s}=b(),t=w(),[n,u]=l.useState(""),[d,c]=l.useState(!1),[m,a]=l.useState(""),g=async o=>{o.preventDefault(),a("");let r=n;if(!v(r)){a(s("forgotpassword.invalidphone"));return}r.startsWith("0")&&(r="+251"+r.slice(1)),c(!0);try{await y(r),p.success(s("forgotpassword.success"),{description:s("forgotpassword.successdesc")}),setTimeout(()=>t("/"),3e3)}catch(i){const x=(i==null?void 0:i.message)||s("forgotpassword.fail");a(x),p.error(s("forgotpassword.fail"),{description:x})}finally{c(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-cyan-50 via-white to-primary-50 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-cyan-100/30 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-96 h-96 bg-primary-100/30 rounded-full blur-3xl"}),e.jsxs("button",{onClick:()=>t("/"),className:"absolute top-6 left-6 z-10 flex items-center gap-2 px-4 py-2 bg-white/80 backdrop-blur-sm hover:bg-white rounded-full shadow-md hover:shadow-lg transition-all duration-300 group",children:[e.jsx(j,{className:"w-4 h-4 text-primary group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:s("forgotpassword.home")})]}),e.jsx("div",{className:"relative min-h-screen flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-primary to-primary-500 p-8 text-center relative",children:[e.jsx("div",{className:"absolute inset-0 bg-white/5"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-16 h-16 bg-white/20 backdrop-blur-sm rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(k,{className:"w-8 h-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:s("forgotpassword.title")}),e.jsx("p",{className:"text-cyan-50 text-sm",children:s("forgotpassword.subtitle")})]})]}),e.jsx("div",{className:"p-8",children:e.jsxs("form",{onSubmit:g,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[e.jsx(C,{className:"w-4 h-4 text-primary"}),s("forgotpassword.phone")]}),e.jsx("div",{className:"relative",children:e.jsx(N,{type:"tel",placeholder:s("forgotpassword.phoneplaceholder"),className:"h-12 rounded-lg border-gray-200 px-4 text-sm focus:border-primary focus:ring-primary transition-all",value:n,onChange:o=>{u(o.target.value),a("")},required:!0})}),m&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-red-50 border border-red-100 rounded-lg",children:[e.jsx("div",{className:"w-1 h-1 bg-red-500 rounded-full mt-1.5"}),e.jsx("p",{className:"text-sm text-red-600 flex-1",children:m})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-cyan-50 border border-cyan-100 rounded-lg",children:[e.jsx(f,{className:"w-5 h-5 text-primary flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-700 font-medium mb-1",children:s("forgotpassword.checkphone")}),e.jsx("p",{className:"text-xs text-gray-600",children:s("forgotpassword.checkdesc")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{type:"submit",className:"w-full h-12 bg-primary hover:bg-primary-500 text-white text-sm font-medium rounded-lg shadow-md hover:shadow-lg transition-all duration-300",disabled:d,children:d?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(P,{className:"animate-spin h-5 w-5"}),s("forgotpassword.sending")]}):e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(f,{className:"h-5 w-5"}),s("forgotpassword.sendresetlink")]})}),e.jsxs(h,{type:"button",variant:"outline",className:"w-full h-12 text-sm font-medium border-gray-200 hover:bg-gray-50 rounded-lg transition-all duration-300 bg-transparent",onClick:()=>t("/login"),children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),s("forgotpassword.backtologin")]})]})]})})]}),e.jsxs("p",{className:"text-center text-sm text-gray-500 mt-6",children:[s("forgotpassword.remember")," ",e.jsx("button",{onClick:()=>t("/login"),className:"text-primary hover:text-primary-500 font-medium transition-colors",children:s("forgotpassword.signin")})]})]})})]})};export{F as ForgotPassword,F as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/FormFields-BA7SVWfi.js b/apps/edr-freight-web/backoffice/public/_um/assets/FormFields-BA7SVWfi.js deleted file mode 100644 index af3c3279b..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/FormFields-BA7SVWfi.js +++ /dev/null @@ -1 +0,0 @@ -import{r as i,j as n,B as k,aI as u}from"./index-Db-xuq0b.js";import"./form-BeLK5rTt.js";import"./multi-select-C9K8HXhI.js";import"./single-select-D9ZG1edj.js";i.createContext({open:!1,setOpen:()=>{}});const O=({label:h,options:x,value:o,onChange:j,collapsible:f=!1,localizedName:r})=>{const[l,b]=i.useState(!f),[m,S]=i.useState(new Set),w=t=>{const e=new Set(m);e.has(t)?e.delete(t):e.add(t),S(e)},g=t=>{j(t)},p=(t,e=[])=>{for(const s of t){const a=typeof s.name=="string"?s.name:(r==null?void 0:r(s.name))??s.name.en;if(s.id===o)return[...e,a].join(" / ");if(s.children&&s.children.length>0){const c=p(s.children,[...e,a]);if(c)return c}}return null},d=t=>t.flatMap(e=>{const s=e.children&&e.children.length>0,a=m.has(e.id),c=s?e.children?.some(v=>v.id===o):!1;if(s&&e.children.length===1)return d(e.children);const C=typeof e.name=="string"?e.name:(r==null?void 0:r(e.name))??e.name.en;return n.jsxs("div",{className:"ml-4 mb-1",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[s&&n.jsx("button",{type:"button",onClick:()=>w(e.id),className:"w-4 h-4 flex items-center justify-center",children:n.jsx(u,{className:`h-3 w-3 transition-transform ${a?"rotate-180":""}`})}),n.jsxs("label",{className:"flex items-center space-x-2",children:[n.jsx("input",{type:"radio",name:"unit-select",checked:o===e.id||c,onChange:()=>g(e.id)}),n.jsx("span",{className:c?"font-semibold":"",children:C})]})]}),s&&a&&n.jsx("div",{className:"ml-4",children:d(e.children)})]},e.id)}),y=p(x);return n.jsxs("div",{className:"mb-4",children:[n.jsx("label",{className:"block font-semibold mb-1",children:h}),f&&n.jsxs(k,{type:"button",variant:"outline",onClick:()=>b(!l),className:"w-full justify-between mb-2",children:[n.jsx("span",{children:y??`Select ${h.toLowerCase()}`}),n.jsx(u,{className:`h-4 w-4 transition-transform ${l?"rotate-180":""}`})]}),l&&n.jsx("div",{className:"border rounded-md p-2 bg-background max-h-96 overflow-y-auto",children:d(x)})]})};export{O as S}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/FormFields-DeF71qnl.js b/apps/edr-freight-web/backoffice/public/_um/assets/FormFields-DeF71qnl.js deleted file mode 100644 index 69066ab56..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/FormFields-DeF71qnl.js +++ /dev/null @@ -1 +0,0 @@ -import{r as i,j as n,B as k,aI as u}from"./index-7T7TTikv.js";import"./form-lLGtsTgY.js";import"./multi-select-CZLBnGmP.js";import"./single-select-CqAjmX3L.js";i.createContext({open:!1,setOpen:()=>{}});const O=({label:h,options:x,value:o,onChange:j,collapsible:f=!1,localizedName:r})=>{const[l,b]=i.useState(!f),[m,S]=i.useState(new Set),w=t=>{const e=new Set(m);e.has(t)?e.delete(t):e.add(t),S(e)},g=t=>{j(t)},p=(t,e=[])=>{for(const s of t){const a=typeof s.name=="string"?s.name:(r==null?void 0:r(s.name))??s.name.en;if(s.id===o)return[...e,a].join(" / ");if(s.children&&s.children.length>0){const c=p(s.children,[...e,a]);if(c)return c}}return null},d=t=>t.flatMap(e=>{const s=e.children&&e.children.length>0,a=m.has(e.id),c=s?e.children.some(v=>v.id===o):!1;if(s&&e.children.length===1)return d(e.children);const C=typeof e.name=="string"?e.name:(r==null?void 0:r(e.name))??e.name.en;return n.jsxs("div",{className:"ml-4 mb-1",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[s&&n.jsx("button",{type:"button",onClick:()=>w(e.id),className:"w-4 h-4 flex items-center justify-center",children:n.jsx(u,{className:`h-3 w-3 transition-transform ${a?"rotate-180":""}`})}),n.jsxs("label",{className:"flex items-center space-x-2",children:[n.jsx("input",{type:"radio",name:"unit-select",checked:o===e.id||c,onChange:()=>g(e.id)}),n.jsx("span",{className:c?"font-semibold":"",children:C})]})]}),s&&a&&n.jsx("div",{className:"ml-4",children:d(e.children)})]},e.id)}),y=p(x);return n.jsxs("div",{className:"mb-4",children:[n.jsx("label",{className:"block font-semibold mb-1",children:h}),f&&n.jsxs(k,{type:"button",variant:"outline",onClick:()=>b(!l),className:"w-full justify-between mb-2",children:[n.jsx("span",{children:y??`Select ${h.toLowerCase()}`}),n.jsx(u,{className:`h-4 w-4 transition-transform ${l?"rotate-180":""}`})]}),l&&n.jsx("div",{className:"border rounded-md p-2 bg-background max-h-96 overflow-y-auto",children:d(x)})]})};export{O as S}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-B16dMH0P.js b/apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-B16dMH0P.js deleted file mode 100644 index 4538fee8d..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-B16dMH0P.js +++ /dev/null @@ -1 +0,0 @@ -import{r as W,V as B,j as e,Q as o,ae as x,_ as C,Z as R,at as w}from"./index-7T7TTikv.js";var u={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const N=u,D=W.forwardRef(({__staticSelector:t,__stylesApiProps:l,className:s,classNames:f,styles:_,unstyled:h,children:I,label:i,description:d,id:p,disabled:b,error:n,size:r,labelPosition:j="left",bodyElement:c="div",labelElement:m="label",variant:v,style:y,vars:E,mod:S,...F},g)=>{const a=B({name:t,props:l,className:s,style:y,classes:u,classNames:f,styles:_,unstyled:h});return e.jsx(o,{...a("root"),ref:g,__vars:{"--label-fz":R(r),"--label-lh":C(r,"label-lh")},mod:[{"label-position":j},S],variant:v,size:r,...F,children:e.jsxs(o,{component:c,htmlFor:c==="label"?p:void 0,...a("body"),children:[I,e.jsxs("div",{...a("labelWrapper"),"data-disabled":b||void 0,children:[i&&e.jsx(o,{component:m,htmlFor:m==="label"?p:void 0,...a("label"),"data-disabled":b||void 0,children:i}),d&&e.jsx(x.Description,{size:r,__inheritStyles:!1,...a("description"),children:d}),n&&typeof n!="boolean"&&e.jsx(x.Error,{size:r,__inheritStyles:!1,...a("error"),children:n})]})]})})});D.displayName="@mantine/core/InlineInput";function Q({children:t,role:l}){const s=w();return s?e.jsx("div",{role:l,"aria-labelledby":s.labelId,"aria-describedby":s.describedBy,children:t}):e.jsx(e.Fragment,{children:t})}export{Q as I,D as a,N as b}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-COkNgcEo.js b/apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-COkNgcEo.js deleted file mode 100644 index 22b2860c1..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/InputsGroupFieldset-COkNgcEo.js +++ /dev/null @@ -1 +0,0 @@ -import{r as W,V as B,j as e,Q as o,ae as x,_ as C,Z as R,at as w}from"./index-Db-xuq0b.js";var u={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const N=u,D=W.forwardRef(({__staticSelector:t,__stylesApiProps:l,className:s,classNames:f,styles:_,unstyled:h,children:I,label:i,description:d,id:p,disabled:b,error:n,size:r,labelPosition:j="left",bodyElement:c="div",labelElement:m="label",variant:v,style:y,vars:E,mod:S,...F},g)=>{const a=B({name:t,props:l,className:s,style:y,classes:u,classNames:f,styles:_,unstyled:h});return e.jsx(o,{...a("root"),ref:g,__vars:{"--label-fz":R(r),"--label-lh":C(r,"label-lh")},mod:[{"label-position":j},S],variant:v,size:r,...F,children:e.jsxs(o,{component:c,htmlFor:c==="label"?p:void 0,...a("body"),children:[I,e.jsxs("div",{...a("labelWrapper"),"data-disabled":b||void 0,children:[i&&e.jsx(o,{component:m,htmlFor:m==="label"?p:void 0,...a("label"),"data-disabled":b||void 0,children:i}),d&&e.jsx(x.Description,{size:r,__inheritStyles:!1,...a("description"),children:d}),n&&typeof n!="boolean"&&e.jsx(x.Error,{size:r,__inheritStyles:!1,...a("error"),children:n})]})]})})});D.displayName="@mantine/core/InlineInput";function Q({children:t,role:l}){const s=w();return s?e.jsx("div",{role:l,"aria-labelledby":s.labelId,"aria-describedby":s.describedBy,children:t}):e.jsx(e.Fragment,{children:t})}export{Q as I,D as a,N as b}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-CpY519LO.js b/apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-CpY519LO.js deleted file mode 100644 index 9a5dd87f6..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-CpY519LO.js +++ /dev/null @@ -1 +0,0 @@ -import{u as H,r as n,a as U,j as e,I as T,B as M,b as $,c as Y,d as W,g as Z,L as A,S as G,M as J,U as Q,e as X}from"./index-Db-xuq0b.js";import{S as _,a as ee,b as re,c as ae,d as L}from"./select-BoQxM42A.js";import{i as q,a as F}from"./Utils-BP0IYDrC.js";import{C as R,a as te,b as se,c as le,d as B}from"./card-BBWyxDss.js";import{A as oe}from"./arrow-left-CE5-YfaQ.js";import{L as ie}from"./lock-BCybB-Lq.js";import{E as ne}from"./eye-Bhud4znU.js";import{E as de}from"./eye-off-CDMvHElM.js";import{P as ce}from"./phone-Ce15UUGI.js";import{M as me}from"./mail-bwr0seHR.js";const xe=({isOpen:h,onClose:b,isLoading:m=!1,title:j,description:E,length:t=6,identifier:I,identifierType:w})=>{const{t:d}=H(),[x,u]=n.useState(Array(t).fill("")),c=n.useRef([]),{verifyMFA:v}=U(),P=j||d("otp.verifyIdentity")||"Verify Your Identity",k=E||d("otp.enterCodeSent")||"Enter the verification code sent to your email",D=d("common.verify")||"Verify",f=d("common.cancel")||"Cancel",[N,g]=n.useState("");n.useEffect(()=>{var a;(a=c.current[0])==null||a.focus()},[]),n.useEffect(()=>{h&&(u(Array(t).fill("")),setTimeout(()=>{var a;(a=c.current[0])==null||a.focus()},100))},[h,t]);const p=(a,s)=>{var o;if(!/^[a-zA-Z0-9]?$/.test(s))return;const l=[...x];l[a]=s,u(l),s&&ai!=="")&&a===t-1&&r(l.join(""))},y=(a,s)=>{var l;s.key==="Backspace"&&!x[a]&&a>0&&((l=c.current[a-1])==null||l.focus())},C=a=>{var o;a.preventDefault();const l=a.clipboardData.getData("text").slice(0,t).split("").filter(i=>/^\d?$/.test(i));if(l.length>0){const i=[...x];l.forEach((V,z)=>{zV===""),K=S===-1?t-1:Math.min(S,t-1);(o=c.current[K])==null||o.focus()}},r=a=>{let s=I;if(w==="phone"){if(!q(s)){g(d("auth.err"));return}s.startsWith("0")&&(s="+251"+s.slice(1))}else if(w==="email"&&!F(s)){g("Please enter a valid email address");return}v({email:s,otp:a})},O=()=>{var a;u(Array(t).fill("")),(a=c.current[0])==null||a.focus()};return h?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm dark:bg-black/80",children:[e.jsxs(R,{className:"w-96 shadow-2xl border-0 animate-in fade-in-90 zoom-in-90 bg-white dark:bg-gray-800",children:[e.jsx(te,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})})}),e.jsxs("div",{children:[e.jsx(se,{className:"text-xl dark:text-white",children:P}),e.jsx(le,{className:"dark:text-gray-400",children:k})]})]})}),e.jsxs(B,{className:"space-y-6",children:[e.jsx("div",{className:"flex justify-center gap-2",children:x?.map((a,s)=>e.jsx(T,{ref:l=>{l&&(c.current[s]=l)},type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:1,value:a,onChange:l=>p(s,l.target.value),onKeyDown:l=>y(s,l),onPaste:C,className:"w-12 h-12 text-center text-lg font-semibold focus:ring-2 focus:ring-primary-500 border-2 bg-white dark:bg-gray-700 text-gray-900 dark:text-white border-gray-200 dark:border-gray-600 dark:focus:border-primary-500",disabled:m},s))}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(M,{type:"button",variant:"outline",onClick:b,disabled:m,className:"flex-1 hover:bg-primary-100 dark:hover:bg-primary-900/30 transition-all duration-200 border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300",children:f}),e.jsx(M,{type:"button",onClick:()=>r(x.join("")),disabled:m||x.join("").length!==t,className:"flex-1 bg-gradient-to-r from-primary-600 to-primary-700 hover:from-primary-700 hover:to-primary-800 text-white shadow-lg hover:shadow-xl transition-all duration-200 disabled:opacity-50",children:m?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),d("common.verifying")||"Verifying..."]}):D})]}),e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("button",{type:"button",onClick:O,className:"text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 font-medium transition-colors disabled:opacity-50",disabled:m,children:d("otp.clearCode")||"Clear Code"}),e.jsx("button",{type:"button",className:"text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 font-medium transition-colors disabled:opacity-50",disabled:m,children:d("otp.resendCode")||"Resend Code"})]}),N&&e.jsxs("p",{className:"text-red-500 dark:text-red-400 text-sm mt-2 flex items-center gap-1",children:[e.jsx("span",{className:"w-1 h-1 bg-red-500 dark:bg-red-400 rounded-full"}),N]})]})]}),m&&e.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm rounded-lg flex items-center justify-center",children:e.jsx(R,{className:"w-80 shadow-2xl border-0 bg-white dark:bg-gray-800",children:e.jsxs(B,{className:"p-6 flex flex-col items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-primary-600"}),e.jsx("span",{className:"text-lg font-semibold text-primary-800 dark:text-primary-300",children:d("common.verifying")||"Verifying..."})]}),e.jsx("p",{className:"text-muted-foreground dark:text-gray-400 text-center text-sm",children:d("otp.verifyingCode")||"Please wait while we verify your code"})]})})})]}):null},he=()=>{const{login:h,isLoggingIn:b}=U(),{config:m}=$(),{isDarkMode:j,toggleDarkMode:E}=Y(),[t,I]=n.useState("email"),[w,d]=n.useState(""),{showOtpModal:x,setShowOtpModal:u,setRememberMePreference:c}=W(),[v,P]=n.useState(""),[k,D]=n.useState(""),[f,N]=n.useState("password"),[g,p]=n.useState(""),[y,C]=n.useState(!1),{t:r}=H();n.useEffect(()=>{const o=Z();C(o),c(o)},[c]);const O=async o=>{o.preventDefault(),p("");try{let i=v;if(t==="phone"){if(!q(i)){p(r("auth.err"));return}i.startsWith("0")&&(i="+251"+i.slice(1))}else if(t==="email"&&!F(i)){p(r("auth.invalidEmail"));return}const S={email:i,password:k};d(i),c(y),h({payload:S,rememberMeValue:y})}catch{}},a=()=>{switch(t){case"email":return r("auth.email");case"phone":return r("auth.phoneNumber")+" (e.g., +251912345678)";case"username":return r("auth.username");default:return""}},s=()=>{switch(t){case"email":return e.jsx(me,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"});case"phone":return e.jsx(ce,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"});case"username":return e.jsx(Q,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"});default:return null}},l=()=>t==="phone"?"tel":"text";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800 p-4 md:p-6 lg:p-8 flex items-center justify-center",children:[e.jsxs(A,{to:"/",className:"fixed top-4 left-4 md:top-6 md:left-6 z-50 flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 rounded-full shadow-md hover:shadow-lg transition-all duration-300 hover:scale-105 text-gray-700 dark:text-gray-200 hover:text-primary group",children:[e.jsx(oe,{className:"w-5 h-5 text-gray-600 dark:text-gray-400 transition-transform group-hover:-translate-x-1"}),e.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:r("Back to Home")})]}),e.jsx("button",{onClick:E,className:"fixed top-4 right-4 md:top-6 md:right-6 z-50 p-2 rounded-full bg-white dark:bg-gray-800 shadow-md hover:shadow-lg transition-all duration-300 hover:scale-105 border border-gray-200 dark:border-gray-700",title:j?"Switch to light mode":"Switch to dark mode",children:j?e.jsx(G,{className:"w-5 h-5 text-yellow-500"}):e.jsx(J,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"w-full max-w-6xl bg-white dark:bg-gray-800 rounded-2xl shadow-2xl overflow-hidden flex flex-col lg:flex-row",children:[e.jsxs("div",{className:"lg:w-1/2 w-full p-6 sm:p-8 md:p-10 lg:p-12 xl:p-16 flex flex-col justify-center",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("img",{src:m.logo||"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-10 md:h-12 mb-8"}),e.jsx("h1",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 dark:text-white mb-3",children:r("auth.welcomeBack")}),e.jsx("p",{className:"text-base text-gray-500 dark:text-gray-400",children:r("auth.enterCredentials")})]}),e.jsxs("form",{onSubmit:O,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("Login Method")}),e.jsxs(_,{value:t,onValueChange:o=>I(o),children:[e.jsx(ee,{className:"w-full h-12 border-2 border-gray-200 dark:border-gray-600 focus:border-primary bg-white dark:bg-gray-700 transition-colors",children:e.jsx(re,{placeholder:"Method"})}),e.jsxs(ae,{className:"dark:bg-gray-700 dark:text-white",children:[e.jsx(L,{value:"email",className:"dark:hover:bg-gray-600 dark:focus:bg-gray-600",children:r("auth.email")}),e.jsx(L,{value:"phone",className:"dark:hover:bg-gray-600 dark:focus:bg-gray-600",children:r("auth.phoneNumber")}),e.jsx(L,{value:"username",className:"dark:hover:bg-gray-600 dark:focus:bg-gray-600",children:r("auth.username")})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r(t==="email"?"auth.email":t==="phone"?"auth.phoneNumber":"auth.username")}),e.jsxs("div",{className:"relative",children:[s(),e.jsx(T,{type:l(),placeholder:a(),className:"h-12 rounded-lg border-2 border-gray-200 dark:border-gray-600 px-4 text-sm pl-11 pr-4 focus:border-primary transition-colors text-gray-900 dark:text-white bg-white dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400",value:v,onChange:o=>{P(o.target.value),g&&p("")},required:!0})]}),g&&e.jsxs("p",{className:"text-red-500 dark:text-red-400 text-sm mt-2 flex items-center gap-1",children:[e.jsx("span",{className:"w-1 h-1 bg-red-500 dark:bg-red-400 rounded-full"}),g]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("auth.password")}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"}),e.jsx(T,{type:f,placeholder:r("auth.password"),className:"h-12 rounded-lg border-2 border-gray-200 dark:border-gray-600 px-4 text-sm pl-11 pr-4 focus:border-primary transition-colors text-gray-900 dark:text-white bg-white dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400",value:k,onChange:o=>D(o.target.value),required:!0}),e.jsx(M,{type:"button",variant:"ghost",size:"icon",onClick:()=>N(f==="password"?"text":"password"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300",children:f==="password"?e.jsx(ne,{className:"w-5 h-5"}):e.jsx(de,{className:"w-5 h-5"})})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",children:[e.jsx("input",{type:"checkbox",className:"w-4 h-4 accent-primary cursor-pointer bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-500",checked:y,onChange:o=>C(o.target.checked)}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-gray-200 transition-colors",children:r("auth.rememberMe")})]}),e.jsx(A,{to:"/forgot-password",className:"text-sm text-primary hover:text-primary-700 font-medium transition-colors",children:r("auth.forgotPassword")})]}),e.jsx(M,{type:"submit",className:"w-full h-12 bg-primary hover:bg-primary-700 text-white text-base font-medium rounded-lg shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-[1.02] disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",disabled:b,children:b?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r("auth.loggingIn")]}):r("auth.login")}),e.jsxs("div",{className:"text-center pt-2",children:[e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r("Don't have an account?")," "]}),e.jsx(A,{to:"/external-portal/signup",className:"text-sm text-primary hover:text-primary-700 font-medium transition-colors",children:r("Sign Up")})]})]})]}),e.jsxs("div",{className:"hidden lg:flex lg:w-1/2 bg-gradient-to-br from-primary to-primary-700 text-white flex-col justify-center p-10 xl:p-16 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-white/10 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-96 h-96 bg-white/5 rounded-full blur-3xl"}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h2",{className:"text-3xl xl:text-4xl font-bold mb-4 leading-tight",children:[r("auth.welcomeHeadline")," ",e.jsx("br",{})," ",r("auth.paperlessOffice")]}),e.jsx("p",{className:"text-base xl:text-lg mb-8 text-white/90 leading-relaxed",children:r("auth.welcomeSubtext")}),e.jsxs("div",{className:"relative w-full max-w-lg mx-auto mt-12",children:[e.jsx("div",{className:"relative rounded-2xl overflow-hidden shadow-2xl border-4 border-white/20",children:e.jsx("img",{src:"/assets/MainDashboard.png",alt:"Main Dashboard",className:"w-full"})}),e.jsx("div",{className:"absolute -right-4 top-1/2 -translate-y-1/2 shadow-2xl rounded-xl",children:e.jsx("img",{src:"/assets/StatsCard.png",alt:"Stats Overlay",className:"w-32 xl:w-40"})})]})]})]})]})]}),x&&e.jsx(xe,{isOpen:!0,onClose:()=>u(!1),identifier:w,identifierType:t})]})},Ne=()=>{const{loading:h}=W();return h?e.jsx(X,{label:"Loading SmartOffice..."}):e.jsx(he,{})};export{Ne as LoginPage}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-l5cw_Ij0.js b/apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-l5cw_Ij0.js deleted file mode 100644 index 71d30429b..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/LoginPage-l5cw_Ij0.js +++ /dev/null @@ -1 +0,0 @@ -import{u as H,r as n,a as U,j as e,I as T,B as M,b as $,c as Y,d as W,g as Z,L as A,S as G,M as J,U as Q,e as X}from"./index-7T7TTikv.js";import{S as _,a as ee,b as re,c as ae,d as L}from"./select--i8koVXg.js";import{i as q,a as F}from"./Utils-BP0IYDrC.js";import{C as R,a as te,b as se,c as le,d as B}from"./card-_ldW-koX.js";import{A as oe}from"./arrow-left-mae9HpSL.js";import{L as ie}from"./lock-DGEqses-.js";import{E as ne}from"./eye-DYwZYJcQ.js";import{E as de}from"./eye-off-AoIvdwmO.js";import{P as ce}from"./phone-w_VmAt3l.js";import{M as me}from"./mail-q8lHlEPt.js";const xe=({isOpen:h,onClose:b,isLoading:m=!1,title:j,description:E,length:t=6,identifier:I,identifierType:w})=>{const{t:d}=H(),[x,u]=n.useState(Array(t).fill("")),c=n.useRef([]),{verifyMFA:v}=U(),P=j||d("otp.verifyIdentity")||"Verify Your Identity",k=E||d("otp.enterCodeSent")||"Enter the verification code sent to your email",D=d("common.verify")||"Verify",f=d("common.cancel")||"Cancel",[N,g]=n.useState("");n.useEffect(()=>{var a;(a=c.current[0])==null||a.focus()},[]),n.useEffect(()=>{h&&(u(Array(t).fill("")),setTimeout(()=>{var a;(a=c.current[0])==null||a.focus()},100))},[h,t]);const p=(a,s)=>{var o;if(!/^[a-zA-Z0-9]?$/.test(s))return;const l=[...x];l[a]=s,u(l),s&&ai!=="")&&a===t-1&&r(l.join(""))},y=(a,s)=>{var l;s.key==="Backspace"&&!x[a]&&a>0&&((l=c.current[a-1])==null||l.focus())},C=a=>{var o;a.preventDefault();const l=a.clipboardData.getData("text").slice(0,t).split("").filter(i=>/^\d?$/.test(i));if(l.length>0){const i=[...x];l.forEach((V,z)=>{zV===""),K=S===-1?t-1:Math.min(S,t-1);(o=c.current[K])==null||o.focus()}},r=a=>{let s=I;if(w==="phone"){if(!q(s)){g(d("auth.err"));return}s.startsWith("0")&&(s="+251"+s.slice(1))}else if(w==="email"&&!F(s)){g("Please enter a valid email address");return}v({email:s,otp:a})},O=()=>{var a;u(Array(t).fill("")),(a=c.current[0])==null||a.focus()};return h?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm dark:bg-black/80",children:[e.jsxs(R,{className:"w-96 shadow-2xl border-0 animate-in fade-in-90 zoom-in-90 bg-white dark:bg-gray-800",children:[e.jsx(te,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})})}),e.jsxs("div",{children:[e.jsx(se,{className:"text-xl dark:text-white",children:P}),e.jsx(le,{className:"dark:text-gray-400",children:k})]})]})}),e.jsxs(B,{className:"space-y-6",children:[e.jsx("div",{className:"flex justify-center gap-2",children:x.map((a,s)=>e.jsx(T,{ref:l=>{l&&(c.current[s]=l)},type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:1,value:a,onChange:l=>p(s,l.target.value),onKeyDown:l=>y(s,l),onPaste:C,className:"w-12 h-12 text-center text-lg font-semibold focus:ring-2 focus:ring-primary-500 border-2 bg-white dark:bg-gray-700 text-gray-900 dark:text-white border-gray-200 dark:border-gray-600 dark:focus:border-primary-500",disabled:m},s))}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(M,{type:"button",variant:"outline",onClick:b,disabled:m,className:"flex-1 hover:bg-primary-100 dark:hover:bg-primary-900/30 transition-all duration-200 border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300",children:f}),e.jsx(M,{type:"button",onClick:()=>r(x.join("")),disabled:m||x.join("").length!==t,className:"flex-1 bg-gradient-to-r from-primary-600 to-primary-700 hover:from-primary-700 hover:to-primary-800 text-white shadow-lg hover:shadow-xl transition-all duration-200 disabled:opacity-50",children:m?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),d("common.verifying")||"Verifying..."]}):D})]}),e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("button",{type:"button",onClick:O,className:"text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 font-medium transition-colors disabled:opacity-50",disabled:m,children:d("otp.clearCode")||"Clear Code"}),e.jsx("button",{type:"button",className:"text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 font-medium transition-colors disabled:opacity-50",disabled:m,children:d("otp.resendCode")||"Resend Code"})]}),N&&e.jsxs("p",{className:"text-red-500 dark:text-red-400 text-sm mt-2 flex items-center gap-1",children:[e.jsx("span",{className:"w-1 h-1 bg-red-500 dark:bg-red-400 rounded-full"}),N]})]})]}),m&&e.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm rounded-lg flex items-center justify-center",children:e.jsx(R,{className:"w-80 shadow-2xl border-0 bg-white dark:bg-gray-800",children:e.jsxs(B,{className:"p-6 flex flex-col items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-primary-600"}),e.jsx("span",{className:"text-lg font-semibold text-primary-800 dark:text-primary-300",children:d("common.verifying")||"Verifying..."})]}),e.jsx("p",{className:"text-muted-foreground dark:text-gray-400 text-center text-sm",children:d("otp.verifyingCode")||"Please wait while we verify your code"})]})})})]}):null},he=()=>{const{login:h,isLoggingIn:b}=U(),{config:m}=$(),{isDarkMode:j,toggleDarkMode:E}=Y(),[t,I]=n.useState("email"),[w,d]=n.useState(""),{showOtpModal:x,setShowOtpModal:u,setRememberMePreference:c}=W(),[v,P]=n.useState(""),[k,D]=n.useState(""),[f,N]=n.useState("password"),[g,p]=n.useState(""),[y,C]=n.useState(!1),{t:r}=H();n.useEffect(()=>{const o=Z();C(o),c(o)},[c]);const O=async o=>{o.preventDefault(),p("");try{let i=v;if(t==="phone"){if(!q(i)){p(r("auth.err"));return}i.startsWith("0")&&(i="+251"+i.slice(1))}else if(t==="email"&&!F(i)){p(r("auth.invalidEmail"));return}const S={email:i,password:k};d(i),c(y),h({payload:S,rememberMeValue:y})}catch{}},a=()=>{switch(t){case"email":return r("auth.email");case"phone":return r("auth.phoneNumber")+" (e.g., +251912345678)";case"username":return r("auth.username");default:return""}},s=()=>{switch(t){case"email":return e.jsx(me,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"});case"phone":return e.jsx(ce,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"});case"username":return e.jsx(Q,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"});default:return null}},l=()=>t==="phone"?"tel":"text";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800 p-4 md:p-6 lg:p-8 flex items-center justify-center",children:[e.jsxs(A,{to:"/",className:"fixed top-4 left-4 md:top-6 md:left-6 z-50 flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 rounded-full shadow-md hover:shadow-lg transition-all duration-300 hover:scale-105 text-gray-700 dark:text-gray-200 hover:text-primary group",children:[e.jsx(oe,{className:"w-5 h-5 text-gray-600 dark:text-gray-400 transition-transform group-hover:-translate-x-1"}),e.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:r("Back to Home")})]}),e.jsx("button",{onClick:E,className:"fixed top-4 right-4 md:top-6 md:right-6 z-50 p-2 rounded-full bg-white dark:bg-gray-800 shadow-md hover:shadow-lg transition-all duration-300 hover:scale-105 border border-gray-200 dark:border-gray-700",title:j?"Switch to light mode":"Switch to dark mode",children:j?e.jsx(G,{className:"w-5 h-5 text-yellow-500"}):e.jsx(J,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"w-full max-w-6xl bg-white dark:bg-gray-800 rounded-2xl shadow-2xl overflow-hidden flex flex-col lg:flex-row",children:[e.jsxs("div",{className:"lg:w-1/2 w-full p-6 sm:p-8 md:p-10 lg:p-12 xl:p-16 flex flex-col justify-center",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("img",{src:m.logo||"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-10 md:h-12 mb-8"}),e.jsx("h1",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 dark:text-white mb-3",children:r("auth.welcomeBack")}),e.jsx("p",{className:"text-base text-gray-500 dark:text-gray-400",children:r("auth.enterCredentials")})]}),e.jsxs("form",{onSubmit:O,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("Login Method")}),e.jsxs(_,{value:t,onValueChange:o=>I(o),children:[e.jsx(ee,{className:"w-full h-12 border-2 border-gray-200 dark:border-gray-600 focus:border-primary bg-white dark:bg-gray-700 transition-colors",children:e.jsx(re,{placeholder:"Method"})}),e.jsxs(ae,{className:"dark:bg-gray-700 dark:text-white",children:[e.jsx(L,{value:"email",className:"dark:hover:bg-gray-600 dark:focus:bg-gray-600",children:r("auth.email")}),e.jsx(L,{value:"phone",className:"dark:hover:bg-gray-600 dark:focus:bg-gray-600",children:r("auth.phoneNumber")}),e.jsx(L,{value:"username",className:"dark:hover:bg-gray-600 dark:focus:bg-gray-600",children:r("auth.username")})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r(t==="email"?"auth.email":t==="phone"?"auth.phoneNumber":"auth.username")}),e.jsxs("div",{className:"relative",children:[s(),e.jsx(T,{type:l(),placeholder:a(),className:"h-12 rounded-lg border-2 border-gray-200 dark:border-gray-600 px-4 text-sm pl-11 pr-4 focus:border-primary transition-colors text-gray-900 dark:text-white bg-white dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400",value:v,onChange:o=>{P(o.target.value),g&&p("")},required:!0})]}),g&&e.jsxs("p",{className:"text-red-500 dark:text-red-400 text-sm mt-2 flex items-center gap-1",children:[e.jsx("span",{className:"w-1 h-1 bg-red-500 dark:bg-red-400 rounded-full"}),g]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("auth.password")}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"}),e.jsx(T,{type:f,placeholder:r("auth.password"),className:"h-12 rounded-lg border-2 border-gray-200 dark:border-gray-600 px-4 text-sm pl-11 pr-4 focus:border-primary transition-colors text-gray-900 dark:text-white bg-white dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400",value:k,onChange:o=>D(o.target.value),required:!0}),e.jsx(M,{type:"button",variant:"ghost",size:"icon",onClick:()=>N(f==="password"?"text":"password"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300",children:f==="password"?e.jsx(ne,{className:"w-5 h-5"}):e.jsx(de,{className:"w-5 h-5"})})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",children:[e.jsx("input",{type:"checkbox",className:"w-4 h-4 accent-primary cursor-pointer bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-500",checked:y,onChange:o=>C(o.target.checked)}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-gray-200 transition-colors",children:r("auth.rememberMe")})]}),e.jsx(A,{to:"/forgot-password",className:"text-sm text-primary hover:text-primary-700 font-medium transition-colors",children:r("auth.forgotPassword")})]}),e.jsx(M,{type:"submit",className:"w-full h-12 bg-primary hover:bg-primary-700 text-white text-base font-medium rounded-lg shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-[1.02] disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",disabled:b,children:b?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r("auth.loggingIn")]}):r("auth.login")}),e.jsxs("div",{className:"text-center pt-2",children:[e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r("Don't have an account?")," "]}),e.jsx(A,{to:"/external-portal/signup",className:"text-sm text-primary hover:text-primary-700 font-medium transition-colors",children:r("Sign Up")})]})]})]}),e.jsxs("div",{className:"hidden lg:flex lg:w-1/2 bg-gradient-to-br from-primary to-primary-700 text-white flex-col justify-center p-10 xl:p-16 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-white/10 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-96 h-96 bg-white/5 rounded-full blur-3xl"}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h2",{className:"text-3xl xl:text-4xl font-bold mb-4 leading-tight",children:[r("auth.welcomeHeadline")," ",e.jsx("br",{})," ",r("auth.paperlessOffice")]}),e.jsx("p",{className:"text-base xl:text-lg mb-8 text-white/90 leading-relaxed",children:r("auth.welcomeSubtext")}),e.jsxs("div",{className:"relative w-full max-w-lg mx-auto mt-12",children:[e.jsx("div",{className:"relative rounded-2xl overflow-hidden shadow-2xl border-4 border-white/20",children:e.jsx("img",{src:"/assets/MainDashboard.png",alt:"Main Dashboard",className:"w-full"})}),e.jsx("div",{className:"absolute -right-4 top-1/2 -translate-y-1/2 shadow-2xl rounded-xl",children:e.jsx("img",{src:"/assets/StatsCard.png",alt:"Stats Overlay",className:"w-32 xl:w-40"})})]})]})]})]})]}),x&&e.jsx(xe,{isOpen:!0,onClose:()=>u(!1),identifier:w,identifierType:t})]})},Ne=()=>{const{loading:h}=W();return h?e.jsx(X,{label:"Loading SmartOffice..."}):e.jsx(he,{})};export{Ne as LoginPage}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage--fzsv4lI.js b/apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage--fzsv4lI.js deleted file mode 100644 index cea0794d0..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage--fzsv4lI.js +++ /dev/null @@ -1 +0,0 @@ -import{n as x,j as r,aA as b,aB as C,B as y,aC as E,aE as M,r as d,az as w,u as S,f as v}from"./index-Db-xuq0b.js";import{A as z}from"./AdvancedTable-CC9ioMU-.js";import{C as I,a as K,b as B,d as T}from"./card-BBWyxDss.js";import{a as A}from"./userService-BHeFzZdn.js";import{E as U}from"./ellipsis-CbtaBcvT.js";import{E as L}from"./eye-Bhud4znU.js";import{f as P}from"./organizationService-DPKKJMFw.js";import{S as k}from"./FormFields-BA7SVWfi.js";import"./table-D3n3VABd.js";import"./select-BoQxM42A.js";import"./chevron-left-DCpEaNzo.js";import"./utils-BncSPdK1.js";import"./badge-D7JvaQeJ.js";import"./command-Cr0tMDDu.js";import"./search-CM5F2ZRy.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./separator-BaOOgzZX.js";import"./refresh-cw-JB7N413f.js";import"./form-BeLK5rTt.js";import"./index.esm-BG4gweZJ.js";import"./label-CsFy6wpo.js";import"./multi-select-C9K8HXhI.js";import"./single-select-D9ZG1edj.js";const q=(n,l)=>x({queryKey:["migratedData",n,l],queryFn:async()=>{const{data:m}=await A(n,l);return m}}),F=(n,l,m)=>{const g=t=>{m(`/user-management/migrated-records-management/view/${t}`)};return[{accessorKey:"record.referenceNumber",header:"Reference Number",cell:({row:t})=>{var e,a;return(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.referenceNumber}},{accessorKey:"record.letterNumber",header:"Letter Number",cell:({row:t})=>{var e,a;return(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.letterNumber}},{accessorKey:"record.metadata.uploadedBy.en",header:"Uploaded By",cell:({row:t})=>{var e,a,s;return n(((s=(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.metadata)==null?void 0:s.uploadedBy)??{en:"-",am:"-"})}},{accessorKey:"record.metadata.organizationName.en",header:"Organization",cell:({row:t})=>{var e,a,s;return n(((s=(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.metadata)==null?void 0:s.organizationName)??{en:"-",am:"-"})}},{accessorKey:"record.dispatchedDate",header:"Dispatched Date",cell:({row:t})=>{var e,a;return new Date((a=(e=t.original)==null?void 0:e.record)==null?void 0:a.dispatchedDate).toLocaleString()}},{accessorKey:"status",header:"Status",cell:({row:t})=>{var e;return(e=t.original)==null?void 0:e.status}},{accessorKey:"record.content",header:"Subject",cell:({row:t})=>{var e,a,s;return((s=(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.content[0])==null?void 0:s.subject)||"-"}},{id:"actions",cell:({row:t})=>{const e=t.original.record;return r.jsxs(b,{children:[r.jsx(C,{asChild:!0,children:r.jsx(y,{variant:"ghost",size:"sm",children:r.jsx(U,{className:"h-4 w-4"})})}),r.jsx(E,{align:"end",children:r.jsxs(M,{onClick:()=>g(e.id),children:[r.jsx(L,{className:"h-4 w-4 mr-2"}),l("userRecord.View")]})})]})}}]};function V(){const[n,l]=d.useState(0),m=10,[g,t]=d.useState(!1),e=w(),{t:a}=S(),s=v(),{data:o,isLoading:O,error:H}=x({queryKey:["organizations"],queryFn:P,staleTime:300*1e3}),[u,h]=d.useState(null),j=d.useMemo(()=>(o==null?void 0:o.items?.map(i=>({id:i.id,name:i.name,hierarchyType:"organization",value:i.units.length===1?i.units[0].id:"",children:Array.isArray(i.units)&&i.units.length>0?i.units?.map(c=>({id:c.id,name:c.name,hierarchyType:"unit",value:c.id,children:[]})):[]})))||[],[o,e]);d.useEffect(()=>{if(!u){const i=o==null?void 0:o.items.flatMap(c=>c.units).find(c=>c.id);i&&h(i.id)}},[o]),d.useEffect(()=>{u&&sessionStorage.setItem("selectedUnitId",u)},[u]),d.useEffect(()=>{const i=sessionStorage.getItem("selectedUnitId");i&&h(i)},[]);const{data:p,isLoading:D}=q(u??"",{skip:n*m,take:m,orderBy:"migratedAt:DESC"}),f=i=>{l(i)},N=()=>{t(!0)};return D?r.jsx("div",{children:a("loading")}):r.jsx("div",{className:"p-6 space-y-6",children:r.jsxs(I,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[r.jsxs(K,{className:"flex flex-row justify-between items-center px-0",children:[r.jsx(B,{className:"text-xl font-semibold ",children:a("migration.migratedData")}),r.jsx(y,{onClick:N,children:a(g?"migration.exporting":"migration.exportData")})]}),r.jsx("div",{className:"mb-4",children:r.jsx(k,{label:a("selectUnit"),options:j,value:u,onChange:h,collapsible:!0})}),r.jsx(T,{className:"px-0",children:r.jsx(z,{columns:F(e,a,s),data:(p==null?void 0:p.items)||[],tableName:"Migrated Data",toolBarPosition:"right",itemCount:(p==null?void 0:p.count)||0,pageIndex:n,onPageChange:f,nextFunction:()=>f(n+1),prevFunction:()=>f(Math.max(n-1,0))})})]})})}function he(){return r.jsx(V,{})}export{he as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage-CT4uCyO9.js b/apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage-CT4uCyO9.js deleted file mode 100644 index c8a131d8c..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/MigratedDataManagementPage-CT4uCyO9.js +++ /dev/null @@ -1 +0,0 @@ -import{n as x,j as r,aA as b,aB as C,B as y,aC as E,aE as M,r as d,az as w,u as S,f as v}from"./index-7T7TTikv.js";import{A as z}from"./AdvancedTable-vWyUWUDX.js";import{C as I,a as K,b as B,d as T}from"./card-_ldW-koX.js";import{a as A}from"./userService-CFvyXTYe.js";import{E as U}from"./ellipsis-DBW5EePE.js";import{E as L}from"./eye-DYwZYJcQ.js";import{f as P}from"./organizationService-B_C-b9EH.js";import{S as k}from"./FormFields-DeF71qnl.js";import"./table-D_B7hhqb.js";import"./select--i8koVXg.js";import"./chevron-left-G_a9-f9o.js";import"./utils-N2wtfq7C.js";import"./badge-D4t6Wb1T.js";import"./command-B6S1IvD4.js";import"./search-y8VSu0lZ.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./separator-BXi_hr72.js";import"./refresh-cw-B7fipPS4.js";import"./form-lLGtsTgY.js";import"./index.esm-BRNlF2G3.js";import"./label-CABYEcfW.js";import"./multi-select-CZLBnGmP.js";import"./single-select-CqAjmX3L.js";const q=(n,l)=>x({queryKey:["migratedData",n,l],queryFn:async()=>{const{data:m}=await A(n,l);return m}}),F=(n,l,m)=>{const g=t=>{m(`/user-management/migrated-records-management/view/${t}`)};return[{accessorKey:"record.referenceNumber",header:"Reference Number",cell:({row:t})=>{var e,a;return(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.referenceNumber}},{accessorKey:"record.letterNumber",header:"Letter Number",cell:({row:t})=>{var e,a;return(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.letterNumber}},{accessorKey:"record.metadata.uploadedBy.en",header:"Uploaded By",cell:({row:t})=>{var e,a,s;return n(((s=(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.metadata)==null?void 0:s.uploadedBy)??{en:"-",am:"-"})}},{accessorKey:"record.metadata.organizationName.en",header:"Organization",cell:({row:t})=>{var e,a,s;return n(((s=(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.metadata)==null?void 0:s.organizationName)??{en:"-",am:"-"})}},{accessorKey:"record.dispatchedDate",header:"Dispatched Date",cell:({row:t})=>{var e,a;return new Date((a=(e=t.original)==null?void 0:e.record)==null?void 0:a.dispatchedDate).toLocaleString()}},{accessorKey:"status",header:"Status",cell:({row:t})=>{var e;return(e=t.original)==null?void 0:e.status}},{accessorKey:"record.content",header:"Subject",cell:({row:t})=>{var e,a,s;return((s=(a=(e=t.original)==null?void 0:e.record)==null?void 0:a.content[0])==null?void 0:s.subject)||"-"}},{id:"actions",cell:({row:t})=>{const e=t.original.record;return r.jsxs(b,{children:[r.jsx(C,{asChild:!0,children:r.jsx(y,{variant:"ghost",size:"sm",children:r.jsx(U,{className:"h-4 w-4"})})}),r.jsx(E,{align:"end",children:r.jsxs(M,{onClick:()=>g(e.id),children:[r.jsx(L,{className:"h-4 w-4 mr-2"}),l("userRecord.View")]})})]})}}]};function V(){const[n,l]=d.useState(0),m=10,[g,t]=d.useState(!1),e=w(),{t:a}=S(),s=v(),{data:o,isLoading:O,error:H}=x({queryKey:["organizations"],queryFn:P,staleTime:300*1e3}),[u,h]=d.useState(null),j=d.useMemo(()=>(o==null?void 0:o.items.map(i=>({id:i.id,name:i.name,hierarchyType:"organization",value:i.units.length===1?i.units[0].id:"",children:Array.isArray(i.units)&&i.units.length>0?i.units.map(c=>({id:c.id,name:c.name,hierarchyType:"unit",value:c.id,children:[]})):[]})))||[],[o,e]);d.useEffect(()=>{if(!u){const i=o==null?void 0:o.items.flatMap(c=>c.units).find(c=>c.id);i&&h(i.id)}},[o]),d.useEffect(()=>{u&&sessionStorage.setItem("selectedUnitId",u)},[u]),d.useEffect(()=>{const i=sessionStorage.getItem("selectedUnitId");i&&h(i)},[]);const{data:p,isLoading:D}=q(u??"",{skip:n*m,take:m,orderBy:"migratedAt:DESC"}),f=i=>{l(i)},N=()=>{t(!0)};return D?r.jsx("div",{children:a("loading")}):r.jsx("div",{className:"p-6 space-y-6",children:r.jsxs(I,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[r.jsxs(K,{className:"flex flex-row justify-between items-center px-0",children:[r.jsx(B,{className:"text-xl font-semibold ",children:a("migration.migratedData")}),r.jsx(y,{onClick:N,children:a(g?"migration.exporting":"migration.exportData")})]}),r.jsx("div",{className:"mb-4",children:r.jsx(k,{label:a("selectUnit"),options:j,value:u,onChange:h,collapsible:!0})}),r.jsx(T,{className:"px-0",children:r.jsx(z,{columns:F(e,a,s),data:(p==null?void 0:p.items)||[],tableName:"Migrated Data",toolBarPosition:"right",itemCount:(p==null?void 0:p.count)||0,pageIndex:n,onPageChange:f,nextFunction:()=>f(n+1),prevFunction:()=>f(Math.max(n-1,0))})})]})})}function he(){return r.jsx(V,{})}export{he as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-C0u3U4kS.js b/apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-C0u3U4kS.js deleted file mode 100644 index 87df458fc..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-C0u3U4kS.js +++ /dev/null @@ -1 +0,0 @@ -import{j as i}from"./index-Db-xuq0b.js";import{u as m}from"./useOrganizations-DiuNBweX.js";import{O as e}from"./OrganizationForm-Dc20iiRT.js";import"./organizationsService-BEVk8qa1.js";import"./select-BoQxM42A.js";import"./card-BBWyxDss.js";import"./label-CsFy6wpo.js";import"./useOrganizationTypes-B6vCp97C.js";import"./index.esm-BG4gweZJ.js";import"./zod-Df58YiJ6.js";import"./switch-BNCD27Bd.js";import"./Switch-DSHMk-sj.js";import"./InputsGroupFieldset-COkNgcEo.js";import"./use-uncontrolled-C3HRHW6t.js";const p=()=>{const{createOrganization:o,isCreating:n}=m("Org"),a=t=>{const r={key:t.key,name:t.name,organizationTypeId:t.organizationTypeId,isGovernmentOrganization:t.isGovernmentOrganization};t.parentId&&t.parentId!==""&&(r.parentId=t.parentId),o(r)};return i.jsx(e,{isLoading:n,onSubmit:t=>a(t),type:"Create"})},w=()=>i.jsx(p,{});export{w as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-S4CT6ysT.js b/apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-S4CT6ysT.js deleted file mode 100644 index 17c92eb9b..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/NewOrganizationPage-S4CT6ysT.js +++ /dev/null @@ -1 +0,0 @@ -import{j as i}from"./index-7T7TTikv.js";import{u as m}from"./useOrganizations-CPt4mkXS.js";import{O as e}from"./OrganizationForm-BNuDw3k3.js";import"./organizationsService-DIFVjoLn.js";import"./select--i8koVXg.js";import"./card-_ldW-koX.js";import"./label-CABYEcfW.js";import"./useOrganizationTypes-CQm1BLlI.js";import"./index.esm-BRNlF2G3.js";import"./zod-D-9d3Txu.js";import"./switch-D9hx8CZw.js";import"./Switch-ByfhjkDo.js";import"./InputsGroupFieldset-B16dMH0P.js";import"./use-uncontrolled-tg0LIUAX.js";const p=()=>{const{createOrganization:o,isCreating:n}=m("Org"),a=t=>{const r={key:t.key,name:t.name,organizationTypeId:t.organizationTypeId,isGovernmentOrganization:t.isGovernmentOrganization};t.parentId&&t.parentId!==""&&(r.parentId=t.parentId),o(r)};return i.jsx(e,{isLoading:n,onSubmit:t=>a(t),type:"Create"})},w=()=>i.jsx(p,{});export{w as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-DhPmvSML.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-DhPmvSML.js deleted file mode 100644 index 8b5b1ed42..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-DhPmvSML.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as C,f as A,d as S,z as M,F as x,v as a,j as e,B as u,A as D}from"./index-Db-xuq0b.js";import{C as n,d as l,a as U,b as z}from"./card-BBWyxDss.js";import{u as $}from"./useOrganizationReport-D3QtWTPL.js";import{A as L,a as E}from"./alert-8Xu28MAD.js";import{S as c}from"./skeleton-CIiqp2Y5.js";import{S as R}from"./SmartOfficeAuditPage-DLN72875.js";import{U as b}from"./users-DNqydOCy.js";import{C as f}from"./circle-alert-Cd_zeQMw.js";import{R as j}from"./refresh-cw-JB7N413f.js";import"./organizationsService-BEVk8qa1.js";import"./Skeleton-BJECajc_.js";import"./table-D3n3VABd.js";import"./badge-D7JvaQeJ.js";import"./avatar-C2-XEZ4v.js";import"./format-DvwV82px.js";import"./en-US-Cc-9gH5A.js";import"./shield-uC_usZTb.js";import"./lock-BCybB-Lq.js";import"./eye-Bhud4znU.js";import"./square-pen-B91TPB19.js";import"./download-CX6rsOqt.js";import"./select-BoQxM42A.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./endOfMonth-DmxQbzXi.js";import"./search-CM5F2ZRy.js";import"./label-CsFy6wpo.js";import"./radio-group-DqG5gUnT.js";import"./Radio-C3SNvFel.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-COkNgcEo.js";import"./checkbox-Dd0VhnrO.js";import"./Checkbox-IILksgz0.js";import"./eye-off-CDMvHElM.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _=[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]],B=C("files",_),je=()=>{var g,h;const t=A(),{user:i}=S(),y=((h=(g=i==null?void 0:i.employee)==null?void 0:g[0])==null?void 0:h.organizationId)||"fecaa9b3-0b9d-4772-a7c7-bcb19d46122a",{report:s,isLoading:d,isError:v,error:m,refetch:N}=$(y),k=()=>{var r,o,p;return[{id:"employees",title:a("dashboard.totalEmployees"),value:((r=s==null?void 0:s.employeesCount)==null?void 0:r.toLocaleString())||"0",icon:b,color:"from-blue-500 to-blue-600"},{id:"units",title:a("dashboard.totalUnits"),value:((o=s==null?void 0:s.unitsCount)==null?void 0:o.toLocaleString())||"0",icon:D,color:"from-primary-500 to-primary-600"},{id:"positions",title:a("dashboard.totalPositions"),value:((p=s==null?void 0:s.positionsCount)==null?void 0:p.toLocaleString())||"0",icon:x,color:"from-purple-500 to-purple-600"}]},w=[{id:"user-mgmt",title:a("dashboard.userManagement"),description:a("dashboard.userManagementDesc"),icon:b,action:()=>t("/user-management/user_management"),color:"bg-gradient-to-r from-blue-500 to-cyan-600"},{id:"content-mgmt",title:a("dashboard.contentManagement"),description:a("dashboard.contentManagementDesc"),icon:B,action:()=>t("/user-management/content-management"),color:"bg-gradient-to-r from-purple-500 to-indigo-600"},{id:"excel-upload",title:a("dashboard.excelUploader"),description:a("dashboard.excelUploaderDesc"),icon:M,action:()=>t("/user-management/bulk-upload"),color:"bg-gradient-to-r from-primary-500 to-primary-600"},{id:"position-settings",title:a("dashboard.positionSettings"),description:a("dashboard.positionSettingsDesc"),icon:x,action:()=>t("/user-management/position-management"),color:"bg-gradient-to-r from-orange-500 to-red-600"},{id:"archive-users",title:a("dashboard.archiveUsers"),description:a("dashboard.archiveUsersDesc"),icon:f,action:()=>t("/user-management/archives"),color:"bg-gradient-to-r from-gray-500 to-slate-600"}];return e.jsxs("div",{className:"mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-gray-100",children:a("dashboard.organizationDashboard")}),e.jsx("p",{className:"text-muted-foreground dark:text-gray-400",children:a("dashboard.orgMsg")})]}),e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>N(),disabled:d,children:[e.jsx(j,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),a("dashboard.refresh")]})]}),v&&e.jsxs(L,{variant:"destructive",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsxs(E,{children:[a("dashboard.errorMsg"),m instanceof Error&&`: ${m.message}`]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:d?Array(3).fill(0)?.map((r,o)=>e.jsx(n,{className:"hover:shadow-lg transition-shadow duration-200 dark:bg-gray-800 dark:border-gray-700",children:e.jsx(l,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"w-full",children:[e.jsx(c,{className:"h-4 w-24 mb-2"}),e.jsx(c,{className:"h-8 w-16"})]}),e.jsx(c,{className:"h-12 w-12 rounded-full"})]})})},`skeleton-stat-${o}`)):k()?.map(r=>e.jsx(n,{className:"hover:shadow-lg transition-shadow duration-200 border-l-4 border-l-blue-500 dark:bg-gray-800 dark:border-gray-700 dark:border-l-blue-500",children:e.jsx(l,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground dark:text-gray-400",children:r.title}),e.jsx("h3",{className:"text-3xl font-bold mt-2 text-gray-900 dark:text-gray-100",children:r.value})]}),e.jsx("div",{className:`p-4 rounded-full bg-gradient-to-r ${r.color} shadow-lg`,children:e.jsx(r.icon,{className:"h-6 w-6 text-white"})})]})})},`stat-${r.id}`))}),e.jsxs(n,{className:"dark:bg-gray-800 dark:border-gray-700",children:[e.jsx(U,{children:e.jsxs(z,{className:"flex items-center dark:text-gray-100",children:[e.jsx(j,{className:"h-5 w-5 mr-2"}),a("landingPage.quickActions")]})}),e.jsx(l,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:w?.map(r=>e.jsx(u,{onClick:r.action,className:`h-auto p-6 ${r.color} text-white hover:opacity-90 hover:scale-105 transition-all duration-200`,children:e.jsxs("div",{className:"flex flex-col items-center space-y-3 text-center",children:[e.jsx(r.icon,{className:"h-8 w-8"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-base",children:r.title}),e.jsx("div",{className:"text-sm opacity-90 mt-1",children:r.description})]})]})},`action-${r.id}`))})})]}),e.jsx(R,{})]})};export{je as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-bZmhZgbZ.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-bZmhZgbZ.js deleted file mode 100644 index 6f4d12f0f..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrgAdminDashboard-bZmhZgbZ.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as C,f as A,d as S,z as M,F as x,v as a,j as e,B as u,A as D}from"./index-7T7TTikv.js";import{C as n,d as l,a as U,b as z}from"./card-_ldW-koX.js";import{u as $}from"./useOrganizationReport-Btcu9b-4.js";import{A as L,a as E}from"./alert-CCWXLU2U.js";import{S as c}from"./skeleton-BCpLdfqO.js";import{S as R}from"./SmartOfficeAuditPage-Dcwrs1dM.js";import{U as b}from"./users-bn5-xqQf.js";import{C as f}from"./circle-alert-HVqsZpe-.js";import{R as j}from"./refresh-cw-B7fipPS4.js";import"./organizationsService-DIFVjoLn.js";import"./Skeleton-BOu0YqbY.js";import"./table-D_B7hhqb.js";import"./badge-D4t6Wb1T.js";import"./avatar-BU_IHgzI.js";import"./format-DvwV82px.js";import"./en-US-Cc-9gH5A.js";import"./shield-D3luOm6l.js";import"./lock-DGEqses-.js";import"./eye-DYwZYJcQ.js";import"./square-pen-Dh1zj83N.js";import"./download-Btm1n-GQ.js";import"./select--i8koVXg.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./endOfMonth-DmxQbzXi.js";import"./search-y8VSu0lZ.js";import"./label-CABYEcfW.js";import"./radio-group-C9tEhs3a.js";import"./Radio-D43EoWlg.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-B16dMH0P.js";import"./checkbox-CTVlz2xL.js";import"./Checkbox-CAXGYFGh.js";import"./eye-off-AoIvdwmO.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _=[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]],B=C("files",_),je=()=>{var g,h;const t=A(),{user:i}=S(),y=((h=(g=i==null?void 0:i.employee)==null?void 0:g[0])==null?void 0:h.organizationId)||"fecaa9b3-0b9d-4772-a7c7-bcb19d46122a",{report:s,isLoading:d,isError:v,error:m,refetch:N}=$(y),k=()=>{var r,o,p;return[{id:"employees",title:a("dashboard.totalEmployees"),value:((r=s==null?void 0:s.employeesCount)==null?void 0:r.toLocaleString())||"0",icon:b,color:"from-blue-500 to-blue-600"},{id:"units",title:a("dashboard.totalUnits"),value:((o=s==null?void 0:s.unitsCount)==null?void 0:o.toLocaleString())||"0",icon:D,color:"from-primary-500 to-primary-600"},{id:"positions",title:a("dashboard.totalPositions"),value:((p=s==null?void 0:s.positionsCount)==null?void 0:p.toLocaleString())||"0",icon:x,color:"from-purple-500 to-purple-600"}]},w=[{id:"user-mgmt",title:a("dashboard.userManagement"),description:a("dashboard.userManagementDesc"),icon:b,action:()=>t("/user-management/user_management"),color:"bg-gradient-to-r from-blue-500 to-cyan-600"},{id:"content-mgmt",title:a("dashboard.contentManagement"),description:a("dashboard.contentManagementDesc"),icon:B,action:()=>t("/user-management/content-management"),color:"bg-gradient-to-r from-purple-500 to-indigo-600"},{id:"excel-upload",title:a("dashboard.excelUploader"),description:a("dashboard.excelUploaderDesc"),icon:M,action:()=>t("/user-management/bulk-upload"),color:"bg-gradient-to-r from-primary-500 to-primary-600"},{id:"position-settings",title:a("dashboard.positionSettings"),description:a("dashboard.positionSettingsDesc"),icon:x,action:()=>t("/user-management/position-management"),color:"bg-gradient-to-r from-orange-500 to-red-600"},{id:"archive-users",title:a("dashboard.archiveUsers"),description:a("dashboard.archiveUsersDesc"),icon:f,action:()=>t("/user-management/archives"),color:"bg-gradient-to-r from-gray-500 to-slate-600"}];return e.jsxs("div",{className:"mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-gray-100",children:a("dashboard.organizationDashboard")}),e.jsx("p",{className:"text-muted-foreground dark:text-gray-400",children:a("dashboard.orgMsg")})]}),e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>N(),disabled:d,children:[e.jsx(j,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),a("dashboard.refresh")]})]}),v&&e.jsxs(L,{variant:"destructive",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsxs(E,{children:[a("dashboard.errorMsg"),m instanceof Error&&`: ${m.message}`]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:d?Array(3).fill(0).map((r,o)=>e.jsx(n,{className:"hover:shadow-lg transition-shadow duration-200 dark:bg-gray-800 dark:border-gray-700",children:e.jsx(l,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"w-full",children:[e.jsx(c,{className:"h-4 w-24 mb-2"}),e.jsx(c,{className:"h-8 w-16"})]}),e.jsx(c,{className:"h-12 w-12 rounded-full"})]})})},`skeleton-stat-${o}`)):k().map(r=>e.jsx(n,{className:"hover:shadow-lg transition-shadow duration-200 border-l-4 border-l-blue-500 dark:bg-gray-800 dark:border-gray-700 dark:border-l-blue-500",children:e.jsx(l,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground dark:text-gray-400",children:r.title}),e.jsx("h3",{className:"text-3xl font-bold mt-2 text-gray-900 dark:text-gray-100",children:r.value})]}),e.jsx("div",{className:`p-4 rounded-full bg-gradient-to-r ${r.color} shadow-lg`,children:e.jsx(r.icon,{className:"h-6 w-6 text-white"})})]})})},`stat-${r.id}`))}),e.jsxs(n,{className:"dark:bg-gray-800 dark:border-gray-700",children:[e.jsx(U,{children:e.jsxs(z,{className:"flex items-center dark:text-gray-100",children:[e.jsx(j,{className:"h-5 w-5 mr-2"}),a("landingPage.quickActions")]})}),e.jsx(l,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:w.map(r=>e.jsx(u,{onClick:r.action,className:`h-auto p-6 ${r.color} text-white hover:opacity-90 hover:scale-105 transition-all duration-200`,children:e.jsxs("div",{className:"flex flex-col items-center space-y-3 text-center",children:[e.jsx(r.icon,{className:"h-8 w-8"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-base",children:r.title}),e.jsx("div",{className:"text-sm opacity-90 mt-1",children:r.description})]})]})},`action-${r.id}`))})})]}),e.jsx(R,{})]})};export{je as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-BvY4PVex.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-BvY4PVex.js deleted file mode 100644 index b1de661a1..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-BvY4PVex.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as Y,j as e,B as c,v as E,m as Z,r as o,u as _,az as H,aK as B,aL as R,aM as ee,aN as ae,bo as se,aF as I,aP as O,I as te,ba as re,t as h,L as ie}from"./index-Db-xuq0b.js";import{C as ne,a as oe,b as de,d as ce}from"./card-BBWyxDss.js";import{A as le}from"./AdvancedTable-CC9ioMU-.js";import{S as me,a as ue}from"./StatusCell-D7zi31G6.js";import{u as Q}from"./useOrganizations-DiuNBweX.js";import{L as T}from"./label-CsFy6wpo.js";import{S as L}from"./scroll-area-zSBvHuIO.js";import{u as xe}from"./useEmployees-CygwM5u6.js";import{c as q}from"./utils-BncSPdK1.js";import{u as ge}from"./useUnit-C4s9nepK.js";import{U as pe}from"./user-plus-CBq7Z0dQ.js";import{P as he}from"./plus-BdjS2Pc-.js";import"./table-D3n3VABd.js";import"./select-BoQxM42A.js";import"./chevron-left-DCpEaNzo.js";import"./badge-D7JvaQeJ.js";import"./command-Cr0tMDDu.js";import"./search-CM5F2ZRy.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./separator-BaOOgzZX.js";import"./refresh-cw-JB7N413f.js";import"./useOrganizationAdmins-Bl-gbkwr.js";import"./use-toast-CdbbItn1.js";import"./alert-dialog-B5Y0wlSz.js";import"./phone-Ce15UUGI.js";import"./eye-Bhud4znU.js";import"./organizationsService-BEVk8qa1.js";import"./unitService-CmGVtFHQ.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const je=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],K=Y("arrow-up-down",je),fe=l=>[{accessorKey:"name",header:({column:s})=>e.jsxs(c,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),className:"p-0 hover:bg-transparent text-gray-700 dark:text-gray-300",style:{padding:0},children:[E("organization.name"),e.jsx(K,{className:"p-0 h-4 w-4"})]}),cell:({row:s})=>e.jsx("div",{className:"font-medium",children:l(s.original.name)})},{accessorKey:"status",header:({column:s})=>e.jsxs(c,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),className:"p-0 hover:bg-transparent text-gray-700 dark:text-gray-300",style:{padding:0},children:[E("dashboard.Status"),e.jsx(K,{className:"h-4 w-4"})]}),cell:({row:s})=>{const g=s.original.id;return e.jsx(me,{id:g,adminsCount:s.original.adminsCount})}}];function ye({onSuccess:l,onClose:s,isOpen:g}){var F;const d=Z(),[m,C]=o.useState(""),[x,n]=o.useState(""),[j,f]=o.useState(!1),[p,y]=o.useState(""),{t:r}=_(),[z,A]=o.useState(0),w=10,$=H(),{organizationsResponse:S,isLoading:V}=Q("Org",{take:300}),{employeesResponseByOrg:t,isLoading:G,refetch:J}=xe({organizationId:m||void 0,params:{take:w,skip:z*w}}),{data:b,isLoading:Ne}=ge().getList(m||"",{take:300,skip:0}),[D,U]=o.useState("");o.useEffect(()=>{var a,i;(i=(a=b==null?void 0:b.data)==null?void 0:a.items)!=null&&i.length?U(b.data.items[0].id):U("")},[m,b]);const W=async a=>{if(a.preventDefault(),!x||!m){h.error("All fields are required");return}const i=t==null?void 0:t.items.find(u=>u.user.id===x);if(!i)return h.error("User not found");if(!D){h.error("No unit available for this organization");return}f(!0);const N={unitId:D,userId:i.user.id};ue(N).then(()=>{d.invalidateQueries({queryKey:["organizationAdmins"]}),h.success(r("organization.userAssignedSuccess")),f(!1),s(),l()}).catch(u=>{var k,v;h.error(r("organization.userAssignFailed"),{description:(v=(k=u==null?void 0:u.response)==null?void 0:k.data)==null?void 0:v.message}),f(!1)})},X=()=>{C(""),n(""),J()},P=o.useMemo(()=>t!=null&&t.items?t.items.filter(a=>{var k,v,M;const i=((v=(k=a.user.name)==null?void 0:k.en)==null?void 0:v.toLowerCase())||"",N=((M=a.user.email)==null?void 0:M.toLowerCase())||"",u=p.toLowerCase();return i.includes(u)||N.includes(u)}):[],[t,p]);return e.jsx(B,{open:g,onOpenChange:s,children:e.jsxs(R,{className:"sm:max-w-[800px]",children:[e.jsxs(ee,{children:[e.jsx(ae,{children:r("organization.assignAdminToOrganization")}),e.jsx(se,{children:r("organization.assignAdminInstructions")})]}),e.jsxs("form",{onSubmit:W,className:"space-y-6",children:[e.jsxs(L,{className:"h-[450px] border border-gray-200 dark:border-gray-700 rounded-md p-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:r("organization.organizations")}),V?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsx(L,{className:"h-[200px] border border-gray-200 dark:border-gray-700 rounded-md p-2",children:e.jsx("div",{className:"space-y-1",children:(F=S==null?void 0:S.items)==null?void 0:F?.map(a=>e.jsxs("button",{onClick:()=>{C(a.id),n(""),A(0)},type:"button",className:q("w-full flex items-center justify-between px-3 py-2 rounded-md text-left",m===a.id?"bg-primary-200 text-primary-800 dark:bg-primary-900/40 dark:text-primary-300":"hover:bg-primary-100 dark:hover:bg-primary-900/30"),children:[e.jsx("span",{children:$(a.name)}),m===a.id&&e.jsx(O,{className:"h-4 w-4"})]},`org-${a.id}`))})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:r("organization.users")}),G?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{placeholder:r("organization.searchUsers"),value:p,onChange:a=>y(a.target.value),className:"border border-gray-200 dark:border-gray-700 rounded-md dark:bg-gray-800 dark:text-gray-100"}),e.jsx(L,{className:"h-[200px] border border-gray-200 dark:border-gray-700 rounded-md p-2",children:e.jsxs("div",{className:"space-y-1",children:[P?.map(a=>{var i;return e.jsxs("button",{onClick:()=>n(a.user.id),type:"button",className:q("w-full flex items-center justify-between px-3 py-2 rounded-md text-left",x===a.user.id?"bg-purple-200 text-purple-800 dark:bg-purple-900/40 dark:text-purple-300":"hover:bg-purple-100 dark:hover:bg-purple-900/30"),children:[e.jsx("span",{children:((i=a.user.name)==null?void 0:i.en)||a.user.email}),x===a.user.id&&e.jsx(O,{className:"h-4 w-4"})]},`emp-${a.id}`)}),P.length===0&&e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center mt-2",children:r("organization.noUsersFound")})]})})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2 px-2",children:[e.jsx(c,{type:"button",variant:"outline",size:"sm",onClick:()=>A(a=>Math.max(a-1,0)),disabled:z===0,children:"<"}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[r("common.page")," ",z+1]}),e.jsx(c,{type:"button",variant:"outline",size:"sm",onClick:()=>{const a=(t==null?void 0:t.count)??0,i=Math.ceil(a/w)-1;A(N=>Math.min(N+1,i))},disabled:!(t!=null&&t.count)||(z+1)*w>=t.count,children:">"})]})]}),e.jsx(re,{children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>{X(),s()},disabled:j,children:r("common.Cancel")}),e.jsx(c,{type:"submit",disabled:j,children:r(j?"organization.assigning":"organization.assignUser")})]})})]})]})})}function be(){const[l,s]=o.useState(0),g=10,{t:d}=_(),m=H(),[C,x]=o.useState(!1),{organizationsAdminsResponse:n,isLoading:j,isError:f,refetch:p}=Q("Admin",{take:g,skip:l*g,orderBy:"createdAt",order:"createdAt:Desc"}),y=r=>{s(r)};return j?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(I,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:d("organization.loadingAdmins")})]})}):f?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"text-red-500 font-medium",children:d("organization.errorLoadingAdmins")}),e.jsx(c,{variant:"outline",onClick:()=>p(),children:d("organization.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-6 space-y-6 dark:bg-gray-900",children:e.jsxs(ne,{className:"col-span-2 shadow-none border-none bg-transparent dark:bg-transparent px-0",children:[e.jsx(oe,{className:"flex flex-row justify-between items-center px-0",children:e.jsx(de,{className:"text-xl font-semibold dark:text-white",children:d("organization.organizationAdmins")})}),e.jsx(ce,{className:"px-0 dark:bg-transparent",children:e.jsx(le,{columns:fe(m),data:(n==null?void 0:n.items)||[],tableName:"Organization Admins",toolBarPosition:"right",extraToolbar:e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(c,{onClick:()=>x(!0),className:"bg-[#4A6CF7] hover:bg-[#3a5ad4] text-white px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(pe,{className:"w-4 h-4 mr-2"}),d("organization.assignAdmin")]}),e.jsx(ie,{to:"/user-management/add_admin",children:e.jsxs(c,{className:"px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(he,{className:"w-4 h-4 mr-2"}),d("organization.addAdmin")]})})]}),itemCount:(n==null?void 0:n.count)||0,pageIndex:l,onPageChange:y,nextFunction:()=>y(l+1),prevFunction:()=>y(Math.max(l-1,0))})})]})}),e.jsx(ye,{isOpen:C,onClose:()=>x(!1),onSuccess:()=>{p(),h.success(d("organization.adminAssignedSuccess"))}})]})}const Be=()=>e.jsx(be,{});export{Be as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-DCQEuGHQ.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-DCQEuGHQ.js deleted file mode 100644 index f9c1b71e9..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationAdminsPage-DCQEuGHQ.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as Y,j as e,B as c,v as E,m as Z,r as o,u as _,az as H,aK as B,aL as R,aM as ee,aN as ae,bo as se,aF as I,aP as O,I as te,ba as re,t as h,L as ie}from"./index-7T7TTikv.js";import{C as ne,a as oe,b as de,d as ce}from"./card-_ldW-koX.js";import{A as le}from"./AdvancedTable-vWyUWUDX.js";import{S as me,a as ue}from"./StatusCell-BAmClBhM.js";import{u as Q}from"./useOrganizations-CPt4mkXS.js";import{L as T}from"./label-CABYEcfW.js";import{S as L}from"./scroll-area-7Hggnc7C.js";import{u as xe}from"./useEmployees-DreGarUD.js";import{c as q}from"./utils-N2wtfq7C.js";import{u as ge}from"./useUnit-CRt6YBLp.js";import{U as pe}from"./user-plus-tzUBEFtH.js";import{P as he}from"./plus-CC3ol2sL.js";import"./table-D_B7hhqb.js";import"./select--i8koVXg.js";import"./chevron-left-G_a9-f9o.js";import"./badge-D4t6Wb1T.js";import"./command-B6S1IvD4.js";import"./search-y8VSu0lZ.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./separator-BXi_hr72.js";import"./refresh-cw-B7fipPS4.js";import"./useOrganizationAdmins-a9snXrfR.js";import"./use-toast-mIxmYSs4.js";import"./alert-dialog-DwppaTz4.js";import"./phone-w_VmAt3l.js";import"./eye-DYwZYJcQ.js";import"./organizationsService-DIFVjoLn.js";import"./unitService-DTtkt-Pb.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const je=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],K=Y("arrow-up-down",je),fe=l=>[{accessorKey:"name",header:({column:s})=>e.jsxs(c,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),className:"p-0 hover:bg-transparent text-gray-700 dark:text-gray-300",style:{padding:0},children:[E("organization.name"),e.jsx(K,{className:"p-0 h-4 w-4"})]}),cell:({row:s})=>e.jsx("div",{className:"font-medium",children:l(s.original.name)})},{accessorKey:"status",header:({column:s})=>e.jsxs(c,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),className:"p-0 hover:bg-transparent text-gray-700 dark:text-gray-300",style:{padding:0},children:[E("dashboard.Status"),e.jsx(K,{className:"h-4 w-4"})]}),cell:({row:s})=>{const g=s.original.id;return e.jsx(me,{id:g,adminsCount:s.original.adminsCount})}}];function ye({onSuccess:l,onClose:s,isOpen:g}){var F;const d=Z(),[m,C]=o.useState(""),[x,n]=o.useState(""),[j,f]=o.useState(!1),[p,y]=o.useState(""),{t:r}=_(),[z,A]=o.useState(0),w=10,$=H(),{organizationsResponse:S,isLoading:V}=Q("Org",{take:300}),{employeesResponseByOrg:t,isLoading:G,refetch:J}=xe({organizationId:m||void 0,params:{take:w,skip:z*w}}),{data:b,isLoading:Ne}=ge().getList(m||"",{take:300,skip:0}),[D,U]=o.useState("");o.useEffect(()=>{var a,i;(i=(a=b==null?void 0:b.data)==null?void 0:a.items)!=null&&i.length?U(b.data.items[0].id):U("")},[m,b]);const W=async a=>{if(a.preventDefault(),!x||!m){h.error("All fields are required");return}const i=t==null?void 0:t.items.find(u=>u.user.id===x);if(!i)return h.error("User not found");if(!D){h.error("No unit available for this organization");return}f(!0);const N={unitId:D,userId:i.user.id};ue(N).then(()=>{d.invalidateQueries({queryKey:["organizationAdmins"]}),h.success(r("organization.userAssignedSuccess")),f(!1),s(),l()}).catch(u=>{var k,v;h.error(r("organization.userAssignFailed"),{description:(v=(k=u==null?void 0:u.response)==null?void 0:k.data)==null?void 0:v.message}),f(!1)})},X=()=>{C(""),n(""),J()},P=o.useMemo(()=>t!=null&&t.items?t.items.filter(a=>{var k,v,M;const i=((v=(k=a.user.name)==null?void 0:k.en)==null?void 0:v.toLowerCase())||"",N=((M=a.user.email)==null?void 0:M.toLowerCase())||"",u=p.toLowerCase();return i.includes(u)||N.includes(u)}):[],[t,p]);return e.jsx(B,{open:g,onOpenChange:s,children:e.jsxs(R,{className:"sm:max-w-[800px]",children:[e.jsxs(ee,{children:[e.jsx(ae,{children:r("organization.assignAdminToOrganization")}),e.jsx(se,{children:r("organization.assignAdminInstructions")})]}),e.jsxs("form",{onSubmit:W,className:"space-y-6",children:[e.jsxs(L,{className:"h-[450px] border border-gray-200 dark:border-gray-700 rounded-md p-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:r("organization.organizations")}),V?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsx(L,{className:"h-[200px] border border-gray-200 dark:border-gray-700 rounded-md p-2",children:e.jsx("div",{className:"space-y-1",children:(F=S==null?void 0:S.items)==null?void 0:F.map(a=>e.jsxs("button",{onClick:()=>{C(a.id),n(""),A(0)},type:"button",className:q("w-full flex items-center justify-between px-3 py-2 rounded-md text-left",m===a.id?"bg-primary-200 text-primary-800 dark:bg-primary-900/40 dark:text-primary-300":"hover:bg-primary-100 dark:hover:bg-primary-900/30"),children:[e.jsx("span",{children:$(a.name)}),m===a.id&&e.jsx(O,{className:"h-4 w-4"})]},`org-${a.id}`))})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:r("organization.users")}),G?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{placeholder:r("organization.searchUsers"),value:p,onChange:a=>y(a.target.value),className:"border border-gray-200 dark:border-gray-700 rounded-md dark:bg-gray-800 dark:text-gray-100"}),e.jsx(L,{className:"h-[200px] border border-gray-200 dark:border-gray-700 rounded-md p-2",children:e.jsxs("div",{className:"space-y-1",children:[P.map(a=>{var i;return e.jsxs("button",{onClick:()=>n(a.user.id),type:"button",className:q("w-full flex items-center justify-between px-3 py-2 rounded-md text-left",x===a.user.id?"bg-purple-200 text-purple-800 dark:bg-purple-900/40 dark:text-purple-300":"hover:bg-purple-100 dark:hover:bg-purple-900/30"),children:[e.jsx("span",{children:((i=a.user.name)==null?void 0:i.en)||a.user.email}),x===a.user.id&&e.jsx(O,{className:"h-4 w-4"})]},`emp-${a.id}`)}),P.length===0&&e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center mt-2",children:r("organization.noUsersFound")})]})})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2 px-2",children:[e.jsx(c,{type:"button",variant:"outline",size:"sm",onClick:()=>A(a=>Math.max(a-1,0)),disabled:z===0,children:"<"}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[r("common.page")," ",z+1]}),e.jsx(c,{type:"button",variant:"outline",size:"sm",onClick:()=>{const a=(t==null?void 0:t.count)??0,i=Math.ceil(a/w)-1;A(N=>Math.min(N+1,i))},disabled:!(t!=null&&t.count)||(z+1)*w>=t.count,children:">"})]})]}),e.jsx(re,{children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>{X(),s()},disabled:j,children:r("common.Cancel")}),e.jsx(c,{type:"submit",disabled:j,children:r(j?"organization.assigning":"organization.assignUser")})]})})]})]})})}function be(){const[l,s]=o.useState(0),g=10,{t:d}=_(),m=H(),[C,x]=o.useState(!1),{organizationsAdminsResponse:n,isLoading:j,isError:f,refetch:p}=Q("Admin",{take:g,skip:l*g,orderBy:"createdAt",order:"createdAt:Desc"}),y=r=>{s(r)};return j?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(I,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:d("organization.loadingAdmins")})]})}):f?e.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"text-red-500 font-medium",children:d("organization.errorLoadingAdmins")}),e.jsx(c,{variant:"outline",onClick:()=>p(),children:d("organization.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-6 space-y-6 dark:bg-gray-900",children:e.jsxs(ne,{className:"col-span-2 shadow-none border-none bg-transparent dark:bg-transparent px-0",children:[e.jsx(oe,{className:"flex flex-row justify-between items-center px-0",children:e.jsx(de,{className:"text-xl font-semibold dark:text-white",children:d("organization.organizationAdmins")})}),e.jsx(ce,{className:"px-0 dark:bg-transparent",children:e.jsx(le,{columns:fe(m),data:(n==null?void 0:n.items)||[],tableName:"Organization Admins",toolBarPosition:"right",extraToolbar:e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(c,{onClick:()=>x(!0),className:"bg-[#4A6CF7] hover:bg-[#3a5ad4] text-white px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(pe,{className:"w-4 h-4 mr-2"}),d("organization.assignAdmin")]}),e.jsx(ie,{to:"/user-management/add_admin",children:e.jsxs(c,{className:"px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(he,{className:"w-4 h-4 mr-2"}),d("organization.addAdmin")]})})]}),itemCount:(n==null?void 0:n.count)||0,pageIndex:l,onPageChange:y,nextFunction:()=>y(l+1),prevFunction:()=>y(Math.max(l-1,0))})})]})}),e.jsx(ye,{isOpen:C,onClose:()=>x(!1),onSuccess:()=>{p(),h.success(d("organization.adminAssignedSuccess"))}})]})}const Be=()=>e.jsx(be,{});export{Be as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-By0FINz9.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-By0FINz9.js deleted file mode 100644 index c87b66df6..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-By0FINz9.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as h,az as f,j as a,A as k,H as j,bj as N}from"./index-7T7TTikv.js";import{B as g}from"./badge-D4t6Wb1T.js";import{C as v,a as w,b as z,d as C}from"./card-_ldW-koX.js";import{S as p}from"./separator-BXi_hr72.js";import{a as O}from"./useOrganizations-CPt4mkXS.js";import{u as D}from"./useOrganizationTypes-CQm1BLlI.js";import{B as y}from"./building-BTGMe3qn.js";import{S as A}from"./shield-check-CfyQTFAv.js";import"./organizationsService-DIFVjoLn.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],B=h("map-pin",S),L=({id:d})=>{var x;const l=f(),{organizationsDetailResponse:o,isDetailLoading:u,isDetailError:b}=O("Org",d),{organizationTypesResponse:n}=D();if(u)return a.jsx("div",{children:"Loading..."});if(b||!o)return a.jsx("div",{children:"Error loading organization."});const r=o.items,c=r.organizationTypeId,m=e=>new Date(e).toLocaleString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});return a.jsxs(v,{className:"w-full max-w-3xl mx-auto shadow-xl rounded-2xl border border-gray-200 bg-white dark:bg-zinc-900 transition hover:shadow-2xl",children:[a.jsxs(w,{className:"flex items-center gap-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsx(k,{className:"w-7 h-7 text-primary"}),a.jsx(z,{className:"text-2xl font-bold",children:l(r.name)})]}),a.jsxs(C,{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(g,{variant:r.isGovernmentOrganization?"default":"outline",className:`px-3 py-1 rounded-xl ${r.isGovernmentOrganization?"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-100":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-100"}`,children:r.isGovernmentOrganization?"Government":"Private"}),a.jsx(g,{variant:"default",className:`px-3 py-1 rounded-xl ${r.status==="Active"?"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"}`,children:r.status})]}),a.jsx(p,{className:"my-2"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm text-gray-700 dark:text-gray-300",children:[a.jsxs("div",{className:"order-1",children:[a.jsx("p",{className:"font-semibold",children:"Created At:"}),a.jsx("p",{children:m(r.createdAt)})]}),a.jsxs("div",{className:"order-2",children:[a.jsx("p",{className:"font-semibold",children:"Updated At:"}),a.jsx("p",{children:m(r.updatedAt)})]}),a.jsxs("div",{className:"sm:col-span-2 order-3",children:[a.jsx("p",{className:"font-semibold",children:"Key:"}),a.jsx("p",{className:"break-words",children:r.key})]})]}),a.jsx(p,{className:"my-2"}),a.jsx("div",{className:"flex flex-wrap gap-2 items-center",children:c&&((x=n==null?void 0:n.items)==null?void 0:x.filter(e=>e.id===c).map(e=>{let t,s,i;switch(e.key){case"super_admin":t=A,s="bg-purple-100 dark:bg-purple-800",i="text-purple-800 dark:text-purple-100";break;case"woreda":t=B,s="bg-blue-100 dark:bg-blue-800",i="text-blue-800 dark:text-blue-100";break;case"subcity":t=j,s="bg-primary-100 dark:bg-primary-800",i="text-primary-800 dark:text-primary-100";break;case"office":t=y,s="bg-yellow-100 dark:bg-yellow-800",i="text-yellow-800 dark:text-yellow-100";break;default:t=y,s="bg-gray-100 dark:bg-gray-800",i="text-gray-800 dark:text-gray-100"}return a.jsxs("span",{className:`flex items-center gap-1 px-3 py-1 rounded-xl font-medium ${s} ${i}`,children:[a.jsx(t,{className:"w-4 h-4"}),l(e.name)]},e.id)}))})]})]})},U=()=>{const{id:d}=N();return d?a.jsx(L,{id:d}):a.jsx("div",{className:"text-gray-900 dark:text-gray-100",children:"Organization ID is missing"})};export{U as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-C-bRL7xT.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-C-bRL7xT.js deleted file mode 100644 index 62babee12..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationDetailPage-C-bRL7xT.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as h,az as f,j as a,A as k,H as j,bj as N}from"./index-Db-xuq0b.js";import{B as g}from"./badge-D7JvaQeJ.js";import{C as v,a as w,b as z,d as C}from"./card-BBWyxDss.js";import{S as p}from"./separator-BaOOgzZX.js";import{a as O}from"./useOrganizations-DiuNBweX.js";import{u as D}from"./useOrganizationTypes-B6vCp97C.js";import{B as y}from"./building-B2uZxFCD.js";import{S as A}from"./shield-check-BeHB0C5s.js";import"./organizationsService-BEVk8qa1.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],B=h("map-pin",S),L=({id:d})=>{var x;const l=f(),{organizationsDetailResponse:o,isDetailLoading:u,isDetailError:b}=O("Org",d),{organizationTypesResponse:n}=D();if(u)return a.jsx("div",{children:"Loading..."});if(b||!o)return a.jsx("div",{children:"Error loading organization."});const r=o.items,c=r.organizationTypeId,m=e=>new Date(e).toLocaleString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});return a.jsxs(v,{className:"w-full max-w-3xl mx-auto shadow-xl rounded-2xl border border-gray-200 bg-white dark:bg-zinc-900 transition hover:shadow-2xl",children:[a.jsxs(w,{className:"flex items-center gap-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsx(k,{className:"w-7 h-7 text-primary"}),a.jsx(z,{className:"text-2xl font-bold",children:l(r.name)})]}),a.jsxs(C,{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(g,{variant:r.isGovernmentOrganization?"default":"outline",className:`px-3 py-1 rounded-xl ${r.isGovernmentOrganization?"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-100":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-100"}`,children:r.isGovernmentOrganization?"Government":"Private"}),a.jsx(g,{variant:"default",className:`px-3 py-1 rounded-xl ${r.status==="Active"?"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"}`,children:r.status})]}),a.jsx(p,{className:"my-2"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm text-gray-700 dark:text-gray-300",children:[a.jsxs("div",{className:"order-1",children:[a.jsx("p",{className:"font-semibold",children:"Created At:"}),a.jsx("p",{children:m(r.createdAt)})]}),a.jsxs("div",{className:"order-2",children:[a.jsx("p",{className:"font-semibold",children:"Updated At:"}),a.jsx("p",{children:m(r.updatedAt)})]}),a.jsxs("div",{className:"sm:col-span-2 order-3",children:[a.jsx("p",{className:"font-semibold",children:"Key:"}),a.jsx("p",{className:"break-words",children:r.key})]})]}),a.jsx(p,{className:"my-2"}),a.jsx("div",{className:"flex flex-wrap gap-2 items-center",children:c&&((x=n==null?void 0:n.items)==null?void 0:x.filter(e=>e.id===c)?.map(e=>{let t,s,i;switch(e.key){case"super_admin":t=A,s="bg-purple-100 dark:bg-purple-800",i="text-purple-800 dark:text-purple-100";break;case"woreda":t=B,s="bg-blue-100 dark:bg-blue-800",i="text-blue-800 dark:text-blue-100";break;case"subcity":t=j,s="bg-primary-100 dark:bg-primary-800",i="text-primary-800 dark:text-primary-100";break;case"office":t=y,s="bg-yellow-100 dark:bg-yellow-800",i="text-yellow-800 dark:text-yellow-100";break;default:t=y,s="bg-gray-100 dark:bg-gray-800",i="text-gray-800 dark:text-gray-100"}return a.jsxs("span",{className:`flex items-center gap-1 px-3 py-1 rounded-xl font-medium ${s} ${i}`,children:[a.jsx(t,{className:"w-4 h-4"}),l(e.name)]},e.id)}))})]})]})},U=()=>{const{id:d}=N();return d?a.jsx(L,{id:d}):a.jsx("div",{className:"text-gray-900 dark:text-gray-100",children:"Organization ID is missing"})};export{U as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-BNuDw3k3.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-BNuDw3k3.js deleted file mode 100644 index b7e0ff09e..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-BNuDw3k3.js +++ /dev/null @@ -1 +0,0 @@ -import{f as G,az as L,r as f,j as e,v as r,I as h,B as N}from"./index-7T7TTikv.js";import{S as v,a as k,b as O,c as T,d as n}from"./select--i8koVXg.js";import{C as V,a as q,b as $,c as A,d as P}from"./card-_ldW-koX.js";import{L as t}from"./label-CABYEcfW.js";import{u as B}from"./useOrganizationTypes-CQm1BLlI.js";import{u as K}from"./index.esm-BRNlF2G3.js";import{u as _,o as S,b as H,s as l}from"./zod-D-9d3Txu.js";import{u as U}from"./useOrganizations-CPt4mkXS.js";import{S as J}from"./switch-D9hx8CZw.js";const M=S({name:S({am:l().min(1,"Amharic name is required"),en:l().min(1,"English name is required")}),key:l().min(1,"Key is required"),organizationTypeId:l().min(1,"Organization Type is required"),parentId:l().optional(),isGovernmentOrganization:H()}),se=({onSubmit:C,isLoading:p,type:o,organizationDetails:i})=>{var y,j,b,z;const d="h-10 rounded-md border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",a=K({resolver:_(M),defaultValues:{name:{am:"",en:""},key:"",organizationTypeId:"",parentId:void 0,isGovernmentOrganization:!0}}),I=G(),u=L(),{organizationTypesResponse:m,isLoading:g,isError:w}=B(),{organizationsResponse:c,isLoading:x,isError:E}=U("Org",{take:1e3});return f.useEffect(()=>{const s=a.watch("name.en");if(s){const F=`${s||""}_001`.replace(/\s+/g,"_").toUpperCase();a.setValue("key",F)}},[a.watch("name.en")]),f.useEffect(()=>{i&&a.reset({name:i.name,key:i.key,organizationTypeId:i.organizationTypeId,parentId:i.parentId??void 0,isGovernmentOrganization:i.isGovernmentOrganization??!0})},[i]),e.jsx("div",{className:"px-2 md:px-4",children:e.jsxs(V,{className:"max-w-5xl mx-auto shadow-md border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsxs(q,{className:"border-b border-gray-200 dark:border-gray-700 bg-gray-50/70 dark:bg-gray-900/40",children:[e.jsxs($,{className:"text-xl md:text-2xl font-semibold text-gray-800 dark:text-gray-100",children:[o==="Create"?r("organization.createNew"):r("organization.edit")," ",r("organization.organizations")]}),e.jsx(A,{className:"text-gray-500 dark:text-gray-400",children:r("organization.enterDetails")})]}),e.jsx(P,{className:"p-4 md:p-8",children:e.jsxs("form",{onSubmit:a.handleSubmit(C),className:"space-y-8",children:[e.jsx("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900/30 p-4 md:p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"name.am",children:[r("organization.nameAmharic")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(h,{...a.register("name.am"),className:d}),((y=a.formState.errors.name)==null?void 0:y.am)&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.name.am.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"name.en",children:[r("organization.nameEnglish")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(h,{...a.register("name.en"),className:d}),((j=a.formState.errors.name)==null?void 0:j.en)&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.name.en.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"code",children:[r("organization.key"),e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(h,{...a.register("key"),disabled:o==="Edit",readOnly:o==="Edit",className:d}),a.formState.errors.key&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.key.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"organizationType",children:[r("organization.organizationType")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(v,{value:a.watch("organizationTypeId"),onValueChange:s=>a.setValue("organizationTypeId",s),disabled:g,children:[e.jsx(k,{className:d,children:e.jsx(O,{placeholder:g?r("organization.loading"):r("organization.selectOrganizationType")})}),e.jsx(T,{children:g?e.jsx(n,{value:"loading",disabled:!0,children:r("organization.loadingOrganizationTypes")}):w?e.jsx(n,{value:"error",disabled:!0,children:r("organization.errorLoadingOrganizationTypes")}):(b=m==null?void 0:m.items)!=null&&b.length?m.items.map(s=>e.jsx(n,{value:s.id,children:u(s.name)},s.id)):e.jsx(n,{value:"none",disabled:!0,children:r("organization.noOrganizationTypesAvailable")})})]}),a.formState.errors.organizationTypeId&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.organizationTypeId.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{htmlFor:"organizationType",children:r("organization.parentOrganization")}),e.jsxs(v,{value:a.watch("parentId"),onValueChange:s=>a.setValue("parentId",s),disabled:x,children:[e.jsx(k,{className:d,children:e.jsx(O,{placeholder:x?r("organization.loading"):r("organization.selectOrganization")})}),e.jsx(T,{children:x?e.jsx(n,{value:"loading",disabled:!0,children:"Loading organization types..."}):E?e.jsx(n,{value:"error",disabled:!0,children:"Error loading organization types"}):(z=c==null?void 0:c.items)!=null&&z.length?c.items.map(s=>e.jsx(n,{value:s.id,children:u(s.name)},s.id)):e.jsx(n,{value:"none",disabled:!0,children:r("organization.noOrganization")})})]}),a.formState.errors.organizationTypeId&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.organizationTypeId.message})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2 xl:col-span-1",children:[e.jsx(t,{htmlFor:"isPublic",children:r("organization.isOrganizationPublic")}),e.jsx("div",{className:"h-10 px-3 rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 flex items-center justify-end",children:e.jsx(J,{id:"isPublic",checked:a.watch("isGovernmentOrganization"),onCheckedChange:s=>a.setValue("isGovernmentOrganization",s)})}),a.formState.errors.isGovernmentOrganization&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.isGovernmentOrganization.message})]})]})}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-3 pt-2",children:[e.jsx(N,{variant:"outline",type:"button",onClick:()=>{I(-1)},className:"w-full sm:w-auto",children:r("common.Cancel")}),e.jsx(N,{type:"submit",disabled:p,className:"w-full sm:w-auto bg-primary hover:bg-primary/90 text-primary-foreground",children:p?`${o==="Create"?"Creating":"Editing"}...`:`${o==="Create"?r("common.create"):r("common.Edit")} `})]})]})})]})})};export{se as O}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-Dc20iiRT.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-Dc20iiRT.js deleted file mode 100644 index 7ec468145..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationForm-Dc20iiRT.js +++ /dev/null @@ -1 +0,0 @@ -import{f as G,az as L,r as f,j as e,v as r,I as h,B as N}from"./index-Db-xuq0b.js";import{S as v,a as k,b as O,c as T,d as n}from"./select-BoQxM42A.js";import{C as V,a as q,b as $,c as A,d as P}from"./card-BBWyxDss.js";import{L as t}from"./label-CsFy6wpo.js";import{u as B}from"./useOrganizationTypes-B6vCp97C.js";import{u as K}from"./index.esm-BG4gweZJ.js";import{u as _,o as S,b as H,s as l}from"./zod-Df58YiJ6.js";import{u as U}from"./useOrganizations-DiuNBweX.js";import{S as J}from"./switch-BNCD27Bd.js";const M=S({name:S({am:l().min(1,"Amharic name is required"),en:l().min(1,"English name is required")}),key:l().min(1,"Key is required"),organizationTypeId:l().min(1,"Organization Type is required"),parentId:l().optional(),isGovernmentOrganization:H()}),se=({onSubmit:C,isLoading:p,type:o,organizationDetails:i})=>{var y,j,b,z;const d="h-10 rounded-md border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary",a=K({resolver:_(M),defaultValues:{name:{am:"",en:""},key:"",organizationTypeId:"",parentId:void 0,isGovernmentOrganization:!0}}),I=G(),u=L(),{organizationTypesResponse:m,isLoading:g,isError:w}=B(),{organizationsResponse:c,isLoading:x,isError:E}=U("Org",{take:1e3});return f.useEffect(()=>{const s=a.watch("name.en");if(s){const F=`${s||""}_001`.replace(/\s+/g,"_").toUpperCase();a.setValue("key",F)}},[a.watch("name.en")]),f.useEffect(()=>{i&&a.reset({name:i.name,key:i.key,organizationTypeId:i.organizationTypeId,parentId:i.parentId??void 0,isGovernmentOrganization:i.isGovernmentOrganization??!0})},[i]),e.jsx("div",{className:"px-2 md:px-4",children:e.jsxs(V,{className:"max-w-5xl mx-auto shadow-md border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsxs(q,{className:"border-b border-gray-200 dark:border-gray-700 bg-gray-50/70 dark:bg-gray-900/40",children:[e.jsxs($,{className:"text-xl md:text-2xl font-semibold text-gray-800 dark:text-gray-100",children:[o==="Create"?r("organization.createNew"):r("organization.edit")," ",r("organization.organizations")]}),e.jsx(A,{className:"text-gray-500 dark:text-gray-400",children:r("organization.enterDetails")})]}),e.jsx(P,{className:"p-4 md:p-8",children:e.jsxs("form",{onSubmit:a.handleSubmit(C),className:"space-y-8",children:[e.jsx("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900/30 p-4 md:p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"name.am",children:[r("organization.nameAmharic")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(h,{...a.register("name.am"),className:d}),((y=a.formState.errors.name)==null?void 0:y.am)&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.name.am.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"name.en",children:[r("organization.nameEnglish")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(h,{...a.register("name.en"),className:d}),((j=a.formState.errors.name)==null?void 0:j.en)&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.name.en.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"code",children:[r("organization.key"),e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(h,{...a.register("key"),disabled:o==="Edit",readOnly:o==="Edit",className:d}),a.formState.errors.key&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.key.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(t,{htmlFor:"organizationType",children:[r("organization.organizationType")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(v,{value:a.watch("organizationTypeId"),onValueChange:s=>a.setValue("organizationTypeId",s),disabled:g,children:[e.jsx(k,{className:d,children:e.jsx(O,{placeholder:g?r("organization.loading"):r("organization.selectOrganizationType")})}),e.jsx(T,{children:g?e.jsx(n,{value:"loading",disabled:!0,children:r("organization.loadingOrganizationTypes")}):w?e.jsx(n,{value:"error",disabled:!0,children:r("organization.errorLoadingOrganizationTypes")}):(b=m==null?void 0:m.items)!=null&&b.length?m.items?.map(s=>e.jsx(n,{value:s.id,children:u(s.name)},s.id)):e.jsx(n,{value:"none",disabled:!0,children:r("organization.noOrganizationTypesAvailable")})})]}),a.formState.errors.organizationTypeId&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.organizationTypeId.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{htmlFor:"organizationType",children:r("organization.parentOrganization")}),e.jsxs(v,{value:a.watch("parentId"),onValueChange:s=>a.setValue("parentId",s),disabled:x,children:[e.jsx(k,{className:d,children:e.jsx(O,{placeholder:x?r("organization.loading"):r("organization.selectOrganization")})}),e.jsx(T,{children:x?e.jsx(n,{value:"loading",disabled:!0,children:"Loading organization types..."}):E?e.jsx(n,{value:"error",disabled:!0,children:"Error loading organization types"}):(z=c==null?void 0:c.items)!=null&&z.length?c.items?.map(s=>e.jsx(n,{value:s.id,children:u(s.name)},s.id)):e.jsx(n,{value:"none",disabled:!0,children:r("organization.noOrganization")})})]}),a.formState.errors.organizationTypeId&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.organizationTypeId.message})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2 xl:col-span-1",children:[e.jsx(t,{htmlFor:"isPublic",children:r("organization.isOrganizationPublic")}),e.jsx("div",{className:"h-10 px-3 rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 flex items-center justify-end",children:e.jsx(J,{id:"isPublic",checked:a.watch("isGovernmentOrganization"),onCheckedChange:s=>a.setValue("isGovernmentOrganization",s)})}),a.formState.errors.isGovernmentOrganization&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:a.formState.errors.isGovernmentOrganization.message})]})]})}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-3 pt-2",children:[e.jsx(N,{variant:"outline",type:"button",onClick:()=>{I(-1)},className:"w-full sm:w-auto",children:r("common.Cancel")}),e.jsx(N,{type:"submit",disabled:p,className:"w-full sm:w-auto bg-primary hover:bg-primary/90 text-primary-foreground",children:p?`${o==="Create"?"Creating":"Editing"}...`:`${o==="Create"?r("common.create"):r("common.Edit")} `})]})]})})]})})};export{se as O}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-Cai8R-Dj.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-Cai8R-Dj.js deleted file mode 100644 index 3d13cb152..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-Cai8R-Dj.js +++ /dev/null @@ -1,8 +0,0 @@ -import{y as Ie,ad as Be,K as $,N as L,j as e,bw as Ue,bx as Te,by as $e,bz as Le,bA as Fe,bB as _e,aq as Ge,V as He,bC as Re,ai as Ve,ap as J,W as Ke,X as Ze,_ as We,as as qe,r as x,bD as Qe,aF as le,v as w,b8 as G,az as ye,u as X,k as Je,I as he,B as M,b6 as Xe,t as E,f as Ye,aA as ea,aB as aa,aC as ta,aD as ra,aE as Q,bn as sa,aH as na,aR as ia,bE as oa,aI as la,aJ as da,L as ca}from"./index-Db-xuq0b.js";import{u as be}from"./useOrganizations-DiuNBweX.js";import{A as ma}from"./AdvancedTable-CC9ioMU-.js";import{A as ve,h as je,a as Ne,b as Ce,c as we,d as ke,e as ze,f as Se,g as Oe}from"./alert-dialog-B5Y0wlSz.js";import{S as ua,a as pa,b as ga,c as ha,d as xa}from"./select-BoQxM42A.js";import{a as fa,u as ya,b as ba,c as va,d as ja,e as Na,f as Ca,g as wa,h as ka,i as za,j as Sa}from"./useConfig-B72ZZHmV.js";import{u as Oa}from"./useUnit-C4s9nepK.js";import{R as Aa,a as xe}from"./radio-group-DqG5gUnT.js";import{u as Da}from"./useArchived-D2u5xEKl.js";import{E as Pa}from"./ellipsis-CbtaBcvT.js";import{E as Ea}from"./eye-Bhud4znU.js";import{S as Ma}from"./square-pen-B91TPB19.js";import{B as fe}from"./badge-D7JvaQeJ.js";import{S as Ia}from"./StatusCell-D7zi31G6.js";import{S as Ba}from"./switch-BNCD27Bd.js";import{f as Ua}from"./format-DvwV82px.js";import{U as Ta}from"./users-DNqydOCy.js";import{C as $a,a as La,b as Fa,d as _a}from"./card-BBWyxDss.js";import{L as Ga}from"./loader-mVRAFg0f.js";import{P as Ha}from"./plus-BdjS2Pc-.js";import"./organizationsService-BEVk8qa1.js";import"./table-D3n3VABd.js";import"./chevron-left-DCpEaNzo.js";import"./utils-BncSPdK1.js";import"./command-Cr0tMDDu.js";import"./search-CM5F2ZRy.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./separator-BaOOgzZX.js";import"./refresh-cw-JB7N413f.js";import"./unitService-CmGVtFHQ.js";import"./Radio-C3SNvFel.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-COkNgcEo.js";import"./positionService-JD0NEiGK.js";import"./useOrganizationAdmins-Bl-gbkwr.js";import"./use-toast-CdbbItn1.js";import"./phone-Ce15UUGI.js";import"./Switch-DSHMk-sj.js";import"./en-US-Cc-9gH5A.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ra=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],Va=Ie("delete",Ra),[Ka,H]=Be("Drawer component was not found in tree");var B={root:"m_f11b401e",header:"m_5a7c2c9",content:"m_b8a05bbd",inner:"m_31cd769a"};const Za={},Y=$((a,t)=>{const r=L("DrawerBody",Za,a),{classNames:i,className:l,style:m,styles:d,vars:u,...g}=r,s=H();return e.jsx(Ue,{ref:t,...s.getStyles("body",{classNames:i,style:m,styles:d,className:l}),...g})});Y.classes=B;Y.displayName="@mantine/core/DrawerBody";const Wa={},ee=$((a,t)=>{const r=L("DrawerCloseButton",Wa,a),{classNames:i,className:l,style:m,styles:d,vars:u,...g}=r,s=H();return e.jsx(Te,{ref:t,...s.getStyles("close",{classNames:i,style:m,styles:d,className:l}),...g})});ee.classes=B;ee.displayName="@mantine/core/DrawerCloseButton";const qa={},ae=$((a,t)=>{const r=L("DrawerContent",qa,a),{classNames:i,className:l,style:m,styles:d,vars:u,children:g,radius:s,__hidden:b,...N}=r,o=H(),z=o.scrollAreaComponent||$e;return e.jsx(Le,{...o.getStyles("content",{className:l,style:m,styles:d,classNames:i}),innerProps:o.getStyles("inner",{className:l,style:m,styles:d,classNames:i}),ref:t,...N,radius:s||o.radius||0,"data-hidden":b||void 0,children:e.jsx(z,{style:{height:"calc(100vh - var(--drawer-offset) * 2)"},children:g})})});ae.classes=B;ae.displayName="@mantine/core/DrawerContent";const Qa={},te=$((a,t)=>{const r=L("DrawerHeader",Qa,a),{classNames:i,className:l,style:m,styles:d,vars:u,...g}=r,s=H();return e.jsx(Fe,{ref:t,...s.getStyles("header",{classNames:i,style:m,styles:d,className:l}),...g})});te.classes=B;te.displayName="@mantine/core/DrawerHeader";const Ja={},re=$((a,t)=>{const r=L("DrawerOverlay",Ja,a),{classNames:i,className:l,style:m,styles:d,vars:u,...g}=r,s=H();return e.jsx(_e,{ref:t,...s.getStyles("overlay",{classNames:i,style:m,styles:d,className:l}),...g})});re.classes=B;re.displayName="@mantine/core/DrawerOverlay";function Xa(a){switch(a){case"top":return"flex-start";case"bottom":return"flex-end";default:return}}function Ya(a){if(a==="top"||a==="bottom")return"0 0 calc(100% - var(--drawer-offset, 0rem) * 2)"}const et={top:"slide-down",bottom:"slide-up",left:"slide-right",right:"slide-left"},at={top:"slide-down",bottom:"slide-up",right:"slide-right",left:"slide-left"},tt={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:J("modal"),position:"left"},rt=Ke((a,{position:t,size:r,offset:i})=>({root:{"--drawer-size":We(r,"drawer-size"),"--drawer-flex":Ya(t),"--drawer-height":t==="left"||t==="right"?void 0:"var(--drawer-size)","--drawer-align":Xa(t),"--drawer-justify":t==="right"?"flex-end":void 0,"--drawer-offset":Ze(i)}})),se=$((a,t)=>{const r=L("DrawerRoot",tt,a),{classNames:i,className:l,style:m,styles:d,unstyled:u,vars:g,scrollAreaComponent:s,position:b,transitionProps:N,radius:o,...z}=r,{dir:c}=Ge(),S=He({name:"Drawer",classes:B,props:r,className:l,style:m,classNames:i,styles:d,unstyled:u,vars:g,varsResolver:rt}),A=(c==="rtl"?at:et)[b];return e.jsx(Ka,{value:{scrollAreaComponent:s,getStyles:S,radius:o},children:e.jsx(Re,{ref:t,...S("root"),transitionProps:{transition:A,...N},"data-offset-scrollbars":s===Ve.Autosize||void 0,unstyled:u,...z})})});se.classes=B;se.displayName="@mantine/core/DrawerRoot";const[st,nt]=qe();function Ae({children:a}){const[t,r]=x.useState([]),[i,l]=x.useState(J("modal"));return e.jsx(st,{value:{stack:t,addModal:(m,d)=>{r(u=>[...new Set([...u,m])]),l(u=>typeof d=="number"&&typeof u=="number"?Math.max(u,d):u)},removeModal:m=>r(d=>d.filter(u=>u!==m)),getZIndex:m=>`calc(${i} + ${t.indexOf(m)} + 1)`,currentId:t[t.length-1],maxZIndex:i},children:a})}Ae.displayName="@mantine/core/DrawerStack";const it={},ne=$((a,t)=>{const r=L("DrawerTitle",it,a),{classNames:i,className:l,style:m,styles:d,vars:u,...g}=r,s=H();return e.jsx(Qe,{ref:t,...s.getStyles("title",{classNames:i,style:m,styles:d,className:l}),...g})});ne.classes=B;ne.displayName="@mantine/core/DrawerTitle";const ot={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:J("modal"),withOverlay:!0,withCloseButton:!0},P=$((a,t)=>{const{title:r,withOverlay:i,overlayProps:l,withCloseButton:m,closeButtonProps:d,children:u,opened:g,stackId:s,zIndex:b,...N}=L("Drawer",ot,a),o=nt(),z=!!r||m,c=o&&s?{closeOnEscape:o.currentId===s,trapFocus:o.currentId===s,zIndex:o.getZIndex(s)}:{},S=i===!1?!1:s&&o?o.currentId===s:g;return x.useEffect(()=>{o&&s&&(g?o.addModal(s,b||J("modal")):o.removeModal(s))},[g,s,b]),e.jsxs(se,{ref:t,opened:g,zIndex:o&&s?o.getZIndex(s):b,...N,...c,children:[i&&e.jsx(re,{visible:S,transitionProps:o&&s?{duration:0}:void 0,...l}),e.jsxs(ae,{__hidden:o&&s&&g?s!==o.currentId:!1,children:[z&&e.jsxs(te,{children:[r&&e.jsx(ne,{children:r}),m&&e.jsx(ee,{...d})]}),e.jsx(Y,{children:u})]})]})});P.classes=B;P.displayName="@mantine/core/Drawer";P.Root=se;P.Overlay=re;P.Content=ae;P.Body=Y;P.Header=te;P.Title=ne;P.CloseButton=ee;P.Stack=Ae;const lt=({organizationName:a,isActive:t,onConfirm:r,isLoading:i,trigger:l})=>e.jsxs(ve,{children:[e.jsx(je,{asChild:!0,children:l}),e.jsxs(Ne,{children:[e.jsxs(Ce,{children:[e.jsxs(we,{children:[t?"Deactivate":"Activate"," Organization"]}),e.jsxs(ke,{children:["Are you sure you want to ",t?"deactivate":"activate"," ",e.jsx("span",{className:"font-medium",children:a}),"? This action can be reversed later."]})]}),e.jsxs(ze,{children:[e.jsx(Se,{disabled:i,className:"cursor-pointer",children:"Cancel"}),e.jsxs(Oe,{onClick:r,disabled:i,className:t?"bg-red-600 hover:bg-red-700 cursor-pointer":"",children:[i&&e.jsx(le,{className:"h-4 w-4 animate-spin"}),i?t?"Deactivating...":"Activating...":t?"Deactivate":"Activate"]})]})]})]}),dt=({organizationName:a,onDelete:t,onCancel:r,isLoading:i,trigger:l})=>e.jsxs(ve,{children:[e.jsx(je,{asChild:!0,children:l}),e.jsxs(Ne,{children:[e.jsxs(Ce,{children:[e.jsx(we,{children:w("organization.deleteOrganization")}),e.jsxs(ke,{children:[w("organization.confirmDelete")," ",e.jsx("strong",{children:a}),"? ",w("organization.cannotUndo")]})]}),e.jsxs(ze,{children:[e.jsx(Se,{onClick:r,disabled:i,className:"cursor-pointer",children:w("common.Cancel")}),e.jsx(Oe,{className:"bg-red-600 hover:bg-red-700 text-white cursor-pointer",disabled:i,onClick:t,children:i?w("organization.deleting"):w("organization.delete")})]})]})]}),de=x.createContext({open:!1,setOpen:()=>{}});function ct({children:a,open:t,onOpenChange:r,defaultOpen:i=!1}){const[l,m]=x.useState(i),d=t!==void 0,u=d?t:l,g=x.useCallback(s=>{d||m(s),r==null||r(s)},[d,r]);return e.jsx(de.Provider,{value:{open:u,setOpen:g},children:a})}function mt({children:a,className:t,...r}){const{open:i,setOpen:l}=x.useContext(de);return e.jsx(P,{opened:i,onClose:()=>l(!1),position:"right",size:400,withCloseButton:!0,classNames:{content:G("p-6",t),overlay:"bg-black/50"},...r,children:a})}function ut({className:a,children:t,...r}){return e.jsx("div",{className:G("mb-4",a),...r,children:t})}function pt({className:a,children:t,...r}){return e.jsx("h2",{className:G("text-lg font-semibold",a),...r,children:t})}function gt({className:a,children:t,...r}){return e.jsx("p",{className:G("text-sm text-muted-foreground",a),...r,children:t})}function ht({className:a,children:t,...r}){return e.jsx("div",{className:G("mt-4 flex justify-end gap-2",a),...r,children:t})}function xt({children:a,asChild:t,className:r,...i}){const{setOpen:l}=x.useContext(de);return t&&x.isValidElement(a)?x.cloneElement(a,{onClick:m=>{var d,u;(u=(d=a.props).onClick)==null||u.call(d,m),l(!1)}}):e.jsx("button",{type:"button",className:G("cursor-pointer",r),onClick:()=>l(!1),...i,children:a})}const ft=ct;function yt({manageOrgConfigOpen:a,setManageOrgConfigOpen:t,organizationId:r}){var ce,me,ue,pe;const{getList:i}=Oa(),[l,m]=x.useState(""),[d,u]=x.useState(""),[g,s]=x.useState(""),[b,N]=x.useState(null),{data:o}=r?i(r,{take:300,skip:0}):{data:void 0},z=ye(),{t:c}=X(),{handleError:S}=Je(c),A=fa(r),U=ya(r),[p,T]=x.useState(!1),D=p?A.data:U.data,ie=p?A.isLoading:U.isLoading,I=p?A.refetch:U.refetch,R=ba(),K=va(),V=ja(),Z=Na(),W=Ca(),y=wa(),v=p?R.isPending||K.isPending:Z.isPending||W.isPending,f=p?V:y,h=(()=>{var O,k;const n=((k=(O=U.data)==null?void 0:O.data)==null?void 0:k.items)??[];return Array.isArray(n)?n.find(j=>((j==null?void 0:j.organizationId)??(j==null?void 0:j.organization_id))===r)??n[0]??null:null})(),C=(()=>{var O,k;if(!l)return null;const n=((k=(O=A.data)==null?void 0:O.data)==null?void 0:k.items)??[];return Array.isArray(n)?n.find(j=>((j==null?void 0:j.unitId)??(j==null?void 0:j.unit_id))===l)??null:null})();x.useEffect(()=>{p||h!=null&&h.id&&b!==h.id&&(N(h.id),u((h.maximumNumberOfUnits??0).toString()))},[p,h,b]),x.useEffect(()=>{p&&C!=null&&C.id&&b!==C.id&&(N(C.id),u((C.numberOfSubUnits??0).toString()),s((C.numberOfEmployeesPerUnit??0).toString()))},[p,C,b]);const oe=()=>{if(p&&!l){E.warning(c("superAdmin.messages.selectUnitWarning"));return}if(p?!d||!g:!d){E.warning(c("superAdmin.messages.fillAllFields"));return}if(p){const k={unitId:l,numberOfSubUnits:Number(d),numberOfEmployeesPerUnit:Number(g)},j=b||(C==null?void 0:C.id)||null;j?K.mutate({id:j,data:k},{onSuccess:()=>{E.success(c("superAdmin.messages.configUpdated")),F(),I()},onError:S}):R.mutate(k,{onSuccess:()=>{E.success(c("superAdmin.messages.configAdded")),F(),I()},onError:_=>q(_)});return}const n={organizationId:r,maximumNumberOfUnits:Number(d),...(h==null?void 0:h.canStartReceivingRecord)!==void 0&&{canStartReceivingRecord:h.canStartReceivingRecord},...(h==null?void 0:h.canCreateBranchByItself)!==void 0&&{canCreateBranchByItself:h.canCreateBranchByItself}},O=b||(h==null?void 0:h.id)||null;O?W.mutate({id:O,data:n},{onSuccess:()=>{E.success(c("superAdmin.messages.configUpdated")),F(),I()},onError:S}):Z.mutate(n,{onSuccess:()=>{E.success(c("superAdmin.messages.configAdded")),F(),I()},onError:k=>q(k)})},q=n=>{var j,_,ge;const O=(j=n==null?void 0:n.response)==null?void 0:j.status,k=((ge=(_=n==null?void 0:n.response)==null?void 0:_.data)==null?void 0:ge.message)??(n==null?void 0:n.message)??"";if(O===400&&/duplicate/i.test(k)){E.warning(c("superAdmin.messages.configAlreadyExists")),I();return}S(n)},F=()=>{m(""),u(""),s(""),N(null)},De=n=>{p?(N(n.id),m(n.unitId??""),u((n.numberOfSubUnits??0).toString()),s((n.numberOfEmployeesPerUnit??0).toString())):(N(n.id),u((n.maximumNumberOfUnits??0).toString()))},Pe=n=>{n!=null&&n.id&&f.mutate(n.id,{onSuccess:()=>{E.success(c("superAdmin.messages.configDeleted")),b===n.id&&F(),I()},onError:S})},Ee=c(p?"superAdmin.manageConfig.unit":"superAdmin.manageConfig.organization"),Me=c(p?"superAdmin.manageConfig.unitBased":"superAdmin.manageConfig.organizationLevel");return e.jsx(ft,{open:a,onOpenChange:t,children:e.jsxs(mt,{className:"max-h-[85vh] overflow-hidden flex flex-col top-1/6 bg-white dark:bg-gray-900",children:[e.jsxs("div",{className:"overflow-y-auto flex-1",children:[e.jsxs(ut,{className:"pb-4",children:[e.jsx(pt,{className:"text-lg text-primary-700 dark:text-primary-400",children:c("superAdmin.manageConfig.title",{type:Ee})}),e.jsxs(gt,{className:"text-primary-600/80 dark:text-primary-300/80 space-y-3",children:[e.jsx("div",{children:c("superAdmin.manageConfig.description",{level:Me})}),e.jsxs(Aa,{value:p?"unit":"org",onValueChange:n=>{T(n==="unit"),F()},className:"inline-flex rounded-md bg-gray-100 dark:bg-gray-800 p-1",children:[e.jsx(xe,{value:"org",id:"org-radio",className:"hidden"}),e.jsx("label",{htmlFor:"org-radio",className:`cursor-pointer px-4 py-1 rounded-md text-sm font-medium transition-all - ${p?"text-primary-700 dark:text-primary-300 hover:bg-primary-200 dark:hover:bg-primary-900/30":"bg-primary-600 text-white"}`,children:c("superAdmin.manageConfig.organization")}),e.jsx(xe,{value:"unit",id:"unit-radio",className:"hidden"}),e.jsx("label",{htmlFor:"unit-radio",className:`cursor-pointer px-4 py-1 rounded-md text-sm font-medium transition-all - ${p?"bg-primary-600 text-white":"text-primary-700 dark:text-primary-300 hover:bg-primary-200 dark:hover:bg-primary-900/30"}`,children:c("superAdmin.manageConfig.unit")})]}),p&&((me=(ce=o==null?void 0:o.data)==null?void 0:ce.items)==null?void 0:me.length)>0&&e.jsxs("div",{className:"pt-2",children:[e.jsx("label",{className:"block text-sm font-medium text-primary-700 dark:text-primary-300",children:c("superAdmin.manageConfig.selectUnit")}),e.jsxs(ua,{value:l,onValueChange:n=>m(n),children:[e.jsx(pa,{className:"mt-1 border-primary-400 dark:border-primary-700 dark:bg-gray-800 dark:text-gray-100 focus:ring-primary-500",children:e.jsx(ga,{placeholder:c("superAdmin.manageConfig.selectUnitPlaceholder")})}),e.jsx(ha,{children:o==null?void 0:o.data.items?.map(n=>e.jsx(xa,{value:n.id,children:z(n.name)},n.id))})]})]})]})]}),e.jsxs("div",{className:"px-6 space-y-4 pb-4",children:[e.jsxs("div",{className:`grid gap-4 ${p?"grid-cols-2":"grid-cols-1"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:p?c("superAdmin.manageConfig.subOrganizations"):c("superAdmin.manageConfig.maxUnits","Maximum Number of Units")}),e.jsx(he,{type:"number",min:"0",value:d,onChange:n=>u(n.target.value),placeholder:c("superAdmin.manageConfig.subOrgsPlaceholder"),className:"border-primary-400 dark:border-primary-700 dark:bg-gray-800 dark:text-gray-100 focus:ring-primary-500"})]}),p&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:c("superAdmin.manageConfig.employeesPerOrg")}),e.jsx(he,{type:"number",min:"0",value:g,onChange:n=>s(n.target.value),placeholder:c("superAdmin.manageConfig.employeesPlaceholder"),className:"border-primary-400 dark:border-primary-700 dark:bg-gray-800 dark:text-gray-100 focus:ring-primary-500"})]})]}),e.jsxs(M,{onClick:oe,className:"w-full flex items-center gap-2 bg-primary-600 hover:bg-primary-700 text-white",disabled:v,children:[v&&e.jsx(le,{className:"h-4 w-4 animate-spin"}),b||!p&&(h!=null&&h.id)||p&&(C!=null&&C.id)?c("superAdmin.manageConfig.updateConfiguration"):c("superAdmin.manageConfig.addConfiguration")]}),e.jsx("div",{className:"border border-primary-300 dark:border-primary-800 rounded-lg p-3 space-y-3 mt-4",children:ie?e.jsx("p",{className:"text-sm text-primary-600/70 text-center py-4",children:c("superAdmin.manageConfig.loading")}):(pe=(ue=D==null?void 0:D.data)==null?void 0:ue.items)!=null&&pe.length?e.jsx("div",{className:"max-h-48 overflow-y-auto",children:D.data.items?.map(n=>{var O,k,j;return e.jsxs("div",{className:"flex items-center justify-between border-b border-primary-100 pb-2 last:border-none py-2",children:[e.jsxs("div",{children:[p&&e.jsx("p",{className:"font-semibold capitalize text-primary-700 text-sm",children:z((j=(k=(O=o==null?void 0:o.data)==null?void 0:O.items)==null?void 0:k.find(_=>_.id===n.unitId))==null?void 0:j.name)||n.unitId}),e.jsx("p",{className:"text-xs text-primary-600/80",children:p?e.jsxs(e.Fragment,{children:[n.numberOfSubUnits," ",c("superAdmin.manageConfig.subOrganizations")," •"," ",n.numberOfEmployeesPerUnit," ",c("superAdmin.manageConfig.employeesPerOrg")]}):e.jsxs(e.Fragment,{children:[c("superAdmin.manageConfig.maxUnits","Maximum Number of Units"),": ",n.maximumNumberOfUnits??0]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>De(n),className:"h-8 px-2 text-xs text-primary-700 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/30",children:c("superAdmin.manageConfig.edit")}),e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>Pe(n),disabled:f.isPending&&f.variables===n.id,className:"h-8 w-8 p-0 text-primary-700 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/30",children:f.isPending&&f.variables===n.id?e.jsx(le,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Xe,{size:14})})]})]},n.id)})}):e.jsx("p",{className:"text-sm text-primary-600/70 text-center py-4",children:c("superAdmin.manageConfig.noConfigurations")})})]})]}),e.jsx(ht,{className:"pt-4 border-t border-primary-200 dark:border-primary-800 bg-primary-50/40 dark:bg-primary-900/10",children:e.jsx(xt,{asChild:!0,children:e.jsx(M,{variant:"outline",onClick:F,className:"w-full border-primary-500 dark:border-primary-700 text-primary-700 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/30",children:c("superAdmin.manageConfig.close")})})})]})})}const bt=({rowData:a})=>{const[t,r]=x.useState(!1),{t:i}=X(),l=Ye(),[m,d]=x.useState(!1),{activateOrganization:u,deactivateOrganization:g,isOrganizationActivating:s,isOrganizationDeactivating:b,deleteOrganization:N,isOrganizationDeleting:o}=be("Org"),{softDeleteOrganization:z,isArchivingOrganization:c}=Da(),S=()=>{r(!1),l(`/user-management/organizations/edit/${a==null?void 0:a.id}`)},A=()=>{r(!1),l(`/user-management/organizations/detail/${a==null?void 0:a.id}`)},U=()=>{r(!1),d(!0)},p=a.status==="Active";return e.jsxs("div",{className:"flex gap-3 align-center",children:[e.jsx(lt,{organizationName:a.name.en,isActive:p,onConfirm:()=>{p?g({id:a.id}):u({id:a.id})},isLoading:s||b,trigger:p?e.jsx(M,{variant:"outline",className:p?"text-red-600 dark:text-red-400 border-red-600 dark:border-red-500 hover:bg-red-50 dark:hover:bg-red-900/30":"text-primary-600 dark:text-primary-400 border-primary-600 dark:border-primary-500 hover:bg-primary-50 dark:hover:bg-primary-900/30",children:i("statusBar.deactivate")}):e.jsx(M,{variant:"outline",size:"sm",className:p?"text-red-600 dark:text-red-400 border-red-600 dark:border-red-500 hover:bg-red-50 dark:hover:bg-red-900/30":"text-primary-600 dark:text-primary-400 border-primary-600 dark:border-primary-500 hover:bg-primary-50 dark:hover:bg-primary-900/30",children:i("statusBar.activate")})}),e.jsxs(ea,{open:t,onOpenChange:r,children:[e.jsx(aa,{asChild:!0,children:e.jsxs(M,{variant:"ghost",className:"flex h-8 w-8 p-0 data-[state=open]:bg-muted","aria-haspopup":"menu","aria-expanded":t,children:[e.jsx(Pa,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Open menu"})]})}),e.jsxs(ta,{align:"end",className:"w-[200px]",onInteractOutside:T=>{T.target.closest('[role="dialog"]')||r(!1)},children:[e.jsx(ra,{children:"Actions"}),e.jsxs(Q,{onSelect:A,children:[e.jsx(Ea,{className:"mr-2 h-4 w-4"}),i("organization.viewOrganization")]}),e.jsxs(Q,{onSelect:S,children:[e.jsx(Ma,{className:"mr-2 h-4 w-4"}),i("organization.editOrganization")]}),e.jsxs(Q,{onSelect:U,children:[e.jsx(sa,{className:"mr-2 h-4 w-4"}),i("organization.editOrganization")]}),e.jsxs(Q,{onSelect:()=>{r(!1),z(a.id)},disabled:c,className:"text-amber-700 focus:text-amber-700",children:[e.jsx(na,{className:"mr-2 h-4 w-4"}),i("archive.archiveOrganization","Archive Organization")]}),e.jsx(dt,{organizationName:a.name.en,onDelete:()=>{N({id:a.id})},onCancel:()=>{},isLoading:o,trigger:e.jsxs(M,{variant:"destructive",children:[e.jsx(Va,{className:"mr-2 h-4 w-4"}),i("organization.deleteOrganization")]})})]}),m&&e.jsx(yt,{manageOrgConfigOpen:m,setManageOrgConfigOpen:d,organizationId:a.id,isUnitConfig:!1})]})]})},vt=({organizationId:a})=>{const{t}=X(),[r,i]=x.useState(null),[l,m]=x.useState(!1),[d,u]=x.useState(!0);x.useEffect(()=>{(async()=>{try{u(!0);const o=(await ka(a)).data;if(o.count>0&&o.items&&o.items.length>0){const z=o.items[0];i(z)}else i(null)}catch{i(null)}finally{u(!1)}})()},[a]);const g=async b=>{try{m(!0);const N={canStartReceivingRecord:b,organizationId:a};if(r&&r.id)await za(r.id,N),i(o=>o?{...o,canStartReceivingRecord:b}:null);else{const o=await Sa(N);i(o.data)}E.success(t(b?"organization.visibilityEnabled":"organization.visibilityDisabled"))}catch{E.error(t("organization.visibilityUpdateFailed"))}finally{m(!1)}};if(d)return e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("div",{className:"w-4 h-4 border-2 border-gray-300 dark:border-gray-600 border-t-primary-600 rounded-full animate-spin"})});const s=r?r.canStartReceivingRecord:!0;return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:t(s?"organization.visible":"organization.hidden")}),e.jsx(Ba,{checked:s,onCheckedChange:g,disabled:l,className:"data-[state=checked]:bg-primary-600"})]}),l&&e.jsx("div",{className:"w-4 h-4 border-2 border-gray-300 dark:border-gray-600 border-t-primary-600 rounded-full animate-spin"})]})},jt=[{accessorKey:"name.en",header:()=>w("organization.organizationName"),size:300,minSize:200,maxSize:400,cell:({row:a})=>{const t=a.original;return ia.language,e.jsxs("div",{className:"font-medium",children:[t.parentId&&e.jsx("span",{className:"text-gray-400 dark:text-gray-500 mr-2",children:"└─"}),t.name.am]})}},{accessorKey:"createdAt",header:()=>w("organization.createdOn"),cell:({row:a})=>e.jsx("div",{className:"font-medium",children:Ua(new Date(a.original.createdAt),"MMM dd, yyyy")})},{accessorKey:"activeEmployeeCount",header:()=>w("organization.numberOfUsers"),cell:({row:a})=>e.jsxs("div",{className:"font-medium flex items-center",children:[e.jsx(Ta,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-gray-400"}),a.original.activeEmployeeCount!==void 0?a.original.activeEmployeeCount:"-"]})},{accessorKey:"adminsCount",header:()=>w("organization.assignedAdmin"),cell:({row:a})=>e.jsx(Ia,{id:a.original.id,adminsCount:a.original.adminsCount||0})},{id:"status",header:()=>w("userRecord.Status"),cell:({row:a})=>{const t=a.original;return e.jsx("div",{children:e.jsx(fe,{className:`${t.status==="Active"?"bg-primary-100 text-primary-600 hover:bg-primary-100 dark:bg-primary-900/40 dark:text-primary-300 dark:hover:bg-primary-900/50":"bg-red-100 text-red-600 hover:bg-red-100 dark:bg-red-900/40 dark:text-red-300 dark:hover:bg-red-900/50"} rounded-full px-6 py-1 font-medium`,children:t.status==="Active"?w("statusBar.activate"):w("statusBar.deactivate")})})}},{id:"isGovernmentOrganization",header:()=>w("organization.isGovernmentOrganization"),cell:({row:a})=>{const t=a.original;return e.jsx("div",{children:e.jsx(fe,{className:`${t.isGovernmentOrganization?"bg-blue-600 text-white hover:bg-blue-400":"bg-red-600 text-white hover:bg-red-400"} rounded-full px-6 py-1 font-medium`,children:t.isGovernmentOrganization===!0?w("common.yes"):w("common.no")})})}},{id:"visibility",header:()=>w("organization.visibilityToOthers"),cell:({row:a})=>{const t=a.original;return e.jsx(vt,{organizationId:t.id})}},{id:"Actions",header:()=>w("userRecord.Actions"),cell:({row:a})=>{const t=a.original;return e.jsx(bt,{rowData:t})}}],Nt=a=>{const{permissions:t}=oa();return a?.some(r=>t.includes(r))},Ct=({perms:a,fallback:t=null,children:r})=>Nt(a)?r:t;function wt(){const[a,t]=x.useState(0),[r,i]=x.useState(new Set),[l,m]=x.useState(""),d=10;x.useEffect(()=>{t(0)},[l]);const{t:u}=X(),g=ye(),{organizationsResponse:s,isLoading:b,refetch:N}=be("Org",{take:1e3,skip:0,orderBy:"createdAt",order:"createdAt:Desc"}),o=y=>{t(y)},z=y=>{i(v=>{const f=new Set(v);return f.has(y)?f.delete(y):f.add(y),f})},c=x.useMemo(()=>{const y=new Map;return((s==null?void 0:s.items)||[]).forEach(v=>{y.set(v.id,v)}),y},[s==null?void 0:s.items]),S=y=>{const v=[],f=new Map;return y.forEach(h=>{h.parentId?(f.has(h.parentId)||f.set(h.parentId,[]),f.get(h.parentId).push(h)):v.push(h)}),{root:v,children:f}},A=x.useMemo(()=>(s==null?void 0:s.items)||[],[s==null?void 0:s.items]),{root:U,children:p}=S(A),T=l.trim().toLowerCase(),D=T.length>0,ie=x.useMemo(()=>D?A.filter(y=>{var v,f;return(((v=y.name)==null?void 0:v.en)||"").toLowerCase().includes(T)||(((f=y.name)==null?void 0:f.am)||"").toLowerCase().includes(T)}):[],[A,D,T]),I=D?ie:U,R=a*d,K=R+d,V=I.slice(R,K),Z=x.useMemo(()=>{const y=[];return D?(V.forEach(v=>{const f=v.parentId?c.get(v.parentId):null;y.push({...v,isChild:!!v.parentId,parentName:f?f.name.en:void 0})}),y):(V.forEach(v=>{y.push(v),r.has(v.id)&&(p.get(v.id)||[]).forEach(h=>{y.push({...h,isChild:!0,parentName:v.name.en})})}),y)},[V,p,r,D,c]),W=x.useMemo(()=>jt?.map(y=>"accessorKey"in y&&y.accessorKey==="name.en"?{...y,cell:({row:v})=>{const f=v.original,h=f.isChild||!1,C=f.parentName,oe=p.has(f.id),q=r.has(f.id);return e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[oe&&e.jsx(M,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 flex-shrink-0",onClick:()=>z(f.id),children:q?e.jsx(la,{className:"h-4 w-4"}):e.jsx(da,{className:"h-4 w-4"})}),e.jsxs("div",{className:"font-medium flex items-center gap-2 min-w-0 flex-1 overflow-hidden",children:[h&&e.jsx("span",{className:"text-gray-400 dark:text-gray-500 flex-shrink-0",children:"└─"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate",title:f.name.en,children:g(f.name)}),C&&e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-normal truncate",title:`under ${C}`,children:["(under ",C,")"]})]})]})]})}}:y),[p,r,g]);return b?e.jsx("div",{children:e.jsx(Ga,{})}):e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs($a,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsx(La,{className:"flex flex-row justify-between items-center px-0",children:e.jsx(Fa,{className:"text-xl font-semibold ",children:u("organization.organizations")})}),e.jsx(_a,{className:"px-0",children:e.jsx(ma,{columns:W,data:Z,tableName:"Organizations",toolBarPosition:"right",itemCount:I.length,pageSize:d,onGlobalFilterChange:m,extraToolbar:e.jsx(Ct,{perms:["create:organization","activate:organization"],children:e.jsx(ca,{to:"/user-management/organizations/new",children:e.jsxs(M,{className:"px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(Ha,{className:"w-4 h-4 mr-2"}),u("organization.newOrganization")]})})}),pageIndex:a,onPageChange:o,nextFunction:()=>o(a+1),prevFunction:()=>o(Math.max(a-1,0)),refresh:N})})]})})}const ur=()=>e.jsx(wt,{});export{ur as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-sU-lwO2G.js b/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-sU-lwO2G.js deleted file mode 100644 index 2981b506d..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/OrganizationsPage-sU-lwO2G.js +++ /dev/null @@ -1,8 +0,0 @@ -import{y as Te,ad as $e,K as F,N as _,j as e,bw as Le,bx as Fe,by as _e,bz as Ge,bA as He,bB as Re,aq as Ve,V as Ke,bC as Ze,ai as We,ap as J,W as qe,X as Qe,_ as Je,as as Xe,r as g,bD as Ye,aF as le,v as w,b8 as K,az as be,u as X,k as ea,I as xe,B as M,b6 as aa,t as I,f as ra,aA as ta,aB as sa,aC as na,aD as ia,aE as Q,bn as oa,aH as la,aR as da,bE as ca,aI as ma,aJ as ua,L as pa}from"./index-7T7TTikv.js";import{u as ve}from"./useOrganizations-CPt4mkXS.js";import{A as ga}from"./AdvancedTable-vWyUWUDX.js";import{A as je,h as Ne,a as Ce,b as we,c as ke,d as ze,e as Se,f as Ae,g as Oe}from"./alert-dialog-DwppaTz4.js";import{S as ha,a as xa,b as fa,c as ya,d as ba}from"./select--i8koVXg.js";import{a as va,u as ja,b as Na,c as Ca,d as wa,e as ka,f as za,g as Sa,h as Aa,i as Oa,j as Da}from"./useConfig-DEF3qQqh.js";import{u as Ba}from"./useUnit-CRt6YBLp.js";import{R as Pa,a as fe}from"./radio-group-C9tEhs3a.js";import{S as De}from"./switch-D9hx8CZw.js";import{u as Ea}from"./useArchived-5V0W60Gf.js";import{E as Ia}from"./ellipsis-DBW5EePE.js";import{E as Ma}from"./eye-DYwZYJcQ.js";import{S as Ua}from"./square-pen-Dh1zj83N.js";import{B as ye}from"./badge-D4t6Wb1T.js";import{S as Ta}from"./StatusCell-BAmClBhM.js";import{f as $a}from"./format-DvwV82px.js";import{U as La}from"./users-bn5-xqQf.js";import{C as Fa,a as _a,b as Ga,d as Ha}from"./card-_ldW-koX.js";import{L as Ra}from"./loader-CLp1W4Fa.js";import{P as Va}from"./plus-CC3ol2sL.js";import"./organizationsService-DIFVjoLn.js";import"./table-D_B7hhqb.js";import"./chevron-left-G_a9-f9o.js";import"./utils-N2wtfq7C.js";import"./command-B6S1IvD4.js";import"./search-y8VSu0lZ.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./separator-BXi_hr72.js";import"./refresh-cw-B7fipPS4.js";import"./unitService-DTtkt-Pb.js";import"./Radio-D43EoWlg.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-B16dMH0P.js";import"./Switch-ByfhjkDo.js";import"./positionService-BwPU5sNe.js";import"./useOrganizationAdmins-a9snXrfR.js";import"./use-toast-mIxmYSs4.js";import"./phone-w_VmAt3l.js";import"./en-US-Cc-9gH5A.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ka=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],Za=Te("delete",Ka),[Wa,Z]=$e("Drawer component was not found in tree");var T={root:"m_f11b401e",header:"m_5a7c2c9",content:"m_b8a05bbd",inner:"m_31cd769a"};const qa={},Y=F((a,r)=>{const t=_("DrawerBody",qa,a),{classNames:i,className:l,style:m,styles:d,vars:u,...h}=t,n=Z();return e.jsx(Le,{ref:r,...n.getStyles("body",{classNames:i,style:m,styles:d,className:l}),...h})});Y.classes=T;Y.displayName="@mantine/core/DrawerBody";const Qa={},ee=F((a,r)=>{const t=_("DrawerCloseButton",Qa,a),{classNames:i,className:l,style:m,styles:d,vars:u,...h}=t,n=Z();return e.jsx(Fe,{ref:r,...n.getStyles("close",{classNames:i,style:m,styles:d,className:l}),...h})});ee.classes=T;ee.displayName="@mantine/core/DrawerCloseButton";const Ja={},ae=F((a,r)=>{const t=_("DrawerContent",Ja,a),{classNames:i,className:l,style:m,styles:d,vars:u,children:h,radius:n,__hidden:N,...j}=t,o=Z(),k=o.scrollAreaComponent||_e;return e.jsx(Ge,{...o.getStyles("content",{className:l,style:m,styles:d,classNames:i}),innerProps:o.getStyles("inner",{className:l,style:m,styles:d,classNames:i}),ref:r,...j,radius:n||o.radius||0,"data-hidden":N||void 0,children:e.jsx(k,{style:{height:"calc(100vh - var(--drawer-offset) * 2)"},children:h})})});ae.classes=T;ae.displayName="@mantine/core/DrawerContent";const Xa={},re=F((a,r)=>{const t=_("DrawerHeader",Xa,a),{classNames:i,className:l,style:m,styles:d,vars:u,...h}=t,n=Z();return e.jsx(He,{ref:r,...n.getStyles("header",{classNames:i,style:m,styles:d,className:l}),...h})});re.classes=T;re.displayName="@mantine/core/DrawerHeader";const Ya={},te=F((a,r)=>{const t=_("DrawerOverlay",Ya,a),{classNames:i,className:l,style:m,styles:d,vars:u,...h}=t,n=Z();return e.jsx(Re,{ref:r,...n.getStyles("overlay",{classNames:i,style:m,styles:d,className:l}),...h})});te.classes=T;te.displayName="@mantine/core/DrawerOverlay";function er(a){switch(a){case"top":return"flex-start";case"bottom":return"flex-end";default:return}}function ar(a){if(a==="top"||a==="bottom")return"0 0 calc(100% - var(--drawer-offset, 0rem) * 2)"}const rr={top:"slide-down",bottom:"slide-up",left:"slide-right",right:"slide-left"},tr={top:"slide-down",bottom:"slide-up",right:"slide-right",left:"slide-left"},sr={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:J("modal"),position:"left"},nr=qe((a,{position:r,size:t,offset:i})=>({root:{"--drawer-size":Je(t,"drawer-size"),"--drawer-flex":ar(r),"--drawer-height":r==="left"||r==="right"?void 0:"var(--drawer-size)","--drawer-align":er(r),"--drawer-justify":r==="right"?"flex-end":void 0,"--drawer-offset":Qe(i)}})),se=F((a,r)=>{const t=_("DrawerRoot",sr,a),{classNames:i,className:l,style:m,styles:d,unstyled:u,vars:h,scrollAreaComponent:n,position:N,transitionProps:j,radius:o,...k}=t,{dir:C}=Ve(),B=Ke({name:"Drawer",classes:T,props:t,className:l,style:m,classNames:i,styles:d,unstyled:u,vars:h,varsResolver:nr}),c=(C==="rtl"?tr:rr)[N];return e.jsx(Wa,{value:{scrollAreaComponent:n,getStyles:B,radius:o},children:e.jsx(Ze,{ref:r,...B("root"),transitionProps:{transition:c,...j},"data-offset-scrollbars":n===We.Autosize||void 0,unstyled:u,...k})})});se.classes=T;se.displayName="@mantine/core/DrawerRoot";const[ir,or]=Xe();function Be({children:a}){const[r,t]=g.useState([]),[i,l]=g.useState(J("modal"));return e.jsx(ir,{value:{stack:r,addModal:(m,d)=>{t(u=>[...new Set([...u,m])]),l(u=>typeof d=="number"&&typeof u=="number"?Math.max(u,d):u)},removeModal:m=>t(d=>d.filter(u=>u!==m)),getZIndex:m=>`calc(${i} + ${r.indexOf(m)} + 1)`,currentId:r[r.length-1],maxZIndex:i},children:a})}Be.displayName="@mantine/core/DrawerStack";const lr={},ne=F((a,r)=>{const t=_("DrawerTitle",lr,a),{classNames:i,className:l,style:m,styles:d,vars:u,...h}=t,n=Z();return e.jsx(Ye,{ref:r,...n.getStyles("title",{classNames:i,style:m,styles:d,className:l}),...h})});ne.classes=T;ne.displayName="@mantine/core/DrawerTitle";const dr={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:J("modal"),withOverlay:!0,withCloseButton:!0},E=F((a,r)=>{const{title:t,withOverlay:i,overlayProps:l,withCloseButton:m,closeButtonProps:d,children:u,opened:h,stackId:n,zIndex:N,...j}=_("Drawer",dr,a),o=or(),k=!!t||m,C=o&&n?{closeOnEscape:o.currentId===n,trapFocus:o.currentId===n,zIndex:o.getZIndex(n)}:{},B=i===!1?!1:n&&o?o.currentId===n:h;return g.useEffect(()=>{o&&n&&(h?o.addModal(n,N||J("modal")):o.removeModal(n))},[h,n,N]),e.jsxs(se,{ref:r,opened:h,zIndex:o&&n?o.getZIndex(n):N,...j,...C,children:[i&&e.jsx(te,{visible:B,transitionProps:o&&n?{duration:0}:void 0,...l}),e.jsxs(ae,{__hidden:o&&n&&h?n!==o.currentId:!1,children:[k&&e.jsxs(re,{children:[t&&e.jsx(ne,{children:t}),m&&e.jsx(ee,{...d})]}),e.jsx(Y,{children:u})]})]})});E.classes=T;E.displayName="@mantine/core/Drawer";E.Root=se;E.Overlay=te;E.Content=ae;E.Body=Y;E.Header=re;E.Title=ne;E.CloseButton=ee;E.Stack=Be;const cr=({organizationName:a,isActive:r,onConfirm:t,isLoading:i,trigger:l})=>e.jsxs(je,{children:[e.jsx(Ne,{asChild:!0,children:l}),e.jsxs(Ce,{children:[e.jsxs(we,{children:[e.jsxs(ke,{children:[r?"Deactivate":"Activate"," Organization"]}),e.jsxs(ze,{children:["Are you sure you want to ",r?"deactivate":"activate"," ",e.jsx("span",{className:"font-medium",children:a}),"? This action can be reversed later."]})]}),e.jsxs(Se,{children:[e.jsx(Ae,{disabled:i,className:"cursor-pointer",children:"Cancel"}),e.jsxs(Oe,{onClick:t,disabled:i,className:r?"bg-red-600 hover:bg-red-700 cursor-pointer":"",children:[i&&e.jsx(le,{className:"h-4 w-4 animate-spin"}),i?r?"Deactivating...":"Activating...":r?"Deactivate":"Activate"]})]})]})]}),mr=({organizationName:a,onDelete:r,onCancel:t,isLoading:i,trigger:l})=>e.jsxs(je,{children:[e.jsx(Ne,{asChild:!0,children:l}),e.jsxs(Ce,{children:[e.jsxs(we,{children:[e.jsx(ke,{children:w("organization.deleteOrganization")}),e.jsxs(ze,{children:[w("organization.confirmDelete")," ",e.jsx("strong",{children:a}),"? ",w("organization.cannotUndo")]})]}),e.jsxs(Se,{children:[e.jsx(Ae,{onClick:t,disabled:i,className:"cursor-pointer",children:w("common.Cancel")}),e.jsx(Oe,{className:"bg-red-600 hover:bg-red-700 text-white cursor-pointer",disabled:i,onClick:r,children:i?w("organization.deleting"):w("organization.delete")})]})]})]}),de=g.createContext({open:!1,setOpen:()=>{}});function ur({children:a,open:r,onOpenChange:t,defaultOpen:i=!1}){const[l,m]=g.useState(i),d=r!==void 0,u=d?r:l,h=g.useCallback(n=>{d||m(n),t==null||t(n)},[d,t]);return e.jsx(de.Provider,{value:{open:u,setOpen:h},children:a})}function pr({children:a,className:r,...t}){const{open:i,setOpen:l}=g.useContext(de);return e.jsx(E,{opened:i,onClose:()=>l(!1),position:"right",size:400,withCloseButton:!0,classNames:{content:K("p-6",r),overlay:"bg-black/50"},...t,children:a})}function gr({className:a,children:r,...t}){return e.jsx("div",{className:K("mb-4",a),...t,children:r})}function hr({className:a,children:r,...t}){return e.jsx("h2",{className:K("text-lg font-semibold",a),...t,children:r})}function xr({className:a,children:r,...t}){return e.jsx("p",{className:K("text-sm text-muted-foreground",a),...t,children:r})}function fr({className:a,children:r,...t}){return e.jsx("div",{className:K("mt-4 flex justify-end gap-2",a),...t,children:r})}function yr({children:a,asChild:r,className:t,...i}){const{setOpen:l}=g.useContext(de);return r&&g.isValidElement(a)?g.cloneElement(a,{onClick:m=>{var d,u;(u=(d=a.props).onClick)==null||u.call(d,m),l(!1)}}):e.jsx("button",{type:"button",className:K("cursor-pointer",t),onClick:()=>l(!1),...i,children:a})}const br=ur;function vr({manageOrgConfigOpen:a,setManageOrgConfigOpen:r,organizationId:t}){var me,ue,pe,ge;const{getList:i}=Ba(),[l,m]=g.useState(""),[d,u]=g.useState(""),[h,n]=g.useState(""),[N,j]=g.useState(!1),[o,k]=g.useState(null),{data:C}=t?i(t,{take:300,skip:0}):{data:void 0},B=be(),{t:c}=X(),{handleError:$}=ea(c),S=va(t),P=ja(t),[p,ie]=g.useState(!1),G=p?S.data:P.data,W=p?S.isLoading:P.isLoading,L=p?S.refetch:P.refetch,R=Na(),q=Ca(),oe=wa(),x=ka(),y=za(),f=Sa(),O=p?R.isPending||q.isPending:x.isPending||y.isPending,U=p?oe:f,b=(()=>{var D,A;const s=((A=(D=P.data)==null?void 0:D.data)==null?void 0:A.items)??[];return Array.isArray(s)?s.find(v=>((v==null?void 0:v.organizationId)??(v==null?void 0:v.organization_id))===t)??s[0]??null:null})(),z=(()=>{var D,A;if(!l)return null;const s=((A=(D=S.data)==null?void 0:D.data)==null?void 0:A.items)??[];return Array.isArray(s)?s.find(v=>((v==null?void 0:v.unitId)??(v==null?void 0:v.unit_id))===l)??null:null})();g.useEffect(()=>{p||(b!=null&&b.id&&o!==b.id?(k(b.id),u((b.maximumNumberOfUnits??0).toString()),j(!!b.canCreateBranchByItself)):b||j(!1))},[p,b,o]),g.useEffect(()=>{p&&z!=null&&z.id&&o!==z.id&&(k(z.id),u((z.numberOfSubUnits??0).toString()),n((z.numberOfEmployeesPerUnit??0).toString()))},[p,z,o]);const Pe=()=>{if(p&&!l){I.warning(c("superAdmin.messages.selectUnitWarning"));return}if(p?!d||!h:!d){I.warning(c("superAdmin.messages.fillAllFields"));return}if(p){const A={unitId:l,numberOfSubUnits:Number(d),numberOfEmployeesPerUnit:Number(h)},v=o||(z==null?void 0:z.id)||null;v?q.mutate({id:v,data:A},{onSuccess:()=>{I.success(c("superAdmin.messages.configUpdated")),H(),L()},onError:$}):R.mutate(A,{onSuccess:()=>{I.success(c("superAdmin.messages.configAdded")),H(),L()},onError:V=>ce(V)});return}const s={organizationId:t,maximumNumberOfUnits:Number(d),canCreateBranchByItself:N,...(b==null?void 0:b.canStartReceivingRecord)!==void 0&&{canStartReceivingRecord:b.canStartReceivingRecord}},D=o||(b==null?void 0:b.id)||null;D?y.mutate({id:D,data:s},{onSuccess:()=>{I.success(c("superAdmin.messages.configUpdated")),H(),L()},onError:$}):x.mutate(s,{onSuccess:()=>{I.success(c("superAdmin.messages.configAdded")),H(),L()},onError:A=>ce(A)})},ce=s=>{var v,V,he;const D=(v=s==null?void 0:s.response)==null?void 0:v.status,A=((he=(V=s==null?void 0:s.response)==null?void 0:V.data)==null?void 0:he.message)??(s==null?void 0:s.message)??"";if(D===400&&/duplicate/i.test(A)){I.warning(c("superAdmin.messages.configAlreadyExists")),L();return}$(s)},H=()=>{m(""),u(""),n(""),j(!!(b!=null&&b.canCreateBranchByItself)),k(null)},Ee=s=>{p?(k(s.id),m(s.unitId??""),u((s.numberOfSubUnits??0).toString()),n((s.numberOfEmployeesPerUnit??0).toString())):(k(s.id),u((s.maximumNumberOfUnits??0).toString()),j(!!s.canCreateBranchByItself))},Ie=s=>{s!=null&&s.id&&U.mutate(s.id,{onSuccess:()=>{I.success(c("superAdmin.messages.configDeleted")),o===s.id&&H(),L()},onError:$})},Me=c(p?"superAdmin.manageConfig.unit":"superAdmin.manageConfig.organization"),Ue=c(p?"superAdmin.manageConfig.unitBased":"superAdmin.manageConfig.organizationLevel");return e.jsx(br,{open:a,onOpenChange:r,children:e.jsxs(pr,{className:"max-h-[85vh] overflow-hidden flex flex-col top-1/6 bg-white dark:bg-gray-900",children:[e.jsxs("div",{className:"overflow-y-auto flex-1",children:[e.jsxs(gr,{className:"pb-4",children:[e.jsx(hr,{className:"text-lg text-primary-700 dark:text-primary-400",children:c("superAdmin.manageConfig.title",{type:Me})}),e.jsxs(xr,{className:"text-primary-600/80 dark:text-primary-300/80 space-y-3",children:[e.jsx("div",{children:c("superAdmin.manageConfig.description",{level:Ue})}),e.jsxs(Pa,{value:p?"unit":"org",onValueChange:s=>{ie(s==="unit"),H()},className:"inline-flex rounded-md bg-gray-100 dark:bg-gray-800 p-1",children:[e.jsx(fe,{value:"org",id:"org-radio",className:"hidden"}),e.jsx("label",{htmlFor:"org-radio",className:`cursor-pointer px-4 py-1 rounded-md text-sm font-medium transition-all - ${p?"text-primary-700 dark:text-primary-300 hover:bg-primary-200 dark:hover:bg-primary-900/30":"bg-primary-600 text-white"}`,children:c("superAdmin.manageConfig.organization")}),e.jsx(fe,{value:"unit",id:"unit-radio",className:"hidden"}),e.jsx("label",{htmlFor:"unit-radio",className:`cursor-pointer px-4 py-1 rounded-md text-sm font-medium transition-all - ${p?"bg-primary-600 text-white":"text-primary-700 dark:text-primary-300 hover:bg-primary-200 dark:hover:bg-primary-900/30"}`,children:c("superAdmin.manageConfig.unit")})]}),p&&((ue=(me=C==null?void 0:C.data)==null?void 0:me.items)==null?void 0:ue.length)>0&&e.jsxs("div",{className:"pt-2",children:[e.jsx("label",{className:"block text-sm font-medium text-primary-700 dark:text-primary-300",children:c("superAdmin.manageConfig.selectUnit")}),e.jsxs(ha,{value:l,onValueChange:s=>m(s),children:[e.jsx(xa,{className:"mt-1 border-primary-400 dark:border-primary-700 dark:bg-gray-800 dark:text-gray-100 focus:ring-primary-500",children:e.jsx(fa,{placeholder:c("superAdmin.manageConfig.selectUnitPlaceholder")})}),e.jsx(ya,{children:C==null?void 0:C.data.items.map(s=>e.jsx(ba,{value:s.id,children:B(s.name)},s.id))})]})]})]})]}),e.jsxs("div",{className:"px-6 space-y-4 pb-4",children:[e.jsxs("div",{className:`grid gap-4 ${p?"grid-cols-2":"grid-cols-1"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:p?c("superAdmin.manageConfig.subOrganizations"):c("superAdmin.manageConfig.maxUnits","Maximum Number of Units")}),e.jsx(xe,{type:"number",min:"0",value:d,onChange:s=>u(s.target.value),placeholder:c("superAdmin.manageConfig.subOrgsPlaceholder"),className:"border-primary-400 dark:border-primary-700 dark:bg-gray-800 dark:text-gray-100 focus:ring-primary-500"})]}),p&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:c("superAdmin.manageConfig.employeesPerOrg")}),e.jsx(xe,{type:"number",min:"0",value:h,onChange:s=>n(s.target.value),placeholder:c("superAdmin.manageConfig.employeesPlaceholder"),className:"border-primary-400 dark:border-primary-700 dark:bg-gray-800 dark:text-gray-100 focus:ring-primary-500"})]})]}),!p&&e.jsx("div",{className:"rounded-lg border border-primary-200 dark:border-primary-800 bg-primary-50/40 dark:bg-primary-900/10 p-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:"Allow organization to create branches"}),e.jsx("p",{className:"text-xs text-primary-600/80 dark:text-primary-300/80",children:"Enable this if the organization should be allowed to create branches by itself."})]}),e.jsx(De,{checked:N,onCheckedChange:j})]})}),e.jsxs(M,{onClick:Pe,className:"w-full flex items-center gap-2 bg-primary-600 hover:bg-primary-700 text-white",disabled:O,children:[O&&e.jsx(le,{className:"h-4 w-4 animate-spin"}),o||!p&&(b!=null&&b.id)||p&&(z!=null&&z.id)?c("superAdmin.manageConfig.updateConfiguration"):c("superAdmin.manageConfig.addConfiguration")]}),e.jsx("div",{className:"border border-primary-300 dark:border-primary-800 rounded-lg p-3 space-y-3 mt-4",children:W?e.jsx("p",{className:"text-sm text-primary-600/70 text-center py-4",children:c("superAdmin.manageConfig.loading")}):(ge=(pe=G==null?void 0:G.data)==null?void 0:pe.items)!=null&&ge.length?e.jsx("div",{className:"max-h-48 overflow-y-auto",children:G.data.items.map(s=>{var D,A,v;return e.jsxs("div",{className:"flex items-center justify-between border-b border-primary-100 pb-2 last:border-none py-2",children:[e.jsxs("div",{children:[p&&e.jsx("p",{className:"font-semibold capitalize text-primary-700 text-sm",children:B((v=(A=(D=C==null?void 0:C.data)==null?void 0:D.items)==null?void 0:A.find(V=>V.id===s.unitId))==null?void 0:v.name)||s.unitId}),e.jsx("p",{className:"text-xs text-primary-600/80",children:p?e.jsxs(e.Fragment,{children:[s.numberOfSubUnits," ",c("superAdmin.manageConfig.subOrganizations")," •"," ",s.numberOfEmployeesPerUnit," ",c("superAdmin.manageConfig.employeesPerOrg")]}):e.jsxs(e.Fragment,{children:[c("superAdmin.manageConfig.maxUnits","Maximum Number of Units"),": ",s.maximumNumberOfUnits??0," • ","Branch creation:"," ",s.canCreateBranchByItself?"Allowed":"Not allowed"]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>Ee(s),className:"h-8 px-2 text-xs text-primary-700 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/30",children:c("superAdmin.manageConfig.edit")}),e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>Ie(s),disabled:U.isPending&&U.variables===s.id,className:"h-8 w-8 p-0 text-primary-700 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/30",children:U.isPending&&U.variables===s.id?e.jsx(le,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(aa,{size:14})})]})]},s.id)})}):e.jsx("p",{className:"text-sm text-primary-600/70 text-center py-4",children:c("superAdmin.manageConfig.noConfigurations")})})]})]}),e.jsx(fr,{className:"pt-4 border-t border-primary-200 dark:border-primary-800 bg-primary-50/40 dark:bg-primary-900/10",children:e.jsx(yr,{asChild:!0,children:e.jsx(M,{variant:"outline",onClick:H,className:"w-full border-primary-500 dark:border-primary-700 text-primary-700 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/30",children:c("superAdmin.manageConfig.close")})})})]})})}const jr=({rowData:a})=>{const[r,t]=g.useState(!1),{t:i}=X(),l=ra(),[m,d]=g.useState(!1),{activateOrganization:u,deactivateOrganization:h,isOrganizationActivating:n,isOrganizationDeactivating:N,deleteOrganization:j,isOrganizationDeleting:o}=ve("Org"),{softDeleteOrganization:k,isArchivingOrganization:C}=Ea(),B=()=>{t(!1),l(`/user-management/organizations/edit/${a==null?void 0:a.id}`)},c=()=>{t(!1),l(`/user-management/organizations/detail/${a==null?void 0:a.id}`)},$=()=>{t(!1),d(!0)},S=a.status==="Active";return e.jsxs("div",{className:"flex gap-3 align-center",children:[e.jsx(cr,{organizationName:a.name.en,isActive:S,onConfirm:()=>{S?h({id:a.id}):u({id:a.id})},isLoading:n||N,trigger:S?e.jsx(M,{variant:"outline",className:S?"text-red-600 dark:text-red-400 border-red-600 dark:border-red-500 hover:bg-red-50 dark:hover:bg-red-900/30":"text-primary-600 dark:text-primary-400 border-primary-600 dark:border-primary-500 hover:bg-primary-50 dark:hover:bg-primary-900/30",children:i("statusBar.deactivate")}):e.jsx(M,{variant:"outline",size:"sm",className:S?"text-red-600 dark:text-red-400 border-red-600 dark:border-red-500 hover:bg-red-50 dark:hover:bg-red-900/30":"text-primary-600 dark:text-primary-400 border-primary-600 dark:border-primary-500 hover:bg-primary-50 dark:hover:bg-primary-900/30",children:i("statusBar.activate")})}),e.jsxs(ta,{open:r,onOpenChange:t,children:[e.jsx(sa,{asChild:!0,children:e.jsxs(M,{variant:"ghost",className:"flex h-8 w-8 p-0 data-[state=open]:bg-muted","aria-haspopup":"menu","aria-expanded":r,children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Open menu"})]})}),e.jsxs(na,{align:"end",className:"w-[200px]",onInteractOutside:P=>{P.target.closest('[role="dialog"]')||t(!1)},children:[e.jsx(ia,{children:"Actions"}),e.jsxs(Q,{onSelect:c,children:[e.jsx(Ma,{className:"mr-2 h-4 w-4"}),i("organization.viewOrganization")]}),e.jsxs(Q,{onSelect:B,children:[e.jsx(Ua,{className:"mr-2 h-4 w-4"}),i("organization.editOrganization")]}),e.jsxs(Q,{onSelect:$,children:[e.jsx(oa,{className:"mr-2 h-4 w-4"}),i("organization.editOrganization")]}),e.jsxs(Q,{onSelect:()=>{t(!1),k(a.id)},disabled:C,className:"text-amber-700 focus:text-amber-700",children:[e.jsx(la,{className:"mr-2 h-4 w-4"}),i("archive.archiveOrganization","Archive Organization")]}),e.jsx(mr,{organizationName:a.name.en,onDelete:()=>{j({id:a.id})},onCancel:()=>{},isLoading:o,trigger:e.jsxs(M,{variant:"destructive",children:[e.jsx(Za,{className:"mr-2 h-4 w-4"}),i("organization.deleteOrganization")]})})]}),m&&e.jsx(vr,{manageOrgConfigOpen:m,setManageOrgConfigOpen:d,organizationId:a.id,isUnitConfig:!1})]})]})},Nr=({organizationId:a})=>{const{t:r}=X(),[t,i]=g.useState(null),[l,m]=g.useState(!1),[d,u]=g.useState(!0);g.useEffect(()=>{(async()=>{try{u(!0);const o=(await Aa(a)).data;if(o.count>0&&o.items&&o.items.length>0){const k=o.items[0];i(k)}else i(null)}catch{i(null)}finally{u(!1)}})()},[a]);const h=async N=>{try{m(!0);const j={canStartReceivingRecord:N,organizationId:a};if(t&&t.id)await Oa(t.id,j),i(o=>o?{...o,canStartReceivingRecord:N}:null);else{const o=await Da(j);i(o.data)}I.success(r(N?"organization.visibilityEnabled":"organization.visibilityDisabled"))}catch{I.error(r("organization.visibilityUpdateFailed"))}finally{m(!1)}};if(d)return e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("div",{className:"w-4 h-4 border-2 border-gray-300 dark:border-gray-600 border-t-primary-600 rounded-full animate-spin"})});const n=t?t.canStartReceivingRecord:!0;return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:r(n?"organization.visible":"organization.hidden")}),e.jsx(De,{checked:n,onCheckedChange:h,disabled:l,className:"data-[state=checked]:bg-primary-600"})]}),l&&e.jsx("div",{className:"w-4 h-4 border-2 border-gray-300 dark:border-gray-600 border-t-primary-600 rounded-full animate-spin"})]})},Cr=[{accessorKey:"name.en",header:()=>w("organization.organizationName"),size:300,minSize:200,maxSize:400,cell:({row:a})=>{const r=a.original;return da.language,e.jsxs("div",{className:"font-medium",children:[r.parentId&&e.jsx("span",{className:"text-gray-400 dark:text-gray-500 mr-2",children:"└─"}),r.name.am]})}},{accessorKey:"createdAt",header:()=>w("organization.createdOn"),cell:({row:a})=>e.jsx("div",{className:"font-medium",children:$a(new Date(a.original.createdAt),"MMM dd, yyyy")})},{accessorKey:"activeEmployeeCount",header:()=>w("organization.numberOfUsers"),cell:({row:a})=>e.jsxs("div",{className:"font-medium flex items-center",children:[e.jsx(La,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-gray-400"}),a.original.activeEmployeeCount!==void 0?a.original.activeEmployeeCount:"-"]})},{accessorKey:"adminsCount",header:()=>w("organization.assignedAdmin"),cell:({row:a})=>e.jsx(Ta,{id:a.original.id,adminsCount:a.original.adminsCount||0})},{id:"status",header:()=>w("userRecord.Status"),cell:({row:a})=>{const r=a.original;return e.jsx("div",{children:e.jsx(ye,{className:`${r.status==="Active"?"bg-primary-100 text-primary-600 hover:bg-primary-100 dark:bg-primary-900/40 dark:text-primary-300 dark:hover:bg-primary-900/50":"bg-red-100 text-red-600 hover:bg-red-100 dark:bg-red-900/40 dark:text-red-300 dark:hover:bg-red-900/50"} rounded-full px-6 py-1 font-medium`,children:r.status==="Active"?w("statusBar.activate"):w("statusBar.deactivate")})})}},{id:"isGovernmentOrganization",header:()=>w("organization.isGovernmentOrganization"),cell:({row:a})=>{const r=a.original;return e.jsx("div",{children:e.jsx(ye,{className:`${r.isGovernmentOrganization?"bg-blue-600 text-white hover:bg-blue-400":"bg-red-600 text-white hover:bg-red-400"} rounded-full px-6 py-1 font-medium`,children:r.isGovernmentOrganization===!0?w("common.yes"):w("common.no")})})}},{id:"visibility",header:()=>w("organization.visibilityToOthers"),cell:({row:a})=>{const r=a.original;return e.jsx(Nr,{organizationId:r.id})}},{id:"Actions",header:()=>w("userRecord.Actions"),cell:({row:a})=>{const r=a.original;return e.jsx(jr,{rowData:r})}}],wr=a=>{const{permissions:r}=ca();return a.some(t=>r.includes(t))},kr=({perms:a,fallback:r=null,children:t})=>wr(a)?t:r;function zr(){const[a,r]=g.useState(0),[t,i]=g.useState(new Set),[l,m]=g.useState(""),d=10;g.useEffect(()=>{r(0)},[l]);const{t:u}=X(),h=be(),{organizationsResponse:n,isLoading:N,refetch:j}=ve("Org",{take:1e3,skip:0,orderBy:"createdAt",order:"createdAt:Desc"}),o=x=>{r(x)},k=x=>{i(y=>{const f=new Set(y);return f.has(x)?f.delete(x):f.add(x),f})},C=g.useMemo(()=>{const x=new Map;return((n==null?void 0:n.items)||[]).forEach(y=>{x.set(y.id,y)}),x},[n==null?void 0:n.items]),B=x=>{const y=[],f=new Map;return x.forEach(O=>{O.parentId?(f.has(O.parentId)||f.set(O.parentId,[]),f.get(O.parentId).push(O)):y.push(O)}),{root:y,children:f}},c=g.useMemo(()=>(n==null?void 0:n.items)||[],[n==null?void 0:n.items]),{root:$,children:S}=B(c),P=l.trim().toLowerCase(),p=P.length>0,ie=g.useMemo(()=>p?c.filter(x=>{var y,f;return(((y=x.name)==null?void 0:y.en)||"").toLowerCase().includes(P)||(((f=x.name)==null?void 0:f.am)||"").toLowerCase().includes(P)}):[],[c,p,P]),G=p?ie:$,W=a*d,L=W+d,R=G.slice(W,L),q=g.useMemo(()=>{const x=[];return p?(R.forEach(y=>{const f=y.parentId?C.get(y.parentId):null;x.push({...y,isChild:!!y.parentId,parentName:f?f.name.en:void 0})}),x):(R.forEach(y=>{x.push(y),t.has(y.id)&&(S.get(y.id)||[]).forEach(O=>{x.push({...O,isChild:!0,parentName:y.name.en})})}),x)},[R,S,t,p,C]),oe=g.useMemo(()=>Cr.map(x=>"accessorKey"in x&&x.accessorKey==="name.en"?{...x,cell:({row:y})=>{const f=y.original,O=f.isChild||!1,U=f.parentName,b=S.has(f.id),z=t.has(f.id);return e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b&&e.jsx(M,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 flex-shrink-0",onClick:()=>k(f.id),children:z?e.jsx(ma,{className:"h-4 w-4"}):e.jsx(ua,{className:"h-4 w-4"})}),e.jsxs("div",{className:"font-medium flex items-center gap-2 min-w-0 flex-1 overflow-hidden",children:[O&&e.jsx("span",{className:"text-gray-400 dark:text-gray-500 flex-shrink-0",children:"└─"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate",title:f.name.en,children:h(f.name)}),U&&e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-normal truncate",title:`under ${U}`,children:["(under ",U,")"]})]})]})]})}}:x),[S,t,h]);return N?e.jsx("div",{children:e.jsx(Ra,{})}):e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(Fa,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsx(_a,{className:"flex flex-row justify-between items-center px-0",children:e.jsx(Ga,{className:"text-xl font-semibold ",children:u("organization.organizations")})}),e.jsx(Ha,{className:"px-0",children:e.jsx(ga,{columns:oe,data:q,tableName:"Organizations",toolBarPosition:"right",itemCount:G.length,pageSize:d,onGlobalFilterChange:m,extraToolbar:e.jsx(kr,{perms:["create:organization","activate:organization"],children:e.jsx(pa,{to:"/user-management/organizations/new",children:e.jsxs(M,{className:"px-5 py-2 rounded-md text-sm font-medium shadow-md",children:[e.jsx(Va,{className:"w-4 h-4 mr-2"}),u("organization.newOrganization")]})})}),pageIndex:a,onPageChange:o,nextFunction:()=>o(a+1),prevFunction:()=>o(Math.max(a-1,0)),refresh:j})})]})})}const gt=()=>e.jsx(zr,{});export{gt as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-DTQ4H5AP.js b/apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-DTQ4H5AP.js deleted file mode 100644 index 1619ded8f..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-DTQ4H5AP.js +++ /dev/null @@ -1 +0,0 @@ -import{n as T,m as w,o as B,u as D,k as P,j as e,B as h,t as F,v as d,az as R,r as j,f as K,aF as S}from"./index-Db-xuq0b.js";import{A as q}from"./AdvancedTable-CC9ioMU-.js";import{C as L,a as I,b as M,d as Q}from"./card-BBWyxDss.js";import{b as _,c as H}from"./userService-BHeFzZdn.js";import{B as O}from"./badge-D7JvaQeJ.js";import{A as y,h as b,a as v,b as f,c as C,d as A,e as N,f as U,g as k}from"./alert-dialog-B5Y0wlSz.js";import{f as V}from"./format-DvwV82px.js";import{R as $,a as z}from"./radio-group-DqG5gUnT.js";import{L as E}from"./label-CsFy6wpo.js";import"./table-D3n3VABd.js";import"./select-BoQxM42A.js";import"./chevron-left-DCpEaNzo.js";import"./utils-BncSPdK1.js";import"./command-Cr0tMDDu.js";import"./search-CM5F2ZRy.js";import"./popover-X-j_SRnG.js";import"./Popover-CzANYrEa.js";import"./use-uncontrolled-C3HRHW6t.js";import"./separator-BaOOgzZX.js";import"./refresh-cw-JB7N413f.js";import"./en-US-Cc-9gH5A.js";import"./Radio-C3SNvFel.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-COkNgcEo.js";const m={pendingUsers:["external-users","pending"],allExternalUsers:["external-users","all"]};var g=(s=>(s.external="external_organization",s.individual="individual",s))(g||{});const G=s=>T({queryKey:[...m.allExternalUsers,s],queryFn:async()=>(await H(s)).data}),J=()=>{const s=w();return B({mutationFn:({id:t,status:a})=>_(t,a),onSuccess:()=>{s.invalidateQueries({queryKey:m.pendingUsers}),s.invalidateQueries({queryKey:m.allExternalUsers})}})},W=({userId:s,userStatus:t})=>{const a=J(),{t:r}=D(),{handleError:l}=P(r),n=a.isPending,o=t==="pending"||t==="rejected"||t==="submitted",c=i=>{a.mutate({id:s,status:i},{onSuccess:()=>{F.success(i==="accepted"?"User successfully approved":"User successfully rejected")},onError:u=>{l(u)}})};return e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{children:[e.jsx(b,{asChild:!0,children:e.jsx(h,{className:"bg-primary-600 text-white hover:bg-primary-700",size:"sm",disabled:n||!o,children:r("statusBar.Approve")})}),e.jsxs(v,{children:[e.jsxs(f,{children:[e.jsx(C,{children:r("organization.approveUserPrompt")}),e.jsx(A,{children:r("organization.approveUserDescription")})]}),e.jsxs(N,{children:[e.jsx(U,{disabled:n,children:r("common.Cancel")}),e.jsx(k,{onClick:()=>c("accepted"),disabled:n,children:r(n?"organization.approving":"organization.yesApprove")})]})]})]}),t==="accepted"&&e.jsxs(y,{children:[e.jsx(b,{asChild:!0,children:e.jsx(h,{className:"bg-red-600 text-white hover:bg-red-700",size:"sm",disabled:n,children:r("statusBar.Reject")})}),e.jsxs(v,{children:[e.jsxs(f,{children:[e.jsx(C,{children:r("organization.rejectUserPrompt")}),e.jsx(A,{children:r("organization.rejectUserDescription")})]}),e.jsxs(N,{children:[e.jsx(U,{disabled:n,children:r("common.Cancel")}),e.jsx(k,{onClick:()=>c("rejected"),disabled:n,children:r(n?"organization.rejecting":"organization.yesReject")})]})]})]})]})},X=(s,t)=>[{accessorKey:"name.en",header:()=>d("organization.username"),cell:({row:a})=>e.jsx("div",{className:"font-medium",children:s(a.original.name)})},{accessorKey:"updatedAt",header:()=>d("organization.updatedOn"),cell:({row:a})=>e.jsx("div",{className:"font-medium",children:V(new Date(a.original.updatedAt),"MMM dd, yyyy")})},{accessorKey:"userType",header:()=>"User Type",cell:({row:a})=>{const r=a.original.userType,l=r==="external_organization"?"External Organization":"Employee";return e.jsx("div",{className:"font-medium",children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${r==="external_organization"?"bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-300":"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300"}`,children:l})})}},{id:"status",header:()=>d("dashboard.Status"),cell:({row:a})=>{const{status:r}=a.original,l=o=>{switch(o){case"accepted":return"bg-primary-100 text-primary-600 hover:bg-primary-100 dark:bg-primary-900/40 dark:text-primary-300 dark:hover:bg-primary-900/50";case"rejected":return"bg-red-100 text-red-600 hover:bg-red-100 dark:bg-red-900/40 dark:text-red-300 dark:hover:bg-red-900/50";case"pending":default:return"bg-blue-100 text-blue-600 hover:bg-blue-100 dark:bg-blue-900/40 dark:text-blue-300 dark:hover:bg-blue-900/50"}},n=o=>{switch(o){case"accepted":return"Accepted";case"rejected":return"Rejected";case"pending":default:return d("statusBar.Pending")}};return e.jsx("div",{children:e.jsx(O,{className:`${l(r)} rounded-full px-6 py-1 font-medium`,children:n(r)})})}},{id:"actions",header:()=>d("userRecord.Actions"),cell:({row:a})=>{const{id:r,status:l}=a.original,n=()=>{t(`/user-management/external_users/view/${r}`)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{userId:r,userStatus:l}),e.jsx("button",{onClick:n,className:"px-2 py-1 bg-gray-100 dark:bg-gray-800 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-sm font-medium text-gray-800 dark:text-gray-200",children:d("View")})]})}}];function Ce(){const s=R(),[t,a]=j.useState(0),r=10,{t:l}=D(),n=K(),[o,c]=j.useState(void 0),{data:i,isLoading:u}=G({take:r,skip:t*r,orderBy:"updatedAt:Desc",userType:o}),p=x=>{a(x)};return u?e.jsx("div",{className:"flex justify-center p-6",children:e.jsx(S,{className:"animate-spin w-6 h-6 text-gray-500 dark:text-gray-400"})}):e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(L,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsxs(I,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(M,{className:"text-xl font-semibold",children:"All Users"}),e.jsxs($,{value:o,onValueChange:x=>{c(x),a(0)},className:"flex gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(z,{value:g.external,id:"external"}),e.jsx(E,{htmlFor:"external",children:"External Organization"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(z,{value:g.individual,id:"individual"}),e.jsx(E,{htmlFor:"individual",children:"Individual"})]})]})]}),e.jsx(Q,{className:"px-0",children:e.jsx(q,{columns:X(s,n),data:(i==null?void 0:i.items)||[],tableName:"ExternalUsers",toolBarPosition:"right",itemCount:(i==null?void 0:i.count)||0,pageIndex:t,onPageChange:p,nextFunction:()=>p(t+1),prevFunction:()=>p(Math.max(t-1,0))})})]})})}export{Ce as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-hqFaYBPx.js b/apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-hqFaYBPx.js deleted file mode 100644 index e066c0958..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/PendingExternalUsers-hqFaYBPx.js +++ /dev/null @@ -1 +0,0 @@ -import{n as T,m as w,o as B,u as D,k as P,j as e,B as h,t as F,v as d,az as R,r as j,f as K,aF as S}from"./index-7T7TTikv.js";import{A as q}from"./AdvancedTable-vWyUWUDX.js";import{C as L,a as I,b as M,d as Q}from"./card-_ldW-koX.js";import{b as _,c as H}from"./userService-CFvyXTYe.js";import{B as O}from"./badge-D4t6Wb1T.js";import{A as y,h as b,a as v,b as f,c as C,d as A,e as N,f as U,g as k}from"./alert-dialog-DwppaTz4.js";import{f as V}from"./format-DvwV82px.js";import{R as $,a as z}from"./radio-group-C9tEhs3a.js";import{L as E}from"./label-CABYEcfW.js";import"./table-D_B7hhqb.js";import"./select--i8koVXg.js";import"./chevron-left-G_a9-f9o.js";import"./utils-N2wtfq7C.js";import"./command-B6S1IvD4.js";import"./search-y8VSu0lZ.js";import"./popover-CSKEA8hg.js";import"./Popover-BSKEfTKH.js";import"./use-uncontrolled-tg0LIUAX.js";import"./separator-BXi_hr72.js";import"./refresh-cw-B7fipPS4.js";import"./en-US-Cc-9gH5A.js";import"./Radio-D43EoWlg.js";import"./get-auto-contrast-value-Da6zqqWm.js";import"./InputsGroupFieldset-B16dMH0P.js";const m={pendingUsers:["external-users","pending"],allExternalUsers:["external-users","all"]};var g=(s=>(s.external="external_organization",s.individual="individual",s))(g||{});const G=s=>T({queryKey:[...m.allExternalUsers,s],queryFn:async()=>(await H(s)).data}),J=()=>{const s=w();return B({mutationFn:({id:t,status:a})=>_(t,a),onSuccess:()=>{s.invalidateQueries({queryKey:m.pendingUsers}),s.invalidateQueries({queryKey:m.allExternalUsers})}})},W=({userId:s,userStatus:t})=>{const a=J(),{t:r}=D(),{handleError:l}=P(r),n=a.isPending,o=t==="pending"||t==="rejected"||t==="submitted",c=i=>{a.mutate({id:s,status:i},{onSuccess:()=>{F.success(i==="accepted"?"User successfully approved":"User successfully rejected")},onError:u=>{l(u)}})};return e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{children:[e.jsx(b,{asChild:!0,children:e.jsx(h,{className:"bg-primary-600 text-white hover:bg-primary-700",size:"sm",disabled:n||!o,children:r("statusBar.Approve")})}),e.jsxs(v,{children:[e.jsxs(f,{children:[e.jsx(C,{children:r("organization.approveUserPrompt")}),e.jsx(A,{children:r("organization.approveUserDescription")})]}),e.jsxs(N,{children:[e.jsx(U,{disabled:n,children:r("common.Cancel")}),e.jsx(k,{onClick:()=>c("accepted"),disabled:n,children:r(n?"organization.approving":"organization.yesApprove")})]})]})]}),t==="accepted"&&e.jsxs(y,{children:[e.jsx(b,{asChild:!0,children:e.jsx(h,{className:"bg-red-600 text-white hover:bg-red-700",size:"sm",disabled:n,children:r("statusBar.Reject")})}),e.jsxs(v,{children:[e.jsxs(f,{children:[e.jsx(C,{children:r("organization.rejectUserPrompt")}),e.jsx(A,{children:r("organization.rejectUserDescription")})]}),e.jsxs(N,{children:[e.jsx(U,{disabled:n,children:r("common.Cancel")}),e.jsx(k,{onClick:()=>c("rejected"),disabled:n,children:r(n?"organization.rejecting":"organization.yesReject")})]})]})]})]})},X=(s,t)=>[{accessorKey:"name.en",header:()=>d("organization.username"),cell:({row:a})=>e.jsx("div",{className:"font-medium",children:s(a.original.name)})},{accessorKey:"updatedAt",header:()=>d("organization.updatedOn"),cell:({row:a})=>e.jsx("div",{className:"font-medium",children:V(new Date(a.original.updatedAt),"MMM dd, yyyy")})},{accessorKey:"userType",header:()=>"User Type",cell:({row:a})=>{const r=a.original.userType,l=r==="external_organization"?"External Organization":"Employee";return e.jsx("div",{className:"font-medium",children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${r==="external_organization"?"bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-300":"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300"}`,children:l})})}},{id:"status",header:()=>d("dashboard.Status"),cell:({row:a})=>{const{status:r}=a.original,l=o=>{switch(o){case"accepted":return"bg-primary-100 text-primary-600 hover:bg-primary-100 dark:bg-primary-900/40 dark:text-primary-300 dark:hover:bg-primary-900/50";case"rejected":return"bg-red-100 text-red-600 hover:bg-red-100 dark:bg-red-900/40 dark:text-red-300 dark:hover:bg-red-900/50";case"pending":default:return"bg-blue-100 text-blue-600 hover:bg-blue-100 dark:bg-blue-900/40 dark:text-blue-300 dark:hover:bg-blue-900/50"}},n=o=>{switch(o){case"accepted":return"Accepted";case"rejected":return"Rejected";case"pending":default:return d("statusBar.Pending")}};return e.jsx("div",{children:e.jsx(O,{className:`${l(r)} rounded-full px-6 py-1 font-medium`,children:n(r)})})}},{id:"actions",header:()=>d("userRecord.Actions"),cell:({row:a})=>{const{id:r,status:l}=a.original,n=()=>{t(`/user-management/external_users/view/${r}`)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{userId:r,userStatus:l}),e.jsx("button",{onClick:n,className:"px-2 py-1 bg-gray-100 dark:bg-gray-800 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-sm font-medium text-gray-800 dark:text-gray-200",children:d("View")})]})}}];function Ce(){const s=R(),[t,a]=j.useState(0),r=10,{t:l}=D(),n=K(),[o,c]=j.useState(void 0),{data:i,isLoading:u}=G({take:r,skip:t*r,orderBy:"updatedAt:Desc",userType:o}),p=x=>{a(x)};return u?e.jsx("div",{className:"flex justify-center p-6",children:e.jsx(S,{className:"animate-spin w-6 h-6 text-gray-500 dark:text-gray-400"})}):e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(L,{className:"col-span-2 shadow-none border-none bg-transparent px-0",children:[e.jsxs(I,{className:"flex flex-row justify-between items-center px-0",children:[e.jsx(M,{className:"text-xl font-semibold",children:"All Users"}),e.jsxs($,{value:o,onValueChange:x=>{c(x),a(0)},className:"flex gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(z,{value:g.external,id:"external"}),e.jsx(E,{htmlFor:"external",children:"External Organization"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(z,{value:g.individual,id:"individual"}),e.jsx(E,{htmlFor:"individual",children:"Individual"})]})]})]}),e.jsx(Q,{className:"px-0",children:e.jsx(q,{columns:X(s,n),data:(i==null?void 0:i.items)||[],tableName:"ExternalUsers",toolBarPosition:"right",itemCount:(i==null?void 0:i.count)||0,pageIndex:t,onPageChange:p,nextFunction:()=>p(t+1),prevFunction:()=>p(Math.max(t-1,0))})})]})})}export{Ce as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Popover-BSKEfTKH.js b/apps/edr-freight-web/backoffice/public/_um/assets/Popover-BSKEfTKH.js deleted file mode 100644 index a485b635c..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Popover-BSKEfTKH.js +++ /dev/null @@ -1 +0,0 @@ -import{av as Fe,r as g,ad as ze,K as Q,N,cn as je,ag as W,j as w,co as Z,a1 as G,cp as ke,Q as Ie,cq as Ae,X as _e,af as Me,ah as $e,aj as Ke,cr as Ve,cs as Le,E as X,ct as Ue,cu as Xe,cv as Y,cw as q,cx as B,cy as Ye,cz as qe,V as Be,ak as He,aq as Qe,a8 as We,cA as Ze,ao as Ge,ap as Je,W as eo,cB as oo,Y as to}from"./index-7T7TTikv.js";import{u as ro}from"./use-uncontrolled-tg0LIUAX.js";function ao(e,r={active:!0}){return typeof e!="function"||!r.active?r.onKeyDown||Fe:t=>{var s;t.key==="Escape"&&(e(t),(s=r.onTrigger)==null||s.call(r))}}const H=["mousedown","touchstart"];function so(e,r,t){const s=g.useRef(null);return g.useEffect(()=>{const d=l=>{const{target:i}=l??{};if(Array.isArray(t)){const n=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";t.every(c=>!!c&&!l.composedPath().includes(c))&&!n&&e()}else s.current&&!s.current.contains(i)&&e()};return(r||H).forEach(l=>document.addEventListener(l,d)),()=>{(r||H).forEach(l=>document.removeEventListener(l,d))}},[s,e,t]),s}const[no,J]=ze("Popover component was not found in the tree");var ee={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};const io={},F=Q((e,r)=>{var C,E,y,m;const t=N("PopoverDropdown",io,e),{className:s,style:d,vars:l,children:i,onKeyDownCapture:n,variant:a,classNames:c,styles:f,...O}=t,o=J(),D=je({opened:o.opened,shouldReturnFocus:o.returnFocus}),R=o.withRoles?{"aria-labelledby":o.getTargetId(),id:o.getDropdownId(),role:"dialog",tabIndex:-1}:{},b=W(r,o.floating);return o.disabled?null:w.jsx(Z,{...o.portalProps,withinPortal:o.withinPortal,children:w.jsx(G,{mounted:o.opened,...o.transitionProps,transition:((C=o.transitionProps)==null?void 0:C.transition)||"fade",duration:((E=o.transitionProps)==null?void 0:E.duration)??150,keepMounted:o.keepMounted,exitDuration:typeof((y=o.transitionProps)==null?void 0:y.exitDuration)=="number"?o.transitionProps.exitDuration:(m=o.transitionProps)==null?void 0:m.duration,children:v=>w.jsx(ke,{active:o.trapFocus&&o.opened,innerRef:b,children:w.jsxs(Ie,{...R,...O,variant:a,onKeyDownCapture:ao(()=>{var S,x;(S=o.onClose)==null||S.call(o),(x=o.onDismiss)==null||x.call(o)},{active:o.closeOnEscape,onTrigger:D,onKeyDown:n}),"data-position":o.placement,"data-fixed":o.floatingStrategy==="fixed"||void 0,...o.getStyles("dropdown",{className:s,props:t,classNames:c,styles:f,style:[{...v,zIndex:o.zIndex,top:o.y??0,left:o.x??0,width:o.width==="target"?void 0:_e(o.width)},o.resolvedStyles.dropdown,f==null?void 0:f.dropdown,d]}),children:[i,w.jsx(Ae,{ref:o.arrowRef,arrowX:o.arrowX,arrowY:o.arrowY,visible:o.withArrow,position:o.placement,arrowSize:o.arrowSize,arrowRadius:o.arrowRadius,arrowOffset:o.arrowOffset,arrowPosition:o.arrowPosition,...o.getStyles("arrow",{props:t,classNames:c,styles:f})})]})})})})});F.classes=ee;F.displayName="@mantine/core/PopoverDropdown";const lo={refProp:"ref",popupType:"dialog"},oe=Q((e,r)=>{const{children:t,refProp:s,popupType:d,...l}=N("PopoverTarget",lo,e);if(!Me(t))throw new Error("Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const i=l,n=J(),a=W(n.reference,$e(t),r),c=n.withRoles?{"aria-haspopup":d,"aria-expanded":n.opened,"aria-controls":n.getDropdownId(),id:n.getTargetId()}:{};return g.cloneElement(t,{...i,...c,...n.targetProps,className:Ke(n.targetProps.className,i.className,t.props.className),[s]:a,...n.controlled?null:{onClick:n.onToggle}})});oe.displayName="@mantine/core/PopoverTarget";function co(e){if(e===void 0)return{shift:!0,flip:!0};const r={...e};return e.shift===void 0&&(r.shift=!0),e.flip===void 0&&(r.flip=!0),r}function uo(e,r){const t=co(e.middlewares),s=[Ue(e.offset)];return t.shift&&s.push(Xe(typeof t.shift=="boolean"?{limiter:Y(),padding:5}:{limiter:Y(),padding:5,...t.shift})),t.flip&&s.push(typeof t.flip=="boolean"?q():q(t.flip)),t.inline&&s.push(typeof t.inline=="boolean"?B():B(t.inline)),s.push(Ye({element:e.arrowRef,padding:e.arrowOffset})),(t.size||e.width==="target")&&s.push(qe({...typeof t.size=="boolean"?{}:t.size,apply({rects:d,availableWidth:l,availableHeight:i,...n}){var f;const c=((f=r().refs.floating.current)==null?void 0:f.style)??{};t.size&&(typeof t.size=="object"&&t.size.apply?t.size.apply({rects:d,availableWidth:l,availableHeight:i,...n}):Object.assign(c,{maxWidth:`${l}px`,maxHeight:`${i}px`})),e.width==="target"&&Object.assign(c,{width:`${d.reference.width}px`})}})),s}function fo(e){const[r,t]=ro({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),s=g.useRef(r),d=()=>{r&&!e.disabled&&t(!1)},l=()=>!e.disabled&&t(!r),i=Ve({strategy:e.strategy,placement:e.position,middleware:uo(e,()=>i)});return Le({opened:r,position:e.position,positionDependencies:e.positionDependencies||[],floating:i}),X(()=>{var n;(n=e.onPositionChange)==null||n.call(e,i.placement)},[i.placement]),X(()=>{var n,a;r!==s.current&&(r?(a=e.onOpen)==null||a.call(e):(n=e.onClose)==null||n.call(e)),s.current=r},[r,e.onClose,e.onOpen]),{floating:i,controlled:typeof e.opened=="boolean",opened:r,onClose:d,onToggle:l}}const po={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Je("popover"),__staticSelector:"Popover",width:"max-content"},go=eo((e,{radius:r,shadow:t})=>({dropdown:{"--popover-radius":r===void 0?void 0:to(r),"--popover-shadow":oo(t)}}));function T(e){var M,$,K,V,L,U;const r=N("Popover",po,e),{children:t,position:s,offset:d,onPositionChange:l,positionDependencies:i,opened:n,transitionProps:a,onExitTransitionEnd:c,onEnterTransitionEnd:f,width:O,middlewares:o,withArrow:D,arrowSize:R,arrowOffset:b,arrowRadius:C,arrowPosition:E,unstyled:y,classNames:m,styles:v,closeOnClickOutside:S,withinPortal:x,portalProps:te,closeOnEscape:re,clickOutsideEvents:ae,trapFocus:se,onClose:ne,onDismiss:P,onOpen:ie,onChange:le,zIndex:de,radius:ce,shadow:ue,id:fe,defaultOpened:pe,__staticSelector:z,withRoles:ge,disabled:j,returnFocus:we,variant:he,keepMounted:me,vars:ye,floatingStrategy:k,withOverlay:ve,overlayProps:h,...xe}=r,I=Be({name:z,props:r,classes:ee,classNames:m,styles:v,unstyled:y,rootSelector:"dropdown",vars:ye,varsResolver:go}),{resolvedStyles:Pe}=He({classNames:m,styles:v,props:r}),A=g.useRef(null),[Oe,De]=g.useState(null),[Re,be]=g.useState(null),{dir:Ce}=Qe(),_=We(fe),u=fo({middlewares:o,width:O,position:Ze(Ce,s),offset:typeof d=="number"?d+(D?R/2:0):d,arrowRef:A,arrowOffset:b,onPositionChange:l,positionDependencies:i,opened:n,defaultOpened:pe,onChange:le,onOpen:ie,onClose:ne,onDismiss:P,strategy:k,disabled:j});so(()=>{S&&(u.onClose(),P==null||P())},ae,[Oe,Re]);const Ee=g.useCallback(p=>{De(p),u.floating.refs.setReference(p)},[u.floating.refs.setReference]),Se=g.useCallback(p=>{be(p),u.floating.refs.setFloating(p)},[u.floating.refs.setFloating]),Te=g.useCallback(()=>{var p;(p=a==null?void 0:a.onExited)==null||p.call(a),c==null||c()},[a==null?void 0:a.onExited,c]),Ne=g.useCallback(()=>{var p;(p=a==null?void 0:a.onEntered)==null||p.call(a),f==null||f()},[a==null?void 0:a.onEntered,f]);return w.jsxs(no,{value:{returnFocus:we,disabled:j,controlled:u.controlled,reference:Ee,floating:Se,x:u.floating.x,y:u.floating.y,arrowX:(K=($=(M=u.floating)==null?void 0:M.middlewareData)==null?void 0:$.arrow)==null?void 0:K.x,arrowY:(U=(L=(V=u.floating)==null?void 0:V.middlewareData)==null?void 0:L.arrow)==null?void 0:U.y,opened:u.opened,arrowRef:A,transitionProps:{...a,onExited:Te,onEntered:Ne},width:O,withArrow:D,arrowSize:R,arrowOffset:b,arrowRadius:C,arrowPosition:E,placement:u.floating.placement,trapFocus:se,withinPortal:x,portalProps:te,zIndex:de,radius:ce,shadow:ue,closeOnEscape:re,onDismiss:P,onClose:u.onClose,onToggle:u.onToggle,getTargetId:()=>`${_}-target`,getDropdownId:()=>`${_}-dropdown`,withRoles:ge,targetProps:xe,__staticSelector:z,classNames:m,styles:v,unstyled:y,variant:he,keepMounted:me,getStyles:I,resolvedStyles:Pe,floatingStrategy:k},children:[t,ve&&w.jsx(G,{transition:"fade",mounted:u.opened,duration:(a==null?void 0:a.duration)||250,exitDuration:(a==null?void 0:a.exitDuration)||250,children:p=>w.jsx(Z,{withinPortal:x,children:w.jsx(Ge,{...h,...I("overlay",{className:h==null?void 0:h.className,style:[p,h==null?void 0:h.style]})})})})]})}T.Target=oe;T.Dropdown=F;T.displayName="@mantine/core/Popover";T.extend=e=>e;export{T as P,so as u}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Popover-CzANYrEa.js b/apps/edr-freight-web/backoffice/public/_um/assets/Popover-CzANYrEa.js deleted file mode 100644 index 8312ac58b..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Popover-CzANYrEa.js +++ /dev/null @@ -1 +0,0 @@ -import{av as Fe,r as g,ad as ze,K as Q,N,cn as je,ag as W,j as w,co as Z,a1 as G,cp as ke,Q as Ie,cq as Ae,X as _e,af as Me,ah as $e,aj as Ke,cr as Ve,cs as Le,E as X,ct as Ue,cu as Xe,cv as Y,cw as q,cx as B,cy as Ye,cz as qe,V as Be,ak as He,aq as Qe,a8 as We,cA as Ze,ao as Ge,ap as Je,W as eo,cB as oo,Y as to}from"./index-Db-xuq0b.js";import{u as ro}from"./use-uncontrolled-C3HRHW6t.js";function ao(e,r={active:!0}){return typeof e!="function"||!r.active?r.onKeyDown||Fe:t=>{var s;t.key==="Escape"&&(e(t),(s=r.onTrigger)==null||s.call(r))}}const H=["mousedown","touchstart"];function so(e,r,t){const s=g.useRef(null);return g.useEffect(()=>{const d=l=>{const{target:i}=l??{};if(Array.isArray(t)){const n=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";t.every(c=>!!c&&!l.composedPath().includes(c))&&!n&&e()}else s.current&&!s.current.contains(i)&&e()};return(r||H).forEach(l=>document.addEventListener(l,d)),()=>{(r||H).forEach(l=>document.removeEventListener(l,d))}},[s,e,t]),s}const[no,J]=ze("Popover component was not found in the tree");var ee={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};const io={},F=Q((e,r)=>{var C,E,y,m;const t=N("PopoverDropdown",io,e),{className:s,style:d,vars:l,children:i,onKeyDownCapture:n,variant:a,classNames:c,styles:f,...O}=t,o=J(),D=je({opened:o.opened,shouldReturnFocus:o.returnFocus}),R=o.withRoles?{"aria-labelledby":o.getTargetId(),id:o.getDropdownId(),role:"dialog",tabIndex:-1}:{},b=W(r,o.floating);return o.disabled?null:w.jsx(Z,{...o.portalProps,withinPortal:o.withinPortal,children:w.jsx(G,{mounted:o.opened,...o.transitionProps,transition:((C=o.transitionProps)==null?void 0:C.transition)||"fade",duration:((E=o.transitionProps)==null?void 0:E.duration)??150,keepMounted:o.keepMounted,exitDuration:typeof((y=o.transitionProps)==null?void 0:y.exitDuration)=="number"?o.transitionProps.exitDuration:(m=o.transitionProps)==null?void 0:m.duration,children:v=>w.jsx(ke,{active:o.trapFocus&&o.opened,innerRef:b,children:w.jsxs(Ie,{...R,...O,variant:a,onKeyDownCapture:ao(()=>{var S,x;(S=o.onClose)==null||S.call(o),(x=o.onDismiss)==null||x.call(o)},{active:o.closeOnEscape,onTrigger:D,onKeyDown:n}),"data-position":o.placement,"data-fixed":o.floatingStrategy==="fixed"||void 0,...o.getStyles("dropdown",{className:s,props:t,classNames:c,styles:f,style:[{...v,zIndex:o.zIndex,top:o.y??0,left:o.x??0,width:o.width==="target"?void 0:_e(o.width)},o.resolvedStyles.dropdown,f==null?void 0:f.dropdown,d]}),children:[i,w.jsx(Ae,{ref:o.arrowRef,arrowX:o.arrowX,arrowY:o.arrowY,visible:o.withArrow,position:o.placement,arrowSize:o.arrowSize,arrowRadius:o.arrowRadius,arrowOffset:o.arrowOffset,arrowPosition:o.arrowPosition,...o.getStyles("arrow",{props:t,classNames:c,styles:f})})]})})})})});F.classes=ee;F.displayName="@mantine/core/PopoverDropdown";const lo={refProp:"ref",popupType:"dialog"},oe=Q((e,r)=>{const{children:t,refProp:s,popupType:d,...l}=N("PopoverTarget",lo,e);if(!Me(t))throw new Error("Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const i=l,n=J(),a=W(n.reference,$e(t),r),c=n.withRoles?{"aria-haspopup":d,"aria-expanded":n.opened,"aria-controls":n.getDropdownId(),id:n.getTargetId()}:{};return g.cloneElement(t,{...i,...c,...n.targetProps,className:Ke(n.targetProps.className,i.className,t.props.className),[s]:a,...n.controlled?null:{onClick:n.onToggle}})});oe.displayName="@mantine/core/PopoverTarget";function co(e){if(e===void 0)return{shift:!0,flip:!0};const r={...e};return e.shift===void 0&&(r.shift=!0),e.flip===void 0&&(r.flip=!0),r}function uo(e,r){const t=co(e.middlewares),s=[Ue(e.offset)];return t.shift&&s.push(Xe(typeof t.shift=="boolean"?{limiter:Y(),padding:5}:{limiter:Y(),padding:5,...t.shift})),t.flip&&s.push(typeof t.flip=="boolean"?q():q(t.flip)),t.inline&&s.push(typeof t.inline=="boolean"?B():B(t.inline)),s.push(Ye({element:e.arrowRef,padding:e.arrowOffset})),(t.size||e.width==="target")&&s.push(qe({...typeof t.size=="boolean"?{}:t.size,apply({rects:d,availableWidth:l,availableHeight:i,...n}){var f;const c=((f=r().refs.floating.current)==null?void 0:f.style)??{};t.size&&(typeof t.size=="object"&&t.size.apply?t.size.apply({rects:d,availableWidth:l,availableHeight:i,...n}):Object.assign(c,{maxWidth:`${l}px`,maxHeight:`${i}px`})),e.width==="target"&&Object.assign(c,{width:`${d.reference.width}px`})}})),s}function fo(e){const[r,t]=ro({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),s=g.useRef(r),d=()=>{r&&!e.disabled&&t(!1)},l=()=>!e.disabled&&t(!r),i=Ve({strategy:e.strategy,placement:e.position,middleware:uo(e,()=>i)});return Le({opened:r,position:e.position,positionDependencies:e.positionDependencies||[],floating:i}),X(()=>{var n;(n=e.onPositionChange)==null||n.call(e,i.placement)},[i.placement]),X(()=>{var n,a;r!==s.current&&(r?(a=e.onOpen)==null||a.call(e):(n=e.onClose)==null||n.call(e)),s.current=r},[r,e.onClose,e.onOpen]),{floating:i,controlled:typeof e.opened=="boolean",opened:r,onClose:d,onToggle:l}}const po={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Je("popover"),__staticSelector:"Popover",width:"max-content"},go=eo((e,{radius:r,shadow:t})=>({dropdown:{"--popover-radius":r===void 0?void 0:to(r),"--popover-shadow":oo(t)}}));function T(e){var M,$,K,V,L,U;const r=N("Popover",po,e),{children:t,position:s,offset:d,onPositionChange:l,positionDependencies:i,opened:n,transitionProps:a,onExitTransitionEnd:c,onEnterTransitionEnd:f,width:O,middlewares:o,withArrow:D,arrowSize:R,arrowOffset:b,arrowRadius:C,arrowPosition:E,unstyled:y,classNames:m,styles:v,closeOnClickOutside:S,withinPortal:x,portalProps:te,closeOnEscape:re,clickOutsideEvents:ae,trapFocus:se,onClose:ne,onDismiss:P,onOpen:ie,onChange:le,zIndex:de,radius:ce,shadow:ue,id:fe,defaultOpened:pe,__staticSelector:z,withRoles:ge,disabled:j,returnFocus:we,variant:he,keepMounted:me,vars:ye,floatingStrategy:k,withOverlay:ve,overlayProps:h,...xe}=r,I=Be({name:z,props:r,classes:ee,classNames:m,styles:v,unstyled:y,rootSelector:"dropdown",vars:ye,varsResolver:go}),{resolvedStyles:Pe}=He({classNames:m,styles:v,props:r}),A=g.useRef(null),[Oe,De]=g.useState(null),[Re,be]=g.useState(null),{dir:Ce}=Qe(),_=We(fe),u=fo({middlewares:o,width:O,position:Ze(Ce,s),offset:typeof d=="number"?d+(D?R/2:0):d,arrowRef:A,arrowOffset:b,onPositionChange:l,positionDependencies:i,opened:n,defaultOpened:pe,onChange:le,onOpen:ie,onClose:ne,onDismiss:P,strategy:k,disabled:j});so(()=>{S&&(u.onClose(),P==null||P())},ae,[Oe,Re]);const Ee=g.useCallback(p=>{De(p),u.floating.refs.setReference(p)},[u.floating.refs.setReference]),Se=g.useCallback(p=>{be(p),u.floating.refs.setFloating(p)},[u.floating.refs.setFloating]),Te=g.useCallback(()=>{var p;(p=a==null?void 0:a.onExited)==null||p.call(a),c==null||c()},[a==null?void 0:a.onExited,c]),Ne=g.useCallback(()=>{var p;(p=a==null?void 0:a.onEntered)==null||p.call(a),f==null||f()},[a==null?void 0:a.onEntered,f]);return w.jsxs(no,{value:{returnFocus:we,disabled:j,controlled:u.controlled,reference:Ee,floating:Se,x:u.floating.x,y:u.floating.y,arrowX:(K=($=(M=u.floating)==null?void 0:M.middlewareData)==null?void 0:$.arrow)==null?void 0:K.x,arrowY:(U=(L=(V=u.floating)==null?void 0:V.middlewareData)==null?void 0:L.arrow)==null?void 0:U.y,opened:u.opened,arrowRef:A,transitionProps:{...a,onExited:Te,onEntered:Ne},width:O,withArrow:D,arrowSize:R,arrowOffset:b,arrowRadius:C,arrowPosition:E,placement:u.floating.placement,trapFocus:se,withinPortal:x,portalProps:te,zIndex:de,radius:ce,shadow:ue,closeOnEscape:re,onDismiss:P,onClose:u.onClose,onToggle:u.onToggle,getTargetId:()=>`${_}-target`,getDropdownId:()=>`${_}-dropdown`,withRoles:ge,targetProps:xe,__staticSelector:z,classNames:m,styles:v,unstyled:y,variant:he,keepMounted:me,getStyles:I,resolvedStyles:Pe,floatingStrategy:k},children:[t,ve&&w.jsx(G,{transition:"fade",mounted:u.opened,duration:(a==null?void 0:a.duration)||250,exitDuration:(a==null?void 0:a.exitDuration)||250,children:p=>w.jsx(Z,{withinPortal:x,children:w.jsx(Ge,{...h,...I("overlay",{className:h==null?void 0:h.className,style:[p,h==null?void 0:h.style]})})})})]})}T.Target=oe;T.Dropdown=F;T.displayName="@mantine/core/Popover";T.extend=e=>e;export{T as P,so as u}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Radio-C3SNvFel.js b/apps/edr-freight-web/backoffice/public/_um/assets/Radio-C3SNvFel.js deleted file mode 100644 index 7909cf213..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Radio-C3SNvFel.js +++ /dev/null @@ -1 +0,0 @@ -import{as as Q,K as N,N as $,V as B,aq as io,j as u,a0 as to,W as D,Y as T,a8 as X,ae as Y,X as F,Q as V,am as H,aa as S,an as J,_ as A,au as co}from"./index-Db-xuq0b.js";import{g as M}from"./get-auto-contrast-value-Da6zqqWm.js";import{I as lo,a as uo}from"./InputsGroupFieldset-COkNgcEo.js";import{u as po}from"./use-uncontrolled-C3HRHW6t.js";const[mo,Z]=Q(),[vo,fo]=Q();var oo={card:"m_9dc8ae12"};const ho={withBorder:!0},yo=D((o,{radius:a})=>({card:{"--card-radius":T(a)}})),U=N((o,a)=>{const e=$("RadioCard",ho,o),{classNames:s,className:c,style:p,styles:i,unstyled:r,vars:m,checked:R,mod:w,withBorder:I,value:g,onClick:C,name:h,onKeyDown:f,...j}=e,b=B({name:"RadioCard",classes:oo,props:e,className:c,style:p,classNames:s,styles:i,unstyled:r,vars:m,varsResolver:yo,rootSelector:"card"}),{dir:y}=io(),d=Z(),x=typeof R=="boolean"?R:(d==null?void 0:d.value)===g||!1,_=h||(d==null?void 0:d.name),z=n=>{if(f==null||f(n),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(n.nativeEvent.code)){n.preventDefault();const l=Array.from(document.querySelectorAll(`[role="radio"][name="${_||"__mantine"}"]`)),k=l.findIndex(G=>G===n.target),v=k+1>=l.length?0:k+1,t=k-1<0?l.length-1:k-1;n.nativeEvent.code==="ArrowDown"&&(l[v].focus(),l[v].click()),n.nativeEvent.code==="ArrowUp"&&(l[t].focus(),l[t].click()),n.nativeEvent.code==="ArrowLeft"&&(l[y==="ltr"?t:v].focus(),l[y==="ltr"?t:v].click()),n.nativeEvent.code==="ArrowRight"&&(l[y==="ltr"?v:t].focus(),l[y==="ltr"?v:t].click())}};return u.jsx(vo,{value:{checked:x},children:u.jsx(to,{ref:a,mod:[{"with-border":I,checked:x},w],...b("card"),...j,role:"radio","aria-checked":x,name:_,onClick:n=>{C==null||C(n),d==null||d.onChange(g||"")},onKeyDown:z})})});U.displayName="@mantine/core/RadioCard";U.classes=oo;const Ro={},W=N((o,a)=>{const{value:e,defaultValue:s,onChange:c,size:p,wrapperProps:i,children:r,name:m,readOnly:R,...w}=$("RadioGroup",Ro,o),I=X(m),[g,C]=po({value:e,defaultValue:s,finalValue:"",onChange:c}),h=f=>!R&&C(typeof f=="string"?f:f.currentTarget.value);return u.jsx(mo,{value:{value:g,onChange:h,size:p,name:I},children:u.jsx(Y.Wrapper,{size:p,ref:a,...i,...w,labelElement:"div",__staticSelector:"RadioGroup",children:u.jsx(lo,{role:"radiogroup",children:r})})})});W.classes=Y.Wrapper.classes;W.displayName="@mantine/core/RadioGroup";function eo({size:o,style:a,...e}){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:F(o),height:F(o),...a},"aria-hidden":!0,...e,children:u.jsx("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"})})}var ro={indicator:"m_717d7ff6",icon:"m_3e4da632","indicator--outline":"m_2980836c"};const go={icon:eo},Co=D((o,{radius:a,color:e,size:s,iconColor:c,variant:p,autoContrast:i})=>{const r=H({color:e||o.primaryColor,theme:o}),m=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{indicator:{"--radio-size":A(s,"radio-size"),"--radio-radius":a===void 0?void 0:T(a),"--radio-color":p==="outline"?m:S(e,o),"--radio-icon-size":A(s,"radio-icon-size"),"--radio-icon-color":c?S(c,o):M(i,o)?J({color:e,theme:o,autoContrast:i}):void 0}}}),q=N((o,a)=>{const e=$("RadioIndicator",go,o),{classNames:s,className:c,style:p,styles:i,unstyled:r,vars:m,icon:R,radius:w,color:I,iconColor:g,autoContrast:C,checked:h,mod:f,variant:j,disabled:b,...y}=e,d=R,x=B({name:"RadioIndicator",classes:ro,props:e,className:c,style:p,classNames:s,styles:i,unstyled:r,vars:m,varsResolver:Co,rootSelector:"indicator"}),_=fo(),z=typeof h=="boolean"?h:(_==null?void 0:_.checked)||!1;return u.jsx(V,{ref:a,...x("indicator",{variant:j}),variant:j,mod:[{checked:z,disabled:b},f],...y,children:u.jsx(d,{...x("icon")})})});q.displayName="@mantine/core/RadioIndicator";q.classes=ro;var ao={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const xo={labelPosition:"right"},_o=D((o,{size:a,radius:e,color:s,iconColor:c,variant:p,autoContrast:i})=>{const r=H({color:s||o.primaryColor,theme:o}),m=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{root:{"--radio-size":A(a,"radio-size"),"--radio-radius":e===void 0?void 0:T(e),"--radio-color":p==="outline"?m:S(s,o),"--radio-icon-color":c?S(c,o):M(i,o)?J({color:s,theme:o,autoContrast:i}):void 0,"--radio-icon-size":A(a,"radio-icon-size")}}}),P=N((o,a)=>{const e=$("Radio",xo,o),{classNames:s,className:c,style:p,styles:i,unstyled:r,vars:m,id:R,size:w,label:I,labelPosition:g,description:C,error:h,radius:f,color:j,variant:b,disabled:y,wrapperProps:d,icon:x=eo,rootRef:_,iconColor:z,onChange:n,mod:l,...k}=e,v=B({name:"Radio",classes:ao,props:e,className:c,style:p,classNames:s,styles:i,unstyled:r,vars:m,varsResolver:_o}),t=Z(),G=(t==null?void 0:t.size)??w,so=e.size?w:G,{styleProps:no,rest:E}=co(k),K=X(R),L=t?{checked:t.value===E.value,name:E.name??t.name,onChange:O=>{t.onChange(O),n==null||n(O)}}:{};return u.jsx(uo,{...v("root"),__staticSelector:"Radio",__stylesApiProps:e,id:K,size:so,labelPosition:g,label:I,description:C,error:h,disabled:y,classNames:s,styles:i,unstyled:r,"data-checked":L.checked||void 0,variant:b,ref:_,mod:l,...no,...d,children:u.jsxs(V,{...v("inner"),mod:{"label-position":g},children:[u.jsx(V,{...v("radio",{focusable:!0,variant:b}),onChange:n,...E,...L,component:"input",mod:{error:!!h},ref:a,id:K,disabled:y,type:"radio"}),u.jsx(x,{...v("icon"),"aria-hidden":!0})]})})});P.classes=ao;P.displayName="@mantine/core/Radio";P.Group=W;P.Card=U;P.Indicator=q;export{P as R}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Radio-D43EoWlg.js b/apps/edr-freight-web/backoffice/public/_um/assets/Radio-D43EoWlg.js deleted file mode 100644 index 1e625f839..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Radio-D43EoWlg.js +++ /dev/null @@ -1 +0,0 @@ -import{as as Q,K as N,N as $,V as B,aq as io,j as u,a0 as to,W as D,Y as T,a8 as X,ae as Y,X as F,Q as V,am as H,aa as S,an as J,_ as A,au as co}from"./index-7T7TTikv.js";import{g as M}from"./get-auto-contrast-value-Da6zqqWm.js";import{I as lo,a as uo}from"./InputsGroupFieldset-B16dMH0P.js";import{u as po}from"./use-uncontrolled-tg0LIUAX.js";const[mo,Z]=Q(),[vo,fo]=Q();var oo={card:"m_9dc8ae12"};const ho={withBorder:!0},yo=D((o,{radius:a})=>({card:{"--card-radius":T(a)}})),U=N((o,a)=>{const e=$("RadioCard",ho,o),{classNames:s,className:c,style:p,styles:i,unstyled:r,vars:m,checked:R,mod:w,withBorder:I,value:g,onClick:C,name:h,onKeyDown:f,...j}=e,b=B({name:"RadioCard",classes:oo,props:e,className:c,style:p,classNames:s,styles:i,unstyled:r,vars:m,varsResolver:yo,rootSelector:"card"}),{dir:y}=io(),d=Z(),x=typeof R=="boolean"?R:(d==null?void 0:d.value)===g||!1,_=h||(d==null?void 0:d.name),z=n=>{if(f==null||f(n),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(n.nativeEvent.code)){n.preventDefault();const l=Array.from(document.querySelectorAll(`[role="radio"][name="${_||"__mantine"}"]`)),k=l.findIndex(G=>G===n.target),v=k+1>=l.length?0:k+1,t=k-1<0?l.length-1:k-1;n.nativeEvent.code==="ArrowDown"&&(l[v].focus(),l[v].click()),n.nativeEvent.code==="ArrowUp"&&(l[t].focus(),l[t].click()),n.nativeEvent.code==="ArrowLeft"&&(l[y==="ltr"?t:v].focus(),l[y==="ltr"?t:v].click()),n.nativeEvent.code==="ArrowRight"&&(l[y==="ltr"?v:t].focus(),l[y==="ltr"?v:t].click())}};return u.jsx(vo,{value:{checked:x},children:u.jsx(to,{ref:a,mod:[{"with-border":I,checked:x},w],...b("card"),...j,role:"radio","aria-checked":x,name:_,onClick:n=>{C==null||C(n),d==null||d.onChange(g||"")},onKeyDown:z})})});U.displayName="@mantine/core/RadioCard";U.classes=oo;const Ro={},W=N((o,a)=>{const{value:e,defaultValue:s,onChange:c,size:p,wrapperProps:i,children:r,name:m,readOnly:R,...w}=$("RadioGroup",Ro,o),I=X(m),[g,C]=po({value:e,defaultValue:s,finalValue:"",onChange:c}),h=f=>!R&&C(typeof f=="string"?f:f.currentTarget.value);return u.jsx(mo,{value:{value:g,onChange:h,size:p,name:I},children:u.jsx(Y.Wrapper,{size:p,ref:a,...i,...w,labelElement:"div",__staticSelector:"RadioGroup",children:u.jsx(lo,{role:"radiogroup",children:r})})})});W.classes=Y.Wrapper.classes;W.displayName="@mantine/core/RadioGroup";function eo({size:o,style:a,...e}){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:F(o),height:F(o),...a},"aria-hidden":!0,...e,children:u.jsx("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"})})}var ro={indicator:"m_717d7ff6",icon:"m_3e4da632","indicator--outline":"m_2980836c"};const go={icon:eo},Co=D((o,{radius:a,color:e,size:s,iconColor:c,variant:p,autoContrast:i})=>{const r=H({color:e||o.primaryColor,theme:o}),m=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{indicator:{"--radio-size":A(s,"radio-size"),"--radio-radius":a===void 0?void 0:T(a),"--radio-color":p==="outline"?m:S(e,o),"--radio-icon-size":A(s,"radio-icon-size"),"--radio-icon-color":c?S(c,o):M(i,o)?J({color:e,theme:o,autoContrast:i}):void 0}}}),q=N((o,a)=>{const e=$("RadioIndicator",go,o),{classNames:s,className:c,style:p,styles:i,unstyled:r,vars:m,icon:R,radius:w,color:I,iconColor:g,autoContrast:C,checked:h,mod:f,variant:j,disabled:b,...y}=e,d=R,x=B({name:"RadioIndicator",classes:ro,props:e,className:c,style:p,classNames:s,styles:i,unstyled:r,vars:m,varsResolver:Co,rootSelector:"indicator"}),_=fo(),z=typeof h=="boolean"?h:(_==null?void 0:_.checked)||!1;return u.jsx(V,{ref:a,...x("indicator",{variant:j}),variant:j,mod:[{checked:z,disabled:b},f],...y,children:u.jsx(d,{...x("icon")})})});q.displayName="@mantine/core/RadioIndicator";q.classes=ro;var ao={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const xo={labelPosition:"right"},_o=D((o,{size:a,radius:e,color:s,iconColor:c,variant:p,autoContrast:i})=>{const r=H({color:s||o.primaryColor,theme:o}),m=r.isThemeColor&&r.shade===void 0?`var(--mantine-color-${r.color}-outline)`:r.color;return{root:{"--radio-size":A(a,"radio-size"),"--radio-radius":e===void 0?void 0:T(e),"--radio-color":p==="outline"?m:S(s,o),"--radio-icon-color":c?S(c,o):M(i,o)?J({color:s,theme:o,autoContrast:i}):void 0,"--radio-icon-size":A(a,"radio-icon-size")}}}),P=N((o,a)=>{const e=$("Radio",xo,o),{classNames:s,className:c,style:p,styles:i,unstyled:r,vars:m,id:R,size:w,label:I,labelPosition:g,description:C,error:h,radius:f,color:j,variant:b,disabled:y,wrapperProps:d,icon:x=eo,rootRef:_,iconColor:z,onChange:n,mod:l,...k}=e,v=B({name:"Radio",classes:ao,props:e,className:c,style:p,classNames:s,styles:i,unstyled:r,vars:m,varsResolver:_o}),t=Z(),G=(t==null?void 0:t.size)??w,so=e.size?w:G,{styleProps:no,rest:E}=co(k),K=X(R),L=t?{checked:t.value===E.value,name:E.name??t.name,onChange:O=>{t.onChange(O),n==null||n(O)}}:{};return u.jsx(uo,{...v("root"),__staticSelector:"Radio",__stylesApiProps:e,id:K,size:so,labelPosition:g,label:I,description:C,error:h,disabled:y,classNames:s,styles:i,unstyled:r,"data-checked":L.checked||void 0,variant:b,ref:_,mod:l,...no,...d,children:u.jsxs(V,{...v("inner"),mod:{"label-position":g},children:[u.jsx(V,{...v("radio",{focusable:!0,variant:b}),onChange:n,...E,...L,component:"input",mod:{error:!!h},ref:a,id:K,disabled:y,type:"radio"}),u.jsx(x,{...v("icon"),"aria-hidden":!0})]})})});P.classes=ao;P.displayName="@mantine/core/Radio";P.Group=W;P.Card=U;P.Indicator=q;export{P as R}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DGVl7BJb.js b/apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DGVl7BJb.js deleted file mode 100644 index 98a741419..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DGVl7BJb.js +++ /dev/null @@ -1 +0,0 @@ -import{f as B,i as D,u as H,r as n,j as s,I as y,B as N,s as O,t as b}from"./index-7T7TTikv.js";import{L as v}from"./lock-DGEqses-.js";import{E as C}from"./eye-off-AoIvdwmO.js";import{E as P}from"./eye-DYwZYJcQ.js";import{R as T}from"./refresh-cw-B7fipPS4.js";import{A as U}from"./arrow-left-mae9HpSL.js";const J=()=>{const p=B(),[u]=D(),{t:e}=H(),r=u.get("email")||"",c=u.get("verificationCode")||"",i=u.get("userId")||"",[t,S]=n.useState(""),[d,E]=n.useState(""),[f,w]=n.useState(!1),[g,a]=n.useState(""),[x,L]=n.useState(!1),[h,R]=n.useState(!1);n.useEffect(()=>{!i&&!r&&a("Missing required parameters in the reset link. Please request a new password reset link."),c||a("Missing verification code in the reset link. Please request a new password reset link.")},[i,r,c]);const k=async m=>{if(m.preventDefault(),a(""),!t){a(e("msg.newPasswordRequired"));return}if(t.length<8){a(e("msg.passwordMinLength"));return}if(!d){a(e("msg.confirmPasswordRequired"));return}if(t!==d){a(e("msg.passwordMismatch"));return}const q=/[A-Z]/.test(t),I=/[a-z]/.test(t),M=/\d/.test(t),A=/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(t),l=[];if(q||l.push(e("msg.uppercaseLetter")),I||l.push(e("msg.lowercaseLetter")),M||l.push(e("msg.number")),A||l.push(e("msg.specialCharacter")),l.length>0){a(e("msg.passwordComplexity")+" "+l.join(", "));return}w(!0);try{const o={verificationCode:c,newPassword:t,confirmPassword:d};i&&(o.userId=i),r&&(o.email=r),await O(o),b.success(e("msg.successChange"),{description:e("msg.passwordResetSuccess")}),setTimeout(()=>p("/"),2e3)}catch(o){const j=(o==null?void 0:o.message)||e("msg.failedChange");a(j),b.error(e("msg.failedChange"),{description:j})}finally{w(!1)}};return s.jsx("div",{className:"min-h-screen bg-gray-100 p-4 flex items-center justify-center",children:s.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-lg p-6 md:p-8",children:[s.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[s.jsx("img",{src:"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-8 md:h-10 mb-4 md:mb-6 mx-auto"}),s.jsx("h1",{className:"text-xl md:text-2xl font-bold text-gray-900 mb-2",children:"Reset Password"}),s.jsx("p",{className:"text-xs md:text-sm text-gray-500",children:"Set a new password for your account"}),r&&s.jsxs("p",{className:"text-xs text-gray-400 mt-1 truncate max-w-full px-2",children:["Email: ",r]}),i&&s.jsxs("p",{className:"text-xs text-gray-400 mt-1 truncate max-w-full px-2",children:["User ID: ",i]})]}),s.jsxs("form",{onSubmit:k,className:"space-y-4 md:space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s.jsx(v,{className:"h-4 w-4 md:h-5 md:w-5 text-gray-400"})}),s.jsx(y,{type:x?"text":"password",placeholder:"New Password",className:"h-10 rounded-md border px-4 text-sm ps-10 pr-10",value:t,onChange:m=>S(m.target.value),required:!0}),s.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>L(!x),"aria-label":x?"Hide password":"Show password",children:x?s.jsx(C,{className:"h-4 w-4 text-gray-400"}):s.jsx(P,{className:"h-4 w-4 text-gray-400"})})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s.jsx(v,{className:"h-4 w-4 md:h-5 md:w-5 text-gray-400"})}),s.jsx(y,{type:h?"text":"password",placeholder:"Confirm New Password",className:"h-10 rounded-md border px-4 text-sm ps-10 pr-10",value:d,onChange:m=>E(m.target.value),required:!0}),s.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>R(!h),"aria-label":h?"Hide password":"Show password",children:h?s.jsx(C,{className:"h-4 w-4 text-gray-400"}):s.jsx(P,{className:"h-4 w-4 text-gray-400"})})]}),g&&s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 md:p-4",children:s.jsx("p",{className:"text-xs md:text-sm text-red-700 font-medium",children:g})})]}),s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(N,{type:"submit",className:"w-full h-10 bg-primary hover:bg-primary-300 text-white text-sm",disabled:f||!i&&!r||!c,children:f?s.jsxs("span",{className:"flex items-center justify-center",children:[s.jsx(T,{className:"animate-spin h-4 w-4 md:h-5 md:w-5 mr-2"}),"Resetting..."]}):"Reset Password"}),s.jsxs(N,{type:"button",variant:"outline",className:"w-full h-10 text-sm",onClick:()=>p("/"),children:[s.jsx(U,{className:"h-4 w-4 mr-2"}),"Back to Login"]})]})]})]})})};export{J as ResetPassword,J as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DeJuLwFx.js b/apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DeJuLwFx.js deleted file mode 100644 index 1a1875267..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/ResetPassword-DeJuLwFx.js +++ /dev/null @@ -1 +0,0 @@ -import{f as B,i as D,u as H,r as n,j as s,I as y,B as N,s as O,t as b}from"./index-Db-xuq0b.js";import{L as v}from"./lock-BCybB-Lq.js";import{E as C}from"./eye-off-CDMvHElM.js";import{E as P}from"./eye-Bhud4znU.js";import{R as T}from"./refresh-cw-JB7N413f.js";import{A as U}from"./arrow-left-CE5-YfaQ.js";const J=()=>{const p=B(),[u]=D(),{t:e}=H(),r=u.get("email")||"",c=u.get("verificationCode")||"",i=u.get("userId")||"",[t,S]=n.useState(""),[d,E]=n.useState(""),[f,w]=n.useState(!1),[g,a]=n.useState(""),[x,L]=n.useState(!1),[h,R]=n.useState(!1);n.useEffect(()=>{!i&&!r&&a("Missing required parameters in the reset link. Please request a new password reset link."),c||a("Missing verification code in the reset link. Please request a new password reset link.")},[i,r,c]);const k=async m=>{if(m.preventDefault(),a(""),!t){a(e("msg.newPasswordRequired"));return}if(t.length<8){a(e("msg.passwordMinLength"));return}if(!d){a(e("msg.confirmPasswordRequired"));return}if(t!==d){a(e("msg.passwordMismatch"));return}const q=/[A-Z]/.test(t),I=/[a-z]/.test(t),M=/\d/.test(t),A=/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(t),l=[];if(q||l.push(e("msg.uppercaseLetter")),I||l.push(e("msg.lowercaseLetter")),M||l.push(e("msg.number")),A||l.push(e("msg.specialCharacter")),l.length>0){a(e("msg.passwordComplexity")+" "+l.join(", "));return}w(!0);try{const o={verificationCode:c,newPassword:t,confirmPassword:d};i&&(o.userId=i),r&&(o.email=r),await O(o),b.success(e("msg.successChange"),{description:e("msg.passwordResetSuccess")}),setTimeout(()=>p("/"),2e3)}catch(o){const j=(o==null?void 0:o.message)||e("msg.failedChange");a(j),b.error(e("msg.failedChange"),{description:j})}finally{w(!1)}};return s.jsx("div",{className:"min-h-screen bg-gray-100 p-4 flex items-center justify-center",children:s.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-lg p-6 md:p-8",children:[s.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[s.jsx("img",{src:"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-8 md:h-10 mb-4 md:mb-6 mx-auto"}),s.jsx("h1",{className:"text-xl md:text-2xl font-bold text-gray-900 mb-2",children:"Reset Password"}),s.jsx("p",{className:"text-xs md:text-sm text-gray-500",children:"Set a new password for your account"}),r&&s.jsxs("p",{className:"text-xs text-gray-400 mt-1 truncate max-w-full px-2",children:["Email: ",r]}),i&&s.jsxs("p",{className:"text-xs text-gray-400 mt-1 truncate max-w-full px-2",children:["User ID: ",i]})]}),s.jsxs("form",{onSubmit:k,className:"space-y-4 md:space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s.jsx(v,{className:"h-4 w-4 md:h-5 md:w-5 text-gray-400"})}),s.jsx(y,{type:x?"text":"password",placeholder:"New Password",className:"h-10 rounded-md border px-4 text-sm ps-10 pr-10",value:t,onChange:m=>S(m.target.value),required:!0}),s.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>L(!x),"aria-label":x?"Hide password":"Show password",children:x?s.jsx(C,{className:"h-4 w-4 text-gray-400"}):s.jsx(P,{className:"h-4 w-4 text-gray-400"})})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s.jsx(v,{className:"h-4 w-4 md:h-5 md:w-5 text-gray-400"})}),s.jsx(y,{type:h?"text":"password",placeholder:"Confirm New Password",className:"h-10 rounded-md border px-4 text-sm ps-10 pr-10",value:d,onChange:m=>E(m.target.value),required:!0}),s.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>R(!h),"aria-label":h?"Hide password":"Show password",children:h?s.jsx(C,{className:"h-4 w-4 text-gray-400"}):s.jsx(P,{className:"h-4 w-4 text-gray-400"})})]}),g&&s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 md:p-4",children:s.jsx("p",{className:"text-xs md:text-sm text-red-700 font-medium",children:g})})]}),s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(N,{type:"submit",className:"w-full h-10 bg-primary hover:bg-primary-300 text-white text-sm",disabled:f||!i&&!r||!c,children:f?s.jsxs("span",{className:"flex items-center justify-center",children:[s.jsx(T,{className:"animate-spin h-4 w-4 md:h-5 md:w-5 mr-2"}),"Resetting..."]}):"Reset Password"}),s.jsxs(N,{type:"button",variant:"outline",className:"w-full h-10 text-sm",onClick:()=>p("/"),children:[s.jsx(U,{className:"h-4 w-4 mr-2"}),"Back to Login"]})]})]})]})})};export{J as ResetPassword,J as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-FBLxgeIW.js b/apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-FBLxgeIW.js deleted file mode 100644 index a38e44e4a..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-FBLxgeIW.js +++ /dev/null @@ -1 +0,0 @@ -import{f as Q,u as X,k as ee,i as se,a as te,r as t,t as b,j as e,I as k,B as I}from"./index-7T7TTikv.js";import{L as O}from"./lock-DGEqses-.js";import{E as U}from"./eye-off-AoIvdwmO.js";import{E as B}from"./eye-DYwZYJcQ.js";import{R as V}from"./refresh-cw-B7fipPS4.js";import{A as ae}from"./arrow-left-mae9HpSL.js";import{M as re}from"./mail-q8lHlEPt.js";const xe=()=>{const f=Q(),{t:q}=X(),{handleError:x}=ee(q),[h]=se(),{setPassword:M,isSettingPassword:v,setPasswordError:i,setPasswordSuccess:S,resendVerificationCode:z,isResendingCode:P,resendError:p,resendSuccess:C}=te(),c=h.get("email"),D=h.get("verificationCode")||"",l=h.get("phoneNumber"),L=h.get("userId"),[n,F]=t.useState(""),[o,Z]=t.useState(""),[g,j]=t.useState(!1),[$,y]=t.useState(!1),[E,H]=t.useState(!1),[N,T]=t.useState(!1),[w,W]=t.useState(!1),[u,m]=t.useState(""),Y=a=>({minLength:a.length>=8,hasLowercase:/[a-z]/.test(a),hasUppercase:/[A-Z]/.test(a),hasNumber:/\d/.test(a),hasSymbol:/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(a)}),s=t.useMemo(()=>Y(n),[n]),A=Object.values(s).every(Boolean),R=o.length>0&&n===o,_=!!(n&&o&&A&&R),G=a=>{const d=a.target.value;F(d),u&&m("")},J=async a=>{if(a.preventDefault(),H(!0),m(""),!n||!o){m("Please fill in both fields");return}if(!A){const r=[];s.minLength||r.push("at least 8 characters"),s.hasLowercase||r.push("one lowercase letter"),s.hasUppercase||r.push("one uppercase letter"),s.hasNumber||r.push("one number"),s.hasSymbol||r.push("one symbol (!@#$%^&*...)"),m(`Password must contain: ${r.join(", ")}`);return}if(!R){m("Passwords don't match");return}const d={verificationCode:D,newPassword:n,confirmPassword:o};if(L&&(d.userId=L),c)d.email=c;else if(l){let r=l;r.startsWith("0")&&(r="+251"+r.slice(1)),d.phoneNumber=r}y(!0),M(d)},K=()=>{if(!l&&!c){b.error("User ID is missing. Cannot resend verification code.");return}j(!0),z({phoneNumber:l||"",email:c||void 0})};return t.useEffect(()=>{S&&(b.success("Password updated successfully! You can now login"),y(!1),f("/login"))},[S,f]),t.useEffect(()=>{E&&i!=null&&i.message&&(y(!1),x(i))},[i==null?void 0:i.message,x,E]),t.useEffect(()=>{C&&g&&(b.success("Verification code resent successfully!"),j(!1)),p&&g&&(x(p),j(!1))},[C,p,g,x]),e.jsx("div",{className:"flex items-center justify-center bg-gray-100 p-4",style:{height:"100vh"},children:e.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-lg p-8",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsx("img",{src:"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-10 mb-6 mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Set Password"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Set a new password for your account"}),c&&e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Email: ",c]}),l&&e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Phone: ",l]})]}),e.jsxs("form",{onSubmit:J,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(O,{className:"h-5 w-5 text-gray-400"})}),e.jsx(k,{type:N?"text":"password",placeholder:"New Password",className:"h-10 rounded-md border px-4 text-sm ps-10",value:n,onChange:G,required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>T(!N),children:N?e.jsx(U,{className:"h-4 w-4 text-gray-400"}):e.jsx(B,{className:"h-4 w-4 text-gray-400"})})]}),n&&e.jsxs("div",{className:"space-y-2 p-3 bg-gray-50 rounded-md border border-gray-200",children:[e.jsx("p",{className:"text-xs font-medium text-gray-700",children:"Password Requirements:"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.minLength?"bg-primary-500":"bg-gray-300"}`,children:s.minLength&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.minLength?"text-primary-700":"text-gray-600"}`,children:"At least 8 characters"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasUppercase?"bg-primary-500":"bg-gray-300"}`,children:s.hasUppercase&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasUppercase?"text-primary-700":"text-gray-600"}`,children:"One uppercase letter (A-Z)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasLowercase?"bg-primary-500":"bg-gray-300"}`,children:s.hasLowercase&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasLowercase?"text-primary-700":"text-gray-600"}`,children:"One lowercase letter (a-z)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasNumber?"bg-primary-500":"bg-gray-300"}`,children:s.hasNumber&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasNumber?"text-primary-700":"text-gray-600"}`,children:"One number (0-9)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasSymbol?"bg-primary-500":"bg-gray-300"}`,children:s.hasSymbol&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasSymbol?"text-primary-700":"text-gray-600"}`,children:"One symbol (!@#$%^&*...)"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(O,{className:"h-5 w-5 text-gray-400"})}),e.jsx(k,{type:w?"text":"password",placeholder:"Confirm Password",className:"h-10 rounded-md border px-4 text-sm ps-10",value:o,onChange:a=>{Z(a.target.value),u&&m("")},required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>W(!w),children:w?e.jsx(U,{className:"h-4 w-4 text-gray-400"}):e.jsx(B,{className:"h-4 w-4 text-gray-400"})})]}),u&&e.jsx("p",{className:"text-sm text-red-500 mt-1",children:u})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(I,{type:"submit",className:"w-full h-10 bg-primary hover:bg-primary-300 text-white text-sm",disabled:v||$||!_,children:v?e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsx(V,{className:"animate-spin h-5 w-5 mr-2"}),"Setting Password..."]}):"Set Password"}),e.jsxs(I,{type:"button",variant:"outline",className:"w-full h-10 text-sm",onClick:()=>f("/"),children:[e.jsx(ae,{className:"h-4 w-4 mr-2"}),"Back to Login"]})]})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx("button",{type:"button",onClick:K,disabled:P||!c||!l||$,className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium flex items-center justify-center space-x-1 mx-auto",children:P?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"animate-spin h-4 w-4 text-indigo-600 mr-2"}),e.jsx("span",{children:"Sending..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),e.jsx("span",{children:"Resend Verification Code"})]})})})]})})};export{xe as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-bCvH9rTk.js b/apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-bCvH9rTk.js deleted file mode 100644 index 7b77965d4..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/SetPassword-bCvH9rTk.js +++ /dev/null @@ -1 +0,0 @@ -import{f as Q,u as X,k as ee,i as se,a as te,r as t,t as b,j as e,I as k,B as I}from"./index-Db-xuq0b.js";import{L as O}from"./lock-BCybB-Lq.js";import{E as U}from"./eye-off-CDMvHElM.js";import{E as B}from"./eye-Bhud4znU.js";import{R as V}from"./refresh-cw-JB7N413f.js";import{A as ae}from"./arrow-left-CE5-YfaQ.js";import{M as re}from"./mail-bwr0seHR.js";const xe=()=>{const f=Q(),{t:q}=X(),{handleError:x}=ee(q),[h]=se(),{setPassword:M,isSettingPassword:v,setPasswordError:i,setPasswordSuccess:S,resendVerificationCode:z,isResendingCode:P,resendError:p,resendSuccess:C}=te(),c=h.get("email"),D=h.get("verificationCode")||"",l=h.get("phoneNumber"),L=h.get("userId"),[n,F]=t.useState(""),[o,Z]=t.useState(""),[g,j]=t.useState(!1),[$,y]=t.useState(!1),[E,H]=t.useState(!1),[N,T]=t.useState(!1),[w,W]=t.useState(!1),[u,m]=t.useState(""),Y=a=>({minLength:a.length>=8,hasLowercase:/[a-z]/.test(a),hasUppercase:/[A-Z]/.test(a),hasNumber:/\d/.test(a),hasSymbol:/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(a)}),s=t.useMemo(()=>Y(n),[n]),A=Object.values(s).every(Boolean),R=o.length>0&&n===o,_=!!(n&&o&&A&&R),G=a=>{const d=a.target.value;F(d),u&&m("")},J=async a=>{if(a.preventDefault(),H(!0),m(""),!n||!o){m("Please fill in both fields");return}if(!A){const r=[];s.minLength||r.push("at least 8 characters"),s.hasLowercase||r.push("one lowercase letter"),s.hasUppercase||r.push("one uppercase letter"),s.hasNumber||r.push("one number"),s.hasSymbol||r.push("one symbol (!@#$%^&*...)"),m(`Password must contain: ${r.join(", ")}`);return}if(!R){m("Passwords don't match");return}const d={verificationCode:D,newPassword:n,confirmPassword:o};if(L&&(d.userId=L),c)d.email=c;else if(l){let r=l;r.startsWith("0")&&(r="+251"+r.slice(1)),d.phoneNumber=r}y(!0),M(d)},K=()=>{if(!l&&!c){b.error("User ID is missing. Cannot resend verification code.");return}j(!0),z({phoneNumber:l||"",email:c||void 0})};return t.useEffect(()=>{S&&(b.success("Password updated successfully! You can now login"),y(!1),f("/login"))},[S,f]),t.useEffect(()=>{E&&i!=null&&i.message&&(y(!1),x(i))},[i==null?void 0:i.message,x,E]),t.useEffect(()=>{C&&g&&(b.success("Verification code resent successfully!"),j(!1)),p&&g&&(x(p),j(!1))},[C,p,g,x]),e.jsx("div",{className:"flex items-center justify-center bg-gray-100 p-4",style:{height:"100vh"},children:e.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-lg p-8",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsx("img",{src:"/assets/smart-office-logo.svg",alt:"Smart Office Logo",className:"h-10 mb-6 mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Set Password"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Set a new password for your account"}),c&&e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Email: ",c]}),l&&e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Phone: ",l]})]}),e.jsxs("form",{onSubmit:J,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(O,{className:"h-5 w-5 text-gray-400"})}),e.jsx(k,{type:N?"text":"password",placeholder:"New Password",className:"h-10 rounded-md border px-4 text-sm ps-10",value:n,onChange:G,required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>T(!N),children:N?e.jsx(U,{className:"h-4 w-4 text-gray-400"}):e.jsx(B,{className:"h-4 w-4 text-gray-400"})})]}),n&&e.jsxs("div",{className:"space-y-2 p-3 bg-gray-50 rounded-md border border-gray-200",children:[e.jsx("p",{className:"text-xs font-medium text-gray-700",children:"Password Requirements:"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.minLength?"bg-primary-500":"bg-gray-300"}`,children:s.minLength&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.minLength?"text-primary-700":"text-gray-600"}`,children:"At least 8 characters"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasUppercase?"bg-primary-500":"bg-gray-300"}`,children:s.hasUppercase&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasUppercase?"text-primary-700":"text-gray-600"}`,children:"One uppercase letter (A-Z)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasLowercase?"bg-primary-500":"bg-gray-300"}`,children:s.hasLowercase&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasLowercase?"text-primary-700":"text-gray-600"}`,children:"One lowercase letter (a-z)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasNumber?"bg-primary-500":"bg-gray-300"}`,children:s.hasNumber&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasNumber?"text-primary-700":"text-gray-600"}`,children:"One number (0-9)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center text-xs ${s.hasSymbol?"bg-primary-500":"bg-gray-300"}`,children:s.hasSymbol&&e.jsx("span",{className:"text-white",children:"✓"})}),e.jsx("span",{className:`text-xs ${s.hasSymbol?"text-primary-700":"text-gray-600"}`,children:"One symbol (!@#$%^&*...)"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(O,{className:"h-5 w-5 text-gray-400"})}),e.jsx(k,{type:w?"text":"password",placeholder:"Confirm Password",className:"h-10 rounded-md border px-4 text-sm ps-10",value:o,onChange:a=>{Z(a.target.value),u&&m("")},required:!0}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer",onClick:()=>W(!w),children:w?e.jsx(U,{className:"h-4 w-4 text-gray-400"}):e.jsx(B,{className:"h-4 w-4 text-gray-400"})})]}),u&&e.jsx("p",{className:"text-sm text-red-500 mt-1",children:u})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(I,{type:"submit",className:"w-full h-10 bg-primary hover:bg-primary-300 text-white text-sm",disabled:v||$||!_,children:v?e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsx(V,{className:"animate-spin h-5 w-5 mr-2"}),"Setting Password..."]}):"Set Password"}),e.jsxs(I,{type:"button",variant:"outline",className:"w-full h-10 text-sm",onClick:()=>f("/"),children:[e.jsx(ae,{className:"h-4 w-4 mr-2"}),"Back to Login"]})]})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx("button",{type:"button",onClick:K,disabled:P||!c||!l||$,className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium flex items-center justify-center space-x-1 mx-auto",children:P?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"animate-spin h-4 w-4 text-indigo-600 mr-2"}),e.jsx("span",{children:"Sending..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),e.jsx("span",{children:"Resend Verification Code"})]})})})]})})};export{xe as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-DLv7kKUv.js b/apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-DLv7kKUv.js deleted file mode 100644 index b4bdc79fb..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-DLv7kKUv.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as de,ad as me,K as E,N as O,j as e,Q as W,O as ue,aq as he,a0 as pe,aa as ie,a8 as xe,V as be,W as ge,an as ye,Y as je,b8 as _,r as w,az as ve,bX as Ne,I as j,bY as fe,B as T,aK as ke,b7 as Te,aL as Ce,aM as Se,aN as we}from"./index-Db-xuq0b.js";import{C as Z,a as ee,b as ae,c as se,d as re}from"./card-BBWyxDss.js";import{g as De}from"./get-auto-contrast-value-Da6zqqWm.js";import{c as Fe}from"./create-scoped-keydown-handler-O-eo68DQ.js";import{u as Le}from"./use-uncontrolled-C3HRHW6t.js";import{T as V}from"./textarea-BNzPMo41.js";import{S as D}from"./switch-BNCD27Bd.js";import{S as U,a as R,b as P,c as I,d as h}from"./select-BoQxM42A.js";import{L as l}from"./label-CsFy6wpo.js";import{a as Ae,u as Ue}from"./useOrganizationReport-D3QtWTPL.js";import{S as Re}from"./shield-uC_usZTb.js";import{S as q}from"./save-BpdaNhEd.js";import"./Switch-DSHMk-sj.js";import"./InputsGroupFieldset-COkNgcEo.js";import"./organizationsService-BEVk8qa1.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ie=de("database",Pe);function te(s,i){return t=>{if(typeof t!="string"||t.trim().length===0)throw new Error(i);return`${s}-${t}`}}const[Ee,H]=me("Tabs component was not found in the tree");var F={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",panel:"m_b0c91715",tab:"m_4ec4dce6",tabSection:"m_fc420b1f","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"};const Oe={},Y=E((s,i)=>{const t=O("TabsList",Oe,s),{children:c,className:x,grow:b,justify:m,classNames:n,styles:p,style:u,mod:g,...v}=t,d=H();return e.jsx(W,{...v,...d.getStyles("list",{className:x,style:u,classNames:n,styles:p,props:t,variant:d.variant}),ref:i,role:"tablist",variant:d.variant,mod:[{grow:b,orientation:d.orientation,placement:d.orientation==="vertical"&&d.placement,inverted:d.inverted},g],"aria-orientation":d.orientation,__vars:{"--tabs-justify":m},children:c})});Y.classes=F;Y.displayName="@mantine/core/TabsList";const _e={},Q=E((s,i)=>{const t=O("TabsPanel",_e,s),{children:c,className:x,value:b,classNames:m,styles:n,style:p,mod:u,keepMounted:g,...v}=t,d=H(),f=d.value===b,r=d.keepMounted||g||f?c:null;return e.jsx(W,{...v,...d.getStyles("panel",{className:x,classNames:m,styles:n,style:[p,f?void 0:{display:"none"}],props:t}),ref:i,mod:[{orientation:d.orientation},u],role:"tabpanel",id:d.getPanelId(b),"aria-labelledby":d.getTabId(b),children:r})});Q.classes=F;Q.displayName="@mantine/core/TabsPanel";const Me={},X=E((s,i)=>{const t=O("TabsTab",Me,s),{className:c,children:x,rightSection:b,leftSection:m,value:n,onClick:p,onKeyDown:u,disabled:g,color:v,style:d,classNames:f,styles:r,vars:y,mod:k,tabIndex:a,...M}=t,B=ue(),{dir:L}=he(),o=H(),C=n===o.value,z=K=>{o.onChange(o.allowTabDeactivation&&n===o.value?null:n),p==null||p(K)},S={classNames:f,styles:r,props:t};return e.jsxs(pe,{...M,...o.getStyles("tab",{className:c,style:d,variant:o.variant,...S}),disabled:g,unstyled:o.unstyled,variant:o.variant,mod:[{active:C,disabled:g,orientation:o.orientation,inverted:o.inverted,placement:o.orientation==="vertical"&&o.placement},k],ref:i,role:"tab",id:o.getTabId(n),"aria-selected":C,tabIndex:a!==void 0?a:C||o.value===null?0:-1,"aria-controls":o.getPanelId(n),onClick:z,__vars:{"--tabs-color":v?ie(v,B):void 0},onKeyDown:Fe({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:o.activateTabWithKeyboard,loop:o.loop,orientation:o.orientation||"horizontal",dir:L,onKeyDown:u}),children:[m&&e.jsx("span",{...o.getStyles("tabSection",S),"data-position":"left",children:m}),x&&e.jsx("span",{...o.getStyles("tabLabel",S),children:x}),b&&e.jsx("span",{...o.getStyles("tabSection",S),"data-position":"right",children:b})]})});X.classes=F;X.displayName="@mantine/core/TabsTab";const ne="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",Be={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},ze=ge((s,{radius:i,color:t,autoContrast:c})=>({root:{"--tabs-radius":je(i),"--tabs-color":ie(t,s),"--tabs-text-color":De(c,s)?ye({color:t,theme:s,autoContrast:c}):void 0}})),N=E((s,i)=>{const t=O("Tabs",Be,s),{defaultValue:c,value:x,onChange:b,orientation:m,children:n,loop:p,id:u,activateTabWithKeyboard:g,allowTabDeactivation:v,variant:d,color:f,radius:r,inverted:y,placement:k,keepMounted:a,classNames:M,styles:B,unstyled:L,className:o,style:C,vars:z,autoContrast:S,mod:K,...le}=t,A=xe(u),[oe,ce]=Le({value:x,defaultValue:c,finalValue:null,onChange:b}),J=be({name:"Tabs",props:t,classes:F,className:o,style:C,classNames:M,styles:B,unstyled:L,vars:z,varsResolver:ze});return e.jsx(Ee,{value:{placement:k,value:oe,orientation:m,id:A,loop:p,activateTabWithKeyboard:g,getTabId:te(`${A}-tab`,ne),getPanelId:te(`${A}-panel`,ne),onChange:ce,allowTabDeactivation:v,variant:d,color:f,radius:r,inverted:y,keepMounted:a,unstyled:L,getStyles:J},children:e.jsx(W,{ref:i,id:A,variant:d,mod:[{orientation:m,inverted:m==="horizontal"&&y,placement:m==="vertical"&&k},K],...J("root"),...le,children:n})})});N.classes=F;N.displayName="@mantine/core/Tabs";N.Tab=X;N.Panel=Q;N.List=Y;function Ke({className:s,value:i,defaultValue:t,onValueChange:c,children:x,...b}){return e.jsx(N,{value:i,defaultValue:t,onChange:m=>m&&(c==null?void 0:c(m)),className:_("flex flex-col gap-2",s),...b,children:x})}function Ve({className:s,children:i,...t}){return e.jsx(N.List,{className:_("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1",s),...t,children:i})}function $({className:s,value:i,children:t,disabled:c,...x}){return e.jsx(N.Tab,{value:i,disabled:c,className:_("data-[active]:bg-background data-[active]:text-primary data-[active]:shadow-sm","inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap","transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 hover:text-primary/80","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),...x,children:t})}function G({className:s,value:i,children:t,...c}){return e.jsx(N.Panel,{value:i,className:_("flex-1 outline-none",s),...c,children:t})}function na(){const[s,i]=w.useState({systemName:"Smart Office",siteUrl:"https://smartoffice.example.com",timezone:"UTC+3",language:"en",enableMaintenance:!1}),{mutateDocumetary:t,isLoading:c}=Ae(),{documentRequirementData:x}=Ue(),[b,m]=w.useState(!1);ve();const[n,p]=w.useState({minimumPasswordLength:"8",requireSpecialCharacters:!0,passwordExpirationDays:"90",maxLoginAttempts:"5",sessionTimeout:"30",enableTwoFactor:!1,allowedIpRanges:"0.0.0.0/0"}),[u,g]=w.useState({backupSchedule:"daily",backupTime:"01:00",backupRetentionDays:"30",backupLocation:"cloud",enableAutoBackup:!0}),v=a=>{a.preventDefault()},d=a=>{a.preventDefault()},f=a=>{a.preventDefault()},[r,y]=w.useState({id:"",title:{am:"",en:""},description:{am:"",en:""},key:"",order:0,isOptional:!1,type:"individual"}),k=async()=>{try{const a={title:r.title,description:r.description,key:r.key,order:r.order,isOptional:r.isOptional,type:r.type};await t(a),y({id:"",title:{am:"",en:""},description:{am:"",en:""},key:"",order:0,isOptional:!1,type:"individual"}),m(!1)}catch{}};return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs(Z,{className:"shadow-lg border-gray-200 dark:border-gray-700",children:[e.jsxs(ee,{children:[e.jsx(ae,{className:"text-xl font-semibold",children:"System Settings"}),e.jsx(se,{children:"Configure system-wide settings for your organization"})]}),e.jsx(re,{children:e.jsxs(Ke,{defaultValue:"general",className:"w-full",children:[e.jsxs(Ve,{className:"grid grid-cols-3 mb-8",children:[e.jsxs($,{value:"general",className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4"}),"General"]}),e.jsxs($,{value:"security",className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4"}),"Security"]}),e.jsxs($,{value:"backup",className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4"}),"Backup"]})]}),e.jsx(G,{value:"general",children:e.jsxs("form",{onSubmit:v,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"systemName",children:"System Name"}),e.jsx(j,{id:"systemName",value:s.systemName,onChange:a=>i({...s,systemName:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"siteUrl",children:"Site URL"}),e.jsx(j,{id:"siteUrl",value:s.siteUrl,onChange:a=>i({...s,siteUrl:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"timezone",children:"Default Timezone"}),e.jsxs(U,{value:s.timezone,onValueChange:a=>i({...s,timezone:a}),children:[e.jsx(R,{id:"timezone",children:e.jsx(P,{placeholder:"Select timezone"})}),e.jsxs(I,{children:[e.jsx(h,{value:"UTC-12",children:"UTC-12 (Baker Island)"}),e.jsx(h,{value:"UTC-8",children:"UTC-8 (Los Angeles)"}),e.jsx(h,{value:"UTC-5",children:"UTC-5 (New York)"}),e.jsx(h,{value:"UTC+0",children:"UTC+0 (London)"}),e.jsx(h,{value:"UTC+1",children:"UTC+1 (Paris)"}),e.jsx(h,{value:"UTC+3",children:"UTC+3 (Addis Ababa)"}),e.jsx(h,{value:"UTC+5:30",children:"UTC+5:30 (New Delhi)"}),e.jsx(h,{value:"UTC+8",children:"UTC+8 (Beijing)"}),e.jsx(h,{value:"UTC+9",children:"UTC+9 (Tokyo)"}),e.jsx(h,{value:"UTC+12",children:"UTC+12 (Auckland)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"language",children:"Default Language"}),e.jsxs(U,{value:s.language,onValueChange:a=>i({...s,language:a}),children:[e.jsx(R,{id:"language",children:e.jsx(P,{placeholder:"Select language"})}),e.jsx(I,{children:fe?.map(a=>e.jsx(h,{value:a.value,children:a.label},a.value))})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"enableMaintenance",checked:s.enableMaintenance,onCheckedChange:a=>i({...s,enableMaintenance:a})}),e.jsx(l,{htmlFor:"enableMaintenance",children:"Enable Maintenance Mode"})]}),e.jsxs(T,{type:"submit",className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]})]})}),e.jsx(G,{value:"security",children:e.jsxs("form",{onSubmit:d,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"minimumPasswordLength",children:"Minimum Password Length"}),e.jsx(j,{id:"minimumPasswordLength",type:"number",min:"6",max:"30",value:n.minimumPasswordLength,onChange:a=>p({...n,minimumPasswordLength:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"passwordExpirationDays",children:"Password Expiration (Days)"}),e.jsx(j,{id:"passwordExpirationDays",type:"number",value:n.passwordExpirationDays,onChange:a=>p({...n,passwordExpirationDays:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"maxLoginAttempts",children:"Max Failed Login Attempts"}),e.jsx(j,{id:"maxLoginAttempts",type:"number",value:n.maxLoginAttempts,onChange:a=>p({...n,maxLoginAttempts:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"sessionTimeout",children:"Session Timeout (Minutes)"}),e.jsx(j,{id:"sessionTimeout",type:"number",value:n.sessionTimeout,onChange:a=>p({...n,sessionTimeout:a.target.value})})]}),e.jsxs("div",{className:"space-y-2 col-span-2",children:[e.jsx(l,{htmlFor:"allowedIpRanges",children:"Allowed IP Ranges (CIDR)"}),e.jsx(V,{id:"allowedIpRanges",value:n.allowedIpRanges,onChange:a=>p({...n,allowedIpRanges:a.target.value}),placeholder:"e.g. 192.168.1.0/24, 10.0.0.0/8",className:"min-h-20"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Enter one CIDR range per line. Use 0.0.0.0/0 for unrestricted access."})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"requireSpecialCharacters",checked:n.requireSpecialCharacters,onCheckedChange:a=>p({...n,requireSpecialCharacters:a})}),e.jsx(l,{htmlFor:"requireSpecialCharacters",children:"Require Special Characters in Password"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"enableTwoFactor",checked:n.enableTwoFactor,onCheckedChange:a=>p({...n,enableTwoFactor:a})}),e.jsx(l,{htmlFor:"enableTwoFactor",children:"Enable Two-Factor Authentication"})]})]}),e.jsx("div",{className:"flex justify-end border-t border-gray-200 dark:border-gray-700 pt-4",children:e.jsxs(T,{type:"submit",className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(G,{value:"backup",children:e.jsxs("form",{onSubmit:f,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupSchedule",children:"Backup Schedule"}),e.jsxs(U,{value:u.backupSchedule,onValueChange:a=>g({...u,backupSchedule:a}),children:[e.jsx(R,{id:"backupSchedule",children:e.jsx(P,{placeholder:"Select schedule"})}),e.jsxs(I,{children:[e.jsx(h,{value:"hourly",children:"Hourly"}),e.jsx(h,{value:"daily",children:"Daily"}),e.jsx(h,{value:"weekly",children:"Weekly"}),e.jsx(h,{value:"monthly",children:"Monthly"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupTime",children:"Backup Time"}),e.jsx(j,{id:"backupTime",type:"time",value:u.backupTime,onChange:a=>g({...u,backupTime:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupRetentionDays",children:"Retention Period (Days)"}),e.jsx(j,{id:"backupRetentionDays",type:"number",value:u.backupRetentionDays,onChange:a=>g({...u,backupRetentionDays:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupLocation",children:"Backup Storage Location"}),e.jsxs(U,{value:u.backupLocation,onValueChange:a=>g({...u,backupLocation:a}),children:[e.jsx(R,{id:"backupLocation",children:e.jsx(P,{placeholder:"Select location"})}),e.jsxs(I,{children:[e.jsx(h,{value:"local",children:"Local Storage"}),e.jsx(h,{value:"cloud",children:"Cloud Storage"}),e.jsx(h,{value:"both",children:"Both (Local & Cloud)"})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"enableAutoBackup",checked:u.enableAutoBackup,onCheckedChange:a=>g({...u,enableAutoBackup:a})}),e.jsx(l,{htmlFor:"enableAutoBackup",children:"Enable Automatic Backup"})]}),e.jsxs("div",{className:"space-x-4",children:[e.jsx(T,{type:"button",variant:"outline",children:"Backup Now"}),e.jsxs(T,{type:"submit",className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]})]})]})})]})})]}),e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(Z,{className:"shadow-lg border-gray-200 dark:border-gray-700",children:[e.jsxs(ee,{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx(ae,{className:"text-xl font-semibold",children:"Document Requirements"}),e.jsx(se,{children:"Manage required and optional document submissions"})]}),e.jsxs(ke,{open:b,onOpenChange:m,children:[e.jsx(Te,{asChild:!0,children:e.jsx(T,{className:"bg-primary hover:bg-primary/90 text-primary-foreground",onClick:()=>m(!0),children:"+ Add Requirement"})}),e.jsxs(Ce,{className:"max-w-lg",children:[e.jsx(Se,{children:e.jsx(we,{children:"Add New Document Requirement"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(l,{htmlFor:"titleEn",children:"Title (English)"}),e.jsx(j,{id:"titleEn",value:r.title.en,onChange:a=>y({...r,title:{...r.title,en:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"titleAm",children:"Title (Amharic)"}),e.jsx(j,{id:"titleAm",value:r.title.am,onChange:a=>y({...r,title:{...r.title,am:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"descEn",children:"Description (English)"}),e.jsx(V,{id:"descEn",value:r.description.en,onChange:a=>y({...r,description:{...r.description,en:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"descAm",children:"Description (Amharic)"}),e.jsx(V,{id:"descAm",value:r.description.am,onChange:a=>y({...r,description:{...r.description,am:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"key",children:"Key"}),e.jsx(j,{id:"key",value:r.key,onChange:a=>y({...r,key:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"order",children:"Order"}),e.jsx(j,{id:"order",type:"number",value:r.order,onChange:a=>y({...r,order:Number(a.target.value)})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"type",children:"Type"}),e.jsxs("select",{id:"type",value:r.type,onChange:a=>y({...r,type:a.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-md px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:[e.jsx("option",{value:"individual",children:"Individual"}),e.jsx("option",{value:"organization",children:"External Organization"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"isOptional",checked:r.isOptional,onCheckedChange:a=>y({...r,isOptional:a})}),e.jsx(l,{htmlFor:"isOptional",children:"Optional"})]}),e.jsx(T,{onClick:k,disabled:c,className:"bg-primary hover:bg-primary/90 text-primary-foreground w-full",children:c?"Saving...":"Save Requirement"})]})]})]})]}),e.jsx(re,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border border-gray-200 dark:border-gray-700 text-sm",children:[e.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Title (EN)"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Title (AM)"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Key"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Order"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Type"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Active"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Optional"})]})}),e.jsx("tbody",{children:x==null?void 0:x.items?.map(a=>e.jsxs("tr",{className:"text-center dark:text-gray-200",children:[e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.title.en}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.title.am}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.key}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.order}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.type}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.isActive?"✅":"❌"}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.isOptional?"✅":"❌"})]},a.id))})]})})})]})})]})}export{na as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-Dm5BoWlS.js b/apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-Dm5BoWlS.js deleted file mode 100644 index 5b9f91769..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/SettingsPage-Dm5BoWlS.js +++ /dev/null @@ -1,6 +0,0 @@ -import{y as de,ad as me,K as E,N as O,j as e,Q as W,O as ue,aq as he,a0 as pe,aa as ie,a8 as xe,V as be,W as ge,an as ye,Y as je,b8 as _,r as w,az as ve,bX as Ne,I as j,bY as fe,B as T,aK as ke,b7 as Te,aL as Ce,aM as Se,aN as we}from"./index-7T7TTikv.js";import{C as Z,a as ee,b as ae,c as se,d as re}from"./card-_ldW-koX.js";import{g as De}from"./get-auto-contrast-value-Da6zqqWm.js";import{c as Fe}from"./create-scoped-keydown-handler-O-eo68DQ.js";import{u as Le}from"./use-uncontrolled-tg0LIUAX.js";import{T as V}from"./textarea-Bq1wvmIA.js";import{S as D}from"./switch-D9hx8CZw.js";import{S as U,a as R,b as P,c as I,d as h}from"./select--i8koVXg.js";import{L as l}from"./label-CABYEcfW.js";import{a as Ae,u as Ue}from"./useOrganizationReport-Btcu9b-4.js";import{S as Re}from"./shield-D3luOm6l.js";import{S as q}from"./save-BBDkdyVg.js";import"./Switch-ByfhjkDo.js";import"./InputsGroupFieldset-B16dMH0P.js";import"./organizationsService-DIFVjoLn.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ie=de("database",Pe);function te(s,i){return t=>{if(typeof t!="string"||t.trim().length===0)throw new Error(i);return`${s}-${t}`}}const[Ee,H]=me("Tabs component was not found in the tree");var F={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",panel:"m_b0c91715",tab:"m_4ec4dce6",tabSection:"m_fc420b1f","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"};const Oe={},Y=E((s,i)=>{const t=O("TabsList",Oe,s),{children:c,className:x,grow:b,justify:m,classNames:n,styles:p,style:u,mod:g,...v}=t,d=H();return e.jsx(W,{...v,...d.getStyles("list",{className:x,style:u,classNames:n,styles:p,props:t,variant:d.variant}),ref:i,role:"tablist",variant:d.variant,mod:[{grow:b,orientation:d.orientation,placement:d.orientation==="vertical"&&d.placement,inverted:d.inverted},g],"aria-orientation":d.orientation,__vars:{"--tabs-justify":m},children:c})});Y.classes=F;Y.displayName="@mantine/core/TabsList";const _e={},Q=E((s,i)=>{const t=O("TabsPanel",_e,s),{children:c,className:x,value:b,classNames:m,styles:n,style:p,mod:u,keepMounted:g,...v}=t,d=H(),f=d.value===b,r=d.keepMounted||g||f?c:null;return e.jsx(W,{...v,...d.getStyles("panel",{className:x,classNames:m,styles:n,style:[p,f?void 0:{display:"none"}],props:t}),ref:i,mod:[{orientation:d.orientation},u],role:"tabpanel",id:d.getPanelId(b),"aria-labelledby":d.getTabId(b),children:r})});Q.classes=F;Q.displayName="@mantine/core/TabsPanel";const Me={},X=E((s,i)=>{const t=O("TabsTab",Me,s),{className:c,children:x,rightSection:b,leftSection:m,value:n,onClick:p,onKeyDown:u,disabled:g,color:v,style:d,classNames:f,styles:r,vars:y,mod:k,tabIndex:a,...M}=t,B=ue(),{dir:L}=he(),o=H(),C=n===o.value,z=K=>{o.onChange(o.allowTabDeactivation&&n===o.value?null:n),p==null||p(K)},S={classNames:f,styles:r,props:t};return e.jsxs(pe,{...M,...o.getStyles("tab",{className:c,style:d,variant:o.variant,...S}),disabled:g,unstyled:o.unstyled,variant:o.variant,mod:[{active:C,disabled:g,orientation:o.orientation,inverted:o.inverted,placement:o.orientation==="vertical"&&o.placement},k],ref:i,role:"tab",id:o.getTabId(n),"aria-selected":C,tabIndex:a!==void 0?a:C||o.value===null?0:-1,"aria-controls":o.getPanelId(n),onClick:z,__vars:{"--tabs-color":v?ie(v,B):void 0},onKeyDown:Fe({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:o.activateTabWithKeyboard,loop:o.loop,orientation:o.orientation||"horizontal",dir:L,onKeyDown:u}),children:[m&&e.jsx("span",{...o.getStyles("tabSection",S),"data-position":"left",children:m}),x&&e.jsx("span",{...o.getStyles("tabLabel",S),children:x}),b&&e.jsx("span",{...o.getStyles("tabSection",S),"data-position":"right",children:b})]})});X.classes=F;X.displayName="@mantine/core/TabsTab";const ne="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",Be={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},ze=ge((s,{radius:i,color:t,autoContrast:c})=>({root:{"--tabs-radius":je(i),"--tabs-color":ie(t,s),"--tabs-text-color":De(c,s)?ye({color:t,theme:s,autoContrast:c}):void 0}})),N=E((s,i)=>{const t=O("Tabs",Be,s),{defaultValue:c,value:x,onChange:b,orientation:m,children:n,loop:p,id:u,activateTabWithKeyboard:g,allowTabDeactivation:v,variant:d,color:f,radius:r,inverted:y,placement:k,keepMounted:a,classNames:M,styles:B,unstyled:L,className:o,style:C,vars:z,autoContrast:S,mod:K,...le}=t,A=xe(u),[oe,ce]=Le({value:x,defaultValue:c,finalValue:null,onChange:b}),J=be({name:"Tabs",props:t,classes:F,className:o,style:C,classNames:M,styles:B,unstyled:L,vars:z,varsResolver:ze});return e.jsx(Ee,{value:{placement:k,value:oe,orientation:m,id:A,loop:p,activateTabWithKeyboard:g,getTabId:te(`${A}-tab`,ne),getPanelId:te(`${A}-panel`,ne),onChange:ce,allowTabDeactivation:v,variant:d,color:f,radius:r,inverted:y,keepMounted:a,unstyled:L,getStyles:J},children:e.jsx(W,{ref:i,id:A,variant:d,mod:[{orientation:m,inverted:m==="horizontal"&&y,placement:m==="vertical"&&k},K],...J("root"),...le,children:n})})});N.classes=F;N.displayName="@mantine/core/Tabs";N.Tab=X;N.Panel=Q;N.List=Y;function Ke({className:s,value:i,defaultValue:t,onValueChange:c,children:x,...b}){return e.jsx(N,{value:i,defaultValue:t,onChange:m=>m&&(c==null?void 0:c(m)),className:_("flex flex-col gap-2",s),...b,children:x})}function Ve({className:s,children:i,...t}){return e.jsx(N.List,{className:_("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1",s),...t,children:i})}function $({className:s,value:i,children:t,disabled:c,...x}){return e.jsx(N.Tab,{value:i,disabled:c,className:_("data-[active]:bg-background data-[active]:text-primary data-[active]:shadow-sm","inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap","transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 hover:text-primary/80","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),...x,children:t})}function G({className:s,value:i,children:t,...c}){return e.jsx(N.Panel,{value:i,className:_("flex-1 outline-none",s),...c,children:t})}function na(){const[s,i]=w.useState({systemName:"Smart Office",siteUrl:"https://smartoffice.example.com",timezone:"UTC+3",language:"en",enableMaintenance:!1}),{mutateDocumetary:t,isLoading:c}=Ae(),{documentRequirementData:x}=Ue(),[b,m]=w.useState(!1);ve();const[n,p]=w.useState({minimumPasswordLength:"8",requireSpecialCharacters:!0,passwordExpirationDays:"90",maxLoginAttempts:"5",sessionTimeout:"30",enableTwoFactor:!1,allowedIpRanges:"0.0.0.0/0"}),[u,g]=w.useState({backupSchedule:"daily",backupTime:"01:00",backupRetentionDays:"30",backupLocation:"cloud",enableAutoBackup:!0}),v=a=>{a.preventDefault()},d=a=>{a.preventDefault()},f=a=>{a.preventDefault()},[r,y]=w.useState({id:"",title:{am:"",en:""},description:{am:"",en:""},key:"",order:0,isOptional:!1,type:"individual"}),k=async()=>{try{const a={title:r.title,description:r.description,key:r.key,order:r.order,isOptional:r.isOptional,type:r.type};await t(a),y({id:"",title:{am:"",en:""},description:{am:"",en:""},key:"",order:0,isOptional:!1,type:"individual"}),m(!1)}catch{}};return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs(Z,{className:"shadow-lg border-gray-200 dark:border-gray-700",children:[e.jsxs(ee,{children:[e.jsx(ae,{className:"text-xl font-semibold",children:"System Settings"}),e.jsx(se,{children:"Configure system-wide settings for your organization"})]}),e.jsx(re,{children:e.jsxs(Ke,{defaultValue:"general",className:"w-full",children:[e.jsxs(Ve,{className:"grid grid-cols-3 mb-8",children:[e.jsxs($,{value:"general",className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4"}),"General"]}),e.jsxs($,{value:"security",className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4"}),"Security"]}),e.jsxs($,{value:"backup",className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4"}),"Backup"]})]}),e.jsx(G,{value:"general",children:e.jsxs("form",{onSubmit:v,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"systemName",children:"System Name"}),e.jsx(j,{id:"systemName",value:s.systemName,onChange:a=>i({...s,systemName:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"siteUrl",children:"Site URL"}),e.jsx(j,{id:"siteUrl",value:s.siteUrl,onChange:a=>i({...s,siteUrl:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"timezone",children:"Default Timezone"}),e.jsxs(U,{value:s.timezone,onValueChange:a=>i({...s,timezone:a}),children:[e.jsx(R,{id:"timezone",children:e.jsx(P,{placeholder:"Select timezone"})}),e.jsxs(I,{children:[e.jsx(h,{value:"UTC-12",children:"UTC-12 (Baker Island)"}),e.jsx(h,{value:"UTC-8",children:"UTC-8 (Los Angeles)"}),e.jsx(h,{value:"UTC-5",children:"UTC-5 (New York)"}),e.jsx(h,{value:"UTC+0",children:"UTC+0 (London)"}),e.jsx(h,{value:"UTC+1",children:"UTC+1 (Paris)"}),e.jsx(h,{value:"UTC+3",children:"UTC+3 (Addis Ababa)"}),e.jsx(h,{value:"UTC+5:30",children:"UTC+5:30 (New Delhi)"}),e.jsx(h,{value:"UTC+8",children:"UTC+8 (Beijing)"}),e.jsx(h,{value:"UTC+9",children:"UTC+9 (Tokyo)"}),e.jsx(h,{value:"UTC+12",children:"UTC+12 (Auckland)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"language",children:"Default Language"}),e.jsxs(U,{value:s.language,onValueChange:a=>i({...s,language:a}),children:[e.jsx(R,{id:"language",children:e.jsx(P,{placeholder:"Select language"})}),e.jsx(I,{children:fe.map(a=>e.jsx(h,{value:a.value,children:a.label},a.value))})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"enableMaintenance",checked:s.enableMaintenance,onCheckedChange:a=>i({...s,enableMaintenance:a})}),e.jsx(l,{htmlFor:"enableMaintenance",children:"Enable Maintenance Mode"})]}),e.jsxs(T,{type:"submit",className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]})]})}),e.jsx(G,{value:"security",children:e.jsxs("form",{onSubmit:d,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"minimumPasswordLength",children:"Minimum Password Length"}),e.jsx(j,{id:"minimumPasswordLength",type:"number",min:"6",max:"30",value:n.minimumPasswordLength,onChange:a=>p({...n,minimumPasswordLength:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"passwordExpirationDays",children:"Password Expiration (Days)"}),e.jsx(j,{id:"passwordExpirationDays",type:"number",value:n.passwordExpirationDays,onChange:a=>p({...n,passwordExpirationDays:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"maxLoginAttempts",children:"Max Failed Login Attempts"}),e.jsx(j,{id:"maxLoginAttempts",type:"number",value:n.maxLoginAttempts,onChange:a=>p({...n,maxLoginAttempts:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"sessionTimeout",children:"Session Timeout (Minutes)"}),e.jsx(j,{id:"sessionTimeout",type:"number",value:n.sessionTimeout,onChange:a=>p({...n,sessionTimeout:a.target.value})})]}),e.jsxs("div",{className:"space-y-2 col-span-2",children:[e.jsx(l,{htmlFor:"allowedIpRanges",children:"Allowed IP Ranges (CIDR)"}),e.jsx(V,{id:"allowedIpRanges",value:n.allowedIpRanges,onChange:a=>p({...n,allowedIpRanges:a.target.value}),placeholder:"e.g. 192.168.1.0/24, 10.0.0.0/8",className:"min-h-20"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Enter one CIDR range per line. Use 0.0.0.0/0 for unrestricted access."})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"requireSpecialCharacters",checked:n.requireSpecialCharacters,onCheckedChange:a=>p({...n,requireSpecialCharacters:a})}),e.jsx(l,{htmlFor:"requireSpecialCharacters",children:"Require Special Characters in Password"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"enableTwoFactor",checked:n.enableTwoFactor,onCheckedChange:a=>p({...n,enableTwoFactor:a})}),e.jsx(l,{htmlFor:"enableTwoFactor",children:"Enable Two-Factor Authentication"})]})]}),e.jsx("div",{className:"flex justify-end border-t border-gray-200 dark:border-gray-700 pt-4",children:e.jsxs(T,{type:"submit",className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(G,{value:"backup",children:e.jsxs("form",{onSubmit:f,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupSchedule",children:"Backup Schedule"}),e.jsxs(U,{value:u.backupSchedule,onValueChange:a=>g({...u,backupSchedule:a}),children:[e.jsx(R,{id:"backupSchedule",children:e.jsx(P,{placeholder:"Select schedule"})}),e.jsxs(I,{children:[e.jsx(h,{value:"hourly",children:"Hourly"}),e.jsx(h,{value:"daily",children:"Daily"}),e.jsx(h,{value:"weekly",children:"Weekly"}),e.jsx(h,{value:"monthly",children:"Monthly"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupTime",children:"Backup Time"}),e.jsx(j,{id:"backupTime",type:"time",value:u.backupTime,onChange:a=>g({...u,backupTime:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupRetentionDays",children:"Retention Period (Days)"}),e.jsx(j,{id:"backupRetentionDays",type:"number",value:u.backupRetentionDays,onChange:a=>g({...u,backupRetentionDays:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"backupLocation",children:"Backup Storage Location"}),e.jsxs(U,{value:u.backupLocation,onValueChange:a=>g({...u,backupLocation:a}),children:[e.jsx(R,{id:"backupLocation",children:e.jsx(P,{placeholder:"Select location"})}),e.jsxs(I,{children:[e.jsx(h,{value:"local",children:"Local Storage"}),e.jsx(h,{value:"cloud",children:"Cloud Storage"}),e.jsx(h,{value:"both",children:"Both (Local & Cloud)"})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"enableAutoBackup",checked:u.enableAutoBackup,onCheckedChange:a=>g({...u,enableAutoBackup:a})}),e.jsx(l,{htmlFor:"enableAutoBackup",children:"Enable Automatic Backup"})]}),e.jsxs("div",{className:"space-x-4",children:[e.jsx(T,{type:"button",variant:"outline",children:"Backup Now"}),e.jsxs(T,{type:"submit",className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]})]})]})})]})})]}),e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs(Z,{className:"shadow-lg border-gray-200 dark:border-gray-700",children:[e.jsxs(ee,{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx(ae,{className:"text-xl font-semibold",children:"Document Requirements"}),e.jsx(se,{children:"Manage required and optional document submissions"})]}),e.jsxs(ke,{open:b,onOpenChange:m,children:[e.jsx(Te,{asChild:!0,children:e.jsx(T,{className:"bg-primary hover:bg-primary/90 text-primary-foreground",onClick:()=>m(!0),children:"+ Add Requirement"})}),e.jsxs(Ce,{className:"max-w-lg",children:[e.jsx(Se,{children:e.jsx(we,{children:"Add New Document Requirement"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(l,{htmlFor:"titleEn",children:"Title (English)"}),e.jsx(j,{id:"titleEn",value:r.title.en,onChange:a=>y({...r,title:{...r.title,en:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"titleAm",children:"Title (Amharic)"}),e.jsx(j,{id:"titleAm",value:r.title.am,onChange:a=>y({...r,title:{...r.title,am:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"descEn",children:"Description (English)"}),e.jsx(V,{id:"descEn",value:r.description.en,onChange:a=>y({...r,description:{...r.description,en:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"descAm",children:"Description (Amharic)"}),e.jsx(V,{id:"descAm",value:r.description.am,onChange:a=>y({...r,description:{...r.description,am:a.target.value}})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"key",children:"Key"}),e.jsx(j,{id:"key",value:r.key,onChange:a=>y({...r,key:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"order",children:"Order"}),e.jsx(j,{id:"order",type:"number",value:r.order,onChange:a=>y({...r,order:Number(a.target.value)})})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"type",children:"Type"}),e.jsxs("select",{id:"type",value:r.type,onChange:a=>y({...r,type:a.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-md px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:[e.jsx("option",{value:"individual",children:"Individual"}),e.jsx("option",{value:"organization",children:"External Organization"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"isOptional",checked:r.isOptional,onCheckedChange:a=>y({...r,isOptional:a})}),e.jsx(l,{htmlFor:"isOptional",children:"Optional"})]}),e.jsx(T,{onClick:k,disabled:c,className:"bg-primary hover:bg-primary/90 text-primary-foreground w-full",children:c?"Saving...":"Save Requirement"})]})]})]})]}),e.jsx(re,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border border-gray-200 dark:border-gray-700 text-sm",children:[e.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Title (EN)"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Title (AM)"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Key"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Order"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Type"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Active"}),e.jsx("th",{className:"p-2 border border-gray-200 dark:border-gray-700",children:"Optional"})]})}),e.jsx("tbody",{children:x==null?void 0:x.items.map(a=>e.jsxs("tr",{className:"text-center dark:text-gray-200",children:[e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.title.en}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.title.am}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.key}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.order}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.type}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.isActive?"✅":"❌"}),e.jsx("td",{className:"p-2 border border-gray-200 dark:border-gray-700",children:a.isOptional?"✅":"❌"})]},a.id))})]})})})]})})]})}export{na as default}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BJECajc_.js b/apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BJECajc_.js deleted file mode 100644 index 485100d90..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BJECajc_.js +++ /dev/null @@ -1 +0,0 @@ -import{K as S,N as x,V as h,j as f,Q as N,W as R,Y as g,X as a}from"./index-Db-xuq0b.js";var l={root:"m_18320242","skeleton-fade":"m_299c329c"};const j={visible:!0,animate:!0},_=R((r,{width:o,height:s,radius:e,circle:t})=>({root:{"--skeleton-height":a(s),"--skeleton-width":t?a(s):a(o),"--skeleton-radius":t?"1000px":e===void 0?void 0:g(e)}})),n=S((r,o)=>{const s=x("Skeleton",j,r),{classNames:e,className:t,style:i,styles:c,unstyled:m,vars:d,width:b,height:w,circle:P,visible:u,radius:V,animate:p,mod:v,...k}=s,y=h({name:"Skeleton",classes:l,props:s,className:t,style:i,classNames:e,styles:c,unstyled:m,vars:d,varsResolver:_});return f.jsx(N,{ref:o,...y("root"),mod:[{visible:u,animate:p},v],...k})});n.classes=l;n.displayName="@mantine/core/Skeleton";export{n as S}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BOu0YqbY.js b/apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BOu0YqbY.js deleted file mode 100644 index 972b34e1c..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/Skeleton-BOu0YqbY.js +++ /dev/null @@ -1 +0,0 @@ -import{K as S,N as x,V as h,j as f,Q as N,W as R,Y as g,X as a}from"./index-7T7TTikv.js";var l={root:"m_18320242","skeleton-fade":"m_299c329c"};const j={visible:!0,animate:!0},_=R((r,{width:o,height:s,radius:e,circle:t})=>({root:{"--skeleton-height":a(s),"--skeleton-width":t?a(s):a(o),"--skeleton-radius":t?"1000px":e===void 0?void 0:g(e)}})),n=S((r,o)=>{const s=x("Skeleton",j,r),{classNames:e,className:t,style:i,styles:c,unstyled:m,vars:d,width:b,height:w,circle:P,visible:u,radius:V,animate:p,mod:v,...k}=s,y=h({name:"Skeleton",classes:l,props:s,className:t,style:i,classNames:e,styles:c,unstyled:m,vars:d,varsResolver:_});return f.jsx(N,{ref:o,...y("root"),mod:[{visible:u,animate:p},v],...k})});n.classes=l;n.displayName="@mantine/core/Skeleton";export{n as S}; diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-BQ86seID.css b/apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-BQ86seID.css deleted file mode 100644 index be3c64223..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-BQ86seID.css +++ /dev/null @@ -1 +0,0 @@ -.rdp{--rdp-cell-size: 40px;--rdp-caption-font-size: 18px;--rdp-accent-color: #0000ff;--rdp-background-color: #e7edff;--rdp-accent-color-dark: #3003e1;--rdp-background-color-dark: #180270;--rdp-outline: 2px solid var(--rdp-accent-color);--rdp-outline-selected: 3px solid var(--rdp-accent-color);--rdp-selected-color: #fff;margin:1em}.rdp-vhidden{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;position:absolute!important;top:0;width:1px!important;height:1px!important;padding:0!important;overflow:hidden!important;clip:rect(1px,1px,1px,1px)!important;border:0!important}.rdp-button_reset{appearance:none;position:relative;margin:0;padding:0;cursor:default;color:inherit;background:none;font:inherit;-moz-appearance:none;-webkit-appearance:none}.rdp-button_reset:focus-visible{outline:none}.rdp-button{border:2px solid transparent}.rdp-button[disabled]:not(.rdp-day_selected){opacity:.25}.rdp-button:not([disabled]){cursor:pointer}.rdp-button:focus-visible:not([disabled]){color:inherit;background-color:var(--rdp-background-color);border:var(--rdp-outline)}.rdp-button:hover:not([disabled]):not(.rdp-day_selected){background-color:var(--rdp-background-color)}.rdp-months{display:flex}.rdp-month{margin:0 1em}.rdp-month:first-child{margin-left:0}.rdp-month:last-child{margin-right:0}.rdp-table{margin:0;max-width:calc(var(--rdp-cell-size) * 7);border-collapse:collapse}.rdp-with_weeknumber .rdp-table{max-width:calc(var(--rdp-cell-size) * 8);border-collapse:collapse}.rdp-caption{display:flex;align-items:center;justify-content:space-between;padding:0;text-align:left}.rdp-multiple_months .rdp-caption{position:relative;display:block;text-align:center}.rdp-caption_dropdowns{position:relative;display:inline-flex}.rdp-caption_label{position:relative;z-index:1;display:inline-flex;align-items:center;margin:0;padding:0 .25em;white-space:nowrap;color:currentColor;border:0;border:2px solid transparent;font-family:inherit;font-size:var(--rdp-caption-font-size);font-weight:700}.rdp-nav{white-space:nowrap}.rdp-multiple_months .rdp-caption_start .rdp-nav{position:absolute;top:50%;left:0;transform:translateY(-50%)}.rdp-multiple_months .rdp-caption_end .rdp-nav{position:absolute;top:50%;right:0;transform:translateY(-50%)}.rdp-nav_button{display:inline-flex;align-items:center;justify-content:center;width:var(--rdp-cell-size);height:var(--rdp-cell-size);padding:.25em;border-radius:100%}.rdp-dropdown_year,.rdp-dropdown_month{position:relative;display:inline-flex;align-items:center}.rdp-dropdown{-webkit-appearance:none;-moz-appearance:none;appearance:none;position:absolute;z-index:2;top:0;bottom:0;left:0;width:100%;margin:0;padding:0;cursor:inherit;opacity:0;border:none;background-color:transparent;font-family:inherit;font-size:inherit;line-height:inherit}.rdp-dropdown[disabled]{opacity:unset;color:unset}.rdp-dropdown:focus-visible:not([disabled])+.rdp-caption_label{background-color:var(--rdp-background-color);border:var(--rdp-outline);border-radius:6px}.rdp-dropdown_icon{margin:0 0 0 5px}.rdp-head{border:0}.rdp-head_row,.rdp-row{height:100%}.rdp-head_cell{vertical-align:middle;font-size:.75em;font-weight:700;text-align:center;height:100%;height:var(--rdp-cell-size);padding:0;text-transform:uppercase}.rdp-tbody{border:0}.rdp-tfoot{margin:.5em}.rdp-cell{width:var(--rdp-cell-size);height:100%;height:var(--rdp-cell-size);padding:0;text-align:center}.rdp-weeknumber{font-size:.75em}.rdp-weeknumber,.rdp-day{display:flex;overflow:hidden;align-items:center;justify-content:center;box-sizing:border-box;width:var(--rdp-cell-size);max-width:var(--rdp-cell-size);height:var(--rdp-cell-size);margin:0;border:2px solid transparent;border-radius:100%}.rdp-day_today:not(.rdp-day_outside){font-weight:700}.rdp-day_selected,.rdp-day_selected:focus-visible,.rdp-day_selected:hover{color:var(--rdp-selected-color);opacity:1;background-color:var(--rdp-accent-color)}.rdp-day_outside{opacity:.5}.rdp-day_selected:focus-visible{outline:var(--rdp-outline);outline-offset:2px;z-index:1}.rdp:not([dir=rtl]) .rdp-day_range_start:not(.rdp-day_range_end){border-top-right-radius:0;border-bottom-right-radius:0}.rdp:not([dir=rtl]) .rdp-day_range_end:not(.rdp-day_range_start){border-top-left-radius:0;border-bottom-left-radius:0}.rdp[dir=rtl] .rdp-day_range_start:not(.rdp-day_range_end){border-top-left-radius:0;border-bottom-left-radius:0}.rdp[dir=rtl] .rdp-day_range_end:not(.rdp-day_range_start){border-top-right-radius:0;border-bottom-right-radius:0}.rdp-day_range_end.rdp-day_range_start{border-radius:100%}.rdp-day_range_middle{border-radius:0}.calendars{background-color:#fff;color:#222;border:1px solid #4297d7;-moz-border-radius:.25em;-webkit-border-radius:.25em;border-radius:.25em;font-family:Arial,Helvetica,Sans-serif;font-size:90%}.calendars-rtl{direction:rtl}.calendars-popup{z-index:1000}.calendars-disable{position:absolute;z-index:100;background-color:#fff;opacity:.5;filter:alpha(opacity=50)}.calendars a{color:#222;text-decoration:none}.calendars a.calendars-disabled{color:#888;cursor:auto}.calendars button{margin:.25em;padding:.125em 0;background-color:#5c9ccc;color:#fff;border:none;-moz-border-radius:.25em;-webkit-border-radius:.25em;border-radius:.25em;font-weight:700}.calendars-nav,.calendars-ctrl{float:left;width:100%;background-color:#fff;font-size:90%;font-weight:700}.calendars-ctrl{background-color:#d0e5f5}.calendars-cmd{width:30%}.calendars-cmd:hover{background-color:#dfeffc}button.calendars-cmd:hover{background-color:#79b7e7}.calendars-cmd-prevJump,.calendars-cmd-nextJump{width:8%}a.calendars-cmd{height:1.5em}button.calendars-cmd{text-align:center}.calendars-cmd-prev,.calendars-cmd-prevJump,.calendars-cmd-clear{float:left;padding-left:2%}.calendars-cmd-current,.calendars-cmd-today{float:left;width:35%;text-align:center}.calendars-cmd-next,.calendars-cmd-nextJump,.calendars-cmd-close{float:right;padding-right:2%;text-align:right}.calendars-rtl .calendars-cmd-prev,.calendars-rtl .calendars-cmd-prevJump,.calendars-rtl .calendars-cmd-clear{float:right;padding-left:0%;padding-right:2%;text-align:right}.calendars-rtl .calendars-cmd-current,.calendars-rtl .calendars-cmd-today{float:right}.calendars-rtl .calendars-cmd-next,.calendars-rtl .calendars-cmd-nextJump,.calendars-rtl .calendars-cmd-close{float:left;padding-left:2%;padding-right:0%;text-align:left}.calendars-month-nav{float:left;text-align:center}.calendars-month-nav div{float:left;width:12.5%;margin:1%;padding:1%}.calendars-month-nav span{color:#888}.calendars-month-row{clear:left}.calendars-month{float:left;width:15em;border:1px solid #5c9ccc;text-align:center}.calendars-month-header,.calendars-month-header select,.calendars-month-header input{height:1.5em;background-color:#5c9ccc;color:#fff;font-weight:700}.calendars-month-header select,.calendars-month-header input{height:1.4em;border:none}.calendars-month-header input{position:absolute;display:none}.calendars-month table{width:100%;border-collapse:collapse}.calendars-month thead{border-bottom:1px solid #aaa}.calendars-month th,.calendars-month td{margin:0;padding:0;font-weight:400;text-align:center}.calendars-month th{border:1px solid #fff;border-bottom:1px solid #c5dbec}.calendars-month td{border:1px solid #c5dbec}.calendars-month td.calendars-week *{background-color:#d0e5f5;color:#222;border:none}.calendars-month a{display:block;width:100%;padding:.125em 0;background-color:#dfeffc;color:#000;text-decoration:none}.calendars-month span{display:block;width:100%;padding:.125em 0}.calendars-month td span{color:#888}.calendars-month td .calendars-other-month{background-color:#fff}.calendars-month td .calendars-today{background-color:#fad42e}.calendars-month td .calendars-highlight{background-color:#79b7e7}.calendars-month td .calendars-selected{background-color:#4297d7;color:#fff}.calendars-status{clear:both;text-align:center}.calendars-clear-fix{clear:both}.ethiopian-picker-surface .calendars{width:100%!important;border:0;border-radius:.5rem;color:#1f2937;font-family:inherit;font-size:.875rem;box-shadow:none}.ethiopian-picker-surface .calendars-nav,.ethiopian-picker-surface .calendars-ctrl{background:transparent;border-bottom:1px solid rgb(229 231 235);padding:.35rem .4rem}.ethiopian-picker-surface .calendars-month{width:100%;border:0}.ethiopian-picker-surface .calendars-month-header,.ethiopian-picker-surface .calendars-month-header select,.ethiopian-picker-surface .calendars-month-header input{height:2.1rem;background:transparent;color:#111827;font-weight:600}.ethiopian-picker-surface .calendars-month th,.ethiopian-picker-surface .calendars-month td{border:0;padding:.2rem}.ethiopian-picker-surface .calendars-month th{color:#6b7280;font-weight:500;font-size:.75rem}.ethiopian-picker-surface .calendars-month a,.ethiopian-picker-surface .calendars-month span{border-radius:.35rem;background:transparent;color:#111827;padding:.38rem 0}.ethiopian-picker-surface .calendars-month a:hover,.ethiopian-picker-surface .calendars-month td .calendars-today{background:#dcfce7;color:#166534}.ethiopian-picker-surface .calendars-month td .calendars-selected{background:#22c55e;color:#fff}.ethiopian-picker-surface .calendars-month td .calendars-other-month{color:#9ca3af}.ethiopian-picker-surface .calendars-nav .calendars-cmd-prev,.ethiopian-picker-surface .calendars-nav .calendars-cmd-next,.ethiopian-picker-surface .calendars-nav .calendars-cmd-prevJump,.ethiopian-picker-surface .calendars-nav .calendars-cmd-nextJump,.calendars-popup .calendars-nav .calendars-cmd-prev,.calendars-popup .calendars-nav .calendars-cmd-next,.calendars-popup .calendars-nav .calendars-cmd-prevJump,.calendars-popup .calendars-nav .calendars-cmd-nextJump{display:inline-flex;align-items:center;justify-content:center;min-width:2rem;height:2rem;border:1px solid rgb(187 247 208);border-radius:.5rem;background:#f0fdf4;color:#15803d;line-height:1;transition:all .2s ease}.ethiopian-picker-surface .calendars-nav .calendars-cmd-prev:hover,.ethiopian-picker-surface .calendars-nav .calendars-cmd-next:hover,.ethiopian-picker-surface .calendars-nav .calendars-cmd-prevJump:hover,.ethiopian-picker-surface .calendars-nav .calendars-cmd-nextJump:hover,.calendars-popup .calendars-nav .calendars-cmd-prev:hover,.calendars-popup .calendars-nav .calendars-cmd-next:hover,.calendars-popup .calendars-nav .calendars-cmd-prevJump:hover,.calendars-popup .calendars-nav .calendars-cmd-nextJump:hover{background:#22c55e;border-color:#22c55e;color:#fff}.ethiopian-picker-surface .calendars-nav,.calendars-popup .calendars-nav{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.ethiopian-picker-surface .calendars-nav .calendars-cmd,.calendars-popup .calendars-nav .calendars-cmd{float:none;width:auto;padding-left:0;padding-right:0}.ethiopian-picker-surface .calendars-nav .calendars-cmd-today,.calendars-popup .calendars-nav .calendars-cmd-today{flex:1;border-radius:.5rem;color:#15803d;font-weight:600;text-align:center}.ethiopian-picker-surface .calendars-nav .calendars-cmd.calendars-disabled,.calendars-popup .calendars-nav .calendars-cmd.calendars-disabled{opacity:.45;cursor:not-allowed}.dark .ethiopian-picker-surface .calendars,[data-theme=dark] .ethiopian-picker-surface .calendars,.dark .calendars-popup .calendars,[data-theme=dark] .calendars-popup .calendars{background:#111827;color:#e5e7eb;border-color:#374151}.dark .ethiopian-picker-surface .calendars-nav,.dark .ethiopian-picker-surface .calendars-ctrl,[data-theme=dark] .ethiopian-picker-surface .calendars-nav,[data-theme=dark] .ethiopian-picker-surface .calendars-ctrl,.dark .calendars-popup .calendars-nav,.dark .calendars-popup .calendars-ctrl,[data-theme=dark] .calendars-popup .calendars-nav,[data-theme=dark] .calendars-popup .calendars-ctrl{background:#111827;border-color:#374151}.dark .ethiopian-picker-surface .calendars-month-header,.dark .ethiopian-picker-surface .calendars-month-header select,.dark .ethiopian-picker-surface .calendars-month-header input,.dark .ethiopian-picker-surface .calendars-month a,.dark .ethiopian-picker-surface .calendars-month span,[data-theme=dark] .ethiopian-picker-surface .calendars-month-header,[data-theme=dark] .ethiopian-picker-surface .calendars-month-header select,[data-theme=dark] .ethiopian-picker-surface .calendars-month-header input,[data-theme=dark] .ethiopian-picker-surface .calendars-month a,[data-theme=dark] .ethiopian-picker-surface .calendars-month span,.dark .calendars-popup .calendars-month-header,.dark .calendars-popup .calendars-month-header select,.dark .calendars-popup .calendars-month-header input,.dark .calendars-popup .calendars-month a,.dark .calendars-popup .calendars-month span,[data-theme=dark] .calendars-popup .calendars-month-header,[data-theme=dark] .calendars-popup .calendars-month-header select,[data-theme=dark] .calendars-popup .calendars-month-header input,[data-theme=dark] .calendars-popup .calendars-month a,[data-theme=dark] .calendars-popup .calendars-month span{color:#e5e7eb}.dark .ethiopian-picker-surface .calendars-month th,[data-theme=dark] .ethiopian-picker-surface .calendars-month th,.dark .calendars-popup .calendars-month th,[data-theme=dark] .calendars-popup .calendars-month th{color:#9ca3af}.dark .ethiopian-picker-surface .calendars-month a:hover,[data-theme=dark] .ethiopian-picker-surface .calendars-month a:hover,.dark .calendars-popup .calendars-month a:hover,[data-theme=dark] .calendars-popup .calendars-month a:hover,.dark .ethiopian-picker-surface .calendars-month td .calendars-today,[data-theme=dark] .ethiopian-picker-surface .calendars-month td .calendars-today,.dark .calendars-popup .calendars-month td .calendars-today,[data-theme=dark] .calendars-popup .calendars-month td .calendars-today{background:#14532d;color:#bbf7d0}.dark .ethiopian-picker-surface .calendars-month td .calendars-highlight,[data-theme=dark] .ethiopian-picker-surface .calendars-month td .calendars-highlight,.dark .calendars-popup .calendars-month td .calendars-highlight,[data-theme=dark] .calendars-popup .calendars-month td .calendars-highlight{background:#166534}.dark .ethiopian-picker-surface .calendars-month td .calendars-selected,[data-theme=dark] .ethiopian-picker-surface .calendars-month td .calendars-selected,.dark .calendars-popup .calendars-month td .calendars-selected,[data-theme=dark] .calendars-popup .calendars-month td .calendars-selected{background:#22c55e;color:#052e16}.dark .ethiopian-picker-surface .calendars-month td .calendars-other-month,[data-theme=dark] .ethiopian-picker-surface .calendars-month td .calendars-other-month,.dark .calendars-popup .calendars-month td .calendars-other-month,[data-theme=dark] .calendars-popup .calendars-month td .calendars-other-month{color:#6b7280}.dark .ethiopian-picker-surface .calendars a.calendars-disabled,[data-theme=dark] .ethiopian-picker-surface .calendars a.calendars-disabled,.dark .calendars-popup .calendars a.calendars-disabled,[data-theme=dark] .calendars-popup .calendars a.calendars-disabled{color:#4b5563}.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-prev,.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-next,.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-prevJump,.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-nextJump,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-prev,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-next,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-prevJump,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-nextJump,.dark .calendars-popup .calendars-nav .calendars-cmd-prev,.dark .calendars-popup .calendars-nav .calendars-cmd-next,.dark .calendars-popup .calendars-nav .calendars-cmd-prevJump,.dark .calendars-popup .calendars-nav .calendars-cmd-nextJump,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-prev,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-next,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-prevJump,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-nextJump{background:#15803d38;border-color:#22c55e73;color:#bbf7d0}.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-prev:hover,.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-next:hover,.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-prevJump:hover,.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-nextJump:hover,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-prev:hover,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-next:hover,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-prevJump:hover,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-nextJump:hover,.dark .calendars-popup .calendars-nav .calendars-cmd-prev:hover,.dark .calendars-popup .calendars-nav .calendars-cmd-next:hover,.dark .calendars-popup .calendars-nav .calendars-cmd-prevJump:hover,.dark .calendars-popup .calendars-nav .calendars-cmd-nextJump:hover,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-prev:hover,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-next:hover,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-prevJump:hover,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-nextJump:hover{background:#22c55e;border-color:#22c55e;color:#052e16}.dark .ethiopian-picker-surface .calendars-nav .calendars-cmd-today,[data-theme=dark] .ethiopian-picker-surface .calendars-nav .calendars-cmd-today,.dark .calendars-popup .calendars-nav .calendars-cmd-today,[data-theme=dark] .calendars-popup .calendars-nav .calendars-cmd-today{color:#bbf7d0} diff --git a/apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-DLN72875.js b/apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-DLN72875.js deleted file mode 100644 index 29575c2bb..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/assets/SmartOfficeAuditPage-DLN72875.js +++ /dev/null @@ -1,35 +0,0 @@ -import{y as createLucideIcon,u as useTranslation,j as jsxRuntimeExports,aO as Clock,F as FileText,U as User,bn as Settings,b6 as Trash2,z as Upload,r as reactExports,b8 as cn,b9 as buttonVariants,aU as getDefaultExportFromCjs,B as Button$1,aS as X,I as Input,bs as CircleCheckBig,aK as Dialog,aL as DialogContent,aM as DialogHeader,aN as DialogTitle,bo as DialogDescription,bt as FileSpreadsheet,ba as DialogFooter,be as axios,p as api,bu as AUDITLOG_API_URL,t as toast,bf as getRefreshToken,aR as instance}from"./index-Db-xuq0b.js";import{C as Card,d as CardContent,a as CardHeader,b as CardTitle,c as CardDescription}from"./card-BBWyxDss.js";import{T as Table$1,a as TableHeader,b as TableRow,c as TableHead,d as TableBody,e as TableCell}from"./table-D3n3VABd.js";import{B as Badge}from"./badge-D7JvaQeJ.js";import{A as Avatar,c as AvatarImage,a as AvatarFallback}from"./avatar-C2-XEZ4v.js";import{s as startOfDay,a as startOfWeek,f as format,d as differenceInCalendarDays,b as startOfYear,c as startOfISOWeek,g as getISOWeek,e as getWeek,i as isDate}from"./format-DvwV82px.js";import{S as Shield}from"./shield-uC_usZTb.js";import{L as Lock}from"./lock-BCybB-Lq.js";import{E as Eye}from"./eye-Bhud4znU.js";import{S as SquarePen}from"./square-pen-B91TPB19.js";import{D as Download}from"./download-CX6rsOqt.js";import{S as Select,a as SelectTrigger,b as SelectValue,c as SelectContent,d as SelectItem}from"./select-BoQxM42A.js";import{P as Popover,a as PopoverTrigger,b as PopoverContent}from"./popover-X-j_SRnG.js";import{t as toDate,c as constructFrom,g as getTimezoneOffsetInMilliseconds,m as millisecondsInWeek,a as getDefaultOptions,e as enUS}from"./en-US-Cc-9gH5A.js";import{e as endOfMonth,d as differenceInCalendarMonths}from"./endOfMonth-DmxQbzXi.js";import{S as Search}from"./search-CM5F2ZRy.js";import{L as Label}from"./label-CsFy6wpo.js";import{R as RadioGroup,a as RadioGroupItem}from"./radio-group-DqG5gUnT.js";import{C as Checkbox}from"./checkbox-Dd0VhnrO.js";import{R as RefreshCw}from"./refresh-cw-JB7N413f.js";import{E as EyeOff}from"./eye-off-CDMvHElM.js";/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const __iconNode$2=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Activity=createLucideIcon("activity",__iconNode$2);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const __iconNode$1=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Calendar$1=createLucideIcon("calendar",__iconNode$1);/** - * @license lucide-react v0.513.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const __iconNode=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],TrendingUp=createLucideIcon("trending-up",__iconNode);function addDays(r,o){const c=toDate(r);return isNaN(o)?constructFrom(r,NaN):(o&&c.setDate(c.getDate()+o),c)}function addMonths(r,o){const c=toDate(r);if(isNaN(o))return constructFrom(r,NaN);if(!o)return c;const n=c.getDate(),a=constructFrom(r,c.getTime());a.setMonth(c.getMonth()+o+1,0);const s=a.getDate();return n>=s?a:(c.setFullYear(a.getFullYear(),a.getMonth(),n),c)}function addWeeks(r,o){const c=o*7;return addDays(r,c)}function addYears(r,o){return addMonths(r,o*12)}function max(r){let o;return r.forEach(function(c){const n=toDate(c);(o===void 0||o{const n=toDate(c);(!o||o>n||isNaN(+n))&&(o=n)}),o||new Date(NaN)}function isSameDay(r,o){const c=startOfDay(r),n=startOfDay(o);return+c==+n}function differenceInCalendarWeeks(r,o,c){const n=startOfWeek(r,c),a=startOfWeek(o,c),s=+n-getTimezoneOffsetInMilliseconds(n),d=+a-getTimezoneOffsetInMilliseconds(a);return Math.round((s-d)/millisecondsInWeek)}function startOfMonth(r){const o=toDate(r);return o.setDate(1),o.setHours(0,0,0,0),o}function endOfWeek(r,o){var p,m,g,j;const c=getDefaultOptions(),n=(o==null?void 0:o.weekStartsOn)??((m=(p=o==null?void 0:o.locale)==null?void 0:p.options)==null?void 0:m.weekStartsOn)??c.weekStartsOn??((j=(g=c.locale)==null?void 0:g.options)==null?void 0:j.weekStartsOn)??0,a=toDate(r),s=a.getDay(),d=(sn.getTime()}function isBefore(r,o){const c=toDate(r),n=toDate(o);return+c<+n}function isSameMonth(r,o){const c=toDate(r),n=toDate(o);return c.getFullYear()===n.getFullYear()&&c.getMonth()===n.getMonth()}function isSameYear(r,o){const c=toDate(r),n=toDate(o);return c.getFullYear()===n.getFullYear()}function subDays(r,o){return addDays(r,-o)}function setMonth(r,o){const c=toDate(r),n=c.getFullYear(),a=c.getDate(),s=constructFrom(r,0);s.setFullYear(n,o,15),s.setHours(0,0,0,0);const d=getDaysInMonth(s);return c.setMonth(o,Math.min(a,d)),c}function setYear(r,o){const c=toDate(r);return isNaN(+c)?constructFrom(r,NaN):(c.setFullYear(o),c)}const getModuleIcon=r=>{switch(r.toLowerCase()){case"authentication":return jsxRuntimeExports.jsx(Shield,{className:"h-4 w-4"});case"documents":case"files":return jsxRuntimeExports.jsx(FileText,{className:"h-4 w-4"});case"settings":return jsxRuntimeExports.jsx(Settings,{className:"h-4 w-4"});case"users":return jsxRuntimeExports.jsx(User,{className:"h-4 w-4"});default:return jsxRuntimeExports.jsx(FileText,{className:"h-4 w-4"})}},getActionIcon=r=>{switch(r.toLowerCase()){case"upload":return jsxRuntimeExports.jsx(Upload,{className:"h-4 w-4"});case"download":return jsxRuntimeExports.jsx(Download,{className:"h-4 w-4"});case"edit":case"update":return jsxRuntimeExports.jsx(SquarePen,{className:"h-4 w-4"});case"delete":return jsxRuntimeExports.jsx(Trash2,{className:"h-4 w-4"});case"view":return jsxRuntimeExports.jsx(Eye,{className:"h-4 w-4"});case"login":return jsxRuntimeExports.jsx(Lock,{className:"h-4 w-4"});default:return jsxRuntimeExports.jsx(FileText,{className:"h-4 w-4"})}},getStatusColor=r=>{switch(r){case"success":return"bg-primary-100 dark:bg-primary-900/40 text-primary-800 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/40 border-primary-300 dark:border-primary-700";case"failure":return"bg-red-100 dark:bg-red-900/40 text-red-800 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/40 border-red-300 dark:border-red-700";case"warning":return"bg-yellow-100 dark:bg-yellow-900/40 text-yellow-800 dark:text-yellow-300 hover:bg-yellow-100 dark:hover:bg-yellow-900/40 border-yellow-300 dark:border-yellow-700";case"pending":return"bg-primary/15 dark:bg-primary/25 text-primary-800 dark:text-primary-300 hover:bg-primary/15 dark:hover:bg-primary/25 border-primary/40 dark:border-primary/60";default:return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 border-gray-300 dark:border-gray-600"}};function ActivityCard({activity:r}){const{t:o}=useTranslation(),c=format(new Date(r.timestamp),"MMM d, yyyy HH:mm:ss");return jsxRuntimeExports.jsx(Card,{className:"hover:shadow-md transition-shadow duration-200 border-gray-200 dark:border-gray-700 dark:bg-gray-800",children:jsxRuntimeExports.jsx(CardContent,{className:"p-4",children:jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-4",children:[jsxRuntimeExports.jsxs("div",{className:"relative",children:[jsxRuntimeExports.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center",children:getModuleIcon(r.module)}),jsxRuntimeExports.jsx("div",{className:"absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 flex items-center justify-center",children:getActionIcon(r.action)})]}),jsxRuntimeExports.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:r.description}),jsxRuntimeExports.jsx(Badge,{variant:"outline",className:`text-xs font-medium ${getStatusColor(r.status)}`,children:o(`auditLogShared.status.${r.status}`)})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap",children:[jsxRuntimeExports.jsx(Clock,{className:"h-3 w-3"}),c]})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsxs(Avatar,{className:"h-5 w-5",children:[r.performedBy.avatar&&jsxRuntimeExports.jsx(AvatarImage,{src:r.performedBy.avatar}),jsxRuntimeExports.jsx(AvatarFallback,{className:"text-xs",children:r.performedBy.name.charAt(0).toUpperCase()})]}),jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:r.performedBy.name}),jsxRuntimeExports.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"•"}),jsxRuntimeExports.jsx("span",{children:r.performedBy.email})]}),r.resourceName&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"•"}),jsxRuntimeExports.jsx("span",{className:"truncate max-w-[200px]",children:r.resourceName})]})]}),(r.details||r.ipAddress||r.location)&&jsxRuntimeExports.jsx("div",{className:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-700",children:jsxRuntimeExports.jsxs("div",{className:"flex flex-wrap gap-4 text-xs text-gray-500 dark:text-gray-400",children:[r.details&&jsxRuntimeExports.jsx("div",{className:"max-w-[300px] truncate",title:r.details,children:r.details}),r.ipAddress&&jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsxs("span",{children:[o("auditLogShared.labels.ip"),":"]}),jsxRuntimeExports.jsx("span",{className:"font-mono",children:r.ipAddress})]}),r.location&&jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("span",{children:"📍"}),jsxRuntimeExports.jsx("span",{children:r.location})]})]})})]})]})})})}var __assign=function(){return __assign=Object.assign||function(o){for(var c,n=1,a=arguments.length;n1&&(m||!g),k=o>1&&(g||!m),_=function(){n&&s(n)},T=function(){a&&s(a)};return jsxRuntimeExports.jsx(Navigation,{displayMonth:r.displayMonth,hideNext:j,hidePrevious:k,nextMonth:a,previousMonth:n,onPreviousClick:_,onNextClick:T})}function Caption(r){var o,c=useDayPicker(),n=c.classNames,a=c.disableNavigation,s=c.styles,d=c.captionLayout,p=c.components,m=(o=p==null?void 0:p.CaptionLabel)!==null&&o!==void 0?o:CaptionLabel,g;return a?g=jsxRuntimeExports.jsx(m,{id:r.id,displayMonth:r.displayMonth}):d==="dropdown"?g=jsxRuntimeExports.jsx(CaptionDropdowns,{displayMonth:r.displayMonth,id:r.id}):d==="dropdown-buttons"?g=jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(CaptionDropdowns,{displayMonth:r.displayMonth,displayIndex:r.displayIndex,id:r.id}),jsxRuntimeExports.jsx(CaptionNavigation,{displayMonth:r.displayMonth,displayIndex:r.displayIndex,id:r.id})]}):g=jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(m,{id:r.id,displayMonth:r.displayMonth,displayIndex:r.displayIndex}),jsxRuntimeExports.jsx(CaptionNavigation,{displayMonth:r.displayMonth,id:r.id})]}),jsxRuntimeExports.jsx("div",{className:n.caption,style:s.caption,children:g})}function Footer(r){var o=useDayPicker(),c=o.footer,n=o.styles,a=o.classNames.tfoot;return c?jsxRuntimeExports.jsx("tfoot",{className:a,style:n.tfoot,children:jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsx("td",{colSpan:8,children:c})})}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function getWeekdays(r,o,c){for(var n=c?startOfISOWeek(new Date):startOfWeek(new Date,{locale:r,weekStartsOn:o}),a=[],s=0;s<7;s++){var d=addDays(n,s);a.push(d)}return a}function HeadRow(){var r=useDayPicker(),o=r.classNames,c=r.styles,n=r.showWeekNumber,a=r.locale,s=r.weekStartsOn,d=r.ISOWeek,p=r.formatters.formatWeekdayName,m=r.labels.labelWeekday,g=getWeekdays(a,s,d);return jsxRuntimeExports.jsxs("tr",{style:c.head_row,className:o.head_row,children:[n&&jsxRuntimeExports.jsx("td",{style:c.head_cell,className:o.head_cell}),g?.map(function(j,k){return jsxRuntimeExports.jsx("th",{scope:"col",className:o.head_cell,style:c.head_cell,"aria-label":m(j,{locale:a}),children:p(j,{locale:a})},k)})]})}function Head(){var r,o=useDayPicker(),c=o.classNames,n=o.styles,a=o.components,s=(r=a==null?void 0:a.HeadRow)!==null&&r!==void 0?r:HeadRow;return jsxRuntimeExports.jsx("thead",{style:n.head,className:c.head,children:jsxRuntimeExports.jsx(s,{})})}function DayContent(r){var o=useDayPicker(),c=o.locale,n=o.formatters.formatDay;return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:n(r.date,{locale:c})})}var SelectMultipleContext=reactExports.createContext(void 0);function SelectMultipleProvider(r){if(!isDayPickerMultiple(r.initialProps)){var o={selected:void 0,modifiers:{disabled:[]}};return jsxRuntimeExports.jsx(SelectMultipleContext.Provider,{value:o,children:r.children})}return jsxRuntimeExports.jsx(SelectMultipleProviderInternal,{initialProps:r.initialProps,children:r.children})}function SelectMultipleProviderInternal(r){var o=r.initialProps,c=r.children,n=o.selected,a=o.min,s=o.max,d=function(g,j,k){var _,T;(_=o.onDayClick)===null||_===void 0||_.call(o,g,j,k);var E=!!(j.selected&&a&&(n==null?void 0:n.length)===a);if(!E){var M=!!(!j.selected&&s&&(n==null?void 0:n.length)===s);if(!M){var P=n?__spreadArray([],n):[];if(j.selected){var A=P.findIndex(function(H){return isSameDay(g,H)});P.splice(A,1)}else P.push(g);(T=o.onSelect)===null||T===void 0||T.call(o,P,g,j,k)}}},p={disabled:[]};n&&p.disabled.push(function(g){var j=s&&n.length>s-1,k=n?.some(function(_){return isSameDay(_,g)});return!!(j&&!k)});var m={selected:n,onDayClick:d,modifiers:p};return jsxRuntimeExports.jsx(SelectMultipleContext.Provider,{value:m,children:c})}function useSelectMultiple(){var r=reactExports.useContext(SelectMultipleContext);if(!r)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return r}function addToRange(r,o){var c=o||{},n=c.from,a=c.to;return n&&a?isSameDay(a,r)&&isSameDay(n,r)?void 0:isSameDay(a,r)?{from:a,to:void 0}:isSameDay(n,r)?void 0:isAfter(n,r)?{from:r,to:a}:{from:n,to:r}:a?isAfter(r,a)?{from:a,to:r}:{from:r,to:a}:n?isBefore(r,n)?{from:r,to:n}:{from:n,to:r}:{from:r,to:void 0}}var SelectRangeContext=reactExports.createContext(void 0);function SelectRangeProvider(r){if(!isDayPickerRange(r.initialProps)){var o={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return jsxRuntimeExports.jsx(SelectRangeContext.Provider,{value:o,children:r.children})}return jsxRuntimeExports.jsx(SelectRangeProviderInternal,{initialProps:r.initialProps,children:r.children})}function SelectRangeProviderInternal(r){var o=r.initialProps,c=r.children,n=o.selected,a=n||{},s=a.from,d=a.to,p=o.min,m=o.max,g=function(T,E,M){var P,A;(P=o.onDayClick)===null||P===void 0||P.call(o,T,E,M);var H=addToRange(T,n);(A=o.onSelect)===null||A===void 0||A.call(o,H,T,E,M)},j={range_start:[],range_end:[],range_middle:[],disabled:[]};if(s?(j.range_start=[s],d?(j.range_end=[d],isSameDay(s,d)||(j.range_middle=[{after:s,before:d}])):j.range_end=[s]):d&&(j.range_start=[d],j.range_end=[d]),p&&(s&&!d&&j.disabled.push({after:subDays(s,p-1),before:addDays(s,p-1)}),s&&d&&j.disabled.push({after:s,before:addDays(s,p-1)}),!s&&d&&j.disabled.push({after:subDays(d,p-1),before:addDays(d,p-1)})),m){if(s&&!d&&(j.disabled.push({before:addDays(s,-m+1)}),j.disabled.push({after:addDays(s,m-1)})),s&&d){var k=differenceInCalendarDays(d,s)+1,_=m-k;j.disabled.push({before:subDays(s,_)}),j.disabled.push({after:addDays(d,_)})}!s&&d&&(j.disabled.push({before:addDays(d,-m+1)}),j.disabled.push({after:addDays(d,m-1)}))}return jsxRuntimeExports.jsx(SelectRangeContext.Provider,{value:{selected:n,onDayClick:g,modifiers:j},children:c})}function useSelectRange(){var r=reactExports.useContext(SelectRangeContext);if(!r)throw new Error("useSelectRange must be used within a SelectRangeProvider");return r}function matcherToArray(r){return Array.isArray(r)?__spreadArray([],r):r!==void 0?[r]:[]}function getCustomModifiers(r){var o={};return Object.entries(r).forEach(function(c){var n=c[0],a=c[1];o[n]=matcherToArray(a)}),o}var InternalModifier;(function(r){r.Outside="outside",r.Disabled="disabled",r.Selected="selected",r.Hidden="hidden",r.Today="today",r.RangeStart="range_start",r.RangeEnd="range_end",r.RangeMiddle="range_middle"})(InternalModifier||(InternalModifier={}));var Selected=InternalModifier.Selected,Disabled=InternalModifier.Disabled,Hidden=InternalModifier.Hidden,Today=InternalModifier.Today,RangeEnd=InternalModifier.RangeEnd,RangeMiddle=InternalModifier.RangeMiddle,RangeStart=InternalModifier.RangeStart,Outside=InternalModifier.Outside;function getInternalModifiers(r,o,c){var n,a=(n={},n[Selected]=matcherToArray(r.selected),n[Disabled]=matcherToArray(r.disabled),n[Hidden]=matcherToArray(r.hidden),n[Today]=[r.today],n[RangeEnd]=[],n[RangeMiddle]=[],n[RangeStart]=[],n[Outside]=[],n);return r.fromDate&&a[Disabled].push({before:r.fromDate}),r.toDate&&a[Disabled].push({after:r.toDate}),isDayPickerMultiple(r)?a[Disabled]=a[Disabled].concat(o.modifiers[Disabled]):isDayPickerRange(r)&&(a[Disabled]=a[Disabled].concat(c.modifiers[Disabled]),a[RangeStart]=c.modifiers[RangeStart],a[RangeMiddle]=c.modifiers[RangeMiddle],a[RangeEnd]=c.modifiers[RangeEnd]),a}var ModifiersContext=reactExports.createContext(void 0);function ModifiersProvider(r){var o=useDayPicker(),c=useSelectMultiple(),n=useSelectRange(),a=getInternalModifiers(o,c,n),s=getCustomModifiers(o.modifiers),d=__assign(__assign({},a),s);return jsxRuntimeExports.jsx(ModifiersContext.Provider,{value:d,children:r.children})}function useModifiers(){var r=reactExports.useContext(ModifiersContext);if(!r)throw new Error("useModifiers must be used within a ModifiersProvider");return r}function isDateInterval(r){return!!(r&&typeof r=="object"&&"before"in r&&"after"in r)}function isDateRange(r){return!!(r&&typeof r=="object"&&"from"in r)}function isDateAfterType(r){return!!(r&&typeof r=="object"&&"after"in r)}function isDateBeforeType(r){return!!(r&&typeof r=="object"&&"before"in r)}function isDayOfWeekType(r){return!!(r&&typeof r=="object"&&"dayOfWeek"in r)}function isDateInRange(r,o){var c,n=o.from,a=o.to;if(n&&a){var s=differenceInCalendarDays(a,n)<0;s&&(c=[a,n],n=c[0],a=c[1]);var d=differenceInCalendarDays(r,n)>=0&&differenceInCalendarDays(a,r)>=0;return d}return a?isSameDay(a,r):n?isSameDay(n,r):!1}function isDateType(r){return isDate(r)}function isArrayOfDates(r){return Array.isArray(r)&&r.every(isDate)}function isMatch(r,o){return o?.some(function(c){if(typeof c=="boolean")return c;if(isDateType(c))return isSameDay(r,c);if(isArrayOfDates(c))return c.includes(r);if(isDateRange(c))return isDateInRange(r,c);if(isDayOfWeekType(c))return c.dayOfWeek.includes(r.getDay());if(isDateInterval(c)){var n=differenceInCalendarDays(c.before,r),a=differenceInCalendarDays(c.after,r),s=n>0,d=a<0,p=isAfter(c.before,c.after);return p?d&&s:s||d}return isDateAfterType(c)?differenceInCalendarDays(r,c.after)>0:isDateBeforeType(c)?differenceInCalendarDays(c.before,r)>0:typeof c=="function"?c(r):!1})}function getActiveModifiers(r,o,c){var n=Object.keys(o).reduce(function(s,d){var p=o[d];return isMatch(r,p)&&s.push(d),s},[]),a={};return n.forEach(function(s){return a[s]=!0}),c&&!isSameMonth(r,c)&&(a.outside=!0),a}function getInitialFocusTarget(r,o){for(var c=startOfMonth(r[0]),n=endOfMonth(r[r.length-1]),a,s,d=c;d<=n;){var p=getActiveModifiers(d,o),m=!p.disabled&&!p.hidden;if(!m){d=addDays(d,1);continue}if(p.selected)return d;p.today&&!s&&(s=d),a||(a=d),d=addDays(d,1)}return s||a}var MAX_RETRY=365;function getNextFocus(r,o){var c=o.moveBy,n=o.direction,a=o.context,s=o.modifiers,d=o.retry,p=d===void 0?{count:0,lastFocused:r}:d,m=a.weekStartsOn,g=a.fromDate,j=a.toDate,k=a.locale,_={day:addDays,week:addWeeks,month:addMonths,year:addYears,startOfWeek:function(P){return a.ISOWeek?startOfISOWeek(P):startOfWeek(P,{locale:k,weekStartsOn:m})},endOfWeek:function(P){return a.ISOWeek?endOfISOWeek(P):endOfWeek(P,{locale:k,weekStartsOn:m})}},T=_[c](r,n==="after"?1:-1);n==="before"&&g?T=max([g,T]):n==="after"&&j&&(T=min([j,T]));var E=!0;if(s){var M=getActiveModifiers(T,s);E=!M.disabled&&!M.hidden}return E?T:p.count>MAX_RETRY?p.lastFocused:getNextFocus(T,{moveBy:c,direction:n,context:a,modifiers:s,retry:__assign(__assign({},p),{count:p.count+1})})}var FocusContext=reactExports.createContext(void 0);function FocusProvider(r){var o=useNavigation(),c=useModifiers(),n=reactExports.useState(),a=n[0],s=n[1],d=reactExports.useState(),p=d[0],m=d[1],g=getInitialFocusTarget(o.displayMonths,c),j=a??(p&&o.isDateDisplayed(p))?p:g,k=function(){m(a),s(void 0)},_=function(P){s(P)},T=useDayPicker(),E=function(P,A){if(a){var H=getNextFocus(a,{moveBy:P,direction:A,context:T,modifiers:c});isSameDay(a,H)||(o.goToDate(H,a),_(H))}},M={focusedDay:a,focusTarget:j,blur:k,focus:_,focusDayAfter:function(){return E("day","after")},focusDayBefore:function(){return E("day","before")},focusWeekAfter:function(){return E("week","after")},focusWeekBefore:function(){return E("week","before")},focusMonthBefore:function(){return E("month","before")},focusMonthAfter:function(){return E("month","after")},focusYearBefore:function(){return E("year","before")},focusYearAfter:function(){return E("year","after")},focusStartOfWeek:function(){return E("startOfWeek","before")},focusEndOfWeek:function(){return E("endOfWeek","after")}};return jsxRuntimeExports.jsx(FocusContext.Provider,{value:M,children:r.children})}function useFocusContext(){var r=reactExports.useContext(FocusContext);if(!r)throw new Error("useFocusContext must be used within a FocusProvider");return r}function useActiveModifiers(r,o){var c=useModifiers(),n=getActiveModifiers(r,c,o);return n}var SelectSingleContext=reactExports.createContext(void 0);function SelectSingleProvider(r){if(!isDayPickerSingle(r.initialProps)){var o={selected:void 0};return jsxRuntimeExports.jsx(SelectSingleContext.Provider,{value:o,children:r.children})}return jsxRuntimeExports.jsx(SelectSingleProviderInternal,{initialProps:r.initialProps,children:r.children})}function SelectSingleProviderInternal(r){var o=r.initialProps,c=r.children,n=function(s,d,p){var m,g,j;if((m=o.onDayClick)===null||m===void 0||m.call(o,s,d,p),d.selected&&!o.required){(g=o.onSelect)===null||g===void 0||g.call(o,void 0,s,d,p);return}(j=o.onSelect)===null||j===void 0||j.call(o,s,s,d,p)},a={selected:o.selected,onDayClick:n};return jsxRuntimeExports.jsx(SelectSingleContext.Provider,{value:a,children:c})}function useSelectSingle(){var r=reactExports.useContext(SelectSingleContext);if(!r)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return r}function useDayEventHandlers(r,o){var c=useDayPicker(),n=useSelectSingle(),a=useSelectMultiple(),s=useSelectRange(),d=useFocusContext(),p=d.focusDayAfter,m=d.focusDayBefore,g=d.focusWeekAfter,j=d.focusWeekBefore,k=d.blur,_=d.focus,T=d.focusMonthBefore,E=d.focusMonthAfter,M=d.focusYearBefore,P=d.focusYearAfter,A=d.focusStartOfWeek,H=d.focusEndOfWeek,Y=function(J){var K,Te,rt,nt;isDayPickerSingle(c)?(K=n.onDayClick)===null||K===void 0||K.call(n,r,o,J):isDayPickerMultiple(c)?(Te=a.onDayClick)===null||Te===void 0||Te.call(a,r,o,J):isDayPickerRange(c)?(rt=s.onDayClick)===null||rt===void 0||rt.call(s,r,o,J):(nt=c.onDayClick)===null||nt===void 0||nt.call(c,r,o,J)},se=function(J){var K;_(r),(K=c.onDayFocus)===null||K===void 0||K.call(c,r,o,J)},z=function(J){var K;k(),(K=c.onDayBlur)===null||K===void 0||K.call(c,r,o,J)},te=function(J){var K;(K=c.onDayMouseEnter)===null||K===void 0||K.call(c,r,o,J)},u=function(J){var K;(K=c.onDayMouseLeave)===null||K===void 0||K.call(c,r,o,J)},fe=function(J){var K;(K=c.onDayPointerEnter)===null||K===void 0||K.call(c,r,o,J)},ae=function(J){var K;(K=c.onDayPointerLeave)===null||K===void 0||K.call(c,r,o,J)},Ee=function(J){var K;(K=c.onDayTouchCancel)===null||K===void 0||K.call(c,r,o,J)},De=function(J){var K;(K=c.onDayTouchEnd)===null||K===void 0||K.call(c,r,o,J)},Me=function(J){var K;(K=c.onDayTouchMove)===null||K===void 0||K.call(c,r,o,J)},re=function(J){var K;(K=c.onDayTouchStart)===null||K===void 0||K.call(c,r,o,J)},U=function(J){var K;(K=c.onDayKeyUp)===null||K===void 0||K.call(c,r,o,J)},ye=function(J){var K;switch(J.key){case"ArrowLeft":J.preventDefault(),J.stopPropagation(),c.dir==="rtl"?p():m();break;case"ArrowRight":J.preventDefault(),J.stopPropagation(),c.dir==="rtl"?m():p();break;case"ArrowDown":J.preventDefault(),J.stopPropagation(),g();break;case"ArrowUp":J.preventDefault(),J.stopPropagation(),j();break;case"PageUp":J.preventDefault(),J.stopPropagation(),J.shiftKey?M():T();break;case"PageDown":J.preventDefault(),J.stopPropagation(),J.shiftKey?P():E();break;case"Home":J.preventDefault(),J.stopPropagation(),A();break;case"End":J.preventDefault(),J.stopPropagation(),H();break}(K=c.onDayKeyDown)===null||K===void 0||K.call(c,r,o,J)},ke={onClick:Y,onFocus:se,onBlur:z,onKeyDown:ye,onKeyUp:U,onMouseEnter:te,onMouseLeave:u,onPointerEnter:fe,onPointerLeave:ae,onTouchCancel:Ee,onTouchEnd:De,onTouchMove:Me,onTouchStart:re};return ke}function useSelectedDays(){var r=useDayPicker(),o=useSelectSingle(),c=useSelectMultiple(),n=useSelectRange(),a=isDayPickerSingle(r)?o.selected:isDayPickerMultiple(r)?c.selected:isDayPickerRange(r)?n.selected:void 0;return a}function isInternalModifier(r){return Object.values(InternalModifier).includes(r)}function getDayClassNames(r,o){var c=[r.classNames.day];return Object.keys(o).forEach(function(n){var a=r.modifiersClassNames[n];if(a)c.push(a);else if(isInternalModifier(n)){var s=r.classNames["day_".concat(n)];s&&c.push(s)}}),c}function getDayStyle(r,o){var c=__assign({},r.styles.day);return Object.keys(o).forEach(function(n){var a;c=__assign(__assign({},c),(a=r.modifiersStyles)===null||a===void 0?void 0:a[n])}),c}function useDayRender(r,o,c){var n,a,s,d=useDayPicker(),p=useFocusContext(),m=useActiveModifiers(r,o),g=useDayEventHandlers(r,m),j=useSelectedDays(),k=!!(d.onDayClick||d.mode!=="default");reactExports.useEffect(function(){var te;m.outside||p.focusedDay&&k&&isSameDay(p.focusedDay,r)&&((te=c.current)===null||te===void 0||te.focus())},[p.focusedDay,r,c,k,m.outside]);var _=getDayClassNames(d,m).join(" "),T=getDayStyle(d,m),E=!!(m.outside&&!d.showOutsideDays||m.hidden),M=(s=(a=d.components)===null||a===void 0?void 0:a.DayContent)!==null&&s!==void 0?s:DayContent,P=jsxRuntimeExports.jsx(M,{date:r,displayMonth:o,activeModifiers:m}),A={style:T,className:_,children:P,role:"gridcell"},H=p.focusTarget&&isSameDay(p.focusTarget,r)&&!m.outside,Y=p.focusedDay&&isSameDay(p.focusedDay,r),se=__assign(__assign(__assign({},A),(n={disabled:m.disabled,role:"gridcell"},n["aria-selected"]=m.selected,n.tabIndex=Y||H?0:-1,n)),g),z={isButton:k,isHidden:E,activeModifiers:m,selectedDays:j,buttonProps:se,divProps:A};return z}function Day(r){var o=reactExports.useRef(null),c=useDayRender(r.date,r.displayMonth,o);return c.isHidden?jsxRuntimeExports.jsx("div",{role:"gridcell"}):c.isButton?jsxRuntimeExports.jsx(Button,__assign({name:"day",ref:o},c.buttonProps)):jsxRuntimeExports.jsx("div",__assign({},c.divProps))}function WeekNumber(r){var o=r.number,c=r.dates,n=useDayPicker(),a=n.onWeekNumberClick,s=n.styles,d=n.classNames,p=n.locale,m=n.labels.labelWeekNumber,g=n.formatters.formatWeekNumber,j=g(Number(o),{locale:p});if(!a)return jsxRuntimeExports.jsx("span",{className:d.weeknumber,style:s.weeknumber,children:j});var k=m(Number(o),{locale:p}),_=function(T){a(o,c,T)};return jsxRuntimeExports.jsx(Button,{name:"week-number","aria-label":k,className:d.weeknumber,style:s.weeknumber,onClick:_,children:j})}function Row(r){var o,c,n=useDayPicker(),a=n.styles,s=n.classNames,d=n.showWeekNumber,p=n.components,m=(o=p==null?void 0:p.Day)!==null&&o!==void 0?o:Day,g=(c=p==null?void 0:p.WeekNumber)!==null&&c!==void 0?c:WeekNumber,j;return d&&(j=jsxRuntimeExports.jsx("td",{className:s.cell,style:a.cell,children:jsxRuntimeExports.jsx(g,{number:r.weekNumber,dates:r.dates})})),jsxRuntimeExports.jsxs("tr",{className:s.row,style:a.row,children:[j,r.dates?.map(function(k){return jsxRuntimeExports.jsx("td",{className:s.cell,style:a.cell,role:"presentation",children:jsxRuntimeExports.jsx(m,{displayMonth:r.displayMonth,date:k})},getUnixTime(k))})]})}function daysToMonthWeeks(r,o,c){for(var n=c!=null&&c.ISOWeek?endOfISOWeek(o):endOfWeek(o,c),a=c!=null&&c.ISOWeek?startOfISOWeek(r):startOfWeek(r,c),s=differenceInCalendarDays(n,a),d=[],p=0;p<=s;p++)d.push(addDays(a,p));var m=d.reduce(function(g,j){var k=c!=null&&c.ISOWeek?getISOWeek(j):getWeek(j,c),_=g.find(function(T){return T.weekNumber===k});return _?(_.dates.push(j),g):(g.push({weekNumber:k,dates:[j]}),g)},[]);return m}function getMonthWeeks(r,o){var c=daysToMonthWeeks(startOfMonth(r),endOfMonth(r),o);if(o!=null&&o.useFixedWeeks){var n=getWeeksInMonth(r,o);if(n<6){var a=c[c.length-1],s=a.dates[a.dates.length-1],d=addWeeks(s,6-n),p=daysToMonthWeeks(addWeeks(s,1),d,o);c.push.apply(c,p)}}return c}function Table(r){var o,c,n,a=useDayPicker(),s=a.locale,d=a.classNames,p=a.styles,m=a.hideHead,g=a.fixedWeeks,j=a.components,k=a.weekStartsOn,_=a.firstWeekContainsDate,T=a.ISOWeek,E=getMonthWeeks(r.displayMonth,{useFixedWeeks:!!g,ISOWeek:T,locale:s,weekStartsOn:k,firstWeekContainsDate:_}),M=(o=j==null?void 0:j.Head)!==null&&o!==void 0?o:Head,P=(c=j==null?void 0:j.Row)!==null&&c!==void 0?c:Row,A=(n=j==null?void 0:j.Footer)!==null&&n!==void 0?n:Footer;return jsxRuntimeExports.jsxs("table",{id:r.id,className:d.table,style:p.table,role:"grid","aria-labelledby":r["aria-labelledby"],children:[!m&&jsxRuntimeExports.jsx(M,{}),jsxRuntimeExports.jsx("tbody",{className:d.tbody,style:p.tbody,children:E?.map(function(H){return jsxRuntimeExports.jsx(P,{displayMonth:r.displayMonth,dates:H.dates,weekNumber:H.weekNumber},H.weekNumber)})}),jsxRuntimeExports.jsx(A,{displayMonth:r.displayMonth})]})}function canUseDOM(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var useIsomorphicLayoutEffect=canUseDOM()?reactExports.useLayoutEffect:reactExports.useEffect,serverHandoffComplete=!1,id=0;function genId(){return"react-day-picker-".concat(++id)}function useId(r){var o,c=r??(serverHandoffComplete?genId():null),n=reactExports.useState(c),a=n[0],s=n[1];return useIsomorphicLayoutEffect(function(){a===null&&s(genId())},[]),reactExports.useEffect(function(){serverHandoffComplete===!1&&(serverHandoffComplete=!0)},[]),(o=r??a)!==null&&o!==void 0?o:void 0}function Month(r){var o,c,n=useDayPicker(),a=n.dir,s=n.classNames,d=n.styles,p=n.components,m=useNavigation().displayMonths,g=useId(n.id?"".concat(n.id,"-").concat(r.displayIndex):void 0),j=n.id?"".concat(n.id,"-grid-").concat(r.displayIndex):void 0,k=[s.month],_=d.month,T=r.displayIndex===0,E=r.displayIndex===m.length-1,M=!T&&!E;a==="rtl"&&(o=[T,E],E=o[0],T=o[1]),T&&(k.push(s.caption_start),_=__assign(__assign({},_),d.caption_start)),E&&(k.push(s.caption_end),_=__assign(__assign({},_),d.caption_end)),M&&(k.push(s.caption_between),_=__assign(__assign({},_),d.caption_between));var P=(c=p==null?void 0:p.Caption)!==null&&c!==void 0?c:Caption;return jsxRuntimeExports.jsxs("div",{className:k.join(" "),style:_,children:[jsxRuntimeExports.jsx(P,{id:g,displayMonth:r.displayMonth,displayIndex:r.displayIndex}),jsxRuntimeExports.jsx(Table,{id:j,"aria-labelledby":g,displayMonth:r.displayMonth})]},r.displayIndex)}function Months(r){var o=useDayPicker(),c=o.classNames,n=o.styles;return jsxRuntimeExports.jsx("div",{className:c.months,style:n.months,children:r.children})}function Root(r){var o,c,n=r.initialProps,a=useDayPicker(),s=useFocusContext(),d=useNavigation(),p=reactExports.useState(!1),m=p[0],g=p[1];reactExports.useEffect(function(){a.initialFocus&&s.focusTarget&&(m||(s.focus(s.focusTarget),g(!0)))},[a.initialFocus,m,s.focus,s.focusTarget,s]);var j=[a.classNames.root,a.className];a.numberOfMonths>1&&j.push(a.classNames.multiple_months),a.showWeekNumber&&j.push(a.classNames.with_weeknumber);var k=__assign(__assign({},a.styles.root),a.style),_=Object.keys(n).filter(function(E){return E.startsWith("data-")}).reduce(function(E,M){var P;return __assign(__assign({},E),(P={},P[M]=n[M],P))},{}),T=(c=(o=n.components)===null||o===void 0?void 0:o.Months)!==null&&c!==void 0?c:Months;return jsxRuntimeExports.jsx("div",__assign({className:j.join(" "),style:k,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},_,{children:jsxRuntimeExports.jsx(T,{children:d.displayMonths?.map(function(E,M){return jsxRuntimeExports.jsx(Month,{displayIndex:M,displayMonth:E},M)})})}))}function RootProvider(r){var o=r.children,c=__rest(r,["children"]);return jsxRuntimeExports.jsx(DayPickerProvider,{initialProps:c,children:jsxRuntimeExports.jsx(NavigationProvider,{children:jsxRuntimeExports.jsx(SelectSingleProvider,{initialProps:c,children:jsxRuntimeExports.jsx(SelectMultipleProvider,{initialProps:c,children:jsxRuntimeExports.jsx(SelectRangeProvider,{initialProps:c,children:jsxRuntimeExports.jsx(ModifiersProvider,{children:jsxRuntimeExports.jsx(FocusProvider,{children:o})})})})})})})}function DayPicker(r){return jsxRuntimeExports.jsx(RootProvider,__assign({},r,{children:jsxRuntimeExports.jsx(Root,{initialProps:r})}))}function Calendar({className:r,classNames:o,showOutsideDays:c=!0,...n}){return jsxRuntimeExports.jsx(DayPicker,{showOutsideDays:c,...n,className:cn("rdp w-full rounded-xl border border-slate-200 bg-white p-3 shadow-[0_10px_30px_-20px_rgba(15,23,42,0.5)] dark:border-slate-700 dark:bg-slate-900",r),classNames:{months:"rdp-months flex flex-col gap-4 sm:flex-row sm:gap-6",month:"rdp-month space-y-4",caption:"rdp-caption relative flex items-center justify-center pt-1",caption_label:"rdp-caption_label text-sm font-semibold tracking-wide text-slate-800 dark:text-slate-100",nav:"rdp-nav flex items-center gap-1",nav_button:cn("rdp-nav_button",buttonVariants({variant:"ghost",size:"icon"}),"h-8 w-8 rounded-lg text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-slate-100"),nav_button_previous:"rdp-nav_button_previous absolute left-0",nav_button_next:"rdp-nav_button_next absolute right-0",table:"rdp-table w-full border-collapse space-y-1",head_row:"rdp-head_row flex w-full justify-between",head_cell:"rdp-head_cell text-slate-500 rounded-md w-9 font-normal text-[0.8rem] dark:text-slate-400 uppercase tracking-wide text-center pt-1 mb-2 whitespace-nowrap",row:"rdp-row flex w-full justify-between mt-1",cell:cn("rdp-cell relative h-9 w-9 p-0 text-center text-sm focus-within:relative focus-within:z-10",n.mode==="range"?"[&:has([aria-selected].day-range-end)]:rounded-r-lg [&:has([aria-selected].day-range-start)]:rounded-l-lg [&:has([aria-selected].day-range-middle)]:bg-primary-50 dark:[&:has([aria-selected].day-range-middle)]:bg-primary-900/30":""),day:cn("rdp-day",buttonVariants({variant:"ghost"}),"h-9 w-9 rounded-lg p-0 font-medium text-slate-700 hover:bg-slate-100 hover:text-slate-900 focus-visible:ring-2 focus-visible:ring-primary-500/30 aria-selected:opacity-100 dark:text-slate-200 dark:hover:bg-slate-800 dark:hover:text-white"),day_selected:"rdp-day_selected bg-primary-600 text-white hover:bg-primary-600 hover:text-white focus:bg-primary-600 focus:text-white dark:bg-primary-500 dark:hover:bg-primary-500",day_today:"rdp-day_today border border-primary-300 bg-primary-50 text-primary-700 dark:border-primary-500/50 dark:bg-primary-900/30 dark:text-primary-300",day_outside:"rdp-day_outside text-slate-400 opacity-60 aria-selected:bg-primary-100 aria-selected:text-primary-700 dark:text-slate-600 dark:aria-selected:bg-primary-900/40 dark:aria-selected:text-primary-300",day_disabled:"rdp-day_disabled text-slate-300 opacity-50 dark:text-slate-600",day_range_middle:"rdp-day_range_middle aria-selected:bg-primary-100 aria-selected:text-primary-800 dark:aria-selected:bg-primary-900/40 dark:aria-selected:text-primary-200",day_range_start:"rdp-day_range_start day-range-start aria-selected:bg-primary-600 aria-selected:text-white",day_range_end:"rdp-day_range_end day-range-end aria-selected:bg-primary-600 aria-selected:text-white",day_hidden:"rdp-day_hidden invisible",...o}})}var jquery$1={exports:{}};/*! - * jQuery JavaScript Library v3.7.1 - * https://jquery.com/ - * - * Copyright OpenJS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2023-08-28T13:37Z - */var jquery=jquery$1.exports,hasRequiredJquery;function requireJquery(){return hasRequiredJquery||(hasRequiredJquery=1,(function(r){(function(o,c){r.exports=o.document?c(o,!0):function(n){if(!n.document)throw new Error("jQuery requires a window with a document");return c(n)}})(typeof window<"u"?window:jquery,function(o,c){var n=[],a=Object.getPrototypeOf,s=n.slice,d=n.flat?function(e){return n.flat.call(e)}:function(e){return n.concat.apply([],e)},p=n.push,m=n.indexOf,g={},j=g.toString,k=g.hasOwnProperty,_=k.toString,T=_.call(Object),E={},M=function(t){return typeof t=="function"&&typeof t.nodeType!="number"&&typeof t.item!="function"},P=function(t){return t!=null&&t===t.window},A=o.document,H={type:!0,src:!0,nonce:!0,noModule:!0};function Y(e,t,i){i=i||A;var l,f,h=i.createElement("script");if(h.text=e,t)for(l in H)f=t[l]||t.getAttribute&&t.getAttribute(l),f&&h.setAttribute(l,f);i.head.appendChild(h).parentNode.removeChild(h)}function se(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?g[j.call(e)]||"object":typeof e}var z="3.7.1",te=/HTML$/i,u=function(e,t){return new u.fn.init(e,t)};u.fn=u.prototype={jquery:z,constructor:u,length:0,toArray:function(){return s.call(this)},get:function(e){return e==null?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=u.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return u.each(this,e)},map:function(e){return this.pushStack(u?.map(this,function(t,i){return e.call(t,i,t)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(u.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(u.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,i=+e+(e<0?t:0);return this.pushStack(i>=0&&i0&&t-1 in e}function ae(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var Ee=n.pop,De=n.sort,Me=n.splice,re="[\\x20\\t\\r\\n\\f]",U=new RegExp("^"+re+"+|((?:^|[^\\\\])(?:\\\\.)*)"+re+"+$","g");u.contains=function(e,t){var i=t&&t.parentNode;return e===i||!!(i&&i.nodeType===1&&(e.contains?e.contains(i):e.compareDocumentPosition&&e.compareDocumentPosition(i)&16))};var ye=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function ke(e,t){return t?e==="\0"?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}u.escapeSelector=function(e){return(e+"").replace(ye,ke)};var J=A,K=p;(function(){var e,t,i,l,f,h=K,x,b,v,w,R,I=u.expando,C=0,F=0,ne=qt(),de=qt(),oe=qt(),Se=qt(),Ce=function(y,D){return y===D&&(f=!0),0},Ke="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",Qe="(?:\\\\[\\da-fA-F]{1,6}"+re+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",ce="\\["+re+"*("+Qe+")(?:"+re+"*([*^$|!~]?=)"+re+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+Qe+"))|)"+re+"*\\]",ft=":("+Qe+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+ce+")*)|.*)\\)|)",he=new RegExp(re+"+","g"),we=new RegExp("^"+re+"*,"+re+"*"),Tt=new RegExp("^"+re+"*([>+~]|"+re+")"+re+"*"),lr=new RegExp(re+"|>"),Ge=new RegExp(ft),Ot=new RegExp("^"+Qe+"$"),Xe={ID:new RegExp("^#("+Qe+")"),CLASS:new RegExp("^\\.("+Qe+")"),TAG:new RegExp("^("+Qe+"|[*])"),ATTR:new RegExp("^"+ce),PSEUDO:new RegExp("^"+ft),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+re+"*(even|odd|(([+-]|)(\\d*)n|)"+re+"*(?:([+-]|)"+re+"*(\\d+)|))"+re+"*\\)|)","i"),bool:new RegExp("^(?:"+Ke+")$","i"),needsContext:new RegExp("^"+re+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+re+"*((?:-\\d)?\\d*)"+re+"*\\)|)(?=[^-]|$)","i")},it=/^(?:input|select|textarea|button)$/i,st=/^h\d$/i,He=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ur=/[+~]/,et=new RegExp("\\\\[\\da-fA-F]{1,6}"+re+"?|\\\\([^\\r\\n\\f])","g"),tt=function(y,D){var N="0x"+y.slice(1)-65536;return D||(N<0?String.fromCharCode(N+65536):String.fromCharCode(N>>10|55296,N&1023|56320))},In=function(){ot()},An=Ut(function(y){return y.disabled===!0&&ae(y,"fieldset")},{dir:"parentNode",next:"legend"});function Pn(){try{return x.activeElement}catch{}}try{h.apply(n=s.call(J.childNodes),J.childNodes),n[J.childNodes.length].nodeType}catch{h={apply:function(D,N){K.apply(D,s.call(N))},call:function(D){K.apply(D,s.call(arguments,1))}}}function ge(y,D,N,S){var L,W,B,Q,q,le,Z,ie=D&&D.ownerDocument,ue=D?D.nodeType:9;if(N=N||[],typeof y!="string"||!y||ue!==1&&ue!==9&&ue!==11)return N;if(!S&&(ot(D),D=D||x,v)){if(ue!==11&&(q=He.exec(y)))if(L=q[1]){if(ue===9)if(B=D.getElementById(L)){if(B.id===L)return h.call(N,B),N}else return N;else if(ie&&(B=ie.getElementById(L))&&ge.contains(D,B)&&B.id===L)return h.call(N,B),N}else{if(q[2])return h.apply(N,D.getElementsByTagName(y)),N;if((L=q[3])&&D.getElementsByClassName)return h.apply(N,D.getElementsByClassName(L)),N}if(!Se[y+" "]&&(!w||!w.test(y))){if(Z=y,ie=D,ue===1&&(lr.test(y)||Tt.test(y))){for(ie=ur.test(y)&&cr(D.parentNode)||D,(ie!=D||!E.scope)&&((Q=D.getAttribute("id"))?Q=u.escapeSelector(Q):D.setAttribute("id",Q=I)),le=Lt(y),W=le.length;W--;)le[W]=(Q?"#"+Q:":scope")+" "+Jt(le[W]);Z=le.join(",")}try{return h.apply(N,ie.querySelectorAll(Z)),N}catch{Se(y,!0)}finally{Q===I&&D.removeAttribute("id")}}}return Kr(y.replace(U,"$1"),D,N,S)}function qt(){var y=[];function D(N,S){return y.push(N+" ")>t.cacheLength&&delete D[y.shift()],D[N+" "]=S}return D}function Je(y){return y[I]=!0,y}function bt(y){var D=x.createElement("fieldset");try{return!!y(D)}catch{return!1}finally{D.parentNode&&D.parentNode.removeChild(D),D=null}}function Fn(y){return function(D){return ae(D,"input")&&D.type===y}}function Wn(y){return function(D){return(ae(D,"input")||ae(D,"button"))&&D.type===y}}function zr(y){return function(D){return"form"in D?D.parentNode&&D.disabled===!1?"label"in D?"label"in D.parentNode?D.parentNode.disabled===y:D.disabled===y:D.isDisabled===y||D.isDisabled!==!y&&An(D)===y:D.disabled===y:"label"in D?D.disabled===y:!1}}function ht(y){return Je(function(D){return D=+D,Je(function(N,S){for(var L,W=y([],N.length,D),B=W.length;B--;)N[L=W[B]]&&(N[L]=!(S[L]=N[L]))})})}function cr(y){return y&&typeof y.getElementsByTagName<"u"&&y}function ot(y){var D,N=y?y.ownerDocument||y:J;return N==x||N.nodeType!==9||!N.documentElement||(x=N,b=x.documentElement,v=!u.isXMLDoc(x),R=b.matches||b.webkitMatchesSelector||b.msMatchesSelector,b.msMatchesSelector&&J!=x&&(D=x.defaultView)&&D.top!==D&&D.addEventListener("unload",In),E.getById=bt(function(S){return b.appendChild(S).id=u.expando,!x.getElementsByName||!x.getElementsByName(u.expando).length}),E.disconnectedMatch=bt(function(S){return R.call(S,"*")}),E.scope=bt(function(){return x.querySelectorAll(":scope")}),E.cssHas=bt(function(){try{return x.querySelector(":has(*,:jqfake)"),!1}catch{return!0}}),E.getById?(t.filter.ID=function(S){var L=S.replace(et,tt);return function(W){return W.getAttribute("id")===L}},t.find.ID=function(S,L){if(typeof L.getElementById<"u"&&v){var W=L.getElementById(S);return W?[W]:[]}}):(t.filter.ID=function(S){var L=S.replace(et,tt);return function(W){var B=typeof W.getAttributeNode<"u"&&W.getAttributeNode("id");return B&&B.value===L}},t.find.ID=function(S,L){if(typeof L.getElementById<"u"&&v){var W,B,Q,q=L.getElementById(S);if(q){if(W=q.getAttributeNode("id"),W&&W.value===S)return[q];for(Q=L.getElementsByName(S),B=0;q=Q[B++];)if(W=q.getAttributeNode("id"),W&&W.value===S)return[q]}return[]}}),t.find.TAG=function(S,L){return typeof L.getElementsByTagName<"u"?L.getElementsByTagName(S):L.querySelectorAll(S)},t.find.CLASS=function(S,L){if(typeof L.getElementsByClassName<"u"&&v)return L.getElementsByClassName(S)},w=[],bt(function(S){var L;b.appendChild(S).innerHTML="",S.querySelectorAll("[selected]").length||w.push("\\["+re+"*(?:value|"+Ke+")"),S.querySelectorAll("[id~="+I+"-]").length||w.push("~="),S.querySelectorAll("a#"+I+"+*").length||w.push(".#.+[+~]"),S.querySelectorAll(":checked").length||w.push(":checked"),L=x.createElement("input"),L.setAttribute("type","hidden"),S.appendChild(L).setAttribute("name","D"),b.appendChild(S).disabled=!0,S.querySelectorAll(":disabled").length!==2&&w.push(":enabled",":disabled"),L=x.createElement("input"),L.setAttribute("name",""),S.appendChild(L),S.querySelectorAll("[name='']").length||w.push("\\["+re+"*name"+re+"*="+re+`*(?:''|"")`)}),E.cssHas||w.push(":has"),w=w.length&&new RegExp(w.join("|")),Ce=function(S,L){if(S===L)return f=!0,0;var W=!S.compareDocumentPosition-!L.compareDocumentPosition;return W||(W=(S.ownerDocument||S)==(L.ownerDocument||L)?S.compareDocumentPosition(L):1,W&1||!E.sortDetached&&L.compareDocumentPosition(S)===W?S===x||S.ownerDocument==J&&ge.contains(J,S)?-1:L===x||L.ownerDocument==J&&ge.contains(J,L)?1:l?m.call(l,S)-m.call(l,L):0:W&4?-1:1)}),x}ge.matches=function(y,D){return ge(y,null,null,D)},ge.matchesSelector=function(y,D){if(ot(y),v&&!Se[D+" "]&&(!w||!w.test(D)))try{var N=R.call(y,D);if(N||E.disconnectedMatch||y.document&&y.document.nodeType!==11)return N}catch{Se(D,!0)}return ge(D,x,null,[y]).length>0},ge.contains=function(y,D){return(y.ownerDocument||y)!=x&&ot(y),u.contains(y,D)},ge.attr=function(y,D){(y.ownerDocument||y)!=x&&ot(y);var N=t.attrHandle[D.toLowerCase()],S=N&&k.call(t.attrHandle,D.toLowerCase())?N(y,D,!v):void 0;return S!==void 0?S:y.getAttribute(D)},ge.error=function(y){throw new Error("Syntax error, unrecognized expression: "+y)},u.uniqueSort=function(y){var D,N=[],S=0,L=0;if(f=!E.sortStable,l=!E.sortStable&&s.call(y,0),De.call(y,Ce),f){for(;D=y[L++];)D===y[L]&&(S=N.push(L));for(;S--;)Me.call(y,N[S],1)}return l=null,y},u.fn.uniqueSort=function(){return this.pushStack(u.uniqueSort(s.apply(this)))},t=u.expr={cacheLength:50,createPseudo:Je,match:Xe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(y){return y[1]=y[1].replace(et,tt),y[3]=(y[3]||y[4]||y[5]||"").replace(et,tt),y[2]==="~="&&(y[3]=" "+y[3]+" "),y.slice(0,4)},CHILD:function(y){return y[1]=y[1].toLowerCase(),y[1].slice(0,3)==="nth"?(y[3]||ge.error(y[0]),y[4]=+(y[4]?y[5]+(y[6]||1):2*(y[3]==="even"||y[3]==="odd")),y[5]=+(y[7]+y[8]||y[3]==="odd")):y[3]&&ge.error(y[0]),y},PSEUDO:function(y){var D,N=!y[6]&&y[2];return Xe.CHILD.test(y[0])?null:(y[3]?y[2]=y[4]||y[5]||"":N&&Ge.test(N)&&(D=Lt(N,!0))&&(D=N.indexOf(")",N.length-D)-N.length)&&(y[0]=y[0].slice(0,D),y[2]=N.slice(0,D)),y.slice(0,3))}},filter:{TAG:function(y){var D=y.replace(et,tt).toLowerCase();return y==="*"?function(){return!0}:function(N){return ae(N,D)}},CLASS:function(y){var D=ne[y+" "];return D||(D=new RegExp("(^|"+re+")"+y+"("+re+"|$)"))&&ne(y,function(N){return D.test(typeof N.className=="string"&&N.className||typeof N.getAttribute<"u"&&N.getAttribute("class")||"")})},ATTR:function(y,D,N){return function(S){var L=ge.attr(S,y);return L==null?D==="!=":D?(L+="",D==="="?L===N:D==="!="?L!==N:D==="^="?N&&L.indexOf(N)===0:D==="*="?N&&L.indexOf(N)>-1:D==="$="?N&&L.slice(-N.length)===N:D==="~="?(" "+L.replace(he," ")+" ").indexOf(N)>-1:D==="|="?L===N||L.slice(0,N.length+1)===N+"-":!1):!0}},CHILD:function(y,D,N,S,L){var W=y.slice(0,3)!=="nth",B=y.slice(-4)!=="last",Q=D==="of-type";return S===1&&L===0?(function(q){return!!q.parentNode}):function(q,le,Z){var ie,ue,G,be,Pe,Re=W!==B?"nextSibling":"previousSibling",Ye=q.parentNode,$e=Q&&q.nodeName.toLowerCase(),jt=!Z&&!Q,Le=!1;if(Ye){if(W){for(;Re;){for(G=q;G=G[Re];)if(Q?ae(G,$e):G.nodeType===1)return!1;Pe=Re=y==="only"&&!Pe&&"nextSibling"}return!0}if(Pe=[B?Ye.firstChild:Ye.lastChild],B&&jt){for(ue=Ye[I]||(Ye[I]={}),ie=ue[y]||[],be=ie[0]===C&&ie[1],Le=be&&ie[2],G=be&&Ye.childNodes[be];G=++be&&G&&G[Re]||(Le=be=0)||Pe.pop();)if(G.nodeType===1&&++Le&&G===q){ue[y]=[C,be,Le];break}}else if(jt&&(ue=q[I]||(q[I]={}),ie=ue[y]||[],be=ie[0]===C&&ie[1],Le=be),Le===!1)for(;(G=++be&&G&&G[Re]||(Le=be=0)||Pe.pop())&&!((Q?ae(G,$e):G.nodeType===1)&&++Le&&(jt&&(ue=G[I]||(G[I]={}),ue[y]=[C,Le]),G===q)););return Le-=L,Le===S||Le%S===0&&Le/S>=0}}},PSEUDO:function(y,D){var N,S=t.pseudos[y]||t.setFilters[y.toLowerCase()]||ge.error("unsupported pseudo: "+y);return S[I]?S(D):S.length>1?(N=[y,y,"",D],t.setFilters.hasOwnProperty(y.toLowerCase())?Je(function(L,W){for(var B,Q=S(L,D),q=Q.length;q--;)B=m.call(L,Q[q]),L[B]=!(W[B]=Q[q])}):function(L){return S(L,0,N)}):S}},pseudos:{not:Je(function(y){var D=[],N=[],S=pr(y.replace(U,"$1"));return S[I]?Je(function(L,W,B,Q){for(var q,le=S(L,null,Q,[]),Z=L.length;Z--;)(q=le[Z])&&(L[Z]=!(W[Z]=q))}):function(L,W,B){return D[0]=L,S(D,null,B,N),D[0]=null,!N.pop()}}),has:Je(function(y){return function(D){return ge(y,D).length>0}}),contains:Je(function(y){return y=y.replace(et,tt),function(D){return(D.textContent||u.text(D)).indexOf(y)>-1}}),lang:Je(function(y){return Ot.test(y||"")||ge.error("unsupported lang: "+y),y=y.replace(et,tt).toLowerCase(),function(D){var N;do if(N=v?D.lang:D.getAttribute("xml:lang")||D.getAttribute("lang"))return N=N.toLowerCase(),N===y||N.indexOf(y+"-")===0;while((D=D.parentNode)&&D.nodeType===1);return!1}}),target:function(y){var D=o.location&&o.location.hash;return D&&D.slice(1)===y.id},root:function(y){return y===b},focus:function(y){return y===Pn()&&x.hasFocus()&&!!(y.type||y.href||~y.tabIndex)},enabled:zr(!1),disabled:zr(!0),checked:function(y){return ae(y,"input")&&!!y.checked||ae(y,"option")&&!!y.selected},selected:function(y){return y.parentNode&&y.parentNode.selectedIndex,y.selected===!0},empty:function(y){for(y=y.firstChild;y;y=y.nextSibling)if(y.nodeType<6)return!1;return!0},parent:function(y){return!t.pseudos.empty(y)},header:function(y){return st.test(y.nodeName)},input:function(y){return it.test(y.nodeName)},button:function(y){return ae(y,"input")&&y.type==="button"||ae(y,"button")},text:function(y){var D;return ae(y,"input")&&y.type==="text"&&((D=y.getAttribute("type"))==null||D.toLowerCase()==="text")},first:ht(function(){return[0]}),last:ht(function(y,D){return[D-1]}),eq:ht(function(y,D,N){return[N<0?N+D:N]}),even:ht(function(y,D){for(var N=0;ND?S=D:S=N;--S>=0;)y.push(S);return y}),gt:ht(function(y,D,N){for(var S=N<0?N+D:N;++S1?function(D,N,S){for(var L=y.length;L--;)if(!y[L](D,N,S))return!1;return!0}:y[0]}function Hn(y,D,N){for(var S=0,L=D.length;S-1&&(B[Z]=!(Q[Z]=ue))}}else G=zt(G===Q?G.splice(Re,G.length):G),L?L(null,Q,G,le):h.apply(Q,G)})}function hr(y){for(var D,N,S,L=y.length,W=t.relative[y[0].type],B=W||t.relative[" "],Q=W?1:0,q=Ut(function(ie){return ie===D},B,!0),le=Ut(function(ie){return m.call(D,ie)>-1},B,!0),Z=[function(ie,ue,G){var be=!W&&(G||ue!=i)||((D=ue).nodeType?q(ie,ue,G):le(ie,ue,G));return D=null,be}];Q1&&dr(Z),Q>1&&Jt(y.slice(0,Q-1).concat({value:y[Q-2].type===" "?"*":""})).replace(U,"$1"),N,Q0,S=y.length>0,L=function(W,B,Q,q,le){var Z,ie,ue,G=0,be="0",Pe=W&&[],Re=[],Ye=i,$e=W||S&&t.find.TAG("*",le),jt=C+=Ye==null?1:Math.random()||.1,Le=$e.length;for(le&&(i=B==x||B||le);be!==Le&&(Z=$e[be])!=null;be++){if(S&&Z){for(ie=0,!B&&Z.ownerDocument!=x&&(ot(Z),Q=!v);ue=y[ie++];)if(ue(Z,B||x,Q)){h.call(q,Z);break}le&&(C=jt)}N&&((Z=!ue&&Z)&&G--,W&&Pe.push(Z))}if(G+=be,N&&be!==G){for(ie=0;ue=D[ie++];)ue(Pe,Re,B,Q);if(W){if(G>0)for(;be--;)Pe[be]||Re[be]||(Re[be]=Ee.call(q));Re=zt(Re)}h.apply(q,Re),le&&!W&&Re.length>0&&G+D.length>1&&u.uniqueSort(q)}return le&&(C=jt,i=Ye),Pe};return N?Je(L):L}function pr(y,D){var N,S=[],L=[],W=oe[y+" "];if(!W){for(D||(D=Lt(y)),N=D.length;N--;)W=hr(D[N]),W[I]?S.push(W):L.push(W);W=oe(y,Yn(L,S)),W.selector=y}return W}function Kr(y,D,N,S){var L,W,B,Q,q,le=typeof y=="function"&&y,Z=!S&&Lt(y=le.selector||y);if(N=N||[],Z.length===1){if(W=Z[0]=Z[0].slice(0),W.length>2&&(B=W[0]).type==="ID"&&D.nodeType===9&&v&&t.relative[W[1].type]){if(D=(t.find.ID(B.matches[0].replace(et,tt),D)||[])[0],D)le&&(D=D.parentNode);else return N;y=y.slice(W.shift().value.length)}for(L=Xe.needsContext.test(y)?0:W.length;L--&&(B=W[L],!t.relative[Q=B.type]);)if((q=t.find[Q])&&(S=q(B.matches[0].replace(et,tt),ur.test(W[0].type)&&cr(D.parentNode)||D))){if(W.splice(L,1),y=S.length&&Jt(W),!y)return h.apply(N,S),N;break}}return(le||pr(y,Z))(S,D,!v,N,!D||ur.test(y)&&cr(D.parentNode)||D),N}E.sortStable=I.split("").sort(Ce).join("")===I,ot(),E.sortDetached=bt(function(y){return y.compareDocumentPosition(x.createElement("fieldset"))&1}),u.find=ge,u.expr[":"]=u.expr.pseudos,u.unique=u.uniqueSort,ge.compile=pr,ge.select=Kr,ge.setDocument=ot,ge.tokenize=Lt,ge.escape=u.escapeSelector,ge.getText=u.text,ge.isXML=u.isXMLDoc,ge.selectors=u.expr,ge.support=u.support,ge.uniqueSort=u.uniqueSort})();var Te=function(e,t,i){for(var l=[],f=i!==void 0;(e=e[t])&&e.nodeType!==9;)if(e.nodeType===1){if(f&&u(e).is(i))break;l.push(e)}return l},rt=function(e,t){for(var i=[];e;e=e.nextSibling)e.nodeType===1&&e!==t&&i.push(e);return i},nt=u.expr.match.needsContext,Dt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function kt(e,t,i){return M(t)?u.grep(e,function(l,f){return!!t.call(l,f,l)!==i}):t.nodeType?u.grep(e,function(l){return l===t!==i}):typeof t!="string"?u.grep(e,function(l){return m.call(t,l)>-1!==i}):u.filter(t,e,i)}u.filter=function(e,t,i){var l=t[0];return i&&(e=":not("+e+")"),t.length===1&&l.nodeType===1?u.find.matchesSelector(l,e)?[l]:[]:u.find.matches(e,u.grep(t,function(f){return f.nodeType===1}))},u.fn.extend({find:function(e){var t,i,l=this.length,f=this;if(typeof e!="string")return this.pushStack(u(e).filter(function(){for(t=0;t1?u.uniqueSort(i):i},filter:function(e){return this.pushStack(kt(this,e||[],!1))},not:function(e){return this.pushStack(kt(this,e||[],!0))},is:function(e){return!!kt(this,typeof e=="string"&&nt.test(e)?u(e):e||[],!1).length}});var It,Vt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,At=u.fn.init=function(e,t,i){var l,f;if(!e)return this;if(i=i||It,typeof e=="string")if(e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?l=[null,e,null]:l=Vt.exec(e),l&&(l[1]||!t))if(l[1]){if(t=t instanceof u?t[0]:t,u.merge(this,u.parseHTML(l[1],t&&t.nodeType?t.ownerDocument||t:A,!0)),Dt.test(l[1])&&u.isPlainObject(t))for(l in t)M(this[l])?this[l](t[l]):this.attr(l,t[l]);return this}else return f=A.getElementById(l[2]),f&&(this[0]=f,this.length=1),this;else return!t||t.jquery?(t||i).find(e):this.constructor(t).find(e);else{if(e.nodeType)return this[0]=e,this.length=1,this;if(M(e))return i.ready!==void 0?i.ready(e):e(u)}return u.makeArray(e,this)};At.prototype=u.fn,It=u(A);var ve=/^(?:parents|prev(?:Until|All))/,wt={children:!0,contents:!0,next:!0,prev:!0};u.fn.extend({has:function(e){var t=u(e,this),i=t.length;return this.filter(function(){for(var l=0;l-1:i.nodeType===1&&u.find.matchesSelector(i,e))){h.push(i);break}}return this.pushStack(h.length>1?u.uniqueSort(h):h)},index:function(e){return e?typeof e=="string"?m.call(u(e),this[0]):m.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(u.uniqueSort(u.merge(this.get(),u(e,t))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}});function Et(e,t){for(;(e=e[t])&&e.nodeType!==1;);return e}u.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return Te(e,"parentNode")},parentsUntil:function(e,t,i){return Te(e,"parentNode",i)},next:function(e){return Et(e,"nextSibling")},prev:function(e){return Et(e,"previousSibling")},nextAll:function(e){return Te(e,"nextSibling")},prevAll:function(e){return Te(e,"previousSibling")},nextUntil:function(e,t,i){return Te(e,"nextSibling",i)},prevUntil:function(e,t,i){return Te(e,"previousSibling",i)},siblings:function(e){return rt((e.parentNode||{}).firstChild,e)},children:function(e){return rt(e.firstChild)},contents:function(e){return e.contentDocument!=null&&a(e.contentDocument)?e.contentDocument:(ae(e,"template")&&(e=e.content||e),u.merge([],e.childNodes))}},function(e,t){u.fn[e]=function(i,l){var f=u?.map(this,t,i);return e.slice(-5)!=="Until"&&(l=i),l&&typeof l=="string"&&(f=u.filter(l,f)),this.length>1&&(wt[e]||u.uniqueSort(f),ve.test(e)&&f.reverse()),this.pushStack(f)}});var Ne=/[^\x20\t\r\n\f]+/g;function Ue(e){var t={};return u.each(e.match(Ne)||[],function(i,l){t[l]=!0}),t}u.Callbacks=function(e){e=typeof e=="string"?Ue(e):u.extend({},e);var t,i,l,f,h=[],x=[],b=-1,v=function(){for(f=f||e.once,l=t=!0;x.length;b=-1)for(i=x.shift();++b-1;)h.splice(C,1),C<=b&&b--}),this},has:function(R){return R?u.inArray(R,h)>-1:h.length>0},empty:function(){return h&&(h=[]),this},disable:function(){return f=x=[],h=i="",this},disabled:function(){return!h},lock:function(){return f=x=[],!i&&!t&&(h=i=""),this},locked:function(){return!!f},fireWith:function(R,I){return f||(I=I||[],I=[R,I.slice?I.slice():I],x.push(I),t||v()),this},fire:function(){return w.fireWith(this,arguments),this},fired:function(){return!!l}};return w};function ze(e){return e}function lt(e){throw e}function O(e,t,i,l){var f;try{e&&M(f=e.promise)?f.call(e).done(t).fail(i):e&&M(f=e.then)?f.call(e,t,i):t.apply(void 0,[e].slice(l))}catch(h){i.apply(void 0,[h])}}u.extend({Deferred:function(e){var t=[["notify","progress",u.Callbacks("memory"),u.Callbacks("memory"),2],["resolve","done",u.Callbacks("once memory"),u.Callbacks("once memory"),0,"resolved"],["reject","fail",u.Callbacks("once memory"),u.Callbacks("once memory"),1,"rejected"]],i="pending",l={state:function(){return i},always:function(){return f.done(arguments).fail(arguments),this},catch:function(h){return l.then(null,h)},pipe:function(){var h=arguments;return u.Deferred(function(x){u.each(t,function(b,v){var w=M(h[v[4]])&&h[v[4]];f[v[1]](function(){var R=w&&w.apply(this,arguments);R&&M(R.promise)?R.promise().progress(x.notify).done(x.resolve).fail(x.reject):x[v[0]+"With"](this,w?[R]:arguments)})}),h=null}).promise()},then:function(h,x,b){var v=0;function w(R,I,C,F){return function(){var ne=this,de=arguments,oe=function(){var Ce,Ke;if(!(R=v&&(C!==lt&&(ne=void 0,de=[Ce]),I.rejectWith(ne,de))}};R?Se():(u.Deferred.getErrorHook?Se.error=u.Deferred.getErrorHook():u.Deferred.getStackHook&&(Se.error=u.Deferred.getStackHook()),o.setTimeout(Se))}}return u.Deferred(function(R){t[0][3].add(w(0,R,M(b)?b:ze,R.notifyWith)),t[1][3].add(w(0,R,M(h)?h:ze)),t[2][3].add(w(0,R,M(x)?x:lt))}).promise()},promise:function(h){return h!=null?u.extend(h,l):l}},f={};return u.each(t,function(h,x){var b=x[2],v=x[5];l[x[1]]=b.add,v&&b.add(function(){i=v},t[3-h][2].disable,t[3-h][3].disable,t[0][2].lock,t[0][3].lock),b.add(x[3].fire),f[x[0]]=function(){return f[x[0]+"With"](this===f?void 0:this,arguments),this},f[x[0]+"With"]=b.fireWith}),l.promise(f),e&&e.call(f,f),f},when:function(e){var t=arguments.length,i=t,l=Array(i),f=s.call(arguments),h=u.Deferred(),x=function(b){return function(v){l[b]=this,f[b]=arguments.length>1?s.call(arguments):v,--t||h.resolveWith(l,f)}};if(t<=1&&(O(e,h.done(x(i)).resolve,h.reject,!t),h.state()==="pending"||M(f[i]&&f[i].then)))return h.then();for(;i--;)O(f[i],x(i),h.reject);return h.promise()}});var me=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;u.Deferred.exceptionHook=function(e,t){o.console&&o.console.warn&&e&&me.test(e.name)&&o.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},u.readyException=function(e){o.setTimeout(function(){throw e})};var pe=u.Deferred();u.fn.ready=function(e){return pe.then(e).catch(function(t){u.readyException(t)}),this},u.extend({isReady:!1,readyWait:1,ready:function(e){(e===!0?--u.readyWait:u.isReady)||(u.isReady=!0,!(e!==!0&&--u.readyWait>0)&&pe.resolveWith(A,[u]))}}),u.ready.then=pe.then;function ee(){A.removeEventListener("DOMContentLoaded",ee),o.removeEventListener("load",ee),u.ready()}A.readyState==="complete"||A.readyState!=="loading"&&!A.documentElement.doScroll?o.setTimeout(u.ready):(A.addEventListener("DOMContentLoaded",ee),o.addEventListener("load",ee));var xe=function(e,t,i,l,f,h,x){var b=0,v=e.length,w=i==null;if(se(i)==="object"){f=!0;for(b in i)xe(e,t,b,i[b],!0,h,x)}else if(l!==void 0&&(f=!0,M(l)||(x=!0),w&&(x?(t.call(e,l),t=null):(w=t,t=function(R,I,C){return w.call(u(R),C)})),t))for(;b1,null,!0)},removeData:function(e){return this.each(function(){_e.remove(this,e)})}}),u.extend({queue:function(e,t,i){var l;if(e)return t=(t||"fx")+"queue",l=V.get(e,t),i&&(!l||Array.isArray(i)?l=V.access(e,t,u.makeArray(i)):l.push(i)),l||[]},dequeue:function(e,t){t=t||"fx";var i=u.queue(e,t),l=i.length,f=i.shift(),h=u._queueHooks(e,t),x=function(){u.dequeue(e,t)};f==="inprogress"&&(f=i.shift(),l--),f&&(t==="fx"&&i.unshift("inprogress"),delete h.stop,f.call(e,x,h)),!l&&h&&h.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return V.get(e,i)||V.access(e,i,{empty:u.Callbacks("once memory").add(function(){V.remove(e,[t+"queue",i])})})}}),u.fn.extend({queue:function(e,t){var i=2;return typeof e!="string"&&(t=e,e="fx",i--),arguments.length\x20\t\r\n\f]*)/i,br=/^$|^module$|\/(?:java|ecma)script/i;(function(){var e=A.createDocumentFragment(),t=e.appendChild(A.createElement("div")),i=A.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),t.appendChild(i),E.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",E.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,t.innerHTML="",E.option=!!t.lastChild})();var We={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};We.tbody=We.tfoot=We.colgroup=We.caption=We.thead,We.th=We.td,E.option||(We.optgroup=We.option=[1,""]);function Ie(e,t){var i;return typeof e.getElementsByTagName<"u"?i=e.getElementsByTagName(t||"*"):typeof e.querySelectorAll<"u"?i=e.querySelectorAll(t||"*"):i=[],t===void 0||t&&ae(e,t)?u.merge([e],i):i}function Kt(e,t){for(var i=0,l=e.length;i-1){f&&f.push(h);continue}if(w=pt(h),x=Ie(I.appendChild(h),"script"),w&&Kt(x),i)for(R=0;h=x[R++];)br.test(h.type||"")&&i.push(h)}return I}var Dr=/^([^.]*)(?:\.(.+)|)/;function xt(){return!0}function gt(){return!1}function Qt(e,t,i,l,f,h){var x,b;if(typeof t=="object"){typeof i!="string"&&(l=l||i,i=void 0);for(b in t)Qt(e,b,i,l,t[b],h);return e}if(l==null&&f==null?(f=i,l=i=void 0):f==null&&(typeof i=="string"?(f=l,l=void 0):(f=l,l=i,i=void 0)),f===!1)f=gt;else if(!f)return e;return h===1&&(x=f,f=function(v){return u().off(v),x.apply(this,arguments)},f.guid=x.guid||(x.guid=u.guid++)),e.each(function(){u.event.add(this,t,f,l,i)})}u.event={global:{},add:function(e,t,i,l,f){var h,x,b,v,w,R,I,C,F,ne,de,oe=V.get(e);if(Be(e))for(i.handler&&(h=i,i=h.handler,f=h.selector),f&&u.find.matchesSelector(ut,f),i.guid||(i.guid=u.guid++),(v=oe.events)||(v=oe.events=Object.create(null)),(x=oe.handle)||(x=oe.handle=function(Se){return typeof u<"u"&&u.event.triggered!==Se.type?u.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(Ne)||[""],w=t.length;w--;)b=Dr.exec(t[w])||[],F=de=b[1],ne=(b[2]||"").split(".").sort(),F&&(I=u.event.special[F]||{},F=(f?I.delegateType:I.bindType)||F,I=u.event.special[F]||{},R=u.extend({type:F,origType:de,data:l,handler:i,guid:i.guid,selector:f,needsContext:f&&u.expr.match.needsContext.test(f),namespace:ne.join(".")},h),(C=v[F])||(C=v[F]=[],C.delegateCount=0,(!I.setup||I.setup.call(e,l,ne,x)===!1)&&e.addEventListener&&e.addEventListener(F,x)),I.add&&(I.add.call(e,R),R.handler.guid||(R.handler.guid=i.guid)),f?C.splice(C.delegateCount++,0,R):C.push(R),u.event.global[F]=!0)},remove:function(e,t,i,l,f){var h,x,b,v,w,R,I,C,F,ne,de,oe=V.hasData(e)&&V.get(e);if(!(!oe||!(v=oe.events))){for(t=(t||"").match(Ne)||[""],w=t.length;w--;){if(b=Dr.exec(t[w])||[],F=de=b[1],ne=(b[2]||"").split(".").sort(),!F){for(F in v)u.event.remove(e,F+t[w],i,l,!0);continue}for(I=u.event.special[F]||{},F=(l?I.delegateType:I.bindType)||F,C=v[F]||[],b=b[2]&&new RegExp("(^|\\.)"+ne.join("\\.(?:.*\\.|)")+"(\\.|$)"),x=h=C.length;h--;)R=C[h],(f||de===R.origType)&&(!i||i.guid===R.guid)&&(!b||b.test(R.namespace))&&(!l||l===R.selector||l==="**"&&R.selector)&&(C.splice(h,1),R.selector&&C.delegateCount--,I.remove&&I.remove.call(e,R));x&&!C.length&&((!I.teardown||I.teardown.call(e,ne,oe.handle)===!1)&&u.removeEvent(e,F,oe.handle),delete v[F])}u.isEmptyObject(v)&&V.remove(e,"handle events")}},dispatch:function(e){var t,i,l,f,h,x,b=new Array(arguments.length),v=u.event.fix(e),w=(V.get(this,"events")||Object.create(null))[v.type]||[],R=u.event.special[v.type]||{};for(b[0]=v,t=1;t=1)){for(;w!==this;w=w.parentNode||this)if(w.nodeType===1&&!(e.type==="click"&&w.disabled===!0)){for(h=[],x={},i=0;i-1:u.find(f,this,null,[w]).length),x[f]&&h.push(l);h.length&&b.push({elem:w,handlers:h})}}return w=this,v\s*$/g;function kr(e,t){return ae(e,"table")&&ae(t.nodeType!==11?t:t.firstChild,"tr")&&u(e).children("tbody")[0]||e}function nn(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function an(e){return(e.type||"").slice(0,5)==="true/"?e.type=e.type.slice(5):e.removeAttribute("type"),e}function wr(e,t){var i,l,f,h,x,b,v;if(t.nodeType===1){if(V.hasData(e)&&(h=V.get(e),v=h.events,v)){V.remove(t,"handle events");for(f in v)for(i=0,l=v[f].length;i1&&typeof F=="string"&&!E.checkClone&&tn.test(F))return e.each(function(de){var oe=e.eq(de);ne&&(t[0]=F.call(this,de,oe.html())),yt(oe,t,i,l)});if(I&&(f=jr(t,e[0].ownerDocument,!1,e,l),h=f.firstChild,f.childNodes.length===1&&(f=h),h||l)){for(x=u?.map(Ie(f,"script"),nn),b=x.length;R0&&Kt(x,!v&&Ie(e,"script")),b},cleanData:function(e){for(var t,i,l,f=u.event.special,h=0;(i=e[h])!==void 0;h++)if(Be(i)){if(t=i[V.expando]){if(t.events)for(l in t.events)f[l]?u.event.remove(i,l):u.removeEvent(i,l,t.handle);i[V.expando]=void 0}i[_e.expando]&&(i[_e.expando]=void 0)}}}),u.fn.extend({detach:function(e){return Er(this,e,!0)},remove:function(e){return Er(this,e)},text:function(e){return xe(this,function(t){return t===void 0?u.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=t)})},null,e,arguments.length)},append:function(){return yt(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=kr(this,e);t.appendChild(e)}})},prepend:function(){return yt(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=kr(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return yt(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return yt(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;(e=this[t])!=null;t++)e.nodeType===1&&(u.cleanData(Ie(e,!1)),e.textContent="");return this},clone:function(e,t){return e=e??!1,t=t??e,this?.map(function(){return u.clone(this,e,t)})},html:function(e){return xe(this,function(t){var i=this[0]||{},l=0,f=this.length;if(t===void 0&&i.nodeType===1)return i.innerHTML;if(typeof t=="string"&&!en.test(t)&&!We[(vr.exec(t)||["",""])[1].toLowerCase()]){t=u.htmlPrefilter(t);try{for(;l=0&&(v+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-h-v-b-.5))||0),v+w}function Or(e,t,i){var l=Ht(e),f=!E.boxSizingReliable()||i,h=f&&u.css(e,"boxSizing",!1,l)==="border-box",x=h,b=St(e,t,l),v="offset"+t[0].toUpperCase()+t.slice(1);if(Gt.test(b)){if(!i)return b;b="auto"}return(!E.boxSizingReliable()&&h||!E.reliableTrDimensions()&&ae(e,"tr")||b==="auto"||!parseFloat(b)&&u.css(e,"display",!1,l)==="inline")&&e.getClientRects().length&&(h=u.css(e,"boxSizing",!1,l)==="border-box",x=v in e,x&&(b=e[v])),b=parseFloat(b)||0,b+Zt(e,t,i||(h?"border":"content"),x,l,b)+"px"}u.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=St(e,"opacity");return i===""?"1":i}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,i,l){if(!(!e||e.nodeType===3||e.nodeType===8||!e.style)){var f,h,x,b=je(t),v=Xt.test(t),w=e.style;if(v||(t=$t(b)),x=u.cssHooks[t]||u.cssHooks[b],i!==void 0){if(h=typeof i,h==="string"&&(f=Nt.exec(i))&&f[1]&&(i=gr(e,t,f),h="number"),i==null||i!==i)return;h==="number"&&!v&&(i+=f&&f[3]||(u.cssNumber[b]?"":"px")),!E.clearCloneStyle&&i===""&&t.indexOf("background")===0&&(w[t]="inherit"),(!x||!("set"in x)||(i=x.set(e,i,l))!==void 0)&&(v?w.setProperty(t,i):w[t]=i)}else return x&&"get"in x&&(f=x.get(e,!1,l))!==void 0?f:w[t]}},css:function(e,t,i,l){var f,h,x,b=je(t),v=Xt.test(t);return v||(t=$t(b)),x=u.cssHooks[t]||u.cssHooks[b],x&&"get"in x&&(f=x.get(e,!0,i)),f===void 0&&(f=St(e,t,l)),f==="normal"&&t in Mr&&(f=Mr[t]),i===""||i?(h=parseFloat(f),i===!0||isFinite(h)?h||0:f):f}}),u.each(["height","width"],function(e,t){u.cssHooks[t]={get:function(i,l,f){if(l)return un.test(u.css(i,"display"))&&(!i.getClientRects().length||!i.getBoundingClientRect().width)?Nr(i,dn,function(){return Or(i,t,f)}):Or(i,t,f)},set:function(i,l,f){var h,x=Ht(i),b=!E.scrollboxSize()&&x.position==="absolute",v=b||f,w=v&&u.css(i,"boxSizing",!1,x)==="border-box",R=f?Zt(i,t,f,w,x):0;return w&&b&&(R-=Math.ceil(i["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(x[t])-Zt(i,t,"border",!1,x)-.5)),R&&(h=Nt.exec(l))&&(h[3]||"px")!=="px"&&(i.style[t]=l,l=u.css(i,t)),Tr(i,l,R)}}}),u.cssHooks.marginLeft=Cr(E.reliableMarginLeft,function(e,t){if(t)return(parseFloat(St(e,"marginLeft"))||e.getBoundingClientRect().left-Nr(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),u.each({margin:"",padding:"",border:"Width"},function(e,t){u.cssHooks[e+t]={expand:function(i){for(var l=0,f={},h=typeof i=="string"?i.split(" "):[i];l<4;l++)f[e+Ze[l]+t]=h[l]||h[l-2]||h[0];return f}},e!=="margin"&&(u.cssHooks[e+t].set=Tr)}),u.fn.extend({css:function(e,t){return xe(this,function(i,l,f){var h,x,b={},v=0;if(Array.isArray(l)){for(h=Ht(i),x=l.length;v1)}});function Ae(e,t,i,l,f){return new Ae.prototype.init(e,t,i,l,f)}u.Tween=Ae,Ae.prototype={constructor:Ae,init:function(e,t,i,l,f,h){this.elem=e,this.prop=i,this.easing=f||u.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=l,this.unit=h||(u.cssNumber[i]?"":"px")},cur:function(){var e=Ae.propHooks[this.prop];return e&&e.get?e.get(this):Ae.propHooks._default.get(this)},run:function(e){var t,i=Ae.propHooks[this.prop];return this.options.duration?this.pos=t=u.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):Ae.propHooks._default.set(this),this}},Ae.prototype.init.prototype=Ae.prototype,Ae.propHooks={_default:{get:function(e){var t;return e.elem.nodeType!==1||e.elem[e.prop]!=null&&e.elem.style[e.prop]==null?e.elem[e.prop]:(t=u.css(e.elem,e.prop,""),!t||t==="auto"?0:t)},set:function(e){u.fx.step[e.prop]?u.fx.step[e.prop](e):e.elem.nodeType===1&&(u.cssHooks[e.prop]||e.elem.style[$t(e.prop)]!=null)?u.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ae.propHooks.scrollTop=Ae.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},u.easing={linear:function(e){return e},swing:function(e){return .5-Math.cos(e*Math.PI)/2},_default:"swing"},u.fx=Ae.prototype.init,u.fx.step={};var vt,Yt,fn=/^(?:toggle|show|hide)$/,hn=/queueHooks$/;function er(){Yt&&(A.hidden===!1&&o.requestAnimationFrame?o.requestAnimationFrame(er):o.setTimeout(er,u.fx.interval),u.fx.tick())}function Lr(){return o.setTimeout(function(){vt=void 0}),vt=Date.now()}function Bt(e,t){var i,l=0,f={height:e};for(t=t?1:0;l<4;l+=2-t)i=Ze[l],f["margin"+i]=f["padding"+i]=e;return t&&(f.opacity=f.width=e),f}function Ir(e,t,i){for(var l,f=(qe.tweeners[t]||[]).concat(qe.tweeners["*"]),h=0,x=f.length;h1)},removeAttr:function(e){return this.each(function(){u.removeAttr(this,e)})}}),u.extend({attr:function(e,t,i){var l,f,h=e.nodeType;if(!(h===3||h===8||h===2)){if(typeof e.getAttribute>"u")return u.prop(e,t,i);if((h!==1||!u.isXMLDoc(e))&&(f=u.attrHooks[t.toLowerCase()]||(u.expr.match.bool.test(t)?Ar:void 0)),i!==void 0){if(i===null){u.removeAttr(e,t);return}return f&&"set"in f&&(l=f.set(e,i,t))!==void 0?l:(e.setAttribute(t,i+""),i)}return f&&"get"in f&&(l=f.get(e,t))!==null?l:(l=u.find.attr(e,t),l??void 0)}},attrHooks:{type:{set:function(e,t){if(!E.radioValue&&t==="radio"&&ae(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}},removeAttr:function(e,t){var i,l=0,f=t&&t.match(Ne);if(f&&e.nodeType===1)for(;i=f[l++];)e.removeAttribute(i)}}),Ar={set:function(e,t,i){return t===!1?u.removeAttr(e,i):e.setAttribute(i,i),i}},u.each(u.expr.match.bool.source.match(/\w+/g),function(e,t){var i=_t[t]||u.find.attr;_t[t]=function(l,f,h){var x,b,v=f.toLowerCase();return h||(b=_t[v],_t[v]=x,x=i(l,f,h)!=null?v:null,_t[v]=b),x}});var xn=/^(?:input|select|textarea|button)$/i,gn=/^(?:a|area)$/i;u.fn.extend({prop:function(e,t){return xe(this,u.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[u.propFix[e]||e]})}}),u.extend({prop:function(e,t,i){var l,f,h=e.nodeType;if(!(h===3||h===8||h===2))return(h!==1||!u.isXMLDoc(e))&&(t=u.propFix[t]||t,f=u.propHooks[t]),i!==void 0?f&&"set"in f&&(l=f.set(e,i,t))!==void 0?l:e[t]=i:f&&"get"in f&&(l=f.get(e,t))!==null?l:e[t]},propHooks:{tabIndex:{get:function(e){var t=u.find.attr(e,"tabindex");return t?parseInt(t,10):xn.test(e.nodeName)||gn.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),E.optSelected||(u.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),u.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){u.propFix[this.toLowerCase()]=this});function ct(e){var t=e.match(Ne)||[];return t.join(" ")}function dt(e){return e.getAttribute&&e.getAttribute("class")||""}function tr(e){return Array.isArray(e)?e:typeof e=="string"?e.match(Ne)||[]:[]}u.fn.extend({addClass:function(e){var t,i,l,f,h,x;return M(e)?this.each(function(b){u(this).addClass(e.call(this,b,dt(this)))}):(t=tr(e),t.length?this.each(function(){if(l=dt(this),i=this.nodeType===1&&" "+ct(l)+" ",i){for(h=0;h-1;)i=i.replace(" "+f+" "," ");x=ct(i),l!==x&&this.setAttribute("class",x)}}):this):this.attr("class","")},toggleClass:function(e,t){var i,l,f,h,x=typeof e,b=x==="string"||Array.isArray(e);return M(e)?this.each(function(v){u(this).toggleClass(e.call(this,v,dt(this),t),t)}):typeof t=="boolean"&&b?t?this.addClass(e):this.removeClass(e):(i=tr(e),this.each(function(){if(b)for(h=u(this),f=0;f-1)return!0;return!1}});var yn=/\r/g;u.fn.extend({val:function(e){var t,i,l,f=this[0];return arguments.length?(l=M(e),this.each(function(h){var x;this.nodeType===1&&(l?x=e.call(this,h,u(this).val()):x=e,x==null?x="":typeof x=="number"?x+="":Array.isArray(x)&&(x=u?.map(x,function(b){return b==null?"":b+""})),t=u.valHooks[this.type]||u.valHooks[this.nodeName.toLowerCase()],(!t||!("set"in t)||t.set(this,x,"value")===void 0)&&(this.value=x))})):f?(t=u.valHooks[f.type]||u.valHooks[f.nodeName.toLowerCase()],t&&"get"in t&&(i=t.get(f,"value"))!==void 0?i:(i=f.value,typeof i=="string"?i.replace(yn,""):i??"")):void 0}}),u.extend({valHooks:{option:{get:function(e){var t=u.find.attr(e,"value");return t??ct(u.text(e))}},select:{get:function(e){var t,i,l,f=e.options,h=e.selectedIndex,x=e.type==="select-one",b=x?null:[],v=x?h+1:f.length;for(h<0?l=v:l=x?h:0;l-1)&&(i=!0);return i||(e.selectedIndex=-1),h}}}}),u.each(["radio","checkbox"],function(){u.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=u.inArray(u(e).val(),t)>-1}},E.checkOn||(u.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})});var Rt=o.location,Pr={guid:Date.now()},rr=/\?/;u.parseXML=function(e){var t,i;if(!e||typeof e!="string")return null;try{t=new o.DOMParser().parseFromString(e,"text/xml")}catch{}return i=t&&t.getElementsByTagName("parsererror")[0],(!t||i)&&u.error("Invalid XML: "+(i?u?.map(i.childNodes,function(l){return l.textContent}).join(` -`):e)),t};var Fr=/^(?:focusinfocus|focusoutblur)$/,Wr=function(e){e.stopPropagation()};u.extend(u.event,{trigger:function(e,t,i,l){var f,h,x,b,v,w,R,I,C=[i||A],F=k.call(e,"type")?e.type:e,ne=k.call(e,"namespace")?e.namespace.split("."):[];if(h=I=x=i=i||A,!(i.nodeType===3||i.nodeType===8)&&!Fr.test(F+u.event.triggered)&&(F.indexOf(".")>-1&&(ne=F.split("."),F=ne.shift(),ne.sort()),v=F.indexOf(":")<0&&"on"+F,e=e[u.expando]?e:new u.Event(F,typeof e=="object"&&e),e.isTrigger=l?2:3,e.namespace=ne.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+ne.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),t=t==null?[e]:u.makeArray(t,[e]),R=u.event.special[F]||{},!(!l&&R.trigger&&R.trigger.apply(i,t)===!1))){if(!l&&!R.noBubble&&!P(i)){for(b=R.delegateType||F,Fr.test(b+F)||(h=h.parentNode);h;h=h.parentNode)C.push(h),x=h;x===(i.ownerDocument||A)&&C.push(x.defaultView||x.parentWindow||o)}for(f=0;(h=C[f++])&&!e.isPropagationStopped();)I=h,e.type=f>1?b:R.bindType||F,w=(V.get(h,"events")||Object.create(null))[e.type]&&V.get(h,"handle"),w&&w.apply(h,t),w=v&&h[v],w&&w.apply&&Be(h)&&(e.result=w.apply(h,t),e.result===!1&&e.preventDefault());return e.type=F,!l&&!e.isDefaultPrevented()&&(!R._default||R._default.apply(C.pop(),t)===!1)&&Be(i)&&v&&M(i[F])&&!P(i)&&(x=i[v],x&&(i[v]=null),u.event.triggered=F,e.isPropagationStopped()&&I.addEventListener(F,Wr),i[F](),e.isPropagationStopped()&&I.removeEventListener(F,Wr),u.event.triggered=void 0,x&&(i[v]=x)),e.result}},simulate:function(e,t,i){var l=u.extend(new u.Event,i,{type:e,isSimulated:!0});u.event.trigger(l,null,t)}}),u.fn.extend({trigger:function(e,t){return this.each(function(){u.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];if(i)return u.event.trigger(e,t,i,!0)}});var vn=/\[\]$/,Hr=/\r?\n/g,bn=/^(?:submit|button|image|reset|file)$/i,jn=/^(?:input|select|textarea|keygen)/i;function nr(e,t,i,l){var f;if(Array.isArray(t))u.each(t,function(h,x){i||vn.test(e)?l(e,x):nr(e+"["+(typeof x=="object"&&x!=null?h:"")+"]",x,i,l)});else if(!i&&se(t)==="object")for(f in t)nr(e+"["+f+"]",t[f],i,l);else l(e,t)}u.param=function(e,t){var i,l=[],f=function(h,x){var b=M(x)?x():x;l[l.length]=encodeURIComponent(h)+"="+encodeURIComponent(b??"")};if(e==null)return"";if(Array.isArray(e)||e.jquery&&!u.isPlainObject(e))u.each(e,function(){f(this.name,this.value)});else for(i in e)nr(i,e[i],t,f);return l.join("&")},u.fn.extend({serialize:function(){return u.param(this.serializeArray())},serializeArray:function(){return this?.map(function(){var e=u.prop(this,"elements");return e?u.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!u(this).is(":disabled")&&jn.test(this.nodeName)&&!bn.test(e)&&(this.checked||!Ct.test(e))})?.map(function(e,t){var i=u(this).val();return i==null?null:Array.isArray(i)?u?.map(i,function(l){return{name:t.name,value:l.replace(Hr,`\r -`)}}):{name:t.name,value:i.replace(Hr,`\r -`)}}).get()}});var Dn=/%20/g,kn=/#.*$/,wn=/([?&])_=[^&]*/,En=/^(.*?):[ \t]*([^\r\n]*)$/mg,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,Sn=/^\/\//,Yr={},ar={},Br="*/".concat("*"),ir=A.createElement("a");ir.href=Rt.href;function qr(e){return function(t,i){typeof t!="string"&&(i=t,t="*");var l,f=0,h=t.toLowerCase().match(Ne)||[];if(M(i))for(;l=h[f++];)l[0]==="+"?(l=l.slice(1)||"*",(e[l]=e[l]||[]).unshift(i)):(e[l]=e[l]||[]).push(i)}}function Jr(e,t,i,l){var f={},h=e===ar;function x(b){var v;return f[b]=!0,u.each(e[b]||[],function(w,R){var I=R(t,i,l);if(typeof I=="string"&&!h&&!f[I])return t.dataTypes.unshift(I),x(I),!1;if(h)return!(v=I)}),v}return x(t.dataTypes[0])||!f["*"]&&x("*")}function sr(e,t){var i,l,f=u.ajaxSettings.flatOptions||{};for(i in t)t[i]!==void 0&&((f[i]?e:l||(l={}))[i]=t[i]);return l&&u.extend(!0,e,l),e}function _n(e,t,i){for(var l,f,h,x,b=e.contents,v=e.dataTypes;v[0]==="*";)v.shift(),l===void 0&&(l=e.mimeType||t.getResponseHeader("Content-Type"));if(l){for(f in b)if(b[f]&&b[f].test(l)){v.unshift(f);break}}if(v[0]in i)h=v[0];else{for(f in i){if(!v[0]||e.converters[f+" "+v[0]]){h=f;break}x||(x=f)}h=h||x}if(h)return h!==v[0]&&v.unshift(h),i[h]}function Rn(e,t,i,l){var f,h,x,b,v,w={},R=e.dataTypes.slice();if(R[1])for(x in e.converters)w[x.toLowerCase()]=e.converters[x];for(h=R.shift();h;)if(e.responseFields[h]&&(i[e.responseFields[h]]=t),!v&&l&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),v=h,h=R.shift(),h){if(h==="*")h=v;else if(v!=="*"&&v!==h){if(x=w[v+" "+h]||w["* "+h],!x){for(f in w)if(b=f.split(" "),b[1]===h&&(x=w[v+" "+b[0]]||w["* "+b[0]],x)){x===!0?x=w[f]:w[f]!==!0&&(h=b[0],R.unshift(b[1]));break}}if(x!==!0)if(x&&e.throws)t=x(t);else try{t=x(t)}catch(I){return{state:"parsererror",error:x?I:"No conversion from "+v+" to "+h}}}}return{state:"success",data:t}}u.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Rt.href,type:"GET",isLocal:Nn.test(Rt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Br,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":u.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?sr(sr(e,u.ajaxSettings),t):sr(u.ajaxSettings,e)},ajaxPrefilter:qr(Yr),ajaxTransport:qr(ar),ajax:function(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};var i,l,f,h,x,b,v,w,R,I,C=u.ajaxSetup({},t),F=C.context||C,ne=C.context&&(F.nodeType||F.jquery)?u(F):u.event,de=u.Deferred(),oe=u.Callbacks("once memory"),Se=C.statusCode||{},Ce={},Ke={},Qe="canceled",ce={readyState:0,getResponseHeader:function(he){var we;if(v){if(!h)for(h={};we=En.exec(f);)h[we[1].toLowerCase()+" "]=(h[we[1].toLowerCase()+" "]||[]).concat(we[2]);we=h[he.toLowerCase()+" "]}return we==null?null:we.join(", ")},getAllResponseHeaders:function(){return v?f:null},setRequestHeader:function(he,we){return v==null&&(he=Ke[he.toLowerCase()]=Ke[he.toLowerCase()]||he,Ce[he]=we),this},overrideMimeType:function(he){return v==null&&(C.mimeType=he),this},statusCode:function(he){var we;if(he)if(v)ce.always(he[ce.status]);else for(we in he)Se[we]=[Se[we],he[we]];return this},abort:function(he){var we=he||Qe;return i&&i.abort(we),ft(0,we),this}};if(de.promise(ce),C.url=((e||C.url||Rt.href)+"").replace(Sn,Rt.protocol+"//"),C.type=t.method||t.type||C.method||C.type,C.dataTypes=(C.dataType||"*").toLowerCase().match(Ne)||[""],C.crossDomain==null){b=A.createElement("a");try{b.href=C.url,b.href=b.href,C.crossDomain=ir.protocol+"//"+ir.host!=b.protocol+"//"+b.host}catch{C.crossDomain=!0}}if(C.data&&C.processData&&typeof C.data!="string"&&(C.data=u.param(C.data,C.traditional)),Jr(Yr,C,t,ce),v)return ce;w=u.event&&C.global,w&&u.active++===0&&u.event.trigger("ajaxStart"),C.type=C.type.toUpperCase(),C.hasContent=!Cn.test(C.type),l=C.url.replace(kn,""),C.hasContent?C.data&&C.processData&&(C.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(C.data=C.data.replace(Dn,"+")):(I=C.url.slice(l.length),C.data&&(C.processData||typeof C.data=="string")&&(l+=(rr.test(l)?"&":"?")+C.data,delete C.data),C.cache===!1&&(l=l.replace(wn,"$1"),I=(rr.test(l)?"&":"?")+"_="+Pr.guid+++I),C.url=l+I),C.ifModified&&(u.lastModified[l]&&ce.setRequestHeader("If-Modified-Since",u.lastModified[l]),u.etag[l]&&ce.setRequestHeader("If-None-Match",u.etag[l])),(C.data&&C.hasContent&&C.contentType!==!1||t.contentType)&&ce.setRequestHeader("Content-Type",C.contentType),ce.setRequestHeader("Accept",C.dataTypes[0]&&C.accepts[C.dataTypes[0]]?C.accepts[C.dataTypes[0]]+(C.dataTypes[0]!=="*"?", "+Br+"; q=0.01":""):C.accepts["*"]);for(R in C.headers)ce.setRequestHeader(R,C.headers[R]);if(C.beforeSend&&(C.beforeSend.call(F,ce,C)===!1||v))return ce.abort();if(Qe="abort",oe.add(C.complete),ce.done(C.success),ce.fail(C.error),i=Jr(ar,C,t,ce),!i)ft(-1,"No Transport");else{if(ce.readyState=1,w&&ne.trigger("ajaxSend",[ce,C]),v)return ce;C.async&&C.timeout>0&&(x=o.setTimeout(function(){ce.abort("timeout")},C.timeout));try{v=!1,i.send(Ce,ft)}catch(he){if(v)throw he;ft(-1,he)}}function ft(he,we,Tt,lr){var Ge,Ot,Xe,it,st,He=we;v||(v=!0,x&&o.clearTimeout(x),i=void 0,f=lr||"",ce.readyState=he>0?4:0,Ge=he>=200&&he<300||he===304,Tt&&(it=_n(C,ce,Tt)),!Ge&&u.inArray("script",C.dataTypes)>-1&&u.inArray("json",C.dataTypes)<0&&(C.converters["text script"]=function(){}),it=Rn(C,it,ce,Ge),Ge?(C.ifModified&&(st=ce.getResponseHeader("Last-Modified"),st&&(u.lastModified[l]=st),st=ce.getResponseHeader("etag"),st&&(u.etag[l]=st)),he===204||C.type==="HEAD"?He="nocontent":he===304?He="notmodified":(He=it.state,Ot=it.data,Xe=it.error,Ge=!Xe)):(Xe=He,(he||!He)&&(He="error",he<0&&(he=0))),ce.status=he,ce.statusText=(we||He)+"",Ge?de.resolveWith(F,[Ot,He,ce]):de.rejectWith(F,[ce,He,Xe]),ce.statusCode(Se),Se=void 0,w&&ne.trigger(Ge?"ajaxSuccess":"ajaxError",[ce,C,Ge?Ot:Xe]),oe.fireWith(F,[ce,He]),w&&(ne.trigger("ajaxComplete",[ce,C]),--u.active||u.event.trigger("ajaxStop")))}return ce},getJSON:function(e,t,i){return u.get(e,t,i,"json")},getScript:function(e,t){return u.get(e,void 0,t,"script")}}),u.each(["get","post"],function(e,t){u[t]=function(i,l,f,h){return M(l)&&(h=h||f,f=l,l=void 0),u.ajax(u.extend({url:i,type:t,dataType:h,data:l,success:f},u.isPlainObject(i)&&i))}}),u.ajaxPrefilter(function(e){var t;for(t in e.headers)t.toLowerCase()==="content-type"&&(e.contentType=e.headers[t]||"")}),u._evalUrl=function(e,t,i){return u.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(l){u.globalEval(l,t,i)}})},u.fn.extend({wrapAll:function(e){var t;return this[0]&&(M(e)&&(e=e.call(this[0])),t=u(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t?.map(function(){for(var i=this;i.firstElementChild;)i=i.firstElementChild;return i}).append(this)),this},wrapInner:function(e){return M(e)?this.each(function(t){u(this).wrapInner(e.call(this,t))}):this.each(function(){var t=u(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=M(e);return this.each(function(i){u(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){u(this).replaceWith(this.childNodes)}),this}}),u.expr.pseudos.hidden=function(e){return!u.expr.pseudos.visible(e)},u.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},u.ajaxSettings.xhr=function(){try{return new o.XMLHttpRequest}catch{}};var Mn={0:200,1223:204},Mt=u.ajaxSettings.xhr();E.cors=!!Mt&&"withCredentials"in Mt,E.ajax=Mt=!!Mt,u.ajaxTransport(function(e){var t,i;if(E.cors||Mt&&!e.crossDomain)return{send:function(l,f){var h,x=e.xhr();if(x.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(h in e.xhrFields)x[h]=e.xhrFields[h];e.mimeType&&x.overrideMimeType&&x.overrideMimeType(e.mimeType),!e.crossDomain&&!l["X-Requested-With"]&&(l["X-Requested-With"]="XMLHttpRequest");for(h in l)x.setRequestHeader(h,l[h]);t=function(b){return function(){t&&(t=i=x.onload=x.onerror=x.onabort=x.ontimeout=x.onreadystatechange=null,b==="abort"?x.abort():b==="error"?typeof x.status!="number"?f(0,"error"):f(x.status,x.statusText):f(Mn[x.status]||x.status,x.statusText,(x.responseType||"text")!=="text"||typeof x.responseText!="string"?{binary:x.response}:{text:x.responseText},x.getAllResponseHeaders()))}},x.onload=t(),i=x.onerror=x.ontimeout=t("error"),x.onabort!==void 0?x.onabort=i:x.onreadystatechange=function(){x.readyState===4&&o.setTimeout(function(){t&&i()})},t=t("abort");try{x.send(e.hasContent&&e.data||null)}catch(b){if(t)throw b}},abort:function(){t&&t()}}}),u.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),u.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return u.globalEval(e),e}}}),u.ajaxPrefilter("script",function(e){e.cache===void 0&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),u.ajaxTransport("script",function(e){if(e.crossDomain||e.scriptAttrs){var t,i;return{send:function(l,f){t=u(" - - - -
- - diff --git a/apps/edr-freight-web/backoffice/public/_um/tinymce/CHANGELOG.md b/apps/edr-freight-web/backoffice/public/_um/tinymce/CHANGELOG.md deleted file mode 100644 index dfa4751f4..000000000 --- a/apps/edr-freight-web/backoffice/public/_um/tinymce/CHANGELOG.md +++ /dev/null @@ -1,3802 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), -and is generated by [Changie](https://github.com/miniscruff/changie). - -## 7.9.3 - 2026-05-19 - -### Security -- Fixed media plugin `data-mce-object` injection leading to stored XSS. #TINY-14357 -- Fixed stored XSS vulnerability through `mce:protected` comments. #TINY-14353 -- Fixed stored XSS vulnerability through `data-mce-` prefixed `src`, `href`, `style` attributes. #TINY-14333 - -## 7.9.2 - 2026-02-11 - -### Deprecated -- The default value of `allow_html_in_comments` will change from `true` to `false` in TinyMCE 8.x. #TINY-11900 - -### Security -- Updated dependencies and parsing logic for enhanced content sanitization. HTML-like content in comments and certain legacy patterns are now sanitized more strictly when `xss_sanitization` is enabled (default). The Introduced `allow_html_in_comments` option provides control over comment node sanitization behavior. - #TINY-11900 -- Introduced `allow_html_in_comments` option (boolean, default: `true`) to control handling of HTML-like syntax in comment nodes. This option will default to `false` in TinyMCE 8.x. #TINY-11900 - -## 7.9.1 - 2025-05-29 - -### Improved -- Update `Notices` file and minified notices. #TINY-12091 - -## 7.9.0 - 2025-05-15 - -### Added -- Added new `disc` style option for unordered lists. #TINY-12015 - -### Improved -- The resize cursor now points in the correct direction for each resize mode. Patch contributed by daniloff200. ##GH-10189 -- If `style_formats` is empty, the button is now disabled. #TINY-12005 -- Inline dialog dropdowns reposition when the dialog is dragged or the window is scrolled. #TINY-11368 -- Bullet list icons were have been updated to better represent the default styles. #TINY-12014 - -### Changed -- The ContextFormSizeInput lock button is now centered instead of aligned to the end. #TINY-11916 -- Changed the default value of `advlist_bullet_styles` option to `default,disc,circle,square`. #TINY-12083 - -### Fixed -- Autolink no longer overrides already existing links when autolinking. #TINY-11836 -- Removed the deprecated CSS media selector `-ms-high-contrast`. #TINY-11876 -- The `mceInsertContent` command no longer deletes the parent block element when an anchor is selected. #TINY-11953 -- Table resizers are now visible when inline editor has a z-index property. #TINY-11981 -- Tabbing inside a `figcaption` element no longer displays two text insertion carets. #TINY-11997 -- Pressing Enter before a floating image no longer duplicates the image. #TINY-11676 -- Editor did not scroll into viewport on receiving focus on Chrome and Safari. #TINY-12017 -- Select UI elements was not properly styled on Chrome version 136. #TINY-12131 - -## 7.8.0 - 2025-04-09 - -### Added -- New subtoolbar support for context toolbars. #TINY-11748 -- New `extended_mathml_attributes` and `extended_mathml_elements` options. #TINY-11756 -- New `onboarding` option. #TINY-11931 - -### Improved -- Focus outline was misaligned with comment card border on saving an edit. #TINY-11329 -- The `editor.selection.scrollIntoView()` method now pads the target scroll area with a small margin, ensuring content doesn't sit at the very edge of the viewport. #TINY-11786 - -### Changed -- Changed promotional text and link. #TINY-11905 - -### Fixed -- Setting editor height to a `pt` or `em` value was ignoring min/max height settings. #TINY-11108 - -## 7.7.2 - 2025-03-19 - -### Fixed -- Error was thrown when pressing tab in the last cell of a non-editable table. #TINY-11797 -- Error was thrown when trying to use the context form API after a component was detached. #TINY-11781 -- Deleting an empty block within an
  • element would move cursor to the end of the
  • . #TINY-11763 -- Deleting an empty block that was between two lists would throw an Error when all three elements were nested inside a list. #TINY-11763 - -## 7.7.1 - 2025-03-05 - -### Fixed -- Skin UI content CSS was truncated when bundling, causing CSS styles to be missing. #TINY-11875 -- Context forms used to disappear if their input was disabled in the `onSetup` API. #TINY-11890 - -## 7.7.0 - 2025-02-20 - -### Added -- `link_attributes_postprocess` option that allows overriding attributes of a link that would be inserted through the link dialog. #TINY-11707 - -### Improved -- Improved visual indication of keyboard focus in annotations that contain an image. #TINY-11596 -- The type now defaults to `info` when `editor.notificationManager.open()` is used without a specified type or with an invalid one. #TINY-11661 - -### Changed -- Updated the `link` plugin behavior to move the cursor outside of the link when inserted or edited via the UI. Patch contributed by Philipp91. #GH-9998 - -### Fixed -- Keyboard navigation for size inputs in context forms. #TINY-11394 -- Keyboard navigation for context form sliders. #TINY-11482 -- The `insertContent` API was not replacing selected non-editable elements correctly. #TINY-11714 -- Context toolbar inputs had incorrect margins. #TINY-11624 -- Iframe aria text no longer suggests opening the help dialog when the help plugin is not enabled. #TINY-11672 -- Preview dialog no longer opens anchor links in a new tab. #TINY-11740 -- The `float` property was not properly removed on the image when converting a image into a captioned image. #TINY-11670 -- Expanding selection to word didn't work inside inline editing host elements. #TINY-11304 -- The `semantics` element in MathML was not properly retained when `annotation` elements were allowed. #TINY-11755 -- It was possible to tab to a toolbar group that had all children disabled. #TINY-11665 -- Keyboard navigation would get stuck on the 'more' toolbar button. #TINY-11762 -- Toolbar groups had both a `title` attribute and a custom tooltip, causing overlapping tooltips #TINY-11768 -- Toolbar text field did not render focus correctly. #TINY-11658 - -## 7.6.1 - 2025-01-22 - -### Fixed -- Text input was prevented in form elements in the contents of the editor. #TINY-11446 -- Opening a notification when the toolbar is positioned at the bottom of the editor threw an error. #TINY-11498 -- Table resize bars were not properly aligned for inline editors inside scrollable containers. #TINY-11215 - -## 7.6.0 - 2024-12-11 - -### Added -- It is now possible to create labeled groups in context toolbars. #TINY-11095 -- New `contextsliderform` and `contextsizeinput` context form types. #TINY-11342 -- New `back` function in `ContextFormApi` to go back to the previous toolbar. #TINY-11344 -- New `QuickbarInsertImage` command that is executed by the `quickimage` button. #TINY-11399 -- New `onSetup` function to the context form API. #TINY-11494 -- New `placeholder` to the context form input field API. #TINY-11459 -- New `disabled` option to restore the previous `readonly` mode behavior, allowing the editor to be displayed in a disabled state. #TINY-11488 - -### Improved -- Base64 data was not properly decoded due to unhandled URL-encoded characters. #TINY-9548 -- The `latin` list style type is now recognized as an alias for the `alpha` list style type. #TINY-11515 - -### Fixed -- Image selection was removed when calling `editor.nodeChanged()` while having focus inside the editor UI. #TINY-11437 -- Tooltip would not show for group toolbar button. #TINY-11391 -- Changing the table row type when a `contenteditable=false` cell was selected would not work as expected. #TINY-11383 -- The `samp` format was being applied as a `block` level format, instead of an `inline` format. #TINY-11390 -- Removed title attribute from dialog tree elements as they already have a tooltip. #TINY-11470 -- Fixed CSS bundling for skin UI content CSS. #TINY-11558 -- Fixed incorrect resource keys for CSS bundling JS files. #TINY-11558 - -## 7.5.0 - 2024-11-06 - -### Added -- Added support for using raw CSS in the list of possible colours, using the `color_map_raw` property. #GH-9788 - -### Improved -- Improved color picker aria support. #TINY-11291 - -### Fixed -- Autocompleter would not activate after applying an inline format like font size in some cases. #TINY-11273 -- The `toolbar-sticky-offset` would still be applied after entering fullscreen mode. #TINY-11137 -- Text and background color toolbar buttons would not be fully greyed out in readonly mode. #TINY-11313 -- Closing a nested modal dialog would lose focus from the editor. #TINY-11153 -- Inability to type '{' character on German keyboard layouts. #TINY-11395 - -## 7.4.1 - 2024-10-10 - -### Fixed -- Invalid HTML elements within SVG elements were not removed. #TINY-11332 - -## 7.4.0 - 2024-10-09 - -### Added -- New `context` property for all ui components. This allows buttons and menu items to be enabled or disabled based on whether their context matches a given predicate; status updates are checked on `init`, `NodeChange`, and `SwitchMode` events. #TINY-11211 -- Tree component now allows the addition of a custom icon. #TINY-11131 -- Added focus function to view button api. #TINY-11122 -- New option `allow_mathml_annotation_encodings` to opt-in to keep math annotations with specific encodings. #TINY-11166 -- Added global `color-active` LESS variable for use in editor skins. #TINY-11266 - -### Improved -- In read-only mode the editor now allows normal cursor movement and block element selection, including video playback. #TINY-11264 -- Pasting a table now places the cursor after the table instead of into the last cell. #TINY-11082 -- Dialog list dropdown menus now close when the browser window resizes. #TINY-11123 - -### Fixed -- Mouse hover on partially visible dialog collection elements no longer scrolls. #TINY-9915 -- Caret would unexpectedly shift to the non-editable table row above when pressing Enter. #TINY-11077 -- Deleting a selection in a list element would sometimes prevent the `input` event from being dispatched. #TINY-11100 -- Placing the cursor after a table with a br after it would misplace added newlines before the table instead of after. #TINY-11110 -- Sidebar could not be toggled until the skin was loaded. #TINY-11155 -- The image dialog lost focus after closing an image upload error alert. #TINY-11159 -- Copying tables to the clipboard did not correctly separate cells and rows for the "text/plain" MIME type. #TINY-10847 -- The editor resize handle was incorrectly rendered when all components were removed from the status bar. #TINY-11257 - -## 7.3.0 - 2024-08-07 - -### Added -- Colorpicker number input fields now show an error tooltip and error icon when invalid text has been entered. #TINY-10799 -- New `format-code` icon. #TINY-11018 - -### Improved -- When a full document was loaded as editor content the head elements were added to the body. #TINY-11053 - -### Fixed -- Unnecessary nbsp entities were inserted when typing at the edges of inline elements. #TINY-10854 -- Fixed JavaScript error when inserting a table using the context menu by adjusting the event order in `renderInsertTableMenuItem`. #TINY-6887 -- Notifications didn't position and resize properly when resizing the editor or toggling views. #TINY-10894 -- The pattern commands would execute even if the command was not enabled. #TINY-10994 -- Split button popups were incorrectly positioned when switching to fullscreen mode if the editor was inside a scrollable container. #TINY-10973 -- Sequential html comments would in some cases generate unwanted elements. #TINY-10955 -- The listbox component had a fixed width and was not a responsive ui element. #TINY-10884 -- Prevent default mousedown on toolbar buttons was causing misplaced focus bugs. #TINY-10638 -- Attempting to use focus commands on an editor where the cursor had last been in certain contentEditable="true" elements would fail. #TINY-11085 -- Colorpicker's hex-based input field showed the wrong validation error message. #TINY-11115 - -## 7.2.1 - 2024-07-03 - -### Fixed -- Text content could move unexpectedly when deleting a paragraph. #TINY-10590 -- Cursor would shift to the start of the editor body when focus was shifted to a noneditable cell of a table. #TINY-10127 -- Long translations of the bottom help text would cause minor graphical issues. #TINY-10961 -- Open Link button was disabled when selection partially covered a link or when multiple links were selected. #TINY-11009 - -## 7.2.0 - 2024-06-19 - -### Added -- Added `options.debug` API that logs the initial raw editor options to console. #TINY-10605 -- Added `referrerpolicy` as a valid attribute for an iframe element. #TINY-10374 -- New `onInit` and `stretched` properties to the `HtmlPanel` dialog component. #TINY-10900 -- Added support for querying the state of the `mceTogglePlainTextPaste` command. #TINY-10938 -- Added `for` option to dialog label components to improve accessibility. The value must be another component on the same dialog. #TINY-10971 - -### Improved -- Dialog slider components now emit an onChange event when using arrow keys. #TINY-10428 -- Accessibility for element path buttons, added tooltip to describe the button and removed incorrect `aria-level` attribute. #TINY-10891 -- Improve merging of inserted inline elements by removing nodes with redundant inheritable styles. #TINY-10869 -- Improved Find & Replace dialog accessibility by changing placeholders to labels. #TINY-10871 - -### Changed -- Replaced tiny branding logo with `Build with TinyMCE` text and logo. #TINY-11001 - -### Fixed -- Deleting in a `div` with preceeding `br` elements would sometimes throw errors. #TINY-10840 -- `autoresize_bottom_margin` was not reliably applied in some situations. #TINY-10793 -- Fixed cases where adding a newline around a br, table or img would not move the cursor to a new line. #TINY-10384 -- Focusing on `contenteditable="true"` element when using `editable_root: false` and inline mode causing selection to be shifted. #TINY-10820 -- Corrected the `role` attribute on listbox dialog components to `combobox` when there are no nested menu items. #TINY-10807 -- HTML entities that were double decoded in `noscript` elements caused an XSS vulnerability. #TINY-11019 -- It was possible to inject XSS HTML that was not matching the regexp when using the `noneditable_regexp` option. #TINY-11022 - -## 7.1.2 - 2024-06-05 - -### Fixed -- CSS color values set to `transparent` were incorrectly converted to '#000000`. #TINY-10916 - -## 7.1.1 - 2024-05-22 - -### Fixed -- Insert/Edit image dialog lost focus after the image upload completed. #TINY-10885 -- Deleting into a list from a paragraph that has an `img` tag could cause extra inline styles to be added. #TINY-10892 -- Resolved an issue where emojis configured with the `emojiimages` database were not loading correctly due to a broken CDN. #TINY-10878 -- Iframes in dialogs were not rendering rounded borders correctly. #TINY-10901 -- Autocompleter possible values are no longer capped at a length of 10. #TINY-10942 - -## 7.1.0 - 2024-05-08 - -### Added -- Parser support for math elements. #TINY-10809 -- New `math-equation` icon. #TINY-10804 - -### Improved -- Included `itemprop`, `itemscope` and `itemtype` as valid HTML5 attributes in the core schema. #TINY-9932 -- Notification accessibility improvements: added tooltips, keyboard navigation and shortcut to focus on notifications. #TINY-6925 -- Removed `aria-pressed` from the `More` button in sliding toolbar mode and replaced it with `aria-expanded`. #TINY-10795 -- The editor UI now renders correctly in Windows High Contrast Mode. #TINY-10781 - -### Fixed -- Backspacing in certain html setups resulted in data moving around unexpectedly. #TINY-10590 -- Dialog title markup changed to use an `h1` element instead of `div`. #TINY-10800 -- Dialog title was not announced in macOS VoiceOver, dialogs now use `aria-label` instead of `aria-labelledby` on macOS. #TINY-10808 -- Theme loader did not respect the suffix when it was loading skin CSS files. #TINY-10602 -- Custom block elements with colon characters would throw errors. #TINY-10813 -- Tab navigation in views didn't work. #TINY-10780 -- Video and audio elements could not be played on Safari. #TINY-10774 -- `ToggleToolbarDrawer` command did not toggle the toolbar in `sliding` mode when `{skipFocus: true}` parameter was passed. #TINY-10726 -- The buttons in the custom view header were clipped on when overflowing. #TINY-10741 -- In the custom view, the scrollbar of the container was not visible if its height was greater than the editor. #TINY-10741 -- Fixed accessibility issue by removing duplicate `role="menu"` attribute from color swatches. #TINY-10806 -- Fullscreen mode now prevents focus from leaving the editor. #TINY-10597 -- Open link context menu action did not work with selection surrounding a link. #TINY-10391 -- Styles were not retained when toggling a list on and off. #TINY-10837 -- Caret and placeholder text were invisible in Windows High Contrast Mode. #TINY-9811 -- Firefox did not announce the iframe title when `iframe_aria_text` was set. #TINY-10718 -- Notification width was not constrained to the width of the editor. #TINY-10886 -- Open link context menu action was not enabled for links on images. #TINY-10391 - -## 7.0.1 - 2024-04-10 - -### Fixed -- Toggle list behavior generated wrong html when the `forced_root_block` option was set to `div`. #TINY-10488 -- Tapping inside a composed text on Firefox Android would not close the autocompleter. #TINY-10715 -- An inline editor toolbar now behaves correctly in horizontally scrolled containers. #TINY-10684 -- Tooltips unintended shrinking and incorrectly positioned when shown in horizontally scrollable container. #TINY-10797 -- The status bar was invisible when the editor's height is short. #TINY-10705 - -## 7.0.0 - 2024-03-20 - -### Added -- New `license_key` option that must be set to `gpl` or a valid license key. #TINY-10681 -- New custom tooltip functionality, tooltip will be shown when hovering with a mouse or with keyboard focus. #TINY-9275 -- New `sandbox_iframes_exclusions` option that holds a list of URL host names to be excluded from iframe sandboxing when `sandbox_iframes` is set to `true`. #TINY-10350 -- Added 'getAllEmojis' api function to the emoticons plugin. #TINY-10572 -- Element preset support for the `valid_children` option and Schema.addValidChildren API. #TINY-9979 -- A new `trigger` property for block text pattern configurations, allowing pattern activation with either Space or Enter keys. #TINY-10324 -- onFocus callback for CustomEditor dialog component. #TINY-10596 -- icons for the import from Word, export to Word and export to PDF premium plugins. #TINY-10612 -- `data` is now a valid element in the Schema. #TINY-10611 -- More advanced schema config for custom elements. #TINY-9980 -- Custom tooltip for autocompleter, now visible on both mouse hover and keyboard focus, except single column cases. #TINY-9638 - -### Improved -- Included keyboard shortcut in custom tooltip for `ToolbarButton` and `ToolbarToggleButton`. #TINY-10487 -- Improved showing which element has focus for keyboard navigation. #TINY-9176 -- Custom tooltips will now show for items in `collection` which is rendered inside a dialog, on mouse hover and keyboard focus. #TINY-9637 -- Autocompleter will now work with IMEs. #TINY-10637 -- Make table ghost element better reflect height changes when resizing. #TINY-10658 - -### Changed -- TinyMCE is now licensed GPL Version 2 or later. #TINY-10578 -- `convert_unsafe_embeds` editor option is now defaulted to `true`. #TINY-10351 -- `sandbox_iframes` editor option is now defaulted to `true`. #TINY-10350 -- The DOMUtils.isEmpty API function has been modified to consider nodes containing only comments as empty. #TINY-10459 -- The `highlight_on_focus` option now defaults to true, adding a focus outline to every editor. #TINY-10574 -- Delay before the tooltip to show up, from 800ms to 300ms. #TINY-10475 -- Now `tox-view__pane` has `position: relative` instead of `static`. #TINY-10561 -- Update outbound link for statusbar Tiny logo #TINY-10494 -- Remove the height field from the `table` plugin cell dialog. The `table` plugin row dialog now controls the row height by setting the height on the `tr` element, not the `td` elements. #TINY-10617 -- Change table height resizing handling to remove heights from `td`/`th` elements and only apply to `tr` elements. #TINY-10589 -- Removed incorrect `aria-placeholder` attribute from editor body when `placeholder` option is set. #TINY-10452 -- The `tooltip` property for dialog's footer `togglebutton` is now optional. #TINY-10672 -- Changed the `media_url_resolver` option to use promises. #TINY-9154 -- `Styles` bespoke toolbar button fallback changed to `Formats` if `Paragraph` is not configured in `style_formats` option. #TINY-10603 -- Updated deprecation/removed console message. #TINY-10694 - -### Removed -- Deprecated `force_hex_color` option, with the default now being all colors are forced to hex format as lower case. #TINY-10436 -- Deprecated `remove_trailing_brs` option from DomParser. #TINY-10454 -- `title` attribute on buttons with visible label. #TINY-10453 -- `InsertOrderedList` and `InsertUnorderedList` commands from core, these now only exist in the `lists` plugin. #TINY-10644 -- `closeButton` from the notification API, close buttons in notifications are now required. #TINY-10646 -- The autocompleter `ch` configuration property has been removed. Use the `trigger` property instead. #TINY-8929 -- Deprecated `template` plugin. #TINY-10654 - -### Fixed -- When deleting the last row in a table, the cursor would jump to the first cell (top left), instead of moving to the next adjacent cell in some cases. #TINY-6309 -- Heading formatting would be partially applied to the content within the `summary` element when the caret was positioned between words. #TINY-10312 -- Moving focus to the outside of the editor after having clicked a menu would not fire a `blur` event as expected. #TINY-10310 -- Autocomplete would sometimes cause corrupt data when starting during text composition. #TINY-10317 -- Inline mode with persisted toolbar would show regardless of the skin being loaded, causing css issues. #TINY-10482 -- Table classes couldn't be removed via setting an empty value in `table_class_list`. Also fixed being forced to pick the first class option. #TINY-6653 -- Directly right clicking on a ol's li in FireFox didn't enable the button `List Properties...` in the context menu. #TINY-10490 -- The `link_default_target` option wasn't considered when inserting a link via `quicklink` toolbar. #TINY-10439 -- When inline editor toolbar wrapped to multiple lines the top wasn't always calculated correctly. #TINY-10580 -- Removed manually dispatching dragend event on drop in Firefox. #TINY-10389 -- Slovenian help dialog content had a dot in the wrong place. #TINY-10601 -- Pressing Backspace at the start of an empty `summary` element within a `details` element nested in a list item no longer removes the `summary` element. #TINY-10303 -- The toolbar width was miscalculated for the inline editor positioned inside a scrollable container. #TINY-10581 -- Fixed incorrect object processor for `event_root` option. #TINY-10433 -- Adding newline after using `selection.setContent` to insert a block element would throw an unhandled exception. #TINY-10560 -- Floating toolbar buttons in inline editor incorrectly wrapped into multiple rows on window resizing or zooming. #TINY-10570 -- When setting table border width and `table_style_by_css` is true, only the border attribute is set to 0 and border-width styling is no longer used. #TINY-10308 -- Clicking to the left or right of a non-editable div in Firefox would show two cursors. #TINY-10314 - -## 6.8.3 - 2024-02-08 - -### Changed -- Update outbound TinyMCE website links. #TINY-10491 - -### Fixed -- The floating toolbar would not be fully visible when the editor was placed inside a scrollable container. #TINY-10335 -- ShadowDOM skin was not loaded properly when used with js bundling feature. #TINY-10451 - -## 6.8.2 - 2023-12-11 - -### Fixed -- Bespoke select toolbar buttons including `fontfamily`, `fontsize`, `blocks`, and `styles` incorrectly used plural words in their accessible names. #TINY-10426 -- The `align` bespoke select toolbar button had an accessible name that was misleading and grammatically incorrect in certain cases. #TINY-10435 -- Accessible names of bespoke select toolbar buttons including `align`, `fontfamily`, `fontsize`, `blocks`, and `styles` were incorrectly translated. #TINY-10426 #TINY-10435 -- Clicking inside table cells with heavily nested content could cause the browser to hang. #TINY-10380 -- Toggling a list that contains an LI element having another list as its first child would remove the remaining content within that LI element. #TINY-10414 - -## 6.8.1 - 2023-11-29 - -### Improved -- Colorpicker now includes the Brightness/Saturation selector and hue slider in the keyboard navigable items. #TINY-9287 - -### Fixed -- Translation syntax for announcement text in the table grid was incorrectly formatted. #TINY-10141 -- The functions `schema.isWrapper` and `schema.isInline` did not exclude node names that started with `#` which should not be considered as elements. #TINY-10385 - -## 6.8.0 - 2023-11-22 - -### Added -- CSS files are now also generated as separate JS files to improve bundling of all resources. #TINY-10352 -- Added new `StylesheetLoader.loadRawCss` API that can be used to load CSS into a style element. #TINY-10352 -- Added new `StylesheetLoader.unloadRawCss` API that can be used to unload CSS that was loaded into a style element. #TINY-10352 -- Added `force_hex_color` editor option. Option `'always'` converts all RGB & RGBA colours to hex, `'rgb_only'` will only convert RGB and *not* RGBA colours to hex, `'off'` won't convert any colours to hex. #TINY-9819 -- Added `default_font_stack` editor option that makes it possible to define what is considered a system font stack. #TINY-10290 -- New `sandbox_iframes` option that controls whether iframe elements will be added a `sandbox=""` attribute to mitigate malicious intent. #TINY-10348 -- New `convert_unsafe_embeds` option that controls whether `` and `` elements will be converted to more restrictive alternatives, namely `` for image MIME types, `