jamespot-react-core 1.1.187 → 1.1.189

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([[435],{435:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>xl,DisplayForm:()=>Sl,EditorsPortal:()=>He,Empty:()=>Ml,JRCInputTinyMCEWithExt:()=>Ol,JRCInputTinyMCEWithExtRaw:()=>zl,MarkdownModal:()=>Pt,ModalAudience:()=>Fl,TwoColLayout:()=>Pl,WidgetList:()=>ot,WidgetWrapperCore:()=>ml});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(574),c=n(497),d=n(996),u=n(683);const m=d.j.getLazyComponent("Icon"),g=e=>{var t;const n=(0,o.useTheme)(),i=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?l().createElement(m,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(s.JRCAvatar,Object.assign({},e))},p=d.j.getLazyComponent("FlexBox"),f=d.j.getLazyComponent("ModalContent"),E=d.j.getLazyComponent("ModalLayout"),h=d.j.getLazyComponent("StyledHref"),b=d.j.getLazyComponent("Tooltip"),v=d.j.getLazyComponent("Typography"),y=a().div`
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[435],{435:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Ll,DisplayForm:()=>Al,EditorsPortal:()=>He,Empty:()=>Ol,JRCInputTinyMCEWithExt:()=>$l,JRCInputTinyMCEWithExtRaw:()=>Fl,MarkdownModal:()=>Ut,ModalAudience:()=>Pl,TwoColLayout:()=>Ql,WidgetList:()=>ot,WidgetWrapperCore:()=>El});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(272),c=n(448),d=n(996),u=n(683);const m=d.j.getLazyComponent("Icon"),g=e=>{var t;const n=(0,o.useTheme)(),i=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?l().createElement(m,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(s.JRCAvatar,Object.assign({},e))},p=d.j.getLazyComponent("FlexBox"),f=d.j.getLazyComponent("ModalContent"),E=d.j.getLazyComponent("ModalLayout"),h=d.j.getLazyComponent("StyledHref"),b=d.j.getLazyComponent("Tooltip"),v=d.j.getLazyComponent("Typography"),y=a().div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -17,9 +17,9 @@
17
17
  border: 4px solid ${e=>e.theme.color.white};
18
18
  margin-left: ${e=>e.overlap?"-18px":"0"};
19
19
  cursor: pointer;
20
- `,x=({audience:e,limit:t=2})=>{const n=(0,r.useIntl)(),a=(0,o.useTheme)(),[c,d]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(p,null,[...e].splice(0,t).map(((e,t)=>l().createElement(C,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(b,{description:void 0===e.title?" ":e.title,position:"left"},l().createElement(g,{uri:e.uri,size:4,variant:"circle",alt:"image",timestamp:e.dateModified?s.Utils.date.strToTimestamp(e.dateModified):void 0,focusable:!0}))))),e.length>t&&l().createElement(C,{onClick:()=>d(!0),overlap:!0},"+",e.length-t)),e.length>t&&l().createElement(E,{closeHandler:()=>d(!1),enableClickAwayCloseModal:!0,open:c,variant:"fixed-height",maxHeight:"800px"},l().createElement(f,{title:n.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>d(!1)},l().createElement(y,null,e.map(((e,t)=>l().createElement(p,{key:`audience-${t}`,y:"center",gap:a.space.l},l().createElement(g,{size:5,uri:`${e.type}/${e.id}`}),l().createElement(h,{href:`${e.type}/${e.id}`},l().createElement(v,null,e.title)))))))))};var w=n(833),k=n.n(w);const W=d.j.getLazyComponent("Loader"),L=d.j.getLazyComponent("ModalContent"),q=d.j.getLazyComponent("ModalLayout"),_=d.j.getLazyComponent("Typography"),j=a().div`
20
+ `,x=({audience:e,limit:t=2})=>{const n=(0,r.useIntl)(),a=(0,o.useTheme)(),[c,d]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(p,null,[...e].splice(0,t).map(((e,t)=>l().createElement(C,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(b,{description:void 0===e.title?" ":e.title,position:"left"},l().createElement(g,{uri:e.uri,size:4,variant:"circle",alt:"image",timestamp:e.dateModified?s.Utils.date.strToTimestamp(e.dateModified):void 0,focusable:!0}))))),e.length>t&&l().createElement(C,{onClick:()=>d(!0),overlap:!0},"+",e.length-t)),e.length>t&&l().createElement(E,{closeHandler:()=>d(!1),enableClickAwayCloseModal:!0,open:c,variant:"fixed-height",maxHeight:"800px"},l().createElement(f,{title:n.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>d(!1)},l().createElement(y,null,e.map(((e,t)=>l().createElement(p,{key:`audience-${t}`,y:"center",gap:a.space.l},l().createElement(g,{size:5,uri:`${e.type}/${e.id}`}),l().createElement(h,{href:`${e.type}/${e.id}`},l().createElement(v,null,e.title)))))))))};var w=n(833),k=n.n(w);const W=d.j.getLazyComponent("Loader"),L=d.j.getLazyComponent("ModalContent"),_=d.j.getLazyComponent("ModalLayout"),q=d.j.getLazyComponent("Typography"),j=a().div`
21
21
  padding: ${e=>e.theme.space.md}px;
22
- `,S={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(S),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(S),k().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void a({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const n=e.result.text;a({error:void 0,loading:!1,response:n})})).catch((e=>{a({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[t]);return(0,i.useEffect)((()=>{e&&e.text.trim().length>0&&c(e)}),[e,c]),l().createElement(q,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(L,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&c(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>n.response&&(null==e?void 0:e.resolve(n.response))},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>null==e?void 0:e.reject()}],isFull:!0},l().createElement(j,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(W,null),l().createElement(_,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!n.loading&&n.error&&l().createElement("p",null,n.error),!n.loading&&n.response&&l().createElement("p",null,n.response))))};var T=n(690),I=n(746);var A=n(206),O=n(743),G=n(704);const z=(a().div`
22
+ `,S={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(S),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(S),k().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void a({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const n=e.result.text;a({error:void 0,loading:!1,response:n})})).catch((e=>{a({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[t]);return(0,i.useEffect)((()=>{e&&e.text.trim().length>0&&c(e)}),[e,c]),l().createElement(_,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(L,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&c(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>n.response&&(null==e?void 0:e.resolve(n.response))},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>null==e?void 0:e.reject()}],isFull:!0},l().createElement(j,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(W,null),l().createElement(q,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!n.loading&&n.error&&l().createElement("p",null,n.error),!n.loading&&n.response&&l().createElement("p",null,n.response))))};var T=n(690),I=n(746);var A=n(206),O=n(743),G=n(704);const z=(a().div`
23
23
  margin-bottom: 24px;
24
24
  `,a().div`
25
25
  margin-bottom: 4px;
@@ -79,14 +79,14 @@
79
79
  flex: 1;
80
80
  display: flex;
81
81
  flex-direction: column;
82
- `,U=a().div`
82
+ `,P=a().div`
83
83
  position: absolute;
84
84
  inset: 0;
85
85
  background-color: rgba(255, 255, 255, 0.8);
86
86
  display: flex;
87
87
  align-items: center;
88
88
  justify-content: center;
89
- `,P=a().div`
89
+ `,U=a().div`
90
90
  position: absolute;
91
91
  inset: 0;
92
92
  background-color: ${e=>e.theme.color.white};
@@ -107,6 +107,9 @@
107
107
  align-items: center;
108
108
  justify-content: center;
109
109
  background-color: ${e=>e.isActive?e.theme.color.grey2:e.theme.color.white};
110
+
111
+ ${(0,s.DashedFocusBorder)()}
112
+
110
113
  &:hover {
111
114
  background-color: ${e=>e.theme.color.grey2};
112
115
  }
@@ -145,7 +148,7 @@
145
148
  flex: 1;
146
149
  display: flex;
147
150
  align-items: center;
148
- `,d.j.getLazyComponent("Button")),X=d.j.getLazyComponent("Icon"),K=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)));return n&&n.popup&&n.view?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},l().createElement(D,null,l().createElement($,null),l().createElement(V,null,"Popup"),l().createElement($,null,l().createElement(Y,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(X,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(D,null,l().createElement(Q,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var Z=n(939);const ee=d.j.getLazyComponent("WidgetArticleTitleEditor"),te=d.j.getLazyComponent("WidgetArticleTextEditor"),ne=d.j.getLazyComponent("WidgetArticleGalleryEditor"),ie=d.j.getLazyComponent("WidgetArticleAttachmentEditor"),le=d.j.getLazyComponent("WidgetArticleSliderEditor"),oe=d.j.getLazyComponent("WidgetArticleImageEditor"),ae=d.j.getLazyComponent("WidgetButtonEditor"),re=d.j.getLazyComponent("WidgetCheckListEditor"),se=d.j.getLazyComponent("WidgetQuickSurveyEditor"),ce=d.j.getLazyComponent("WidgetDatasourceTableEditor"),de=d.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),ue=d.j.getLazyComponent("WidgetPresenceEditor"),me=d.j.getLazyComponent("WidgetEmailsImapEditor"),ge=d.j.getLazyComponent("WidgetContactCardDavEditor"),pe=d.j.getLazyComponent("WidgetCalendarCalDavEditor"),fe=({uniqid:e})=>{var t,n,i,o,a,r;const d=(0,u.jL)(),m=(0,u.GV)(c.x0.selectors.selectToken),g=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual),p=(0,u.GV)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),G.shallowEqual),f=e=>{var t;return null===(t=c.qn.selectors.selectHook(Z.M.getState(),e))||void 0===t?void 0:t.isActive},E=t=>{g&&d(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),d(c.cr.slice.actions.flushEditor({uniqid:e})),p&&p(t)},h=(t,n)=>{d(void 0!==n?c.x0.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.x0.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},b=t=>{d(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},v=null==g?void 0:g.widget;return v?(0,w.ensureWidgetArticleButtonType)(v)?l().createElement(ae,Object.assign({},v.content,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:()=>E({})})):(0,w.ensureWidgetArticleGalleryType)(v)?l().createElement(ne,{token:m,content:v.content,onChange:t=>d((0,c.vR)(e,t,!1)),onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleAttachmentType)(v)?l().createElement(ie,{token:m,content:v.content,onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h,onOpen:b}):(0,w.ensureWidgetArticleImageType)(v)?l().createElement(oe,{content:v.content,token:m,onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleSliderType)(v)?void 0!==m?l().createElement(le,{slides:null!==(t=v.content.slides)&&void 0!==t?t:[],loop:null!==(n=v.content.loop)&&void 0!==n&&n,useDots:null===(i=v.content.useDots)||void 0===i||i,onChange:t=>{d((0,c.vR)(e,t,!1))},token:m,onSave:E}):l().createElement(l().Fragment,null,"Token is mandatory"):(0,w.ensureWidgetArticleTitleType)(v)?l().createElement(ee,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content,onOpen:b}):(0,w.ensureWidgetArticleTextType)(v)?l().createElement(te,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content}):(0,w.ensureWidgetPresenceType)(v)?l().createElement(ue,Object.assign({onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h},v.content)):(0,w.ensureWidgetCheckListType)(v)?l().createElement(re,{token:m,uniqid:v.uniqid,content:Object.assign(Object.assign({},v.content),{arr:null===(o=v.content.arr)||void 0===o?void 0:o.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),onChangeContent:(e,t)=>{d((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{d(c.x0.slice.actions.updateWidgetWrapper(Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))},handleChange:t=>d((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetQuickSurveyType)(v)?l().createElement(se,{token:m,uniqid:v.uniqid,content:v.content,onChangeContent:(e,t)=>{d((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{d(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>d((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetExcelDatasourceTableType)(v)?l().createElement(de,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(a=v.content.limit)&&void 0!==a?a:20,hook:{isActive:f},handlers:{jamespot:{datasource:k().datasource,network:k().network,filebank:k().filebank,wedoc:k().wedoc},handleStart:()=>h({busy:!0}),handleCatch:e=>d(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:E,onChange:(t,n)=>d((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>d(c.y8.actions.error({label:e}))})):(0,w.ensureWidgetEmailsImapType)(v)?l().createElement(me,null):(0,w.ensureWidgetContactCardDavType)(v)?l().createElement(ge,null):(0,w.ensureWidgetCalendarCalDavType)(v)?l().createElement(pe,null):(0,w.ensureWidgetDatasourceTableType)(v)?l().createElement(ce,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(r=v.content.limit)&&void 0!==r?r:20,hook:{isActive:f},handlers:{jamespot:{datasource:k().datasource,network:k().network,application:k().application,filebank:k().filebank},handleStart:()=>h({busy:!0}),handleCatch:e=>d(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:E,onChange:(t,n)=>d((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>{d(c.y8.actions.error({label:e}))}})):l().createElement(l().Fragment,null,"cannot display editor"):null},Ee=d.j.getLazyComponent("Icon"),he=({uniqid:e,position:t})=>{const n=(0,u.jL)(),i=(0,o.useTheme)();return l().createElement($,null,l().createElement(Y,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Ee,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:i.color.lavender})))};var be=n(655);const ve=d.j.getLazyComponent("InputColorRaw"),ye=a().label`
151
+ `,d.j.getLazyComponent("Button")),X=d.j.getLazyComponent("Icon"),K=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)));return n&&n.popup&&n.view?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},l().createElement(D,null,l().createElement($,null),l().createElement(V,null,"Popup"),l().createElement($,null,l().createElement(Y,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(X,{name:"icon-times",color:"grey2",size:26.75})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(D,null,l().createElement(Q,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var Z=n(939);const ee=d.j.getLazyComponent("WidgetArticleTitleEditor"),te=d.j.getLazyComponent("WidgetArticleTextEditor"),ne=d.j.getLazyComponent("WidgetArticleGalleryEditor"),ie=d.j.getLazyComponent("WidgetArticleAttachmentEditor"),le=d.j.getLazyComponent("WidgetArticleSliderEditor"),oe=d.j.getLazyComponent("WidgetArticleImageEditor"),ae=d.j.getLazyComponent("WidgetButtonEditor"),re=d.j.getLazyComponent("WidgetCheckListEditor"),se=d.j.getLazyComponent("WidgetQuickSurveyEditor"),ce=d.j.getLazyComponent("WidgetDatasourceTableEditor"),de=d.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),ue=d.j.getLazyComponent("WidgetPresenceEditor"),me=d.j.getLazyComponent("WidgetEmailsImapEditor"),ge=d.j.getLazyComponent("WidgetContactCardDavEditor"),pe=d.j.getLazyComponent("WidgetCalendarCalDavEditor"),fe=({uniqid:e})=>{var t,n,i,o,a,r;const d=(0,u.jL)(),m=(0,u.GV)(c.x0.selectors.selectToken),g=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual),p=(0,u.GV)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),G.shallowEqual),f=e=>{var t;return null===(t=c.qn.selectors.selectHook(Z.M.getState(),e))||void 0===t?void 0:t.isActive},E=t=>{g&&d(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),d(c.cr.slice.actions.flushEditor({uniqid:e})),p&&p(t)},h=(t,n)=>{d(void 0!==n?c.x0.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.x0.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},b=t=>{d(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},v=null==g?void 0:g.widget;return v?(0,w.ensureWidgetArticleButtonType)(v)?l().createElement(ae,Object.assign({},v.content,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:()=>E({})})):(0,w.ensureWidgetArticleGalleryType)(v)?l().createElement(ne,{token:m,content:v.content,onChange:t=>d((0,c.vR)(e,t,!1)),onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleAttachmentType)(v)?l().createElement(ie,{token:m,content:v.content,onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h,onOpen:b}):(0,w.ensureWidgetArticleImageType)(v)?l().createElement(oe,{content:v.content,token:m,onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleSliderType)(v)?void 0!==m?l().createElement(le,{slides:null!==(t=v.content.slides)&&void 0!==t?t:[],loop:null!==(n=v.content.loop)&&void 0!==n&&n,useDots:null===(i=v.content.useDots)||void 0===i||i,onChange:t=>{d((0,c.vR)(e,t,!1))},token:m,onSave:E}):l().createElement(l().Fragment,null,"Token is mandatory"):(0,w.ensureWidgetArticleTitleType)(v)?l().createElement(ee,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content,onOpen:b}):(0,w.ensureWidgetArticleTextType)(v)?l().createElement(te,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content}):(0,w.ensureWidgetPresenceType)(v)?l().createElement(ue,Object.assign({onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h},v.content)):(0,w.ensureWidgetCheckListType)(v)?l().createElement(re,{token:m,uniqid:v.uniqid,content:Object.assign(Object.assign({},v.content),{arr:null===(o=v.content.arr)||void 0===o?void 0:o.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),onChangeContent:(e,t)=>{d((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{d(c.x0.slice.actions.updateWidgetWrapper(Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))},handleChange:t=>d((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetQuickSurveyType)(v)?l().createElement(se,{token:m,uniqid:v.uniqid,content:v.content,onChangeContent:(e,t)=>{d((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{d(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>d((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetExcelDatasourceTableType)(v)?l().createElement(de,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(a=v.content.limit)&&void 0!==a?a:20,hook:{isActive:f},handlers:{jamespot:{datasource:k().datasource,network:k().network,filebank:k().filebank,wedoc:k().wedoc},handleStart:()=>h({busy:!0}),handleCatch:e=>d(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:E,onChange:(t,n)=>d((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>d(c.y8.actions.error({label:e}))})):(0,w.ensureWidgetEmailsImapType)(v)?l().createElement(me,null):(0,w.ensureWidgetContactCardDavType)(v)?l().createElement(ge,null):(0,w.ensureWidgetCalendarCalDavType)(v)?l().createElement(pe,null):(0,w.ensureWidgetDatasourceTableType)(v)?l().createElement(ce,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(r=v.content.limit)&&void 0!==r?r:20,hook:{isActive:f},handlers:{jamespot:{datasource:k().datasource,network:k().network,application:k().application,filebank:k().filebank},handleStart:()=>h({busy:!0}),handleCatch:e=>d(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:E,onChange:(t,n)=>d((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>{d(c.y8.actions.error({label:e}))}})):l().createElement(l().Fragment,null,"cannot display editor"):null},Ee=d.j.getLazyComponent("Icon"),he=({uniqid:e,position:t})=>{const n=(0,u.jL)(),i=(0,o.useTheme)();return l().createElement($,null,l().createElement(Y,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Ee,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:i.color.lavender,size:26.75})))};var be=n(655);const ve=d.j.getLazyComponent("InputColorRaw"),ye=a().label`
149
152
  margin-left: 2px;
150
153
  margin-right: 2px;
151
154
  margin-bottom: 8px;
@@ -155,7 +158,7 @@
155
158
  `,Ce=a().fieldset`
156
159
  margin: 12px 0px !important;
157
160
  width: 100% !important;
158
- `,xe=({label:e,initialValue:t,handleChange:n})=>{const i=(0,o.useTheme)(),a=[{name:(0,r.useIntl)().formatMessage({id:"GLOBAL_Platform_Color"}),colors:[i.color.primary,i.color.secondary,i.color.headerColor,i.color.lavender,i.color.orange,i.color.green,i.color.navy,i.color.overseas]}];return l().createElement(Ce,null,l().createElement(ye,null,l().createElement(r.FormattedMessage,{id:e})),l().createElement(ve,{palettes:a,label:e,initialValue:null!=t?t:i.color.primary,name:"background-color",onChange:n}))},we=d.j.getLazyComponent("InputNumber"),ke=({label:e,initialValue:t,handleChange:n})=>{const i=(0,r.useIntl)(),{control:o,watch:a}=(0,be.useForm)({defaultValues:{value:null!=t?t:"0"},criteriaMode:"all"});return l().useEffect((()=>{const e=a((e=>{var t;n(null!==(t=e.value)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[a,n]),l().createElement(we,{label:e,name:"value",width:"100%",control:o,placeholder:i.formatMessage({id:e})})},We=d.j.getLazyComponent("InputSelect"),Le=({label:e,options:t=[],initialValue:n,required:o=!1,handleChange:a})=>{const s=(0,r.useIntl)(),c=(0,i.useMemo)((()=>n&&t.find((e=>e.value===n))?t.find((e=>e.value===n)):t[0]),[n,t]),{control:d,watch:u}=(0,be.useForm)({defaultValues:{select:c},criteriaMode:"all"});return l().useEffect((()=>{const e=u((e=>{a(e.select.value)}));return()=>e.unsubscribe()}),[u,a]),l().createElement(We,{options:t,label:e,components:{Option:e=>l().createElement("span",null,s.formatMessage({id:e.option.label}))},getSearch:e=>s.formatMessage({id:e.label}),rules:{required:o},hideDeleteIcon:!0,required:o,control:d,name:"select"})},qe=d.j.getLazyComponent("InputText"),_e=({uniqid:e})=>{var t;const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),d=(0,o.useTheme)(),m=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),G.shallowEqual),{control:g,watch:p}=(0,be.useForm)({defaultValues:{text:null!==(t=null==s?void 0:s.title.replace(/&/g,"&"))&&void 0!==t?t:""},criteriaMode:"all"});(0,i.useEffect)((()=>{const t=p((t=>{a(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))}));return()=>t.unsubscribe()}),[p,e,a]);const f=(0,i.useMemo)((()=>({color:m&&m.color?String(m.color):d.color.black,backgroundColor:m&&m["background-color"]?String(m["background-color"]):"transparent",fontSize:m&&m["font-size"]?String(m["font-size"]):"24",fontWeight:m&&m["font-weight"]?String(m["font-weight"]):"medium",textAlign:m&&m["text-align"]?String(m["text-align"]):"left"})),[m,d]),E=(0,i.useCallback)(((t,n)=>{a(c.x0.slice.actions.setWidgetTitleStyle({uniqid:e,styles:{[t]:n}}))}),[a,e]);return s?l().createElement(l().Fragment,null,l().createElement(qe,{name:"text",label:"WIDGET_Title",width:"100%",control:g,placeholder:n.formatMessage({id:"WIDGET_Title"})}),l().createElement(xe,{label:"STYLE_Text_Color",initialValue:f.color,handleChange:e=>E("color",e)}),l().createElement(xe,{label:"STYLE_Background_Color",initialValue:f.backgroundColor,handleChange:e=>E("background-color",e)}),l().createElement(ke,{label:"STYLE_Text_Size",initialValue:f.fontSize,handleChange:e=>E("font-size",e)}),l().createElement(Le,{label:"STYLE_Font_Weight",initialValue:f.fontWeight,options:[{label:n.formatMessage({id:"STYLE_Font_Weight_Normal"}),value:"normal"},{label:n.formatMessage({id:"STYLE_Font_Weight_Medium"}),value:"medium"},{label:n.formatMessage({id:"STYLE_Font_Weight_Bold"}),value:"bold"}],required:!1,handleChange:e=>E("font-weight",e)}),l().createElement(Le,{label:"STYLE_Text_Align",initialValue:f.textAlign,options:[{label:n.formatMessage({id:"STYLE_Text_Align_Left"}),value:"left"},{label:n.formatMessage({id:"STYLE_Text_Align_Center"}),value:"center"},{label:n.formatMessage({id:"STYLE_Text_Align_Justify"}),value:"justify"},{label:n.formatMessage({id:"STYLE_Text_Align_Right"}),value:"right"}],required:!1,handleChange:e=>E("text-align",e)})):l().createElement(l().Fragment,null)},je=d.j.getLazyComponent("Loader"),Se=({uniqid:e})=>{var t;const n=null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),G.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(U,null,l().createElement(je,{size:"l"})))},Me=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),G.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(P,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Te=d.j.getLazyComponent("Button"),Ie=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,u.jL)(),o=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),G.shallowEqual);return l().createElement(Te,{color:"valid",onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=o&&o.widget&&o.widget.content;a&&o&&l&&("view"==t&&k().widget.updateWidget({uri:a,uniqid:e,title:o.title,content:l,v2:!0}).catch((e=>{var t;i(c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:n.formatMessage({id:"GLOBAL_Error"})}))})),"edit"===t&&i(c.x0.slice.actions.updateWidget({uniqid:e,content:l})))}},n.formatMessage({id:"GLOBAL_Save"}))},Ae=({uniqid:e})=>{const t=(0,o.useTheme)(),n=(0,u.jL)(),a=(0,r.useIntl)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual),d=(0,i.useMemo)((()=>({color:s&&s.color?String(s.color):t.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):t.color.white,padding:s&&s.padding?String(s.padding):"0",borderRadius:s&&s["border-radius"]?String(s["border-radius"]):"0",borderColor:s["border-color"]?String(s["border-color"]):t.color.black,borderWidth:s["border-width"]?String(s["border-width"]):"0",borderStyle:s["border-style"]?String(s["border-style"]):"none"})),[s,t]),m=(0,i.useCallback)(((t,i)=>{n(c.x0.slice.actions.setWidgetWrapperStyle({uniqid:e,styles:{[t]:i}}))}),[e,n]);return l().createElement(l().Fragment,null,l().createElement(xe,{label:"STYLE_Background_Color",initialValue:d.backgroundColor,handleChange:e=>m("background-color",e)}),l().createElement(xe,{label:"STYLE_Text_Color",initialValue:d.color,handleChange:e=>m("color",e)}),l().createElement("hr",null),l().createElement(ke,{label:"STYLE_Padding",initialValue:d.padding,handleChange:e=>m("padding",String(e))}),l().createElement(ke,{label:"STYLE_Radius",initialValue:d.borderRadius,handleChange:e=>m("border-radius",String(e))}),l().createElement(Le,{label:"STYLE_Border_Style",initialValue:d.borderStyle,options:[{label:a.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:a.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:a.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:a.formatMessage({id:"STYLE_Border_Style_Dotted"}),value:"dotted"}],required:!1,handleChange:e=>{m("border-style",e),"none"!==e&&m("border-color",t.color.black),"none"!==e&&m("border-width","1")}}),"none"!==s["border-style"]&&l().createElement(xe,{label:"STYLE_Border_Color",initialValue:d.borderColor,handleChange:e=>m("border-color",e)}),"none"!==s["border-style"]&&l().createElement(ke,{label:"STYLE_Border_Width",initialValue:d.borderWidth,handleChange:e=>m("border-width",e)}))},Oe=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,r.useIntl)(),o=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),G.shallowEqual),a=c.x0.definition(null==o?void 0:o.name),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e)),G.shallowEqual),d=(0,i.useCallback)((n=>{t(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(n)}))}),[e,t]);return l().createElement(Le,{handleChange:d,required:!0,label:"WIDGET_Display_Level_Select",initialValue:s?String(s):"3",options:[{label:n.formatMessage({id:"WIDGET_Display_Level_1"}),value:"1"},{label:n.formatMessage({id:"WIDGET_Display_Level_2"}),value:"2"},{label:n.formatMessage({id:"WIDGET_Display_Level_3"}),value:"3"},{label:n.formatMessage({id:"WIDGET_Display_Level_4"}),value:"4"}].filter((e=>Array.isArray(a.displayLevel)?a.displayLevel.includes(Number(e.value)):[]))})},Ge=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],ze=d.j.getLazyComponent("Icon"),De=d.j.getLazyComponent("Tooltip"),$e=({uniqid:e,position:t})=>{const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,o.useTheme)(),d=(0,i.useRef)(null),m=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),G.shallowEqual),g=c.x0.definition(null==m?void 0:m.name),p=(0,i.useMemo)((()=>void 0!==g.displayLevel&&Array.isArray(g.displayLevel)&&0!==g.displayLevel.length),[g]),f=(0,i.useMemo)((()=>[{name:"widget-title",label:n.formatMessage({id:"PANEL_Title"}),enable:g.panel.useWrapper,icon:"icon-font"},{name:"widget-selection",label:n.formatMessage({id:"PANEL_Widget_Selection"}),enable:g.panel.useSelection,icon:"icon-sliders"},{name:"widget-settings",label:n.formatMessage({id:"PANEL_Widget_Settings"}),enable:g.panel.useEditor,icon:"icon-pen"},{name:"widget-level",label:n.formatMessage({id:"PANEL_Widget_Level"}),enable:p,icon:"icon-edit"}]),[g,n,p]),E=(0,i.useMemo)((()=>g.panel.useEditor?f.find((e=>"widget-settings"===e.name)):f.filter((e=>e.enable))[0]),[g,f]),[h,b]=(0,i.useState)(E);return(0,i.useEffect)((()=>{setTimeout((()=>{d&&d.current&&(d.current.className=d.current.className+" animate")}),0)}),[]),m?l().createElement(F,null,l().createElement(R,{ref:d,position:t},l().createElement(N,null,f.map((e=>e.enable?l().createElement(De,{key:e.name,position:"left",description:e.label},l().createElement(Y,{isActive:h&&h.name===e.name,onClick:()=>b(e)},l().createElement(ze,{name:e.icon,color:h&&h.name===e.name?s.color.white:s.color.lavender}))):l().createElement(l().Fragment,null)))),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(D,null,l().createElement(he,{uniqid:e,position:m.position}),l().createElement(V,null,l().createElement("h3",null,h?h.label:n.formatMessage({id:g.label}))),l().createElement($,null,l().createElement(Y,{onClick:()=>{a(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(ze,{name:"icon-times",color:s.color.lavender})))),l().createElement(B,null,l().createElement(H,null,h&&"widget-settings"===h.name&&g.panel.useEditor&&l().createElement(fe,{uniqid:m.uniqid}),h&&"widget-title"===h.name&&g.panel.useWrapper&&l().createElement(_e,{uniqid:m.uniqid}),h&&"widget-selection"===h.name&&l().createElement(Ae,{uniqid:e}),h&&"widget-level"===h.name&&p&&l().createElement(Oe,{uniqid:e})),l().createElement(Se,{uniqid:e}),l().createElement(Me,{uniqid:e}),Ge.includes(m.name)&&l().createElement(Ie,{uniqid:e,mode:m.mode})))),(null==m?void 0:m.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Ve=a().div`
161
+ `,xe=({label:e,initialValue:t,handleChange:n})=>{const i=(0,o.useTheme)(),a=[{name:(0,r.useIntl)().formatMessage({id:"GLOBAL_Platform_Color"}),colors:[i.color.primary,i.color.secondary,i.color.headerColor,i.color.lavender,i.color.orange,i.color.green,i.color.navy,i.color.overseas]}];return l().createElement(Ce,null,l().createElement(ye,null,l().createElement(r.FormattedMessage,{id:e})),l().createElement(ve,{palettes:a,label:e,initialValue:null!=t?t:i.color.primary,name:"background-color",onChange:n}))},we=d.j.getLazyComponent("InputNumber"),ke=({label:e,initialValue:t,handleChange:n})=>{const i=(0,r.useIntl)(),{control:o,watch:a}=(0,be.useForm)({defaultValues:{value:null!=t?t:"0"},criteriaMode:"all"});return l().useEffect((()=>{const e=a((e=>{var t;n(null!==(t=e.value)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[a,n]),l().createElement(we,{label:e,name:"value",width:"100%",control:o,placeholder:i.formatMessage({id:e})})},We=d.j.getLazyComponent("InputSelect"),Le=({label:e,options:t=[],initialValue:n,required:o=!1,handleChange:a})=>{const s=(0,r.useIntl)(),c=(0,i.useMemo)((()=>n&&t.find((e=>e.value===n))?t.find((e=>e.value===n)):t[0]),[n,t]),{control:d,watch:u}=(0,be.useForm)({defaultValues:{select:c},criteriaMode:"all"});return l().useEffect((()=>{const e=u((e=>{a(e.select.value)}));return()=>e.unsubscribe()}),[u,a]),l().createElement(We,{options:t,label:e,components:{Option:e=>l().createElement("span",null,s.formatMessage({id:e.option.label}))},getSearch:e=>s.formatMessage({id:e.label}),rules:{required:o},hideDeleteIcon:!0,required:o,control:d,name:"select"})},_e=d.j.getLazyComponent("InputText"),qe=({uniqid:e})=>{var t;const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),d=(0,o.useTheme)(),m=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),G.shallowEqual),{control:g,watch:p}=(0,be.useForm)({defaultValues:{text:null!==(t=null==s?void 0:s.title.replace(/&/g,"&"))&&void 0!==t?t:""},criteriaMode:"all"});(0,i.useEffect)((()=>{const t=p((t=>{a(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))}));return()=>t.unsubscribe()}),[p,e,a]);const f=(0,i.useMemo)((()=>({color:m&&m.color?String(m.color):d.color.black,backgroundColor:m&&m["background-color"]?String(m["background-color"]):"transparent",fontSize:m&&m["font-size"]?String(m["font-size"]):"24",fontWeight:m&&m["font-weight"]?String(m["font-weight"]):"medium",textAlign:m&&m["text-align"]?String(m["text-align"]):"left"})),[m,d]),E=(0,i.useCallback)(((t,n)=>{a(c.x0.slice.actions.setWidgetTitleStyle({uniqid:e,styles:{[t]:n}}))}),[a,e]);return s?l().createElement(l().Fragment,null,l().createElement(_e,{name:"text",label:"WIDGET_Title",width:"100%",control:g,placeholder:n.formatMessage({id:"WIDGET_Title"})}),l().createElement(xe,{label:"STYLE_Text_Color",initialValue:f.color,handleChange:e=>E("color",e)}),l().createElement(xe,{label:"STYLE_Background_Color",initialValue:f.backgroundColor,handleChange:e=>E("background-color",e)}),l().createElement(ke,{label:"STYLE_Text_Size",initialValue:f.fontSize,handleChange:e=>E("font-size",e)}),l().createElement(Le,{label:"STYLE_Font_Weight",initialValue:f.fontWeight,options:[{label:n.formatMessage({id:"STYLE_Font_Weight_Normal"}),value:"normal"},{label:n.formatMessage({id:"STYLE_Font_Weight_Medium"}),value:"medium"},{label:n.formatMessage({id:"STYLE_Font_Weight_Bold"}),value:"bold"}],required:!1,handleChange:e=>E("font-weight",e)}),l().createElement(Le,{label:"STYLE_Text_Align",initialValue:f.textAlign,options:[{label:n.formatMessage({id:"STYLE_Text_Align_Left"}),value:"left"},{label:n.formatMessage({id:"STYLE_Text_Align_Center"}),value:"center"},{label:n.formatMessage({id:"STYLE_Text_Align_Justify"}),value:"justify"},{label:n.formatMessage({id:"STYLE_Text_Align_Right"}),value:"right"}],required:!1,handleChange:e=>E("text-align",e)})):l().createElement(l().Fragment,null)},je=d.j.getLazyComponent("Loader"),Se=({uniqid:e})=>{var t;const n=null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),G.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(P,null,l().createElement(je,{size:"l"})))},Me=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),G.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(U,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Te=d.j.getLazyComponent("Button"),Ie=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,u.jL)(),o=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),G.shallowEqual);return l().createElement(Te,{color:"valid",onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=o&&o.widget&&o.widget.content;a&&o&&l&&("view"==t&&k().widget.updateWidget({uri:a,uniqid:e,title:o.title,content:l,v2:!0}).catch((e=>{var t;i(c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:n.formatMessage({id:"GLOBAL_Error"})}))})),"edit"===t&&i(c.x0.slice.actions.updateWidget({uniqid:e,content:l})))}},n.formatMessage({id:"GLOBAL_Save"}))},Ae=({uniqid:e})=>{const t=(0,o.useTheme)(),n=(0,u.jL)(),a=(0,r.useIntl)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual),d=(0,i.useMemo)((()=>({color:s&&s.color?String(s.color):t.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):t.color.white,padding:s&&s.padding?String(s.padding):"0",borderRadius:s&&s["border-radius"]?String(s["border-radius"]):"0",borderColor:s["border-color"]?String(s["border-color"]):t.color.black,borderWidth:s["border-width"]?String(s["border-width"]):"0",borderStyle:s["border-style"]?String(s["border-style"]):"none"})),[s,t]),m=(0,i.useCallback)(((t,i)=>{n(c.x0.slice.actions.setWidgetWrapperStyle({uniqid:e,styles:{[t]:i}}))}),[e,n]);return l().createElement(l().Fragment,null,l().createElement(xe,{label:"STYLE_Background_Color",initialValue:d.backgroundColor,handleChange:e=>m("background-color",e)}),l().createElement(xe,{label:"STYLE_Text_Color",initialValue:d.color,handleChange:e=>m("color",e)}),l().createElement("hr",null),l().createElement(ke,{label:"STYLE_Padding",initialValue:d.padding,handleChange:e=>m("padding",String(e))}),l().createElement(ke,{label:"STYLE_Radius",initialValue:d.borderRadius,handleChange:e=>m("border-radius",String(e))}),l().createElement(Le,{label:"STYLE_Border_Style",initialValue:d.borderStyle,options:[{label:a.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:a.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:a.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:a.formatMessage({id:"STYLE_Border_Style_Dotted"}),value:"dotted"}],required:!1,handleChange:e=>{m("border-style",e),"none"!==e&&m("border-color",t.color.black),"none"!==e&&m("border-width","1")}}),"none"!==s["border-style"]&&l().createElement(xe,{label:"STYLE_Border_Color",initialValue:d.borderColor,handleChange:e=>m("border-color",e)}),"none"!==s["border-style"]&&l().createElement(ke,{label:"STYLE_Border_Width",initialValue:d.borderWidth,handleChange:e=>m("border-width",e)}))},Oe=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,r.useIntl)(),o=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),G.shallowEqual),a=c.x0.definition(null==o?void 0:o.name),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e)),G.shallowEqual),d=(0,i.useCallback)((n=>{t(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(n)}))}),[e,t]);return l().createElement(Le,{handleChange:d,required:!0,label:"WIDGET_Display_Level_Select",initialValue:s?String(s):"3",options:[{label:n.formatMessage({id:"WIDGET_Display_Level_1"}),value:"1"},{label:n.formatMessage({id:"WIDGET_Display_Level_2"}),value:"2"},{label:n.formatMessage({id:"WIDGET_Display_Level_3"}),value:"3"},{label:n.formatMessage({id:"WIDGET_Display_Level_4"}),value:"4"}].filter((e=>Array.isArray(a.displayLevel)?a.displayLevel.includes(Number(e.value)):[]))})},Ge=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],ze=d.j.getLazyComponent("Icon"),De=d.j.getLazyComponent("Tooltip"),$e=({uniqid:e,position:t})=>{const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,o.useTheme)(),d=(0,i.useRef)(null),m=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),G.shallowEqual),g=c.x0.definition(null==m?void 0:m.name),p=(0,i.useMemo)((()=>void 0!==g.displayLevel&&Array.isArray(g.displayLevel)&&0!==g.displayLevel.length),[g]),f=(0,i.useMemo)((()=>[{name:"widget-title",label:n.formatMessage({id:"PANEL_Title"}),enable:g.panel.useWrapper,icon:"icon-font"},{name:"widget-selection",label:n.formatMessage({id:"PANEL_Widget_Selection"}),enable:g.panel.useSelection,icon:"icon-sliders"},{name:"widget-settings",label:n.formatMessage({id:"PANEL_Widget_Settings"}),enable:g.panel.useEditor,icon:"icon-pen"},{name:"widget-level",label:n.formatMessage({id:"PANEL_Widget_Level"}),enable:p,icon:"icon-edit"}]),[g,n,p]),E=(0,i.useMemo)((()=>g.panel.useEditor?f.find((e=>"widget-settings"===e.name)):f.filter((e=>e.enable))[0]),[g,f]),[h,b]=(0,i.useState)(E);return(0,i.useEffect)((()=>{setTimeout((()=>{d&&d.current&&(d.current.className=d.current.className+" animate")}),0)}),[]),m?l().createElement(F,null,l().createElement(R,{ref:d,position:t},l().createElement(N,null,f.map((e=>e.enable?l().createElement(De,{key:e.name,position:"left",description:e.label},l().createElement(Y,{isActive:h&&h.name===e.name,onClick:()=>b(e)},l().createElement(ze,{name:e.icon,color:h&&h.name===e.name?s.color.white:s.color.lavender}))):l().createElement(l().Fragment,null)))),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(D,null,l().createElement(he,{uniqid:e,position:m.position}),l().createElement(V,null,l().createElement("h3",null,h?h.label:n.formatMessage({id:g.label}))),l().createElement($,null,l().createElement(Y,{onClick:()=>{a(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(ze,{name:"icon-times",color:s.color.lavender,size:26.75})))),l().createElement(B,null,l().createElement(H,null,h&&"widget-settings"===h.name&&g.panel.useEditor&&l().createElement(fe,{uniqid:m.uniqid}),h&&"widget-title"===h.name&&g.panel.useWrapper&&l().createElement(qe,{uniqid:m.uniqid}),h&&"widget-selection"===h.name&&l().createElement(Ae,{uniqid:e}),h&&"widget-level"===h.name&&p&&l().createElement(Oe,{uniqid:e})),l().createElement(Se,{uniqid:e}),l().createElement(Me,{uniqid:e}),Ge.includes(m.name)&&l().createElement(Ie,{uniqid:e,mode:m.mode})))),(null==m?void 0:m.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Ve=a().div`
159
162
  position: absolute;
160
163
  inset: 0;
161
164
  pointer-events: none;
@@ -173,7 +176,7 @@
173
176
  `,Be=a().div`
174
177
  width: ${440}px;
175
178
  pointer-events: none;
176
- `,He=()=>{const e=(0,u.GV)(c.cr.selectors.selectEditors,G.shallowEqual);return l().createElement(Ve,{className:"editor-portal-wrapper"},e.map(((e,t)=>"left"===e.position?l().createElement(z,{isActive:!1,key:t},l().createElement(Re,null,l().createElement($e,{uniqid:e.uniqid,position:e.position}),l().createElement(Fe,{isActive:void 0!==e.popup},l().createElement(K,{uniqid:e.uniqid})),l().createElement(Be,null))):l().createElement(z,{isActive:!1,key:t},l().createElement(Re,null,l().createElement(Be,null),l().createElement(Fe,{isActive:void 0!==e.popup},l().createElement(K,{uniqid:e.uniqid})),l().createElement($e,{uniqid:e.uniqid,position:e.position}))))))},Ue=d.j.getLazyComponent("ThemeProvider"),Pe=()=>{const e=document.getElementById("react-portals"),t=(0,i.useMemo)((()=>e&&(e=>{let t=document.getElementById("react-portals");return t||(t=document.createElement("div"),t.id=(0,O.A)(),e.appendChild(t)),t})(e)),[e]);return t?(0,A.createPortal)(l().createElement(Ue,null,l().createElement(He,null)),t):null},Ne=a().div`
179
+ `,He=()=>{const e=(0,u.jL)();(0,i.useEffect)((()=>{const t=()=>{e(c.cr.slice.actions.flushAllEditor())};return window.addEventListener("NGWidgetEditorFlushAll",t),()=>{window.removeEventListener("NGWidgetEditorFlushAll",t)}}),[e]);const t=(0,u.GV)(c.cr.selectors.selectEditors,G.shallowEqual);return l().createElement(Ve,{className:"editor-portal-wrapper"},t.map((e=>l().createElement(z,{isActive:!1,key:e.uniqid},l().createElement(Re,null,"left"===e.position?l().createElement(l().Fragment,null,l().createElement($e,{uniqid:e.uniqid,position:e.position}),l().createElement(Fe,{isActive:void 0!==e.popup},l().createElement(K,{uniqid:e.uniqid})),l().createElement(Be,null)):l().createElement(l().Fragment,null,l().createElement(Be,null),l().createElement(Fe,{isActive:void 0!==e.popup},l().createElement(K,{uniqid:e.uniqid})),l().createElement($e,{uniqid:e.uniqid,position:e.position})))))))},Pe=d.j.getLazyComponent("ThemeProvider"),Ue=()=>{const e=document.getElementById("react-portals"),t=(0,i.useMemo)((()=>e&&(e=>{let t=document.getElementById("react-portals");return t||(t=document.createElement("div"),t.id=(0,O.A)(),e.appendChild(t)),t})(e)),[e]);return t?(0,A.createPortal)(l().createElement(Pe,null,l().createElement(He,null)),t):null},Ne=a().div`
177
180
  display: flex;
178
181
  flex-direction: row;
179
182
  flex-wrap: wrap;
@@ -279,7 +282,7 @@
279
282
  align-items: center;
280
283
  `,yt=({widget:e,mode:t})=>{const n=(0,u.jL)(),{uniqid:o}=e,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f}=e.content;return(0,i.useEffect)((()=>{n(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!a||0===a.length}))}),[a]),l().createElement(bt,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(vt,{clickable:"edit"!==t},l().createElement(ht,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f})))},Ct=d.j.getLazyComponent("WidgetArticleGallery"),xt=d.j.getLazyComponent("WidgetEmptyInplace"),wt=d.j.getLazyComponent("FileViewer"),kt=a().button`
281
284
  cursor: pointer;
282
- `,Wt=({widget:e,inplace:t,mode:n})=>{var o,a;const{uniqid:r}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,r)),G.shallowEqual);return(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),void 0!==s?l().createElement(l().Fragment,null,"edit"===n?l().createElement(Ct,{files:s,maxWidth:800,gap:null!==(o=e.content.gap)&&void 0!==o?o:"10",column:null!==(a=e.content.column)&&void 0!==a?a:"3",onClick:()=>{}}):l().createElement(wt,{files:s,openWithOptions:[]},(t=>{var n,i;return l().createElement(kt,null,l().createElement(Ct,{files:s,maxWidth:600,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(i=e.content.column)&&void 0!==i?i:"3",onClick:e=>t(e)}))})),t&&"edit"===n?l().createElement(ut,{initialFiles:s,initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&d((0,c.vR)(r,{files:e}))},onUploadStart:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},l().createElement(xt,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Lt=d.j.getLazyComponent("WidgetImage"),qt=d.j.getLazyComponent("FileViewer"),_t=d.j.getLazyComponent("WidgetEmptyInplace"),jt=a().div`
285
+ `,Wt=({widget:e,inplace:t,mode:n})=>{var o,a;const{uniqid:r}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,r)),G.shallowEqual);return(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),void 0!==s?l().createElement(l().Fragment,null,"edit"===n?l().createElement(Ct,{files:s,maxWidth:800,gap:null!==(o=e.content.gap)&&void 0!==o?o:"10",column:null!==(a=e.content.column)&&void 0!==a?a:"3",onClick:()=>{}}):l().createElement(wt,{files:s,openWithOptions:[]},(t=>{var n,i;return l().createElement(kt,null,l().createElement(Ct,{files:s,maxWidth:600,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(i=e.content.column)&&void 0!==i?i:"3",onClick:e=>t(e)}))})),t&&"edit"===n?l().createElement(ut,{initialFiles:s,initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&d((0,c.vR)(r,{files:e}))},onUploadStart:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},l().createElement(xt,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Lt=d.j.getLazyComponent("WidgetImage"),_t=d.j.getLazyComponent("FileViewer"),qt=d.j.getLazyComponent("WidgetEmptyInplace"),jt=a().div`
283
286
  position: absolute;
284
287
  inset: 0;
285
288
  background-color: rgba(0, 0, 0, 0.4);
@@ -294,14 +297,14 @@
294
297
  }
295
298
  `,St=a().button`
296
299
  cursor: pointer;
297
- `,Mt={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},Tt=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},It=({widget:e,width:t,inplace:n,mode:o})=>{const{uniqid:a}=e,{file:s,useFilter:d}=e.content,m=(0,u.jL)(),g=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),G.shallowEqual),[p,f]=(0,i.useState)(void 0),E=(0,r.useIntl)();return(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s}))}),[s]),(0,i.useEffect)((()=>{s&&f((0,w.formatImgUrl)({timestamp:s.dateModified?Tt(s.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:s.uri}))}),[s]),l().createElement(l().Fragment,null,"edit"===o?void 0!==p?l().createElement(Lt,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=d&&d}):l().createElement(l().Fragment,null):l().createElement(qt,{files:[Object.assign(Object.assign({},Mt),{path:p,mimetype:"image/png"})],openWithOptions:[]},(e=>l().createElement(St,{onClick:()=>e(0)},l().createElement(Lt,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=d&&d})))),n&&"edit"===o?l().createElement(ut,{initialFiles:[],initialClick:g,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&m((0,c.vR)(a,{file:e[0]}))},onUploadStart:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},void 0!==s?l().createElement(jt,null,E.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(_t,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null))},At=d.j.getLazyComponent("FileViewer"),Ot=d.j.getLazyComponent("WidgetEmptyInplace"),Gt=d.j.getLazyComponent("WidgetSlider"),zt=a().div`
300
+ `,Mt={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},Tt=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},It=({widget:e,width:t,inplace:n,mode:o})=>{const{uniqid:a}=e,{file:s,useFilter:d}=e.content,m=(0,u.jL)(),g=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),G.shallowEqual),[p,f]=(0,i.useState)(void 0),E=(0,r.useIntl)();return(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s}))}),[s]),(0,i.useEffect)((()=>{s&&f((0,w.formatImgUrl)({timestamp:s.dateModified?Tt(s.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:s.uri}))}),[s]),l().createElement(l().Fragment,null,"edit"===o?void 0!==p?l().createElement(Lt,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=d&&d}):l().createElement(l().Fragment,null):l().createElement(_t,{files:[Object.assign(Object.assign({},Mt),{path:p,mimetype:"image/png"})],openWithOptions:[]},(e=>l().createElement(St,{onClick:()=>e(0)},l().createElement(Lt,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=d&&d})))),n&&"edit"===o?l().createElement(ut,{initialFiles:[],initialClick:g,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&m((0,c.vR)(a,{file:e[0]}))},onUploadStart:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},void 0!==s?l().createElement(jt,null,E.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(qt,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null))},At=d.j.getLazyComponent("FileViewer"),Ot=d.j.getLazyComponent("WidgetEmptyInplace"),Gt=d.j.getLazyComponent("WidgetSlider"),zt=a().div`
298
301
  flex: 1;
299
302
  display: flex;
300
303
  flex-direction: row;
301
304
  min-height: 60px;
302
305
  align-items: center;
303
306
  width: ${e=>e.maxWidth}px;
304
- `,Dt={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},$t=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},Vt=({widget:e,mode:t,width:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),r=(0,u.GV)((e=>c.x0.selectors.isActive(e,o)),G.shallowEqual),s=null!=n?n:600,[d,m]=(0,i.useState)(void 0),g=(0,i.useRef)(null),p=(0,i.useMemo)((()=>e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},Dt),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:Dt.mimetype,path:(0,w.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?$t(e.file.dateModified):Date.now()})})))]:[]),[e.content.slides]),f=(0,i.useMemo)((()=>void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:(0,w.formatImgUrl)({timestamp:e.file.dateModified?$t(e.file.dateModified):Date.now(),size:`fitx${d&&d<s?d:s}`,from:"imagecache",uri:e.file.uri})}):Object.assign(Object.assign({},e),{uri:""})))]:[]),[e.content.slides,d,s]);(0,i.useEffect)((()=>{r&&"edit"===t&&a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}),[r]),(0,i.useEffect)((()=>{const e=()=>{g.current&&m(g.current?g.current.offsetWidth:s)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[g]),(0,i.useEffect)((()=>{m(g.current?g.current.offsetWidth:s)}),[g]),(0,i.useEffect)((()=>{a(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!e.content.slides||0===e.content.slides.length}))}),[e.content.slides]);const E=(0,i.useMemo)((()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length),[e.content.slides,t]),h=(0,i.useCallback)((()=>{a(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[a,e.uniqid,e.name]);return void 0===d?l().createElement("div",{ref:g,style:{width:"100%"}}):l().createElement(zt,{maxWidth:d&&d<s?d:s},l().createElement(At,{files:p,openWithOptions:[]},(n=>{var i,r;return l().createElement(Gt,{slides:f,maxWidth:d&&d<s?d:s,useDots:null===(i=e.content.useDots)||void 0===i||i,loop:null!==(r=e.content.loop)&&void 0!==r&&r,startAt:0,onClickSlide:i=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[i];t&&t.file&&n(t.file.id)}}else a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}})})),E?l().createElement(Ot,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:h}):l().createElement(l().Fragment,null))};var Ft=n(730);const Rt=()=>{const e=(0,r.useIntl)(),[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)();return{open:t,onInsert:e=>{null==l||l.execCommand("InsertHTML",!1,e)},close:()=>n(!1),ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.markdown((e=>{o(e),n(!0)}),e)),[e]),isActive:!0}};var Bt=n(201);const Ht=d.j.getLazyComponent("InputTextareaRaw"),Ut=d.j.getLazyComponent("Modal"),Pt=({onInsert:e,open:t,close:n})=>{const o=(0,r.useIntl)(),[a,s]=(0,i.useState)(""),c=(0,i.useCallback)((()=>{s(""),n()}),[n]);return l().createElement(Ut,{title:o.formatMessage({id:"TINY_MCE_Insert_Markdown"}),open:t,closeHandler:c,enableClickAwayCloseModal:!0,buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:c},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Insert"}),color:"valid",disabled:!a,clickHandler:()=>{e(Bt.xI.parse(a,{async:!1}).replace(/<br>/g,"<br><br>")),c()}}]},l().createElement(Ht,{value:a,onChange:e=>s(e.target.value),height:"400px"}))},Nt=d.j.getLazyComponent("WidgetArticleText"),Yt=a().div`
307
+ `,Dt={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},$t=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},Vt=({widget:e,mode:t,width:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),r=(0,u.GV)((e=>c.x0.selectors.isActive(e,o)),G.shallowEqual),s=null!=n?n:600,[d,m]=(0,i.useState)(void 0),g=(0,i.useRef)(null),p=(0,i.useMemo)((()=>e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},Dt),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:Dt.mimetype,path:(0,w.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?$t(e.file.dateModified):Date.now()})})))]:[]),[e.content.slides]),f=(0,i.useMemo)((()=>void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:(0,w.formatImgUrl)({timestamp:e.file.dateModified?$t(e.file.dateModified):Date.now(),size:`fitx${d&&d<s?d:s}`,from:"imagecache",uri:e.file.uri})}):Object.assign(Object.assign({},e),{uri:""})))]:[]),[e.content.slides,d,s]);(0,i.useEffect)((()=>{r&&"edit"===t&&a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}),[r]),(0,i.useEffect)((()=>{const e=()=>{g.current&&m(g.current?g.current.offsetWidth:s)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[g]),(0,i.useEffect)((()=>{m(g.current?g.current.offsetWidth:s)}),[g]),(0,i.useEffect)((()=>{a(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!e.content.slides||0===e.content.slides.length}))}),[e.content.slides]);const E=(0,i.useMemo)((()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length),[e.content.slides,t]),h=(0,i.useCallback)((()=>{a(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[a,e.uniqid,e.name]);return void 0===d?l().createElement("div",{ref:g,style:{width:"100%"}}):l().createElement(zt,{maxWidth:d&&d<s?d:s},l().createElement(At,{files:p,openWithOptions:[]},(n=>{var i,r;return l().createElement(Gt,{slides:f,maxWidth:d&&d<s?d:s,useDots:null===(i=e.content.useDots)||void 0===i||i,loop:null!==(r=e.content.loop)&&void 0!==r&&r,startAt:0,onClickSlide:i=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[i];t&&t.file&&n(t.file.id)}}else a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}})})),E?l().createElement(Ot,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:h}):l().createElement(l().Fragment,null))};var Ft=n(730);const Rt=()=>{const e=(0,r.useIntl)(),[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)();return{open:t,onInsert:e=>{null==l||l.execCommand("InsertHTML",!1,e)},close:()=>n(!1),ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.markdown((e=>{o(e),n(!0)}),e)),[e]),isActive:!0}};var Bt=n(201);const Ht=d.j.getLazyComponent("InputTextareaRaw"),Pt=d.j.getLazyComponent("Modal"),Ut=({onInsert:e,open:t,close:n})=>{const o=(0,r.useIntl)(),[a,s]=(0,i.useState)(""),c=(0,i.useCallback)((()=>{s(""),n()}),[n]);return l().createElement(Pt,{title:o.formatMessage({id:"TINY_MCE_Insert_Markdown"}),open:t,closeHandler:c,enableClickAwayCloseModal:!0,buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:c},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Insert"}),color:"valid",disabled:!a,clickHandler:()=>{e(Bt.xI.parse(a,{async:!1}).replace(/<br>/g,"<br><br>")),c()}}]},l().createElement(Ht,{value:a,onChange:e=>s(e.target.value),height:"400px"}))},Nt=d.j.getLazyComponent("WidgetArticleText"),Yt=a().div`
305
308
  width: 100%;
306
309
  cursor: text;
307
310
 
@@ -312,7 +315,7 @@
312
315
  a {
313
316
  word-wrap: break-word;
314
317
  }
315
- `,Jt=({widget:e,mode:t})=>{const{uniqid:n}=e,a=(0,o.useTheme)(),{text:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,n)),G.shallowEqual),g=(0,u.GV)((e=>{var t;return null===(t=c.x0.selectors.selectWidgetState(e,n))||void 0===t?void 0:t.busy})),p=(0,u.GV)(c.x0.selectors.selectToken),f=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),E=(0,u.GV)(c.Kx.selectors.selectAll),h=(0,r.useIntl)(),{open:b,onInsert:v,close:y,ext:C,isActive:x}=Rt(),w=(0,i.useCallback)((e=>{d(c.y8.actions.error({label:null!=e?e:h.formatMessage({id:"GLOBAL_Error"})}))}),[d,h]);(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:n,empty:!s||0===s.length}))}),[s]);const k=(0,i.useMemo)((()=>(0,Ft.X)(E,a,w)),[E,w,a]);return g?l().createElement(l().Fragment,null):l().createElement(Yt,null,l().createElement(Nt,{autoFocus:m,text:null!=s?s:"",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t&&f?{commonOptions:f,mentionsQueries:k}:void 0,mode:t,onChange:e=>{d((0,c.vR)(n,{text:e}))},additionalExtensions:[C]}),x&&l().createElement(Pt,{onInsert:v,open:b,close:y}))},Qt=d.j.getLazyComponent("WidgetArticleTitle"),Xt=a().div`
318
+ `,Jt=({widget:e,mode:t})=>{const{uniqid:n}=e,a=(0,o.useTheme)(),{text:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,n)),G.shallowEqual),g=(0,u.GV)((e=>{var t;return null===(t=c.x0.selectors.selectWidgetState(e,n))||void 0===t?void 0:t.busy})),p=(0,u.GV)(c.x0.selectors.selectToken),f=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),E=(0,u.GV)(c.Kx.selectors.selectAll),h=(0,r.useIntl)(),{open:b,onInsert:v,close:y,ext:C,isActive:x}=Rt(),w=(0,i.useCallback)((e=>{d(c.y8.actions.error({label:null!=e?e:h.formatMessage({id:"GLOBAL_Error"})}))}),[d,h]);(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:n,empty:!s||0===s.length}))}),[s]);const k=(0,i.useMemo)((()=>(0,Ft.X)(E,a,w)),[E,w,a]);return g?l().createElement(l().Fragment,null):l().createElement(Yt,null,l().createElement(Nt,{autoFocus:m,text:null!=s?s:"",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t&&f?{commonOptions:f,mentionsQueries:k}:void 0,mode:t,onChange:e=>{d((0,c.vR)(n,{text:e}))},additionalExtensions:[C]}),x&&l().createElement(Ut,{onInsert:v,open:b,close:y}))},Qt=d.j.getLazyComponent("WidgetArticleTitle"),Xt=a().div`
316
319
  flex: 1;
317
320
  display: flex;
318
321
  flex-direction: row;
@@ -337,18 +340,18 @@
337
340
  &:hover {
338
341
  background-color: ${e=>e.theme.color.grey1};
339
342
  }
340
- `,en=({widget:e,inplace:t,mode:n,dataCy:o})=>{const{uniqid:a}=e,{text:r,color:s,heading:d}=e.content,m=(0,u.jL)(),g=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),G.shallowEqual);return(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!r||0===r.length}))}),[r]),l().createElement(Xt,null,l().createElement(Qt,{dataCy:o,text:r,color:s,heading:d,autoFocus:g,inplace:t,mode:n,onChange:e=>{m((0,c.vR)(a,{text:e}))}}),g&&"edit"===n?l().createElement(tn,{heading:d,onClick:e=>{m((0,c.vR)(a,{heading:e}))}}):l().createElement(l().Fragment,null))},tn=({heading:e="h1",onClick:t})=>l().createElement(Kt,null,["h1","h2","h3","h4"].map(((n,i)=>l().createElement(Zt,{key:i,isActive:e===n,onClick:()=>t(n)},n)))),nn=d.j.getLazyComponent("Button"),ln=d.j.getLazyComponent("ModalLayout"),on=d.j.getLazyComponent("ModalContent"),an=(a().button`
343
+ `,en=({widget:e,inplace:t,mode:n,dataCy:o})=>{const{uniqid:a}=e,{text:r,color:s,heading:d}=e.content,m=(0,u.jL)(),g=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),G.shallowEqual);return(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!r||0===r.length}))}),[r]),l().createElement(Xt,null,l().createElement(Qt,{dataCy:o,text:r,color:s,heading:d,autoFocus:g,inplace:t,mode:n,onChange:e=>{m((0,c.vR)(a,{text:e}))}}),g&&"edit"===n?l().createElement(tn,{heading:d,onClick:e=>{m((0,c.vR)(a,{heading:e}))}}):l().createElement(l().Fragment,null))},tn=({heading:e="h1",onClick:t})=>l().createElement(Kt,null,["h1","h2","h3","h4"].map(((n,i)=>l().createElement(Zt,{key:i,isActive:e===n,onClick:()=>t(n)},n))));var nn=n(586);const ln=d.j.getLazyComponent("Button"),on=d.j.getLazyComponent("ModalLayout"),an=d.j.getLazyComponent("ModalContent"),rn=(a().button`
341
344
  padding: ${e=>e.theme.space.md}px;
342
345
  `,a().div`
343
346
  padding: ${e=>e.theme.space.md}px;
344
347
  display: flex;
345
348
  flex-direction: row-reverse;
346
- `),rn=({id:e,type:t,uniqid:n})=>{const o=(0,u.jL)(),a=(0,r.useIntl)(),[d,m]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCIconButton,{iconSize:14,onClick:()=>m(!0),icon:"icon-trash"}),d&&l().createElement(ln,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(on,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(an,null,l().createElement(nn,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{k().widget.removeWidget({id:e,type:t,uniqid:n}).then((()=>{o(c.x0.slice.actions.flushWidget({uniqid:n}))})).catch((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}}))))},sn=a().div`
349
+ `),sn=({id:e,type:t,uniqid:n})=>{const o=(0,u.jL)(),a=(0,r.useIntl)(),[d,m]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCIconButton,{iconSize:14,onClick:()=>m(!0),icon:"icon-trash"}),d&&l().createElement(on,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(an,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(rn,null,l().createElement(ln,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{k().widget.removeWidget({id:e,type:t,uniqid:n}).then((()=>{o(c.x0.slice.actions.flushWidget({uniqid:n}))})).catch((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}}))))},cn=a().div`
347
350
  display: flex;
348
351
  flex: 1;
349
352
  flex-direction: row;
350
353
  border-top: 1px solid ${e=>e.theme.color.grey1};
351
- `,cn=a().button`
354
+ `,dn=a().button`
352
355
  display: flex;
353
356
  flex: 1;
354
357
  justify-content: center;
@@ -357,21 +360,21 @@
357
360
  &:hover {
358
361
  background-color: ${e=>e.theme.color.grey0};
359
362
  }
360
- `,dn=({name:e,uniqid:t,mode:n,collaborationRights:o,handleOpenEditor:a})=>{const s=(0,r.useIntl)(),d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.selectWidgetObject(e,t)),G.shallowEqual),g=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),G.shallowEqual),p=(0,i.useMemo)((()=>m&&g&&g.update||o&&o.update),[m,g,o]),f=(0,i.useMemo)((()=>m&&g&&g.delete),[m,g]),E=(0,i.useCallback)((()=>{d(c.cr.slice.actions.registerEditor({uniqid:t,name:e,mode:n}))}),[t,d,e,n]);return p&&(0,w.ensureWidgetObjectHasMinimumProperties)(m)?l().createElement(sn,null,l().createElement(cn,{onClick:null!=a?a:E},s.formatMessage({id:"WIDGET_Set_Widget"})),f&&l().createElement(rn,{id:m.id,type:m.type,uniqid:t})):l().createElement(l().Fragment,null)},un=a().div`
361
- position: absolute;
362
- inset: 0;
363
- display: flex;
364
- justify-content: center;
365
- align-items: center;
366
- background-color: rgba(255, 255, 255, 0.4);
367
- `,mn=()=>l().createElement(un,null,l().createElement(s.JRCLoader,{size:"m"})),gn=a().div`
363
+ `,un=({name:e,uniqid:t,mode:n,collaborationRights:o,handleOpenEditor:a})=>{const s=(0,r.useIntl)(),d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.selectWidgetObject(e,t)),G.shallowEqual),g=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),G.shallowEqual),p=(0,i.useMemo)((()=>m&&g&&g.update||o&&o.update),[m,g,o]),f=(0,i.useMemo)((()=>m&&g&&g.delete),[m,g]),E=(0,i.useCallback)((()=>{d(c.cr.slice.actions.registerEditor({uniqid:t,name:e,mode:n}))}),[t,d,e,n]);return p&&(0,w.ensureWidgetObjectHasMinimumProperties)(m)?l().createElement(cn,null,l().createElement(dn,{onClick:null!=a?a:E},s.formatMessage({id:"WIDGET_Set_Widget"})),f&&l().createElement(sn,{id:m.id,type:m.type,uniqid:t})):l().createElement(l().Fragment,null)},mn=a().div`
368
364
  padding: ${e=>e.theme.space.md}px;
369
365
  display: flex;
370
366
  flex-direction: row;
371
367
  fieldset {
372
368
  margin: 0.2rem !important;
373
369
  }
374
- `,pn=({placeholder:e,handleClick:t})=>{const n=(0,r.useIntl)(),o=(0,u.jL)(),[a,c]=(0,i.useState)(""),{control:d,watch:m,reset:g}=(0,be.useForm)({defaultValues:{label:a},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=m((e=>{var t;c(null!==(t=e.label)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[m,o]),l().createElement(gn,null,l().createElement(s.JRCInputText,{name:"label",control:d,placeholder:e,width:"100%"}),l().createElement(s.JRCButton,{label:n.formatMessage({id:"GLOBAL_Confirm"}),disabled:!a.length,onClick:()=>{t(a),c(""),g()}}))};var fn=n(586);const En=d.j.getLazyComponent("WidgetCheckList"),hn=d.j.getLazyComponent("WidgetCheckListEditor"),bn=(a().div`
370
+ `,gn=({placeholder:e,handleClick:t})=>{const n=(0,r.useIntl)(),o=(0,u.jL)(),[a,c]=(0,i.useState)(""),{control:d,watch:m,reset:g}=(0,be.useForm)({defaultValues:{label:a},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=m((e=>{var t;c(null!==(t=e.label)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[m,o]),l().createElement(mn,null,l().createElement(s.JRCInputText,{name:"label",control:d,placeholder:e,width:"100%"}),l().createElement(s.JRCButton,{label:n.formatMessage({id:"GLOBAL_Confirm"}),disabled:!a.length,onClick:()=>{t(a),c(""),g()}}))},pn=a().div`
371
+ position: absolute;
372
+ inset: 0;
373
+ display: flex;
374
+ justify-content: center;
375
+ align-items: center;
376
+ background-color: rgba(255, 255, 255, 0.4);
377
+ `,fn=()=>l().createElement(pn,null,l().createElement(s.JRCLoader,{size:"m"})),En=d.j.getLazyComponent("WidgetCheckList"),hn=d.j.getLazyComponent("WidgetCheckListEditor"),bn=(a().div`
375
378
  display: flex;
376
379
  flex-direction: row;
377
380
  justify-content: space-between;
@@ -387,7 +390,7 @@
387
390
  padding: 16px;
388
391
  `),vn=a().div`
389
392
  position: relative;
390
- `,yn=({widget:e,inplace:t,mode:n,onWidgetUpdate:o})=>{var a;const d=(0,r.useIntl)(),{uniqid:m,content:g}=e,p=(0,u.jL)(),[f,E]=(0,i.useState)(),[h,b]=(0,i.useState)(!1),v=(0,u.GV)(c.x0.selectors.selectToken,G.shallowEqual),y=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),G.shallowEqual),C=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),G.shallowEqual),x=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),G.shallowEqual),W=(0,i.useMemo)((()=>C&&C.update),[C]),L=(0,i.useMemo)((()=>C&&C.administrate),[C]),q=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:d.formatMessage({id:"GLOBAL_Error"})}))}),[p,d]),_=(0,i.useCallback)(((e,t)=>{p((0,c.vR)(e,t))}),[p]),j=(0,i.useCallback)((()=>{y&&(b(!0),k().widget.getWidget({uri:y,uniqid:m}).then((e=>{(0,w.ensureWidgetCheckListType)(e.result)&&_(m,e.result.content)})).catch((e=>!e.aborted&&q)).finally((()=>b(!1))))}),[m,q,y,_]),S=t=>{p(c.cr.slice.actions.flushAllEditor()),p(c.x0.slice.actions.setToken({token:t})),p(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:w.WidgetsName.CheckList,mode:n}))};(0,i.useEffect)((()=>{v||"edit"!==n||k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,v,p]),(0,i.useEffect)((()=>{var t;const n=null===(t=e.content.arr)||void 0===t?void 0:t.map((e=>{var t,n,i,l;return Object.assign(Object.assign(Object.assign({text:null!==(t=e.title)&&void 0!==t?t:"",file:null!==(n=e.file)&&void 0!==n?n:void 0,checked:null!==(i=e.value)&&void 0!==i&&i},e.links&&{links:e.links}),e.user&&{user:null!==(l=e.user)&&void 0!==l?l:void 0}),e.id&&{id:e.id,mimetype:"image/png"})}));E(n)}),[e.content.arr,g]),(0,i.useEffect)((()=>{if(!Array.isArray(x))return;const t=x.at(-1);t&&y&&t.object.uri===y&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||j())}),[x,e.uniqid,y,q,p,j]);const M=t=>{if(!e.content.arr||!y)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});k().widget.updateWidget({uri:y,uniqid:e.uniqid,content:n,v2:!0}).then((()=>_(e.uniqid,n))).catch((e=>q(e.errorMsg)))},T=(0,i.useMemo)((()=>{if(!Array.isArray(g.arr))return[];const e=[];return g.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[g]);return"edit"===n&&t?l().createElement(bn,null,l().createElement(hn,{token:v,uniqid:m,content:Object.assign(Object.assign({},g),{arr:null===(a=g.arr)||void 0===a?void 0:a.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),inplace:t,onChangeContent:_,onChangeWrapper:e=>{p(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>p((0,c.vR)(e.uniqid,t))})):l().createElement(fn.M,{useRT:()=>{(0,st.AW)(e.uniqid)}},f&&l().createElement(s.JRCFileViewer,{files:T,openWithOptions:[]},(t=>l().createElement(vn,{key:e.uniqid},l().createElement(En,{limit:10,initialEntries:f,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{y&&(h||(b(!0),k().widget.checkListRespond({uri:y,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{q(e.message),b(!1)}))))})(e.uniqid,t)}),g.edit&&l().createElement(pn,{handleClick:M,placeholder:d.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),L&&v&&l().createElement(dn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!W)},mode:n,handleOpenEditor:()=>{v?S(v):(b(!0),k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result})),S(e.result)})).finally((()=>b(!1))))}}),h&&l().createElement(mn,null)))))},Cn=(e,t)=>{const n=[];return e.filter((e=>e.isVisible)).forEach((e=>{const i=t.find((t=>t.name===e.name));i&&n.push(i)})),n},xn=d.j.getLazyComponent("Button"),wn=d.j.getLazyComponent("Html"),kn=d.j.getLazyComponent("WidgetTable"),Wn=d.j.getLazyComponent("Loader"),Ln=(a().div``,a().div`
393
+ `,yn=({widget:e,inplace:t,mode:n,onWidgetUpdate:o})=>{var a;const d=(0,r.useIntl)(),{uniqid:m,content:g}=e,p=(0,u.jL)(),[f,E]=(0,i.useState)(),[h,b]=(0,i.useState)(!1),[v,y]=(0,i.useState)(),[C,x]=(0,i.useState)(!1),W=(0,u.GV)(c.x0.selectors.selectToken,G.shallowEqual),L=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),G.shallowEqual),_=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),G.shallowEqual),q=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),G.shallowEqual),j=(0,i.useMemo)((()=>_&&_.update),[_]),S=(0,i.useMemo)((()=>_&&_.administrate),[_]),M=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:d.formatMessage({id:"GLOBAL_Error"})}))}),[p,d]),T=(0,i.useCallback)((()=>{f||h||(b(!0),k().network.token().then((e=>{E(e.result),b(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{M(e.errorMsg)})))}),[M,f,h,p]);W?f||E(W):T();const I=(0,i.useCallback)(((e,t)=>{p((0,c.vR)(e,t))}),[p]),A=(0,i.useCallback)((()=>{L&&(x(!0),k().widget.getWidget({uri:L,uniqid:m}).then((e=>{(0,w.ensureWidgetCheckListType)(e.result)&&I(m,e.result.content)})).catch((e=>!e.aborted&&M)).finally((()=>x(!1))))}),[m,M,L,I]),O=t=>{p(c.cr.slice.actions.flushAllEditor()),p(c.x0.slice.actions.setToken({token:t})),p(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:w.WidgetsName.CheckList,mode:n}))};(0,i.useEffect)((()=>{f||"edit"!==n||k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,f,p]),(0,i.useEffect)((()=>{var t;const n=null===(t=e.content.arr)||void 0===t?void 0:t.map((e=>{var t,n,i,l;return Object.assign(Object.assign(Object.assign({text:null!==(t=e.title)&&void 0!==t?t:"",file:null!==(n=e.file)&&void 0!==n?n:void 0,checked:null!==(i=e.value)&&void 0!==i&&i},e.links&&{links:e.links}),e.user&&{user:null!==(l=e.user)&&void 0!==l?l:void 0}),e.id&&{id:e.id,mimetype:"image/png"})}));y(n)}),[e.content.arr,g]),(0,i.useEffect)((()=>{if(!Array.isArray(q))return;const t=q.at(-1);t&&L&&t.object.uri===L&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||A())}),[q,e.uniqid,L,M,p,A]);const z=t=>{if(!e.content.arr||!L)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});k().widget.updateWidget({uri:L,uniqid:e.uniqid,content:n,v2:!0}).then((()=>I(e.uniqid,n))).catch((e=>M(e.errorMsg)))},D=(0,i.useMemo)((()=>{if(!Array.isArray(g.arr))return[];const e=[];return g.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[g]);return"edit"===n&&t?l().createElement(bn,null,l().createElement(hn,{token:f,uniqid:m,content:Object.assign(Object.assign({},g),{arr:null===(a=g.arr)||void 0===a?void 0:a.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),inplace:t,onChangeContent:I,onChangeWrapper:e=>{p(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>p((0,c.vR)(e.uniqid,t))})):l().createElement(nn.M,{useRT:()=>{(0,st.AW)(e.uniqid)}},v&&l().createElement(s.JRCFileViewer,{files:D,openWithOptions:[]},(t=>l().createElement(vn,{key:e.uniqid},l().createElement(En,{limit:10,initialEntries:v,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{L&&(C||(x(!0),k().widget.checkListRespond({uri:L,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{M(e.message),x(!1)}))))})(e.uniqid,t)}),g.edit&&l().createElement(gn,{handleClick:z,placeholder:d.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),S&&f&&l().createElement(un,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!j)},mode:n,handleOpenEditor:()=>{f?O(f):(x(!0),k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result})),O(e.result)})).finally((()=>x(!1))))}}),C&&l().createElement(fn,null)))))},Cn=(e,t)=>{const n=[];return e.filter((e=>e.isVisible)).forEach((e=>{const i=t.find((t=>t.name===e.name));i&&n.push(i)})),n},xn=d.j.getLazyComponent("Button"),wn=d.j.getLazyComponent("Html"),kn=d.j.getLazyComponent("WidgetTable"),Wn=d.j.getLazyComponent("Loader"),Ln=(a().div``,a().div`
391
394
  position: absolute;
392
395
  inset: 0;
393
396
  display: flex;
@@ -395,7 +398,7 @@
395
398
  justify-content: center;
396
399
  align-items: center;
397
400
  gap: ${e=>e.theme.space.md}px;
398
- `),qn=a().div`
401
+ `),_n=a().div`
399
402
  position: absolute;
400
403
  inset: 0;
401
404
  display: flex;
@@ -411,7 +414,7 @@
411
414
  background-color: ${e=>e.theme.color.grey2};
412
415
  opacity: 0.9;
413
416
  }
414
- `,_n=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableColumnsData:g=[],tableBorderRadius:p,tableSizedColumns:f,tableSizedColumnsWidth:E,mode:h})=>{const b=(0,r.useIntl)(),v=(0,u.jL)(),[y,C]=(0,i.useState)(!1),[x,W]=(0,i.useState)(!1),[L,q]=(0,i.useState)([]),[_,j]=(0,i.useState)([]),[S,M]=(0,i.useState)({order:"ascending",name:"unknown"}),[T,I]=(0,i.useState)(void 0),[A,O]=(0,i.useState)(""),G=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.DatasourceTable)),[]),z=(0,i.useMemo)((()=>"studio"===T?[{type:[A]}]:[]),[T,A]),D=(0,i.useMemo)((()=>"doc"===T?[A]:[]),[T,A]),{rtLastObject:$}=(0,st.YL)(z,D),V=(0,i.useCallback)((()=>{t&&(W(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{j(e.result.model),q(e.result.data),M(e.result.sort),I(e.result.datasource.datasourceType),O(e.result.datasource.datasourceIdentifier)})).finally((()=>W(!1))))}),[t]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===_.length&&V()}),[t,g,_,V]),(0,i.useEffect)((()=>{$&&V()}),[$,V]),(0,i.useEffect)((()=>{t||j([])}),[t]);const F=(0,i.useCallback)((()=>{v(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>{v(c.cr.slice.actions.registerEditor({uniqid:e,name:w.WidgetsName.DatasourceTable}))}),0)}),[v,e]);(0,i.useEffect)((()=>{"view"!==h&&"preview"!==h||v(c.cr.slice.actions.flushAllEditor())}),[h,v]),(0,i.useEffect)((()=>{y||t||"edit"!==h||(F(),C(!0))}),[v,e,y,t,F,h]);const R=(0,i.useMemo)((()=>Cn(g,_)),[g,_]);return 0!==g.length||x||"edit"!==h?x?l().createElement(Ln,null,l().createElement(Wn,null)):l().createElement(l().Fragment,null,x||0!==L.length?l().createElement(kn,{rows:L,columns:R,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:f,tableSizedColumnsWidth:E,tableDefaultSortOrder:S.order,tableDefaultSortName:S.name}):l().createElement(Ln,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===h?l().createElement(qn,{onClick:F},l().createElement(wn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:G.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(Ln,{onClick:F},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:G.label}),l().createElement(xn,{label:"GLOBAL_Settings"})),l().createElement(qn,{onClick:F},l().createElement(wn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:G.label})}</b>`})))},jn=d.j.getLazyComponent("Button"),Sn=d.j.getLazyComponent("Html"),Mn=d.j.getLazyComponent("WidgetTable"),Tn=d.j.getLazyComponent("Loader"),In=(a().div``,a().div`
417
+ `,qn=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableColumnsData:g=[],tableBorderRadius:p,tableSizedColumns:f,tableSizedColumnsWidth:E,mode:h})=>{const b=(0,r.useIntl)(),v=(0,u.jL)(),[y,C]=(0,i.useState)(!1),[x,W]=(0,i.useState)(!1),[L,_]=(0,i.useState)([]),[q,j]=(0,i.useState)([]),[S,M]=(0,i.useState)({order:"ascending",name:"unknown"}),[T,I]=(0,i.useState)(void 0),[A,O]=(0,i.useState)(""),G=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.DatasourceTable)),[]),z=(0,i.useMemo)((()=>"studio"===T?[{type:[A]}]:[]),[T,A]),D=(0,i.useMemo)((()=>"doc"===T?[A]:[]),[T,A]),{rtLastObject:$}=(0,st.YL)(z,D),V=(0,i.useCallback)((()=>{t&&(W(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{j(e.result.model),_(e.result.data),M(e.result.sort),I(e.result.datasource.datasourceType),O(e.result.datasource.datasourceIdentifier)})).finally((()=>W(!1))))}),[t]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===q.length&&V()}),[t,g,q,V]),(0,i.useEffect)((()=>{$&&V()}),[$,V]),(0,i.useEffect)((()=>{t||j([])}),[t]);const F=(0,i.useCallback)((()=>{v(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>{v(c.cr.slice.actions.registerEditor({uniqid:e,name:w.WidgetsName.DatasourceTable}))}),0)}),[v,e]);(0,i.useEffect)((()=>{"view"!==h&&"preview"!==h||v(c.cr.slice.actions.flushAllEditor())}),[h,v]),(0,i.useEffect)((()=>{y||t||"edit"!==h||(F(),C(!0))}),[v,e,y,t,F,h]);const R=(0,i.useMemo)((()=>Cn(g,q)),[g,q]);return 0!==g.length||x||"edit"!==h?x?l().createElement(Ln,null,l().createElement(Wn,null)):l().createElement(l().Fragment,null,x||0!==L.length?l().createElement(kn,{rows:L,columns:R,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:f,tableSizedColumnsWidth:E,tableDefaultSortOrder:S.order,tableDefaultSortName:S.name}):l().createElement(Ln,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===h?l().createElement(_n,{onClick:F},l().createElement(wn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:G.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(Ln,{onClick:F},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:G.label}),l().createElement(xn,{label:"GLOBAL_Settings"})),l().createElement(_n,{onClick:F},l().createElement(wn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:G.label})}</b>`})))},jn=d.j.getLazyComponent("Button"),Sn=d.j.getLazyComponent("Html"),Mn=d.j.getLazyComponent("WidgetTable"),Tn=d.j.getLazyComponent("Loader"),In=(a().div``,a().div`
415
418
  position: absolute;
416
419
  inset: 0;
417
420
  display: flex;
@@ -435,7 +438,7 @@
435
438
  background-color: ${e=>e.theme.color.grey2};
436
439
  opacity: 0.9;
437
440
  }
438
- `,On=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableColumnsData:g=[],tableBorderRadius:p,tableSizedColumns:f,tableSizedColumnsWidth:E,mode:h})=>{const b=(0,r.useIntl)(),v=(0,u.jL)(),[y,C]=(0,i.useState)(!1),[x,W]=(0,i.useState)(!1),[L,q]=(0,i.useState)([]),[_,j]=(0,i.useState)([]),S=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===_.length&&(W(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{j(e.result.model),q(e.result.data)})).finally((()=>W(!1))))}),[t,g,_]),(0,i.useEffect)((()=>{t||j([])}),[t]);const M=(0,i.useCallback)((()=>{v(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>v(c.cr.slice.actions.registerEditor({uniqid:e,name:w.WidgetsName.ExcelDatasourceTable}))),0)}),[v,e]);(0,i.useEffect)((()=>{"view"!==h&&"preview"!==h||v(c.cr.slice.actions.flushAllEditor())}),[h,v]),(0,i.useEffect)((()=>{y||t||"edit"!==h||(M(),C(!0))}),[v,e,y,t,M,h]);const T=(0,i.useMemo)((()=>Cn(g,_)),[g,_]);return 0!==g.length||x||"edit"!==h?x?l().createElement(In,null,l().createElement(Tn,null)):l().createElement(l().Fragment,null,x||0!==L.length?l().createElement(Mn,{rows:L,columns:T,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:f,tableSizedColumnsWidth:E}):l().createElement(In,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===h?l().createElement(An,{onClick:M},l().createElement(Sn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:S.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(In,{onClick:M},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:S.label}),l().createElement(jn,{label:"GLOBAL_Settings"})),l().createElement(An,{onClick:M},l().createElement(Sn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:S.label})}</b>`})))},Gn=a().div`
441
+ `,On=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableColumnsData:g=[],tableBorderRadius:p,tableSizedColumns:f,tableSizedColumnsWidth:E,mode:h})=>{const b=(0,r.useIntl)(),v=(0,u.jL)(),[y,C]=(0,i.useState)(!1),[x,W]=(0,i.useState)(!1),[L,_]=(0,i.useState)([]),[q,j]=(0,i.useState)([]),S=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===q.length&&(W(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{j(e.result.model),_(e.result.data)})).finally((()=>W(!1))))}),[t,g,q]),(0,i.useEffect)((()=>{t||j([])}),[t]);const M=(0,i.useCallback)((()=>{v(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>v(c.cr.slice.actions.registerEditor({uniqid:e,name:w.WidgetsName.ExcelDatasourceTable}))),0)}),[v,e]);(0,i.useEffect)((()=>{"view"!==h&&"preview"!==h||v(c.cr.slice.actions.flushAllEditor())}),[h,v]),(0,i.useEffect)((()=>{y||t||"edit"!==h||(M(),C(!0))}),[v,e,y,t,M,h]);const T=(0,i.useMemo)((()=>Cn(g,q)),[g,q]);return 0!==g.length||x||"edit"!==h?x?l().createElement(In,null,l().createElement(Tn,null)):l().createElement(l().Fragment,null,x||0!==L.length?l().createElement(Mn,{rows:L,columns:T,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:f,tableSizedColumnsWidth:E}):l().createElement(In,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===h?l().createElement(An,{onClick:M},l().createElement(Sn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:S.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(In,{onClick:M},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:S.label}),l().createElement(jn,{label:"GLOBAL_Settings"})),l().createElement(An,{onClick:M},l().createElement(Sn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:S.label})}</b>`})))},Gn=a().div`
439
442
  padding: ${e=>e.theme.space.md}px;
440
443
  `,zn=a().a`
441
444
  cursor: pointer;
@@ -466,24 +469,24 @@
466
469
  align-items: center;
467
470
  border-radius: ${e=>e.theme.space.sm}px;
468
471
  margin: ${e=>e.theme.space.sm}px;
469
- `),Hn=({widget:e,mode:t})=>{const n=(0,r.useIntl)(),o=(0,u.jL)(),{limit:a,limitValue:s,closing:d,isClosed:m}=e.content,{uniqid:g}=e,[p,f]=(0,i.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[E,h]=(0,i.useState)(!1),[b]=(0,i.useState)(new AbortController),[v,y]=(0,i.useState)(!1),[C,x]=(0,i.useState)(),[w,W]=(0,i.useState)(),L=(0,i.useRef)(b),q=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),G.shallowEqual),_=(0,u.GV)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),G.shallowEqual),j=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),S=(0,i.useMemo)((()=>!(a&&s&&p.userAvailableTotal>=s)),[a,s,p.userAvailableTotal]),M=(0,i.useMemo)((()=>d&&m||"edit"===t),[d,m,t]),T=(0,i.useCallback)((()=>{q&&!M&&(S?(h(!0),k().widget.presenceCancel({uri:q,uniqid:g}).catch(j).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,j,q,S,M]),I=(0,i.useCallback)((e=>{q&&!M&&(h(!0),k().widget.presenceRespond({uri:q,uniqid:g,value:e},L.current.signal).catch(j).finally((()=>h(!1))))}),[q,g,j,M]),A=(0,i.useCallback)((()=>{"edit"!==t&&q&&(h(!0),k().widget.presenceGetResponse({uri:q,uniqid:g},L.current.signal).then((e=>{f(e.result)})).catch((e=>!e.aborted&&j())).finally((()=>h(!1))))}),[q,j,g,t]),O=(e,t)=>{q&&k().widget.presenceGetResponseUserList({uri:q,uniqid:g,index:e,page:t,limit:8},L.current.signal).then((e=>{W(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&j))},z=(0,i.useCallback)((()=>{q&&(h(!0),k().widget.getWidget({uri:q,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&j)).finally((()=>h(!1))))}),[o,j,q,g]);return(0,i.useEffect)((()=>{const e=L.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{A()}),[A]),(0,i.useEffect)((()=>{if(!Array.isArray(_))return;const e=_.at(-1);e&&q&&e.object.uri===q&&e.uniqid===g&&("widget-presence-response"===e.fn&&A(),"widget-update"===e.fn&&z())}),[_,A,g,q,z]),l().createElement(fn.M,{useRT:()=>{(0,st.AW)(e.uniqid)}},l().createElement(Rn,null,l().createElement(Vn,{limit:a,limitValue:s,userAvailableList:p.userAvailableList,userUnavailableList:p.userUnavailableList,userValue:p.userValue,userAvailableTotal:null==p?void 0:p.userAvailableTotal,userUnavailableTotal:null==p?void 0:p.userUnavailableTotal,isClosed:d&&m,handleClickAvailable:()=>1===p.userValue?T():I(1),handleClickUnavailable:()=>0===p.userValue?T():I(0),handleOpenUsersModal:e=>{W({limit:0,page:0,data:[],cnt:0}),x(e),O(e),y(!0)}}),d&&m&&l().createElement(Bn,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),d&&!m&&l().createElement($n,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(dn,{uniqid:e.uniqid,name:e.name,mode:t}),E&&l().createElement(mn,null),l().createElement(Fn,{open:v,usersList:w,title:1===C?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:y,onClose:()=>{W({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{O(null!=C?C:0,e)}})))},Un=d.j.getLazyComponent("WidgetQuickSurvey"),Pn=d.j.getLazyComponent("WidgetQuickSurveyEditor"),Nn=d.j.getLazyComponent("ModalUserList"),Yn=a().div`
472
+ `),Hn=({widget:e,mode:t})=>{const n=(0,r.useIntl)(),o=(0,u.jL)(),{limit:a,limitValue:s,closing:d,isClosed:m}=e.content,{uniqid:g}=e,[p,f]=(0,i.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[E,h]=(0,i.useState)(!1),[b]=(0,i.useState)(new AbortController),[v,y]=(0,i.useState)(!1),[C,x]=(0,i.useState)(),[w,W]=(0,i.useState)(),L=(0,i.useRef)(b),_=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),G.shallowEqual),q=(0,u.GV)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),G.shallowEqual),j=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),S=(0,i.useMemo)((()=>!(a&&s&&p.userAvailableTotal>=s)),[a,s,p.userAvailableTotal]),M=(0,i.useMemo)((()=>d&&m||"edit"===t),[d,m,t]),T=(0,i.useCallback)((()=>{_&&!M&&(S?(h(!0),k().widget.presenceCancel({uri:_,uniqid:g}).catch(j).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,j,_,S,M]),I=(0,i.useCallback)((e=>{_&&!M&&(h(!0),k().widget.presenceRespond({uri:_,uniqid:g,value:e},L.current.signal).catch(j).finally((()=>h(!1))))}),[_,g,j,M]),A=(0,i.useCallback)((()=>{"edit"!==t&&_&&(h(!0),k().widget.presenceGetResponse({uri:_,uniqid:g},L.current.signal).then((e=>{f(e.result)})).catch((e=>!e.aborted&&j())).finally((()=>h(!1))))}),[_,j,g,t]),O=(e,t)=>{_&&k().widget.presenceGetResponseUserList({uri:_,uniqid:g,index:e,page:t,limit:8},L.current.signal).then((e=>{W(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&j))},z=(0,i.useCallback)((()=>{_&&(h(!0),k().widget.getWidget({uri:_,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&j)).finally((()=>h(!1))))}),[o,j,_,g]);return(0,i.useEffect)((()=>{const e=L.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{A()}),[A]),(0,i.useEffect)((()=>{if(!Array.isArray(q))return;const e=q.at(-1);e&&_&&e.object.uri===_&&e.uniqid===g&&("widget-presence-response"===e.fn&&A(),"widget-update"===e.fn&&z())}),[q,A,g,_,z]),l().createElement(nn.M,{useRT:()=>{(0,st.AW)(e.uniqid)}},l().createElement(Rn,null,l().createElement(Vn,{limit:a,limitValue:s,userAvailableList:p.userAvailableList,userUnavailableList:p.userUnavailableList,userValue:p.userValue,userAvailableTotal:null==p?void 0:p.userAvailableTotal,userUnavailableTotal:null==p?void 0:p.userUnavailableTotal,isClosed:d&&m,handleClickAvailable:()=>1===p.userValue?T():I(1),handleClickUnavailable:()=>0===p.userValue?T():I(0),handleOpenUsersModal:e=>{W({limit:0,page:0,data:[],cnt:0}),x(e),O(e),y(!0)}}),d&&m&&l().createElement(Bn,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),d&&!m&&l().createElement($n,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(un,{uniqid:e.uniqid,name:e.name,mode:t}),E&&l().createElement(fn,null),l().createElement(Fn,{open:v,usersList:w,title:1===C?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:y,onClose:()=>{W({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{O(null!=C?C:0,e)}})))},Pn=d.j.getLazyComponent("WidgetQuickSurvey"),Un=d.j.getLazyComponent("WidgetQuickSurveyEditor"),Nn=d.j.getLazyComponent("ModalUserList"),Yn=a().div`
470
473
  width: 100%;
471
474
  display: flex;
472
475
  flex-direction: column;
473
476
  gap: 14px;
474
477
  ${e=>e.withPadding&&"padding: 0 12px;"}
475
478
  padding-top: 16px;
476
- `,Jn=({widget:e,inplace:t,mode:n})=>{var o,a,d;const m=(0,r.useIntl)(),g=(0,u.jL)(),{uniqid:p,content:f}=e,[E,h]=(0,i.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)(!1),[x,W]=(0,i.useState)(),[L,q]=(0,i.useState)(),[_]=(0,i.useState)(new AbortController),j=(0,i.useRef)(_),S=(0,u.GV)(c.x0.selectors.selectToken,G.shallowEqual),M=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),G.shallowEqual),T=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),G.shallowEqual),I=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),G.shallowEqual),A=(0,i.useCallback)(((e,t)=>{g((0,c.vR)(e,t))}),[g]),O=t=>{g(c.cr.slice.actions.flushAllEditor()),g(c.x0.slice.actions.setToken({token:t})),g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:w.WidgetsName.QuickSurvey}))},z=(0,i.useCallback)((()=>g(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[g]),D=(0,i.useCallback)((e=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyGetResponse({uri:M,uniqid:e},j.current.signal).then((e=>{h(e.result)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[z,M,n]),$=(0,i.useCallback)((()=>{M&&(C(!0),k().widget.getWidget({uri:M,uniqid:p},j.current.signal).then((e=>{A(p,e.result.content)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[p,z,M,A]),V=()=>{if(M&&f.closing){const e=Object.assign(Object.assign({},f),{isClosed:!0});k().widget.updateWidget({uri:M,uniqid:p,content:e}).catch((()=>{z()}))}},F=t=>{(t=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyRespond({uri:M,index:t,multi:f.multi?1:0,uniqid:p},j.current.signal).then((()=>{D(e.uniqid)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))})(t)},R=(e,t)=>{M&&k().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},j.current.signal).then((e=>{q(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&z))},B=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{D(e.uniqid)}),[D,e.uniqid]),(0,i.useEffect)((()=>{if(!Array.isArray(I))return;const t=I.at(-1);t&&M&&t.object.uri===M&&t.uniqid===e.uniqid&&("widget-quick-survey-response"===t.fn&&D(e.uniqid),"widget-update"===t.fn&&$())}),[I,M,e.uniqid,$,D]);const H=(0,i.useMemo)((()=>{if(!Array.isArray(f.arr))return[];const e=[];return f.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[f]);return(0,i.useEffect)((()=>{S||"edit"!==n||k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,S,g]),"edit"===n&&t?l().createElement(Yn,{withPadding:!0},l().createElement(Pn,{token:S,uniqid:p,content:e.content,onChangeContent:A,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:e=>A(p,e),inplace:t})):l().createElement(fn.M,{useRT:()=>{(0,st.AW)(e.uniqid)}},l().createElement(Yn,null,l().createElement(s.JRCFileViewer,{files:H,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(Un,{limit:null!==(n=E.totalResponse)&&void 0!==n?n:0,values:null!==(i=f.arr)&&void 0!==i?i:[],userResponses:E.userResponses,userHasAlreadyVoted:E.userLoggedResponses.length>0,canCloseSurvey:null!==(o=e.content.closing)&&void 0!==o&&o,isClosed:null!==(a=e.content.isClosed)&&void 0!==a&&a,open:null!==(r=e.content.open)&&void 0!==r&&r,anonymize:null!==(s=e.content.anonymize)&&void 0!==s&&s,seeResponseAfter:null!==(c=e.content.seeResponseAfter)&&void 0!==c&&c,canUpdate:B,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:V,handleProgressBarClick:F,setOpenUsersModal:e=>{W(e),R(e),v(!0)}})})),f.open&&l().createElement(pn,{handleClick:e=>{var t;if(!M)return;const n=Object.assign(Object.assign({},f),{arr:[...null!==(t=f.arr)&&void 0!==t?t:[],{title:e}]});k().widget.quickSurveyAddEnty({uri:M,uniqid:p,label:e}).then((()=>{g(c.x0.slice.actions.updateWidget({uniqid:p,content:n}))})).catch(z)},placeholder:m.formatMessage({id:"FIELDS_Add_Option"})}),B&&l().createElement(dn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!B},mode:n,handleOpenEditor:()=>{S?O(S):(C(!0),k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result})),O(e.result)})).finally((()=>C(!1))))}}),y&&l().createElement(mn,null),l().createElement(Nn,{open:b,usersList:L,title:null!==(d=null===(a=null===(o=f.arr)||void 0===o?void 0:o[null!=x?x:0])||void 0===a?void 0:a.title)&&void 0!==d?d:"",setOpen:v,handleLoadUsersList:e=>{R(null!=x?x:0,e)},onClose:()=>{q({limit:0,page:0,data:[],cnt:0})}})))},Qn=d.j.getLazyComponent("ModalLayout"),Xn=d.j.getLazyComponent("ModalContent"),Kn=d.j.getLazyComponent("Button"),Zn=d.j.getLazyComponent("InputText"),ei=d.j.getLazyComponent("InputSelect"),ti=d.j.getLazyComponent("InputPassword"),ni=d.j.getLazyComponent("Typography"),ii=a().div`
479
+ `,Jn=({widget:e,inplace:t,mode:n})=>{var o,a,d;const m=(0,r.useIntl)(),g=(0,u.jL)(),{uniqid:p,content:f}=e,[E,h]=(0,i.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)(!1),[x,W]=(0,i.useState)(),[L,_]=(0,i.useState)(),[q]=(0,i.useState)(new AbortController),j=(0,i.useRef)(q),S=(0,u.GV)(c.x0.selectors.selectToken,G.shallowEqual),M=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),G.shallowEqual),T=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),G.shallowEqual),I=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),G.shallowEqual),A=(0,i.useCallback)(((e,t)=>{g((0,c.vR)(e,t))}),[g]),O=t=>{g(c.cr.slice.actions.flushAllEditor()),g(c.x0.slice.actions.setToken({token:t})),g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:w.WidgetsName.QuickSurvey}))},z=(0,i.useCallback)((()=>g(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[g]),D=(0,i.useCallback)((e=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyGetResponse({uri:M,uniqid:e},j.current.signal).then((e=>{h(e.result)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[z,M,n]),$=(0,i.useCallback)((()=>{M&&(C(!0),k().widget.getWidget({uri:M,uniqid:p},j.current.signal).then((e=>{A(p,e.result.content)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[p,z,M,A]),V=()=>{if(M&&f.closing){const e=Object.assign(Object.assign({},f),{isClosed:!0});k().widget.updateWidget({uri:M,uniqid:p,content:e}).catch((()=>{z()}))}},F=t=>{(t=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyRespond({uri:M,index:t,multi:f.multi?1:0,uniqid:p},j.current.signal).then((()=>{D(e.uniqid)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))})(t)},R=(e,t)=>{M&&k().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},j.current.signal).then((e=>{_(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&z))},B=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{D(e.uniqid)}),[D,e.uniqid]),(0,i.useEffect)((()=>{if(!Array.isArray(I))return;const t=I.at(-1);t&&M&&t.object.uri===M&&t.uniqid===e.uniqid&&("widget-quick-survey-response"===t.fn&&D(e.uniqid),"widget-update"===t.fn&&$())}),[I,M,e.uniqid,$,D]);const H=(0,i.useMemo)((()=>{if(!Array.isArray(f.arr))return[];const e=[];return f.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[f]);return(0,i.useEffect)((()=>{S||"edit"!==n||k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,S,g]),"edit"===n&&t?l().createElement(Yn,{withPadding:!0},l().createElement(Un,{token:S,uniqid:p,content:e.content,onChangeContent:A,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:e=>A(p,e),inplace:t})):l().createElement(nn.M,{useRT:()=>{(0,st.AW)(e.uniqid)}},l().createElement(Yn,null,l().createElement(s.JRCFileViewer,{files:H,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(Pn,{limit:null!==(n=E.totalResponse)&&void 0!==n?n:0,values:null!==(i=f.arr)&&void 0!==i?i:[],userResponses:E.userResponses,userHasAlreadyVoted:E.userLoggedResponses.length>0,canCloseSurvey:null!==(o=e.content.closing)&&void 0!==o&&o,isClosed:null!==(a=e.content.isClosed)&&void 0!==a&&a,open:null!==(r=e.content.open)&&void 0!==r&&r,anonymize:null!==(s=e.content.anonymize)&&void 0!==s&&s,seeResponseAfter:null!==(c=e.content.seeResponseAfter)&&void 0!==c&&c,canUpdate:B,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:V,handleProgressBarClick:F,setOpenUsersModal:e=>{W(e),R(e),v(!0)}})})),f.open&&l().createElement(gn,{handleClick:e=>{var t;if(!M)return;const n=Object.assign(Object.assign({},f),{arr:[...null!==(t=f.arr)&&void 0!==t?t:[],{title:e}]});k().widget.quickSurveyAddEnty({uri:M,uniqid:p,label:e}).then((()=>{g(c.x0.slice.actions.updateWidget({uniqid:p,content:n}))})).catch(z)},placeholder:m.formatMessage({id:"FIELDS_Add_Option"})}),B&&l().createElement(un,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!B},mode:n,handleOpenEditor:()=>{S?O(S):(C(!0),k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result})),O(e.result)})).finally((()=>C(!1))))}}),y&&l().createElement(fn,null),l().createElement(Nn,{open:b,usersList:L,title:null!==(d=null===(a=null===(o=f.arr)||void 0===o?void 0:o[null!=x?x:0])||void 0===a?void 0:a.title)&&void 0!==d?d:"",setOpen:v,handleLoadUsersList:e=>{R(null!=x?x:0,e)},onClose:()=>{_({limit:0,page:0,data:[],cnt:0})}})))},Qn=d.j.getLazyComponent("ModalLayout"),Xn=d.j.getLazyComponent("ModalContent"),Kn=d.j.getLazyComponent("Button"),Zn=d.j.getLazyComponent("InputText"),ei=d.j.getLazyComponent("InputNumber"),ti=d.j.getLazyComponent("InputSelect"),ni=d.j.getLazyComponent("InputPassword"),ii=d.j.getLazyComponent("Typography"),li=a().div`
477
480
  display: flex;
478
481
  flex-direction: column;
479
482
  opacity: ${e=>e.isLocked?".4":"1.0"};
480
- `,li=a().div`
483
+ `,oi=a().div`
481
484
  position: absolute;
482
485
  inset: 0;
483
486
  display: flex;
484
487
  justify-content: center;
485
488
  align-items: center;
486
- `,oi=a().div`
489
+ `,ai=a().div`
487
490
  background-color: ${e=>e.theme.color.orange};
488
491
  color: ${e=>e.theme.color.white};
489
492
  padding: ${e=>e.theme.space.sm}px;
@@ -491,100 +494,97 @@
491
494
  display: flex;
492
495
  justify-content: center;
493
496
  align-items: center;
494
- `,ai={username:"",password:"",hostname:"mail.sogomail.eu",imapMailbox:"INBOX",cardDavAddressBook:"personal",calDavCalendar:"personal",provider:"sogo"},ri=({handleCallback:e})=>{const t=(0,r.useIntl)(),n=(0,G.useDispatch)(),[o,a]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!1),{control:m,reset:g,setValue:p,getValues:f,watch:E,formState:{isValid:h}}=(0,be.useForm)({defaultValues:ai,criteriaMode:"all"}),[b,v]=(0,i.useState)([]),y=E();(0,i.useEffect)((()=>{o&&(u(!0),k().office.getProviders().then((({result:e})=>v(e))).catch((e=>n(c.y8.actions.error({label:e.errorMsg})))).finally((()=>u(!1))))}),[o,n]),(0,i.useEffect)((()=>{1===b.length&&p("provider",b[0].id)}),[b,p]);const C=()=>a(!1);return l().createElement(l().Fragment,null,l().createElement(li,null,l().createElement(Kn,{label:t.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>a(!0)})),l().createElement(Qn,{open:o,radius:"small",closeHandler:C},l().createElement(Xn,{overflow:"scroll",title:t.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:C},d?l().createElement(s.JRCLoader,{size:"s"}):l().createElement(l().Fragment,null,0===b.length&&l().createElement(oi,null,t.formatMessage({id:"Office_No_Providers"})),l().createElement(ii,{isLocked:0===b.length},b.length>1&&l().createElement(ni,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_Provider"})),b.length>1&&l().createElement(si,{label:"OfficeHook_Conf_Select_Provider",initialValue:{label:b[0].label,value:b[0].id},options:b.map((e=>({label:e.label,value:e.id}))),handleChange:e=>{f("provider")!==e&&g(),p("provider",e)}}),l().createElement(ni,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Settings"})),l().createElement(Zn,{control:m,name:"hostname",width:"400",placeholder:t.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),l().createElement(Zn,{control:m,name:"username",width:"400",placeholder:t.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),l().createElement(ti,{control:m,name:"password",width:"400",placeholder:t.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}}),l().createElement(ni,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_IMap"})),l().createElement(Zn,{control:m,name:"imapMailbox",width:"400",placeholder:t.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}}),l().createElement(ni,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CalDav"})),l().createElement(Zn,{control:m,name:"calDavCalendar",width:"400",placeholder:t.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}}),l().createElement(ni,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CardDav"})),l().createElement(Zn,{control:m,name:"cardDavAddressBook",width:"400",placeholder:t.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})),l().createElement(Kn,{label:t.formatMessage({id:"OfficeHook_Conf_Prompt_Submit"}),loader:d,disabled:d||0===b.length||!h,onClick:()=>{d||(u(!0),k().office.setConfiguration(y).then((({result:e})=>{window.location.reload()})).catch((e=>n(c.y8.actions.error({label:e.errorMsg})))).finally((()=>{a(!1),u(!1),g()})))}})))))},si=({label:e,initialValue:t,options:n,handleChange:o})=>{const{control:a,watch:r}=(0,be.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=r((e=>{e.provider&&e.provider.value&&o(e.provider.value)}));return()=>e.unsubscribe()}),[r,o]),l().createElement(ei,{label:e,name:"provider",options:null!=n?n:[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:a,rules:{required:!0}})},ci=a().div`
497
+ `,ri={username:"",password:"",hostname:"",imapPort:993,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},si=()=>{const e=(0,r.useIntl)(),t=(0,G.useDispatch)(),n=(0,s.useAbortController)(),[o,a]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!1),{control:m,reset:g,setValue:p,getValues:f,watch:E,formState:{isValid:h}}=(0,be.useForm)({defaultValues:ri,criteriaMode:"all"}),[b,v]=(0,i.useState)([]),y=E(),C=(0,i.useCallback)((e=>{k().office.getConfiguration().then((({result:t})=>{var n;g(Object.assign(Object.assign({},t),{provider:e.includes(null!==(n=t.provider)&&void 0!==n?n:"")?t.provider:e[0]}))}))}),[g]);(0,i.useEffect)((()=>{o&&(u(!0),k().office.getProviders({signal:n.signal}).then((({result:e})=>{n.signal.aborted||(v(e),C(e.map((e=>e.id))))})).catch((e=>{n.signal.aborted||t(c.y8.actions.error({label:e.errorMsg}))})).finally((()=>{u(!1)})))}),[o,n.signal,t,C]),(0,i.useEffect)((()=>{1===b.length&&p("provider",b[0].id)}),[b,p]);const x=()=>a(!1);return l().createElement(l().Fragment,null,l().createElement(oi,null,l().createElement(Kn,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>a(!0)})),l().createElement(Qn,{open:o,radius:"small",closeHandler:x},l().createElement(Xn,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:x},d?l().createElement(s.JRCLoader,{size:"s"}):l().createElement(l().Fragment,null,0===b.length&&l().createElement(ai,null,e.formatMessage({id:"Office_No_Providers"})),l().createElement(li,{isLocked:0===b.length},b.length>1&&l().createElement(ii,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_Provider"})),b.length>1&&l().createElement(ci,{label:"OfficeHook_Conf_Select_Provider",initialValue:{label:b[0].label,value:b[0].id},options:b.map((e=>({label:e.label,value:e.id}))),handleChange:e=>{f("provider")!==e&&g(),p("provider",e)}}),l().createElement(ii,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Settings"})),l().createElement(Zn,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),l().createElement(Zn,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),l().createElement(ni,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}}),l().createElement(ii,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_IMap_Mailbox"})),l().createElement(ei,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),l().createElement(Zn,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}}),l().createElement(ii,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})),l().createElement(Zn,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}}),l().createElement(ii,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})),l().createElement(Zn,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})),l().createElement(Kn,{label:e.formatMessage({id:"OfficeHook_Conf_Prompt_Submit"}),loader:d,disabled:d||0===b.length||!h,onClick:()=>{d||(u(!0),k().office.setConfiguration(y).then((()=>window.location.reload())).catch((e=>t(c.y8.actions.error({label:e.errorMsg})))).finally((()=>{a(!1),u(!1),g()})))}})))))},ci=({label:e,initialValue:t,options:n,handleChange:o})=>{const{control:a,watch:r}=(0,be.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=r((e=>{e.provider&&e.provider.value&&o(e.provider.value)}));return()=>e.unsubscribe()}),[r,o]),l().createElement(ti,{label:e,name:"provider",options:null!=n?n:[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:a,rules:{required:!0}})},di=a().div`
495
498
  padding: ${e=>e.theme.space.md}px;
496
- `,di=a().div`
499
+ padding-right: 0px;
500
+ `,ui=a().div`
497
501
  text-align: ${e=>e.textAlign};
498
502
  font-size: ${e=>e.fontSize}px;
499
503
  font-weight: ${e=>e.fontWeight};
500
- `,ui=({uniqid:e,textAlign:t="left",fontSize:n="16",fontWeight:i="medium"})=>{const o=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual);return l().createElement(l().Fragment,null,o&&"string"==typeof o.title&&0!==o.title.length&&l().createElement(ci,null,l().createElement(di,{textAlign:t,fontSize:n,fontWeight:i},o.title)))},mi=a().div`
501
- background-color: ${e=>e.backroundColor};
502
504
  color: ${e=>e.color};
503
- `,gi=a().div`
505
+ `,mi=({uniqid:e,textAlign:t="left",fontSize:n="16",fontWeight:i="medium",color:o})=>{const a=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual);return l().createElement(l().Fragment,null,a&&"string"==typeof a.title&&0!==a.title.length&&l().createElement(di,null,l().createElement(ui,{textAlign:t,fontSize:n,fontWeight:i,color:o},a.title)))},gi=a().div`
506
+ background-color: ${e=>e.backroundColor};
507
+ `,pi=a().div`
504
508
  display: flex;
505
509
  flex-direction: row;
506
510
  align-items: center;
507
- `,pi=(a().div`
511
+ `,fi=(a().div`
508
512
  padding: ${e=>e.theme.space.sm}px ${e=>e.theme.space.md}px;
509
513
  color: ${e=>e.theme.color.grey4};
510
514
  `,a().div`
511
515
  flex: 1;
512
- `),fi=({uniqid:e,dropdown:t,subHeader:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),G.shallowEqual),s=(0,i.useMemo)((()=>({color:r&&r.color?String(r.color):a.color.black,backgroundColor:r&&r["background-color"]?String(r["background-color"]):"transparent",fontSize:r&&r["font-size"]?String(r["font-size"]):"16",fontWeight:r&&r["font-weight"]?String(r["font-weight"]):"medium",textAlign:r&&r["text-align"]?String(r["text-align"]):"left"})),[r,a]);return l().createElement(mi,{backroundColor:s.backgroundColor,color:s.color},l().createElement(gi,null,l().createElement(pi,null,l().createElement(ui,{uniqid:e,fontWeight:s.fontWeight,fontSize:s.fontSize,textAlign:s.textAlign})),t&&t()),n&&n())},Ei=d.j.getLazyComponent("ButtonDropdown"),hi=d.j.getLazyComponent("Tooltip"),bi=(a().div`
513
516
  display: flex;
514
517
  flex-direction: row;
518
+ gap: ${e=>e.theme.space.xs}px;
515
519
  align-items: center;
516
- `,a().div`
517
- padding: ${e=>e.theme.space.md}px 0px;
518
- flex: 1;
519
- `,({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,G.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(ai).finally(n)}}];return l().createElement(fi,{uniqid:e,dropdown:()=>t&&l().createElement(hi,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Ei,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"}))})}),vi=a().div`
520
+ `),Ei=({uniqid:e,dropdown:t,subHeader:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),G.shallowEqual),s=(0,i.useMemo)((()=>({color:r&&r.color?String(r.color):a.color.black,backgroundColor:r&&r["background-color"]?String(r["background-color"]):"transparent",fontSize:r&&r["font-size"]?String(r["font-size"]):"16",fontWeight:r&&r["font-weight"]?String(r["font-weight"]):"medium",textAlign:r&&r["text-align"]?String(r["text-align"]):"left"})),[r,a]);return l().createElement(gi,{backroundColor:s.backgroundColor},l().createElement(pi,null,l().createElement(fi,null,l().createElement(mi,{uniqid:e,fontWeight:s.fontWeight,fontSize:s.fontSize,textAlign:s.textAlign,color:s.color}),n&&n(s.color)),t&&t()))},hi=d.j.getLazyComponent("ButtonDropdown"),bi=d.j.getLazyComponent("Tooltip"),vi=a().div`
521
+ margin-right: ${e=>e.theme.space.sm}px;
522
+ button {
523
+ background: ${e=>e.theme.color.white};
524
+ }
525
+ `,yi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,G.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(ri).finally(n)}}];return l().createElement(Ei,{uniqid:e,dropdown:()=>t&&l().createElement(vi,null,l().createElement(bi,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(hi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"})))})},Ci=a().div`
520
526
  flex-direction: column;
521
527
  display: flex;
522
528
  flex: 1;
523
- `,yi=a().div`
529
+ `,xi=a().div`
524
530
  position: relative;
525
531
  display: flex;
526
532
  flex: 1;
527
- `,Ci=a().div`
533
+ `,wi=a().div`
528
534
  overflow: auto;
529
535
  position: absolute;
530
536
  inset: 0;
531
- `,xi=({header:e,scrollable:t,footer:n})=>l().createElement(vi,null,e&&e(),l().createElement(yi,null,l().createElement(Ci,null,t&&t())),n&&n()),wi=a().div`
537
+ `,ki=({header:e,scrollable:t,footer:n})=>l().createElement(Ci,null,e&&e(),l().createElement(xi,null,l().createElement(wi,null,t&&t())),n&&n()),Wi=a().div`
532
538
  display: flex;
533
539
  flex-direction: column;
534
540
  padding: ${e=>e.padding};
535
- `,ki=({uniqid:e,children:t})=>{const n=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual),o=(0,i.useMemo)((()=>({padding:n&&n.padding?String(n.padding):"0"})),[n]);return l().createElement(wi,{padding:o.padding},t)},Wi=d.j.getLazyComponent("WidgetContactCardDav"),Li=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,s]=(0,i.useState)(void 0),[d,m]=(0,i.useState)(void 0),[g,p]=(0,i.useState)(!1),f=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),G.shallowEqual),[E,h]=(0,i.useState)([]),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(ai),t?window.location.reload():(s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),v=(0,i.useCallback)((e=>{s(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),y=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),C=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{m(e.dav_address_book_url)})).finally((()=>y(!1)))}),[y]),x=(0,i.useCallback)((()=>{k().office.davAddressBookGetContacts().then((({result:e})=>{h(e),p(!0)})).catch(b).finally((()=>y(!1)))}),[b,y]);return(0,i.useEffect)((()=>{if(!g)return;if(!r)return;if(f!==w.WIDGET_LEVEL_3)return;const e=setInterval(x,4e3);return()=>clearInterval(e)}),[r,x,g,f]),(0,i.useEffect)((()=>{y(!0),k().office.isConfigurationValid().then((({result:e})=>v(e))).catch(b).finally((()=>y(!1)))}),[v,f,C,y,b]),(0,i.useEffect)((()=>{if(r)return f===w.WIDGET_LEVEL_1?(y(!0),void C()):void x()}),[r,C,y,x,f]),r&&f&&f!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(f,null!=d?d:"")):l().createElement(xi,{header:()=>l().createElement(l().Fragment,null,l().createElement(bi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(ki,{uniqid:o},r&&l().createElement(Wi,{contactCardList:E}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(ri,{handleCallback:v}))})},qi=d.j.getLazyComponent("ButtonDropdown"),_i=d.j.getLazyComponent("Tooltip"),ji=(a().div`
536
- display: flex;
537
- flex-direction: row;
538
- align-items: center;
539
- `,a().div`
540
- padding: ${e=>e.theme.space.md}px 0px;
541
- flex: 1;
542
- `,({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,G.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(ai).finally(n)}}];return l().createElement(fi,{uniqid:e,dropdown:()=>t&&l().createElement(_i,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(qi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"}))})}),Si=d.j.getLazyComponent("WidgetCalendarCalDav"),Mi=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,d]=(0,i.useState)(void 0),[m,g]=(0,i.useState)(!1),p=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),G.shallowEqual),{moment:f}=(0,s.useMoment)(),[E,h]=(0,i.useState)(void 0),[b,v]=(0,i.useState)([]),y=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(ai),t?window.location.reload():(d(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),C=(0,i.useCallback)((e=>{d(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),x=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),W=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{h(e.dav_calendar_url)})).finally((()=>x(!1)))}),[x]),L=(0,i.useCallback)((()=>{k().office.davCalendarGetEvents({limit:10,dateStart:f().format("YYYY-MM-DD hh:mm:ss"),dateEnd:f(f()).add(1,"M").format("YYYY-MM-DD hh:mm:ss")}).then((({result:e})=>{v(e),g(!0)})).catch(y).finally((()=>x(!1)))}),[y,x,f]);return(0,i.useEffect)((()=>{if(!m)return;if(!r)return;if(p!==w.WIDGET_LEVEL_3)return;const e=setInterval(L,6e4);return()=>clearInterval(e)}),[r,L,m,p]),(0,i.useEffect)((()=>{x(!0),k().office.isConfigurationValid().then((({result:e})=>C(e))).catch(y)}),[y,x,C]),(0,i.useEffect)((()=>{if(r)return p===w.WIDGET_LEVEL_1?(x(!0),void W()):void L()}),[r,W,x,L,f,p]),r&&p&&p!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(p,null!=E?E:"")):l().createElement(xi,{header:()=>l().createElement(l().Fragment,null,l().createElement(ji,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>y(void 0,!0)})),scrollable:()=>l().createElement(ki,{uniqid:o},r&&l().createElement(Si,{calendarListEvent:b}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(ri,{handleCallback:C}))})},Ti=d.j.getLazyComponent("ButtonDropdown"),Ii=d.j.getLazyComponent("Tooltip"),Ai=(a().div`
543
- background-color: ${e=>e.backroundColor};
541
+ `,Li=({uniqid:e,children:t})=>{const n=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual),o=(0,i.useMemo)((()=>({padding:n&&n.padding?String(n.padding):"0"})),[n]);return l().createElement(Wi,{padding:o.padding},t)},_i=d.j.getLazyComponent("WidgetContactCardDav"),qi=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,s]=(0,i.useState)(void 0),[d,m]=(0,i.useState)(void 0),[g,p]=(0,i.useState)(!1),f=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),G.shallowEqual),[E,h]=(0,i.useState)([]),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(ri),t?window.location.reload():(s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),v=(0,i.useCallback)((e=>{s(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),y=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),C=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{m(e.dav_address_book_url)})).finally((()=>y(!1)))}),[y]),x=(0,i.useCallback)((()=>{k().office.davAddressBookGetContacts({limit:10}).then((({result:e})=>{h(e),p(!0)})).catch((()=>{a(c.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1}))})).finally((()=>y(!1)))}),[y,a,o]);return(0,i.useEffect)((()=>{if(!g)return;if(!r)return;if(f!==w.WIDGET_LEVEL_3)return;const e=setInterval(x,4e3);return()=>clearInterval(e)}),[r,x,g,f]),(0,i.useEffect)((()=>{y(!0),k().office.isConfigurationValid().then((({result:e})=>v(e))).catch(b).finally((()=>y(!1)))}),[v,f,C,y,b]),(0,i.useEffect)((()=>{if(r)return f===w.WIDGET_LEVEL_1?(y(!0),void C()):void x()}),[r,C,y,x,f]),r&&f&&f!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(f,null!=d?d:"")):l().createElement(ki,{header:()=>l().createElement(l().Fragment,null,l().createElement(yi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Li,{uniqid:o},r&&l().createElement(_i,{contactCardList:E}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(si,null))})},ji=d.j.getLazyComponent("ButtonDropdown"),Si=d.j.getLazyComponent("Tooltip"),Mi=a().div`
542
+ margin-right: ${e=>e.theme.space.sm}px;
543
+ button {
544
+ background: ${e=>e.theme.color.white};
545
+ }
546
+ `,Ti=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,G.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(ri).finally(n)}}];return l().createElement(Ei,{uniqid:e,dropdown:()=>t&&l().createElement(Mi,null,l().createElement(Si,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(ji,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"})))})},Ii=d.j.getLazyComponent("WidgetCalendarCalDav"),Ai=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,d]=(0,i.useState)(void 0),[m,g]=(0,i.useState)(!1),p=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),G.shallowEqual),{moment:f}=(0,s.useMoment)(),[E,h]=(0,i.useState)(void 0),[b,v]=(0,i.useState)([]),y=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(ri),t?window.location.reload():(d(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),C=(0,i.useCallback)((e=>{d(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),x=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),W=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{h(e.dav_calendar_url)})).finally((()=>x(!1)))}),[x]),L=(0,i.useCallback)((()=>{k().office.davCalendarGetEvents({limit:10,dateStart:f().format("YYYY-MM-DD hh:mm:ss"),dateEnd:f(f()).add(1,"M").format("YYYY-MM-DD hh:mm:ss")}).then((({result:e})=>{v(e),g(!0)})).catch((()=>{a(c.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),d(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1}))})).finally((()=>x(!1)))}),[x,a,o,f]);return(0,i.useEffect)((()=>{if(!m)return;if(!r)return;if(p!==w.WIDGET_LEVEL_3)return;const e=setInterval(L,6e4);return()=>clearInterval(e)}),[r,L,m,p]),(0,i.useEffect)((()=>{x(!0),k().office.isConfigurationValid().then((({result:e})=>C(e))).catch(y)}),[y,x,C]),(0,i.useEffect)((()=>{if(r)return p===w.WIDGET_LEVEL_1?(x(!0),void W()):void L()}),[r,W,x,L,f,p]),r&&p&&p!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(p,null!=E?E:"")):l().createElement(ki,{header:()=>l().createElement(l().Fragment,null,l().createElement(Ti,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>y(void 0,!0)})),scrollable:()=>l().createElement(Li,{uniqid:o},r&&l().createElement(Ii,{calendarListEvent:b}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(si,null))})},Oi=d.j.getLazyComponent("ButtonDropdown"),Gi=d.j.getLazyComponent("Tooltip"),zi=a().div`
547
+ margin-right: ${e=>e.theme.space.sm}px;
548
+ button {
549
+ background: ${e=>e.theme.color.white};
550
+ }
551
+ `,Di=a().div`
552
+ font-size: ${e=>e.theme.size.sm+4}px;
544
553
  color: ${e=>e.color};
545
- `,a().div`
546
- display: flex;
547
- flex-direction: row;
548
- align-items: center;
549
- `,a().div`
550
- padding: ${e=>e.theme.space.sm}px ${e=>e.theme.space.md}px;
551
- color: ${e=>e.theme.color.grey4};
552
- `),Oi=(a().div`
553
- flex: 1;
554
- `,({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,u.jL)(),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetChipCount(t,e)),G.shallowEqual),d=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(ai).finally(n)}}];return l().createElement(fi,{uniqid:e,dropdown:()=>t&&l().createElement(Ii,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Ti,{small:!0,smallOpenDirection:"left",options:d,icon:"icon-edit",label:"",color:"primary",variant:"outlined"})),subHeader:()=>t&&l().createElement(Ai,null,l().createElement(s.JRCTypography,{size:"s"},i.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:a})))})}),Gi=d.j.getLazyComponent("WidgetEmailsImap"),zi=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,s]=(0,i.useState)(void 0),[d,m]=(0,i.useState)(!1),[g,p]=(0,i.useState)([]),[f,E]=(0,i.useState)(void 0),h=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e.uniqid)),G.shallowEqual),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(ai),t?window.location.reload():(s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),v=(0,i.useCallback)((()=>{k().office.imapInboxGetUnreadEmailsCount().then((({result:e})=>{a(c.x0.slice.actions.setWidgetChipCount({uniqid:o,count:e})),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))})).catch(b)}),[a,o,b]),y=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),C=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{E(e.imap_inbox_url)})).finally((()=>y(!1)))}),[y]),x=(0,i.useCallback)((e=>{s(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),W=(0,i.useCallback)((()=>{k().office.imapInboxGetEmails().then((({result:e})=>{p(e),m(!0)})).catch(b).finally((()=>y(!1)))}),[y,b]);return(0,i.useEffect)((()=>{if(!d)return;if(!r)return;if(h===w.WIDGET_LEVEL_1)return;const e=setInterval((()=>{h===w.WIDGET_LEVEL_2&&v(),h===w.WIDGET_LEVEL_3&&(v(),W())}),6e4);return()=>clearInterval(e)}),[r,W,d,v,h]),(0,i.useEffect)((()=>{k().office.isConfigurationValid().then((({result:e})=>x(e))).catch(b)}),[x,b]),(0,i.useEffect)((()=>{if(r){if(h===w.WIDGET_LEVEL_1)return y(!0),void C();if(h===w.WIDGET_LEVEL_2)return y(!0),v(),void C();y(!0),v(),W()}}),[r,h,C,W,y,v,a]),r&&h&&h!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(h,null!=f?f:"")):l().createElement(xi,{header:()=>l().createElement(l().Fragment,null,l().createElement(Oi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(ki,{uniqid:o},void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(ri,{handleCallback:x}),r&&l().createElement(Gi,{emailList:g}))})},Di=a().div`
554
+ `,$i=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,u.jL)(),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetChipCount(t,e)),G.shallowEqual),s=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(ri).finally(n)}}];return l().createElement(Ei,{uniqid:e,dropdown:()=>t&&l().createElement(zi,null,l().createElement(Gi,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Oi,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-edit",label:"",color:"primary",variant:"outlined"}))),subHeader:e=>t&&0!==a&&l().createElement(Di,{color:e},"(",i.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:a}),")")})},Vi=d.j.getLazyComponent("WidgetEmailsImap"),Fi=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,s]=(0,i.useState)(void 0),[d,m]=(0,i.useState)(!1),[g,p]=(0,i.useState)([]),[f,E]=(0,i.useState)(void 0),h=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e.uniqid)),G.shallowEqual),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(ri),t?window.location.reload():(s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),v=(0,i.useCallback)((()=>{k().office.imapInboxGetUnreadEmailsCount().then((({result:e})=>{a(c.x0.slice.actions.setWidgetChipCount({uniqid:o,count:e})),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))})).catch(b)}),[a,o,b]),y=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),C=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{E(e.imap_inbox_url)})).finally((()=>y(!1)))}),[y]),x=(0,i.useCallback)((e=>{s(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),W=(0,i.useCallback)((()=>{k().office.imapInboxGetEmails({limit:10}).then((({result:e})=>{p(e),m(!0)})).catch((()=>{a(c.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1}))})).finally((()=>y(!1)))}),[y,a,o]);return(0,i.useEffect)((()=>{if(!d)return;if(!r)return;if(h===w.WIDGET_LEVEL_1)return;const e=setInterval((()=>{h===w.WIDGET_LEVEL_2&&v(),h===w.WIDGET_LEVEL_3&&(v(),W())}),6e4);return()=>clearInterval(e)}),[r,W,d,v,h]),(0,i.useEffect)((()=>{k().office.isConfigurationValid().then((({result:e})=>x(e))).catch(b)}),[x,b]),(0,i.useEffect)((()=>{if(r){if(h===w.WIDGET_LEVEL_1)return y(!0),void C();if(h===w.WIDGET_LEVEL_2)return y(!0),v(),void C();y(!0),v(),W()}}),[r,h,C,W,y,v,a]),r&&h&&h!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(h,null!=f?f:"")):l().createElement(ki,{header:()=>l().createElement(l().Fragment,null,l().createElement($i,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Li,{uniqid:o},void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(si,null),r&&l().createElement(Vi,{emailList:g}))})},Ri=a().div`
555
555
  padding: ${e=>e.theme.space.md}px;
556
556
  border-bottom: 1px solid ${e=>e.theme.color.grey1};
557
- `,$i=({uniqid:e})=>{var t;const n=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual);return l().createElement(l().Fragment,null,n&&"string"==typeof n.title&&0!==n.title.length&&l().createElement(Di,null,l().createElement(s.JRCHtml,{__html:null!==(t=n.title)&&void 0!==t?t:""})))},Vi=({uniqid:e})=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),o=(0,u.GV)((t=>{var n;return null===(n=c.x0.selectors.selectWidget(t,e))||void 0===n?void 0:n.title}),G.shallowEqual),{control:a,watch:d}=(0,be.useForm)({defaultValues:{widgetTitle:o},criteriaMode:"all"});return(0,i.useEffect)((()=>{const t=d((t=>{n(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.widgetTitle}))}));return()=>t.unsubscribe()}),[d,n,e]),l().createElement(s.JRCInputText,{name:"widgetTitle",control:a,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},Fi=d.j.getLazyComponent("Button"),Ri=d.j.getLazyComponent("ModalLayout"),Bi=d.j.getLazyComponent("ModalContent"),Hi=a().div`
557
+ `,Bi=({uniqid:e})=>{var t;const n=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),G.shallowEqual);return l().createElement(l().Fragment,null,n&&"string"==typeof n.title&&0!==n.title.length&&l().createElement(Ri,null,l().createElement(s.JRCHtml,{__html:null!==(t=n.title)&&void 0!==t?t:""})))},Hi=({uniqid:e})=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),o=(0,u.GV)((t=>{var n;return null===(n=c.x0.selectors.selectWidget(t,e))||void 0===n?void 0:n.title}),G.shallowEqual),{control:a,watch:d}=(0,be.useForm)({defaultValues:{widgetTitle:o},criteriaMode:"all"});return(0,i.useEffect)((()=>{const t=d((t=>{n(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.widgetTitle}))}));return()=>t.unsubscribe()}),[d,n,e]),l().createElement(s.JRCInputText,{name:"widgetTitle",control:a,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},Pi=d.j.getLazyComponent("Button"),Ui=d.j.getLazyComponent("ModalLayout"),Ni=d.j.getLazyComponent("ModalContent"),Yi=a().div`
558
558
  padding: ${e=>e.theme.space.md}px;
559
559
  display: flex;
560
560
  flex-direction: row-reverse;
561
- `,Ui=a().div`
561
+ `,Ji=a().div`
562
562
  flex: 1;
563
563
  display: flex;
564
564
  flex-direction: row;
565
565
  gap: ${e=>e.theme.space.sm}px;
566
566
  padding: ${e=>e.theme.space.sm}px;
567
567
  border-bottom: 1px solid ${e=>e.theme.color.grey1};
568
- `,Pi=a().div`
568
+ `,Qi=a().div`
569
569
  flex: 1;
570
570
  display: flex;
571
571
  fieldset:first-of-type {
572
572
  margin: 0px !important;
573
573
  }
574
- `,Ni=a().div`
574
+ `,Xi=a().div`
575
575
  display: flex;
576
576
  gap: ${e=>e.theme.space.sm}px;
577
- `,Yi=({uniqid:e,name:t,handleOpenEditor:n})=>{const o=(0,u.jL)(),a=(0,r.useIntl)(),[d,m]=(0,i.useState)(!1),g=(0,i.useCallback)((()=>{o(c.cr.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))}),[e,o,t]),p=(0,i.useCallback)((()=>{o(c.x0.slice.actions.flushWidget({uniqid:e}))}),[e,o]);return l().createElement(l().Fragment,null,l().createElement(Ui,null,l().createElement(Pi,null,l().createElement(Vi,{uniqid:e})),l().createElement(Ni,null,l().createElement(s.JRCIconButton,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:null!=n?n:g,title:a.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),l().createElement(s.JRCIconButton,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>m(!0),title:a.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})}))),d&&l().createElement(Ri,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(Bi,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(Hi,null,l().createElement(Fi,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:p}))))},Ji=a().div`
577
+ `,Ki=({uniqid:e,name:t,handleOpenEditor:n})=>{const o=(0,u.jL)(),a=(0,r.useIntl)(),[d,m]=(0,i.useState)(!1),g=(0,i.useCallback)((()=>{o(c.cr.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))}),[e,o,t]),p=(0,i.useCallback)((()=>{o(c.x0.slice.actions.flushWidget({uniqid:e}))}),[e,o]);return l().createElement(l().Fragment,null,l().createElement(Ji,null,l().createElement(Qi,null,l().createElement(Hi,{uniqid:e})),l().createElement(Xi,null,l().createElement(s.JRCIconButton,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:null!=n?n:g,title:a.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),l().createElement(s.JRCIconButton,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>m(!0),title:a.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})}))),d&&l().createElement(Ui,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(Ni,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(Yi,null,l().createElement(Pi,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:p}))))},Zi=a().div`
578
578
  display: flex;
579
579
  flex: 1;
580
580
  flex-direction: column;
581
- `,Qi=({widget:e,width:t,inplace:n=!1,mode:i="view",onWidgetUpdate:o,cannotDisplayComponent:a,levelFallback:r,dataCy:s})=>{const{name:c}=e;return(0,w.ensureWidgetArticleButtonType)(e)?l().createElement(yt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleGalleryType)(e)?l().createElement(Wt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleAttachmentType)(e)?l().createElement(Et,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleImageType)(e)?l().createElement(It,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleSliderType)(e)?l().createElement(Vt,{widget:e,inplace:n,mode:i,width:null!=t?t:800}):(0,w.ensureWidgetArticleTitleType)(e)?l().createElement(en,{widget:e,inplace:n,mode:i,dataCy:s}):(0,w.ensureWidgetArticleTextType)(e)?l().createElement(Jt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(Ji,null,l().createElement($i,{uniqid:e.uniqid}),l().createElement(On,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetDatasourceTableType)(e)?l().createElement(Ji,null,l().createElement($i,{uniqid:e.uniqid}),l().createElement(_n,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?l().createElement(Ji,null,"edit"===i?l().createElement(Yi,{name:e.name,uniqid:e.uniqid}):l().createElement($i,{uniqid:e.uniqid}),l().createElement(yn,{widget:e,inplace:n,mode:i,onWidgetUpdate:o})):(0,w.ensureWidgetPresenceType)(e)?l().createElement(Ji,null,"edit"===i?l().createElement(Yi,{name:e.name,uniqid:e.uniqid}):l().createElement($i,{uniqid:e.uniqid}),l().createElement(Hn,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetQuickSurveyType)(e)?l().createElement(Ji,null,"edit"===i?l().createElement(Yi,{name:e.name,uniqid:e.uniqid}):l().createElement($i,{uniqid:e.uniqid}),l().createElement(Jn,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetCalendarCalDavType)(e)?l().createElement(Ji,null,l().createElement(Mi,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetContactCardDavType)(e)?l().createElement(Ji,null,l().createElement(Li,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetEmailsImapType)(e)?l().createElement(Ji,null,l().createElement(zi,{widget:e,inplace:n,mode:i,levelFallback:r})):a?l().createElement(l().Fragment,null,a(c)):l().createElement(l().Fragment,null,"cannot display widget (",c,")")},Xi=a().div`
581
+ `,el=({widget:e,width:t,inplace:n=!1,mode:i="view",onWidgetUpdate:o,cannotDisplayComponent:a,levelFallback:r,dataCy:s})=>{const{name:c}=e;return(0,w.ensureWidgetArticleButtonType)(e)?l().createElement(yt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleGalleryType)(e)?l().createElement(Wt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleAttachmentType)(e)?l().createElement(Et,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleImageType)(e)?l().createElement(It,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleSliderType)(e)?l().createElement(Vt,{widget:e,inplace:n,mode:i,width:null!=t?t:800}):(0,w.ensureWidgetArticleTitleType)(e)?l().createElement(en,{widget:e,inplace:n,mode:i,dataCy:s}):(0,w.ensureWidgetArticleTextType)(e)?l().createElement(Jt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(Zi,null,l().createElement(Bi,{uniqid:e.uniqid}),l().createElement(On,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetDatasourceTableType)(e)?l().createElement(Zi,null,l().createElement(Bi,{uniqid:e.uniqid}),l().createElement(qn,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?l().createElement(Zi,null,"edit"===i?l().createElement(Ki,{name:e.name,uniqid:e.uniqid}):l().createElement(Bi,{uniqid:e.uniqid}),l().createElement(yn,{widget:e,inplace:n,mode:i,onWidgetUpdate:o})):(0,w.ensureWidgetPresenceType)(e)?l().createElement(Zi,null,"edit"===i?l().createElement(Ki,{name:e.name,uniqid:e.uniqid}):l().createElement(Bi,{uniqid:e.uniqid}),l().createElement(Hn,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetQuickSurveyType)(e)?l().createElement(Zi,null,"edit"===i?l().createElement(Ki,{name:e.name,uniqid:e.uniqid}):l().createElement(Bi,{uniqid:e.uniqid}),l().createElement(Jn,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetCalendarCalDavType)(e)?l().createElement(Zi,null,l().createElement(Ai,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetContactCardDavType)(e)?l().createElement(Zi,null,l().createElement(qi,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetEmailsImapType)(e)?l().createElement(Zi,null,l().createElement(Fi,{widget:e,inplace:n,mode:i,levelFallback:r})):a?l().createElement(l().Fragment,null,a(c)):l().createElement(l().Fragment,null,"cannot display widget (",c,")")},tl=a().div`
582
582
  position: absolute;
583
583
  inset: 0;
584
584
  opacity: ${e=>e.opacity};
585
585
  background-color: ${e=>e.backgroundColor};
586
586
  pointer-events: ${e=>e.pointerEvents};
587
- `,Ki=d.j.getLazyComponent("DoubleClick"),Zi=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.ids[e].widget.layers),G.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(el,{uniqid:e,key:t,mode:"edit"}))))},el=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(Xi,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(tl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(Xi,{opacity:n.visible?1:0,backgroundColor:n.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:n.locked?"none":"all"},n.widgets.map(((e,t)=>l().createElement(tl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},tl=({uniqid:e,layerId:t,mode:n})=>{const i=(0,u.jL)(),o=(0,u.GV)((t=>t.widgets.ids[e]),G.shallowEqual),a=(0,u.GV)((e=>e.widgets.layers[t]));return o&&a&&a.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},l().createElement(gl,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(nl,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{i(c.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(Ki,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(gl,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},nl=({position:e,children:t,onMouseUp:n})=>{const[o,a]=(0,i.useState)(!1),[r,s]=(0,i.useState)({x:0,y:0}),[c,d]=(0,i.useState)({x:0,y:0}),[u,m]=(0,i.useState)({x:e.x,y:e.y}),g=(0,i.useRef)(null),p=(0,i.useCallback)((e=>{a(!0),g.current&&(s({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),d({x:u.x,y:u.y}))}),[u.x,u.y]),f=(0,i.useCallback)((e=>{if(o&&g.current){const t=c.x+(e.clientX-r.x),n=c.y+(e.clientY-r.y);m({x:t,y:n})}}),[r.x,r.y,o,c.x,c.y]),E=(0,i.useCallback)((()=>{a(!1),n({x:u.x,y:u.y})}),[u.x,u.y,n]);return(0,i.useEffect)((()=>(document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E)})),[f,E]),l().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},il=d.j.getLazyComponent("Loader"),ll=({name:e,uniqid:t,inplace:n})=>{const i=(0,u.GV)((e=>c.x0.selectors.selectWidgetState(e,t))),o=c.x0.definition(e);return(null==i?void 0:i.loading)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement(il,null)):(null==i?void 0:i.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==i?void 0:i.initialized)&&n||(null==i?void 0:i.initialized)||n?l().createElement(l().Fragment,null):l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement("img",{src:o.img}))},ol=a().button`
587
+ `,nl=d.j.getLazyComponent("DoubleClick"),il=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.ids[e].widget.layers),G.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(ll,{uniqid:e,key:t,mode:"edit"}))))},ll=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(tl,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(ol,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(tl,{opacity:n.visible?1:0,backgroundColor:n.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:n.locked?"none":"all"},n.widgets.map(((e,t)=>l().createElement(ol,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},ol=({uniqid:e,layerId:t,mode:n})=>{const i=(0,u.jL)(),o=(0,u.GV)((t=>t.widgets.ids[e]),G.shallowEqual),a=(0,u.GV)((e=>e.widgets.layers[t]));return o&&a&&a.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},l().createElement(hl,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(al,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{i(c.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(nl,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(hl,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},al=({position:e,children:t,onMouseUp:n})=>{const[o,a]=(0,i.useState)(!1),[r,s]=(0,i.useState)({x:0,y:0}),[c,d]=(0,i.useState)({x:0,y:0}),[u,m]=(0,i.useState)({x:e.x,y:e.y}),g=(0,i.useRef)(null),p=(0,i.useCallback)((e=>{a(!0),g.current&&(s({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),d({x:u.x,y:u.y}))}),[u.x,u.y]),f=(0,i.useCallback)((e=>{if(o&&g.current){const t=c.x+(e.clientX-r.x),n=c.y+(e.clientY-r.y);m({x:t,y:n})}}),[r.x,r.y,o,c.x,c.y]),E=(0,i.useCallback)((()=>{a(!1),n({x:u.x,y:u.y})}),[u.x,u.y,n]);return(0,i.useEffect)((()=>(document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E)})),[f,E]),l().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},rl=d.j.getLazyComponent("Loader"),sl=({name:e,uniqid:t,inplace:n})=>{const i=(0,u.GV)((e=>c.x0.selectors.selectWidgetState(e,t))),o=c.x0.definition(e);return(null==i?void 0:i.loading)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement(rl,null)):(null==i?void 0:i.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==i?void 0:i.initialized)&&n||(null==i?void 0:i.initialized)||n?l().createElement(l().Fragment,null):l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement("img",{src:o.img}))},cl=a().button`
588
588
  position: absolute;
589
589
  inset: 0;
590
590
  display: flex;
@@ -602,7 +602,7 @@
602
602
  }
603
603
 
604
604
  ${(0,s.DashedFocusBorder)()}
605
- `,al=({uniqid:e,name:t})=>{const n=(0,u.jL)(),o=(0,r.useIntl)(),a=(0,u.GV)((t=>{var n;return null===(n=c.x0.selectors.selectWidgetState(t,e))||void 0===n?void 0:n.initialized})),d=(0,i.useCallback)((()=>{a&&n(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))}),[n,e,a,t]),m=c.x0.definition(t);return a?l().createElement(ol,{onClick:d},l().createElement(s.JRCHtml,{__html:`${o.formatMessage({id:"WIDGET_Set_Widget"})} <b>${o.formatMessage({id:m.label})}</b>`})):l().createElement(l().Fragment,null)},rl=d.j.getLazyComponent("WidgetIcon"),sl=a().a`
605
+ `,dl=({uniqid:e,name:t})=>{const n=(0,u.jL)(),o=(0,r.useIntl)(),a=(0,u.GV)((t=>{var n;return null===(n=c.x0.selectors.selectWidgetState(t,e))||void 0===n?void 0:n.initialized})),d=(0,i.useCallback)((()=>{a&&(n(c.cr.slice.actions.flushAllEditor()),n(c.cr.slice.actions.registerEditor({uniqid:e,name:t})))}),[n,e,a,t]),m=c.x0.definition(t);return a?l().createElement(cl,{onClick:d},l().createElement(s.JRCHtml,{__html:`${o.formatMessage({id:"WIDGET_Set_Widget"})} <b>${o.formatMessage({id:m.label})}</b>`})):l().createElement(l().Fragment,null)},ul=d.j.getLazyComponent("WidgetIcon"),ml=a().a`
606
606
  position: absolute;
607
607
  top: 0;
608
608
  right: 0;
@@ -618,7 +618,7 @@
618
618
  background-color: rgba(0, 0, 0, 0.1);
619
619
  color: ${e=>e.color?e.color:e.theme.color.black};
620
620
  }
621
- `,cl=({uniqid:e,name:t,url:n,level:i})=>{var o;const a=c.x0.definition(t),r=(0,u.GV)((t=>2===i?c.x0.selectors.selectWidgetChipCount(t,e):0),G.shallowEqual),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual);return l().createElement(sl,{href:n,target:"_blank",color:null!==(o=String(s.color))&&void 0!==o?o:void 0,rel:"noreferrer","aria-label":a.label},l().createElement(rl,{count:r,img:a.img,label:a.label,maxValue:999}))},dl=a().div`
621
+ `,gl=({uniqid:e,name:t,url:n,level:i})=>{var o;const a=c.x0.definition(t),r=(0,u.GV)((t=>2===i?c.x0.selectors.selectWidgetChipCount(t,e):0),G.shallowEqual),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual);return l().createElement(ml,{href:n,target:"_blank",color:null!==(o=String(s.color))&&void 0!==o?o:void 0,rel:"noreferrer","aria-label":a.label},l().createElement(ul,{count:r,img:a.img,label:a.label,maxValue:999}))},pl=a().div`
622
622
  display: flex;
623
623
  flex-direction: column;
624
624
  background-color: ${e=>e.backgroundColor};
@@ -627,28 +627,28 @@
627
627
  border-width: ${e=>e.borderWidth}px;
628
628
  border-radius: ${e=>e.borderRadius}px;
629
629
  overflow: ${e=>e.overflow};
630
- `,ul=l().forwardRef((({uniqid:e,onClick:t,children:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual),s=(0,i.useMemo)((()=>({color:r&&r.color?String(r.color):a.color.black,backgroundColor:r&&r["background-color"]?String(r["background-color"]):a.color.white,borderRadius:r&&r["border-radius"]?String(r["border-radius"]):"0",borderColor:r["border-color"]?String(r["border-color"]):a.color.black,borderWidth:r["border-width"]?String(r["border-width"]):"0",borderStyle:r["border-style"]?String(r["border-style"]):"none"})),[r,a]);return l().createElement(dl,{onClick:t,backgroundColor:s.backgroundColor,borderColor:s.borderColor,borderStyle:s.borderStyle,borderRadius:s.borderRadius,overflow:Number(s.borderRadius)>0?"hidden":"initial",borderWidth:s.borderWidth},n)})),ml=({uniqid:e,widgetObject:t,widget:n,inplace:o=!0,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:d,dataCy:m})=>{const g=(0,u.jL)(),p=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),f=(0,u.GV)((t=>t.widgets.editableMap[e]),G.shallowEqual),E=(0,u.GV)((e=>e.widgets.currentEditableWidgetId),G.shallowEqual),h=(0,u.GV)((t=>t.widgets.currentEditableWidgetId===e),G.shallowEqual),{ref:b,isComponentVisible:v,setIsComponentVisible:y}=(0,st.xv)(!1);if((0,i.useEffect)((()=>{t&&g(c.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,i.useEffect)((()=>{n&&g(c.x0.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,i.useEffect)((()=>{v||e===E&&g(c.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[v]),(0,i.useEffect)((()=>{v!==h&&y(h)}),[h]),void 0===p)return l().createElement(l().Fragment,null,"This widget cannot be displayed");const C=p.widget,x=()=>{"edit"===a?k():(0,w.ensureWidgetArticleButtonType)(C)&&"link"===C.content.openingType&&C.content.openingTypeLink&&window.open(C.content.openingTypeLink.url,C.content.openingTypeLink.target)},k=()=>{if("view"===a)return;const{widget:e}=p;g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return o&&"view"!==a?l().createElement(ul,{uniqid:e,ref:b,onClick:()=>{y(!0),f&&(g(c.x0.slice.actions.setEditableIndex({index:f.index})),g(c.x0.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(Qi,{dataCy:m,width:r,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,onClick:x,levelFallback:(e,t)=>e<=2&&l().createElement(cl,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(Zi,{uniqid:e,mode:a}),"edit"===a&&l().createElement(al,{uniqid:e,name:n.widget.name}),l().createElement(ll,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o})):l().createElement(ul,{uniqid:e,onClick:k},l().createElement(Qi,{dataCy:m,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,width:r,onClick:x,onWidgetUpdate:s,cannotDisplayComponent:d,levelFallback:(e,t)=>e<=2&&l().createElement(cl,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(Zi,{uniqid:e,mode:a}),l().createElement(ll,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o}))},gl=ml,pl=a().div`
630
+ `,fl=({uniqid:e,onClick:t,children:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),G.shallowEqual),s=(0,i.useMemo)((()=>({color:r&&r.color?String(r.color):a.color.black,backgroundColor:r&&r["background-color"]?String(r["background-color"]):a.color.white,borderRadius:r&&r["border-radius"]?String(r["border-radius"]):"0",borderColor:r["border-color"]?String(r["border-color"]):a.color.black,borderWidth:r["border-width"]?String(r["border-width"]):"0",borderStyle:r["border-style"]?String(r["border-style"]):"none"})),[r,a]);return l().createElement(pl,{onClick:t,backgroundColor:s.backgroundColor,borderColor:s.borderColor,borderStyle:s.borderStyle,borderRadius:s.borderRadius,overflow:Number(s.borderRadius)>0?"hidden":"initial",borderWidth:s.borderWidth},n)},El=({uniqid:e,widgetObject:t,widget:n,inplace:o=!0,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:d,dataCy:m})=>{const g=(0,u.jL)(),p=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),f=(0,u.GV)((t=>t.widgets.editableMap[e]),G.shallowEqual),E=(0,u.GV)((e=>e.widgets.currentEditableWidgetId),G.shallowEqual),h=(0,u.GV)((t=>t.widgets.currentEditableWidgetId===e),G.shallowEqual),{isComponentVisible:b,setIsComponentVisible:v}=(0,st.xv)(!1);(0,i.useEffect)((()=>{t&&g(c.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,i.useEffect)((()=>{n&&g(c.x0.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,i.useEffect)((()=>{b||e===E&&g(c.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[b]),(0,i.useEffect)((()=>{b!==h&&v(h)}),[h]);const y=(0,i.useCallback)((()=>{if(void 0===p||"view"===a)return;g(c.cr.slice.actions.flushAllEditor());const{widget:e}=p;g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[g,a,p]);return void 0===p?l().createElement(l().Fragment,null,"This widget cannot be displayed"):o&&"view"!==a?l().createElement(fl,{uniqid:e,onClick:()=>{v(!0),f&&(g(c.x0.slice.actions.setEditableIndex({index:f.index})),g(c.x0.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(el,{dataCy:m,width:r,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,levelFallback:(e,t)=>e<=2&&l().createElement(gl,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(il,{uniqid:e,mode:a}),"edit"===a&&l().createElement(dl,{uniqid:e,name:n.widget.name}),l().createElement(sl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o})):l().createElement(fl,{uniqid:e,onClick:y},l().createElement(el,{dataCy:m,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:d,levelFallback:(e,t)=>e<=2&&l().createElement(gl,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(il,{uniqid:e,mode:a}),l().createElement(sl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o}))},hl=El,bl=a().div`
631
631
  border-radius: ${e=>e.theme.space.sm}px;
632
632
  border: 1px solid ${e=>e.theme.color.grey1};
633
633
  background-color: ${e=>e.theme.color.white};
634
634
  overflow: hidden;
635
- `,fl=d.j.getLazyComponent("Message"),El=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,G.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(pl,{key:e.widget.uniqid},l().createElement(gl,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(fl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},hl=d.j.getLazyComponent("Message"),bl=e=>{const t=(0,r.useIntl)(),{widgets:n,comment:i,inplace:o,mode:a,handleWidgetUpdate:s}=e,d=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,G.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!d.includes(e.widget.uniqid))).map((e=>e&&l().createElement(pl,{key:e.widget.uniqid},l().createElement(gl,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(hl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var vl=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function a(e){try{s(i.next(e))}catch(e){o(e)}}function r(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}s((i=i.apply(e,t||[])).next())}))};const yl=d.j.getLazyComponent("JRCCommentsBloc"),Cl=a().div`
635
+ `,vl=d.j.getLazyComponent("Message"),yl=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,G.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(bl,{key:e.widget.uniqid},l().createElement(hl,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(vl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},Cl=d.j.getLazyComponent("Message"),xl=e=>{const t=(0,r.useIntl)(),{widgets:n,comment:i,inplace:o,mode:a,handleWidgetUpdate:s}=e,d=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,G.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!d.includes(e.widget.uniqid))).map((e=>e&&l().createElement(bl,{key:e.widget.uniqid},l().createElement(hl,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(Cl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var wl=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function a(e){try{s(i.next(e))}catch(e){o(e)}}function r(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}s((i=i.apply(e,t||[])).next())}))};const kl=d.j.getLazyComponent("JRCCommentsBloc"),Wl=a().div`
636
636
  display: flex;
637
637
  flex-direction: column;
638
638
  gap: 4px;
639
639
  flex: 1;
640
640
  width: 100%;
641
641
  margin-top: 10px;
642
- `,xl=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s})=>{var d;const m=(0,r.useIntl)(),g=(0,o.useTheme)(),p=(0,u.jL)(),[f,E]=(0,i.useState)(),[h,b]=(0,i.useState)(!1),[v,y]=(0,i.useState)([]),[C,x]=(0,i.useState)(!1),w=(0,u.GV)(c.xJ.selectors.get),W=(0,u.GV)(c.x0.selectors.selectWidgets),L=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),q=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),_=(0,u.GV)(c.Kx.selectors.selectAll),j=(0,u.GV)(c.OD.selectors.selectPlatformConfig),S=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),M=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),A=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),O=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),G=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,D]=(0,i.useState)(s),{open:$,onInsert:V,close:F,ext:R,isActive:B}=Rt();(0,T.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>I.A),[]),o=(0,i.useMemo)((()=>c.Mw.getCommentsLikeRTHandlers(n,e,t)),[n,e,t]);(0,i.useEffect)((()=>(o.forEach((e=>{l.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{l.offMessage(e.namespace,e.function,e.handler)}))})),[o,l])})(M.map((e=>e.id)),e);const H=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})}))}),[p,m]),U=()=>{p(c.Mw.actions.fetchComments({idArticle:e})),P()},P=(0,i.useCallback)((()=>{f||C||(x(!0),k().network.token().then((e=>{E(e.result),x(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{H(e.errorMsg)})))}),[H,f,C,p]),N=(0,i.useCallback)((t=>vl(void 0,void 0,void 0,(function*(){if(f){b(!0);const n=Object.keys(W).map((e=>(null==v?void 0:v.some((t=>t.widget.uniqid===e)))?W[e]:null)).filter((e=>null!==e));try{yield k().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:f,idArticle:e,type:a})).then((()=>{y([])})),P()}catch(e){H(e.errorMsg)}finally{b(!1)}}}))),[e,a,P,H,f,W,v]);return(0,i.useEffect)((()=>{P()}),[P]),(0,i.useEffect)((()=>{p(c.Mw.actions.fetchComments({idArticle:e}))}),[e,p]),(0,i.useEffect)((()=>{M&&M.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{p(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),p(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[M,p]),l().createElement(l().Fragment,null,L&&q&&l().createElement(l().Fragment,null,l().createElement(Cl,null,l().createElement(yl,{canComment:n,loading:h,token:f,comments:M,onComment:N,onCommentUpdate:t=>vl(void 0,void 0,void 0,(function*(){var n,i;const l=M.find((e=>e.id===t.idComment));if(l)return k().article.updateComment({idComment:t.idComment,description:null!==(i=null!==(n=t.description)&&void 0!==n?n:l.description)&&void 0!==i?i:void 0,token:t.token,widgets:t.widgets}).then((()=>{p(c.Mw.actions.fetchComments({idArticle:e})),P()})).catch((e=>{H(e.errorMsg)}))})),onCommentDelete:t=>vl(void 0,void 0,void 0,(function*(){p(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!!((null==G?void 0:G.isActive)&&(null==G?void 0:G.create)&&(null===(d=null==G?void 0:G.autorize)||void 0===d?void 0:d.includes("comment"))),widgetListComponent:l().createElement(ot,{mode:"comment",namespace:"comment",onChange:e=>{y([e]),p(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),E(void 0),P()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(El,{widgets:v}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(bl,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:U,handleWidgetRemove:P}),currentUser:w,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},L),{toolbar:q.commentsToolbar}),mentionsQueries:(0,Ft.X)(_,g,H)},onError:H,highlightFields:j.userHighlightFields,userAccountStatus:j.userAccountStatus,userModel:_.find((e=>"user"===e.type)),isWedocActive:!!S,onGetHashError:e=>p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...O&&A?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==A?void 0:A.drives)],variant:t,handlers:{drive:k().drive,filebank:k().filebank,file:k().file,user:k().user,socialAction:k().socialAction,questionAnswer:k().questionAnswer},socialQuestion:z?Object.assign(Object.assign({},z),{onSelectResponse:e=>{D(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{D(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[R]}),l().createElement(Pe,null))),B&&l().createElement(Pt,{onInsert:V,open:$,close:F}))};var wl=n(749),kl=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(n[i[l]]=e[i[l]])}return n};const Wl=o.css`
642
+ `,Ll=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s})=>{var d;const m=(0,r.useIntl)(),g=(0,o.useTheme)(),p=(0,u.jL)(),[f,E]=(0,i.useState)(),[h,b]=(0,i.useState)(!1),[v,y]=(0,i.useState)([]),[C,x]=(0,i.useState)(!1),w=(0,u.GV)(c.xJ.selectors.get),W=(0,u.GV)(c.x0.selectors.selectWidgets),L=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),_=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),q=(0,u.GV)(c.Kx.selectors.selectAll),j=(0,u.GV)(c.OD.selectors.selectPlatformConfig),S=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),M=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),A=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),O=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),G=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,D]=(0,i.useState)(s),{open:$,onInsert:V,close:F,ext:R,isActive:B}=Rt();(0,T.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>I.A),[]),o=(0,i.useMemo)((()=>c.Mw.getCommentsLikeRTHandlers(n,e,t)),[n,e,t]);(0,i.useEffect)((()=>(o.forEach((e=>{l.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{l.offMessage(e.namespace,e.function,e.handler)}))})),[o,l])})(M.map((e=>e.id)),e);const H=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})}))}),[p,m]),P=()=>{p(c.Mw.actions.fetchComments({idArticle:e})),U()},U=(0,i.useCallback)((()=>{f||C||(x(!0),k().network.token().then((e=>{E(e.result),x(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{H(e.errorMsg)})))}),[H,f,C,p]),N=(0,i.useCallback)((t=>wl(void 0,void 0,void 0,(function*(){if(f){b(!0);const n=Object.keys(W).map((e=>(null==v?void 0:v.some((t=>t.widget.uniqid===e)))?W[e]:null)).filter((e=>null!==e));try{yield k().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:f,idArticle:e,type:a})).then((()=>{y([])})),U()}catch(e){H(e.errorMsg)}finally{b(!1)}}}))),[e,a,U,H,f,W,v]);return(0,i.useEffect)((()=>{U()}),[U]),(0,i.useEffect)((()=>{p(c.Mw.actions.fetchComments({idArticle:e}))}),[e,p]),(0,i.useEffect)((()=>{M&&M.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{p(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),p(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[M,p]),l().createElement(l().Fragment,null,L&&_&&l().createElement(l().Fragment,null,l().createElement(Wl,null,l().createElement(kl,{canComment:n,loading:h,token:f,comments:M,onComment:N,onCommentUpdate:t=>wl(void 0,void 0,void 0,(function*(){var n,i;const l=M.find((e=>e.id===t.idComment));if(l)return k().article.updateComment({idComment:t.idComment,description:null!==(i=null!==(n=t.description)&&void 0!==n?n:l.description)&&void 0!==i?i:void 0,token:t.token,widgets:t.widgets}).then((()=>{p(c.Mw.actions.fetchComments({idArticle:e})),U()})).catch((e=>{H(e.errorMsg)}))})),onCommentDelete:t=>wl(void 0,void 0,void 0,(function*(){p(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!!((null==G?void 0:G.isActive)&&(null==G?void 0:G.create)&&(null===(d=null==G?void 0:G.autorize)||void 0===d?void 0:d.includes("comment"))),widgetListComponent:l().createElement(ot,{mode:"comment",namespace:"comment",onChange:e=>{y([e]),p(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),E(void 0),U()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(yl,{widgets:v}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(xl,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:P,handleWidgetRemove:U}),currentUser:w,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},L),{toolbar:_.commentsToolbar}),mentionsQueries:(0,Ft.X)(q,g,H)},onError:H,highlightFields:j.userHighlightFields,userAccountStatus:j.userAccountStatus,userModel:q.find((e=>"user"===e.type)),isWedocActive:!!S,onGetHashError:e=>p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...O&&A?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==A?void 0:A.drives)],variant:t,handlers:{drive:k().drive,filebank:k().filebank,file:k().file,user:k().user,socialAction:k().socialAction,questionAnswer:k().questionAnswer},socialQuestion:z?Object.assign(Object.assign({},z),{onSelectResponse:e=>{D(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{D(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[R]}),l().createElement(Ue,null))),B&&l().createElement(Ut,{onInsert:V,open:$,close:F}))};var _l=n(749),ql=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(n[i[l]]=e[i[l]])}return n};const jl=o.css`
643
643
  height: 100%;
644
644
  display: flex;
645
645
  flex-direction: column;
646
646
  justify-content: space-between;
647
- `,Ll=a().div`
648
- ${({stretch:e})=>e&&Wl}
649
- `,ql=a().form`
650
- ${({stretch:e})=>e&&Wl}
651
- `,_l=(0,i.forwardRef)(((e,t)=>e.onSubmit?l().createElement(ql,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy},e.children):l().createElement(Ll,{stretch:e.stretch,ref:t,"data-cy":e.dataCy},e.children))),jl=a().div`
647
+ `,Sl=a().div`
648
+ ${({stretch:e})=>e&&jl}
649
+ `,Ml=a().form`
650
+ ${({stretch:e})=>e&&jl}
651
+ `,Tl=(0,i.forwardRef)(((e,t)=>e.onSubmit?l().createElement(Ml,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy},e.children):l().createElement(Sl,{stretch:e.stretch,ref:t,"data-cy":e.dataCy},e.children))),Il=a().div`
652
652
  ${e=>e.stretch&&"\n flex: 1;\n"}
653
- `,Sl=(0,i.forwardRef)(((e,t)=>{const n=(0,i.useRef)(null),[o,a]=(0,wl.SC)(e.fields,e.type,e.forceMandatory),r=(0,be.useForm)({defaultValues:Object.assign(Object.assign({},a),e.defaultValues),criteriaMode:"all"}),{handleSubmit:s,control:c,reset:d}=r,u=kl(r,["handleSubmit","control","reset"]),m=(0,i.useCallback)((e=>{const t={};return Object.keys(e).forEach((n=>{var i;const l=null===(i=o.find((e=>e.name===n)))||void 0===i?void 0:i.widget;switch(null==l?void 0:l.type){case"audience":t[n]=e[n].map((e=>e.uri)).join(",");break;case"taxonomy":t[n]=e[n].map((e=>e.title)).join(",");break;case"toggle":t[n]=e[n]?"1":"0";break;default:t[n]=e[n]}})),t}),[o]);return(0,i.useImperativeHandle)(t,(()=>Object.assign(Object.assign({},u),{handleSubmit:s,control:c,reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),d()},getFormattedValues:()=>m(u.getValues())})),[]),l().createElement(_l,{dataCy:e.dataCy,stretch:e.stretch,onSubmit:e.onSubmit?s(e.onSubmit):void 0,ref:n},l().createElement(jl,{stretch:e.stretch},o.map((t=>{var{Input:n}=t,i=kl(t,["Input"]);return l().createElement(n,Object.assign({key:i.name,control:c},i,{dataCy:`${e.dataCy}-${i.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(c)),e.buttons)})),Ml=()=>l().createElement(l().Fragment,null);var Tl=n(286);const Il=()=>{const[e,t]=(0,i.useState)(),n=(0,r.useIntl)(),l=(0,i.useMemo)((()=>{var e,t;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.JIAHook)||void 0===t?void 0:t.isActive)&&J.debug.JIABETA}),[]),o=(0,i.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:n=>{e.reject(n),t(void 0)},resolve:n=>{e.resolve(n),t(void 0)}}))}),[]),a=(0,i.useCallback)(((e,t)=>new Promise(((n,i)=>{o({reject:i,resolve:n,text:e,capability:t})}))),[o]),c=(0,i.useMemo)((()=>({develop:e=>a(e,"develop"),summarize:e=>a(e,"summarize"),tldr:e=>a(e,"tldr"),en:e=>a(e,"en"),es:e=>a(e,"es"),formal:e=>a(e,"formal"),funny:e=>a(e,"funny")})),[a]);return{query:e,ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.jia(c,n)),[n,c]),isActive:l}},Al=d.j.getLazyComponent("InputTinyMCE"),Ol=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Il(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=Rt(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,Ft.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Tl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Al,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(Pt,{onInsert:f,open:p,close:E}))},Gl=d.j.getLazyComponent("InputTinyMCERaw"),zl=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Il(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=Rt(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,Ft.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Tl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Gl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(Pt,{onInsert:f,open:p,close:E}))},Dl=d.j.getLazyComponent("InputAudience"),$l=d.j.getLazyComponent("Message"),Vl=d.j.getLazyComponent("Modal"),Fl=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const d=(0,r.useIntl)(),m=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return l().createElement(Vl,{open:e,closeHandler:t,title:null!=n?n:d.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),a()}}]},l().createElement($l,{variant:"warning",message:null!=o?o:d.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(Dl,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:d.formatMessage({id:"GLOBAL_Audience"}),name:s,defaultCustomOptions:m?[{uri:m.uri,title:m.title,resetOptions:!0,icon:"icon-fs-wall"}]:[]}))};var Rl=n(737);const Bl=d.j.getLazyComponent("Container"),Hl=d.j.getLazyComponent("AppColumn"),Ul=d.j.getLazyComponent("MainColumn");function Pl({extensionRoute:e,routes:t,description:n,mode:o="center"}){var a;const s=(0,r.useIntl)(),{pathname:c}=(0,Rl.useLocation)(),d=(0,i.useMemo)((()=>Object.values(t)),[t]),[u,m]=(0,i.useState)(null===(a=null==d?void 0:d[0])||void 0===a?void 0:a.key),g=d.map((t=>Object.assign(Object.assign({},t),{label:s.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?s.formatMessage({id:t.group}):void 0})));return(0,i.useEffect)((()=>{const t=d.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===c||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,Rl.matchPath)(i,c);return t||l}),!1))}));t&&m(t.key)}),[c,d,e]),l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(Bl,{mode:o},l().createElement(Hl,{mode:o,description:n,tabs:g,activeTab:u||""}),l().createElement(Ul,{mode:o,flex:!0},l().createElement(Rl.Outlet,null))))}}}]);
654
- //# sourceMappingURL=435.38154081efc76cefc3ba.chunk.js.map
653
+ `,Al=(0,i.forwardRef)(((e,t)=>{const n=(0,i.useRef)(null),[o,a]=(0,_l.SC)(e.fields,e.type,e.forceMandatory),r=(0,be.useForm)({defaultValues:Object.assign(Object.assign({},a),e.defaultValues),criteriaMode:"all"}),{handleSubmit:s,control:c,reset:d}=r,u=ql(r,["handleSubmit","control","reset"]),m=(0,i.useCallback)((e=>{const t={};return Object.keys(e).forEach((n=>{var i;const l=null===(i=o.find((e=>e.name===n)))||void 0===i?void 0:i.widget;switch(null==l?void 0:l.type){case"audience":t[n]=e[n].map((e=>e.uri)).join(",");break;case"taxonomy":t[n]=e[n].map((e=>e.title)).join(",");break;case"toggle":t[n]=e[n]?"1":"0";break;default:t[n]=e[n]}})),t}),[o]);return(0,i.useImperativeHandle)(t,(()=>Object.assign(Object.assign({},u),{handleSubmit:s,control:c,reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),d()},getFormattedValues:()=>m(u.getValues())})),[]),l().createElement(Tl,{dataCy:e.dataCy,stretch:e.stretch,onSubmit:e.onSubmit?s(e.onSubmit):void 0,ref:n},l().createElement(Il,{stretch:e.stretch},o.map((t=>{var{Input:n}=t,i=ql(t,["Input"]);return l().createElement(n,Object.assign({key:i.name,control:c},i,{dataCy:`${e.dataCy}-${i.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(c)),e.buttons)})),Ol=()=>l().createElement(l().Fragment,null);var Gl=n(286);const zl=()=>{const[e,t]=(0,i.useState)(),n=(0,r.useIntl)(),l=(0,i.useMemo)((()=>{var e,t;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.JIAHook)||void 0===t?void 0:t.isActive)&&J.debug.JIABETA}),[]),o=(0,i.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:n=>{e.reject(n),t(void 0)},resolve:n=>{e.resolve(n),t(void 0)}}))}),[]),a=(0,i.useCallback)(((e,t)=>new Promise(((n,i)=>{o({reject:i,resolve:n,text:e,capability:t})}))),[o]),c=(0,i.useMemo)((()=>({develop:e=>a(e,"develop"),summarize:e=>a(e,"summarize"),tldr:e=>a(e,"tldr"),en:e=>a(e,"en"),es:e=>a(e,"es"),formal:e=>a(e,"formal"),funny:e=>a(e,"funny")})),[a]);return{query:e,ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.jia(c,n)),[n,c]),isActive:l}},Dl=d.j.getLazyComponent("InputTinyMCE"),$l=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=zl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=Rt(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,Ft.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Gl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Dl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(Ut,{onInsert:f,open:p,close:E}))},Vl=d.j.getLazyComponent("InputTinyMCERaw"),Fl=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=zl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=Rt(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,Ft.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Gl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Vl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(Ut,{onInsert:f,open:p,close:E}))},Rl=d.j.getLazyComponent("InputAudience"),Bl=d.j.getLazyComponent("Message"),Hl=d.j.getLazyComponent("Modal"),Pl=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const d=(0,r.useIntl)(),m=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return l().createElement(Hl,{open:e,closeHandler:t,title:null!=n?n:d.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),a()}}]},l().createElement(Bl,{variant:"warning",message:null!=o?o:d.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(Rl,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:d.formatMessage({id:"GLOBAL_Audience"}),name:s,defaultCustomOptions:m?[{uri:m.uri,title:m.title,resetOptions:!0,icon:"icon-fs-wall"}]:[]}))};var Ul=n(737);const Nl=d.j.getLazyComponent("Container"),Yl=d.j.getLazyComponent("AppColumn"),Jl=d.j.getLazyComponent("MainColumn");function Ql({extensionRoute:e,routes:t,description:n,mode:o="center"}){var a;const s=(0,r.useIntl)(),{pathname:c}=(0,Ul.useLocation)(),d=(0,i.useMemo)((()=>Object.values(t)),[t]),[u,m]=(0,i.useState)(null===(a=null==d?void 0:d[0])||void 0===a?void 0:a.key),g=d.map((t=>Object.assign(Object.assign({},t),{label:s.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?s.formatMessage({id:t.group}):void 0})));return(0,i.useEffect)((()=>{const t=d.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===c||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,Ul.matchPath)(i,c);return t||l}),!1))}));t&&m(t.key)}),[c,d,e]),l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(Nl,{mode:o},l().createElement(Yl,{mode:o,description:n,tabs:g,activeTab:u||""}),l().createElement(Jl,{mode:o,flex:!0},l().createElement(Ul.Outlet,null))))}}}]);
654
+ //# sourceMappingURL=435.ea8eca2f117abb78e1db.chunk.js.map