jamespot-react-core 1.1.190 → 1.1.191

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([[593],{593:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Ul,DisplayForm:()=>V,EditorsPortal:()=>dt,Empty:()=>Nl,JRCInputTinyMCEWithExt:()=>Xl,JRCInputTinyMCEWithExtRaw:()=>Zl,MarkdownModal:()=>gn,ModalAudience:()=>io,TwoColLayout:()=>so,WidgetList:()=>Lt,WidgetWrapperCore:()=>zl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(215),c=n(847),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([[593],{593:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Rl,DisplayForm:()=>$,Editor:()=>ze,EditorsPortal:()=>dt,Empty:()=>Bl,JRCInputTinyMCEWithExt:()=>Nl,JRCInputTinyMCEWithExtRaw:()=>Jl,MarkdownModal:()=>gn,ModalAudience:()=>Zl,TwoColLayout:()=>lo,WidgetList:()=>Lt,WidgetWrapperCore:()=>Tl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(527),c=n(22),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;
@@ -19,7 +19,7 @@
19
19
  cursor: pointer;
20
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 L=d.j.getLazyComponent("Loader"),_=d.j.getLazyComponent("ModalContent"),W=d.j.getLazyComponent("ModalLayout"),q=d.j.getLazyComponent("Typography"),S=a().div`
21
21
  padding: ${e=>e.theme.space.md}px;
22
- `,j={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(j),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(j),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(W,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(_,{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(S,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(L,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(655),I=n(749),A=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 O=o.css`
22
+ `,j={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(j),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(j),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(W,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(_,{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(S,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(L,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(655),A=n(749),I=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 O=o.css`
23
23
  height: 100%;
24
24
  display: flex;
25
25
  flex-direction: column;
@@ -28,9 +28,9 @@
28
28
  ${({stretch:e})=>e&&O}
29
29
  `,G=a().form`
30
30
  ${({stretch:e})=>e&&O}
31
- `,$=(0,i.forwardRef)(((e,t)=>e.onSubmit?l().createElement(G,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy},e.children):l().createElement(z,{stretch:e.stretch,ref:t,"data-cy":e.dataCy},e.children))),D=a().div`
31
+ `,D=(0,i.forwardRef)(((e,t)=>e.onSubmit?l().createElement(G,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy},e.children):l().createElement(z,{stretch:e.stretch,ref:t,"data-cy":e.dataCy},e.children))),V=a().div`
32
32
  ${e=>e.stretch&&"\n flex: 1;\n"}
33
- `,V=(0,i.forwardRef)(((e,t)=>{const n=(0,i.useRef)(null),[o,a]=(0,I.SC)(e.fields,e.type,e.forceMandatory),r=(0,T.useForm)({defaultValues:Object.assign(Object.assign({},a),e.defaultValues),criteriaMode:"all"}),{handleSubmit:s,control:c,reset:d}=r,u=A(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($,{dataCy:e.dataCy,stretch:e.stretch,onSubmit:e.onSubmit?s(e.onSubmit):void 0,ref:n},l().createElement(D,{stretch:e.stretch},o.map((t=>{var{Input:n}=t,i=A(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)}));var F=n(491),R=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 B=d.j.getLazyComponent("ModalForm"),H=d.j.getLazyComponent("Loader"),P=d.j.getLazyComponent("Icon"),U=d.j.getLazyComponent("Typography"),N=d.j.getLazyComponent("Ellipsis"),Y=d.j.getLazyComponent("StyledHref"),Q=a().div`
33
+ `,$=(0,i.forwardRef)(((e,t)=>{const n=(0,i.useRef)(null),[o,a]=(0,A.SC)(e.fields,e.type,e.forceMandatory),r=(0,T.useForm)({defaultValues:Object.assign(Object.assign({},a),e.defaultValues),criteriaMode:"all"}),{handleSubmit:s,control:c,reset:d}=r,u=I(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(D,{dataCy:e.dataCy,stretch:e.stretch,onSubmit:e.onSubmit?s(e.onSubmit):void 0,ref:n},l().createElement(V,{stretch:e.stretch},o.map((t=>{var{Input:n}=t,i=I(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)}));var F=n(491),R=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 B=d.j.getLazyComponent("ModalForm"),H=d.j.getLazyComponent("Loader"),P=d.j.getLazyComponent("Icon"),U=d.j.getLazyComponent("Typography"),N=d.j.getLazyComponent("Ellipsis"),Y=d.j.getLazyComponent("StyledHref"),Q=a().div`
34
34
  display: flex;
35
35
  flex-direction: column;
36
36
  gap: ${({theme:e})=>e.space.md}px;
@@ -46,7 +46,7 @@
46
46
  display: flex;
47
47
  flex-direction: column;
48
48
  gap: ${({theme:e})=>e.space.sm}px;
49
- `,Z=({onClose:e,articleId:t,articleUri:n,commentUri:o})=>{const a=(0,r.useIntl)(),s=(0,i.useRef)(null),d=(0,u.jL)(),[m,g]=l().useState(!0),[p,f]=(0,i.useState)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!0),[y,C]=(0,i.useState)(!1),x=(0,F.Ie)();(0,i.useEffect)((()=>{Promise.all([R(void 0,void 0,void 0,(function*(){const e=yield k().article.get({idArticle:t,format:"raw-list"},{signal:x.signal});f(e.result)})),R(void 0,void 0,void 0,(function*(){if(o){const e=yield k().article.getComments({idArticle:t},{format:"raw-list",signal:x.signal});h(e.result.find((e=>e.uri===o)))}}))]).then((()=>{v(!1)}))}),[x,t,o]);const w=(0,i.useCallback)((()=>{g(!1),e()}),[e]),L=(0,i.useCallback)((e=>{(null==e?void 0:e.trim())?(C(!0),k().contentReport.createReport({uri:o||n,description:e}).then((()=>{d(c.y8.actions.success({label:a.formatMessage({id:"CRPT_Report_Sent"})})),w()})).catch((e=>{var t;c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:"GLOBAL_Error"}),C(!1)}))):d(c.y8.actions.error({label:a.formatMessage({id:"CRPT_Report_Description_Required"})}))}),[n,w,o,d,a]),_=(0,i.useCallback)((({description:e})=>{L(e)}),[L]);return l().createElement(B,{title:a.formatMessage({id:"CRPT_Add_Report"}),open:m,closeHandler:w,onSubmit:()=>R(void 0,void 0,void 0,(function*(){var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)})),enableClickAwayCloseModal:!0,maxHeight:"520px",buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:w},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Send"}),clickHandler:()=>{var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)},color:"valid",loading:y}]},b?l().createElement(H,{size:"l"}):l().createElement(Q,null,l().createElement(X,null,l().createElement(P,{name:o?"icon-comment":"icon-file",size:50,variant:"square"}),l().createElement(K,null,l().createElement(U,{variant:o?"h3":"h2"},l().createElement(N,{label:null==p?void 0:p.title,length:40})),E&&l().createElement(U,null,a.formatMessage({id:"CRPT_Comment_Of"})," ",l().createElement(Y,{href:null==E?void 0:E._user._url},null==E?void 0:E._user.title)))),l().createElement(V,{ref:s,fields:["description"],type:"contentReport",onSubmit:_})))};var ee=n(690),te=n(746);var ne=n(206),ie=n(743),le=n(704);const oe=(a().div`
49
+ `,Z=({onClose:e,articleId:t,articleUri:n,commentUri:o})=>{const a=(0,r.useIntl)(),s=(0,i.useRef)(null),d=(0,u.jL)(),[m,g]=l().useState(!0),[p,f]=(0,i.useState)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!0),[y,C]=(0,i.useState)(!1),x=(0,F.Ie)();(0,i.useEffect)((()=>{Promise.all([R(void 0,void 0,void 0,(function*(){const e=yield k().article.get({idArticle:t,format:"raw-list"},{signal:x.signal});f(e.result)})),R(void 0,void 0,void 0,(function*(){if(o){const e=yield k().article.getComments({idArticle:t},{format:"raw-list",signal:x.signal});h(e.result.find((e=>e.uri===o)))}}))]).then((()=>{v(!1)}))}),[x,t,o]);const w=(0,i.useCallback)((()=>{g(!1),e()}),[e]),L=(0,i.useCallback)((e=>{(null==e?void 0:e.trim())?(C(!0),k().contentReport.createReport({uri:o||n,description:e}).then((()=>{d(c.y8.actions.success({label:a.formatMessage({id:"CRPT_Report_Sent"})})),w()})).catch((e=>{var t;c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:"GLOBAL_Error"}),C(!1)}))):d(c.y8.actions.error({label:a.formatMessage({id:"CRPT_Report_Description_Required"})}))}),[n,w,o,d,a]),_=(0,i.useCallback)((({description:e})=>{L(e)}),[L]);return l().createElement(B,{title:a.formatMessage({id:"CRPT_Add_Report"}),open:m,closeHandler:w,onSubmit:()=>R(void 0,void 0,void 0,(function*(){var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)})),enableClickAwayCloseModal:!0,maxHeight:"520px",buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:w},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Send"}),clickHandler:()=>{var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)},color:"valid",loading:y}]},b?l().createElement(H,{size:"l"}):l().createElement(Q,null,l().createElement(X,null,l().createElement(P,{name:o?"icon-comment":"icon-file",size:50,variant:"square"}),l().createElement(K,null,l().createElement(U,{variant:o?"h3":"h2"},l().createElement(N,{label:null==p?void 0:p.title,length:40})),E&&l().createElement(U,null,a.formatMessage({id:"CRPT_Comment_Of"})," ",l().createElement(Y,{href:null==E?void 0:E._user._url},null==E?void 0:E._user.title)))),l().createElement($,{ref:s,fields:["description"],type:"contentReport",onSubmit:_})))};var ee=n(690),te=n(746);var ne=n(206),ie=n(743),le=n(704);const oe=(a().div`
50
50
  margin-bottom: 24px;
51
51
  `,a().div`
52
52
  margin-bottom: 4px;
@@ -175,7 +175,7 @@
175
175
  flex: 1;
176
176
  display: flex;
177
177
  align-items: center;
178
- `,d.j.getLazyComponent("Button")),be=d.j.getLazyComponent("Icon"),ve=({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(ae,null,l().createElement(re,null),l().createElement(se,null,"Popup"),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(be,{name:"icon-times",color:"grey2",size:26.75})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(ae,null,l().createElement(he,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var ye=n(939);const Ce=d.j.getLazyComponent("WidgetArticleTitleEditor"),xe=d.j.getLazyComponent("WidgetArticleTextEditor"),we=d.j.getLazyComponent("WidgetArticleGalleryEditor"),ke=d.j.getLazyComponent("WidgetArticleAttachmentEditor"),Le=d.j.getLazyComponent("WidgetArticleSliderEditor"),_e=d.j.getLazyComponent("WidgetArticleImageEditor"),We=d.j.getLazyComponent("WidgetButtonEditor"),qe=d.j.getLazyComponent("WidgetCheckListEditor"),Se=d.j.getLazyComponent("WidgetQuickSurveyEditor"),je=d.j.getLazyComponent("WidgetDatasourceTableEditor"),Me=d.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),Te=d.j.getLazyComponent("WidgetPresenceEditor"),Ie=d.j.getLazyComponent("WidgetEmailsImapEditor"),Ae=d.j.getLazyComponent("WidgetContactCardDavEditor"),Oe=d.j.getLazyComponent("WidgetCalendarCalDavEditor"),ze=({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)),le.shallowEqual),p=(0,u.GV)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),le.shallowEqual),f=e=>{var t;return null===(t=c.qn.selectors.selectHook(ye.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(We,Object.assign({},v.content,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:()=>E({})})):(0,w.ensureWidgetArticleGalleryType)(v)?l().createElement(we,{token:m,content:v.content,onChange:t=>d((0,c.vR)(e,t,!1)),onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleAttachmentType)(v)?l().createElement(ke,{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(_e,{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(Ce,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content,onOpen:b}):(0,w.ensureWidgetArticleTextType)(v)?l().createElement(xe,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content}):(0,w.ensureWidgetPresenceType)(v)?l().createElement(Te,Object.assign({onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h},v.content)):(0,w.ensureWidgetCheckListType)(v)?l().createElement(qe,{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(Me,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(Ie,null):(0,w.ensureWidgetContactCardDavType)(v)?l().createElement(Ae,null):(0,w.ensureWidgetCalendarCalDavType)(v)?l().createElement(Oe,null):(0,w.ensureWidgetDatasourceTableType)(v)?l().createElement(je,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},Ge=d.j.getLazyComponent("Icon"),$e=({uniqid:e,position:t})=>{const n=(0,u.jL)(),i=(0,o.useTheme)();return l().createElement(re,null,l().createElement(Ee,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Ge,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:i.color.lavender,size:26.75})))},De=d.j.getLazyComponent("InputColorRaw"),Ve=a().label`
178
+ `,d.j.getLazyComponent("Button")),be=d.j.getLazyComponent("Icon"),ve=({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(ae,null,l().createElement(re,null),l().createElement(se,null,"Popup"),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(be,{name:"icon-times",color:"grey2",size:26.75})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(ae,null,l().createElement(he,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var ye=n(939);const Ce=d.j.getLazyComponent("WidgetArticleTitleEditor"),xe=d.j.getLazyComponent("WidgetArticleTextEditor"),we=d.j.getLazyComponent("WidgetArticleGalleryEditor"),ke=d.j.getLazyComponent("WidgetArticleAttachmentEditor"),Le=d.j.getLazyComponent("WidgetArticleSliderEditor"),_e=d.j.getLazyComponent("WidgetArticleImageEditor"),We=d.j.getLazyComponent("WidgetButtonEditor"),qe=d.j.getLazyComponent("WidgetCheckListEditor"),Se=d.j.getLazyComponent("WidgetQuickSurveyEditor"),je=d.j.getLazyComponent("WidgetDatasourceTableEditor"),Me=d.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),Te=d.j.getLazyComponent("WidgetPresenceEditor"),Ae=d.j.getLazyComponent("WidgetEmailsImapEditor"),Ie=d.j.getLazyComponent("WidgetContactCardDavEditor"),Oe=d.j.getLazyComponent("WidgetCalendarCalDavEditor"),ze=({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)),le.shallowEqual),p=(0,u.GV)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),le.shallowEqual),f=e=>{var t;return null===(t=c.qn.selectors.selectHook(ye.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(We,Object.assign({},v.content,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:()=>E({})})):(0,w.ensureWidgetArticleGalleryType)(v)?l().createElement(we,{token:m,content:v.content,onChange:t=>d((0,c.vR)(e,t,!1)),onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleAttachmentType)(v)?l().createElement(ke,{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(_e,{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(Ce,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content,onOpen:b}):(0,w.ensureWidgetArticleTextType)(v)?l().createElement(xe,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content}):(0,w.ensureWidgetPresenceType)(v)?l().createElement(Te,Object.assign({onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h},v.content)):(0,w.ensureWidgetCheckListType)(v)?l().createElement(qe,{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(Me,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(Ae,null):(0,w.ensureWidgetContactCardDavType)(v)?l().createElement(Ie,null):(0,w.ensureWidgetCalendarCalDavType)(v)?l().createElement(Oe,null):(0,w.ensureWidgetDatasourceTableType)(v)?l().createElement(je,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},Ge=d.j.getLazyComponent("Icon"),De=({uniqid:e,position:t})=>{const n=(0,u.jL)(),i=(0,o.useTheme)();return l().createElement(re,null,l().createElement(Ee,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Ge,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:i.color.lavender,size:26.75})))},Ve=d.j.getLazyComponent("InputColorRaw"),$e=a().label`
179
179
  margin-left: 2px;
180
180
  margin-right: 2px;
181
181
  margin-bottom: 8px;
@@ -185,7 +185,7 @@
185
185
  `,Fe=a().fieldset`
186
186
  margin: 12px 0px !important;
187
187
  width: 100% !important;
188
- `,Re=({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(Fe,null,l().createElement(Ve,null,l().createElement(r.FormattedMessage,{id:e})),l().createElement(De,{palettes:a,label:e,initialValue:null!=t?t:i.color.primary,name:"background-color",onChange:n}))},Be=d.j.getLazyComponent("InputNumber"),He=({label:e,initialValue:t,handleChange:n})=>{const i=(0,r.useIntl)(),{control:o,watch:a}=(0,T.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(Be,{label:e,name:"value",width:"100%",control:o,placeholder:i.formatMessage({id:e})})},Pe=d.j.getLazyComponent("InputSelect"),Ue=({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,T.useForm)({defaultValues:{select:c},criteriaMode:"all"});return l().useEffect((()=>{const e=u((e=>{a(e.select.value)}));return()=>e.unsubscribe()}),[u,a]),l().createElement(Pe,{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"})},Ne=d.j.getLazyComponent("InputText"),Ye=({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)),le.shallowEqual),{control:g,watch:p}=(0,T.useForm)({defaultValues:{text:null!==(t=null==s?void 0:s.title.replace(/&amp;/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(Ne,{name:"text",label:"WIDGET_Title",width:"100%",control:g,placeholder:n.formatMessage({id:"WIDGET_Title"})}),l().createElement(Re,{label:"STYLE_Text_Color",initialValue:f.color,handleChange:e=>E("color",e)}),l().createElement(Re,{label:"STYLE_Background_Color",initialValue:f.backgroundColor,handleChange:e=>E("background-color",e)}),l().createElement(He,{label:"STYLE_Text_Size",initialValue:f.fontSize,handleChange:e=>E("font-size",e)}),l().createElement(Ue,{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(Ue,{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"),Qe=({uniqid:e})=>{var t;const n=null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(ge,null,l().createElement(Je,{size:"l"})))},Xe=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(pe,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Ke=d.j.getLazyComponent("Button"),Ze=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,u.jL)(),o=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),le.shallowEqual),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),le.shallowEqual);return l().createElement(Ke,{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"}))},et=({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)),le.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(Re,{label:"STYLE_Background_Color",initialValue:d.backgroundColor,handleChange:e=>m("background-color",e)}),l().createElement(Re,{label:"STYLE_Text_Color",initialValue:d.color,handleChange:e=>m("color",e)}),l().createElement("hr",null),l().createElement(He,{label:"STYLE_Padding",initialValue:d.padding,handleChange:e=>m("padding",String(e))}),l().createElement(He,{label:"STYLE_Radius",initialValue:d.borderRadius,handleChange:e=>m("border-radius",String(e))}),l().createElement(Ue,{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(Re,{label:"STYLE_Border_Color",initialValue:d.borderColor,handleChange:e=>m("border-color",e)}),"none"!==s["border-style"]&&l().createElement(He,{label:"STYLE_Border_Width",initialValue:d.borderWidth,handleChange:e=>m("border-width",e)}))},tt=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,r.useIntl)(),o=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),le.shallowEqual),a=c.x0.definition(null==o?void 0:o.name),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e)),le.shallowEqual),d=(0,i.useCallback)((n=>{t(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(n)}))}),[e,t]);return l().createElement(Ue,{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)):[]))})},nt=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],it=d.j.getLazyComponent("Icon"),lt=d.j.getLazyComponent("Tooltip"),ot=({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)),le.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(ce,null,l().createElement(de,{ref:d,position:t},l().createElement(fe,null,f.map((e=>e.enable?l().createElement(lt,{key:e.name,position:"left",description:e.label},l().createElement(Ee,{isActive:h&&h.name===e.name,onClick:()=>b(e)},l().createElement(it,{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(ae,null,l().createElement($e,{uniqid:e,position:m.position}),l().createElement(se,null,l().createElement("h3",null,h?h.label:n.formatMessage({id:g.label}))),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{a(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(it,{name:"icon-times",color:s.color.lavender,size:26.75})))),l().createElement(ue,null,l().createElement(me,null,h&&"widget-settings"===h.name&&g.panel.useEditor&&l().createElement(ze,{uniqid:m.uniqid}),h&&"widget-title"===h.name&&g.panel.useWrapper&&l().createElement(Ye,{uniqid:m.uniqid}),h&&"widget-selection"===h.name&&l().createElement(et,{uniqid:e}),h&&"widget-level"===h.name&&p&&l().createElement(tt,{uniqid:e})),l().createElement(Qe,{uniqid:e}),l().createElement(Xe,{uniqid:e}),nt.includes(m.name)&&l().createElement(Ze,{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)},at=a().div`
188
+ `,Re=({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(Fe,null,l().createElement($e,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}))},Be=d.j.getLazyComponent("InputNumber"),He=({label:e,initialValue:t,handleChange:n})=>{const i=(0,r.useIntl)(),{control:o,watch:a}=(0,T.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(Be,{label:e,name:"value",width:"100%",control:o,placeholder:i.formatMessage({id:e})})},Pe=d.j.getLazyComponent("InputSelect"),Ue=({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,T.useForm)({defaultValues:{select:c},criteriaMode:"all"});return l().useEffect((()=>{const e=u((e=>{a(e.select.value)}));return()=>e.unsubscribe()}),[u,a]),l().createElement(Pe,{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"})},Ne=d.j.getLazyComponent("InputText"),Ye=({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)),le.shallowEqual),{control:g,watch:p}=(0,T.useForm)({defaultValues:{text:null!==(t=null==s?void 0:s.title.replace(/&amp;/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(Ne,{name:"text",label:"WIDGET_Title",width:"100%",control:g,placeholder:n.formatMessage({id:"WIDGET_Title"})}),l().createElement(Re,{label:"STYLE_Text_Color",initialValue:f.color,handleChange:e=>E("color",e)}),l().createElement(Re,{label:"STYLE_Background_Color",initialValue:f.backgroundColor,handleChange:e=>E("background-color",e)}),l().createElement(He,{label:"STYLE_Text_Size",initialValue:f.fontSize,handleChange:e=>E("font-size",e)}),l().createElement(Ue,{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(Ue,{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"),Qe=({uniqid:e})=>{var t;const n=null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(ge,null,l().createElement(Je,{size:"l"})))},Xe=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(pe,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Ke=d.j.getLazyComponent("Button"),Ze=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,u.jL)(),o=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),le.shallowEqual),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),le.shallowEqual);return l().createElement(Ke,{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"}))},et=({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)),le.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(Re,{label:"STYLE_Background_Color",initialValue:d.backgroundColor,handleChange:e=>m("background-color",e)}),l().createElement(Re,{label:"STYLE_Text_Color",initialValue:d.color,handleChange:e=>m("color",e)}),l().createElement("hr",null),l().createElement(He,{label:"STYLE_Padding",initialValue:d.padding,handleChange:e=>m("padding",String(e))}),l().createElement(He,{label:"STYLE_Radius",initialValue:d.borderRadius,handleChange:e=>m("border-radius",String(e))}),l().createElement(Ue,{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(Re,{label:"STYLE_Border_Color",initialValue:d.borderColor,handleChange:e=>m("border-color",e)}),"none"!==s["border-style"]&&l().createElement(He,{label:"STYLE_Border_Width",initialValue:d.borderWidth,handleChange:e=>m("border-width",e)}))},tt=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,r.useIntl)(),o=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),le.shallowEqual),a=c.x0.definition(null==o?void 0:o.name),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e)),le.shallowEqual),d=(0,i.useCallback)((n=>{t(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(n)}))}),[e,t]);return l().createElement(Ue,{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)):[]))})},nt=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],it=d.j.getLazyComponent("Icon"),lt=d.j.getLazyComponent("Tooltip"),ot=({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)),le.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(ce,null,l().createElement(de,{ref:d,position:t},l().createElement(fe,null,f.map((e=>e.enable?l().createElement(lt,{key:e.name,position:"left",description:e.label},l().createElement(Ee,{isActive:h&&h.name===e.name,onClick:()=>b(e)},l().createElement(it,{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(ae,null,l().createElement(De,{uniqid:e,position:m.position}),l().createElement(se,null,l().createElement("h3",null,h?h.label:n.formatMessage({id:g.label}))),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{a(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(it,{name:"icon-times",color:s.color.lavender,size:26.75})))),l().createElement(ue,null,l().createElement(me,null,h&&"widget-settings"===h.name&&g.panel.useEditor&&l().createElement(ze,{uniqid:m.uniqid}),h&&"widget-title"===h.name&&g.panel.useWrapper&&l().createElement(Ye,{uniqid:m.uniqid}),h&&"widget-selection"===h.name&&l().createElement(et,{uniqid:e}),h&&"widget-level"===h.name&&p&&l().createElement(tt,{uniqid:e})),l().createElement(Qe,{uniqid:e}),l().createElement(Xe,{uniqid:e}),nt.includes(m.name)&&l().createElement(Ze,{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)},at=a().div`
189
189
  position: absolute;
190
190
  inset: 0;
191
191
  pointer-events: none;
@@ -293,21 +293,21 @@
293
293
  width: 0;
294
294
  height: 0;
295
295
  overflow: hidden;
296
- `,Mt=({children:e,initialFiles:t,initialClick:n,multiple:o,accept:a,onUploadStart:r,onUploadEnd:s,onUploadSuccess:d})=>{const m=(0,i.useRef)(null),g=(0,u.GV)(c.x0.selectors.selectToken),[p,f]=(0,i.useState)(0),[E,h]=(0,i.useState)(t);return(0,i.useEffect)((()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}),[n]),(0,i.useEffect)((()=>{t.length!==E.length&&h(t)}),[t]),(0,i.useEffect)((()=>{d(E)}),[E]),(0,i.useEffect)((()=>{0===p&&s()}),[p]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}},e),l().createElement(jt,null,l().createElement(St,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:a,multiple:o,token:g,onUploadStart:e=>{void 0!==e&&f((t=>t+e)),"function"==typeof r&&0!==e&&r()},onUploadSuccess:e=>{void 0!==e&&(f((e=>void 0!==e?e-1:0)),h((t=>o?[...t,e]:[e])))}})))},Tt=d.j.getLazyComponent("WidgetAttachment"),It=d.j.getLazyComponent("WidgetEmptyInplace"),At=d.j.getLazyComponent("FileViewer"),Ot=a().div`
296
+ `,Mt=({children:e,initialFiles:t,initialClick:n,multiple:o,accept:a,onUploadStart:r,onUploadEnd:s,onUploadSuccess:d})=>{const m=(0,i.useRef)(null),g=(0,u.GV)(c.x0.selectors.selectToken),[p,f]=(0,i.useState)(0),[E,h]=(0,i.useState)(t);return(0,i.useEffect)((()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}),[n]),(0,i.useEffect)((()=>{t.length!==E.length&&h(t)}),[t]),(0,i.useEffect)((()=>{d(E)}),[E]),(0,i.useEffect)((()=>{0===p&&s()}),[p]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}},e),l().createElement(jt,null,l().createElement(St,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:a,multiple:o,token:g,onUploadStart:e=>{void 0!==e&&f((t=>t+e)),"function"==typeof r&&0!==e&&r()},onUploadSuccess:e=>{void 0!==e&&(f((e=>void 0!==e?e-1:0)),h((t=>o?[...t,e]:[e])))}})))},Tt=d.j.getLazyComponent("WidgetAttachment"),At=d.j.getLazyComponent("WidgetEmptyInplace"),It=d.j.getLazyComponent("FileViewer"),Ot=a().div`
297
297
  flex: 1;
298
- `,zt=({widget:e,inplace:t,mode:n})=>{const o=(0,r.useIntl)(),{uniqid:a}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),le.shallowEqual),g=e=>{d(c.y8.actions.error({label:null!=e?e:o.formatMessage({id:"GLOBAL_Error"})}))};(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s||0===s.length}))}),[s]);const p=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),f=[{label:o.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&k().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const n=t.result;((e,t)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,n)})).catch((()=>{d(c.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],E=p?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:f}]:[];return void 0!==s?l().createElement(Ot,null,"view"!==n?l().createElement(Tt,{files:s,onClick:()=>{},onError:g}):l().createElement(At,{files:s,openWithOptions:E},(e=>l().createElement(Tt,{files:s,onClick:t=>e(t),onError:g}))),t&&"view"!==n&&l().createElement(Mt,{initialFiles:s,initialClick:m,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&d((0,c.vR)(a,{files:e}))},onUploadStart:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},"edit"===n?l().createElement(It,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):l().createElement(l().Fragment,null))):l().createElement(l().Fragment,null)},Gt=d.j.getLazyComponent("WidgetButton"),$t=a().div`
298
+ `,zt=({widget:e,inplace:t,mode:n})=>{const o=(0,r.useIntl)(),{uniqid:a}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),le.shallowEqual),g=e=>{d(c.y8.actions.error({label:null!=e?e:o.formatMessage({id:"GLOBAL_Error"})}))};(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s||0===s.length}))}),[s]);const p=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),f=[{label:o.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&k().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const n=t.result;((e,t)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,n)})).catch((()=>{d(c.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],E=p?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:f}]:[];return void 0!==s?l().createElement(Ot,null,"view"!==n?l().createElement(Tt,{files:s,onClick:()=>{},onError:g}):l().createElement(It,{files:s,openWithOptions:E},(e=>l().createElement(Tt,{files:s,onClick:t=>e(t),onError:g}))),t&&"view"!==n&&l().createElement(Mt,{initialFiles:s,initialClick:m,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&d((0,c.vR)(a,{files:e}))},onUploadStart:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},"edit"===n?l().createElement(At,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):l().createElement(l().Fragment,null))):l().createElement(l().Fragment,null)},Gt=d.j.getLazyComponent("WidgetButton"),Dt=a().div`
299
299
  display: flex;
300
300
  flex: 1;
301
301
  justify-content: center;
302
302
  align-items: center;
303
- `,Dt=a().div`
303
+ `,Vt=a().div`
304
304
  pointer-events: ${e=>e.clickable?"all":"none"};
305
305
  cursor: pointer;
306
306
  display: flex;
307
307
  flex: 1;
308
308
  justify-content: center;
309
309
  align-items: center;
310
- `,Vt=({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($t,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(Dt,{clickable:"edit"!==t},l().createElement(Gt,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f})))},Ft=d.j.getLazyComponent("WidgetArticleGallery"),Rt=d.j.getLazyComponent("WidgetEmptyInplace"),Bt=d.j.getLazyComponent("FileViewer"),Ht=a().button`
310
+ `,$t=({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(Dt,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(Vt,{clickable:"edit"!==t},l().createElement(Gt,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f})))},Ft=d.j.getLazyComponent("WidgetArticleGallery"),Rt=d.j.getLazyComponent("WidgetEmptyInplace"),Bt=d.j.getLazyComponent("FileViewer"),Ht=a().button`
311
311
  cursor: pointer;
312
312
  `,Pt=({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)),le.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(Ft,{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(Bt,{files:s,openWithOptions:[]},(t=>{var n,i;return l().createElement(Ht,null,l().createElement(Ft,{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(Mt,{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(Rt,{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)},Ut=d.j.getLazyComponent("WidgetImage"),Nt=d.j.getLazyComponent("FileViewer"),Yt=d.j.getLazyComponent("WidgetEmptyInplace"),Jt=a().div`
313
313
  position: absolute;
@@ -331,7 +331,7 @@
331
331
  min-height: 60px;
332
332
  align-items: center;
333
333
  width: ${e=>e.maxWidth}px;
334
- `,on={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},an=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},rn=({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)),le.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({},on),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:on.mimetype,path:(0,w.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?an(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?an(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(ln,{maxWidth:d&&d<s?d:s},l().createElement(en,{files:p,openWithOptions:[]},(n=>{var i,r;return l().createElement(nn,{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(tn,{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 sn=n(730);const cn=()=>{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 dn=n(201);const un=d.j.getLazyComponent("InputTextareaRaw"),mn=d.j.getLazyComponent("Modal"),gn=({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(mn,{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(dn.xI.parse(a,{async:!1}).replace(/<br>/g,"<br><br>")),c()}}]},l().createElement(un,{value:a,onChange:e=>s(e.target.value),height:"400px"}))},pn=d.j.getLazyComponent("WidgetArticleText"),fn=a().div`
334
+ `,on={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},an=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},rn=({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)),le.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({},on),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:on.mimetype,path:e.file&&e.file.uri?(0,w.formatImgUrl)({size:"fitx1200",uri:e.file.uri,from:"imagecache",timestamp:e.file&&e.file.dateModified?an(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?an(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(ln,{maxWidth:d&&d<s?d:s},l().createElement(en,{files:p,openWithOptions:[]},(n=>{var i,r;return l().createElement(nn,{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(tn,{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 sn=n(730);const cn=()=>{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 dn=n(201);const un=d.j.getLazyComponent("InputTextareaRaw"),mn=d.j.getLazyComponent("Modal"),gn=({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(mn,{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(dn.xI.parse(a,{async:!1}).replace(/<br>/g,"<br><br>")),c()}}]},l().createElement(un,{value:a,onChange:e=>s(e.target.value),height:"400px"}))},pn=d.j.getLazyComponent("WidgetArticleText"),fn=a().div`
335
335
  width: 100%;
336
336
  cursor: text;
337
337
 
@@ -394,14 +394,14 @@
394
394
  fieldset {
395
395
  margin: 0.2rem !important;
396
396
  }
397
- `,In=({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,T.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(Tn,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()}}))},An=a().div`
397
+ `,An=({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,T.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(Tn,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()}}))},In=a().div`
398
398
  position: absolute;
399
399
  inset: 0;
400
400
  display: flex;
401
401
  justify-content: center;
402
402
  align-items: center;
403
403
  background-color: rgba(255, 255, 255, 0.4);
404
- `,On=()=>l().createElement(An,null,l().createElement(s.JRCLoader,{size:"m"})),zn=d.j.getLazyComponent("WidgetCheckList"),Gn=d.j.getLazyComponent("WidgetCheckListEditor"),$n=(a().div`
404
+ `,On=()=>l().createElement(In,null,l().createElement(s.JRCLoader,{size:"m"})),zn=d.j.getLazyComponent("WidgetCheckList"),Gn=d.j.getLazyComponent("WidgetCheckListEditor"),Dn=(a().div`
405
405
  display: flex;
406
406
  flex-direction: row;
407
407
  justify-content: space-between;
@@ -415,9 +415,9 @@
415
415
  display: flex;
416
416
  gap: 14px;
417
417
  padding: 16px;
418
- `),Dn=a().div`
418
+ `),Vn=a().div`
419
419
  position: relative;
420
- `,Vn=({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),L=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),_=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),le.shallowEqual),q=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),le.shallowEqual),S=(0,i.useMemo)((()=>W&&W.update),[W]),j=(0,i.useMemo)((()=>W&&W.administrate),[W]),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]);L?f||E(L):T();const I=(0,i.useCallback)(((e,t)=>{p((0,c.vR)(e,t))}),[p]),A=(0,i.useCallback)((()=>{_&&(x(!0),k().widget.getWidget({uri:_,uniqid:m}).then((e=>{(0,w.ensureWidgetCheckListType)(e.result)&&I(m,e.result.content)})).catch((e=>!e.aborted&&M)).finally((()=>x(!1))))}),[m,M,_,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&&_&&t.object.uri===_&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||A())}),[q,e.uniqid,_,M,p,A]);const z=t=>{if(!e.content.arr||!_)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});k().widget.updateWidget({uri:_,uniqid:e.uniqid,content:n,v2:!0}).then((()=>I(e.uniqid,n))).catch((e=>M(e.errorMsg)))},G=(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($n,null,l().createElement(Gn,{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(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},v&&l().createElement(s.JRCFileViewer,{files:G,openWithOptions:[]},(t=>l().createElement(Dn,{key:e.uniqid},l().createElement(zn,{limit:10,initialEntries:v,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{_&&(C||(x(!0),k().widget.checkListRespond({uri:_,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{M(e.message),x(!1)}))))})(e.uniqid,t)}),g.edit&&l().createElement(In,{handleClick:z,placeholder:d.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),j&&f&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!S)},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(On,null)))))},Fn=(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},Rn=d.j.getLazyComponent("Button"),Bn=d.j.getLazyComponent("Html"),Hn=d.j.getLazyComponent("WidgetTable"),Pn=d.j.getLazyComponent("Loader"),Un=(a().div``,a().div`
420
+ `,$n=({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),L=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),_=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),le.shallowEqual),q=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),le.shallowEqual),S=(0,i.useMemo)((()=>W&&W.update),[W]),j=(0,i.useMemo)((()=>W&&W.administrate),[W]),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]);L?f||E(L):T();const A=(0,i.useCallback)(((e,t)=>{p((0,c.vR)(e,t))}),[p]),I=(0,i.useCallback)((()=>{_&&(x(!0),k().widget.getWidget({uri:_,uniqid:m}).then((e=>{(0,w.ensureWidgetCheckListType)(e.result)&&A(m,e.result.content)})).catch((e=>!e.aborted&&M)).finally((()=>x(!1))))}),[m,M,_,A]),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&&_&&t.object.uri===_&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||I())}),[q,e.uniqid,_,M,p,I]);const z=t=>{if(!e.content.arr||!_)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});k().widget.updateWidget({uri:_,uniqid:e.uniqid,content:n,v2:!0}).then((()=>A(e.uniqid,n))).catch((e=>M(e.errorMsg)))},G=(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(Dn,null,l().createElement(Gn,{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:A,onChangeWrapper:e=>{p(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>p((0,c.vR)(e.uniqid,t))})):l().createElement(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},v&&l().createElement(s.JRCFileViewer,{files:G,openWithOptions:[]},(t=>l().createElement(Vn,{key:e.uniqid},l().createElement(zn,{limit:10,initialEntries:v,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{_&&(C||(x(!0),k().widget.checkListRespond({uri:_,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{M(e.message),x(!1)}))))})(e.uniqid,t)}),g.edit&&l().createElement(An,{handleClick:z,placeholder:d.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),j&&f&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!S)},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(On,null)))))},Fn=(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},Rn=d.j.getLazyComponent("Button"),Bn=d.j.getLazyComponent("WidgetTable"),Hn=d.j.getLazyComponent("Loader"),Pn=(a().div``,a().div`
421
421
  position: absolute;
422
422
  inset: 0;
423
423
  display: flex;
@@ -425,23 +425,7 @@
425
425
  justify-content: center;
426
426
  align-items: center;
427
427
  gap: ${e=>e.theme.space.md}px;
428
- `),Nn=a().div`
429
- position: absolute;
430
- inset: 0;
431
- display: flex;
432
- flex-direction: row;
433
- justify-content: center;
434
- align-items: center;
435
- gap: ${e=>e.theme.space.md}px;
436
- color: ${e=>e.theme.color.primary};
437
- cursor: pointer;
438
- opacity: 0;
439
- border: 1px solid ${e=>e.theme.color.primary};
440
- &:hover {
441
- background-color: ${e=>e.theme.color.grey2};
442
- opacity: 0.9;
443
- }
444
- `,Yn=({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,L]=(0,i.useState)(!1),[_,W]=(0,i.useState)([]),[q,S]=(0,i.useState)([]),[j,M]=(0,i.useState)({order:"ascending",name:"unknown"}),[T,I]=(0,i.useState)(void 0),[A,O]=(0,i.useState)(""),z=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.DatasourceTable)),[]),G=(0,i.useMemo)((()=>"studio"===T?[{type:[A]}]:[]),[T,A]),$=(0,i.useMemo)((()=>"doc"===T?[A]:[]),[T,A]),{rtLastObject:D}=(0,qt.YL)(G,$),V=(0,i.useCallback)((()=>{t&&(L(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{S(e.result.model),W(e.result.data),M(e.result.sort),I(e.result.datasource.datasourceType),O(e.result.datasource.datasourceIdentifier)})).finally((()=>L(!1))))}),[t]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===q.length&&V()}),[t,g,q,V]),(0,i.useEffect)((()=>{D&&V()}),[D,V]),(0,i.useEffect)((()=>{t||S([])}),[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)((()=>Fn(g,q)),[g,q]);return 0!==g.length||x||"edit"!==h?x?l().createElement(Un,null,l().createElement(Pn,null)):l().createElement(l().Fragment,null,x||0!==_.length?l().createElement(Hn,{rows:_,columns:R,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:f,tableSizedColumnsWidth:E,tableDefaultSortOrder:j.order,tableDefaultSortName:j.name}):l().createElement(Un,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(Nn,{onClick:F},l().createElement(Bn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:z.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(Un,{onClick:F},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:z.label}),l().createElement(Rn,{label:"GLOBAL_Settings"})),l().createElement(Nn,{onClick:F},l().createElement(Bn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:z.label})}</b>`})))},Jn=d.j.getLazyComponent("Button"),Qn=d.j.getLazyComponent("Html"),Xn=d.j.getLazyComponent("WidgetTable"),Kn=d.j.getLazyComponent("Loader"),Zn=(a().div``,a().div`
428
+ `),Un=({uri:e,limit:t,tableHeadColor:n,tableHeadTextColor:o,tableHeadIconColor:a,tableRowColor:s,tableRowTextColor:d,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:f,mode:E})=>{const h=(0,u.jL)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,L]=(0,i.useState)([]),[_,W]=(0,i.useState)({order:"ascending",name:"unknown"}),[q,S]=(0,i.useState)(void 0),[j,M]=(0,i.useState)(""),T=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.DatasourceTable)),[]),A=(0,i.useMemo)((()=>"studio"===q?[{type:[j]}]:[]),[q,j]),I=(0,i.useMemo)((()=>"doc"===q?[j]:[]),[q,j]),{rtLastObject:O}=(0,qt.YL)(A,I),z=(0,i.useCallback)((()=>{e&&(v(!0),k().datasource.get(e,w.Format.VIEW).then((e=>{L(e.result.model),C(e.result.data),W(e.result.sort),S(e.result.datasource.datasourceType),M(e.result.datasource.datasourceIdentifier)})).finally((()=>v(!1))))}),[e]);(0,i.useEffect)((()=>{void 0!==e&&0!==m.length&&0===x.length&&z()}),[e,m,x,z]),(0,i.useEffect)((()=>{O&&z()}),[O,z]),(0,i.useEffect)((()=>{e||L([])}),[e]),(0,i.useEffect)((()=>{"view"!==E&&"preview"!==E||h(c.cr.slice.actions.flushAllEditor())}),[E,h]);const G=(0,i.useMemo)((()=>Fn(m,x)),[m,x]);return 0!==m.length||b||"edit"!==E?b?l().createElement(Pn,null,l().createElement(Hn,null)):l().createElement(l().Fragment,null,b||0!==y.length||"edit"===E?l().createElement(Bn,{rows:y,columns:G,limit:t,tableHeadColor:n,tableHeadTextColor:o,tableHeadIconColor:a,tableRowColor:s,tableRowTextColor:d,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:f,tableDefaultSortOrder:_.order,tableDefaultSortName:_.name}):l().createElement(Pn,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"}))):l().createElement(l().Fragment,null,l().createElement(Pn,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:T.label}),l().createElement(Rn,{label:"GLOBAL_Settings"})))},Nn=d.j.getLazyComponent("Button"),Yn=d.j.getLazyComponent("WidgetTable"),Jn=d.j.getLazyComponent("Loader"),Qn=(a().div``,a().div`
445
429
  position: absolute;
446
430
  inset: 0;
447
431
  display: flex;
@@ -449,37 +433,21 @@
449
433
  justify-content: center;
450
434
  align-items: center;
451
435
  gap: ${e=>e.theme.space.md}px;
452
- `),ei=a().div`
453
- position: absolute;
454
- inset: 0;
455
- display: flex;
456
- flex-direction: row;
457
- justify-content: center;
458
- align-items: center;
459
- gap: ${e=>e.theme.space.md}px;
460
- color: ${e=>e.theme.color.primary};
461
- cursor: pointer;
462
- opacity: 0;
463
- border: 1px solid ${e=>e.theme.color.primary};
464
- &:hover {
465
- background-color: ${e=>e.theme.color.grey2};
466
- opacity: 0.9;
467
- }
468
- `,ti=({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,L]=(0,i.useState)(!1),[_,W]=(0,i.useState)([]),[q,S]=(0,i.useState)([]),j=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===q.length&&(L(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{S(e.result.model),W(e.result.data)})).finally((()=>L(!1))))}),[t,g,q]),(0,i.useEffect)((()=>{t||S([])}),[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)((()=>Fn(g,q)),[g,q]);return 0!==g.length||x||"edit"!==h?x?l().createElement(Zn,null,l().createElement(Kn,null)):l().createElement(l().Fragment,null,x||0!==_.length?l().createElement(Xn,{rows:_,columns:T,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:f,tableSizedColumnsWidth:E}):l().createElement(Zn,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(ei,{onClick:M},l().createElement(Qn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:j.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(Zn,{onClick:M},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:j.label}),l().createElement(Jn,{label:"GLOBAL_Settings"})),l().createElement(ei,{onClick:M},l().createElement(Qn,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:j.label})}</b>`})))},ni=a().div`
436
+ `),Xn=({uri:e,limit:t,tableHeadColor:n,tableHeadTextColor:o,tableHeadIconColor:a,tableRowColor:s,tableRowTextColor:d,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:f,mode:E})=>{const h=(0,u.jL)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,L]=(0,i.useState)([]),_=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==e&&0!==m.length&&0===x.length&&(v(!0),k().datasource.get(e,w.Format.VIEW).then((e=>{L(e.result.model),C(e.result.data)})).finally((()=>v(!1))))}),[e,m,x]),(0,i.useEffect)((()=>{e||L([])}),[e]),(0,i.useEffect)((()=>{"view"!==E&&"preview"!==E||h(c.cr.slice.actions.flushAllEditor())}),[E,h]);const W=(0,i.useMemo)((()=>Fn(m,x)),[m,x]);return 0!==m.length||b||"edit"!==E?b?l().createElement(Qn,null,l().createElement(Jn,null)):l().createElement(l().Fragment,null,b||0!==y.length||"edit"===E?l().createElement(Yn,{rows:y,columns:W,limit:t,tableHeadColor:n,tableHeadTextColor:o,tableHeadIconColor:a,tableRowColor:s,tableRowTextColor:d,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:f}):l().createElement(Qn,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"}))):l().createElement(l().Fragment,null,l().createElement(Qn,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:_.label}),l().createElement(Nn,{label:"GLOBAL_Settings"})))},Kn=a().div`
469
437
  padding: ${e=>e.theme.space.md}px;
470
- `,ii=a().a`
438
+ `,Zn=a().a`
471
439
  cursor: pointer;
472
440
  color: ${e=>e.theme.color.secondary};
473
- `,li=a().div`
441
+ `,ei=a().div`
474
442
  display: flex;
475
443
  justify-content: center;
476
444
  align-items: center;
477
- `,oi=({mode:e,uniqid:t,content:n})=>{const o=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,t)),le.shallowEqual),d=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),le.shallowEqual),m=(0,i.useMemo)((()=>!(!d||!d.update)),[d]),g=(0,i.useCallback)((()=>{if("edit"===e||!m||!s)return;const i=Object.assign(Object.assign({},n),{isClosed:!0});k().widget.updateWidget({uri:s,uniqid:t,content:i,v2:!0}).then((()=>a(c.x0.slice.actions.updateWidget({uniqid:t,content:i})))).catch((()=>a(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}),[e,t,m,s,n,a]);return l().createElement(l().Fragment,null,m&&!n.isClosed&&l().createElement(ni,null,l().createElement(li,null,l().createElement(ii,{onClick:g},o.formatMessage({id:"WIDGET_Presence_Closing"})))))},ai=d.j.getLazyComponent("WidgetPresence"),ri=d.j.getLazyComponent("ModalUserList"),si=a().div`
445
+ `,ti=({mode:e,uniqid:t,content:n})=>{const o=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,t)),le.shallowEqual),d=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),le.shallowEqual),m=(0,i.useMemo)((()=>!(!d||!d.update)),[d]),g=(0,i.useCallback)((()=>{if("edit"===e||!m||!s)return;const i=Object.assign(Object.assign({},n),{isClosed:!0});k().widget.updateWidget({uri:s,uniqid:t,content:i,v2:!0}).then((()=>a(c.x0.slice.actions.updateWidget({uniqid:t,content:i})))).catch((()=>a(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}),[e,t,m,s,n,a]);return l().createElement(l().Fragment,null,m&&!n.isClosed&&l().createElement(Kn,null,l().createElement(ei,null,l().createElement(Zn,{onClick:g},o.formatMessage({id:"WIDGET_Presence_Closing"})))))},ni=d.j.getLazyComponent("WidgetPresence"),ii=d.j.getLazyComponent("ModalUserList"),li=a().div`
478
446
  display: flex;
479
447
  flex: 1;
480
448
  position: relative;
481
449
  flex-direction: column;
482
- `,ci=(a().div`
450
+ `,oi=(a().div`
483
451
  position: absolute;
484
452
  inset: 0;
485
453
  background-color: rgba(255, 255, 255, 0.7);
@@ -496,24 +464,24 @@
496
464
  align-items: center;
497
465
  border-radius: ${e=>e.theme.space.sm}px;
498
466
  margin: ${e=>e.theme.space.sm}px;
499
- `),di=({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,L]=(0,i.useState)(),_=(0,i.useRef)(b),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),le.shallowEqual),q=(0,u.GV)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),le.shallowEqual),S=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),j=(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)((()=>{W&&!M&&(j?(h(!0),k().widget.presenceCancel({uri:W,uniqid:g}).catch(S).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,S,W,j,M]),I=(0,i.useCallback)((e=>{W&&!M&&(h(!0),k().widget.presenceRespond({uri:W,uniqid:g,value:e},_.current.signal).catch(S).finally((()=>h(!1))))}),[W,g,S,M]),A=(0,i.useCallback)((()=>{"edit"!==t&&W&&(h(!0),k().widget.presenceGetResponse({uri:W,uniqid:g},_.current.signal).then((e=>{f(e.result)})).catch((e=>!e.aborted&&S())).finally((()=>h(!1))))}),[W,S,g,t]),O=(e,t)=>{W&&k().widget.presenceGetResponseUserList({uri:W,uniqid:g,index:e,page:t,limit:8},_.current.signal).then((e=>{L(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&S))},z=(0,i.useCallback)((()=>{W&&(h(!0),k().widget.getWidget({uri:W,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&S)).finally((()=>h(!1))))}),[o,S,W,g]);return(0,i.useEffect)((()=>{const e=_.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{A()}),[A]),(0,i.useEffect)((()=>{if(!Array.isArray(q))return;const e=q.at(-1);e&&W&&e.object.uri===W&&e.uniqid===g&&("widget-presence-response"===e.fn&&A(),"widget-update"===e.fn&&z())}),[q,A,g,W,z]),l().createElement(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},l().createElement(si,null,l().createElement(ai,{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=>{L({limit:0,page:0,data:[],cnt:0}),x(e),O(e),y(!0)}}),d&&m&&l().createElement(ci,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),d&&!m&&l().createElement(oi,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,mode:t}),E&&l().createElement(On,null),l().createElement(ri,{open:v,usersList:w,title:1===C?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:y,onClose:()=>{L({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{O(null!=C?C:0,e)}})))},ui=d.j.getLazyComponent("WidgetQuickSurvey"),mi=d.j.getLazyComponent("WidgetQuickSurveyEditor"),gi=d.j.getLazyComponent("ModalUserList"),pi=a().div`
467
+ `),ai=({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,L]=(0,i.useState)(),_=(0,i.useRef)(b),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),le.shallowEqual),q=(0,u.GV)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),le.shallowEqual),S=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),j=(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)((()=>{W&&!M&&(j?(h(!0),k().widget.presenceCancel({uri:W,uniqid:g}).catch(S).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,S,W,j,M]),A=(0,i.useCallback)((e=>{W&&!M&&(h(!0),k().widget.presenceRespond({uri:W,uniqid:g,value:e},_.current.signal).catch(S).finally((()=>h(!1))))}),[W,g,S,M]),I=(0,i.useCallback)((()=>{"edit"!==t&&W&&(h(!0),k().widget.presenceGetResponse({uri:W,uniqid:g},_.current.signal).then((e=>{f(e.result)})).catch((e=>!e.aborted&&S())).finally((()=>h(!1))))}),[W,S,g,t]),O=(e,t)=>{W&&k().widget.presenceGetResponseUserList({uri:W,uniqid:g,index:e,page:t,limit:8},_.current.signal).then((e=>{L(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&S))},z=(0,i.useCallback)((()=>{W&&(h(!0),k().widget.getWidget({uri:W,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&S)).finally((()=>h(!1))))}),[o,S,W,g]);return(0,i.useEffect)((()=>{const e=_.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{I()}),[I]),(0,i.useEffect)((()=>{if(!Array.isArray(q))return;const e=q.at(-1);e&&W&&e.object.uri===W&&e.uniqid===g&&("widget-presence-response"===e.fn&&I(),"widget-update"===e.fn&&z())}),[q,I,g,W,z]),l().createElement(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},l().createElement(li,null,l().createElement(ni,{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():A(1),handleClickUnavailable:()=>0===p.userValue?T():A(0),handleOpenUsersModal:e=>{L({limit:0,page:0,data:[],cnt:0}),x(e),O(e),y(!0)}}),d&&m&&l().createElement(oi,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),d&&!m&&l().createElement(ti,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,mode:t}),E&&l().createElement(On,null),l().createElement(ii,{open:v,usersList:w,title:1===C?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:y,onClose:()=>{L({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{O(null!=C?C:0,e)}})))},ri=d.j.getLazyComponent("WidgetQuickSurvey"),si=d.j.getLazyComponent("WidgetQuickSurveyEditor"),ci=d.j.getLazyComponent("ModalUserList"),di=a().div`
500
468
  width: 100%;
501
469
  display: flex;
502
470
  flex-direction: column;
503
471
  gap: 14px;
504
472
  ${e=>e.withPadding&&"padding: 0 12px;"}
505
473
  padding-top: 16px;
506
- `,fi=({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,L]=(0,i.useState)(),[_,W]=(0,i.useState)(),[q]=(0,i.useState)(new AbortController),S=(0,i.useRef)(q),j=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),M=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),T=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),le.shallowEqual),I=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),le.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]),G=(0,i.useCallback)((e=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyGetResponse({uri:M,uniqid:e},S.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},S.current.signal).then((e=>{A(p,e.result.content)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[p,z,M,A]),D=()=>{if(M&&f.closing){const e=Object.assign(Object.assign({},f),{isClosed:!0});k().widget.updateWidget({uri:M,uniqid:p,content:e}).catch((()=>{z()}))}},V=t=>{(t=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyRespond({uri:M,index:t,multi:f.multi?1:0,uniqid:p},S.current.signal).then((()=>{G(e.uniqid)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))})(t)},F=(e,t)=>{M&&k().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},S.current.signal).then((e=>{W(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&z))},R=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{G(e.uniqid)}),[G,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&&G(e.uniqid),"widget-update"===t.fn&&$())}),[I,M,e.uniqid,$,G]);const B=(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)((()=>{j||"edit"!==n||k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,j,g]),"edit"===n&&t?l().createElement(pi,{withPadding:!0},l().createElement(mi,{token:j,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(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},l().createElement(pi,null,l().createElement(s.JRCFileViewer,{files:B,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(ui,{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:R,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:D,handleProgressBarClick:V,setOpenUsersModal:e=>{L(e),F(e),v(!0)}})})),f.open&&l().createElement(In,{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"})}),R&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!R},mode:n,handleOpenEditor:()=>{j?O(j):(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(On,null),l().createElement(gi,{open:b,usersList:_,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=>{F(null!=x?x:0,e)},onClose:()=>{W({limit:0,page:0,data:[],cnt:0})}})))},Ei=d.j.getLazyComponent("ModalLayout"),hi=d.j.getLazyComponent("ModalContent"),bi=d.j.getLazyComponent("Button"),vi=d.j.getLazyComponent("InputText"),yi=d.j.getLazyComponent("InputNumber"),Ci=d.j.getLazyComponent("InputSelect"),xi=d.j.getLazyComponent("InputPassword"),wi=d.j.getLazyComponent("Typography"),ki=a().div`
474
+ `,ui=({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,L]=(0,i.useState)(),[_,W]=(0,i.useState)(),[q]=(0,i.useState)(new AbortController),S=(0,i.useRef)(q),j=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),M=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),T=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),le.shallowEqual),A=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),le.shallowEqual),I=(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]),G=(0,i.useCallback)((e=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyGetResponse({uri:M,uniqid:e},S.current.signal).then((e=>{h(e.result)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[z,M,n]),D=(0,i.useCallback)((()=>{M&&(C(!0),k().widget.getWidget({uri:M,uniqid:p},S.current.signal).then((e=>{I(p,e.result.content)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[p,z,M,I]),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()}))}},$=t=>{(t=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyRespond({uri:M,index:t,multi:f.multi?1:0,uniqid:p},S.current.signal).then((()=>{G(e.uniqid)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))})(t)},F=(e,t)=>{M&&k().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},S.current.signal).then((e=>{W(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&z))},R=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{G(e.uniqid)}),[G,e.uniqid]),(0,i.useEffect)((()=>{if(!Array.isArray(A))return;const t=A.at(-1);t&&M&&t.object.uri===M&&t.uniqid===e.uniqid&&("widget-quick-survey-response"===t.fn&&G(e.uniqid),"widget-update"===t.fn&&D())}),[A,M,e.uniqid,D,G]);const B=(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)((()=>{j||"edit"!==n||k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,j,g]),"edit"===n&&t?l().createElement(di,{withPadding:!0},l().createElement(si,{token:j,uniqid:p,content:e.content,onChangeContent:I,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:e=>I(p,e),inplace:t})):l().createElement(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},l().createElement(di,null,l().createElement(s.JRCFileViewer,{files:B,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(ri,{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:R,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:V,handleProgressBarClick:$,setOpenUsersModal:e=>{L(e),F(e),v(!0)}})})),f.open&&l().createElement(An,{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"})}),R&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!R},mode:n,handleOpenEditor:()=>{j?O(j):(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(On,null),l().createElement(ci,{open:b,usersList:_,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=>{F(null!=x?x:0,e)},onClose:()=>{W({limit:0,page:0,data:[],cnt:0})}})))},mi=d.j.getLazyComponent("ModalLayout"),gi=d.j.getLazyComponent("ModalContent"),pi=d.j.getLazyComponent("Button"),fi=d.j.getLazyComponent("InputText"),Ei=d.j.getLazyComponent("InputNumber"),hi=d.j.getLazyComponent("InputSelect"),bi=d.j.getLazyComponent("InputPassword"),vi=d.j.getLazyComponent("Typography"),yi=a().div`
507
475
  display: flex;
508
476
  flex-direction: column;
509
477
  opacity: ${e=>e.isLocked?".4":"1.0"};
510
- `,Li=a().div`
478
+ `,Ci=a().div`
511
479
  position: absolute;
512
480
  inset: 0;
513
481
  display: flex;
514
482
  justify-content: center;
515
483
  align-items: center;
516
- `,_i=a().div`
484
+ `,xi=a().div`
517
485
  background-color: ${e=>e.theme.color.orange};
518
486
  color: ${e=>e.theme.color.white};
519
487
  padding: ${e=>e.theme.space.sm}px;
@@ -521,21 +489,21 @@
521
489
  display: flex;
522
490
  justify-content: center;
523
491
  align-items: center;
524
- `,Wi={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:w.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},qi=()=>{const e=(0,r.useIntl)(),t=(0,le.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,T.useForm)({defaultValues:Wi,criteriaMode:"all"}),[b,v]=(0,i.useState)([]),y=E(),C=[{label:"NONE",value:w.ImapConnection.NONE},{label:"SSL",value:w.ImapConnection.SSL},{label:"STARTTLS",value:w.ImapConnection.STARTTLS}],x=(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),x(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,x]),(0,i.useEffect)((()=>{1===b.length&&p("provider",b[0].id)}),[b,p]);const L=()=>a(!1);return l().createElement(l().Fragment,null,l().createElement(Li,null,l().createElement(bi,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>a(!0)})),l().createElement(Ei,{open:o,radius:"small",closeHandler:L},l().createElement(hi,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:L},d?l().createElement(s.JRCLoader,{size:"s"}):l().createElement(l().Fragment,null,0===b.length&&l().createElement(_i,null,e.formatMessage({id:"Office_No_Providers"})),l().createElement(ki,{isLocked:0===b.length},b.length>1&&l().createElement(wi,{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(wi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Settings"})),l().createElement(vi,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),l().createElement(vi,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),l().createElement(xi,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}}),l().createElement(wi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_IMap_Mailbox"})),l().createElement(yi,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),l().createElement(Si,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:C[0],options:C,handleChange:e=>p("imapConnectionSecurity",e)}),l().createElement(vi,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}}),l().createElement(wi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})),l().createElement(vi,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}}),l().createElement(wi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})),l().createElement(vi,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})),l().createElement(bi,{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()})))}})))))},Si=({label:e,initialValue:t,options:n,handleChange:o})=>{const{control:a,watch:r}=(0,T.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(Ci,{label:e,name:"provider",options:null!=n?n:[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:a,rules:{required:!0}})},ji=a().div`
492
+ `,wi={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:w.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},ki=()=>{const e=(0,r.useIntl)(),t=(0,le.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,T.useForm)({defaultValues:wi,criteriaMode:"all"}),[b,v]=(0,i.useState)([]),y=E(),C=[{label:"NONE",value:w.ImapConnection.NONE},{label:"SSL",value:w.ImapConnection.SSL},{label:"STARTTLS",value:w.ImapConnection.STARTTLS}],x=(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),x(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,x]),(0,i.useEffect)((()=>{1===b.length&&p("provider",b[0].id)}),[b,p]);const L=()=>a(!1);return l().createElement(l().Fragment,null,l().createElement(Ci,null,l().createElement(pi,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>a(!0)})),l().createElement(mi,{open:o,radius:"small",closeHandler:L},l().createElement(gi,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:L},d?l().createElement(s.JRCLoader,{size:"s"}):l().createElement(l().Fragment,null,0===b.length&&l().createElement(xi,null,e.formatMessage({id:"Office_No_Providers"})),l().createElement(yi,{isLocked:0===b.length},b.length>1&&l().createElement(vi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_Provider"})),b.length>1&&l().createElement(Li,{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(vi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Settings"})),l().createElement(fi,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),l().createElement(fi,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),l().createElement(bi,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}}),l().createElement(vi,{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(Li,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:C[0],options:C,handleChange:e=>p("imapConnectionSecurity",e)}),l().createElement(fi,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}}),l().createElement(vi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})),l().createElement(fi,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}}),l().createElement(vi,{size:"s"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})),l().createElement(fi,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})),l().createElement(pi,{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()})))}})))))},Li=({label:e,initialValue:t,options:n,handleChange:o})=>{const{control:a,watch:r}=(0,T.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(hi,{label:e,name:"provider",options:null!=n?n:[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:a,rules:{required:!0}})},_i=a().div`
525
493
  padding: ${e=>e.theme.space.md}px;
526
494
  padding-right: 0px;
527
- `,Mi=a().div`
495
+ `,Wi=a().div`
528
496
  text-align: ${e=>e.textAlign};
529
497
  font-size: ${e=>e.fontSize}px;
530
498
  font-weight: ${e=>e.fontWeight};
531
499
  color: ${e=>e.color};
532
- `,Ti=({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)),le.shallowEqual);return l().createElement(l().Fragment,null,a&&"string"==typeof a.title&&0!==a.title.length&&l().createElement(ji,null,l().createElement(Mi,{textAlign:t,fontSize:n,fontWeight:i,color:o},a.title)))},Ii=a().div`
500
+ `,qi=({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)),le.shallowEqual);return l().createElement(l().Fragment,null,a&&"string"==typeof a.title&&0!==a.title.length&&l().createElement(_i,null,l().createElement(Wi,{textAlign:t,fontSize:n,fontWeight:i,color:o},a.title)))},Si=a().div`
533
501
  background-color: ${e=>e.backroundColor};
534
- `,Ai=a().div`
502
+ `,ji=a().div`
535
503
  display: flex;
536
504
  flex-direction: row;
537
505
  align-items: center;
538
- `,Oi=(a().div`
506
+ `,Mi=(a().div`
539
507
  padding: ${e=>e.theme.space.sm}px ${e=>e.theme.space.md}px;
540
508
  color: ${e=>e.theme.color.grey4};
541
509
  `,a().div`
@@ -544,74 +512,74 @@
544
512
  flex-direction: row;
545
513
  gap: ${e=>e.theme.space.xs}px;
546
514
  align-items: center;
547
- `),zi=({uniqid:e,dropdown:t,subHeader:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),le.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(Ii,{backroundColor:s.backgroundColor},l().createElement(Ai,null,l().createElement(Oi,null,l().createElement(Ti,{uniqid:e,fontWeight:s.fontWeight,fontSize:s.fontSize,textAlign:s.textAlign,color:s.color}),n&&n(s.color)),t&&t()))},Gi=d.j.getLazyComponent("ButtonDropdown"),$i=d.j.getLazyComponent("Tooltip"),Di=a().div`
515
+ `),Ti=({uniqid:e,dropdown:t,subHeader:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),le.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(Si,{backroundColor:s.backgroundColor},l().createElement(ji,null,l().createElement(Mi,null,l().createElement(qi,{uniqid:e,fontWeight:s.fontWeight,fontSize:s.fontSize,textAlign:s.textAlign,color:s.color}),n&&n(s.color)),t&&t()))},Ai=d.j.getLazyComponent("ButtonDropdown"),Ii=d.j.getLazyComponent("Tooltip"),Oi=a().div`
548
516
  margin-right: ${e=>e.theme.space.sm}px;
549
517
  button {
550
518
  background: ${e=>e.theme.color.white};
551
519
  }
552
- `,Vi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Wi).finally(n)}}];return l().createElement(zi,{uniqid:e,dropdown:()=>t&&l().createElement(Di,null,l().createElement($i,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Gi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"})))})},Fi=a().div`
520
+ `,zi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(wi).finally(n)}}];return l().createElement(Ti,{uniqid:e,dropdown:()=>t&&l().createElement(Oi,null,l().createElement(Ii,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Ai,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"})))})},Gi=a().div`
553
521
  flex-direction: column;
554
522
  display: flex;
555
523
  flex: 1;
556
- `,Ri=a().div`
524
+ `,Di=a().div`
557
525
  position: relative;
558
526
  display: flex;
559
527
  flex: 1;
560
- `,Bi=a().div`
528
+ `,Vi=a().div`
561
529
  overflow: auto;
562
530
  position: absolute;
563
531
  inset: 0;
564
- `,Hi=({header:e,scrollable:t,footer:n})=>l().createElement(Fi,null,e&&e(),l().createElement(Ri,null,l().createElement(Bi,null,t&&t())),n&&n()),Pi=a().div`
532
+ `,$i=({header:e,scrollable:t,footer:n})=>l().createElement(Gi,null,e&&e(),l().createElement(Di,null,l().createElement(Vi,null,t&&t())),n&&n()),Fi=a().div`
565
533
  display: flex;
566
534
  flex-direction: column;
567
535
  padding: ${e=>e.padding};
568
- `,Ui=({uniqid:e,children:t})=>{const n=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual),o=(0,i.useMemo)((()=>({padding:n&&n.padding?String(n.padding):"0"})),[n]);return l().createElement(Pi,{padding:o.padding},t)},Ni=d.j.getLazyComponent("WidgetContactCardDav"),Yi=({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)),le.shallowEqual),[E,h]=(0,i.useState)([]),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Wi),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(Hi,{header:()=>l().createElement(l().Fragment,null,l().createElement(Vi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Ui,{uniqid:o},r&&l().createElement(Ni,{contactCardList:E}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(qi,null))})},Ji=d.j.getLazyComponent("ButtonDropdown"),Qi=d.j.getLazyComponent("Tooltip"),Xi=a().div`
536
+ `,Ri=({uniqid:e,children:t})=>{const n=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual),o=(0,i.useMemo)((()=>({padding:n&&n.padding?String(n.padding):"0"})),[n]);return l().createElement(Fi,{padding:o.padding},t)},Bi=d.j.getLazyComponent("WidgetContactCardDav"),Hi=({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)),le.shallowEqual),[E,h]=(0,i.useState)([]),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(wi),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($i,{header:()=>l().createElement(l().Fragment,null,l().createElement(zi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Ri,{uniqid:o},r&&l().createElement(Bi,{contactCardList:E}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(ki,null))})},Pi=d.j.getLazyComponent("ButtonDropdown"),Ui=d.j.getLazyComponent("Tooltip"),Ni=a().div`
569
537
  margin-right: ${e=>e.theme.space.sm}px;
570
538
  button {
571
539
  background: ${e=>e.theme.color.white};
572
540
  }
573
- `,Ki=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Wi).finally(n)}}];return l().createElement(zi,{uniqid:e,dropdown:()=>t&&l().createElement(Xi,null,l().createElement(Qi,{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"})))})},Zi=d.j.getLazyComponent("WidgetCalendarCalDav"),el=({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)),le.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(Wi),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]),L=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{h(e.dav_calendar_url)})).finally((()=>x(!1)))}),[x]),_=(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(_,6e4);return()=>clearInterval(e)}),[r,_,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 L()):void _()}),[r,L,x,_,f,p]),r&&p&&p!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(p,null!=E?E:"")):l().createElement(Hi,{header:()=>l().createElement(l().Fragment,null,l().createElement(Ki,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>y(void 0,!0)})),scrollable:()=>l().createElement(Ui,{uniqid:o},r&&l().createElement(Zi,{calendarListEvent:b}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(qi,null))})},tl=d.j.getLazyComponent("ButtonDropdown"),nl=d.j.getLazyComponent("Tooltip"),il=a().div`
541
+ `,Yi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(wi).finally(n)}}];return l().createElement(Ti,{uniqid:e,dropdown:()=>t&&l().createElement(Ni,null,l().createElement(Ui,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Pi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"})))})},Ji=d.j.getLazyComponent("WidgetCalendarCalDav"),Qi=({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)),le.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(wi),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]),L=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{h(e.dav_calendar_url)})).finally((()=>x(!1)))}),[x]),_=(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(_,6e4);return()=>clearInterval(e)}),[r,_,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 L()):void _()}),[r,L,x,_,f,p]),r&&p&&p!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(p,null!=E?E:"")):l().createElement($i,{header:()=>l().createElement(l().Fragment,null,l().createElement(Yi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>y(void 0,!0)})),scrollable:()=>l().createElement(Ri,{uniqid:o},r&&l().createElement(Ji,{calendarListEvent:b}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(ki,null))})},Xi=d.j.getLazyComponent("ButtonDropdown"),Ki=d.j.getLazyComponent("Tooltip"),Zi=a().div`
574
542
  margin-right: ${e=>e.theme.space.sm}px;
575
543
  button {
576
544
  background: ${e=>e.theme.color.white};
577
545
  }
578
- `,ll=a().div`
546
+ `,el=a().div`
579
547
  font-size: ${e=>e.theme.size.sm+4}px;
580
548
  color: ${e=>e.color};
581
- `,ol=({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)),le.shallowEqual),s=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Wi).finally(n)}}];return l().createElement(zi,{uniqid:e,dropdown:()=>t&&l().createElement(il,null,l().createElement(nl,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(tl,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-edit",label:"",color:"primary",variant:"outlined"}))),subHeader:e=>t&&0!==a&&l().createElement(ll,{color:e},"(",i.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:a}),")")})},al=d.j.getLazyComponent("WidgetEmailsImap"),rl=({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)),le.shallowEqual),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Wi),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]),L=(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(),L())}),6e4);return()=>clearInterval(e)}),[r,L,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(),L()}}),[r,h,C,L,y,v,a]),r&&h&&h!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(h,null!=f?f:"")):l().createElement(Hi,{header:()=>l().createElement(l().Fragment,null,l().createElement(ol,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Ui,{uniqid:o},void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(qi,null),r&&l().createElement(al,{emailList:g}))})},sl=a().div`
549
+ `,tl=({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)),le.shallowEqual),s=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(wi).finally(n)}}];return l().createElement(Ti,{uniqid:e,dropdown:()=>t&&l().createElement(Zi,null,l().createElement(Ki,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Xi,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-edit",label:"",color:"primary",variant:"outlined"}))),subHeader:e=>t&&0!==a&&l().createElement(el,{color:e},"(",i.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:a}),")")})},nl=d.j.getLazyComponent("WidgetEmailsImap"),il=({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)),le.shallowEqual),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(wi),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]),L=(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(),L())}),6e4);return()=>clearInterval(e)}),[r,L,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(),L()}}),[r,h,C,L,y,v,a]),r&&h&&h!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(h,null!=f?f:"")):l().createElement($i,{header:()=>l().createElement(l().Fragment,null,l().createElement(tl,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Ri,{uniqid:o},void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(ki,null),r&&l().createElement(nl,{emailList:g}))})},ll=a().div`
582
550
  padding: ${e=>e.theme.space.md}px;
583
551
  border-bottom: 1px solid ${e=>e.theme.color.grey1};
584
- `,cl=({uniqid:e})=>{var t;const n=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),le.shallowEqual);return l().createElement(l().Fragment,null,n&&"string"==typeof n.title&&0!==n.title.length&&l().createElement(sl,null,l().createElement(s.JRCHtml,{__html:null!==(t=n.title)&&void 0!==t?t:""})))},dl=({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}),le.shallowEqual),{control:a,watch:d}=(0,T.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"})},ul=d.j.getLazyComponent("Button"),ml=d.j.getLazyComponent("ModalLayout"),gl=d.j.getLazyComponent("ModalContent"),pl=a().div`
552
+ `,ol=({uniqid:e})=>{var t;const n=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),le.shallowEqual);return l().createElement(l().Fragment,null,n&&"string"==typeof n.title&&0!==n.title.length&&l().createElement(ll,null,l().createElement(s.JRCHtml,{__html:null!==(t=n.title)&&void 0!==t?t:""})))},al=({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}),le.shallowEqual),{control:a,watch:d}=(0,T.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"})},rl=d.j.getLazyComponent("Button"),sl=d.j.getLazyComponent("ModalLayout"),cl=d.j.getLazyComponent("ModalContent"),dl=a().div`
585
553
  padding: ${e=>e.theme.space.md}px;
586
554
  display: flex;
587
555
  flex-direction: row-reverse;
588
- `,fl=a().div`
556
+ `,ul=a().div`
589
557
  flex: 1;
590
558
  display: flex;
591
559
  flex-direction: row;
592
560
  gap: ${e=>e.theme.space.sm}px;
593
561
  padding: ${e=>e.theme.space.sm}px;
594
562
  border-bottom: 1px solid ${e=>e.theme.color.grey1};
595
- `,El=a().div`
563
+ `,ml=a().div`
596
564
  flex: 1;
597
565
  display: flex;
598
566
  fieldset:first-of-type {
599
567
  margin: 0px !important;
600
568
  }
601
- `,hl=a().div`
569
+ `,gl=a().div`
602
570
  display: flex;
603
571
  gap: ${e=>e.theme.space.sm}px;
604
- `,bl=({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(fl,null,l().createElement(El,null,l().createElement(dl,{uniqid:e})),l().createElement(hl,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(ml,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(gl,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(pl,null,l().createElement(ul,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:p}))))},vl=a().div`
572
+ `,pl=({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(ul,null,l().createElement(ml,null,l().createElement(al,{uniqid:e})),l().createElement(gl,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(sl,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(cl,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(dl,null,l().createElement(rl,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:p}))))},fl=a().div`
605
573
  display: flex;
606
574
  flex: 1;
607
575
  flex-direction: column;
608
- `,yl=({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(Vt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleGalleryType)(e)?l().createElement(Pt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleAttachmentType)(e)?l().createElement(zt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleImageType)(e)?l().createElement(Zt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleSliderType)(e)?l().createElement(rn,{widget:e,inplace:n,mode:i,width:null!=t?t:800}):(0,w.ensureWidgetArticleTitleType)(e)?l().createElement(Cn,{widget:e,inplace:n,mode:i,dataCy:s}):(0,w.ensureWidgetArticleTextType)(e)?l().createElement(En,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(vl,null,l().createElement(cl,{uniqid:e.uniqid}),l().createElement(ti,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetDatasourceTableType)(e)?l().createElement(vl,null,l().createElement(cl,{uniqid:e.uniqid}),l().createElement(Yn,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?l().createElement(vl,null,"edit"===i?l().createElement(bl,{name:e.name,uniqid:e.uniqid}):l().createElement(cl,{uniqid:e.uniqid}),l().createElement(Vn,{widget:e,inplace:n,mode:i,onWidgetUpdate:o})):(0,w.ensureWidgetPresenceType)(e)?l().createElement(vl,null,"edit"===i?l().createElement(bl,{name:e.name,uniqid:e.uniqid}):l().createElement(cl,{uniqid:e.uniqid}),l().createElement(di,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetQuickSurveyType)(e)?l().createElement(vl,null,"edit"===i?l().createElement(bl,{name:e.name,uniqid:e.uniqid}):l().createElement(cl,{uniqid:e.uniqid}),l().createElement(fi,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetCalendarCalDavType)(e)?l().createElement(vl,null,l().createElement(el,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetContactCardDavType)(e)?l().createElement(vl,null,l().createElement(Yi,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetEmailsImapType)(e)?l().createElement(vl,null,l().createElement(rl,{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,")")},Cl=a().div`
576
+ `,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($t,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleGalleryType)(e)?l().createElement(Pt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleAttachmentType)(e)?l().createElement(zt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleImageType)(e)?l().createElement(Zt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleSliderType)(e)?l().createElement(rn,{widget:e,inplace:n,mode:i,width:null!=t?t:800}):(0,w.ensureWidgetArticleTitleType)(e)?l().createElement(Cn,{widget:e,inplace:n,mode:i,dataCy:s}):(0,w.ensureWidgetArticleTextType)(e)?l().createElement(En,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(fl,null,l().createElement(ol,{uniqid:e.uniqid}),l().createElement(Xn,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetDatasourceTableType)(e)?l().createElement(fl,null,l().createElement(ol,{uniqid:e.uniqid}),l().createElement(Un,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?l().createElement(fl,null,"edit"===i?l().createElement(pl,{name:e.name,uniqid:e.uniqid}):l().createElement(ol,{uniqid:e.uniqid}),l().createElement($n,{widget:e,inplace:n,mode:i,onWidgetUpdate:o})):(0,w.ensureWidgetPresenceType)(e)?l().createElement(fl,null,"edit"===i?l().createElement(pl,{name:e.name,uniqid:e.uniqid}):l().createElement(ol,{uniqid:e.uniqid}),l().createElement(ai,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetQuickSurveyType)(e)?l().createElement(fl,null,"edit"===i?l().createElement(pl,{name:e.name,uniqid:e.uniqid}):l().createElement(ol,{uniqid:e.uniqid}),l().createElement(ui,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetCalendarCalDavType)(e)?l().createElement(fl,null,l().createElement(Qi,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetContactCardDavType)(e)?l().createElement(fl,null,l().createElement(Hi,{widget:e,inplace:n,mode:i,levelFallback:r})):(0,w.ensureWidgetEmailsImapType)(e)?l().createElement(fl,null,l().createElement(il,{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,")")},hl=a().div`
609
577
  position: absolute;
610
578
  inset: 0;
611
579
  opacity: ${e=>e.opacity};
612
580
  background-color: ${e=>e.backgroundColor};
613
581
  pointer-events: ${e=>e.pointerEvents};
614
- `,xl=d.j.getLazyComponent("DoubleClick"),wl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.ids[e].widget.layers),le.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(kl,{uniqid:e,key:t,mode:"edit"}))))},kl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(Cl,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(Ll,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(Cl,{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(Ll,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Ll=({uniqid:e,layerId:t,mode:n})=>{const i=(0,u.jL)(),o=(0,u.GV)((t=>t.widgets.ids[e]),le.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(_l,{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(xl,{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)},_l=({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)},Wl=d.j.getLazyComponent("Loader"),ql=({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(Wl,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}))},Sl=a().button`
582
+ `,bl=d.j.getLazyComponent("DoubleClick"),vl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.ids[e].widget.layers),le.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(yl,{uniqid:e,key:t,mode:"edit"}))))},yl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(hl,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(Cl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(hl,{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(Cl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Cl=({uniqid:e,layerId:t,mode:n})=>{const i=(0,u.jL)(),o=(0,u.GV)((t=>t.widgets.ids[e]),le.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(Al,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(xl,{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(bl,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(Al,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},xl=({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)},wl=d.j.getLazyComponent("Loader"),kl=({uniqid:e,inplace:t})=>{const n=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)));return(null==n?void 0:n.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(wl,null)):(null==n?void 0:n.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):(null==n||n.initialized,l().createElement(l().Fragment,null))},Ll=a().button`
615
583
  position: absolute;
616
584
  inset: 0;
617
585
  display: flex;
@@ -629,7 +597,16 @@
629
597
  }
630
598
 
631
599
  ${(0,s.DashedFocusBorder)()}
632
- `,jl=({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(Sl,{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)},Ml=d.j.getLazyComponent("WidgetIcon"),Tl=a().a`
600
+ `,_l=({uniqid:e,name:t})=>{const n=(0,u.jL)(),o=(0,r.useIntl)(),a=(0,i.useCallback)((()=>{n(c.cr.slice.actions.flushAllEditor()),n(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))}),[n,e,t]),d=c.x0.definition(t);return l().createElement(Ll,{onClick:a},l().createElement(s.JRCHtml,{__html:`${o.formatMessage({id:"WIDGET_Set_Widget"})} <b>${o.formatMessage({id:d.label})}</b>`}))},Wl=a().div`
601
+ display: flex;
602
+ flex-direction: column;
603
+ background-color: ${e=>e.backgroundColor};
604
+ border-style: ${e=>e.borderStyle};
605
+ border-color: ${e=>e.borderColor};
606
+ border-width: ${e=>e.borderWidth}px;
607
+ border-radius: ${e=>e.borderRadius}px;
608
+ overflow: ${e=>e.overflow};
609
+ `,ql=({uniqid:e,onClick:t,children:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.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(Wl,{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)},Sl=d.j.getLazyComponent("WidgetIcon"),jl=a().a`
633
610
  position: absolute;
634
611
  top: 0;
635
612
  right: 0;
@@ -645,26 +622,17 @@
645
622
  background-color: rgba(0, 0, 0, 0.1);
646
623
  color: ${e=>e.color?e.color:e.theme.color.black};
647
624
  }
648
- `,Il=({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),le.shallowEqual),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual);return l().createElement(Tl,{href:n,target:"_blank",color:null!==(o=String(s.color))&&void 0!==o?o:void 0,rel:"noreferrer","aria-label":a.label},l().createElement(Ml,{count:r,img:a.img,label:a.label,maxValue:999}))},Al=a().div`
649
- display: flex;
650
- flex-direction: column;
651
- background-color: ${e=>e.backgroundColor};
652
- border-style: ${e=>e.borderStyle};
653
- border-color: ${e=>e.borderColor};
654
- border-width: ${e=>e.borderWidth}px;
655
- border-radius: ${e=>e.borderRadius}px;
656
- overflow: ${e=>e.overflow};
657
- `,Ol=({uniqid:e,onClick:t,children:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.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(Al,{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)},zl=({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]),le.shallowEqual),E=(0,u.GV)((e=>e.widgets.currentEditableWidgetId),le.shallowEqual),h=(0,u.GV)((t=>t.widgets.currentEditableWidgetId===e),le.shallowEqual),{isComponentVisible:b,setIsComponentVisible:v}=(0,qt.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(Ol,{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(yl,{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(Il,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(wl,{uniqid:e,mode:a}),"edit"===a&&l().createElement(jl,{uniqid:e,name:n.widget.name}),l().createElement(ql,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o})):l().createElement(Ol,{uniqid:e,onClick:y},l().createElement(yl,{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(Il,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(wl,{uniqid:e,mode:a}),l().createElement(ql,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o}))},Gl=zl,$l=a().div`
625
+ `,Ml=({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),le.shallowEqual),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual);return l().createElement(jl,{href:n,target:"_blank",color:null!==(o=String(s.color))&&void 0!==o?o:void 0,rel:"noreferrer","aria-label":a.label},l().createElement(Sl,{count:r,img:a.img,label:a.label,maxValue:999}))},Tl=({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]),le.shallowEqual),E=(0,u.GV)((e=>e.widgets.currentEditableWidgetId),le.shallowEqual),h=(0,u.GV)((t=>t.widgets.currentEditableWidgetId===e),le.shallowEqual),{isComponentVisible:b,setIsComponentVisible:v}=(0,qt.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(ql,{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(Ml,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(vl,{uniqid:e,mode:a}),l().createElement(kl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o})):l().createElement(ql,{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(Ml,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(vl,{uniqid:e,mode:a}),"edit"===a&&l().createElement(_l,{uniqid:e,name:n.widget.name}),l().createElement(kl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o}))},Al=Tl,Il=a().div`
658
626
  border-radius: ${e=>e.theme.space.sm}px;
659
627
  border: 1px solid ${e=>e.theme.color.grey1};
660
628
  background-color: ${e=>e.theme.color.white};
661
629
  overflow: hidden;
662
- `,Dl=d.j.getLazyComponent("Message"),Vl=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement($l,{key:e.widget.uniqid},l().createElement(Gl,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(Dl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},Fl=d.j.getLazyComponent("Message"),Rl=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,le.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!d.includes(e.widget.uniqid))).map((e=>e&&l().createElement($l,{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(Fl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var Bl=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 Hl=d.j.getLazyComponent("JRCCommentsBloc"),Pl=a().div`
630
+ `,Ol=d.j.getLazyComponent("Message"),zl=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(Il,{key:e.widget.uniqid},l().createElement(Al,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(Ol,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},Gl=d.j.getLazyComponent("Message"),Dl=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,le.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!d.includes(e.widget.uniqid))).map((e=>e&&l().createElement(Il,{key:e.widget.uniqid},l().createElement(Al,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(Gl,{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 $l=d.j.getLazyComponent("JRCCommentsBloc"),Fl=a().div`
663
631
  display: flex;
664
632
  flex-direction: column;
665
633
  gap: 4px;
666
634
  flex: 1;
667
635
  width: 100%;
668
636
  margin-top: 10px;
669
- `,Ul=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s,articleUri:d})=>{var m;const g=(0,r.useIntl)(),p=(0,o.useTheme)(),f=(0,u.jL)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,w]=(0,i.useState)(!1),L=(0,u.GV)(c.xJ.selectors.get),_=(0,u.GV)(c.x0.selectors.selectWidgets),W=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),q=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),S=(0,u.GV)(c.Kx.selectors.selectAll),j=(0,u.GV)(c.OD.selectors.selectPlatformConfig),M=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),T=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),I=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),A=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),O=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,G]=(0,i.useState)(s),[$,D]=(0,i.useState)(null),{open:V,onInsert:F,close:R,ext:B,isActive:H}=cn();(0,ee.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>te.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])})(T.map((e=>e.id)),e);const P=(0,i.useCallback)((e=>{f(c.y8.actions.error({label:null!=e?e:g.formatMessage({id:"GLOBAL_Error"})}))}),[f,g]),U=()=>{f(c.Mw.actions.fetchComments({idArticle:e})),N()},N=(0,i.useCallback)((()=>{E||x||(w(!0),k().network.token().then((e=>{h(e.result),w(!1),f(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{P(e.errorMsg)})))}),[P,E,x,f]),Y=(0,i.useCallback)((t=>Bl(void 0,void 0,void 0,(function*(){if(E){v(!0);const n=Object.keys(_).map((e=>(null==y?void 0:y.some((t=>t.widget.uniqid===e)))?_[e]:null)).filter((e=>null!==e));try{yield k().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:E,idArticle:e,type:a})).then((()=>{C([])})),N()}catch(e){P(e.errorMsg)}finally{v(!1)}}}))),[e,a,N,P,E,_,y]);return(0,i.useEffect)((()=>{N()}),[N]),(0,i.useEffect)((()=>{f(c.Mw.actions.fetchComments({idArticle:e}))}),[e,f]),(0,i.useEffect)((()=>{T&&T.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{f(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),f(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[T,f]),l().createElement(l().Fragment,null,W&&q&&l().createElement(l().Fragment,null,l().createElement(Pl,null,l().createElement(Hl,{canComment:n,loading:b,token:E,comments:T,onComment:Y,onCommentUpdate:t=>Bl(void 0,void 0,void 0,(function*(){var n,i;const l=T.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((()=>{f(c.Mw.actions.fetchComments({idArticle:e})),N()})).catch((e=>{P(e.errorMsg)}))})),onCommentDelete:t=>Bl(void 0,void 0,void 0,(function*(){f(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!!((null==O?void 0:O.isActive)&&(null==O?void 0:O.create)&&(null===(m=null==O?void 0:O.autorize)||void 0===m?void 0:m.includes("comment"))),widgetListComponent:l().createElement(Lt,{mode:"comment",namespace:"comment",onChange:e=>{C([e]),f(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),h(void 0),N()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(Vl,{widgets:y}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(Rl,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:U,handleWidgetRemove:N}),currentUser:L,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},W),{toolbar:q.commentsToolbar}),mentionsQueries:(0,sn.X)(S,p,P)},onError:P,highlightFields:j.userHighlightFields,userAccountStatus:j.userAccountStatus,userModel:S.find((e=>"user"===e.type)),isWedocActive:!!M,onGetHashError:e=>f(c.y8.actions.error({label:null!=e?e:g.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...A&&I?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==I?void 0:I.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=>{G(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{G(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[B],onReport:t=>D({articleId:e,commentUri:t,articleUri:d})}),l().createElement(mt,null))),H&&l().createElement(gn,{onInsert:F,open:V,close:R}),$&&l().createElement(Z,Object.assign({onClose:()=>D(null)},$)))},Nl=()=>l().createElement(l().Fragment,null);var Yl=n(286);const Jl=()=>{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}},Ql=d.j.getLazyComponent("InputTinyMCE"),Xl=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}=Jl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=cn(),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,sn.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Yl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Ql,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(gn,{onInsert:f,open:p,close:E}))},Kl=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}=Jl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=cn(),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,sn.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Yl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Kl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(gn,{onInsert:f,open:p,close:E}))},eo=d.j.getLazyComponent("InputAudience"),to=d.j.getLazyComponent("Message"),no=d.j.getLazyComponent("Modal"),io=({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(no,{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(to,{variant:"warning",message:null!=o?o:d.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(eo,{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 lo=n(737);const oo=d.j.getLazyComponent("Container"),ao=d.j.getLazyComponent("AppColumn"),ro=d.j.getLazyComponent("MainColumn");function so({extensionRoute:e,routes:t,description:n,mode:o="center"}){var a;const s=(0,r.useIntl)(),{pathname:c}=(0,lo.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,lo.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(oo,{mode:o},l().createElement(ao,{mode:o,description:n,tabs:g,activeTab:u||""}),l().createElement(ro,{mode:o,flex:!0},l().createElement(lo.Outlet,null))))}}}]);
670
- //# sourceMappingURL=593.56c6fcd2db8c13313d75.chunk.js.map
637
+ `,Rl=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s,articleUri:d})=>{var m;const g=(0,r.useIntl)(),p=(0,o.useTheme)(),f=(0,u.jL)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,w]=(0,i.useState)(!1),L=(0,u.GV)(c.xJ.selectors.get),_=(0,u.GV)(c.x0.selectors.selectWidgets),W=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),q=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),S=(0,u.GV)(c.Kx.selectors.selectAll),j=(0,u.GV)(c.OD.selectors.selectPlatformConfig),M=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),T=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),A=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),I=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),O=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,G]=(0,i.useState)(s),[D,V]=(0,i.useState)(null),{open:$,onInsert:F,close:R,ext:B,isActive:H}=cn();(0,ee.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>te.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])})(T.map((e=>e.id)),e);const P=(0,i.useCallback)((e=>{f(c.y8.actions.error({label:null!=e?e:g.formatMessage({id:"GLOBAL_Error"})}))}),[f,g]),U=()=>{f(c.Mw.actions.fetchComments({idArticle:e})),N()},N=(0,i.useCallback)((()=>{E||x||(w(!0),k().network.token().then((e=>{h(e.result),w(!1),f(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{P(e.errorMsg)})))}),[P,E,x,f]),Y=(0,i.useCallback)((t=>Vl(void 0,void 0,void 0,(function*(){if(E){v(!0);const n=Object.keys(_).map((e=>(null==y?void 0:y.some((t=>t.widget.uniqid===e)))?_[e]:null)).filter((e=>null!==e));try{yield k().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:E,idArticle:e,type:a})).then((()=>{C([])})),N()}catch(e){P(e.errorMsg)}finally{v(!1)}}}))),[e,a,N,P,E,_,y]);return(0,i.useEffect)((()=>{N()}),[N]),(0,i.useEffect)((()=>{f(c.Mw.actions.fetchComments({idArticle:e}))}),[e,f]),(0,i.useEffect)((()=>{T&&T.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{f(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),f(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[T,f]),l().createElement(l().Fragment,null,W&&q&&l().createElement(l().Fragment,null,l().createElement(Fl,null,l().createElement($l,{canComment:n,loading:b,token:E,comments:T,onComment:Y,onCommentUpdate:t=>Vl(void 0,void 0,void 0,(function*(){var n,i;const l=T.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((()=>{f(c.Mw.actions.fetchComments({idArticle:e})),N()})).catch((e=>{P(e.errorMsg)}))})),onCommentDelete:t=>Vl(void 0,void 0,void 0,(function*(){f(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!!((null==O?void 0:O.isActive)&&(null==O?void 0:O.create)&&(null===(m=null==O?void 0:O.autorize)||void 0===m?void 0:m.includes("comment"))),widgetListComponent:l().createElement(Lt,{mode:"comment",namespace:"comment",onChange:e=>{C([e]),f(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),h(void 0),N()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(zl,{widgets:y}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(Dl,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:U,handleWidgetRemove:N}),currentUser:L,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},W),{toolbar:q.commentsToolbar}),mentionsQueries:(0,sn.X)(S,p,P)},onError:P,highlightFields:j.userHighlightFields,userAccountStatus:j.userAccountStatus,userModel:S.find((e=>"user"===e.type)),isWedocActive:!!M,onGetHashError:e=>f(c.y8.actions.error({label:null!=e?e:g.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...I&&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=>{G(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{G(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[B],onReport:t=>V({articleId:e,commentUri:t,articleUri:d})}),l().createElement(mt,null))),H&&l().createElement(gn,{onInsert:F,open:$,close:R}),D&&l().createElement(Z,Object.assign({onClose:()=>V(null)},D)))},Bl=()=>l().createElement(l().Fragment,null);var Hl=n(286);const Pl=()=>{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}},Ul=d.j.getLazyComponent("InputTinyMCE"),Nl=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}=Pl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=cn(),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,sn.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Hl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Ul,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(gn,{onInsert:f,open:p,close:E}))},Yl=d.j.getLazyComponent("InputTinyMCERaw"),Jl=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}=Pl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=cn(),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,sn.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Hl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Yl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(gn,{onInsert:f,open:p,close:E}))},Ql=d.j.getLazyComponent("InputAudience"),Xl=d.j.getLazyComponent("Message"),Kl=d.j.getLazyComponent("Modal"),Zl=({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(Kl,{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(Xl,{variant:"warning",message:null!=o?o:d.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(Ql,{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 eo=n(737);const to=d.j.getLazyComponent("Container"),no=d.j.getLazyComponent("AppColumn"),io=d.j.getLazyComponent("MainColumn");function lo({extensionRoute:e,routes:t,description:n,mode:o="center"}){var a;const s=(0,r.useIntl)(),{pathname:c}=(0,eo.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,eo.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(to,{mode:o},l().createElement(no,{mode:o,description:n,tabs:g,activeTab:u||""}),l().createElement(io,{mode:o,flex:!0},l().createElement(eo.Outlet,null))))}}}]);
638
+ //# sourceMappingURL=593.79631f6e71918390b161.chunk.js.map