jamespot-react-core 1.2.55 → 1.2.57

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.
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[836],{836:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>A,AddReportModal:()=>Z,Audience:()=>L,Avatar:()=>x,CalendarToolbar:()=>ho,CalendarWrapper:()=>Co,CommentsBloc:()=>Jn,DisplayForm:()=>R,Editor:()=>el,EditorsPortal:()=>Wl,Empty:()=>Sl,FullPageLayout:()=>Ml,JRCInputTinyMCEWithExt:()=>zl,JRCInputTinyMCEWithExtRaw:()=>Dl,MarkdownModal:()=>bt,ModalAudience:()=>Rl,ModalSchedule:()=>Ql,TwoColLayout:()=>Zl,WidgetList:()=>xe,WidgetWrapperCore:()=>Rn});var n=i(576),o=i(594),l=i(196),s=i.n(l),a=i(493),r=i(472),d=i(24),c=i(71),u=i(389);const g=u.j.getLazyComponent("Icon"),m=u.j.getLazyComponent("JRCAvatar"),p=s().span`
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[541],{541:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>A,AddReportModal:()=>Z,Audience:()=>L,Avatar:()=>x,CalendarToolbar:()=>jo,CalendarWrapper:()=>wo,CommentsBloc:()=>Xn,DisplayForm:()=>R,Editor:()=>nl,EditorsPortal:()=>Ml,Empty:()=>Tl,FullPageLayout:()=>Il,JRCInputTinyMCEWithExt:()=>Vl,JRCInputTinyMCEWithExtRaw:()=>Fl,MarkdownModal:()=>bt,ModalAudience:()=>Hl,ModalSchedule:()=>Xl,TwoColLayout:()=>is,WidgetList:()=>xe,WidgetWrapperCore:()=>Bn});var n=i(576),o=i(594),l=i(196),s=i.n(l),a=i(493),r=i(6),d=i(358),c=i(71),u=i(389);const g=u.j.getLazyComponent("Icon"),m=u.j.getLazyComponent("JRCAvatar"),p=s().span`
2
2
  ${r.SROnly}
3
3
  `,x=e=>{const t=(0,l.useTheme)(),i=(0,a.useIntl)(),o=(0,c.GV)(d.Bx.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=s().div`
4
4
  display: flex;
@@ -189,16 +189,16 @@
189
189
  overflow: auto;
190
190
  position: absolute;
191
191
  inset: 0;
192
- `,Qe=({header:e,scrollable:t,footer:i})=>(0,n.jsxs)(Ne,{children:[e&&e(),(0,n.jsx)(Pe,{children:(0,n.jsx)(Ye,{children:t&&t()})}),i&&i()]}),Je=s().div`
192
+ `,Je=({header:e,scrollable:t,footer:i})=>(0,n.jsxs)(Ne,{children:[e&&e(),(0,n.jsx)(Pe,{children:(0,n.jsx)(Ye,{children:t&&t()})}),i&&i()]}),Qe=s().div`
193
193
  display: flex;
194
194
  flex-direction: column;
195
- `,Ke=({uniqid:e,children:t})=>{const i=(0,c.GV)(t=>d.x0.selectors.selectWidgetWrapperStyle(t,e),be.shallowEqual),l=(0,o.useMemo)(()=>({padding:i&&i.padding?`${i.padding}px`:"0px"}),[i]);return(0,n.jsx)(Je,{style:{padding:l.padding},children:t})},Xe=s().div`
195
+ `,Ke=({uniqid:e,children:t})=>{const i=(0,c.GV)(t=>d.x0.selectors.selectWidgetWrapperStyle(t,e),be.shallowEqual),l=(0,o.useMemo)(()=>({padding:i&&i.padding?`${i.padding}px`:"0px"}),[i]);return(0,n.jsx)(Qe,{style:{padding:l.padding},children:t})},Xe=s().div`
196
196
  position: absolute;
197
197
  inset: 0;
198
198
  display: flex;
199
199
  justify-content: center;
200
200
  align-items: center;
201
- `,Ze=u.j.getLazyComponent("WidgetLuccaAbsence"),et=u.j.getLazyComponent("Loader"),tt=({uniqid:e})=>{const[t,i]=(0,o.useState)([]),[l,s]=(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||s(!0)}).finally(()=>d(!1))},[u,c.signal]),r?(0,n.jsx)(Xe,{children:(0,n.jsx)(et,{size:"m"})}):l?(0,n.jsx)(Xe,{children:(0,n.jsx)(a.FormattedMessage,{id:"WIDGET_Lucca_Absence_Url_Error"})}):(0,n.jsx)(Qe,{header:()=>(0,n.jsx)(Ue,{uniqid:e}),scrollable:()=>(0,n.jsx)(Ke,{uniqid:e,children:(0,n.jsx)(Ze,{list:t})})})},it=u.j.getLazyComponent("WidgetImage"),nt=u.j.getLazyComponent("FileViewer"),ot=u.j.getLazyComponent("WidgetEmptyInplace"),lt=s().div`
201
+ `,Ze=u.j.getLazyComponent("WidgetLuccaAbsence"),et=u.j.getLazyComponent("Loader"),tt=({uniqid:e})=>{const[t,i]=(0,o.useState)([]),[l,s]=(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||s(!0)}).finally(()=>d(!1))},[u,c.signal]),r?(0,n.jsx)(Xe,{children:(0,n.jsx)(et,{size:"m"})}):l?(0,n.jsx)(Xe,{children:(0,n.jsx)(a.FormattedMessage,{id:"WIDGET_Lucca_Absence_Url_Error"})}):(0,n.jsx)(Je,{header:()=>(0,n.jsx)(Ue,{uniqid:e}),scrollable:()=>(0,n.jsx)(Ke,{uniqid:e,children:(0,n.jsx)(Ze,{list:t})})})},it=u.j.getLazyComponent("WidgetImage"),nt=u.j.getLazyComponent("FileViewer"),ot=u.j.getLazyComponent("WidgetEmptyInplace"),lt=s().div`
202
202
  position: absolute;
203
203
  inset: 0;
204
204
  background-color: rgba(0, 0, 0, 0.4);
@@ -290,7 +290,7 @@
290
290
  justify-content: center;
291
291
  align-items: center;
292
292
  background-color: rgba(255, 255, 255, 0.4);
293
- `,Nt=()=>(0,n.jsx)(Ut,{children:(0,n.jsx)(Ht,{size:"m"})}),Pt=u.j.getLazyComponent("WidgetCheckList"),Yt=u.j.getLazyComponent("WidgetCheckListEditor"),Qt=u.j.getLazyComponent("FileViewer"),Jt=(s().div`
293
+ `,Nt=()=>(0,n.jsx)(Ut,{children:(0,n.jsx)(Ht,{size:"m"})}),Pt=u.j.getLazyComponent("WidgetCheckList"),Yt=u.j.getLazyComponent("WidgetCheckListEditor"),Jt=u.j.getLazyComponent("FileViewer"),Qt=(s().div`
294
294
  display: flex;
295
295
  flex-direction: row;
296
296
  justify-content: space-between;
@@ -306,7 +306,7 @@
306
306
  padding: 16px;
307
307
  `),Kt=s().div`
308
308
  position: relative;
309
- `,Xt=({widget:e,inplace:t,mode:i,onWidgetUpdate:l})=>{const s=(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??s.formatMessage({id:"GLOBAL_Error"})}))},[m,s]),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 T=(0,o.useCallback)((e,t)=>{m((0,d.vR)(e,t))},[m]),A=(0,o.useCallback)(()=>{w&&(C(!0),k().widget.getWidget({uri:w,uniqid:u}).then(e=>{(0,E.ensureWidgetCheckListType)(e.result)&&T(u,e.result.content)}).catch(e=>!e.aborted&&q).finally(()=>C(!1)))},[u,q,w,T]),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||A())},[_,e.uniqid,w,q,m,A]);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(()=>T(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)(Jt,{children:(0,n.jsx)(Yt,{token:p,uniqid:u,content:{...g,arr:g.arr?.map(e=>({...e,title:r.Utils.html.htmlDecodeSpecialChars(e.title)}))},inplace:t,onChangeContent:T,onChangeWrapper:e=>{m(d.x0.slice.actions.updateWidgetWrapper({...e}))},handleChange:t=>m((0,d.vR)(e.uniqid,t))})}):(0,n.jsx)(qt.M,{useRT:()=>{(0,Ce.AW)(e.uniqid)},children:j&&(0,n.jsx)(Qt,{files:G,openWithOptions:[],children:t=>(0,n.jsxs)(Kt,{children:[(0,n.jsx)(Pt,{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(()=>{l&&l()}).catch(e=>{q(e.message),C(!1)})))})(e.uniqid,t)}),g.edit&&(0,n.jsx)(Bt,{handleClick:z,placeholder:s.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),S&&p&&(0,n.jsx)($t,{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)(Nt,{})]},e.uniqid)})})},Zt=(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},ei=u.j.getLazyComponent("Button"),ti=u.j.getLazyComponent("WidgetTable"),ii=u.j.getLazyComponent("Loader"),ni=(s().div``,s().div`
309
+ `,Xt=({widget:e,inplace:t,mode:i,onWidgetUpdate:l})=>{const s=(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??s.formatMessage({id:"GLOBAL_Error"})}))},[m,s]),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 T=(0,o.useCallback)((e,t)=>{m((0,d.vR)(e,t))},[m]),A=(0,o.useCallback)(()=>{w&&(C(!0),k().widget.getWidget({uri:w,uniqid:u}).then(e=>{(0,E.ensureWidgetCheckListType)(e.result)&&T(u,e.result.content)}).catch(e=>!e.aborted&&q).finally(()=>C(!1)))},[u,q,w,T]),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||A())},[_,e.uniqid,w,q,m,A]);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(()=>T(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)(Qt,{children:(0,n.jsx)(Yt,{token:p,uniqid:u,content:{...g,arr:g.arr?.map(e=>({...e,title:r.Utils.html.htmlDecodeSpecialChars(e.title)}))},inplace:t,onChangeContent:T,onChangeWrapper:e=>{m(d.x0.slice.actions.updateWidgetWrapper({...e}))},handleChange:t=>m((0,d.vR)(e.uniqid,t))})}):(0,n.jsx)(qt.M,{useRT:()=>{(0,Ce.AW)(e.uniqid)},children:j&&(0,n.jsx)(Jt,{files:G,openWithOptions:[],children:t=>(0,n.jsxs)(Kt,{children:[(0,n.jsx)(Pt,{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(()=>{l&&l()}).catch(e=>{q(e.message),C(!1)})))})(e.uniqid,t)}),g.edit&&(0,n.jsx)(Bt,{handleClick:z,placeholder:s.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),S&&p&&(0,n.jsx)($t,{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)(Nt,{})]},e.uniqid)})})},Zt=(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},ei=u.j.getLazyComponent("Button"),ti=u.j.getLazyComponent("WidgetTable"),ii=u.j.getLazyComponent("Loader"),ni=(s().div``,s().div`
310
310
  position: absolute;
311
311
  inset: 0;
312
312
  display: flex;
@@ -360,17 +360,17 @@
360
360
  gap: 14px;
361
361
  ${e=>e.withPadding&&"padding: 0 12px;"}
362
362
  padding-top: 16px;
363
- `,Li=({widget:e,inplace:t,mode:i})=>{const l=(0,a.useIntl)(),s=(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)=>{s((0,d.vR)(e,t))},[s]),M=t=>{s(d.cr.slice.actions.flushAllEditor()),s(d.x0.slice.actions.setToken({token:t})),s(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:E.WidgetsName.QuickSurvey}))},T=(0,o.useCallback)(()=>s(d.y8.actions.error({label:"WIDGET_Presence_Error"})),[s]),A=(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&&T).finally(()=>f(!1)))},[T,_,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&&T).finally(()=>f(!1)))},[r,T,_,q]),z=()=>{if(_&&u.closing){const e={...u,isClosed:!0};k().widget.updateWidget({uri:_,uniqid:r,content:e}).catch(()=>{T()})}},G=t=>{(t=>{"edit"!==i&&_&&(f(!0),k().widget.quickSurveyRespond({uri:_,index:t,multi:u.multi?1:0,uniqid:r},w.current.signal).then(()=>{A(e.uniqid)}).catch(e=>!e.aborted&&T).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&&T)},V=(0,o.useMemo)(()=>W&&W.update,[W]);(0,o.useEffect)(()=>{A(e.uniqid)},[A,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&&A(e.uniqid),"widget-update"===t.fn&&I())},[S,_,e.uniqid,I,A]);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=>{s(d.x0.slice.actions.setToken({token:e.result}))})},[i,L,s]),"edit"===i&&t?(0,n.jsx)(wi,{withPadding:!0,children:(0,n.jsx)(bi,{token:L,uniqid:r,content:e.content,onChangeContent:q,onChangeWrapper:e=>{s(d.x0.slice.actions.updateWidgetWrapper({...e}))},handleChange:e=>q(r,e),inplace:t})}):(0,n.jsx)(qt.M,{useRT:()=>{(0,Ce.AW)(e.uniqid)},children:(0,n.jsxs)(wi,{children:[(0,n.jsx)(vi,{files:$,openWithOptions:[],children:t=>(0,n.jsx)(yi,{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)(Bt,{handleClick:e=>{if(!_)return;const t={...u,arr:[...u.arr??[],{title:e}]};k().widget.quickSurveyAddEnty({uri:_,uniqid:r,label:e}).then(()=>{s(d.x0.slice.actions.updateWidget({uniqid:r,content:t}))}).catch(T)},placeholder:l.formatMessage({id:"FIELDS_Add_Option"})}),V&&(0,n.jsx)($t,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!V},mode:i,handleOpenEditor:()=>{L?M(L):(f(!0),k().network.token().then(e=>{s(d.x0.slice.actions.setToken({token:e.result})),M(e.result)}).finally(()=>f(!1)))}}),h&&(0,n.jsx)(Nt,{}),(0,n.jsx)(Ci,{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})}})]})})},Ei=u.j.getLazyComponent("ModalLayout"),ki=u.j.getLazyComponent("ModalContent"),_i=u.j.getLazyComponent("Button"),Wi=u.j.getLazyComponent("InputText"),Si=u.j.getLazyComponent("InputNumber"),qi=u.j.getLazyComponent("InputSelectExtended"),Mi=u.j.getLazyComponent("InputPassword"),Ti=u.j.getLazyComponent("Typography"),Ai=u.j.getLazyComponent("Loader"),Ii=s().div`
363
+ `,Li=({widget:e,inplace:t,mode:i})=>{const l=(0,a.useIntl)(),s=(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)=>{s((0,d.vR)(e,t))},[s]),M=t=>{s(d.cr.slice.actions.flushAllEditor()),s(d.x0.slice.actions.setToken({token:t})),s(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:E.WidgetsName.QuickSurvey}))},T=(0,o.useCallback)(()=>s(d.y8.actions.error({label:"WIDGET_Presence_Error"})),[s]),A=(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&&T).finally(()=>f(!1)))},[T,_,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&&T).finally(()=>f(!1)))},[r,T,_,q]),z=()=>{if(_&&u.closing){const e={...u,isClosed:!0};k().widget.updateWidget({uri:_,uniqid:r,content:e}).catch(()=>{T()})}},G=t=>{(t=>{"edit"!==i&&_&&(f(!0),k().widget.quickSurveyRespond({uri:_,index:t,multi:u.multi?1:0,uniqid:r},w.current.signal).then(()=>{A(e.uniqid)}).catch(e=>!e.aborted&&T).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&&T)},V=(0,o.useMemo)(()=>W&&W.update,[W]);(0,o.useEffect)(()=>{A(e.uniqid)},[A,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&&A(e.uniqid),"widget-update"===t.fn&&I())},[S,_,e.uniqid,I,A]);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=>{s(d.x0.slice.actions.setToken({token:e.result}))})},[i,L,s]),"edit"===i&&t?(0,n.jsx)(wi,{withPadding:!0,children:(0,n.jsx)(bi,{token:L,uniqid:r,content:e.content,onChangeContent:q,onChangeWrapper:e=>{s(d.x0.slice.actions.updateWidgetWrapper({...e}))},handleChange:e=>q(r,e),inplace:t})}):(0,n.jsx)(qt.M,{useRT:()=>{(0,Ce.AW)(e.uniqid)},children:(0,n.jsxs)(wi,{children:[(0,n.jsx)(vi,{files:$,openWithOptions:[],children:t=>(0,n.jsx)(yi,{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)(Bt,{handleClick:e=>{if(!_)return;const t={...u,arr:[...u.arr??[],{title:e}]};k().widget.quickSurveyAddEnty({uri:_,uniqid:r,label:e}).then(()=>{s(d.x0.slice.actions.updateWidget({uniqid:r,content:t}))}).catch(T)},placeholder:l.formatMessage({id:"FIELDS_Add_Option"})}),V&&(0,n.jsx)($t,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!V},mode:i,handleOpenEditor:()=>{L?M(L):(f(!0),k().network.token().then(e=>{s(d.x0.slice.actions.setToken({token:e.result})),M(e.result)}).finally(()=>f(!1)))}}),h&&(0,n.jsx)(Nt,{}),(0,n.jsx)(Ci,{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})}})]})})},Ei=u.j.getLazyComponent("WidgetUserProfile"),ki=({widget:e,mode:t})=>{const i=(0,c.jL)(),{uniqid:l,name:s,content:a}=e,r=(0,c.GV)(d.xJ.selectors.get);return(0,o.useEffect)(()=>{i(d.x0.slice.actions.setWidgetState({uniqid:l,mounted:!0}))},[]),(0,o.useEffect)(()=>{"edit"===t&&(i(d.cr.slice.actions.flushAllEditor()),i(d.cr.slice.actions.registerEditor({uniqid:l,name:s})))},[i,t,s,l]),(0,o.useEffect)(()=>{"view"!==t&&"preview"!==t||i(d.cr.slice.actions.flushAllEditor())},[t,i]),(0,n.jsx)(Ei,{currentUser:r,pictureSize:a.pictureSize,displayMode:a.buttonName,css:a.css})},_i=u.j.getLazyComponent("ModalLayout"),Wi=u.j.getLazyComponent("ModalContent"),Si=u.j.getLazyComponent("Button"),qi=u.j.getLazyComponent("InputText"),Mi=u.j.getLazyComponent("InputNumber"),Ti=u.j.getLazyComponent("InputSelectExtended"),Ai=u.j.getLazyComponent("InputPassword"),Ii=u.j.getLazyComponent("Typography"),zi=u.j.getLazyComponent("Loader"),Gi=s().div`
364
364
  display: flex;
365
365
  flex-direction: column;
366
366
  opacity: ${e=>e.isLocked?".4":"1.0"};
367
- `,zi=s().div`
367
+ `,Di=s().div`
368
368
  position: absolute;
369
369
  inset: 0;
370
370
  display: flex;
371
371
  justify-content: center;
372
372
  align-items: center;
373
- `,Gi=s().div`
373
+ `,Vi=s().div`
374
374
  background-color: ${e=>e.theme.color.orange};
375
375
  color: ${e=>e.theme.color.white};
376
376
  padding: ${e=>e.theme.space.sm}px;
@@ -378,67 +378,67 @@
378
378
  display: flex;
379
379
  justify-content: center;
380
380
  align-items: center;
381
- `,Di=s().div`
381
+ `,$i=s().div`
382
382
  margin-bottom: ${e=>e.theme.space.md}px;
383
- `,Vi={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:E.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},$i=()=>{const e=(0,a.useIntl)(),t=(0,c.jL)(),i=(0,r.useAbortController)(),[l,s]=(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:Vi,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)(()=>{l&&(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)}))},[l,i.signal,t,w]),(0,o.useEffect)(()=>{1===y.length&&x("provider",y[0].id)},[y,x]);const L=()=>s(!1),_=(0,o.useMemo)(()=>y.length>1,[y]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(zi,{children:(0,n.jsx)(_i,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>s(!0)})}),(0,n.jsx)(Ei,{open:l,radius:"small",closeHandler:L,children:(0,n.jsx)(ki,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:L,children:u?(0,n.jsx)(Ai,{size:"s"}):(0,n.jsxs)(n.Fragment,{children:[0===y.length&&(0,n.jsx)(Gi,{children:e.formatMessage({id:"Office_No_Providers"})}),(0,n.jsxs)(Ii,{isLocked:0===y.length,children:[_&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(Di,{children:[(0,n.jsx)(Ti,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_Provider"})}),(0,n.jsx)(Fi,{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)(Di,{children:[(0,n.jsx)(Ti,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Settings"})}),(0,n.jsx)(Wi,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),(0,n.jsx)(Wi,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),(0,n.jsx)(Mi,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}})]}),(0,n.jsxs)(Di,{children:[(0,n.jsx)(Ti,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_IMap_Mailbox"})}),(0,n.jsx)(Si,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),(0,n.jsx)(Fi,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:v[0],options:v,handleChange:e=>x("imapConnectionSecurity",e)}),(0,n.jsx)(Wi,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}})]}),(0,n.jsxs)(Di,{children:[(0,n.jsx)(Ti,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})}),(0,n.jsx)(Wi,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}})]}),(0,n.jsxs)(Di,{children:[(0,n.jsx)(Ti,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})}),(0,n.jsx)(Wi,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})]})]}),(0,n.jsx)(_i,{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(()=>{s(!1),g(!1),p()}))}})]})})})]})},Fi=({label:e,initialValue:t,options:i,handleChange:l})=>{const{control:s,watch:a}=(0,I.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,o.useEffect)(()=>{const e=a(e=>{e.provider&&e.provider.value&&l(e.provider.value)});return()=>e.unsubscribe()},[a,l]),(0,n.jsx)(qi,{label:e,name:"provider",options:i??[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:s,rules:{required:!0}})},Ri=u.j.getLazyComponent("ButtonDropdown"),Oi=u.j.getLazyComponent("Tooltip"),Bi=s().div`
383
+ `,Fi={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:E.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},Ri=()=>{const e=(0,a.useIntl)(),t=(0,c.jL)(),i=(0,r.useAbortController)(),[l,s]=(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:Fi,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)(()=>{l&&(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)}))},[l,i.signal,t,w]),(0,o.useEffect)(()=>{1===y.length&&x("provider",y[0].id)},[y,x]);const L=()=>s(!1),_=(0,o.useMemo)(()=>y.length>1,[y]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Di,{children:(0,n.jsx)(Si,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>s(!0)})}),(0,n.jsx)(_i,{open:l,radius:"small",closeHandler:L,children:(0,n.jsx)(Wi,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:L,children:u?(0,n.jsx)(zi,{size:"s"}):(0,n.jsxs)(n.Fragment,{children:[0===y.length&&(0,n.jsx)(Vi,{children:e.formatMessage({id:"Office_No_Providers"})}),(0,n.jsxs)(Gi,{isLocked:0===y.length,children:[_&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)($i,{children:[(0,n.jsx)(Ii,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_Provider"})}),(0,n.jsx)(Oi,{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)($i,{children:[(0,n.jsx)(Ii,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Settings"})}),(0,n.jsx)(qi,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),(0,n.jsx)(qi,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),(0,n.jsx)(Ai,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}})]}),(0,n.jsxs)($i,{children:[(0,n.jsx)(Ii,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_IMap_Mailbox"})}),(0,n.jsx)(Mi,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),(0,n.jsx)(Oi,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:v[0],options:v,handleChange:e=>x("imapConnectionSecurity",e)}),(0,n.jsx)(qi,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}})]}),(0,n.jsxs)($i,{children:[(0,n.jsx)(Ii,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})}),(0,n.jsx)(qi,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}})]}),(0,n.jsxs)($i,{children:[(0,n.jsx)(Ii,{size:"l",children:(0,n.jsx)(a.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})}),(0,n.jsx)(qi,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})]})]}),(0,n.jsx)(Si,{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(()=>{s(!1),g(!1),p()}))}})]})})})]})},Oi=({label:e,initialValue:t,options:i,handleChange:l})=>{const{control:s,watch:a}=(0,I.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,o.useEffect)(()=>{const e=a(e=>{e.provider&&e.provider.value&&l(e.provider.value)});return()=>e.unsubscribe()},[a,l]),(0,n.jsx)(Ti,{label:e,name:"provider",options:i??[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:s,rules:{required:!0}})},Bi=u.j.getLazyComponent("ButtonDropdown"),Hi=u.j.getLazyComponent("Tooltip"),Ui=s().div`
384
384
  margin-right: ${e=>e.theme.space.sm}px;
385
385
  button {
386
386
  background: ${e=>e.theme.color.white};
387
387
  }
388
- `,Hi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),l=(0,be.useDispatch)(),s=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{l(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Vi).finally(i)}}];return(0,n.jsx)(Ue,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(Bi,{children:(0,n.jsx)(Oi,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(Ri,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},Ui=u.j.getLazyComponent("WidgetContactCardDav"),Ni=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:l}=e,s=(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,l),be.shallowEqual),[h,f]=(0,o.useState)([]),j=(0,o.useCallback)((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Vi),t?window.location.reload():(r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1})))},[s,l]),y=(0,o.useCallback)(e=>{r(e),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))},[s,l]),b=(0,o.useCallback)(e=>s(d.x0.slice.actions.setWidgetState({uniqid:l,loading:e})),[l,s]),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(()=>{s(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1}))}).finally(()=>b(!1))},[b,s,l]);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)(Qe,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Hi,{uniqid:l,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Ke,{uniqid:l,children:[a&&(0,n.jsx)(Ui,{contactCardList:h}),void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)($i,{})]})})},Pi=u.j.getLazyComponent("ButtonDropdown"),Yi=u.j.getLazyComponent("Tooltip"),Qi=s().div`
388
+ `,Ni=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),l=(0,be.useDispatch)(),s=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{l(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Fi).finally(i)}}];return(0,n.jsx)(Ue,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(Ui,{children:(0,n.jsx)(Hi,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(Bi,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},Pi=u.j.getLazyComponent("WidgetContactCardDav"),Yi=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:l}=e,s=(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,l),be.shallowEqual),[h,f]=(0,o.useState)([]),j=(0,o.useCallback)((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Fi),t?window.location.reload():(r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1})))},[s,l]),y=(0,o.useCallback)(e=>{r(e),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))},[s,l]),b=(0,o.useCallback)(e=>s(d.x0.slice.actions.setWidgetState({uniqid:l,loading:e})),[l,s]),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(()=>{s(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1}))}).finally(()=>b(!1))},[b,s,l]);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)(Je,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Ni,{uniqid:l,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Ke,{uniqid:l,children:[a&&(0,n.jsx)(Pi,{contactCardList:h}),void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)(Ri,{})]})})},Ji=u.j.getLazyComponent("ButtonDropdown"),Qi=u.j.getLazyComponent("Tooltip"),Ki=s().div`
389
389
  margin-right: ${e=>e.theme.space.sm}px;
390
390
  button {
391
391
  background: ${e=>e.theme.color.white};
392
392
  }
393
- `,Ji=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),l=(0,be.useDispatch)(),s=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{l(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Vi).finally(i)}}];return(0,n.jsx)(Ue,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(Qi,{children:(0,n.jsx)(Yi,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(Pi,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},Ki=u.j.getLazyComponent("WidgetCalendarCalDav"),Xi=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:l}=e,s=(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,l),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(Vi),t?window.location.reload():(u(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1})))},[s,l]),b=(0,o.useCallback)(e=>{u(e),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))},[s,l]),C=(0,o.useCallback)(e=>s(d.x0.slice.actions.setWidgetState({uniqid:l,loading:e})),[l,s]),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(()=>{s(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),u(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1}))}).finally(()=>C(!1))},[C,s,l]);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)(Qe,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Ji,{uniqid:l,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>y(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Ke,{uniqid:l,children:[a&&(0,n.jsx)(Ki,{calendarListEvent:f}),void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)($i,{})]})})},Zi=u.j.getLazyComponent("ButtonDropdown"),en=u.j.getLazyComponent("Tooltip"),tn=s().div`
393
+ `,Xi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),l=(0,be.useDispatch)(),s=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{l(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Fi).finally(i)}}];return(0,n.jsx)(Ue,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(Ki,{children:(0,n.jsx)(Qi,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(Ji,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},Zi=u.j.getLazyComponent("WidgetCalendarCalDav"),en=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:l}=e,s=(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,l),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(Fi),t?window.location.reload():(u(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1})))},[s,l]),b=(0,o.useCallback)(e=>{u(e),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))},[s,l]),C=(0,o.useCallback)(e=>s(d.x0.slice.actions.setWidgetState({uniqid:l,loading:e})),[l,s]),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(()=>{s(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),u(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1}))}).finally(()=>C(!1))},[C,s,l]);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)(Je,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Xi,{uniqid:l,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>y(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Ke,{uniqid:l,children:[a&&(0,n.jsx)(Zi,{calendarListEvent:f}),void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)(Ri,{})]})})},tn=u.j.getLazyComponent("ButtonDropdown"),nn=u.j.getLazyComponent("Tooltip"),on=s().div`
394
394
  margin-right: ${e=>e.theme.space.sm}px;
395
395
  button {
396
396
  background: ${e=>e.theme.color.white};
397
397
  }
398
- `,nn=s().div`
398
+ `,ln=s().div`
399
399
  font-size: ${e=>e.theme.size.sm+4}px;
400
400
  color: ${e=>e.color};
401
- `,on=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),l=(0,c.jL)(),s=(0,c.GV)(t=>d.x0.selectors.selectWidgetChipCount(t,e),be.shallowEqual),r=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{l(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Vi).finally(i)}}];return(0,n.jsx)(Ue,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(tn,{children:(0,n.jsx)(en,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(Zi,{small:!0,smallOpenDirection:"left",options:r,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})}),subHeader:e=>t&&0!==s&&(0,n.jsxs)(nn,{color:e,children:["(",o.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:s}),")"]})})},ln=u.j.getLazyComponent("WidgetEmailsImap"),sn=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:l}=e,s=(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(Vi),t?window.location.reload():(r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1})))},[s,l]),y=(0,o.useCallback)(()=>{k().office.imapInboxGetUnreadEmailsCount().then(({result:e})=>{s(d.x0.slice.actions.setWidgetChipCount({uniqid:l,count:e})),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))}).catch(j)},[s,l,j]),b=(0,o.useCallback)(e=>s(d.x0.slice.actions.setWidgetState({uniqid:l,loading:e})),[l,s]),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),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))},[s,l]),w=(0,o.useCallback)(()=>{k().office.imapInboxGetEmails({limit:10}).then(({result:e})=>{p(e),g(!0)}).catch(()=>{s(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1}))}).finally(()=>b(!1))},[b,s,l]);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,s]),a&&f&&f!==E.WIDGET_LEVEL_3&&i?(0,n.jsx)(n.Fragment,{children:i(f,x??"")}):(0,n.jsx)(Qe,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(on,{uniqid:l,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Ke,{uniqid:l,children:[void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)($i,{}),a&&(0,n.jsx)(ln,{emailList:m})]})})},an=u.j.getLazyComponent("Html"),rn=s().div`
401
+ `,sn=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const o=(0,a.useIntl)(),l=(0,c.jL)(),s=(0,c.GV)(t=>d.x0.selectors.selectWidgetChipCount(t,e),be.shallowEqual),r=[{label:o.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{l(d.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Fi).finally(i)}}];return(0,n.jsx)(Ue,{uniqid:e,dropdown:()=>t&&(0,n.jsx)(on,{children:(0,n.jsx)(nn,{position:"left",description:o.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,n.jsx)(tn,{small:!0,smallOpenDirection:"left",options:r,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})}),subHeader:e=>t&&0!==s&&(0,n.jsxs)(ln,{color:e,children:["(",o.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:s}),")"]})})},an=u.j.getLazyComponent("WidgetEmailsImap"),rn=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:l}=e,s=(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(Fi),t?window.location.reload():(r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1})))},[s,l]),y=(0,o.useCallback)(()=>{k().office.imapInboxGetUnreadEmailsCount().then(({result:e})=>{s(d.x0.slice.actions.setWidgetChipCount({uniqid:l,count:e})),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))}).catch(j)},[s,l,j]),b=(0,o.useCallback)(e=>s(d.x0.slice.actions.setWidgetState({uniqid:l,loading:e})),[l,s]),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),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0}))},[s,l]),w=(0,o.useCallback)(()=>{k().office.imapInboxGetEmails({limit:10}).then(({result:e})=>{p(e),g(!0)}).catch(()=>{s(d.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),r(!1),s(d.x0.slice.actions.setWidgetState({uniqid:l,initialized:!0,loading:!1}))}).finally(()=>b(!1))},[b,s,l]);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,s]),a&&f&&f!==E.WIDGET_LEVEL_3&&i?(0,n.jsx)(n.Fragment,{children:i(f,x??"")}):(0,n.jsx)(Je,{header:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(sn,{uniqid:l,isConfigurationValid:void 0!==a&&!0===a,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,n.jsxs)(Ke,{uniqid:l,children:[void 0===a&&(0,n.jsx)(n.Fragment,{}),void 0!==a&&!1===a&&"view"===t&&(0,n.jsx)(Ri,{}),a&&(0,n.jsx)(an,{emailList:m})]})})},dn=u.j.getLazyComponent("Html"),cn=s().div`
402
402
  padding: ${e=>e.theme.space.md}px;
403
403
  border-bottom: 1px solid ${e=>e.theme.color.grey1};
404
- `,dn=({uniqid:e})=>{const t=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual),i=(0,l.useTheme)(),s=(0,c.GV)(t=>d.x0.selectors.selectWidgetTitleStyle(t,e),be.shallowEqual),a=(0,o.useMemo)(()=>({color:s&&s.color?String(s.color):i.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):i.color.white,fontSize:s&&s["font-size"]?`${s["font-size"]}px`:"24px",fontWeight:s&&s["font-weight"]?String(s["font-weight"]):"medium",textAlign:s&&s["text-align"]?String(s["text-align"]):"left"}),[s,i]),r=(0,o.useMemo)(()=>t&&"string"==typeof t.title&&0!==t.title.length?t.title:void 0,[t]);return r?(0,n.jsx)(rn,{style:{color:a.color,backgroundColor:a.backgroundColor,fontSize:a.fontSize,fontWeight:a.fontWeight,textAlign:a.textAlign},children:(0,n.jsx)(an,{as:"span",__html:r})}):(0,n.jsx)(n.Fragment,{})},cn=u.j.getLazyComponent("InputText"),un=({uniqid:e})=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),l=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e)?.title,be.shallowEqual),{control:s,watch:r}=(0,I.useForm)({defaultValues:{widgetTitle:l},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)(cn,{name:"widgetTitle",control:s,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},gn=u.j.getLazyComponent("Button"),mn=u.j.getLazyComponent("ModalLayout"),pn=u.j.getLazyComponent("ModalContent"),xn=u.j.getLazyComponent("IconButton"),hn=s().div`
404
+ `,un=({uniqid:e})=>{const t=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual),i=(0,l.useTheme)(),s=(0,c.GV)(t=>d.x0.selectors.selectWidgetTitleStyle(t,e),be.shallowEqual),a=(0,o.useMemo)(()=>({color:s&&s.color?String(s.color):i.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):i.color.white,fontSize:s&&s["font-size"]?`${s["font-size"]}px`:"24px",fontWeight:s&&s["font-weight"]?String(s["font-weight"]):"medium",textAlign:s&&s["text-align"]?String(s["text-align"]):"left"}),[s,i]),r=(0,o.useMemo)(()=>t&&"string"==typeof t.title&&0!==t.title.length?t.title:void 0,[t]);return r?(0,n.jsx)(cn,{style:{color:a.color,backgroundColor:a.backgroundColor,fontSize:a.fontSize,fontWeight:a.fontWeight,textAlign:a.textAlign},children:(0,n.jsx)(dn,{as:"span",__html:r})}):(0,n.jsx)(n.Fragment,{})},gn=u.j.getLazyComponent("InputText"),mn=({uniqid:e})=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),l=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e)?.title,be.shallowEqual),{control:s,watch:r}=(0,I.useForm)({defaultValues:{widgetTitle:l},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)(gn,{name:"widgetTitle",control:s,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},pn=u.j.getLazyComponent("Button"),xn=u.j.getLazyComponent("ModalLayout"),hn=u.j.getLazyComponent("ModalContent"),fn=u.j.getLazyComponent("IconButton"),jn=s().div`
405
405
  padding: ${e=>e.theme.space.md}px;
406
406
  display: flex;
407
407
  flex-direction: row-reverse;
408
- `,fn=s().div`
408
+ `,yn=s().div`
409
409
  flex: 1;
410
410
  display: flex;
411
411
  flex-direction: row;
412
412
  gap: ${e=>e.theme.space.sm}px;
413
413
  padding: ${e=>e.theme.space.sm}px;
414
414
  border-bottom: 1px solid ${e=>e.theme.color.grey1};
415
- `,jn=s().div`
415
+ `,bn=s().div`
416
416
  flex: 1;
417
417
  display: flex;
418
418
  fieldset:first-of-type {
419
419
  margin: 0px !important;
420
420
  }
421
- `,yn=s().div`
421
+ `,Cn=s().div`
422
422
  display: flex;
423
423
  gap: ${e=>e.theme.space.sm}px;
424
- `,bn=({uniqid:e,name:t,handleOpenEditor:i})=>{const l=(0,c.jL)(),s=(0,a.useIntl)(),[r,u]=(0,o.useState)(!1),g=(0,o.useCallback)(()=>{l(d.cr.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))},[e,l,t]),m=(0,o.useCallback)(()=>{l(d.x0.slice.actions.flushWidget({uniqid:e}))},[e,l]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(fn,{children:[(0,n.jsx)(jn,{children:(0,n.jsx)(un,{uniqid:e})}),(0,n.jsxs)(yn,{children:[(0,n.jsx)(xn,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:i??g,title:s.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),(0,n.jsx)(xn,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>u(!0),title:s.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})})]})]}),r&&(0,n.jsxs)(mn,{enableClickAwayCloseModal:!0,open:r,closeHandler:()=>u(!1),children:[(0,n.jsx)(pn,{overflow:"scroll",title:s.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1),children:s.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})}),(0,n.jsx)(hn,{children:(0,n.jsx)(gn,{label:s.formatMessage({id:"GLOBAL_Confirm"}),onClick:m})})]})]})},Cn=s().div`
424
+ `,vn=({uniqid:e,name:t,handleOpenEditor:i})=>{const l=(0,c.jL)(),s=(0,a.useIntl)(),[r,u]=(0,o.useState)(!1),g=(0,o.useCallback)(()=>{l(d.cr.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))},[e,l,t]),m=(0,o.useCallback)(()=>{l(d.x0.slice.actions.flushWidget({uniqid:e}))},[e,l]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(yn,{children:[(0,n.jsx)(bn,{children:(0,n.jsx)(mn,{uniqid:e})}),(0,n.jsxs)(Cn,{children:[(0,n.jsx)(fn,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:i??g,title:s.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),(0,n.jsx)(fn,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>u(!0),title:s.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})})]})]}),r&&(0,n.jsxs)(xn,{enableClickAwayCloseModal:!0,open:r,closeHandler:()=>u(!1),children:[(0,n.jsx)(hn,{overflow:"scroll",title:s.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1),children:s.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})}),(0,n.jsx)(jn,{children:(0,n.jsx)(pn,{label:s.formatMessage({id:"GLOBAL_Confirm"}),onClick:m})})]})]})},wn=s().div`
425
425
  position: absolute;
426
426
  inset: 0;
427
427
  display: flex;
428
428
  align-items: center;
429
429
  justify-content: center;
430
430
  color: ${e=>e.theme.color.orange};
431
- `,vn=({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)(Cn,{children:o.formatMessage({id:"WIDGET_Missing_License"},{label:"label"in i?i.label:""})}):(0,n.jsx)(n.Fragment,{children:e})},wn=s().div`
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=s().div`
432
432
  display: flex;
433
433
  flex: 1;
434
434
  flex-direction: column;
435
- `,Ln=({widget:e,width:t,inplace:i=!1,mode:o="view",onWidgetUpdate:l,cannotDisplayComponent:s,levelFallback:a,dataCy:r})=>{const{name:d}=e;return(0,E.ensureWidgetArticleButtonType)(e)?(0,n.jsx)(Ae,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleGalleryType)(e)?(0,n.jsx)(Ve,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetLuccaAbsenceType)(e)?(0,n.jsx)(wn,{children:(0,n.jsx)(vn,{name:"LuccaAbsenceHook",children:(0,n.jsx)(tt,{uniqid:e.uniqid})})}):(0,E.ensureWidgetArticleAttachmentType)(e)?(0,n.jsx)(Se,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleImageType)(e)?(0,n.jsx)(dt,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleSliderType)(e)?(0,n.jsx)(ht,{widget:e,inplace:i,mode:o,width:t??800}):(0,E.ensureWidgetArticleTitleType)(e)?(0,n.jsx)(Wt,{widget:e,inplace:i,mode:o,dataCy:r}):(0,E.ensureWidgetArticleTextType)(e)?(0,n.jsx)(wt,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetExcelDatasourceTableType)(e)?(0,n.jsxs)(wn,{children:[(0,n.jsx)(dn,{uniqid:e.uniqid}),(0,n.jsx)(di,{...e.content,uniqid:e.uniqid,mode:o})]}):(0,E.ensureWidgetDatasourceTableType)(e)?(0,n.jsxs)(wn,{children:[(0,n.jsx)(dn,{uniqid:e.uniqid}),(0,n.jsx)(oi,{...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)(bn,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(dn,{uniqid:e.uniqid}),(0,n.jsx)(Xt,{widget:e,inplace:i,mode:o,onWidgetUpdate:l})]}):(0,E.ensureWidgetPresenceType)(e)?(0,n.jsxs)(wn,{children:["edit"===o?(0,n.jsx)(bn,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(dn,{uniqid:e.uniqid}),(0,n.jsx)(ji,{widget:e,inplace:i,mode:o})]}):(0,E.ensureWidgetQuickSurveyType)(e)?(0,n.jsxs)(wn,{children:["edit"===o?(0,n.jsx)(bn,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(dn,{uniqid:e.uniqid}),(0,n.jsx)(Li,{widget:e,inplace:i,mode:o})]}):(0,E.ensureWidgetCalendarCalDavType)(e)?(0,n.jsx)(wn,{children:(0,n.jsx)(vn,{name:"OfficeHook",children:(0,n.jsx)(Xi,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetContactCardDavType)(e)?(0,n.jsx)(wn,{children:(0,n.jsx)(vn,{name:"OfficeHook",children:(0,n.jsx)(Ni,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetEmailsImapType)(e)?(0,n.jsx)(wn,{children:(0,n.jsx)(vn,{name:"OfficeHook",children:(0,n.jsx)(sn,{widget:e,inplace:i,mode:o,levelFallback:a})})}):s?(0,n.jsx)(n.Fragment,{children:s(d)}):(0,n.jsxs)(n.Fragment,{children:["cannot display widget (",d,")"]})},En=s().div`
435
+ `,kn=({widget:e,width:t,inplace:i=!1,mode:o="view",onWidgetUpdate:l,cannotDisplayComponent:s,levelFallback:a,dataCy:r})=>{const{name:d}=e;return(0,E.ensureWidgetArticleButtonType)(e)?(0,n.jsx)(Ae,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleGalleryType)(e)?(0,n.jsx)(Ve,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetLuccaAbsenceType)(e)?(0,n.jsx)(En,{children:(0,n.jsx)(Ln,{name:"LuccaAbsenceHook",children:(0,n.jsx)(tt,{uniqid:e.uniqid})})}):(0,E.ensureWidgetArticleAttachmentType)(e)?(0,n.jsx)(Se,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleImageType)(e)?(0,n.jsx)(dt,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetArticleSliderType)(e)?(0,n.jsx)(ht,{widget:e,inplace:i,mode:o,width:t??800}):(0,E.ensureWidgetArticleTitleType)(e)?(0,n.jsx)(Wt,{widget:e,inplace:i,mode:o,dataCy:r}):(0,E.ensureWidgetArticleTextType)(e)?(0,n.jsx)(wt,{widget:e,inplace:i,mode:o}):(0,E.ensureWidgetExcelDatasourceTableType)(e)?(0,n.jsxs)(En,{children:[(0,n.jsx)(un,{uniqid:e.uniqid}),(0,n.jsx)(di,{...e.content,uniqid:e.uniqid,mode:o})]}):(0,E.ensureWidgetDatasourceTableType)(e)?(0,n.jsxs)(En,{children:[(0,n.jsx)(un,{uniqid:e.uniqid}),(0,n.jsx)(oi,{...e.content,uniqid:e.uniqid,mode:o})]}):(0,E.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?(0,n.jsxs)(En,{children:["edit"===o?(0,n.jsx)(vn,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(un,{uniqid:e.uniqid}),(0,n.jsx)(Xt,{widget:e,inplace:i,mode:o,onWidgetUpdate:l})]}):(0,E.ensureWidgetPresenceType)(e)?(0,n.jsxs)(En,{children:["edit"===o?(0,n.jsx)(vn,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(un,{uniqid:e.uniqid}),(0,n.jsx)(ji,{widget:e,inplace:i,mode:o})]}):(0,E.ensureWidgetQuickSurveyType)(e)?(0,n.jsxs)(En,{children:["edit"===o?(0,n.jsx)(vn,{name:e.name,uniqid:e.uniqid}):(0,n.jsx)(un,{uniqid:e.uniqid}),(0,n.jsx)(Li,{widget:e,inplace:i,mode:o})]}):(0,E.ensureWidgetCalendarCalDavType)(e)?(0,n.jsx)(En,{children:(0,n.jsx)(Ln,{name:"OfficeHook",children:(0,n.jsx)(en,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetContactCardDavType)(e)?(0,n.jsx)(En,{children:(0,n.jsx)(Ln,{name:"OfficeHook",children:(0,n.jsx)(Yi,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetEmailsImapType)(e)?(0,n.jsx)(En,{children:(0,n.jsx)(Ln,{name:"OfficeHook",children:(0,n.jsx)(rn,{widget:e,inplace:i,mode:o,levelFallback:a})})}):(0,E.ensureWidgetUserProfileType)(e,!0)?(0,n.jsx)(En,{children:(0,n.jsx)(ki,{widget:e,inplace:i,mode:o})}):s?(0,n.jsx)(n.Fragment,{children:s(d)}):(0,n.jsxs)(n.Fragment,{children:["cannot display widget (",d,")"]})},_n=s().div`
436
436
  position: absolute;
437
437
  inset: 0;
438
438
  opacity: ${e=>e.opacity};
439
439
  background-color: ${e=>e.backgroundColor};
440
440
  pointer-events: ${e=>e.pointerEvents};
441
- `,kn=u.j.getLazyComponent("DoubleClick"),_n=({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)(Wn,{uniqid:e,mode:"edit"},t))})},Wn=({uniqid:e,mode:t})=>{const i=(0,c.GV)(t=>t.widgets.layers[e]);return"view"===t?(0,n.jsx)(En,{opacity:1,backgroundColor:"transparent",pointerEvents:"none",children:i.widgets.map((e,t)=>(0,n.jsx)(Sn,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"},t))}):(0,n.jsx)(En,{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)(Sn,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"},t))})},Sn=({uniqid:e,layerId:t,mode:i})=>{const o=(0,c.jL)(),l=(0,c.GV)(t=>t.widgets.ids[e],be.shallowEqual),s=(0,c.GV)(e=>e.widgets.layers[t]);return l&&s&&s.position?"view"===i?(0,n.jsx)("div",{style:{position:"absolute",top:s.position.y,left:s.position.x},children:(0,n.jsx)(On,{uniqid:e,widget:l,mode:i,inplace:!0,context:"article"})}):(0,n.jsx)(qn,{position:{x:s.position.x,y:s.position.y},onMouseUp:e=>{(s.position&&s.position.x!==e.x||s.position&&s.position.y!==e.y)&&(e=>{o(d.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)},children:(0,n.jsx)(kn,{onDoubleTap:()=>((e,t)=>{o(d.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(l.widget.uniqid,l.widget.name),children:(0,n.jsx)(On,{uniqid:e,widget:l,mode:i,inplace:!0,context:"article"})})}):(0,n.jsx)(n.Fragment,{})},qn=({position:e,children:t,onMouseUp:i})=>{const[l,s]=(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=>{s(!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(l&&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,l,d.x,d.y]),h=(0,o.useCallback)(()=>{s(!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})},Mn=u.j.getLazyComponent("Loader"),Tn=({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)(Mn,{})}):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,{})},An=u.j.getLazyComponent("Html"),In=s().button`
441
+ `,Wn=u.j.getLazyComponent("DoubleClick"),Sn=({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)(qn,{uniqid:e,mode:"edit"},t))})},qn=({uniqid:e,mode:t})=>{const i=(0,c.GV)(t=>t.widgets.layers[e]);return"view"===t?(0,n.jsx)(_n,{opacity:1,backgroundColor:"transparent",pointerEvents:"none",children:i.widgets.map((e,t)=>(0,n.jsx)(Mn,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"},t))}):(0,n.jsx)(_n,{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)(Mn,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"},t))})},Mn=({uniqid:e,layerId:t,mode:i})=>{const o=(0,c.jL)(),l=(0,c.GV)(t=>t.widgets.ids[e],be.shallowEqual),s=(0,c.GV)(e=>e.widgets.layers[t]);return l&&s&&s.position?"view"===i?(0,n.jsx)("div",{style:{position:"absolute",top:s.position.y,left:s.position.x},children:(0,n.jsx)(Hn,{uniqid:e,widget:l,mode:i,inplace:!0,context:"article"})}):(0,n.jsx)(Tn,{position:{x:s.position.x,y:s.position.y},onMouseUp:e=>{(s.position&&s.position.x!==e.x||s.position&&s.position.y!==e.y)&&(e=>{o(d.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)},children:(0,n.jsx)(Wn,{onDoubleTap:()=>((e,t)=>{o(d.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(l.widget.uniqid,l.widget.name),children:(0,n.jsx)(Hn,{uniqid:e,widget:l,mode:i,inplace:!0,context:"article"})})}):(0,n.jsx)(n.Fragment,{})},Tn=({position:e,children:t,onMouseUp:i})=>{const[l,s]=(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=>{s(!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(l&&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,l,d.x,d.y]),h=(0,o.useCallback)(()=>{s(!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})},An=u.j.getLazyComponent("Loader"),In=({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)(An,{})}):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,{})},zn=u.j.getLazyComponent("Html"),Gn=s().button`
442
442
  position: absolute;
443
443
  inset: 0;
444
444
  display: flex;
@@ -456,10 +456,10 @@
456
456
  }
457
457
 
458
458
  ${(0,r.DashedFocusBorder)()}
459
- `,zn=({uniqid:e,name:t})=>{const i=(0,c.jL)(),l=(0,a.useIntl)(),s=(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)(In,{onClick:s,children:(0,n.jsx)(An,{__html:`${l.formatMessage({id:"WIDGET_Set_Widget"})} <b>${l.formatMessage({id:r.label})}</b>`})})},Gn=s().div`
459
+ `,Dn=({uniqid:e,name:t})=>{const i=(0,c.jL)(),l=(0,a.useIntl)(),s=(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)(Gn,{onClick:s,children:(0,n.jsx)(zn,{__html:`${l.formatMessage({id:"WIDGET_Set_Widget"})} <b>${l.formatMessage({id:r.label})}</b>`})})},Vn=s().div`
460
460
  display: flex;
461
461
  flex-direction: column;
462
- `,Dn=({uniqid:e,onClick:t,children:i})=>{const s=(0,l.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):s.color.black,backgroundColor:a&&a["background-color"]?String(a["background-color"]):s.color.white,borderRadius:a&&a["border-radius"]?`${a["border-radius"]}px`:"0px",borderColor:a["border-color"]?String(a["border-color"]):s.color.black,borderWidth:a["border-width"]?`${a["border-width"]}px`:"0px",borderStyle:a["border-style"]?String(a["border-style"]):"none"}),[a,s]);return(0,n.jsx)(Gn,{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})},Vn=u.j.getLazyComponent("WidgetIcon"),$n=s().a`
462
+ `,$n=({uniqid:e,onClick:t,children:i})=>{const s=(0,l.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):s.color.black,backgroundColor:a&&a["background-color"]?String(a["background-color"]):s.color.white,borderRadius:a&&a["border-radius"]?`${a["border-radius"]}px`:"0px",borderColor:a["border-color"]?String(a["border-color"]):s.color.black,borderWidth:a["border-width"]?`${a["border-width"]}px`:"0px",borderStyle:a["border-style"]?String(a["border-style"]):"none"}),[a,s]);return(0,n.jsx)(Vn,{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})},Fn=u.j.getLazyComponent("WidgetIcon"),Rn=s().a`
463
463
  position: absolute;
464
464
  top: 0;
465
465
  right: 0;
@@ -475,21 +475,21 @@
475
475
  background-color: rgba(0, 0, 0, 0.1);
476
476
  color: ${e=>e.color?e.color:e.theme.color.black};
477
477
  }
478
- `,Fn=({uniqid:e,name:t,url:i,level:o})=>{const l=d.x0.definition(t),s=(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)($n,{href:i,target:"_blank",color:String(a.color)??void 0,rel:"noreferrer","aria-label":l.label,children:(0,n.jsx)(Vn,{count:s,img:l.img,label:l.label,maxValue:999})})},Rn=({uniqid:e,widgetObject:t,widget:i,inplace:l=!0,mode:s,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"===s)return;p(d.cr.slice.actions.flushAllEditor());const{widget:e}=x;p(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))},[p,s,x]);return void 0===x?(0,n.jsx)(n.Fragment,{children:"This widget cannot be displayed"}):l&&"view"!==s?(0,n.jsxs)(Dn,{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)(Ln,{dataCy:m,width:a,widget:{...x.widget,...x.title&&{title:x.title}},inplace:l,mode:s,levelFallback:(e,t)=>e<=2&&(0,n.jsx)(Fn,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,n.jsx)(_n,{uniqid:e,mode:s}),(0,n.jsx)(Tn,{name:x.widget.name,uniqid:x.widget.uniqid,inplace:l})]}):(0,n.jsxs)(Dn,{uniqid:e,onClick:C,children:[(0,n.jsx)(Ln,{dataCy:m,widget:{...x.widget,...x.title&&{title:x.title}},inplace:l,mode:s,width:a,onWidgetUpdate:u,cannotDisplayComponent:g,levelFallback:(e,t)=>e<=2&&(0,n.jsx)(Fn,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,n.jsx)(_n,{uniqid:e,mode:s}),"edit"===s&&(0,n.jsx)(zn,{uniqid:e,name:i.widget.name}),(0,n.jsx)(Tn,{name:x.widget.name,uniqid:x.widget.uniqid,inplace:l})]})},On=Rn,Bn=s().div`
478
+ `,On=({uniqid:e,name:t,url:i,level:o})=>{const l=d.x0.definition(t),s=(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)(Rn,{href:i,target:"_blank",color:String(a.color)??void 0,rel:"noreferrer","aria-label":l.label,children:(0,n.jsx)(Fn,{count:s,img:l.img,label:l.label,maxValue:999})})},Bn=({uniqid:e,widgetObject:t,widget:i,inplace:l=!0,mode:s,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"===s)return;p(d.cr.slice.actions.flushAllEditor());const{widget:e}=x;p(d.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))},[p,s,x]);return void 0===x?(0,n.jsx)(n.Fragment,{children:"This widget cannot be displayed"}):l&&"view"!==s?(0,n.jsxs)($n,{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)(kn,{dataCy:m,width:a,widget:{...x.widget,...x.title&&{title:x.title}},inplace:l,mode:s,levelFallback:(e,t)=>e<=2&&(0,n.jsx)(On,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,n.jsx)(Sn,{uniqid:e,mode:s}),(0,n.jsx)(In,{name:x.widget.name,uniqid:x.widget.uniqid,inplace:l})]}):(0,n.jsxs)($n,{uniqid:e,onClick:C,children:[(0,n.jsx)(kn,{dataCy:m,widget:{...x.widget,...x.title&&{title:x.title}},inplace:l,mode:s,width:a,onWidgetUpdate:u,cannotDisplayComponent:g,levelFallback:(e,t)=>e<=2&&(0,n.jsx)(On,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,n.jsx)(Sn,{uniqid:e,mode:s}),"edit"===s&&(0,n.jsx)(Dn,{uniqid:e,name:i.widget.name}),(0,n.jsx)(In,{name:x.widget.name,uniqid:x.widget.uniqid,inplace:l})]})},Hn=Bn,Un=s().div`
479
479
  border-radius: ${e=>e.theme.space.sm}px;
480
480
  border: 1px solid ${e=>e.theme.color.grey1};
481
481
  background-color: ${e=>e.theme.color.white};
482
482
  overflow: hidden;
483
- `,Hn=u.j.getLazyComponent("Message"),Un=({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)(Bn,{children:(0,n.jsx)(On,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>(0,n.jsx)(Hn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},Nn=u.j.getLazyComponent("Message"),Pn=e=>{const t=(0,a.useIntl)(),{widgets:i,comment:o,inplace:l,mode:s,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)(Bn,{children:(0,n.jsx)(On,{uniqid:e.widget.uniqid,widgetObject:o,widget:e,inplace:l,mode:s,onWidgetUpdate:r,cannotDisplayComponent:e=>(0,n.jsx)(Nn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},Yn=u.j.getLazyComponent("JRCCommentsBloc"),Qn=s().div`
483
+ `,Nn=u.j.getLazyComponent("Message"),Pn=({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)(Un,{children:(0,n.jsx)(Hn,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>(0,n.jsx)(Nn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},Yn=u.j.getLazyComponent("Message"),Jn=e=>{const t=(0,a.useIntl)(),{widgets:i,comment:o,inplace:l,mode:s,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)(Un,{children:(0,n.jsx)(Hn,{uniqid:e.widget.uniqid,widgetObject:o,widget:e,inplace:l,mode:s,onWidgetUpdate:r,cannotDisplayComponent:e=>(0,n.jsx)(Yn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},Qn=u.j.getLazyComponent("JRCCommentsBloc"),Kn=s().div`
484
484
  display: flex;
485
485
  flex-direction: column;
486
486
  gap: 4px;
487
487
  flex: 1;
488
488
  width: 100%;
489
489
  margin-top: 10px;
490
- `,Jn=({articleId:e,variant:t="inline",canComment:i,commentType:s="comment",socialQuestion:r,articleUri:u})=>{const g=(0,a.useIntl)(),m=(0,l.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")),T=(0,c.GV)(e=>d.lg.selectors.selectById(e,"FileBankHook")),A=(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();(0,te.A)(e),((e,t)=>{const i=(0,c.jL)(),n=(0,o.useMemo)(()=>ie.A,[]),l=(0,o.useMemo)(()=>d.Mw.getCommentsLikeRTHandlers(i,e,t),[i,e,t]);(0,o.useEffect)(()=>(l.forEach(e=>{n.onMessage(e.namespace,e.function,e.handler)}),()=>{l.forEach(e=>{n.offMessage(e.namespace,e.function,e.handler)})}),[l,n])})(q.map(e=>e.id),e);const B=(0,o.useCallback)(e=>{p(d.y8.actions.error({label:e??g.formatMessage({id:"GLOBAL_Error"})}))},[p,g]),H=()=>{p(d.Mw.actions.fetchComments({idArticle:e})),U()},U=(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=>{B(e.errorMsg)}))},[B,x,C,p]),N=(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:s}).then(()=>{b([])}),U()}catch(e){throw B(e.errorMsg),e}finally{j(!1)}}},[e,s,U,B,x,L,y]);return(0,o.useEffect)(()=>{U()},[U]),(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)(Qn,{children:(0,n.jsx)(Yn,{canComment:i,loading:f,token:x,comments:q,onComment:N,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})),U()}).catch(e=>{B(e.errorMsg)})},onCommentDelete:async t=>{p(d.Mw.actions.deleteComment({idComment:t,idArticle:e}))},isWidgetActive:!(!A?.isActive||!A?.autorize?.includes("comment")),canCreateWidget:!!(A?.isActive&&A?.create&&A?.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),U()},view:"edit"}),newWidgetsWrapperComponent:(0,n.jsx)(Un,{widgets:y}),existingWidgetsWrapperComponent:(e,t,i,o=!0)=>(0,n.jsx)(Pn,{comment:e,widgets:t,mode:i,inplace:o,handleWidgetUpdate:H,handleWidgetRemove:U}),currentUser:w,tinyMCEConfig:{commonOptions:{...E,toolbar:_.commentsToolbar},mentionsQueries:(0,ye.X)(W,m,B)},onError:B,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:[...T&&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],onReport:t=>D({articleId:e,commentUri:t,articleUri:u})})})}),O&&(0,n.jsx)(bt,{onInsert:$,open:V,close:F}),G&&(0,n.jsx)(Z,{onClose:()=>D(null),...G})]})},Kn=s().li`
490
+ `,Xn=({articleId:e,variant:t="inline",canComment:i,commentType:s="comment",socialQuestion:r,articleUri:u})=>{const g=(0,a.useIntl)(),m=(0,l.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")),T=(0,c.GV)(e=>d.lg.selectors.selectById(e,"FileBankHook")),A=(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();(0,te.A)(e),((e,t)=>{const i=(0,c.jL)(),n=(0,o.useMemo)(()=>ie.A,[]),l=(0,o.useMemo)(()=>d.Mw.getCommentsLikeRTHandlers(i,e,t),[i,e,t]);(0,o.useEffect)(()=>(l.forEach(e=>{n.onMessage(e.namespace,e.function,e.handler)}),()=>{l.forEach(e=>{n.offMessage(e.namespace,e.function,e.handler)})}),[l,n])})(q.map(e=>e.id),e);const B=(0,o.useCallback)(e=>{p(d.y8.actions.error({label:e??g.formatMessage({id:"GLOBAL_Error"})}))},[p,g]),H=()=>{p(d.Mw.actions.fetchComments({idArticle:e})),U()},U=(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=>{B(e.errorMsg)}))},[B,x,C,p]),N=(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:s}).then(()=>{b([])}),U()}catch(e){throw B(e.errorMsg),e}finally{j(!1)}}},[e,s,U,B,x,L,y]);return(0,o.useEffect)(()=>{U()},[U]),(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)(Kn,{children:(0,n.jsx)(Qn,{canComment:i,loading:f,token:x,comments:q,onComment:N,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})),U()}).catch(e=>{B(e.errorMsg)})},onCommentDelete:async t=>{p(d.Mw.actions.deleteComment({idComment:t,idArticle:e}))},isWidgetActive:!(!A?.isActive||!A?.autorize?.includes("comment")),canCreateWidget:!!(A?.isActive&&A?.create&&A?.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),U()},view:"edit"}),newWidgetsWrapperComponent:(0,n.jsx)(Pn,{widgets:y}),existingWidgetsWrapperComponent:(e,t,i,o=!0)=>(0,n.jsx)(Jn,{comment:e,widgets:t,mode:i,inplace:o,handleWidgetUpdate:H,handleWidgetRemove:U}),currentUser:w,tinyMCEConfig:{commonOptions:{...E,toolbar:_.commentsToolbar},mentionsQueries:(0,ye.X)(W,m,B)},onError:B,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:[...T&&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],onReport:t=>D({articleId:e,commentUri:t,articleUri:u})})})}),O&&(0,n.jsx)(bt,{onInsert:$,open:V,close:F}),G&&(0,n.jsx)(Z,{onClose:()=>D(null),...G})]})},Zn=s().li`
491
491
  list-style: none;
492
- `,Xn=s().a`
492
+ `,eo=s().a`
493
493
  display: flex;
494
494
  align-items: center;
495
495
  gap: ${({theme:e})=>e.space.sm}px;
@@ -504,25 +504,25 @@
504
504
  background-color: ${({theme:e})=>e.color.grey1};
505
505
  color: ${({theme:e})=>e.font.color};
506
506
  }
507
- `,Zn=u.j.getLazyComponent("Icon"),eo=u.j.getLazyComponent("FlexBox"),to=u.j.getLazyComponent("Typography"),io=u.j.getLazyComponent("DropDown"),no=()=>{const e=(0,l.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")),s=(0,c.GV)(e=>d.lg.selectors.selectById(e,"SurveyDateHook"));return o?(0,n.jsxs)(eo,{y:"center",children:[(0,n.jsx)(Zn,{name:"icon-"+o.icon,variant:"circle",color:o.color,size:40}),(0,n.jsx)(to,{variant:"h1",size:"xl",weight:"medium",children:o.label}),(s||i)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(to,{size:"xl",color:"grey4",children:"/"}),(0,n.jsx)(io,{withBorder:!0,borderColor:"grey3",trigger:(0,n.jsxs)(eo,{y:"center",gap:e.space.xs,children:[(0,n.jsx)(to,{size:"xl",color:"grey4",children:t.formatMessage({id:"CALENDAR_Agenda"})}),(0,n.jsx)(Zn,{name:"icon-chevron-down",color:"grey4",size:16})]}),dropdown:()=>(0,n.jsxs)(eo,{direction:"column",gap:e.space.sm,as:"ul",children:[s&&(0,n.jsx)(Kn,{children:(0,n.jsxs)(Xn,{href:s.url,children:[(0,n.jsx)(Zn,{name:"icon-"+s.icon,size:25,variant:"circle",color:s.color}),(0,n.jsx)(to,{size:"l",children:s.label})]})}),i&&(0,n.jsx)(Kn,{children:(0,n.jsxs)(Xn,{href:i.url,children:[(0,n.jsx)(Zn,{name:"icon-"+i.icon,size:25,variant:"circle",color:i.color}),(0,n.jsx)(to,{size:"l",children:i.label})]})})]})})]})]}):null},oo=u.j.getLazyComponent("Typography"),lo=u.j.getLazyComponent("FlexBox"),so=u.j.getLazyComponent("ButtonDropdown"),ao=u.j.getLazyComponent("DropDown"),ro=u.j.getLazyComponent("IconButton"),co=u.j.getLazyComponent("InputSelectRaw"),uo=u.j.getLazyComponent("InputCheckboxRaw"),go=u.j.getLazyComponent("StyledHref"),mo=s()(oo)`
507
+ `,to=u.j.getLazyComponent("Icon"),io=u.j.getLazyComponent("FlexBox"),no=u.j.getLazyComponent("Typography"),oo=u.j.getLazyComponent("DropDown"),lo=()=>{const e=(0,l.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")),s=(0,c.GV)(e=>d.lg.selectors.selectById(e,"SurveyDateHook"));return o?(0,n.jsxs)(io,{y:"center",children:[(0,n.jsx)(to,{name:"icon-"+o.icon,variant:"circle",color:o.color,size:40}),(0,n.jsx)(no,{variant:"h1",size:"xl",weight:"medium",children:o.label}),(s||i)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(no,{size:"xl",color:"grey4",children:"/"}),(0,n.jsx)(oo,{withBorder:!0,borderColor:"grey3",trigger:(0,n.jsxs)(io,{y:"center",gap:e.space.xs,children:[(0,n.jsx)(no,{size:"xl",color:"grey4",children:t.formatMessage({id:"CALENDAR_Agenda"})}),(0,n.jsx)(to,{name:"icon-chevron-down",color:"grey4",size:16})]}),dropdown:()=>(0,n.jsxs)(io,{direction:"column",gap:e.space.sm,as:"ul",children:[s&&(0,n.jsx)(Zn,{children:(0,n.jsxs)(eo,{href:s.url,children:[(0,n.jsx)(to,{name:"icon-"+s.icon,size:25,variant:"circle",color:s.color}),(0,n.jsx)(no,{size:"l",children:s.label})]})}),i&&(0,n.jsx)(Zn,{children:(0,n.jsxs)(eo,{href:i.url,children:[(0,n.jsx)(to,{name:"icon-"+i.icon,size:25,variant:"circle",color:i.color}),(0,n.jsx)(no,{size:"l",children:i.label})]})})]})})]})]}):null},so=u.j.getLazyComponent("Typography"),ao=u.j.getLazyComponent("FlexBox"),ro=u.j.getLazyComponent("ButtonDropdown"),co=u.j.getLazyComponent("DropDown"),uo=u.j.getLazyComponent("IconButton"),go=u.j.getLazyComponent("InputSelectRaw"),mo=u.j.getLazyComponent("InputCheckboxRaw"),po=u.j.getLazyComponent("StyledHref"),xo=s()(so)`
508
508
  text-transform: capitalize;
509
509
  margin-right: ${({theme:e})=>e.space.md}px;
510
- `,po=s().div`
510
+ `,ho=s().div`
511
511
  max-width: 200px;
512
512
  display: flex;
513
513
  align-items: center;
514
- `,xo=s().div`
514
+ `,fo=s().div`
515
515
  padding: 0 ${({theme:e})=>e.space.md}px;
516
- `,ho=({label:e,view:t,viewsOptions:i,calendarApi:l,isLoading:s,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)(lo,{y:"center",children:["list"!==t.value&&(0,n.jsxs)(o.Fragment,{children:[(0,n.jsx)(mo,{size:"l",weight:"medium",children:e}),(0,n.jsxs)(lo,{children:[(0,n.jsx)(ro,{icon:"icon-chevron-left",onClick:()=>l?.prev(),color:"grey5"}),(0,n.jsx)(ro,{icon:"icon-chevron-right",onClick:()=>l?.next(),color:"grey5"})]}),(0,n.jsx)(ro,{icon:"icon-calendar",onClick:()=>l?.today(),tooltip:{description:"CALENDAR_Today",position:"bottom"},color:"grey5"})]}),(0,n.jsx)(po,{children:(0,n.jsx)(co,{onChange:u,value:t,name:"selectView",options:i,getLabel:e=>e.label,getValue:e=>e.value,required:!0,minWidth:!1,loading:s,noMargin:!0})}),(0,n.jsx)(so,{noMargin:!0,color:"primary",icon:"icon-plus",label:p.formatMessage({id:"GLOBAL_Add"}),options:C,dataCy:"calendar-create-dropdown"}),(0,n.jsx)(ao,{trigger:(0,n.jsx)(ro,{"aria-label":p.formatMessage({id:"GLOBAL_Filter"}),colorVariant:"light",icon:"icon-filter",badgeNumber:h.length}),dropdown:()=>(0,n.jsx)(xo,{children:(0,n.jsxs)(lo,{direction:"column",children:[(0,n.jsx)(oo,{weight:"medium",color:"primary",children:p.formatMessage({id:"GLOBAL_Filter"})}),(0,n.jsx)(uo,{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)(go,{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)(so,{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)}]})]})},fo=u.j.getLazyComponent("Calendar"),jo=s().div`
516
+ `,jo=({label:e,view:t,viewsOptions:i,calendarApi:l,isLoading:s,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)(ao,{y:"center",children:["list"!==t.value&&(0,n.jsxs)(o.Fragment,{children:[(0,n.jsx)(xo,{size:"l",weight:"medium",children:e}),(0,n.jsxs)(ao,{children:[(0,n.jsx)(uo,{icon:"icon-chevron-left",onClick:()=>l?.prev(),color:"grey5"}),(0,n.jsx)(uo,{icon:"icon-chevron-right",onClick:()=>l?.next(),color:"grey5"})]}),(0,n.jsx)(uo,{icon:"icon-calendar",onClick:()=>l?.today(),tooltip:{description:"CALENDAR_Today",position:"bottom"},color:"grey5"})]}),(0,n.jsx)(ho,{children:(0,n.jsx)(go,{onChange:u,value:t,name:"selectView",options:i,getLabel:e=>e.label,getValue:e=>e.value,required:!0,minWidth:!1,loading:s,noMargin:!0})}),(0,n.jsx)(ro,{noMargin:!0,color:"primary",icon:"icon-plus",label:p.formatMessage({id:"GLOBAL_Add"}),options:C,dataCy:"calendar-create-dropdown"}),(0,n.jsx)(co,{trigger:(0,n.jsx)(uo,{"aria-label":p.formatMessage({id:"GLOBAL_Filter"}),colorVariant:"light",icon:"icon-filter",badgeNumber:h.length}),dropdown:()=>(0,n.jsx)(fo,{children:(0,n.jsxs)(ao,{direction:"column",children:[(0,n.jsx)(so,{weight:"medium",color:"primary",children:p.formatMessage({id:"GLOBAL_Filter"})}),(0,n.jsx)(mo,{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)(po,{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)(ro,{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)}]})]})},yo=u.j.getLazyComponent("Calendar"),bo=s().div`
517
517
  margin-bottom: ${({theme:e})=>e.space.md}px;
518
- `,yo=s().div`
518
+ `,Co=s().div`
519
519
  height: 54px;
520
520
  display: flex;
521
521
  align-items: center;
522
522
  justify-content: space-between;
523
523
  ${({view:e,theme:t})=>"list"===e&&`border-bottom: 1px solid ${t.color.grey2};`}
524
524
  padding: 0 ${({theme:e})=>e.space.md}px;
525
- `,bo=[{label:"CALENDAR_dayGridMonth",value:"dayGridMonth"},{label:"CALENDAR_timeGridWeek",value:"timeGridWeek"},{label:"CALENDAR_timeGridDay",value:"timeGridDay"},{label:"CALENDAR_listWeek",value:"list"}],Co=({views:e=["dayGridMonth","list","timeGridDay","timeGridWeek"],mode:t="full",withPadding:i=!0,withHeader:l=!0,withToolbar:s=!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]),T=(0,o.useMemo)(()=>bo.filter(t=>e.includes(t.value)).map(e=>({label:p.formatMessage({id:e.label}),value:e.value})),[e,p]),[A,I]=(0,o.useState)(T.find(e=>e.value===M)??T[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}),(l||s)&&(0,n.jsxs)(yo,{view:A.value,children:[l&&(0,n.jsx)(no,{}),s&&(0,n.jsx)(ho,{label:f,isLoading:"pending"===b,view:A,calendarApi:w,viewsOptions:T,navigateWithQuery:z,setView:I,setCreationType:R,setExportModalOpen:S})]}),(0,n.jsx)(fo,{fluid:u,mode:t,fullScreen:!0,withPadding:i,events:C,loading:"pending"===b,handler:{global:k().global,calendar:k().calendar,article:k().article},defaultView:A.value,eventModalExtraComponent:({id:e,uri:t,_right:i})=>(0,n.jsx)(jo,{children:(0,n.jsx)(Jn,{articleId:e,articleUri:t,canComment:i.comment})}),deportedToolbar:{onChangeLabel:j,onCalendarApiInit:L,view:A},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})]})},vo=(s().div`
525
+ `,vo=[{label:"CALENDAR_dayGridMonth",value:"dayGridMonth"},{label:"CALENDAR_timeGridWeek",value:"timeGridWeek"},{label:"CALENDAR_timeGridDay",value:"timeGridDay"},{label:"CALENDAR_listWeek",value:"list"}],wo=({views:e=["dayGridMonth","list","timeGridDay","timeGridWeek"],mode:t="full",withPadding:i=!0,withHeader:l=!0,withToolbar:s=!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]),T=(0,o.useMemo)(()=>vo.filter(t=>e.includes(t.value)).map(e=>({label:p.formatMessage({id:e.label}),value:e.value})),[e,p]),[A,I]=(0,o.useState)(T.find(e=>e.value===M)??T[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}),(l||s)&&(0,n.jsxs)(Co,{view:A.value,children:[l&&(0,n.jsx)(lo,{}),s&&(0,n.jsx)(jo,{label:f,isLoading:"pending"===b,view:A,calendarApi:w,viewsOptions:T,navigateWithQuery:z,setView:I,setCreationType:R,setExportModalOpen:S})]}),(0,n.jsx)(yo,{fluid:u,mode:t,fullScreen:!0,withPadding:i,events:C,loading:"pending"===b,handler:{global:k().global,calendar:k().calendar,article:k().article},defaultView:A.value,eventModalExtraComponent:({id:e,uri:t,_right:i})=>(0,n.jsx)(bo,{children:(0,n.jsx)(Xn,{articleId:e,articleUri:t,canComment:i.comment})}),deportedToolbar:{onChangeLabel:j,onCalendarApiInit:L,view:A},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})]})},Lo=(s().div`
526
526
  margin-bottom: 24px;
527
527
  `,s().div`
528
528
  margin-bottom: 4px;
@@ -534,27 +534,27 @@
534
534
  flex: 1;
535
535
  display: flex;
536
536
  overflow: hidden;
537
- `),wo=s().div`
537
+ `),Eo=s().div`
538
538
  flex-direction: row;
539
539
  display: flex;
540
540
  min-height: 60px;
541
541
  border-bottom: 1px solid ${e=>e.theme.color.grey2};
542
- `,Lo=s().div`
542
+ `,ko=s().div`
543
543
  width: 60px;
544
544
  display: flex;
545
545
  align-items: center;
546
546
  justify-content: center;
547
- `,Eo=s().div`
547
+ `,_o=s().div`
548
548
  flex: 1;
549
549
  display: flex;
550
550
  align-items: center;
551
551
  justify-content: center;
552
- `,ko=s().div`
552
+ `,Wo=s().div`
553
553
  position: relative;
554
554
  overflow: hidden;
555
555
  top: 0px;
556
556
  width: ${460}px;
557
- `,_o=s().div`
557
+ `,So=s().div`
558
558
  position: absolute;
559
559
  top: 0;
560
560
  ${e=>"left"===e.position?"left: 0px;":""}
@@ -570,7 +570,7 @@
570
570
  &.animate {
571
571
  right: 0px;
572
572
  }
573
- `,Wo=s().div`
573
+ `,qo=s().div`
574
574
  flex: 1;
575
575
  display: flex;
576
576
  flex-direction: column;
@@ -578,29 +578,29 @@
578
578
  overflow: auto;
579
579
  margin-bottom: 12px;
580
580
  position: relative;
581
- `,So=s().div`
581
+ `,Mo=s().div`
582
582
  flex: 1;
583
583
  display: flex;
584
584
  flex-direction: column;
585
- `,qo=s().div`
585
+ `,To=s().div`
586
586
  position: absolute;
587
587
  inset: 0;
588
588
  background-color: rgba(255, 255, 255, 0.8);
589
589
  display: flex;
590
590
  align-items: center;
591
591
  justify-content: center;
592
- `,Mo=s().div`
592
+ `,Ao=s().div`
593
593
  position: absolute;
594
594
  inset: 0;
595
595
  background-color: ${e=>e.theme.color.white};
596
596
  padding: ${e=>e.theme.space.md}px;
597
- `,To=s().div`
597
+ `,Io=s().div`
598
598
  width: ${50}px;
599
599
  padding-top: 60px;
600
600
  display: flex;
601
601
  flex-direction: column;
602
602
  border-right: 1px solid ${e=>e.theme.color.grey2};
603
- `,Ao=s().button`
603
+ `,zo=s().button`
604
604
  border-radius: 4px;
605
605
  cursor: pointer;
606
606
  height: 42px;
@@ -616,7 +616,7 @@
616
616
  &:hover {
617
617
  background-color: ${e=>e.theme.color.grey2};
618
618
  }
619
- `,Io=(s().div`
619
+ `,Go=(s().div`
620
620
  display: flex;
621
621
  border: 1px solid ${e=>e.theme.color.grey1};
622
622
  border-radius: ${8}px;
@@ -651,35 +651,35 @@
651
651
  flex: 1;
652
652
  display: flex;
653
653
  align-items: center;
654
- `,u.j.getLazyComponent("Button")),zo=u.j.getLazyComponent("Icon"),Go=({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)(wo,{children:[(0,n.jsx)(Lo,{}),(0,n.jsx)(Eo,{children:"Popup"}),(0,n.jsx)(Lo,{children:(0,n.jsx)(Ao,{onClick:()=>{t(d.cr.slice.actions.flushEditorPopup({uniqid:e}))},children:(0,n.jsx)(zo,{name:"icon-times",color:"grey2",size:26.75})})})]}),(0,n.jsx)("div",{style:{flex:1,display:"flex"},children:i.view}),(0,n.jsx)(wo,{children:(0,n.jsx)(Io,{onClick:()=>{t(d.cr.slice.actions.flushEditorPopup({uniqid:e}))},children:"Save"})})]}):(0,n.jsx)(n.Fragment,{})};var Do=i(771);const Vo=u.j.getLazyComponent("WidgetArticleTitleEditor"),$o=u.j.getLazyComponent("WidgetArticleTextEditor"),Fo=u.j.getLazyComponent("WidgetArticleGalleryEditor"),Ro=u.j.getLazyComponent("WidgetArticleAttachmentEditor"),Oo=u.j.getLazyComponent("WidgetArticleSliderEditor"),Bo=u.j.getLazyComponent("WidgetArticleImageEditor"),Ho=u.j.getLazyComponent("WidgetButtonEditor"),Uo=u.j.getLazyComponent("WidgetCheckListEditor"),No=u.j.getLazyComponent("WidgetQuickSurveyEditor"),Po=u.j.getLazyComponent("WidgetDatasourceTableEditor"),Yo=u.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),Qo=u.j.getLazyComponent("WidgetPresenceEditor"),Jo=u.j.getLazyComponent("WidgetLuccaAbsenceEditor"),Ko=u.j.getLazyComponent("WidgetEmailsImapEditor"),Xo=u.j.getLazyComponent("WidgetContactCardDavEditor"),Zo=u.j.getLazyComponent("WidgetCalendarCalDavEditor"),el=({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),l=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e)?.onSave,be.shallowEqual),s=e=>d.qn.selectors.selectHook(Do.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})),l&&l(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)(Ho,{...m.content,onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:()=>a({})}):(0,E.ensureWidgetArticleGalleryType)(m)?(0,n.jsx)(Fo,{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)(Ro,{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)(Jo,{}):(0,E.ensureWidgetArticleImageType)(m)?(0,n.jsx)(Bo,{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)(Oo,{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)(Vo,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,content:m.content,onOpen:g}):(0,E.ensureWidgetArticleTextType)(m)?(0,n.jsx)($o,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,content:m.content}):(0,E.ensureWidgetPresenceType)(m)?(0,n.jsx)(Qo,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,onStateChange:u,...m.content}):(0,E.ensureWidgetCheckListType)(m)?(0,n.jsx)(Uo,{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)(No,{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)(Yo,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:s},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)(Ko,{}):(0,E.ensureWidgetContactCardDavType)(m)?(0,n.jsx)(Xo,{}):(0,E.ensureWidgetCalendarCalDavType)(m)?(0,n.jsx)(Zo,{}):(0,E.ensureWidgetDatasourceTableType)(m)?(0,n.jsx)(Po,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:s},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,n.jsx)(n.Fragment,{children:"cannot display editor"}):null},tl=u.j.getLazyComponent("Icon"),il=({uniqid:e,position:t})=>{const i=(0,c.jL)(),o=(0,l.useTheme)();return(0,n.jsx)(Lo,{children:(0,n.jsx)(Ao,{onClick:()=>{i(d.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))},children:(0,n.jsx)(tl,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:o.color.lavender,size:26.75})})})},nl=u.j.getLazyComponent("InputColorRaw"),ol=s().label`
654
+ `,u.j.getLazyComponent("Button")),Do=u.j.getLazyComponent("Icon"),Vo=({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)(Eo,{children:[(0,n.jsx)(ko,{}),(0,n.jsx)(_o,{children:"Popup"}),(0,n.jsx)(ko,{children:(0,n.jsx)(zo,{onClick:()=>{t(d.cr.slice.actions.flushEditorPopup({uniqid:e}))},children:(0,n.jsx)(Do,{name:"icon-times",color:"grey2",size:26.75})})})]}),(0,n.jsx)("div",{style:{flex:1,display:"flex"},children:i.view}),(0,n.jsx)(Eo,{children:(0,n.jsx)(Go,{onClick:()=>{t(d.cr.slice.actions.flushEditorPopup({uniqid:e}))},children:"Save"})})]}):(0,n.jsx)(n.Fragment,{})};var $o=i(771);const Fo=u.j.getLazyComponent("WidgetArticleTitleEditor"),Ro=u.j.getLazyComponent("WidgetArticleTextEditor"),Oo=u.j.getLazyComponent("WidgetArticleGalleryEditor"),Bo=u.j.getLazyComponent("WidgetArticleAttachmentEditor"),Ho=u.j.getLazyComponent("WidgetArticleSliderEditor"),Uo=u.j.getLazyComponent("WidgetArticleImageEditor"),No=u.j.getLazyComponent("WidgetButtonEditor"),Po=u.j.getLazyComponent("WidgetCheckListEditor"),Yo=u.j.getLazyComponent("WidgetQuickSurveyEditor"),Jo=u.j.getLazyComponent("WidgetDatasourceTableEditor"),Qo=u.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),Ko=u.j.getLazyComponent("WidgetPresenceEditor"),Xo=u.j.getLazyComponent("WidgetLuccaAbsenceEditor"),Zo=u.j.getLazyComponent("WidgetEmailsImapEditor"),el=u.j.getLazyComponent("WidgetContactCardDavEditor"),tl=u.j.getLazyComponent("WidgetCalendarCalDavEditor"),il=u.j.getLazyComponent("WidgetUserProfileEditor"),nl=({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),l=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e)?.onSave,be.shallowEqual),s=e=>d.qn.selectors.selectHook($o.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})),l&&l(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)(No,{...m.content,onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:()=>a({})}):(0,E.ensureWidgetArticleGalleryType)(m)?(0,n.jsx)(Oo,{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)(Bo,{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)(Xo,{}):(0,E.ensureWidgetArticleImageType)(m)?(0,n.jsx)(Uo,{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)(Ho,{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)(Fo,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,content:m.content,onOpen:g}):(0,E.ensureWidgetArticleTextType)(m)?(0,n.jsx)(Ro,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,content:m.content}):(0,E.ensureWidgetPresenceType)(m)?(0,n.jsx)(Ko,{onChange:i=>{t((0,d.vR)(e,i,!1))},onSave:a,onStateChange:u,...m.content}):(0,E.ensureWidgetCheckListType)(m)?(0,n.jsx)(Po,{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)(Yo,{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)(Qo,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:s},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)(Zo,{}):(0,E.ensureWidgetContactCardDavType)(m)?(0,n.jsx)(el,{}):(0,E.ensureWidgetCalendarCalDavType)(m)?(0,n.jsx)(tl,{}):(0,E.ensureWidgetDatasourceTableType)(m)?(0,n.jsx)(Jo,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:s},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)(il,{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},ol=u.j.getLazyComponent("Icon"),ll=({uniqid:e,position:t})=>{const i=(0,c.jL)(),o=(0,l.useTheme)();return(0,n.jsx)(ko,{children:(0,n.jsx)(zo,{onClick:()=>{i(d.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))},children:(0,n.jsx)(ol,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:o.color.lavender,size:26.75})})})},sl=u.j.getLazyComponent("InputColorRaw"),al=s().label`
655
655
  margin-left: 2px;
656
656
  margin-right: 2px;
657
657
  margin-bottom: 8px;
658
658
  font-size: 14px;
659
659
  width: 100%;
660
660
  min-height: 20px;
661
- `,ll=s().fieldset`
661
+ `,rl=s().fieldset`
662
662
  margin: 12px 0px !important;
663
663
  width: 100% !important;
664
- `,sl=({label:e,initialValue:t,handleChange:i})=>{const o=(0,l.useTheme)(),s=[{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]}];return(0,n.jsxs)(ll,{children:[(0,n.jsx)(ol,{children:(0,n.jsx)(a.FormattedMessage,{id:e})}),(0,n.jsx)(nl,{palettes:s,label:e,initialValue:t??o.color.primary,name:"background-color",onChange:i})]})},al=u.j.getLazyComponent("InputNumber"),rl=({label:e,initialValue:t,handleChange:i})=>{const l=(0,a.useIntl)(),{control:s,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)(al,{label:e,name:"value",width:"100%",control:s,placeholder:l.formatMessage({id:e})})},dl=u.j.getLazyComponent("InputSelectExtended"),cl=({label:e,options:t=[],initialValue:i,required:l=!1,handleChange:s})=>{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=>{s(e.select.value)});return()=>e.unsubscribe()},[d,s]),(0,n.jsx)(dl,{options:t,label:e,getValue:e=>e.value,getLabel:"label",getSearch:"label",rules:{required:l},hideDeleteIcon:!0,required:l,control:r,name:"select"})},ul=u.j.getLazyComponent("InputText"),gl=({uniqid:e})=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),s=(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,l.useTheme)(),g=(0,c.GV)(t=>d.x0.selectors.selectWidgetTitleStyle(t,e),be.shallowEqual),{control:m,watch:p}=(0,I.useForm)({defaultValues:{text:s?.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 s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ul,{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)(sl,{label:"STYLE_Text_Color",initialValue:x.color,handleChange:e=>h("color",e)}),(0,n.jsx)(sl,{label:"STYLE_Background_Color",initialValue:x.backgroundColor,handleChange:e=>h("background-color",e)}),(0,n.jsx)(rl,{label:"STYLE_Text_Size",initialValue:x.fontSize,handleChange:e=>h("font-size",e)}),(0,n.jsx)(cl,{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)(cl,{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,{})},ml=u.j.getLazyComponent("Loader"),pl=({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)(qo,{children:(0,n.jsx)(ml,{size:"l"})})})},xl=({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)(Mo,{children:t.formatMessage({id:"INTRANET_Panel_Change_Off"})}):(0,n.jsx)(n.Fragment,{})},hl=u.j.getLazyComponent("Button"),fl=({uniqid:e,mode:t})=>{const i=(0,a.useIntl)(),o=(0,c.jL)(),l=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual),s=(0,c.GV)(t=>d.x0.selectors.selectWidgetObjectUri(t,e),be.shallowEqual);return(0,n.jsx)(hl,{color:"valid",onClick:()=>{o(d.cr.slice.actions.flushEditor({uniqid:e}));const n=l&&l.widget&&l.widget.content;s&&l&&n&&("view"==t&&k().widget.updateWidget({uri:s,uniqid:e,title:l.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"})})},jl=({uniqid:e})=>{const t=(0,l.useTheme)(),i=(0,c.jL)(),s=(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)(sl,{label:"STYLE_Background_Color",initialValue:u.backgroundColor,handleChange:e=>g("background-color",e)}),(0,n.jsx)(sl,{label:"STYLE_Text_Color",initialValue:u.color,handleChange:e=>g("color",e)}),(0,n.jsx)("hr",{}),(0,n.jsx)(rl,{label:"STYLE_Padding",initialValue:u.padding,handleChange:e=>g("padding",String(e))}),(0,n.jsx)(rl,{label:"STYLE_Radius",initialValue:u.borderRadius,handleChange:e=>g("border-radius",String(e))}),(0,n.jsx)(cl,{label:"STYLE_Border_Style",initialValue:u.borderStyle,options:[{label:s.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:s.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:s.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:s.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)(sl,{label:"STYLE_Border_Color",initialValue:u.borderColor,handleChange:e=>g("border-color",e)}),"string"==typeof u.borderStyle&&"none"!==u.borderStyle&&(0,n.jsx)(rl,{label:"STYLE_Border_Width",initialValue:u.borderWidth,handleChange:e=>g("border-width",e)})]})},yl=({uniqid:e})=>{const t=(0,c.jL)(),i=(0,a.useIntl)(),l=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e),be.shallowEqual),s=d.x0.definition(l?.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)(cl,{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(s.displayLevel)?s.displayLevel.includes(Number(e.value)):[])})},bl=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],Cl=u.j.getLazyComponent("Icon"),vl=u.j.getLazyComponent("Tooltip"),wl=({uniqid:e,position:t})=>{const i=(0,a.useIntl)(),s=(0,c.jL)(),r=(0,l.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)(ko,{children:[(0,n.jsxs)(_o,{ref:u,position:t,children:[(0,n.jsx)(To,{children:x.filter(e=>e.enable).map(e=>(0,n.jsx)(Ao,{isActive:f&&f.name===e.name,onClick:()=>j(e),children:(0,n.jsx)(vl,{position:"left",description:e.label,children:(0,n.jsx)(Cl,{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)(wo,{children:[(0,n.jsx)(il,{uniqid:e,position:g.position}),(0,n.jsx)(Eo,{children:(0,n.jsx)("h3",{children:f?f.label:i.formatMessage({id:m.label})})}),(0,n.jsx)(Lo,{children:(0,n.jsx)(Ao,{onClick:()=>{s(d.cr.slice.actions.flushEditor({uniqid:e}))},children:(0,n.jsx)(Cl,{name:"icon-times",color:r.color.lavender,size:26.75})})})]}),(0,n.jsxs)(Wo,{children:[(0,n.jsxs)(So,{children:[f&&"widget-settings"===f.name&&m.panel.useEditor&&(0,n.jsx)(el,{uniqid:g.uniqid}),f&&"widget-title"===f.name&&m.panel.useWrapper&&(0,n.jsx)(gl,{uniqid:g.uniqid}),f&&"widget-selection"===f.name&&(0,n.jsx)(jl,{uniqid:e}),f&&"widget-level"===f.name&&p&&(0,n.jsx)(yl,{uniqid:e})]}),(0,n.jsx)(pl,{uniqid:e}),(0,n.jsx)(xl,{uniqid:e}),bl.includes(g.name)&&(0,n.jsx)(fl,{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,{})},Ll=s().div`
664
+ `,dl=({label:e,initialValue:t,handleChange:i})=>{const o=(0,l.useTheme)(),s=[{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)(rl,{children:[(0,n.jsx)(al,{children:(0,n.jsx)(a.FormattedMessage,{id:e})}),(0,n.jsx)(sl,{palettes:s,label:e,initialValue:t??o.color.primary,name:"background-color",onChange:i})]})},cl=u.j.getLazyComponent("InputNumber"),ul=({label:e,initialValue:t,handleChange:i})=>{const l=(0,a.useIntl)(),{control:s,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)(cl,{label:e,name:"value",width:"100%",control:s,placeholder:l.formatMessage({id:e})})},gl=u.j.getLazyComponent("InputSelectExtended"),ml=({label:e,options:t=[],initialValue:i,required:l=!1,handleChange:s})=>{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=>{s(e.select.value)});return()=>e.unsubscribe()},[d,s]),(0,n.jsx)(gl,{options:t,label:e,getValue:e=>e.value,getLabel:"label",getSearch:"label",rules:{required:l},hideDeleteIcon:!0,required:l,control:r,name:"select"})},pl=u.j.getLazyComponent("InputText"),xl=({uniqid:e})=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),s=(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,l.useTheme)(),g=(0,c.GV)(t=>d.x0.selectors.selectWidgetTitleStyle(t,e),be.shallowEqual),{control:m,watch:p}=(0,I.useForm)({defaultValues:{text:s?.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 s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(pl,{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)(dl,{label:"STYLE_Text_Color",initialValue:x.color,handleChange:e=>h("color",e)}),(0,n.jsx)(dl,{label:"STYLE_Background_Color",initialValue:x.backgroundColor,handleChange:e=>h("background-color",e)}),(0,n.jsx)(ul,{label:"STYLE_Text_Size",initialValue:x.fontSize,handleChange:e=>h("font-size",e)}),(0,n.jsx)(ml,{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)(ml,{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,{})},hl=u.j.getLazyComponent("Loader"),fl=({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)(To,{children:(0,n.jsx)(hl,{size:"l"})})})},jl=({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)(Ao,{children:t.formatMessage({id:"INTRANET_Panel_Change_Off"})}):(0,n.jsx)(n.Fragment,{})},yl=u.j.getLazyComponent("Button"),bl=({uniqid:e,mode:t})=>{const i=(0,a.useIntl)(),o=(0,c.jL)(),l=(0,c.GV)(t=>d.x0.selectors.selectWidget(t,e),be.shallowEqual),s=(0,c.GV)(t=>d.x0.selectors.selectWidgetObjectUri(t,e),be.shallowEqual);return(0,n.jsx)(yl,{color:"valid",onClick:()=>{o(d.cr.slice.actions.flushEditor({uniqid:e}));const n=l&&l.widget&&l.widget.content;s&&l&&n&&("view"==t&&k().widget.updateWidget({uri:s,uniqid:e,title:l.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"})})},Cl=({uniqid:e})=>{const t=(0,l.useTheme)(),i=(0,c.jL)(),s=(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)(dl,{label:"STYLE_Background_Color",initialValue:u.backgroundColor,handleChange:e=>g("background-color",e)}),(0,n.jsx)(dl,{label:"STYLE_Text_Color",initialValue:u.color,handleChange:e=>g("color",e)}),(0,n.jsx)("hr",{}),(0,n.jsx)(ul,{label:"STYLE_Padding",initialValue:u.padding,handleChange:e=>g("padding",String(e))}),(0,n.jsx)(ul,{label:"STYLE_Radius",initialValue:u.borderRadius,handleChange:e=>g("border-radius",String(e))}),(0,n.jsx)(ml,{label:"STYLE_Border_Style",initialValue:u.borderStyle,options:[{label:s.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:s.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:s.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:s.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)(dl,{label:"STYLE_Border_Color",initialValue:u.borderColor,handleChange:e=>g("border-color",e)}),"string"==typeof u.borderStyle&&"none"!==u.borderStyle&&(0,n.jsx)(ul,{label:"STYLE_Border_Width",initialValue:u.borderWidth,handleChange:e=>g("border-width",e)})]})},vl=({uniqid:e})=>{const t=(0,c.jL)(),i=(0,a.useIntl)(),l=(0,c.GV)(t=>d.cr.selectors.selectEditor(t,e),be.shallowEqual),s=d.x0.definition(l?.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)(ml,{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(s.displayLevel)?s.displayLevel.includes(Number(e.value)):[])})},wl=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],Ll=u.j.getLazyComponent("Icon"),El=u.j.getLazyComponent("Tooltip"),kl=({uniqid:e,position:t})=>{const i=(0,a.useIntl)(),s=(0,c.jL)(),r=(0,l.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)(Wo,{children:[(0,n.jsxs)(So,{ref:u,position:t,children:[(0,n.jsx)(Io,{children:x.filter(e=>e.enable).map(e=>(0,n.jsx)(zo,{isActive:f&&f.name===e.name,onClick:()=>j(e),children:(0,n.jsx)(El,{position:"left",description:e.label,children:(0,n.jsx)(Ll,{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)(Eo,{children:[(0,n.jsx)(ll,{uniqid:e,position:g.position}),(0,n.jsx)(_o,{children:(0,n.jsx)("h3",{children:f?f.label:i.formatMessage({id:m.label})})}),(0,n.jsx)(ko,{children:(0,n.jsx)(zo,{onClick:()=>{s(d.cr.slice.actions.flushEditor({uniqid:e}))},children:(0,n.jsx)(Ll,{name:"icon-times",color:r.color.lavender,size:26.75})})})]}),(0,n.jsxs)(qo,{children:[(0,n.jsxs)(Mo,{children:[f&&"widget-settings"===f.name&&m.panel.useEditor&&(0,n.jsx)(nl,{uniqid:g.uniqid}),f&&"widget-title"===f.name&&m.panel.useWrapper&&(0,n.jsx)(xl,{uniqid:g.uniqid}),f&&"widget-selection"===f.name&&(0,n.jsx)(Cl,{uniqid:e}),f&&"widget-level"===f.name&&p&&(0,n.jsx)(vl,{uniqid:e})]}),(0,n.jsx)(fl,{uniqid:e}),(0,n.jsx)(jl,{uniqid:e}),wl.includes(g.name)&&(0,n.jsx)(bl,{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,{})},_l=s().div`
665
665
  position: absolute;
666
666
  inset: 0;
667
667
  pointer-events: none;
668
668
  z-index: 1;
669
- `,El=s().div`
669
+ `,Wl=s().div`
670
670
  flex: 1;
671
671
  display: flex;
672
672
  margin-top: ${90}px;
673
673
  pointer-events: ${e=>e.isActive?"all":"none"};
674
- `,kl=s().div`
674
+ `,Sl=s().div`
675
675
  flex: 1;
676
676
  display: flex;
677
677
  flex-direction: row;
678
678
  pointer-events: none;
679
- `,_l=s().div`
679
+ `,ql=s().div`
680
680
  width: ${440}px;
681
681
  pointer-events: none;
682
- `,Wl=()=>{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)(Ll,{className:"editor-portal-wrapper",children:t.map(e=>(0,n.jsx)(vo,{isActive:!1,children:(0,n.jsx)(kl,{children:"left"===e.position?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(wl,{uniqid:e.uniqid,position:e.position}),(0,n.jsx)(El,{isActive:void 0!==e.popup,children:(0,n.jsx)(Go,{uniqid:e.uniqid})}),(0,n.jsx)(_l,{})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_l,{}),(0,n.jsx)(El,{isActive:void 0!==e.popup,children:(0,n.jsx)(Go,{uniqid:e.uniqid})}),(0,n.jsx)(wl,{uniqid:e.uniqid,position:e.position})]})})},e.uniqid))})},Sl=()=>(0,n.jsx)(n.Fragment,{}),ql=u.j.getLazyComponent("Container"),Ml=()=>(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)(n.Fragment,{}),children:(0,n.jsx)(ql,{backgroundColor:"white",mode:"fluid",flexDirection:"column",children:(0,n.jsx)(ee.Outlet,{})})});var Tl=i(622);const Al=()=>{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,[]),l=(0,o.useCallback)(e=>{t({...e,reject:i=>{e.reject(i),t(void 0)},resolve:i=>{e.resolve(i),t(void 0)}})},[]),s=(0,o.useCallback)((e,t)=>new Promise((i,n)=>{l({reject:n,resolve:i,text:e,capability:t})}),[l]),d=(0,o.useMemo)(()=>({develop:e=>s(e,"develop"),summarize:e=>s(e,"summarize"),tldr:e=>s(e,"tldr"),en:e=>s(e,"en"),es:e=>s(e,"es"),formal:e=>s(e,"formal"),funny:e=>s(e,"funny")}),[s]);return{query:e,ext:(0,o.useMemo)(()=>r.JTinyMCEExtensionsBuilders.jia(d,i),[i,d]),isActive:n}},Il=u.j.getLazyComponent("InputTinyMCE"),zl=e=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),s=(0,l.useTheme)(),r=(0,c.GV)(d.Kx.selectors.selectAll),{query:u,ext:g,isActive:m}=Al(),{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,s,b),[r,b,s]),v=(0,o.useMemo)(()=>Tl.p9,[]);return(0,n.jsxs)(n.Fragment,{children:[v&&(0,n.jsx)(Il,{commonOptions:v,additionalExtensions:y,mentionsQueries:C,...e}),m&&(0,n.jsx)(A,{query:u}),j&&(0,n.jsx)(bt,{onInsert:x,open:p,close:h})]})},Gl=u.j.getLazyComponent("InputTinyMCERaw"),Dl=e=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),s=(0,l.useTheme)(),r=(0,c.GV)(d.Kx.selectors.selectAll),{query:u,ext:g,isActive:m}=Al(),{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,s,b),[r,b,s]),v=(0,o.useMemo)(()=>Tl.p9,[]);return(0,n.jsxs)(n.Fragment,{children:[v&&(0,n.jsx)(Gl,{commonOptions:v,additionalExtensions:y,mentionsQueries:C,...e}),m&&(0,n.jsx)(A,{query:u}),j&&(0,n.jsx)(bt,{onInsert:x,open:p,close:h})]})},Vl=u.j.getLazyComponent("InputAudience"),$l=u.j.getLazyComponent("Message"),Fl=u.j.getLazyComponent("Modal"),Rl=({open:e,closeHandler:t,title:i,control:o,warningMessage:l,onSubmit:s,name:r="publishTo"})=>{const d=(0,a.useIntl)();return(0,n.jsxs)(Fl,{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(),s()}}],children:[(0,n.jsx)($l,{variant:"warning",message:l??d.formatMessage({id:"FORM_Audience_Empty"})}),(0,n.jsx)(Vl,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:o,multiple:!0,placeholder:d.formatMessage({id:"GLOBAL_Audience"}),name:r})]})};var Ol=i(97);const Bl=u.j.getLazyComponent("ModalForm"),Hl=u.j.getLazyComponent("InputDateTime"),Ul=u.j.getLazyComponent("InputTextRaw"),Nl=u.j.getLazyComponent("FlexBox"),Pl=u.j.getLazyComponent("IconButton"),Yl=s().div`
682
+ `,Ml=()=>{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)(_l,{className:"editor-portal-wrapper",children:t.map(e=>(0,n.jsx)(Lo,{isActive:!1,children:(0,n.jsx)(Sl,{children:"left"===e.position?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(kl,{uniqid:e.uniqid,position:e.position}),(0,n.jsx)(Wl,{isActive:void 0!==e.popup,children:(0,n.jsx)(Vo,{uniqid:e.uniqid})}),(0,n.jsx)(ql,{})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ql,{}),(0,n.jsx)(Wl,{isActive:void 0!==e.popup,children:(0,n.jsx)(Vo,{uniqid:e.uniqid})}),(0,n.jsx)(kl,{uniqid:e.uniqid,position:e.position})]})})},e.uniqid))})},Tl=()=>(0,n.jsx)(n.Fragment,{}),Al=u.j.getLazyComponent("Container"),Il=()=>(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)(n.Fragment,{}),children:(0,n.jsx)(Al,{backgroundColor:"white",mode:"fluid",flexDirection:"column",children:(0,n.jsx)(ee.Outlet,{})})});var zl=i(622);const Gl=()=>{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,[]),l=(0,o.useCallback)(e=>{t({...e,reject:i=>{e.reject(i),t(void 0)},resolve:i=>{e.resolve(i),t(void 0)}})},[]),s=(0,o.useCallback)((e,t)=>new Promise((i,n)=>{l({reject:n,resolve:i,text:e,capability:t})}),[l]),d=(0,o.useMemo)(()=>({develop:e=>s(e,"develop"),summarize:e=>s(e,"summarize"),tldr:e=>s(e,"tldr"),en:e=>s(e,"en"),es:e=>s(e,"es"),formal:e=>s(e,"formal"),funny:e=>s(e,"funny")}),[s]);return{query:e,ext:(0,o.useMemo)(()=>r.JTinyMCEExtensionsBuilders.jia(d,i),[i,d]),isActive:n}},Dl=u.j.getLazyComponent("InputTinyMCE"),Vl=e=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),s=(0,l.useTheme)(),r=(0,c.GV)(d.Kx.selectors.selectAll),{query:u,ext:g,isActive:m}=Gl(),{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,s,b),[r,b,s]),v=(0,o.useMemo)(()=>zl.p9,[]);return(0,n.jsxs)(n.Fragment,{children:[v&&(0,n.jsx)(Dl,{commonOptions:v,additionalExtensions:y,mentionsQueries:C,...e}),m&&(0,n.jsx)(A,{query:u}),j&&(0,n.jsx)(bt,{onInsert:x,open:p,close:h})]})},$l=u.j.getLazyComponent("InputTinyMCERaw"),Fl=e=>{const t=(0,a.useIntl)(),i=(0,c.jL)(),s=(0,l.useTheme)(),r=(0,c.GV)(d.Kx.selectors.selectAll),{query:u,ext:g,isActive:m}=Gl(),{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,s,b),[r,b,s]),v=(0,o.useMemo)(()=>zl.p9,[]);return(0,n.jsxs)(n.Fragment,{children:[v&&(0,n.jsx)($l,{commonOptions:v,additionalExtensions:y,mentionsQueries:C,...e}),m&&(0,n.jsx)(A,{query:u}),j&&(0,n.jsx)(bt,{onInsert:x,open:p,close:h})]})},Rl=u.j.getLazyComponent("InputAudience"),Ol=u.j.getLazyComponent("Message"),Bl=u.j.getLazyComponent("Modal"),Hl=({open:e,closeHandler:t,title:i,control:o,warningMessage:l,onSubmit:s,name:r="publishTo"})=>{const d=(0,a.useIntl)();return(0,n.jsxs)(Bl,{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(),s()}}],children:[(0,n.jsx)(Ol,{variant:"warning",message:l??d.formatMessage({id:"FORM_Audience_Empty"})}),(0,n.jsx)(Rl,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:o,multiple:!0,placeholder:d.formatMessage({id:"GLOBAL_Audience"}),name:r})]})};var Ul=i(97);const Nl=u.j.getLazyComponent("ModalForm"),Pl=u.j.getLazyComponent("InputDateTime"),Yl=u.j.getLazyComponent("InputTextRaw"),Jl=u.j.getLazyComponent("FlexBox"),Ql=u.j.getLazyComponent("IconButton"),Kl=s().div`
683
683
  margin-bottom: ${({theme:e})=>e.space.xs}px;
684
- `,Ql=({open:e,closeHandler:t,onSubmit:i})=>{const l=(0,a.useIntl)(),s=(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,Ol.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)(Bl,{open:e,closeHandler:t,onSubmit:m,maxHeight:"620px",title:l.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)(Hl,{rules:{required:!0},label:"GLOBAL_Scheduled_Date",control:g.control,name:"scheduleDate"}),(0,n.jsxs)(Nl,{y:"flex-end",children:[(0,n.jsx)(Ul,{label:l.formatMessage({id:"GLOBAL_Permalink"}),value:x,onChange:()=>null,margin:"0",width:"100%"}),(0,n.jsx)(Yl,{children:(0,n.jsx)(Pl,{srOnly:"GLOBAL_Copy_Link",icon:"icon-copy",colorVariant:"primary",onClick:()=>{navigator.clipboard.writeText(x).then(()=>{s(d.y8.actions.success({label:l.formatMessage({id:"CLIPBOARD_Copy_Success"})}))})}})})]})]})},Jl=u.j.getLazyComponent("Container"),Kl=u.j.getLazyComponent("AppColumn"),Xl=u.j.getLazyComponent("MainColumn");function Zl({extensionRoute:e,routes:t,description:i,mode:l="center",mainColumnProps:s}){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)(Jl,{mode:l,children:[(0,n.jsx)(Kl,{mode:l,description:i,tabs:m,activeTab:u||""}),(0,n.jsx)(Xl,{mode:l,flex:!0,...s,children:(0,n.jsx)(ee.Outlet,{})})]})})}}}]);
685
- //# sourceMappingURL=836.72e8e6ee836190bf4071.chunk.js.map
684
+ `,Xl=({open:e,closeHandler:t,onSubmit:i})=>{const l=(0,a.useIntl)(),s=(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,Ul.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)(Nl,{open:e,closeHandler:t,onSubmit:m,maxHeight:"620px",title:l.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)(Pl,{rules:{required:!0},label:"GLOBAL_Scheduled_Date",control:g.control,name:"scheduleDate"}),(0,n.jsxs)(Jl,{y:"flex-end",children:[(0,n.jsx)(Yl,{label:l.formatMessage({id:"GLOBAL_Permalink"}),value:x,onChange:()=>null,margin:"0",width:"100%"}),(0,n.jsx)(Kl,{children:(0,n.jsx)(Ql,{srOnly:"GLOBAL_Copy_Link",icon:"icon-copy",colorVariant:"primary",onClick:()=>{navigator.clipboard.writeText(x).then(()=>{s(d.y8.actions.success({label:l.formatMessage({id:"CLIPBOARD_Copy_Success"})}))})}})})]})]})},Zl=u.j.getLazyComponent("Container"),es=u.j.getLazyComponent("AppColumn"),ts=u.j.getLazyComponent("MainColumn");function is({extensionRoute:e,routes:t,description:i,mode:l="center",mainColumnProps:s}){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)(Zl,{mode:l,children:[(0,n.jsx)(es,{mode:l,description:i,tabs:m,activeTab:u||""}),(0,n.jsx)(ts,{mode:l,flex:!0,...s,children:(0,n.jsx)(ee.Outlet,{})})]})})}}}]);
685
+ //# sourceMappingURL=541.f36879fda62072178a72.chunk.js.map