@trii/components 3.1.6 → 3.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/cjs/index.js +44 -43
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/theme.js +643 -1
  4. package/dist/cjs/theme.js.map +1 -1
  5. package/dist/esm/index.js +43 -42
  6. package/dist/esm/index.js.map +1 -1
  7. package/dist/esm/theme.js +604 -1
  8. package/dist/esm/theme.js.map +1 -1
  9. package/dist/index.d.ts +10 -0
  10. package/dist/types/components/ContactInfoPopup/components/BusinessSection/BusinessSection.d.ts +1 -1
  11. package/dist/types/components/ContactInfoPopup/components/ContactMethod/ContactMethod.d.ts +1 -0
  12. package/dist/types/components/ContactInfoPopup/components/LabelsSection/LabelsSection.d.ts +1 -1
  13. package/dist/types/components/ContactInfoPopup/components/MembersSection/MembersSection.d.ts +1 -1
  14. package/dist/types/components/ContactSidebar/ChatDetailsSidebar.d.ts +10 -0
  15. package/dist/types/components/ContactSidebar/components/CombineContactsModal/CombineContactsModal.d.ts +1 -1
  16. package/dist/types/components/ContactSidebar/components/MediaViewer/MediaViewer.d.ts +1 -1
  17. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactButton/ContactButton.d.ts +1 -0
  18. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactButton/components/ExternalLink/ExternalLink.d.ts +1 -0
  19. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactConversation/ContactConversation.d.ts +1 -0
  20. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactConversation/styles.d.ts +2 -1
  21. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactData/ContactData.d.ts +1 -0
  22. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactData/components/Properties/Properties.d.ts +1 -1
  23. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactData/styles.d.ts +2 -1
  24. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactDataDetails/ContactDataDetails.d.ts +1 -0
  25. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactEvent/ContactEvent.d.ts +1 -0
  26. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactEvent/components/AddEvent/styles.d.ts +2 -1
  27. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactEvent/components/DatePicker/styles.d.ts +4 -3
  28. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactEvent/components/LocationTextField/SendLocation/components/GoogleMap/components/LocationSearch/locationSearch.d.ts +1 -0
  29. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactEvent/layout/BasicInputContainer/styles.d.ts +3 -2
  30. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactFiles/ContactFiles.d.ts +1 -0
  31. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactHistory/ContactHistory.d.ts +1 -0
  32. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactNotes/ContactNotes.d.ts +1 -0
  33. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactNotes/components/AddNote/AddNote.d.ts +1 -1
  34. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactNotes/context/NotesCardContext.d.ts +1 -0
  35. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactPanelShop/ContactPanelShop.d.ts +1 -0
  36. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactRelations/ContactRelations.d.ts +1 -0
  37. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactTask/ContactTask.d.ts +1 -0
  38. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactTask/components/AddTask/styles.d.ts +2 -1
  39. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactTickets/ContactTickets.d.ts +12 -0
  40. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactTickets/components/ContactTicketItem.d.ts +11 -0
  41. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactTickets/components/ContactTicketsSection.d.ts +18 -0
  42. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactTickets/components/RelativeTime.d.ts +11 -0
  43. package/dist/types/components/ContactSidebar/components/PanelView/components/ContactTickets/index.d.ts +1 -0
  44. package/dist/types/components/ContactSidebar/components/PanelView/components/GroupData/GroupData.d.ts +1 -0
  45. package/dist/types/components/ContactSidebar/components/PanelView/components/GroupData/components/GroupDataContent/components/InformationBox/InformationBox.d.ts +1 -0
  46. package/dist/types/components/ContactSidebar/components/PanelView/components/index.d.ts +1 -0
  47. package/dist/types/components/ContactSidebar/components/tabIndexes.d.ts +7 -0
  48. package/dist/types/components/ContactSidebar/context/ActivitiesCardContext.d.ts +1 -0
  49. package/dist/types/components/ContactSidebar/context/SidebarPropsContext.d.ts +9 -1
  50. package/dist/types/components/ContactSidebar/context/types/TabName.d.ts +1 -1
  51. package/dist/types/components/ContactSidebar/hooks/useActivityDate.d.ts +2 -2
  52. package/dist/types/components/ContactSidebar/hooks/useContactTickets.d.ts +30 -0
  53. package/dist/types/components/ContactSidebar/hooks/useCreateActivity.d.ts +9 -8
  54. package/dist/types/components/ContactSidebar/hooks/useLinkContacts.d.ts +2 -2
  55. package/dist/types/components/ContactSidebar/hooks/useMultipleSelect.d.ts +1 -0
  56. package/dist/types/components/ContactSidebar/hooks/useNotifications.d.ts +1 -1
  57. package/dist/types/components/ContactSidebar/hooks/useNow.d.ts +2 -0
  58. package/dist/types/components/ContactSidebar/hooks/useShareWithUsers.d.ts +2 -2
  59. package/dist/types/components/ContactSidebar/hooks/useSidebarAudioControl.d.ts +1 -0
  60. package/dist/types/components/ContactSidebar/hooks/useTicketStatuses.d.ts +8 -0
  61. package/dist/types/components/ContactSidebar/services/ticketsApi.d.ts +29 -0
  62. package/dist/types/components/ContactSidebar/services/urls.d.ts +1 -0
  63. package/dist/types/components/ContactSidebar/types/tickets.d.ts +60 -0
  64. package/dist/types/components/ContactSidebar/utils/formatRelativeTime.d.ts +9 -0
  65. package/dist/types/components/ContactSidebar/utils/googleMapsUtils.d.ts +1 -1
  66. package/dist/types/components/ContactSidebar/utils/markdown/Markdown.d.ts +1 -1
  67. package/dist/types/components/ContactSidebar/utils/minuteTicker.d.ts +3 -0
  68. package/dist/types/components/EditContactModal/components/SearchLocation/googleMapsUtils.d.ts +1 -1
  69. package/dist/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/EditModal.d.ts +1 -0
  70. package/dist/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/WarningsDisplay/components/Warning/hooks/useContactInfoPopup.d.ts +2 -2
  71. package/dist/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/shared/StatusAdornment/components/Adornment/Adornment.d.ts +1 -1
  72. package/dist/types/components/EditContactModal/components/Section/General/components/BusinessGeneral.d.ts +1 -1
  73. package/dist/types/components/EditContactModal/components/Section/General/components/ContactGeneral.d.ts +1 -1
  74. package/dist/types/components/EditContactModal/components/Section/utils/resolveUserLabel.d.ts +1 -1
  75. package/dist/types/components/EditContactModal/context/EditContactApiContext.d.ts +9 -8
  76. package/dist/types/components/EditContactModal/context/EditContactViewContext.d.ts +2 -1
  77. package/dist/types/components/EditContactModal/hooks/useEditContactModalController.d.ts +1 -1
  78. package/dist/types/components/EditContactModal/hooks/utils/editContactHelper.d.ts +1 -1
  79. package/dist/types/components/EventsDialog/components/ConfirmDeleteDialog/ConfirmDeleteDialog.d.ts +1 -0
  80. package/dist/types/components/EventsDialog/components/DatePicker/styles.d.ts +3 -4
  81. package/dist/types/components/EventsDialog/components/DeleteRecurringEventDialog/DeleteRecurringEventDialog.d.ts +1 -0
  82. package/dist/types/components/EventsDialog/components/EditRecurringEventDialog/EditRecurringEventDialog.d.ts +1 -0
  83. package/dist/types/components/EventsDialog/components/LocationTextField/SendLocation/components/GoogleMap/components/LocationSearch/locationSearch.d.ts +1 -0
  84. package/dist/types/components/EventsDialog/components/ReminderNotifications/components/ReminderItem/style.d.ts +10 -7
  85. package/dist/types/components/EventsDialog/components/ReminderNotifications/styles.d.ts +2 -3
  86. package/dist/types/components/EventsDialog/context/CalendarContextProvider.d.ts +1 -0
  87. package/dist/types/components/EventsDialog/context/EventsDialogApiContext.d.ts +4 -3
  88. package/dist/types/components/EventsDialog/hooks/useCalendarEvents.d.ts +1 -0
  89. package/dist/types/components/EventsDialog/hooks/useCalendarTasks.d.ts +1 -0
  90. package/dist/types/components/EventsDialog/hooks/useNotifications.d.ts +1 -1
  91. package/dist/types/components/EventsDialog/layout/BasicInputContainer/styles.d.ts +2 -3
  92. package/dist/types/components/EventsDialog/utils/googleMapsLoader.d.ts +1 -1
  93. package/dist/types/theme/themeActionTypes.d.ts +1 -1
  94. package/dist/types/theme/themePersistence.d.ts +1 -1
  95. package/dist/types/theme/themeSlice.d.ts +1 -1
  96. package/package.json +2 -2
  97. package/dist/types/asyncState/__tests__/asyncState.test.d.ts +0 -1
  98. package/dist/types/asyncState/__tests__/useAsyncData.test.d.ts +0 -1
  99. package/dist/types/components/AsyncContent/__tests__/AsyncContent.test.d.ts +0 -1
  100. package/dist/types/components/AsyncContent/__tests__/AsyncContentI18n.test.d.ts +0 -1
  101. package/dist/types/components/ContactInfoPopup/ContactInfoPopup.stories.d.ts +0 -9
  102. package/dist/types/components/ContactSidebar/ContactSidebar.stories.d.ts +0 -58
  103. package/dist/types/components/EditContactModal/EditContactModal.stories.d.ts +0 -9
  104. package/dist/types/components/EventsDialog/components/LinkContactsSelect/styles.d.ts +0 -6
  105. package/dist/types/components/EventsDialog/components/LocationTextField/MapLocationPicker.d.ts +0 -8
  106. package/dist/types/components/EventsDialog/components/LocationTextField/SendLocation/components/GoogleMap/index.d.ts +0 -1
  107. package/dist/types/components/EventsDialog/components/LocationTextField/SendLocation/components/index.d.ts +0 -1
  108. package/dist/types/components/EventsDialog/components/LocationTextField/SendLocation/index.d.ts +0 -3
  109. package/dist/types/components/EventsDialog/hooks/index.d.ts +0 -9
  110. package/dist/types/components/EventsDialog/hooks/useSelect.d.ts +0 -14
  111. package/dist/types/components/EventsDialog/utils/eventValidation.d.ts +0 -37
  112. package/dist/types/components/EventsDialog/utils/googleMapsUtils.d.ts +0 -5
  113. package/dist/types/components/EventsDialog/utils/keyboardNavigation.d.ts +0 -24
  114. package/dist/types/components/PanelErrorBoundary/__tests__/PanelErrorBoundary.test.d.ts +0 -1
  115. package/dist/types/theme/MuiComponentsConfig.test.d.ts +0 -1
  116. package/dist/types/theme/themePreference.test.d.ts +0 -1
  117. package/dist/types/theme/themeProvider.test.d.ts +0 -1
package/dist/cjs/theme.js CHANGED
@@ -1,2 +1,644 @@
1
- "use strict";var s=require("@mui/material"),a=require("@mui/material/styles"),g=require("@reduxjs/toolkit"),x=require("axios");function f(r){return r&&r.__esModule?r:{default:r}}var O=f(x);const A=r=>{if(r.palette.mode!=="dark")return r;const{palette:e}=r,o=a.alpha(e.text.secondary,.5),i=a.alpha(e.text.secondary,.72);return a.createTheme(r,{components:{MuiSelect:{defaultProps:{MenuProps:{PaperProps:{sx:{backgroundColor:e.background.dropdownMenu,backgroundImage:"none"}}}}},MuiTypography:{styleOverrides:{root:{color:e.text.primary}}},MuiPaper:{styleOverrides:{root:{backgroundColor:e.background.paper,backgroundImage:"none"},outlined:{borderColor:e.divider}}},MuiCard:{styleOverrides:{root:{backgroundColor:e.background.paper,backgroundImage:"none",borderColor:e.divider}}},MuiDialog:{styleOverrides:{paper:{backgroundColor:e.background.dropdownMenu,backgroundImage:"none",border:`1px solid ${e.divider}`}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:e.background.dropdownMenu,backgroundImage:"none",borderColor:e.divider}}},MuiPopover:{styleOverrides:{paper:{backgroundColor:e.background.dropdownMenu,backgroundImage:"none",border:`1px solid ${e.divider}`}}},MuiMenu:{styleOverrides:{paper:{backgroundColor:e.background.dropdownMenu,backgroundImage:"none",border:`1px solid ${e.divider}`}}},MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:a.alpha(e.background.default,.34),"& .MuiOutlinedInput-notchedOutline":{borderColor:o},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:i},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:e.primary.light,borderWidth:2},"&.Mui-disabled .MuiOutlinedInput-notchedOutline":{borderColor:a.alpha(e.text.disabled,.36)}},input:{"&::placeholder":{color:e.text.disabled,opacity:1}}}},MuiInputLabel:{styleOverrides:{root:{color:e.text.secondary,"&.Mui-focused":{color:e.primary.light},"&.Mui-disabled":{color:e.text.disabled}}}},MuiButton:{styleOverrides:{root:{"&.Mui-disabled":{color:e.text.disabled,borderColor:a.alpha(e.text.disabled,.38)}},containedPrimary:{backgroundColor:e.primary.main,color:e.primary.contrastText,"&:hover":{backgroundColor:e.primary.dark}},outlined:{color:e.primary.light,borderColor:a.alpha(e.primary.light,.72),"&:hover":{color:e.primary.light,borderColor:e.primary.light,backgroundColor:a.alpha(e.primary.light,.1)}},textPrimary:{color:e.primary.light,"&:hover":{backgroundColor:a.alpha(e.primary.light,.1)}}}},MuiIconButton:{styleOverrides:{root:{color:e.text.secondary,"&:hover":{color:e.text.primary,backgroundColor:e.action.hover},"&.MuiIconButton-colorPrimary":{color:e.primary.light},"&.MuiIconButton-colorError":{color:e.error.light},"&.Mui-disabled":{color:e.text.disabled}}}},MuiChip:{styleOverrides:{root:{color:e.text.primary,backgroundColor:a.alpha(e.text.primary,.07),borderColor:o,"& .MuiChip-icon":{color:"inherit"},"&.MuiChip-colorSuccess":{color:e.success.light,backgroundColor:e.success.dark,borderColor:a.alpha(e.success.light,.46)},"&.MuiChip-colorWarning":{color:e.warning.light,backgroundColor:e.warning.dark,borderColor:a.alpha(e.warning.light,.46)},"&.MuiChip-colorError":{color:e.error.light,backgroundColor:e.error.dark,borderColor:a.alpha(e.error.light,.46)},"&.MuiChip-colorInfo":{color:e.info.light,backgroundColor:e.info.dark,borderColor:a.alpha(e.info.light,.46)}}}},MuiAlert:{styleOverrides:{root:{border:"1px solid currentColor"},standardSuccess:{color:e.success.light,backgroundColor:e.success.dark},standardWarning:{color:e.warning.light,backgroundColor:e.warning.dark},standardError:{color:e.error.light,backgroundColor:e.error.dark},standardInfo:{color:e.info.light,backgroundColor:e.info.dark}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:e.cellHeader}}},MuiTableCell:{styleOverrides:{root:{borderColor:e.divider},head:{color:e.text.primary,fontWeight:700}}},MuiTableRow:{styleOverrides:{root:{"&:hover":{backgroundColor:e.action.hover},"&.Mui-selected":{backgroundColor:e.action.selected,"&:hover":{backgroundColor:e.action.selected}}}}},MuiTabs:{styleOverrides:{indicator:{backgroundColor:e.primary.light}}},MuiTab:{styleOverrides:{root:{color:e.text.secondary,"&.Mui-selected":{color:e.primary.light}}}},MuiSwitch:{styleOverrides:{switchBase:{color:e.text.disabled,"&.Mui-checked":{color:e.primary.light,"& + .MuiSwitch-track":{backgroundColor:e.primary.light,opacity:.5}}},track:{backgroundColor:e.text.disabled,opacity:.34}}},MuiTooltip:{styleOverrides:{tooltip:{color:e.text.primary,backgroundColor:e.background.tooltip,border:`1px solid ${o}`},arrow:{color:e.background.tooltip}}},MuiDivider:{styleOverrides:{root:{borderColor:e.divider}}},MuiLink:{styleOverrides:{root:{color:e.primary.light}}}}})},w=(r,e={})=>{const{transparentModal:o=!1,autocompleteZIndex:i=11}=e,l=r.palette.background,d=s.createTheme({...r,components:{MuiSelect:{defaultProps:{MenuProps:{PaperProps:{sx:{backgroundColor:l.panel,backgroundImage:"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"}}}}},MuiAutocomplete:{styleOverrides:{popper:{zIndex:i,"& div":{backgroundColor:l.panel}}}},MuiPaper:{styleOverrides:{root:{backgroundColor:l.panel,backgroundImage:"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"}}},MuiMenu:{styleOverrides:{paper:{backgroundColor:l.panel,backgroundImage:"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"}}},MuiList:{styleOverrides:{root:{padding:0}}},MuiModal:{styleOverrides:{root:o?{background:"transparent","& .MuiBackdrop-root":{background:"transparent",border:"none"}}:{}}},MuiTypography:{styleOverrides:{root:{color:r.palette.text.primary}}},MuiChip:{styleOverrides:{root:{color:r.palette.text.primary,border:"1px solid rgba(0, 0, 0, 0.1)",borderRadius:"4px",height:"20px",fontSize:"0.7125rem"}}},MuiListSubheader:{styleOverrides:{root:{backgroundColor:l.accordionHeader}}},MuiButton:{styleOverrides:{outlined:{color:r.palette.mode==="light"?r.palette.primary.dark:r.palette.primary.light,borderColor:r.palette.mode==="light"?r.palette.primary.dark:r.palette.primary.light,"&:hover":{borderColor:r.palette.mode==="light"?r.palette.primary.main:r.palette.primary.light,color:r.palette.mode==="light"?r.palette.primary.main:r.palette.primary.light}}}}}});return A(d)},p="Theme/updateTheme",D=g.createAction(`${p}/fulfilled`),m=["light","dark","system"],b=["lightBlueIndigo","lightBlue","lightRed","lightGreen","lightPink","lightPurple","lightTeal","lightLime","lightYellow","lightAmber","lightOrange","lightBrown","lightGray","darkBlue","darkBlack"],k=r=>m.includes(r)||b.includes(r),h=r=>r==="light"||r==="dark"||r==="system"?r:r&&b.includes(r)?r.startsWith("dark")?"dark":"light":"system",F=()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-color-scheme: dark)"):void 0,c=(r,e=F()?.matches??!1)=>r==="system"?e?"dark":"light":r,P=(r,e)=>{if(r!=="system")return e(r),()=>{};const o=F();if(e(c(r,o?.matches??!1)),!o)return()=>{};const i=l=>e(l.matches?"dark":"light");return typeof o.addEventListener=="function"?(o.addEventListener("change",i),()=>o.removeEventListener("change",i)):(o.addListener(i),()=>o.removeListener(i))},I=r=>`https://agent-api.trii.app/api/v1/settings/${r}/user/setTheme`,S=g.createAsyncThunk(p,async(r,{getState:e})=>{const{uid:o="",spaceId:i=""}=e().User.user??{},l=JSON.stringify({theme:r,uid:o}),d=await O.default.put(I(i),l,{headers:{"Content-Type":"application/json"}});if(!k(d.data.theme))throw new Error("Invalid theme response");return d.data}),y={main:"#246FB5",light:"#78B7F2",dark:"#195A96",contrastText:"#FFFFFF"},t=s.createTheme({name:"light",palette:{mode:"light",contrastThreshold:4.5,primary:y,secondary:{main:"#526078",light:"#728099",dark:"#38445A",contrastText:"#FFFFFF"},error:{main:"#BD3446",light:"#FCECEF",dark:"#932536",contrastText:"#FFFFFF"},warning:{main:"#946000",light:"#FFF5DF",dark:"#704800",contrastText:"#FFFFFF"},info:{main:"#176B9B",light:"#EAF4FC",dark:"#125174",contrastText:"#FFFFFF"},success:{main:"#237547",light:"#EAF6EE",dark:"#185935",contrastText:"#FFFFFF"},background:{default:"#F4F6FA",paper:"#FFFFFF",mainCenter:"#F4F6FA",mainGradient:"linear-gradient(120deg, #195A96, #246FB5)",navMenu:"#EDF1F7",dropdownMenu:"#FFFFFF",panel:"#FFFFFF",tooltip:"#EDF1F7",accordionHeader:"#EDF1F7",panelHeader:"#EDF1F7",panelCenter:"#F8FAFD",panelGradient:"#EDF1F7",selectedItem:"#E5EFFA"},text:{primary:"#202C3E",secondary:"#526078",disabled:"#7C8798",colorMain:"#202C3E"},action:{active:"#526078",hover:"rgba(36, 111, 181, 0.06)",selected:"rgba(36, 111, 181, 0.12)",disabled:"#8893A3",disabledBackground:"#E8ECF2"},divider:"#D7DEE9",containerBox:{default:"#FFFFFF",main:"#F8FAFD"},dropdownBox:"#FFFFFF",color:{icons:"#526078"},cellHeader:"#EDF1F7",Skeleton:{bg:"#E4EAF2"},messageBox:"#E5EFFA",boxShadow:"rgba(25, 42, 66, 0.12)",disabled:"#8893A3"}}),n=s.createTheme({name:"dark",palette:{mode:"dark",contrastThreshold:4.5,primary:y,secondary:{main:"#B7B5D9",light:"#D6D4EF",dark:"#46415F",contrastText:"#171824"},error:{main:"#F06B7A",light:"#FF9AA8",dark:"#4A1D24",contrastText:"#2B0D12"},warning:{main:"#E5A93B",light:"#FFD27A",dark:"#493515",contrastText:"#2A1B05"},info:{main:"#4FAFE8",light:"#7CCBFF",dark:"#123955",contrastText:"#082033"},success:{main:"#43C17A",light:"#75E0A7",dark:"#143D2B",contrastText:"#092116"},background:{default:"#111520",paper:"#1B2333",mainCenter:"#151C2A",mainGradient:"linear-gradient(120deg, #131B2B, #242237)",navMenu:"#0E121C",dropdownMenu:"#252D40",panel:"#1B2333",tooltip:"#30384F",accordionHeader:"#20283A",panelHeader:"#20283A",panelCenter:"#222B3E",panelGradient:"#2C2B40",selectedItem:"#293E59"},text:{primary:"#F1F4FA",secondary:"#BBC6D8",disabled:"#8793A6",colorMain:"#F1F4FA"},action:{active:"#BBC6D8",hover:"rgba(241, 244, 250, 0.07)",selected:"rgba(120, 183, 242, 0.16)",disabled:"rgba(187, 198, 216, 0.45)",disabledBackground:"rgba(187, 198, 216, 0.10)"},divider:"rgba(187, 198, 216, 0.22)",containerBox:{default:"#1B2333",main:"#222B3E"},dropdownBox:"#252D40",color:{icons:"#BBC6D8"},cellHeader:"#20283A",Skeleton:{bg:"#30384F"},messageBox:"#203953",boxShadow:"rgba(0, 0, 0, 0.40)",disabled:"rgba(187, 198, 216, 0.45)"}}),L={...t,name:"lightBlueIndigo"},G={...t,name:"lightBlue"},H={...t,name:"lightRed"},R={...t,name:"lightGreen"},_={...t,name:"lightPink"},$={...t,name:"lightPurple"},N={...t,name:"lightTeal"},Y={...t,name:"lightLime"},W={...t,name:"lightYellow"},q={...t,name:"lightAmber"},z={...t,name:"lightOrange"},j={...t,name:"lightBrown"},U={...t,name:"lightGray"},V={...n,name:"darkBlue"},J={...n,name:"darkBlack"},C="trii-theme",Z=()=>{try{return h(localStorage.getItem(C))}catch{return"system"}},K=r=>{try{localStorage.setItem(C,r)}catch{}},M=Z(),T=c(M),Q={themeSelected:T==="dark"?n:t,preference:M,darkMode:T==="dark",toggleStatus:"idle"},v=g.createSlice({name:"Theme",initialState:Q,reducers:{toggleTheme:(r,e)=>{u(r,e.payload)},systemThemeChanged:(r,e)=>{r.preference==="system"&&Object.assign(r,{themeSelected:e.payload==="dark"?n:t,darkMode:e.payload==="dark",toggleStatus:"toggled"})},toggleModeTheme:r=>{u(r,r.darkMode?"light":"dark")}},extraReducers:r=>{r.addCase(D,(e,o)=>{u(e,o.payload.theme)})}});function u(r,e){const o=h(e),i=c(o);K(e);const l=i==="dark"?n:t,d=e==="system"||e==="light"||e==="dark"?l:{...l,name:e};Object.assign(r,{preference:o,themeSelected:d,darkMode:i==="dark",toggleStatus:"toggled"})}const X=r=>r.Theme.preference,{toggleTheme:ee,toggleModeTheme:re,systemThemeChanged:oe}=v.actions,te=r=>r.Theme.toggleStatus,B=r=>r.Theme.themeSelected,E=r=>r.Theme.darkMode,ae=B,ie=E;var le=v.reducer;exports.MuiComponentsConfig=w,exports.THEME_PREFERENCES=m,exports.darkBlack=J,exports.darkBlue=V,exports.darkTheme=n,exports.isValidThemeName=k,exports.lightAmber=q,exports.lightBlue=G,exports.lightBlueIndigo=L,exports.lightBrown=j,exports.lightGray=U,exports.lightGreen=R,exports.lightLime=Y,exports.lightOrange=z,exports.lightPink=_,exports.lightPurple=$,exports.lightRed=H,exports.lightTeal=N,exports.lightTheme=t,exports.lightYellow=W,exports.normalizeThemePreference=h,exports.observeThemePreference=P,exports.resolveThemePreference=c,exports.selectDarkTheme=E,exports.selectTheme=B,exports.selectThemePreference=X,exports.selectThemeToggleStatus=te,exports.selectedDarkTheme=ie,exports.selectedTheme=ae,exports.systemThemeChanged=oe,exports.themeReducer=le,exports.toggleModeTheme=re,exports.toggleTheme=ee,exports.updateTheme=S;
1
+ 'use strict';
2
+
3
+ var material = require('@mui/material');
4
+ var styles = require('@mui/material/styles');
5
+ var toolkit = require('@reduxjs/toolkit');
6
+ var axios = require('axios');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var axios__default = /*#__PURE__*/_interopDefault(axios);
11
+
12
+ const applyDarkThemeComponents = (sharedTheme) => {
13
+ if (sharedTheme.palette.mode !== "dark") return sharedTheme;
14
+ const { palette } = sharedTheme;
15
+ const strongOutline = styles.alpha(palette.text.secondary, 0.5);
16
+ const hoverOutline = styles.alpha(palette.text.secondary, 0.72);
17
+ return styles.createTheme(sharedTheme, {
18
+ components: {
19
+ MuiSelect: {
20
+ defaultProps: {
21
+ MenuProps: {
22
+ PaperProps: {
23
+ sx: {
24
+ backgroundColor: palette.background.dropdownMenu,
25
+ backgroundImage: "none"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ },
31
+ MuiTypography: {
32
+ styleOverrides: {
33
+ // El microfrontend no controla el color del body de root. Mantener
34
+ // un foreground explícito evita heredar texto oscuro del shell.
35
+ root: { color: palette.text.primary }
36
+ }
37
+ },
38
+ MuiPaper: {
39
+ styleOverrides: {
40
+ root: {
41
+ backgroundColor: palette.background.paper,
42
+ backgroundImage: "none"
43
+ },
44
+ outlined: {
45
+ borderColor: palette.divider
46
+ }
47
+ }
48
+ },
49
+ MuiCard: {
50
+ styleOverrides: {
51
+ root: {
52
+ backgroundColor: palette.background.paper,
53
+ backgroundImage: "none",
54
+ borderColor: palette.divider
55
+ }
56
+ }
57
+ },
58
+ MuiDialog: {
59
+ styleOverrides: {
60
+ paper: {
61
+ backgroundColor: palette.background.dropdownMenu,
62
+ backgroundImage: "none",
63
+ border: `1px solid ${palette.divider}`
64
+ }
65
+ }
66
+ },
67
+ MuiDrawer: {
68
+ styleOverrides: {
69
+ paper: {
70
+ backgroundColor: palette.background.dropdownMenu,
71
+ backgroundImage: "none",
72
+ borderColor: palette.divider
73
+ }
74
+ }
75
+ },
76
+ MuiPopover: {
77
+ styleOverrides: {
78
+ paper: {
79
+ backgroundColor: palette.background.dropdownMenu,
80
+ backgroundImage: "none",
81
+ border: `1px solid ${palette.divider}`
82
+ }
83
+ }
84
+ },
85
+ MuiMenu: {
86
+ styleOverrides: {
87
+ paper: {
88
+ backgroundColor: palette.background.dropdownMenu,
89
+ backgroundImage: "none",
90
+ border: `1px solid ${palette.divider}`
91
+ }
92
+ }
93
+ },
94
+ MuiOutlinedInput: {
95
+ styleOverrides: {
96
+ root: {
97
+ backgroundColor: styles.alpha(palette.background.default, 0.34),
98
+ "& .MuiOutlinedInput-notchedOutline": {
99
+ borderColor: strongOutline
100
+ },
101
+ "&:hover .MuiOutlinedInput-notchedOutline": {
102
+ borderColor: hoverOutline
103
+ },
104
+ "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
105
+ borderColor: palette.primary.light,
106
+ borderWidth: 2
107
+ },
108
+ "&.Mui-disabled .MuiOutlinedInput-notchedOutline": {
109
+ borderColor: styles.alpha(palette.text.disabled, 0.36)
110
+ }
111
+ },
112
+ input: {
113
+ "&::placeholder": {
114
+ color: palette.text.disabled,
115
+ opacity: 1
116
+ }
117
+ }
118
+ }
119
+ },
120
+ MuiInputLabel: {
121
+ styleOverrides: {
122
+ root: {
123
+ color: palette.text.secondary,
124
+ "&.Mui-focused": { color: palette.primary.light },
125
+ "&.Mui-disabled": { color: palette.text.disabled }
126
+ }
127
+ }
128
+ },
129
+ MuiButton: {
130
+ styleOverrides: {
131
+ root: {
132
+ "&.Mui-disabled": {
133
+ color: palette.text.disabled,
134
+ borderColor: styles.alpha(palette.text.disabled, 0.38)
135
+ }
136
+ },
137
+ containedPrimary: {
138
+ backgroundColor: palette.primary.main,
139
+ color: palette.primary.contrastText,
140
+ "&:hover": { backgroundColor: palette.primary.dark }
141
+ },
142
+ outlined: {
143
+ color: palette.primary.light,
144
+ borderColor: styles.alpha(palette.primary.light, 0.72),
145
+ "&:hover": {
146
+ color: palette.primary.light,
147
+ borderColor: palette.primary.light,
148
+ backgroundColor: styles.alpha(palette.primary.light, 0.1)
149
+ }
150
+ },
151
+ textPrimary: {
152
+ color: palette.primary.light,
153
+ "&:hover": {
154
+ backgroundColor: styles.alpha(palette.primary.light, 0.1)
155
+ }
156
+ }
157
+ }
158
+ },
159
+ MuiIconButton: {
160
+ styleOverrides: {
161
+ root: {
162
+ color: palette.text.secondary,
163
+ "&:hover": {
164
+ color: palette.text.primary,
165
+ backgroundColor: palette.action.hover
166
+ },
167
+ "&.MuiIconButton-colorPrimary": { color: palette.primary.light },
168
+ "&.MuiIconButton-colorError": { color: palette.error.light },
169
+ "&.Mui-disabled": { color: palette.text.disabled }
170
+ }
171
+ }
172
+ },
173
+ MuiChip: {
174
+ styleOverrides: {
175
+ root: {
176
+ color: palette.text.primary,
177
+ backgroundColor: styles.alpha(palette.text.primary, 0.07),
178
+ borderColor: strongOutline,
179
+ "& .MuiChip-icon": { color: "inherit" },
180
+ "&.MuiChip-colorSuccess": {
181
+ color: palette.success.light,
182
+ backgroundColor: palette.success.dark,
183
+ borderColor: styles.alpha(palette.success.light, 0.46)
184
+ },
185
+ "&.MuiChip-colorWarning": {
186
+ color: palette.warning.light,
187
+ backgroundColor: palette.warning.dark,
188
+ borderColor: styles.alpha(palette.warning.light, 0.46)
189
+ },
190
+ "&.MuiChip-colorError": {
191
+ color: palette.error.light,
192
+ backgroundColor: palette.error.dark,
193
+ borderColor: styles.alpha(palette.error.light, 0.46)
194
+ },
195
+ "&.MuiChip-colorInfo": {
196
+ color: palette.info.light,
197
+ backgroundColor: palette.info.dark,
198
+ borderColor: styles.alpha(palette.info.light, 0.46)
199
+ }
200
+ }
201
+ }
202
+ },
203
+ MuiAlert: {
204
+ styleOverrides: {
205
+ root: { border: "1px solid currentColor" },
206
+ standardSuccess: {
207
+ color: palette.success.light,
208
+ backgroundColor: palette.success.dark
209
+ },
210
+ standardWarning: {
211
+ color: palette.warning.light,
212
+ backgroundColor: palette.warning.dark
213
+ },
214
+ standardError: {
215
+ color: palette.error.light,
216
+ backgroundColor: palette.error.dark
217
+ },
218
+ standardInfo: {
219
+ color: palette.info.light,
220
+ backgroundColor: palette.info.dark
221
+ }
222
+ }
223
+ },
224
+ MuiTableHead: {
225
+ styleOverrides: {
226
+ root: { backgroundColor: palette.cellHeader }
227
+ }
228
+ },
229
+ MuiTableCell: {
230
+ styleOverrides: {
231
+ root: { borderColor: palette.divider },
232
+ head: { color: palette.text.primary, fontWeight: 700 }
233
+ }
234
+ },
235
+ MuiTableRow: {
236
+ styleOverrides: {
237
+ root: {
238
+ "&:hover": { backgroundColor: palette.action.hover },
239
+ "&.Mui-selected": {
240
+ backgroundColor: palette.action.selected,
241
+ "&:hover": { backgroundColor: palette.action.selected }
242
+ }
243
+ }
244
+ }
245
+ },
246
+ MuiTabs: {
247
+ styleOverrides: {
248
+ indicator: { backgroundColor: palette.primary.light }
249
+ }
250
+ },
251
+ MuiTab: {
252
+ styleOverrides: {
253
+ root: {
254
+ color: palette.text.secondary,
255
+ "&.Mui-selected": { color: palette.primary.light }
256
+ }
257
+ }
258
+ },
259
+ MuiSwitch: {
260
+ styleOverrides: {
261
+ switchBase: {
262
+ color: palette.text.disabled,
263
+ "&.Mui-checked": {
264
+ color: palette.primary.light,
265
+ "& + .MuiSwitch-track": {
266
+ backgroundColor: palette.primary.light,
267
+ opacity: 0.5
268
+ }
269
+ }
270
+ },
271
+ track: {
272
+ backgroundColor: palette.text.disabled,
273
+ opacity: 0.34
274
+ }
275
+ }
276
+ },
277
+ MuiTooltip: {
278
+ styleOverrides: {
279
+ tooltip: {
280
+ color: palette.text.primary,
281
+ backgroundColor: palette.background.tooltip,
282
+ border: `1px solid ${strongOutline}`
283
+ },
284
+ arrow: { color: palette.background.tooltip }
285
+ }
286
+ },
287
+ MuiDivider: {
288
+ styleOverrides: {
289
+ root: { borderColor: palette.divider }
290
+ }
291
+ },
292
+ MuiLink: {
293
+ styleOverrides: {
294
+ root: { color: palette.primary.light }
295
+ }
296
+ }
297
+ }
298
+ });
299
+ };
300
+
301
+ const MuiComponentsConfig = (themeRedux, options = {}) => {
302
+ const { transparentModal = false, autocompleteZIndex = 11 } = options;
303
+ const bg = themeRedux.palette.background;
304
+ const sharedTheme = material.createTheme({
305
+ ...themeRedux,
306
+ components: {
307
+ MuiSelect: {
308
+ defaultProps: {
309
+ MenuProps: {
310
+ PaperProps: {
311
+ sx: {
312
+ backgroundColor: bg.panel,
313
+ backgroundImage: "linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"
314
+ }
315
+ }
316
+ }
317
+ }
318
+ },
319
+ MuiAutocomplete: {
320
+ styleOverrides: {
321
+ popper: {
322
+ zIndex: autocompleteZIndex,
323
+ "& div": {
324
+ backgroundColor: bg.panel
325
+ }
326
+ }
327
+ }
328
+ },
329
+ MuiPaper: {
330
+ styleOverrides: {
331
+ root: {
332
+ backgroundColor: bg.panel,
333
+ backgroundImage: "linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"
334
+ }
335
+ }
336
+ },
337
+ MuiMenu: {
338
+ styleOverrides: {
339
+ paper: {
340
+ backgroundColor: bg.panel,
341
+ backgroundImage: "linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"
342
+ }
343
+ }
344
+ },
345
+ MuiList: {
346
+ styleOverrides: {
347
+ root: {
348
+ padding: 0
349
+ }
350
+ }
351
+ },
352
+ MuiModal: {
353
+ styleOverrides: {
354
+ root: transparentModal ? {
355
+ background: "transparent",
356
+ "& .MuiBackdrop-root": {
357
+ background: "transparent",
358
+ border: "none"
359
+ }
360
+ } : {}
361
+ }
362
+ },
363
+ MuiTypography: {
364
+ styleOverrides: {
365
+ root: {
366
+ color: themeRedux.palette.text.primary
367
+ }
368
+ }
369
+ },
370
+ MuiChip: {
371
+ styleOverrides: {
372
+ root: {
373
+ color: themeRedux.palette.text.primary,
374
+ border: "1px solid rgba(0, 0, 0, 0.1)",
375
+ borderRadius: "4px",
376
+ height: "20px",
377
+ fontSize: "0.7125rem"
378
+ }
379
+ }
380
+ },
381
+ MuiListSubheader: {
382
+ styleOverrides: {
383
+ root: {
384
+ backgroundColor: bg.accordionHeader
385
+ }
386
+ }
387
+ },
388
+ MuiButton: {
389
+ styleOverrides: {
390
+ outlined: {
391
+ color: themeRedux.palette.mode === "light" ? themeRedux.palette.primary.dark : themeRedux.palette.primary.light,
392
+ borderColor: themeRedux.palette.mode === "light" ? themeRedux.palette.primary.dark : themeRedux.palette.primary.light,
393
+ "&:hover": {
394
+ borderColor: themeRedux.palette.mode === "light" ? themeRedux.palette.primary.main : themeRedux.palette.primary.light,
395
+ color: themeRedux.palette.mode === "light" ? themeRedux.palette.primary.main : themeRedux.palette.primary.light
396
+ }
397
+ }
398
+ }
399
+ }
400
+ }
401
+ });
402
+ return applyDarkThemeComponents(sharedTheme);
403
+ };
404
+
405
+ const UPDATE_THEME_TYPE = "Theme/updateTheme";
406
+ const themeUpdateFulfilled = /* @__PURE__ */ toolkit.createAction(
407
+ `${UPDATE_THEME_TYPE}/fulfilled`
408
+ );
409
+
410
+ const THEME_PREFERENCES = ["light", "dark", "system"];
411
+ const LEGACY_THEME_NAMES = ["lightBlueIndigo", "lightBlue", "lightRed", "lightGreen", "lightPink", "lightPurple", "lightTeal", "lightLime", "lightYellow", "lightAmber", "lightOrange", "lightBrown", "lightGray", "darkBlue", "darkBlack"];
412
+ const isValidThemeName = (name) => THEME_PREFERENCES.includes(name) || LEGACY_THEME_NAMES.includes(name);
413
+ const normalizeThemePreference = (name) => {
414
+ if (name === "light" || name === "dark" || name === "system") return name;
415
+ if (name && LEGACY_THEME_NAMES.includes(name)) return name.startsWith("dark") ? "dark" : "light";
416
+ return "system";
417
+ };
418
+ const systemMedia = () => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
419
+ const resolveThemePreference = (preference, systemDark = systemMedia()?.matches ?? false) => preference === "system" ? systemDark ? "dark" : "light" : preference;
420
+ const observeThemePreference = (preference, listener) => {
421
+ if (preference !== "system") {
422
+ listener(preference);
423
+ return () => {
424
+ };
425
+ }
426
+ const media = systemMedia();
427
+ listener(resolveThemePreference(preference, media?.matches ?? false));
428
+ if (!media) return () => {
429
+ };
430
+ const change = (event) => listener(event.matches ? "dark" : "light");
431
+ if (typeof media.addEventListener === "function") {
432
+ media.addEventListener("change", change);
433
+ return () => media.removeEventListener("change", change);
434
+ }
435
+ media.addListener(change);
436
+ return () => media.removeListener(change);
437
+ };
438
+
439
+ const themeUrl = (spaceId) => `https://agent-api.trii.app/api/v1/settings/${spaceId}/user/setTheme`;
440
+ const updateTheme = /* @__PURE__ */ toolkit.createAsyncThunk(UPDATE_THEME_TYPE, async (theme, { getState }) => {
441
+ const { uid = "", spaceId = "" } = getState().User.user ?? {};
442
+ const themeJson = JSON.stringify({ theme, uid });
443
+ const response = await axios__default.default.put(
444
+ themeUrl(spaceId),
445
+ themeJson,
446
+ { headers: { "Content-Type": "application/json" } }
447
+ );
448
+ if (!isValidThemeName(response.data.theme)) throw new Error("Invalid theme response");
449
+ return response.data;
450
+ });
451
+
452
+ const primary = { main: "#246FB5", light: "#78B7F2", dark: "#195A96", contrastText: "#FFFFFF" };
453
+ const lightTheme = material.createTheme({
454
+ name: "light",
455
+ palette: {
456
+ mode: "light",
457
+ contrastThreshold: 4.5,
458
+ primary,
459
+ secondary: { main: "#526078", light: "#728099", dark: "#38445A", contrastText: "#FFFFFF" },
460
+ error: { main: "#BD3446", light: "#FCECEF", dark: "#932536", contrastText: "#FFFFFF" },
461
+ warning: { main: "#946000", light: "#FFF5DF", dark: "#704800", contrastText: "#FFFFFF" },
462
+ info: { main: "#176B9B", light: "#EAF4FC", dark: "#125174", contrastText: "#FFFFFF" },
463
+ success: { main: "#237547", light: "#EAF6EE", dark: "#185935", contrastText: "#FFFFFF" },
464
+ background: {
465
+ default: "#F4F6FA",
466
+ paper: "#FFFFFF",
467
+ mainCenter: "#F4F6FA",
468
+ mainGradient: "linear-gradient(120deg, #195A96, #246FB5)",
469
+ navMenu: "#EDF1F7",
470
+ dropdownMenu: "#FFFFFF",
471
+ panel: "#FFFFFF",
472
+ tooltip: "#EDF1F7",
473
+ accordionHeader: "#EDF1F7",
474
+ panelHeader: "#EDF1F7",
475
+ panelCenter: "#F8FAFD",
476
+ panelGradient: "#EDF1F7",
477
+ selectedItem: "#E5EFFA"
478
+ },
479
+ text: { primary: "#202C3E", secondary: "#526078", disabled: "#7C8798", colorMain: "#202C3E" },
480
+ action: { active: "#526078", hover: "rgba(36, 111, 181, 0.06)", selected: "rgba(36, 111, 181, 0.12)", disabled: "#8893A3", disabledBackground: "#E8ECF2" },
481
+ divider: "#D7DEE9",
482
+ containerBox: { default: "#FFFFFF", main: "#F8FAFD" },
483
+ dropdownBox: "#FFFFFF",
484
+ color: { icons: "#526078" },
485
+ cellHeader: "#EDF1F7",
486
+ Skeleton: { bg: "#E4EAF2" },
487
+ messageBox: "#E5EFFA",
488
+ boxShadow: "rgba(25, 42, 66, 0.12)",
489
+ disabled: "#8893A3"
490
+ }
491
+ });
492
+ const darkTheme = material.createTheme({
493
+ name: "dark",
494
+ palette: {
495
+ mode: "dark",
496
+ contrastThreshold: 4.5,
497
+ primary,
498
+ secondary: { main: "#B7B5D9", light: "#D6D4EF", dark: "#46415F", contrastText: "#171824" },
499
+ error: { main: "#F06B7A", light: "#FF9AA8", dark: "#4A1D24", contrastText: "#2B0D12" },
500
+ warning: { main: "#E5A93B", light: "#FFD27A", dark: "#493515", contrastText: "#2A1B05" },
501
+ info: { main: "#4FAFE8", light: "#7CCBFF", dark: "#123955", contrastText: "#082033" },
502
+ success: { main: "#43C17A", light: "#75E0A7", dark: "#143D2B", contrastText: "#092116" },
503
+ background: {
504
+ default: "#111520",
505
+ paper: "#1B2333",
506
+ mainCenter: "#151C2A",
507
+ mainGradient: "linear-gradient(120deg, #131B2B, #242237)",
508
+ navMenu: "#0E121C",
509
+ dropdownMenu: "#252D40",
510
+ panel: "#1B2333",
511
+ tooltip: "#30384F",
512
+ accordionHeader: "#20283A",
513
+ panelHeader: "#20283A",
514
+ panelCenter: "#222B3E",
515
+ panelGradient: "#2C2B40",
516
+ selectedItem: "#293E59"
517
+ },
518
+ text: { primary: "#F1F4FA", secondary: "#BBC6D8", disabled: "#8793A6", colorMain: "#F1F4FA" },
519
+ action: { active: "#BBC6D8", hover: "rgba(241, 244, 250, 0.07)", selected: "rgba(120, 183, 242, 0.16)", disabled: "rgba(187, 198, 216, 0.45)", disabledBackground: "rgba(187, 198, 216, 0.10)" },
520
+ divider: "rgba(187, 198, 216, 0.22)",
521
+ containerBox: { default: "#1B2333", main: "#222B3E" },
522
+ dropdownBox: "#252D40",
523
+ color: { icons: "#BBC6D8" },
524
+ cellHeader: "#20283A",
525
+ Skeleton: { bg: "#30384F" },
526
+ messageBox: "#203953",
527
+ boxShadow: "rgba(0, 0, 0, 0.40)",
528
+ disabled: "rgba(187, 198, 216, 0.45)"
529
+ }
530
+ });
531
+ const lightBlueIndigo = { ...lightTheme, name: "lightBlueIndigo" };
532
+ const lightBlue = { ...lightTheme, name: "lightBlue" };
533
+ const lightRed = { ...lightTheme, name: "lightRed" };
534
+ const lightGreen = { ...lightTheme, name: "lightGreen" };
535
+ const lightPink = { ...lightTheme, name: "lightPink" };
536
+ const lightPurple = { ...lightTheme, name: "lightPurple" };
537
+ const lightTeal = { ...lightTheme, name: "lightTeal" };
538
+ const lightLime = { ...lightTheme, name: "lightLime" };
539
+ const lightYellow = { ...lightTheme, name: "lightYellow" };
540
+ const lightAmber = { ...lightTheme, name: "lightAmber" };
541
+ const lightOrange = { ...lightTheme, name: "lightOrange" };
542
+ const lightBrown = { ...lightTheme, name: "lightBrown" };
543
+ const lightGray = { ...lightTheme, name: "lightGray" };
544
+ const darkBlue = { ...darkTheme, name: "darkBlue" };
545
+ const darkBlack = { ...darkTheme, name: "darkBlack" };
546
+
547
+ const THEME_STORAGE_KEY = "trii-theme";
548
+ const getSavedPreference = () => {
549
+ try {
550
+ return normalizeThemePreference(localStorage.getItem(THEME_STORAGE_KEY));
551
+ } catch {
552
+ return "system";
553
+ }
554
+ };
555
+ const saveTheme = (theme) => {
556
+ try {
557
+ localStorage.setItem(THEME_STORAGE_KEY, theme);
558
+ } catch {
559
+ }
560
+ };
561
+ const savedPreference = getSavedPreference();
562
+ const savedMode = resolveThemePreference(savedPreference);
563
+ const initialState = {
564
+ themeSelected: savedMode === "dark" ? darkTheme : lightTheme,
565
+ preference: savedPreference,
566
+ darkMode: savedMode === "dark",
567
+ toggleStatus: "idle"
568
+ };
569
+ const themeSlice = toolkit.createSlice({
570
+ name: "Theme",
571
+ initialState,
572
+ reducers: {
573
+ /** Cambia el tema por nombre. */
574
+ toggleTheme: (state, action) => {
575
+ applyPreference(state, action.payload);
576
+ },
577
+ /** Local update from observeThemePreference; never overwrite the saved system choice. */
578
+ systemThemeChanged: (state, action) => {
579
+ if (state.preference !== "system") return;
580
+ Object.assign(state, { themeSelected: action.payload === "dark" ? darkTheme : lightTheme, darkMode: action.payload === "dark", toggleStatus: "toggled" });
581
+ },
582
+ /** Alterna el modo oscuro. */
583
+ toggleModeTheme: (state) => {
584
+ applyPreference(state, state.darkMode ? "light" : "dark");
585
+ }
586
+ },
587
+ extraReducers: (builder) => {
588
+ builder.addCase(themeUpdateFulfilled, (state, action) => {
589
+ applyPreference(state, action.payload.theme);
590
+ });
591
+ }
592
+ });
593
+ function applyPreference(state, name) {
594
+ const preference = normalizeThemePreference(name);
595
+ const mode = resolveThemePreference(preference);
596
+ saveTheme(name);
597
+ const base = mode === "dark" ? darkTheme : lightTheme;
598
+ const themeSelected = name === "system" || name === "light" || name === "dark" ? base : { ...base, name };
599
+ Object.assign(state, { preference, themeSelected, darkMode: mode === "dark", toggleStatus: "toggled" });
600
+ }
601
+ const selectThemePreference = (state) => state.Theme.preference;
602
+ const { toggleTheme, toggleModeTheme, systemThemeChanged } = themeSlice.actions;
603
+ const selectThemeToggleStatus = (state) => state.Theme.toggleStatus;
604
+ const selectTheme = (state) => state.Theme.themeSelected;
605
+ const selectDarkTheme = (state) => state.Theme.darkMode;
606
+ const selectedTheme = selectTheme;
607
+ const selectedDarkTheme = selectDarkTheme;
608
+ var themeSlice$1 = themeSlice.reducer;
609
+
610
+ exports.MuiComponentsConfig = MuiComponentsConfig;
611
+ exports.THEME_PREFERENCES = THEME_PREFERENCES;
612
+ exports.darkBlack = darkBlack;
613
+ exports.darkBlue = darkBlue;
614
+ exports.darkTheme = darkTheme;
615
+ exports.isValidThemeName = isValidThemeName;
616
+ exports.lightAmber = lightAmber;
617
+ exports.lightBlue = lightBlue;
618
+ exports.lightBlueIndigo = lightBlueIndigo;
619
+ exports.lightBrown = lightBrown;
620
+ exports.lightGray = lightGray;
621
+ exports.lightGreen = lightGreen;
622
+ exports.lightLime = lightLime;
623
+ exports.lightOrange = lightOrange;
624
+ exports.lightPink = lightPink;
625
+ exports.lightPurple = lightPurple;
626
+ exports.lightRed = lightRed;
627
+ exports.lightTeal = lightTeal;
628
+ exports.lightTheme = lightTheme;
629
+ exports.lightYellow = lightYellow;
630
+ exports.normalizeThemePreference = normalizeThemePreference;
631
+ exports.observeThemePreference = observeThemePreference;
632
+ exports.resolveThemePreference = resolveThemePreference;
633
+ exports.selectDarkTheme = selectDarkTheme;
634
+ exports.selectTheme = selectTheme;
635
+ exports.selectThemePreference = selectThemePreference;
636
+ exports.selectThemeToggleStatus = selectThemeToggleStatus;
637
+ exports.selectedDarkTheme = selectedDarkTheme;
638
+ exports.selectedTheme = selectedTheme;
639
+ exports.systemThemeChanged = systemThemeChanged;
640
+ exports.themeReducer = themeSlice$1;
641
+ exports.toggleModeTheme = toggleModeTheme;
642
+ exports.toggleTheme = toggleTheme;
643
+ exports.updateTheme = updateTheme;
2
644
  //# sourceMappingURL=theme.js.map