jamespot-react-core 1.3.4 → 1.3.6

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 (37) hide show
  1. package/build/534.606ae244f89e01f0c5fa.chunk.js +2 -0
  2. package/build/534.606ae244f89e01f0c5fa.chunk.js.map +1 -0
  3. package/build/605.2ea491387427c666537a.chunk.js +707 -0
  4. package/build/605.2ea491387427c666537a.chunk.js.map +1 -0
  5. package/build/app.bundle.js +4038 -3965
  6. package/build/app.bundle.js.map +1 -1
  7. package/build/src/App.d.ts +1 -0
  8. package/build/src/components/LayoutProvider.component.d.ts +14 -0
  9. package/build/src/components/calendar/CalendarToolbar.d.ts +1 -1
  10. package/build/src/components/calendar/CalendarWrapper.d.ts +2 -20
  11. package/build/src/components/calendar/CreateCalendarEventModal.d.ts +15 -0
  12. package/build/src/components/calendar/ExportCalendarModal.d.ts +5 -0
  13. package/build/src/components/calendar/UpdateCalendarEventModal.d.ts +14 -0
  14. package/build/src/components/calendar/meeting/CreateMeetingModal.d.ts +5 -0
  15. package/build/src/components/calendar/meeting/MeetingForm.d.ts +29 -0
  16. package/build/src/components/calendar/meeting/UpdateMeetingModal.d.ts +7 -0
  17. package/build/src/components/calendar/socialEvent/CreateSocialEventOrRecurringEventModal.d.ts +10 -0
  18. package/build/src/components/calendar/socialEvent/SocialEventOrRecurringEventForm.d.ts +35 -0
  19. package/build/src/components/calendar/socialEvent/UpdateRecurringEventModal.d.ts +7 -0
  20. package/build/src/components/calendar/socialEvent/UpdateSocialEventModal.d.ts +7 -0
  21. package/build/src/components/widgets/wrapper/JRCWidgetColorWrapper.d.ts +8 -0
  22. package/build/src/hooks/index.d.ts +3 -1
  23. package/build/src/hooks/useApplication.d.ts +1 -0
  24. package/build/src/hooks/useLayout.d.ts +2 -0
  25. package/build/src/redux/store.d.ts +3 -3
  26. package/build/src/registry/core-component-list.d.ts +3 -0
  27. package/build/src/registry/coreComponents.d.ts +3 -0
  28. package/build/src/registry/ext-component-list.d.ts +4 -1
  29. package/build/src/utils/eventRecurrence.d.ts +10 -0
  30. package/build/src/utils/jamespot.d.ts +14 -0
  31. package/build/src/utils/reactHookForm.d.ts +2 -0
  32. package/build/src/utils/types.d.ts +2 -0
  33. package/package.json +5 -4
  34. package/build/605.f594e89c1007934615b9.chunk.js +0 -2
  35. package/build/605.f594e89c1007934615b9.chunk.js.map +0 -1
  36. package/build/818.3f23be9d7323f83e9353.chunk.js +0 -685
  37. package/build/818.3f23be9d7323f83e9353.chunk.js.map +0 -1
@@ -1,685 +0,0 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[818],{818:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>T,AddReportModal:()=>Z,Audience:()=>L,Avatar:()=>x,CalendarToolbar:()=>Eo,CalendarWrapper:()=>qo,CommentsBloc:()=>so,DisplayForm:()=>R,Editor:()=>gs,EditorsPortal:()=>Fs,Empty:()=>Rs,FullPageLayout:()=>Bs,GifsModal:()=>io,JRCInputTinyMCEWithExt:()=>Ps,JRCInputTinyMCEWithExtRaw:()=>Js,MarkdownModal:()=>ft,ModalAudience:()=>Zs,ModalSchedule:()=>al,TwoColLayout:()=>ul,WidgetList:()=>xe,WidgetWrapperCore:()=>Nn});var n=i(576),o=i(594),s=i(196),l=i.n(s),a=i(493),r=i(229),d=i(777),c=i(71),u=i(389);const g=u.j.getLazyComponent("Icon"),m=u.j.getLazyComponent("JRCAvatar"),p=l().span`
2
- ${r.SROnly}
3
- `,x=e=>{const t=(0,s.useTheme)(),i=(0,a.useIntl)(),o=(0,c.GV)(d.ED.selectors.selectNetworkPublic);return e.uri===o?.uri?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g,{name:"icon-fs-wall",size:8*(e.size??3),color:t.color.primary,variant:"circle"}),(0,n.jsx)(p,{children:i.formatMessage({id:"NETWORK_Public"})})]}):(0,n.jsx)(m,{...e})},h=u.j.getLazyComponent("FlexBox"),f=u.j.getLazyComponent("ModalContent"),j=u.j.getLazyComponent("ModalLayout"),y=u.j.getLazyComponent("StyledHref"),b=u.j.getLazyComponent("Tooltip"),C=u.j.getLazyComponent("Typography"),v=l().div`
4
- display: flex;
5
- flex-direction: column;
6
- gap: 12px;
7
- margin-bottom: 24px;
8
- `,w=l().a`
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- position: relative;
13
- width: 40px;
14
- height: 40px;
15
- border-radius: 40px;
16
- overflow: hidden;
17
- color: ${e=>e.theme.color.white};
18
- background-color: ${e=>e.theme.color.lavender};
19
- border: 4px solid ${e=>e.theme.color.white};
20
- margin-left: ${e=>e.overlap?"-18px":"0"};
21
- cursor: pointer;
22
- `,L=({audience:e,limit:t=2})=>{const i=(0,a.useIntl)(),l=(0,s.useTheme)(),[d,c]=(0,o.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(h,{children:[[...e].splice(0,t).map((e,t)=>(0,n.jsx)(w,{overlap:0!==t,href:e._url,target:"_blank",children:(0,n.jsx)(b,{description:void 0===e.title?" ":e.title,position:"left",children:(0,n.jsx)(x,{uri:e.uri,size:4,variant:"circle",alt:"image",timestamp:e.dateModified?r.Utils.date.strToTimestamp(e.dateModified):void 0,focusable:!0})})},e.id)),e.length>t&&(0,n.jsxs)(w,{onClick:()=>c(!0),overlap:!0,children:["+",e.length-t]})]}),e.length>t&&(0,n.jsx)(j,{closeHandler:()=>c(!1),enableClickAwayCloseModal:!0,open:d,variant:"fixed-height",maxHeight:"800px",children:(0,n.jsx)(f,{title:i.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>c(!1),children:(0,n.jsx)(v,{children:e.map((e,t)=>(0,n.jsxs)(h,{y:"center",gap:l.space.l,children:[(0,n.jsx)(x,{size:5,uri:`${e.type}/${e.id}`}),(0,n.jsx)(y,{href:`${e.type}/${e.id}`,children:(0,n.jsx)(C,{children:e.title})})]},`audience-${t}`))})})})]})};var E=i(833),k=i.n(E);const _=u.j.getLazyComponent("Loader"),W=u.j.getLazyComponent("ModalContent"),S=u.j.getLazyComponent("ModalLayout"),q=u.j.getLazyComponent("Typography"),M=l().div`
23
- padding: ${e=>e.theme.space.md}px;
24
- `,A={response:void 0,loading:!0,error:void 0},T=({query:e})=>{const t=(0,a.useIntl)(),[i,l]=(0,o.useState)(A),r=(0,s.useTheme)(),d=(0,o.useCallback)(e=>{l(A),k().jia.textEnhancement({text:e.text,capacity:e.capability}).then(e=>{if(e.error)return void l({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const i=e.result.text;l({error:void 0,loading:!1,response:i})}).catch(e=>{l({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})})},[t]);return(0,o.useEffect)(()=>{e&&e.text.trim().length>0&&d(e)},[e,d]),(0,n.jsx)(S,{zIndex:r.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{e?.reject()},children:(0,n.jsx)(W,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&d(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>i.response&&e?.resolve(i.response)},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>e?.reject()}],isFull:!0,children:(0,n.jsxs)(M,{children:[i.loading&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_,{}),(0,n.jsx)(q,{align:"center",children:t.formatMessage({id:"JIA_WAITING_WARNIG"})})]}),!i.loading&&i.error&&(0,n.jsx)("p",{children:i.error}),!i.loading&&i.response&&(0,n.jsx)("p",{children:i.response})]})})})};var I=i(655),z=i(155);const G=s.css`
25
- height: 100%;
26
- display: flex;
27
- flex-direction: column;
28
- justify-content: space-between;
29
- `,D=l().div`
30
- ${({stretch:e})=>e&&G}
31
- `,V=l().form`
32
- ${({stretch:e})=>e&&G}
33
- `,$=(0,o.forwardRef)((e,t)=>e.onSubmit?(0,n.jsx)(V,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy,children:e.children}):(0,n.jsx)(D,{stretch:e.stretch,ref:t,"data-cy":e.dataCy,children:e.children})),F=l().div`
34
- ${e=>e.stretch&&"\n flex: 1;\n"}
35
- `,R=(0,o.forwardRef)(({onInit:e,...t},i)=>{const s=(0,o.useRef)(null),[l,a]=(0,z.SC)(t.fields,t.type,t.forceMandatory),[r,d]=(0,o.useState)(!1),{handleSubmit:c,control:u,reset:g,...m}=(0,I.useForm)({defaultValues:{...a,...t.defaultValues},criteriaMode:"all"});(0,o.useEffect)(()=>{e&&!r&&(e(m),d(!0))},[e,m,r]);const p=(0,o.useCallback)(e=>{const t={};return Object.keys(e).forEach(i=>{const n=l.find(e=>e.name===i)?.widget;switch(n?.type){case"audience":t[i]=e[i].map(e=>e.uri).join(",");break;case"taxonomy":t[i]=e[i].map(e=>e.title).join(",");break;case"toggle":t[i]=e[i]?"1":"0";break;default:t[i]=e[i]}}),t},[l]);return(0,o.useImperativeHandle)(i,()=>({...m,handleSubmit:c,control:u,reset:()=>{s?.current?.scrollTo(0,0),g()},getFormattedValues:()=>p(m.getValues())}),[]),(0,n.jsxs)($,{dataCy:t.dataCy,stretch:t.stretch,onSubmit:t.onSubmit?c(t.onSubmit):void 0,ref:s,children:[(0,n.jsxs)(F,{stretch:t.stretch,children:[l.map(({Input:e,...i})=>(0,n.jsx)(e,{control:u,...i,dataCy:`${t.dataCy}-${i.name}`,readOnly:t.readOnly},i.name)),t.extraInputs&&t.extraInputs(u)]}),t.buttons]})});var O=i(468);const B=u.j.getLazyComponent("ModalForm"),H=u.j.getLazyComponent("Loader"),U=u.j.getLazyComponent("Icon"),N=u.j.getLazyComponent("Typography"),P=u.j.getLazyComponent("Deprecated_Ellipsis"),Y=u.j.getLazyComponent("StyledHref"),Q=l().div`
36
- display: flex;
37
- flex-direction: column;
38
- gap: ${({theme:e})=>e.space.md}px;
39
- `,K=l().div`
40
- display: flex;
41
- gap: ${({theme:e})=>e.space.md}px;
42
- align-items: center;
43
- border: 1px solid ${({theme:e})=>e.color.grey2};
44
- background-color: ${({theme:e})=>e.color.grey0};
45
- border-radius: ${({theme:e})=>e.size.sm}px;
46
- padding: ${({theme:e})=>e.space.md}px;
47
- `,X=l().div`
48
- display: flex;
49
- flex-direction: column;
50
- gap: ${({theme:e})=>e.space.sm}px;
51
- `,Z=({onClose:e,articleId:t,articleUri:i,commentUri:s})=>{const l=(0,a.useIntl)(),r=(0,o.useRef)(null),u=(0,c.jL)(),[g,m]=(0,o.useState)(!0),[p,x]=(0,o.useState)(),[h,f]=(0,o.useState)(),[j,y]=(0,o.useState)(!0),[b,C]=(0,o.useState)(!1),v=(0,O.Ie)();(0,o.useEffect)(()=>{Promise.all([(async()=>{const e=await k().article.get({idArticle:t},{signal:v.signal,format:"raw-list"});x(e.result)})(),(async()=>{if(s){const e=await k().article.getComments({idArticle:t},{format:"raw-list",signal:v.signal});f(e.result.find(e=>e.uri===s))}})()]).then(()=>{y(!1)})},[v,t,s]);const w=(0,o.useCallback)(()=>{m(!1),e()},[e]),L=(0,o.useCallback)(e=>{e?.trim()?(C(!0),k().contentReport.createReport({uri:s||i,description:e}).then(()=>{u(d.y8.actions.success({label:l.formatMessage({id:"CRPT_Report_Sent"})})),w()}).catch(e=>{d.y8.actions.error({label:e.errorMsg??"GLOBAL_Error"}),C(!1)})):u(d.y8.actions.error({label:l.formatMessage({id:"CRPT_Report_Description_Required"})}))},[i,w,s,u,l]),E=(0,o.useCallback)(({description:e})=>{L(e)},[L]);return(0,n.jsx)(B,{title:l.formatMessage({id:"CRPT_Add_Report"}),open:g,closeHandler:w,onSubmit:async()=>L(r.current?.getValues().description),enableClickAwayCloseModal:!0,maxHeight:"520px",buttons:[{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:w},{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Send"}),clickHandler:()=>L(r.current?.getValues().description),color:"valid",loading:b}],children:j?(0,n.jsx)(H,{size:"l"}):(0,n.jsxs)(Q,{children:[(0,n.jsxs)(K,{children:[(0,n.jsx)(U,{name:s?"icon-comment":"icon-file",size:50,variant:"square"}),(0,n.jsxs)(X,{children:[(0,n.jsx)(N,{variant:s?"h3":"h2",children:(0,n.jsx)(P,{label:p?.title,length:40})}),h&&(0,n.jsxs)(N,{children:[l.formatMessage({id:"CRPT_Comment_Of"})," ",(0,n.jsx)(Y,{href:h?._user._url,children:h?._user.title})]})]})]}),(0,n.jsx)(R,{ref:r,fields:["description"],type:"contentReport",onSubmit:E})]})})};var ee=i(737),te=i(626),ie=i(652);const ne=l().div`
52
- display: flex;
53
- flex-direction: row;
54
- flex-wrap: wrap;
55
- gap: 10px;
56
- justify-content: center;
57
- `,oe=l().div`
58
- border: 1px solid ${e=>e.theme.color.grey2};
59
- border-radius: 8px;
60
- cursor: pointer;
61
- padding: 12px;
62
- position: relative;
63
- opacity: ${e=>e.available?"1":".4"};
64
- pointer-events: ${e=>e.available?"all":"none"};
65
-
66
- .show-on-hover {
67
- position: absolute;
68
- inset: 0;
69
- border-radius: 8px;
70
- justify-content: center;
71
- align-items: center;
72
- display: flex;
73
- opacity: 0;
74
- background-color: #ffffffe6;
75
- }
76
-
77
- &:hover {
78
- .show-on-hover {
79
- opacity: 1;
80
- }
81
- }
82
- `,se=l().div`
83
- border: 2px solid ${e=>e.theme.color.primary};
84
- height: ${e=>e.open?e.height:"54"}px;
85
- border-radius: 8px;
86
- display: flex;
87
- justify-content: top;
88
- flex-direction: column;
89
- transition: height 0.4s;
90
- overflow: hidden;
91
- flex-direction: column;
92
- `,le=l().div`
93
- display: flex;
94
- flex-direction: row;
95
- flex-wrap: wrap;
96
- justify-content: center;
97
- gap: 10px;
98
- ${e=>e.column&&"flex-direction: column;"}
99
- `,ae=l().div`
100
- min-height: 50px;
101
- display: flex;
102
- justify-content: center;
103
- align-items: center;
104
- cursor: pointer;
105
- color: ${e=>e.theme.color.primary};
106
- &:hover {
107
- background-color: ${e=>e.theme.color.grey0};
108
- }
109
- `,re=l().button`
110
- display: flex;
111
- align-items: center;
112
- padding: ${e=>e.parentIsColumn?"36px 16px":"0 10px"};
113
- gap: 10px;
114
- width: 40%;
115
- border: 1px solid ${e=>e.theme.color.grey1};
116
- border-radius: 8px;
117
- transition: opacity 0.4s ease ${e=>40*e.index}ms;
118
- opacity: ${e=>e.open?1:0};
119
- img {
120
- width: 40px;
121
- }
122
- ${e=>e.full&&"flex: 1; width: 100%;"}
123
- ${e=>e.parentIsColumn&&"flex-basis: 72px;"}
124
- ${e=>!e.parentIsColumn&&"height: 72px;"}
125
- &:hover {
126
- background-color: ${e=>e.theme.color.grey0};
127
- }
128
-
129
- ${(0,r.DashedFocusBorder)()}
130
- `,de=l().div`
131
- display: flex;
132
- flex-direction: ${e=>"row"===e.direction?"row":"column"};
133
- align-items: ${e=>"row"===e.direction?"center":"flex-start"};
134
- justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
135
- flex: 1;
136
- ${e=>e.gap&&`gap:${e.gap}px`}
137
- `,ce=u.j.getLazyComponent("Button"),ue=u.j.getLazyComponent("ModalLayout"),ge=u.j.getLazyComponent("ModalContent"),me=u.j.getLazyComponent("Tooltip"),pe=u.j.getLazyComponent("IconButton"),xe=({mode:e,view:t,children:i,namespace:s="default",onChange:l})=>{const[r,c]=(0,o.useState)(!1),u=function(e){switch(e){case"widget-article-image":return[d.x0.definition(E.WidgetsName.ArticleTitle),d.x0.definition(E.WidgetsName.ArticleButton)];case"comment":return[d.x0.definition(E.WidgetsName.CheckList),d.x0.definition(E.WidgetsName.Presence),d.x0.definition(E.WidgetsName.QuickSurvey)];default:return[d.x0.definition(E.WidgetsName.ArticleTitle),d.x0.definition(E.WidgetsName.ArticleText),d.x0.definition(E.WidgetsName.ArticleImage),d.x0.definition(E.WidgetsName.ArticleButton),d.x0.definition(E.WidgetsName.ArticleSlider),d.x0.definition(E.WidgetsName.ArticleAttachment),d.x0.definition(E.WidgetsName.Presence)]}}(s),g=(0,a.useIntl)(),m={open:r,portalId:"react-modal",variant:"full-height",closeHandler:()=>c(!1)},p=e=>{l(d.x0.factory(e)),c(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ue,{...m,children:(0,n.jsx)(ge,{onClickIconClose:m.closeHandler,buttons:"comment"===e?[{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Close"}),color:"cancel",clickHandler:()=>c(!1)}]:void 0,title:g.formatMessage({id:"WIDGET_Builder"}),children:"comment"===e?(0,n.jsx)(le,{column:!0,children:u.map((e,t)=>(0,n.jsx)(re,{open:!0,full:!0,parentIsColumn:!0,index:t,onClick:()=>p(e.name),children:(0,n.jsxs)(de,{direction:"row",gap:12,children:[(0,n.jsx)("img",{src:e.img}),(0,n.jsxs)(de,{direction:"column",children:[(0,n.jsx)("h3",{children:g.formatMessage({id:e.label})}),(0,n.jsx)("p",{children:g.formatMessage({id:e.description})})]})]})},e.name))}):(0,n.jsx)(ne,{children:u.map((e,t)=>(0,n.jsxs)(oe,{onClick:()=>p(e.name),available:e.available,children:[(0,n.jsx)("img",{src:e.img}),(0,n.jsx)("div",{className:"show-on-hover",children:g.formatMessage({id:e.label})})]},t))})})}),"custom"===e&&i?(0,n.jsx)("div",{onClick:()=>c(!0),children:i}):(0,n.jsx)(n.Fragment,{}),"button"===e&&"edit"===t?(0,n.jsx)(ce,{onClick:()=>c(!0),variant:"outlined",minWidth:"100%",children:g.formatMessage({id:"WIDGET_Add_Widget"})}):(0,n.jsx)(n.Fragment,{}),"gallery"===e&&"edit"===t?(0,n.jsx)(ne,{children:u.map((e,t)=>(0,n.jsxs)(oe,{onClick:()=>p(e.name),available:e.available,children:[(0,n.jsx)("img",{src:e.img}),(0,n.jsx)("div",{className:"show-on-hover",children:g.formatMessage({id:e.label})})]},t))}):(0,n.jsx)(n.Fragment,{}),"article"===e&&"edit"===t?(0,n.jsx)(he,{widgets:u,onClick:p}):(0,n.jsx)(n.Fragment,{}),"comment"===e&&"edit"===t?(0,n.jsx)(fe,{onClick:()=>{c(!0)}}):(0,n.jsx)(n.Fragment,{})]})},he=({widgets:e,onClick:t})=>{const[i,s]=(0,o.useState)(!1),l=(0,a.useIntl)(),r=(0,o.useMemo)(()=>80*Math.ceil(e.length/2)+50+10,[e]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(se,{open:i,height:r,children:[(0,n.jsx)(ae,{onClick:()=>s(!i),children:l.formatMessage({id:"WIDGET_Add_Widget"})}),(0,n.jsx)(le,{children:e.map((e,o)=>(0,n.jsxs)(re,{open:i,index:o,onClick:()=>t(e.name),children:[(0,n.jsx)("img",{src:e.img}),l.formatMessage({id:e.label})]},e.name))})]})})},fe=({onClick:e})=>{const t=(0,a.useIntl)();return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(me,{description:t.formatMessage({id:"COMMENT_Add_Widget"}),children:(0,n.jsx)(pe,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})})})},je=()=>{const e=(0,a.useIntl)(),[t,i]=(0,o.useState)(!1),[n,s]=(0,o.useState)();return{open:t,onInsert:e=>{n?.execCommand("InsertHTML",!1,e)},close:()=>i(!1),ext:(0,o.useMemo)(()=>r.JTinyMCEExtensionsBuilders.markdown(e=>{s(e),i(!0)},e),[e]),isActive:!0}};var ye=i(786),be=i(704),Ce=i(876);const ve=u.j.getLazyComponent("InputText"),we=({uniqid:e})=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),s=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e)?.title,be.shallowEqual),{control:l,watch:r}=(0,I.useForm)({defaultValues:{widgetTitle:s},criteriaMode:"all"});return(0,o.useEffect)(()=>{const t=r(t=>{i(d.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.widgetTitle}))});return()=>t.unsubscribe()},[r,i,e]),(0,n.jsx)(ve,{name:"widgetTitle",control:l,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},Le=u.j.getLazyComponent("Button"),Ee=u.j.getLazyComponent("ModalLayout"),ke=u.j.getLazyComponent("ModalContent"),_e=u.j.getLazyComponent("IconButton"),We=l().div`
138
- padding: ${e=>e.theme.space.md}px;
139
- display: flex;
140
- flex-direction: row-reverse;
141
- `,Se=l().div`
142
- flex: 1;
143
- display: flex;
144
- flex-direction: row;
145
- gap: ${e=>e.theme.space.sm}px;
146
- padding: ${e=>e.theme.space.sm}px;
147
- border-bottom: 1px solid ${e=>e.theme.color.grey1};
148
- `,qe=l().div`
149
- flex: 1;
150
- display: flex;
151
- fieldset:first-of-type {
152
- margin: 0px !important;
153
- }
154
- `,Me=l().div`
155
- display: flex;
156
- gap: ${e=>e.theme.space.sm}px;
157
- `,Ae=({uniqid:e,name:t,handleOpenEditor:i})=>{const s=(0,c.jL)(),l=(0,a.useIntl)(),[r,u]=(0,o.useState)(!1),g=(0,o.useCallback)(()=>{s(d.cr.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))},[e,s,t]),m=(0,o.useCallback)(()=>{s(d.x0.slice.actions.flushWidget({uniqid:e}))},[e,s]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(Se,{children:[(0,n.jsx)(qe,{children:(0,n.jsx)(we,{uniqid:e})}),(0,n.jsxs)(Me,{children:[(0,n.jsx)(_e,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:i??g,title:l.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),(0,n.jsx)(_e,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>u(!0),title:l.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})})]})]}),r&&(0,n.jsxs)(Ee,{enableClickAwayCloseModal:!0,open:r,closeHandler:()=>u(!1),children:[(0,n.jsx)(ke,{overflow:"scroll",title:l.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1),children:l.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})}),(0,n.jsx)(We,{children:(0,n.jsx)(Le,{label:l.formatMessage({id:"GLOBAL_Confirm"}),onClick:m})})]})]})},Te=u.j.getLazyComponent("Html"),Ie=l().div`
158
- padding: ${e=>e.theme.space.md}px;
159
- border-bottom: 1px solid ${e=>e.theme.color.grey1};
160
- `,ze=({uniqid:e})=>{const t=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual),i=(0,s.useTheme)(),l=(0,c.GV)(t=>d.x0.selectors.selectWidgetTitleStyle(t,e),be.shallowEqual),a=(0,o.useMemo)(()=>({color:l&&l.color?String(l.color):i.color.black,backgroundColor:l&&l["background-color"]?String(l["background-color"]):i.color.white,fontSize:l&&l["font-size"]?`${l["font-size"]}px`:"24px",fontWeight:l&&l["font-weight"]?String(l["font-weight"]):"medium",textAlign:l&&l["text-align"]?String(l["text-align"]):"left"}),[l,i]),r=(0,o.useMemo)(()=>t&&"string"==typeof t.title&&0!==t.title.length?t.title:void 0,[t]);return r?(0,n.jsx)(Ie,{style:{color:a.color,backgroundColor:a.backgroundColor,fontSize:a.fontSize,fontWeight:a.fontWeight,textAlign:a.textAlign},children:(0,n.jsx)(Te,{as:"span",__html:r})}):(0,n.jsx)(n.Fragment,{})},Ge=u.j.getLazyComponent("InputFileAdvancedRaw"),De=l().div`
161
- width: 0;
162
- height: 0;
163
- overflow: hidden;
164
- `,Ve=({children:e,initialFiles:t,initialClick:i,multiple:s,accept:l,onUploadStart:a,onUploadEnd:r,onUploadSuccess:u})=>{const g=(0,o.useRef)(null),m=(0,c.GV)(d.x0.selectors.selectToken),[p,x]=(0,o.useState)(0),[h,f]=(0,o.useState)(t);return(0,o.useEffect)(()=>{i&&g.current?.click()},[i]),(0,o.useEffect)(()=>{t.length!==h.length&&f(t)},[t]),(0,o.useEffect)(()=>{u(h)},[h]),(0,o.useEffect)(()=>{0===p&&r()},[p]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{onClick:()=>{i&&g.current?.click()},children:e}),(0,n.jsx)(De,{children:(0,n.jsx)(Ge,{ref:g,id:"widget-upload-file",name:"editorFiles",content:"",accept:l,multiple:s,token:m,onUploadStart:e=>{void 0!==e&&x(t=>t+e),"function"==typeof a&&0!==e&&a()},onUploadSuccess:e=>{void 0!==e&&(x(e=>void 0!==e?e-1:0),f(t=>s?[...t,e]:[e]))}})})]})},$e=u.j.getLazyComponent("WidgetAttachment"),Fe=u.j.getLazyComponent("WidgetEmptyInplace"),Re=u.j.getLazyComponent("FileViewer"),Oe=l().div`
165
- flex: 1;
166
- `,Be=({widget:e,inplace:t,mode:i})=>{const s=(0,a.useIntl)(),{uniqid:l}=e,{files:r}=e.content,u=(0,c.jL)(),g=(0,c.GV)(e=>d.x0.selectors.isActive(e,l),be.shallowEqual),m=e=>{u(d.y8.actions.error({label:e??s.formatMessage({id:"GLOBAL_Error"})}))};(0,o.useEffect)(()=>{u(d.x0.slice.actions.setWidgetState({uniqid:l,mounted:!0}))},[]),(0,o.useEffect)(()=>{u(d.x0.slice.actions.setWidgetState({uniqid:l,empty:!r||0===r.length}))},[r]);const p=(0,c.GV)(e=>d.lg.selectors.selectById(e,"WeDocHook")),x=[{label:s.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&k().object.getAccessHash(`fileArticle/${e.id}`).then(t=>{if(""===t.result)throw new Error("result empty");const i=t.result;((e,t)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,i)}).catch(()=>{u(d.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))})}}],h=p?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:x}]:[];return void 0!==r?(0,n.jsxs)(Oe,{children:["view"!==i?(0,n.jsx)($e,{files:r,onClick:()=>{},onError:m}):(0,n.jsx)(Re,{files:r,openWithOptions:h,children:e=>(0,n.jsx)($e,{files:r.map(e=>({...e,uri:(0,E.resolveFilePath)(e)})),onClick:t=>e(t),onError:m})}),t&&"view"!==i&&(0,n.jsx)(Ve,{initialFiles:r,initialClick:g,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&u((0,d.vR)(l,{files:e.map(e=>({...e,uri:(0,E.resolveFilePath)(e)??""}))}))},onUploadStart:()=>{u(d.x0.slice.actions.setWidgetState({uniqid:l,loading:!0}))},onUploadEnd:()=>{u(d.x0.slice.actions.setWidgetState({uniqid:l,loading:!1}))},children:"edit"===i?(0,n.jsx)(Fe,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):(0,n.jsx)(n.Fragment,{})})]}):(0,n.jsx)(n.Fragment,{})},He=u.j.getLazyComponent("WidgetButton"),Ue=l().div`
167
- display: flex;
168
- flex: 1;
169
- justify-content: center;
170
- align-items: center;
171
- `,Ne=l().div`
172
- pointer-events: ${e=>e.clickable?"all":"none"};
173
- cursor: pointer;
174
- display: flex;
175
- flex: 1;
176
- justify-content: center;
177
- align-items: center;
178
- `,Pe=({widget:e,mode:t})=>{const i=(0,c.jL)(),{uniqid:s}=e,{text:l,url:a,target:r,color:u,backgroundColor:g,buttonSize:m,borderRadius:p,variant:x}=e.content;return(0,o.useEffect)(()=>{i(d.x0.slice.actions.setWidgetState({uniqid:s,empty:!l||0===l.length}))},[l]),(0,n.jsx)(Ue,{onClick:()=>{"edit"===t&&i(d.cr.slice.actions.registerEditor({uniqid:s,name:e.name}))},children:(0,n.jsx)(Ne,{clickable:"edit"!==t,children:(0,n.jsx)(He,{text:l,url:a,target:r,color:u,backgroundColor:g,buttonSize:m,borderRadius:p,variant:x})})})},Ye=u.j.getLazyComponent("WidgetArticleGallery"),Je=u.j.getLazyComponent("WidgetEmptyInplace"),Qe=u.j.getLazyComponent("FileViewer"),Ke=l().button`
179
- cursor: pointer;
180
- `,Xe=({widget:e,inplace:t,mode:i})=>{const{uniqid:s}=e,{files:l}=e.content,a=(0,c.jL)(),r=(0,c.GV)(e=>d.x0.selectors.isActive(e,s),be.shallowEqual);return(0,o.useEffect)(()=>{a(d.x0.slice.actions.setWidgetState({uniqid:s,mounted:!0}))},[]),void 0!==l?(0,n.jsxs)(n.Fragment,{children:["edit"===i?(0,n.jsx)(Ye,{files:l,maxWidth:800,gap:e.content.gap??"10",column:e.content.column??"3",onClick:()=>{}}):(0,n.jsx)(Qe,{files:l,openWithOptions:[],children:t=>(0,n.jsx)(Ke,{children:(0,n.jsx)(Ye,{files:l,maxWidth:600,gap:e.content.gap??"10",column:e.content.column??"3",onClick:e=>t(e)})})}),t&&"edit"===i?(0,n.jsx)(Ve,{initialFiles:l,initialClick:r,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&a((0,d.vR)(s,{files:e}))},onUploadStart:()=>{a(d.x0.slice.actions.setWidgetState({uniqid:s,loading:!0}))},onUploadEnd:()=>{a(d.x0.slice.actions.setWidgetState({uniqid:s,loading:!1}))},children:(0,n.jsx)(Je,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})}):(0,n.jsx)(n.Fragment,{})]}):(0,n.jsx)(n.Fragment,{})},Ze=u.j.getLazyComponent("WidgetImage"),et=u.j.getLazyComponent("FileViewer"),tt=u.j.getLazyComponent("WidgetEmptyInplace"),it=l().div`
181
- position: absolute;
182
- inset: 0;
183
- background-color: rgba(0, 0, 0, 0.4);
184
- pointer-events: none;
185
- display: flex;
186
- justify-content: center;
187
- align-items: center;
188
- opacity: 0;
189
- color: ${e=>e.theme.color.white};
190
- &:hover {
191
- opacity: 1;
192
- }
193
- `,nt=l().button`
194
- cursor: pointer;
195
- `,ot={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},st=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},lt=({widget:e,width:t,inplace:i,mode:s})=>{const{uniqid:l}=e,{file:r,useFilter:u}=e.content,g=(0,c.jL)(),m=(0,c.GV)(e=>d.x0.selectors.isActive(e,l),be.shallowEqual),[p,x]=(0,o.useState)(void 0),h=(0,a.useIntl)();return(0,o.useEffect)(()=>{g(d.x0.slice.actions.setWidgetState({uniqid:l,mounted:!0}))},[]),(0,o.useEffect)(()=>{g(d.x0.slice.actions.setWidgetState({uniqid:l,empty:!r}))},[r]),(0,o.useEffect)(()=>{r&&x((0,E.formatImgUrl)({timestamp:r.dateModified?st(r.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:r.uri}))},[r]),(0,n.jsxs)(n.Fragment,{children:["edit"!==s&&(0,n.jsx)(et,{files:[{...ot,...r,path:p,mimetype:"image/png"}],openWithOptions:[],children:e=>(0,n.jsx)(nt,{onClick:()=>e(r?.id??0),children:(0,n.jsx)(Ze,{maxWidth:t??600,uri:p,useFilter:u??!1})})}),"edit"===s&&(0,n.jsxs)(n.Fragment,{children:[void 0!==p&&(0,n.jsx)(Ze,{maxWidth:t??600,uri:p,useFilter:u??!1}),i&&(0,n.jsx)(Ve,{initialFiles:[],initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&g((0,d.vR)(l,{file:e[0]}))},onUploadStart:()=>{g(d.x0.slice.actions.setWidgetState({uniqid:l,loading:!0}))},onUploadEnd:()=>{g(d.x0.slice.actions.setWidgetState({uniqid:l,loading:!1}))},children:void 0!==r?(0,n.jsx)(it,{children:h.formatMessage({id:"ARTICLE_Widget_Image_Change"})}):(0,n.jsx)(tt,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})})]})]})},at=u.j.getLazyComponent("FileViewer"),rt=u.j.getLazyComponent("WidgetEmptyInplace"),dt=u.j.getLazyComponent("WidgetSlider"),ct=l().div`
196
- flex: 1;
197
- display: flex;
198
- flex-direction: row;
199
- min-height: 60px;
200
- align-items: center;
201
- width: ${e=>e.maxWidth}px;
202
- `,ut={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},gt=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},mt=({widget:e,mode:t,width:i})=>{const{uniqid:s}=e,l=(0,c.jL)(),a=(0,c.GV)(e=>d.x0.selectors.isActive(e,s),be.shallowEqual),r=i??600,[u,g]=(0,o.useState)(void 0),m=(0,o.useRef)(null),p=(0,o.useMemo)(()=>e.content.slides?[...e.content.slides.map((e,t)=>({...ut,id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:ut.mimetype,path:e.file&&e.file.uri?(0,E.formatImgUrl)({size:"fitx1200",uri:e.file.uri,from:"imagecache",timestamp:e.file&&e.file.dateModified?gt(e.file.dateModified):Date.now()}):""}))]:[],[e.content.slides]),x=(0,o.useMemo)(()=>void 0!==e.content.slides?[...e.content.slides.map(e=>e.file?{...e,uri:(0,E.formatImgUrl)({timestamp:e.file.dateModified?gt(e.file.dateModified):Date.now(),size:`fitx${u&&u<r?u:r}`,from:"imagecache",uri:e.file.uri})}:{...e,uri:""})]:[],[e.content.slides,u,r]);(0,o.useEffect)(()=>{a&&"edit"===t&&l(d.cr.slice.actions.registerEditor({uniqid:s,name:e.name}))},[a]),(0,o.useEffect)(()=>{const e=()=>{m.current&&g(m.current?m.current.offsetWidth:r)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[m]),(0,o.useEffect)(()=>{g(m.current?m.current.offsetWidth:r)},[m]),(0,o.useEffect)(()=>{l(d.x0.slice.actions.setWidgetState({uniqid:s,empty:!e.content.slides||0===e.content.slides.length}))},[e.content.slides]);const h=(0,o.useMemo)(()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length,[e.content.slides,t]),f=(0,o.useCallback)(()=>{l(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))},[l,e.uniqid,e.name]);return void 0===u?(0,n.jsx)("div",{ref:m,style:{width:"100%"}}):(0,n.jsxs)(ct,{maxWidth:u&&u<r?u:r,children:[(0,n.jsx)(at,{files:p,openWithOptions:[],children:i=>(0,n.jsx)(dt,{slides:x,maxWidth:u&&u<r?u:r,useDots:e.content.useDots??!0,loop:e.content.loop??!1,startAt:0,onClickSlide:n=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[n];t&&t.file&&i(t.file.id)}}else l(d.cr.slice.actions.registerEditor({uniqid:s,name:e.name}))}})}),h?(0,n.jsx)(rt,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:f}):(0,n.jsx)(n.Fragment,{})]})};var pt=i(605);const xt=u.j.getLazyComponent("InputTextareaRaw"),ht=u.j.getLazyComponent("Modal"),ft=({onInsert:e,open:t,close:i})=>{const s=(0,a.useIntl)(),[l,r]=(0,o.useState)(""),d=(0,o.useCallback)(()=>{r(""),i()},[i]);return(0,n.jsx)(ht,{title:s.formatMessage({id:"TINY_MCE_Insert_Markdown"}),open:t,closeHandler:d,enableClickAwayCloseModal:!0,buttons:[{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:d},{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Insert"}),color:"valid",disabled:!l,clickHandler:()=>{e(pt.xI.parse(l,{async:!1}).replace(/<br>/g,"<br><br>")),d()}}],children:(0,n.jsx)(xt,{value:l,onChange:e=>r(e.target.value),height:"400px"})})},jt=u.j.getLazyComponent("WidgetArticleText"),yt=l().div`
203
- width: 100%;
204
- cursor: text;
205
-
206
- p {
207
- word-wrap: break-word;
208
- }
209
-
210
- a {
211
- word-wrap: break-word;
212
- }
213
- `,bt=({widget:e,mode:t})=>{const{uniqid:i}=e,l=(0,s.useTheme)(),{text:r}=e.content,u=(0,c.jL)(),g=(0,c.GV)(e=>d.x0.selectors.isActive(e,i),be.shallowEqual),m=(0,c.GV)(e=>d.x0.selectors.selectWidgetState(e,i)?.busy),p=(0,c.GV)(d.x0.selectors.selectToken),x=(0,c.GV)(d.sU.selectors.selectTinyMCECommonOptions),h=(0,c.GV)(d.Kx.selectors.selectAll),f=(0,a.useIntl)(),{open:j,onInsert:y,close:b,ext:C,isActive:v}=je(),w=(0,o.useCallback)(e=>{u(d.y8.actions.error({label:e??f.formatMessage({id:"GLOBAL_Error"})}))},[u,f]);(0,o.useEffect)(()=>{u(d.x0.slice.actions.setWidgetState({uniqid:i,empty:!r||0===r.length}))},[r]);const L=(0,o.useMemo)(()=>(0,ye.X)(h,l,w),[h,w,l]);return m?(0,n.jsx)(n.Fragment,{}):(0,n.jsxs)(yt,{children:[(0,n.jsx)(jt,{autoFocus:g,text:r??"",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t&&x?{commonOptions:x,mentionsQueries:L}:void 0,mode:t,onChange:e=>{u((0,d.vR)(i,{text:e}))},additionalExtensions:[C],handlers:{file:k().file}}),v&&(0,n.jsx)(ft,{onInsert:y,open:j,close:b})]})},Ct=u.j.getLazyComponent("WidgetArticleTitle"),vt=l().div`
214
- flex: 1;
215
- display: flex;
216
- flex-direction: row;
217
- align-items: center;
218
- cursor: text;
219
- `,wt=l().div`
220
- display: flex;
221
- flex-direction: row;
222
- border-radius: 8px;
223
- overflow: hidden;
224
- margin: 4px;
225
- border: 1px solid ${e=>e.theme.color.grey1};
226
- `,Lt=l().button`
227
- display: flex;
228
- width: 40px;
229
- height: 40px;
230
- justify-content: center;
231
- align-items: center;
232
- cursor: pointer;
233
- opacity: ${e=>e.isActive?"1.0":".8"};
234
- background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
235
- &:hover {
236
- background-color: ${e=>e.theme.color.grey1};
237
- }
238
- `,Et=({widget:e,inplace:t,mode:i,dataCy:s})=>{const{uniqid:l}=e,{text:a,color:r,heading:u}=e.content,g=(0,c.jL)(),m=(0,c.GV)(e=>d.x0.selectors.isActive(e,l),be.shallowEqual);return(0,o.useEffect)(()=>{g(d.x0.slice.actions.setWidgetState({uniqid:l,empty:!a||0===a.length}))},[a]),(0,n.jsxs)(vt,{children:[(0,n.jsx)(Ct,{dataCy:s,text:a,color:r,heading:u,autoFocus:m,inplace:t,mode:i,onChange:e=>{g((0,d.vR)(l,{text:e}))}}),m&&"edit"===i?(0,n.jsx)(kt,{heading:u,onClick:e=>{g((0,d.vR)(l,{heading:e}))}}):(0,n.jsx)(n.Fragment,{})]})},kt=({heading:e="h1",onClick:t})=>(0,n.jsx)(wt,{children:["h1","h2","h3","h4"].map((i,o)=>(0,n.jsx)(Lt,{isActive:e===i,onClick:()=>t(i),children:i},o))}),_t=u.j.getLazyComponent("ModalLayout"),Wt=u.j.getLazyComponent("ModalContent"),St=u.j.getLazyComponent("Button"),qt=u.j.getLazyComponent("InputText"),Mt=u.j.getLazyComponent("InputNumber"),At=u.j.getLazyComponent("InputSelectExtended"),Tt=u.j.getLazyComponent("InputPassword"),It=u.j.getLazyComponent("Typography"),zt=u.j.getLazyComponent("Loader"),Gt=l().div`
239
- display: flex;
240
- flex-direction: column;
241
- opacity: ${e=>e.isLocked?".4":"1.0"};
242
- `,Dt=l().div`
243
- position: absolute;
244
- inset: 0;
245
- display: flex;
246
- justify-content: center;
247
- align-items: center;
248
- `,Vt=l().div`
249
- background-color: ${e=>e.theme.color.orange};
250
- color: ${e=>e.theme.color.white};
251
- padding: ${e=>e.theme.space.sm}px;
252
- border-radius: ${e=>e.theme.space.sm}px;
253
- display: flex;
254
- justify-content: center;
255
- align-items: center;
256
- `,$t=l().div`
257
- margin-bottom: ${e=>e.theme.space.md}px;
258
- `,Ft={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:E.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},Rt=()=>{const e=(0,a.useIntl)(),t=(0,c.jL)(),i=(0,r.useAbortController)(),[s,l]=(0,o.useState)(!1),[u,g]=(0,o.useState)(!1),{control:m,reset:p,setValue:x,getValues:h,watch:f,formState:{isValid:j}}=(0,I.useForm)({defaultValues:Ft,criteriaMode:"all"}),[y,b]=(0,o.useState)([]),C=f(),v=[{label:"NONE",value:E.ImapConnection.NONE},{label:"SSL",value:E.ImapConnection.SSL},{label:"STARTTLS",value:E.ImapConnection.STARTTLS}],w=(0,o.useCallback)(e=>{k().office.getConfiguration().then(({result:t})=>{p({...t,provider:e.includes(t.provider??"")?t.provider:e[0]})})},[p]);(0,o.useEffect)(()=>{s&&(g(!0),k().office.getProviders({signal:i.signal}).then(({result:e})=>{i.signal.aborted||(b(e),w(e.map(e=>e.id)))}).catch(e=>{i.signal.aborted||t(d.y8.actions.error({label:e.errorMsg}))}).finally(()=>{g(!1)}))},[s,i.signal,t,w]),(0,o.useEffect)(()=>{1===y.length&&x("provider",y[0].id)},[y,x]);const L=()=>l(!1),_=(0,o.useMemo)(()=>y.length>1,[y]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Dt,{children:(0,n.jsx)(St,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>l(!0)})}),(0,n.jsx)(_t,{open:s,radius:"small",closeHandler:L,children:(0,n.jsx)(Wt,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:L,children:u?(0,n.jsx)(zt,{size:"s"}):(0,n.jsxs)(n.Fragment,{children:[0===y.length&&(0,n.jsx)(Vt,{children:e.formatMessage({id:"Office_No_Providers"})}),(0,n.jsxs)(Gt,{isLocked:0===y.length,children:[_&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)($t,{children:[(0,n.jsx)(It,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_Provider"})}),(0,n.jsx)(Ot,{label:"OfficeHook_Conf_Select_Provider",initialValue:{label:y[0].label,value:y[0].id},options:y.map(e=>({label:e.label,value:e.id})),handleChange:e=>{h("provider")!==e&&p(),x("provider",e)}})]})}),(0,n.jsxs)($t,{children:[(0,n.jsx)(It,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Settings"})}),(0,n.jsx)(qt,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),(0,n.jsx)(qt,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),(0,n.jsx)(Tt,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}})]}),(0,n.jsxs)($t,{children:[(0,n.jsx)(It,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_IMap_Mailbox"})}),(0,n.jsx)(Mt,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),(0,n.jsx)(Ot,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:v[0],options:v,handleChange:e=>x("imapConnectionSecurity",e)}),(0,n.jsx)(qt,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}})]}),(0,n.jsxs)($t,{children:[(0,n.jsx)(It,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})}),(0,n.jsx)(qt,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}})]}),(0,n.jsxs)($t,{children:[(0,n.jsx)(It,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})}),(0,n.jsx)(qt,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})]})]}),(0,n.jsx)(St,{label:e.formatMessage({id:"OfficeHook_Conf_Prompt_Submit"}),loader:u,disabled:u||0===y.length||!j,onClick:()=>{u||(g(!0),k().office.setConfiguration(C).then(()=>window.location.reload()).catch(e=>t(d.y8.actions.error({label:e.errorMsg}))).finally(()=>{l(!1),g(!1),p()}))}})]})})})]})},Ot=({label:e,initialValue:t,options:i,handleChange:s})=>{const{control:l,watch:a}=(0,I.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,o.useEffect)(()=>{const e=a(e=>{e.provider&&e.provider.value&&s(e.provider.value)});return()=>e.unsubscribe()},[a,s]),(0,n.jsx)(At,{label:e,name:"provider",options:i??[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:l,rules:{required:!0}})},Bt=l().div`
259
- flex-direction: column;
260
- display: flex;
261
- flex: 1;
262
- `,Ht=l().div`
263
- position: relative;
264
- display: flex;
265
- flex: 1;
266
- `,Ut=l().div`
267
- overflow: auto;
268
- position: absolute;
269
- inset: 0;
270
- `,Nt=({header:e,scrollable:t,footer:i})=>(0,n.jsxs)(Bt,{children:[e&&e(),(0,n.jsx)(Ht,{children:(0,n.jsx)(Ut,{children:t&&t()})}),i&&i()]}),Pt=l().div`
271
- display: flex;
272
- flex-direction: column;
273
- `,Yt=({uniqid:e,children:t})=>{const i=(0,c.GV)(t=>d.x0.selectors.selectWidgetWrapperStyle(t,e),be.shallowEqual),s=(0,o.useMemo)(()=>({padding:i&&i.padding?`${i.padding}px`:"0px"}),[i]);return(0,n.jsx)(Pt,{style:{padding:s.padding},children:t})},Jt=l().div`
274
- padding: ${e=>e.theme.space.md}px;
275
- padding-right: 0px;
276
- `,Qt=l().div`
277
- text-align: ${e=>e.textAlign};
278
- font-size: ${e=>e.fontSize}px;
279
- font-weight: ${e=>e.fontWeight};
280
- color: ${e=>e.color};
281
- `,Kt=({uniqid:e,textAlign:t="left",fontSize:i="16",fontWeight:o="medium",color:s})=>{const l=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual);return(0,n.jsx)(n.Fragment,{children:l&&"string"==typeof l.title&&0!==l.title.length&&(0,n.jsx)(Jt,{children:(0,n.jsx)(Qt,{textAlign:t,fontSize:i,fontWeight:o,color:s,children:l.title})})})},Xt=l().div`
282
- background-color: ${e=>e.backroundColor};
283
- `,Zt=l().div`
284
- display: flex;
285
- flex-direction: row;
286
- align-items: center;
287
- `,ei=(l().div`
288
- padding: ${e=>e.theme.space.sm}px ${e=>e.theme.space.md}px;
289
- color: ${e=>e.theme.color.grey4};
290
- `,l().div`
291
- flex: 1;
292
- display: flex;
293
- flex-direction: row;
294
- gap: ${e=>e.theme.space.xs}px;
295
- align-items: center;
296
- `),ti=({uniqid:e,dropdown:t,subHeader:i})=>{const l=(0,s.useTheme)(),a=(0,c.GV)(t=>d.x0.selectors.selectWidgetTitleStyle(t,e),be.shallowEqual),r=(0,o.useMemo)(()=>({color:a&&a.color?String(a.color):l.color.black,backgroundColor:a&&a["background-color"]?String(a["background-color"]):"transparent",fontSize:a&&a["font-size"]?String(a["font-size"]):"16",fontWeight:a&&a["font-weight"]?String(a["font-weight"]):"medium",textAlign:a&&a["text-align"]?String(a["text-align"]):"left"}),[a,l]);return(0,n.jsx)(Xt,{backroundColor:r.backgroundColor,children:(0,n.jsxs)(Zt,{children:[(0,n.jsxs)(ei,{children:[(0,n.jsx)(Kt,{uniqid:e,fontWeight:r.fontWeight,fontSize:r.fontSize,textAlign:r.textAlign,color:r.color}),i&&i(r.color)]}),t&&t()]})})},ii=u.j.getLazyComponent("ButtonDropdown"),ni=u.j.getLazyComponent("Tooltip"),oi=l().div`
297
- margin-right: ${e=>e.theme.space.sm}px;
298
- button {
299
- background: ${e=>e.theme.color.white};
300
- }
301
- `,si=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),s=(0,be.useDispatch)(),l=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{s(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Ft).finally(i)}}];return(0,n.jsx)(ti,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(oi,{children:(0,n.jsx)(ni,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(ii,{small:!0,smallOpenDirection:"left",options:l,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},li=u.j.getLazyComponent("WidgetCalendarCalDav"),ai=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:s}=e,l=(0,c.jL)(),[a,u]=(0,o.useState)(void 0),[g,m]=(0,o.useState)(!1),p=(0,c.GV)(e=>d.x0.selectors.selectWidgetLevel(e,s),be.shallowEqual),[x,h]=(0,o.useState)(void 0),[f,j]=(0,o.useState)([]),y=(0,o.useCallback)((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Ft),t?window.location.reload():(u(!1),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0,loading:!1})))},[l,s]),b=(0,o.useCallback)(e=>{u(e),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0}))},[l,s]),C=(0,o.useCallback)(e=>l(d.x0.slice.actions.setWidgetState({uniqid:s,loading:e})),[s,l]),v=(0,o.useCallback)(()=>{k().office.getProviderBaseUrls().then(({result:e})=>{h(e.dav_calendar_url)}).finally(()=>C(!1))},[C]),w=(0,o.useCallback)(()=>{const e=new Date,t=r.Utils.date.addMonth(new Date(e));k().office.davCalendarGetEvents({limit:10,dateStart:r.Utils.date.formatDateTime(e),dateEnd:r.Utils.date.formatDateTime(t)}).then(({result:e})=>{j(e),m(!0)}).catch(()=>{l(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),u(!1),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0,loading:!1}))}).finally(()=>C(!1))},[C,l,s]);return(0,o.useEffect)(()=>{if(!g)return;if(!a)return;if(p!==E.WIDGET_LEVEL_3)return;const e=setInterval(w,6e4);return()=>clearInterval(e)},[a,w,g,p]),(0,o.useEffect)(()=>{C(!0),k().office.isConfigurationValid().then(({result:e})=>b(e)).catch(y)},[y,C,b]),(0,o.useEffect)(()=>{if(a)return p===E.WIDGET_LEVEL_1?(C(!0),void v()):void w()},[a,v,C,w,p]),a&&p&&p!==E.WIDGET_LEVEL_3&&i?(0,n.jsx)(n.Fragment,{children:i(p,x??"")}):(0,n.jsx)(Nt,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(si,{uniqid:s,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>y(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Yt,{uniqid:s,children:[a&&(0,n.jsx)(li,{calendarListEvent:f}),void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)(Rt,{})]})})};var ri=i(858);const di=u.j.getLazyComponent("Button"),ci=u.j.getLazyComponent("ModalLayout"),ui=u.j.getLazyComponent("ModalContent"),gi=u.j.getLazyComponent("IconButton"),mi=(l().button`
302
- padding: ${e=>e.theme.space.md}px;
303
- `,l().div`
304
- padding: ${e=>e.theme.space.md}px;
305
- display: flex;
306
- flex-direction: row-reverse;
307
- `),pi=({id:e,type:t,uniqid:i})=>{const s=(0,c.jL)(),l=(0,a.useIntl)(),[r,u]=(0,o.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(gi,{iconSize:14,onClick:()=>u(!0),icon:"icon-trash"}),r&&(0,n.jsxs)(ci,{enableClickAwayCloseModal:!0,open:r,closeHandler:()=>u(!1),children:[(0,n.jsx)(ui,{overflow:"scroll",title:l.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1),children:l.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})}),(0,n.jsx)(mi,{children:(0,n.jsx)(di,{label:l.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{k().widget.removeWidget({id:e,type:t,uniqid:i}).then(()=>{s(d.x0.slice.actions.flushWidget({uniqid:i}))}).catch(()=>s(d.y8.actions.error({label:"WIDGET_Presence_Error"})))}})})]})]})},xi=l().div`
308
- display: flex;
309
- flex: 1;
310
- flex-direction: row;
311
- border-top: 1px solid ${e=>e.theme.color.grey1};
312
- `,hi=l().button`
313
- display: flex;
314
- flex: 1;
315
- justify-content: center;
316
- align-items: center;
317
- background-color: ${e=>e.theme.color.white};
318
- &:hover {
319
- background-color: ${e=>e.theme.color.grey0};
320
- }
321
- `,fi=({name:e,uniqid:t,mode:i,collaborationRights:s,handleOpenEditor:l})=>{const r=(0,a.useIntl)(),u=(0,c.jL)(),g=(0,c.GV)(e=>d.x0.selectors.selectWidgetObject(e,t),be.shallowEqual),m=(0,c.GV)(e=>d.x0.selectors.selectWidgetObjectRights(e,t),be.shallowEqual),p=(0,o.useMemo)(()=>g&&m&&m.update||s&&s.update,[g,m,s]),x=(0,o.useMemo)(()=>g&&m&&m.delete,[g,m]),h=(0,o.useCallback)(()=>{u(d.cr.slice.actions.registerEditor({uniqid:t,name:e,mode:i}))},[t,u,e,i]);return p&&(0,E.ensureWidgetObjectHasMinimumProperties)(g)?(0,n.jsxs)(xi,{children:[(0,n.jsx)(hi,{onClick:l??h,children:r.formatMessage({id:"WIDGET_Set_Widget"})}),x&&(0,n.jsx)(pi,{id:g.id,type:g.type,uniqid:t})]}):(0,n.jsx)(n.Fragment,{})},ji=u.j.getLazyComponent("Button"),yi=u.j.getLazyComponent("InputText"),bi=l().div`
322
- padding: ${e=>e.theme.space.md}px;
323
- display: flex;
324
- flex-direction: row;
325
- fieldset {
326
- margin: 0.2rem !important;
327
- }
328
- `,Ci=({placeholder:e,handleClick:t})=>{const i=(0,a.useIntl)(),s=(0,c.jL)(),[l,r]=(0,o.useState)(""),{control:d,watch:u,reset:g}=(0,I.useForm)({defaultValues:{label:l},criteriaMode:"all"});return(0,o.useEffect)(()=>{const e=u(e=>{r(e.label??"")});return()=>e.unsubscribe()},[u,s]),(0,n.jsxs)(bi,{children:[(0,n.jsx)(yi,{name:"label",control:d,placeholder:e,width:"100%"}),(0,n.jsx)(ji,{label:i.formatMessage({id:"GLOBAL_Confirm"}),disabled:!l.length,onClick:()=>{t(l),r(""),g()}})]})},vi=u.j.getLazyComponent("Loader"),wi=l().div`
329
- position: absolute;
330
- inset: 0;
331
- display: flex;
332
- justify-content: center;
333
- align-items: center;
334
- background-color: rgba(255, 255, 255, 0.4);
335
- `,Li=()=>(0,n.jsx)(wi,{children:(0,n.jsx)(vi,{size:"m"})}),Ei=u.j.getLazyComponent("WidgetCheckList"),ki=u.j.getLazyComponent("WidgetCheckListEditor"),_i=u.j.getLazyComponent("FileViewer"),Wi=(l().div`
336
- display: flex;
337
- flex-direction: row;
338
- justify-content: space-between;
339
- align-items: center;
340
- border: ${e=>e.border?`1px solid ${e.theme.color.grey2}`:"none"};
341
- min-height: 24px;
342
- border-radius: 4px;
343
- padding: 4px 8px;
344
- `,l().div`
345
- width: 100%;
346
- display: flex;
347
- gap: 14px;
348
- padding: 16px;
349
- `),Si=l().div`
350
- position: relative;
351
- `,qi=({widget:e,inplace:t,mode:i,onWidgetUpdate:s})=>{const l=(0,a.useIntl)(),{uniqid:u,content:g}=e,m=(0,c.jL)(),[p,x]=(0,o.useState)(),[h,f]=(0,o.useState)(!1),[j,y]=(0,o.useState)(),[b,C]=(0,o.useState)(!1),v=(0,c.GV)(d.x0.selectors.selectToken,be.shallowEqual),w=(0,c.GV)(t=>d.x0.selectors.selectWidgetObjectUri(t,e.uniqid),be.shallowEqual),L=(0,c.GV)(e=>d.x0.selectors.selectWidgetObjectRights(e,u),be.shallowEqual),_=(0,c.GV)(t=>d.x0.selectors.selectAllWidgetRTObject(t,e.uniqid),be.shallowEqual),W=(0,o.useMemo)(()=>L&&L.update,[L]),S=(0,o.useMemo)(()=>L&&L.administrate,[L]),q=(0,o.useCallback)(e=>{m(d.y8.actions.error({label:e??l.formatMessage({id:"GLOBAL_Error"})}))},[m,l]),M=(0,o.useCallback)(()=>{p||h||(f(!0),k().network.token().then(e=>{x(e.result),f(!1),m(d.x0.slice.actions.setToken({token:e.result}))}).catch(e=>{q(e.errorMsg)}))},[q,p,h,m]);v?p||x(v):M();const A=(0,o.useCallback)((e,t)=>{m((0,d.vR)(e,t))},[m]),T=(0,o.useCallback)(()=>{w&&(C(!0),k().widget.getWidget({uri:w,uniqid:u}).then(e=>{(0,E.ensureWidgetCheckListType)(e.result)&&A(u,e.result.content)}).catch(e=>!e.aborted&&q).finally(()=>C(!1)))},[u,q,w,A]),I=t=>{m(d.cr.slice.actions.flushAllEditor()),m(d.x0.slice.actions.setToken({token:t})),m(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:E.WidgetsName.CheckList,mode:i}))};(0,o.useEffect)(()=>{p||"edit"!==i||k().network.token().then(e=>{m(d.x0.slice.actions.setToken({token:e.result}))})},[i,p,m]),(0,o.useEffect)(()=>{const t=e.content.arr?.map(e=>({text:e.title??"",file:e.file??void 0,checked:e.value??!1,...e.links&&{links:e.links},...e.user&&{user:e.user??void 0},...e.id&&{id:e.id,mimetype:"image/png"}}));y(t)},[e.content.arr,g]),(0,o.useEffect)(()=>{if(!Array.isArray(_))return;const t=_.at(-1);t&&w&&t.object.uri===w&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||T())},[_,e.uniqid,w,q,m,T]);const z=t=>{if(!e.content.arr||!w)return;const i={...e.content,arr:[...e.content.arr,{title:t,value:!1}]};k().widget.updateWidget({uri:w,uniqid:e.uniqid,content:i,v2:!0}).then(()=>A(e.uniqid,i)).catch(e=>q(e.errorMsg))},G=(0,o.useMemo)(()=>{if(!Array.isArray(g.arr))return[];const e=[];return g.arr.forEach(t=>{t.file&&e.push(t.file)}),e},[g]);return"edit"===i&&t?(0,n.jsx)(Wi,{children:(0,n.jsx)(ki,{token:p,uniqid:u,content:{...g,arr:g.arr?.map(e=>({...e,title:r.Utils.html.htmlDecodeSpecialChars(e.title)}))},inplace:t,onChangeContent:A,onChangeWrapper:e=>{m(d.x0.slice.actions.updateWidgetWrapper({...e}))},handleChange:t=>m((0,d.vR)(e.uniqid,t))})}):(0,n.jsx)(ri.M,{useRT:()=>{(0,Ce.AW)(e.uniqid)},children:j&&(0,n.jsx)(_i,{files:G,openWithOptions:[],children:t=>(0,n.jsxs)(Si,{children:[(0,n.jsx)(Ei,{limit:10,initialEntries:j,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{w&&(b||(C(!0),k().widget.checkListRespond({uri:w,uniqid:e,index:t}).then(()=>{s&&s()}).catch(e=>{q(e.message),C(!1)})))})(e.uniqid,t)}),g.edit&&(0,n.jsx)(Ci,{handleClick:z,placeholder:l.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),S&&p&&(0,n.jsx)(fi,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!W)},mode:i,handleOpenEditor:()=>{p?I(p):(C(!0),k().network.token().then(e=>{m(d.x0.slice.actions.setToken({token:e.result})),I(e.result)}).finally(()=>C(!1)))}}),b&&(0,n.jsx)(Li,{})]},e.uniqid)})})},Mi=u.j.getLazyComponent("ButtonDropdown"),Ai=u.j.getLazyComponent("Tooltip"),Ti=l().div`
352
- margin-right: ${e=>e.theme.space.sm}px;
353
- button {
354
- background: ${e=>e.theme.color.white};
355
- }
356
- `,Ii=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),s=(0,be.useDispatch)(),l=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{s(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Ft).finally(i)}}];return(0,n.jsx)(ti,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(Ti,{children:(0,n.jsx)(Ai,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(Mi,{small:!0,smallOpenDirection:"left",options:l,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},zi=u.j.getLazyComponent("WidgetContactCardDav"),Gi=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:s}=e,l=(0,c.jL)(),[a,r]=(0,o.useState)(void 0),[u,g]=(0,o.useState)(void 0),[m,p]=(0,o.useState)(!1),x=(0,c.GV)(e=>d.x0.selectors.selectWidgetLevel(e,s),be.shallowEqual),[h,f]=(0,o.useState)([]),j=(0,o.useCallback)((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Ft),t?window.location.reload():(r(!1),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0,loading:!1})))},[l,s]),y=(0,o.useCallback)(e=>{r(e),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0}))},[l,s]),b=(0,o.useCallback)(e=>l(d.x0.slice.actions.setWidgetState({uniqid:s,loading:e})),[s,l]),C=(0,o.useCallback)(()=>{k().office.getProviderBaseUrls().then(({result:e})=>{g(e.dav_address_book_url)}).finally(()=>b(!1))},[b]),v=(0,o.useCallback)(()=>{k().office.davAddressBookGetContacts({limit:10}).then(({result:e})=>{f(e),p(!0)}).catch(()=>{l(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),r(!1),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0,loading:!1}))}).finally(()=>b(!1))},[b,l,s]);return(0,o.useEffect)(()=>{if(!m)return;if(!a)return;if(x!==E.WIDGET_LEVEL_3)return;const e=setInterval(v,4e3);return()=>clearInterval(e)},[a,v,m,x]),(0,o.useEffect)(()=>{b(!0),k().office.isConfigurationValid().then(({result:e})=>y(e)).catch(j).finally(()=>b(!1))},[y,x,C,b,j]),(0,o.useEffect)(()=>{if(a)return x===E.WIDGET_LEVEL_1?(b(!0),void C()):void v()},[a,C,b,v,x]),a&&x&&x!==E.WIDGET_LEVEL_3&&i?(0,n.jsx)(n.Fragment,{children:i(x,u??"")}):(0,n.jsx)(Nt,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Ii,{uniqid:s,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Yt,{uniqid:s,children:[a&&(0,n.jsx)(zi,{contactCardList:h}),void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)(Rt,{})]})})},Di=u.j.getLazyComponent("ButtonDropdown"),Vi=u.j.getLazyComponent("Tooltip"),$i=l().div`
357
- margin-right: ${e=>e.theme.space.sm}px;
358
- button {
359
- background: ${e=>e.theme.color.white};
360
- }
361
- `,Fi=l().div`
362
- font-size: ${e=>e.theme.size.sm+4}px;
363
- color: ${e=>e.color};
364
- `,Ri=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),s=(0,c.jL)(),l=(0,c.GV)(t=>d.x0.selectors.selectWidgetChipCount(t,e),be.shallowEqual),r=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{s(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Ft).finally(i)}}];return(0,n.jsx)(ti,{uniqid:e,dropdown:()=>t&&(0,n.jsx)($i,{children:(0,n.jsx)(Vi,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(Di,{small:!0,smallOpenDirection:"left",options:r,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})}),subHeader:e=>t&&0!==l&&(0,n.jsxs)(Fi,{color:e,children:["(",o.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:l}),")"]})})},Oi=u.j.getLazyComponent("WidgetEmailsImap"),Bi=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:s}=e,l=(0,c.jL)(),[a,r]=(0,o.useState)(void 0),[u,g]=(0,o.useState)(!1),[m,p]=(0,o.useState)([]),[x,h]=(0,o.useState)(void 0),f=(0,c.GV)(t=>d.x0.selectors.selectWidgetLevel(t,e.uniqid),be.shallowEqual),j=(0,o.useCallback)((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Ft),t?window.location.reload():(r(!1),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0,loading:!1})))},[l,s]),y=(0,o.useCallback)(()=>{k().office.imapInboxGetUnreadEmailsCount().then(({result:e})=>{l(d.x0.slice.actions.setWidgetChipCount({uniqid:s,count:e})),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0}))}).catch(j)},[l,s,j]),b=(0,o.useCallback)(e=>l(d.x0.slice.actions.setWidgetState({uniqid:s,loading:e})),[s,l]),C=(0,o.useCallback)(()=>{k().office.getProviderBaseUrls().then(({result:e})=>{h(e.imap_inbox_url)}).finally(()=>b(!1))},[b]),v=(0,o.useCallback)(e=>{r(e),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0}))},[l,s]),w=(0,o.useCallback)(()=>{k().office.imapInboxGetEmails({limit:10}).then(({result:e})=>{p(e),g(!0)}).catch(()=>{l(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),r(!1),l(d.x0.slice.actions.setWidgetState({uniqid:s,initialized:!0,loading:!1}))}).finally(()=>b(!1))},[b,l,s]);return(0,o.useEffect)(()=>{if(!u)return;if(!a)return;if(f===E.WIDGET_LEVEL_1)return;const e=setInterval(()=>{f===E.WIDGET_LEVEL_2&&y(),f===E.WIDGET_LEVEL_3&&(y(),w())},6e4);return()=>clearInterval(e)},[a,w,u,y,f]),(0,o.useEffect)(()=>{k().office.isConfigurationValid().then(({result:e})=>v(e)).catch(j)},[v,j]),(0,o.useEffect)(()=>{if(a){if(f===E.WIDGET_LEVEL_1)return b(!0),void C();if(f===E.WIDGET_LEVEL_2)return b(!0),y(),void C();b(!0),y(),w()}},[a,f,C,w,b,y,l]),a&&f&&f!==E.WIDGET_LEVEL_3&&i?(0,n.jsx)(n.Fragment,{children:i(f,x??"")}):(0,n.jsx)(Nt,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Ri,{uniqid:s,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Yt,{uniqid:s,children:[void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)(Rt,{}),a&&(0,n.jsx)(Oi,{emailList:m})]})})},Hi=l().div`
365
- position: absolute;
366
- inset: 0;
367
- display: flex;
368
- justify-content: center;
369
- align-items: center;
370
- `,Ui=u.j.getLazyComponent("WidgetLuccaAbsence"),Ni=u.j.getLazyComponent("Loader"),Pi=({uniqid:e})=>{const[t,i]=(0,o.useState)([]),[s,l]=(0,o.useState)(!1),[r,d]=(0,o.useState)(!0),c=(0,O.Ie)(),u=(0,o.useMemo)(()=>(new Date).getFullYear()+"-"+((new Date).getMonth()+1).toString().padStart(2,"0")+"-"+(new Date).getDate().toString().padStart(2,"0")+" 00:00:00",[]);return(0,o.useEffect)(()=>{k().lucca.getAbsence({date:u},{signal:c.signal}).then(({result:e})=>i(e)).catch(()=>{c.signal.aborted||l(!0)}).finally(()=>d(!1))},[u,c.signal]),r?(0,n.jsx)(Hi,{children:(0,n.jsx)(Ni,{size:"m"})}):s?(0,n.jsx)(Hi,{children:(0,n.jsx)(a.FormattedMessage,{id:"WIDGET_Lucca_Absence_Url_Error"})}):(0,n.jsx)(Nt,{header:()=>(0,n.jsx)(ti,{uniqid:e}),scrollable:()=>(0,n.jsx)(Yt,{uniqid:e,children:(0,n.jsx)(Ui,{list:t})})})},Yi=l().div`
371
- padding: ${e=>e.theme.space.md}px;
372
- `,Ji=l().a`
373
- cursor: pointer;
374
- color: ${e=>e.theme.color.secondary};
375
- `,Qi=l().div`
376
- display: flex;
377
- justify-content: center;
378
- align-items: center;
379
- `,Ki=({mode:e,uniqid:t,content:i})=>{const s=(0,a.useIntl)(),l=(0,c.jL)(),r=(0,c.GV)(e=>d.x0.selectors.selectWidgetObjectUri(e,t),be.shallowEqual),u=(0,c.GV)(e=>d.x0.selectors.selectWidgetObjectRights(e,t),be.shallowEqual),g=(0,o.useMemo)(()=>!(!u||!u.update),[u]),m=(0,o.useCallback)(()=>{if("edit"===e||!g||!r)return;const n={...i,isClosed:!0};k().widget.updateWidget({uri:r,uniqid:t,content:n,v2:!0}).then(()=>l(d.x0.slice.actions.updateWidget({uniqid:t,content:n}))).catch(()=>l(d.y8.actions.error({label:"WIDGET_Presence_Error"})))},[e,t,g,r,i,l]);return(0,n.jsx)(n.Fragment,{children:g&&!i.isClosed&&(0,n.jsx)(Yi,{children:(0,n.jsx)(Qi,{children:(0,n.jsx)(Ji,{onClick:m,children:s.formatMessage({id:"WIDGET_Presence_Closing"})})})})})},Xi=u.j.getLazyComponent("WidgetPresence"),Zi=u.j.getLazyComponent("ModalUserList"),en=l().div`
380
- display: flex;
381
- flex: 1;
382
- position: relative;
383
- flex-direction: column;
384
- `,tn=(l().div`
385
- position: absolute;
386
- inset: 0;
387
- background-color: rgba(255, 255, 255, 0.7);
388
- display: flex;
389
- flex: 1;
390
- justify-content: center;
391
- align-items: center;
392
- `,l().div`
393
- flex: 1;
394
- display: flex;
395
- padding: ${e=>e.theme.space.md}px;
396
- border: 1px dashed ${e=>e.theme.color.orange};
397
- justify-content: center;
398
- align-items: center;
399
- border-radius: ${e=>e.theme.space.sm}px;
400
- margin: ${e=>e.theme.space.sm}px;
401
- `),nn=({widget:e,mode:t})=>{const i=(0,a.useIntl)(),s=(0,c.jL)(),{limit:l,limitValue:r,closing:u,isClosed:g}=e.content,{uniqid:m}=e,[p,x]=(0,o.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[h,f]=(0,o.useState)(!1),[j]=(0,o.useState)(new AbortController),[y,b]=(0,o.useState)(!1),[C,v]=(0,o.useState)(),[w,L]=(0,o.useState)(),E=(0,o.useRef)(j),_=(0,c.GV)(e=>d.x0.selectors.selectWidgetObjectUri(e,m),be.shallowEqual),W=(0,c.GV)(e=>d.x0.selectors.selectAllWidgetRTObject(e,m),be.shallowEqual),S=(0,o.useCallback)(()=>s(d.y8.actions.error({label:"WIDGET_Presence_Error"})),[s]),q=(0,o.useMemo)(()=>!(l&&r&&p.userAvailableTotal>=r),[l,r,p.userAvailableTotal]),M=(0,o.useMemo)(()=>u&&g||"edit"===t,[u,g,t]),A=(0,o.useCallback)(()=>{_&&!M&&(q?(f(!0),k().widget.presenceCancel({uri:_,uniqid:m}).catch(S).finally(()=>f(!1))):s(d.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))},[s,m,S,_,q,M]),T=(0,o.useCallback)(e=>{_&&!M&&(f(!0),k().widget.presenceRespond({uri:_,uniqid:m,value:e},E.current.signal).catch(S).finally(()=>f(!1)))},[_,m,S,M]),I=(0,o.useCallback)(()=>{"edit"!==t&&_&&(f(!0),k().widget.presenceGetResponse({uri:_,uniqid:m},E.current.signal).then(e=>{x(e.result)}).catch(e=>!e.aborted&&S()).finally(()=>f(!1)))},[_,S,m,t]),z=(e,t)=>{_&&k().widget.presenceGetResponseUserList({uri:_,uniqid:m,index:e,page:t,limit:8},E.current.signal).then(e=>{L({...e.result,data:[...e.result.data],cnt:e.result.cnt})}).catch(e=>!e.aborted&&S)},G=(0,o.useCallback)(()=>{_&&(f(!0),k().widget.getWidget({uri:_,uniqid:m}).then(e=>{s((0,d.vR)(m,e.result))}).catch(e=>!e.aborted&&S).finally(()=>f(!1)))},[s,S,_,m]);return(0,o.useEffect)(()=>{const e=E.current;return()=>{e.abort()}},[]),(0,o.useEffect)(()=>{I()},[I]),(0,o.useEffect)(()=>{if(!Array.isArray(W))return;const e=W.at(-1);e&&_&&e.object.uri===_&&e.uniqid===m&&("widget-presence-response"===e.fn&&I(),"widget-update"===e.fn&&G())},[W,I,m,_,G]),(0,n.jsx)(ri.M,{useRT:()=>{(0,Ce.AW)(e.uniqid)},children:(0,n.jsxs)(en,{children:[(0,n.jsx)(Xi,{limit:l,limitValue:r,userAvailableList:p.userAvailableList,userUnavailableList:p.userUnavailableList,userValue:p.userValue,userAvailableTotal:p?.userAvailableTotal,userUnavailableTotal:p?.userUnavailableTotal,isClosed:u&&g,handleClickAvailable:()=>1===p.userValue?A():T(1),handleClickUnavailable:()=>0===p.userValue?A():T(0),handleOpenUsersModal:e=>{L({limit:0,page:0,data:[],cnt:0}),v(e),z(e),b(!0)}}),u&&g&&(0,n.jsx)(tn,{children:i.formatMessage({id:"WIDGET_Presence_Is_Closed"})}),u&&!g&&(0,n.jsx)(Ki,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&(0,n.jsx)(fi,{uniqid:e.uniqid,name:e.name,mode:t}),h&&(0,n.jsx)(Li,{}),(0,n.jsx)(Zi,{open:y,usersList:w,title:1===C?i.formatMessage({id:"WIDGET_Presence_On"}):i.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:b,onClose:()=>{L({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{z(C??0,e)}})]})})},on=u.j.getLazyComponent("WidgetQuickSurvey"),sn=u.j.getLazyComponent("WidgetQuickSurveyEditor"),ln=u.j.getLazyComponent("ModalUserList"),an=u.j.getLazyComponent("FileViewer"),rn=l().div`
402
- width: 100%;
403
- display: flex;
404
- flex-direction: column;
405
- gap: 14px;
406
- ${e=>e.withPadding&&"padding: 0 12px;"}
407
- padding-top: 16px;
408
- `,dn=({widget:e,inplace:t,mode:i})=>{const s=(0,a.useIntl)(),l=(0,c.jL)(),{uniqid:r,content:u}=e,[g,m]=(0,o.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[p,x]=(0,o.useState)(!1),[h,f]=(0,o.useState)(!1),[j,y]=(0,o.useState)(),[b,C]=(0,o.useState)(),[v]=(0,o.useState)(new AbortController),w=(0,o.useRef)(v),L=(0,c.GV)(d.x0.selectors.selectToken,be.shallowEqual),_=(0,c.GV)(t=>d.x0.selectors.selectWidgetObjectUri(t,e.uniqid),be.shallowEqual),W=(0,c.GV)(e=>d.x0.selectors.selectWidgetObjectRights(e,r),be.shallowEqual),S=(0,c.GV)(t=>d.x0.selectors.selectAllWidgetRTObject(t,e.uniqid),be.shallowEqual),q=(0,o.useCallback)((e,t)=>{l((0,d.vR)(e,t))},[l]),M=t=>{l(d.cr.slice.actions.flushAllEditor()),l(d.x0.slice.actions.setToken({token:t})),l(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:E.WidgetsName.QuickSurvey}))},A=(0,o.useCallback)(()=>l(d.y8.actions.error({label:"WIDGET_Presence_Error"})),[l]),T=(0,o.useCallback)(e=>{"edit"!==i&&_&&(f(!0),k().widget.quickSurveyGetResponse({uri:_,uniqid:e},w.current.signal).then(e=>{m(e.result)}).catch(e=>!e.aborted&&A).finally(()=>f(!1)))},[A,_,i]),I=(0,o.useCallback)(()=>{_&&(f(!0),k().widget.getWidget({uri:_,uniqid:r},w.current.signal).then(e=>{q(r,e.result.content)}).catch(e=>!e.aborted&&A).finally(()=>f(!1)))},[r,A,_,q]),z=()=>{if(_&&u.closing){const e={...u,isClosed:!0};k().widget.updateWidget({uri:_,uniqid:r,content:e}).catch(()=>{A()})}},G=t=>{(t=>{"edit"!==i&&_&&(f(!0),k().widget.quickSurveyRespond({uri:_,index:t,multi:u.multi?1:0,uniqid:r},w.current.signal).then(()=>{T(e.uniqid)}).catch(e=>!e.aborted&&A).finally(()=>f(!1)))})(t)},D=(e,t)=>{_&&k().widget.quickSurveyGetResponseUserList({uri:_,uniqid:r,index:e,page:t,limit:8},w.current.signal).then(e=>{C({...e.result,data:[...e.result.data],cnt:e.result.cnt})}).catch(e=>!e.aborted&&A)},V=(0,o.useMemo)(()=>W&&W.update,[W]);(0,o.useEffect)(()=>{T(e.uniqid)},[T,e.uniqid]),(0,o.useEffect)(()=>{if(!Array.isArray(S))return;const t=S.at(-1);t&&_&&t.object.uri===_&&t.uniqid===e.uniqid&&("widget-quick-survey-response"===t.fn&&T(e.uniqid),"widget-update"===t.fn&&I())},[S,_,e.uniqid,I,T]);const $=(0,o.useMemo)(()=>{if(!Array.isArray(u.arr))return[];const e=[];return u.arr.forEach(t=>{t.file&&e.push(t.file)}),e},[u]);return(0,o.useEffect)(()=>{L||"edit"!==i||k().network.token().then(e=>{l(d.x0.slice.actions.setToken({token:e.result}))})},[i,L,l]),"edit"===i&&t?(0,n.jsx)(rn,{withPadding:!0,children:(0,n.jsx)(sn,{token:L,uniqid:r,content:e.content,onChangeContent:q,onChangeWrapper:e=>{l(d.x0.slice.actions.updateWidgetWrapper({...e}))},handleChange:e=>q(r,e),inplace:t})}):(0,n.jsx)(ri.M,{useRT:()=>{(0,Ce.AW)(e.uniqid)},children:(0,n.jsxs)(rn,{children:[(0,n.jsx)(an,{files:$,openWithOptions:[],children:t=>(0,n.jsx)(on,{limit:g.totalResponse??0,values:u.arr??[],userResponses:g.userResponses,userHasAlreadyVoted:g.userLoggedResponses.length>0,canCloseSurvey:e.content.closing??!1,isClosed:e.content.isClosed??!1,open:e.content.open??!1,anonymize:e.content.anonymize??!1,seeResponseAfter:e.content.seeResponseAfter??!1,canUpdate:V,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:z,handleProgressBarClick:G,setOpenUsersModal:e=>{y(e),D(e),x(!0)}})}),u.open&&(0,n.jsx)(Ci,{handleClick:e=>{if(!_)return;const t={...u,arr:[...u.arr??[],{title:e}]};k().widget.quickSurveyAddEnty({uri:_,uniqid:r,label:e}).then(()=>{l(d.x0.slice.actions.updateWidget({uniqid:r,content:t}))}).catch(A)},placeholder:s.formatMessage({id:"FIELDS_Add_Option"})}),V&&(0,n.jsx)(fi,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!V},mode:i,handleOpenEditor:()=>{L?M(L):(f(!0),k().network.token().then(e=>{l(d.x0.slice.actions.setToken({token:e.result})),M(e.result)}).finally(()=>f(!1)))}}),h&&(0,n.jsx)(Li,{}),(0,n.jsx)(ln,{open:p,usersList:b,title:u.arr?.[j??0]?.title??"",setOpen:x,handleLoadUsersList:e=>{D(j??0,e)},onClose:()=>{C({limit:0,page:0,data:[],cnt:0})}})]})})},cn=u.j.getLazyComponent("WidgetUserProfile"),un=({widget:e,mode:t})=>{const i=(0,c.jL)(),{uniqid:s,name:l,content:a}=e,r=(0,c.GV)(d.xJ.selectors.get);return(0,o.useEffect)(()=>(i(d.x0.slice.actions.setWidgetState({uniqid:s,mounted:!0})),()=>{i(d.x0.slice.actions.setWidgetState({uniqid:s,mounted:!1}))}),[s,i]),(0,o.useEffect)(()=>{"edit"===t&&(i(d.cr.slice.actions.flushAllEditor()),i(d.cr.slice.actions.registerEditor({uniqid:s,name:l})))},[i,t,l,s]),(0,o.useEffect)(()=>{"view"!==t&&"preview"!==t||i(d.cr.slice.actions.flushAllEditor())},[t,i]),(0,n.jsx)(cn,{currentUser:r,pictureSize:a.pictureSize,displayMode:a.buttonName,css:a.css})},gn=(e,t)=>{const i=[];return e.filter(e=>e.isVisible).forEach(e=>{const n=t.find(t=>t.name===e.name);n&&i.push(n)}),i},mn=u.j.getLazyComponent("Button"),pn=u.j.getLazyComponent("WidgetTable"),xn=u.j.getLazyComponent("Loader"),hn=(l().div``,l().div`
409
- position: absolute;
410
- inset: 0;
411
- display: flex;
412
- flex-direction: column;
413
- justify-content: center;
414
- align-items: center;
415
- gap: ${e=>e.theme.space.md}px;
416
- `),fn=({uri:e,limit:t,tableHeadColor:i,tableHeadTextColor:s,tableHeadIconColor:l,tableRowColor:r,tableRowTextColor:u,tableColumnsData:g=[],tableBorderRadius:m,tableSizedColumns:p,tableSizedColumnsWidth:x,mode:h})=>{const f=(0,c.jL)(),[j,y]=(0,o.useState)(!1),[b,C]=(0,o.useState)([]),[v,w]=(0,o.useState)([]),L=(0,o.useMemo)(()=>d.x0.definition(E.WidgetsName.ExcelDatasourceTable),[]);(0,o.useEffect)(()=>{void 0!==e&&0!==g.length&&0===v.length&&(y(!0),k().datasource.get(e,E.Format.VIEW).then(e=>{w(e.result.model),C(e.result.data)}).finally(()=>y(!1)))},[e,g,v]),(0,o.useEffect)(()=>{e||w([])},[e]),(0,o.useEffect)(()=>{"view"!==h&&"preview"!==h||f(d.cr.slice.actions.flushAllEditor())},[h,f]);const _=(0,o.useMemo)(()=>gn(g,v),[g,v]);return 0!==g.length||j||"edit"!==h?j?(0,n.jsx)(hn,{children:(0,n.jsx)(xn,{})}):(0,n.jsx)(n.Fragment,{children:j||0!==b.length||"edit"===h?(0,n.jsx)(pn,{rows:b,columns:_,limit:t,tableHeadColor:i,tableHeadTextColor:s,tableHeadIconColor:l,tableRowColor:r,tableRowTextColor:u,tableBorderRadius:m,tableColumnsData:g,tableSizedColumns:p,tableSizedColumnsWidth:x}):(0,n.jsxs)(hn,{children:[(0,n.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),(0,n.jsx)(a.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})]})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(hn,{children:[(0,n.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),(0,n.jsx)(a.FormattedMessage,{id:L.label}),(0,n.jsx)(mn,{label:"GLOBAL_Settings"})]})})},jn=u.j.getLazyComponent("Button"),yn=u.j.getLazyComponent("WidgetTable"),bn=u.j.getLazyComponent("Loader"),Cn=(l().div``,l().div`
417
- position: absolute;
418
- inset: 0;
419
- display: flex;
420
- flex-direction: column;
421
- justify-content: center;
422
- align-items: center;
423
- gap: ${e=>e.theme.space.md}px;
424
- `),vn=({uri:e,limit:t,tableHeadColor:i,tableHeadTextColor:s,tableHeadIconColor:l,tableRowColor:r,tableRowTextColor:u,tableColumnsData:g=[],tableBorderRadius:m,tableSizedColumns:p,tableSizedColumnsWidth:x,mode:h})=>{const f=(0,c.jL)(),[j,y]=(0,o.useState)(!1),[b,C]=(0,o.useState)([]),[v,w]=(0,o.useState)([]),[L,_]=(0,o.useState)({order:"ascending",name:"unknown"}),[W,S]=(0,o.useState)(void 0),[q,M]=(0,o.useState)(""),A=(0,o.useMemo)(()=>d.x0.definition(E.WidgetsName.DatasourceTable),[]),T=(0,o.useMemo)(()=>"studio"===W?[{type:[q]}]:[],[W,q]),I=(0,o.useMemo)(()=>"doc"===W?[q]:[],[W,q]),{rtLastObject:z}=(0,Ce.YL)(T,I),G=(0,o.useCallback)(()=>{e&&(y(!0),k().datasource.get(e,E.Format.VIEW).then(e=>{w(e.result.model),C(e.result.data),_(e.result.sort),S(e.result.datasource.datasourceType),M(e.result.datasource.datasourceIdentifier)}).finally(()=>y(!1)))},[e]);(0,o.useEffect)(()=>{void 0!==e&&0!==g.length&&0===v.length&&G()},[e,g,v,G]),(0,o.useEffect)(()=>{z&&G()},[z,G]),(0,o.useEffect)(()=>{e||w([])},[e]),(0,o.useEffect)(()=>{"view"!==h&&"preview"!==h||f(d.cr.slice.actions.flushAllEditor())},[h,f]);const D=(0,o.useMemo)(()=>gn(g,v),[g,v]);return 0!==g.length||j||"edit"!==h?j?(0,n.jsx)(Cn,{children:(0,n.jsx)(bn,{})}):(0,n.jsx)(n.Fragment,{children:j||0!==b.length||"edit"===h?(0,n.jsx)(yn,{rows:b,columns:D,limit:t,tableHeadColor:i,tableHeadTextColor:s,tableHeadIconColor:l,tableRowColor:r,tableRowTextColor:u,tableBorderRadius:m,tableColumnsData:g,tableSizedColumns:p,tableSizedColumnsWidth:x,tableDefaultSortOrder:L.order,tableDefaultSortName:L.name}):(0,n.jsxs)(Cn,{children:[(0,n.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.DatasourceTable}.png`,alt:""}),(0,n.jsx)(a.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})]})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(Cn,{children:[(0,n.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.DatasourceTable}.png`,alt:""}),(0,n.jsx)(a.FormattedMessage,{id:A.label}),(0,n.jsx)(jn,{label:"GLOBAL_Settings"})]})})},wn=l().div`
425
- position: absolute;
426
- inset: 0;
427
- display: flex;
428
- align-items: center;
429
- justify-content: center;
430
- color: ${e=>e.theme.color.orange};
431
- `,Ln=({children:e,name:t})=>{const i=(0,c.GV)(e=>d.qn.selectors.selectHook(e,t)),o=(0,a.useIntl)();return i&&!i.hasLicense?(0,n.jsx)(wn,{children:o.formatMessage({id:"WIDGET_Missing_License"},{label:"label"in i?i.label:""})}):(0,n.jsx)(n.Fragment,{children:e})},En=u.j.getLazyComponent("WidgetWelcome"),kn=({widget:e,mode:t})=>{const i=(0,c.jL)(),{uniqid:s,name:l,content:a}=e,r=(0,c.GV)(d.xJ.selectors.get);return(0,o.useEffect)(()=>(i(d.x0.slice.actions.setWidgetState({uniqid:s,mounted:!0})),()=>{i(d.x0.slice.actions.setWidgetState({uniqid:s,mounted:!1}))}),[s,i]),(0,o.useEffect)(()=>{"edit"===t&&(i(d.cr.slice.actions.flushAllEditor()),i(d.cr.slice.actions.registerEditor({uniqid:s,name:l})))},[i,t,l,s]),(0,o.useEffect)(()=>{"view"!==t&&"preview"!==t||i(d.cr.slice.actions.flushAllEditor())},[t,i]),(0,n.jsx)(En,{currentUser:r,position:a.position,lineBreak:a.lineBreak,message:a.message,displayMode:a.buttonName,css:a.css})},_n=({uniqid:e,extensionName:t})=>{const i=(0,o.useMemo)(()=>`widget-extension-${t}-${e}`,[t,e]);return(0,o.useEffect)(()=>{t&&J.react.require(t,{anchorId:i})},[t,i]),(0,n.jsx)("div",{id:i})},Wn=l().div`
432
- display: flex;
433
- flex: 1;
434
- flex-direction: column;
435
- `,Sn=({widget:e,width:t,inplace:i=!1,mode:o="view",onWidgetUpdate:s,cannotDisplayComponent:l,levelFallback:a,dataCy:r})=>{const{name:d}=e;return(0,E.ensureWidgetArticleButtonType)(e)?(0,n.jsx)(Pe,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleGalleryType)(e)?(0,n.jsx)(Xe,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetLuccaAbsenceType)(e)?(0,n.jsx)(Wn,{children:(0,n.jsx)(Ln,{name:"LuccaAbsenceHook",children:(0,n.jsx)(Pi,{uniqid:e.uniqid})})}):(0,E.ensureWidgetArticleAttachmentType)(e)?(0,n.jsx)(Be,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleImageType)(e)?(0,n.jsx)(lt,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleSliderType)(e)?(0,n.jsx)(mt,{widget:e,inplace:i,mode:o,width:t??800}):(0,E.ensureWidgetArticleTitleType)(e)?(0,n.jsx)(Et,{widget:e,inplace:i,mode:o,dataCy:r}):(0,E.ensureWidgetArticleTextType)(e)?(0,n.jsx)(bt,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetExcelDatasourceTableType)(e)?(0,n.jsxs)(Wn,{children:[(0,n.jsx)(ze,{uniqid:e.uniqid}),(0,n.jsx)(fn,{...e.content,uniqid:e.uniqid,mode:o})]}):(0,E.ensureWidgetDatasourceTableType)(e)?(0,n.jsxs)(Wn,{children:[(0,n.jsx)(ze,{uniqid:e.uniqid}),(0,n.jsx)(vn,{...e.content,uniqid:e.uniqid,mode:o})]}):(0,E.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?(0,n.jsxs)(Wn,{children:["edit"===o?(0,n.jsx)(Ae,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(ze,{uniqid:e.uniqid}),(0,n.jsx)(qi,{widget:e,inplace:i,mode:o,onWidgetUpdate:s})]}):(0,E.ensureWidgetPresenceType)(e)?(0,n.jsxs)(Wn,{children:["edit"===o?(0,n.jsx)(Ae,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(ze,{uniqid:e.uniqid}),(0,n.jsx)(nn,{widget:e,inplace:i,mode:o})]}):(0,E.ensureWidgetQuickSurveyType)(e)?(0,n.jsxs)(Wn,{children:["edit"===o?(0,n.jsx)(Ae,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(ze,{uniqid:e.uniqid}),(0,n.jsx)(dn,{widget:e,inplace:i,mode:o})]}):(0,E.ensureWidgetCalendarCalDavType)(e)?(0,n.jsx)(Wn,{children:(0,n.jsx)(Ln,{name:"OfficeHook",children:(0,n.jsx)(ai,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetContactCardDavType)(e)?(0,n.jsx)(Wn,{children:(0,n.jsx)(Ln,{name:"OfficeHook",children:(0,n.jsx)(Gi,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetEmailsImapType)(e)?(0,n.jsx)(Wn,{children:(0,n.jsx)(Ln,{name:"OfficeHook",children:(0,n.jsx)(Bi,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetUserProfileType)(e)?(0,n.jsx)(Wn,{children:(0,n.jsx)(un,{widget:e,inplace:i,mode:o})}):(0,E.ensureWidgetWelcomeType)(e)?(0,n.jsx)(Wn,{children:(0,n.jsx)(kn,{widget:e,inplace:i,mode:o})}):(0,E.ensureWidgetExtensionType)(e)&&e.content.extensionName?(0,n.jsx)(Wn,{children:(0,n.jsx)(_n,{uniqid:e.uniqid,name:e.name,extensionName:e.content.extensionName})}):l?(0,n.jsx)(n.Fragment,{children:l(d)}):(0,n.jsxs)(n.Fragment,{children:["cannot display widget (",d,")"]})},qn=l().div`
436
- position: absolute;
437
- inset: 0;
438
- opacity: ${e=>e.opacity};
439
- background-color: ${e=>e.backgroundColor};
440
- pointer-events: ${e=>e.pointerEvents};
441
- `,Mn=u.j.getLazyComponent("DoubleClick"),An=({uniqid:e,mode:t})=>{const i=(0,c.GV)(t=>t.widgets.ids[e].widget.layers,be.shallowEqual);return(0,n.jsx)(n.Fragment,{children:i?.map((e,t)=>(0,n.jsx)(Tn,{uniqid:e,mode:"edit"},t))})},Tn=({uniqid:e,mode:t})=>{const i=(0,c.GV)(t=>t.widgets.layers[e]);return"view"===t?(0,n.jsx)(qn,{opacity:1,backgroundColor:"transparent",pointerEvents:"none",children:i.widgets.map((e,t)=>(0,n.jsx)(In,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"},t))}):(0,n.jsx)(qn,{opacity:i.visible?1:0,backgroundColor:i.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:i.locked?"none":"all",children:i.widgets.map((e,t)=>(0,n.jsx)(In,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"},t))})},In=({uniqid:e,layerId:t,mode:i})=>{const o=(0,c.jL)(),s=(0,c.GV)(t=>t.widgets.ids[e],be.shallowEqual),l=(0,c.GV)(e=>e.widgets.layers[t]);return s&&l&&l.position?"view"===i?(0,n.jsx)("div",{style:{position:"absolute",top:l.position.y,left:l.position.x},children:(0,n.jsx)(Pn,{uniqid:e,widget:s,mode:i,inplace:!0,context:"article"})}):(0,n.jsx)(zn,{position:{x:l.position.x,y:l.position.y},onMouseUp:e=>{(l.position&&l.position.x!==e.x||l.position&&l.position.y!==e.y)&&(e=>{o(d.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)},children:(0,n.jsx)(Mn,{onDoubleTap:()=>((e,t)=>{o(d.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(s.widget.uniqid,s.widget.name),children:(0,n.jsx)(Pn,{uniqid:e,widget:s,mode:i,inplace:!0,context:"article"})})}):(0,n.jsx)(n.Fragment,{})},zn=({position:e,children:t,onMouseUp:i})=>{const[s,l]=(0,o.useState)(!1),[a,r]=(0,o.useState)({x:0,y:0}),[d,c]=(0,o.useState)({x:0,y:0}),[u,g]=(0,o.useState)({x:e.x,y:e.y}),m=(0,o.useRef)(null),p=(0,o.useCallback)(e=>{l(!0),m.current&&(r({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),c({x:u.x,y:u.y}))},[u.x,u.y]),x=(0,o.useCallback)(e=>{if(s&&m.current){const t=d.x+(e.clientX-a.x),i=d.y+(e.clientY-a.y);g({x:t,y:i})}},[a.x,a.y,s,d.x,d.y]),h=(0,o.useCallback)(()=>{l(!1),i({x:u.x,y:u.y})},[u.x,u.y,i]);return(0,o.useEffect)(()=>(document.addEventListener("mousemove",x),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",h)}),[x,h]),(0,n.jsx)("div",{style:{position:"absolute",top:u.y,left:u.x},ref:m,onMouseDown:p,children:t})},Gn=u.j.getLazyComponent("Loader"),Dn=({uniqid:e,inplace:t})=>{const i=(0,c.GV)(t=>d.x0.selectors.selectWidgetState(t,e));return i?.loading?(0,n.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"},children:(0,n.jsx)(Gn,{})}):i?.hover?(0,n.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):(0,n.jsx)(n.Fragment,{})},Vn=u.j.getLazyComponent("Html"),$n=l().button`
442
- position: absolute;
443
- inset: 0;
444
- display: flex;
445
- flex-direction: row;
446
- justify-content: center;
447
- align-items: center;
448
- gap: ${e=>e.theme.space.md}px;
449
- color: ${e=>e.theme.color.primary};
450
- cursor: pointer;
451
- opacity: 0;
452
- border: 1px solid ${e=>e.theme.color.primary};
453
- &:hover {
454
- background-color: ${e=>e.theme.color.grey2};
455
- opacity: 0.9;
456
- }
457
-
458
- ${(0,r.DashedFocusBorder)()}
459
- `,Fn=({uniqid:e,name:t})=>{const i=(0,c.jL)(),s=(0,a.useIntl)(),l=(0,o.useCallback)(()=>{i(d.cr.slice.actions.flushAllEditor()),i(d.cr.slice.actions.registerEditor({uniqid:e,name:t}))},[i,e,t]),r=d.x0.definition(t);return(0,n.jsx)($n,{onClick:l,children:(0,n.jsx)(Vn,{__html:`${s.formatMessage({id:"WIDGET_Set_Widget"})} <b>${s.formatMessage({id:r.label})}</b>`})})},Rn=l().div`
460
- display: flex;
461
- flex-direction: column;
462
- `,On=({uniqid:e,onClick:t,children:i})=>{const l=(0,s.useTheme)(),a=(0,c.GV)(t=>d.x0.selectors.selectWidgetWrapperStyle(t,e),be.shallowEqual),r=(0,o.useMemo)(()=>({color:a&&a.color?String(a.color):l.color.black,backgroundColor:a&&a["background-color"]?String(a["background-color"]):l.color.white,borderRadius:a&&a["border-radius"]?`${a["border-radius"]}px`:"0px",borderColor:a["border-color"]?String(a["border-color"]):l.color.black,borderWidth:a["border-width"]?`${a["border-width"]}px`:"0px",borderStyle:a["border-style"]?String(a["border-style"]):"none"}),[a,l]);return(0,n.jsx)(Rn,{onClick:t,style:{color:r.color,borderColor:r.borderColor,borderStyle:r.borderStyle,borderRadius:r.borderRadius,borderWidth:r.borderWidth,backgroundColor:r.backgroundColor,overflow:Number(r.borderRadius)>0?"hidden":"initial"},children:i})},Bn=u.j.getLazyComponent("WidgetIcon"),Hn=l().a`
463
- position: absolute;
464
- top: 0;
465
- right: 0;
466
- bottom: 0;
467
- left: 0;
468
- display: flex;
469
- justify-content: center;
470
- align-items: center;
471
- flex-direction: column;
472
- color: ${e=>e.color?e.color:e.theme.color.black};
473
- transition: background-color 0.4s;
474
- &:hover {
475
- background-color: rgba(0, 0, 0, 0.1);
476
- color: ${e=>e.color?e.color:e.theme.color.black};
477
- }
478
- `,Un=({uniqid:e,name:t,url:i,level:o})=>{const s=d.x0.definition(t),l=(0,c.GV)(t=>2===o?d.x0.selectors.selectWidgetChipCount(t,e):0,be.shallowEqual),a=(0,c.GV)(t=>d.x0.selectors.selectWidgetWrapperStyle(t,e),be.shallowEqual);return(0,n.jsx)(Hn,{href:i,target:"_blank",color:String(a.color)??void 0,rel:"noreferrer","aria-label":s.label,children:(0,n.jsx)(Bn,{count:l,img:s.img,label:s.label,maxValue:999})})},Nn=({uniqid:e,widgetObject:t,widget:i,inplace:s=!0,mode:l,width:a,context:r,onWidgetUpdate:u,cannotDisplayComponent:g,dataCy:m})=>{const p=(0,c.jL)(),x=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e)),h=(0,c.GV)(t=>t.widgets.editableMap[e],be.shallowEqual),f=(0,c.GV)(e=>e.widgets.currentEditableWidgetId,be.shallowEqual),j=(0,c.GV)(t=>t.widgets.currentEditableWidgetId===e,be.shallowEqual),{isComponentVisible:y,setIsComponentVisible:b}=(0,Ce.xv)(!1);(0,o.useEffect)(()=>{t&&p(d.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))},[]),(0,o.useEffect)(()=>{i&&p(d.x0.slice.actions.registerWidget({uniqid:e,widget:i,context:r}))},[]),(0,o.useEffect)(()=>{y||e===f&&p(d.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))},[y]),(0,o.useEffect)(()=>{y!==j&&b(j)},[j]);const C=(0,o.useCallback)(()=>{if(void 0===x||"view"===l)return;p(d.cr.slice.actions.flushAllEditor());const{widget:e}=x;p(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))},[p,l,x]);return void 0===x?(0,n.jsx)(n.Fragment,{children:"This widget cannot be displayed"}):s&&"view"!==l?(0,n.jsxs)(On,{uniqid:e,onClick:()=>{b(!0),h&&(p(d.x0.slice.actions.setEditableIndex({index:h.index})),p(d.x0.slice.actions.setEditableWidgetId({uniqid:e})))},children:[(0,n.jsx)(Sn,{dataCy:m,width:a,widget:{...x.widget,...x.title&&{title:x.title}},inplace:s,mode:l,levelFallback:(e,t)=>e<=2&&(0,n.jsx)(Un,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,n.jsx)(An,{uniqid:e,mode:l}),(0,n.jsx)(Dn,{name:x.widget.name,uniqid:x.widget.uniqid,inplace:s})]}):(0,n.jsxs)(On,{uniqid:e,onClick:C,children:[(0,n.jsx)(Sn,{dataCy:m,widget:{...x.widget,...x.title&&{title:x.title}},inplace:s,mode:l,width:a,onWidgetUpdate:u,cannotDisplayComponent:g,levelFallback:(e,t)=>e<=2&&(0,n.jsx)(Un,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,n.jsx)(An,{uniqid:e,mode:l}),"edit"===l&&(0,n.jsx)(Fn,{uniqid:e,name:i.widget.name}),(0,n.jsx)(Dn,{name:x.widget.name,uniqid:x.widget.uniqid,inplace:s})]})},Pn=Nn,Yn=l().div`
479
- border-radius: ${e=>e.theme.space.sm}px;
480
- border: 1px solid ${e=>e.theme.color.grey1};
481
- background-color: ${e=>e.theme.color.white};
482
- overflow: hidden;
483
- `,Jn=u.j.getLazyComponent("Message"),Qn=({widgets:e})=>{const t=(0,a.useIntl)(),i=(0,c.GV)(d.x0.selectors.selectFlushedWidgets,be.shallowEqual);return(0,n.jsx)(n.Fragment,{children:e.filter(e=>!i.includes(e.widget.uniqid)).map(e=>e&&e.widget&&(0,n.jsx)(Yn,{children:(0,n.jsx)(Pn,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>(0,n.jsx)(Jn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},Kn=u.j.getLazyComponent("Message"),Xn=e=>{const t=(0,a.useIntl)(),{widgets:i,comment:o,inplace:s,mode:l,handleWidgetUpdate:r}=e,u=(0,c.GV)(d.x0.selectors.selectFlushedWidgets,be.shallowEqual);return(0,n.jsx)(n.Fragment,{children:i.filter(e=>!u.includes(e.widget.uniqid)).map(e=>e&&(0,n.jsx)(Yn,{children:(0,n.jsx)(Pn,{uniqid:e.widget.uniqid,widgetObject:o,widget:e,inplace:s,mode:l,onWidgetUpdate:r,cannotDisplayComponent:e=>(0,n.jsx)(Kn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},Zn=()=>{const[e,t]=(0,o.useState)(!1),[i,n]=(0,o.useState)();return{open:e,onSelect:e=>{i?.execCommand("InsertHTML",!1,`<img src="${e}" alt="" />`),t(!1)},close:()=>t(!1),ext:(0,o.useMemo)(()=>r.JTinyMCEExtensionsBuilders.gifs(e=>n(e),()=>t(!0)),[]),isActive:!0}},eo=u.j.getLazyComponent("GifsSelector"),to=u.j.getLazyComponent("Modal"),io=({onSelect:e,open:t,close:i})=>{const s=(0,c.jL)(),l=(0,O.Ie)(),[r,u]=(0,o.useState)(!1),[g,m]=(0,o.useState)([]),[p,x]=(0,o.useState)({q:void 0,offset:0}),h=(0,o.useCallback)(()=>{i(),x({q:void 0,offset:0})},[i]);return(0,o.useEffect)(()=>{u(!0),k().jamespot.getGifs({q:p.q||"awesome",limit:10,offset:p.offset},{signal:l.signal}).then(e=>{m(0===p.offset?e.result:t=>[...t,...e.result])}).catch(e=>{e.aborted||s(d.y8.actions.error({label:e.errorMsg??"GLOBAL_Error"}))}).finally(()=>{u(!1)})},[l,s,p]),(0,n.jsx)(to,{title:"Gif",open:t,closeHandler:h,enableClickAwayCloseModal:!0,variant:"fixed-height",buttons:[{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:h}],children:(0,n.jsx)(eo,{gifs:g,onSelectGif:e,loading:r,onSearch:e=>x({q:e,offset:0}),onReachEnd:()=>{x(e=>({...e,offset:e.offset+10}))}})})},no=u.j.getLazyComponent("JRCCommentsBloc"),oo=l().div`
484
- display: flex;
485
- flex-direction: column;
486
- gap: 4px;
487
- flex: 1;
488
- width: 100%;
489
- margin-top: 10px;
490
- `,so=({articleId:e,variant:t="inline",canComment:i,commentType:l="comment",socialQuestion:r,articleUri:u})=>{const g=(0,a.useIntl)(),m=(0,s.useTheme)(),p=(0,c.jL)(),[x,h]=(0,o.useState)(),[f,j]=(0,o.useState)(!1),[y,b]=(0,o.useState)([]),[C,v]=(0,o.useState)(!1),w=(0,c.GV)(d.xJ.selectors.get),L=(0,c.GV)(d.x0.selectors.selectWidgets),E=(0,c.GV)(d.sU.selectors.selectTinyMCECommonOptions),_=(0,c.GV)(d.sU.selectors.selectTinyMCEExtendedOptions),W=(0,c.GV)(d.Kx.selectors.selectAll),S=(0,c.GV)(d.OD.selectors.selectPlatformConfig),q=(0,c.GV)(t=>d.Mw.selectors.commentList(t,e)),M=(0,c.GV)(e=>d.qn.selectors.selectHook(e,"DriveHook")),A=(0,c.GV)(e=>d.lg.selectors.selectById(e,"FileBankHook")),T=(0,c.GV)(e=>d.qn.selectors.selectHook(e,"WidgetHook")),[I,z]=(0,o.useState)(r),[G,D]=(0,o.useState)(null),{open:V,onInsert:$,close:F,ext:R,isActive:O}=je(),{open:B,close:H,onSelect:U,ext:N,isActive:P}=Zn();(0,te.A)(e),((e,t)=>{const i=(0,c.jL)(),n=(0,o.useMemo)(()=>ie.A,[]),s=(0,o.useMemo)(()=>d.Mw.getCommentsLikeRTHandlers(i,e,t),[i,e,t]);(0,o.useEffect)(()=>(s.forEach(e=>{n.onMessage(e.namespace,e.function,e.handler)}),()=>{s.forEach(e=>{n.offMessage(e.namespace,e.function,e.handler)})}),[s,n])})(q.map(e=>e.id),e);const Y=(0,o.useCallback)(e=>{p(d.y8.actions.error({label:e??g.formatMessage({id:"GLOBAL_Error"})}))},[p,g]),J=()=>{p(d.Mw.actions.fetchComments({idArticle:e})),Q()},Q=(0,o.useCallback)(()=>{x||C||(v(!0),k().network.token().then(e=>{h(e.result),v(!1),p(d.x0.slice.actions.setToken({token:e.result}))}).catch(e=>{Y(e.errorMsg)}))},[Y,x,C,p]),K=(0,o.useCallback)(async t=>{if(x){j(!0);const i=Object.keys(L).map(e=>y?.some(t=>t.widget.uniqid===e)?L[e]:null).filter(e=>null!==e);try{await k().article.addComment({...t,widgets:i,token:x,idArticle:e,type:l}).then(()=>{b([])}),Q()}catch(e){throw Y(e.errorMsg),e}finally{j(!1)}}},[e,l,Q,Y,x,L,y]);return(0,o.useEffect)(()=>{Q()},[Q]),(0,o.useEffect)(()=>{p(d.Mw.actions.fetchComments({idArticle:e}))},[e,p]),(0,o.useEffect)(()=>{q&&q.forEach(e=>{e._widgets?.forEach(t=>{p(d.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),p(d.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))})})},[q,p]),(0,n.jsxs)(n.Fragment,{children:[E&&_&&(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(oo,{children:(0,n.jsx)(no,{canComment:i,loading:f,token:x,comments:q,onComment:K,onCommentUpdate:async t=>{const i=q.find(e=>e.id===t.idComment);if(i)return k().article.updateComment({idComment:t.idComment,description:t.description??i.description??void 0,token:t.token,widgets:t.widgets}).then(()=>{p(d.Mw.actions.fetchComments({idArticle:e})),Q()}).catch(e=>{Y(e.errorMsg)})},onCommentDelete:async t=>{p(d.Mw.actions.deleteComment({idComment:t,idArticle:e}))},isWidgetActive:!(!T?.isActive||!T?.autorize?.includes("comment")),canCreateWidget:!!(T?.isActive&&T?.create&&T?.autorize?.includes("comment")),widgetListComponent:(0,n.jsx)(xe,{mode:"comment",namespace:"comment",onChange:e=>{b([e]),p(d.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e,context:"comment"})),h(void 0),Q()},view:"edit"}),newWidgetsWrapperComponent:(0,n.jsx)(Qn,{widgets:y}),existingWidgetsWrapperComponent:(e,t,i,o=!0)=>(0,n.jsx)(Xn,{comment:e,widgets:t,mode:i,inplace:o,handleWidgetUpdate:J,handleWidgetRemove:Q}),currentUser:w,tinyMCEConfig:{commonOptions:{...E,toolbar:_.commentsToolbar},mentionsQueries:(0,ye.X)(W,m,Y)},onError:Y,highlightFields:S.userHighlightFields,userAccountStatus:S.userAccountStatus,userModel:W.find(e=>"user"===e.type),onGetHashError:e=>p(d.y8.actions.error({label:e??g.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...A&&M?["fileBank"]:[],...d.qn.utils.buildDrivesArrayFromObject(M?.drives)],variant:t,handlers:{drive:k().drive,filebank:k().filebank,file:k().file,fileIntegrity:k().fileIntegrity,user:k().user,global:k().global,questionAnswer:k().questionAnswer},socialQuestion:I?{...I,onSelectResponse:e=>{z({...I,responseId:e,isResolved:!0})},onUnselectResponse:()=>{z({...I,responseId:void 0,isResolved:!1})}}:void 0,articleId:e,additionalExtensions:[R,N],onReport:t=>D({articleId:e,commentUri:t,articleUri:u})})})}),O&&(0,n.jsx)(ft,{onInsert:$,open:V,close:F}),G&&(0,n.jsx)(Z,{onClose:()=>D(null),...G}),P&&(0,n.jsx)(io,{open:B,close:H,onSelect:U})]})},lo=l().li`
491
- list-style: none;
492
- `,ao=l().a`
493
- display: flex;
494
- align-items: center;
495
- gap: ${({theme:e})=>e.space.sm}px;
496
- text-decoration: none;
497
- color: ${({theme:e})=>e.font.color};
498
- padding: ${({theme:e})=>e.space.sm}px ${({theme:e})=>e.space.md}px ${({theme:e})=>e.space.sm}px
499
- ${({theme:e})=>e.space.xs}px;
500
- border-radius: ${({theme:e})=>e.size.sm}px;
501
-
502
- &:hover {
503
- text-decoration: none;
504
- background-color: ${({theme:e})=>e.color.grey1};
505
- color: ${({theme:e})=>e.font.color};
506
- }
507
- `,ro=u.j.getLazyComponent("Icon"),co=u.j.getLazyComponent("FlexBox"),uo=u.j.getLazyComponent("Typography"),go=u.j.getLazyComponent("DropDown"),mo=()=>{const e=(0,s.useTheme)(),t=(0,a.useIntl)(),i=(0,c.GV)(e=>d.lg.selectors.selectById(e,"AnimatedMeetingHook")),o=(0,c.GV)(e=>d.lg.selectors.selectById(e,"calendar")),l=(0,c.GV)(e=>d.lg.selectors.selectById(e,"SurveyDateHook"));return o?(0,n.jsxs)(co,{y:"center",children:[(0,n.jsx)(ro,{name:"icon-"+o.icon,variant:"circle",color:o.color,size:40}),(0,n.jsx)(uo,{variant:"h1",size:"xl",weight:"medium",children:o.label}),(l||i)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(uo,{size:"xl",color:"grey4",children:"/"}),(0,n.jsx)(go,{withBorder:!0,borderColor:"grey3",trigger:(0,n.jsxs)(co,{y:"center",gap:e.space.xs,children:[(0,n.jsx)(uo,{size:"xl",color:"grey4",children:t.formatMessage({id:"CALENDAR_Agenda"})}),(0,n.jsx)(ro,{name:"icon-chevron-down",color:"grey4",size:16})]}),dropdown:()=>(0,n.jsxs)(co,{direction:"column",gap:e.space.sm,as:"ul",children:[l&&(0,n.jsx)(lo,{children:(0,n.jsxs)(ao,{href:l.url,children:[(0,n.jsx)(ro,{name:"icon-"+l.icon,size:25,variant:"circle",color:l.color}),(0,n.jsx)(uo,{size:"l",children:l.label})]})}),i&&(0,n.jsx)(lo,{children:(0,n.jsxs)(ao,{href:i.url,children:[(0,n.jsx)(ro,{name:"icon-"+i.icon,size:25,variant:"circle",color:i.color}),(0,n.jsx)(uo,{size:"l",children:i.label})]})})]})})]})]}):null},po=u.j.getLazyComponent("Typography"),xo=u.j.getLazyComponent("FlexBox"),ho=u.j.getLazyComponent("ButtonDropdown"),fo=u.j.getLazyComponent("DropDown"),jo=u.j.getLazyComponent("IconButton"),yo=u.j.getLazyComponent("InputSelectRaw"),bo=u.j.getLazyComponent("InputCheckboxRaw"),Co=u.j.getLazyComponent("StyledHref"),vo=l()(po)`
508
- text-transform: capitalize;
509
- margin-right: ${({theme:e})=>e.space.md}px;
510
- `,wo=l().div`
511
- max-width: 200px;
512
- display: flex;
513
- align-items: center;
514
- `,Lo=l().div`
515
- padding: 0 ${({theme:e})=>e.space.md}px;
516
- `,Eo=({label:e,view:t,viewsOptions:i,calendarApi:s,isLoading:l,navigateWithQuery:r,setView:u,setCreationType:g,setExportModalOpen:m})=>{const p=(0,a.useIntl)(),x=(0,c.jL)(),{types:h}=(0,c.GV)(d.Vv.selectors.selectCalendarEvents),f=(0,c.GV)(e=>d.lg.selectors.selectById(e,"AnimatedMeetingHook")),j=(0,c.GV)(e=>d.qn.selectors.selectHook(e,"AnimatedMeetingHook")),y=(0,c.GV)(e=>d.lg.selectors.selectById(e,"MeetingHook")),b=(0,c.GV)(e=>d.lg.selectors.selectById(e,"BoardcardHook")),C=(0,o.useMemo)(()=>[{label:p.formatMessage({id:"CALENDAR_Create_SocialEvent"}),onClick:()=>{g("socialEvent")}},...y?[{label:p.formatMessage({id:"CALENDAR_Create_Meeting"}),onClick:()=>{g("meeting")}}]:[],...f&&j?.create?[{label:p.formatMessage({id:"CALENDAR_Create_AnimatedMeeting"}),href:"/?action=spotlight-edit&type=animatedMeeting"}]:[]],[f,j?.create,p,y,g]),v=(0,o.useMemo)(()=>[{label:(0,n.jsx)(a.FormattedMessage,{id:"CALENDAR_SocialEvents"}),value:"socialEvent"},...y?[{label:(0,n.jsx)(a.FormattedMessage,{id:"CALENDAR_Meetings"}),value:"meeting"}]:[],...f?[{label:(0,n.jsx)(a.FormattedMessage,{id:"CALENDAR_AnimatedMeetings"}),value:"animatedMeeting"}]:[],...b?[{label:(0,n.jsx)(a.FormattedMessage,{id:"CALENDAR_BoardCards"}),value:"boardCard"}]:[]],[f,b,y]);return(0,n.jsxs)(xo,{y:"center",children:["list"!==t.value&&(0,n.jsxs)(o.Fragment,{children:[(0,n.jsx)(vo,{size:"l",weight:"medium",children:e}),(0,n.jsxs)(xo,{children:[(0,n.jsx)(jo,{icon:"icon-chevron-left",onClick:()=>s?.prev(),color:"grey5"}),(0,n.jsx)(jo,{icon:"icon-chevron-right",onClick:()=>s?.next(),color:"grey5"})]}),(0,n.jsx)(jo,{icon:"icon-calendar",onClick:()=>s?.today(),tooltip:{description:"CALENDAR_Today",position:"bottom"},color:"grey5"})]}),(0,n.jsx)(wo,{children:(0,n.jsx)(yo,{onChange:u,value:t,name:"selectView",options:i,getLabel:e=>e.label,getValue:e=>e.value,required:!0,minWidth:!1,loading:l,noMargin:!0})}),(0,n.jsx)(ho,{noMargin:!0,color:"primary",icon:"icon-plus",label:p.formatMessage({id:"GLOBAL_Add"}),options:C,dataCy:"calendar-create-dropdown"}),(0,n.jsx)(fo,{trigger:(0,n.jsx)(jo,{"aria-label":p.formatMessage({id:"GLOBAL_Filter"}),colorVariant:"light",icon:"icon-filter",badgeNumber:h.length}),dropdown:()=>(0,n.jsx)(Lo,{children:(0,n.jsxs)(xo,{direction:"column",children:[(0,n.jsx)(po,{weight:"medium",color:"primary",children:p.formatMessage({id:"GLOBAL_Filter"})}),(0,n.jsx)(bo,{labelPosition:"before",checkboxMode:"checkbox",direction:"column",onChange:e=>{x(d.Vv.actions.setTypes(e)),r({types:e})},options:v,value:h,name:"0"}),(0,n.jsx)(Co,{onClick:()=>{x(d.Vv.actions.setTypes([])),r({types:[]})},as:"button",color:"cancel",disabled:0===h.length,children:p.formatMessage({id:"GLOBAL_Reset"})})]})}),withBorder:!0,align:"right"}),(0,n.jsx)(ho,{noMargin:!0,small:!0,smallOpenDirection:"left",color:"primary",variant:"outlined",icon:"icon-ellipsis-v",label:p.formatMessage({id:"GLOBAL_Options"}),options:[{label:p.formatMessage({id:"EVENT_Export_Calendar_ICalendar_Format"}),onClick:()=>m(!0)}]})]})},ko=u.j.getLazyComponent("Calendar"),_o=l().div`
517
- margin-bottom: ${({theme:e})=>e.space.md}px;
518
- `,Wo=l().div`
519
- height: 54px;
520
- display: flex;
521
- align-items: center;
522
- justify-content: space-between;
523
- ${({view:e,theme:t})=>"list"===e&&`border-bottom: 1px solid ${t.color.grey2};`}
524
- padding: 0 ${({theme:e})=>e.space.md}px;
525
- `,So=[{label:"CALENDAR_dayGridMonth",value:"dayGridMonth"},{label:"CALENDAR_timeGridWeek",value:"timeGridWeek"},{label:"CALENDAR_timeGridDay",value:"timeGridDay"},{label:"CALENDAR_listWeek",value:"list"}],qo=({views:e=["dayGridMonth","list","timeGridDay","timeGridWeek"],mode:t="full",withPadding:i=!0,withHeader:s=!0,withToolbar:l=!0,fluid:u,children:g,onSelect:m})=>{const p=(0,a.useIntl)(),x=(0,c.jL)(),h=(0,ee.useNavigate)();(()=>{const e=(0,c.jL)(),t=(0,o.useMemo)(()=>ie.A,[]),i=(0,o.useMemo)(()=>d.Vv.getCalendarRTHandlers(e,k()),[e]);(0,o.useEffect)(()=>(i.forEach(e=>{t.onMessage(e.namespace,e.function,e.handler)}),()=>{i.forEach(e=>{t.offMessage(e.namespace,e.function,e.handler)})}),[i,t])})();const[f,j]=(0,o.useState)(),{dates:y,loading:b,list:C,pendingStatusChanges:v}=(0,c.GV)(d.Vv.selectors.selectCalendarEvents),[w,L]=(0,o.useState)(),[E,_]=(0,o.useState)(null),[W,S]=(0,o.useState)(!1),q=(0,c.GV)(e=>d.qn.selectors.selectHook(e,"calendarHook"))?.defaultView,M=(0,o.useMemo)(()=>{const e=new URLSearchParams(window.location.search).get("view");switch(e){case"dayGridMonth":case"timeGridDay":case"timeGridWeek":case"list":return e;default:return"calendar"===q?"dayGridMonth":"list"}},[q]),A=(0,o.useMemo)(()=>So.filter(t=>e.includes(t.value)).map(e=>({label:p.formatMessage({id:e.label}),value:e.value})),[e,p]),[T,I]=(0,o.useState)(A.find(e=>e.value===M)??A[0]),z=(0,o.useCallback)(e=>{const t=new URLSearchParams(window.location.search);void 0!==e.types&&(e.types.length>0?t.set("types",e.types.join(",")):t.delete("types")),void 0!==e.view&&(e.view?t.set("view",e.view):t.delete("view")),h(`?${t.toString()}`,{replace:!0})},[h]),G=(0,o.useCallback)(e=>{x(d.y8.actions.error({label:e??p.formatMessage({id:"GLOBAL_Error"})}))},[x,p]),D=(0,o.useCallback)(e=>{x(d.y8.actions.success({label:e}))},[x]),V=(0,o.useCallback)(e=>{I(e),z({view:e.value})},[z]),$=(0,o.useCallback)((e,t)=>{const i={start:r.Utils.date.formatDate(e),end:r.Utils.date.formatDate(t)};x(d.Vv.actions.setDates(i))},[x]),[F,R]=(0,o.useState)(null);return(0,o.useEffect)(()=>{x(d.Vv.actions.setTypes(new URLSearchParams(window.location.search).get("types")?.split(",").filter(e=>["socialEvent","meeting","animatedMeeting","boardCard"].includes(e))??[]))},[x]),(0,n.jsxs)(o.Fragment,{children:[g&&g({dates:y,eventToUpdate:E,creationType:F,isExportModalOpen:W,setEventToUpdate:_,setCreationType:R,setExportModalOpen:S}),(s||l)&&(0,n.jsxs)(Wo,{view:T.value,children:[s&&(0,n.jsx)(mo,{}),l&&(0,n.jsx)(Eo,{label:f,isLoading:"pending"===b,view:T,calendarApi:w,viewsOptions:A,navigateWithQuery:z,setView:I,setCreationType:R,setExportModalOpen:S})]}),(0,n.jsx)(ko,{fluid:u,mode:t,fullScreen:!0,withPadding:i,events:C,loading:"pending"===b,handler:{global:k().global,calendar:k().calendar,article:k().article},defaultView:T.value,eventModalExtraComponent:({id:e,uri:t,_right:i})=>(0,n.jsx)(_o,{children:(0,n.jsx)(so,{articleId:e,articleUri:t,canComment:i.comment})}),deportedToolbar:{onChangeLabel:j,onCalendarApiInit:L,view:T},onChangeDates:$,onError:G,onSuccess:D,onChangeView:V,onDeleteEvent:()=>{x(d.y8.actions.success({label:p.formatMessage({id:"GLOBAL_Successfully_Deleted"})}))},onClickUpdateEvent:_,onUpdateStatus:e=>x(d.Vv.actions.changeResponse(e)),isUpdateStatusLoading:e=>v.some(t=>t.eventId===e),onSelect:m})]})},Mo=(l().div`
526
- margin-bottom: 24px;
527
- `,l().div`
528
- margin-bottom: 4px;
529
- `,l().div`
530
- position: absolute;
531
- background-color: ${e=>e.isActive?"rgba(0,0,0,.1)":"transparent"};
532
- inset: 0;
533
- pointer-events: ${e=>e.isActive?"all":"none"};
534
- flex: 1;
535
- display: flex;
536
- overflow: hidden;
537
- `),Ao=l().div`
538
- flex-direction: row;
539
- display: flex;
540
- min-height: 60px;
541
- border-bottom: 1px solid ${e=>e.theme.color.grey2};
542
- `,To=l().div`
543
- width: 60px;
544
- display: flex;
545
- align-items: center;
546
- justify-content: center;
547
- `,Io=l().div`
548
- flex: 1;
549
- display: flex;
550
- align-items: center;
551
- justify-content: center;
552
- `,zo=l().div`
553
- position: relative;
554
- overflow: hidden;
555
- top: 0px;
556
- width: ${460}px;
557
- `,Go=l().div`
558
- position: absolute;
559
- top: 0;
560
- ${e=>"left"===e.position?"left: 0px;":""}
561
- ${e=>"right"===e.position?"right: -1000px;":""}
562
- width: ${440}px;
563
- bottom: 00px;
564
- display: flex;
565
- background-color: ${e=>e.theme.color.white};
566
- flex-direction: row;
567
- transition: all 0.4s;
568
- box-shadow: -4px 0px 20px 0px #00000017;
569
-
570
- &.animate {
571
- right: 0px;
572
- }
573
- `,Do=l().div`
574
- flex: 1;
575
- display: flex;
576
- flex-direction: column;
577
- padding: 12px;
578
- overflow: auto;
579
- margin-bottom: 12px;
580
- position: relative;
581
- `,Vo=l().div`
582
- flex: 1;
583
- display: flex;
584
- flex-direction: column;
585
- `,$o=l().div`
586
- position: absolute;
587
- inset: 0;
588
- background-color: rgba(255, 255, 255, 0.8);
589
- display: flex;
590
- align-items: center;
591
- justify-content: center;
592
- `,Fo=l().div`
593
- position: absolute;
594
- inset: 0;
595
- background-color: ${e=>e.theme.color.white};
596
- padding: ${e=>e.theme.space.md}px;
597
- `,Ro=l().div`
598
- width: ${50}px;
599
- padding-top: 60px;
600
- display: flex;
601
- flex-direction: column;
602
- border-right: 1px solid ${e=>e.theme.color.grey2};
603
- `,Oo=l().button`
604
- border-radius: 4px;
605
- cursor: pointer;
606
- height: 42px;
607
- margin: 4px;
608
- width: 42px;
609
- display: flex;
610
- align-items: center;
611
- justify-content: center;
612
- background-color: ${e=>e.isActive?e.theme.color.grey2:e.theme.color.white};
613
-
614
- ${(0,r.DashedFocusBorder)()}
615
-
616
- &:hover {
617
- background-color: ${e=>e.theme.color.grey2};
618
- }
619
- `,Bo=(l().div`
620
- display: flex;
621
- border: 1px solid ${e=>e.theme.color.grey1};
622
- border-radius: ${8}px;
623
- margin-bottom: 24px;
624
- input {
625
- width: 100%;
626
- border: 0;
627
- height: ${50}px;
628
- margin: 0;
629
- }
630
- `,l().div`
631
- display: flex;
632
- flex-direction: row;
633
- padding: 12px;
634
- background-color: ${e=>e.theme.color.grey0};
635
- border-radius: 8px;
636
- margin-bottom: 4px;
637
- `,l().div`
638
- display: flex;
639
- flex: 1;
640
- align-items: center;
641
- `,l().div`
642
- width: 40px;
643
- display: flex;
644
- justify-content: center;
645
- align-items: center;
646
- `,l().div`
647
- flex-direction: row;
648
- display: flex;
649
- align-items: center;
650
- `,l().div`
651
- flex: 1;
652
- display: flex;
653
- align-items: center;
654
- `,u.j.getLazyComponent("Button")),Ho=u.j.getLazyComponent("Icon"),Uo=({uniqid:e})=>{const t=(0,c.jL)(),i=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e));return i&&i.popup&&i.view?(0,n.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90},children:[(0,n.jsxs)(Ao,{children:[(0,n.jsx)(To,{}),(0,n.jsx)(Io,{children:"Popup"}),(0,n.jsx)(To,{children:(0,n.jsx)(Oo,{onClick:()=>{t(d.cr.slice.actions.flushEditorPopup({uniqid:e}))},children:(0,n.jsx)(Ho,{name:"icon-times",color:"grey2",size:26.75})})})]}),(0,n.jsx)("div",{style:{flex:1,display:"flex"},children:i.view}),(0,n.jsx)(Ao,{children:(0,n.jsx)(Bo,{onClick:()=>{t(d.cr.slice.actions.flushEditorPopup({uniqid:e}))},children:"Save"})})]}):(0,n.jsx)(n.Fragment,{})};var No=i(771);const Po=u.j.getLazyComponent("WidgetArticleTitleEditor"),Yo=u.j.getLazyComponent("WidgetArticleTextEditor"),Jo=u.j.getLazyComponent("WidgetArticleGalleryEditor"),Qo=u.j.getLazyComponent("WidgetArticleAttachmentEditor"),Ko=u.j.getLazyComponent("WidgetArticleSliderEditor"),Xo=u.j.getLazyComponent("WidgetArticleImageEditor"),Zo=u.j.getLazyComponent("WidgetButtonEditor"),es=u.j.getLazyComponent("WidgetCheckListEditor"),ts=u.j.getLazyComponent("WidgetQuickSurveyEditor"),is=u.j.getLazyComponent("WidgetDatasourceTableEditor"),ns=u.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),os=u.j.getLazyComponent("WidgetPresenceEditor"),ss=u.j.getLazyComponent("WidgetLuccaAbsenceEditor"),ls=u.j.getLazyComponent("WidgetEmailsImapEditor"),as=u.j.getLazyComponent("WidgetContactCardDavEditor"),rs=u.j.getLazyComponent("WidgetCalendarCalDavEditor"),ds=u.j.getLazyComponent("WidgetUserProfileEditor"),cs=u.j.getLazyComponent("WidgetWelcomeEditor"),us=u.j.getLazyComponent("WidgetExtensionEditor"),gs=({uniqid:e})=>{const t=(0,c.jL)(),i=(0,c.GV)(d.x0.selectors.selectToken),o=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual),s=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e)?.onSave,be.shallowEqual),l=e=>d.qn.selectors.selectHook(No.M.getState(),e)?.isActive,a=i=>{o&&t(d.x0.slice.actions.updateWidget({uniqid:e,content:i})),t(d.cr.slice.actions.flushEditor({uniqid:e})),s&&s(i)},u=(i,n)=>{t(void 0!==n?d.x0.slice.actions.setWidgetState({uniqid:n,...i}):d.x0.slice.actions.setWidgetState({uniqid:e,...i}))},g=i=>{t(d.cr.slice.actions.registerEditorPopup({uniqid:e,view:i}))},m=o?.widget;return m?(0,E.ensureWidgetArticleButtonType)(m)?(0,n.jsx)(Zo,{...m.content,onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:()=>a({})}):(0,E.ensureWidgetArticleGalleryType)(m)?(0,n.jsx)(Jo,{token:i,content:m.content,onChange:i=>t((0,d.vR)(e,i,!1)),onSave:a,onStateChange:u}):(0,E.ensureWidgetArticleAttachmentType)(m)?(0,n.jsx)(Qo,{token:i,content:m.content,onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,onStateChange:u,onOpen:g}):(0,E.ensureWidgetLuccaAbsenceType)(m)?(0,n.jsx)(ss,{}):(0,E.ensureWidgetArticleImageType)(m)?(0,n.jsx)(Xo,{content:m.content,token:i,onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,onStateChange:u}):(0,E.ensureWidgetArticleSliderType)(m)?void 0!==i?(0,n.jsx)(Ko,{slides:m.content.slides??[],loop:m.content.loop??!1,useDots:m.content.useDots??!0,onChange:i=>{t((0,d.vR)(e,i,!1))},token:i,onSave:a}):(0,n.jsx)(n.Fragment,{children:"Token is mandatory"}):(0,E.ensureWidgetArticleTitleType)(m)?(0,n.jsx)(Po,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,content:m.content,onOpen:g}):(0,E.ensureWidgetArticleTextType)(m)?(0,n.jsx)(Yo,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,content:m.content}):(0,E.ensureWidgetPresenceType)(m)?(0,n.jsx)(os,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,onStateChange:u,...m.content}):(0,E.ensureWidgetCheckListType)(m)?(0,n.jsx)(es,{token:i,uniqid:m.uniqid,content:{...m.content,arr:m.content.arr?.map(e=>({...e,title:r.Utils.html.htmlDecodeSpecialChars(e.title)}))},onChangeContent:(e,i)=>{t((0,d.vR)(e,i,!1))},onChangeWrapper:e=>{t(d.x0.slice.actions.updateWidgetWrapper({...e,title:r.Utils.html.htmlDecodeSpecialChars(e.title)}))},handleChange:i=>t((0,d.vR)(e,i,!1))}):(0,E.ensureWidgetQuickSurveyType)(m)?(0,n.jsx)(ts,{token:i,uniqid:m.uniqid,content:m.content,onChangeContent:(e,i)=>{t((0,d.vR)(e,i,!1))},onChangeWrapper:e=>{t(d.x0.slice.actions.updateWidgetWrapper({...e}))},handleChange:i=>t((0,d.vR)(e,i,!1))}):(0,E.ensureWidgetExcelDatasourceTableType)(m)?(0,n.jsx)(ns,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:l},handlers:{jamespot:{datasource:k().datasource,network:k().network,filebank:k().filebank,wedoc:k().wedoc},handleStart:()=>u({busy:!0}),handleCatch:e=>t(d.y8.actions.error({label:e.errorMsg})),handleFinally:()=>u({busy:!1})},onSave:a,onChange:(i,n)=>t((0,d.vR)(e,i,n??!1)),onStateChange:u,onError:e=>t(d.y8.actions.error({label:e}))}):(0,E.ensureWidgetEmailsImapType)(m)?(0,n.jsx)(ls,{}):(0,E.ensureWidgetExtensionType)(m)?(0,n.jsx)(us,{extensionName:m.content.extensionName,onChange:(i,n)=>t((0,d.vR)(e,i,n??!1)),onSave:a,onStateChange:u}):(0,E.ensureWidgetContactCardDavType)(m)?(0,n.jsx)(as,{}):(0,E.ensureWidgetCalendarCalDavType)(m)?(0,n.jsx)(rs,{}):(0,E.ensureWidgetDatasourceTableType)(m)?(0,n.jsx)(is,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:l},handlers:{jamespot:{datasource:k().datasource,network:k().network,application:k().application,filebank:k().filebank},handleStart:()=>u({busy:!0}),handleCatch:e=>t(d.y8.actions.error({label:e.errorMsg})),handleFinally:()=>u({busy:!1})},onSave:a,onChange:(i,n)=>t((0,d.vR)(e,i,n??!1)),onStateChange:u,onError:e=>{t(d.y8.actions.error({label:e}))}}):(0,E.ensureWidgetUserProfileType)(m)?(0,n.jsx)(ds,{uniqid:m.uniqid,content:m.content,onChangeContent:(e,i)=>{t((0,d.vR)(e,i,!1))}}):(0,E.ensureWidgetWelcomeType)(m)?(0,n.jsx)(cs,{uniqid:m.uniqid,content:m.content,onChangeContent:(e,i)=>{t((0,d.vR)(e,i,!1))}}):(0,n.jsx)(n.Fragment,{children:"cannot display editor"}):null},ms=u.j.getLazyComponent("Icon"),ps=({uniqid:e,position:t})=>{const i=(0,c.jL)(),o=(0,s.useTheme)();return(0,n.jsx)(To,{children:(0,n.jsx)(Oo,{onClick:()=>{i(d.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))},children:(0,n.jsx)(ms,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:o.color.lavender,size:26.75})})})},xs=u.j.getLazyComponent("InputColorRaw"),hs=l().label`
655
- margin-left: 2px;
656
- margin-right: 2px;
657
- margin-bottom: 8px;
658
- font-size: 14px;
659
- width: 100%;
660
- min-height: 20px;
661
- `,fs=l().fieldset`
662
- margin: 12px 0px !important;
663
- width: 100% !important;
664
- `,js=({label:e,initialValue:t,handleChange:i})=>{const o=(0,s.useTheme)(),l=[{name:(0,a.useIntl)().formatMessage({id:"GLOBAL_Platform_Color"}),colors:[o.color.primary,o.color.secondary,o.color.headerColor,o.color.lavender,o.color.orange,o.color.green,o.color.navy,o.color.overseas,o.color.transparentHexa]}];return(0,n.jsxs)(fs,{children:[(0,n.jsx)(hs,{children:(0,n.jsx)(a.FormattedMessage,{id:e})}),(0,n.jsx)(xs,{palettes:l,label:e,initialValue:t??o.color.primary,name:"background-color",onChange:i})]})},ys=u.j.getLazyComponent("InputNumber"),bs=({label:e,initialValue:t,handleChange:i})=>{const s=(0,a.useIntl)(),{control:l,watch:r}=(0,I.useForm)({defaultValues:{value:t??"0"},criteriaMode:"all"});return(0,o.useEffect)(()=>{const e=r(e=>{i(e.value??"")});return()=>e.unsubscribe()},[r,i]),(0,n.jsx)(ys,{label:e,name:"value",width:"100%",control:l,placeholder:s.formatMessage({id:e})})},Cs=u.j.getLazyComponent("InputSelectExtended"),vs=({label:e,options:t=[],initialValue:i,required:s=!1,handleChange:l})=>{const a=(0,o.useMemo)(()=>i&&t.find(e=>e.value===i)?t.find(e=>e.value===i):t[0],[i,t]),{control:r,watch:d}=(0,I.useForm)({defaultValues:{select:a},criteriaMode:"all"});return(0,o.useEffect)(()=>{const e=d(e=>{l(e.select.value)});return()=>e.unsubscribe()},[d,l]),(0,n.jsx)(Cs,{options:t,label:e,getValue:e=>e.value,getLabel:"label",getSearch:"label",rules:{required:s},hideDeleteIcon:!0,required:s,control:r,name:"select"})},ws=u.j.getLazyComponent("InputText"),Ls=({uniqid:e})=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),l=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e)),r=(0,c.GV)(t=>d.x0.selectors.selectWidgetContext(t,e),be.shallowEqual),u=(0,s.useTheme)(),g=(0,c.GV)(t=>d.x0.selectors.selectWidgetTitleStyle(t,e),be.shallowEqual),{control:m,watch:p}=(0,I.useForm)({defaultValues:{text:l?.title.replace(/&amp;/g,"&")??""},criteriaMode:"all"});(0,o.useEffect)(()=>{const t=p(t=>{i(d.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))});return()=>t.unsubscribe()},[p,e,i]);const x=(0,o.useMemo)(()=>({color:g&&g.color?String(g.color):u.color.black,backgroundColor:g&&g["background-color"]?String(g["background-color"]):"transparent",fontSize:g&&g["font-size"]?String(g["font-size"]):"24",fontWeight:g&&g["font-weight"]?String(g["font-weight"]):"medium",textAlign:g&&g["text-align"]?String(g["text-align"]):"left"}),[g,u]),h=(0,o.useCallback)((t,n)=>{i(d.x0.slice.actions.setWidgetTitleStyle({uniqid:e,styles:{[t]:n}}))},[i,e]);return l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ws,{name:"text",label:"WIDGET_Title",width:"100%",control:m,placeholder:t.formatMessage({id:"WIDGET_Title"})}),"comment"!==r&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(js,{label:"STYLE_Text_Color",initialValue:x.color,handleChange:e=>h("color",e)}),(0,n.jsx)(js,{label:"STYLE_Background_Color",initialValue:x.backgroundColor,handleChange:e=>h("background-color",e)}),(0,n.jsx)(bs,{label:"STYLE_Text_Size",initialValue:x.fontSize,handleChange:e=>h("font-size",e)}),(0,n.jsx)(vs,{label:"STYLE_Font_Weight",initialValue:x.fontWeight,options:[{label:t.formatMessage({id:"STYLE_Font_Weight_Normal"}),value:"normal"},{label:t.formatMessage({id:"STYLE_Font_Weight_Medium"}),value:"medium"},{label:t.formatMessage({id:"STYLE_Font_Weight_Bold"}),value:"bold"}],required:!1,handleChange:e=>h("font-weight",e)}),(0,n.jsx)(vs,{label:"STYLE_Text_Align",initialValue:x.textAlign,options:[{label:t.formatMessage({id:"STYLE_Text_Align_Left"}),value:"left"},{label:t.formatMessage({id:"STYLE_Text_Align_Center"}),value:"center"},{label:t.formatMessage({id:"STYLE_Text_Align_Justify"}),value:"justify"},{label:t.formatMessage({id:"STYLE_Text_Align_Right"}),value:"right"}],required:!1,handleChange:e=>h("text-align",e)})]})]}):(0,n.jsx)(n.Fragment,{})},Es=u.j.getLazyComponent("Loader"),ks=({uniqid:e})=>{const t=(0,c.GV)(t=>d.x0.selectors.selectWidgetState(t,e),be.shallowEqual)?.busy;return(0,n.jsx)(n.Fragment,{children:t&&(0,n.jsx)($o,{children:(0,n.jsx)(Es,{size:"l"})})})},_s=({uniqid:e})=>{const t=(0,a.useIntl)(),i=(0,c.GV)(t=>d.x0.selectors.selectWidgetState(t,e),be.shallowEqual)?.locked;return i?(0,n.jsx)(Fo,{children:t.formatMessage({id:"INTRANET_Panel_Change_Off"})}):(0,n.jsx)(n.Fragment,{})},Ws=u.j.getLazyComponent("Button"),Ss=({uniqid:e,mode:t})=>{const i=(0,a.useIntl)(),o=(0,c.jL)(),s=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual),l=(0,c.GV)(t=>d.x0.selectors.selectWidgetObjectUri(t,e),be.shallowEqual);return(0,n.jsx)(Ws,{color:"valid",onClick:()=>{o(d.cr.slice.actions.flushEditor({uniqid:e}));const n=s&&s.widget&&s.widget.content;l&&s&&n&&("view"==t&&k().widget.updateWidget({uri:l,uniqid:e,title:s.title,content:n,v2:!0}).catch(e=>{o(d.y8.actions.error({label:e.errorMsg??i.formatMessage({id:"GLOBAL_Error"})}))}),"edit"===t&&o(d.x0.slice.actions.updateWidget({uniqid:e,content:n})))},children:i.formatMessage({id:"GLOBAL_Save"})})},qs=({uniqid:e})=>{const t=(0,s.useTheme)(),i=(0,c.jL)(),l=(0,a.useIntl)(),r=(0,c.GV)(t=>d.x0.selectors.selectWidgetWrapperStyle(t,e),be.shallowEqual),u=(0,o.useMemo)(()=>({color:r&&r.color?String(r.color):t.color.black,backgroundColor:r&&r["background-color"]?String(r["background-color"]):t.color.white,padding:r&&r.padding?String(r.padding):"0",borderRadius:r&&r["border-radius"]?String(r["border-radius"]):"0",borderColor:r["border-color"]?String(r["border-color"]):t.color.black,borderWidth:r["border-width"]?String(r["border-width"]):"0",borderStyle:r["border-style"]?String(r["border-style"]):"none"}),[r,t]),g=(0,o.useCallback)((t,n)=>{i(d.x0.slice.actions.setWidgetWrapperStyle({uniqid:e,styles:{[t]:n}}))},[e,i]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(js,{label:"STYLE_Background_Color",initialValue:u.backgroundColor,handleChange:e=>g("background-color",e)}),(0,n.jsx)(js,{label:"STYLE_Text_Color",initialValue:u.color,handleChange:e=>g("color",e)}),(0,n.jsx)("hr",{}),(0,n.jsx)(bs,{label:"STYLE_Padding",initialValue:u.padding,handleChange:e=>g("padding",String(e))}),(0,n.jsx)(bs,{label:"STYLE_Radius",initialValue:u.borderRadius,handleChange:e=>g("border-radius",String(e))}),(0,n.jsx)(vs,{label:"STYLE_Border_Style",initialValue:u.borderStyle,options:[{label:l.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:l.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:l.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:l.formatMessage({id:"STYLE_Border_Style_Dotted"}),value:"dotted"}],required:!1,handleChange:e=>{g("border-style",e),"none"!==e&&g("border-color",t.color.black),"none"!==e&&g("border-width","1")}}),"string"==typeof u.borderStyle&&"none"!==u.borderStyle&&(0,n.jsx)(js,{label:"STYLE_Border_Color",initialValue:u.borderColor,handleChange:e=>g("border-color",e)}),"string"==typeof u.borderStyle&&"none"!==u.borderStyle&&(0,n.jsx)(bs,{label:"STYLE_Border_Width",initialValue:u.borderWidth,handleChange:e=>g("border-width",e)})]})},Ms=({uniqid:e})=>{const t=(0,c.jL)(),i=(0,a.useIntl)(),s=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e),be.shallowEqual),l=d.x0.definition(s?.name),r=(0,c.GV)(t=>d.x0.selectors.selectWidgetLevel(t,e),be.shallowEqual),u=(0,o.useCallback)(i=>{t(d.x0.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(i)}))},[e,t]);return(0,n.jsx)(vs,{handleChange:u,required:!0,label:"WIDGET_Display_Level_Select",initialValue:r?String(r):"3",options:[{label:i.formatMessage({id:"WIDGET_Display_Level_1"}),value:"1"},{label:i.formatMessage({id:"WIDGET_Display_Level_2"}),value:"2"},{label:i.formatMessage({id:"WIDGET_Display_Level_3"}),value:"3"},{label:i.formatMessage({id:"WIDGET_Display_Level_4"}),value:"4"}].filter(e=>Array.isArray(l.displayLevel)?l.displayLevel.includes(Number(e.value)):[])})},As=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],Ts=u.j.getLazyComponent("Icon"),Is=u.j.getLazyComponent("Tooltip"),zs=({uniqid:e,position:t})=>{const i=(0,a.useIntl)(),l=(0,c.jL)(),r=(0,s.useTheme)(),u=(0,o.useRef)(null),g=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e),be.shallowEqual),m=d.x0.definition(g?.name),p=(0,o.useMemo)(()=>void 0!==m.displayLevel&&Array.isArray(m.displayLevel)&&0!==m.displayLevel.length,[m]),x=(0,o.useMemo)(()=>[{name:"widget-title",label:i.formatMessage({id:"PANEL_Title"}),enable:m.panel.useWrapper,icon:"icon-font"},{name:"widget-selection",label:i.formatMessage({id:"PANEL_Widget_Selection"}),enable:m.panel.useSelection,icon:"icon-sliders"},{name:"widget-settings",label:i.formatMessage({id:"PANEL_Widget_Settings"}),enable:m.panel.useEditor,icon:"icon-pen"},{name:"widget-level",label:i.formatMessage({id:"PANEL_Widget_Level"}),enable:p,icon:"icon-edit"}],[m,i,p]),h=(0,o.useMemo)(()=>m.panel.useEditor?x.find(e=>"widget-settings"===e.name):x.filter(e=>e.enable)[0],[m,x]),[f,j]=(0,o.useState)(h);return(0,o.useEffect)(()=>{setTimeout(()=>{u&&u.current&&(u.current.className=u.current.className+" animate")},0)},[]),g?(0,n.jsxs)(zo,{children:[(0,n.jsxs)(Go,{ref:u,position:t,children:[(0,n.jsx)(Ro,{children:x.filter(e=>e.enable).map(e=>(0,n.jsx)(Oo,{isActive:f&&f.name===e.name,onClick:()=>j(e),children:(0,n.jsx)(Is,{position:"left",description:e.label,children:(0,n.jsx)(Ts,{name:e.icon,color:f&&f.name===e.name?r.color.white:r.color.lavender})})},e.name))}),(0,n.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"},children:[(0,n.jsxs)(Ao,{children:[(0,n.jsx)(ps,{uniqid:e,position:g.position}),(0,n.jsx)(Io,{children:(0,n.jsx)("h3",{children:f?f.label:i.formatMessage({id:m.label})})}),(0,n.jsx)(To,{children:(0,n.jsx)(Oo,{onClick:()=>{l(d.cr.slice.actions.flushEditor({uniqid:e}))},children:(0,n.jsx)(Ts,{name:"icon-times",color:r.color.lavender,size:26.75})})})]}),(0,n.jsxs)(Do,{children:[(0,n.jsxs)(Vo,{children:[f&&"widget-settings"===f.name&&m.panel.useEditor&&(0,n.jsx)(gs,{uniqid:g.uniqid}),f&&"widget-title"===f.name&&m.panel.useWrapper&&(0,n.jsx)(Ls,{uniqid:g.uniqid}),f&&"widget-selection"===f.name&&(0,n.jsx)(qs,{uniqid:e}),f&&"widget-level"===f.name&&p&&(0,n.jsx)(Ms,{uniqid:e})]}),(0,n.jsx)(ks,{uniqid:e}),(0,n.jsx)(_s,{uniqid:e}),As.includes(g.name)&&(0,n.jsx)(Ss,{uniqid:e,mode:g.mode})]})]})]}),g?.popup?(0,n.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):(0,n.jsx)(n.Fragment,{})]}):(0,n.jsx)(n.Fragment,{})},Gs=l().div`
665
- position: absolute;
666
- inset: 0;
667
- pointer-events: none;
668
- z-index: 1;
669
- `,Ds=l().div`
670
- flex: 1;
671
- display: flex;
672
- margin-top: ${90}px;
673
- pointer-events: ${e=>e.isActive?"all":"none"};
674
- `,Vs=l().div`
675
- flex: 1;
676
- display: flex;
677
- flex-direction: row;
678
- pointer-events: none;
679
- `,$s=l().div`
680
- width: ${440}px;
681
- pointer-events: none;
682
- `,Fs=()=>{const e=(0,c.jL)();(0,o.useEffect)(()=>{const t=()=>{e(d.cr.slice.actions.flushAllEditor())};return window.addEventListener("NGWidgetEditorFlushAll",t),()=>{window.removeEventListener("NGWidgetEditorFlushAll",t)}},[e]);const t=(0,c.GV)(d.cr.selectors.selectEditors,be.shallowEqual);return(0,n.jsx)(Gs,{className:"editor-portal-wrapper",children:t.map(e=>(0,n.jsx)(Mo,{isActive:!1,children:(0,n.jsx)(Vs,{children:"left"===e.position?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(zs,{uniqid:e.uniqid,position:e.position}),(0,n.jsx)(Ds,{isActive:void 0!==e.popup,children:(0,n.jsx)(Uo,{uniqid:e.uniqid})}),(0,n.jsx)($s,{})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($s,{}),(0,n.jsx)(Ds,{isActive:void 0!==e.popup,children:(0,n.jsx)(Uo,{uniqid:e.uniqid})}),(0,n.jsx)(zs,{uniqid:e.uniqid,position:e.position})]})})},e.uniqid))})},Rs=()=>(0,n.jsx)(n.Fragment,{}),Os=u.j.getLazyComponent("Container"),Bs=()=>(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)(n.Fragment,{}),children:(0,n.jsx)(Os,{backgroundColor:"white",mode:"fluid",flexDirection:"column",children:(0,n.jsx)(ee.Outlet,{})})});var Hs=i(622);const Us=()=>{const[e,t]=(0,o.useState)(),i=(0,a.useIntl)(),n=(0,o.useMemo)(()=>J.hooks?.MagicWandHook?.isActive&&J.hooks?.MagicWandHook?.menuItems&&J.hooks.MagicWandHook.menuItems.length,[]),s=(0,o.useCallback)(e=>{t({...e,reject:i=>{e.reject(i),t(void 0)},resolve:i=>{e.resolve(i),t(void 0)}})},[]),l=(0,o.useCallback)((e,t)=>new Promise((i,n)=>{s({reject:n,resolve:i,text:e,capability:t})}),[s]),d=(0,o.useMemo)(()=>({develop:e=>l(e,"develop"),summarize:e=>l(e,"summarize"),tldr:e=>l(e,"tldr"),en:e=>l(e,"en"),es:e=>l(e,"es"),formal:e=>l(e,"formal"),funny:e=>l(e,"funny")}),[l]);return{query:e,ext:(0,o.useMemo)(()=>r.JTinyMCEExtensionsBuilders.jia(d,i),[i,d]),isActive:n}},Ns=u.j.getLazyComponent("InputTinyMCE"),Ps=e=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),l=(0,s.useTheme)(),r=(0,c.GV)(d.Kx.selectors.selectAll),{query:u,ext:g,isActive:m}=Us(),{open:p,onInsert:x,close:h,ext:f,isActive:j}=je(),{close:y,open:b,isActive:C,onSelect:v,ext:w}=Zn(),L=(0,o.useMemo)(()=>[...j?[f]:[],...m?[g]:[],...C?[w]:[]],[g,f,w,m,C,j]),E=(0,o.useCallback)(e=>{i(d.y8.actions.error({label:e??t.formatMessage({id:"GLOBAL_Error"})}))},[i,t]),k=(0,o.useMemo)(()=>(0,ye.X)(r,l,E),[r,E,l]),_=(0,o.useMemo)(()=>Hs.p9,[]);return(0,n.jsxs)(n.Fragment,{children:[_&&(0,n.jsx)(Ns,{commonOptions:_,additionalExtensions:L,mentionsQueries:k,...e}),m&&(0,n.jsx)(T,{query:u}),j&&(0,n.jsx)(ft,{onInsert:x,open:p,close:h}),C&&(0,n.jsx)(io,{onSelect:v,open:b,close:y})]})},Ys=u.j.getLazyComponent("InputTinyMCERaw"),Js=e=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),l=(0,s.useTheme)(),r=(0,c.GV)(d.Kx.selectors.selectAll),{query:u,ext:g,isActive:m}=Us(),{open:p,onInsert:x,close:h,ext:f,isActive:j}=je(),y=(0,o.useMemo)(()=>[...j?[f]:[],...m?[g]:[]],[g,f,m,j]),b=(0,o.useCallback)(e=>{i(d.y8.actions.error({label:e??t.formatMessage({id:"GLOBAL_Error"})}))},[i,t]),C=(0,o.useMemo)(()=>(0,ye.X)(r,l,b),[r,b,l]),v=(0,o.useMemo)(()=>Hs.p9,[]);return(0,n.jsxs)(n.Fragment,{children:[v&&(0,n.jsx)(Ys,{commonOptions:v,additionalExtensions:y,mentionsQueries:C,...e}),m&&(0,n.jsx)(T,{query:u}),j&&(0,n.jsx)(ft,{onInsert:x,open:p,close:h})]})},Qs=u.j.getLazyComponent("InputAudience"),Ks=u.j.getLazyComponent("Message"),Xs=u.j.getLazyComponent("Modal"),Zs=({open:e,closeHandler:t,title:i,control:o,warningMessage:s,onSubmit:l,name:r="publishTo"})=>{const d=(0,a.useIntl)();return(0,n.jsxs)(Xs,{open:e,closeHandler:t,title:i??d.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{dataCy:"no-audience-continue",children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),l()}}],children:[(0,n.jsx)(Ks,{variant:"warning",message:s??d.formatMessage({id:"FORM_Audience_Empty"})}),(0,n.jsx)(Qs,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:o,multiple:!0,placeholder:d.formatMessage({id:"GLOBAL_Audience"}),name:r})]})};var el=i(97);const tl=u.j.getLazyComponent("ModalForm"),il=u.j.getLazyComponent("InputDateTime"),nl=u.j.getLazyComponent("InputTextRaw"),ol=u.j.getLazyComponent("FlexBox"),sl=u.j.getLazyComponent("IconButton"),ll=l().div`
683
- margin-bottom: ${({theme:e})=>e.space.xs}px;
684
- `,al=({open:e,closeHandler:t,onSubmit:i})=>{const s=(0,a.useIntl)(),l=(0,c.jL)(),u=(0,c.GV)(d.OD.selectors.selectUrlBase),g=(0,I.useForm)({defaultValues:async()=>{const e=new Date;return{scheduleDate:`${r.Utils.date.formatDate(e)} ${(0,E.padStartTwoDigits)(e.getHours())}:${(0,E.padStartTwoDigits)(e.getMinutes())}`,permalinkId:(0,el.A)()}}}),m=g.handleSubmit(e=>{i(e)});(0,o.useEffect)(()=>{e&&g.reset()},[g,e]);const p=(0,I.useWatch)({control:g.control,name:"permalinkId"}),x=(0,o.useMemo)(()=>`${u}permalink/${p}`,[p,u]);return(0,n.jsxs)(tl,{open:e,closeHandler:t,onSubmit:m,maxHeight:"620px",title:s.formatMessage({id:"GLOBAL_Schedule"}),buttons:[{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:(0,n.jsx)(a.FormattedMessage,{id:"GLOBAL_Schedule"}),color:"valid",clickHandler:()=>{t(),m()},disabled:!g.watch("scheduleDate")}],children:[(0,n.jsx)(il,{rules:{required:!0},label:"GLOBAL_Scheduled_Date",control:g.control,name:"scheduleDate"}),(0,n.jsxs)(ol,{y:"flex-end",children:[(0,n.jsx)(nl,{label:s.formatMessage({id:"GLOBAL_Permalink"}),value:x,onChange:()=>null,margin:"0",width:"100%"}),(0,n.jsx)(ll,{children:(0,n.jsx)(sl,{srOnly:"GLOBAL_Copy_Link",icon:"icon-copy",colorVariant:"primary",onClick:()=>{navigator.clipboard.writeText(x).then(()=>{l(d.y8.actions.success({label:s.formatMessage({id:"CLIPBOARD_Copy_Success"})}))})}})})]})]})},rl=u.j.getLazyComponent("Container"),dl=u.j.getLazyComponent("AppColumn"),cl=u.j.getLazyComponent("MainColumn");function ul({extensionRoute:e,routes:t,description:i,mode:s="center",mainColumnProps:l}){const r=(0,a.useIntl)(),{pathname:d}=(0,ee.useLocation)(),c=(0,o.useMemo)(()=>Object.values(t),[t]),[u,g]=(0,o.useState)(c?.[0]?.key),m=c.map(t=>({...t,label:r.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?r.formatMessage({id:t.group}):void 0}));return(0,o.useEffect)(()=>{const t=c.find(t=>`/ng/rr/${e}/${t.path}`===d||t.paths?.reduce((t,i)=>{const n=`/ng/rr/${e}/${i}`,o=null!==(0,ee.matchPath)(n,d);return t||o},!1));t&&g(t.key)},[d,c,e]),(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)(n.Fragment,{}),children:(0,n.jsxs)(rl,{mode:s,children:[(0,n.jsx)(dl,{mode:s,description:i,tabs:m,activeTab:u||""}),(0,n.jsx)(cl,{mode:s,flex:!0,...l,children:(0,n.jsx)(ee.Outlet,{})})]})})}}}]);
685
- //# sourceMappingURL=818.3f23be9d7323f83e9353.chunk.js.map