jamespot-react-core 1.2.34 → 1.2.36

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