@strapi/admin 4.11.0-alpha.0 → 4.11.0-beta.0

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 (147) hide show
  1. package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
  2. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +1 -2
  3. package/admin/src/content-manager/components/DynamicZone/index.js +1 -1
  4. package/admin/src/content-manager/components/FieldComponent/index.js +1 -1
  5. package/admin/src/content-manager/components/Inputs/index.js +1 -1
  6. package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +67 -71
  7. package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +3 -5
  8. package/admin/src/content-manager/pages/App/useContentManagerInitData.js +2 -3
  9. package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +2 -5
  10. package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +1 -1
  11. package/admin/src/content-manager/pages/EditView/Header/index.js +1 -1
  12. package/admin/src/content-manager/pages/EditViewLayoutManager/Permissions.js +1 -1
  13. package/admin/src/content-manager/pages/ListView/index.js +1 -2
  14. package/admin/src/hooks/index.js +1 -1
  15. package/admin/src/hooks/marketplace/constants.js +1 -0
  16. package/admin/src/hooks/{useFetchMarketplacePlugins → marketplace/useFetchMarketplacePlugins}/index.js +21 -1
  17. package/admin/src/hooks/{useFetchMarketplaceProviders → marketplace/useFetchMarketplaceProviders}/index.js +21 -1
  18. package/admin/src/hooks/useAdminUsers/__mocks__/index.js +5 -0
  19. package/admin/src/hooks/useAdminUsers/index.js +1 -0
  20. package/admin/src/hooks/useAdminUsers/useAdminUsers.js +38 -0
  21. package/admin/src/hooks/useContentTypes/__mocks__/index.js +6 -0
  22. package/admin/src/hooks/useContentTypes/index.js +1 -0
  23. package/admin/src/hooks/useContentTypes/useContentTypes.js +47 -0
  24. package/admin/src/hooks/useReleaseNotification/utils/api.js +6 -5
  25. package/admin/src/pages/Admin/Onboarding/index.js +89 -91
  26. package/admin/src/pages/App/index.js +1 -5
  27. package/admin/src/pages/AuthPage/components/Register/index.js +3 -4
  28. package/admin/src/pages/AuthPage/index.js +11 -26
  29. package/admin/src/pages/HomePage/index.js +3 -2
  30. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/InstallPluginButton.js +12 -8
  31. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +39 -41
  32. package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +2 -2
  33. package/admin/src/pages/SettingsPage/components/Tokens/TokenBox/index.js +28 -26
  34. package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +1 -1
  35. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +3 -2
  36. package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
  37. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +1 -1
  38. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +36 -26
  39. package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +1 -8
  40. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +6 -7
  41. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +54 -63
  42. package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper.js +11 -9
  43. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +12 -1
  44. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +2 -2
  45. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +120 -205
  46. package/admin/src/pages/UseCasePage/index.js +13 -15
  47. package/admin/src/translations/en.json +11 -9
  48. package/build/1387.a86ac314.chunk.js +1 -0
  49. package/build/{1657.45231968.chunk.js → 1657.ca8562dd.chunk.js} +17 -17
  50. package/build/3081.c2cdfac8.chunk.js +108 -0
  51. package/build/{3562.57745ccd.chunk.js → 3562.e0b1a0b3.chunk.js} +6 -6
  52. package/build/3816.60f858cf.chunk.js +211 -0
  53. package/build/462.a073ff1f.chunk.js +71 -0
  54. package/build/{4628.20631dd1.chunk.js → 4628.9cbb6df5.chunk.js} +1 -1
  55. package/build/5542.002522eb.chunk.js +71 -0
  56. package/build/5563.79950369.chunk.js +79 -0
  57. package/build/617.87b2fe96.chunk.js +155 -0
  58. package/build/6970.7ea35fbd.chunk.js +1 -0
  59. package/build/7259.5cc67413.chunk.js +1 -0
  60. package/build/Admin-authenticatedApp.65172a0c.chunk.js +79 -0
  61. package/build/Admin_homePage.107a9fe0.chunk.js +73 -0
  62. package/build/Admin_marketplace.717bd7ca.chunk.js +55 -0
  63. package/build/Admin_pluginsPage.7df6b5a9.chunk.js +6 -0
  64. package/build/{Admin_profilePage.1b337b73.chunk.js → Admin_profilePage.a8fa3a56.chunk.js} +1 -1
  65. package/build/Admin_settingsPage.bd715ed3.chunk.js +79 -0
  66. package/build/{Upload_ConfigureTheView.d429a7fc.chunk.js → Upload_ConfigureTheView.aa64ed9a.chunk.js} +1 -1
  67. package/build/admin-app.9c79b484.chunk.js +63 -0
  68. package/build/{admin-edit-roles-page.d0c9497b.chunk.js → admin-edit-roles-page.0d12b741.chunk.js} +43 -41
  69. package/build/admin-edit-users.f9ce7844.chunk.js +10 -0
  70. package/build/admin-roles-list.e8bf9685.chunk.js +31 -0
  71. package/build/admin-users.751b28b2.chunk.js +34 -0
  72. package/build/audit-logs-settings-page.3c6cea81.chunk.js +129 -0
  73. package/build/{content-manager.cf467ecc.chunk.js → content-manager.bf060d8e.chunk.js} +95 -95
  74. package/build/content-type-builder-list-view.1e821eb9.chunk.js +215 -0
  75. package/build/content-type-builder-translation-en-json.af293c9e.chunk.js +1 -0
  76. package/build/content-type-builder.b10576e7.chunk.js +126 -0
  77. package/build/email-settings-page.dba83275.chunk.js +11 -0
  78. package/build/en-json.19e9ff9b.chunk.js +1 -0
  79. package/build/i18n-settings-page.55628f74.chunk.js +114 -0
  80. package/build/index.html +1 -1
  81. package/build/main.576a9d22.js +2630 -0
  82. package/build/review-workflows-settings.4b39b837.chunk.js +61 -0
  83. package/build/{runtime~main.1074f2bb.js → runtime~main.96d92f16.js} +2 -2
  84. package/build/{sso-settings-page.f44d95d8.chunk.js → sso-settings-page.265e3d72.chunk.js} +1 -1
  85. package/build/upload-settings.63d99bf5.chunk.js +14 -0
  86. package/build/upload.c50d8c7a.chunk.js +34 -0
  87. package/build/users-advanced-settings-page.4f49ca57.chunk.js +9 -0
  88. package/build/users-email-settings-page.d2429d0a.chunk.js +24 -0
  89. package/build/users-providers-settings-page.50c5ba27.chunk.js +29 -0
  90. package/build/{users-roles-settings-page.eeb3a339.chunk.js → users-roles-settings-page.2549794b.chunk.js} +2 -2
  91. package/build/webhook-edit-page.ddd5963d.chunk.js +128 -0
  92. package/build/webhook-list-page.e2fca9f8.chunk.js +71 -0
  93. package/ee/LICENSE +1 -21
  94. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -2
  95. package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
  96. package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +1 -1
  97. package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
  98. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +36 -28
  99. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +1 -1
  100. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +3 -3
  101. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +32 -21
  102. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +1 -1
  103. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +1 -1
  104. package/ee/server/services/audit-logs.js +5 -1
  105. package/package.json +14 -17
  106. package/webpack.alias.js +0 -2
  107. package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +0 -18
  108. package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +0 -18
  109. package/admin/src/hooks/useModels/index.js +0 -58
  110. package/admin/src/hooks/useModels/reducer.js +0 -45
  111. package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +0 -20
  112. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/utils/formatValue.js +0 -13
  113. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/reducer.js +0 -72
  114. package/build/1387.84b454d3.chunk.js +0 -1
  115. package/build/3081.bcf9a12f.chunk.js +0 -108
  116. package/build/462.8fff7f3b.chunk.js +0 -71
  117. package/build/5542.b8240e3f.chunk.js +0 -70
  118. package/build/5563.986609ed.chunk.js +0 -79
  119. package/build/6404.68405699.chunk.js +0 -100
  120. package/build/6970.5159b068.chunk.js +0 -1
  121. package/build/7259.7a48aa2f.chunk.js +0 -1
  122. package/build/7725.1633e06f.chunk.js +0 -213
  123. package/build/Admin-authenticatedApp.27a2329f.chunk.js +0 -79
  124. package/build/Admin_homePage.9f7c0bb1.chunk.js +0 -73
  125. package/build/Admin_marketplace.5f7b89e5.chunk.js +0 -55
  126. package/build/Admin_pluginsPage.9e6fa51c.chunk.js +0 -6
  127. package/build/Admin_settingsPage.9d0419bc.chunk.js +0 -79
  128. package/build/admin-app.8e1f56bc.chunk.js +0 -63
  129. package/build/admin-edit-users.2aae89f5.chunk.js +0 -10
  130. package/build/admin-roles-list.c759daa3.chunk.js +0 -31
  131. package/build/admin-users.04a823ca.chunk.js +0 -34
  132. package/build/audit-logs-settings-page.45cb4fb5.chunk.js +0 -76
  133. package/build/content-type-builder-list-view.5ff685ec.chunk.js +0 -214
  134. package/build/content-type-builder-translation-en-json.5e5f8607.chunk.js +0 -1
  135. package/build/content-type-builder.4737a30c.chunk.js +0 -126
  136. package/build/email-settings-page.dc07d518.chunk.js +0 -10
  137. package/build/en-json.7edb00f6.chunk.js +0 -1
  138. package/build/i18n-settings-page.8219dd99.chunk.js +0 -60
  139. package/build/main.14dca275.js +0 -2592
  140. package/build/review-workflows-settings.6a662ebd.chunk.js +0 -61
  141. package/build/upload-settings.dd2d987c.chunk.js +0 -13
  142. package/build/upload.c8479232.chunk.js +0 -33
  143. package/build/users-advanced-settings-page.c36cfd59.chunk.js +0 -8
  144. package/build/users-email-settings-page.2716ce8e.chunk.js +0 -23
  145. package/build/users-providers-settings-page.0d6304a5.chunk.js +0 -28
  146. package/build/webhook-edit-page.f4db86f3.chunk.js +0 -75
  147. package/build/webhook-list-page.30d73114.chunk.js +0 -71
@@ -1,8 +1,8 @@
1
- (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{42814:function(pt,Pe){"use strict";Pe.Z=()=>null},65765:function(pt,Pe,d){"use strict";d.r(Pe),d.d(Pe,{App:function(){return Us},default:function(){return mm}});var e=d(32735),Me=d(74758),te=d(53038),y=d(24989),Te=d(27649),he=d(82055),Ae=d(96709),V=d(67879),it=d(98978),Le=d.n(it),Oe=d(83983),ve=d(47510),$e=d(55433),Ze=(0,e.createContext)(),_e=d(47533),ye=d(60216),n=d.n(ye),Be=(0,e.createContext)(),jt=d(73386),pe=d(56327),h=d(51375),J=d(15062),je=d(46339),et=d(4460);const Dt=()=>({type:et.c}),kt=(t,o)=>({type:et.O,layout:t,query:o});var ft=d(70031),lt=d(8266),xe=d.n(lt),We=d(17e3),ke=d(15335),ge=d(5803),F=d(87933),A=d(72850),Ve=d(68625),Ke=d(2669),tt=d(66694),Pt=()=>(0,e.useContext)(tt.ux),Wt=t=>{const{getAdminInjectedComponents:o}=Pt(),[r,s,a]=t.split(".");return o(r,s,a)};const zo=({area:t,...o})=>Wt(t).map(s=>e.createElement(s.Component,{key:s.name,...o}));zo.propTypes={area:n().string.isRequired};var zt=zo,Vs=d(33795),x=d.n(Vs),ht=d(3685);function Hs(t,o){return r=>{const s=o(r.name);return e.createElement(t,{...r,...s})}}var Qs=Hs;function Gs(t){const{addComponentToDynamicZone:o,createActionAllowedFields:r,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentField:i,removeComponentFromDynamicZone:c,readActionAllowedFields:g,updateActionAllowedFields:u}=(0,y.Wq)(),p=(0,e.useMemo)(()=>x()(l,[t],[]).map(b=>({componentUid:b.__component,id:b.id??b.__temp_key__})),[l,t]),f=(0,e.useMemo)(()=>(s?r:u).includes(t),[t,s,r,u]),m=(0,e.useMemo)(()=>(s?[]:g).includes(t),[t,s,g]);return{addComponentToDynamicZone:o,formErrors:a,isCreatingEntry:s,isFieldAllowed:f,isFieldReadable:m,moveComponentField:i,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:p}}var Ks=Gs,j=d(8471),wt=d(51968),be=d(50563),un=d(83828),mn=d(61762),pn=d(89966),Ye=d(4038),nt=d(47081),Ys=d(61868),Xs=d.n(Ys);function Js(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var _s=Js,ea=d(88708),xt=d.n(ea);function ta({isFromDynamicZone:t,name:o}){const{addNonRepeatableComponentToField:r,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:c,updateActionAllowedFields:g,formErrors:u}=(0,y.Wq)(),{contentType:p}=(0,pe.PL)(),f=(0,e.useMemo)(()=>{const T=x()(p,["attributes"],{});return Object.keys(T).filter(D=>x()(T,[D,"type"],"")==="dynamiczone")},[p]),m=(0,e.useMemo)(()=>a?s:g,[a,s,g]),b=x()(l,o,null),E=(0,e.useMemo)(()=>(0,h.Ts)(o),[o]),v=(0,e.useMemo)(()=>t&&a||m.filter(D=>D===E[0]).length>0?!0:m.map(D=>D.split(".")).filter(D=>D.length<E.length?!1:xt()(D,E.length).join(".")===E.join(".")).length>0,[t,a,m,E]),k=(0,e.useMemo)(()=>t||f.includes(E[0])?!0:(a?[]:c).map(D=>D.split(".")).filter(D=>D.length<E.length?!1:xt()(D,E.length).join(".")===E.join(".")).length>0,[t,f,E,a,c]),R=(0,e.useMemo)(()=>a||v?!1:k,[v,k,a]);return{addNonRepeatableComponentToField:r,formErrors:u,hasChildrenAllowedFields:v,hasChildrenReadableFields:k,isCreatingEntry:a,isReadOnly:R,removeComponentFromField:i,componentValue:b}}var na=ta,Q=d(49372);const oa=(0,j.ZP)(A.x)`
1
+ (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{42814:function(pt,Oe){"use strict";Oe.Z=()=>null},65765:function(pt,Oe,d){"use strict";d.r(Oe),d.d(Oe,{App:function(){return Ws},default:function(){return dm}});var e=d(32735),Te=d(74758),te=d(53038),y=d(24989),De=d(27649),he=d(82055),Ae=d(96709),V=d(67879),it=d(98978),Le=d.n(it),we=d(83983),ve=d(47510),$e=d(55433),Ze=(0,e.createContext)(),_e=d(47533),ye=d(60216),n=d.n(ye),Be=(0,e.createContext)(),Nt=d(73386),pe=d(56327),h=d(51375),J=d(15062),je=d(46339),et=d(4460);const Dt=()=>({type:et.c}),kt=(t,o)=>({type:et.O,layout:t,query:o});var ft=d(70031),lt=d(89793),Ce=d.n(lt),We=d(17e3),Ie=d(15335),ge=d(5803),F=d(87933),A=d(72850),Ve=d(68625),Ke=d(2669),tt=d(66694),Pt=()=>(0,e.useContext)(tt.ux),jt=t=>{const{getAdminInjectedComponents:o}=Pt(),[r,s,a]=t.split(".");return o(r,s,a)};const Wo=({area:t,...o})=>jt(t).map(s=>e.createElement(s.Component,{key:s.name,...o}));Wo.propTypes={area:n().string.isRequired};var Wt=Wo,zs=d(33795),x=d.n(zs),ht=d(3685);function Us(t,o){return r=>{const s=o(r.name);return e.createElement(t,{...r,...s})}}var Vs=Us;function Hs(t){const{addComponentToDynamicZone:o,createActionAllowedFields:r,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentField:i,removeComponentFromDynamicZone:c,readActionAllowedFields:g,updateActionAllowedFields:u}=(0,y.Wq)(),p=(0,e.useMemo)(()=>x()(l,[t],[]).map(b=>({componentUid:b.__component,id:b.id??b.__temp_key__})),[l,t]),f=(0,e.useMemo)(()=>(s?r:u).includes(t),[t,s,r,u]),m=(0,e.useMemo)(()=>(s?[]:g).includes(t),[t,s,g]);return{addComponentToDynamicZone:o,formErrors:a,isCreatingEntry:s,isFieldAllowed:f,isFieldReadable:m,moveComponentField:i,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:p}}var Qs=Hs,j=d(8471),wt=d(51968),be=d(50563),dn=d(83828),un=d(61762),mn=d(89966),Ye=d(4038),nt=d(47081),Gs=d(61868),Ks=d.n(Gs);function Ys(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var Xs=Ys,Js=d(88708),xt=d.n(Js);function _s({isFromDynamicZone:t,name:o}){const{addNonRepeatableComponentToField:r,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:c,updateActionAllowedFields:g,formErrors:u}=(0,y.Wq)(),{contentType:p}=(0,pe.PL)(),f=(0,e.useMemo)(()=>{const T=x()(p,["attributes"],{});return Object.keys(T).filter(D=>x()(T,[D,"type"],"")==="dynamiczone")},[p]),m=(0,e.useMemo)(()=>a?s:g,[a,s,g]),b=x()(l,o,null),E=(0,e.useMemo)(()=>(0,h.Ts)(o),[o]),v=(0,e.useMemo)(()=>t&&a||m.filter(D=>D===E[0]).length>0?!0:m.map(D=>D.split(".")).filter(D=>D.length<E.length?!1:xt()(D,E.length).join(".")===E.join(".")).length>0,[t,a,m,E]),k=(0,e.useMemo)(()=>t||f.includes(E[0])?!0:(a?[]:c).map(D=>D.split(".")).filter(D=>D.length<E.length?!1:xt()(D,E.length).join(".")===E.join(".")).length>0,[t,f,E,a,c]),R=(0,e.useMemo)(()=>a||v?!1:k,[v,k,a]);return{addNonRepeatableComponentToField:r,formErrors:u,hasChildrenAllowedFields:v,hasChildrenReadableFields:k,isCreatingEntry:a,isReadOnly:R,removeComponentFromField:i,componentValue:b}}var ea=_s,Q=d(49372);const ta=(0,j.ZP)(A.x)`
2
2
  svg path {
3
3
  fill: ${({theme:t})=>t.colors.neutral500};
4
4
  }
5
- `,gn=({intlLabel:t,id:o,labelAction:r,name:s,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:c}=(0,V.Z)(),g=t?.id?c(t):s;return e.createElement(A.x,{paddingBottom:1},e.createElement(F.k,null,e.createElement(Q.Z,{textColor:"neutral800",htmlFor:o||s,variant:"pi",fontWeight:"bold",as:"label"},g,l&&e.createElement(e.Fragment,null,"\xA0(",a,")"),i&&e.createElement(Q.Z,{textColor:"danger600"},"*")),r&&e.createElement(oa,{paddingLeft:1},r)))};gn.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},gn.propTypes={id:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,numberOfEntries:n().number,required:n().bool,showNumberOfEntries:n().bool};var ra=gn,Uo=d(86308);const sa=j.ZP.span`
5
+ `,pn=({intlLabel:t,id:o,labelAction:r,name:s,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:c}=(0,V.Z)(),g=t?.id?c(t):s;return e.createElement(A.x,{paddingBottom:1},e.createElement(F.k,null,e.createElement(Q.Z,{textColor:"neutral800",htmlFor:o||s,variant:"pi",fontWeight:"bold",as:"label"},g,l&&e.createElement(e.Fragment,null,"\xA0(",a,")"),i&&e.createElement(Q.Z,{textColor:"danger600"},"*")),r&&e.createElement(ta,{paddingLeft:1},r)))};pn.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},pn.propTypes={id:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,numberOfEntries:n().number,required:n().bool,showNumberOfEntries:n().bool};var na=pn,zo=d(86308);const oa=j.ZP.span`
6
6
  > svg {
7
7
  width: ${(0,y.Q1)(24)};
8
8
  height: ${(0,y.Q1)(24)};
@@ -13,7 +13,7 @@
13
13
  fill: ${({theme:t})=>t.colors.primary600};
14
14
  }
15
15
  }
16
- `,fn=({error:t,isReadOnly:o,onClick:r})=>{const{formatMessage:s}=(0,V.Z)();return e.createElement(e.Fragment,null,e.createElement(A.x,{as:"button",background:"neutral100",borderColor:t?"danger600":"neutral200",disabled:o,hasRadius:!0,onClick:r,paddingTop:9,paddingBottom:9,type:"button"},e.createElement(F.k,{direction:"column",gap:2},e.createElement(F.k,{justifyContent:"center",style:{cursor:o?"not-allowed":"inherit"}},e.createElement(sa,null,e.createElement(Uo.Z,null))),e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},s({id:(0,h.OB)("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),t?.id&&e.createElement(Q.Z,{textColor:"danger600",variant:"pi"},s(t,{...t.values})))};fn.defaultProps={error:void 0,isReadOnly:!1},fn.propTypes={error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),isReadOnly:n().bool,onClick:n().func.isRequired};var Vo=fn,aa=d(9086),ia=d.n(aa),la=d(87702),hn=d.n(la),Rm=d(27217),ca=d(88591),da=d.n(ca),yn=d(59845),ua=d(20871),ma=d.n(ua),pa=d(48375),Ho=d.n(pa),ga=d(31089),fa=d.n(ga),ha=d(16043),ya=d.n(ha),ba=d(5109),Ea=d.n(ba),va=d(47955),Ca=d.n(va),Ra=d(95706),Ma=d.n(Ra),Ta=d(6658),Da=d.n(Ta),ka=d(36407),Ia=d.n(ka);(async()=>{await d.e(7347).then(d.bind(d,74194))})();const yt=new(da())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(t,o){if(o&&o!=="auto"&&(0,yn.getLanguage)(o))return'<pre class="hljs language-'+yt.utils.escapeHtml(o.toLowerCase())+'"><code>'+(0,yn.highlight)(o,t,!0).value+"</code></pre>";if(o==="auto"){const r=(0,yn.highlightAuto)(t);return'<pre class="hljs language-'+yt.utils.escapeHtml(r.language)+'"><code>'+r.value+"</code></pre>"}return'<pre class="hljs"><code>'+yt.utils.escapeHtml(t)+"</code></pre>"}}).use(ma()).use(Ho(),"warning").use(Ho(),"tip").use(fa()).use(ya()).use(Ea()).use(Ca()).use(Ma()).use(Da()).use(Ia());yt.renderer.rules.footnote_ref=(t,o,r,s,a)=>'<sup class="footnote-ref"><span>'+a.rules.footnote_caption(t,o,r,s,a)+"</span></sup>",yt.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';var Pa=yt,Oa=d(13993),Qo=d.n(Oa);const wa={...Qo().defaults,allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}};var xa=t=>Qo()(t,wa),Fa=j.ZP.div`
16
+ `,gn=({error:t,isReadOnly:o,onClick:r})=>{const{formatMessage:s}=(0,V.Z)();return e.createElement(e.Fragment,null,e.createElement(A.x,{as:"button",background:"neutral100",borderColor:t?"danger600":"neutral200",disabled:o,hasRadius:!0,onClick:r,paddingTop:9,paddingBottom:9,type:"button"},e.createElement(F.k,{direction:"column",gap:2},e.createElement(F.k,{justifyContent:"center",style:{cursor:o?"not-allowed":"inherit"}},e.createElement(oa,null,e.createElement(zo.Z,null))),e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},s({id:(0,h.OB)("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),t?.id&&e.createElement(Q.Z,{textColor:"danger600",variant:"pi"},s(t,{...t.values})))};gn.defaultProps={error:void 0,isReadOnly:!1},gn.propTypes={error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),isReadOnly:n().bool,onClick:n().func.isRequired};var Uo=gn,ra=d(9086),sa=d.n(ra),aa=d(87702),fn=d.n(aa),vm=d(27217),ia=d(88591),la=d.n(ia),hn=d(59845),ca=d(20871),da=d.n(ca),ua=d(48375),Vo=d.n(ua),ma=d(31089),pa=d.n(ma),ga=d(16043),fa=d.n(ga),ha=d(5109),ya=d.n(ha),ba=d(47955),Ea=d.n(ba),va=d(95706),Ca=d.n(va),Ra=d(6658),Ma=d.n(Ra),Ta=d(36407),Da=d.n(Ta);(async()=>{await d.e(7347).then(d.bind(d,74194))})();const yt=new(la())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(t,o){if(o&&o!=="auto"&&(0,hn.getLanguage)(o))return'<pre class="hljs language-'+yt.utils.escapeHtml(o.toLowerCase())+'"><code>'+(0,hn.highlight)(o,t,!0).value+"</code></pre>";if(o==="auto"){const r=(0,hn.highlightAuto)(t);return'<pre class="hljs language-'+yt.utils.escapeHtml(r.language)+'"><code>'+r.value+"</code></pre>"}return'<pre class="hljs"><code>'+yt.utils.escapeHtml(t)+"</code></pre>"}}).use(da()).use(Vo(),"warning").use(Vo(),"tip").use(pa()).use(fa()).use(ya()).use(Ea()).use(Ca()).use(Ma()).use(Da());yt.renderer.rules.footnote_ref=(t,o,r,s,a)=>'<sup class="footnote-ref"><span>'+a.rules.footnote_caption(t,o,r,s,a)+"</span></sup>",yt.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';var ka=yt,Ia=d(13993),Ho=d.n(Ia);const Pa={...Ho().defaults,allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}};var Oa=t=>Ho()(t,Pa),wa=j.ZP.div`
17
17
  position: absolute;
18
18
  top: 0;
19
19
  width: 100%;
@@ -155,8 +155,8 @@
155
155
  margin-block-end: 0px;
156
156
  }
157
157
  }
158
- `;const bn=({data:t})=>{const o=(0,e.useMemo)(()=>xa(Pa.render(t.replaceAll("\\n",`
159
- `)||"")),[t]);return e.createElement(Fa,null,e.createElement("div",{dangerouslySetInnerHTML:{__html:o}}))};bn.defaultProps={data:""},bn.propTypes={data:n().string};var Go=(0,e.memo)(bn);const La=j.ZP.div`
158
+ `;const yn=({data:t})=>{const o=(0,e.useMemo)(()=>Oa(ka.render(t.replaceAll("\\n",`
159
+ `)||"")),[t]);return e.createElement(wa,null,e.createElement("div",{dangerouslySetInnerHTML:{__html:o}}))};yn.defaultProps={data:""},yn.propTypes={data:n().string};var Qo=(0,e.memo)(yn);const xa=j.ZP.div`
160
160
  cursor: ${({disabled:t})=>t?"not-allowed !important":"auto"};
161
161
  height: 100%;
162
162
  /* BASICS */
@@ -495,7 +495,7 @@
495
495
  span {
496
496
  color: ${({theme:t})=>t.colors.neutral800} !important;
497
497
  }
498
- `;var En=d(69783);const Se=(0,j.ZP)(be.h)`
498
+ `;var bn=d(69783);const Se=(0,j.ZP)(be.h)`
499
499
  padding: ${({theme:t})=>t.spaces[2]};
500
500
  /* Trick to prevent the outline from overflowing because of the general outline-offset */
501
501
  outline-offset: -2px !important;
@@ -504,14 +504,14 @@
504
504
  width: ${18/16}rem;
505
505
  height: ${18/16}rem;
506
506
  }
507
- `,Sa=(0,j.ZP)(Se)`
507
+ `,Fa=(0,j.ZP)(Se)`
508
508
  svg {
509
509
  width: ${8/16}rem;
510
510
  height: ${8/16}rem;
511
511
  }
512
- `,Ko=(0,j.ZP)(be.o)`
512
+ `,Go=(0,j.ZP)(be.o)`
513
513
  margin-left: ${({theme:t})=>t.spaces[4]};
514
- `,Yo=(0,j.ZP)(be.h)`
514
+ `,Ko=(0,j.ZP)(be.h)`
515
515
  margin: ${({theme:t})=>`0 ${t.spaces[2]}`};
516
516
  padding: ${({theme:t})=>t.spaces[2]};
517
517
 
@@ -519,12 +519,12 @@
519
519
  width: ${18/16}rem;
520
520
  height: ${18/16}rem;
521
521
  }
522
- `,Aa=(0,j.ZP)(be.o)`
522
+ `,La=(0,j.ZP)(be.o)`
523
523
  margin-right: ${({theme:t})=>`${t.spaces[2]}`};
524
- `,$a=j.ZP.div`
524
+ `,Sa=j.ZP.div`
525
525
  position: relative;
526
526
  height: calc(100% - 48px);
527
- `,Za=(0,j.ZP)(En.Y)`
527
+ `,Aa=(0,j.ZP)(bn.Y)`
528
528
  background-color: transparent;
529
529
  border: none;
530
530
  align-items: center;
@@ -537,9 +537,9 @@
537
537
  height: ${12/16}rem;
538
538
  }
539
539
  }
540
- `;var Ut=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,Ba=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,qa=/[*+-]\s/;function Na(t){if(t.getOption("disableInput"))return hn().Pass;for(var o=t.listSelections(),r=[],s=0;s<o.length;s++){var a=o[s].head,l=t.getStateAfter(a.line),i=l.list!==!1,c=l.quote!==0,g=t.getLine(a.line),u=Ut.exec(g),p=/^\s*$/.test(g.slice(0,a.ch));if(!o[s].empty()||!i&&!c||!u||p){t.execCommand("newlineAndIndent");return}if(Ba.test(g)){var f=c&&/>\s*$/.test(g),m=!/>\s*$/.test(g);(f||m)&&t.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),r[s]=`
541
- `}else{var b=u[1],E=u[5],v=!(qa.test(u[2])||u[2].indexOf(">")>=0),k=v?parseInt(u[3],10)+1+u[4]:u[2].replace("x"," ");r[s]=`
542
- `+b+k+E,v&&ja(t,a)}}t.replaceSelections(r)}function ja(t,o){var r=o.line,s=0,a=0,l=Ut.exec(t.getLine(r)),i=l[1];do{s+=1;var c=r+s,g=t.getLine(c),u=Ut.exec(g);if(u){var p=u[1],f=parseInt(l[3],10)+s-a,m=parseInt(u[3],10),b=m;if(i===p&&!isNaN(m))f===m&&(b=m+1),f>m&&(b=f+1),t.replaceRange(g.replace(Ut,p+b+u[4]+u[5]),{line:c,ch:0},{line:c,ch:g.length});else{if(i.length>p.length||i.length<p.length&&s===1)return;a+=1}}}while(u)}var Wa=Na;const vn=({disabled:t,editorRef:o,error:r,isPreviewMode:s,isExpandMode:a,name:l,onChange:i,placeholder:c,textareaRef:g,value:u})=>{const p=(0,e.useRef)(i);return(0,e.useEffect)(()=>{o.current=hn().fromTextArea(g.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:c,spellcheck:!0,inputStyle:"contenteditable"}),hn().commands.newlineAndIndentContinueMarkdownList=Wa,o.current.on("change",f=>{p.current({target:{name:l,value:f.getValue(),type:"wysiwyg"}})})},[o,g,l,c]),(0,e.useEffect)(()=>{u&&!o.current.hasFocus()&&o.current.setValue(u)},[o,u]),(0,e.useEffect)(()=>{s||t?o.current.setOption("readOnly","nocursor"):o.current.setOption("readOnly",!1)},[t,s,o]),(0,e.useEffect)(()=>{r?o.current.setOption("screenReaderLabel",r):o.current.setOption("screenReaderLabel","Editor")},[o,r]),e.createElement($a,null,e.createElement(La,{isExpandMode:a,disabled:t||s},e.createElement("textarea",{ref:g})),s&&e.createElement(Go,{data:u}))};vn.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},vn.propTypes={disabled:n().bool,editorRef:n().shape({current:n().any}).isRequired,error:n().string,isPreviewMode:n().bool,isExpandMode:n().bool,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().string,textareaRef:n().shape({current:n().any}).isRequired,value:n().string};var za=vn,He=d(80084),Ee=d(84967),ce=d(41415),Ua=d(4101),Xo=d(67563),Jo=d(73906),_o=d(49844),er=d(99283),tr=d(49825),Va=d(83139),Ha=d(35635),Qa=d(20063),Ga=d(80601),Ka=d(11417),Ya=d(43231),Xa=d(65663);const Cn=({disabled:t,editorRef:o,isExpandMode:r,isPreviewMode:s,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[c,g]=(0,e.useState)(!1),{formatMessage:u}=(0,V.Z)(),p=u({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,e.useRef)(),m=()=>{g(b=>!b)};return t||s?e.createElement(F.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(nr,null,e.createElement(He.P,{disabled:!0,placeholder:p,size:"S",label:p},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Ko,null,e.createElement(Se,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Jo.Z,null)}),e.createElement(Se,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(_o.Z,null)}),e.createElement(Se,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(er.Z,null)})),e.createElement(Yo,{disabled:!0,id:"more",label:"More",icon:e.createElement(tr.Z,null)})),!r&&e.createElement(ce.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"}))):e.createElement(F.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(nr,null,e.createElement(He.P,{placeholder:p,label:p,size:"S",onChange:b=>a(b,o)},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Ko,null,e.createElement(Se,{onClick:()=>a("Bold",o),id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Jo.Z,null)}),e.createElement(Se,{onClick:()=>a("Italic",o),id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(_o.Z,null)}),e.createElement(Se,{onClick:()=>a("Underline",o),id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(er.Z,null)})),e.createElement(Yo,{ref:f,onClick:m,id:"more",label:"More",icon:e.createElement(tr.Z,null)}),c&&e.createElement(Ua.J2,{centered:!0,source:f,spacing:4,id:"popover"},e.createElement(Xo.i,{onEscape:m,restoreFocus:!1},e.createElement(F.k,null,e.createElement(Aa,null,e.createElement(Se,{onClick:()=>a("Strikethrough",o,m),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:e.createElement(Va.Z,null)}),e.createElement(Se,{onClick:()=>a("BulletList",o,m),id:"BulletList",label:"BulletList",name:"BulletList",icon:e.createElement(Ha.Z,null)}),e.createElement(Se,{onClick:()=>a("NumberList",o,m),id:"NumberList",label:"NumberList",name:"NumberList",icon:e.createElement(Qa.Z,null)})),e.createElement(be.o,null,e.createElement(Se,{onClick:()=>a("Code",o,m),id:"Code",label:"Code",name:"Code",icon:e.createElement(Ga.Z,null)}),e.createElement(Se,{onClick:()=>{m(),l()},id:"Image",label:"Image",name:"Image",icon:e.createElement(Ka.Z,null)}),e.createElement(Sa,{onClick:()=>a("Link",o,m),id:"Link",label:"Link",name:"Link",icon:e.createElement(Ya.Z,null)}),e.createElement(Se,{onClick:()=>a("Quote",o,m),id:"Quote",label:"Quote",name:"Quote",icon:e.createElement(Xa.Z,null)})))))),i&&e.createElement(ce.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"})))};Cn.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},Cn.propTypes={disabled:n().bool.isRequired,editorRef:n().shape({current:n().any}).isRequired,isExpandMode:n().bool.isRequired,isPreviewMode:n().bool,onActionClick:n().func,onToggleMediaLib:n().func,onTogglePreviewMode:n().func};var Ja=Cn;const nr=(0,j.ZP)(F.k)`
540
+ `;var zt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,$a=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Za=/[*+-]\s/;function Ba(t){if(t.getOption("disableInput"))return fn().Pass;for(var o=t.listSelections(),r=[],s=0;s<o.length;s++){var a=o[s].head,l=t.getStateAfter(a.line),i=l.list!==!1,c=l.quote!==0,g=t.getLine(a.line),u=zt.exec(g),p=/^\s*$/.test(g.slice(0,a.ch));if(!o[s].empty()||!i&&!c||!u||p){t.execCommand("newlineAndIndent");return}if($a.test(g)){var f=c&&/>\s*$/.test(g),m=!/>\s*$/.test(g);(f||m)&&t.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),r[s]=`
541
+ `}else{var b=u[1],E=u[5],v=!(Za.test(u[2])||u[2].indexOf(">")>=0),k=v?parseInt(u[3],10)+1+u[4]:u[2].replace("x"," ");r[s]=`
542
+ `+b+k+E,v&&qa(t,a)}}t.replaceSelections(r)}function qa(t,o){var r=o.line,s=0,a=0,l=zt.exec(t.getLine(r)),i=l[1];do{s+=1;var c=r+s,g=t.getLine(c),u=zt.exec(g);if(u){var p=u[1],f=parseInt(l[3],10)+s-a,m=parseInt(u[3],10),b=m;if(i===p&&!isNaN(m))f===m&&(b=m+1),f>m&&(b=f+1),t.replaceRange(g.replace(zt,p+b+u[4]+u[5]),{line:c,ch:0},{line:c,ch:g.length});else{if(i.length>p.length||i.length<p.length&&s===1)return;a+=1}}}while(u)}var Na=Ba;const En=({disabled:t,editorRef:o,error:r,isPreviewMode:s,isExpandMode:a,name:l,onChange:i,placeholder:c,textareaRef:g,value:u})=>{const p=(0,e.useRef)(i);return(0,e.useEffect)(()=>{o.current=fn().fromTextArea(g.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:c,spellcheck:!0,inputStyle:"contenteditable"}),fn().commands.newlineAndIndentContinueMarkdownList=Na,o.current.on("change",f=>{p.current({target:{name:l,value:f.getValue(),type:"wysiwyg"}})})},[o,g,l,c]),(0,e.useEffect)(()=>{u&&!o.current.hasFocus()&&o.current.setValue(u)},[o,u]),(0,e.useEffect)(()=>{s||t?o.current.setOption("readOnly","nocursor"):o.current.setOption("readOnly",!1)},[t,s,o]),(0,e.useEffect)(()=>{r?o.current.setOption("screenReaderLabel",r):o.current.setOption("screenReaderLabel","Editor")},[o,r]),e.createElement(Sa,null,e.createElement(xa,{isExpandMode:a,disabled:t||s},e.createElement("textarea",{ref:g})),s&&e.createElement(Qo,{data:u}))};En.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},En.propTypes={disabled:n().bool,editorRef:n().shape({current:n().any}).isRequired,error:n().string,isPreviewMode:n().bool,isExpandMode:n().bool,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().string,textareaRef:n().shape({current:n().any}).isRequired,value:n().string};var ja=En,He=d(68465),Ee=d(84967),ce=d(41415),Wa=d(54015),Yo=d(73906),Xo=d(49844),Jo=d(99283),_o=d(49825),za=d(83139),Ua=d(35635),Va=d(20063),Ha=d(80601),Qa=d(11417),Ga=d(43231),Ka=d(65663);const vn=({disabled:t,editorRef:o,isExpandMode:r,isPreviewMode:s,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[c,g]=(0,e.useState)(!1),{formatMessage:u}=(0,V.Z)(),p=u({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,e.useRef)(),m=()=>{g(b=>!b)};return t||s?e.createElement(F.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(er,null,e.createElement(He.P,{disabled:!0,placeholder:p,size:"S",label:p},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Go,null,e.createElement(Se,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Yo.Z,null)}),e.createElement(Se,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Xo.Z,null)}),e.createElement(Se,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(Jo.Z,null)})),e.createElement(Ko,{disabled:!0,id:"more",label:"More",icon:e.createElement(_o.Z,null)})),!r&&e.createElement(ce.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"}))):e.createElement(F.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(er,null,e.createElement(He.P,{placeholder:p,label:p,size:"S",onChange:b=>a(b,o)},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Go,null,e.createElement(Se,{onClick:()=>a("Bold",o),id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Yo.Z,null)}),e.createElement(Se,{onClick:()=>a("Italic",o),id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Xo.Z,null)}),e.createElement(Se,{onClick:()=>a("Underline",o),id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(Jo.Z,null)})),e.createElement(Ko,{ref:f,onClick:m,id:"more",label:"More",icon:e.createElement(_o.Z,null)}),c&&e.createElement(Wa.J2,{onDismiss:m,centered:!0,source:f,spacing:4,id:"popover"},e.createElement(F.k,null,e.createElement(La,null,e.createElement(Se,{onClick:()=>a("Strikethrough",o,m),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:e.createElement(za.Z,null)}),e.createElement(Se,{onClick:()=>a("BulletList",o,m),id:"BulletList",label:"BulletList",name:"BulletList",icon:e.createElement(Ua.Z,null)}),e.createElement(Se,{onClick:()=>a("NumberList",o,m),id:"NumberList",label:"NumberList",name:"NumberList",icon:e.createElement(Va.Z,null)})),e.createElement(be.o,null,e.createElement(Se,{onClick:()=>a("Code",o,m),id:"Code",label:"Code",name:"Code",icon:e.createElement(Ha.Z,null)}),e.createElement(Se,{onClick:()=>{m(),l()},id:"Image",label:"Image",name:"Image",icon:e.createElement(Qa.Z,null)}),e.createElement(Fa,{onClick:()=>a("Link",o,m),id:"Link",label:"Link",name:"Link",icon:e.createElement(Ga.Z,null)}),e.createElement(Se,{onClick:()=>a("Quote",o,m),id:"Quote",label:"Quote",name:"Quote",icon:e.createElement(Ka.Z,null)}))))),i&&e.createElement(ce.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"})))};vn.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},vn.propTypes={disabled:n().bool.isRequired,editorRef:n().shape({current:n().any}).isRequired,isExpandMode:n().bool.isRequired,isPreviewMode:n().bool,onActionClick:n().func,onToggleMediaLib:n().func,onTogglePreviewMode:n().func};var Ya=vn;const er=(0,j.ZP)(F.k)`
543
543
  /* Hide the label, every input needs a label. */
544
544
  label {
545
545
  border: 0;
@@ -551,18 +551,18 @@
551
551
  position: absolute;
552
552
  width: 1px;
553
553
  }
554
- `;var _a=d(18070);const Rn=({onToggleExpand:t})=>{const{formatMessage:o}=(0,V.Z)();return e.createElement(A.x,{padding:2,background:"neutral100",hasRadius:!0},e.createElement(F.k,{justifyContent:"flex-end",alignItems:"flex-end"},e.createElement(Za,{id:"expand",onClick:t},e.createElement(Q.Z,null,o({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),e.createElement(_a.Z,null))))};Rn.defaultProps={onToggleExpand(){}},Rn.propTypes={onToggleExpand:n().func};var ei=Rn;const Mn=({id:t,error:o,name:r,hint:s})=>s.length===0||o?null:e.createElement(Q.Z,{as:"p",variant:"pi",id:`${t||r}-hint`,textColor:"neutral600"},s);Mn.defaultProps={id:void 0,error:void 0,hint:""},Mn.propTypes={hint:n().oneOfType([n().string,n().array]),error:n().string,id:n().string,name:n().string.isRequired};var ti=Mn;const or=(t,o)=>{let r;switch(t){case"Strikethrough":r=`~~${o}~~`;break;case"Bold":r=`**${o}**`;break;case"Italic":r=`_${o}_`;break;case"Underline":r=`<u>${o}</u>`;break;case"Code":r=`\`\`\`
554
+ `;var Xa=d(18070);const Cn=({onToggleExpand:t})=>{const{formatMessage:o}=(0,V.Z)();return e.createElement(A.x,{padding:2,background:"neutral100",hasRadius:!0},e.createElement(F.k,{justifyContent:"flex-end",alignItems:"flex-end"},e.createElement(Aa,{id:"expand",onClick:t},e.createElement(Q.Z,null,o({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),e.createElement(Xa.Z,null))))};Cn.defaultProps={onToggleExpand(){}},Cn.propTypes={onToggleExpand:n().func};var Ja=Cn;const Rn=({id:t,error:o,name:r,hint:s})=>s.length===0||o?null:e.createElement(Q.Z,{as:"p",variant:"pi",id:`${t||r}-hint`,textColor:"neutral600"},s);Rn.defaultProps={id:void 0,error:void 0,hint:""},Rn.propTypes={hint:n().oneOfType([n().string,n().array]),error:n().string,id:n().string,name:n().string.isRequired};var _a=Rn;const tr=(t,o)=>{let r;switch(t){case"Strikethrough":r=`~~${o}~~`;break;case"Bold":r=`**${o}**`;break;case"Italic":r=`_${o}_`;break;case"Underline":r=`<u>${o}</u>`;break;case"Code":r=`\`\`\`
555
555
  ${o}
556
- \`\`\``;break;case"Link":r=`[${o}](link)`;break;case"Quote":r=`>${o}`;break;default:r=o}return r},rr=t=>{let o,r={start:t.length,end:0};switch(t){case"Strikethrough":o=`~~${t}~~`,r.end=2;break;case"Bold":o=`**${t}**`,r.end=2;break;case"Italic":o=`_${t}_`,r.end=1;break;case"alt":o=`[${t}]()`,r.end=3;break;case"Underline":o=`<u>${t}</u>`,r.end=4;break;case"Code":o=`\`\`\`
556
+ \`\`\``;break;case"Link":r=`[${o}](link)`;break;case"Quote":r=`>${o}`;break;default:r=o}return r},nr=t=>{let o,r={start:t.length,end:0};switch(t){case"Strikethrough":o=`~~${t}~~`,r.end=2;break;case"Bold":o=`**${t}**`,r.end=2;break;case"Italic":o=`_${t}_`,r.end=1;break;case"alt":o=`[${t}]()`,r.end=3;break;case"Underline":o=`<u>${t}</u>`,r.end=4;break;case"Code":o=`\`\`\`
557
557
  ${t}
558
- \`\`\``,r.end=3;break;case"Link":o=`[${t}](link)`,r.end=7;break;case"Quote":o=`>${t}`,r.end=0;break;default:o=""}return{editedText:o,selection:r}},sr=t=>{let o;switch(t){case"BulletList":o="- ";break;case"NumberList":o="1. ";break;case"h1":o="# ";break;case"h2":o="## ";break;case"h3":o="### ";break;case"h4":o="#### ";break;case"h5":o="##### ";break;case"h6":o="###### ";break;default:return""}return o},ar=(t,o)=>{const r=t.current.getSelection();let s;if(r){const a=or(o,r);t.current.replaceSelection(a),t.current.focus()}else{s=rr(o),t.current.replaceSelection(s.editedText),t.current.focus();const{line:a,ch:l}=t.current.getCursor(),i=l-s.selection.end,c=l-s.selection.end-s.selection.start;t.current.setSelection({line:a,ch:c},{line:a,ch:i})}},ni=(t,o)=>{const r=t.current.getDoc(),s=o==="BulletList"?"- ":"1. ";if(r.somethingSelected()){const a=r.listSelections();let l=null;t.current.operation(function(){a.forEach(function(i){const c=[i.head.line,i.anchor.line].sort();l==null&&(l=r.getLine(c[0]).startsWith(s));for(let g=c[0];g<=c[1];g++)if(l)r.getLine(g).startsWith(s)&&r.replaceRange("",{line:g,ch:0},{line:g,ch:s.length});else{const u=o==="BulletList"?"- ":`${g+1}. `;r.replaceRange(u,{line:g,ch:0})}})})}else{let{line:a}=r.getCursor();const l=sr(o),i=t.current.getLine(a),c=l+i;t.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),t.current.replaceSelection(c)}t.current.focus()},oi=(t,o)=>{let{line:r}=t.current.getCursor();const s=sr(o),a=t.current.getLine(r),l=a.replace(/#{1,6}\s/g,"").trim(),i=s+l;t.current.setSelection({line:r,ch:0},{line:r,ch:a.length}),t.current.replaceSelection(i),setTimeout(()=>{const c=t.current.getLine(r).length;t.current.focus(),t.current.setCursor({line:r,ch:c})},0)},ri=(t,o)=>{let{line:r,ch:s}=t.current.getCursor();o.forEach((a,l)=>{let i=t.current.getLine(r).length;t.current.setCursor({line:r,ch:i}),(l>0||l===0&&s!==0)&&(i=t.current.getLine(r).length,t.current.setCursor({line:r,ch:i}),r++,t.current.replaceSelection(`
559
- `)),a.mime.includes("image")?t.current.replaceSelection(`![${a.alt}](${a.url})`):t.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>t.current.focus(),0)},si=(t,o,r,s,a)=>{const l=or(o,a),i=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.replaceSelection(""),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
560
- `),t.current.replaceSelection(l),o==="Code"){let{line:c}=t.current.getCursor();t.current.setCursor({line:c-1,ch:a.length})}t.current.replaceRange(i,{line:r+4,ch:0},{line:1/0,ch:1/0}),t.current.focus()},ai=(t,o,r,s)=>{const a=rr(o),l=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
561
- `),t.current.replaceSelection(a.editedText),o==="Code")r+=2,t.current.setSelection({line:r,ch:0},{line:r,ch:4});else{r+=1;let{ch:i}=t.current.getCursor(),c=i-a.selection.end,g=i-a.selection.end-a.selection.start;t.current.setSelection({line:r,ch:g},{line:r,ch:c})}t.current.replaceRange(l,{line:r+2,ch:0},{line:1/0,ch:1/0}),t.current.focus()},ii=(t,o)=>{const r=t.current.getSelection();let{line:s}=t.current.getCursor(),a=t.current.getLine(s).length;r?si(t,o,s,a,r):ai(t,o,s,a)};var li=d(71933),ci=d(74464);const di=(t,o)=>`${t}${Math.floor(o*255).toString(16).padStart(2,0)}`,ui=(0,j.ZP)(F.k)`
562
- background: ${({theme:t})=>di(t.colors.neutral800,.2)};
563
- `,mi=(0,j.ZP)(A.x)`
558
+ \`\`\``,r.end=3;break;case"Link":o=`[${t}](link)`,r.end=7;break;case"Quote":o=`>${t}`,r.end=0;break;default:o=""}return{editedText:o,selection:r}},or=t=>{let o;switch(t){case"BulletList":o="- ";break;case"NumberList":o="1. ";break;case"h1":o="# ";break;case"h2":o="## ";break;case"h3":o="### ";break;case"h4":o="#### ";break;case"h5":o="##### ";break;case"h6":o="###### ";break;default:return""}return o},rr=(t,o)=>{const r=t.current.getSelection();let s;if(r){const a=tr(o,r);t.current.replaceSelection(a),t.current.focus()}else{s=nr(o),t.current.replaceSelection(s.editedText),t.current.focus();const{line:a,ch:l}=t.current.getCursor(),i=l-s.selection.end,c=l-s.selection.end-s.selection.start;t.current.setSelection({line:a,ch:c},{line:a,ch:i})}},ei=(t,o)=>{const r=t.current.getDoc(),s=o==="BulletList"?"- ":"1. ";if(r.somethingSelected()){const a=r.listSelections();let l=null;t.current.operation(function(){a.forEach(function(i){const c=[i.head.line,i.anchor.line].sort();l==null&&(l=r.getLine(c[0]).startsWith(s));for(let g=c[0];g<=c[1];g++)if(l)r.getLine(g).startsWith(s)&&r.replaceRange("",{line:g,ch:0},{line:g,ch:s.length});else{const u=o==="BulletList"?"- ":`${g+1}. `;r.replaceRange(u,{line:g,ch:0})}})})}else{let{line:a}=r.getCursor();const l=or(o),i=t.current.getLine(a),c=l+i;t.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),t.current.replaceSelection(c)}t.current.focus()},ti=(t,o)=>{let{line:r}=t.current.getCursor();const s=or(o),a=t.current.getLine(r),l=a.replace(/#{1,6}\s/g,"").trim(),i=s+l;t.current.setSelection({line:r,ch:0},{line:r,ch:a.length}),t.current.replaceSelection(i),setTimeout(()=>{const c=t.current.getLine(r).length;t.current.focus(),t.current.setCursor({line:r,ch:c})},0)},ni=(t,o)=>{let{line:r,ch:s}=t.current.getCursor();o.forEach((a,l)=>{let i=t.current.getLine(r).length;t.current.setCursor({line:r,ch:i}),(l>0||l===0&&s!==0)&&(i=t.current.getLine(r).length,t.current.setCursor({line:r,ch:i}),r++,t.current.replaceSelection(`
559
+ `)),a.mime.includes("image")?t.current.replaceSelection(`![${a.alt}](${a.url})`):t.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>t.current.focus(),0)},oi=(t,o,r,s,a)=>{const l=tr(o,a),i=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.replaceSelection(""),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
560
+ `),t.current.replaceSelection(l),o==="Code"){let{line:c}=t.current.getCursor();t.current.setCursor({line:c-1,ch:a.length})}t.current.replaceRange(i,{line:r+4,ch:0},{line:1/0,ch:1/0}),t.current.focus()},ri=(t,o,r,s)=>{const a=nr(o),l=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
561
+ `),t.current.replaceSelection(a.editedText),o==="Code")r+=2,t.current.setSelection({line:r,ch:0},{line:r,ch:4});else{r+=1;let{ch:i}=t.current.getCursor(),c=i-a.selection.end,g=i-a.selection.end-a.selection.start;t.current.setSelection({line:r,ch:g},{line:r,ch:c})}t.current.replaceRange(l,{line:r+2,ch:0},{line:1/0,ch:1/0}),t.current.focus()},si=(t,o)=>{const r=t.current.getSelection();let{line:s}=t.current.getCursor(),a=t.current.getLine(s).length;r?oi(t,o,s,a,r):ri(t,o,s,a)};var ai=d(71933),ii=d(67563),li=d(74464);const ci=(t,o)=>`${t}${Math.floor(o*255).toString(16).padStart(2,0)}`,di=(0,j.ZP)(F.k)`
562
+ background: ${({theme:t})=>ci(t.colors.neutral800,.2)};
563
+ `,ui=(0,j.ZP)(A.x)`
564
564
  border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
565
- `,pi=(0,j.ZP)(En.Y)`
565
+ `,mi=(0,j.ZP)(bn.Y)`
566
566
  background-color: transparent;
567
567
  border: none;
568
568
  align-items: center;
@@ -576,13 +576,13 @@ ${t}
576
576
  height: ${12/16}rem;
577
577
  }
578
578
  }
579
- `,Tn=({children:t,isExpandMode:o,error:r,previewContent:s,onCollapse:a})=>{const{formatMessage:l}=(0,V.Z)();return(0,y.F5)(o),o?e.createElement(li.h,{role:"dialog","aria-modal":!1},e.createElement(Xo.i,{onEscape:a},e.createElement(ui,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},e.createElement(A.x,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},e.createElement(F.k,{height:"100%",alignItems:"flex-start"},e.createElement(mi,{flex:"1",height:"100%"},t),e.createElement(F.k,{alignItems:"start",direction:"column",flex:1,height:"100%",width:"100%"},e.createElement(F.k,{height:(0,y.Q1)(48),background:"neutral100",justifyContent:"flex-end",shrink:0,width:"100%"},e.createElement(pi,{onClick:a},e.createElement(Q.Z,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),e.createElement(ci.Z,null))),e.createElement(A.x,{position:"relative",height:"100%",width:"100%"},e.createElement(Go,{data:s})))))))):e.createElement(A.x,{borderColor:r?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},t)};Tn.defaultProps={error:void 0,previewContent:""},Tn.propTypes={children:n().node.isRequired,error:n().string,isExpandMode:n().bool.isRequired,previewContent:n().string,onCollapse:n().func.isRequired};const gi=(0,j.ZP)(A.x)`
579
+ `,Mn=({children:t,isExpandMode:o,error:r,previewContent:s,onCollapse:a})=>{const{formatMessage:l}=(0,V.Z)();return(0,y.F5)(o),o?e.createElement(ai.h,{role:"dialog","aria-modal":!1},e.createElement(ii.i,{onEscape:a},e.createElement(di,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},e.createElement(A.x,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},e.createElement(F.k,{height:"100%",alignItems:"flex-start"},e.createElement(ui,{flex:"1",height:"100%"},t),e.createElement(F.k,{alignItems:"start",direction:"column",flex:1,height:"100%",width:"100%"},e.createElement(F.k,{height:(0,y.Q1)(48),background:"neutral100",justifyContent:"flex-end",shrink:0,width:"100%"},e.createElement(mi,{onClick:a},e.createElement(Q.Z,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),e.createElement(li.Z,null))),e.createElement(A.x,{position:"relative",height:"100%",width:"100%"},e.createElement(Qo,{data:s})))))))):e.createElement(A.x,{borderColor:r?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},t)};Mn.defaultProps={error:void 0,previewContent:""},Mn.propTypes={children:n().node.isRequired,error:n().string,isExpandMode:n().bool.isRequired,previewContent:n().string,onCollapse:n().func.isRequired};const pi=(0,j.ZP)(A.x)`
580
580
  svg path {
581
581
  fill: ${({theme:t})=>t.colors.neutral500};
582
582
  }
583
- `,fi=(0,j.ZP)(Q.Z)`
583
+ `,gi=(0,j.ZP)(Q.Z)`
584
584
  line-height: 0;
585
- `,Dn=({hint:t,disabled:o,error:r,intlLabel:s,labelAction:a,name:l,onChange:i,placeholder:c,value:g,required:u})=>{const{formatMessage:p}=(0,V.Z)(),f=(0,e.useRef)(null),m=(0,e.useRef)(null),[b,E]=(0,e.useState)(!1),[v,k]=(0,e.useState)(!1),[R,T]=(0,e.useState)(!1),{components:O}=(0,y.yX)(),D=O["media-library"],C=()=>k(W=>!W),M=()=>E(W=>!W),I=()=>{E(!1),T(W=>!W)},S=(W,G,z)=>{switch(W){case"Link":case"Strikethrough":{ar(G,W),z();break}case"Code":case"Quote":{ii(G,W),z();break}case"Bold":case"Italic":case"Underline":{ar(G,W);break}case"BulletList":case"NumberList":{ni(G,W),z();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{oi(G,W);break}default:}},B=W=>{const G=W.map(z=>({alt:z.alternativeText||z.name,url:(0,y.CR)(z.url),mime:z.mime}));ri(m,G),k(!1)},$=c?p({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):"",K=s.id?p({id:s.id,defaultMessage:s.defaultMessage},{...s.values}):l;return e.createElement(e.Fragment,null,e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:1},e.createElement(F.k,{gap:1},e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},K,u&&e.createElement(fi,{textColor:"danger600"},"*")),a&&e.createElement(gi,{paddingLeft:1},a)),e.createElement(Tn,{isExpandMode:R,error:r,previewContent:g,onCollapse:I},e.createElement(Ja,{isExpandMode:R,editorRef:m,isPreviewMode:b,onActionClick:S,onToggleMediaLib:C,onTogglePreviewMode:R?void 0:M,disabled:o}),e.createElement(za,{disabled:o,isExpandMode:R,editorRef:m,error:r,isPreviewMode:b,name:l,onChange:i,placeholder:$,textareaRef:f,value:g}),!R&&e.createElement(ei,{onToggleExpand:I})),e.createElement(ti,{hint:t,name:l,error:r})),r&&e.createElement(A.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},r)),v&&e.createElement(D,{onClose:C,onSelectAssets:B}))};Dn.defaultProps={disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:"",hint:""},Dn.propTypes={hint:n().oneOfType([n().string,n().array]),disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,value:n().string};var hi=Dn,kn=d(10369),yi=d(38705),Ft=d(69932),bi=d(27169),ir=d(44647),lr=d(75536),Ei=/^[A-Za-z0-9-_.~]*$/,vi=d(63642);const Ci=(0,j.ZP)(vi.E)`
585
+ `,Tn=({hint:t,disabled:o,error:r,intlLabel:s,labelAction:a,name:l,onChange:i,placeholder:c,value:g,required:u})=>{const{formatMessage:p}=(0,V.Z)(),f=(0,e.useRef)(null),m=(0,e.useRef)(null),[b,E]=(0,e.useState)(!1),[v,k]=(0,e.useState)(!1),[R,T]=(0,e.useState)(!1),{components:O}=(0,y.yX)(),D=O["media-library"],C=()=>k(W=>!W),M=()=>E(W=>!W),I=()=>{E(!1),T(W=>!W)},S=(W,G,z)=>{switch(W){case"Link":case"Strikethrough":{rr(G,W),z();break}case"Code":case"Quote":{si(G,W),z();break}case"Bold":case"Italic":case"Underline":{rr(G,W);break}case"BulletList":case"NumberList":{ei(G,W),z();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{ti(G,W);break}default:}},B=W=>{const G=W.map(z=>({alt:z.alternativeText||z.name,url:(0,y.CR)(z.url),mime:z.mime}));ni(m,G),k(!1)},$=c?p({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):"",K=s.id?p({id:s.id,defaultMessage:s.defaultMessage},{...s.values}):l;return e.createElement(e.Fragment,null,e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:1},e.createElement(F.k,{gap:1},e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},K,u&&e.createElement(gi,{textColor:"danger600"},"*")),a&&e.createElement(pi,{paddingLeft:1},a)),e.createElement(Mn,{isExpandMode:R,error:r,previewContent:g,onCollapse:I},e.createElement(Ya,{isExpandMode:R,editorRef:m,isPreviewMode:b,onActionClick:S,onToggleMediaLib:C,onTogglePreviewMode:R?void 0:M,disabled:o}),e.createElement(ja,{disabled:o,isExpandMode:R,editorRef:m,error:r,isPreviewMode:b,name:l,onChange:i,placeholder:$,textareaRef:f,value:g}),!R&&e.createElement(Ja,{onToggleExpand:I})),e.createElement(_a,{hint:t,name:l,error:r})),r&&e.createElement(A.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},r)),v&&e.createElement(D,{onClose:C,onSelectAssets:B}))};Tn.defaultProps={disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:"",hint:""},Tn.propTypes={hint:n().oneOfType([n().string,n().array]),disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,value:n().string};var fi=Tn,Dn=d(10369),hi=d(38705),Ft=d(69932),yi=d(27169),sr=d(44647),ar=d(75536),bi=/^[A-Za-z0-9-_.~]*$/,Ei=d(63642);const vi=(0,j.ZP)(Ei.E)`
586
586
  svg {
587
587
  height: 1rem;
588
588
  width: 1rem;
@@ -596,7 +596,7 @@ ${t}
596
596
  fill: ${({theme:t})=>t.colors.primary600};
597
597
  }
598
598
  }
599
- `,cr=(0,j.ZP)(F.k)`
599
+ `,ir=(0,j.ZP)(F.k)`
600
600
  svg {
601
601
  height: ${12/16}rem;
602
602
  width: ${12/16}rem;
@@ -605,16 +605,16 @@ ${t}
605
605
  fill: ${({theme:t,available:o})=>o?t.colors.success600:t.colors.danger600};
606
606
  }
607
607
  }
608
- `,Ri=j.F4`
608
+ `,Ci=j.F4`
609
609
  from {
610
610
  transform: rotate(0deg);
611
611
  }
612
612
  to {
613
613
  transform: rotate(359deg);
614
614
  }
615
- `,Mi=(0,j.ZP)(F.k)`
616
- animation: ${Ri} 2s infinite linear;
617
- `,In=({attribute:t,contentTypeUID:o,hint:r,disabled:s,error:a,intlLabel:l,labelAction:i,name:c,onChange:g,value:u,placeholder:p,required:f})=>{const{modifiedData:m,initialData:b,layout:E}=(0,y.Wq)(),[v,k]=(0,e.useState)(!1),[R,T]=(0,e.useState)(null),O=(0,lr.Z)(u,300),D=(0,e.useRef)(),C=(0,y.lm)(),{formatAPIError:M}=(0,y.So)(),I=b[c],{formatMessage:S}=(0,V.Z)(),B=E?.options?.timestamps??0,$=!b[B],K=(0,lr.Z)(m[t.targetField],300),[W,G]=(0,e.useState)(!1),[z,X]=(0,e.useState)(null),{post:q}=(0,y.kY)(),U=l.id?S({id:l.id,defaultMessage:l.defaultMessage},{...l.values}):c,L=p?S({id:p.id,defaultMessage:p.defaultMessage},{...p.values}):"";D.current=async(Z=!1)=>{k(!0);try{const{data:{data:oe}}=await q((0,h.IF)("uid/generate"),{contentTypeUID:o,field:c,data:m});g({target:{name:c,value:oe,type:"text"}},Z),k(!1)}catch(oe){k(!1),C({type:"warning",message:M(oe)})}};const w=async()=>{if(u){k(!0);try{const{data:Z}=await q((0,h.IF)("uid/check-availability"),{contentTypeUID:o,field:c,value:u?u.trim():""});k(!1),T(Z)}catch(Z){k(!1),C({type:"warning",message:M(Z)})}}};(0,e.useEffect)(()=>{!u&&t.required&&D.current(!0)},[t.required,D,u]),(0,e.useEffect)(()=>{O?.trim().match(Ei)&&O!==I&&w(),O||T(null)},[I,O]),(0,e.useEffect)(()=>{let Z;return R?.isAvailable&&(Z=setTimeout(()=>{T(null)},4e3)),()=>{Z&&clearTimeout(Z)}},[R]),(0,e.useEffect)(()=>{!W&&$&&K&&m[t.targetField]&&!u&&D.current(!0)},[K,W,$]);const N=()=>{X(S({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},Y=()=>{X(null)},P=Z=>{Z.target.value&&$&&G(!0),g(Z)};return e.createElement(kn.o,{disabled:s,error:a,endAction:e.createElement(F.k,{position:"relative",gap:1},R&&!z&&e.createElement(cr,{alignItems:"center",gap:1,justifyContent:"flex-end",available:!!R?.isAvailable,"data-not-here-outer":!0,position:"absolute",pointerEvents:"none",right:6,width:"100px"},R?.isAvailable?e.createElement(yi.Z,null):e.createElement(Ft.Z,null),e.createElement(Q.Z,{textColor:R.isAvailable?"success600":"danger600",variant:"pi"},S(R.isAvailable?{id:"content-manager.components.uid.available",defaultMessage:"Available"}:{id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),!s&&e.createElement(e.Fragment,null,z&&e.createElement(cr,{alignItems:"center",justifyContent:"flex-end",gap:1},e.createElement(Q.Z,{textColor:"primary600",variant:"pi"},z)),e.createElement(Ci,{onClick:()=>D.current(),label:S({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}),onMouseEnter:N,onMouseLeave:Y},v?e.createElement(Mi,{"data-testid":"loading-wrapper"},e.createElement(bi.Z,null)):e.createElement(ir.Z,null)))),hint:r,label:U,labelAction:i,name:c,onChange:P,placeholder:L,value:u||"",required:f})};In.propTypes={attribute:n().shape({targetField:n().string,required:n().bool}).isRequired,contentTypeUID:n().string.isRequired,disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,hint:n().oneOfType([n().string,n().array])},In.defaultProps={disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1,hint:""};var Ti=In,Di=d(88423),Pn=d.n(Di),ki=d(41044),Ii=d(50428),Pi=d(87107),Oi=d(28847),dr=d(7563),wi=d(67014),xi=d(47851),ur=d(99140),Vt=d(63919),On=d(41234),Ht=d(35331);const wn=({children:t,loadMore:o,search:r,totalNumberOfRelations:s,size:a,...l})=>e.createElement(e.Fragment,null,e.createElement(F.k,{paddingBottom:s>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},e.createElement(F.k,{direction:"column",alignItems:"stretch",basis:a<=6?"100%":"70%",gap:1,...l},r),o),t);wn.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},wn.propTypes={children:n().node.isRequired,search:n().node,loadMore:n().node,size:n().number.isRequired,totalNumberOfRelations:n().number};var mr=d(90553);const Qt=50,bt=4,pr=(0,j.ZP)(F.k)`
615
+ `,Ri=(0,j.ZP)(F.k)`
616
+ animation: ${Ci} 2s infinite linear;
617
+ `,kn=({attribute:t,contentTypeUID:o,hint:r,disabled:s,error:a,intlLabel:l,labelAction:i,name:c,onChange:g,value:u,placeholder:p,required:f})=>{const{modifiedData:m,initialData:b,layout:E}=(0,y.Wq)(),[v,k]=(0,e.useState)(!1),[R,T]=(0,e.useState)(null),O=(0,ar.Z)(u,300),D=(0,e.useRef)(),C=(0,y.lm)(),{formatAPIError:M}=(0,y.So)(),I=b[c],{formatMessage:S}=(0,V.Z)(),B=E?.options?.timestamps??0,$=!b[B],K=(0,ar.Z)(m[t.targetField],300),[W,G]=(0,e.useState)(!1),[z,X]=(0,e.useState)(null),{post:q}=(0,y.kY)(),U=l.id?S({id:l.id,defaultMessage:l.defaultMessage},{...l.values}):c,L=p?S({id:p.id,defaultMessage:p.defaultMessage},{...p.values}):"";D.current=async(Z=!1)=>{k(!0);try{const{data:{data:oe}}=await q((0,h.IF)("uid/generate"),{contentTypeUID:o,field:c,data:m});g({target:{name:c,value:oe,type:"text"}},Z),k(!1)}catch(oe){k(!1),C({type:"warning",message:M(oe)})}};const w=async()=>{if(u){k(!0);try{const{data:Z}=await q((0,h.IF)("uid/check-availability"),{contentTypeUID:o,field:c,value:u?u.trim():""});k(!1),T(Z)}catch(Z){k(!1),C({type:"warning",message:M(Z)})}}};(0,e.useEffect)(()=>{!u&&t.required&&D.current(!0)},[t.required,D,u]),(0,e.useEffect)(()=>{O?.trim().match(bi)&&O!==I&&w(),O||T(null)},[I,O]),(0,e.useEffect)(()=>{let Z;return R?.isAvailable&&(Z=setTimeout(()=>{T(null)},4e3)),()=>{Z&&clearTimeout(Z)}},[R]),(0,e.useEffect)(()=>{!W&&$&&K&&m[t.targetField]&&!u&&D.current(!0)},[K,W,$]);const N=()=>{X(S({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},Y=()=>{X(null)},P=Z=>{Z.target.value&&$&&G(!0),g(Z)};return e.createElement(Dn.o,{disabled:s,error:a,endAction:e.createElement(F.k,{position:"relative",gap:1},R&&!z&&e.createElement(ir,{alignItems:"center",gap:1,justifyContent:"flex-end",available:!!R?.isAvailable,"data-not-here-outer":!0,position:"absolute",pointerEvents:"none",right:6,width:"100px"},R?.isAvailable?e.createElement(hi.Z,null):e.createElement(Ft.Z,null),e.createElement(Q.Z,{textColor:R.isAvailable?"success600":"danger600",variant:"pi"},S(R.isAvailable?{id:"content-manager.components.uid.available",defaultMessage:"Available"}:{id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),!s&&e.createElement(e.Fragment,null,z&&e.createElement(ir,{alignItems:"center",justifyContent:"flex-end",gap:1},e.createElement(Q.Z,{textColor:"primary600",variant:"pi"},z)),e.createElement(vi,{onClick:()=>D.current(),label:S({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}),onMouseEnter:N,onMouseLeave:Y},v?e.createElement(Ri,{"data-testid":"loading-wrapper"},e.createElement(yi.Z,null)):e.createElement(sr.Z,null)))),hint:r,label:U,labelAction:i,name:c,onChange:P,placeholder:L,value:u||"",required:f})};kn.propTypes={attribute:n().shape({targetField:n().string,required:n().bool}).isRequired,contentTypeUID:n().string.isRequired,disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,hint:n().oneOfType([n().string,n().array])},kn.defaultProps={disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1,hint:""};var Mi=kn,Ti=d(88423),In=d.n(Ti),Di=d(41044),ki=d(50428),Ii=d(87107),Pi=d(28847),lr=d(7563),Oi=d(67014),wi=d(47851),cr=d(99140),Ut=d(63919),Pn=d(41234),Vt=d(35331);const On=({children:t,loadMore:o,search:r,totalNumberOfRelations:s,size:a,...l})=>e.createElement(e.Fragment,null,e.createElement(F.k,{paddingBottom:s>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},e.createElement(F.k,{direction:"column",alignItems:"stretch",basis:a<=6?"100%":"70%",gap:1,...l},r),o),t);On.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},On.propTypes={children:n().node.isRequired,search:n().node,loadMore:n().node,size:n().number.isRequired,totalNumberOfRelations:n().number};var dr=d(90553);const Ht=50,bt=4,ur=(0,j.ZP)(F.k)`
618
618
  width: 100%;
619
619
  /* Used to prevent endAction to be pushed out of container */
620
620
  min-width: 0;
@@ -622,11 +622,11 @@ ${t}
622
622
  & > div[role='button'] {
623
623
  cursor: all-scroll;
624
624
  }
625
- `,gr=(0,j.ZP)(F.k)`
625
+ `,mr=(0,j.ZP)(F.k)`
626
626
  width: 100%;
627
627
  /* Used to prevent endAction to be pushed out of container */
628
628
  min-width: 0;
629
- `,xn=({ariaDescribedBy:t,children:o,displayValue:r,canDrag:s,disabled:a,endAction:l,iconButtonAriaLabel:i,style:c,id:g,index:u,name:p,onCancel:f,onDropItem:m,onGrabItem:b,status:E,updatePositionOfRelation:v,...k})=>{const[{handlerId:R,isDragging:T,handleKeyDown:O},D,C,M,I]=(0,mr.Y)(s&&!a,{type:`${h._Q.RELATION}_${p}`,index:u,item:{displayedValue:r,status:E,id:g},onGrabItem:b,onDropItem:m,onCancel:f,onMoveItem:v,dropSensitivity:"immediate"}),S=(0,h.FE)(D,M);return(0,e.useEffect)(()=>{I((0,wt.rX)())},[I]),e.createElement(A.x,{style:c,as:"li",ref:C,"aria-describedby":t,cursor:s?"all-scroll":"default"},T?e.createElement(Fi,null):e.createElement(F.k,{paddingTop:2,paddingBottom:2,paddingLeft:s?2:4,paddingRight:4,hasRadius:!0,borderSize:1,borderColor:"neutral200",background:a?"neutral150":"neutral0",justifyContent:"space-between",ref:s?S:void 0,"data-handler-id":R,...k},e.createElement(pr,{gap:1},s?e.createElement(be.h,{forwardedAs:"div",role:"button",tabIndex:0,"aria-label":i,noBorder:!0,onKeyDown:O,disabled:a},e.createElement(nt.Z,null)):null,e.createElement(gr,{justifyContent:"space-between"},o)),l&&e.createElement(A.x,{paddingLeft:4},l)))},Fi=()=>e.createElement(A.x,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",background:"primary100",height:`calc(100% - ${bt}px)`});xn.defaultProps={ariaDescribedBy:"",canDrag:!1,displayValue:"",disabled:!1,endAction:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,style:void 0,status:void 0,updatePositionOfRelation:void 0},xn.propTypes={ariaDescribedBy:n().string,canDrag:n().bool,children:n().node.isRequired,displayValue:n().string,disabled:n().bool,endAction:n().node,iconButtonAriaLabel:n().string.isRequired,id:n().number.isRequired,index:n().number.isRequired,name:n().string.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,status:n().string,style:n().shape({height:n().number,left:n().number,position:n().string,right:n().number,width:n().string}),updatePositionOfRelation:n().func};const Li=(0,j.ZP)(A.x)`
629
+ `,wn=({ariaDescribedBy:t,children:o,displayValue:r,canDrag:s,disabled:a,endAction:l,iconButtonAriaLabel:i,style:c,id:g,index:u,name:p,onCancel:f,onDropItem:m,onGrabItem:b,status:E,updatePositionOfRelation:v,...k})=>{const[{handlerId:R,isDragging:T,handleKeyDown:O},D,C,M,I]=(0,dr.Y)(s&&!a,{type:`${h._Q.RELATION}_${p}`,index:u,item:{displayedValue:r,status:E,id:g},onGrabItem:b,onDropItem:m,onCancel:f,onMoveItem:v,dropSensitivity:"immediate"}),S=(0,h.FE)(D,M);return(0,e.useEffect)(()=>{I((0,wt.rX)())},[I]),e.createElement(A.x,{style:c,as:"li",ref:C,"aria-describedby":t,cursor:s?"all-scroll":"default"},T?e.createElement(xi,null):e.createElement(F.k,{paddingTop:2,paddingBottom:2,paddingLeft:s?2:4,paddingRight:4,hasRadius:!0,borderSize:1,borderColor:"neutral200",background:a?"neutral150":"neutral0",justifyContent:"space-between",ref:s?S:void 0,"data-handler-id":R,...k},e.createElement(ur,{gap:1},s?e.createElement(be.h,{forwardedAs:"div",role:"button",tabIndex:0,"aria-label":i,noBorder:!0,onKeyDown:O,disabled:a},e.createElement(nt.Z,null)):null,e.createElement(mr,{justifyContent:"space-between"},o)),l&&e.createElement(A.x,{paddingLeft:4},l)))},xi=()=>e.createElement(A.x,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",background:"primary100",height:`calc(100% - ${bt}px)`});wn.defaultProps={ariaDescribedBy:"",canDrag:!1,displayValue:"",disabled:!1,endAction:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,style:void 0,status:void 0,updatePositionOfRelation:void 0},wn.propTypes={ariaDescribedBy:n().string,canDrag:n().bool,children:n().node.isRequired,displayValue:n().string,disabled:n().bool,endAction:n().node,iconButtonAriaLabel:n().string.isRequired,id:n().number.isRequired,index:n().number.isRequired,name:n().string.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,status:n().string,style:n().shape({height:n().number,left:n().number,position:n().string,right:n().number,width:n().string}),updatePositionOfRelation:n().func};const Fi=(0,j.ZP)(A.x)`
630
630
  position: relative;
631
631
  overflow-x: hidden;
632
632
  overflow-y: auto;
@@ -656,14 +656,14 @@ ${t}
656
656
  opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="bottom"?1:0};
657
657
  transition: opacity 0.2s ease-in-out;
658
658
  }
659
- `,Fn=({children:t,overflow:o,...r})=>e.createElement(Li,{overflowDirection:o,...r},t);Fn.defaultProps={overflow:""},Fn.propTypes={children:n().node.isRequired,overflow:n().oneOf(["top-bottom","bottom","top",""])};var Si=d(88994);const Ai=j.ZP.div`
659
+ `,xn=({children:t,overflow:o,...r})=>e.createElement(Fi,{overflowDirection:o,...r},t);xn.defaultProps={overflow:""},xn.propTypes={children:n().node.isRequired,overflow:n().oneOf(["top-bottom","bottom","top",""])};var Li=d(67582);const Si=j.ZP.div`
660
660
  flex-shrink: 0;
661
661
  width: ${(0,y.Q1)(6)};
662
662
  height: ${(0,y.Q1)(6)};
663
663
  margin-right: ${({theme:t})=>t.spaces[2]};
664
664
  background-color: ${({theme:t,isDraft:o})=>t.colors[o?"secondary600":"success600"]};
665
665
  border-radius: 50%;
666
- `,fr=t=>{const{formatMessage:o}=(0,V.Z)(),r=Si.c.Option,{publicationState:s,mainField:a,id:l}=t.data;if(s){const i=s==="draft",c={id:(0,h.OB)("components.Select.draft-info-title"),defaultMessage:"State: Draft"},g={id:(0,h.OB)("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=o(i?c:g);return e.createElement(r,{...t},e.createElement(F.k,null,e.createElement(Ai,{title:u,isDraft:i}),e.createElement(Q.Z,{ellipsis:!0},a??l)))}return e.createElement(r,{...t},a??l)};fr.propTypes={isFocused:n().bool.isRequired,data:n().shape({id:n().number.isRequired,isDraft:n().bool,mainField:n().string,publicationState:n().oneOfType([n().string,n().bool])}).isRequired};const hr=(0,j.ZP)(Ii.r)`
666
+ `,pr=t=>{const{formatMessage:o}=(0,V.Z)(),r=Li.c.Option,{publicationState:s,mainField:a,id:l}=t.data;if(s){const i=s==="draft",c={id:(0,h.OB)("components.Select.draft-info-title"),defaultMessage:"State: Draft"},g={id:(0,h.OB)("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=o(i?c:g);return e.createElement(r,{...t},e.createElement(F.k,null,e.createElement(Si,{title:u,isDraft:i}),e.createElement(Q.Z,{ellipsis:!0},a??l)))}return e.createElement(r,{...t},a??l)};pr.propTypes={isFocused:n().bool.isRequired,data:n().shape({id:n().number.isRequired,isDraft:n().bool,mainField:n().string,publicationState:n().oneOfType([n().string,n().bool])}).isRequired};const gr=(0,j.ZP)(ki.r)`
667
667
  display: block;
668
668
 
669
669
  > span {
@@ -672,7 +672,7 @@ ${t}
672
672
  text-overflow: ellipsis;
673
673
  display: block;
674
674
  }
675
- `,yr=j.ZP.button`
675
+ `,fr=j.ZP.button`
676
676
  svg path {
677
677
  fill: ${({theme:t,disabled:o})=>o?t.colors.neutral600:t.colors.neutral500};
678
678
  }
@@ -681,13 +681,13 @@ ${t}
681
681
  &:focus svg path {
682
682
  fill: ${({theme:t,disabled:o})=>!o&&t.colors.neutral600};
683
683
  }
684
- `,Ln=({canReorder:t,description:o,disabled:r,error:s,iconButtonAriaLabel:a,id:l,name:i,numberOfRelationsToDisplay:c,label:g,labelAction:u,labelLoadMore:p,labelDisconnectRelation:f,listAriaDescription:m,liveText:b,loadingMessage:E,onCancel:v,onDropItem:k,onGrabItem:R,noRelationsMessage:T,onRelationConnect:O,onRelationLoadMore:D,onRelationDisconnect:C,onRelationReorder:M,onSearchNextPage:I,onSearch:S,placeholder:B,publicationStateTranslations:$,required:K,relations:W,searchResults:G,size:z})=>{const[X,q]=(0,e.useState)(null),[U,L]=(0,e.useState)(""),w=(0,e.useRef)(),N=(0,e.useRef)(),{data:Y}=G,P=W.data,Z=P.length??0,oe=(0,e.useMemo)(()=>Z>c?Math.min(Z,c)*(Qt+bt)+Qt/2:Math.min(Z,c)*(Qt+bt),[Z,c]),re=!!p&&W.hasNextPage,me=(0,e.useMemo)(()=>Y.flat().filter(Boolean).map(_=>({..._,value:_.id,label:_.mainField})),[Y]);(0,e.useEffect)(()=>{if(Z<=c)return L("");const _=ze=>{const jo=ze.target.parentNode.scrollHeight,at=ze.target.scrollHeight-ze.target.scrollTop;return ze.target.scrollTop===0?L("bottom"):L(at===jo?"top":"top-bottom")},fe=N?.current;return!W.isLoading&&P.length>0&&fe&&N.current.addEventListener("scroll",_),()=>{fe&&fe.removeEventListener("scroll",_)}},[W,P,c,Z]);const[H,ae]=(0,e.useState)(!1),Ie=(0,e.useRef)(),Ne=(0,e.useRef)([]);(0,e.useEffect)(()=>(me.length>0&&Ne.current.length===0&&ae(_=>(_&&(Ie.current=setTimeout(()=>{ae(!0)},10)),!1)),()=>{Ne.current=me||[]}),[me]),(0,e.useEffect)(()=>()=>{Ie.current&&clearTimeout(Ie.current)},[]);const de=()=>{ae(!1)},ue=()=>{ae(!0),S()},Fe=(_,fe)=>{M&&_>=0&&_<P.length&&M(fe,_)},Ce=(0,pe.zH)(P.length),De=(0,e.useRef)(),Tt=()=>{De.current="loadMore",D()};(0,e.useEffect)(()=>{De.current==="onChange"&&P.length!==Ce?w.current.scrollToItem(P.length,"end"):De.current==="loadMore"&&P.length!==Ce&&w.current.scrollToItem(0,"start"),De.current=void 0},[Ce,P]);const Re=`${i}-item-instructions`;return e.createElement(Pi.g,{error:s,name:i,hint:o,id:l,required:K},e.createElement(wn,{totalNumberOfRelations:Z,size:z,search:e.createElement(e.Fragment,null,e.createElement(Oi.Q,{action:u},g),e.createElement(y.JV,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:fr},options:me,isDisabled:r,isLoading:G.isLoading,error:s,inputId:l,isSearchable:!0,isClear:!0,loadingMessage:()=>E,onChange:_=>{q(null),O(_),De.current="onChange"},onInputChange:_=>{q(_),S(_)},onMenuClose:de,onMenuOpen:ue,menuIsOpen:H,noOptionsMessage:()=>T,onMenuScrollToBottom:()=>{G.hasNextPage&&I()},placeholder:B,name:i,value:X})),loadMore:re&&e.createElement(dr.A,{disabled:W.isLoading||W.isFetchingNextPage,onClick:Tt,loading:W.isLoading||W.isFetchingNextPage,startIcon:e.createElement(ir.Z,null)},p)},P.length>0&&e.createElement(Fn,{overflow:U},e.createElement(ht.T,{id:Re},m),e.createElement(ht.T,{"aria-live":"assertive"},b),e.createElement(ki.t7,{height:oe,ref:w,outerRef:N,itemCount:Z,itemSize:Qt+bt,itemData:{name:i,ariaDescribedBy:Re,canDrag:t,disabled:r,handleCancel:v,handleDropItem:k,handleGrabItem:R,iconButtonAriaLabel:a,labelDisconnectRelation:f,onRelationDisconnect:C,publicationStateTranslations:$,relations:P,updatePositionOfRelation:Fe},itemKey:_=>`${P[_].mainField}_${P[_].id}`,innerElementType:"ol"},Sn)),(o||s)&&e.createElement(A.x,{paddingTop:2},e.createElement(wi.J,null),e.createElement(xi.c,null))))},$i=n().shape({data:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),hasNextPage:n().bool,isFetchingNextPage:n().bool.isRequired,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired}),Zi=n().shape({data:n().arrayOf(n().shape({id:n().number.isRequired,href:n().string,mainField:n().oneOfType([n().string,n().number]),publicationState:n().oneOfType([n().string,n().bool])})),hasNextPage:n().bool,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired});Ln.defaultProps={canReorder:!1,description:void 0,disabled:!1,error:void 0,labelAction:null,labelLoadMore:null,liveText:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,required:!1,relations:{data:[]},searchResults:{data:[]}},Ln.propTypes={error:n().string,canReorder:n().bool,description:n().string,disabled:n().bool,iconButtonAriaLabel:n().string.isRequired,id:n().string.isRequired,label:n().string.isRequired,labelAction:n().element,labelLoadMore:n().string,labelDisconnectRelation:n().string.isRequired,listAriaDescription:n().string.isRequired,liveText:n().string,loadingMessage:n().string.isRequired,name:n().string.isRequired,noRelationsMessage:n().string.isRequired,numberOfRelationsToDisplay:n().number.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,onRelationConnect:n().func.isRequired,onRelationDisconnect:n().func.isRequired,onRelationLoadMore:n().func.isRequired,onRelationReorder:n().func.isRequired,onSearch:n().func.isRequired,onSearchNextPage:n().func.isRequired,placeholder:n().string.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,required:n().bool,searchResults:Zi,size:n().number.isRequired,relations:$i};const Sn=({data:t,index:o,style:r})=>{const{ariaDescribedBy:s,canDrag:a,disabled:l,handleCancel:i,handleDropItem:c,handleGrabItem:g,iconButtonAriaLabel:u,name:p,labelDisconnectRelation:f,onRelationDisconnect:m,publicationStateTranslations:b,relations:E,updatePositionOfRelation:v}=t,{publicationState:k,href:R,mainField:T,id:O}=E[o],D=k==="draft"?"secondary":"success";return e.createElement(xn,{ariaDescribedBy:s,canDrag:a,disabled:l,displayValue:String(T??O),iconButtonAriaLabel:u,id:O,index:o,name:p,endAction:e.createElement(yr,{"data-testid":`remove-relation-${O}`,disabled:l,type:"button",onClick:()=>m(E[o]),"aria-label":f},e.createElement(ur.J,{width:"12px",as:Ht.Z})),onCancel:i,onDropItem:c,onGrabItem:g,status:k||void 0,style:{...r,bottom:r.bottom??0+bt,height:r.height??0-bt},updatePositionOfRelation:v},e.createElement(A.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(Vt.u,{description:T??`${O}`},R?e.createElement(hr,{to:R},T??O):e.createElement(Q.Z,{textColor:l?"neutral600":"primary600",ellipsis:!0},T??O))),k&&e.createElement(On.q,{variant:D,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${D}700`},b[k])))};Sn.defaultProps={data:{}},Sn.propTypes={data:n().shape({ariaDescribedBy:n().string.isRequired,canDrag:n().bool.isRequired,disabled:n().bool.isRequired,handleCancel:n().func,handleDropItem:n().func,handleGrabItem:n().func,iconButtonAriaLabel:n().string.isRequired,labelDisconnectRelation:n().string.isRequired,name:n().string.isRequired,onRelationDisconnect:n().func.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,relations:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),updatePositionOfRelation:n().func.isRequired}),index:n().number.isRequired,style:n().object.isRequired};var Bi=Ln,Xe=d(20108);function qi(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var Ni=qi;function ji({componentUid:t,isUserAllowedToEditField:o,isUserAllowedToReadField:r,name:s,queryInfos:a}){const{isCreatingEntry:l,createActionAllowedFields:i,readActionAllowedFields:c,updateActionAllowedFields:g,slug:u,modifiedData:p}=(0,y.Wq)(),f=(0,e.useMemo)(()=>o===!0?!0:(l?i:g).includes(s),[l,i,s,o,g]),m=(0,e.useMemo)(()=>r?!0:(l?[]:c).includes(s),[l,r,s,c]),b=s.split(".");let E;t&&(E=x()(p,b.slice(0,-1))?.id);const v=(0,e.useMemo)(()=>l?null:t?E?(0,h.IF)(`relations/${t}/${E}/${b.at(-1)}`):null:(0,h.IF)(`relations/${u}/${p.id}/${s.split(".").at(-1)}`),[l,t,u,p.id,s,E,b]),k=(0,e.useMemo)(()=>t?(0,h.IF)(`relations/${t}/${s.split(".").at(-1)}`):(0,h.IF)(`relations/${u}/${s.split(".").at(-1)}`),[t,u,s]);return{componentId:E,isComponentRelation:Boolean(t),queryInfos:{...a,endpoints:{search:k,relation:v}},isCreatingEntry:l,isFieldAllowed:f,isFieldReadable:m}}var Wi=ji;function zi(t,o){return`${(0,h.IF)(`collectionType/${t}/${o??""}`)}`}const ct={DRAFT:"draft",PUBLISHED:"published"},An=5,Ui=10,$n=(t,{shouldAddLink:o,mainFieldName:r,targetModel:s})=>{const a={...t};return o&&(a.href=zi(s,a.id)),a.publicationState=!1,a?.publishedAt!==void 0&&(a.publicationState=a.publishedAt?ct.PUBLISHED:ct.DRAFT),a.mainField=a[r],a},Vi=(t,{shouldAddLink:o=!1,mainFieldName:r,targetModel:s}={})=>[...t].map(a=>$n(a,{shouldAddLink:o,mainFieldName:r,targetModel:s})),Hi=(t,{mainFieldName:o})=>{const{data:r}=t,{pages:s=[]}=r??{};return{...t,data:s.map(a=>a?.results.map(l=>$n(l,{mainFieldName:o}))).filter(Boolean).flat()}},Qi=(t=[],o=[])=>{const r=t.reduce((a,l)=>o.find(i=>i.id===l.id)?a:[...a,l.id],[]),s=o.reduce((a,l)=>t.find(i=>i.id===l.id)?a:[...a,l.id],[]);return[r,s]},Gi=(t,{relation:o,search:r})=>{const[s,a]=(0,e.useState)({}),[l,i]=(0,e.useState)(0),{get:c}=(0,y.kY)(),g=async({pageParam:C=1})=>{try{const{data:M}=await c(o?.endpoint,{params:{...o.pageParams??{},page:C}});return i(C),M}catch{return null}},u=async({pageParam:C=1})=>{try{const{data:M}=await c(r.endpoint,{params:{...r.pageParams??{},...s,page:C}});return M}catch{return null}},{onLoad:p,normalizeArguments:f={}}=o,m=(0,Xe.useInfiniteQuery)(["relation",...t],g,{cacheTime:0,enabled:o.enabled,getNextPageParam(C){const M=!C?.pagination;if(!(!C||M||C?.pagination.page>=C?.pagination.pageCount))return C.pagination.page+1},select:C=>({...C,pages:C.pages.map(M=>{if(!M)return M;const{data:I,results:S,pagination:B}=M,$=!!I;let K=[];return $?K=[I]:S&&(K=[...S].reverse()),{pagination:B,results:K}})})}),{pageGoal:b}=o,{status:E,data:v,fetchNextPage:k,hasNextPage:R}=m;(0,e.useEffect)(()=>{b>l&&R&&E==="success"&&k({pageParam:l+1})},[b,l,k,R,E]);const T=(0,y.W6)(p);(0,e.useEffect)(()=>{if(E==="success"&&v&&v.pages?.at(-1)?.results&&T){const C=Vi(v.pages.at(-1).results,f);T(C)}},[E,T,v]);const O=(0,Xe.useInfiniteQuery)(["relation",...t,"search",JSON.stringify(s)],u,{enabled:Object.keys(s).length>0,getNextPageParam(C){if(!(!C?.pagination||C.pagination.page>=C.pagination.pageCount))return C.pagination.page+1}});return{relations:m,search:O,searchFor:(C,M={})=>{a({...M,_q:C})}}},br=(t,o)=>r=>{const s=r.split(".");return s.reduce((a,l,i)=>{const c=x()(t,a),g=x()(o,[...s.slice(0,i),l,"__temp_key__"]);if(Array.isArray(c)&&typeof g=="number"){const u=c.findIndex(p=>p.__temp_key__===g);return a.push(u.toString()),a}return a.push(l),a},[])},Zn=({error:t,componentId:o,isComponentRelation:r,editable:s,description:a,intlLabel:l,isCreatingEntry:i,isFieldAllowed:c,isFieldReadable:g,labelAction:u,mainField:p,name:f,queryInfos:{endpoints:m,defaultParams:b,shouldDisplayRelationLink:E},placeholder:v,required:k,relationType:R,size:T,targetModel:O})=>{const[D,C]=(0,e.useState)(""),{formatMessage:M}=(0,V.Z)(),{slug:I,initialData:S,modifiedData:B,relationConnect:$,relationDisconnect:K,relationLoad:W,relationReorder:G}=(0,y.Wq)(),z=f.split("."),X=br(S,B)(f),q=x()(B,f,[]),U=Math.ceil(x()(S,f,[]).length/An),{relations:L,search:w,searchFor:N}=Gi([I,X.join("."),B.id,b],{relation:{enabled:!!m.relation,endpoint:m.relation,pageGoal:U,pageParams:{...b,pageSize:An},onLoad(_){W({target:{initialDataPath:["initialData",...X],modifiedDataPath:["modifiedData",...z],value:_}})},normalizeArguments:{mainFieldName:p.name,shouldAddLink:E,targetModel:O}},search:{endpoint:m.search,pageParams:{...b,entityId:i?void 0:r?o:S.id,pageSize:Ui}}}),Y=(0,e.useMemo)(()=>R.toLowerCase().includes("morph"),[R]),P=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(R),Z=(0,e.useMemo)(()=>Y?!0:i?!s:!c&&g||!s,[Y,i,s,c,g]),oe=_=>{const fe=$n(_,{mainFieldName:p.name,shouldAddLink:E,targetModel:O});$({name:f,value:fe,toOneRelation:P})},re=_=>{K({name:f,id:_.id})},me=()=>{L.fetchNextPage()},H=(_="")=>{const[fe,ze]=Qi(q,x()(S,f));N(_,{idsToInclude:ze,idsToOmit:fe})},ae=()=>{w.fetchNextPage()},Ie=_=>`${_+1} of ${q.length}`,Ne=(_,fe)=>{const ze=q[_];C(M({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:ze.mainField??ze.id,position:Ie(fe)})),G({name:f,newIndex:fe,oldIndex:_})},de=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:fe.mainField??fe.id,position:Ie(_)}))},ue=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:fe.mainField??fe.id,position:Ie(_)}))},Fe=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:fe.mainField??fe.id}))};if(!c&&i||!i&&!c&&!g)return e.createElement(y.X0,{name:f,intlLabel:l,labelAction:u});const Ce=q.length,De=(x()(S,X)??[]).length,Tt=L.data?.pages[0]?.pagination?.total??0,Re=!L.data&&Ce===De?Ce:Ce-De+Tt;return e.createElement(Bi,{error:t,canReorder:!P,description:a,disabled:Z,iconButtonAriaLabel:M({id:(0,h.OB)("components.RelationInput.icon-button-aria-label"),defaultMessage:"Drag"}),id:f,label:`${M({id:l.id,defaultMessage:l.defaultMessage})} ${Re>0?`(${Re})`:""}`,labelAction:u,labelLoadMore:i?null:M({id:(0,h.OB)("relation.loadMore"),defaultMessage:"Load More"}),labelDisconnectRelation:M({id:(0,h.OB)("relation.disconnect"),defaultMessage:"Remove"}),listAriaDescription:M({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"}),listHeight:320,liveText:D,loadingMessage:M({id:(0,h.OB)("relation.isLoading"),defaultMessage:"Relations are loading"}),name:f,noRelationsMessage:M({id:(0,h.OB)("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:An,onDropItem:ue,onGrabItem:de,onCancel:Fe,onRelationConnect:oe,onRelationDisconnect:re,onRelationLoadMore:me,onRelationReorder:Ne,onSearch:_=>H(_),onSearchNextPage:()=>ae(),placeholder:M(v||{id:(0,h.OB)("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[ct.DRAFT]:M({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ct.PUBLISHED]:M({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},relations:Pn()({...L,data:q},"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:k,searchResults:Hi(w,{mainFieldName:p.name}),size:T})};Zn.defaultProps={componentId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},Zn.propTypes={componentId:n().number,editable:n().bool,error:n().string,description:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,isCreatingEntry:n().bool.isRequired,isComponentRelation:n().bool,isFieldAllowed:n().bool,isFieldReadable:n().bool.isRequired,mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired}).isRequired,name:n().string.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,relationType:n().string.isRequired,size:n().number.isRequired,targetModel:n().string.isRequired,queryInfos:n().shape({defaultParams:n().shape({locale:n().string}),endpoints:n().shape({relation:n().string,search:n().string.isRequired}).isRequired,shouldDisplayRelationLink:n().bool.isRequired}).isRequired};const Ki=(0,e.memo)(Zn);var Yi=Ni(Ki,Wi);function Xi(t,o){return r=>{const s=o(r.keys);return e.createElement(t,{...r,...s})}}var Ji=Xi,_i=(t,o=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:o,hidden:o},key:"__enum_option_null",value:""},...t.map(r=>({metadatas:{intlLabel:{id:r,defaultMessage:r},hidden:!1,disabled:!1},key:r,value:r}))],el=d(59578),tl=d.n(el),nl=(t="")=>{switch(tl()(t)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return t;case"email":return"email";case"enumeration":return"select";case"password":return"password";case"string":return"text";case"text":return"textarea";case"media":case"file":case"files":return"media";case"json":return"json";case"wysiwyg":case"WYSIWYG":case"richtext":return"wysiwyg";case"uid":return"uid";default:return t||"text"}},ol=t=>{let o;return t==="float"||t==="decimal"?o=.01:o=1,o};function rl(t){const{createActionAllowedFields:o,formErrors:r,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:c,updateActionAllowedFields:g}=(0,y.Wq)(),u=(0,e.useMemo)(()=>s?o:g,[s,o,g]),p=(0,e.useMemo)(()=>s?[]:i,[s,i]),f=x()(a,t,null);return{allowedFields:u,formErrors:r,isCreatingEntry:s,onChange:l,readableFields:p,shouldNotRunValidations:c,value:f}}var sl=rl,Er=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];function Bn({allowedFields:t,componentUid:o,fieldSchema:r,formErrors:s,isCreatingEntry:a,keys:l,labelAction:i,metadatas:c,onChange:g,readableFields:u,shouldNotRunValidations:p,queryInfos:f,value:m,size:b,customFieldInputs:E}){const{fields:v}=(0,y.yX)(),{formatMessage:k}=(0,V.Z)(),{contentType:R}=(0,pe.PL)(),T=(0,e.useMemo)(()=>!x()(c,"editable",!0),[c]),{type:O,customField:D}=r,C=x()(s,[l],null),M=(0,e.useMemo)(()=>(0,h.Ts)(l),[l]),I=(0,e.useMemo)(()=>{const oe=ia()(r,p?[...Er,"required","minLength"]:Er),re=r.regex||null;if(re){const me=new RegExp(re);me&&(oe.regex=me)}return oe},[r,p]),S=(0,e.useMemo)(()=>x()(I,["required"],!1),[I]),B=(0,e.useMemo)(()=>{const oe=x()(R,["attributes"],{});return x()(oe,[M[0],"type"],null)==="dynamiczone"},[R,M]),$=(0,e.useMemo)(()=>nl(O),[O]),K=(0,e.useMemo)(()=>O==="media"&&!m?[]:m,[O,m]),W=(0,e.useMemo)(()=>ol(O),[O]),G=(0,e.useMemo)(()=>{const oe=M.join(".");if(t.includes(oe))return!0;if(B)return t.includes(M[0]);if(M.length>1){const me=xt()(M,M.length-1).join(".");return t.includes(me)}return!1},[t,M,B]),z=(0,e.useMemo)(()=>{const oe=M.join(".");if(u.includes(oe))return!0;if(B)return u.includes(M[0]);if(M.length>1){const me=xt()(M,M.length-1).join(".");return u.includes(me)}return!1},[u,M,B]),X=(0,e.useMemo)(()=>z||G,[G,z]),q=(0,e.useMemo)(()=>a?T:z&&!G?!0:T,[T,a,G,z]),U=(0,e.useMemo)(()=>_i(r.enum||[],S),[r,S]),{label:L,description:w,placeholder:N,visible:Y}=c,P=(0,e.useMemo)(()=>{if(!c.step||$!=="datetime"&&$!=="time")return W;if(!K)return c.step;let oe;return $==="datetime"?oe=parseInt(K.substr(14,2),10):$==="time"&&(oe=parseInt(K.slice(-2),10)),oe%c.step===0?c.step:W},[$,K,c.step,W]);if(Y===!1)return null;if(!X)return e.createElement(y.X0,{description:w?{id:w,defaultMessage:w}:null,intlLabel:{id:L,defaultMessage:L},labelAction:i,error:C&&k(C),name:l,required:S});if(O==="relation")return e.createElement(Yi,{...c,...r,componentUid:o,description:c.description?k({id:c.description,defaultMessage:c.description}):void 0,intlLabel:{id:c.label,defaultMessage:c.label},labelAction:i,isUserAllowedToEditField:G,isUserAllowedToReadField:z,name:l,placeholder:c.placeholder?{id:c.placeholder,defaultMessage:c.placeholder}:null,queryInfos:f,size:b,value:m,error:C&&k(C)});const Z={uid:Ti,media:v.media,wysiwyg:hi,...v,...E};return e.createElement(y.jm,{attribute:r,autoComplete:"new-password",intlLabel:{id:L,defaultMessage:L},isNullable:$==="bool"&&[null,void 0].includes(r.default),description:w?{id:w,defaultMessage:w}:null,disabled:q,error:C,labelAction:i,contentTypeUID:R.uid,customInputs:Z,multiple:r.multiple||!1,name:l,onChange:g,options:U,placeholder:N?{id:N,defaultMessage:N}:null,required:r.required||!1,step:P,type:D||$,value:K,withDefaultValue:!1})}Bn.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},Bn.propTypes={allowedFields:n().array.isRequired,componentUid:n().string,fieldSchema:n().object.isRequired,formErrors:n().object,keys:n().string.isRequired,isCreatingEntry:n().bool.isRequired,labelAction:n().element,metadatas:n().object.isRequired,onChange:n().func.isRequired,readableFields:n().array.isRequired,size:n().number,shouldNotRunValidations:n().bool.isRequired,value:n().any,queryInfos:n().shape({containsKey:n().string,defaultParams:n().object,endPoint:n().string}),customFieldInputs:n().object};const al=(0,e.memo)(Bn,xe());var qn=Ji(al,sl);const Lt=new Map;var Nn=(t=[])=>{const[o,r]=(0,e.useState)(Object.fromEntries(Lt)),s=t.filter(g=>!Lt.get(g)),[a,l]=(0,e.useState)(()=>!!s.length),i=(0,y.mZ)();(0,e.useEffect)(()=>{const g=p=>{r(p),l(!1)},u=async(p,f)=>{const m=await Promise.all(f);p.forEach((b,E)=>{Lt.set(b,m[E].default)}),g(Object.fromEntries(Lt))};if(s.length>0){l(!0);const p=s.reduce((f,m)=>{const b=i.get(m);return b&&f.push(b.components.Input()),f},[]);p.length>0&&u(s,p)}},[s,i]);const c=(0,e.useCallback)(()=>{Lt.clear(),r({})},[]);return{isLazyLoading:a,lazyComponentStore:o,cleanup:c}};const jn=({componentUid:t,isFromDynamicZone:o,isNested:r,name:s})=>{const{getComponentLayout:a}=(0,pe.PL)(),i=(0,e.useMemo)(()=>a(t),[t,a]).layouts.edit,{lazyComponentStore:c}=Nn();return e.createElement(A.x,{background:o?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:r,borderColor:r?"neutral200":""},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},i.map((g,u)=>e.createElement(ke.r,{gap:4,key:u},g.map(({name:p,size:f,metadatas:m,fieldSchema:b,queryInfos:E})=>{const v=b.type==="component",k=`${s}.${p}`;if(v){const R=b.component;return e.createElement(ge.P,{col:f,s:12,xs:12,key:p},e.createElement(Gt,{componentUid:R,intlLabel:{id:m.label,defaultMessage:m.label},isNested:!0,isRepeatable:b.repeatable,max:b.max,min:b.min,name:k,required:b.required||!1}))}return e.createElement(ge.P,{col:f,key:p,s:12,xs:12},e.createElement(qn,{componentUid:t,keys:k,fieldSchema:b,metadatas:m,queryInfos:E,size:f,customFieldInputs:c}))})))))};jn.defaultProps={isFromDynamicZone:!1,isNested:!1},jn.propTypes={componentUid:n().string.isRequired,isFromDynamicZone:n().bool,isNested:n().bool,name:n().string.isRequired};var il=jn,St=d(19406),ll=d(41119),vr=d.n(ll);const cl=j.ZP.span`
684
+ `,Fn=({canReorder:t,description:o,disabled:r,error:s,iconButtonAriaLabel:a,id:l,name:i,numberOfRelationsToDisplay:c,label:g,labelAction:u,labelLoadMore:p,labelDisconnectRelation:f,listAriaDescription:m,liveText:b,loadingMessage:E,onCancel:v,onDropItem:k,onGrabItem:R,noRelationsMessage:T,onRelationConnect:O,onRelationLoadMore:D,onRelationDisconnect:C,onRelationReorder:M,onSearchNextPage:I,onSearch:S,placeholder:B,publicationStateTranslations:$,required:K,relations:W,searchResults:G,size:z})=>{const[X,q]=(0,e.useState)(null),[U,L]=(0,e.useState)(""),w=(0,e.useRef)(),N=(0,e.useRef)(),{data:Y}=G,P=W.data,Z=P.length??0,oe=(0,e.useMemo)(()=>Z>c?Math.min(Z,c)*(Ht+bt)+Ht/2:Math.min(Z,c)*(Ht+bt),[Z,c]),re=!!p&&W.hasNextPage,me=(0,e.useMemo)(()=>Y.flat().filter(Boolean).map(_=>({..._,value:_.id,label:_.mainField})),[Y]);(0,e.useEffect)(()=>{if(Z<=c)return L("");const _=ze=>{const No=ze.target.parentNode.scrollHeight,at=ze.target.scrollHeight-ze.target.scrollTop;return ze.target.scrollTop===0?L("bottom"):L(at===No?"top":"top-bottom")},fe=N?.current;return!W.isLoading&&P.length>0&&fe&&N.current.addEventListener("scroll",_),()=>{fe&&fe.removeEventListener("scroll",_)}},[W,P,c,Z]);const[H,ae]=(0,e.useState)(!1),Pe=(0,e.useRef)(),Ne=(0,e.useRef)([]);(0,e.useEffect)(()=>(me.length>0&&Ne.current.length===0&&ae(_=>(_&&(Pe.current=setTimeout(()=>{ae(!0)},10)),!1)),()=>{Ne.current=me||[]}),[me]),(0,e.useEffect)(()=>()=>{Pe.current&&clearTimeout(Pe.current)},[]);const de=()=>{ae(!1)},ue=()=>{ae(!0),S()},Fe=(_,fe)=>{M&&_>=0&&_<P.length&&M(fe,_)},Re=(0,pe.zH)(P.length),ke=(0,e.useRef)(),Tt=()=>{ke.current="loadMore",D()};(0,e.useEffect)(()=>{ke.current==="onChange"&&P.length!==Re?w.current.scrollToItem(P.length,"end"):ke.current==="loadMore"&&P.length!==Re&&w.current.scrollToItem(0,"start"),ke.current=void 0},[Re,P]);const Me=`${i}-item-instructions`;return e.createElement(Ii.g,{error:s,name:i,hint:o,id:l,required:K},e.createElement(On,{totalNumberOfRelations:Z,size:z,search:e.createElement(e.Fragment,null,e.createElement(Pi.Q,{action:u},g),e.createElement(y.JV,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:pr},options:me,isDisabled:r,isLoading:G.isLoading,error:s,inputId:l,isSearchable:!0,isClear:!0,loadingMessage:()=>E,onChange:_=>{q(null),O(_),ke.current="onChange"},onInputChange:_=>{q(_),S(_)},onMenuClose:de,onMenuOpen:ue,menuIsOpen:H,noOptionsMessage:()=>T,onMenuScrollToBottom:()=>{G.hasNextPage&&I()},placeholder:B,name:i,value:X})),loadMore:re&&e.createElement(lr.A,{disabled:W.isLoading||W.isFetchingNextPage,onClick:Tt,loading:W.isLoading||W.isFetchingNextPage,startIcon:e.createElement(sr.Z,null)},p)},P.length>0&&e.createElement(xn,{overflow:U},e.createElement(ht.T,{id:Me},m),e.createElement(ht.T,{"aria-live":"assertive"},b),e.createElement(Di.t7,{height:oe,ref:w,outerRef:N,itemCount:Z,itemSize:Ht+bt,itemData:{name:i,ariaDescribedBy:Me,canDrag:t,disabled:r,handleCancel:v,handleDropItem:k,handleGrabItem:R,iconButtonAriaLabel:a,labelDisconnectRelation:f,onRelationDisconnect:C,publicationStateTranslations:$,relations:P,updatePositionOfRelation:Fe},itemKey:_=>`${P[_].mainField}_${P[_].id}`,innerElementType:"ol"},Ln)),(o||s)&&e.createElement(A.x,{paddingTop:2},e.createElement(Oi.J,null),e.createElement(wi.c,null))))},Ai=n().shape({data:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),hasNextPage:n().bool,isFetchingNextPage:n().bool.isRequired,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired}),$i=n().shape({data:n().arrayOf(n().shape({id:n().number.isRequired,href:n().string,mainField:n().oneOfType([n().string,n().number]),publicationState:n().oneOfType([n().string,n().bool])})),hasNextPage:n().bool,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired});Fn.defaultProps={canReorder:!1,description:void 0,disabled:!1,error:void 0,labelAction:null,labelLoadMore:null,liveText:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,required:!1,relations:{data:[]},searchResults:{data:[]}},Fn.propTypes={error:n().string,canReorder:n().bool,description:n().string,disabled:n().bool,iconButtonAriaLabel:n().string.isRequired,id:n().string.isRequired,label:n().string.isRequired,labelAction:n().element,labelLoadMore:n().string,labelDisconnectRelation:n().string.isRequired,listAriaDescription:n().string.isRequired,liveText:n().string,loadingMessage:n().string.isRequired,name:n().string.isRequired,noRelationsMessage:n().string.isRequired,numberOfRelationsToDisplay:n().number.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,onRelationConnect:n().func.isRequired,onRelationDisconnect:n().func.isRequired,onRelationLoadMore:n().func.isRequired,onRelationReorder:n().func.isRequired,onSearch:n().func.isRequired,onSearchNextPage:n().func.isRequired,placeholder:n().string.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,required:n().bool,searchResults:$i,size:n().number.isRequired,relations:Ai};const Ln=({data:t,index:o,style:r})=>{const{ariaDescribedBy:s,canDrag:a,disabled:l,handleCancel:i,handleDropItem:c,handleGrabItem:g,iconButtonAriaLabel:u,name:p,labelDisconnectRelation:f,onRelationDisconnect:m,publicationStateTranslations:b,relations:E,updatePositionOfRelation:v}=t,{publicationState:k,href:R,mainField:T,id:O}=E[o],D=k==="draft"?"secondary":"success";return e.createElement(wn,{ariaDescribedBy:s,canDrag:a,disabled:l,displayValue:String(T??O),iconButtonAriaLabel:u,id:O,index:o,name:p,endAction:e.createElement(fr,{"data-testid":`remove-relation-${O}`,disabled:l,type:"button",onClick:()=>m(E[o]),"aria-label":f},e.createElement(cr.J,{width:"12px",as:Vt.Z})),onCancel:i,onDropItem:c,onGrabItem:g,status:k||void 0,style:{...r,bottom:r.bottom??0+bt,height:r.height??0-bt},updatePositionOfRelation:v},e.createElement(A.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(Ut.u,{description:T??`${O}`},R?e.createElement(gr,{to:R},T??O):e.createElement(Q.Z,{textColor:l?"neutral600":"primary600",ellipsis:!0},T??O))),k&&e.createElement(Pn.q,{variant:D,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${D}700`},b[k])))};Ln.defaultProps={data:{}},Ln.propTypes={data:n().shape({ariaDescribedBy:n().string.isRequired,canDrag:n().bool.isRequired,disabled:n().bool.isRequired,handleCancel:n().func,handleDropItem:n().func,handleGrabItem:n().func,iconButtonAriaLabel:n().string.isRequired,labelDisconnectRelation:n().string.isRequired,name:n().string.isRequired,onRelationDisconnect:n().func.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,relations:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),updatePositionOfRelation:n().func.isRequired}),index:n().number.isRequired,style:n().object.isRequired};var Zi=Fn,Xe=d(20108);function Bi(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var qi=Bi;function Ni({componentUid:t,isUserAllowedToEditField:o,isUserAllowedToReadField:r,name:s,queryInfos:a}){const{isCreatingEntry:l,createActionAllowedFields:i,readActionAllowedFields:c,updateActionAllowedFields:g,slug:u,modifiedData:p}=(0,y.Wq)(),f=(0,e.useMemo)(()=>o===!0?!0:(l?i:g).includes(s),[l,i,s,o,g]),m=(0,e.useMemo)(()=>r?!0:(l?[]:c).includes(s),[l,r,s,c]),b=s.split(".");let E;t&&(E=x()(p,b.slice(0,-1))?.id);const v=(0,e.useMemo)(()=>l?null:t?E?(0,h.IF)(`relations/${t}/${E}/${b.at(-1)}`):null:(0,h.IF)(`relations/${u}/${p.id}/${s.split(".").at(-1)}`),[l,t,u,p.id,s,E,b]),k=(0,e.useMemo)(()=>t?(0,h.IF)(`relations/${t}/${s.split(".").at(-1)}`):(0,h.IF)(`relations/${u}/${s.split(".").at(-1)}`),[t,u,s]);return{componentId:E,isComponentRelation:Boolean(t),queryInfos:{...a,endpoints:{search:k,relation:v}},isCreatingEntry:l,isFieldAllowed:f,isFieldReadable:m}}var ji=Ni;function Wi(t,o){return`${(0,h.IF)(`collectionType/${t}/${o??""}`)}`}const ct={DRAFT:"draft",PUBLISHED:"published"},Sn=5,zi=10,An=(t,{shouldAddLink:o,mainFieldName:r,targetModel:s})=>{const a={...t};return o&&(a.href=Wi(s,a.id)),a.publicationState=!1,a?.publishedAt!==void 0&&(a.publicationState=a.publishedAt?ct.PUBLISHED:ct.DRAFT),a.mainField=a[r],a},Ui=(t,{shouldAddLink:o=!1,mainFieldName:r,targetModel:s}={})=>[...t].map(a=>An(a,{shouldAddLink:o,mainFieldName:r,targetModel:s})),Vi=(t,{mainFieldName:o})=>{const{data:r}=t,{pages:s=[]}=r??{};return{...t,data:s.map(a=>a?.results.map(l=>An(l,{mainFieldName:o}))).filter(Boolean).flat()}},Hi=(t=[],o=[])=>{const r=t.reduce((a,l)=>o.find(i=>i.id===l.id)?a:[...a,l.id],[]),s=o.reduce((a,l)=>t.find(i=>i.id===l.id)?a:[...a,l.id],[]);return[r,s]},Qi=(t,{relation:o,search:r})=>{const[s,a]=(0,e.useState)({}),[l,i]=(0,e.useState)(0),{get:c}=(0,y.kY)(),g=async({pageParam:C=1})=>{try{const{data:M}=await c(o?.endpoint,{params:{...o.pageParams??{},page:C}});return i(C),M}catch{return null}},u=async({pageParam:C=1})=>{try{const{data:M}=await c(r.endpoint,{params:{...r.pageParams??{},...s,page:C}});return M}catch{return null}},{onLoad:p,normalizeArguments:f={}}=o,m=(0,Xe.useInfiniteQuery)(["relation",...t],g,{cacheTime:0,enabled:o.enabled,getNextPageParam(C){const M=!C?.pagination;if(!(!C||M||C?.pagination.page>=C?.pagination.pageCount))return C.pagination.page+1},select:C=>({...C,pages:C.pages.map(M=>{if(!M)return M;const{data:I,results:S,pagination:B}=M,$=!!I;let K=[];return $?K=[I]:S&&(K=[...S].reverse()),{pagination:B,results:K}})})}),{pageGoal:b}=o,{status:E,data:v,fetchNextPage:k,hasNextPage:R}=m;(0,e.useEffect)(()=>{b>l&&R&&E==="success"&&k({pageParam:l+1})},[b,l,k,R,E]);const T=(0,y.W6)(p);(0,e.useEffect)(()=>{if(E==="success"&&v&&v.pages?.at(-1)?.results&&T){const C=Ui(v.pages.at(-1).results,f);T(C)}},[E,T,v]);const O=(0,Xe.useInfiniteQuery)(["relation",...t,"search",JSON.stringify(s)],u,{enabled:Object.keys(s).length>0,getNextPageParam(C){if(!(!C?.pagination||C.pagination.page>=C.pagination.pageCount))return C.pagination.page+1}});return{relations:m,search:O,searchFor:(C,M={})=>{a({...M,_q:C})}}},hr=(t,o)=>r=>{const s=r.split(".");return s.reduce((a,l,i)=>{const c=x()(t,a),g=x()(o,[...s.slice(0,i),l,"__temp_key__"]);if(Array.isArray(c)&&typeof g=="number"){const u=c.findIndex(p=>p.__temp_key__===g);return a.push(u.toString()),a}return a.push(l),a},[])},$n=({error:t,componentId:o,isComponentRelation:r,editable:s,description:a,intlLabel:l,isCreatingEntry:i,isFieldAllowed:c,isFieldReadable:g,labelAction:u,mainField:p,name:f,queryInfos:{endpoints:m,defaultParams:b,shouldDisplayRelationLink:E},placeholder:v,required:k,relationType:R,size:T,targetModel:O})=>{const[D,C]=(0,e.useState)(""),{formatMessage:M}=(0,V.Z)(),{slug:I,initialData:S,modifiedData:B,relationConnect:$,relationDisconnect:K,relationLoad:W,relationReorder:G}=(0,y.Wq)(),z=f.split("."),X=hr(S,B)(f),q=x()(B,f,[]),U=Math.ceil(x()(S,f,[]).length/Sn),{relations:L,search:w,searchFor:N}=Qi([I,X.join("."),B.id,b],{relation:{enabled:!!m.relation,endpoint:m.relation,pageGoal:U,pageParams:{...b,pageSize:Sn},onLoad(_){W({target:{initialDataPath:["initialData",...X],modifiedDataPath:["modifiedData",...z],value:_}})},normalizeArguments:{mainFieldName:p.name,shouldAddLink:E,targetModel:O}},search:{endpoint:m.search,pageParams:{...b,entityId:i?void 0:r?o:S.id,pageSize:zi}}}),Y=(0,e.useMemo)(()=>R.toLowerCase().includes("morph"),[R]),P=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(R),Z=(0,e.useMemo)(()=>Y?!0:i?!s:!c&&g||!s,[Y,i,s,c,g]),oe=_=>{const fe=An(_,{mainFieldName:p.name,shouldAddLink:E,targetModel:O});$({name:f,value:fe,toOneRelation:P})},re=_=>{K({name:f,id:_.id})},me=()=>{L.fetchNextPage()},H=(_="")=>{const[fe,ze]=Hi(q,x()(S,f));N(_,{idsToInclude:ze,idsToOmit:fe})},ae=()=>{w.fetchNextPage()},Pe=_=>`${_+1} of ${q.length}`,Ne=(_,fe)=>{const ze=q[_];C(M({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:ze.mainField??ze.id,position:Pe(fe)})),G({name:f,newIndex:fe,oldIndex:_})},de=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:fe.mainField??fe.id,position:Pe(_)}))},ue=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:fe.mainField??fe.id,position:Pe(_)}))},Fe=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:fe.mainField??fe.id}))};if(!c&&i||!i&&!c&&!g)return e.createElement(y.X0,{name:f,intlLabel:l,labelAction:u});const Re=q.length,ke=(x()(S,X)??[]).length,Tt=L.data?.pages[0]?.pagination?.total??0,Me=!L.data&&Re===ke?Re:Re-ke+Tt;return e.createElement(Zi,{error:t,canReorder:!P,description:a,disabled:Z,iconButtonAriaLabel:M({id:(0,h.OB)("components.RelationInput.icon-button-aria-label"),defaultMessage:"Drag"}),id:f,label:`${M({id:l.id,defaultMessage:l.defaultMessage})} ${Me>0?`(${Me})`:""}`,labelAction:u,labelLoadMore:i?null:M({id:(0,h.OB)("relation.loadMore"),defaultMessage:"Load More"}),labelDisconnectRelation:M({id:(0,h.OB)("relation.disconnect"),defaultMessage:"Remove"}),listAriaDescription:M({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"}),listHeight:320,liveText:D,loadingMessage:M({id:(0,h.OB)("relation.isLoading"),defaultMessage:"Relations are loading"}),name:f,noRelationsMessage:M({id:(0,h.OB)("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:Sn,onDropItem:ue,onGrabItem:de,onCancel:Fe,onRelationConnect:oe,onRelationDisconnect:re,onRelationLoadMore:me,onRelationReorder:Ne,onSearch:_=>H(_),onSearchNextPage:()=>ae(),placeholder:M(v||{id:(0,h.OB)("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[ct.DRAFT]:M({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ct.PUBLISHED]:M({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},relations:In()({...L,data:q},"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:k,searchResults:Vi(w,{mainFieldName:p.name}),size:T})};$n.defaultProps={componentId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},$n.propTypes={componentId:n().number,editable:n().bool,error:n().string,description:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,isCreatingEntry:n().bool.isRequired,isComponentRelation:n().bool,isFieldAllowed:n().bool,isFieldReadable:n().bool.isRequired,mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired}).isRequired,name:n().string.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,relationType:n().string.isRequired,size:n().number.isRequired,targetModel:n().string.isRequired,queryInfos:n().shape({defaultParams:n().shape({locale:n().string}),endpoints:n().shape({relation:n().string,search:n().string.isRequired}).isRequired,shouldDisplayRelationLink:n().bool.isRequired}).isRequired};const Gi=(0,e.memo)($n);var Ki=qi(Gi,ji);function Yi(t,o){return r=>{const s=o(r.keys);return e.createElement(t,{...r,...s})}}var Xi=Yi,Ji=(t,o=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:o,hidden:o},key:"__enum_option_null",value:""},...t.map(r=>({metadatas:{intlLabel:{id:r,defaultMessage:r},hidden:!1,disabled:!1},key:r,value:r}))],_i=d(59578),el=d.n(_i),tl=(t="")=>{switch(el()(t)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return t;case"email":return"email";case"enumeration":return"select";case"password":return"password";case"string":return"text";case"text":return"textarea";case"media":case"file":case"files":return"media";case"json":return"json";case"wysiwyg":case"WYSIWYG":case"richtext":return"wysiwyg";case"uid":return"uid";default:return t||"text"}},nl=t=>{let o;return t==="float"||t==="decimal"?o=.01:o=1,o};function ol(t){const{createActionAllowedFields:o,formErrors:r,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:c,updateActionAllowedFields:g}=(0,y.Wq)(),u=(0,e.useMemo)(()=>s?o:g,[s,o,g]),p=(0,e.useMemo)(()=>s?[]:i,[s,i]),f=x()(a,t,null);return{allowedFields:u,formErrors:r,isCreatingEntry:s,onChange:l,readableFields:p,shouldNotRunValidations:c,value:f}}var rl=ol,yr=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];function Zn({allowedFields:t,componentUid:o,fieldSchema:r,formErrors:s,isCreatingEntry:a,keys:l,labelAction:i,metadatas:c,onChange:g,readableFields:u,shouldNotRunValidations:p,queryInfos:f,value:m,size:b,customFieldInputs:E}){const{fields:v}=(0,y.yX)(),{formatMessage:k}=(0,V.Z)(),{contentType:R}=(0,pe.PL)(),T=(0,e.useMemo)(()=>!x()(c,"editable",!0),[c]),{type:O,customField:D}=r,C=x()(s,[l],null),M=(0,e.useMemo)(()=>(0,h.Ts)(l),[l]),I=(0,e.useMemo)(()=>{const oe=sa()(r,p?[...yr,"required","minLength"]:yr),re=r.regex||null;if(re){const me=new RegExp(re);me&&(oe.regex=me)}return oe},[r,p]),S=(0,e.useMemo)(()=>x()(I,["required"],!1),[I]),B=(0,e.useMemo)(()=>{const oe=x()(R,["attributes"],{});return x()(oe,[M[0],"type"],null)==="dynamiczone"},[R,M]),$=(0,e.useMemo)(()=>tl(O),[O]),K=(0,e.useMemo)(()=>O==="media"&&!m?[]:m,[O,m]),W=(0,e.useMemo)(()=>nl(O),[O]),G=(0,e.useMemo)(()=>{const oe=M.join(".");if(t.includes(oe))return!0;if(B)return t.includes(M[0]);if(M.length>1){const me=xt()(M,M.length-1).join(".");return t.includes(me)}return!1},[t,M,B]),z=(0,e.useMemo)(()=>{const oe=M.join(".");if(u.includes(oe))return!0;if(B)return u.includes(M[0]);if(M.length>1){const me=xt()(M,M.length-1).join(".");return u.includes(me)}return!1},[u,M,B]),X=(0,e.useMemo)(()=>z||G,[G,z]),q=(0,e.useMemo)(()=>a?T:z&&!G?!0:T,[T,a,G,z]),U=(0,e.useMemo)(()=>Ji(r.enum||[],S),[r,S]),{label:L,description:w,placeholder:N,visible:Y}=c,P=(0,e.useMemo)(()=>{if(!c.step||$!=="datetime"&&$!=="time")return W;if(!K)return c.step;let oe;return $==="datetime"?oe=parseInt(K.substr(14,2),10):$==="time"&&(oe=parseInt(K.slice(-2),10)),oe%c.step===0?c.step:W},[$,K,c.step,W]);if(Y===!1)return null;if(!X)return e.createElement(y.X0,{description:w?{id:w,defaultMessage:w}:null,intlLabel:{id:L,defaultMessage:L},labelAction:i,error:C&&k(C),name:l,required:S});if(O==="relation")return e.createElement(Ki,{...c,...r,componentUid:o,description:c.description?k({id:c.description,defaultMessage:c.description}):void 0,intlLabel:{id:c.label,defaultMessage:c.label},labelAction:i,isUserAllowedToEditField:G,isUserAllowedToReadField:z,name:l,placeholder:c.placeholder?{id:c.placeholder,defaultMessage:c.placeholder}:null,queryInfos:f,size:b,value:m,error:C&&k(C)});const Z={uid:Mi,media:v.media,wysiwyg:fi,...v,...E};return e.createElement(y.jm,{attribute:r,autoComplete:"new-password",intlLabel:{id:L,defaultMessage:L},isNullable:$==="bool"&&[null,void 0].includes(r.default),description:w?{id:w,defaultMessage:w}:null,disabled:q,error:C,labelAction:i,contentTypeUID:R.uid,customInputs:Z,multiple:r.multiple||!1,name:l,onChange:g,options:U,placeholder:N?{id:N,defaultMessage:N}:null,required:r.required||!1,step:P,type:D||$,value:K,withDefaultValue:!1})}Zn.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},Zn.propTypes={allowedFields:n().array.isRequired,componentUid:n().string,fieldSchema:n().object.isRequired,formErrors:n().object,keys:n().string.isRequired,isCreatingEntry:n().bool.isRequired,labelAction:n().element,metadatas:n().object.isRequired,onChange:n().func.isRequired,readableFields:n().array.isRequired,size:n().number,shouldNotRunValidations:n().bool.isRequired,value:n().any,queryInfos:n().shape({containsKey:n().string,defaultParams:n().object,endPoint:n().string}),customFieldInputs:n().object};const sl=(0,e.memo)(Zn,Ce());var Bn=Xi(sl,rl);const Lt=new Map;var qn=(t=[])=>{const[o,r]=(0,e.useState)(Object.fromEntries(Lt)),s=t.filter(g=>!Lt.get(g)),[a,l]=(0,e.useState)(()=>!!s.length),i=(0,y.mZ)();(0,e.useEffect)(()=>{const g=p=>{r(p),l(!1)},u=async(p,f)=>{const m=await Promise.all(f);p.forEach((b,E)=>{Lt.set(b,m[E].default)}),g(Object.fromEntries(Lt))};if(s.length>0){l(!0);const p=s.reduce((f,m)=>{const b=i.get(m);return b&&f.push(b.components.Input()),f},[]);p.length>0&&u(s,p)}},[s,i]);const c=(0,e.useCallback)(()=>{Lt.clear(),r({})},[]);return{isLazyLoading:a,lazyComponentStore:o,cleanup:c}};const Nn=({componentUid:t,isFromDynamicZone:o,isNested:r,name:s})=>{const{getComponentLayout:a}=(0,pe.PL)(),i=(0,e.useMemo)(()=>a(t),[t,a]).layouts.edit,{lazyComponentStore:c}=qn();return e.createElement(A.x,{background:o?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:r,borderColor:r?"neutral200":""},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},i.map((g,u)=>e.createElement(Ie.r,{gap:4,key:u},g.map(({name:p,size:f,metadatas:m,fieldSchema:b,queryInfos:E})=>{const v=b.type==="component",k=`${s}.${p}`;if(v){const R=b.component;return e.createElement(ge.P,{col:f,s:12,xs:12,key:p},e.createElement(Qt,{componentUid:R,intlLabel:{id:m.label,defaultMessage:m.label},isNested:!0,isRepeatable:b.repeatable,max:b.max,min:b.min,name:k,required:b.required||!1}))}return e.createElement(ge.P,{col:f,key:p,s:12,xs:12},e.createElement(Bn,{componentUid:t,keys:k,fieldSchema:b,metadatas:m,queryInfos:E,size:f,customFieldInputs:c}))})))))};Nn.defaultProps={isFromDynamicZone:!1,isNested:!1},Nn.propTypes={componentUid:n().string.isRequired,isFromDynamicZone:n().bool,isNested:n().bool,name:n().string.isRequired};var al=Nn,St=d(19406),il=d(41119),br=d.n(il);const ll=j.ZP.span`
685
685
  display: block;
686
686
  background-color: ${({theme:t})=>t.colors.primary100};
687
687
  outline: 1px dashed ${({theme:t})=>t.colors.primary500};
688
688
  outline-offset: -1px;
689
689
  padding: ${({theme:t})=>t.spaces[6]};
690
- `;var dl=()=>e.createElement(cl,{padding:6,background:"primary100"});const ul=(0,j.ZP)(be.h)`
690
+ `;var cl=()=>e.createElement(ll,{padding:6,background:"primary100"});const dl=(0,j.ZP)(be.h)`
691
691
  background-color: transparent;
692
692
 
693
693
  svg {
@@ -703,7 +703,7 @@ ${t}
703
703
  }
704
704
  }
705
705
  }
706
- `,ml=(0,j.ZP)(F.k)`
706
+ `,ul=(0,j.ZP)(F.k)`
707
707
  & .drag-handle {
708
708
  background: unset;
709
709
 
@@ -722,13 +722,13 @@ ${t}
722
722
  }
723
723
  }
724
724
  }
725
- `,Wn=({componentFieldName:t,componentUid:o,fields:r,index:s,isOpen:a,isReadOnly:l,mainField:i,moveComponentField:c,onClickToggle:g,toggleCollapses:u,onGrabItem:p,onDropItem:f,onCancel:m})=>{const{modifiedData:b,removeRepeatableField:E,triggerFormValidation:v}=(0,y.Wq)(),k=vr()(x()(b,[...t.split("."),i],"")),R=(0,e.useRef)(null),{formatMessage:T}=(0,V.Z)(),O=t.split(".").slice(0,-1).join("."),[{handlerId:D,isDragging:C,handleKeyDown:M},I,S,B,$]=(0,mr.Y)(!l,{type:`${h._Q.COMPONENT}_${O}`,index:s,item:{displayedValue:k},onMoveItem:c,onStart(){u()},onEnd(){v()},onGrabItem:p,onDropItem:f,onCancel:m});(0,e.useEffect)(()=>{$((0,wt.rX)(),{captureDraggingState:!1})},[$,s]);const K=(0,h.FE)(R,B),W=(0,h.FE)(I,S),{lazyComponentStore:G}=Nn();return e.createElement(A.x,{ref:W},C?e.createElement(dl,null):e.createElement(un.U,{expanded:a,onToggle:g,id:t,size:"S"},e.createElement(mn.B,{action:l?null:e.createElement(ml,{gap:0,expanded:a},e.createElement(ul,{expanded:a,noBorder:!0,onClick:()=>{E(t),u()},label:T({id:(0,h.OB)("containers.Edit.delete"),defaultMessage:"Delete"}),icon:e.createElement(Ye.Z,null)}),e.createElement(be.h,{className:"drag-handle",ref:K,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:z=>z.stopPropagation(),"data-handler-id":D,label:T({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:M},e.createElement(nt.Z,null))),title:k,togglePosition:"left"}),e.createElement(pn.v,null,e.createElement(F.k,{direction:"column",alignItems:"stretch",background:"neutral100",padding:6,gap:6},r.map((z,X)=>e.createElement(ke.r,{gap:4,key:X},z.map(({name:q,fieldSchema:U,metadatas:L,queryInfos:w,size:N})=>{const Y=U.type==="component",P=`${t}.${q}`;if(Y){const Z=U.component;return e.createElement(ge.P,{col:N,s:12,xs:12,key:q},e.createElement(Gt,{componentUid:Z,intlLabel:{id:L.label,defaultMessage:L.label},isRepeatable:U.repeatable,isNested:!0,name:P,max:U.max,min:U.min,required:U.required}))}return e.createElement(ge.P,{key:P,col:N,s:12,xs:12},e.createElement(qn,{componentUid:o,fieldSchema:U,keys:P,metadatas:L,queryInfos:w,size:N,customFieldInputs:G}))})))))))};Wn.defaultProps={componentUid:void 0,fields:[],isReadOnly:!1,isOpen:!1,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0,toggleCollapses(){}},Wn.propTypes={componentFieldName:n().string.isRequired,componentUid:n().string,fields:n().array,index:n().number.isRequired,isOpen:n().bool,isReadOnly:n().bool,mainField:n().string.isRequired,moveComponentField:n().func.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onClickToggle:n().func.isRequired,toggleCollapses:n().func};var pl=(0,e.memo)(Wn),Cr=d(861);const gl=(0,j.ZP)(A.x)`
725
+ `,jn=({componentFieldName:t,componentUid:o,fields:r,index:s,isOpen:a,isReadOnly:l,mainField:i,moveComponentField:c,onClickToggle:g,toggleCollapses:u,onGrabItem:p,onDropItem:f,onCancel:m})=>{const{modifiedData:b,removeRepeatableField:E,triggerFormValidation:v}=(0,y.Wq)(),k=br()(x()(b,[...t.split("."),i],"")),R=(0,e.useRef)(null),{formatMessage:T}=(0,V.Z)(),O=t.split(".").slice(0,-1).join("."),[{handlerId:D,isDragging:C,handleKeyDown:M},I,S,B,$]=(0,dr.Y)(!l,{type:`${h._Q.COMPONENT}_${O}`,index:s,item:{displayedValue:k},onMoveItem:c,onStart(){u()},onEnd(){v()},onGrabItem:p,onDropItem:f,onCancel:m});(0,e.useEffect)(()=>{$((0,wt.rX)(),{captureDraggingState:!1})},[$,s]);const K=(0,h.FE)(R,B),W=(0,h.FE)(I,S),{lazyComponentStore:G}=qn();return e.createElement(A.x,{ref:W},C?e.createElement(cl,null):e.createElement(dn.U,{expanded:a,onToggle:g,id:t,size:"S"},e.createElement(un.B,{action:l?null:e.createElement(ul,{gap:0,expanded:a},e.createElement(dl,{expanded:a,noBorder:!0,onClick:()=>{E(t),u()},label:T({id:(0,h.OB)("containers.Edit.delete"),defaultMessage:"Delete"}),icon:e.createElement(Ye.Z,null)}),e.createElement(be.h,{className:"drag-handle",ref:K,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:z=>z.stopPropagation(),"data-handler-id":D,label:T({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:M},e.createElement(nt.Z,null))),title:k,togglePosition:"left"}),e.createElement(mn.v,null,e.createElement(F.k,{direction:"column",alignItems:"stretch",background:"neutral100",padding:6,gap:6},r.map((z,X)=>e.createElement(Ie.r,{gap:4,key:X},z.map(({name:q,fieldSchema:U,metadatas:L,queryInfos:w,size:N})=>{const Y=U.type==="component",P=`${t}.${q}`;if(Y){const Z=U.component;return e.createElement(ge.P,{col:N,s:12,xs:12,key:q},e.createElement(Qt,{componentUid:Z,intlLabel:{id:L.label,defaultMessage:L.label},isRepeatable:U.repeatable,isNested:!0,name:P,max:U.max,min:U.min,required:U.required}))}return e.createElement(ge.P,{key:P,col:N,s:12,xs:12},e.createElement(Bn,{componentUid:o,fieldSchema:U,keys:P,metadatas:L,queryInfos:w,size:N,customFieldInputs:G}))})))))))};jn.defaultProps={componentUid:void 0,fields:[],isReadOnly:!1,isOpen:!1,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0,toggleCollapses(){}},jn.propTypes={componentFieldName:n().string.isRequired,componentUid:n().string,fields:n().array,index:n().number.isRequired,isOpen:n().bool,isReadOnly:n().bool,mainField:n().string.isRequired,moveComponentField:n().func.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onClickToggle:n().func.isRequired,toggleCollapses:n().func};var ml=(0,e.memo)(jn),Er=d(861);const pl=(0,j.ZP)(A.x)`
726
726
  overflow: hidden;
727
727
  border-bottom: 1px solid ${({theme:t})=>t.colors.neutral200};
728
728
  border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
729
729
  border-left: 1px solid ${({theme:t})=>t.colors.neutral200};
730
730
  border-radius: 0 0 ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius};
731
- `,fl=(0,j.ZP)(A.x)`
731
+ `,gl=(0,j.ZP)(A.x)`
732
732
  border-bottom: none;
733
733
 
734
734
  /* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
@@ -757,7 +757,7 @@ ${t}
757
757
  & > div > div[data-strapi-expanded='true'] {
758
758
  border: 1px solid ${({theme:t})=>t.colors.primary600};
759
759
  }
760
- `,zn=({children:t,error:o})=>{const{formatMessage:r}=(0,V.Z)();return e.createElement(Cr.k,{attributeName:"data-strapi-accordion-toggle"},t,o&&e.createElement(A.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600"},r({id:o.id,defaultMessage:o.defaultMessage},{...o.values}))))};zn.defaultProps={error:void 0},zn.propTypes={children:n().node.isRequired,error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object})};function hl(t,o={}){return Object.keys(o).filter(r=>r.startsWith(t)).map(r=>r.split(".").slice(0,t.split(".").length+1).join("."))}const yl=(0,j.ZP)(dr.A)`
760
+ `,Wn=({children:t,error:o})=>{const{formatMessage:r}=(0,V.Z)();return e.createElement(Er.k,{attributeName:"data-strapi-accordion-toggle"},t,o&&e.createElement(A.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600"},r({id:o.id,defaultMessage:o.defaultMessage},{...o.values}))))};Wn.defaultProps={error:void 0},Wn.propTypes={children:n().node.isRequired,error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object})};function fl(t,o={}){return Object.keys(o).filter(r=>r.startsWith(t)).map(r=>r.split(".").slice(0,t.split(".").length+1).join("."))}const hl=(0,j.ZP)(lr.A)`
761
761
  height: 100%;
762
762
  width: 100%;
763
763
  border-radius: 0 0 4px 4px;
@@ -767,7 +767,7 @@ ${t}
767
767
  font-weight: 600;
768
768
  font-size: 14px;
769
769
  }
770
- `,Un=({componentUid:t,componentValue:o,componentValueLength:r,isReadOnly:s,max:a,min:l,name:i})=>{const{addRepeatableComponentToField:c,formErrors:g,moveComponentField:u}=(0,y.Wq)(),p=(0,y.lm)(),{formatMessage:f}=(0,V.Z)(),[m,b]=(0,e.useState)(""),[E,v]=(0,e.useState)(""),{getComponentLayout:k,components:R}=(0,pe.PL)(),T=(0,e.useMemo)(()=>k(t),[t,k]),O=(0,e.useMemo)(()=>(0,h.Uo)(o||[])+1,[o]),D=hl(i,g),C=l-r,M=x()(g,i,{id:""}).id.includes("min"),I=()=>{b("")},S=()=>{s||(r<a?(c(i,T,R,M),b(O)):r>=a&&p({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}}))},B=(L,w)=>{v(f({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${i}.${w}`,position:W(L)})),u({name:i,newIndex:L,currentIndex:w})},$=x()(T,["settings","mainField"],"id"),K=L=>()=>{b(m===L?"":L)},W=L=>`${L+1} of ${r}`,G=L=>{v(f({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${i}.${L}`}))},z=L=>{v(f({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${i}.${L}`,position:W(L)}))},X=L=>{v(f({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${i}.${L}`,position:W(L)}))};let q=g[i];if(M?q={id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:C}}:D.some(L=>L.split(".").length>1)&&!M&&(q={id:(0,h.OB)("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r===0)return e.createElement(Vo,{error:q,isReadOnly:s,onClick:S});const U=`${i}-item-instructions`;return e.createElement(A.x,{hasRadius:!0},e.createElement(ht.T,{id:U},f({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ht.T,{"aria-live":"assertive"},E),e.createElement(zn,{error:q,ariaDescribedBy:U},e.createElement(fl,{"aria-describedby":U},o.map(({__temp_key__:L},w)=>e.createElement(pl,{componentFieldName:`${i}.${w}`,componentUid:t,fields:T.layouts.edit,key:L,index:w,isOpen:m===L,isReadOnly:s,mainField:$,moveComponentField:B,onClickToggle:K(L),toggleCollapses:I,onCancel:G,onDropItem:X,onGrabItem:z}))),e.createElement(gl,null,e.createElement(F.k,{justifyContent:"center",height:"48px",background:"neutral0"},e.createElement(yl,{disabled:s,onClick:S,startIcon:e.createElement(St.Z,null)},f({id:(0,h.OB)("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"}))))))};Un.defaultProps={componentValue:null,componentValueLength:0,isReadOnly:!1,max:1/0,min:0},Un.propTypes={componentUid:n().string.isRequired,componentValue:n().oneOfType([n().array,n().object]),componentValueLength:n().number,isReadOnly:n().bool,max:n().number,min:n().number,name:n().string.isRequired};var bl=(0,e.memo)(Un);const Vn=({addNonRepeatableComponentToField:t,componentUid:o,intlLabel:r,isCreatingEntry:s,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:c,max:g,min:u,name:p,hasChildrenAllowedFields:f,hasChildrenReadableFields:m,isReadOnly:b,componentValue:E,removeComponentFromField:v,required:k})=>{const{formatMessage:R}=(0,V.Z)(),T=Xs()(E),O=E!==null||a,D=!l&&O&&!a&&f,{getComponentLayout:C,components:M}=(0,pe.PL)(),I=(0,e.useMemo)(()=>C(o),[o,C]);if(!f&&s)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:p});if(!f&&!s&&!m)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:p});const S=()=>{t(p,I,M)};return e.createElement(A.x,null,e.createElement(F.k,{justifyContent:"space-between"},r&&e.createElement(ra,{intlLabel:r,labelAction:c,name:p,numberOfEntries:T,showNumberOfEntries:l,required:k}),D&&e.createElement(be.h,{label:R({id:(0,h.OB)("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:e.createElement(Ye.Z,null),noBorder:!0,onClick:()=>{v(p,o)}})),e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:1},!l&&!O&&e.createElement(Vo,{isReadOnly:b,onClick:S}),!l&&O&&e.createElement(il,{componentUid:o,isFromDynamicZone:a,isNested:i,name:p}),l&&e.createElement(bl,{componentValue:E,componentValueLength:T,componentUid:o,isReadOnly:b,max:g,min:u,name:p})))};Vn.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},Vn.propTypes={addNonRepeatableComponentToField:n().func.isRequired,componentUid:n().string.isRequired,componentValue:n().oneOfType([n().object,n().array]),hasChildrenAllowedFields:n().bool,hasChildrenReadableFields:n().bool,isCreatingEntry:n().bool.isRequired,isFromDynamicZone:n().bool,isReadOnly:n().bool,isRepeatable:n().bool,isNested:n().bool,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),labelAction:n().element,max:n().number,min:n().number,name:n().string.isRequired,removeComponentFromField:n().func.isRequired,required:n().bool};const El=(0,e.memo)(Vn,xe());var Gt=_s(El,na);const vl=(0,j.ZP)(F.k)`
770
+ `,zn=({componentUid:t,componentValue:o,componentValueLength:r,isReadOnly:s,max:a,min:l,name:i})=>{const{addRepeatableComponentToField:c,formErrors:g,moveComponentField:u}=(0,y.Wq)(),p=(0,y.lm)(),{formatMessage:f}=(0,V.Z)(),[m,b]=(0,e.useState)(""),[E,v]=(0,e.useState)(""),{getComponentLayout:k,components:R}=(0,pe.PL)(),T=(0,e.useMemo)(()=>k(t),[t,k]),O=(0,e.useMemo)(()=>(0,h.Uo)(o||[])+1,[o]),D=fl(i,g),C=l-r,M=x()(g,i,{id:""}).id.includes("min"),I=()=>{b("")},S=()=>{s||(r<a?(c(i,T,R,M),b(O)):r>=a&&p({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}}))},B=(L,w)=>{v(f({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${i}.${w}`,position:W(L)})),u({name:i,newIndex:L,currentIndex:w})},$=x()(T,["settings","mainField"],"id"),K=L=>()=>{b(m===L?"":L)},W=L=>`${L+1} of ${r}`,G=L=>{v(f({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${i}.${L}`}))},z=L=>{v(f({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${i}.${L}`,position:W(L)}))},X=L=>{v(f({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${i}.${L}`,position:W(L)}))};let q=g[i];if(M?q={id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:C}}:D.some(L=>L.split(".").length>1)&&!M&&(q={id:(0,h.OB)("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r===0)return e.createElement(Uo,{error:q,isReadOnly:s,onClick:S});const U=`${i}-item-instructions`;return e.createElement(A.x,{hasRadius:!0},e.createElement(ht.T,{id:U},f({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ht.T,{"aria-live":"assertive"},E),e.createElement(Wn,{error:q,ariaDescribedBy:U},e.createElement(gl,{"aria-describedby":U},o.map(({__temp_key__:L},w)=>e.createElement(ml,{componentFieldName:`${i}.${w}`,componentUid:t,fields:T.layouts.edit,key:L,index:w,isOpen:m===L,isReadOnly:s,mainField:$,moveComponentField:B,onClickToggle:K(L),toggleCollapses:I,onCancel:G,onDropItem:X,onGrabItem:z}))),e.createElement(pl,null,e.createElement(F.k,{justifyContent:"center",height:"48px",background:"neutral0"},e.createElement(hl,{disabled:s,onClick:S,startIcon:e.createElement(St.Z,null)},f({id:(0,h.OB)("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"}))))))};zn.defaultProps={componentValue:null,componentValueLength:0,isReadOnly:!1,max:1/0,min:0},zn.propTypes={componentUid:n().string.isRequired,componentValue:n().oneOfType([n().array,n().object]),componentValueLength:n().number,isReadOnly:n().bool,max:n().number,min:n().number,name:n().string.isRequired};var yl=(0,e.memo)(zn);const Un=({addNonRepeatableComponentToField:t,componentUid:o,intlLabel:r,isCreatingEntry:s,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:c,max:g,min:u,name:p,hasChildrenAllowedFields:f,hasChildrenReadableFields:m,isReadOnly:b,componentValue:E,removeComponentFromField:v,required:k})=>{const{formatMessage:R}=(0,V.Z)(),T=Ks()(E),O=E!==null||a,D=!l&&O&&!a&&f,{getComponentLayout:C,components:M}=(0,pe.PL)(),I=(0,e.useMemo)(()=>C(o),[o,C]);if(!f&&s)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:p});if(!f&&!s&&!m)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:p});const S=()=>{t(p,I,M)};return e.createElement(A.x,null,e.createElement(F.k,{justifyContent:"space-between"},r&&e.createElement(na,{intlLabel:r,labelAction:c,name:p,numberOfEntries:T,showNumberOfEntries:l,required:k}),D&&e.createElement(be.h,{label:R({id:(0,h.OB)("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:e.createElement(Ye.Z,null),noBorder:!0,onClick:()=>{v(p,o)}})),e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:1},!l&&!O&&e.createElement(Uo,{isReadOnly:b,onClick:S}),!l&&O&&e.createElement(al,{componentUid:o,isFromDynamicZone:a,isNested:i,name:p}),l&&e.createElement(yl,{componentValue:E,componentValueLength:T,componentUid:o,isReadOnly:b,max:g,min:u,name:p})))};Un.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},Un.propTypes={addNonRepeatableComponentToField:n().func.isRequired,componentUid:n().string.isRequired,componentValue:n().oneOfType([n().object,n().array]),hasChildrenAllowedFields:n().bool,hasChildrenReadableFields:n().bool,isCreatingEntry:n().bool.isRequired,isFromDynamicZone:n().bool,isReadOnly:n().bool,isRepeatable:n().bool,isNested:n().bool,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),labelAction:n().element,max:n().number,min:n().number,name:n().string.isRequired,removeComponentFromField:n().func.isRequired,required:n().bool};const bl=(0,e.memo)(Un,Ce());var Qt=Xs(bl,ea);const El=(0,j.ZP)(F.k)`
771
771
  /*
772
772
  we need to remove the background from the button but we can't
773
773
  wrap the element in styled because it breaks the forwardedAs which
@@ -776,32 +776,32 @@ ${t}
776
776
  div[role='button'] {
777
777
  background: transparent;
778
778
  }
779
- `,Cl=(0,j.ZP)(be.h)`
779
+ `,vl=(0,j.ZP)(be.h)`
780
780
  background-color: transparent;
781
781
 
782
782
  svg path {
783
783
  fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
784
784
  }
785
- `,Rl=(0,j.ZP)(A.x)`
785
+ `,Cl=(0,j.ZP)(A.x)`
786
786
  > div:first-child {
787
787
  box-shadow: ${({theme:t})=>t.shadows.tableShadow};
788
788
  }
789
- `,Ml=(0,j.ZP)(A.x)`
789
+ `,Rl=(0,j.ZP)(A.x)`
790
790
  border-radius: 0 0 ${({theme:t})=>t.spaces[1]} ${({theme:t})=>t.spaces[1]};
791
- `,Tl=(0,j.ZP)(A.x)`
791
+ `,Ml=(0,j.ZP)(A.x)`
792
792
  width: ${({theme:t})=>t.spaces[2]};
793
793
  height: ${({theme:t})=>t.spaces[4]};
794
- `,Dl=j.ZP.span`
794
+ `,Tl=j.ZP.span`
795
795
  display: block;
796
796
  background-color: ${({theme:t})=>t.colors.primary100};
797
797
  outline: 1px dashed ${({theme:t})=>t.colors.primary500};
798
798
  outline-offset: -1px;
799
799
  padding: ${({theme:t})=>t.spaces[6]};
800
- `,kl=(0,j.ZP)(A.x)`
800
+ `,Dl=(0,j.ZP)(A.x)`
801
801
  list-style: none;
802
802
  padding: 0;
803
803
  margin: 0;
804
- `,Hn=({componentUid:t,formErrors:o,index:r,isFieldAllowed:s,name:a,onRemoveComponentClick:l,onMoveComponent:i,onGrabItem:c,onDropItem:g,onCancel:u})=>{const[p,f]=(0,e.useState)(!0),{formatMessage:m}=(0,V.Z)(),{getComponentLayout:b}=(0,pe.PL)(),{modifiedData:E}=(0,y.Wq)(),{icon:v,friendlyName:k,mainValue:R}=(0,e.useMemo)(()=>{const z=b(t),{info:{icon:X,displayName:q}}=z,U=x()(z,["settings","mainField"],"id"),L=x()(E,[a,r,U])??"",w=U==="id"?"":String(L).trim(),N=w.length>0?` - ${w}`:w;return{friendlyName:q,icon:X,mainValue:N}},[t,b,E,a,r]),T=Object.keys(o).filter(z=>{const X=z.split(".");return`${X[0]}.${X[1]}`==`${a}.${r}`});let O;T.length>0&&(O=m({id:(0,h.OB)("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const D=()=>{f(z=>!z)},[{handlerId:C,isDragging:M,handleKeyDown:I},S,B,$,K]=(0,pe.Y9)(s,{type:`${h._Q.DYNAMIC_ZONE}_${a}`,index:r,item:{displayedValue:`${k}${R}`,icon:v},onMoveItem:i,onGrabItem:c,onDropItem:g,onCancel:u});(0,e.useEffect)(()=>{K((0,wt.rX)(),{captureDraggingState:!1})},[K,r]);const W=(0,h.FE)(S,B),G=s?e.createElement(vl,{gap:0,expanded:p},e.createElement(Cl,{noBorder:!0,label:m({id:(0,h.OB)("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:k}),onClick:l},e.createElement(Ye.Z,null)),e.createElement(be.h,{forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:z=>z.stopPropagation(),"data-handler-id":C,ref:$,label:m({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:I},e.createElement(nt.Z,null))):null;return e.createElement(kl,{as:"li"},e.createElement(F.k,{justifyContent:"center"},e.createElement(Tl,{background:"neutral200"})),e.createElement(Rl,{ref:W,hasRadius:!0},M?e.createElement(Dl,{padding:6,background:"primary100"}):e.createElement(un.U,{expanded:p,onToggle:D,size:"S",error:O},e.createElement(mn.B,{action:G,title:`${k}${R}`,togglePosition:"left"}),e.createElement(pn.v,null,e.createElement(Ml,{background:"neutral0"},e.createElement(Gt,{componentUid:t,icon:v,name:`${a}.${r}`,isFromDynamicZone:!0}))))))};Hn.defaultProps={formErrors:{},index:0,isFieldAllowed:!0,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0},Hn.propTypes={componentUid:n().string.isRequired,formErrors:n().object,index:n().number,isFieldAllowed:n().bool,name:n().string.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onMoveComponent:n().func.isRequired,onRemoveComponentClick:n().func.isRequired};var Il=Hn;const Qn=(0,j.ZP)(Uo.Z)`
804
+ `,Vn=({componentUid:t,formErrors:o,index:r,isFieldAllowed:s,name:a,onRemoveComponentClick:l,onMoveComponent:i,onGrabItem:c,onDropItem:g,onCancel:u})=>{const[p,f]=(0,e.useState)(!0),{formatMessage:m}=(0,V.Z)(),{getComponentLayout:b}=(0,pe.PL)(),{modifiedData:E}=(0,y.Wq)(),{icon:v,friendlyName:k,mainValue:R}=(0,e.useMemo)(()=>{const z=b(t),{info:{icon:X,displayName:q}}=z,U=x()(z,["settings","mainField"],"id"),L=x()(E,[a,r,U])??"",w=U==="id"?"":String(L).trim(),N=w.length>0?` - ${w}`:w;return{friendlyName:q,icon:X,mainValue:N}},[t,b,E,a,r]),T=Object.keys(o).filter(z=>{const X=z.split(".");return`${X[0]}.${X[1]}`==`${a}.${r}`});let O;T.length>0&&(O=m({id:(0,h.OB)("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const D=()=>{f(z=>!z)},[{handlerId:C,isDragging:M,handleKeyDown:I},S,B,$,K]=(0,pe.Y9)(s,{type:`${h._Q.DYNAMIC_ZONE}_${a}`,index:r,item:{displayedValue:`${k}${R}`,icon:v},onMoveItem:i,onGrabItem:c,onDropItem:g,onCancel:u});(0,e.useEffect)(()=>{K((0,wt.rX)(),{captureDraggingState:!1})},[K,r]);const W=(0,h.FE)(S,B),G=s?e.createElement(El,{gap:0,expanded:p},e.createElement(vl,{noBorder:!0,label:m({id:(0,h.OB)("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:k}),onClick:l},e.createElement(Ye.Z,null)),e.createElement(be.h,{forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:z=>z.stopPropagation(),"data-handler-id":C,ref:$,label:m({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:I},e.createElement(nt.Z,null))):null;return e.createElement(Dl,{as:"li"},e.createElement(F.k,{justifyContent:"center"},e.createElement(Ml,{background:"neutral200"})),e.createElement(Cl,{ref:W,hasRadius:!0},M?e.createElement(Tl,{padding:6,background:"primary100"}):e.createElement(dn.U,{expanded:p,onToggle:D,size:"S",error:O},e.createElement(un.B,{action:G,title:`${k}${R}`,togglePosition:"left"}),e.createElement(mn.v,null,e.createElement(Rl,{background:"neutral0"},e.createElement(Qt,{componentUid:t,icon:v,name:`${a}.${r}`,isFromDynamicZone:!0}))))))};Vn.defaultProps={formErrors:{},index:0,isFieldAllowed:!0,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0},Vn.propTypes={componentUid:n().string.isRequired,formErrors:n().object,index:n().number,isFieldAllowed:n().bool,name:n().string.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onMoveComponent:n().func.isRequired,onRemoveComponentClick:n().func.isRequired};var kl=Vn;const Hn=(0,j.ZP)(zo.Z)`
805
805
  transform: ${({$isOpen:t})=>t?"rotate(45deg)":"rotate(0deg)"};
806
806
  > circle {
807
807
  fill: ${({theme:t,$hasError:o})=>o?t.colors.danger200:t.colors.neutral150};
@@ -809,7 +809,7 @@ ${t}
809
809
  > path {
810
810
  fill: ${({theme:t,$hasError:o})=>o?t.colors.danger600:t.colors.neutral600};
811
811
  }
812
- `,Pl=(0,j.ZP)(En.Y)`
812
+ `,Il=(0,j.ZP)(bn.Y)`
813
813
  border-radius: 26px;
814
814
  border-color: ${({theme:t})=>t.colors.neutral150};
815
815
  background: ${({theme:t})=>t.colors.neutral0};
@@ -833,7 +833,7 @@ ${t}
833
833
  color: ${({theme:t})=>t.colors.primary600} !important;
834
834
  }
835
835
 
836
- ${Qn} {
836
+ ${Hn} {
837
837
  > circle {
838
838
  fill: ${({theme:t})=>t.colors.primary600};
839
839
  }
@@ -846,7 +846,7 @@ ${t}
846
846
  ${Q.Z} {
847
847
  color: ${({theme:t})=>t.colors.primary600};
848
848
  }
849
- ${Qn} {
849
+ ${Hn} {
850
850
  > circle {
851
851
  fill: ${({theme:t})=>t.colors.primary600};
852
852
  }
@@ -855,21 +855,21 @@ ${t}
855
855
  }
856
856
  }
857
857
  }
858
- `,Ol=(0,j.ZP)(A.x)`
858
+ `,Pl=(0,j.ZP)(A.x)`
859
859
  height: 100%;
860
- `,Gn=({hasError:t,hasMaxError:o,hasMinError:r,isDisabled:s,isOpen:a,label:l,missingComponentNumber:i,name:c,onClick:g})=>{const{formatMessage:u}=(0,V.Z)(),p=u({id:(0,h.OB)("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||c}),f=u({id:"app.utils.close-label",defaultMessage:"Close"});let m=a?f:p;return o&&!a&&(m=u({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),r&&!a&&(m=u({id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),e.createElement(F.k,{justifyContent:"center"},e.createElement(A.x,{style:{cursor:s?"not-allowed":"pointer"}},e.createElement(Pl,{type:"button",onClick:g,disabled:s,hasError:t},e.createElement(F.k,null,e.createElement(Ol,{"aria-hidden":!0,paddingRight:2},e.createElement(Qn,{$isOpen:a,$hasError:t&&!a})),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:t&&!a?"danger600":"neutral500"},m)))))};Gn.defaultProps={hasError:!1,hasMaxError:!1,hasMinError:!1,isDisabled:!1,isOpen:!1,label:"",missingComponentNumber:0},Gn.propTypes={label:n().string,hasError:n().bool,hasMaxError:n().bool,hasMinError:n().bool,isDisabled:n().bool,isOpen:n().bool,missingComponentNumber:n().number,name:n().string.isRequired,onClick:n().func.isRequired};var wl=Gn;const xl=(0,j.ZP)(A.x)`
860
+ `,Qn=({hasError:t,hasMaxError:o,hasMinError:r,isDisabled:s,isOpen:a,label:l,missingComponentNumber:i,name:c,onClick:g})=>{const{formatMessage:u}=(0,V.Z)(),p=u({id:(0,h.OB)("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||c}),f=u({id:"app.utils.close-label",defaultMessage:"Close"});let m=a?f:p;return o&&!a&&(m=u({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),r&&!a&&(m=u({id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),e.createElement(F.k,{justifyContent:"center"},e.createElement(A.x,{style:{cursor:s?"not-allowed":"pointer"}},e.createElement(Il,{type:"button",onClick:g,disabled:s,hasError:t},e.createElement(F.k,null,e.createElement(Pl,{"aria-hidden":!0,paddingRight:2},e.createElement(Hn,{$isOpen:a,$hasError:t&&!a})),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:t&&!a?"danger600":"neutral500"},m)))))};Qn.defaultProps={hasError:!1,hasMaxError:!1,hasMinError:!1,isDisabled:!1,isOpen:!1,label:"",missingComponentNumber:0},Qn.propTypes={label:n().string,hasError:n().bool,hasMaxError:n().bool,hasMinError:n().bool,isDisabled:n().bool,isOpen:n().bool,missingComponentNumber:n().number,name:n().string.isRequired,onClick:n().func.isRequired};var Ol=Qn;const wl=(0,j.ZP)(A.x)`
861
861
  border-radius: ${(0,y.Q1)(26)};
862
- `,Kn=({label:t,labelAction:o,name:r,numberOfComponents:s,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,V.Z)(),c=i({id:t||r,defaultMessage:t||r});return e.createElement(F.k,{justifyContent:"center"},e.createElement(A.x,null,e.createElement(xl,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},e.createElement(F.k,{direction:"column",justifyContent:"center"},e.createElement(F.k,{maxWidth:(0,y.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},c,"\xA0"),e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",s,")"),a&&e.createElement(Q.Z,{textColor:"danger600"},"*"),o&&e.createElement(A.x,{paddingLeft:1},o)),l&&e.createElement(A.x,{paddingTop:1,maxWidth:(0,y.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};Kn.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},Kn.propTypes={intlDescription:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}),label:n().string,labelAction:n().element,name:n().string.isRequired,numberOfComponents:n().number,required:n().bool};var Fl=Kn,Ll=d(81346),Rr=d.n(Ll);const Kt=5,Yt=8,Sl=(0,j.ZP)(F.k)`
862
+ `,Gn=({label:t,labelAction:o,name:r,numberOfComponents:s,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,V.Z)(),c=i({id:t||r,defaultMessage:t||r});return e.createElement(F.k,{justifyContent:"center"},e.createElement(A.x,null,e.createElement(wl,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},e.createElement(F.k,{direction:"column",justifyContent:"center"},e.createElement(F.k,{maxWidth:(0,y.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},c,"\xA0"),e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",s,")"),a&&e.createElement(Q.Z,{textColor:"danger600"},"*"),o&&e.createElement(A.x,{paddingLeft:1},o)),l&&e.createElement(A.x,{paddingTop:1,maxWidth:(0,y.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};Gn.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},Gn.propTypes={intlDescription:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}),label:n().string,labelAction:n().element,name:n().string.isRequired,numberOfComponents:n().number,required:n().bool};var xl=Gn,Fl=d(81346),vr=d.n(Fl);const Gt=5,Kt=8,Ll=(0,j.ZP)(F.k)`
863
863
  border-radius: ${({showBackground:t})=>t?"50%":0};
864
864
  color: ${({theme:t})=>t.colors.neutral600};
865
- height: ${({theme:t,size:o})=>t.spaces[o==="S"?Kt:Yt]};
866
- width: ${({theme:t,size:o})=>t.spaces[o==="S"?Kt:Yt]};
865
+ height: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt:Kt]};
866
+ width: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt:Kt]};
867
867
 
868
868
  svg {
869
- height: ${({theme:t,size:o})=>t.spaces[o==="S"?Kt-2:Yt-3]};
870
- width: ${({theme:t,size:o})=>t.spaces[o==="S"?Kt-2:Yt-3]};
869
+ height: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt-2:Kt-3]};
870
+ width: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt-2:Kt-3]};
871
871
  }
872
- `;function Xt({showBackground:t=!0,size:o="M"}){return e.createElement(Sl,{alignItems:"center",background:t?"neutral200":null,justifyContent:"center",size:o,showBackground:t},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e.createElement("path",{d:"M216.3 2c4.8-2.6 10.5-2.6 15.3 0L422.3 106c5.1 2.8 8.3 8.2 8.3 14s-3.2 11.2-8.3 14L231.7 238c-4.8 2.6-10.5 2.6-15.3 0L25.7 134c-5.1-2.8-8.3-8.2-8.3-14s3.2-11.2 8.3-14L216.3 2zM23.7 170l176 96c5.1 2.8 8.3 8.2 8.3 14V496c0 5.6-3 10.9-7.8 13.8s-10.9 3-15.8 .3L8.3 414C3.2 411.2 0 405.9 0 400V184c0-5.6 3-10.9 7.8-13.8s10.9-3 15.8-.3zm400.7 0c5-2.7 11-2.6 15.8 .3s7.8 8.1 7.8 13.8V400c0 5.9-3.2 11.2-8.3 14l-176 96c-5 2.7-11 2.6-15.8-.3s-7.8-8.1-7.8-13.8V280c0-5.9 3.2-11.2 8.3-14l176-96z",fill:"currentColor"})))}Xt.defaultProps={showBackground:!0,size:"M"},Xt.propTypes={showBackground:n().bool,size:n().string};const Al=(0,j.ZP)(A.x)`
872
+ `;function Yt({showBackground:t=!0,size:o="M"}){return e.createElement(Ll,{alignItems:"center",background:t?"neutral200":null,justifyContent:"center",size:o,showBackground:t},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e.createElement("path",{d:"M216.3 2c4.8-2.6 10.5-2.6 15.3 0L422.3 106c5.1 2.8 8.3 8.2 8.3 14s-3.2 11.2-8.3 14L231.7 238c-4.8 2.6-10.5 2.6-15.3 0L25.7 134c-5.1-2.8-8.3-8.2-8.3-14s3.2-11.2 8.3-14L216.3 2zM23.7 170l176 96c5.1 2.8 8.3 8.2 8.3 14V496c0 5.6-3 10.9-7.8 13.8s-10.9 3-15.8 .3L8.3 414C3.2 411.2 0 405.9 0 400V184c0-5.6 3-10.9 7.8-13.8s10.9-3 15.8-.3zm400.7 0c5-2.7 11-2.6 15.8 .3s7.8 8.1 7.8 13.8V400c0 5.9-3.2 11.2-8.3 14l-176 96c-5 2.7-11 2.6-15.8-.3s-7.8-8.1-7.8-13.8V280c0-5.9 3.2-11.2 8.3-14l176-96z",fill:"currentColor"})))}Yt.defaultProps={showBackground:!0,size:"M"},Yt.propTypes={showBackground:n().bool,size:n().string};const Sl=(0,j.ZP)(A.x)`
873
873
  flex-shrink: 0;
874
874
  height: ${(0,y.Q1)(84)};
875
875
  border: 1px solid ${({theme:t})=>t.colors.neutral200};
@@ -894,19 +894,19 @@ ${t}
894
894
  color: ${({theme:t})=>t.colors.primary600};
895
895
  }
896
896
  }
897
- `;function Yn({children:t,onClick:o}){return e.createElement(Al,{as:"button",type:"button",onClick:o,hasRadius:!0},e.createElement(F.k,{direction:"column",gap:1,alignItems:"center",justifyContent:"center"},e.createElement(Xt,null),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},t)))}Yn.defaultProps={onClick(){}},Yn.propTypes={children:n().node.isRequired,onClick:n().func};const $l=j.ZP.div`
897
+ `;function Kn({children:t,onClick:o}){return e.createElement(Sl,{as:"button",type:"button",onClick:o,hasRadius:!0},e.createElement(F.k,{direction:"column",gap:1,alignItems:"center",justifyContent:"center"},e.createElement(Yt,null),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},t)))}Kn.defaultProps={onClick(){}},Kn.propTypes={children:n().node.isRequired,onClick:n().func};const Al=j.ZP.div`
898
898
  display: grid;
899
899
  grid-template-columns: repeat(auto-fit, ${140/16}rem);
900
900
  grid-gap: ${({theme:t})=>t.spaces[1]};
901
- `,Xn=({category:t,components:o,variant:r,isOpen:s,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,V.Z)(),c=()=>{l(t)};return e.createElement(un.U,{expanded:s,onToggle:c,size:"S"},e.createElement(mn.B,{variant:r,title:i({id:t,defaultMessage:t}),togglePosition:"left"}),e.createElement(pn.v,null,e.createElement(A.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},e.createElement($l,null,o.map(({componentUid:g,info:{displayName:u}})=>e.createElement(Yn,{key:g,onClick:a(g)},i({id:u,defaultMessage:u})))))))};Xn.defaultProps={components:[],isOpen:!1,variant:"primary"},Xn.propTypes={category:n().string.isRequired,components:n().array,isOpen:n().bool,onAddComponent:n().func.isRequired,onToggle:n().func.isRequired,variant:n().oneOf(["primary","secondary"])};var Zl=Xn;const Jn=({components:t,isOpen:o,onClickAddComponent:r})=>{const{formatMessage:s}=(0,V.Z)(),{getComponentLayout:a}=(0,pe.PL)(),[l,i]=(0,e.useState)(""),c=(0,e.useMemo)(()=>{const p=t.map(m=>{const{category:b,info:E}=a(m);return{componentUid:m,category:b,info:E}}),f=Rr()(p,"category");return Object.keys(f).reduce((m,b)=>(m.push({category:b,components:f[b]}),m),[])},[t,a]);(0,e.useEffect)(()=>{o&&c.length>0&&i(c[0].category)},[o,c]);const g=p=>()=>{r(p),i("")},u=p=>{i(f=>f===p?"":p)};return o?e.createElement(A.x,{paddingBottom:6},e.createElement(A.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral600"},s({id:(0,h.OB)("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),e.createElement(A.x,{paddingTop:2},e.createElement(Cr.k,{attributeName:"data-strapi-accordion-toggle"},c.map(({category:p,components:f},m)=>e.createElement(Zl,{key:p,category:p,components:f,onAddComponent:g,isOpen:p===l,onToggle:u,variant:m%2===1?"primary":"secondary"})))))):null};Jn.defaultProps={components:[],isOpen:!1},Jn.propTypes={components:n().array,isOpen:n().bool,onClickAddComponent:n().func.isRequired};var Bl=Jn;const _n=({name:t,addComponentToDynamicZone:o,formErrors:r,isCreatingEntry:s,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentField:c,removeComponentFromDynamicZone:g,dynamicDisplayedComponents:u,fieldSchema:p,metadatas:f})=>{const[m,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(""),{formatMessage:k}=(0,V.Z)(),R=(0,y.lm)(),{getComponentLayout:T,components:O}=(0,pe.PL)(),D=u.length,C=f.description?{id:f.description,defaultMessage:f.description}:null,{max:M=1/0,min:I=-1/0}=p,S=(0,e.useMemo)(()=>Object.keys(r).filter(P=>P===t).map(P=>r[P]),[r,t]),B=I-D,$=S.length>0,K=S.length>0&&x()(S,[0,"id"],"").includes("min"),W=$&&x()(S,[0,"id"],"")==="components.Input.error.validation.max",G=P=>{b(!1);const Z=T(P);o(t,Z,O,$)},z=()=>{D<M?b(P=>!P):R({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}})},X=(P,Z)=>{v(k({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${t}.${Z}`,position:q(P)})),c({name:t,newIndex:P,currentIndex:Z})},q=P=>`${P+1} of ${u.length}`,U=P=>{v(k({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${t}.${P}`}))},L=P=>{v(k({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${t}.${P}`,position:q(P)}))},w=P=>{v(k({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${t}.${P}`,position:q(P)}))},N=(P,Z)=>()=>{g(P,Z)};if(!a&&(s||!l&&!s))return e.createElement(y.X0,{description:C,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:i,name:t});const Y=`${t}-item-instructions`;return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},D>0&&e.createElement(A.x,null,e.createElement(Fl,{intlDescription:C,label:f.label,labelAction:i,name:t,numberOfComponents:D,required:p.required||!1}),e.createElement(ht.T,{id:Y},k({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ht.T,{"aria-live":"assertive"},E),e.createElement("ol",{"aria-describedby":Y},u.map(({componentUid:P,id:Z},oe)=>e.createElement(Il,{componentUid:P,formErrors:r,key:`${P}-${Z}`,index:oe,isFieldAllowed:a,name:t,onMoveComponent:X,onRemoveComponentClick:N(t,oe),onCancel:U,onDropItem:w,onGrabItem:L})))),e.createElement(wl,{hasError:$,hasMaxError:W,hasMinError:K,isDisabled:!a,label:f.label,missingComponentNumber:B,isOpen:m,name:t,onClick:z}),e.createElement(Bl,{isOpen:m,components:p.components??[],onClickAddComponent:G}))};_n.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},_n.propTypes={addComponentToDynamicZone:n().func.isRequired,dynamicDisplayedComponents:n().arrayOf(n().shape({componentUid:n().string.isRequired,id:n().number.isRequired})),fieldSchema:n().shape({components:n().array.isRequired,max:n().number,min:n().number,required:n().bool}),formErrors:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isFieldAllowed:n().bool.isRequired,isFieldReadable:n().bool.isRequired,labelAction:n().element,metadatas:n().shape({description:n().string,label:n().string}).isRequired,moveComponentField:n().func.isRequired,name:n().string.isRequired,removeComponentFromDynamicZone:n().func.isRequired};const ql=(0,e.memo)(_n,xe());var Nl=Qs(ql,Ks),Qe=d(84306),ot=d(41578);const Jt=()=>({type:ot.ZA}),eo=t=>({type:ot.Id,data:t}),to=(t,o=!1)=>({type:ot.TP,rawQuery:t,isSingleType:o}),Mr=()=>({type:ot.c2}),Tr=(t,o)=>({type:ot.w7,componentsDataStructure:t,contentTypeDataStructure:o}),le=t=>({type:ot.d0,status:t}),rt=t=>({type:ot.t9,data:t}),jl=()=>({type:ot.tE});var no=t=>t["content-manager_editViewCrudReducer"];const oo=({allLayoutData:t,children:o,slug:r,id:s,origin:a})=>{const l=(0,Xe.useQueryClient)(),i=(0,y.lm)(),{setCurrentStep:c}=(0,y.c1)(),{trackUsage:g}=(0,y.rS)(),{push:u,replace:p}=(0,te.k6)(),[{rawQuery:f}]=(0,y.Kx)(),m=(0,J.I0)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:v,isLoading:k,status:R}=(0,J.v9)(no),T=(0,pe.Ky)(r),{formatAPIError:O}=(0,y.So)(h.OB),D=(0,e.useRef)(!0),C=(0,e.useRef)(g),M=(0,e.useRef)(t),I=(0,y.kY)(),{put:S,post:B,del:$}=I,K=s===null,W=(0,e.useMemo)(()=>K&&!a?null:(0,h.IF)(`collection-types/${r}/${a||s}`),[r,s,K,a]),G=(0,e.useCallback)(P=>a?(0,y.w6)(P,M.current.contentType,M.current.components):P,[a]),z=(0,e.useCallback)(P=>{const Z=(0,h.kc)(P,M.current.contentType,M.current.components);return(0,y.dU)(Z,M.current.contentType,M.current.components)},[]);(0,e.useEffect)(()=>{const P=Object.keys(t.components).reduce((re,me)=>{const H=(0,h.Di)(x()(t,["components",me,"attributes"],{}),t.components);return re[me]=(0,y.dU)(H,t.components[me],t.components),re},{}),Z=(0,h.Di)(t.contentType.attributes,t.components),oe=(0,y.dU)(Z,t.contentType,t.components);m(Tr(P,oe))},[t,m]),(0,e.useEffect)(()=>()=>{m(Mr())},[m]),(0,e.useEffect)(()=>{const Z=Qe.Z.CancelToken.source(),oe=async me=>{m(Jt());try{const{data:H}=await I.get(W,{cancelToken:me.token});m(eo(z(G(H))))}catch(H){if(Qe.Z.isCancel(H))return;const ae=x()(H,"response.status",null);if(ae===404){u(T);return}ae===403&&(i({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),u(T))}},re=async()=>{await m(Jt()),await m(to(f))};return D.current?(W?oe(Z):re(),()=>{Z.cancel("Operation canceled by the user.")}):()=>{}},[I,G,z,u,W,m,f,T,i]);const X=(0,e.useCallback)(P=>{i({type:"warning",message:O(P)})},[i,O]),q=(0,e.useCallback)(async P=>{try{C.current("willDeleteEntry",P);const{data:Z}=await $((0,h.IF)(`collection-types/${r}/${s}`));return i({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),C.current("didDeleteEntry",P),p(T),Promise.resolve(Z)}catch(Z){return C.current("didNotDeleteEntry",{error:Z,...P}),Promise.reject(Z)}},[s,r,i,$,T,p]),U=(0,e.useCallback)(async(P,Z)=>{const oe=`${(0,h.IF)(`collection-types/${r}`)}${f}`;try{m(le("submit-pending"));const{data:re}=await B(oe,P);return C.current("didCreateEntry",Z),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c("contentManager.success"),l.invalidateQueries(["relation"]),m(rt(z(re))),m(le("resolved")),p(`/content-manager/collectionType/${r}/${re.id}${f}`),Promise.resolve(re)}catch(re){return X(re),C.current("didNotCreateEntry",{error:re,trackerProperty:Z}),m(le("resolved")),Promise.reject(re)}},[z,X,p,r,m,f,i,c,l,B]),L=(0,e.useCallback)(async()=>{try{C.current("willCheckDraftRelations");const P=(0,h.IF)(`collection-types/${r}/${s}/actions/numberOfDraftRelations`);m(le("draft-relation-check-pending"));const Z=await I.get(P);return C.current("didCheckDraftRelations"),m(le("resolved")),Z.data.data}catch(P){return X(P),m(le("resolved")),Promise.reject(P)}},[X,s,r,m,I]),w=(0,e.useCallback)(async()=>{try{C.current("willPublishEntry");const P=(0,h.IF)(`collection-types/${r}/${s}/actions/publish`);m(le("publish-pending"));const{data:Z}=await B(P);return C.current("didPublishEntry"),m(rt(z(Z))),m(le("resolved")),i({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),Promise.resolve(Z)}catch(P){return X(P),m(le("resolved")),Promise.reject(P)}},[z,X,s,r,m,i,B]),N=(0,e.useCallback)(async(P,Z)=>{const oe=(0,h.IF)(`collection-types/${r}/${s}`);try{C.current("willEditEntry",Z),m(le("submit-pending"));const{data:re}=await S(oe,P);return C.current("didEditEntry",{trackerProperty:Z}),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),l.invalidateQueries(["relation"]),m(rt(z(re))),m(le("resolved")),Promise.resolve(re)}catch(re){return C.current("didNotEditEntry",{error:re,trackerProperty:Z}),X(re),m(le("resolved")),Promise.reject(re)}},[z,X,r,s,m,i,l,S]),Y=(0,e.useCallback)(async()=>{const P=(0,h.IF)(`collection-types/${r}/${s}/actions/unpublish`);m(le("unpublish-pending"));try{C.current("willUnpublishEntry");const{data:Z}=await B(P);return C.current("didUnpublishEntry"),i({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),m(rt(z(Z))),m(le("resolved")),Promise.resolve(Z)}catch(Z){return m(le("resolved")),X(Z),Promise.reject(Z)}},[z,X,s,r,m,i,B]);return o({componentsDataStructure:b,contentTypeDataStructure:E,data:v,isCreatingEntry:K,isLoadingForData:k,onDelete:q,onPost:U,onPublish:w,onDraftRelationCheck:L,onPut:N,onUnpublish:Y,status:R,redirectionLink:T})};oo.defaultProps={id:null,origin:null},oo.propTypes={allLayoutData:n().exact({components:n().object.isRequired,contentType:n().shape({apiID:n().string.isRequired,attributes:n().object.isRequired,info:n().object.isRequired,isDisplayed:n().bool.isRequired,kind:n().string.isRequired,layouts:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,pluginOptions:n().object,settings:n().object.isRequired,uid:n().string.isRequired}).isRequired}).isRequired,children:n().func.isRequired,id:n().string,origin:n().string,slug:n().string.isRequired};var Wl=(0,e.memo)(oo,xe()),zl=d(86834),qe=d.n(zl),Ul=d(99381),Je=d.n(Ul),Vl=d(89793),At=d.n(Vl),Hl=d(3040),se=d.n(Hl),ro=d(97889),Ql=d(56236),Gl=d.n(Ql),Kl=d(10268),Dr=d.n(Kl),so=d(99526),kr=(t,o,r,s)=>{const a=t.slice();return a.splice(o,1),a.splice(r,0,s),a},Yl=d(77236),Xl=d.n(Yl),Jl=d(85973),_l=d.n(Jl);const ec=({browserState:t,serverState:o},r,s)=>{const a=o,l=t,i=(u,p)=>x()(u,["attributes",p,"type"],""),c=(u,p)=>x()(u,["attributes",...p],""),g=(u,p,f,m)=>Object.keys(u).reduce((b,E)=>{const v=m?`${m}.${E}`:E,k=i(f,E),R=x()(u,E),T=x()(p,E),O=c(f,[E,"component"]),D=c(f,[E,"repeatable"]);let C;switch(k){case"json":C=JSON.parse(R);break;case"time":{C=R,R&&R.split(":").length<3&&(C=`${R}:00`);break}case"media":c(f,[E,"multiple"])===!0?C=R?R.filter(M=>!(M instanceof File)):null:C=x()(R,0)instanceof File?null:x()(R,"id",null);break;case"component":D?C=R&&R.map((M,I)=>g(M,(T??[])[I],s[O],`${v}.${I}`)):C=R&&g(R,T,s[O],v);break;case"relation":{const M=br(a,l)(v).join(".");let I=x()(a,M,[]);const S=R.reduce(($,K,W,G)=>{const z=I.find(q=>q.id===K.id),X=G[W+1];if(!z||z.__temp_key__!==K.__temp_key__){const q=X?{before:X.id}:{end:!0};return[...$,{id:K.id,position:q}]}return $},[]);C={disconnect:I.reduce(($,K)=>R.find(W=>W.id===K.id)?$:[...$,{id:K.id}],[]),connect:S.reverse()};break}case"dynamiczone":C=R.map((M,I)=>g(M,(T??[])[I],s[M.__component],`${v}.${I}`));break;default:C=tc(R,"id")}return b[E]=C,b},{});return g(t,o,r,"")},tc=(t,o)=>Xl()(t)?t.map(r=>r[o]?r[o]:r):_l()(t)?t[o]:t;var nc=ec;const _t=(t,o=()=>!1,r=void 0)=>{const s=(a,l,{ignoreFalseyValues:i=!1,path:c=[],parent:g=l}={})=>Object.entries(l).reduce((u,[p,f])=>{if(i&&(u==null||u[p]===void 0||u[p]===null))return u;if(o(f,{path:[...c,p],parent:g})&&(u[p]=typeof r=="function"?r(u[p],{path:[...c,p],parent:u}):r),f.type==="component"){const m=t[f.component].attributes;!f.repeatable&&u[p]&&typeof u[p]=="object"?u[p]=s(u[p],m,{ignoreFalseyValues:i,path:[...c,p],parent:l[p]}):f.repeatable&&Array.isArray(u[p])&&(u[p]=u[p].map((b,E)=>s(b,m,{ignoreFalseyValues:i,path:[...c,p,E],parent:l[p]})))}else f.type==="dynamiczone"&&Array.isArray(u[p])&&(u[p]=u[p].map((m,b)=>{const E=t[m.__component].attributes;return s(m,E,{ignoreFalseyValues:i,path:[...c,p,b],parent:l[p]})}));return u},{...a});return s},oc={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}};var rc=(t,o)=>(0,ro.ZP)(t,r=>{switch(o.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:s,allComponents:a}=o,l={...t.componentsDataStructure[s.uid]},c=_t(a,g=>g.type==="relation",[])(l,s.attributes);se()(r,["modifiedData",...o.keys],c);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:s,allComponents:a,componentLayoutData:l,shouldCheckErrors:i}=o;i&&(r.shouldCheckErrors=!t.shouldCheckErrors),o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(r.modifiedDZName=s[0]);const c=x()(t,["modifiedData",...s],[]),g=o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?{...t.componentsDataStructure[l.uid],__component:l.uid,__temp_key__:(0,h.Uo)(c)+1}:{...t.componentsDataStructure[l.uid],__temp_key__:(0,h.Uo)(c)+1},p=_t(a,m=>m.type==="relation",[])(g,l.attributes),f=Array.isArray(c)?[...c,p]:[p];se()(r,["modifiedData",...s],f);break}case"LOAD_RELATION":{const{initialDataPath:s,modifiedDataPath:a,value:l}=o,i=x()(t,s),c=x()(t,a),g=i?l.filter(f=>!i.some(m=>m.id===f.id)):l,u=(0,so.zJ)(null,c[0]?.__temp_key__,g.length),p=g.map((f,m)=>({...f,__temp_key__:u[m]}));se()(r,s,Dr()([...p,...i],"id")),se()(r,a,Dr()([...p,...c],"id"));break}case"CONNECT_RELATION":{const s=["modifiedData",...o.keys],{value:a,toOneRelation:l}=o;if(l)se()(r,s,[a]);else{const i=x()(t,s),[c]=(0,so.zJ)(i.at(-1)?.__temp_key__,null,1),g=[...i,{...a,__temp_key__:c}];se()(r,s,g)}break}case"DISCONNECT_RELATION":{const s=["modifiedData",...o.keys],{id:a}=o,i=x()(t,[...s]).filter(c=>c.id!==a);se()(r,s,i);break}case"MOVE_COMPONENT_FIELD":case"REORDER_RELATION":{const{oldIndex:s,newIndex:a,keys:l}=o,i=["modifiedData",...l],c=x()(t,[...i]),g=c[s],u=[...c];if(o.type==="REORDER_RELATION"){const p=s>a?c[a-1]?.__temp_key__:c[a]?.__temp_key__,f=s>a?c[a]?.__temp_key__:c[a+1]?.__temp_key__,[m]=(0,so.zJ)(p,f,1);u.splice(s,1),u.splice(a,0,{...g,__temp_key__:m})}else u.splice(s,1),u.splice(a,0,g);se()(r,i,u);break}case"INIT_FORM":{const{initialValues:s,components:a={},attributes:l={},setModifiedDataOnly:i}=o,c=Je()(s),u=_t(a,m=>m.type==="relation",(m,{path:b})=>t.modifiedData?.id===c.id&&x()(t.modifiedData,b)?x()(t.modifiedData,b):[])(c,l),f=_t(a,m=>m.type==="dynamiczone"||m.type==="component"&&!m.repeatable,m=>Array.isArray(m)?m.map((b,E)=>({...b,__temp_key__:E})):{...m,__temp_key__:0})(u,l,{ignoreFalseyValues:!0});i||(r.initialData=f),r.modifiedData=f,r.formErrors={},r.modifiedDZName=null,r.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:s,dynamicZoneName:a,shouldCheckErrors:l}=o;l&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=t.modifiedData[a],c=o.type==="MOVE_COMPONENT_UP"?s-1:s+1,g=t.modifiedData[a][s],u=kr(i,s,c,g);se()(r,["modifiedData",o.dynamicZoneName],u);break}case"MOVE_FIELD":{const s=x()(t,["modifiedData",...o.keys],[]).slice(),a=x()(t,["modifiedData",...o.keys,o.dragIndex]),l=kr(s,o.dragIndex,o.overIndex,a);se()(r,["modifiedData",...o.keys],l);break}case"ON_CHANGE":{const[s]=o.keys;if(o.shouldSetInitialValue&&se()(r,["initialData",...o.keys],o.value),o.keys.length===2&&x()(t,["modifiedData",s])===null){se()(r,["modifiedData",s],{[o.keys[1]]:o.value});break}se()(r,["modifiedData",...o.keys],o.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{o.shouldCheckErrors&&(r.shouldCheckErrors=!t.shouldCheckErrors),r.modifiedData[o.dynamicZoneName].splice(o.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const s=["modifiedData",...o.keys];se()(r,s,null);break}case"REMOVE_PASSWORD_FIELD":{Gl()(r,["modifiedData",...o.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=o.keys.length-1,a=["modifiedData",...xt()(o.keys,s)];Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=x()(t,a).slice();i.splice(parseInt(o.keys[s],10),1),se()(r,a,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{r.componentsDataStructure=o.componentsDataStructure,r.contentTypeDataStructure=o.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{r.modifiedDZName=null,r.formErrors=o.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);break}case"SET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...o.publishConfirmation};break}case"RESET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...t.publishConfirmation,show:!1};break}default:return r}});const ao=({allLayoutData:t,allowedActions:{canRead:o,canUpdate:r},children:s,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:c,initialValues:g,isCreatingEntry:u,isLoadingForData:p,isSingleType:f,onPost:m,onPublish:b,onDraftRelationCheck:E,onPut:v,onUnpublish:k,readActionAllowedFields:R,redirectToPreviousPage:T,slug:O,status:D,updateActionAllowedFields:C})=>{const[M,I]=(0,e.useReducer)(rc,oc),{formErrors:S,initialData:B,modifiedData:$,modifiedDZName:K,shouldCheckErrors:W,publishConfirmation:G}=M,{setModifiedDataOnly:z}=(0,J.v9)(no),X=(0,J.I0)(),q=(0,y.lm)(),{lockApp:U,unlockApp:L}=(0,y.o1)(),w=x()(t,["contentType"],{}),N=(0,e.useMemo)(()=>x()(w,["options","draftAndPublish"],!1),[w]),Y=(0,e.useMemo)(()=>N&&!B.publishedAt,[N,B.publishedAt]),{trackUsage:P}=(0,y.rS)(),{formatMessage:Z}=(0,V.Z)(),oe=(0,e.useRef)(P),re=(0,e.useMemo)(()=>p||u?!1:o===!1&&r===!1,[p,u,o,r]);(0,e.useEffect)(()=>{D==="resolved"?L():U()},[U,L,D]),(0,e.useEffect)(()=>{p||De()},[W]),(0,e.useEffect)(()=>{const ne=Object.keys(S);if(ne.length>0){const ee=ne[0],ie=document.getElementById(ee);ie&&ie.focus()}},[S]),(0,e.useEffect)(()=>{re&&q({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}})},[re,q]),(0,e.useEffect)(()=>{I({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]);const{components:me}=t,H=(0,pe.zH)(g);(0,e.useEffect)(()=>{g&&w?.attributes&&!At()(H,g)&&(I({type:"INIT_FORM",initialValues:g,components:me,attributes:w.attributes,setModifiedDataOnly:z}),z&&X(jl()))},[g,w,me,z,X,H]);const ae=(0,e.useCallback)(ne=>(ee,ie,Ue,mt=!1)=>{oe.current("didAddComponentToDynamicZone"),I({type:ne,keys:ee.split("."),componentLayoutData:ie,allComponents:Ue,shouldCheckErrors:mt})},[]),Ie=ae("ADD_COMPONENT_TO_DYNAMIC_ZONE"),Ne=(0,e.useCallback)((ne,ee,ie)=>{I({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:ne.split("."),componentLayoutData:ee,allComponents:ie})},[]),de=(0,e.useCallback)(({name:ne,value:ee,toOneRelation:ie})=>{I({type:"CONNECT_RELATION",keys:ne.split("."),value:ee,toOneRelation:ie})},[]),ue=(0,e.useCallback)(({target:{initialDataPath:ne,modifiedDataPath:ee,value:ie}})=>{I({type:"LOAD_RELATION",modifiedDataPath:ee,initialDataPath:ne,value:ie})},[]),Fe=ae("ADD_REPEATABLE_COMPONENT_TO_FIELD"),Ce=(0,e.useMemo)(()=>{const ne={isCreatingEntry:u,isDraft:Y,isFromComponent:!1};return(0,h.Ex)(w,{components:t.components||{}},ne)},[t.components,w,u,Y]),De=(0,e.useCallback)(async(ne={})=>{let ee={};const ie=Je()($);qe()(ie)||se()(ie,ne.path,ne.value);try{await Ce.validate(ie,{abortEarly:!1})}catch(Ue){ee=(0,y.CJ)(Ue),K&&(ee=Object.keys(ee).reduce((mt,Wo)=>(Wo.split(".")[0]!==K&&(mt[Wo]=ee[Wo]),mt),{}))}I({type:"SET_FORM_ERRORS",errors:ee})},[K,$,Ce]),Tt=(0,e.useCallback)(({target:{name:ne,value:ee,type:ie}},Ue=!1)=>{let mt=ee;if(["text","textarea","string","email","uid","select","select-one","number"].includes(ie)&&!ee&&ee!==0&&(mt=null),ie==="password"&&!ee){I({type:"REMOVE_PASSWORD_FIELD",keys:ne.split(".")});return}I({type:"ON_CHANGE",keys:ne.split("."),value:mt,shouldSetInitialValue:Ue})},[]),Re=(0,e.useCallback)((ne,ee)=>nc({browserState:ne,serverState:ee},w,t.components),[t.components,w]),_=(0,e.useMemo)(()=>N?Y?{status:"draft"}:{}:{},[N,Y]),fe=(0,e.useCallback)(async ne=>(ne.preventDefault(),I({type:"RESET_PUBLISH_CONFIRMATION"})),[]),ze=(0,e.useCallback)(async ne=>{ne.preventDefault();let ee={};try{await Ce.validate($,{abortEarly:!1})}catch(ie){ee=(0,y.CJ)(ie)}try{if(qe()(ee)){const ie=Re($,B);u?await m(ie,_):await v(ie,_)}}catch(ie){ee={...ee,...(0,y.nn)(ie,{getTrad:h.OB})}}I({type:"SET_FORM_ERRORS",errors:ee})},[Re,u,$,B,m,v,_,Ce]),jo=(0,e.useCallback)(async()=>{const ne=(0,h.Ex)(w,{components:x()(t,"components",{})},{isCreatingEntry:u,isDraft:!1,isFromComponent:!1}),ee=await E();if(!G.show&&ee>0){I({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:ee}});return}I({type:"RESET_PUBLISH_CONFIRMATION"});let ie={};try{await ne.validate($,{abortEarly:!1})}catch(Ue){ie=(0,y.CJ)(Ue)}try{qe()(ie)&&await b()}catch(Ue){ie={...ie,...(0,y.nn)(Ue,{getTrad:h.OB})}}I({type:"SET_FORM_ERRORS",errors:ie})},[t,w,u,$,G.show,b,E]),at=(0,e.useCallback)(ne=>{const ee=Object.keys(S).some(Ue=>Ue.split(".")[0]===ne);return!qe()(S)&&ee},[S]),pm=(0,e.useCallback)((ne,ee)=>{oe.current("changeComponentsOrder"),I({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:ne,currentIndex:ee,shouldCheckErrors:at(ne)})},[at]),gm=(0,e.useCallback)((ne,ee)=>{oe.current("changeComponentsOrder"),I({type:"MOVE_COMPONENT_UP",dynamicZoneName:ne,currentIndex:ee,shouldCheckErrors:at(ne)})},[at]),fm=(0,e.useCallback)(({name:ne,newIndex:ee,currentIndex:ie})=>{I({type:"MOVE_COMPONENT_FIELD",keys:ne.split("."),newIndex:ee,oldIndex:ie})},[]),hm=(0,e.useCallback)(({name:ne,id:ee})=>{I({type:"DISCONNECT_RELATION",keys:ne.split("."),id:ee})},[]),ym=(0,e.useCallback)(({name:ne,oldIndex:ee,newIndex:ie})=>{I({type:"REORDER_RELATION",keys:ne.split("."),oldIndex:ee,newIndex:ie})},[]),bm=(0,e.useCallback)((ne,ee)=>{oe.current("removeComponentFromDynamicZone"),I({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:ne,index:ee,shouldCheckErrors:at(ne)})},[at]),Em=(0,e.useCallback)((ne,ee)=>{I({type:"REMOVE_COMPONENT_FROM_FIELD",keys:ne.split("."),componentUid:ee})},[]),vm=(0,e.useCallback)((ne,ee)=>{I({type:"REMOVE_REPEATABLE_FIELD",keys:ne.split("."),componentUid:ee})},[]),Cm=(0,e.useCallback)(()=>{I({type:"TRIGGER_FORM_VALIDATION"})},[]);return re?e.createElement(te.l_,{to:c}):$?e.createElement(y.W1.Provider,{value:{addComponentToDynamicZone:Ie,addNonRepeatableComponentToField:Ne,addRepeatableComponentToField:Fe,allLayoutData:t,checkFormErrors:De,createActionAllowedFields:i,formErrors:S,hasDraftAndPublish:N,initialData:B,isCreatingEntry:u,isSingleType:f,shouldNotRunValidations:Y,status:D,layout:w,modifiedData:$,moveComponentField:fm,moveComponentDown:pm,moveComponentUp:gm,onChange:Tt,onPublish:jo,onUnpublish:k,readActionAllowedFields:R,redirectToPreviousPage:T,removeComponentFromDynamicZone:bm,removeComponentFromField:Em,removeRepeatableField:vm,relationConnect:de,relationDisconnect:hm,relationLoad:ue,relationReorder:ym,slug:O,triggerFormValidation:Cm,updateActionAllowedFields:C,onPublishPromptDismissal:fe,publishConfirmation:G}},p||!u&&!B.id?e.createElement(Te.o,{"aria-busy":"true"},e.createElement(y.dO,null)):e.createElement(e.Fragment,null,e.createElement(te.NL,{when:!At()($,B),message:Z({id:"global.prompt.unsaved"})}),e.createElement("form",{noValidate:!0,onSubmit:ze},s))):null};ao.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},ao.propTypes={allLayoutData:n().object.isRequired,allowedActions:n().object.isRequired,children:n().node.isRequired,componentsDataStructure:n().object.isRequired,contentTypeDataStructure:n().object.isRequired,createActionAllowedFields:n().array.isRequired,from:n().string,initialValues:n().object,isCreatingEntry:n().bool.isRequired,isLoadingForData:n().bool.isRequired,isSingleType:n().bool.isRequired,onPost:n().func.isRequired,onPublish:n().func.isRequired,onDraftRelationCheck:n().func.isRequired,onPut:n().func.isRequired,onUnpublish:n().func.isRequired,readActionAllowedFields:n().array.isRequired,redirectToPreviousPage:n().func,slug:n().string.isRequired,status:n().string.isRequired,updateActionAllowedFields:n().array.isRequired};var sc=ao,dt=t=>(0,h.IF)(`single-types/${t}`),en=d(33348),ac=t=>Object.values(t||{}).reduce((o,r)=>Object.assign(o,r),{}),Ir=(t={})=>{const{plugins:o,_q:r,...s}={...t,...ac(t.plugins)};return r&&se()(s,"_q",encodeURIComponent(r)),`${(0,en.stringify)(s,{encode:!1,addQueryPrefix:!0})}`};const Pr=({allLayoutData:t,children:o,slug:r})=>{const s=(0,Xe.useQueryClient)(),{trackUsage:a}=(0,y.rS)(),{push:l}=(0,te.k6)(),{setCurrentStep:i}=(0,y.c1)(),c=(0,e.useRef)(a),[g,u]=(0,e.useState)(!0),[{query:p,rawQuery:f}]=(0,y.Kx)(),m=Ir(p),b=(0,y.lm)(),E=(0,J.I0)(),{formatAPIError:v}=(0,y.So)(h.OB),k=(0,y.kY)(),{post:R,put:T,del:O}=k,{componentsDataStructure:D,contentTypeDataStructure:C,data:M,isLoading:I,status:S}=(0,J.v9)(no),B=(0,e.useCallback)(U=>{const L=(0,h.kc)(U,t.contentType,t.components);return(0,y.dU)(L,t.contentType,t.components)},[t]);(0,e.useEffect)(()=>()=>{E(Mr())},[E]),(0,e.useEffect)(()=>{const U=Object.keys(t.components).reduce((N,Y)=>{const P=(0,h.Di)(x()(t,["components",Y,"attributes"],{}),t.components);return N[Y]=(0,y.dU)(P,t.components[Y],t.components),N},{}),L=(0,h.Di)(t.contentType.attributes,t.components),w=(0,y.dU)(L,t.contentType,t.components);E(Tr(U,w))},[t,E]),(0,e.useEffect)(()=>{const L=Qe.Z.CancelToken.source();return(async N=>{E(Jt()),u(!0);try{const{data:Y}=await k.get(dt(`${r}${m}`),{cancelToken:N.token});E(eo(B(Y))),u(!1)}catch(Y){if(Qe.Z.isCancel(Y))return;const P=x()(Y,"response.status",null);P===404&&E(to(f,!0)),P===403&&(b({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),l("/"))}})(L),()=>L.cancel("Operation canceled by the user.")},[k,B,l,r,E,m,f,b]);const $=(0,e.useCallback)(U=>{b({type:"warning",message:v(U)})},[b,v]),K=(0,e.useCallback)(async U=>{try{c.current("willDeleteEntry",U);const{data:L}=await O(dt(`${r}${m}`));return b({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),c.current("didDeleteEntry",U),u(!0),E(to(f,!0)),Promise.resolve(L)}catch(L){return c.current("didNotDeleteEntry",{error:L,...U}),$(L),Promise.reject(L)}},[O,r,$,b,m,E,f]),W=(0,e.useCallback)(async(U,L)=>{const w=dt(`${r}${f}`);try{E(le("submit-pending"));const{data:N}=await T(w,U);return c.current("didCreateEntry",L),b({type:"success",message:{id:(0,h.OB)("success.record.save")}}),i("contentManager.success"),s.invalidateQueries(["relation"]),E(rt(B(N))),u(!1),E(le("resolved")),Promise.resolve(N)}catch(N){return c.current("didNotCreateEntry",{error:N,trackerProperty:L}),$(N),E(le("resolved")),Promise.reject(N)}},[T,B,$,r,E,f,b,i,s]),G=(0,e.useCallback)(async()=>{try{c.current("willCheckDraftRelations");const U=dt(`${r}/actions/numberOfDraftRelations`);E(le("draft-relation-check-pending"));const L=await k.get(U);return c.current("didCheckDraftRelations"),E(le("resolved")),L.data.data}catch(U){return $(U),E(le("resolved")),Promise.reject(U)}},[k,$,r,E]),z=(0,e.useCallback)(async()=>{try{c.current("willPublishEntry");const U=dt(`${r}/actions/publish${m}`);E(le("publish-pending"));const{data:L}=await R(U);return c.current("didPublishEntry"),b({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),E(rt(B(L))),E(le("resolved")),Promise.resolve(L)}catch(U){return $(U),E(le("resolved")),Promise.reject(U)}},[R,B,$,r,m,E,b]),X=(0,e.useCallback)(async(U,L)=>{const w=dt(`${r}${f}`);try{c.current("willEditEntry",L),E(le("submit-pending"));const{data:N}=await T(w,U);return b({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c.current("didEditEntry",{trackerProperty:L}),s.invalidateQueries(["relation"]),E(rt(B(N))),E(le("resolved")),Promise.resolve(N)}catch(N){return $(N),c.current("didNotEditEntry",{error:N,trackerProperty:L}),E(le("resolved")),Promise.reject(N)}},[T,B,$,r,E,f,b,s]),q=(0,e.useCallback)(async()=>{const U=dt(`${r}/actions/unpublish${m}`);E(le("unpublish-pending"));try{c.current("willUnpublishEntry");const{data:L}=await R(U);c.current("didUnpublishEntry"),b({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),E(rt(B(L))),E(le("resolved"))}catch(L){E(le("resolved")),$(L)}},[R,B,b,$,r,E,m]);return o({componentsDataStructure:D,contentTypeDataStructure:C,data:M,isCreatingEntry:g,isLoadingForData:I,onDelete:K,onPost:W,onDraftRelationCheck:G,onPublish:z,onPut:X,onUnpublish:q,redirectionLink:"/",status:S})};Pr.propTypes={allLayoutData:n().shape({components:n().object.isRequired,contentType:n().object.isRequired}).isRequired,children:n().func.isRequired,slug:n().string.isRequired};var ic=(0,e.memo)(Pr),lc=d(56243);function cc(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var dc=cc;function uc(){const{initialData:t,hasDraftAndPublish:o}=(0,y.Wq)(),r=t.publishedAt!==void 0&&t.publishedAt!==null;return{hasDraftAndPublish:o,isPublished:r}}var mc=uc;const pc=(0,j.ZP)(lc.Z)`
901
+ `,Yn=({category:t,components:o,variant:r,isOpen:s,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,V.Z)(),c=()=>{l(t)};return e.createElement(dn.U,{expanded:s,onToggle:c,size:"S"},e.createElement(un.B,{variant:r,title:i({id:t,defaultMessage:t}),togglePosition:"left"}),e.createElement(mn.v,null,e.createElement(A.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},e.createElement(Al,null,o.map(({componentUid:g,info:{displayName:u}})=>e.createElement(Kn,{key:g,onClick:a(g)},i({id:u,defaultMessage:u})))))))};Yn.defaultProps={components:[],isOpen:!1,variant:"primary"},Yn.propTypes={category:n().string.isRequired,components:n().array,isOpen:n().bool,onAddComponent:n().func.isRequired,onToggle:n().func.isRequired,variant:n().oneOf(["primary","secondary"])};var $l=Yn;const Xn=({components:t,isOpen:o,onClickAddComponent:r})=>{const{formatMessage:s}=(0,V.Z)(),{getComponentLayout:a}=(0,pe.PL)(),[l,i]=(0,e.useState)(""),c=(0,e.useMemo)(()=>{const p=t.map(m=>{const{category:b,info:E}=a(m);return{componentUid:m,category:b,info:E}}),f=vr()(p,"category");return Object.keys(f).reduce((m,b)=>(m.push({category:b,components:f[b]}),m),[])},[t,a]);(0,e.useEffect)(()=>{o&&c.length>0&&i(c[0].category)},[o,c]);const g=p=>()=>{r(p),i("")},u=p=>{i(f=>f===p?"":p)};return o?e.createElement(A.x,{paddingBottom:6},e.createElement(A.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral600"},s({id:(0,h.OB)("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),e.createElement(A.x,{paddingTop:2},e.createElement(Er.k,{attributeName:"data-strapi-accordion-toggle"},c.map(({category:p,components:f},m)=>e.createElement($l,{key:p,category:p,components:f,onAddComponent:g,isOpen:p===l,onToggle:u,variant:m%2===1?"primary":"secondary"})))))):null};Xn.defaultProps={components:[],isOpen:!1},Xn.propTypes={components:n().array,isOpen:n().bool,onClickAddComponent:n().func.isRequired};var Zl=Xn;const Jn=({name:t,addComponentToDynamicZone:o,formErrors:r,isCreatingEntry:s,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentField:c,removeComponentFromDynamicZone:g,dynamicDisplayedComponents:u,fieldSchema:p,metadatas:f})=>{const[m,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(""),{formatMessage:k}=(0,V.Z)(),R=(0,y.lm)(),{getComponentLayout:T,components:O}=(0,pe.PL)(),D=u.length,C=f.description?{id:f.description,defaultMessage:f.description}:null,{max:M=1/0,min:I=-1/0}=p,S=(0,e.useMemo)(()=>Object.keys(r).filter(P=>P===t).map(P=>r[P]),[r,t]),B=I-D,$=S.length>0,K=S.length>0&&x()(S,[0,"id"],"").includes("min"),W=$&&x()(S,[0,"id"],"")==="components.Input.error.validation.max",G=P=>{b(!1);const Z=T(P);o(t,Z,O,$)},z=()=>{D<M?b(P=>!P):R({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}})},X=(P,Z)=>{v(k({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${t}.${Z}`,position:q(P)})),c({name:t,newIndex:P,currentIndex:Z})},q=P=>`${P+1} of ${u.length}`,U=P=>{v(k({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${t}.${P}`}))},L=P=>{v(k({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${t}.${P}`,position:q(P)}))},w=P=>{v(k({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${t}.${P}`,position:q(P)}))},N=(P,Z)=>()=>{g(P,Z)};if(!a&&(s||!l&&!s))return e.createElement(y.X0,{description:C,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:i,name:t});const Y=`${t}-item-instructions`;return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},D>0&&e.createElement(A.x,null,e.createElement(xl,{intlDescription:C,label:f.label,labelAction:i,name:t,numberOfComponents:D,required:p.required||!1}),e.createElement(ht.T,{id:Y},k({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ht.T,{"aria-live":"assertive"},E),e.createElement("ol",{"aria-describedby":Y},u.map(({componentUid:P,id:Z},oe)=>e.createElement(kl,{componentUid:P,formErrors:r,key:`${P}-${Z}`,index:oe,isFieldAllowed:a,name:t,onMoveComponent:X,onRemoveComponentClick:N(t,oe),onCancel:U,onDropItem:w,onGrabItem:L})))),e.createElement(Ol,{hasError:$,hasMaxError:W,hasMinError:K,isDisabled:!a,label:f.label,missingComponentNumber:B,isOpen:m,name:t,onClick:z}),e.createElement(Zl,{isOpen:m,components:p.components??[],onClickAddComponent:G}))};Jn.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},Jn.propTypes={addComponentToDynamicZone:n().func.isRequired,dynamicDisplayedComponents:n().arrayOf(n().shape({componentUid:n().string.isRequired,id:n().number.isRequired})),fieldSchema:n().shape({components:n().array.isRequired,max:n().number,min:n().number,required:n().bool}),formErrors:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isFieldAllowed:n().bool.isRequired,isFieldReadable:n().bool.isRequired,labelAction:n().element,metadatas:n().shape({description:n().string,label:n().string}).isRequired,moveComponentField:n().func.isRequired,name:n().string.isRequired,removeComponentFromDynamicZone:n().func.isRequired};const Bl=(0,e.memo)(Jn,Ce());var ql=Vs(Bl,Qs),Qe=d(84306),ot=d(41578);const Xt=()=>({type:ot.ZA}),_n=t=>({type:ot.Id,data:t}),eo=(t,o=!1)=>({type:ot.TP,rawQuery:t,isSingleType:o}),Cr=()=>({type:ot.c2}),Rr=(t,o)=>({type:ot.w7,componentsDataStructure:t,contentTypeDataStructure:o}),le=t=>({type:ot.d0,status:t}),rt=t=>({type:ot.t9,data:t}),Nl=()=>({type:ot.tE});var to=t=>t["content-manager_editViewCrudReducer"];const no=({allLayoutData:t,children:o,slug:r,id:s,origin:a})=>{const l=(0,Xe.useQueryClient)(),i=(0,y.lm)(),{setCurrentStep:c}=(0,y.c1)(),{trackUsage:g}=(0,y.rS)(),{push:u,replace:p}=(0,te.k6)(),[{rawQuery:f}]=(0,y.Kx)(),m=(0,J.I0)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:v,isLoading:k,status:R}=(0,J.v9)(to),T=(0,pe.Ky)(r),{formatAPIError:O}=(0,y.So)(h.OB),D=(0,e.useRef)(!0),C=(0,e.useRef)(g),M=(0,e.useRef)(t),I=(0,y.kY)(),{put:S,post:B,del:$}=I,K=s===null,W=(0,e.useMemo)(()=>K&&!a?null:(0,h.IF)(`collection-types/${r}/${a||s}`),[r,s,K,a]),G=(0,e.useCallback)(P=>a?(0,y.w6)(P,M.current.contentType,M.current.components):P,[a]),z=(0,e.useCallback)(P=>{const Z=(0,h.kc)(P,M.current.contentType,M.current.components);return(0,y.dU)(Z,M.current.contentType,M.current.components)},[]);(0,e.useEffect)(()=>{const P=Object.keys(t.components).reduce((re,me)=>{const H=(0,h.Di)(x()(t,["components",me,"attributes"],{}),t.components);return re[me]=(0,y.dU)(H,t.components[me],t.components),re},{}),Z=(0,h.Di)(t.contentType.attributes,t.components),oe=(0,y.dU)(Z,t.contentType,t.components);m(Rr(P,oe))},[t,m]),(0,e.useEffect)(()=>()=>{m(Cr())},[m]),(0,e.useEffect)(()=>{const Z=Qe.default.CancelToken.source(),oe=async me=>{m(Xt());try{const{data:H}=await I.get(W,{cancelToken:me.token});m(_n(z(G(H))))}catch(H){if(Qe.default.isCancel(H))return;const ae=x()(H,"response.status",null);if(ae===404){u(T);return}ae===403&&(i({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),u(T))}},re=async()=>{await m(Xt()),await m(eo(f))};return D.current?(W?oe(Z):re(),()=>{Z.cancel("Operation canceled by the user.")}):()=>{}},[I,G,z,u,W,m,f,T,i]);const X=(0,e.useCallback)(P=>{i({type:"warning",message:O(P)})},[i,O]),q=(0,e.useCallback)(async P=>{try{C.current("willDeleteEntry",P);const{data:Z}=await $((0,h.IF)(`collection-types/${r}/${s}`));return i({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),C.current("didDeleteEntry",P),p(T),Promise.resolve(Z)}catch(Z){return C.current("didNotDeleteEntry",{error:Z,...P}),Promise.reject(Z)}},[s,r,i,$,T,p]),U=(0,e.useCallback)(async(P,Z)=>{const oe=`${(0,h.IF)(`collection-types/${r}`)}${f}`;try{m(le("submit-pending"));const{data:re}=await B(oe,P);return C.current("didCreateEntry",Z),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c("contentManager.success"),l.invalidateQueries(["relation"]),m(rt(z(re))),m(le("resolved")),p(`/content-manager/collectionType/${r}/${re.id}${f}`),Promise.resolve(re)}catch(re){return X(re),C.current("didNotCreateEntry",{error:re,trackerProperty:Z}),m(le("resolved")),Promise.reject(re)}},[z,X,p,r,m,f,i,c,l,B]),L=(0,e.useCallback)(async()=>{try{C.current("willCheckDraftRelations");const P=(0,h.IF)(`collection-types/${r}/${s}/actions/numberOfDraftRelations`);m(le("draft-relation-check-pending"));const Z=await I.get(P);return C.current("didCheckDraftRelations"),m(le("resolved")),Z.data.data}catch(P){return X(P),m(le("resolved")),Promise.reject(P)}},[X,s,r,m,I]),w=(0,e.useCallback)(async()=>{try{C.current("willPublishEntry");const P=(0,h.IF)(`collection-types/${r}/${s}/actions/publish`);m(le("publish-pending"));const{data:Z}=await B(P);return C.current("didPublishEntry"),m(rt(z(Z))),m(le("resolved")),i({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),Promise.resolve(Z)}catch(P){return X(P),m(le("resolved")),Promise.reject(P)}},[z,X,s,r,m,i,B]),N=(0,e.useCallback)(async(P,Z)=>{const oe=(0,h.IF)(`collection-types/${r}/${s}`);try{C.current("willEditEntry",Z),m(le("submit-pending"));const{data:re}=await S(oe,P);return C.current("didEditEntry",{trackerProperty:Z}),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),l.invalidateQueries(["relation"]),m(rt(z(re))),m(le("resolved")),Promise.resolve(re)}catch(re){return C.current("didNotEditEntry",{error:re,trackerProperty:Z}),X(re),m(le("resolved")),Promise.reject(re)}},[z,X,r,s,m,i,l,S]),Y=(0,e.useCallback)(async()=>{const P=(0,h.IF)(`collection-types/${r}/${s}/actions/unpublish`);m(le("unpublish-pending"));try{C.current("willUnpublishEntry");const{data:Z}=await B(P);return C.current("didUnpublishEntry"),i({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),m(rt(z(Z))),m(le("resolved")),Promise.resolve(Z)}catch(Z){return m(le("resolved")),X(Z),Promise.reject(Z)}},[z,X,s,r,m,i,B]);return o({componentsDataStructure:b,contentTypeDataStructure:E,data:v,isCreatingEntry:K,isLoadingForData:k,onDelete:q,onPost:U,onPublish:w,onDraftRelationCheck:L,onPut:N,onUnpublish:Y,status:R,redirectionLink:T})};no.defaultProps={id:null,origin:null},no.propTypes={allLayoutData:n().exact({components:n().object.isRequired,contentType:n().shape({apiID:n().string.isRequired,attributes:n().object.isRequired,info:n().object.isRequired,isDisplayed:n().bool.isRequired,kind:n().string.isRequired,layouts:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,pluginOptions:n().object,settings:n().object.isRequired,uid:n().string.isRequired}).isRequired}).isRequired,children:n().func.isRequired,id:n().string,origin:n().string,slug:n().string.isRequired};var jl=(0,e.memo)(no,Ce()),Wl=d(86834),qe=d.n(Wl),zl=d(99381),Je=d.n(zl),Ul=d(3040),se=d.n(Ul),oo=d(97889),Vl=d(56236),Hl=d.n(Vl),Ql=d(10268),Mr=d.n(Ql),ro=d(99526),Tr=(t,o,r,s)=>{const a=t.slice();return a.splice(o,1),a.splice(r,0,s),a},Gl=d(77236),Kl=d.n(Gl),Yl=d(85973),Xl=d.n(Yl);const Jl=({browserState:t,serverState:o},r,s)=>{const a=o,l=t,i=(u,p)=>x()(u,["attributes",p,"type"],""),c=(u,p)=>x()(u,["attributes",...p],""),g=(u,p,f,m)=>Object.keys(u).reduce((b,E)=>{const v=m?`${m}.${E}`:E,k=i(f,E),R=x()(u,E),T=x()(p,E),O=c(f,[E,"component"]),D=c(f,[E,"repeatable"]);let C;switch(k){case"json":C=JSON.parse(R);break;case"time":{C=R,R&&R.split(":").length<3&&(C=`${R}:00`);break}case"media":c(f,[E,"multiple"])===!0?C=R?R.filter(M=>!(M instanceof File)):null:C=x()(R,0)instanceof File?null:x()(R,"id",null);break;case"component":D?C=R&&R.map((M,I)=>g(M,(T??[])[I],s[O],`${v}.${I}`)):C=R&&g(R,T,s[O],v);break;case"relation":{const M=hr(a,l)(v).join(".");let I=x()(a,M,[]);const S=R.reduce(($,K,W,G)=>{const z=I.find(q=>q.id===K.id),X=G[W+1];if(!z||z.__temp_key__!==K.__temp_key__){const q=X?{before:X.id}:{end:!0};return[...$,{id:K.id,position:q}]}return $},[]);C={disconnect:I.reduce(($,K)=>R.find(W=>W.id===K.id)?$:[...$,{id:K.id}],[]),connect:S.reverse()};break}case"dynamiczone":C=R.map((M,I)=>g(M,(T??[])[I],s[M.__component],`${v}.${I}`));break;default:C=_l(R,"id")}return b[E]=C,b},{});return g(t,o,r,"")},_l=(t,o)=>Kl()(t)?t.map(r=>r[o]?r[o]:r):Xl()(t)?t[o]:t;var ec=Jl;const Jt=(t,o=()=>!1,r=void 0)=>{const s=(a,l,{ignoreFalseyValues:i=!1,path:c=[],parent:g=l}={})=>Object.entries(l).reduce((u,[p,f])=>{if(i&&(u==null||u[p]===void 0||u[p]===null))return u;if(o(f,{path:[...c,p],parent:g})&&(u[p]=typeof r=="function"?r(u[p],{path:[...c,p],parent:u}):r),f.type==="component"){const m=t[f.component].attributes;!f.repeatable&&u[p]&&typeof u[p]=="object"?u[p]=s(u[p],m,{ignoreFalseyValues:i,path:[...c,p],parent:l[p]}):f.repeatable&&Array.isArray(u[p])&&(u[p]=u[p].map((b,E)=>s(b,m,{ignoreFalseyValues:i,path:[...c,p,E],parent:l[p]})))}else f.type==="dynamiczone"&&Array.isArray(u[p])&&(u[p]=u[p].map((m,b)=>{const E=t[m.__component].attributes;return s(m,E,{ignoreFalseyValues:i,path:[...c,p,b],parent:l[p]})}));return u},{...a});return s},tc={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}};var nc=(t,o)=>(0,oo.ZP)(t,r=>{switch(o.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:s,allComponents:a}=o,l={...t.componentsDataStructure[s.uid]},c=Jt(a,g=>g.type==="relation",[])(l,s.attributes);se()(r,["modifiedData",...o.keys],c);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:s,allComponents:a,componentLayoutData:l,shouldCheckErrors:i}=o;i&&(r.shouldCheckErrors=!t.shouldCheckErrors),o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(r.modifiedDZName=s[0]);const c=x()(t,["modifiedData",...s],[]),g=o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?{...t.componentsDataStructure[l.uid],__component:l.uid,__temp_key__:(0,h.Uo)(c)+1}:{...t.componentsDataStructure[l.uid],__temp_key__:(0,h.Uo)(c)+1},p=Jt(a,m=>m.type==="relation",[])(g,l.attributes),f=Array.isArray(c)?[...c,p]:[p];se()(r,["modifiedData",...s],f);break}case"LOAD_RELATION":{const{initialDataPath:s,modifiedDataPath:a,value:l}=o,i=x()(t,s),c=x()(t,a),g=i?l.filter(f=>!i.some(m=>m.id===f.id)):l,u=(0,ro.zJ)(null,c[0]?.__temp_key__,g.length),p=g.map((f,m)=>({...f,__temp_key__:u[m]}));se()(r,s,Mr()([...p,...i],"id")),se()(r,a,Mr()([...p,...c],"id"));break}case"CONNECT_RELATION":{const s=["modifiedData",...o.keys],{value:a,toOneRelation:l}=o;if(l)se()(r,s,[a]);else{const i=x()(t,s),[c]=(0,ro.zJ)(i.at(-1)?.__temp_key__,null,1),g=[...i,{...a,__temp_key__:c}];se()(r,s,g)}break}case"DISCONNECT_RELATION":{const s=["modifiedData",...o.keys],{id:a}=o,i=x()(t,[...s]).filter(c=>c.id!==a);se()(r,s,i);break}case"MOVE_COMPONENT_FIELD":case"REORDER_RELATION":{const{oldIndex:s,newIndex:a,keys:l}=o,i=["modifiedData",...l],c=x()(t,[...i]),g=c[s],u=[...c];if(o.type==="REORDER_RELATION"){const p=s>a?c[a-1]?.__temp_key__:c[a]?.__temp_key__,f=s>a?c[a]?.__temp_key__:c[a+1]?.__temp_key__,[m]=(0,ro.zJ)(p,f,1);u.splice(s,1),u.splice(a,0,{...g,__temp_key__:m})}else u.splice(s,1),u.splice(a,0,g);se()(r,i,u);break}case"INIT_FORM":{const{initialValues:s,components:a={},attributes:l={},setModifiedDataOnly:i}=o,c=Je()(s),u=Jt(a,m=>m.type==="relation",(m,{path:b})=>t.modifiedData?.id===c.id&&x()(t.modifiedData,b)?x()(t.modifiedData,b):[])(c,l),f=Jt(a,m=>m.type==="dynamiczone"||m.type==="component"&&!m.repeatable,m=>Array.isArray(m)?m.map((b,E)=>({...b,__temp_key__:E})):{...m,__temp_key__:0})(u,l,{ignoreFalseyValues:!0});i||(r.initialData=f),r.modifiedData=f,r.formErrors={},r.modifiedDZName=null,r.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:s,dynamicZoneName:a,shouldCheckErrors:l}=o;l&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=t.modifiedData[a],c=o.type==="MOVE_COMPONENT_UP"?s-1:s+1,g=t.modifiedData[a][s],u=Tr(i,s,c,g);se()(r,["modifiedData",o.dynamicZoneName],u);break}case"MOVE_FIELD":{const s=x()(t,["modifiedData",...o.keys],[]).slice(),a=x()(t,["modifiedData",...o.keys,o.dragIndex]),l=Tr(s,o.dragIndex,o.overIndex,a);se()(r,["modifiedData",...o.keys],l);break}case"ON_CHANGE":{const[s]=o.keys;if(o.shouldSetInitialValue&&se()(r,["initialData",...o.keys],o.value),o.keys.length===2&&x()(t,["modifiedData",s])===null){se()(r,["modifiedData",s],{[o.keys[1]]:o.value});break}se()(r,["modifiedData",...o.keys],o.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{o.shouldCheckErrors&&(r.shouldCheckErrors=!t.shouldCheckErrors),r.modifiedData[o.dynamicZoneName].splice(o.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const s=["modifiedData",...o.keys];se()(r,s,null);break}case"REMOVE_PASSWORD_FIELD":{Hl()(r,["modifiedData",...o.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=o.keys.length-1,a=["modifiedData",...xt()(o.keys,s)];Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=x()(t,a).slice();i.splice(parseInt(o.keys[s],10),1),se()(r,a,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{r.componentsDataStructure=o.componentsDataStructure,r.contentTypeDataStructure=o.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{r.modifiedDZName=null,r.formErrors=o.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);break}case"SET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...o.publishConfirmation};break}case"RESET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...t.publishConfirmation,show:!1};break}default:return r}});const so=({allLayoutData:t,allowedActions:{canRead:o,canUpdate:r},children:s,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:c,initialValues:g,isCreatingEntry:u,isLoadingForData:p,isSingleType:f,onPost:m,onPublish:b,onDraftRelationCheck:E,onPut:v,onUnpublish:k,readActionAllowedFields:R,redirectToPreviousPage:T,slug:O,status:D,updateActionAllowedFields:C})=>{const[M,I]=(0,e.useReducer)(nc,tc),{formErrors:S,initialData:B,modifiedData:$,modifiedDZName:K,shouldCheckErrors:W,publishConfirmation:G}=M,{setModifiedDataOnly:z}=(0,J.v9)(to),X=(0,J.I0)(),q=(0,y.lm)(),{lockApp:U,unlockApp:L}=(0,y.o1)(),w=x()(t,["contentType"],{}),N=(0,e.useMemo)(()=>x()(w,["options","draftAndPublish"],!1),[w]),Y=(0,e.useMemo)(()=>N&&!B.publishedAt,[N,B.publishedAt]),{trackUsage:P}=(0,y.rS)(),{formatMessage:Z}=(0,V.Z)(),oe=(0,e.useRef)(P),re=(0,e.useMemo)(()=>p||u?!1:o===!1&&r===!1,[p,u,o,r]);(0,e.useEffect)(()=>{D==="resolved"?L():U()},[U,L,D]),(0,e.useEffect)(()=>{p||ke()},[W]),(0,e.useEffect)(()=>{const ne=Object.keys(S);if(ne.length>0){const ee=ne[0],ie=document.getElementById(ee);ie&&ie.focus()}},[S]),(0,e.useEffect)(()=>{re&&q({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}})},[re,q]),(0,e.useEffect)(()=>{I({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]);const{components:me}=t,H=(0,pe.zH)(g);(0,e.useEffect)(()=>{g&&w?.attributes&&!Ce()(H,g)&&(I({type:"INIT_FORM",initialValues:g,components:me,attributes:w.attributes,setModifiedDataOnly:z}),z&&X(Nl()))},[g,w,me,z,X,H]);const ae=(0,e.useCallback)(ne=>(ee,ie,Ue,mt=!1)=>{oe.current("didAddComponentToDynamicZone"),I({type:ne,keys:ee.split("."),componentLayoutData:ie,allComponents:Ue,shouldCheckErrors:mt})},[]),Pe=ae("ADD_COMPONENT_TO_DYNAMIC_ZONE"),Ne=(0,e.useCallback)((ne,ee,ie)=>{I({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:ne.split("."),componentLayoutData:ee,allComponents:ie})},[]),de=(0,e.useCallback)(({name:ne,value:ee,toOneRelation:ie})=>{I({type:"CONNECT_RELATION",keys:ne.split("."),value:ee,toOneRelation:ie})},[]),ue=(0,e.useCallback)(({target:{initialDataPath:ne,modifiedDataPath:ee,value:ie}})=>{I({type:"LOAD_RELATION",modifiedDataPath:ee,initialDataPath:ne,value:ie})},[]),Fe=ae("ADD_REPEATABLE_COMPONENT_TO_FIELD"),Re=(0,e.useMemo)(()=>{const ne={isCreatingEntry:u,isDraft:Y,isFromComponent:!1};return(0,h.Ex)(w,{components:t.components||{}},ne)},[t.components,w,u,Y]),ke=(0,e.useCallback)(async(ne={})=>{let ee={};const ie=Je()($);qe()(ie)||se()(ie,ne.path,ne.value);try{await Re.validate(ie,{abortEarly:!1})}catch(Ue){ee=(0,y.CJ)(Ue),K&&(ee=Object.keys(ee).reduce((mt,jo)=>(jo.split(".")[0]!==K&&(mt[jo]=ee[jo]),mt),{}))}I({type:"SET_FORM_ERRORS",errors:ee})},[K,$,Re]),Tt=(0,e.useCallback)(({target:{name:ne,value:ee,type:ie}},Ue=!1)=>{let mt=ee;if(["text","textarea","string","email","uid","select","select-one","number"].includes(ie)&&!ee&&ee!==0&&(mt=null),ie==="password"&&!ee){I({type:"REMOVE_PASSWORD_FIELD",keys:ne.split(".")});return}I({type:"ON_CHANGE",keys:ne.split("."),value:mt,shouldSetInitialValue:Ue})},[]),Me=(0,e.useCallback)((ne,ee)=>ec({browserState:ne,serverState:ee},w,t.components),[t.components,w]),_=(0,e.useMemo)(()=>N?Y?{status:"draft"}:{}:{},[N,Y]),fe=(0,e.useCallback)(async ne=>(ne.preventDefault(),I({type:"RESET_PUBLISH_CONFIRMATION"})),[]),ze=(0,e.useCallback)(async ne=>{ne.preventDefault();let ee={};try{await Re.validate($,{abortEarly:!1})}catch(ie){ee=(0,y.CJ)(ie)}try{if(qe()(ee)){const ie=Me($,B);u?await m(ie,_):await v(ie,_)}}catch(ie){ee={...ee,...(0,y.nn)(ie,{getTrad:h.OB})}}I({type:"SET_FORM_ERRORS",errors:ee})},[Me,u,$,B,m,v,_,Re]),No=(0,e.useCallback)(async()=>{const ne=(0,h.Ex)(w,{components:x()(t,"components",{})},{isCreatingEntry:u,isDraft:!1,isFromComponent:!1}),ee=await E();if(!G.show&&ee>0){I({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:ee}});return}I({type:"RESET_PUBLISH_CONFIRMATION"});let ie={};try{await ne.validate($,{abortEarly:!1})}catch(Ue){ie=(0,y.CJ)(Ue)}try{qe()(ie)&&await b()}catch(Ue){ie={...ie,...(0,y.nn)(Ue,{getTrad:h.OB})}}I({type:"SET_FORM_ERRORS",errors:ie})},[t,w,u,$,G.show,b,E]),at=(0,e.useCallback)(ne=>{const ee=Object.keys(S).some(Ue=>Ue.split(".")[0]===ne);return!qe()(S)&&ee},[S]),um=(0,e.useCallback)((ne,ee)=>{oe.current("changeComponentsOrder"),I({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:ne,currentIndex:ee,shouldCheckErrors:at(ne)})},[at]),mm=(0,e.useCallback)((ne,ee)=>{oe.current("changeComponentsOrder"),I({type:"MOVE_COMPONENT_UP",dynamicZoneName:ne,currentIndex:ee,shouldCheckErrors:at(ne)})},[at]),pm=(0,e.useCallback)(({name:ne,newIndex:ee,currentIndex:ie})=>{I({type:"MOVE_COMPONENT_FIELD",keys:ne.split("."),newIndex:ee,oldIndex:ie})},[]),gm=(0,e.useCallback)(({name:ne,id:ee})=>{I({type:"DISCONNECT_RELATION",keys:ne.split("."),id:ee})},[]),fm=(0,e.useCallback)(({name:ne,oldIndex:ee,newIndex:ie})=>{I({type:"REORDER_RELATION",keys:ne.split("."),oldIndex:ee,newIndex:ie})},[]),hm=(0,e.useCallback)((ne,ee)=>{oe.current("removeComponentFromDynamicZone"),I({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:ne,index:ee,shouldCheckErrors:at(ne)})},[at]),ym=(0,e.useCallback)((ne,ee)=>{I({type:"REMOVE_COMPONENT_FROM_FIELD",keys:ne.split("."),componentUid:ee})},[]),bm=(0,e.useCallback)((ne,ee)=>{I({type:"REMOVE_REPEATABLE_FIELD",keys:ne.split("."),componentUid:ee})},[]),Em=(0,e.useCallback)(()=>{I({type:"TRIGGER_FORM_VALIDATION"})},[]);return re?e.createElement(te.l_,{to:c}):$?e.createElement(y.W1.Provider,{value:{addComponentToDynamicZone:Pe,addNonRepeatableComponentToField:Ne,addRepeatableComponentToField:Fe,allLayoutData:t,checkFormErrors:ke,createActionAllowedFields:i,formErrors:S,hasDraftAndPublish:N,initialData:B,isCreatingEntry:u,isSingleType:f,shouldNotRunValidations:Y,status:D,layout:w,modifiedData:$,moveComponentField:pm,moveComponentDown:um,moveComponentUp:mm,onChange:Tt,onPublish:No,onUnpublish:k,readActionAllowedFields:R,redirectToPreviousPage:T,removeComponentFromDynamicZone:hm,removeComponentFromField:ym,removeRepeatableField:bm,relationConnect:de,relationDisconnect:gm,relationLoad:ue,relationReorder:fm,slug:O,triggerFormValidation:Em,updateActionAllowedFields:C,onPublishPromptDismissal:fe,publishConfirmation:G}},p||!u&&!B.id?e.createElement(De.o,{"aria-busy":"true"},e.createElement(y.dO,null)):e.createElement(e.Fragment,null,e.createElement(te.NL,{when:!Ce()($,B),message:Z({id:"global.prompt.unsaved"})}),e.createElement("form",{noValidate:!0,onSubmit:ze},s))):null};so.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},so.propTypes={allLayoutData:n().object.isRequired,allowedActions:n().object.isRequired,children:n().node.isRequired,componentsDataStructure:n().object.isRequired,contentTypeDataStructure:n().object.isRequired,createActionAllowedFields:n().array.isRequired,from:n().string,initialValues:n().object,isCreatingEntry:n().bool.isRequired,isLoadingForData:n().bool.isRequired,isSingleType:n().bool.isRequired,onPost:n().func.isRequired,onPublish:n().func.isRequired,onDraftRelationCheck:n().func.isRequired,onPut:n().func.isRequired,onUnpublish:n().func.isRequired,readActionAllowedFields:n().array.isRequired,redirectToPreviousPage:n().func,slug:n().string.isRequired,status:n().string.isRequired,updateActionAllowedFields:n().array.isRequired};var oc=so,dt=t=>(0,h.IF)(`single-types/${t}`),_t=d(33348),rc=t=>Object.values(t||{}).reduce((o,r)=>Object.assign(o,r),{}),Dr=(t={})=>{const{plugins:o,_q:r,...s}={...t,...rc(t.plugins)};return r&&se()(s,"_q",encodeURIComponent(r)),`${(0,_t.stringify)(s,{encode:!1,addQueryPrefix:!0})}`};const kr=({allLayoutData:t,children:o,slug:r})=>{const s=(0,Xe.useQueryClient)(),{trackUsage:a}=(0,y.rS)(),{push:l}=(0,te.k6)(),{setCurrentStep:i}=(0,y.c1)(),c=(0,e.useRef)(a),[g,u]=(0,e.useState)(!0),[{query:p,rawQuery:f}]=(0,y.Kx)(),m=Dr(p),b=(0,y.lm)(),E=(0,J.I0)(),{formatAPIError:v}=(0,y.So)(h.OB),k=(0,y.kY)(),{post:R,put:T,del:O}=k,{componentsDataStructure:D,contentTypeDataStructure:C,data:M,isLoading:I,status:S}=(0,J.v9)(to),B=(0,e.useCallback)(U=>{const L=(0,h.kc)(U,t.contentType,t.components);return(0,y.dU)(L,t.contentType,t.components)},[t]);(0,e.useEffect)(()=>()=>{E(Cr())},[E]),(0,e.useEffect)(()=>{const U=Object.keys(t.components).reduce((N,Y)=>{const P=(0,h.Di)(x()(t,["components",Y,"attributes"],{}),t.components);return N[Y]=(0,y.dU)(P,t.components[Y],t.components),N},{}),L=(0,h.Di)(t.contentType.attributes,t.components),w=(0,y.dU)(L,t.contentType,t.components);E(Rr(U,w))},[t,E]),(0,e.useEffect)(()=>{const L=Qe.default.CancelToken.source();return(async N=>{E(Xt()),u(!0);try{const{data:Y}=await k.get(dt(`${r}${m}`),{cancelToken:N.token});E(_n(B(Y))),u(!1)}catch(Y){if(Qe.default.isCancel(Y))return;const P=x()(Y,"response.status",null);P===404&&E(eo(f,!0)),P===403&&(b({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),l("/"))}})(L),()=>L.cancel("Operation canceled by the user.")},[k,B,l,r,E,m,f,b]);const $=(0,e.useCallback)(U=>{b({type:"warning",message:v(U)})},[b,v]),K=(0,e.useCallback)(async U=>{try{c.current("willDeleteEntry",U);const{data:L}=await O(dt(`${r}${m}`));return b({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),c.current("didDeleteEntry",U),u(!0),E(eo(f,!0)),Promise.resolve(L)}catch(L){return c.current("didNotDeleteEntry",{error:L,...U}),$(L),Promise.reject(L)}},[O,r,$,b,m,E,f]),W=(0,e.useCallback)(async(U,L)=>{const w=dt(`${r}${f}`);try{E(le("submit-pending"));const{data:N}=await T(w,U);return c.current("didCreateEntry",L),b({type:"success",message:{id:(0,h.OB)("success.record.save")}}),i("contentManager.success"),s.invalidateQueries(["relation"]),E(rt(B(N))),u(!1),E(le("resolved")),Promise.resolve(N)}catch(N){return c.current("didNotCreateEntry",{error:N,trackerProperty:L}),$(N),E(le("resolved")),Promise.reject(N)}},[T,B,$,r,E,f,b,i,s]),G=(0,e.useCallback)(async()=>{try{c.current("willCheckDraftRelations");const U=dt(`${r}/actions/numberOfDraftRelations`);E(le("draft-relation-check-pending"));const L=await k.get(U);return c.current("didCheckDraftRelations"),E(le("resolved")),L.data.data}catch(U){return $(U),E(le("resolved")),Promise.reject(U)}},[k,$,r,E]),z=(0,e.useCallback)(async()=>{try{c.current("willPublishEntry");const U=dt(`${r}/actions/publish${m}`);E(le("publish-pending"));const{data:L}=await R(U);return c.current("didPublishEntry"),b({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),E(rt(B(L))),E(le("resolved")),Promise.resolve(L)}catch(U){return $(U),E(le("resolved")),Promise.reject(U)}},[R,B,$,r,m,E,b]),X=(0,e.useCallback)(async(U,L)=>{const w=dt(`${r}${f}`);try{c.current("willEditEntry",L),E(le("submit-pending"));const{data:N}=await T(w,U);return b({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c.current("didEditEntry",{trackerProperty:L}),s.invalidateQueries(["relation"]),E(rt(B(N))),E(le("resolved")),Promise.resolve(N)}catch(N){return $(N),c.current("didNotEditEntry",{error:N,trackerProperty:L}),E(le("resolved")),Promise.reject(N)}},[T,B,$,r,E,f,b,s]),q=(0,e.useCallback)(async()=>{const U=dt(`${r}/actions/unpublish${m}`);E(le("unpublish-pending"));try{c.current("willUnpublishEntry");const{data:L}=await R(U);c.current("didUnpublishEntry"),b({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),E(rt(B(L))),E(le("resolved"))}catch(L){E(le("resolved")),$(L)}},[R,B,b,$,r,E,m]);return o({componentsDataStructure:D,contentTypeDataStructure:C,data:M,isCreatingEntry:g,isLoadingForData:I,onDelete:K,onPost:W,onDraftRelationCheck:G,onPublish:z,onPut:X,onUnpublish:q,redirectionLink:"/",status:S})};kr.propTypes={allLayoutData:n().shape({components:n().object.isRequired,contentType:n().object.isRequired}).isRequired,children:n().func.isRequired,slug:n().string.isRequired};var sc=(0,e.memo)(kr),ac=d(56243);function ic(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var lc=ic;function cc(){const{initialData:t,hasDraftAndPublish:o}=(0,y.Wq)(),r=t.publishedAt!==void 0&&t.publishedAt!==null;return{hasDraftAndPublish:o,isPublished:r}}var dc=cc;const uc=(0,j.ZP)(ac.Z)`
902
902
  width: ${(0,y.Q1)(6)};
903
903
  height: ${(0,y.Q1)(6)};
904
904
  * {
905
905
  fill: ${({theme:t,$bulletColor:o})=>t.colors[o]};
906
906
  }
907
- `,Or=({hasDraftAndPublish:t,isPublished:o})=>{const{formatMessage:r}=(0,V.Z)();if(!t)return null;const s={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=o?s.published:s.draft;return e.createElement(A.x,{hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5,...a.box},e.createElement(A.x,{as:F.k},e.createElement(pc,{$bulletColor:a.bulletColor}),e.createElement(A.x,{paddingLeft:3},e.createElement(Q.Z,{textColor:a.textColor},r({id:(0,h.OB)("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),e.createElement(Q.Z,{fontWeight:"bold",textColor:a.textColor},o&&r({id:(0,h.OB)("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!o&&r({id:(0,h.OB)("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};Or.propTypes={hasDraftAndPublish:n().bool.isRequired,isPublished:n().bool.isRequired};var gc=dc(Or,mc),st=d(66456),tn=d(29439),nn=d(22342),on=d(96166),rn=d(88693);function fc(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var hc=fc;function yc(){const{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:g,publishConfirmation:u,onPublishPromptDismissal:p}=(0,y.Wq)();return{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:g,publishConfirmation:u,onPublishPromptDismissal:p}}var bc=yc;const wr=(0,j.ZP)(F.k)`
907
+ `,Ir=({hasDraftAndPublish:t,isPublished:o})=>{const{formatMessage:r}=(0,V.Z)();if(!t)return null;const s={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=o?s.published:s.draft;return e.createElement(A.x,{hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5,...a.box},e.createElement(A.x,{as:F.k},e.createElement(uc,{$bulletColor:a.bulletColor}),e.createElement(A.x,{paddingLeft:3},e.createElement(Q.Z,{textColor:a.textColor},r({id:(0,h.OB)("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),e.createElement(Q.Z,{fontWeight:"bold",textColor:a.textColor},o&&r({id:(0,h.OB)("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!o&&r({id:(0,h.OB)("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};Ir.propTypes={hasDraftAndPublish:n().bool.isRequired,isPublished:n().bool.isRequired};var mc=lc(Ir,dc),st=d(66456),en=d(29439),tn=d(22342),nn=d(96166),on=d(88693);function pc(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var gc=pc;function fc(){const{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:g,publishConfirmation:u,onPublishPromptDismissal:p}=(0,y.Wq)();return{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:g,publishConfirmation:u,onPublishPromptDismissal:p}}var hc=fc;const Pr=(0,j.ZP)(F.k)`
908
908
  text-align: center;
909
- `,xr=({allowedActions:{canUpdate:t,canCreate:o,canPublish:r},initialData:s,isCreatingEntry:a,isSingleType:l,hasDraftAndPublish:i,layout:c,modifiedData:g,onPublish:u,onUnpublish:p,status:f,publishConfirmation:{show:m,draftCount:b},onPublishPromptDismissal:E})=>{const{goBack:v}=(0,te.k6)(),[k,R]=(0,e.useState)(!1),{formatMessage:T}=(0,V.Z)(),O=x()(c,["settings","mainField"],"id"),D=x()(c,["info","displayName"],"NOT FOUND"),C=!At()(s,g)||a&&!qe()(g);let I=T({id:(0,h.OB)("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!a&&!l&&(I=s[O]||D),l&&(I=D);let S=null;if(a&&o&&(S=e.createElement(F.k,{gap:2},i&&e.createElement(ce.z,{disabled:!0,startIcon:e.createElement(st.Z,null),variant:"secondary"},T({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(ce.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},T({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"})))),!a&&t){const W=i&&r,G=!qe()(s.publishedAt),z=G?f==="unpublish-pending":f==="publish-pending",X=G?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},q=G?()=>R(!0):()=>u();S=e.createElement(F.k,null,W&&e.createElement(ce.z,{disabled:C,loading:z,onClick:q,startIcon:e.createElement(st.Z,null),variant:"secondary"},T(X)),e.createElement(A.x,{paddingLeft:W?2:0},e.createElement(ce.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},T({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"}))))}const B=()=>R(W=>!W),$=()=>{B(),p()},K=`${T({id:(0,h.OB)("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return e.createElement(e.Fragment,null,e.createElement(he.T,{title:I.toString(),primaryAction:S,subtitle:K,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(tn.Z,null),onClick:W=>{W.preventDefault(),v()},to:"/"},T({id:"global.back",defaultMessage:"Back"}))}),e.createElement(nn.V,{onClose:B,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:k},e.createElement(on.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(F.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>e.createElement("br",null)}))),e.createElement(F.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),e.createElement(rn.c,{startAction:e.createElement(ce.z,{onClick:B,variant:"tertiary"},T({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{variant:"danger-light",onClick:$},T({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),e.createElement(nn.V,{onClose:E,title:T({id:(0,h.OB)("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:m},e.createElement(on.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(wr,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},b,T({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, one { relation is} other { relations are}}</b> not published yet and might lead to unexpected behavior."},{b:W=>e.createElement(Q.Z,{fontWeight:"bold"},W),count:b}))),e.createElement(wr,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),e.createElement(rn.c,{startAction:e.createElement(ce.z,{onClick:E,variant:"tertiary"},T({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{variant:"success",onClick:u},T({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};xr.propTypes={allowedActions:n().shape({canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canPublish:n().bool.isRequired}).isRequired,initialData:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isSingleType:n().bool.isRequired,status:n().string.isRequired,layout:n().object.isRequired,hasDraftAndPublish:n().bool.isRequired,modifiedData:n().object.isRequired,onPublish:n().func.isRequired,onUnpublish:n().func.isRequired,publishConfirmation:n().shape({show:n().bool.isRequired,draftCount:n().number.isRequired}).isRequired,onPublishPromptDismissal:n().func.isRequired};const Ec=(0,e.memo)(xr,xe());var vc=hc(Ec,bc),Cc=t=>{if(!t.layouts)return[];const o=t.layouts.edit,r=t.attributes,s=i=>x()(r,[i,"type"],"");let a=0;const l=[];return o.forEach(i=>{const c=i.some(({name:g})=>s(g)==="dynamiczone");l[a]||(l[a]=[]),c?(a=a===0&&qe()(l[0])?0:a+1,l[a]||(l[a]=[]),l[a].push(i),a+=1):l[a].push(i)}),l.filter(i=>i.length>0)},Rc=d(91815),Mc=d.n(Rc),Tc=d(3704),Fr=d.n(Tc),Dc=(t,o)=>{const r=s=>{const a=(0,y.ZT)(t,[{action:`plugin::content-manager.explorer.${s}`,subject:o}]);return Mc()(Fr()(a,"properties.fields"))};return{createActionAllowedFields:r("create"),readActionAllowedFields:r("read"),updateActionAllowedFields:r("update")}},kc=t=>{if(!t)return[];const r=[...t.contentType.layouts.edit,...Object.values(t.components).flatMap(a=>a.layouts.edit)].flat().filter(a=>a.fieldSchema.customField).map(a=>a.fieldSchema.customField);return[...new Set(r)]};function Ic(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var Pc=Ic;function Oc(){const{hasDraftAndPublish:t,modifiedData:o}=(0,y.Wq)();let r={};return t&&(r=qe()(o.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:t,trackerProperty:r}}var wc=Oc;const Lr=({onDelete:t,trackerProperty:o})=>{const[r,s]=(0,e.useState)(!1),[a,l]=(0,e.useState)(!1),{formatMessage:i}=(0,V.Z)(),{formatAPIError:c}=(0,y.So)(h.OB),g=(0,y.lm)(),u=()=>s(f=>!f),p=async()=>{try{l(!0),await t(o),l(!1),u()}catch(f){l(!1),u(),g({type:"warning",message:c(f)})}};return e.createElement(e.Fragment,null,e.createElement(ce.z,{onClick:u,size:"S",startIcon:e.createElement(Ye.Z,null),variant:"danger-light"},i({id:(0,h.OB)("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),e.createElement(y.QH,{isConfirmButtonLoading:a,isOpen:r,onConfirm:p,onToggleDialog:u}))};Lr.propTypes={onDelete:n().func.isRequired,trackerProperty:n().object.isRequired};const xc=(0,e.memo)(Lr,xe());var Fc=Pc(xc,wc);const io=({columns:t,customFieldInputs:o})=>e.createElement(ke.r,{gap:4},t.map(({fieldSchema:r,labelAction:s,metadatas:a,name:l,size:i,queryInfos:c})=>{if(r.type==="component"){const{component:u,max:p,min:f,repeatable:m=!1,required:b=!1}=r;return e.createElement(ge.P,{col:i,s:12,xs:12,key:u},e.createElement(Gt,{componentUid:u,labelAction:s,isRepeatable:m,intlLabel:{id:a.label,defaultMessage:a.label},max:p,min:f,name:l,required:b}))}return e.createElement(ge.P,{col:i,key:l,s:12,xs:12},e.createElement(qn,{size:i,fieldSchema:r,keys:l,labelAction:s,metadatas:a,queryInfos:c,customFieldInputs:o}))}));io.defaultProps={customFieldInputs:{}},io.propTypes={columns:n().array.isRequired,customFieldInputs:n().object};var Lc=io,lo=d(98178);const co=t=>t["content-manager_editViewLayoutManager"].currentLayout,Sc=(0,lo.P1)(co,t=>Cc(t?.contentType??{})),Ac=(0,lo.P1)(co,t=>kc(t)),$c=(()=>window&&window.strapi&&window.strapi.isEE?d(28243).Z:d(73710).Z)(),Sr=Oe.Z.contentManager,Zc=[{action:"plugin::content-type-builder.read",subject:null}],uo=t=>{let{allowedActions:o,isSingleType:r,goBack:s,slug:a,id:l,origin:i,userPermissions:c}=t;const{trackUsage:g}=(0,y.rS)(),{formatMessage:u}=(0,V.Z)(),{layout:p,formattedContentTypeLayout:f,customFieldUids:m}=(0,J.v9)(M=>({layout:co(M),formattedContentTypeLayout:Sc(M),customFieldUids:Ac(M)})),{isLazyLoading:b,lazyComponentStore:E}=Nn(m),{createActionAllowedFields:v,readActionAllowedFields:k,updateActionAllowedFields:R}=Dc(c,a),T=r?Sr.singleTypesConfigurations:Sr.collectionTypesConfigurations,O=`/content-manager/${r?"singleType":"collectionType"}/${a}/configurations/edit`,D=r?ic:Wl,C=M=>M.every(I=>I.every(S=>S.fieldSchema.type==="dynamiczone"));return b?e.createElement(y.dO,null):e.createElement(D,{allLayoutData:p,slug:a,id:l,origin:i},M=>{let{componentsDataStructure:I,contentTypeDataStructure:S,data:B,isCreatingEntry:$,isLoadingForData:K,onDelete:W,onPost:G,onPublish:z,onDraftRelationCheck:X,onPut:q,onUnpublish:U,redirectionLink:L,status:w}=M;return e.createElement(sc,{allowedActions:o,allLayoutData:p,createActionAllowedFields:v,componentsDataStructure:I,contentTypeDataStructure:S,from:L,initialValues:B,isCreatingEntry:$,isLoadingForData:K,isSingleType:r,onPost:G,onPublish:z,onDraftRelationCheck:X,onPut:q,onUnpublish:U,readActionAllowedFields:k,redirectToPreviousPage:s,slug:a,status:w,updateActionAllowedFields:R},e.createElement(Te.o,{"aria-busy":w!=="resolved"},e.createElement(vc,{allowedActions:o}),e.createElement(We.D,null,e.createElement(ke.r,{gap:4},e.createElement(ge.P,{col:9,s:12},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},f.map((N,Y)=>{if(C(N)){const{0:{0:{name:P,fieldSchema:Z,metadatas:oe,labelAction:re}}}=N;return e.createElement(A.x,{key:Y},e.createElement(ke.r,{gap:4},e.createElement(ge.P,{col:12,s:12,xs:12},e.createElement(Nl,{name:P,fieldSchema:Z,labelAction:re,metadatas:oe}))))}return e.createElement(A.x,{key:Y,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},N.map((P,Z)=>e.createElement(Lc,{columns:P,customFieldInputs:E,key:Z}))))}))),e.createElement(ge.P,{col:3,s:12},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(gc,null),e.createElement(A.x,{as:"aside","aria-labelledby":"additional-information",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},e.createElement($c,null),e.createElement(zt,{area:"contentManager.editView.informations"})),e.createElement(A.x,{as:"aside","aria-labelledby":"links"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(zt,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&e.createElement(y.jW,{permissions:Zc},e.createElement(y.Qj,{onClick:()=>{g("willEditEditLayout")},size:"S",startIcon:e.createElement(Ve.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},u({id:(0,h.OB)("link-to-ctb"),defaultMessage:"Edit the model"}))),e.createElement(y.jW,{permissions:T},e.createElement(y.Qj,{size:"S",startIcon:e.createElement(Ke.Z,null),style:{width:"100%"},to:O,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),o.canDelete&&!$&&e.createElement(Fc,{onDelete:W})))))))))})};uo.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},uo.propTypes={allowedActions:n().shape({canRead:n().bool.isRequired,canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canDelete:n().bool.isRequired}).isRequired,id:n().string,isSingleType:n().bool,goBack:n().func.isRequired,origin:n().string,slug:n().string.isRequired,userPermissions:n().array};var Bc=(0,e.memo)(uo);const mo=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.userPermissions);return r?e.createElement(y.dO,null):e.createElement(Bc,{...t,allowedActions:s})};mo.defaultProps={permissions:[]},mo.propTypes={permissions:n().array,slug:n().string.isRequired,userPermissions:n().array.isRequired};var qc=(0,e.memo)(mo,xe());const Ar=({layout:t,...o})=>{const r=(0,J.v9)(ft.Z),s=(0,J.I0)(),[{query:a}]=(0,y.Kx)(),{runHookWaterfall:l}=(0,y.j1)(),i=(0,pe.r5)(a,o.slug,"editView");return(0,e.useEffect)(()=>{const c=l(je.Eo,{layout:t,query:a});return s(kt(c.layout,a)),()=>{s(Dt())}},[t,s,a,l]),!r||!i?e.createElement(y.dO,null):e.createElement(qc,{...o,userPermissions:i})};Ar.propTypes={layout:n().shape({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,settings:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().object.isRequired}).isRequired}).isRequired};var sn=Ar,Nc=d(23940),$t=d.n(Nc),$r=d(9026);const po=t=>t.reduce((o,r)=>o+r.size,0),jc=t=>t.reduce((o,r,s)=>{const a={rowId:s,rowContent:r};return o.concat(a)},[]),Et=t=>t.reduce((o,r)=>{let s=[];const a=r.rowContent.reduce((c,g)=>{const u=po(c);return g.name==="_TEMP_"||(u+g.size<=12?c.push(g):s.push(g)),c},[]),l=o.length===0?0:Math.max.apply(Math,o.map(c=>c.rowId))+1,i=po(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),o.push({rowId:l,rowContent:a}),s.length>0){const c=po(s);c<12&&s.push({name:"_TEMP_",size:12-c}),o.push({rowId:l+1,rowContent:s}),s=[]}return o},[]).filter(o=>o.rowContent.length>0).filter(o=>o.rowContent.length===1?o.rowContent[0].name!=="_TEMP_":!0),Wc=t=>t.reduce((o,r)=>{const s=r.rowContent.filter(a=>a.name!=="_TEMP_");return o.concat([s])},[]),zc=(t,o=[])=>o.reduce((r,{rowContent:s})=>{const a=s.find(l=>l.name===t)?.size??null;return a&&(r=a),r},null),Uc=(t,o,r=[])=>r.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===t?{...a,size:o}:a),s)),Zr=6,go={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}};var Vc=(t=go,o)=>(0,ro.ZP)(t,r=>{const s=["modifiedData","layouts","edit"];switch(o.type){case"MOVE_ROW":{const a=x()(t,s,[]),{fromIndex:l,toIndex:i}=o;se()(r,s,(0,h.W3)(a,l,i));break}case"ON_ADD_FIELD":{const a=Je()(t),l=x()(a,["modifiedData","attributes",o.name],{}),i=o.fieldSizes[l?.customField]?.default??o.fieldSizes[l?.type]?.default??Zr,c=x()(a,s,[]).length,g=[...s,c-1,"rowContent"],u=x()(a,g,[]);let p=x()(a,s,[]);Array.isArray(u)?se()(p,[c>0?c-1:0,"rowContent"],[...u,{name:o.name,size:i}]):se()(p,[c>0?c-1:0,"rowContent"],[{name:o.name,size:i}]);const f=Et(p);se()(r,s,f);break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys],o.value);break}case"ON_CHANGE_META":{se()(r,["metaForm","metadata",...o.keys],o.value);break}case"ON_CHANGE_SIZE":{se()(r,["metaForm","size"],o.value);break}case"ON_RESET":{r.modifiedData=t.initialData;break}case"REMOVE_FIELD":{const a=x()(t,[...s,o.rowIndex,"rowContent"],[]);let l=Je()(t);if(a.length===1||a.length===2&&x()(a,[1,"name"],"")==="_TEMP_"){const c=x()(t,s,[]);se()(l,s,c.filter((g,u)=>o.rowIndex!==u))}else se()(l,[...s,o.rowIndex,"rowContent"],a.filter((c,g)=>g!==o.fieldIndex));const i=Et(x()(l,s,[]));se()(r,s,i);break}case"REORDER_DIFF_ROW":{const a=x()(t,[...s,o.dragRowIndex,"rowContent"],[]),l=x()(t,[...s,o.hoverRowIndex,"rowContent"],[]),i=x()(t,[...s,o.dragRowIndex,"rowContent",o.dragIndex],{}),c=[...l,i];let g=Je()(t);se()(g,[...s,o.dragRowIndex,"rowContent"],a.filter((p,f)=>o.dragIndex!==f)),se()(g,[...s,o.hoverRowIndex,"rowContent"],(0,h.W3)(c,c.length-1,o.hoverIndex));const u=Et(x()(g,s,[]));se()(r,s,u);break}case"REORDER_ROW":{const a=Je()(t),l=x()(a,[...s,o.dragRowIndex,"rowContent"],[]);se()(a,[...s,o.dragRowIndex,"rowContent"],(0,h.W3)(l,o.dragIndex,o.hoverIndex));const i=Et(x()(a,s,[]));se()(r,s,i);break}case"SET_FIELD_TO_EDIT":{r.metaToEdit=o.name,r.metaForm={metadata:x()(t,["modifiedData","metadatas",o.name,"edit"],{}),size:zc(o.name,t.modifiedData?.layouts?.edit)??Zr};break}case"SUBMIT_META_FORM":{se()(r,["modifiedData","metadatas",t.metaToEdit,"edit"],t.metaForm.metadata);const a=Je()(x()(t,s,[])),l=Uc(t.metaToEdit,t.metaForm.size,a);l.length>0&&se()(r,s,Et(l));break}case"SUBMIT_SUCCEEDED":{r.initialData=t.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{r.metaToEdit="",r.metaForm={};break}default:return r}}),Hc=(t,o,r)=>{let s=Je()(o);return se()(s,["layouts","edit"],Et(jc(o.layouts.edit))),{...t,initialData:s,modifiedData:s,componentLayouts:r}},Ge=d(34853);const Br=e.createContext();function fo({attributes:t,buttonData:o,children:r,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:g,relationsLayout:u,removeField:p,selectedItemName:f,setEditFieldToSelect:m,...b}){return e.createElement(Br.Provider,{value:{attributes:t,buttonData:o,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:g,relationsLayout:u,removeField:p,selectedItemName:f,setEditFieldToSelect:m,...b}},r)}fo.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},fo.propTypes={attributes:n().object,buttonData:n().array,children:n().node.isRequired,goTo:n().func,layout:n().array,metadatas:n().object,moveItem:n().func,moveRow:n().func,onAddData:n().func,relationsLayout:n().array,removeField:n().func,selectedItemName:n().string,setEditFieldToSelect:n().func};function ut(){return e.useContext(Br)}var an=d(74506),qr=d(45112);const Nr=({componentUid:t})=>{const{componentLayouts:o}=ut(),{formatMessage:r}=(0,V.Z)(),s=x()(o,[t],{}),a=x()(s,["layouts","edit"],[]);return e.createElement(A.x,{padding:3},a.map((l,i)=>e.createElement(ke.r,{gap:4,key:i},l.map(c=>e.createElement(ge.P,{key:c.name,col:c.size},e.createElement(A.x,{paddingTop:2},e.createElement(F.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},e.createElement(Q.Z,{textColor:"neutral800"},c.name))))))),e.createElement(A.x,{paddingTop:2},e.createElement(y.rU,{startIcon:e.createElement(qr.Z,null),to:`/content-manager/components/${t}/configurations/edit`},r({id:(0,ve.Z)("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};Nr.propTypes={componentUid:n().string.isRequired};var Qc=Nr,vt=d(14911);const Gc=(0,j.ZP)(F.k)`
909
+ `,Or=({allowedActions:{canUpdate:t,canCreate:o,canPublish:r},initialData:s,isCreatingEntry:a,isSingleType:l,hasDraftAndPublish:i,layout:c,modifiedData:g,onPublish:u,onUnpublish:p,status:f,publishConfirmation:{show:m,draftCount:b},onPublishPromptDismissal:E})=>{const{goBack:v}=(0,te.k6)(),[k,R]=(0,e.useState)(!1),{formatMessage:T}=(0,V.Z)(),O=x()(c,["settings","mainField"],"id"),D=x()(c,["info","displayName"],"NOT FOUND"),C=!Ce()(s,g)||a&&!qe()(g);let I=T({id:(0,h.OB)("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!a&&!l&&(I=s[O]||D),l&&(I=D);let S=null;if(a&&o&&(S=e.createElement(F.k,{gap:2},i&&e.createElement(ce.z,{disabled:!0,startIcon:e.createElement(st.Z,null),variant:"secondary"},T({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(ce.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},T({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"})))),!a&&t){const W=i&&r,G=!qe()(s.publishedAt),z=G?f==="unpublish-pending":f==="publish-pending",X=G?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},q=G?()=>R(!0):()=>u();S=e.createElement(F.k,null,W&&e.createElement(ce.z,{disabled:C,loading:z,onClick:q,startIcon:e.createElement(st.Z,null),variant:"secondary"},T(X)),e.createElement(A.x,{paddingLeft:W?2:0},e.createElement(ce.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},T({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"}))))}const B=()=>R(W=>!W),$=()=>{B(),p()},K=`${T({id:(0,h.OB)("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return e.createElement(e.Fragment,null,e.createElement(he.T,{title:I.toString(),primaryAction:S,subtitle:K,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),onClick:W=>{W.preventDefault(),v()},to:"/"},T({id:"global.back",defaultMessage:"Back"}))}),e.createElement(tn.V,{onClose:B,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:k},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(F.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>e.createElement("br",null)}))),e.createElement(F.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:B,variant:"tertiary"},T({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{variant:"danger-light",onClick:$},T({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),e.createElement(tn.V,{onClose:E,title:T({id:(0,h.OB)("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:m},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Pr,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},b,T({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, one { relation is} other { relations are}}</b> not published yet and might lead to unexpected behavior."},{b:W=>e.createElement(Q.Z,{fontWeight:"bold"},W),count:b}))),e.createElement(Pr,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:E,variant:"tertiary"},T({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{variant:"success",onClick:u},T({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};Or.propTypes={allowedActions:n().shape({canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canPublish:n().bool.isRequired}).isRequired,initialData:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isSingleType:n().bool.isRequired,status:n().string.isRequired,layout:n().object.isRequired,hasDraftAndPublish:n().bool.isRequired,modifiedData:n().object.isRequired,onPublish:n().func.isRequired,onUnpublish:n().func.isRequired,publishConfirmation:n().shape({show:n().bool.isRequired,draftCount:n().number.isRequired}).isRequired,onPublishPromptDismissal:n().func.isRequired};const yc=(0,e.memo)(Or,Ce());var bc=gc(yc,hc),Ec=t=>{if(!t.layouts)return[];const o=t.layouts.edit,r=t.attributes,s=i=>x()(r,[i,"type"],"");let a=0;const l=[];return o.forEach(i=>{const c=i.some(({name:g})=>s(g)==="dynamiczone");l[a]||(l[a]=[]),c?(a=a===0&&qe()(l[0])?0:a+1,l[a]||(l[a]=[]),l[a].push(i),a+=1):l[a].push(i)}),l.filter(i=>i.length>0)},vc=d(91815),Cc=d.n(vc),Rc=d(3704),wr=d.n(Rc),Mc=(t,o)=>{const r=s=>{const a=(0,y.ZT)(t,[{action:`plugin::content-manager.explorer.${s}`,subject:o}]);return Cc()(wr()(a,"properties.fields"))};return{createActionAllowedFields:r("create"),readActionAllowedFields:r("read"),updateActionAllowedFields:r("update")}},Tc=t=>{if(!t)return[];const r=[...t.contentType.layouts.edit,...Object.values(t.components).flatMap(a=>a.layouts.edit)].flat().filter(a=>a.fieldSchema.customField).map(a=>a.fieldSchema.customField);return[...new Set(r)]};function Dc(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var kc=Dc;function Ic(){const{hasDraftAndPublish:t,modifiedData:o}=(0,y.Wq)();let r={};return t&&(r=qe()(o.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:t,trackerProperty:r}}var Pc=Ic;const xr=({onDelete:t,trackerProperty:o})=>{const[r,s]=(0,e.useState)(!1),[a,l]=(0,e.useState)(!1),{formatMessage:i}=(0,V.Z)(),{formatAPIError:c}=(0,y.So)(h.OB),g=(0,y.lm)(),u=()=>s(f=>!f),p=async()=>{try{l(!0),await t(o),l(!1),u()}catch(f){l(!1),u(),g({type:"warning",message:c(f)})}};return e.createElement(e.Fragment,null,e.createElement(ce.z,{onClick:u,size:"S",startIcon:e.createElement(Ye.Z,null),variant:"danger-light"},i({id:(0,h.OB)("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),e.createElement(y.QH,{isConfirmButtonLoading:a,isOpen:r,onConfirm:p,onToggleDialog:u}))};xr.propTypes={onDelete:n().func.isRequired,trackerProperty:n().object.isRequired};const Oc=(0,e.memo)(xr,Ce());var wc=kc(Oc,Pc);const ao=({columns:t,customFieldInputs:o})=>e.createElement(Ie.r,{gap:4},t.map(({fieldSchema:r,labelAction:s,metadatas:a,name:l,size:i,queryInfos:c})=>{if(r.type==="component"){const{component:u,max:p,min:f,repeatable:m=!1,required:b=!1}=r;return e.createElement(ge.P,{col:i,s:12,xs:12,key:u},e.createElement(Qt,{componentUid:u,labelAction:s,isRepeatable:m,intlLabel:{id:a.label,defaultMessage:a.label},max:p,min:f,name:l,required:b}))}return e.createElement(ge.P,{col:i,key:l,s:12,xs:12},e.createElement(Bn,{size:i,fieldSchema:r,keys:l,labelAction:s,metadatas:a,queryInfos:c,customFieldInputs:o}))}));ao.defaultProps={customFieldInputs:{}},ao.propTypes={columns:n().array.isRequired,customFieldInputs:n().object};var xc=ao,io=d(98178);const lo=t=>t["content-manager_editViewLayoutManager"].currentLayout,Fc=(0,io.P1)(lo,t=>Ec(t?.contentType??{})),Lc=(0,io.P1)(lo,t=>Tc(t)),Sc=(()=>window&&window.strapi&&window.strapi.isEE?d(28243).Z:d(73710).Z)(),Fr=we.Z.contentManager,Ac=[{action:"plugin::content-type-builder.read",subject:null}],co=t=>{let{allowedActions:o,isSingleType:r,goBack:s,slug:a,id:l,origin:i,userPermissions:c}=t;const{trackUsage:g}=(0,y.rS)(),{formatMessage:u}=(0,V.Z)(),{layout:p,formattedContentTypeLayout:f,customFieldUids:m}=(0,J.v9)(M=>({layout:lo(M),formattedContentTypeLayout:Fc(M),customFieldUids:Lc(M)})),{isLazyLoading:b,lazyComponentStore:E}=qn(m),{createActionAllowedFields:v,readActionAllowedFields:k,updateActionAllowedFields:R}=Mc(c,a),T=r?Fr.singleTypesConfigurations:Fr.collectionTypesConfigurations,O=`/content-manager/${r?"singleType":"collectionType"}/${a}/configurations/edit`,D=r?sc:jl,C=M=>M.every(I=>I.every(S=>S.fieldSchema.type==="dynamiczone"));return b?e.createElement(y.dO,null):e.createElement(D,{allLayoutData:p,slug:a,id:l,origin:i},M=>{let{componentsDataStructure:I,contentTypeDataStructure:S,data:B,isCreatingEntry:$,isLoadingForData:K,onDelete:W,onPost:G,onPublish:z,onDraftRelationCheck:X,onPut:q,onUnpublish:U,redirectionLink:L,status:w}=M;return e.createElement(oc,{allowedActions:o,allLayoutData:p,createActionAllowedFields:v,componentsDataStructure:I,contentTypeDataStructure:S,from:L,initialValues:B,isCreatingEntry:$,isLoadingForData:K,isSingleType:r,onPost:G,onPublish:z,onDraftRelationCheck:X,onPut:q,onUnpublish:U,readActionAllowedFields:k,redirectToPreviousPage:s,slug:a,status:w,updateActionAllowedFields:R},e.createElement(De.o,{"aria-busy":w!=="resolved"},e.createElement(bc,{allowedActions:o}),e.createElement(We.D,null,e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{col:9,s:12},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},f.map((N,Y)=>{if(C(N)){const{0:{0:{name:P,fieldSchema:Z,metadatas:oe,labelAction:re}}}=N;return e.createElement(A.x,{key:Y},e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{col:12,s:12,xs:12},e.createElement(ql,{name:P,fieldSchema:Z,labelAction:re,metadatas:oe}))))}return e.createElement(A.x,{key:Y,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},N.map((P,Z)=>e.createElement(xc,{columns:P,customFieldInputs:E,key:Z}))))}))),e.createElement(ge.P,{col:3,s:12},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(mc,null),e.createElement(A.x,{as:"aside","aria-labelledby":"additional-information",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},e.createElement(Sc,null),e.createElement(Wt,{area:"contentManager.editView.informations"})),e.createElement(A.x,{as:"aside","aria-labelledby":"links"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Wt,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&e.createElement(y.jW,{permissions:Ac},e.createElement(y.Qj,{onClick:()=>{g("willEditEditLayout")},size:"S",startIcon:e.createElement(Ve.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},u({id:(0,h.OB)("link-to-ctb"),defaultMessage:"Edit the model"}))),e.createElement(y.jW,{permissions:T},e.createElement(y.Qj,{size:"S",startIcon:e.createElement(Ke.Z,null),style:{width:"100%"},to:O,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),o.canDelete&&!$&&e.createElement(wc,{onDelete:W})))))))))})};co.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},co.propTypes={allowedActions:n().shape({canRead:n().bool.isRequired,canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canDelete:n().bool.isRequired}).isRequired,id:n().string,isSingleType:n().bool,goBack:n().func.isRequired,origin:n().string,slug:n().string.isRequired,userPermissions:n().array};var $c=(0,e.memo)(co);const uo=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.userPermissions);return r?e.createElement(y.dO,null):e.createElement($c,{...t,allowedActions:s})};uo.defaultProps={permissions:[]},uo.propTypes={permissions:n().array,slug:n().string.isRequired,userPermissions:n().array.isRequired};var Zc=(0,e.memo)(uo,Ce());const Lr=({layout:t,...o})=>{const r=(0,J.v9)(ft.Z),s=(0,J.I0)(),[{query:a}]=(0,y.Kx)(),{runHookWaterfall:l}=(0,y.j1)(),i=(0,pe.r5)(a,o.slug,"editView");return(0,e.useEffect)(()=>{const c=l(je.Eo,{layout:t,query:a});return s(kt(c.layout,a)),()=>{s(Dt())}},[t,s,a,l]),!r||!i?e.createElement(y.dO,null):e.createElement(Zc,{...o,userPermissions:i})};Lr.propTypes={layout:n().shape({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,settings:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().object.isRequired}).isRequired}).isRequired};var rn=Lr,Bc=d(23940),At=d.n(Bc),Sr=d(9026);const mo=t=>t.reduce((o,r)=>o+r.size,0),qc=t=>t.reduce((o,r,s)=>{const a={rowId:s,rowContent:r};return o.concat(a)},[]),Et=t=>t.reduce((o,r)=>{let s=[];const a=r.rowContent.reduce((c,g)=>{const u=mo(c);return g.name==="_TEMP_"||(u+g.size<=12?c.push(g):s.push(g)),c},[]),l=o.length===0?0:Math.max.apply(Math,o.map(c=>c.rowId))+1,i=mo(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),o.push({rowId:l,rowContent:a}),s.length>0){const c=mo(s);c<12&&s.push({name:"_TEMP_",size:12-c}),o.push({rowId:l+1,rowContent:s}),s=[]}return o},[]).filter(o=>o.rowContent.length>0).filter(o=>o.rowContent.length===1?o.rowContent[0].name!=="_TEMP_":!0),Nc=t=>t.reduce((o,r)=>{const s=r.rowContent.filter(a=>a.name!=="_TEMP_");return o.concat([s])},[]),jc=(t,o=[])=>o.reduce((r,{rowContent:s})=>{const a=s.find(l=>l.name===t)?.size??null;return a&&(r=a),r},null),Wc=(t,o,r=[])=>r.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===t?{...a,size:o}:a),s)),Ar=6,po={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}};var zc=(t=po,o)=>(0,oo.ZP)(t,r=>{const s=["modifiedData","layouts","edit"];switch(o.type){case"MOVE_ROW":{const a=x()(t,s,[]),{fromIndex:l,toIndex:i}=o;se()(r,s,(0,h.W3)(a,l,i));break}case"ON_ADD_FIELD":{const a=Je()(t),l=x()(a,["modifiedData","attributes",o.name],{}),i=o.fieldSizes[l?.customField]?.default??o.fieldSizes[l?.type]?.default??Ar,c=x()(a,s,[]).length,g=[...s,c-1,"rowContent"],u=x()(a,g,[]);let p=x()(a,s,[]);Array.isArray(u)?se()(p,[c>0?c-1:0,"rowContent"],[...u,{name:o.name,size:i}]):se()(p,[c>0?c-1:0,"rowContent"],[{name:o.name,size:i}]);const f=Et(p);se()(r,s,f);break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys],o.value);break}case"ON_CHANGE_META":{se()(r,["metaForm","metadata",...o.keys],o.value);break}case"ON_CHANGE_SIZE":{se()(r,["metaForm","size"],o.value);break}case"ON_RESET":{r.modifiedData=t.initialData;break}case"REMOVE_FIELD":{const a=x()(t,[...s,o.rowIndex,"rowContent"],[]);let l=Je()(t);if(a.length===1||a.length===2&&x()(a,[1,"name"],"")==="_TEMP_"){const c=x()(t,s,[]);se()(l,s,c.filter((g,u)=>o.rowIndex!==u))}else se()(l,[...s,o.rowIndex,"rowContent"],a.filter((c,g)=>g!==o.fieldIndex));const i=Et(x()(l,s,[]));se()(r,s,i);break}case"REORDER_DIFF_ROW":{const a=x()(t,[...s,o.dragRowIndex,"rowContent"],[]),l=x()(t,[...s,o.hoverRowIndex,"rowContent"],[]),i=x()(t,[...s,o.dragRowIndex,"rowContent",o.dragIndex],{}),c=[...l,i];let g=Je()(t);se()(g,[...s,o.dragRowIndex,"rowContent"],a.filter((p,f)=>o.dragIndex!==f)),se()(g,[...s,o.hoverRowIndex,"rowContent"],(0,h.W3)(c,c.length-1,o.hoverIndex));const u=Et(x()(g,s,[]));se()(r,s,u);break}case"REORDER_ROW":{const a=Je()(t),l=x()(a,[...s,o.dragRowIndex,"rowContent"],[]);se()(a,[...s,o.dragRowIndex,"rowContent"],(0,h.W3)(l,o.dragIndex,o.hoverIndex));const i=Et(x()(a,s,[]));se()(r,s,i);break}case"SET_FIELD_TO_EDIT":{r.metaToEdit=o.name,r.metaForm={metadata:x()(t,["modifiedData","metadatas",o.name,"edit"],{}),size:jc(o.name,t.modifiedData?.layouts?.edit)??Ar};break}case"SUBMIT_META_FORM":{se()(r,["modifiedData","metadatas",t.metaToEdit,"edit"],t.metaForm.metadata);const a=Je()(x()(t,s,[])),l=Wc(t.metaToEdit,t.metaForm.size,a);l.length>0&&se()(r,s,Et(l));break}case"SUBMIT_SUCCEEDED":{r.initialData=t.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{r.metaToEdit="",r.metaForm={};break}default:return r}}),Uc=(t,o,r)=>{let s=Je()(o);return se()(s,["layouts","edit"],Et(qc(o.layouts.edit))),{...t,initialData:s,modifiedData:s,componentLayouts:r}},Ge=d(34853);const $r=e.createContext();function go({attributes:t,buttonData:o,children:r,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:g,relationsLayout:u,removeField:p,selectedItemName:f,setEditFieldToSelect:m,...b}){return e.createElement($r.Provider,{value:{attributes:t,buttonData:o,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:g,relationsLayout:u,removeField:p,selectedItemName:f,setEditFieldToSelect:m,...b}},r)}go.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},go.propTypes={attributes:n().object,buttonData:n().array,children:n().node.isRequired,goTo:n().func,layout:n().array,metadatas:n().object,moveItem:n().func,moveRow:n().func,onAddData:n().func,relationsLayout:n().array,removeField:n().func,selectedItemName:n().string,setEditFieldToSelect:n().func};function ut(){return e.useContext($r)}var sn=d(74506),Zr=d(45112);const Br=({componentUid:t})=>{const{componentLayouts:o}=ut(),{formatMessage:r}=(0,V.Z)(),s=x()(o,[t],{}),a=x()(s,["layouts","edit"],[]);return e.createElement(A.x,{padding:3},a.map((l,i)=>e.createElement(Ie.r,{gap:4,key:i},l.map(c=>e.createElement(ge.P,{key:c.name,col:c.size},e.createElement(A.x,{paddingTop:2},e.createElement(F.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},e.createElement(Q.Z,{textColor:"neutral800"},c.name))))))),e.createElement(A.x,{paddingTop:2},e.createElement(y.rU,{startIcon:e.createElement(Zr.Z,null),to:`/content-manager/components/${t}/configurations/edit`},r({id:(0,ve.Z)("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};Br.propTypes={componentUid:n().string.isRequired};var Vc=Br,vt=d(14911);const Hc=(0,j.ZP)(F.k)`
910
910
  text-decoration: none;
911
911
 
912
912
  &:focus,
@@ -926,12 +926,12 @@ ${t}
926
926
  color: ${({theme:t})=>t.colors.primary600};
927
927
  }
928
928
  }
929
- `,jr=({components:t})=>{const{componentLayouts:o}=ut();return e.createElement(F.k,{gap:2,overflow:"scroll hidden",padding:3},t.map(r=>e.createElement(Gc,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:r,padding:2,direction:"column",borderColor:"neutral200",as:vt.rU,to:`/content-manager/components/${r}/configurations/edit`},e.createElement(Xt,null),e.createElement(A.x,{paddingTop:1},e.createElement(Q.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},o?.[r]?.info?.displayName??"")))))};jr.propTypes={components:n().arrayOf(n().string).isRequired};var Kc=jr;const Wr=(0,j.ZP)(be.h)`
929
+ `,qr=({components:t})=>{const{componentLayouts:o}=ut();return e.createElement(F.k,{gap:2,overflow:"scroll hidden",padding:3},t.map(r=>e.createElement(Hc,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:r,padding:2,direction:"column",borderColor:"neutral200",as:vt.rU,to:`/content-manager/components/${r}/configurations/edit`},e.createElement(Yt,null),e.createElement(A.x,{paddingTop:1},e.createElement(Q.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},o?.[r]?.info?.displayName??"")))))};qr.propTypes={components:n().arrayOf(n().string).isRequired};var Qc=qr;const Nr=(0,j.ZP)(be.h)`
930
930
  background-color: transparent;
931
931
  path {
932
932
  fill: ${({theme:t})=>t.colors.neutral600};
933
933
  }
934
- `,ho=({attribute:t,onEditField:o,onDeleteField:r,children:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(A.x,{overflow:"hidden",width:"100%"},e.createElement(F.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},e.createElement(Q.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},s),e.createElement(F.k,null,e.createElement(Wr,{label:a({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:s}),onClick:o,icon:e.createElement(Ve.Z,null),noBorder:!0}),e.createElement(Wr,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:s}),"data-testid":"delete-field",onClick:r,icon:e.createElement(Ye.Z,null),noBorder:!0}))),t?.type==="component"&&e.createElement(Qc,{componentUid:t.component}),t?.type==="dynamiczone"&&e.createElement(Kc,{components:t.components}))};ho.defaultProps={attribute:void 0},ho.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),onEditField:n().func.isRequired,onDeleteField:n().func.isRequired,children:n().string.isRequired};var Yc=ho;const Xc=(0,j.ZP)(F.k)`
934
+ `,fo=({attribute:t,onEditField:o,onDeleteField:r,children:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(A.x,{overflow:"hidden",width:"100%"},e.createElement(F.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},e.createElement(Q.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},s),e.createElement(F.k,null,e.createElement(Nr,{label:a({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:s}),onClick:o,icon:e.createElement(Ve.Z,null),noBorder:!0}),e.createElement(Nr,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:s}),"data-testid":"delete-field",onClick:r,icon:e.createElement(Ye.Z,null),noBorder:!0}))),t?.type==="component"&&e.createElement(Vc,{componentUid:t.component}),t?.type==="dynamiczone"&&e.createElement(Qc,{components:t.components}))};fo.defaultProps={attribute:void 0},fo.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),onEditField:n().func.isRequired,onDeleteField:n().func.isRequired,children:n().string.isRequired};var Gc=fo;const Kc=(0,j.ZP)(F.k)`
935
935
  position: relative;
936
936
  ${({isFirst:t,isLast:o,hasHorizontalPadding:r})=>t?`
937
937
  padding-right: 4px;
@@ -963,25 +963,25 @@ ${t}
963
963
  z-index: 1;
964
964
  }
965
965
  `:""};
966
- `,Jc=(0,j.ZP)(nt.Z)`
966
+ `,Yc=(0,j.ZP)(nt.Z)`
967
967
  height: ${12/16}rem;
968
968
  width: ${12/16}rem;
969
969
  path {
970
970
  fill: ${({theme:t})=>t.colors.neutral600};
971
971
  }
972
- `,_c=(0,j.ZP)(F.k)`
972
+ `,Xc=(0,j.ZP)(F.k)`
973
973
  display: ${({dragStart:t})=>t?"none":"flex"};
974
974
  opacity: ${({isDragging:t,isFullSize:o,isHidden:r})=>t&&!o?.2:t&&o||r?0:1};
975
- `,ed=(0,j.ZP)(F.k)`
975
+ `,Jc=(0,j.ZP)(F.k)`
976
976
  cursor: all-scroll;
977
977
  border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
978
- `,yo=({attribute:t,children:o,index:r,lastIndex:s,moveItem:a,moveRow:l,name:i,onDeleteField:c,onEditField:g,rowIndex:u,size:p})=>{const[f,m]=(0,e.useState)(!1),b=i==="_TEMP_",{setIsDraggingSibling:E}=ut(),v=p===12,k=(0,e.useRef)(null),R=(0,e.useRef)(null),[{clientOffset:T,isOver:O},D]=(0,an.useDrop)({accept:h._Q.EDIT_FIELD,hover(q,U){if(!R.current||q.size!==12)return;const L=U.getItem().index,w=r,N=U.getItem().rowIndex,Y=u;if(L===w&&N===Y)return;const P=R.current.getBoundingClientRect(),Z=(P.bottom-P.top)/2,re=U.getClientOffset().y-P.top;N<Y&&re<Z||N>Y&&re>Z||(l(N,Y),q.rowIndex=Y,q.itemIndex=w)},drop(q,U){if(!R.current)return;const L=U.getItem().index,w=r,N=U.getItem().rowIndex,Y=u;if(q.size===12||L===w&&N===Y)return;const P=R.current.getBoundingClientRect();if(Math.abs(U.getClientOffset().x-P.left)>P.width/1.8){a(L,w+1,N,Y),q.itemIndex=w+1,q.rowIndex=Y;return}a(L,w,N,Y),q.itemIndex=w,q.rowIndex=Y},collect:q=>({canDrop:q.canDrop(),clientOffset:q.getClientOffset(),isOver:q.isOver(),isOverCurrent:q.isOver({shallow:!0}),itemType:q.getItemType()})}),[{isDragging:C,getItem:M},I,S]=(0,an.useDrag)({type:h._Q.EDIT_FIELD,item(){return E(!0),{index:r,labelField:o,rowIndex:u,name:i,size:p}},canDrag(){return i!=="_TEMP_"},collect:q=>({isDragging:q.isDragging(),getItem:q.getItem()}),end(){E(!1)}});(0,e.useEffect)(()=>{S((0,wt.rX)(),{captureDraggingState:!0})},[S]);const B={dragRef:I(k),dropRef:D(R)};let $=!1,K=!1;if(R.current&&T){const q=R.current.getBoundingClientRect();$=O&&M.size!==12&&Math.abs(T.x-q.left)<q.width/2,K=O&&M.size!==12&&Math.abs(T.x-q.left)>q.width/2,i==="_TEMP_"&&($=O&&M.size!==12,K=!1)}const W=()=>t&&v?`${74/16}rem`:`${32/16}rem`,G=r===0&&!v,z=r===s&&!v,X=r!==0&&!v;return e.createElement(ge.P,{col:p},e.createElement(Xc,{ref:B.dropRef,showLeftCarret:$,showRightCarret:K,isFirst:G,isLast:z,hasHorizontalPadding:X,onDrag:()=>{v&&!f&&m(!0)},onDragEnd:()=>{v&&m(!1)}},f&&v&&e.createElement(A.x,{width:"100%",height:"2px",background:"primary600"}),e.createElement(_c,{width:v&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:W(),alignItems:"stretch",isDragging:C,dragStart:f,isFullSize:v,isHidden:b},e.createElement(ed,{as:"span",type:"button",ref:B.dragRef,onClick:q=>q.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},e.createElement(Jc,null)),!b&&e.createElement(Yc,{attribute:t,onEditField:g,onDeleteField:c},o))))};yo.defaultProps={attribute:void 0},yo.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),children:n().string.isRequired,index:n().number.isRequired,moveItem:n().func.isRequired,moveRow:n().func.isRequired,name:n().string.isRequired,onDeleteField:n().func.isRequired,onEditField:n().func.isRequired,rowIndex:n().number.isRequired,lastIndex:n().number.isRequired,size:n().number.isRequired};var td=yo;const zr=({rowItem:t,onRemoveField:o,rowId:r,rowIndex:s,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:c,modifiedData:g,moveRow:u,moveItem:p}=ut(),f=x()(c,[t.name],{}),m=x()(g,["metadatas",t.name,"edit","label"],"");return e.createElement(td,{onEditField:()=>i(t.name),onDeleteField:()=>o(r,a),attribute:f,index:a,lastIndex:l,rowIndex:s,name:t.name,size:t.size,moveRow:u,moveItem:p},m||t.name)};zr.propTypes={index:n().number.isRequired,lastIndex:n().number.isRequired,onRemoveField:n().func.isRequired,rowId:n().number.isRequired,rowIndex:n().number.isRequired,rowItem:n().object.isRequired};var nd=zr;const Ur=({row:t,onRemoveField:o,rowIndex:r})=>e.createElement(ke.r,null,t.rowContent.map((s,a)=>e.createElement(nd,{key:s.name,rowItem:s,index:a,rowId:t.rowId,onRemoveField:o,rowIndex:r,lastIndex:t.rowContent.length-1})));Ur.propTypes={onRemoveField:n().func.isRequired,row:n().object.isRequired,rowIndex:n().number.isRequired};var od=Ur;const rd=[{action:"plugin::content-type-builder.read",subject:null}];var sd=()=>{const{trackUsage:t}=(0,y.rS)(),{formatMessage:o}=(0,V.Z)(),{slug:r,modifiedData:s,isContentTypeView:a}=ut(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,c=x()(s,"category",""),g=l==="content-types"?r:`${c}/${r}`,u=()=>{t("willEditEditLayout")};return r==="strapi::administrator"?null:e.createElement(y.jW,{permissions:rd},e.createElement(y.Qj,{to:`${i}/${g}`,onClick:u,size:"S",startIcon:e.createElement(Ve.Z,null),variant:"secondary"},o({id:(0,ve.Z)(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))};const Vr=({editLayout:t,fields:o,onRemoveField:r,onAddField:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(F.k,{justifyContent:"space-between"},e.createElement("div",null,e.createElement(A.x,null,e.createElement(Q.Z,{fontWeight:"bold"},a({id:(0,h.OB)("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),e.createElement(A.x,null,e.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),e.createElement(sd,null)),e.createElement(A.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},t.map((l,i)=>e.createElement(od,{key:l.rowId,row:l,rowIndex:i,onRemoveField:r})),e.createElement(Ge.O,{id:"label",label:a({id:(0,h.OB)("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:ce.z,"data-testid":"add-field",fullWidth:!0,startIcon:e.createElement(St.Z,null),endIcon:null,variant:"secondary",disabled:o.length===0},o.map(l=>e.createElement(Ge.s,{key:l,onClick:()=>s(l)},l))))))};Vr.propTypes={editLayout:n().array.isRequired,fields:n().array.isRequired,onAddField:n().func.isRequired,onRemoveField:n().func.isRequired};var ad=Vr,Hr=d(85025),Qr=d(55225),Gr=d(31600),Kr=d(11406),Zt=d(32031),id=d(73779),ln=d(88675),ld=d(22348),Yr=d(7184),bo=d(43475),cd=d(82512),Eo=d(83218),dd=d(872),ud=d(17757),md=d(1176),pd=d(15431);const Xr={biginteger:e.createElement(Zt.Z,null),boolean:e.createElement(id.Z,null),date:e.createElement(ln.Z,null),datetime:e.createElement(ln.Z,null),decimal:e.createElement(Zt.Z,null),email:e.createElement(ld.Z,null),enum:e.createElement(Yr.Z,null),enumeration:e.createElement(Yr.Z,null),file:e.createElement(bo.Z,null),files:e.createElement(bo.Z,null),float:e.createElement(Zt.Z,null),integer:e.createElement(Zt.Z,null),media:e.createElement(bo.Z,null),number:e.createElement(Zt.Z,null),relation:e.createElement(cd.Z,null),string:e.createElement(Eo.Z,null),text:e.createElement(Eo.Z,null),richtext:e.createElement(Eo.Z,null),time:e.createElement(ln.Z,null),timestamp:e.createElement(ln.Z,null),json:e.createElement(dd.Z,null),uid:e.createElement(ud.Z,null),component:e.createElement(md.Z,null),dynamiczone:e.createElement(pd.Z,null)},vo=({type:t,customFieldUid:o})=>{const r=(0,y.mZ)();let s=Xr[t];if(o){const l=r.get(o).icon;l&&(s=e.createElement(A.x,{marginRight:3,width:7,height:6},e.createElement(l,null)))}return Xr[t]?s:null};vo.defaultProps={customFieldUid:null},vo.propTypes={type:n().string.isRequired,customFieldUid:n().string};var Jr=vo,gd=t=>t.reduce((o,r)=>{const s=r?.attributes??{},a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes(s?.[l]?.type??""));return o[r.uid]=a,o},{}),_r=t=>{let o;switch(t){case"description":case"label":case"placeholder":o="text";break;case"mainField":o="select";break;case"editable":o="bool";break;default:o=""}const r=t==="mainField"?(0,h.OB)("containers.SettingPage.editSettings.entry.title"):(0,h.OB)(`form.Input.${t}`);return{type:o,label:{id:r}}},Ct=d(42882),Bt=d(9139);const Co=({type:t,options:o,onChange:r,value:s,name:a,...l})=>{const{formatMessage:i}=(0,V.Z)();switch(t){case"text":return e.createElement(kn.o,{onChange:r,value:s,name:a,...l});case"bool":return e.createElement(Bt.s,{onChange:c=>{r({target:{name:a,value:c.target.checked}})},checked:s,name:a,onLabel:i({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:i({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),...l});case"select":return e.createElement(He.P,{value:s,name:a,onChange:c=>r({target:{name:a,value:c}}),...l},o.map(c=>e.createElement(Ee.W,{key:c,value:c},c)));default:return null}};Co.defaultProps={options:void 0},Co.propTypes={type:n().string.isRequired,options:n().arrayOf(n().string),onChange:n().func.isRequired,value:n().oneOfType([n().string,n().bool]).isRequired,name:n().string.isRequired};var fd=Co;const hd=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],yd=[1,5,10,15,30,60],bd=["datetime","time"],es=({onMetaChange:t,onSizeChange:o})=>{const{formatMessage:r}=(0,V.Z)(),{modifiedData:s,selectedField:a,attributes:l,fieldForm:i}=ut(),c=(0,e.useMemo)(Ct.Vo,[]),{schemas:g}=(0,J.v9)(D=>c(D),J.wU),u=(0,J.v9)(Ct.Jg),p=(0,e.useMemo)(()=>{if(!a)return[];const D=x()(s,["metadatas",a,"edit"],{});return Object.keys(D).filter(C=>C!=="visible")},[a,s]),f=(0,e.useMemo)(()=>gd(g),[g]),m=(0,e.useCallback)(D=>{if(D!=="relation"&&D!=="component")return[];const C=D==="component"?"component":"targetModel",M=x()(s,["attributes",a,C],"");return x()(f,[M],[])},[a,f,s]),b=p.map(D=>{const C=x()(l,[a,"type"]);return["component","dynamiczone"].includes(C)&&!["label","description"].includes(D)||C==="component"&&D!=="label"||["media","json","boolean"].includes(C)&&D==="placeholder"||D==="step"?null:e.createElement(ge.P,{col:6,key:D},e.createElement(fd,{type:_r(D).type,hint:D==="mainField"?r({id:(0,ve.Z)("containers.SettingPage.editSettings.relation-field.description")}):"",label:r({id:x()(_r(D),"label.id","app.utils.defaultMessage")}),name:D,onChange:t,value:x()(i,["metadata",D],""),options:m(C)}))}),{type:E,customField:v}=l[a],{isResizable:k}=u[v]??u[E],R=e.createElement(ge.P,{col:6,key:"size"},e.createElement(He.P,{value:i?.size,name:"size",onChange:D=>{o({name:a,value:D})},label:r({id:(0,ve.Z)("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},hd.map(([D,C])=>e.createElement(Ee.W,{key:D,value:D},C)))),T=bd.includes(l[a].type),O=e.createElement(ge.P,{col:6,key:"step"},e.createElement(He.P,{value:x()(i,["metadata","step"],1),name:"step",onChange:D=>t({target:{name:"step",value:D}}),label:r({id:(0,ve.Z)("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},yd.map(D=>e.createElement(Ee.W,{key:D,value:D},D))));return e.createElement(e.Fragment,null,b,k&&R,T&&O)};es.propTypes={onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired};var Ed=es;const vd=(0,j.ZP)(F.k)`
978
+ `,ho=({attribute:t,children:o,index:r,lastIndex:s,moveItem:a,moveRow:l,name:i,onDeleteField:c,onEditField:g,rowIndex:u,size:p})=>{const[f,m]=(0,e.useState)(!1),b=i==="_TEMP_",{setIsDraggingSibling:E}=ut(),v=p===12,k=(0,e.useRef)(null),R=(0,e.useRef)(null),[{clientOffset:T,isOver:O},D]=(0,sn.useDrop)({accept:h._Q.EDIT_FIELD,hover(q,U){if(!R.current||q.size!==12)return;const L=U.getItem().index,w=r,N=U.getItem().rowIndex,Y=u;if(L===w&&N===Y)return;const P=R.current.getBoundingClientRect(),Z=(P.bottom-P.top)/2,re=U.getClientOffset().y-P.top;N<Y&&re<Z||N>Y&&re>Z||(l(N,Y),q.rowIndex=Y,q.itemIndex=w)},drop(q,U){if(!R.current)return;const L=U.getItem().index,w=r,N=U.getItem().rowIndex,Y=u;if(q.size===12||L===w&&N===Y)return;const P=R.current.getBoundingClientRect();if(Math.abs(U.getClientOffset().x-P.left)>P.width/1.8){a(L,w+1,N,Y),q.itemIndex=w+1,q.rowIndex=Y;return}a(L,w,N,Y),q.itemIndex=w,q.rowIndex=Y},collect:q=>({canDrop:q.canDrop(),clientOffset:q.getClientOffset(),isOver:q.isOver(),isOverCurrent:q.isOver({shallow:!0}),itemType:q.getItemType()})}),[{isDragging:C,getItem:M},I,S]=(0,sn.useDrag)({type:h._Q.EDIT_FIELD,item(){return E(!0),{index:r,labelField:o,rowIndex:u,name:i,size:p}},canDrag(){return i!=="_TEMP_"},collect:q=>({isDragging:q.isDragging(),getItem:q.getItem()}),end(){E(!1)}});(0,e.useEffect)(()=>{S((0,wt.rX)(),{captureDraggingState:!0})},[S]);const B={dragRef:I(k),dropRef:D(R)};let $=!1,K=!1;if(R.current&&T){const q=R.current.getBoundingClientRect();$=O&&M.size!==12&&Math.abs(T.x-q.left)<q.width/2,K=O&&M.size!==12&&Math.abs(T.x-q.left)>q.width/2,i==="_TEMP_"&&($=O&&M.size!==12,K=!1)}const W=()=>t&&v?`${74/16}rem`:`${32/16}rem`,G=r===0&&!v,z=r===s&&!v,X=r!==0&&!v;return e.createElement(ge.P,{col:p},e.createElement(Kc,{ref:B.dropRef,showLeftCarret:$,showRightCarret:K,isFirst:G,isLast:z,hasHorizontalPadding:X,onDrag:()=>{v&&!f&&m(!0)},onDragEnd:()=>{v&&m(!1)}},f&&v&&e.createElement(A.x,{width:"100%",height:"2px",background:"primary600"}),e.createElement(Xc,{width:v&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:W(),alignItems:"stretch",isDragging:C,dragStart:f,isFullSize:v,isHidden:b},e.createElement(Jc,{as:"span",type:"button",ref:B.dragRef,onClick:q=>q.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},e.createElement(Yc,null)),!b&&e.createElement(Gc,{attribute:t,onEditField:g,onDeleteField:c},o))))};ho.defaultProps={attribute:void 0},ho.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),children:n().string.isRequired,index:n().number.isRequired,moveItem:n().func.isRequired,moveRow:n().func.isRequired,name:n().string.isRequired,onDeleteField:n().func.isRequired,onEditField:n().func.isRequired,rowIndex:n().number.isRequired,lastIndex:n().number.isRequired,size:n().number.isRequired};var _c=ho;const jr=({rowItem:t,onRemoveField:o,rowId:r,rowIndex:s,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:c,modifiedData:g,moveRow:u,moveItem:p}=ut(),f=x()(c,[t.name],{}),m=x()(g,["metadatas",t.name,"edit","label"],"");return e.createElement(_c,{onEditField:()=>i(t.name),onDeleteField:()=>o(r,a),attribute:f,index:a,lastIndex:l,rowIndex:s,name:t.name,size:t.size,moveRow:u,moveItem:p},m||t.name)};jr.propTypes={index:n().number.isRequired,lastIndex:n().number.isRequired,onRemoveField:n().func.isRequired,rowId:n().number.isRequired,rowIndex:n().number.isRequired,rowItem:n().object.isRequired};var ed=jr;const Wr=({row:t,onRemoveField:o,rowIndex:r})=>e.createElement(Ie.r,null,t.rowContent.map((s,a)=>e.createElement(ed,{key:s.name,rowItem:s,index:a,rowId:t.rowId,onRemoveField:o,rowIndex:r,lastIndex:t.rowContent.length-1})));Wr.propTypes={onRemoveField:n().func.isRequired,row:n().object.isRequired,rowIndex:n().number.isRequired};var td=Wr;const nd=[{action:"plugin::content-type-builder.read",subject:null}];var od=()=>{const{trackUsage:t}=(0,y.rS)(),{formatMessage:o}=(0,V.Z)(),{slug:r,modifiedData:s,isContentTypeView:a}=ut(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,c=x()(s,"category",""),g=l==="content-types"?r:`${c}/${r}`,u=()=>{t("willEditEditLayout")};return r==="strapi::administrator"?null:e.createElement(y.jW,{permissions:nd},e.createElement(y.Qj,{to:`${i}/${g}`,onClick:u,size:"S",startIcon:e.createElement(Ve.Z,null),variant:"secondary"},o({id:(0,ve.Z)(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))};const zr=({editLayout:t,fields:o,onRemoveField:r,onAddField:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(F.k,{justifyContent:"space-between"},e.createElement("div",null,e.createElement(A.x,null,e.createElement(Q.Z,{fontWeight:"bold"},a({id:(0,h.OB)("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),e.createElement(A.x,null,e.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),e.createElement(od,null)),e.createElement(A.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},t.map((l,i)=>e.createElement(td,{key:l.rowId,row:l,rowIndex:i,onRemoveField:r})),e.createElement(Ge.O,{id:"label",label:a({id:(0,h.OB)("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:ce.z,"data-testid":"add-field",fullWidth:!0,startIcon:e.createElement(St.Z,null),endIcon:null,variant:"secondary",disabled:o.length===0},o.map(l=>e.createElement(Ge.s,{key:l,onClick:()=>s(l)},l))))))};zr.propTypes={editLayout:n().array.isRequired,fields:n().array.isRequired,onAddField:n().func.isRequired,onRemoveField:n().func.isRequired};var rd=zr,Ur=d(85025),Vr=d(55225),Hr=d(31600),Qr=d(11406),$t=d(32031),sd=d(73779),an=d(88675),ad=d(22348),Gr=d(7184),yo=d(43475),id=d(82512),bo=d(83218),ld=d(872),cd=d(17757),dd=d(1176),ud=d(15431);const Kr={biginteger:e.createElement($t.Z,null),boolean:e.createElement(sd.Z,null),date:e.createElement(an.Z,null),datetime:e.createElement(an.Z,null),decimal:e.createElement($t.Z,null),email:e.createElement(ad.Z,null),enum:e.createElement(Gr.Z,null),enumeration:e.createElement(Gr.Z,null),file:e.createElement(yo.Z,null),files:e.createElement(yo.Z,null),float:e.createElement($t.Z,null),integer:e.createElement($t.Z,null),media:e.createElement(yo.Z,null),number:e.createElement($t.Z,null),relation:e.createElement(id.Z,null),string:e.createElement(bo.Z,null),text:e.createElement(bo.Z,null),richtext:e.createElement(bo.Z,null),time:e.createElement(an.Z,null),timestamp:e.createElement(an.Z,null),json:e.createElement(ld.Z,null),uid:e.createElement(cd.Z,null),component:e.createElement(dd.Z,null),dynamiczone:e.createElement(ud.Z,null)},Eo=({type:t,customFieldUid:o})=>{const r=(0,y.mZ)();let s=Kr[t];if(o){const l=r.get(o).icon;l&&(s=e.createElement(A.x,{marginRight:3,width:7,height:6},e.createElement(l,null)))}return Kr[t]?s:null};Eo.defaultProps={customFieldUid:null},Eo.propTypes={type:n().string.isRequired,customFieldUid:n().string};var Yr=Eo,md=t=>t.reduce((o,r)=>{const s=r?.attributes??{},a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes(s?.[l]?.type??""));return o[r.uid]=a,o},{}),Xr=t=>{let o;switch(t){case"description":case"label":case"placeholder":o="text";break;case"mainField":o="select";break;case"editable":o="bool";break;default:o=""}const r=t==="mainField"?(0,h.OB)("containers.SettingPage.editSettings.entry.title"):(0,h.OB)(`form.Input.${t}`);return{type:o,label:{id:r}}},Ct=d(42882),Zt=d(9139);const vo=({type:t,options:o,onChange:r,value:s,name:a,...l})=>{const{formatMessage:i}=(0,V.Z)();switch(t){case"text":return e.createElement(Dn.o,{onChange:r,value:s,name:a,...l});case"bool":return e.createElement(Zt.s,{onChange:c=>{r({target:{name:a,value:c.target.checked}})},checked:s,name:a,onLabel:i({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:i({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),...l});case"select":return e.createElement(He.P,{value:s,name:a,onChange:c=>r({target:{name:a,value:c}}),...l},o.map(c=>e.createElement(Ee.W,{key:c,value:c},c)));default:return null}};vo.defaultProps={options:void 0},vo.propTypes={type:n().string.isRequired,options:n().arrayOf(n().string),onChange:n().func.isRequired,value:n().oneOfType([n().string,n().bool]).isRequired,name:n().string.isRequired};var pd=vo;const gd=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],fd=[1,5,10,15,30,60],hd=["datetime","time"],Jr=({onMetaChange:t,onSizeChange:o})=>{const{formatMessage:r}=(0,V.Z)(),{modifiedData:s,selectedField:a,attributes:l,fieldForm:i}=ut(),c=(0,e.useMemo)(Ct.Vo,[]),{schemas:g}=(0,J.v9)(D=>c(D),J.wU),u=(0,J.v9)(Ct.Jg),p=(0,e.useMemo)(()=>{if(!a)return[];const D=x()(s,["metadatas",a,"edit"],{});return Object.keys(D).filter(C=>C!=="visible")},[a,s]),f=(0,e.useMemo)(()=>md(g),[g]),m=(0,e.useCallback)(D=>{if(D!=="relation"&&D!=="component")return[];const C=D==="component"?"component":"targetModel",M=x()(s,["attributes",a,C],"");return x()(f,[M],[])},[a,f,s]),b=p.map(D=>{const C=x()(l,[a,"type"]);return["component","dynamiczone"].includes(C)&&!["label","description"].includes(D)||C==="component"&&D!=="label"||["media","json","boolean"].includes(C)&&D==="placeholder"||D==="step"?null:e.createElement(ge.P,{col:6,key:D},e.createElement(pd,{type:Xr(D).type,hint:D==="mainField"?r({id:(0,ve.Z)("containers.SettingPage.editSettings.relation-field.description")}):"",label:r({id:x()(Xr(D),"label.id","app.utils.defaultMessage")}),name:D,onChange:t,value:x()(i,["metadata",D],""),options:m(C)}))}),{type:E,customField:v}=l[a],{isResizable:k}=u[v]??u[E],R=e.createElement(ge.P,{col:6,key:"size"},e.createElement(He.P,{value:i?.size,name:"size",onChange:D=>{o({name:a,value:D})},label:r({id:(0,ve.Z)("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},gd.map(([D,C])=>e.createElement(Ee.W,{key:D,value:D},C)))),T=hd.includes(l[a].type),O=e.createElement(ge.P,{col:6,key:"step"},e.createElement(He.P,{value:x()(i,["metadata","step"],1),name:"step",onChange:D=>t({target:{name:"step",value:D}}),label:r({id:(0,ve.Z)("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},fd.map(D=>e.createElement(Ee.W,{key:D,value:D},D))));return e.createElement(e.Fragment,null,b,k&&R,T&&O)};Jr.propTypes={onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired};var yd=Jr;const bd=(0,j.ZP)(F.k)`
979
979
  svg {
980
980
  width: ${32/16}rem;
981
981
  height: ${24/16}rem;
982
982
  margin-right: ${({theme:t})=>t.spaces[3]};
983
983
  }
984
- `,Ro=({onToggle:t,onMetaChange:o,onSizeChange:r,onSubmit:s,type:a,customFieldUid:l})=>{const{selectedField:i}=ut(),{formatMessage:c}=(0,V.Z)(),g=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return e.createElement(Hr.P,{onClose:t,labelledBy:"title"},e.createElement("form",{onSubmit:s},e.createElement(Qr.x,null,e.createElement(vd,null,e.createElement(Jr,{type:g(),customFieldUid:l}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:$t()(i)})))),e.createElement(Gr.f,null,e.createElement(ke.r,{gap:4},e.createElement(Ed,{onMetaChange:o,onSizeChange:r}))),e.createElement(Kr.m,{startActions:e.createElement(ce.z,{onClick:t,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(ce.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Ro.defaultProps={customFieldUid:null},Ro.propTypes={customFieldUid:n().string,onSubmit:n().func.isRequired,onToggle:n().func.isRequired,onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired,type:n().string.isRequired};var Cd=Ro,Rd=(t,o,r)=>{const{put:s}=(0,y.tg)();return s((0,h.IF)(r?`content-types/${o}/configuration`:`components/${o}/configuration`),t)};const Mo=({mainLayout:t,components:o,isContentTypeView:r,slug:s,updateLayout:a})=>{const[l,i]=(0,e.useReducer)(Vc,go,()=>Hc(go,t,o)),[c,g]=(0,e.useState)(!1),{trackUsage:u}=(0,y.rS)(),p=(0,y.lm)(),{goBack:f}=(0,te.k6)(),[m,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(!1),{componentLayouts:k,initialData:R,modifiedData:T,metaToEdit:O,metaForm:D}=l,{formatMessage:C}=(0,V.Z)(),M=x()(t,["info","displayName"],""),I=x()(T,["attributes"],{}),S=(0,J.v9)(Ct.Jg),B=Object.keys(I).filter(H=>{const ae=x()(I,[H,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(ae)&&!!ae}),$=x()(T,["layouts","edit"],[]),K=Fr()($,"rowContent"),W=Object.keys(T.attributes).filter(H=>x()(T,["metadatas",H,"edit","visible"],!1)===!0).filter(H=>K.findIndex(ae=>ae.name===H)===-1).sort(),G=({target:{name:H,value:ae}})=>{i({type:"ON_CHANGE",keys:H.split("."),value:ae})},z=()=>{b(H=>!H)},X=()=>{v(H=>!H)},q=({target:{name:H,value:ae}})=>{i({type:"ON_CHANGE_META",keys:H.split("."),value:ae})},U=({name:H,value:ae})=>{i({type:"ON_CHANGE_SIZE",name:H,value:ae})},L=H=>{H.preventDefault(),i({type:"SUBMIT_META_FORM"}),z()},w=H=>{H.preventDefault(),X()},N=(0,Xe.useMutation)(H=>Rd(H,s,r),{onSuccess({data:H}){a&&a(H.data),i({type:"SUBMIT_SUCCEEDED"}),X(),u("didEditEditSettings")},onError(){p({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=N,P=()=>{const H=Pn()(Je()(T),["layouts","metadatas","settings"]);se()(H,"layouts.edit",Wc(H.layouts.edit)),N.mutate(H)},Z=(H,ae)=>{i({type:"MOVE_RELATION",fromIndex:H,toIndex:ae})},oe=(H,ae)=>{i({type:"MOVE_FIELD",fromIndex:H,toIndex:ae})},re=(H,ae,Ie,Ne)=>{i(Ie===Ne?{type:"REORDER_ROW",dragRowIndex:Ie,dragIndex:H,hoverIndex:ae}:{type:"REORDER_DIFF_ROW",dragIndex:H,hoverIndex:ae,dragRowIndex:Ie,hoverRowIndex:Ne})},me=(H,ae)=>{i({type:"MOVE_ROW",fromIndex:H,toIndex:ae})};return e.createElement(fo,{isContentTypeView:r,attributes:I,modifiedData:T,slug:s,componentLayouts:k,selectedField:O,fieldForm:D,onMoveRelation:Z,onMoveField:oe,moveRow:me,moveItem:re,setEditFieldToSelect:H=>{i({type:"SET_FIELD_TO_EDIT",name:H}),z()},isDraggingSibling:c,setIsDraggingSibling:g},e.createElement(Te.o,null,e.createElement("form",{onSubmit:w},e.createElement(he.T,{title:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${$t()(M)}`},{name:$t()(M)}),subtitle:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:e.createElement(y.rU,{startIcon:e.createElement(tn.Z,null),onClick:H=>{H.preventDefault(),f()},to:"/"},C({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(ce.z,{disabled:At()(R,T),startIcon:e.createElement(st.Z,null),type:"submit"},C({id:"global.save",defaultMessage:"Save"}))}),e.createElement(We.D,null,e.createElement(A.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},C({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(ke.r,null,e.createElement(ge.P,{col:6,s:12},e.createElement(He.P,{label:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:H=>{G({target:{name:"settings.mainField",value:H===""?null:H}})},value:T.settings.mainField},B.map(H=>e.createElement(Ee.W,{key:H,value:H},H))))),e.createElement(A.x,{paddingTop:2,paddingBottom:2},e.createElement($r.i,null)),e.createElement(Q.Z,{variant:"delta",as:"h3"},C({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(ad,{attributes:I,editLayout:$,fields:W,onAddField:H=>{i({type:"ON_ADD_FIELD",name:H,fieldSizes:S})},onRemoveField:(H,ae)=>{i({type:"REMOVE_FIELD",rowIndex:H,fieldIndex:ae})}})))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(st.Z,null),isConfirmButtonLoading:Y,isOpen:E,onToggleDialog:X,onConfirm:P,variantRightButton:"success-light"})),m&&e.createElement(Cd,{onSubmit:L,onToggle:z,onMetaChange:q,onSizeChange:U,type:x()(I,[O,"type"],""),customFieldUid:x()(I,[O,"customField"],"")})))};Mo.defaultProps={isContentTypeView:!1,updateLayout:null},Mo.propTypes={components:n().object.isRequired,isContentTypeView:n().bool,mainLayout:n().shape({attributes:n().object.isRequired,info:n().object.isRequired,layouts:n().shape({list:n().array.isRequired,edit:n().array.isRequired}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired}).isRequired,slug:n().string.isRequired,updateLayout:n().func};var To=Mo,Rt=d(37617);const Md=()=>({type:Rt.ZA}),Td=(t,o)=>({type:Rt.Id,pagination:t,data:o}),Dd=()=>({type:Rt.MP});function kd(){return{type:Rt.c2}}const Id=({components:t,contentType:o})=>{const{layouts:r}=o;return{contentType:o,components:t,displayedHeaders:r.list,type:Rt.Zz}},Do=t=>({type:Rt.Rp,target:t});var ts=d(6680),ko=d(94638),ns=d(99223),Pd=d(70664);const os=()=>t=>t["content-manager_listView"]||Pd.E,Od=()=>(0,lo.P1)(os(),t=>t),rs=t=>{const{displayedHeaders:o}=t["content-manager_listView"];return o};var wd=Od,xd=d(35658),Fd=d(94547),Io=d(19786),Ld=d(44426),Sd=d(47765),Ad=d(8997),$d=d(69033);const Zd=(0,j.ZP)(F.k)`
984
+ `,Co=({onToggle:t,onMetaChange:o,onSizeChange:r,onSubmit:s,type:a,customFieldUid:l})=>{const{selectedField:i}=ut(),{formatMessage:c}=(0,V.Z)(),g=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return e.createElement(Ur.P,{onClose:t,labelledBy:"title"},e.createElement("form",{onSubmit:s},e.createElement(Vr.x,null,e.createElement(bd,null,e.createElement(Yr,{type:g(),customFieldUid:l}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:At()(i)})))),e.createElement(Hr.f,null,e.createElement(Ie.r,{gap:4},e.createElement(yd,{onMetaChange:o,onSizeChange:r}))),e.createElement(Qr.m,{startActions:e.createElement(ce.z,{onClick:t,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(ce.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Co.defaultProps={customFieldUid:null},Co.propTypes={customFieldUid:n().string,onSubmit:n().func.isRequired,onToggle:n().func.isRequired,onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired,type:n().string.isRequired};var Ed=Co,vd=(t,o,r)=>{const{put:s}=(0,y.tg)();return s((0,h.IF)(r?`content-types/${o}/configuration`:`components/${o}/configuration`),t)};const Ro=({mainLayout:t,components:o,isContentTypeView:r,slug:s,updateLayout:a})=>{const[l,i]=(0,e.useReducer)(zc,po,()=>Uc(po,t,o)),[c,g]=(0,e.useState)(!1),{trackUsage:u}=(0,y.rS)(),p=(0,y.lm)(),{goBack:f}=(0,te.k6)(),[m,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(!1),{componentLayouts:k,initialData:R,modifiedData:T,metaToEdit:O,metaForm:D}=l,{formatMessage:C}=(0,V.Z)(),M=x()(t,["info","displayName"],""),I=x()(T,["attributes"],{}),S=(0,J.v9)(Ct.Jg),B=Object.keys(I).filter(H=>{const ae=x()(I,[H,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(ae)&&!!ae}),$=x()(T,["layouts","edit"],[]),K=wr()($,"rowContent"),W=Object.keys(T.attributes).filter(H=>x()(T,["metadatas",H,"edit","visible"],!1)===!0).filter(H=>K.findIndex(ae=>ae.name===H)===-1).sort(),G=({target:{name:H,value:ae}})=>{i({type:"ON_CHANGE",keys:H.split("."),value:ae})},z=()=>{b(H=>!H)},X=()=>{v(H=>!H)},q=({target:{name:H,value:ae}})=>{i({type:"ON_CHANGE_META",keys:H.split("."),value:ae})},U=({name:H,value:ae})=>{i({type:"ON_CHANGE_SIZE",name:H,value:ae})},L=H=>{H.preventDefault(),i({type:"SUBMIT_META_FORM"}),z()},w=H=>{H.preventDefault(),X()},N=(0,Xe.useMutation)(H=>vd(H,s,r),{onSuccess({data:H}){a&&a(H.data),i({type:"SUBMIT_SUCCEEDED"}),X(),u("didEditEditSettings")},onError(){p({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=N,P=()=>{const H=In()(Je()(T),["layouts","metadatas","settings"]);se()(H,"layouts.edit",Nc(H.layouts.edit)),N.mutate(H)},Z=(H,ae)=>{i({type:"MOVE_RELATION",fromIndex:H,toIndex:ae})},oe=(H,ae)=>{i({type:"MOVE_FIELD",fromIndex:H,toIndex:ae})},re=(H,ae,Pe,Ne)=>{i(Pe===Ne?{type:"REORDER_ROW",dragRowIndex:Pe,dragIndex:H,hoverIndex:ae}:{type:"REORDER_DIFF_ROW",dragIndex:H,hoverIndex:ae,dragRowIndex:Pe,hoverRowIndex:Ne})},me=(H,ae)=>{i({type:"MOVE_ROW",fromIndex:H,toIndex:ae})};return e.createElement(go,{isContentTypeView:r,attributes:I,modifiedData:T,slug:s,componentLayouts:k,selectedField:O,fieldForm:D,onMoveRelation:Z,onMoveField:oe,moveRow:me,moveItem:re,setEditFieldToSelect:H=>{i({type:"SET_FIELD_TO_EDIT",name:H}),z()},isDraggingSibling:c,setIsDraggingSibling:g},e.createElement(De.o,null,e.createElement("form",{onSubmit:w},e.createElement(he.T,{title:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${At()(M)}`},{name:At()(M)}),subtitle:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),onClick:H=>{H.preventDefault(),f()},to:"/"},C({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(ce.z,{disabled:Ce()(R,T),startIcon:e.createElement(st.Z,null),type:"submit"},C({id:"global.save",defaultMessage:"Save"}))}),e.createElement(We.D,null,e.createElement(A.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},C({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(Ie.r,null,e.createElement(ge.P,{col:6,s:12},e.createElement(He.P,{label:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:H=>{G({target:{name:"settings.mainField",value:H===""?null:H}})},value:T.settings.mainField},B.map(H=>e.createElement(Ee.W,{key:H,value:H},H))))),e.createElement(A.x,{paddingTop:2,paddingBottom:2},e.createElement(Sr.i,null)),e.createElement(Q.Z,{variant:"delta",as:"h3"},C({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(rd,{attributes:I,editLayout:$,fields:W,onAddField:H=>{i({type:"ON_ADD_FIELD",name:H,fieldSizes:S})},onRemoveField:(H,ae)=>{i({type:"REMOVE_FIELD",rowIndex:H,fieldIndex:ae})}})))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(st.Z,null),isConfirmButtonLoading:Y,isOpen:E,onToggleDialog:X,onConfirm:P,variantRightButton:"success-light"})),m&&e.createElement(Ed,{onSubmit:L,onToggle:z,onMetaChange:q,onSizeChange:U,type:x()(I,[O,"type"],""),customFieldUid:x()(I,[O,"customField"],"")})))};Ro.defaultProps={isContentTypeView:!1,updateLayout:null},Ro.propTypes={components:n().object.isRequired,isContentTypeView:n().bool,mainLayout:n().shape({attributes:n().object.isRequired,info:n().object.isRequired,layouts:n().shape({list:n().array.isRequired,edit:n().array.isRequired}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired}).isRequired,slug:n().string.isRequired,updateLayout:n().func};var Mo=Ro,Rt=d(37617);const Cd=()=>({type:Rt.ZA}),Rd=(t,o)=>({type:Rt.Id,pagination:t,data:o}),Md=()=>({type:Rt.MP});function Td(){return{type:Rt.c2}}const Dd=({components:t,contentType:o})=>{const{layouts:r}=o;return{contentType:o,components:t,displayedHeaders:r.list,type:Rt.Zz}},To=t=>({type:Rt.Rp,target:t});var _r=d(6680),Do=d(94638),es=d(99223),kd=d(70664);const ts=()=>t=>t["content-manager_listView"]||kd.E,Id=()=>(0,io.P1)(ts(),t=>t),ns=t=>{const{displayedHeaders:o}=t["content-manager_listView"];return o};var Pd=Id,Od=d(35658),wd=d(94547),ko=d(19786),xd=d(82884),Fd=d(47765),Ld=d(8997),Sd=d(69033);const Ad=(0,j.ZP)(F.k)`
985
985
  position: relative;
986
986
  border-radius: 50%;
987
987
  width: 26px;
@@ -994,29 +994,29 @@ ${t}
994
994
  line-height: 0.6rem;
995
995
  font-size: 0.6rem;
996
996
  }
997
- `,ss=({children:t,...o})=>e.createElement(Zd,{justifyContent:"center",alignItems:"center",as:"span",...o},e.createElement(Q.Z,{variant:"sigma",textColor:"neutral600"},t));ss.propTypes={children:n().string.isRequired};var as=ss;const Po=({url:t,mime:o,alternativeText:r,name:s,ext:a,formats:l})=>{const i=(0,y.CR)(t);if(o.includes("image")){const u=l?.thumbnail?.url||null,p=(0,y.CR)(u)||i;return e.createElement($d.q,{src:p,alt:r||s,preview:!0})}const c=(0,y.mD)(a),g=s.length>100?`${s.substring(0,100)}...`:s;return e.createElement(Vt.u,{description:g},e.createElement(as,null,c))};Po.defaultProps={alternativeText:null,formats:null},Po.propTypes={alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired};var is=Po,Bd=d(25898);const ls=({value:t})=>e.createElement(Bd.H,null,t.map((o,r)=>{const s=`${o.id}${r}`;if(r===3){const a=`+${t.length-3}`;return e.createElement(as,{key:s,preview:!1},a)}return r>3?null:e.createElement(is,{key:s,...o})}));ls.propTypes={value:n().arrayOf(n().shape({alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired})).isRequired};var qd=ls,cs=d(6518),Nd=d(97405),jd=d(96315);const ds=({type:t,value:o})=>{const{formatDate:r,formatTime:s,formatNumber:a}=(0,V.Z)();let l=o;if(t==="date"&&(l=r((0,jd.Z)(o),{dateStyle:"full"})),t==="datetime"&&(l=r(o,{dateStyle:"full",timeStyle:"short"})),t==="time"){const[i,c,g]=o.split(":"),u=new Date;u.setHours(i),u.setMinutes(c),u.setSeconds(g),l=s(u,{numeric:"auto",style:"short"})}return["float","decimal"].includes(t)&&(l=a(o,{maximumFractionDigits:20})),["integer","biginteger"].includes(t)&&(l=a(o,{maximumFractionDigits:0})),vr()(l)};ds.propTypes={type:n().string.isRequired,value:n().any.isRequired};var Mt=ds;const Wd=(0,j.ZP)(Q.Z)`
997
+ `,os=({children:t,...o})=>e.createElement(Ad,{justifyContent:"center",alignItems:"center",as:"span",...o},e.createElement(Q.Z,{variant:"sigma",textColor:"neutral600"},t));os.propTypes={children:n().string.isRequired};var rs=os;const Io=({url:t,mime:o,alternativeText:r,name:s,ext:a,formats:l})=>{const i=(0,y.CR)(t);if(o.includes("image")){const u=l?.thumbnail?.url||null,p=(0,y.CR)(u)||i;return e.createElement(Sd.q,{src:p,alt:r||s,preview:!0})}const c=(0,y.mD)(a),g=s.length>100?`${s.substring(0,100)}...`:s;return e.createElement(Ut.u,{description:g},e.createElement(rs,null,c))};Io.defaultProps={alternativeText:null,formats:null},Io.propTypes={alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired};var ss=Io,$d=d(25898);const as=({value:t})=>e.createElement($d.H,null,t.map((o,r)=>{const s=`${o.id}${r}`;if(r===3){const a=`+${t.length-3}`;return e.createElement(rs,{key:s,preview:!1},a)}return r>3?null:e.createElement(ss,{key:s,...o})}));as.propTypes={value:n().arrayOf(n().shape({alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired})).isRequired};var Zd=as,is=d(6518),Bd=d(23866),qd=d(96315);const ls=({type:t,value:o})=>{const{formatDate:r,formatTime:s,formatNumber:a}=(0,V.Z)();let l=o;if(t==="date"&&(l=r((0,qd.Z)(o),{dateStyle:"full"})),t==="datetime"&&(l=r(o,{dateStyle:"full",timeStyle:"short"})),t==="time"){const[i,c,g]=o.split(":"),u=new Date;u.setHours(i),u.setMinutes(c),u.setSeconds(g),l=s(u,{numeric:"auto",style:"short"})}return["float","decimal"].includes(t)&&(l=a(o,{maximumFractionDigits:20})),["integer","biginteger"].includes(t)&&(l=a(o,{maximumFractionDigits:0})),br()(l)};ls.propTypes={type:n().string.isRequired,value:n().any.isRequired};var Mt=ls;const Nd=(0,j.ZP)(Q.Z)`
998
998
  max-width: 500px;
999
- `,zd=async(t,o,r)=>{const{data:{results:s,pagination:a}}=await r(t);return o(),{results:s,pagination:a}},us=({fieldSchema:t,metadatas:o,name:r,entityId:s,value:a,contentType:l})=>{const{formatMessage:i}=(0,V.Z)(),{notifyStatus:c}=(0,ko.G)(),g=(0,e.useMemo)(()=>(0,h.IF)(`relations/${l.uid}/${s}/${r.split(".")[0]}`),[s,r,l]),[u,p]=(0,e.useState)(!1),{get:f}=(0,y.kY)(),m=e.createElement(F.k,{gap:1,wrap:"nowrap"},e.createElement(cs.C,null,a.count),i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:a.count})),b=()=>{const k=i({id:(0,h.OB)("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});c(k)},{data:E,status:v}=(0,Xe.useQuery)([t.targetModel,s],()=>zd(g,b,f),{enabled:u,staleTime:0,select:k=>({...k,results:[...k.results].reverse()})});return e.createElement(A.x,{...y.UW},e.createElement(Ge.O,{label:m,size:"S",onOpen:()=>p(!0),onClose:()=>p(!1)},v!=="success"&&e.createElement(Ge.s,{"aria-disabled":!0},e.createElement(Nd.a,{small:!0},i({id:(0,h.OB)("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),v==="success"&&e.createElement(e.Fragment,null,E?.results.map(k=>e.createElement(Ge.s,{key:k.id,"aria-disabled":!0},e.createElement(Wd,{ellipsis:!0},e.createElement(Mt,{type:o.mainField.schema.type,value:k[o.mainField.name]||k.id})))),E?.pagination.total>10&&e.createElement(Ge.s,{"aria-disabled":!0,"aria-label":i({id:(0,h.OB)("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},e.createElement(Q.Z,null,"\u2026")))))};us.propTypes={contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({relation:n().string,targetModel:n().string,type:n().string.isRequired}).isRequired,metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,name:n().string.isRequired,entityId:n().oneOfType([n().string,n().number]).isRequired,value:n().object.isRequired};var Ud=us;const Vd=(0,j.ZP)(Q.Z)`
999
+ `,jd=async(t,o,r)=>{const{data:{results:s,pagination:a}}=await r(t);return o(),{results:s,pagination:a}},cs=({fieldSchema:t,metadatas:o,name:r,entityId:s,value:a,contentType:l})=>{const{formatMessage:i}=(0,V.Z)(),{notifyStatus:c}=(0,Do.G)(),g=(0,e.useMemo)(()=>(0,h.IF)(`relations/${l.uid}/${s}/${r.split(".")[0]}`),[s,r,l]),[u,p]=(0,e.useState)(!1),{get:f}=(0,y.kY)(),m=e.createElement(F.k,{gap:1,wrap:"nowrap"},e.createElement(is.C,null,a.count),i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:a.count})),b=()=>{const k=i({id:(0,h.OB)("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});c(k)},{data:E,status:v}=(0,Xe.useQuery)([t.targetModel,s],()=>jd(g,b,f),{enabled:u,staleTime:0,select:k=>({...k,results:[...k.results].reverse()})});return e.createElement(A.x,{...y.UW},e.createElement(Ge.O,{label:m,size:"S",onOpen:()=>p(!0),onClose:()=>p(!1)},v!=="success"&&e.createElement(Ge.s,{"aria-disabled":!0},e.createElement(Bd.a,{small:!0},i({id:(0,h.OB)("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),v==="success"&&e.createElement(e.Fragment,null,E?.results.map(k=>e.createElement(Ge.s,{key:k.id,"aria-disabled":!0},e.createElement(Nd,{ellipsis:!0},e.createElement(Mt,{type:o.mainField.schema.type,value:k[o.mainField.name]||k.id})))),E?.pagination.total>10&&e.createElement(Ge.s,{"aria-disabled":!0,"aria-label":i({id:(0,h.OB)("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},e.createElement(Q.Z,null,"\u2026")))))};cs.propTypes={contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({relation:n().string,targetModel:n().string,type:n().string.isRequired}).isRequired,metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,name:n().string.isRequired,entityId:n().oneOfType([n().string,n().number]).isRequired,value:n().object.isRequired};var Wd=cs;const zd=(0,j.ZP)(Q.Z)`
1000
1000
  max-width: 500px;
1001
- `,ms=({metadatas:t,value:o})=>e.createElement(Vd,{textColor:"neutral800",ellipsis:!0},e.createElement(Mt,{type:t.mainField.schema.type,value:o[t.mainField.name]??o.id}));ms.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,value:n().object.isRequired};var Hd=ms;const Qd=(0,j.ZP)(Q.Z)`
1001
+ `,ds=({metadatas:t,value:o})=>e.createElement(zd,{textColor:"neutral800",ellipsis:!0},e.createElement(Mt,{type:t.mainField.schema.type,value:o[t.mainField.name]??o.id}));ds.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,value:n().object.isRequired};var Ud=ds;const Vd=(0,j.ZP)(Q.Z)`
1002
1002
  max-width: 500px;
1003
- `,ps=({value:t,metadatas:o})=>{const{formatMessage:r}=(0,V.Z)(),{mainField:{type:s,name:a}}=o,l=e.createElement(e.Fragment,null,e.createElement(cs.C,null,t.length)," ",r({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:t.length}));return e.createElement(A.x,{...y.UW},e.createElement(Ge.O,{label:l,size:"S"},t.map(i=>e.createElement(Ge.s,{key:i.id,"aria-disabled":!0},e.createElement(Qd,{ellipsis:!0},e.createElement(Mt,{type:s,value:i[a]||i.id}))))))};ps.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().array.isRequired};var Gd=ps;const Kd=(0,j.ZP)(Q.Z)`
1003
+ `,us=({value:t,metadatas:o})=>{const{formatMessage:r}=(0,V.Z)(),{mainField:{type:s,name:a}}=o,l=e.createElement(e.Fragment,null,e.createElement(is.C,null,t.length)," ",r({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:t.length}));return e.createElement(A.x,{...y.UW},e.createElement(Ge.O,{label:l,size:"S"},t.map(i=>e.createElement(Ge.s,{key:i.id,"aria-disabled":!0},e.createElement(Vd,{ellipsis:!0},e.createElement(Mt,{type:s,value:i[a]||i.id}))))))};us.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().array.isRequired};var Hd=us;const Qd=(0,j.ZP)(Q.Z)`
1004
1004
  max-width: 250px;
1005
- `,gs=({value:t,metadatas:o})=>{const{mainField:r}=o,s=t[r.name];return e.createElement(Vt.u,{label:s},e.createElement(Kd,{textColor:"neutral800",ellipsis:!0},e.createElement(Mt,{type:r.type,value:s})))};gs.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().object.isRequired};var Yd=gs,Xd=d(80022),fs=d.n(Xd);function hs(t){return["oneToOne","manyToOne","oneToOneMorph"].includes(t)}var ys=d(82293);function Jd(t,o,r,s){if(t==="component"){const{mainField:{name:a,type:l}}=r;if(s?.repeatable)return o.length>0;const i=o?.[a];return a==="id"&&![void 0,null].includes(i)?!0:(0,ys.Z)(l)&&l!=="biginteger"&&a!=="id"?fs()(i):!qe()(i)}return t==="relation"?hs(s.relation)?!qe()(o):o?.count>0:(0,ys.Z)(t)&&t!=="biginteger"?fs()(o):t==="boolean"?o!==null:!qe()(o)}const bs=(0,j.ZP)(Q.Z)`
1005
+ `,ms=({value:t,metadatas:o})=>{const{mainField:r}=o,s=t[r.name];return e.createElement(Ut.u,{label:s},e.createElement(Qd,{textColor:"neutral800",ellipsis:!0},e.createElement(Mt,{type:r.type,value:s})))};ms.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().object.isRequired};var Gd=ms,Kd=d(80022),ps=d.n(Kd);function gs(t){return["oneToOne","manyToOne","oneToOneMorph"].includes(t)}var fs=d(82293);function Yd(t,o,r,s){if(t==="component"){const{mainField:{name:a,type:l}}=r;if(s?.repeatable)return o.length>0;const i=o?.[a];return a==="id"&&![void 0,null].includes(i)?!0:(0,fs.Z)(l)&&l!=="biginteger"&&a!=="id"?ps()(i):!qe()(i)}return t==="relation"?gs(s.relation)?!qe()(o):o?.count>0:(0,fs.Z)(t)&&t!=="biginteger"?ps()(o):t==="boolean"?o!==null:!qe()(o)}const hs=(0,j.ZP)(Q.Z)`
1006
1006
  max-width: 300px;
1007
- `,Oo=({content:t,fieldSchema:o,metadatas:r,name:s,rowId:a,contentType:l})=>{const{type:i}=o;if(!Jd(i,t,r,o))return e.createElement(Q.Z,{textColor:"neutral800"},"-");switch(i){case"media":return o.multiple?e.createElement(qd,{value:t}):e.createElement(is,{...t});case"relation":return hs(o.relation)?e.createElement(Hd,{metadatas:r,value:t}):e.createElement(Ud,{fieldSchema:o,metadatas:r,value:t,name:s,entityId:a,contentType:l});case"component":return o.repeatable===!0?e.createElement(Gd,{value:t,metadatas:r}):e.createElement(Yd,{value:t,metadatas:r});case"string":return e.createElement(Vt.u,{description:t},e.createElement(bs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Mt,{type:i,value:t})));default:return e.createElement(bs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Mt,{type:i,value:t}))}};Oo.defaultProps={content:void 0},Oo.propTypes={content:n().any,contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({component:n().string,multiple:n().bool,type:n().string.isRequired,repeatable:n().bool,relation:n().string}).isRequired,metadatas:n().object.isRequired,name:n().string.isRequired,rowId:n().oneOfType([n().string,n().number]).isRequired};var _d=Oo;const wo=({canCreate:t,canDelete:o,contentType:r,headers:s,entriesToDelete:a,onClickDelete:l,onSelectRow:i,withMainAction:c,withBulkActions:g,rows:u})=>{const{push:p,location:{pathname:f}}=(0,te.k6)(),{formatMessage:m}=(0,V.Z)(),{trackUsage:b}=(0,y.rS)(),E=(0,pe.fi)();return e.createElement(xd.p,null,u.map((v,k)=>{const R=a.findIndex(O=>O===v.id)!==-1,T=m({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:k});return e.createElement(Fd.Tr,{key:v.id,...(0,y.X7)({fn(){b("willEditEntryFromList"),p({pathname:`${f}/${v.id}`,state:{from:f},search:E})},condition:g})},c&&e.createElement(Io.Td,{...y.UW},e.createElement(Ld.C,{"aria-label":m({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,Ad.Pp)(v.firstname,v.lastname)}),checked:R,onChange:()=>{i({name:v.id,value:!R})}})),s.map(({key:O,cellFormatter:D,name:C,...M})=>e.createElement(Io.Td,{key:O},typeof D=="function"?D(v,{key:O,name:C,...M}):e.createElement(_d,{content:v[C.split(".")[0]],name:C,contentType:r,...M,rowId:v.id}))),g&&e.createElement(Io.Td,null,e.createElement(F.k,{justifyContent:"end",...y.UW},e.createElement(be.h,{forwardedAs:vt.rU,onClick:()=>{b("willEditEntryFromButton")},to:{pathname:`${f}/${v.id}`,state:{from:f},search:E},label:m({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:T}),noBorder:!0,icon:e.createElement(Ve.Z,null)}),t&&e.createElement(A.x,{paddingLeft:1},e.createElement(be.h,{forwardedAs:vt.rU,to:{pathname:`${f}/create/clone/${v.id}`,state:{from:f},search:E},label:m({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:T}),noBorder:!0,icon:e.createElement(Sd.Z,null)})),o&&e.createElement(A.x,{paddingLeft:1},e.createElement(be.h,{onClick:()=>{b("willDeleteEntryFromList"),l(v.id)},label:m({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:T}),noBorder:!0,icon:e.createElement(Ye.Z,null)})))))}))};wo.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},wo.propTypes={canCreate:n().bool,canDelete:n().bool,contentType:n().shape({uid:n().string.isRequired}).isRequired,entriesToDelete:n().array,headers:n().array.isRequired,onClickDelete:n().func,onSelectRow:n().func,rows:n().array,withBulkActions:n().bool,withMainAction:n().bool};var eu=wo;const Es=({area:t,...o})=>{const r=Wt(t);return r?e.createElement("ul",null,r.map(s=>s.Component(o)?e.createElement(A.x,{key:s.name,padding:3,style:{textAlign:"center"}},e.createElement(s.Component,{...o})):null)):null};Es.propTypes={area:n().string.isRequired};var cn=Es;const vs=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(nn.V,{onClose:r,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(on.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),e.createElement(F.k,null,e.createElement(cn,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(rn.c,{startAction:e.createElement(ce.z,{onClick:r,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Ye.Z,null),id:"confirm-delete",loading:t},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};vs.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};var tu=vs;function Cs({isPublished:t}){const{formatMessage:o}=(0,V.Z)(),r=t?"success":"secondary";return e.createElement(On.q,{showBullet:!1,variant:r,size:"S",width:"min-content"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${r}700`},o({id:(0,h.OB)(`containers.List.${t?"published":"draft"}`),defaultMessage:t?"Published":"Draft"})))}Cs.propTypes={isPublished:n().bool.isRequired};const dn=({onToggleDialog:t,isOpen:o,dialogBody:r,endAction:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(nn.V,{onClose:t,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(on.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},r)),e.createElement(rn.c,{startAction:e.createElement(ce.z,{onClick:t,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:s}))};dn.propTypes={isOpen:n().bool.isRequired,onToggleDialog:n().func.isRequired,dialogBody:n().node.isRequired,endAction:n().node.isRequired};const xo={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired},Rs=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(dn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.publish.all"),defaultMessage:"Are you sure you want to publish these entries?"})),e.createElement(cn,{area:"contentManager.listView.publishModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"secondary",startIcon:e.createElement(st.Z,null),loading:r},a({id:"app.utils.publish",defaultMessage:"Publish"}))})};Rs.propTypes=xo;const Ms=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(dn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.unpublish.all"),defaultMessage:"Are you sure you want to unpublish these entries?"})),e.createElement(cn,{area:"contentManager.listView.unpublishModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"secondary",startIcon:e.createElement(st.Z,null),loading:r},a({id:"app.utils.unpublish",defaultMessage:"Unpublish"}))})};Ms.propTypes=xo;const Ts=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(dn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"})),e.createElement(cn,{area:"contentManager.listView.deleteModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Ye.Z,null),id:"confirm-delete",loading:r},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))})};Ts.propTypes=xo;const Fo=({showPublish:t,showDelete:o,onConfirmDeleteAll:r,onConfirmPublishAll:s,onConfirmUnpublishAll:a,selectedEntries:l,clearSelectedEntries:i})=>{const{formatMessage:c}=(0,V.Z)(),{trackUsage:g}=(0,y.rS)(),{data:u}=(0,J.v9)(os()),[p,f]=(0,e.useState)(!1),[m,b]=(0,e.useState)(null),E=u.filter(S=>l.includes(S.id)),v=t&&E.some(S=>!S.publishedAt),k=t&&E.some(S=>S.publishedAt),R=()=>{m==="delete"?b(null):(b("delete"),g("willBulkDeleteEntries"))},T=()=>{m==="publish"?b(null):(b("publish"),g("willBulkPublishEntries"))},O=()=>{m==="unpublish"?b(null):(b("unpublish"),g("willBulkUnpublishEntries"))},D=async(S,B)=>{try{f(!0),await S(l),f(!1),B(),i()}catch{f(!1),B()}},C=()=>D(r,R),M=()=>D(s,T),I=()=>D(a,O);return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"tertiary",onClick:T},c({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(Rs,{isOpen:m==="publish",onToggleDialog:T,isConfirmButtonLoading:p,onConfirm:M})),k&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"tertiary",onClick:O},c({id:"app.utils.unpublish",defaultMessage:"Unpublish"})),e.createElement(Ms,{isOpen:m==="unpublish",onToggleDialog:O,isConfirmButtonLoading:p,onConfirm:I})),o&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"danger-light",onClick:R},c({id:"global.delete",defaultMessage:"Delete"})),e.createElement(Ts,{isOpen:m==="delete",onToggleDialog:R,isConfirmButtonLoading:p,onConfirm:C})))};Fo.defaultProps={showPublish:!1,showDelete:!1,onConfirmDeleteAll(){},onConfirmPublishAll(){},onConfirmUnpublishAll(){}},Fo.propTypes={showPublish:n().bool,showDelete:n().bool,onConfirmDeleteAll:n().func,onConfirmPublishAll:n().func,onConfirmUnpublishAll:n().func,selectedEntries:n().array.isRequired,clearSelectedEntries:n().func.isRequired};var nu=Fo;const ou=(()=>window&&window.strapi&&window.strapi.isEE?d(57047).Z:d(42814).Z)(),Lo=t=>{let{canCreate:o,canDelete:r,canPublish:s,contentTypeName:a,action:l,isBulkable:i,isLoading:c,onConfirmDelete:g,onConfirmDeleteAll:u,onConfirmPublishAll:p,onConfirmUnpublishAll:f,layout:m,rows:b}=t;const{runHookWaterfall:E}=(0,y.j1)(),v=m.contentType.options?.draftAndPublish??!1,{formatMessage:k}=(0,V.Z)(),R=(0,J.v9)(rs),T=(0,e.useMemo)(()=>{const D=E(je.No,{displayedHeaders:R,layout:m}).displayedHeaders.map(M=>{const{fieldSchema:I,metadatas:S,name:B}=M;return{...M,metadatas:{...S,label:k({id:(0,h.OB)(`containers.ListPage.table-headers.${B}`),defaultMessage:S.label})},name:I.type==="relation"?`${B}.${S.mainField.name}`:B}});v&&D.push({key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:k({id:(0,h.OB)("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(M){let{publishedAt:I}=M;return e.createElement(Cs,{isPublished:!!I})}});const C=ou(m);return C&&D.push(C),D},[E,R,m,v,k]);return e.createElement(y.tM,{components:{ConfirmDialogDelete:tu},contentType:a,action:l,isLoading:c,headers:T,onConfirmDelete:g,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:b,withBulkActions:!0,withMainAction:(r||s)&&i,renderBulkActionsBar:O=>{let{selectedEntries:D,clearSelectedEntries:C}=O;return e.createElement(nu,{showPublish:s&&v,showDelete:r,onConfirmDeleteAll:u,onConfirmPublishAll:p,onConfirmUnpublishAll:f,selectedEntries:D,clearSelectedEntries:C})}},e.createElement(eu,{canCreate:o,canDelete:r,contentType:m.contentType,headers:T,rows:b,withBulkActions:!0,withMainAction:r&&i}))};Lo.defaultProps={action:void 0},Lo.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canPublish:n().bool.isRequired,contentTypeName:n().string.isRequired,action:n().node,isBulkable:n().bool.isRequired,isLoading:n().bool.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,onConfirmDelete:n().func.isRequired,onConfirmDeleteAll:n().func.isRequired,onConfirmPublishAll:n().func.isRequired,onConfirmUnpublishAll:n().func.isRequired,rows:n().array.isRequired};var ru=Lo;const su=["json","component","media","richtext","dynamiczone","password"],au=["createdAt","updatedAt"];var iu=(t,o)=>{const{allPermissions:r}=(0,y.vn)(),s=(0,y.ZT)(r,[{action:"plugin::content-manager.explorer.read",subject:o}]),a=x()(s,["0","properties","fields"],[]);return Object.keys(x()(t,["attributes"]),{}).filter(c=>{const g=x()(t,["attributes",c],{});return!(!g.type||su.includes(g.type)||!a.includes(c)&&c!=="id"&&!au.includes(c))}).sort()},lu=d(5644);const Ds=({displayedFilters:t})=>{const[o,r]=(0,e.useState)(!1),{formatMessage:s}=(0,V.Z)(),a=(0,e.useRef)(),{trackUsage:l}=(0,y.rS)(),i=()=>{o||l("willFilterEntries"),r(c=>!c)};return e.createElement(e.Fragment,null,e.createElement(A.x,{paddingTop:1,paddingBottom:1},e.createElement(ce.z,{variant:"tertiary",ref:a,startIcon:e.createElement(lu.Z,null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),o&&e.createElement(y.J5,{displayedFilters:t,isVisible:o,onToggle:i,source:a})),e.createElement(y.W$,{filtersSchema:t}))};Ds.propTypes={displayedFilters:n().arrayOf(n().shape({name:n().string.isRequired,metadatas:n().shape({label:n().string}),fieldSchema:n().shape({type:n().string})})).isRequired};var cu=Ds;const ks=({contentType:t,slug:o,metadatas:r})=>{const{formatMessage:s}=(0,V.Z)(),l=iu(t,o).map(i=>{const c=t.attributes[i],{type:g,enum:u}=c,p={name:"didFilterEntries",properties:{useRelation:g==="relation"}},{mainField:f,label:m}=r[i].list;return{name:i,metadatas:{label:s({id:m,defaultMessage:m})},fieldSchema:{type:g,options:u,mainField:f},trackedEvent:p}});return e.createElement(cu,{displayedFilters:l})};ks.propTypes={contentType:n().object.isRequired,metadatas:n().object.isRequired,slug:n().string.isRequired};var du=ks,uu=t=>Object.keys(t).reduce((r,s)=>{const a=t[s];return(0,h.ko)(a)&&r.push(s),r},[]).sort();const Is=({layout:t})=>{const o=(0,J.I0)(),r=(0,J.v9)(rs),{trackUsage:s}=(0,y.rS)(),{formatMessage:a}=(0,V.Z)(),l=uu(t.contentType.attributes).map(g=>{const u=t.contentType.metadatas[g].list;return{name:g,intlLabel:{id:u.label,defaultMessage:u.label}}}),i=r.map(({name:g})=>g),c=g=>{if(s("didChangeDisplayedFields"),g.length<i.length){const u=i.filter(p=>g.indexOf(p)===-1);o(Do({name:u[0],value:!0}))}else{const u=g.filter(p=>i.indexOf(p)===-1);o(Do({name:u[0],value:!1}))}};return e.createElement(A.x,{paddingTop:1,paddingBottom:1},e.createElement(He.P,{"aria-label":"change displayed fields",value:i,onChange:c,customizeContent:g=>a({id:(0,ve.Z)("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:g.length}),multi:!0,size:"S"},l.map(g=>e.createElement(Ee.W,{key:g.name,value:g.name},a({id:g.intlLabel.id||g.name,defaultMessage:g.intlLabel.defaultMessage||g.name})))))};Is.propTypes={layout:n().shape({contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired};var mu=(0,e.memo)(Is);const So=({pagination:t})=>e.createElement(A.x,{paddingTop:4},e.createElement(F.k,{alignItems:"flex-end",justifyContent:"space-between"},e.createElement(y.v4,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),e.createElement(y.tU,{pagination:t})));So.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},So.propTypes={pagination:n().shape({page:n().number,pageCount:n().number,pageSize:n().number,total:n().number})};var pu=So;const gu=Oe.Z.contentManager,fu=(0,j.ZP)(A.x)`
1007
+ `,Po=({content:t,fieldSchema:o,metadatas:r,name:s,rowId:a,contentType:l})=>{const{type:i}=o;if(!Yd(i,t,r,o))return e.createElement(Q.Z,{textColor:"neutral800"},"-");switch(i){case"media":return o.multiple?e.createElement(Zd,{value:t}):e.createElement(ss,{...t});case"relation":return gs(o.relation)?e.createElement(Ud,{metadatas:r,value:t}):e.createElement(Wd,{fieldSchema:o,metadatas:r,value:t,name:s,entityId:a,contentType:l});case"component":return o.repeatable===!0?e.createElement(Hd,{value:t,metadatas:r}):e.createElement(Gd,{value:t,metadatas:r});case"string":return e.createElement(Ut.u,{description:t},e.createElement(hs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Mt,{type:i,value:t})));default:return e.createElement(hs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Mt,{type:i,value:t}))}};Po.defaultProps={content:void 0},Po.propTypes={content:n().any,contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({component:n().string,multiple:n().bool,type:n().string.isRequired,repeatable:n().bool,relation:n().string}).isRequired,metadatas:n().object.isRequired,name:n().string.isRequired,rowId:n().oneOfType([n().string,n().number]).isRequired};var Xd=Po;const Oo=({canCreate:t,canDelete:o,contentType:r,headers:s,entriesToDelete:a,onClickDelete:l,onSelectRow:i,withMainAction:c,withBulkActions:g,rows:u})=>{const{push:p,location:{pathname:f}}=(0,te.k6)(),{formatMessage:m}=(0,V.Z)(),{trackUsage:b}=(0,y.rS)(),E=(0,pe.fi)();return e.createElement(Od.p,null,u.map((v,k)=>{const R=a.findIndex(O=>O===v.id)!==-1,T=m({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:k});return e.createElement(wd.Tr,{key:v.id,...(0,y.X7)({fn(){b("willEditEntryFromList"),p({pathname:`${f}/${v.id}`,state:{from:f},search:E})},condition:g})},c&&e.createElement(ko.Td,{...y.UW},e.createElement(xd.C,{"aria-label":m({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,Ld.Pp)(v.firstname,v.lastname)}),checked:R,onChange:()=>{i({name:v.id,value:!R})}})),s.map(({key:O,cellFormatter:D,name:C,...M})=>e.createElement(ko.Td,{key:O},typeof D=="function"?D(v,{key:O,name:C,...M}):e.createElement(Xd,{content:v[C.split(".")[0]],name:C,contentType:r,...M,rowId:v.id}))),g&&e.createElement(ko.Td,null,e.createElement(F.k,{justifyContent:"end",...y.UW},e.createElement(be.h,{forwardedAs:vt.rU,onClick:()=>{b("willEditEntryFromButton")},to:{pathname:`${f}/${v.id}`,state:{from:f},search:E},label:m({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:T}),noBorder:!0,icon:e.createElement(Ve.Z,null)}),t&&e.createElement(A.x,{paddingLeft:1},e.createElement(be.h,{forwardedAs:vt.rU,to:{pathname:`${f}/create/clone/${v.id}`,state:{from:f},search:E},label:m({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:T}),noBorder:!0,icon:e.createElement(Fd.Z,null)})),o&&e.createElement(A.x,{paddingLeft:1},e.createElement(be.h,{onClick:()=>{b("willDeleteEntryFromList"),l(v.id)},label:m({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:T}),noBorder:!0,icon:e.createElement(Ye.Z,null)})))))}))};Oo.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},Oo.propTypes={canCreate:n().bool,canDelete:n().bool,contentType:n().shape({uid:n().string.isRequired}).isRequired,entriesToDelete:n().array,headers:n().array.isRequired,onClickDelete:n().func,onSelectRow:n().func,rows:n().array,withBulkActions:n().bool,withMainAction:n().bool};var Jd=Oo;const ys=({area:t,...o})=>{const r=jt(t);return r?e.createElement("ul",null,r.map(s=>s.Component(o)?e.createElement(A.x,{key:s.name,padding:3,style:{textAlign:"center"}},e.createElement(s.Component,{...o})):null)):null};ys.propTypes={area:n().string.isRequired};var ln=ys;const bs=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(tn.V,{onClose:r,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),e.createElement(F.k,null,e.createElement(ln,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:r,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Ye.Z,null),id:"confirm-delete",loading:t},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};bs.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};var _d=bs;function Es({isPublished:t}){const{formatMessage:o}=(0,V.Z)(),r=t?"success":"secondary";return e.createElement(Pn.q,{showBullet:!1,variant:r,size:"S",width:"min-content"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${r}700`},o({id:(0,h.OB)(`containers.List.${t?"published":"draft"}`),defaultMessage:t?"Published":"Draft"})))}Es.propTypes={isPublished:n().bool.isRequired};const cn=({onToggleDialog:t,isOpen:o,dialogBody:r,endAction:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(tn.V,{onClose:t,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},r)),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:t,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:s}))};cn.propTypes={isOpen:n().bool.isRequired,onToggleDialog:n().func.isRequired,dialogBody:n().node.isRequired,endAction:n().node.isRequired};const wo={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired},vs=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(cn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.publish.all"),defaultMessage:"Are you sure you want to publish these entries?"})),e.createElement(ln,{area:"contentManager.listView.publishModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"secondary",startIcon:e.createElement(st.Z,null),loading:r},a({id:"app.utils.publish",defaultMessage:"Publish"}))})};vs.propTypes=wo;const Cs=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(cn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.unpublish.all"),defaultMessage:"Are you sure you want to unpublish these entries?"})),e.createElement(ln,{area:"contentManager.listView.unpublishModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"secondary",startIcon:e.createElement(st.Z,null),loading:r},a({id:"app.utils.unpublish",defaultMessage:"Unpublish"}))})};Cs.propTypes=wo;const Rs=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(cn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"})),e.createElement(ln,{area:"contentManager.listView.deleteModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Ye.Z,null),id:"confirm-delete",loading:r},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))})};Rs.propTypes=wo;const xo=({showPublish:t,showDelete:o,onConfirmDeleteAll:r,onConfirmPublishAll:s,onConfirmUnpublishAll:a,selectedEntries:l,clearSelectedEntries:i})=>{const{formatMessage:c}=(0,V.Z)(),{trackUsage:g}=(0,y.rS)(),{data:u}=(0,J.v9)(ts()),[p,f]=(0,e.useState)(!1),[m,b]=(0,e.useState)(null),E=u.filter(S=>l.includes(S.id)),v=t&&E.some(S=>!S.publishedAt),k=t&&E.some(S=>S.publishedAt),R=()=>{m==="delete"?b(null):(b("delete"),g("willBulkDeleteEntries"))},T=()=>{m==="publish"?b(null):(b("publish"),g("willBulkPublishEntries"))},O=()=>{m==="unpublish"?b(null):(b("unpublish"),g("willBulkUnpublishEntries"))},D=async(S,B)=>{try{f(!0),await S(l),f(!1),B(),i()}catch{f(!1),B()}},C=()=>D(r,R),M=()=>D(s,T),I=()=>D(a,O);return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"tertiary",onClick:T},c({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(vs,{isOpen:m==="publish",onToggleDialog:T,isConfirmButtonLoading:p,onConfirm:M})),k&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"tertiary",onClick:O},c({id:"app.utils.unpublish",defaultMessage:"Unpublish"})),e.createElement(Cs,{isOpen:m==="unpublish",onToggleDialog:O,isConfirmButtonLoading:p,onConfirm:I})),o&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"danger-light",onClick:R},c({id:"global.delete",defaultMessage:"Delete"})),e.createElement(Rs,{isOpen:m==="delete",onToggleDialog:R,isConfirmButtonLoading:p,onConfirm:C})))};xo.defaultProps={showPublish:!1,showDelete:!1,onConfirmDeleteAll(){},onConfirmPublishAll(){},onConfirmUnpublishAll(){}},xo.propTypes={showPublish:n().bool,showDelete:n().bool,onConfirmDeleteAll:n().func,onConfirmPublishAll:n().func,onConfirmUnpublishAll:n().func,selectedEntries:n().array.isRequired,clearSelectedEntries:n().func.isRequired};var eu=xo;const tu=(()=>window&&window.strapi&&window.strapi.isEE?d(57047).Z:d(42814).Z)(),Fo=t=>{let{canCreate:o,canDelete:r,canPublish:s,contentTypeName:a,action:l,isBulkable:i,isLoading:c,onConfirmDelete:g,onConfirmDeleteAll:u,onConfirmPublishAll:p,onConfirmUnpublishAll:f,layout:m,rows:b}=t;const{runHookWaterfall:E}=(0,y.j1)(),v=m.contentType.options?.draftAndPublish??!1,{formatMessage:k}=(0,V.Z)(),R=(0,J.v9)(ns),T=(0,e.useMemo)(()=>{const D=E(je.No,{displayedHeaders:R,layout:m}).displayedHeaders.map(M=>{const{fieldSchema:I,metadatas:S,name:B}=M;return{...M,metadatas:{...S,label:k({id:(0,h.OB)(`containers.ListPage.table-headers.${B}`),defaultMessage:S.label})},name:I.type==="relation"?`${B}.${S.mainField.name}`:B}});v&&D.push({key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:k({id:(0,h.OB)("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(M){let{publishedAt:I}=M;return e.createElement(Es,{isPublished:!!I})}});const C=tu(m);return C&&D.push(C),D},[E,R,m,v,k]);return e.createElement(y.tM,{components:{ConfirmDialogDelete:_d},contentType:a,action:l,isLoading:c,headers:T,onConfirmDelete:g,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:b,withBulkActions:!0,withMainAction:(r||s)&&i,renderBulkActionsBar:O=>{let{selectedEntries:D,clearSelectedEntries:C}=O;return e.createElement(eu,{showPublish:s&&v,showDelete:r,onConfirmDeleteAll:u,onConfirmPublishAll:p,onConfirmUnpublishAll:f,selectedEntries:D,clearSelectedEntries:C})}},e.createElement(Jd,{canCreate:o,canDelete:r,contentType:m.contentType,headers:T,rows:b,withBulkActions:!0,withMainAction:r&&i}))};Fo.defaultProps={action:void 0},Fo.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canPublish:n().bool.isRequired,contentTypeName:n().string.isRequired,action:n().node,isBulkable:n().bool.isRequired,isLoading:n().bool.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,onConfirmDelete:n().func.isRequired,onConfirmDeleteAll:n().func.isRequired,onConfirmPublishAll:n().func.isRequired,onConfirmUnpublishAll:n().func.isRequired,rows:n().array.isRequired};var nu=Fo;const ou=["json","component","media","richtext","dynamiczone","password"],ru=["createdAt","updatedAt"];var su=(t,o)=>{const{allPermissions:r}=(0,y.vn)(),s=(0,y.ZT)(r,[{action:"plugin::content-manager.explorer.read",subject:o}]),a=x()(s,["0","properties","fields"],[]);return Object.keys(x()(t,["attributes"]),{}).filter(c=>{const g=x()(t,["attributes",c],{});return!(!g.type||ou.includes(g.type)||!a.includes(c)&&c!=="id"&&!ru.includes(c))}).sort()},au=d(5644);const Ms=({displayedFilters:t})=>{const[o,r]=(0,e.useState)(!1),{formatMessage:s}=(0,V.Z)(),a=(0,e.useRef)(),{trackUsage:l}=(0,y.rS)(),i=()=>{o||l("willFilterEntries"),r(c=>!c)};return e.createElement(e.Fragment,null,e.createElement(A.x,{paddingTop:1,paddingBottom:1},e.createElement(ce.z,{variant:"tertiary",ref:a,startIcon:e.createElement(au.Z,null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),o&&e.createElement(y.J5,{displayedFilters:t,isVisible:o,onToggle:i,source:a})),e.createElement(y.W$,{filtersSchema:t}))};Ms.propTypes={displayedFilters:n().arrayOf(n().shape({name:n().string.isRequired,metadatas:n().shape({label:n().string}),fieldSchema:n().shape({type:n().string})})).isRequired};var iu=Ms;const Ts=({contentType:t,slug:o,metadatas:r})=>{const{formatMessage:s}=(0,V.Z)(),l=su(t,o).map(i=>{const c=t.attributes[i],{type:g,enum:u}=c,p={name:"didFilterEntries",properties:{useRelation:g==="relation"}},{mainField:f,label:m}=r[i].list;return{name:i,metadatas:{label:s({id:m,defaultMessage:m})},fieldSchema:{type:g,options:u,mainField:f},trackedEvent:p}});return e.createElement(iu,{displayedFilters:l})};Ts.propTypes={contentType:n().object.isRequired,metadatas:n().object.isRequired,slug:n().string.isRequired};var lu=Ts,cu=t=>Object.keys(t).reduce((r,s)=>{const a=t[s];return(0,h.ko)(a)&&r.push(s),r},[]).sort();const Ds=({layout:t})=>{const o=(0,J.I0)(),r=(0,J.v9)(ns),{trackUsage:s}=(0,y.rS)(),{formatMessage:a}=(0,V.Z)(),l=cu(t.contentType.attributes).map(g=>{const u=t.contentType.metadatas[g].list;return{name:g,intlLabel:{id:u.label,defaultMessage:u.label}}}),i=r.map(({name:g})=>g),c=g=>{if(s("didChangeDisplayedFields"),g.length<i.length){const u=i.filter(p=>g.indexOf(p)===-1);o(To({name:u[0],value:!0}))}else{const u=g.filter(p=>i.indexOf(p)===-1);o(To({name:u[0],value:!1}))}};return e.createElement(A.x,{paddingTop:1,paddingBottom:1},e.createElement(He.P,{"aria-label":"change displayed fields",value:i,onChange:c,customizeContent:g=>a({id:(0,ve.Z)("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:g.length}),multi:!0,size:"S"},l.map(g=>e.createElement(Ee.W,{key:g.name,value:g.name},a({id:g.intlLabel.id||g.name,defaultMessage:g.intlLabel.defaultMessage||g.name})))))};Ds.propTypes={layout:n().shape({contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired};var du=(0,e.memo)(Ds);const Lo=({pagination:t})=>e.createElement(A.x,{paddingTop:4},e.createElement(F.k,{alignItems:"flex-end",justifyContent:"space-between"},e.createElement(y.v4,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),e.createElement(y.tU,{pagination:t})));Lo.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},Lo.propTypes={pagination:n().shape({page:n().number,pageCount:n().number,pageSize:n().number,total:n().number})};var uu=Lo;const mu=we.Z.contentManager,pu=(0,j.ZP)(A.x)`
1008
1008
  svg {
1009
1009
  path {
1010
1010
  fill: ${({theme:t})=>t.colors.neutral900};
1011
1011
  }
1012
1012
  }
1013
- `;function Ps({canCreate:t,canDelete:o,canRead:r,canPublish:s,data:a,getData:l,getDataSucceeded:i,isLoading:c,layout:g,pagination:u,slug:p}){const{total:f}=u,{contentType:m}=g,{metadatas:b,settings:{bulkable:E,filterable:v,searchable:k}}=m,R=(0,y.lm)(),{trackUsage:T}=(0,y.rS)(),{refetchPermissions:O}=(0,y.vn)(),D=(0,e.useRef)(T),C=(0,e.useRef)(O),{notifyStatus:M}=(0,ko.G)(),{formatAPIError:I}=(0,y.So)(h.OB);(0,y.go)();const[{query:S}]=(0,y.Kx)(),B=Ir(S),$=(0,en.stringify)({plugins:S.plugins},{encode:!1}),{pathname:K}=(0,te.TH)(),{push:W}=(0,te.k6)(),{formatMessage:G}=(0,V.Z)(),z=m.options?.draftAndPublish??!1,X=(0,y.kY)(),{post:q,del:U}=X,L=(0,Xe.useMutation)(de=>q(`/content-manager/collection-types/${m.uid}/actions/bulkPublish`,de),{onSuccess(){R({type:"success",message:{id:"content-manager.success.record.publish",defaultMessage:"Published"}}),Y(`/content-manager/collection-types/${p}${B}`)},onError(de){R({type:"warning",message:I(de)})}}),w=(0,Xe.useMutation)(de=>q(`/content-manager/collection-types/${m.uid}/actions/bulkUnpublish`,de),{onSuccess(){R({type:"success",message:{id:"content-manager.success.record.unpublish",defaultMessage:"Unpublished"}}),Y(`/content-manager/collection-types/${p}${B}`)},onError(de){R({type:"warning",message:I(de)})}}),N=(0,e.useRef)(""),Y=(0,e.useCallback)(async(de,ue)=>{l();try{const Fe=ue?{cancelToken:ue.token}:null,{data:{results:Ce,pagination:De}}=await X.get(de,Fe);M(G({id:(0,h.OB)("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:De.count})),i(De,Ce)}catch(Fe){if(Qe.Z.isCancel(Fe))return;if((Fe?.response?.status??null)===403){await C.current(),R({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),W("/");return}R({type:"warning",message:{id:(0,h.OB)("error.model.fetch")}})}},[G,l,i,M,W,R,X]),P=(0,e.useCallback)(async de=>{try{await q((0,h.IF)(`collection-types/${p}/actions/bulkDelete`),{ids:de});const ue=(0,h.IF)(`collection-types/${p}${B}`);Y(ue),D.current("didBulkDeleteEntries")}catch(ue){R({type:"warning",message:I(ue)})}},[Y,B,p,R,I,q]),Z=(0,e.useCallback)(async de=>{try{await U((0,h.IF)(`collection-types/${p}/${de}`));const ue=(0,h.IF)(`collection-types/${p}${B}`);Y(ue),R({type:"success",message:{id:(0,h.OB)("success.record.delete")}})}catch(ue){R({type:"warning",message:I(ue)})}},[p,B,Y,R,I,U]),oe=async de=>{const ue={validIds:[],errors:{}},Fe=(0,h.Ex)(m,{components:g.components},{isDraft:!1}),De=a.filter(Re=>de.includes(Re.id)).map(Re=>Fe.validate(Re,{abortEarly:!1}));return(await Promise.allSettled(De)).forEach(Re=>{if(Re.status==="rejected"){const _=Re.reason.value.id;ue.errors[_]=(0,y.CJ)(Re.reason)}Re.status==="fulfilled"&&ue.validIds.push(Re.value.id)}),ue},re=async de=>{const ue=await oe(de);if(Object.values(ue.errors).length)throw R({type:"warning",title:{id:"content-manager.listView.validation.errors.title",defaultMessage:"Action required"},message:{id:"content-manager.listView.validation.errors.message",defaultMessage:"Please make sure all fields are valid before publishing (required field, min/max character limit, etc.)"}}),new Error("Validation error");return L.mutateAsync({ids:de})},me=de=>w.mutateAsync({ids:de});(0,e.useEffect)(()=>{const ue=Qe.Z.CancelToken.source(),Fe=r,Ce=(0,h.IF)(`collection-types/${p}${B}`);return Fe&&Ce.includes(N.current)&&Y(Ce,ue),()=>{N.current=p,ue.cancel("Operation canceled by the user.")}},[r,l,p,B,i,Y]);const H=G({id:(0,h.OB)("header.name"),defaultMessage:"Content"}),ae=G({id:m.info.displayName,defaultMessage:m.info.displayName||H}),Ie=r?G({id:(0,h.OB)("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:f}):null,Ne=de=>t?e.createElement(ce.z,{...de,forwardedAs:vt.rU,onClick:()=>{const ue=z?{status:"draft"}:{};D.current("willCreateEntry",ue)},to:{pathname:`${K}/create`,search:S.plugins?$:""},startIcon:e.createElement(St.Z,null),style:{textDecoration:"none"}},G({id:(0,h.OB)("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return e.createElement(Te.o,{"aria-busy":c},e.createElement(he.T,{primaryAction:Ne(),subtitle:Ie,title:ae,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(tn.Z,null),to:"/content-manager/"},G({id:"global.back",defaultMessage:"Back"}))}),!r&&e.createElement(ns.Z,{endActions:e.createElement(zt,{area:"contentManager.listView.actions"})}),r&&e.createElement(ns.Z,{endActions:e.createElement(e.Fragment,null,e.createElement(zt,{area:"contentManager.listView.actions"}),e.createElement(mu,{layout:g}),e.createElement(y.jW,{permissions:gu.collectionTypesConfigurations},e.createElement(fu,{paddingTop:1,paddingBottom:1},e.createElement(be.h,{onClick:()=>{T("willEditListLayout")},forwardedAs:vt.rU,to:{pathname:`${p}/configurations/list`,search:$},icon:e.createElement(qr.Z,null),label:G({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:e.createElement(e.Fragment,null,k&&e.createElement(y.m,{label:G({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:ae}),placeholder:G({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),v&&e.createElement(du,{contentType:m,slug:p,metadatas:b}))}),e.createElement(We.D,null,r?e.createElement(e.Fragment,null,e.createElement(ru,{canCreate:t,canDelete:o,canPublish:s,contentTypeName:ae,onConfirmDelete:Z,onConfirmDeleteAll:P,onConfirmPublishAll:re,onConfirmUnpublishAll:me,isBulkable:E,isLoading:c,layout:g,rows:a,action:Ne({variant:"secondary"})}),e.createElement(pu,{pagination:{pageCount:u?.pageCount||1}})):e.createElement(y.ZF,null)))}Ps.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canRead:n().bool.isRequired,canPublish:n().bool.isRequired,data:n().array.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,attributes:n().object.isRequired,metadatas:n().object.isRequired,info:n().shape({displayName:n().string.isRequired}).isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,isLoading:n().bool.isRequired,getData:n().func.isRequired,getDataSucceeded:n().func.isRequired,pagination:n().shape({total:n().number.isRequired,pageCount:n().number}).isRequired,slug:n().string.isRequired};const hu=wd();function yu(t){return(0,ts.bindActionCreators)({getData:Md,getDataSucceeded:Td,onChangeListHeaders:Do,onResetListHeaders:Dd},t)}const bu=(0,J.$j)(hu,yu);var Eu=(0,ts.compose)(bu)((0,e.memo)(Ps,xe()));const Ao=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.permissions);return r?e.createElement(y.dO,null):e.createElement(Eu,{...t,...s})};Ao.defaultProps={permissions:[]},Ao.propTypes={permissions:n().array,slug:n().string.isRequired};var vu=(0,e.memo)(Ao,(t,o)=>{const r=(0,y.e5)(t,o);return Object.keys(r).filter(a=>a!=="state").length>0});const Os=({layout:t,...o})=>{const r=(0,J.I0)(),{replace:s}=(0,te.k6)(),[{query:a,rawQuery:l}]=(0,y.Kx)(),i=(0,pe.r5)(a,o.slug,"listView"),c=(0,pe.Ky)(o.slug);return(0,e.useEffect)(()=>{l||s(c)},[l,s,c]),(0,e.useEffect)(()=>{r(Id(t))},[r,t]),(0,e.useEffect)(()=>()=>{r(kd())},[r]),i?e.createElement(vu,{...o,layout:t,permissions:i}):null};Os.propTypes={layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired,pluginOptions:n().object}).isRequired}).isRequired,slug:n().string.isRequired};var Cu=Os;const $o=({modifiedData:t,onChange:o,sortOptions:r})=>{const{formatMessage:s}=(0,V.Z)(),{settings:a,metadatas:l}=t;return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},s({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(F.k,{justifyContent:"space-between",gap:4},e.createElement(A.x,{width:"100%"},e.createElement(Bt.s,{label:s({id:(0,h.OB)("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{o({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable})),e.createElement(A.x,{width:"100%"},e.createElement(Bt.s,{label:s({id:(0,h.OB)("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{o({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable})),e.createElement(A.x,{width:"100%"},e.createElement(Bt.s,{label:s({id:(0,h.OB)("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{o({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable}))),e.createElement(ke.r,{gap:4},e.createElement(ge.P,{s:12,col:6},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:s({id:(0,h.OB)("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>o({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:t.settings.pageSize||""},[10,20,50,100].map(i=>e.createElement(Ee.W,{key:i,value:i},i)))),e.createElement(ge.P,{s:12,col:3},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>o({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:t.settings.defaultSortBy||""},r.map(i=>e.createElement(Ee.W,{key:i,value:i},l[i].list.label||i)))),e.createElement(ge.P,{s:12,col:3},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>o({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:t.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>e.createElement(Ee.W,{key:i,value:i},i))))))};$o.defaultProps={modifiedData:{},sortOptions:[]},$o.propTypes={modifiedData:n().object,onChange:n().func.isRequired,sortOptions:n().array};var Ru=$o;const Zo=(0,j.ZP)(F.k)`
1013
+ `;function ks({canCreate:t,canDelete:o,canRead:r,canPublish:s,data:a,getData:l,getDataSucceeded:i,isLoading:c,layout:g,pagination:u,slug:p}){const{total:f}=u,{contentType:m}=g,{metadatas:b,settings:{bulkable:E,filterable:v,searchable:k}}=m,R=(0,y.lm)(),{trackUsage:T}=(0,y.rS)(),{refetchPermissions:O}=(0,y.vn)(),D=(0,e.useRef)(T),C=(0,e.useRef)(O),{notifyStatus:M}=(0,Do.G)(),{formatAPIError:I}=(0,y.So)(h.OB);(0,y.go)();const[{query:S}]=(0,y.Kx)(),B=Dr(S),$=(0,_t.stringify)({plugins:S.plugins},{encode:!1}),{pathname:K}=(0,te.TH)(),{push:W}=(0,te.k6)(),{formatMessage:G}=(0,V.Z)(),z=m.options?.draftAndPublish??!1,X=(0,y.kY)(),{post:q,del:U}=X,L=(0,Xe.useMutation)(de=>q(`/content-manager/collection-types/${m.uid}/actions/bulkPublish`,de),{onSuccess(){R({type:"success",message:{id:"content-manager.success.record.publish",defaultMessage:"Published"}}),Y(`/content-manager/collection-types/${p}${B}`)},onError(de){R({type:"warning",message:I(de)})}}),w=(0,Xe.useMutation)(de=>q(`/content-manager/collection-types/${m.uid}/actions/bulkUnpublish`,de),{onSuccess(){R({type:"success",message:{id:"content-manager.success.record.unpublish",defaultMessage:"Unpublished"}}),Y(`/content-manager/collection-types/${p}${B}`)},onError(de){R({type:"warning",message:I(de)})}}),N=(0,e.useRef)(""),Y=(0,e.useCallback)(async(de,ue)=>{l();try{const Fe=ue?{cancelToken:ue.token}:null,{data:{results:Re,pagination:ke}}=await X.get(de,Fe);M(G({id:(0,h.OB)("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:ke.count})),i(ke,Re)}catch(Fe){if(Qe.default.isCancel(Fe))return;if((Fe?.response?.status??null)===403){await C.current(),R({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),W("/");return}R({type:"warning",message:{id:(0,h.OB)("error.model.fetch")}})}},[G,l,i,M,W,R,X]),P=(0,e.useCallback)(async de=>{try{await q((0,h.IF)(`collection-types/${p}/actions/bulkDelete`),{ids:de});const ue=(0,h.IF)(`collection-types/${p}${B}`);Y(ue),D.current("didBulkDeleteEntries")}catch(ue){R({type:"warning",message:I(ue)})}},[Y,B,p,R,I,q]),Z=(0,e.useCallback)(async de=>{try{await U((0,h.IF)(`collection-types/${p}/${de}`));const ue=(0,h.IF)(`collection-types/${p}${B}`);Y(ue),R({type:"success",message:{id:(0,h.OB)("success.record.delete")}})}catch(ue){R({type:"warning",message:I(ue)})}},[p,B,Y,R,I,U]),oe=async de=>{const ue={validIds:[],errors:{}},Fe=(0,h.Ex)(m,{components:g.components},{isDraft:!1}),ke=a.filter(Me=>de.includes(Me.id)).map(Me=>Fe.validate(Me,{abortEarly:!1}));return(await Promise.allSettled(ke)).forEach(Me=>{if(Me.status==="rejected"){const _=Me.reason.value.id;ue.errors[_]=(0,y.CJ)(Me.reason)}Me.status==="fulfilled"&&ue.validIds.push(Me.value.id)}),ue},re=async de=>{const ue=await oe(de);if(Object.values(ue.errors).length)throw R({type:"warning",title:{id:"content-manager.listView.validation.errors.title",defaultMessage:"Action required"},message:{id:"content-manager.listView.validation.errors.message",defaultMessage:"Please make sure all fields are valid before publishing (required field, min/max character limit, etc.)"}}),new Error("Validation error");return L.mutateAsync({ids:de})},me=de=>w.mutateAsync({ids:de});(0,e.useEffect)(()=>{const ue=Qe.default.CancelToken.source(),Fe=r,Re=(0,h.IF)(`collection-types/${p}${B}`);return Fe&&Re.includes(N.current)&&Y(Re,ue),()=>{N.current=p,ue.cancel("Operation canceled by the user.")}},[r,l,p,B,i,Y]);const H=G({id:(0,h.OB)("header.name"),defaultMessage:"Content"}),ae=G({id:m.info.displayName,defaultMessage:m.info.displayName||H}),Pe=r?G({id:(0,h.OB)("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:f}):null,Ne=de=>t?e.createElement(ce.z,{...de,forwardedAs:vt.rU,onClick:()=>{const ue=z?{status:"draft"}:{};D.current("willCreateEntry",ue)},to:{pathname:`${K}/create`,search:S.plugins?$:""},startIcon:e.createElement(St.Z,null),style:{textDecoration:"none"}},G({id:(0,h.OB)("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return e.createElement(De.o,{"aria-busy":c},e.createElement(he.T,{primaryAction:Ne(),subtitle:Pe,title:ae,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),to:"/content-manager/"},G({id:"global.back",defaultMessage:"Back"}))}),!r&&e.createElement(es.Z,{endActions:e.createElement(Wt,{area:"contentManager.listView.actions"})}),r&&e.createElement(es.Z,{endActions:e.createElement(e.Fragment,null,e.createElement(Wt,{area:"contentManager.listView.actions"}),e.createElement(du,{layout:g}),e.createElement(y.jW,{permissions:mu.collectionTypesConfigurations},e.createElement(pu,{paddingTop:1,paddingBottom:1},e.createElement(be.h,{onClick:()=>{T("willEditListLayout")},forwardedAs:vt.rU,to:{pathname:`${p}/configurations/list`,search:$},icon:e.createElement(Zr.Z,null),label:G({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:e.createElement(e.Fragment,null,k&&e.createElement(y.m,{label:G({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:ae}),placeholder:G({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),v&&e.createElement(lu,{contentType:m,slug:p,metadatas:b}))}),e.createElement(We.D,null,r?e.createElement(e.Fragment,null,e.createElement(nu,{canCreate:t,canDelete:o,canPublish:s,contentTypeName:ae,onConfirmDelete:Z,onConfirmDeleteAll:P,onConfirmPublishAll:re,onConfirmUnpublishAll:me,isBulkable:E,isLoading:c,layout:g,rows:a,action:Ne({variant:"secondary"})}),e.createElement(uu,{pagination:{pageCount:u?.pageCount||1}})):e.createElement(y.ZF,null)))}ks.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canRead:n().bool.isRequired,canPublish:n().bool.isRequired,data:n().array.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,attributes:n().object.isRequired,metadatas:n().object.isRequired,info:n().shape({displayName:n().string.isRequired}).isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,isLoading:n().bool.isRequired,getData:n().func.isRequired,getDataSucceeded:n().func.isRequired,pagination:n().shape({total:n().number.isRequired,pageCount:n().number}).isRequired,slug:n().string.isRequired};const gu=Pd();function fu(t){return(0,_r.bindActionCreators)({getData:Cd,getDataSucceeded:Rd,onChangeListHeaders:To,onResetListHeaders:Md},t)}const hu=(0,J.$j)(gu,fu);var yu=(0,_r.compose)(hu)((0,e.memo)(ks,Ce()));const So=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.permissions);return r?e.createElement(y.dO,null):e.createElement(yu,{...t,...s})};So.defaultProps={permissions:[]},So.propTypes={permissions:n().array,slug:n().string.isRequired};var bu=(0,e.memo)(So,(t,o)=>{const r=(0,y.e5)(t,o);return Object.keys(r).filter(a=>a!=="state").length>0});const Is=({layout:t,...o})=>{const r=(0,J.I0)(),{replace:s}=(0,te.k6)(),[{query:a,rawQuery:l}]=(0,y.Kx)(),i=(0,pe.r5)(a,o.slug,"listView"),c=(0,pe.Ky)(o.slug);return(0,e.useEffect)(()=>{l||s(c)},[l,s,c]),(0,e.useEffect)(()=>{r(Dd(t))},[r,t]),(0,e.useEffect)(()=>()=>{r(Td())},[r]),i?e.createElement(bu,{...o,layout:t,permissions:i}):null};Is.propTypes={layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired,pluginOptions:n().object}).isRequired}).isRequired,slug:n().string.isRequired};var Eu=Is;const Ao=({modifiedData:t,onChange:o,sortOptions:r})=>{const{formatMessage:s}=(0,V.Z)(),{settings:a,metadatas:l}=t;return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},s({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(F.k,{justifyContent:"space-between",gap:4},e.createElement(A.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,h.OB)("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{o({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable})),e.createElement(A.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,h.OB)("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{o({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable})),e.createElement(A.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,h.OB)("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{o({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable}))),e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{s:12,col:6},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:s({id:(0,h.OB)("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>o({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:t.settings.pageSize||""},[10,20,50,100].map(i=>e.createElement(Ee.W,{key:i,value:i},i)))),e.createElement(ge.P,{s:12,col:3},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>o({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:t.settings.defaultSortBy||""},r.map(i=>e.createElement(Ee.W,{key:i,value:i},l[i].list.label||i)))),e.createElement(ge.P,{s:12,col:3},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>o({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:t.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>e.createElement(Ee.W,{key:i,value:i},i))))))};Ao.defaultProps={modifiedData:{},sortOptions:[]},Ao.propTypes={modifiedData:n().object,onChange:n().func.isRequired,sortOptions:n().array};var vu=Ao;const $o=(0,j.ZP)(F.k)`
1014
1014
  height: ${({theme:t})=>t.spaces[7]};
1015
1015
 
1016
1016
  &:last-child {
1017
1017
  padding: 0 ${({theme:t})=>t.spaces[3]};
1018
1018
  }
1019
- `,Mu=(0,j.ZP)(Zo)`
1019
+ `,Cu=(0,j.ZP)($o)`
1020
1020
  border-right: 1px solid
1021
1021
  ${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
1022
1022
 
@@ -1024,7 +1024,7 @@ ${t}
1024
1024
  width: ${12/16}rem;
1025
1025
  height: ${12/16}rem;
1026
1026
  }
1027
- `,Tu=(0,j.ZP)(F.k)`
1027
+ `,Ru=(0,j.ZP)(F.k)`
1028
1028
  border: 1px solid
1029
1029
  ${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
1030
1030
 
@@ -1036,9 +1036,9 @@ ${t}
1036
1036
  fill: ${({theme:t,isSibling:o})=>o?void 0:t.colors.primary600};
1037
1037
  }
1038
1038
  }
1039
- `,Du=(0,j.ZP)(Q.Z)`
1039
+ `,Mu=(0,j.ZP)(Q.Z)`
1040
1040
  max-width: ${72/16}rem;
1041
- `;function qt({labelField:t,transparent:o,isSibling:r}){return e.createElement(Tu,{background:r?"neutral100":"primary100",display:"inline-flex",gap:3,hasRadius:!0,justifyContent:"space-between",transparent:o,isSibling:r,"max-height":(0,y.Q1)(32),maxWidth:"min-content",opacity:o?0:1},e.createElement(F.k,{gap:3},e.createElement(Mu,{alignItems:"center",cursor:"all-scroll",padding:3},e.createElement(nt.Z,null)),e.createElement(Du,{textColor:r?void 0:"primary600",fontWeight:"bold",ellipsis:!0},t)),e.createElement(F.k,null,e.createElement(Zo,{alignItems:"center"},e.createElement(Ve.Z,null)),e.createElement(Zo,{alignItems:"center"},e.createElement(Ht.Z,null))))}qt.defaultProps={isSibling:!1,transparent:!1},qt.propTypes={isSibling:n().bool,labelField:n().string.isRequired,transparent:n().bool};const Bo=j.ZP.button`
1041
+ `;function Bt({labelField:t,transparent:o,isSibling:r}){return e.createElement(Ru,{background:r?"neutral100":"primary100",display:"inline-flex",gap:3,hasRadius:!0,justifyContent:"space-between",transparent:o,isSibling:r,"max-height":(0,y.Q1)(32),maxWidth:"min-content",opacity:o?0:1},e.createElement(F.k,{gap:3},e.createElement(Cu,{alignItems:"center",cursor:"all-scroll",padding:3},e.createElement(nt.Z,null)),e.createElement(Mu,{textColor:r?void 0:"primary600",fontWeight:"bold",ellipsis:!0},t)),e.createElement(F.k,null,e.createElement($o,{alignItems:"center"},e.createElement(Ve.Z,null)),e.createElement($o,{alignItems:"center"},e.createElement(Vt.Z,null))))}Bt.defaultProps={isSibling:!1,transparent:!1},Bt.propTypes={isSibling:n().bool,labelField:n().string.isRequired,transparent:n().bool};const Zo=j.ZP.button`
1042
1042
  display: flex;
1043
1043
  align-items: center;
1044
1044
  height: ${({theme:t})=>t.spaces[7]};
@@ -1046,7 +1046,7 @@ ${t}
1046
1046
  &:last-child {
1047
1047
  padding: 0 ${({theme:t})=>t.spaces[3]};
1048
1048
  }
1049
- `,ws=(0,j.ZP)(Bo)`
1049
+ `,Ps=(0,j.ZP)(Zo)`
1050
1050
  padding: 0 ${({theme:t})=>t.spaces[3]};
1051
1051
  border-right: 1px solid ${({theme:t})=>t.colors.neutral150};
1052
1052
  cursor: all-scroll;
@@ -1055,7 +1055,7 @@ ${t}
1055
1055
  width: ${12/16}rem;
1056
1056
  height: ${12/16}rem;
1057
1057
  }
1058
- `,ku=(0,j.ZP)(F.k)`
1058
+ `,Tu=(0,j.ZP)(F.k)`
1059
1059
  max-height: ${32/16}rem;
1060
1060
  cursor: pointer;
1061
1061
 
@@ -1082,28 +1082,28 @@ ${t}
1082
1082
  color: ${({theme:t})=>t.colors.primary600};
1083
1083
  }
1084
1084
 
1085
- ${ws} {
1085
+ ${Ps} {
1086
1086
  border-right: 1px solid ${({theme:t})=>t.colors.primary200};
1087
1087
  }
1088
1088
  }
1089
- `,Iu=(0,j.ZP)(A.x)`
1089
+ `,Du=(0,j.ZP)(A.x)`
1090
1090
  &:last-child {
1091
1091
  padding-right: ${({theme:t})=>t.spaces[3]};
1092
1092
  }
1093
- `,xs=({index:t,isDraggingSibling:o,labelField:r,onClickEditField:s,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:c})=>{const{formatMessage:g}=(0,V.Z)(),u=(0,e.useRef)(null),p=(0,e.useRef)(null),[,f]=(0,e.useState)(!1),m=(0,e.useRef)(),b=()=>{m.current&&m.current.click()},[,E]=(0,an.useDrop)({accept:h._Q.FIELD,hover(O,D){if(!p.current)return;const C=O.index,M=t;if(C===M)return;const I=p.current.getBoundingClientRect(),S=(I.right-I.left)/2,$=D.getClientOffset().x-I.left;C>M&&$>S||C<M&&$<S||(a(C,M),O.index=M)}}),[{isDragging:v},k,R]=(0,an.useDrag)({type:h._Q.FIELD,item(){return{index:t,labelField:r,name:i}},collect:O=>({isDragging:O.isDragging()}),end(){c(!1)}});(0,e.useEffect)(()=>{R((0,wt.rX)(),{captureDraggingState:!1})},[R]),(0,e.useEffect)(()=>{v&&c(!0)},[v,c]),(0,e.useEffect)(()=>{o||f(O=>!O)},[o]);const T={dragRef:k(u),dropRef:E(p)};return e.createElement(Iu,{ref:T?T.dropRef:null},v&&e.createElement(qt,{transparent:!0,labelField:r}),!v&&o&&e.createElement(qt,{isSibling:!0,labelField:r}),!v&&!o&&e.createElement(ku,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:v},e.createElement(F.k,{gap:3},e.createElement(ws,{as:"span","aria-label":g({id:(0,h.OB)("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:r}),onClick:O=>O.stopPropagation(),ref:T.dragRef,type:"button"},e.createElement(nt.Z,null)),e.createElement(Q.Z,{fontWeight:"bold"},r)),e.createElement(F.k,{paddingLeft:3},e.createElement(Bo,{ref:m,onClick:O=>{O.stopPropagation(),s(i)},"aria-label":g({id:(0,h.OB)("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:r}),type:"button"},e.createElement(Ve.Z,null)),e.createElement(Bo,{onClick:l,"data-testid":`delete-${i}`,"aria-label":g({id:(0,h.OB)("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:r}),type:"button"},e.createElement(Ht.Z,null)))))};xs.propTypes={index:n().number.isRequired,isDraggingSibling:n().bool.isRequired,labelField:n().string.isRequired,name:n().string.isRequired,onClickEditField:n().func.isRequired,onMoveField:n().func.isRequired,onRemoveField:n().func.isRequired,setIsDraggingSibling:n().func.isRequired};var Pu=xs;const Fs=(0,j.ZP)(A.x)`
1093
+ `,Os=({index:t,isDraggingSibling:o,labelField:r,onClickEditField:s,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:c})=>{const{formatMessage:g}=(0,V.Z)(),u=(0,e.useRef)(null),p=(0,e.useRef)(null),[,f]=(0,e.useState)(!1),m=(0,e.useRef)(),b=()=>{m.current&&m.current.click()},[,E]=(0,sn.useDrop)({accept:h._Q.FIELD,hover(O,D){if(!p.current)return;const C=O.index,M=t;if(C===M)return;const I=p.current.getBoundingClientRect(),S=(I.right-I.left)/2,$=D.getClientOffset().x-I.left;C>M&&$>S||C<M&&$<S||(a(C,M),O.index=M)}}),[{isDragging:v},k,R]=(0,sn.useDrag)({type:h._Q.FIELD,item(){return{index:t,labelField:r,name:i}},collect:O=>({isDragging:O.isDragging()}),end(){c(!1)}});(0,e.useEffect)(()=>{R((0,wt.rX)(),{captureDraggingState:!1})},[R]),(0,e.useEffect)(()=>{v&&c(!0)},[v,c]),(0,e.useEffect)(()=>{o||f(O=>!O)},[o]);const T={dragRef:k(u),dropRef:E(p)};return e.createElement(Du,{ref:T?T.dropRef:null},v&&e.createElement(Bt,{transparent:!0,labelField:r}),!v&&o&&e.createElement(Bt,{isSibling:!0,labelField:r}),!v&&!o&&e.createElement(Tu,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:v},e.createElement(F.k,{gap:3},e.createElement(Ps,{as:"span","aria-label":g({id:(0,h.OB)("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:r}),onClick:O=>O.stopPropagation(),ref:T.dragRef,type:"button"},e.createElement(nt.Z,null)),e.createElement(Q.Z,{fontWeight:"bold"},r)),e.createElement(F.k,{paddingLeft:3},e.createElement(Zo,{ref:m,onClick:O=>{O.stopPropagation(),s(i)},"aria-label":g({id:(0,h.OB)("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:r}),type:"button"},e.createElement(Ve.Z,null)),e.createElement(Zo,{onClick:l,"data-testid":`delete-${i}`,"aria-label":g({id:(0,h.OB)("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:r}),type:"button"},e.createElement(Vt.Z,null)))))};Os.propTypes={index:n().number.isRequired,isDraggingSibling:n().bool.isRequired,labelField:n().string.isRequired,name:n().string.isRequired,onClickEditField:n().func.isRequired,onMoveField:n().func.isRequired,onRemoveField:n().func.isRequired,setIsDraggingSibling:n().func.isRequired};var ku=Os;const ws=(0,j.ZP)(A.x)`
1094
1094
  flex: ${({size:t})=>t};
1095
- `,Ou=(0,j.ZP)(Fs)`
1095
+ `,Iu=(0,j.ZP)(ws)`
1096
1096
  overflow-x: scroll;
1097
1097
  overflow-y: hidden;
1098
- `,wu=(0,j.ZP)(Fs)`
1098
+ `,Pu=(0,j.ZP)(ws)`
1099
1099
  max-width: ${32/16}rem;
1100
- `,Ls=({displayedFields:t,listRemainingFields:o,metadatas:r,onAddField:s,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:c}=(0,V.Z)(),[g,u]=(0,e.useState)(!1),[p,f]=(0,e.useState)(null),m=(0,e.useRef)();function b(...v){f("add"),s(...v)}function E(...v){f("remove"),i(...v)}return(0,e.useEffect)(()=>{p==="add"&&m?.current&&(m.current.scrollLeft=m.current.scrollWidth)},[t,p]),e.createElement(e.Fragment,null,e.createElement(A.x,{paddingBottom:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},c({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"}))),e.createElement(F.k,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},e.createElement(Ou,{size:"1",paddingBottom:4,ref:m},e.createElement(F.k,{gap:3},t.map((v,k)=>e.createElement(Pu,{key:v,index:k,isDraggingSibling:g,onMoveField:l,onClickEditField:a,onRemoveField:R=>E(R,k),name:v,labelField:r[v].list.label||v,setIsDraggingSibling:u})))),e.createElement(wu,{size:"auto",paddingBottom:4},e.createElement(Ge.O,{label:c({id:(0,h.OB)("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:be.h,icon:e.createElement(St.Z,null),disabled:o.length<=0,"data-testid":"add-field"},o.map(v=>e.createElement(Ge.s,{key:v,onClick:()=>b(v)},r[v].list.label||v))))))};Ls.propTypes={displayedFields:ye.PropTypes.array.isRequired,listRemainingFields:ye.PropTypes.array.isRequired,metadatas:ye.PropTypes.objectOf(ye.PropTypes.shape({list:ye.PropTypes.shape({label:ye.PropTypes.string})})).isRequired,onAddField:ye.PropTypes.func.isRequired,onClickEditField:ye.PropTypes.func.isRequired,onMoveField:ye.PropTypes.func.isRequired,onRemoveField:ye.PropTypes.func.isRequired};var xu=Ls;const Fu=(0,j.ZP)(F.k)`
1100
+ `,xs=({displayedFields:t,listRemainingFields:o,metadatas:r,onAddField:s,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:c}=(0,V.Z)(),[g,u]=(0,e.useState)(!1),[p,f]=(0,e.useState)(null),m=(0,e.useRef)();function b(...v){f("add"),s(...v)}function E(...v){f("remove"),i(...v)}return(0,e.useEffect)(()=>{p==="add"&&m?.current&&(m.current.scrollLeft=m.current.scrollWidth)},[t,p]),e.createElement(e.Fragment,null,e.createElement(A.x,{paddingBottom:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},c({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"}))),e.createElement(F.k,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},e.createElement(Iu,{size:"1",paddingBottom:4,ref:m},e.createElement(F.k,{gap:3},t.map((v,k)=>e.createElement(ku,{key:v,index:k,isDraggingSibling:g,onMoveField:l,onClickEditField:a,onRemoveField:R=>E(R,k),name:v,labelField:r[v].list.label||v,setIsDraggingSibling:u})))),e.createElement(Pu,{size:"auto",paddingBottom:4},e.createElement(Ge.O,{label:c({id:(0,h.OB)("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:be.h,icon:e.createElement(St.Z,null),disabled:o.length<=0,"data-testid":"add-field"},o.map(v=>e.createElement(Ge.s,{key:v,onClick:()=>b(v)},r[v].list.label||v))))))};xs.propTypes={displayedFields:ye.PropTypes.array.isRequired,listRemainingFields:ye.PropTypes.array.isRequired,metadatas:ye.PropTypes.objectOf(ye.PropTypes.shape({list:ye.PropTypes.shape({label:ye.PropTypes.string})})).isRequired,onAddField:ye.PropTypes.func.isRequired,onClickEditField:ye.PropTypes.func.isRequired,onMoveField:ye.PropTypes.func.isRequired,onRemoveField:ye.PropTypes.func.isRequired};var Ou=xs;const wu=(0,j.ZP)(F.k)`
1101
1101
  svg {
1102
1102
  width: ${32/16}rem;
1103
1103
  height: ${24/16}rem;
1104
1104
  margin-right: ${({theme:t})=>t.spaces[3]};
1105
1105
  }
1106
- `,Ss=({attributes:t,fieldForm:o,fieldToEdit:r,onCloseModal:s,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:c}=(0,V.Z)(),g=t[r].relationType;let u=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(g)&&(u=!0),e.createElement(Hr.P,{onClose:s,labelledBy:"title"},e.createElement("form",{onSubmit:l},e.createElement(Qr.x,null,e.createElement(Fu,null,e.createElement(Jr,{type:i}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:$t()(r)})))),e.createElement(Gr.f,null,e.createElement(ke.r,{gap:4},e.createElement(ge.P,{s:12,col:6},e.createElement(kn.o,{id:"label-input",label:c({id:(0,h.OB)("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:p=>a(p),value:o.label,hint:c({id:(0,h.OB)("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),u&&e.createElement(ge.P,{s:12,col:6},e.createElement(Bt.s,{"data-testid":"Enable sort on this field",checked:o.sortable,label:c({id:(0,h.OB)("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:p=>a({target:{name:"sortable",value:p.target.checked}}),onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),e.createElement(Kr.m,{startActions:e.createElement(ce.z,{onClick:s,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(ce.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Ss.propTypes={attributes:n().objectOf(n().shape({relationType:n().string})).isRequired,fieldForm:n().shape({label:n().string,sortable:n().bool}).isRequired,fieldToEdit:n().string.isRequired,onChangeEditLabel:n().func.isRequired,onCloseModal:n().func.isRequired,onSubmit:n().func.isRequired,type:n().string.isRequired};var Lu=Ss,Su=(t,o)=>({...t,initialData:o,modifiedData:o});const qo={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}};var Au=(t=qo,o)=>(0,ro.ZP)(t,r=>{const s=["modifiedData","layouts","list"];switch(o.type){case"ADD_FIELD":{const a=x()(t,s,[]);se()(r,s,[...a,o.item]);break}case"MOVE_FIELD":{const a=x()(t,s,[]),{originalIndex:l,atIndex:i}=o;se()(r,s,(0,h.W3)(a,l,i));break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys.split(".")],o.value);break}case"ON_CHANGE_FIELD_METAS":{se()(r,["fieldForm",o.name],o.value);break}case"REMOVE_FIELD":{const a=x()(t,s,[]);se()(r,s,a.filter((l,i)=>o.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=o;r.fieldToEdit=a,r.fieldForm.label=x()(r,["modifiedData","metadatas",a,"list","label"],""),r.fieldForm.sortable=x()(r,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{r.fieldForm={},r.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",t.fieldToEdit,"list"];se()(r,[...a,"label"],t.fieldForm.label),se()(r,[...a,"sortable"],t.fieldForm.sortable);break}default:return r}});const $u=["media","richtext","dynamiczone","relation","component","json"],As=({layout:t,slug:o})=>{const{put:r}=(0,y.kY)(),{formatMessage:s}=(0,V.Z)(),{trackUsage:a}=(0,y.rS)(),l=(0,pe.fi)(),i=(0,y.lm)(),{refetchData:c}=(0,e.useContext)(Ze),[g,u]=(0,e.useState)(!1),p=()=>u(w=>!w),[f,m]=(0,e.useReducer)(Au,qo,()=>Su(qo,t)),{fieldToEdit:b,fieldForm:E,initialData:v,modifiedData:k}=f,R=!qe()(E),{attributes:T}=t,O=k.layouts.list,D=()=>{const{settings:{pageSize:w,defaultSortBy:N,defaultSortOrder:Y},kind:P,uid:Z}=v,oe=`${N}:${Y}`,re=`${(0,en.stringify)({page:1,pageSize:w,sort:oe},{encode:!1})}${l?`&${l}`:""}`;return`/content-manager/${P}/${Z}?${re}`},C=({target:{name:w,value:N}})=>{m({type:"ON_CHANGE",keys:w,value:w==="settings.pageSize"?parseInt(N,10):N})},M=async()=>{const w=Pn()(k,["layouts","settings","metadatas"]);G.mutate(w)},I=w=>{m({type:"ADD_FIELD",item:w})},S=(w,N)=>{w.stopPropagation(),O.length===1?i({type:"info",message:{id:(0,h.OB)("notification.info.minimumFields")}}):m({type:"REMOVE_FIELD",index:N})},B=w=>{w.preventDefault(),p(),a("willSaveContentTypeLayout")},$=w=>{m({type:"SET_FIELD_TO_EDIT",fieldToEdit:w})},K=()=>{m({type:"UNSET_FIELD_TO_EDIT"})},W=w=>{w.preventDefault(),m({type:"SUBMIT_FIELD_FORM"}),K()},G=(0,Xe.useMutation)(w=>r(`/content-manager/content-types/${o}/configuration`,w),{onSuccess(){a("didEditListSettings"),c()},onError(){i({type:"warning",message:{id:"notification.error"}})}}),{isLoading:z}=G,X=({target:{name:w,value:N}})=>{m({type:"ON_CHANGE_FIELD_METAS",name:w,value:N})},q=Object.entries(T).filter(([w,N])=>(0,h.ko)(N)&&!O.includes(w)).map(([w])=>w).sort(),U=Object.entries(T).filter(([,w])=>!$u.includes(w.type)).map(([w])=>w),L=(w,N)=>{m({type:"MOVE_FIELD",originalIndex:w,atIndex:N})};return e.createElement(Ae.A,null,e.createElement(Te.o,{"aria-busy":z},e.createElement("form",{onSubmit:B},e.createElement(he.T,{navigationAction:e.createElement(y.rU,{startIcon:e.createElement(tn.Z,null),to:D,id:"go-back"},s({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(ce.z,{size:"S",startIcon:e.createElement(st.Z,null),disabled:At()(k,v),type:"submit"},s({id:"global.save",defaultMessage:"Save"})),subtitle:s({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:s({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:$t()(k.info.displayName)})}),e.createElement(We.D,null,e.createElement(A.x,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(Ru,{modifiedData:k,onChange:C,sortOptions:U}),e.createElement(A.x,{paddingTop:6,paddingBottom:6},e.createElement($r.i,null)),e.createElement(xu,{listRemainingFields:q,displayedFields:O,onAddField:I,onClickEditField:$,onMoveField:L,onRemoveField:S,metadatas:k.metadatas}))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(st.Z,null),isConfirmButtonLoading:z,isOpen:g,onToggleDialog:p,onConfirm:M,variantRightButton:"success-light"})),R&&e.createElement(Lu,{attributes:T,fieldForm:E,fieldToEdit:b,onChangeEditLabel:X,onCloseModal:K,onSubmit:W,type:x()(T,[b,"type"],"text")})))};As.propTypes={layout:n().shape({uid:n().string.isRequired,settings:n().shape({bulkable:n().bool,defaultSortBy:n().string,defaultSortOrder:n().string,filterable:n().bool,pageSize:n().number,searchable:n().bool}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().objectOf(n().shape({type:n().string})).isRequired}).isRequired,slug:n().string.isRequired};var Zu=(0,e.memo)(As),Bu=()=>e.createElement(A.x,{padding:8},e.createElement(y.Hn,null));const $s=Oe.Z.contentManager,Zs=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=(0,pe.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let p={},f={};return s.contentType&&(p=(0,h.du)(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((m,b)=>(m[b]=(0,h.du)(s.components[b]),m),{})),{rawContentTypeLayout:p,rawComponentsLayouts:f}},[s]);if((s?.contentType?.uid??null)!==t||r)return e.createElement(y.dO,null);const g=({location:{state:p},history:{goBack:f},match:{params:{id:m,origin:b}}},E)=>e.createElement(E,{slug:t,layout:s,state:p,goBack:f,id:m,origin:b}),u=[{path:"create/clone/:origin",comp:sn},{path:"create",comp:sn},{path:":id",comp:sn},{path:"",comp:Cu}].map(({path:p,comp:f})=>e.createElement(te.AW,{key:p,path:`${o}/${p}`,render:m=>g(m,f)}));return e.createElement(_e.ErrorBoundary,{FallbackComponent:Bu},e.createElement(Be.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${o}/configurations/list`},e.createElement(y.O4,{permissions:$s.collectionTypesConfigurations},e.createElement(Zu,{layout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:$s.collectionTypesConfigurations},e.createElement(To,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),u)))};Zs.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var qu=(0,e.memo)(Zs),Bs=d(57678);const Nu=Oe.Z.contentManager,ju=()=>{const[{isLoading:t,data:o},r]=(0,e.useReducer)(Bs.Z,Bs.q),s=(0,e.useMemo)(Ct.Vo,[]),{schemas:a}=(0,J.v9)(c=>s(c),J.wU),{uid:l}=(0,te.UO)(),{get:i}=(0,y.kY)();return(0,e.useEffect)(()=>{const g=Qe.Z.CancelToken.source();return(async p=>{try{r(Jt());const{data:{data:f}}=await i((0,h.IF)(`components/${l}/configuration`),{cancelToken:p.token});r(eo((0,h.w8)(f,a,"component")))}catch(f){if(Qe.Z.isCancel(f))return;console.error(f)}})(g),()=>{g.cancel("Operation canceled by the user.")}},[l,a,i]),t?e.createElement(y.dO,null):e.createElement(y.O4,{permissions:Nu.componentsConfigurations},e.createElement(To,{components:o.components,mainLayout:o.component,slug:l}))};var Wu=(0,e.memo)(ju),zu=d(9695),Uu=d(54725),Vu=()=>{const{formatMessage:t}=(0,V.Z)();return(0,y.go)(),e.createElement(Te.o,null,e.createElement(he.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(We.D,null,e.createElement(zu.x,{action:e.createElement(y.Qj,{variant:"secondary",startIcon:e.createElement(St.Z,null),to:"/plugins/content-type-builder/content-types/create-content-type"},t({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:t({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:e.createElement(Uu.Z,{width:"10rem"}),shadow:"tableShadow"})))},Hu=()=>{const{formatMessage:t}=(0,V.Z)();return(0,y.go)(),e.createElement(Te.o,null,e.createElement(he.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(We.D,null,e.createElement(y.ZF,null)))};const Qu=Oe.Z.contentManager,qs=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=(0,pe.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let c={},g={};return s.contentType&&(g=(0,h.du)(s.contentType)),s.components&&(c=Object.keys(s.components).reduce((u,p)=>(u[p]=(0,h.du)(s.components[p]),u),{})),{rawContentTypeLayout:g,rawComponentsLayouts:c}},[s]);return r?e.createElement(y.dO,null):e.createElement(Be.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:Qu.singleTypesConfigurations},e.createElement(To,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:o,render:({location:{state:c},history:{goBack:g}})=>e.createElement(sn,{layout:s,slug:t,isSingleType:!0,state:c,goBack:g})})))};qs.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Gu=(0,e.memo)(qs),Ku=d(90700),Yu=d(78090),Xu=d(77013),Ju=d(79318),_u=d(66618),em=()=>{const[t,o]=(0,e.useState)(""),{formatMessage:r,locale:s}=(0,V.Z)(),a=(0,e.useMemo)(Ct.KQ,[]),{collectionTypeLinks:l,singleTypeLinks:i}=(0,J.v9)(a,J.wU),{startsWith:c}=(0,y.L0)(s,{sensitivity:"base"}),g=(0,y.Xe)(s,{sensitivity:"base"}),u=(0,e.useMemo)(()=>[{id:"collectionTypes",title:{id:(0,ve.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:l},{id:"singleTypes",title:{id:(0,ve.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:i}].map(b=>({...b,links:b.links.filter(E=>c(E.title,t)).sort((E,v)=>g.compare(E.title,v.title)).map(E=>({...E,title:r({id:E.title,defaultMessage:E.title})}))})),[l,t,i,c,r,g]),p=()=>{o("")},f=({target:{value:b}})=>{o(b)},m=r({id:(0,ve.Z)("header.name"),defaultMessage:"Content"});return e.createElement(Ku.m,{ariaLabel:m},e.createElement(Yu.p,{label:m,searchable:!0,value:t,onChange:f,onClear:p,searchLabel:r({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),e.createElement(Xu.Z,null,u.map(b=>{const E=r({id:b.title.id,defaultMessage:b.title.defaultMessage},b.title.values);return e.createElement(Ju.D,{key:b.id,label:E,badgeLabel:b.links.length.toString()},b.links.map(v=>{const k=v.search?`?${v.search}`:"";return e.createElement(_u.E,{as:vt.OL,key:v.uid,to:`${v.to}${k}`},v.title)}))})))},No=d(92886);const tm=()=>({type:No.fn}),nm=()=>({type:No.sZ}),om=({authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,contentTypeSchemas:r,components:s,fieldSizes:a})=>({type:No.IX,data:{authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,components:s,contentTypeSchemas:r,fieldSizes:a}}),Ns=(t,o,r=[])=>t.filter(s=>s.isDisplayed).map(s=>{const a=[{action:"plugin::content-manager.explorer.create",subject:s.uid},{action:"plugin::content-manager.explorer.read",subject:s.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:s.uid}],i=o==="collectionTypes"?a:l,c=r.find(({uid:u})=>u===s.uid);let g=null;if(c){const u={page:1,pageSize:c.settings.pageSize,sort:`${c.settings.defaultSortBy}:${c.settings.defaultSortOrder}`};g=(0,en.stringify)(u,{encode:!1})}return{permissions:i,search:g,kind:s.kind,title:s.info.displayName,to:`/content-manager/${s.kind}/${s.uid}`,uid:s.uid,name:s.uid,isDisplayed:s.isDisplayed}});var rm=(t,o)=>{const r=Object.entries(Rr()(t,"kind")).map(([l,i])=>({name:l,links:i})),[s,a]=Le()(r,"name");return{collectionTypeSectionLinks:Ns(s?.links||[],"collectionTypes",o),singleTypeSectionLinks:Ns(a?.links??[],"singleTypes")}},js=(t,o)=>o.map(({permissions:r})=>(0,y.qX)(t,r)),sm=async({models:t,userPermissions:o,toggleNotification:r})=>{const{get:s}=(0,y.tg)();try{const{data:{data:a}}=await s((0,h.IF)("content-types-settings")),{collectionTypeSectionLinks:l,singleTypeSectionLinks:i}=rm(t,a),c=await Promise.all(js(o,l)),g=l.filter((f,m)=>c[m]),u=await Promise.all(js(o,i)),p=i.filter((f,m)=>u[m]);return{authorizedCollectionTypeLinks:g,authorizedSingleTypeLinks:p}}catch(a){return console.error(a),r({type:"warning",message:{id:"notification.error"}}),{authorizedCollectionTypeLinks:[],authorizedSingleTypeLinks:[]}}},am=()=>{const t=(0,J.I0)(),o=(0,y.lm)(),r=(0,J.v9)((0,Ct.Yg)()),s=(0,e.useRef)(),{allPermissions:a}=(0,y.vn)(),{runHookWaterfall:l}=(0,y.j1)(),c=Qe.Z.CancelToken.source(),{notifyStatus:g}=(0,ko.G)(),{formatMessage:u}=(0,V.Z)(),{get:p}=(0,y.kY)(),f=async()=>{t(tm());try{const{data:{data:{components:m,contentTypes:b,fieldSizes:E}}}=await p((0,h.IF)("init"),{cancelToken:c.token});g(u({id:(0,h.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const v=await sm({models:b,userPermissions:a,toggleNotification:o}),{ctLinks:k}=l(je.LK,{ctLinks:v.authorizedCollectionTypeLinks,models:b}),{stLinks:R}=l(je.dV,{stLinks:v.authorizedSingleTypeLinks,models:b}),T=om({authorizedCollectionTypeLinks:k,authorizedSingleTypeLinks:R,contentTypeSchemas:b,components:m,fieldSizes:E});t(T)}catch(m){if(Qe.Z.isCancel(m))return;console.error(m),o({type:"warning",message:{id:"notification.error"}})}};return s.current=f,(0,e.useEffect)(()=>(s.current(),()=>{c.cancel("Operation canceled by the user."),t(nm())}),[t,o]),{...r,refetchData:s.current}},Nt=d(25708),im=d(16899);const lm=(0,j.ZP)(F.k)`
1106
+ `,Fs=({attributes:t,fieldForm:o,fieldToEdit:r,onCloseModal:s,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:c}=(0,V.Z)(),g=t[r].relationType;let u=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(g)&&(u=!0),e.createElement(Ur.P,{onClose:s,labelledBy:"title"},e.createElement("form",{onSubmit:l},e.createElement(Vr.x,null,e.createElement(wu,null,e.createElement(Yr,{type:i}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:At()(r)})))),e.createElement(Hr.f,null,e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{s:12,col:6},e.createElement(Dn.o,{id:"label-input",label:c({id:(0,h.OB)("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:p=>a(p),value:o.label,hint:c({id:(0,h.OB)("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),u&&e.createElement(ge.P,{s:12,col:6},e.createElement(Zt.s,{"data-testid":"Enable sort on this field",checked:o.sortable,label:c({id:(0,h.OB)("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:p=>a({target:{name:"sortable",value:p.target.checked}}),onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),e.createElement(Qr.m,{startActions:e.createElement(ce.z,{onClick:s,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(ce.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Fs.propTypes={attributes:n().objectOf(n().shape({relationType:n().string})).isRequired,fieldForm:n().shape({label:n().string,sortable:n().bool}).isRequired,fieldToEdit:n().string.isRequired,onChangeEditLabel:n().func.isRequired,onCloseModal:n().func.isRequired,onSubmit:n().func.isRequired,type:n().string.isRequired};var xu=Fs,Fu=(t,o)=>({...t,initialData:o,modifiedData:o});const Bo={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}};var Lu=(t=Bo,o)=>(0,oo.ZP)(t,r=>{const s=["modifiedData","layouts","list"];switch(o.type){case"ADD_FIELD":{const a=x()(t,s,[]);se()(r,s,[...a,o.item]);break}case"MOVE_FIELD":{const a=x()(t,s,[]),{originalIndex:l,atIndex:i}=o;se()(r,s,(0,h.W3)(a,l,i));break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys.split(".")],o.value);break}case"ON_CHANGE_FIELD_METAS":{se()(r,["fieldForm",o.name],o.value);break}case"REMOVE_FIELD":{const a=x()(t,s,[]);se()(r,s,a.filter((l,i)=>o.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=o;r.fieldToEdit=a,r.fieldForm.label=x()(r,["modifiedData","metadatas",a,"list","label"],""),r.fieldForm.sortable=x()(r,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{r.fieldForm={},r.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",t.fieldToEdit,"list"];se()(r,[...a,"label"],t.fieldForm.label),se()(r,[...a,"sortable"],t.fieldForm.sortable);break}default:return r}});const Su=["media","richtext","dynamiczone","relation","component","json"],Ls=({layout:t,slug:o})=>{const{put:r}=(0,y.kY)(),{formatMessage:s}=(0,V.Z)(),{trackUsage:a}=(0,y.rS)(),l=(0,pe.fi)(),i=(0,y.lm)(),{refetchData:c}=(0,e.useContext)(Ze),[g,u]=(0,e.useState)(!1),p=()=>u(w=>!w),[f,m]=(0,e.useReducer)(Lu,Bo,()=>Fu(Bo,t)),{fieldToEdit:b,fieldForm:E,initialData:v,modifiedData:k}=f,R=!qe()(E),{attributes:T}=t,O=k.layouts.list,D=()=>{const{settings:{pageSize:w,defaultSortBy:N,defaultSortOrder:Y},kind:P,uid:Z}=v,oe=`${N}:${Y}`,re=`${(0,_t.stringify)({page:1,pageSize:w,sort:oe},{encode:!1})}${l?`&${l}`:""}`;return`/content-manager/${P}/${Z}?${re}`},C=({target:{name:w,value:N}})=>{m({type:"ON_CHANGE",keys:w,value:w==="settings.pageSize"?parseInt(N,10):N})},M=async()=>{const w=In()(k,["layouts","settings","metadatas"]);G.mutate(w)},I=w=>{m({type:"ADD_FIELD",item:w})},S=(w,N)=>{w.stopPropagation(),O.length===1?i({type:"info",message:{id:(0,h.OB)("notification.info.minimumFields")}}):m({type:"REMOVE_FIELD",index:N})},B=w=>{w.preventDefault(),p(),a("willSaveContentTypeLayout")},$=w=>{m({type:"SET_FIELD_TO_EDIT",fieldToEdit:w})},K=()=>{m({type:"UNSET_FIELD_TO_EDIT"})},W=w=>{w.preventDefault(),m({type:"SUBMIT_FIELD_FORM"}),K()},G=(0,Xe.useMutation)(w=>r(`/content-manager/content-types/${o}/configuration`,w),{onSuccess(){a("didEditListSettings"),c()},onError(){i({type:"warning",message:{id:"notification.error"}})}}),{isLoading:z}=G,X=({target:{name:w,value:N}})=>{m({type:"ON_CHANGE_FIELD_METAS",name:w,value:N})},q=Object.entries(T).filter(([w,N])=>(0,h.ko)(N)&&!O.includes(w)).map(([w])=>w).sort(),U=Object.entries(T).filter(([,w])=>!Su.includes(w.type)).map(([w])=>w),L=(w,N)=>{m({type:"MOVE_FIELD",originalIndex:w,atIndex:N})};return e.createElement(Ae.A,null,e.createElement(De.o,{"aria-busy":z},e.createElement("form",{onSubmit:B},e.createElement(he.T,{navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),to:D,id:"go-back"},s({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(ce.z,{size:"S",startIcon:e.createElement(st.Z,null),disabled:Ce()(k,v),type:"submit"},s({id:"global.save",defaultMessage:"Save"})),subtitle:s({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:s({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:At()(k.info.displayName)})}),e.createElement(We.D,null,e.createElement(A.x,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(vu,{modifiedData:k,onChange:C,sortOptions:U}),e.createElement(A.x,{paddingTop:6,paddingBottom:6},e.createElement(Sr.i,null)),e.createElement(Ou,{listRemainingFields:q,displayedFields:O,onAddField:I,onClickEditField:$,onMoveField:L,onRemoveField:S,metadatas:k.metadatas}))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(st.Z,null),isConfirmButtonLoading:z,isOpen:g,onToggleDialog:p,onConfirm:M,variantRightButton:"success-light"})),R&&e.createElement(xu,{attributes:T,fieldForm:E,fieldToEdit:b,onChangeEditLabel:X,onCloseModal:K,onSubmit:W,type:x()(T,[b,"type"],"text")})))};Ls.propTypes={layout:n().shape({uid:n().string.isRequired,settings:n().shape({bulkable:n().bool,defaultSortBy:n().string,defaultSortOrder:n().string,filterable:n().bool,pageSize:n().number,searchable:n().bool}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().objectOf(n().shape({type:n().string})).isRequired}).isRequired,slug:n().string.isRequired};var Au=(0,e.memo)(Ls),$u=()=>e.createElement(A.x,{padding:8},e.createElement(y.Hn,null));const Ss=we.Z.contentManager,As=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=(0,pe.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let p={},f={};return s.contentType&&(p=(0,h.du)(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((m,b)=>(m[b]=(0,h.du)(s.components[b]),m),{})),{rawContentTypeLayout:p,rawComponentsLayouts:f}},[s]);if((s?.contentType?.uid??null)!==t||r)return e.createElement(y.dO,null);const g=({location:{state:p},history:{goBack:f},match:{params:{id:m,origin:b}}},E)=>e.createElement(E,{slug:t,layout:s,state:p,goBack:f,id:m,origin:b}),u=[{path:"create/clone/:origin",comp:rn},{path:"create",comp:rn},{path:":id",comp:rn},{path:"",comp:Eu}].map(({path:p,comp:f})=>e.createElement(te.AW,{key:p,path:`${o}/${p}`,render:m=>g(m,f)}));return e.createElement(_e.ErrorBoundary,{FallbackComponent:$u},e.createElement(Be.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${o}/configurations/list`},e.createElement(y.O4,{permissions:Ss.collectionTypesConfigurations},e.createElement(Au,{layout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:Ss.collectionTypesConfigurations},e.createElement(Mo,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),u)))};As.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Zu=(0,e.memo)(As),$s=d(57678);const Bu=we.Z.contentManager,qu=()=>{const[{isLoading:t,data:o},r]=(0,e.useReducer)($s.Z,$s.q),s=(0,e.useMemo)(Ct.Vo,[]),{schemas:a}=(0,J.v9)(c=>s(c),J.wU),{uid:l}=(0,te.UO)(),{get:i}=(0,y.kY)();return(0,e.useEffect)(()=>{const g=Qe.default.CancelToken.source();return(async p=>{try{r(Xt());const{data:{data:f}}=await i(`/content-manager/components/${l}/configuration`,{cancelToken:p.token});r(_n((0,h.w8)(f,a,"component")))}catch(f){if(Qe.default.isCancel(f))return;console.error(f)}})(g),()=>{g.cancel("Operation canceled by the user.")}},[l,a,i]),t?e.createElement(y.dO,null):e.createElement(y.O4,{permissions:Bu.componentsConfigurations},e.createElement(Mo,{components:o.components,mainLayout:o.component,slug:l}))};var Nu=(0,e.memo)(qu),ju=d(9695),Wu=d(54725),zu=()=>{const{formatMessage:t}=(0,V.Z)();return(0,y.go)(),e.createElement(De.o,null,e.createElement(he.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(We.D,null,e.createElement(ju.x,{action:e.createElement(y.Qj,{variant:"secondary",startIcon:e.createElement(St.Z,null),to:"/plugins/content-type-builder/content-types/create-content-type"},t({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:t({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:e.createElement(Wu.Z,{width:"10rem"}),shadow:"tableShadow"})))},Uu=()=>{const{formatMessage:t}=(0,V.Z)();return(0,y.go)(),e.createElement(De.o,null,e.createElement(he.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(We.D,null,e.createElement(y.ZF,null)))};const Vu=we.Z.contentManager,Zs=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=(0,pe.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let c={},g={};return s.contentType&&(g=(0,h.du)(s.contentType)),s.components&&(c=Object.keys(s.components).reduce((u,p)=>(u[p]=(0,h.du)(s.components[p]),u),{})),{rawContentTypeLayout:g,rawComponentsLayouts:c}},[s]);return r?e.createElement(y.dO,null):e.createElement(Be.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:Vu.singleTypesConfigurations},e.createElement(Mo,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:o,render:({location:{state:c},history:{goBack:g}})=>e.createElement(rn,{layout:s,slug:t,isSingleType:!0,state:c,goBack:g})})))};Zs.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Hu=(0,e.memo)(Zs),Qu=d(90700),Gu=d(78090),Ku=d(77013),Yu=d(79318),Xu=d(66618),Ju=()=>{const[t,o]=(0,e.useState)(""),{formatMessage:r,locale:s}=(0,V.Z)(),a=(0,e.useMemo)(Ct.KQ,[]),{collectionTypeLinks:l,singleTypeLinks:i}=(0,J.v9)(a,J.wU),{startsWith:c}=(0,y.L0)(s,{sensitivity:"base"}),g=(0,y.Xe)(s,{sensitivity:"base"}),u=(0,e.useMemo)(()=>[{id:"collectionTypes",title:{id:(0,ve.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:l},{id:"singleTypes",title:{id:(0,ve.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:i}].map(b=>({...b,links:b.links.filter(E=>c(E.title,t)).sort((E,v)=>g.compare(E.title,v.title)).map(E=>({...E,title:r({id:E.title,defaultMessage:E.title})}))})),[l,t,i,c,r,g]),p=()=>{o("")},f=({target:{value:b}})=>{o(b)},m=r({id:(0,ve.Z)("header.name"),defaultMessage:"Content"});return e.createElement(Qu.m,{ariaLabel:m},e.createElement(Gu.p,{label:m,searchable:!0,value:t,onChange:f,onClear:p,searchLabel:r({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),e.createElement(Ku.Z,null,u.map(b=>{const E=r({id:b.title.id,defaultMessage:b.title.defaultMessage},b.title.values);return e.createElement(Yu.D,{key:b.id,label:E,badgeLabel:b.links.length.toString()},b.links.map(v=>{const k=v.search?`?${v.search}`:"";return e.createElement(Xu.E,{as:vt.OL,key:v.uid,to:`${v.to}${k}`},v.title)}))})))},qo=d(92886);const _u=()=>({type:qo.fn}),em=()=>({type:qo.sZ}),tm=({authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,contentTypeSchemas:r,components:s,fieldSizes:a})=>({type:qo.IX,data:{authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,components:s,contentTypeSchemas:r,fieldSizes:a}}),Bs=(t,o,r=[])=>t.filter(s=>s.isDisplayed).map(s=>{const a=[{action:"plugin::content-manager.explorer.create",subject:s.uid},{action:"plugin::content-manager.explorer.read",subject:s.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:s.uid}],i=o==="collectionTypes"?a:l,c=r.find(({uid:u})=>u===s.uid);let g=null;if(c){const u={page:1,pageSize:c.settings.pageSize,sort:`${c.settings.defaultSortBy}:${c.settings.defaultSortOrder}`};g=(0,_t.stringify)(u,{encode:!1})}return{permissions:i,search:g,kind:s.kind,title:s.info.displayName,to:`/content-manager/${s.kind}/${s.uid}`,uid:s.uid,name:s.uid,isDisplayed:s.isDisplayed}});var nm=(t,o)=>{const r=Object.entries(vr()(t,"kind")).map(([l,i])=>({name:l,links:i})),[s,a]=Le()(r,"name");return{collectionTypeSectionLinks:Bs(s?.links||[],"collectionTypes",o),singleTypeSectionLinks:Bs(a?.links??[],"singleTypes")}},qs=(t,o)=>o.map(({permissions:r})=>(0,y.qX)(t,r)),om=async({models:t,userPermissions:o,toggleNotification:r})=>{const{get:s}=(0,y.tg)();try{const{data:{data:a}}=await s((0,h.IF)("content-types-settings")),{collectionTypeSectionLinks:l,singleTypeSectionLinks:i}=nm(t,a),c=await Promise.all(qs(o,l)),g=l.filter((f,m)=>c[m]),u=await Promise.all(qs(o,i)),p=i.filter((f,m)=>u[m]);return{authorizedCollectionTypeLinks:g,authorizedSingleTypeLinks:p}}catch(a){return console.error(a),r({type:"warning",message:{id:"notification.error"}}),{authorizedCollectionTypeLinks:[],authorizedSingleTypeLinks:[]}}},rm=()=>{const t=(0,J.I0)(),o=(0,y.lm)(),r=(0,J.v9)((0,Ct.Yg)()),s=(0,e.useRef)(),{allPermissions:a}=(0,y.vn)(),{runHookWaterfall:l}=(0,y.j1)(),c=Qe.default.CancelToken.source(),{notifyStatus:g}=(0,Do.G)(),{formatMessage:u}=(0,V.Z)(),{get:p}=(0,y.kY)(),f=async()=>{t(_u());try{const{data:{data:{components:m,contentTypes:b,fieldSizes:E}}}=await p("/content-manager/init",{cancelToken:c.token});g(u({id:(0,h.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const v=await om({models:b,userPermissions:a,toggleNotification:o}),{ctLinks:k}=l(je.LK,{ctLinks:v.authorizedCollectionTypeLinks,models:b}),{stLinks:R}=l(je.dV,{stLinks:v.authorizedSingleTypeLinks,models:b}),T=tm({authorizedCollectionTypeLinks:k,authorizedSingleTypeLinks:R,contentTypeSchemas:b,components:m,fieldSizes:E});t(T)}catch(m){if(Qe.default.isCancel(m))return;console.error(m),o({type:"warning",message:{id:"notification.error"}})}};return s.current=f,(0,e.useEffect)(()=>(s.current(),()=>{c.cancel("Operation canceled by the user."),t(em())}),[t,o]),{...r,refetchData:s.current}},qt=d(25708),sm=d(16899);const am=(0,j.ZP)(F.k)`
1107
1107
  border-radius: 50%;
1108
1108
 
1109
1109
  svg {
@@ -1113,11 +1113,11 @@ ${t}
1113
1113
  fill: ${({theme:t})=>t.colors.neutral600};
1114
1114
  }
1115
1115
  }
1116
- `,cm=j.ZP.button`
1116
+ `,im=j.ZP.button`
1117
1117
  border: none;
1118
1118
  background: transparent;
1119
1119
  display: block;
1120
1120
  width: 100%;
1121
1121
  text-align: unset;
1122
1122
  padding: 0;
1123
- `;function Ws({displayedValue:t}){return e.createElement(F.k,{background:"neutral0",borderColor:"neutral200",justifyContent:"space-between",gap:3,padding:3,width:(0,y.Q1)(300)},e.createElement(cm,{type:"button"},e.createElement(F.k,{gap:6},e.createElement(lm,{alignItems:"center",justifyContent:"center",background:"neutral200",height:(0,y.Q1)(32),width:(0,y.Q1)(32)},e.createElement(im.Z,null)),e.createElement(F.k,{maxWidth:(0,y.Q1)(150)},e.createElement(Q.Z,{textColor:"neutral700",ellipsis:!0},t)))),e.createElement(F.k,{gap:2},e.createElement(be.h,{noBorder:!0},e.createElement(Ye.Z,null)),e.createElement(be.h,{noBorder:!0},e.createElement(nt.Z,null))))}Ws.propTypes={displayedValue:n().string.isRequired};const zs=({status:t,displayedValue:o,width:r})=>{const{formatMessage:s}=(0,V.Z)(),a={[ct.DRAFT]:s({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ct.PUBLISHED]:s({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},l=t===ct.DRAFT?"secondary":"success";return e.createElement(A.x,{style:{width:r}},e.createElement(F.k,{paddingTop:2,paddingBottom:2,paddingLeft:2,paddingRight:4,hasRadius:!0,borderSize:1,background:"neutral0",borderColor:"neutral200",justifyContent:"space-between"},e.createElement(pr,{gap:1},e.createElement(be.h,{noBorder:!0},e.createElement(nt.Z,null)),e.createElement(gr,{maxWidth:"100%",justifyContent:"space-between"},e.createElement(A.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(hr,null,e.createElement(Q.Z,{textColor:"primary600",ellipsis:!0},o))),t&&e.createElement(On.q,{variant:l,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${l}700`},a[t])))),e.createElement(A.x,{paddingLeft:4},e.createElement(yr,{type:"button"},e.createElement(ur.J,{width:"12px",as:Ht.Z})))))};zs.propTypes={status:n().string.isRequired,displayedValue:n().string.isRequired,width:n().number.isRequired};const dm=Oe.Z.contentManager;function um({type:t,item:o}){if([Nt.Z.EDIT_FIELD,Nt.Z.FIELD].includes(t))return e.createElement(qt,{labelField:o.labelField});const[r]=t.split("_");switch(r){case Nt.Z.COMPONENT:case Nt.Z.DYNAMIC_ZONE:return e.createElement(Ws,{displayedValue:o.displayedValue});case Nt.Z.RELATION:return e.createElement(zs,{displayedValue:o.displayedValue,status:o.status,width:o.width});default:return null}}const Us=()=>{const t=(0,te.$B)("/content-manager/:kind/:uid"),{status:o,collectionTypeLinks:r,singleTypeLinks:s,models:a,refetchData:l}=am(),i=Le()([...r,...s],m=>m.title.toLowerCase()),{pathname:c}=(0,te.TH)(),{formatMessage:g}=(0,V.Z)(),{startSection:u}=(0,y.c1)(),p=(0,e.useRef)(u);if((0,e.useEffect)(()=>{p.current&&p.current("contentManager")},[]),o==="loading")return e.createElement(Te.o,{"aria-busy":"true"},e.createElement(he.T,{title:g({id:(0,ve.Z)("header.name"),defaultMessage:"Content"})}),e.createElement(y.dO,null));const f=a.filter(({isDisplayed:m})=>m);return i.length===0&&f.length>0&&c!=="/content-manager/403"?e.createElement(te.l_,{to:"/content-manager/403"}):f.length===0&&c!=="/content-manager/no-content-types"?e.createElement(te.l_,{to:"/content-manager/no-content-types"}):!t&&i.length>0?e.createElement(te.l_,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):e.createElement(Ae.A,{sideNav:e.createElement(em,null)},e.createElement($e.r,{renderItem:um}),e.createElement(Ze.Provider,{value:{refetchData:l}},e.createElement(te.rs,null,e.createElement(te.AW,{path:"/content-manager/components/:uid/configurations/edit"},e.createElement(y.O4,{permissions:dm.componentsConfigurations},e.createElement(Wu,null))),e.createElement(te.AW,{path:"/content-manager/collectionType/:slug",component:qu}),e.createElement(te.AW,{path:"/content-manager/singleType/:slug",component:Gu}),e.createElement(te.AW,{path:"/content-manager/403"},e.createElement(Hu,null)),e.createElement(te.AW,{path:"/content-manager/no-content-types"},e.createElement(Vu,null)),e.createElement(te.AW,{path:"",component:y.Hn}))))};function mm(){const{formatMessage:t}=(0,V.Z)();return e.createElement(e.Fragment,null,e.createElement(Me.q,{title:t({id:(0,ve.Z)("plugin.name"),defaultMessage:"Content Manager"})}),e.createElement(Us,null))}},92914:function(pt,Pe,d){"use strict";d.d(Pe,{Z:function(){return h}});var e=d(32735),Me=d(60216),te=d.n(Me),y=d(67879),Te=d(24989),he=d(87933),Ae=d(49372),V=d(72850),it=d(9026),Le=d(51375);const Oe=60*1e3,ve=Oe*60,$e=ve*24,we=$e*30,Ze=$e*365;var ye=J=>J<Oe?{unit:"second",value:-Math.round(J/1e3)}:J<ve?{unit:"minute",value:-Math.round(J/Oe)}:J<$e?{unit:"hour",value:-Math.round(J/ve)}:J<we?{unit:"day",value:-Math.round(J/$e)}:J<Ze?{unit:"month",value:-Math.round(J/we)}:{unit:"year",value:-Math.round(J/Ze)},n=d(8997);const gt=()=>{const{formatMessage:J}=(0,y.Z)();return e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Ae.Z,{variant:"sigma",textColor:"neutral600",id:"additional-information"},J({id:(0,Le.OB)("containers.Edit.information"),defaultMessage:"Information"})),e.createElement(V.x,null,e.createElement(it.i,null)))},Be=({label:J,value:je})=>e.createElement(he.k,{justifyContent:"space-between"},e.createElement(Ae.Z,{as:"dt",fontWeight:"bold",textColor:"neutral800",variant:"pi"},J),e.createElement(Ae.Z,{as:"dd",variant:"pi",textColor:"neutral600"},je));Be.propTypes={label:te().string.isRequired,value:te().string.isRequired};const jt=()=>{const{formatMessage:J,formatRelativeTime:je}=(0,y.Z)(),{initialData:et,isCreatingEntry:Dt}=(0,Te.Wq)(),kt=(0,e.useRef)(Date.now()),ft=(We,ke)=>{const{firstname:ge,lastname:F,username:A}=et[ke]??{},Ve=ge??"",Ke=F??"",tt=A??(0,n.Pp)(Ve,Ke),Pt=(et[We]?new Date(et[We]).getTime():Date.now())-kt.current,{unit:Ot,value:Wt}=ye(-Pt);return{at:je(Wt,Ot,{numeric:"auto"}),by:Dt?"-":tt}},lt=ft("updatedAt","updatedBy"),xe=ft("createdAt","createdBy");return e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.created"),defaultMessage:"Created"}),value:xe.at}),e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:xe.by})),e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"}),value:lt.at}),e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:lt.by})))},pe=({children:J})=>e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:4},J);pe.propTypes={children:te().oneOfType([te().arrayOf(te().node),te().node]).isRequired};var h={Root:pe,Title:gt,Body:jt}},73710:function(pt,Pe,d){"use strict";d.d(Pe,{Z:function(){return y}});var e=d(32735),Me=d(92914);function te(){return e.createElement(Me.Z.Root,null,e.createElement(Me.Z.Title,null),e.createElement(Me.Z.Body,null))}var y=te},75536:function(pt,Pe,d){"use strict";var e=d(32735);const Me=(te,y)=>{const[Te,he]=(0,e.useState)(te);return(0,e.useEffect)(()=>{const Ae=setTimeout(()=>{he(te)},y);return()=>{clearTimeout(Ae)}},[te,y]),Te};Pe.Z=Me},57047:function(pt,Pe,d){"use strict";d.d(Pe,{Z:function(){return we}});var e=d(32735),Me=d(67879),te=d(49372),y=d(60216),Te=d.n(y),he=d(87933),Ae=d(72850),V=d(24989),it=d(54504);function Le({color:Ze,name:_e}){const{themeColorName:ye}=(0,it.k)(Ze);return e.createElement(he.k,{alignItems:"center",gap:2,maxWidth:(0,V.Q1)(300)},e.createElement(Ae.x,{height:2,background:Ze,borderColor:ye==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),e.createElement(te.Z,{fontWeight:"regular",textColor:"neutral700",ellipsis:!0},_e))}Le.propTypes={color:Te().string.isRequired,name:Te().string.isRequired};var Oe=Le,ve=d(47510),$e=d(61937),we=Ze=>{const{formatMessage:_e}=(0,Me.Z)();return(window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS)&&Ze.contentType.options?.reviewWorkflows)??!1?{key:"__strapi_reviewWorkflows_stage_temp_key__",name:"strapi_reviewWorkflows_stage",fieldSchema:{type:"relation"},metadatas:{label:_e({id:(0,ve.Z)("containers.ListPage.table-headers.reviewWorkflows.stage"),defaultMessage:"Review stage"}),searchable:!1,sortable:!0,mainField:{name:"name",schema:{type:"string"}}},cellFormatter({strapi_reviewWorkflows_stage:n}){if(!n)return e.createElement(te.Z,{textColor:"neutral800"},"-");const{color:gt,name:Be}=n;return e.createElement(Oe,{color:gt??$e.FT,name:Be})}}:null}},28243:function(pt,Pe,d){"use strict";d.d(Pe,{Z:function(){return _e}});var e=d(32735),Me=d(24989),te=d(87107),y=d(87933),Te=d(28847),he=d(97405),Ae=d(47851),V=d(67879),it=d(20108),Le=d(67350),Oe=d(28315),ve=d(8445),$e=d(92914);const we="strapi_reviewWorkflows_stage";function Ze(){const{initialData:ye,isCreatingEntry:n,layout:{uid:gt},isSingleType:Be,onChange:jt}=(0,Me.Wq)(),{put:pe}=(0,Me.kY)(),h=ye?.[we]??null,J=Object.prototype.hasOwnProperty.call(ye,we),{formatMessage:je}=(0,V.Z)(),{formatAPIError:et}=(0,Me.So)(),Dt=(0,Me.lm)(),{workflows:{data:kt,isLoading:ft}={}}=(0,Le.n)(),lt=kt?.[0]??null,{error:xe,isLoading:We,mutateAsync:ke}=(0,it.useMutation)(async({entityId:Ke,stageId:tt,uid:It})=>{const Pt=Be?"single-types":"collection-types",{data:{data:Ot}}=await pe(`/admin/content-manager/${Pt}/${It}/${Ke}/stage`,{data:{id:tt}});return jt({target:{name:we,value:Ot[we]}},!0),Ot},{onSuccess(){Dt({type:"success",message:{id:"content-manager.reviewWorkflows.stage.notification.saved",defaultMessage:"Success: Review stage updated"}})}}),ge=h===null&&!ft&&!n&&je({id:"content-manager.reviewWorkflows.stage.select.placeholder",defaultMessage:"Select a stage"}),A=xe&&et(xe)||ge||null,Ve=async({value:Ke})=>{try{await ke({entityId:ye.id,stageId:Ke,uid:gt})}catch{}};return e.createElement($e.Z.Root,null,e.createElement($e.Z.Title,null),J&&!n&&e.createElement(te.g,{error:A,name:we,id:we},e.createElement(y.k,{direction:"column",gap:2,alignItems:"stretch"},e.createElement(Te.Q,null,je({id:"content-manager.reviewWorkflows.stage.label",defaultMessage:"Review stage"})),e.createElement(Me.JV,{components:{LoadingIndicator:()=>e.createElement(he.a,{small:!0}),Option:Oe.K,SingleValue:ve.R},error:A,inputId:we,isLoading:We,isSearchable:!1,isClearable:!1,name:we,onChange:Ve,options:lt?lt.stages.map(({id:Ke,color:tt,name:It})=>({value:Ke,label:It,color:tt})):[],value:{value:h?.id,label:h?.name,color:h?.color}}),e.createElement(Ae.c,null))),e.createElement($e.Z.Body,null))}var _e=Ze},57544:function(){},59599:function(){},42310:function(){},33842:function(){},85695:function(){}}]);
1123
+ `;function Ns({displayedValue:t}){return e.createElement(F.k,{background:"neutral0",borderColor:"neutral200",justifyContent:"space-between",gap:3,padding:3,width:(0,y.Q1)(300)},e.createElement(im,{type:"button"},e.createElement(F.k,{gap:6},e.createElement(am,{alignItems:"center",justifyContent:"center",background:"neutral200",height:(0,y.Q1)(32),width:(0,y.Q1)(32)},e.createElement(sm.Z,null)),e.createElement(F.k,{maxWidth:(0,y.Q1)(150)},e.createElement(Q.Z,{textColor:"neutral700",ellipsis:!0},t)))),e.createElement(F.k,{gap:2},e.createElement(be.h,{noBorder:!0},e.createElement(Ye.Z,null)),e.createElement(be.h,{noBorder:!0},e.createElement(nt.Z,null))))}Ns.propTypes={displayedValue:n().string.isRequired};const js=({status:t,displayedValue:o,width:r})=>{const{formatMessage:s}=(0,V.Z)(),a={[ct.DRAFT]:s({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ct.PUBLISHED]:s({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},l=t===ct.DRAFT?"secondary":"success";return e.createElement(A.x,{style:{width:r}},e.createElement(F.k,{paddingTop:2,paddingBottom:2,paddingLeft:2,paddingRight:4,hasRadius:!0,borderSize:1,background:"neutral0",borderColor:"neutral200",justifyContent:"space-between"},e.createElement(ur,{gap:1},e.createElement(be.h,{noBorder:!0},e.createElement(nt.Z,null)),e.createElement(mr,{maxWidth:"100%",justifyContent:"space-between"},e.createElement(A.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(gr,null,e.createElement(Q.Z,{textColor:"primary600",ellipsis:!0},o))),t&&e.createElement(Pn.q,{variant:l,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${l}700`},a[t])))),e.createElement(A.x,{paddingLeft:4},e.createElement(fr,{type:"button"},e.createElement(cr.J,{width:"12px",as:Vt.Z})))))};js.propTypes={status:n().string.isRequired,displayedValue:n().string.isRequired,width:n().number.isRequired};const lm=we.Z.contentManager;function cm({type:t,item:o}){if([qt.Z.EDIT_FIELD,qt.Z.FIELD].includes(t))return e.createElement(Bt,{labelField:o.labelField});const[r]=t.split("_");switch(r){case qt.Z.COMPONENT:case qt.Z.DYNAMIC_ZONE:return e.createElement(Ns,{displayedValue:o.displayedValue});case qt.Z.RELATION:return e.createElement(js,{displayedValue:o.displayedValue,status:o.status,width:o.width});default:return null}}const Ws=()=>{const t=(0,te.$B)("/content-manager/:kind/:uid"),{status:o,collectionTypeLinks:r,singleTypeLinks:s,models:a,refetchData:l}=rm(),i=Le()([...r,...s],m=>m.title.toLowerCase()),{pathname:c}=(0,te.TH)(),{formatMessage:g}=(0,V.Z)(),{startSection:u}=(0,y.c1)(),p=(0,e.useRef)(u);if((0,e.useEffect)(()=>{p.current&&p.current("contentManager")},[]),o==="loading")return e.createElement(De.o,{"aria-busy":"true"},e.createElement(he.T,{title:g({id:(0,ve.Z)("header.name"),defaultMessage:"Content"})}),e.createElement(y.dO,null));const f=a.filter(({isDisplayed:m})=>m);return i.length===0&&f.length>0&&c!=="/content-manager/403"?e.createElement(te.l_,{to:"/content-manager/403"}):f.length===0&&c!=="/content-manager/no-content-types"?e.createElement(te.l_,{to:"/content-manager/no-content-types"}):!t&&i.length>0?e.createElement(te.l_,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):e.createElement(Ae.A,{sideNav:e.createElement(Ju,null)},e.createElement($e.r,{renderItem:cm}),e.createElement(Ze.Provider,{value:{refetchData:l}},e.createElement(te.rs,null,e.createElement(te.AW,{path:"/content-manager/components/:uid/configurations/edit"},e.createElement(y.O4,{permissions:lm.componentsConfigurations},e.createElement(Nu,null))),e.createElement(te.AW,{path:"/content-manager/collectionType/:slug",component:Zu}),e.createElement(te.AW,{path:"/content-manager/singleType/:slug",component:Hu}),e.createElement(te.AW,{path:"/content-manager/403"},e.createElement(Uu,null)),e.createElement(te.AW,{path:"/content-manager/no-content-types"},e.createElement(zu,null)),e.createElement(te.AW,{path:"",component:y.Hn}))))};function dm(){const{formatMessage:t}=(0,V.Z)();return e.createElement(e.Fragment,null,e.createElement(Te.q,{title:t({id:(0,ve.Z)("plugin.name"),defaultMessage:"Content Manager"})}),e.createElement(Ws,null))}},92914:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return h}});var e=d(32735),Te=d(60216),te=d.n(Te),y=d(67879),De=d(24989),he=d(87933),Ae=d(49372),V=d(72850),it=d(9026),Le=d(51375);const we=60*1e3,ve=we*60,$e=ve*24,xe=$e*30,Ze=$e*365;var ye=J=>J<we?{unit:"second",value:-Math.round(J/1e3)}:J<ve?{unit:"minute",value:-Math.round(J/we)}:J<$e?{unit:"hour",value:-Math.round(J/ve)}:J<xe?{unit:"day",value:-Math.round(J/$e)}:J<Ze?{unit:"month",value:-Math.round(J/xe)}:{unit:"year",value:-Math.round(J/Ze)},n=d(8997);const gt=()=>{const{formatMessage:J}=(0,y.Z)();return e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Ae.Z,{variant:"sigma",textColor:"neutral600",id:"additional-information"},J({id:(0,Le.OB)("containers.Edit.information"),defaultMessage:"Information"})),e.createElement(V.x,null,e.createElement(it.i,null)))},Be=({label:J,value:je})=>e.createElement(he.k,{justifyContent:"space-between"},e.createElement(Ae.Z,{as:"dt",fontWeight:"bold",textColor:"neutral800",variant:"pi"},J),e.createElement(Ae.Z,{as:"dd",variant:"pi",textColor:"neutral600"},je));Be.propTypes={label:te().string.isRequired,value:te().string.isRequired};const Nt=()=>{const{formatMessage:J,formatRelativeTime:je}=(0,y.Z)(),{initialData:et,isCreatingEntry:Dt}=(0,De.Wq)(),kt=(0,e.useRef)(Date.now()),ft=(We,Ie)=>{const{firstname:ge,lastname:F,username:A}=et[Ie]??{},Ve=ge??"",Ke=F??"",tt=A??(0,n.Pp)(Ve,Ke),Pt=(et[We]?new Date(et[We]).getTime():Date.now())-kt.current,{unit:Ot,value:jt}=ye(-Pt);return{at:je(jt,Ot,{numeric:"auto"}),by:Dt?"-":tt}},lt=ft("updatedAt","updatedBy"),Ce=ft("createdAt","createdBy");return e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.created"),defaultMessage:"Created"}),value:Ce.at}),e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:Ce.by})),e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"}),value:lt.at}),e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:lt.by})))},pe=({children:J})=>e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:4},J);pe.propTypes={children:te().oneOfType([te().arrayOf(te().node),te().node]).isRequired};var h={Root:pe,Title:gt,Body:Nt}},73710:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return y}});var e=d(32735),Te=d(92914);function te(){return e.createElement(Te.Z.Root,null,e.createElement(Te.Z.Title,null),e.createElement(Te.Z.Body,null))}var y=te},75536:function(pt,Oe,d){"use strict";var e=d(32735);const Te=(te,y)=>{const[De,he]=(0,e.useState)(te);return(0,e.useEffect)(()=>{const Ae=setTimeout(()=>{he(te)},y);return()=>{clearTimeout(Ae)}},[te,y]),De};Oe.Z=Te},57047:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return xe}});var e=d(32735),Te=d(67879),te=d(49372),y=d(60216),De=d.n(y),he=d(87933),Ae=d(72850),V=d(24989),it=d(54504);function Le({color:Ze,name:_e}){const{themeColorName:ye}=(0,it.k)(Ze);return e.createElement(he.k,{alignItems:"center",gap:2,maxWidth:(0,V.Q1)(300)},e.createElement(Ae.x,{height:2,background:Ze,borderColor:ye==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),e.createElement(te.Z,{fontWeight:"regular",textColor:"neutral700",ellipsis:!0},_e))}Le.propTypes={color:De().string.isRequired,name:De().string.isRequired};var we=Le,ve=d(47510),$e=d(61937),xe=Ze=>{const{formatMessage:_e}=(0,Te.Z)();return(window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS)&&Ze.contentType.options?.reviewWorkflows)??!1?{key:"__strapi_reviewWorkflows_stage_temp_key__",name:"strapi_reviewWorkflows_stage",fieldSchema:{type:"relation"},metadatas:{label:_e({id:(0,ve.Z)("containers.ListPage.table-headers.reviewWorkflows.stage"),defaultMessage:"Review stage"}),searchable:!1,sortable:!0,mainField:{name:"name",schema:{type:"string"}}},cellFormatter({strapi_reviewWorkflows_stage:n}){if(!n)return e.createElement(te.Z,{textColor:"neutral800"},"-");const{color:gt,name:Be}=n;return e.createElement(we,{color:gt??$e.FT,name:Be})}}:null}},28243:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return _e}});var e=d(32735),Te=d(24989),te=d(87107),y=d(87933),De=d(28847),he=d(23866),Ae=d(47851),V=d(67879),it=d(20108),Le=d(67350),we=d(28315),ve=d(8445),$e=d(92914);const xe="strapi_reviewWorkflows_stage";function Ze(){const{initialData:ye,isCreatingEntry:n,layout:{uid:gt},isSingleType:Be,onChange:Nt}=(0,Te.Wq)(),{put:pe}=(0,Te.kY)(),h=ye?.[xe]??null,J=Object.prototype.hasOwnProperty.call(ye,xe),{formatMessage:je}=(0,V.Z)(),{formatAPIError:et}=(0,Te.So)(),Dt=(0,Te.lm)(),{workflows:kt,isLoading:ft}=(0,Le.n)(),lt=kt?.[0]??null,{error:Ce,isLoading:We,mutateAsync:Ie}=(0,it.useMutation)(async({entityId:Ke,stageId:tt,uid:It})=>{const Pt=Be?"single-types":"collection-types",{data:{data:Ot}}=await pe(`/admin/content-manager/${Pt}/${It}/${Ke}/stage`,{data:{id:tt}});return Nt({target:{name:xe,value:Ot[xe]}},!0),Ot},{onSuccess(){Dt({type:"success",message:{id:"content-manager.reviewWorkflows.stage.notification.saved",defaultMessage:"Success: Review stage updated"}})}}),ge=h===null&&!ft&&!n&&je({id:"content-manager.reviewWorkflows.stage.select.placeholder",defaultMessage:"Select a stage"}),A=Ce&&et(Ce)||ge||null,Ve=async({value:Ke})=>{try{await Ie({entityId:ye.id,stageId:Ke,uid:gt})}catch{}};return e.createElement($e.Z.Root,null,e.createElement($e.Z.Title,null),J&&!n&&e.createElement(te.g,{error:A,name:xe,id:xe},e.createElement(y.k,{direction:"column",gap:2,alignItems:"stretch"},e.createElement(De.Q,null,je({id:"content-manager.reviewWorkflows.stage.label",defaultMessage:"Review stage"})),e.createElement(Te.JV,{components:{LoadingIndicator:()=>e.createElement(he.a,{small:!0}),Option:we.K,SingleValue:ve.R},error:A,inputId:xe,isLoading:We,isSearchable:!1,isClearable:!1,name:xe,onChange:Ve,options:lt?lt.stages.map(({id:Ke,color:tt,name:It})=>({value:Ke,label:It,color:tt})):[],value:{value:h?.id,label:h?.name,color:h?.color}}),e.createElement(Ae.c,null))),e.createElement($e.Z.Body,null))}var _e=Ze},57544:function(){},59599:function(){},42310:function(){},33842:function(){},85695:function(){}}]);