@strapi/admin 4.12.7 → 4.13.0-alpha.1

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 (180) hide show
  1. package/admin/src/components/NpsSurvey/hooks/useNpsSurveySettings.js +17 -0
  2. package/admin/src/components/NpsSurvey/index.js +365 -0
  3. package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumns.js +2 -0
  4. package/admin/src/content-manager/components/DynamicZone/components/DynamicZoneLabel.js +1 -1
  5. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +7 -2
  6. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +6 -0
  7. package/admin/src/content-manager/components/Filter/CustomInputs/AdminUsersFilter.js +42 -0
  8. package/admin/src/content-manager/components/Filter/Filter.js +54 -0
  9. package/admin/src/content-manager/components/Filter/index.js +1 -0
  10. package/admin/src/content-manager/components/InputUID/index.js +222 -216
  11. package/admin/src/content-manager/components/RelationInput/RelationInput.js +4 -0
  12. package/admin/src/content-manager/components/RepeatableComponent/index.js +32 -2
  13. package/admin/src/content-manager/components/Wysiwyg/Editor.js +432 -68
  14. package/admin/src/content-manager/components/Wysiwyg/WysiwygStyles.js +0 -7
  15. package/admin/src/content-manager/components/Wysiwyg/index.js +147 -152
  16. package/admin/src/content-manager/constants/attributes.js +3 -0
  17. package/admin/src/content-manager/hooks/useAllowedAttributes.js +43 -0
  18. package/admin/src/content-manager/pages/EditView/Information/index.js +9 -8
  19. package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +40 -7
  20. package/admin/src/content-manager/pages/ListSettingsView/index.js +6 -2
  21. package/admin/src/content-manager/pages/ListView/components/FieldPicker/index.js +67 -69
  22. package/admin/src/content-manager/pages/ListView/components/ViewSettingsMenu/index.js +80 -0
  23. package/admin/src/content-manager/pages/ListView/index.js +236 -67
  24. package/admin/src/content-manager/utils/getDisplayName.js +33 -0
  25. package/admin/src/content-manager/utils/index.js +1 -0
  26. package/admin/src/pages/Admin/index.js +3 -1
  27. package/admin/src/pages/AuthPage/components/Register/index.js +5 -0
  28. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +3 -3
  29. package/admin/src/pages/SettingsPage/index.js +16 -26
  30. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +69 -35
  31. package/admin/src/plugins.js +7 -8
  32. package/admin/src/translations/en.json +10 -1
  33. package/build/{1049.f76cb14b.chunk.js → 1049.ec69f5e0.chunk.js} +1 -1
  34. package/build/1227.9f37e1dc.chunk.js +1 -0
  35. package/build/{1386.879bcd90.chunk.js → 1386.ea73b677.chunk.js} +1 -1
  36. package/build/1504.eff012f7.chunk.js +95 -0
  37. package/build/{2225.c6244756.chunk.js → 2225.649fb7bc.chunk.js} +11 -11
  38. package/build/2237.b832ae6e.chunk.js +114 -0
  39. package/build/2379.1f98a31a.chunk.js +1 -0
  40. package/build/2395.0e5e8ded.chunk.js +26 -0
  41. package/build/2801.8e1aa82a.chunk.js +1 -0
  42. package/build/{3483.03c24f96.chunk.js → 3483.19381b40.chunk.js} +1 -1
  43. package/build/4174.f1f39e40.chunk.js +1 -0
  44. package/build/4546.a5946d22.chunk.js +1 -0
  45. package/build/4724.aea5c8c1.chunk.js +6 -0
  46. package/build/502.7bba43b1.chunk.js +1 -0
  47. package/build/6158.c3c13c20.chunk.js +1 -0
  48. package/build/7464.eb057bec.chunk.js +1 -0
  49. package/build/78.dcc6df5c.chunk.js +1 -0
  50. package/build/8276.be3ed581.chunk.js +26 -0
  51. package/build/{Admin-authenticatedApp.31497f74.chunk.js → Admin-authenticatedApp.36b0fe22.chunk.js} +2 -2
  52. package/build/{Admin_InternalErrorPage.f45f2462.chunk.js → Admin_InternalErrorPage.38155af3.chunk.js} +1 -1
  53. package/build/{Admin_homePage.ac9dfb86.chunk.js → Admin_homePage.6f128523.chunk.js} +1 -1
  54. package/build/{Admin_marketplace.c94239f6.chunk.js → Admin_marketplace.061a6e5a.chunk.js} +1 -1
  55. package/build/{Admin_pluginsPage.bbe79434.chunk.js → Admin_pluginsPage.16f837b8.chunk.js} +1 -1
  56. package/build/{Admin_profilePage.192edc52.chunk.js → Admin_profilePage.678bce24.chunk.js} +2 -2
  57. package/build/Admin_settingsPage.af7309e4.chunk.js +111 -0
  58. package/build/{Upload_ConfigureTheView.345ac1e0.chunk.js → Upload_ConfigureTheView.3fc1c100.chunk.js} +1 -1
  59. package/build/admin-app.d63bd229.chunk.js +36 -0
  60. package/build/{admin-edit-roles-page.6d567273.chunk.js → admin-edit-roles-page.38a6c863.chunk.js} +3 -3
  61. package/build/{admin-edit-users.acfd4128.chunk.js → admin-edit-users.545fc882.chunk.js} +2 -2
  62. package/build/{admin-roles-list.23ddff26.chunk.js → admin-roles-list.1e2e814d.chunk.js} +1 -1
  63. package/build/{admin-users.00e20017.chunk.js → admin-users.b8ea5677.chunk.js} +2 -2
  64. package/build/{api-tokens-create-page.46c2ea84.chunk.js → api-tokens-create-page.e0c15627.chunk.js} +1 -1
  65. package/build/{api-tokens-edit-page.58139df9.chunk.js → api-tokens-edit-page.9f2dce47.chunk.js} +1 -1
  66. package/build/{api-tokens-list-page.0af7d431.chunk.js → api-tokens-list-page.d747051c.chunk.js} +2 -2
  67. package/build/{audit-logs-settings-page.0f73ccf8.chunk.js → audit-logs-settings-page.96f9d608.chunk.js} +1 -1
  68. package/build/content-manager.2d676432.chunk.js +1097 -0
  69. package/build/{content-type-builder-list-view.bf9be456.chunk.js → content-type-builder-list-view.b71cf240.chunk.js} +1 -1
  70. package/build/{content-type-builder.cd999f6e.chunk.js → content-type-builder.e5669749.chunk.js} +2 -2
  71. package/build/email-settings-page.2809f0bf.chunk.js +11 -0
  72. package/build/en-json.e12fd5fc.chunk.js +1 -0
  73. package/build/{i18n-settings-page.47f78016.chunk.js → i18n-settings-page.5f716172.chunk.js} +1 -1
  74. package/build/index.html +1 -1
  75. package/build/main.c6c9e04c.js +2859 -0
  76. package/build/review-workflows-settings-create-view.4a156a19.chunk.js +1 -0
  77. package/build/review-workflows-settings-edit-view.ce984d1f.chunk.js +1 -0
  78. package/build/review-workflows-settings-list-view.419b8deb.chunk.js +56 -0
  79. package/build/{runtime~main.d515c521.js → runtime~main.5a10b789.js} +2 -2
  80. package/build/{sso-settings-page.12b6d8ae.chunk.js → sso-settings-page.45153df5.chunk.js} +1 -1
  81. package/build/{transfer-tokens-create-page.1597e6ab.chunk.js → transfer-tokens-create-page.ebba16d8.chunk.js} +1 -1
  82. package/build/{transfer-tokens-edit-page.8741529f.chunk.js → transfer-tokens-edit-page.d7bb2b3e.chunk.js} +1 -1
  83. package/build/{transfer-tokens-list-page.d6986b03.chunk.js → transfer-tokens-list-page.cfe1736c.chunk.js} +2 -2
  84. package/build/{upload-settings.7f93d4c0.chunk.js → upload-settings.cc5ad813.chunk.js} +1 -1
  85. package/build/{upload.37488080.chunk.js → upload.756efc28.chunk.js} +1 -1
  86. package/build/users-advanced-settings-page.818d84eb.chunk.js +9 -0
  87. package/build/users-email-settings-page.c1967c09.chunk.js +9 -0
  88. package/build/users-providers-settings-page.11893e08.chunk.js +14 -0
  89. package/build/users-roles-settings-page.2b051e6a.chunk.js +55 -0
  90. package/build/{webhook-edit-page.6cb479ff.chunk.js → webhook-edit-page.de45c635.chunk.js} +2 -2
  91. package/build/{webhook-list-page.65e1b5bb.chunk.js → webhook-list-page.ca91df8b.chunk.js} +1 -1
  92. package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/AssigneeFilter.js +42 -0
  93. package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/StageFilter.js +70 -0
  94. package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/constants.js +71 -0
  95. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +9 -217
  96. package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/AssigneeSelect.js +147 -0
  97. package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/index.js +1 -0
  98. package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +243 -0
  99. package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/index.js +1 -0
  100. package/ee/admin/content-manager/pages/EditView/InformationBox/constants.js +2 -0
  101. package/ee/admin/content-manager/pages/ListSettingsView/constants.js +7 -0
  102. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/ReviewWorkflowsAssigneeEE.js +21 -0
  103. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +44 -17
  104. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/index.js +1 -0
  105. package/ee/admin/hooks/useAuthProviders.js +25 -0
  106. package/ee/admin/hooks/{useLicenseLimitNotification/index.js → useLicenseLimitNotification.js} +2 -4
  107. package/ee/admin/hooks/{useLicenseLimits/useLicenseLimits.js → useLicenseLimits.js} +4 -1
  108. package/ee/admin/pages/AuthPage/components/Login/index.js +8 -4
  109. package/ee/admin/pages/AuthPage/components/Providers/index.js +8 -5
  110. package/ee/admin/pages/HomePage/index.js +1 -1
  111. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -1
  112. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +1 -1
  113. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +1 -1
  114. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +1 -1
  115. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
  116. package/ee/server/constants/workflows.js +1 -0
  117. package/ee/server/controllers/index.js +1 -0
  118. package/ee/server/controllers/workflows/assignees/index.js +44 -0
  119. package/ee/server/routes/review-workflows.js +17 -0
  120. package/ee/server/services/index.js +1 -0
  121. package/ee/server/services/review-workflows/assignees.js +54 -0
  122. package/ee/server/services/review-workflows/metrics/index.js +5 -0
  123. package/ee/server/services/review-workflows/review-workflows.js +20 -11
  124. package/ee/server/validation/review-workflows.js +8 -0
  125. package/index.js +2 -6
  126. package/package.json +9 -9
  127. package/scripts/build.js +15 -15
  128. package/scripts/create-dev-plugins-file.js +5 -38
  129. package/server/controllers/role.js +2 -0
  130. package/server/controllers/user.js +2 -0
  131. package/server/services/permission/permissions-manager/index.js +3 -1
  132. package/server/services/permission/permissions-manager/sanitize.js +19 -7
  133. package/server/services/permission/permissions-manager/validate.js +218 -0
  134. package/utils/create-cache-dir.js +62 -16
  135. package/utils/create-plugins-exclude-path.js +3 -23
  136. package/utils/get-plugins.js +110 -0
  137. package/utils/index.js +1 -1
  138. package/webpack.config.js +10 -13
  139. package/admin/src/content-manager/components/AttributeFilter/Filters.js +0 -58
  140. package/admin/src/content-manager/components/AttributeFilter/hooks/useAllowedAttributes.js +0 -42
  141. package/admin/src/content-manager/components/AttributeFilter/index.js +0 -40
  142. package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +0 -344
  143. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -23
  144. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
  145. package/admin/src/pages/SettingsPage/utils/createSectionsRoutes.js +0 -11
  146. package/admin/src/pages/SettingsPage/utils/getSectionsToDisplay.js +0 -5
  147. package/admin/src/pages/SettingsPage/utils/index.js +0 -2
  148. package/build/2379.f1641312.chunk.js +0 -1
  149. package/build/2395.46f8d0c1.chunk.js +0 -26
  150. package/build/2801.5cef5ec8.chunk.js +0 -1
  151. package/build/3929.5632f24d.chunk.js +0 -114
  152. package/build/3984.dda474f7.chunk.js +0 -1
  153. package/build/4546.7a3c0d03.chunk.js +0 -1
  154. package/build/502.8ae8ef60.chunk.js +0 -1
  155. package/build/5483.6dd2e776.chunk.js +0 -6
  156. package/build/5542.2415a393.chunk.js +0 -63
  157. package/build/6158.c974fd83.chunk.js +0 -1
  158. package/build/7464.3e64a1d5.chunk.js +0 -1
  159. package/build/8276.10a3f883.chunk.js +0 -26
  160. package/build/Admin_settingsPage.97cb9d41.chunk.js +0 -111
  161. package/build/admin-app.91898385.chunk.js +0 -36
  162. package/build/content-manager.b40f79c0.chunk.js +0 -1099
  163. package/build/email-settings-page.d494d1eb.chunk.js +0 -11
  164. package/build/en-json.08c05fcf.chunk.js +0 -1
  165. package/build/main.9dbe4579.js +0 -2859
  166. package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +0 -1
  167. package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +0 -1
  168. package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +0 -56
  169. package/build/users-advanced-settings-page.f0760eb8.chunk.js +0 -9
  170. package/build/users-email-settings-page.ff4b32f3.chunk.js +0 -9
  171. package/build/users-providers-settings-page.48de0306.chunk.js +0 -14
  172. package/build/users-roles-settings-page.9d9a1eff.chunk.js +0 -30
  173. package/ee/admin/hooks/index.js +0 -4
  174. package/ee/admin/hooks/useAuthProviders/index.js +0 -50
  175. package/ee/admin/hooks/useAuthProviders/reducer.js +0 -26
  176. package/ee/admin/hooks/useLicenseLimits/index.js +0 -1
  177. package/scripts/create-plugins-file.js +0 -92
  178. package/utils/get-plugins-path.js +0 -41
  179. /package/ee/admin/hooks/{useLicenseLimits/__mocks__/index.js → __mocks__/useLicenseLimits.js} +0 -0
  180. /package/server/services/permission/permissions-manager/{query-builers.js → query-builders.js} +0 -0
@@ -1,1099 +0,0 @@
1
- (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{2046:function(Ko,dt,l){"use strict";l.r(dt),l.d(dt,{App:function(){return ns},default:function(){return Up}});var e=l(32735),Te=l(27649),De=l(82055),nt=l(96709),h=l(19565),Tt=l(98978),ut=l.n(Tt),Ge=l(74758),Q=l(67879),se=l(15062),re=l(53038),Dt=l(17379),je=l(30305),Pt=(0,e.createContext)(),Ae=l(7921),mt=l(24381),ke=l(60216),n=l.n(ke),ot=l(47533),It=(0,e.createContext)(),Xo=l(75430),te=l(69242),E=l(69997),le=l(41415),Qe=l(17e3),H=l(72850),x=l(87933),z=l(49372),Oe=l(15335),ve=l(5803),Fe=l(68465),Ce=l(84967),Nt=l(9026),rt=l(29439),We=l(66456),an=l(99381),$e=l.n(an),Jo=l(89793),Pe=l.n(Jo),sn=l(23940),at=l.n(sn),we=l(20108),pt=l(20716),ge=l(1594),gt=l(19406),Ke=l(68625),os=l(33795),w=l.n(os);const _o=e.createContext();function ln({attributes:t,buttonData:o,children:r,goTo:a,layout:s,metadatas:c,moveItem:i,moveRow:d,onAddData:u,relationsLayout:m,removeField:p,selectedItemName:y,setEditFieldToSelect:f,...g}){return e.createElement(_o.Provider,{value:{attributes:t,buttonData:o,goTo:a,layout:s,metadatas:c,moveItem:i,moveRow:d,onAddData:u,relationsLayout:m,removeField:p,selectedItemName:y,setEditFieldToSelect:f,...g}},r)}ln.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},ln.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 st(){return e.useContext(_o)}const rs=[{action:"plugin::content-type-builder.read",subject:null}];var as=()=>{const{trackUsage:t}=(0,h.rS)(),{formatMessage:o}=(0,Q.Z)(),{slug:r,modifiedData:a,isContentTypeView:s}=st(),c=s?"content-types":"components",i=`/plugins/content-type-builder/${c==="content-types"?c:"component-categories"}`,d=w()(a,"category",""),u=c==="content-types"?r:`${d}/${r}`,m=()=>{t("willEditEditLayout")};return r==="strapi::administrator"?null:e.createElement(h.jW,{permissions:rs},e.createElement(h.Qj,{to:`${i}/${u}`,onClick:m,size:"S",startIcon:e.createElement(Ke.Z,null),variant:"secondary"},o({id:(0,Ae.Z)(`edit-settings-view.link-to-ctb.${c}`),defaultMessage:"Edit the content type"})))},Ye=l(47081),jt=l(74506),xt=l(51968),V=l(8471),Re=l(50563),qe=l(4038),cn=l(45112);const er=({componentUid:t})=>{const{componentLayouts:o}=st(),{formatMessage:r}=(0,Q.Z)(),a=w()(o,[t],{}),s=w()(a,["layouts","edit"],[]);return e.createElement(H.x,{padding:3},s.map((c,i)=>e.createElement(Oe.r,{gap:4,key:i},c.map(d=>e.createElement(ve.P,{key:d.name,col:d.size},e.createElement(H.x,{paddingTop:2},e.createElement(x.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},e.createElement(z.Z,{textColor:"neutral800"},d.name))))))),e.createElement(H.x,{paddingTop:2},e.createElement(h.rU,{startIcon:e.createElement(cn.Z,null),to:`/content-manager/components/${t}/configurations/edit`},r({id:(0,Ae.Z)("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};er.propTypes={componentUid:n().string.isRequired};var ss=er,ft=l(14911),ht=l(99140),is=l(55805),ls=l(31206),cs=l(97075),ds=l(14949),us=l(8482),ms=l(65261),ps=l(55877),gs=l(84298),dn=l(73906),fs=l(37272),hs=l(67121),ys=l(39869),tr=l(35635),Es=l(26366),bs=l(98464),vs=l(2362),Cs=l(89992),Rs=l(10473),Ms=l(95971),Ts=l(72536),Ds=l(68312),nr=l(80601),or=l(74464),Os=l(70809),Ps=l(98148),Is=l(81424),xs=l(69317),Zs=l(25789),ks=l(77359),Ls=l(50416),Ss=l(20015),As=l(20276),Fs=l(82068),$s=l(41645),ws=l(61294),Bs=l(65943),Ns=l(8606),js=l(7961),Ws=l(92967),rr=l(18070),zs=l(54894),Vs=l(30285),Us=l(96011),qs=l(47041),Hs=l(60625),ar=l(5644),Gs=l(78150),Qs=l(63717),Ks=l(24609),Ys=l(86543),Xs=l(62864),Js=l(92989),_s=l(49886),ei=l(47052),ti=l(50694),ni=l(81875),oi=l(92323),un=l(49844),ri=l(11631),ai=l(9254),sr=l(2669),si=l(18709),ii=l(20258),ir=l(43231),li=l(45147),ci=l(23154),di=l(26253),ui=l(79634),mi=l(32548),pi=l(99482),gi=l(45323),fi=l(76994),hi=l(88777),yi=l(95703),Ei=l(8981),bi=l(7733),vi=l(10168),Ci=l(25449),Ri=l(83900),Mi=l(32645),Ti=l(78429),Di=l(9882),lr=l(11417),Oi=l(39698),Pi=l(92168),Ii=l(69621),xi=l(2438),Zi=l(92254),ki=l(2287),Li=l(29685),cr=l(65663),mn=l(44647),Si=l(5502),Ai=l(31047),Fi=l(93307),$i=l(78055),wi=l(51239),Bi=l(6792),Ni=l(75156),ji=l(80683),Wi=l(2689),zi=l(40202),Vi=l(36919),Ui=l(75444),qi=l(92003),Hi=l(4511),Gi=l(2847),dr=l(83139),Qi=l(53779),Ki=l(72890),Yi=l(84411),Xi=l(37193),Ji=l(74831),_i=l(99221),el=l(34119),pn=l(99283),tl=l(21371),nl=l(70727),ol=l(42213),rl=l(8611),al=l(20448),sl=l(73165);const ur={alien:is.Z,apps:ls.Z,archive:cs.Z,arrowDown:ds.Z,arrowLeft:rt.Z,arrowRight:us.Z,arrowUp:ms.Z,attachment:ps.Z,bell:gs.Z,bold:dn.Z,book:fs.Z,briefcase:hs.Z,brush:ys.Z,bulletList:tr.Z,calendar:Es.Z,car:bs.Z,cast:vs.Z,chartBubble:Cs.Z,chartCircle:Rs.Z,chartPie:Ms.Z,check:We.Z,clock:Ts.Z,cloud:Ds.Z,code:nr.Z,cog:cn.Z,collapse:or.Z,command:Os.Z,connector:Ps.Z,crop:Is.Z,crown:xs.Z,cube:Zs.Z,cup:ks.Z,cursor:Ls.Z,dashboard:Ss.Z,database:As.Z,discuss:Fs.Z,doctor:$s.Z,earth:ws.Z,emotionHappy:Bs.Z,emotionUnhappy:Ns.Z,envelop:js.Z,exit:Ws.Z,expand:rr.Z,eye:zs.Z,feather:Vs.Z,file:Us.Z,fileError:qs.Z,filePdf:Hs.Z,filter:ar.Z,folder:Gs.Z,gate:Qs.Z,gift:Ks.Z,globe:Ys.Z,grid:Xs.Z,handHeart:Js.Z,hashtag:_s.Z,headphone:ei.Z,heart:ti.Z,house:ni.Z,information:oi.Z,italic:un.Z,key:ri.Z,landscape:ai.Z,layer:sr.Z,layout:si.Z,lightbulb:ii.Z,link:ir.Z,lock:li.Z,magic:ci.Z,manyToMany:di.Z,manyToOne:ui.Z,manyWays:mi.Z,medium:pi.Z,message:gi.Z,microphone:fi.Z,monitor:hi.Z,moon:yi.Z,music:Ei.Z,oneToMany:bi.Z,oneToOne:vi.Z,oneWay:Ci.Z,paint:Ri.Z,paintBrush:Mi.Z,paperPlane:Ti.Z,pencil:Ke.Z,phone:Di.Z,picture:lr.Z,pin:Oi.Z,pinMap:Pi.Z,plane:Ii.Z,play:xi.Z,plus:gt.Z,priceTag:Zi.Z,puzzle:ki.Z,question:Li.Z,quote:cr.Z,refresh:mn.Z,repeat:Si.Z,restaurant:Ai.Z,rocket:Fi.Z,rotate:$i.Z,scissors:wi.Z,search:Bi.Z,seed:Ni.Z,server:ji.Z,shield:Wi.Z,shirt:zi.Z,shoppingCart:Vi.Z,slideshow:Ui.Z,stack:qi.Z,star:Hi.Z,store:Gi.Z,strikeThrough:dr.Z,sun:Qi.Z,television:Ki.Z,thumbDown:Yi.Z,thumbUp:Xi.Z,train:Ji.Z,twitter:_i.Z,typhoon:el.Z,underline:pn.Z,user:tl.Z,volumeMute:nl.Z,volumeUp:ol.Z,walk:rl.Z,wheelchair:al.Z,write:sl.Z};function Zt({showBackground:t=!0,size:o="M",icon:r}){return e.createElement(x.k,{alignItems:"center",background:t?"neutral200":null,justifyContent:"center",size:o,showBackground:t,height:o==="S"?5:8,width:o==="S"?5:8,color:"neutral600",borderRadius:t?"50%":0},e.createElement(ht.J,{as:ur[r]||ur.cube,height:o==="S"?3:5,width:o==="S"?3:5}))}Zt.defaultProps={showBackground:!0,size:"M",icon:"Cube"},Zt.propTypes={showBackground:n().bool,size:n().string,icon:n().string};const il=(0,V.ZP)(x.k)`
2
- text-decoration: none;
3
-
4
- &:focus,
5
- &:hover {
6
- ${({theme:t})=>`
7
- background-color: ${t.colors.primary100};
8
- border-color: ${t.colors.primary200};
9
-
10
- ${z.Z} {
11
- color: ${t.colors.primary600};
12
- }
13
- `}
14
-
15
- /* > ComponentIcon */
16
- > div:first-child {
17
- background: ${({theme:t})=>t.colors.primary200};
18
- color: ${({theme:t})=>t.colors.primary600};
19
-
20
- svg {
21
- path {
22
- fill: ${({theme:t})=>t.colors.primary600};
23
- }
24
- }
25
- }
26
- }
27
- `,mr=({components:t})=>{const{componentLayouts:o}=st();return e.createElement(x.k,{gap:2,overflow:"scroll hidden",padding:3},t.map(r=>e.createElement(il,{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:ft.rU,to:`/content-manager/components/${r}/configurations/edit`},e.createElement(Zt,{icon:o?.[r]?.info?.icon}),e.createElement(H.x,{paddingTop:1},e.createElement(z.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},o?.[r]?.info?.displayName??"")))))};mr.propTypes={components:n().arrayOf(n().string).isRequired};var ll=mr;const pr=(0,V.ZP)(Re.h)`
28
- background-color: transparent;
29
- path {
30
- fill: ${({theme:t})=>t.colors.neutral600};
31
- }
32
- `,gn=({attribute:t,onEditField:o,onDeleteField:r,children:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(H.x,{overflow:"hidden",width:"100%"},e.createElement(x.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},e.createElement(z.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},a),e.createElement(x.k,null,e.createElement(pr,{label:s({id:(0,E.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:a}),onClick:o,icon:e.createElement(Ke.Z,null),noBorder:!0}),e.createElement(pr,{label:s({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:a}),"data-testid":"delete-field",onClick:r,icon:e.createElement(qe.Z,null),noBorder:!0}))),t?.type==="component"&&e.createElement(ss,{componentUid:t.component}),t?.type==="dynamiczone"&&e.createElement(ll,{components:t.components}))};gn.defaultProps={attribute:void 0},gn.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 cl=gn;const dl=(0,V.ZP)(x.k)`
33
- position: relative;
34
- ${({isFirst:t,isLast:o,hasHorizontalPadding:r})=>t?`
35
- padding-right: 4px;
36
- `:o?`
37
- padding-left: 4px;
38
- `:r?`
39
- padding: 0 4px;
40
- `:""}
41
- ${({showRightCarret:t,showLeftCarret:o,theme:r})=>t?`
42
- &:after {
43
- content: '';
44
- position: absolute;
45
- right: -1px;
46
- background-color: ${r.colors.primary600};
47
- width: 2px;
48
- height: 100%;
49
- align-self: stretch;
50
- z-index: 1;
51
- }
52
- `:o?`
53
- &:before {
54
- content: '';
55
- position: absolute;
56
- left: -1px;
57
- background-color: ${r.colors.primary600};
58
- width: 2px;
59
- height: 100%;
60
- align-self: stretch;
61
- z-index: 1;
62
- }
63
- `:""};
64
- `,ul=(0,V.ZP)(Ye.Z)`
65
- height: ${12/16}rem;
66
- width: ${12/16}rem;
67
- path {
68
- fill: ${({theme:t})=>t.colors.neutral600};
69
- }
70
- `,ml=(0,V.ZP)(x.k)`
71
- display: ${({dragStart:t})=>t?"none":"flex"};
72
- opacity: ${({isDragging:t,isFullSize:o,isHidden:r})=>t&&!o?.2:t&&o||r?0:1};
73
- `,pl=(0,V.ZP)(x.k)`
74
- cursor: all-scroll;
75
- border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
76
- `,fn=({attribute:t,children:o,index:r,lastIndex:a,moveItem:s,moveRow:c,name:i,onDeleteField:d,onEditField:u,rowIndex:m,size:p})=>{const[y,f]=(0,e.useState)(!1),g=i==="_TEMP_",{setIsDraggingSibling:b}=st(),C=p===12,k=(0,e.useRef)(null),v=(0,e.useRef)(null),[{clientOffset:M,isOver:L},W]=(0,jt.useDrop)({accept:E._Q.EDIT_FIELD,hover(S,F){if(!v.current||S.size!==12)return;const R=F.getItem().index,X=r,K=F.getItem().rowIndex,Y=m;if(R===X&&K===Y)return;const A=v.current.getBoundingClientRect(),j=(A.bottom-A.top)/2,ue=F.getClientOffset().y-A.top;K<Y&&ue<j||K>Y&&ue>j||(c(K,Y),S.rowIndex=Y,S.itemIndex=X)},drop(S,F){if(!v.current)return;const R=F.getItem().index,X=r,K=F.getItem().rowIndex,Y=m;if(S.size===12||R===X&&K===Y)return;const A=v.current.getBoundingClientRect();if(Math.abs(F.getClientOffset().x-A.left)>A.width/1.8){s(R,X+1,K,Y),S.itemIndex=X+1,S.rowIndex=Y;return}s(R,X,K,Y),S.itemIndex=X,S.rowIndex=Y},collect:S=>({canDrop:S.canDrop(),clientOffset:S.getClientOffset(),isOver:S.isOver(),isOverCurrent:S.isOver({shallow:!0}),itemType:S.getItemType()})}),[{isDragging:T,getItem:D},N,$]=(0,jt.useDrag)({type:E._Q.EDIT_FIELD,item(){return b(!0),{index:r,labelField:o,rowIndex:m,name:i,size:p}},canDrag(){return i!=="_TEMP_"},collect:S=>({isDragging:S.isDragging(),getItem:S.getItem()}),end(){b(!1)}});(0,e.useEffect)(()=>{$((0,xt.rX)(),{captureDraggingState:!0})},[$]);const P={dragRef:N(k),dropRef:W(v)};let B=!1,U=!1;if(v.current&&M){const S=v.current.getBoundingClientRect();B=L&&D.size!==12&&Math.abs(M.x-S.left)<S.width/2,U=L&&D.size!==12&&Math.abs(M.x-S.left)>S.width/2,i==="_TEMP_"&&(B=L&&D.size!==12,U=!1)}const I=()=>t&&C?`${74/16}rem`:`${32/16}rem`,G=r===0&&!C,Z=r===a&&!C,q=r!==0&&!C;return e.createElement(ve.P,{col:p},e.createElement(dl,{ref:P.dropRef,showLeftCarret:B,showRightCarret:U,isFirst:G,isLast:Z,hasHorizontalPadding:q,onDrag:()=>{C&&!y&&f(!0)},onDragEnd:()=>{C&&f(!1)}},y&&C&&e.createElement(H.x,{width:"100%",height:"2px",background:"primary600"}),e.createElement(ml,{width:C&&y?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:I(),alignItems:"stretch",isDragging:T,dragStart:y,isFullSize:C,isHidden:g},e.createElement(pl,{as:"span",type:"button",ref:P.dragRef,onClick:S=>S.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},e.createElement(ul,null)),!g&&e.createElement(cl,{attribute:t,onEditField:u,onDeleteField:d},o))))};fn.defaultProps={attribute:void 0},fn.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 gl=fn;const gr=({rowItem:t,onRemoveField:o,rowId:r,rowIndex:a,index:s,lastIndex:c})=>{const{setEditFieldToSelect:i,attributes:d,modifiedData:u,moveRow:m,moveItem:p}=st(),y=w()(d,[t.name],{}),f=w()(u,["metadatas",t.name,"edit","label"],"");return e.createElement(gl,{onEditField:()=>i(t.name),onDeleteField:()=>o(r,s),attribute:y,index:s,lastIndex:c,rowIndex:a,name:t.name,size:t.size,moveRow:m,moveItem:p},f||t.name)};gr.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 fl=gr;const fr=({row:t,onRemoveField:o,rowIndex:r})=>e.createElement(Oe.r,null,t.rowContent.map((a,s)=>e.createElement(fl,{key:a.name,rowItem:a,index:s,rowId:t.rowId,onRemoveField:o,rowIndex:r,lastIndex:t.rowContent.length-1})));fr.propTypes={onRemoveField:n().func.isRequired,row:n().object.isRequired,rowIndex:n().number.isRequired};var hl=fr;const hr=({editLayout:t,fields:o,onRemoveField:r,onAddField:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(x.k,{justifyContent:"space-between"},e.createElement("div",null,e.createElement(H.x,null,e.createElement(z.Z,{fontWeight:"bold"},s({id:(0,E.OB)("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),e.createElement(H.x,null,e.createElement(z.Z,{variant:"pi",textColor:"neutral600"},s({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),e.createElement(as,null)),e.createElement(H.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:2},t.map((c,i)=>e.createElement(hl,{key:c.rowId,row:c,rowIndex:i,onRemoveField:r})),e.createElement(ge.fC,null,e.createElement(ge.xz,{startIcon:e.createElement(gt.Z,null),endIcon:null,disabled:o.length===0,fullWidth:!0,variant:"secondary"},s({id:(0,E.OB)("containers.SettingPage.add.field"),defaultMessage:"Insert another field"})),e.createElement(ge.VY,null,o.map(c=>e.createElement(ge.ck,{key:c,onSelect:()=>a(c)},c)))))))};hr.propTypes={editLayout:n().array.isRequired,fields:n().array.isRequired,onAddField:n().func.isRequired,onRemoveField:n().func.isRequired};var yl=hr,hn=l(85025),yn=l(55225),En=l(31600),bn=l(11406),kt=l(32031),El=l(73779),Wt=l(88675),bl=l(22348),yr=l(7184),vn=l(43475),vl=l(82512),Cn=l(83218),Cl=l(872),Rl=l(17757),Ml=l(1176),Tl=l(15431);const Er={biginteger:e.createElement(kt.Z,null),boolean:e.createElement(El.Z,null),date:e.createElement(Wt.Z,null),datetime:e.createElement(Wt.Z,null),decimal:e.createElement(kt.Z,null),email:e.createElement(bl.Z,null),enum:e.createElement(yr.Z,null),enumeration:e.createElement(yr.Z,null),file:e.createElement(vn.Z,null),files:e.createElement(vn.Z,null),float:e.createElement(kt.Z,null),integer:e.createElement(kt.Z,null),media:e.createElement(vn.Z,null),number:e.createElement(kt.Z,null),relation:e.createElement(vl.Z,null),string:e.createElement(Cn.Z,null),text:e.createElement(Cn.Z,null),richtext:e.createElement(Cn.Z,null),time:e.createElement(Wt.Z,null),timestamp:e.createElement(Wt.Z,null),json:e.createElement(Cl.Z,null),uid:e.createElement(Rl.Z,null),component:e.createElement(Ml.Z,null),dynamiczone:e.createElement(Tl.Z,null)},Rn=({type:t,customFieldUid:o})=>{const r=(0,h.mZ)();let a=Er[t];if(o){const c=r.get(o).icon;c&&(a=e.createElement(H.x,{marginRight:3,width:7,height:6},e.createElement(c,null)))}return Er[t]?a:null};Rn.defaultProps={customFieldUid:null},Rn.propTypes={type:n().string.isRequired,customFieldUid:n().string};var br=Rn,Dl=t=>t.reduce((o,r)=>{const a=r?.attributes??{},s=Object.keys(a).filter(c=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes(a?.[c]?.type??""));return o[r.uid]=s,o},{}),vr=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,E.OB)("containers.SettingPage.editSettings.entry.title"):(0,E.OB)(`form.Input.${t}`);return{type:o,label:{id:r}}},Mn=l(10369),Lt=l(71842);const Tn=({type:t,options:o,onChange:r,value:a,name:s,...c})=>{const{formatMessage:i}=(0,Q.Z)();switch(t){case"text":return e.createElement(Mn.o,{onChange:r,value:a,name:s,...c});case"bool":return e.createElement(Lt.s,{onChange:d=>{r({target:{name:s,value:d.target.checked}})},checked:a,name:s,onLabel:i({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:i({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),...c});case"select":return e.createElement(Fe.P,{value:a,name:s,onChange:d=>r({target:{name:s,value:d}}),...c},o.map(d=>e.createElement(Ce.W,{key:d,value:d},d)));default:return null}};Tn.defaultProps={options:void 0},Tn.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 Ol=Tn;const Pl=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],Cr=({onMetaChange:t,onSizeChange:o})=>{const{formatMessage:r}=(0,Q.Z)(),{modifiedData:a,selectedField:s,attributes:c,fieldForm:i}=st(),d=(0,e.useMemo)(pt.Vo,[]),{schemas:u}=(0,se.v9)(v=>d(v),se.wU),m=(0,se.v9)(pt.Jg),p=(0,e.useMemo)(()=>{if(!s)return[];const v=w()(a,["metadatas",s,"edit"],{});return Object.keys(v).filter(M=>M!=="visible")},[s,a]),y=(0,e.useMemo)(()=>Dl(u),[u]),f=(0,e.useCallback)(v=>{if(v!=="relation"&&v!=="component")return[];const M=v==="component"?"component":"targetModel",L=w()(a,["attributes",s,M],"");return w()(y,[L],[])},[s,y,a]),g=p.map(v=>{const M=w()(c,[s,"type"]);return["component","dynamiczone"].includes(M)&&!["label","description"].includes(v)||M==="component"&&v!=="label"||["media","json","boolean"].includes(M)&&v==="placeholder"||v==="step"?null:e.createElement(ve.P,{col:6,key:v},e.createElement(Ol,{type:vr(v).type,hint:v==="mainField"?r({id:(0,Ae.Z)("containers.SettingPage.editSettings.relation-field.description")}):"",label:r({id:w()(vr(v),"label.id","app.utils.defaultMessage")}),name:v,onChange:t,value:w()(i,["metadata",v],""),options:f(M)}))}),{type:b,customField:C}=c[s],{isResizable:k}=m[C]??m[b];return e.createElement(e.Fragment,null,g,k&&e.createElement(ve.P,{col:6,key:"size"},e.createElement(Fe.P,{value:i?.size,name:"size",onChange:v=>{o({name:s,value:v})},label:r({id:(0,Ae.Z)("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},Pl.map(([v,M])=>e.createElement(Ce.W,{key:v,value:v},M)))))};Cr.propTypes={onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired};var Il=Cr;const xl=(0,V.ZP)(x.k)`
77
- svg {
78
- width: ${32/16}rem;
79
- height: ${24/16}rem;
80
- margin-right: ${({theme:t})=>t.spaces[3]};
81
- }
82
- `,Dn=({onToggle:t,onMetaChange:o,onSizeChange:r,onSubmit:a,type:s,customFieldUid:c})=>{const{selectedField:i}=st(),{formatMessage:d}=(0,Q.Z)(),u=()=>s==="timestamp"?"date":["decimal","float","integer","biginter"].includes(s)?"number":s;return e.createElement(hn.P,{onClose:t,labelledBy:"title"},e.createElement("form",{onSubmit:a},e.createElement(yn.x,null,e.createElement(xl,null,e.createElement(br,{type:u(),customFieldUid:c}),e.createElement(z.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},d({id:(0,E.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:at()(i)})))),e.createElement(En.f,null,e.createElement(Oe.r,{gap:4},e.createElement(Il,{onMetaChange:o,onSizeChange:r}))),e.createElement(bn.m,{startActions:e.createElement(le.z,{onClick:t,variant:"tertiary"},d({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(le.z,{type:"submit"},d({id:"global.finish",defaultMessage:"Finish"}))})))};Dn.defaultProps={customFieldUid:null},Dn.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 Zl=Dn,kl=l(3040),ne=l.n(kl);const On=t=>t.reduce((o,r)=>o+r.size,0),Ll=t=>t.reduce((o,r,a)=>{const s={rowId:a,rowContent:r};return o.concat(s)},[]),yt=t=>t.reduce((o,r)=>{let a=[];const s=r.rowContent.reduce((d,u)=>{const m=On(d);return u.name==="_TEMP_"||(m+u.size<=12?d.push(u):a.push(u)),d},[]),c=o.length===0?0:Math.max.apply(Math,o.map(d=>d.rowId))+1,i=On(s);if(i<12&&s.push({name:"_TEMP_",size:12-i}),o.push({rowId:c,rowContent:s}),a.length>0){const d=On(a);d<12&&a.push({name:"_TEMP_",size:12-d}),o.push({rowId:c+1,rowContent:a}),a=[]}return o},[]).filter(o=>o.rowContent.length>0).filter(o=>o.rowContent.length===1?o.rowContent[0].name!=="_TEMP_":!0),Sl=t=>t.reduce((o,r)=>{const a=r.rowContent.filter(s=>s.name!=="_TEMP_");return o.concat([a])},[]),Al=(t,o=[])=>o.reduce((r,{rowContent:a})=>{const s=a.find(c=>c.name===t)?.size??null;return s&&(r=s),r},null),Fl=(t,o,r=[])=>r.map(a=>(a.rowContent=a.rowContent.map(s=>s.name===t?{...s,size:o}:s),a));var $l=(t,o,r)=>{let a=$e()(o);return ne()(a,["layouts","edit"],yt(Ll(o.layouts.edit))),{...t,initialData:a,modifiedData:a,componentLayouts:r}},Pn=l(97889);const Rr=6,In={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}};var wl=(t=In,o)=>(0,Pn.ZP)(t,r=>{const a=["modifiedData","layouts","edit"];switch(o.type){case"MOVE_ROW":{const s=w()(t,a,[]),{fromIndex:c,toIndex:i}=o;ne()(r,a,(0,E.W3)(s,c,i));break}case"ON_ADD_FIELD":{const s=$e()(t),c=w()(s,["modifiedData","attributes",o.name],{}),i=o.fieldSizes[c?.customField]?.default??o.fieldSizes[c?.type]?.default??Rr,d=w()(s,a,[]).length,u=[...a,d-1,"rowContent"],m=w()(s,u,[]);let p=w()(s,a,[]);Array.isArray(m)?ne()(p,[d>0?d-1:0,"rowContent"],[...m,{name:o.name,size:i}]):ne()(p,[d>0?d-1:0,"rowContent"],[{name:o.name,size:i}]);const y=yt(p);ne()(r,a,y);break}case"ON_CHANGE":{ne()(r,["modifiedData",...o.keys],o.value);break}case"ON_CHANGE_META":{ne()(r,["metaForm","metadata",...o.keys],o.value);break}case"ON_CHANGE_SIZE":{ne()(r,["metaForm","size"],o.value);break}case"ON_RESET":{r.modifiedData=t.initialData;break}case"REMOVE_FIELD":{const s=w()(t,[...a,o.rowIndex,"rowContent"],[]);let c=$e()(t);if(s.length===1||s.length===2&&w()(s,[1,"name"],"")==="_TEMP_"){const d=w()(t,a,[]);ne()(c,a,d.filter((u,m)=>o.rowIndex!==m))}else ne()(c,[...a,o.rowIndex,"rowContent"],s.filter((d,u)=>u!==o.fieldIndex));const i=yt(w()(c,a,[]));ne()(r,a,i);break}case"REORDER_DIFF_ROW":{const s=w()(t,[...a,o.dragRowIndex,"rowContent"],[]),c=w()(t,[...a,o.hoverRowIndex,"rowContent"],[]),i=w()(t,[...a,o.dragRowIndex,"rowContent",o.dragIndex],{}),d=[...c,i];let u=$e()(t);ne()(u,[...a,o.dragRowIndex,"rowContent"],s.filter((p,y)=>o.dragIndex!==y)),ne()(u,[...a,o.hoverRowIndex,"rowContent"],(0,E.W3)(d,d.length-1,o.hoverIndex));const m=yt(w()(u,a,[]));ne()(r,a,m);break}case"REORDER_ROW":{const s=$e()(t),c=w()(s,[...a,o.dragRowIndex,"rowContent"],[]);ne()(s,[...a,o.dragRowIndex,"rowContent"],(0,E.W3)(c,o.dragIndex,o.hoverIndex));const i=yt(w()(s,a,[]));ne()(r,a,i);break}case"SET_FIELD_TO_EDIT":{r.metaToEdit=o.name,r.metaForm={metadata:w()(t,["modifiedData","metadatas",o.name,"edit"],{}),size:Al(o.name,t.modifiedData?.layouts?.edit)??Rr};break}case"SUBMIT_META_FORM":{ne()(r,["modifiedData","metadatas",t.metaToEdit,"edit"],t.metaForm.metadata);const s=$e()(w()(t,a,[])),c=Fl(t.metaToEdit,t.metaForm.size,s);c.length>0&&ne()(r,a,yt(c));break}case"SUBMIT_SUCCEEDED":{r.initialData=t.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{r.metaToEdit="",r.metaForm={};break}default:return r}});const xn=({mainLayout:t,components:o,isContentTypeView:r,slug:a,updateLayout:s})=>{const[c,i]=(0,e.useReducer)(wl,In,()=>$l(In,t,o)),[d,u]=(0,e.useState)(!1),{trackUsage:m}=(0,h.rS)(),p=(0,h.lm)(),{goBack:y}=(0,re.k6)(),[f,g]=(0,e.useState)(!1),[b,C]=(0,e.useState)(!1),{componentLayouts:k,initialData:v,modifiedData:M,metaToEdit:L,metaForm:W}=c,{formatMessage:T}=(0,Q.Z)(),D=t.info.displayName,N=M?.attributes??{},$=(0,se.v9)(pt.Jg),{put:P}=(0,h.kY)(),B=Object.keys(N).filter(O=>{const ee=N?.[O]?.type??"";return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(ee)&&!!ee}),U=M.layouts.edit,I=U.flatMap(O=>O.rowContent),G=Object.keys(M.attributes).filter(O=>(M?.metadatas?.[O]?.edit?.visible??!1)===!0).filter(O=>I.findIndex(ee=>ee.name===O)===-1).sort(),Z=({target:{name:O,value:ee}})=>{i({type:"ON_CHANGE",keys:O.split("."),value:ee})},q=()=>{g(O=>!O)},S=()=>{C(O=>!O)},F=({target:{name:O,value:ee}})=>{i({type:"ON_CHANGE_META",keys:O.split("."),value:ee})},R=({name:O,value:ee})=>{i({type:"ON_CHANGE_SIZE",name:O,value:ee})},X=O=>{O.preventDefault(),i({type:"SUBMIT_META_FORM"}),q()},K=O=>{O.preventDefault(),S()},Y=(0,we.useMutation)(O=>P(r?`/content-manager/content-types/${a}/configuration`:`/content-manager/components/${a}/configuration`,O),{onSuccess({data:O}){s&&s(O.data),i({type:"SUBMIT_SUCCEEDED"}),S(),m("didEditEditSettings")},onError(){p({type:"warning",message:{id:"notification.error"}})}}),{isLoading:A}=Y,j=()=>{const{layouts:O,metadatas:ee,settings:pe}=$e()(M);Y.mutate({layouts:{...O,edit:Sl(O.edit)},metadatas:ee,settings:pe})},oe=(O,ee)=>{i({type:"MOVE_RELATION",fromIndex:O,toIndex:ee})},ue=(O,ee)=>{i({type:"MOVE_FIELD",fromIndex:O,toIndex:ee})},fe=(O,ee,pe,Ie)=>{i(pe===Ie?{type:"REORDER_ROW",dragRowIndex:pe,dragIndex:O,hoverIndex:ee}:{type:"REORDER_DIFF_ROW",dragIndex:O,hoverIndex:ee,dragRowIndex:pe,hoverRowIndex:Ie})},Ee=(O,ee)=>{i({type:"MOVE_ROW",fromIndex:O,toIndex:ee})};return e.createElement(ln,{isContentTypeView:r,attributes:N,modifiedData:M,slug:a,componentLayouts:k,selectedField:L,fieldForm:W,onMoveRelation:oe,onMoveField:ue,moveRow:Ee,moveItem:fe,setEditFieldToSelect:O=>{i({type:"SET_FIELD_TO_EDIT",name:O}),q()},isDraggingSibling:d,setIsDraggingSibling:u},e.createElement(Te.o,null,e.createElement("form",{onSubmit:K},e.createElement(De.T,{title:T({id:(0,E.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${at()(D)}`},{name:at()(D)}),subtitle:T({id:(0,E.OB)("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:e.createElement(h.rU,{startIcon:e.createElement(rt.Z,null),onClick:O=>{O.preventDefault(),y()},to:"/"},T({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(le.z,{disabled:Pe()(v,M),startIcon:e.createElement(We.Z,null),type:"submit"},T({id:"global.save",defaultMessage:"Save"}))}),e.createElement(Qe.D,null,e.createElement(H.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(z.Z,{variant:"delta",as:"h2"},T({id:(0,E.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(Oe.r,null,e.createElement(ve.P,{col:6,s:12},e.createElement(Fe.P,{label:T({id:(0,E.OB)("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:T({id:(0,E.OB)("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:O=>{Z({target:{name:"settings.mainField",value:O===""?null:O}})},value:M.settings.mainField},B.map(O=>e.createElement(Ce.W,{key:O,value:O},O))))),e.createElement(H.x,{paddingTop:2,paddingBottom:2},e.createElement(Nt.i,null)),e.createElement(z.Z,{variant:"delta",as:"h3"},T({id:(0,E.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(yl,{attributes:N,editLayout:U,fields:G,onAddField:O=>{i({type:"ON_ADD_FIELD",name:O,fieldSizes:$})},onRemoveField:(O,ee)=>{i({type:"REMOVE_FIELD",rowIndex:O,fieldIndex:ee})}})))),e.createElement(h.QH,{bodyText:{id:(0,E.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(We.Z,null),isConfirmButtonLoading:A,isOpen:b,onToggleDialog:S,onConfirm:j,variantRightButton:"success-light"})),f&&e.createElement(Zl,{onSubmit:X,onToggle:q,onMetaChange:F,onSizeChange:R,type:N?.[L]?.type??"",customFieldUid:N?.[L]?.customField??""})))};xn.defaultProps={isContentTypeView:!1,updateLayout:null},xn.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 Zn=xn,zt=l(66941),Mr=l(40582);const Bl=()=>({type:Mr.c}),Nl=(t,o)=>({type:Mr.O,layout:t,query:o});var kn=l(9592),jl=l(76402),Wl=()=>(0,e.useContext)(jl.ux),Tr=t=>{const{getAdminInjectedComponents:o}=Wl(),[r,a,s]=t.split(".");return o(r,a,s)};const Dr=({area:t,...o})=>Tr(t).map(a=>e.createElement(a.Component,{key:a.name,...o}));Dr.propTypes={area:n().string.isRequired};var Vt=Dr,ze=l(84306),Xe=l(46491);const Ut=()=>({type:Xe.ZA}),Ln=t=>({type:Xe.Id,data:t}),Sn=(t,o=!1)=>({type:Xe.TP,rawQuery:t,isSingleType:o}),Or=()=>({type:Xe.c2}),Pr=(t,o)=>({type:Xe.w7,componentsDataStructure:t,contentTypeDataStructure:o}),me=t=>({type:Xe.d0,status:t}),Je=t=>({type:Xe.t9,data:t}),zl=()=>({type:Xe.tE});var An=t=>t["content-manager_editViewCrudReducer"];const Fn=({allLayoutData:t,children:o,slug:r,id:a,origin:s})=>{const c=(0,we.useQueryClient)(),i=(0,h.lm)(),{setCurrentStep:d}=(0,h.c1)(),{trackUsage:u}=(0,h.rS)(),{push:m,replace:p}=(0,re.k6)(),[{query:y,rawQuery:f}]=(0,h.Kx)(),g=(0,se.I0)(),{componentsDataStructure:b,contentTypeDataStructure:C,data:k,isLoading:v,status:M}=(0,se.v9)(An),L=(0,te.Ky)(r),{formatAPIError:W}=(0,h.So)(E.OB),T=(0,e.useRef)(!0),D=(0,e.useRef)(u),N=(0,e.useRef)(t),$=(0,h.kY)(),{put:P,post:B,del:U}=$,I=a===null,G=I&&!s?null:`/content-manager/collection-types/${r}/${s||a}`,Z=(0,e.useCallback)(A=>{const j=(0,E.kc)(A,N.current.contentType,N.current.components);return(0,h.dU)(j,N.current.contentType,N.current.components)},[]);(0,e.useEffect)(()=>{const A=Object.keys(t.components).reduce((ue,fe)=>{const Ee=(0,E.Di)(w()(t,["components",fe,"attributes"],{}),t.components);return ue[fe]=(0,h.dU)(Ee,t.components[fe],t.components),ue},{}),j=(0,E.Di)(t.contentType.attributes,t.components),oe=(0,h.dU)(j,t.contentType,t.components);g(Pr(A,oe))},[t,g]),(0,e.useEffect)(()=>()=>{g(Or())},[g]),(0,e.useEffect)(()=>{const j=ze.default.CancelToken.source(),oe=async fe=>{g(Ut());try{const{data:Ee}=await $.get(G,{cancelToken:fe.token});g(Ln(Z(Ee)))}catch(Ee){if(ze.default.isCancel(Ee))return;const O=w()(Ee,"response.status",null);if(O===404){m(L);return}O===403&&(i({type:"info",message:{id:(0,E.OB)("permissions.not-allowed.update")}}),m(L))}},ue=async()=>{g(Ut()),g(Sn(f))};return T.current?(G?oe(j):ue(),()=>{j.cancel("Operation canceled by the user.")}):()=>{}},[$,Z,m,G,g,f,L,i]);const q=(0,e.useCallback)(A=>{i({type:"warning",message:W(A)})},[i,W]),S=(0,e.useCallback)(async A=>{try{D.current("willDeleteEntry",A);const{data:j}=await U(`/content-manager/collection-types/${r}/${a}`);return i({type:"success",message:{id:(0,E.OB)("success.record.delete")}}),D.current("didDeleteEntry",A),p(L),Promise.resolve(j)}catch(j){return D.current("didNotDeleteEntry",{error:j,...A}),Promise.reject(j)}},[a,r,i,U,L,p]),F=(0,e.useCallback)(async(A,j)=>{const oe=typeof s=="string",ue=oe?`/content-manager/collection-types/${r}/clone/${s}`:`/content-manager/collection-types/${r}`;try{g(me("submit-pending"));const{id:fe,...Ee}=A,{data:O}=await B(ue,oe?Ee:A,{params:y});return D.current("didCreateEntry",j),i({type:"success",message:{id:(0,E.OB)("success.record.save")}}),d("contentManager.success"),c.invalidateQueries(["relation"]),g(Je(Z(O))),g(me("resolved")),p(`/content-manager/collectionType/${r}/${O.id}${f}`),Promise.resolve(O)}catch(fe){return q(fe),D.current("didNotCreateEntry",{error:fe,trackerProperty:j}),g(me("resolved")),Promise.reject(fe)}},[s,Z,q,p,r,g,y,i,d,c,B,f]),R=(0,e.useCallback)(async()=>{try{D.current("willCheckDraftRelations");const A=`/content-manager/collection-types/${r}/${a}/actions/countDraftRelations`;g(me("draft-relation-check-pending"));const j=await $.get(A);return D.current("didCheckDraftRelations"),g(me("resolved")),j.data.data}catch(A){return q(A),g(me("resolved")),Promise.reject(A)}},[q,a,r,g,$]),X=(0,e.useCallback)(async()=>{try{D.current("willPublishEntry");const A=`/content-manager/collection-types/${r}/${a}/actions/publish`;g(me("publish-pending"));const{data:j}=await B(A);return D.current("didPublishEntry"),g(Je(Z(j))),g(me("resolved")),i({type:"success",message:{id:(0,E.OB)("success.record.publish")}}),Promise.resolve(j)}catch(A){return q(A),g(me("resolved")),Promise.reject(A)}},[Z,q,a,r,g,i,B]),K=(0,e.useCallback)(async(A,j)=>{const oe=`/content-manager/collection-types/${r}/${a}`;try{D.current("willEditEntry",j),g(me("submit-pending"));const{data:ue}=await P(oe,A);return D.current("didEditEntry",{trackerProperty:j}),i({type:"success",message:{id:(0,E.OB)("success.record.save")}}),c.invalidateQueries(["relation"]),g(Je(Z(ue))),g(me("resolved")),Promise.resolve(ue)}catch(ue){return D.current("didNotEditEntry",{error:ue,trackerProperty:j}),q(ue),g(me("resolved")),Promise.reject(ue)}},[Z,q,r,a,g,i,c,P]),Y=(0,e.useCallback)(async()=>{const A=`/content-manager/collection-types/${r}/${a}/actions/unpublish`;g(me("unpublish-pending"));try{D.current("willUnpublishEntry");const{data:j}=await B(A);return D.current("didUnpublishEntry"),i({type:"success",message:{id:(0,E.OB)("success.record.unpublish")}}),g(Je(Z(j))),g(me("resolved")),Promise.resolve(j)}catch(j){return g(me("resolved")),q(j),Promise.reject(j)}},[Z,q,a,r,g,i,B]);return o({componentsDataStructure:b,contentTypeDataStructure:C,data:k,isCreatingEntry:I,isLoadingForData:v,onDelete:S,onPost:F,onPublish:X,onDraftRelationCheck:R,onPut:K,onUnpublish:Y,status:M,redirectionLink:L})};Fn.defaultProps={id:null,origin:null},Fn.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 Vl=(0,e.memo)(Fn,Pe()),_e=l(3685),$n=l(69783),Ir=l(86308);const wn=({hasError:t,isDisabled:o,isOpen:r,children:a,onClick:s})=>e.createElement(Ul,{type:"button",onClick:s,disabled:o,hasError:t,background:"neutral0",paddingTop:3,paddingBottom:3,paddingLeft:4,paddingRight:4,style:{cursor:o?"not-allowed":"pointer"}},e.createElement(x.k,{as:"span",gap:2},e.createElement(Bn,{"aria-hidden":!0,$isOpen:r,$hasError:t&&!r}),e.createElement(z.Z,{variant:"pi",fontWeight:"bold",textColor:t&&!r?"danger600":"neutral500"},a))),Bn=(0,V.ZP)(Ir.Z)`
83
- height: ${({theme:t})=>t.spaces[6]};
84
- width: ${({theme:t})=>t.spaces[6]};
85
- transform: ${({$isOpen:t})=>t?"rotate(45deg)":"rotate(0deg)"};
86
- > circle {
87
- fill: ${({theme:t,$hasError:o})=>o?t.colors.danger200:t.colors.neutral150};
88
- }
89
- > path {
90
- fill: ${({theme:t,$hasError:o})=>o?t.colors.danger600:t.colors.neutral600};
91
- }
92
- `,Ul=(0,V.ZP)($n.Y)`
93
- border-radius: 26px;
94
- border-color: ${({theme:t})=>t.colors.neutral150};
95
- box-shadow: ${({theme:t})=>t.shadows.filterShadow};
96
-
97
- &:hover {
98
- ${z.Z} {
99
- color: ${({theme:t})=>t.colors.primary600};
100
- }
101
-
102
- ${Bn} {
103
- > circle {
104
- fill: ${({theme:t})=>t.colors.primary600};
105
- }
106
- > path {
107
- fill: ${({theme:t})=>t.colors.neutral100};
108
- }
109
- }
110
- }
111
- &:active {
112
- ${z.Z} {
113
- color: ${({theme:t})=>t.colors.primary600};
114
- }
115
- ${Bn} {
116
- > circle {
117
- fill: ${({theme:t})=>t.colors.primary600};
118
- }
119
- > path {
120
- fill: ${({theme:t})=>t.colors.neutral100};
121
- }
122
- }
123
- }
124
- `;wn.defaultProps={hasError:!1,isDisabled:!1,isOpen:!1},wn.propTypes={children:n().node.isRequired,hasError:n().bool,isDisabled:n().bool,isOpen:n().bool,onClick:n().func.isRequired};var xr=l(861),Nn=l(83828),jn=l(61762),Wn=l(89966);const zn=({category:t,components:o,variant:r,isOpen:a,onAddComponent:s,onToggle:c})=>{const{formatMessage:i}=(0,Q.Z)(),d=()=>{c(t)};return e.createElement(Nn.U,{expanded:a,onToggle:d,size:"S"},e.createElement(jn.B,{variant:r,title:i({id:t,defaultMessage:t}),togglePosition:"left"}),e.createElement(Wn.v,null,e.createElement(H.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},e.createElement(ql,null,o.map(({componentUid:u,info:{displayName:m,icon:p}})=>e.createElement(Hl,{key:u,as:"button",type:"button",background:"neutral100",justifyContent:"center",onClick:s(u),hasRadius:!0,height:(0,h.Q1)(84),shrink:0,borderColor:"neutral200"},e.createElement(x.k,{direction:"column",gap:1,alignItems:"center",justifyContent:"center"},e.createElement(Zt,{icon:p}),e.createElement(z.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},i({id:m,defaultMessage:m})))))))))},ql=V.ZP.div`
125
- display: grid;
126
- grid-template-columns: repeat(auto-fit, ${140/16}rem);
127
- grid-gap: ${({theme:t})=>t.spaces[1]};
128
- `,Hl=(0,V.ZP)(x.k)`
129
- &:focus,
130
- &:hover {
131
- border: 1px solid ${({theme:t})=>t.colors.primary200};
132
- background: ${({theme:t})=>t.colors.primary100};
133
-
134
- ${z.Z} {
135
- color: ${({theme:t})=>t.colors.primary600};
136
- }
137
-
138
- /* > Flex > ComponentIcon */
139
- > div > div:first-child {
140
- background: ${({theme:t})=>t.colors.primary200};
141
- color: ${({theme:t})=>t.colors.primary600};
142
- }
143
- }
144
- `;zn.defaultProps={components:[],isOpen:!1,variant:"primary"},zn.propTypes={category:n().string.isRequired,components:n().array,isOpen:n().bool,onAddComponent:n().func.isRequired,onToggle:n().func.isRequired,variant:n().oneOf(["primary","secondary"])};const Vn=({dynamicComponentsByCategory:t,isOpen:o,onClickAddComponent:r})=>{const{formatMessage:a}=(0,Q.Z)(),[s,c]=(0,e.useState)("");(0,e.useEffect)(()=>{const u=Object.keys(t);o&&u.length>0&&c(u[0])},[o,t]);const i=u=>()=>{r(u),c("")},d=u=>{c(m=>m===u?"":u)};return o?e.createElement(H.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},e.createElement(x.k,{justifyContent:"center"},e.createElement(z.Z,{fontWeight:"bold",textColor:"neutral600"},a({id:(0,E.OB)("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),e.createElement(H.x,{paddingTop:2},e.createElement(xr.k,{attributeName:"data-strapi-accordion-toggle"},Object.entries(t).map(([u,m],p)=>e.createElement(zn,{key:u,category:u,components:m,onAddComponent:i,isOpen:u===s,onToggle:d,variant:p%2===1?"primary":"secondary"}))))):null};Vn.defaultProps={dynamicComponentsByCategory:{},isOpen:!1},Vn.propTypes={dynamicComponentsByCategory:n().shape({components:n().arrayOf(n().shape({componentUid:n().string.isRequired,info:n().object}))}),isOpen:n().bool,onClickAddComponent:n().func.isRequired};var Zr=l(91647),Un=l(49825),Gl=l(61868),Ql=l.n(Gl);const Kl=V.ZP.span`
145
- > svg {
146
- width: ${(0,h.Q1)(24)};
147
- height: ${(0,h.Q1)(24)};
148
- > circle {
149
- fill: ${({theme:t})=>t.colors.primary200};
150
- }
151
- > path {
152
- fill: ${({theme:t})=>t.colors.primary600};
153
- }
154
- }
155
- `,qn=({error:t,isReadOnly:o,onClick:r})=>{const{formatMessage:a}=(0,Q.Z)();return e.createElement(e.Fragment,null,e.createElement(H.x,{as:"button",background:"neutral100",borderColor:t?"danger600":"neutral200",disabled:o,hasRadius:!0,onClick:r,paddingTop:9,paddingBottom:9,type:"button"},e.createElement(x.k,{direction:"column",gap:2},e.createElement(x.k,{justifyContent:"center",style:{cursor:o?"not-allowed":"inherit"}},e.createElement(Kl,null,e.createElement(Ir.Z,null))),e.createElement(x.k,{justifyContent:"center"},e.createElement(z.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},a({id:(0,E.OB)("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),t?.id&&e.createElement(z.Z,{textColor:"danger600",variant:"pi"},a(t,{...t.values})))};qn.defaultProps={error:void 0,isReadOnly:!1},qn.propTypes={error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),isReadOnly:n().bool,onClick:n().func.isRequired};var kr=qn;const St=new Map;var Hn=(t=[])=>{const[o,r]=(0,e.useState)(Object.fromEntries(St)),a=t.filter(u=>!St.get(u)),[s,c]=(0,e.useState)(()=>!!a.length),i=(0,h.mZ)();(0,e.useEffect)(()=>{const u=p=>{r(p),c(!1)},m=async(p,y)=>{const f=await Promise.all(y);p.forEach((g,b)=>{St.set(g,f[b].default)}),u(Object.fromEntries(St))};if(a.length>0){c(!0);const p=a.reduce((y,f)=>{const g=i.get(f);return g&&y.push(g.components.Input()),y},[]);p.length>0&&m(a,p)}},[a,i]);const d=(0,e.useCallback)(()=>{St.clear(),r({})},[]);return{isLazyLoading:s,lazyComponentStore:o,cleanup:d}},Yl=l(9086),Xl=l.n(Yl),Jl=l(88708),At=l.n(Jl),Gn=l(38705),Ft=l(69932),_l=l(27169),Lr=l(99097),ec=l(63642);const tc=(0,V.ZP)(ec.E)`
156
- svg {
157
- height: 1rem;
158
- width: 1rem;
159
- path {
160
- fill: ${({theme:t})=>t.colors.neutral400};
161
- }
162
- }
163
-
164
- svg:hover {
165
- path {
166
- fill: ${({theme:t})=>t.colors.primary600};
167
- }
168
- }
169
- `,Sr=(0,V.ZP)(x.k)`
170
- svg {
171
- height: ${12/16}rem;
172
- width: ${12/16}rem;
173
-
174
- path {
175
- fill: ${({theme:t,available:o})=>o?t.colors.success600:t.colors.danger600};
176
- }
177
- }
178
- `,nc=(0,V.F4)`
179
- from {
180
- transform: rotate(0deg);
181
- }
182
- to {
183
- transform: rotate(359deg);
184
- }
185
- `,oc=(0,V.ZP)(x.k)`
186
- animation: ${nc} 2s infinite linear;
187
- `;var rc=/^[A-Za-z0-9-_.~]*$/;const Qn=({attribute:t,contentTypeUID:o,hint:r,disabled:a,error:s,intlLabel:c,labelAction:i,name:d,onChange:u,value:m,placeholder:p,required:y})=>{const{modifiedData:f,initialData:g,layout:b}=(0,h.Wq)(),[C,k]=(0,e.useState)(!1),[v,M]=(0,e.useState)(null),L=(0,Lr.Z)(m,300),W=(0,e.useRef)(),T=(0,h.lm)(),{formatAPIError:D}=(0,h.So)(),N=g[d],{formatMessage:$}=(0,Q.Z)(),P=b?.options?.timestamps??0,B=!g[P],U=(0,Lr.Z)(f[t.targetField],300),[I,G]=(0,e.useState)(!1),[Z,q]=(0,e.useState)(null),{post:S}=(0,h.kY)(),F=c.id?$({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):d,R=p?$({id:p.id,defaultMessage:p.defaultMessage},{...p.values}):"";W.current=async(j=!1)=>{k(!0);try{const{data:{data:oe}}=await S("/content-manager/uid/generate",{contentTypeUID:o,field:d,data:f});u({target:{name:d,value:oe,type:"text"}},j),k(!1)}catch(oe){k(!1),T({type:"warning",message:D(oe)})}};const X=async()=>{if(m){k(!0);try{const{data:j}=await S("/content-manager/uid/check-availability",{contentTypeUID:o,field:d,value:m?m.trim():""});k(!1),M(j)}catch(j){k(!1),T({type:"warning",message:D(j)})}}};(0,e.useEffect)(()=>{!m&&t.required&&W.current(!0)},[t.required,W,m]),(0,e.useEffect)(()=>{L?.trim().match(rc)&&L!==N&&X(),L||M(null)},[N,L]),(0,e.useEffect)(()=>{let j;return v?.isAvailable&&(j=setTimeout(()=>{M(null)},4e3)),()=>{j&&clearTimeout(j)}},[v]),(0,e.useEffect)(()=>{!I&&B&&U&&f[t.targetField]&&!m&&W.current(!0)},[U,I,B]);const K=()=>{q($({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},Y=()=>{q(null)},A=j=>{j.target.value&&B&&G(!0),u(j)};return e.createElement(Mn.o,{disabled:a,error:s,endAction:e.createElement(x.k,{position:"relative",gap:1},v&&!Z&&e.createElement(Sr,{alignItems:"center",gap:1,justifyContent:"flex-end",available:!!v?.isAvailable,"data-not-here-outer":!0,position:"absolute",pointerEvents:"none",right:6,width:"100px"},v?.isAvailable?e.createElement(Gn.Z,null):e.createElement(Ft.Z,null),e.createElement(z.Z,{textColor:v.isAvailable?"success600":"danger600",variant:"pi"},$(v.isAvailable?{id:"content-manager.components.uid.available",defaultMessage:"Available"}:{id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),!a&&e.createElement(e.Fragment,null,Z&&e.createElement(Sr,{alignItems:"center",justifyContent:"flex-end",gap:1},e.createElement(z.Z,{textColor:"primary600",variant:"pi"},Z)),e.createElement(tc,{onClick:()=>W.current(),label:$({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}),onMouseEnter:K,onMouseLeave:Y},C?e.createElement(oc,{"data-testid":"loading-wrapper"},e.createElement(_l.Z,null)):e.createElement(mn.Z,null)))),hint:r,label:F,labelAction:i,name:d,onChange:A,placeholder:R,value:m||"",required:y})};Qn.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])},Qn.defaultProps={disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1,hint:""};var ac=Qn,sc=l(88423),ic=l.n(sc);function lc(t,o){return r=>{const a=o(r);return e.createElement(t,{...r,...a})}}var cc=lc;const dc=(t=[],o=[])=>{const r=t.reduce((s,c)=>o.find(i=>i.id===c.id)?s:[...s,c.id],[]),a=o.reduce((s,c)=>t.find(i=>i.id===c.id)?s:[...s,c.id],[]);return[r,a]},it={DRAFT:"draft",PUBLISHED:"published"},Kn=5,uc=10;function mc(t,o){return`/content-manager/collectionType/${t}/${o??""}`}const Yn=(t,{shouldAddLink:o,mainFieldName:r,targetModel:a})=>{const s={...t};return o&&(s.href=mc(a,s.id)),s.publicationState=!1,s?.publishedAt!==void 0&&(s.publicationState=s.publishedAt?it.PUBLISHED:it.DRAFT),s.mainField=s[r],s},pc=(t,{shouldAddLink:o=!1,mainFieldName:r,targetModel:a}={})=>[...t].map(s=>Yn(s,{shouldAddLink:o,mainFieldName:r,targetModel:a})),gc=(t,{mainFieldName:o})=>{const{data:r}=t,{pages:a=[]}=r??{};return{...t,data:a.map(s=>s?.results.map(c=>Yn(c,{mainFieldName:o}))).filter(Boolean).flat()}};function fc({componentUid:t,isUserAllowedToEditField:o,isUserAllowedToReadField:r,name:a,queryInfos:s}){const{isCreatingEntry:c,createActionAllowedFields:i,readActionAllowedFields:d,updateActionAllowedFields:u,slug:m,modifiedData:p}=(0,h.Wq)(),{params:y}=(0,re.$B)("/content-manager/collectionType/:collectionType/create/clone/:origin")??{},{origin:f}=y??{},g=(0,e.useMemo)(()=>o===!0?!0:(c?i:u).includes(a),[c,i,a,o,u]),b=(0,e.useMemo)(()=>r?!0:(c?[]:d).includes(a),[c,r,a,d]),C=a.split(".");let k;t&&(k=w()(p,C.slice(0,-1))?.id);const v=f||p.id,M=(0,e.useMemo)(()=>c&&!f?null:t?k?`/content-manager/relations/${t}/${k}/${C.at(-1)}`:null:`/content-manager/relations/${m}/${v}/${a.split(".").at(-1)}`,[c,f,t,m,v,a,k,C]),L=(0,e.useMemo)(()=>t?`/content-manager/relations/${t}/${a.split(".").at(-1)}`:`/content-manager/relations/${m}/${a.split(".").at(-1)}`,[t,m,a]);return{entityId:v,componentId:k,isComponentRelation:Boolean(t),queryInfos:{...s,endpoints:{search:L,relation:M}},isCloningEntry:Boolean(f),isCreatingEntry:c,isFieldAllowed:g,isFieldReadable:b}}var hc=fc;const yc=(t,{relation:o,search:r})=>{const[a,s]=(0,e.useState)({}),[c,i]=(0,e.useState)(0),{get:d}=(0,h.kY)(),u=async({pageParam:T=1})=>{try{const{data:D}=await d(o?.endpoint,{params:{...o.pageParams??{},page:T}});return i(T),D}catch{return null}},m=async({pageParam:T=1})=>{try{const{data:D}=await d(r.endpoint,{params:{...r.pageParams??{},...a,page:T}});return D}catch{return null}},{onLoad:p,normalizeArguments:y={}}=o,f=(0,we.useInfiniteQuery)(["relation",...t],u,{cacheTime:0,enabled:o.enabled,getNextPageParam(T){const D=!T?.pagination;if(!(!T||D||T?.pagination.page>=T?.pagination.pageCount))return T.pagination.page+1},select:T=>({...T,pages:T.pages.map(D=>{if(!D)return D;const{data:N,results:$,pagination:P}=D,B=!!N;let U=[];return B?U=[N]:$&&(U=[...$].reverse()),{pagination:P,results:U}})})}),{pageGoal:g}=o,{status:b,data:C,fetchNextPage:k,hasNextPage:v}=f;(0,e.useEffect)(()=>{g>c&&v&&b==="success"&&k({pageParam:c+1})},[g,c,k,v,b]);const M=(0,h.W6)(p);(0,e.useEffect)(()=>{if(b==="success"&&C&&C.pages?.at(-1)?.results&&M){const T=pc(C.pages.at(-1).results,y);M(T)}},[b,M,C]);const L=(0,we.useInfiniteQuery)(["relation",...t,"search",JSON.stringify(a)],m,{enabled:Object.keys(a).length>0,getNextPageParam(T){if(!(!T?.pagination||T.pagination.page>=T.pagination.pageCount))return T.pagination.page+1}});return{relations:f,search:L,searchFor:(T,D={})=>{s({...D,_q:T})}}},Ar=(t,o)=>r=>{const a=r.split(".");return a.reduce((s,c,i)=>{const d=w()(t,s),u=w()(o,[...a.slice(0,i),c,"__temp_key__"]);if(Array.isArray(d)&&typeof u=="number"){const m=d.findIndex(p=>p.__temp_key__===u);return s.push(m.toString()),s}return s.push(c),s},[])};var Ec=l(50428),bc=l(21428),Fr=l(7563),$t=l(63919),Xn=l(41234),qt=l(35331),vc=l(41044),$r=l(90333);const Cc=V.ZP.div`
188
- flex-shrink: 0;
189
- width: ${(0,h.Q1)(6)};
190
- height: ${(0,h.Q1)(6)};
191
- margin-right: ${({theme:t})=>t.spaces[2]};
192
- background-color: ${({theme:t,isDraft:o})=>t.colors[o?"secondary600":"success600"]};
193
- border-radius: 50%;
194
- `,Jn=({publicationState:t,mainField:o,id:r})=>{const{formatMessage:a}=(0,Q.Z)(),s=(o??r).toString();if(t){const c=t==="draft",i={id:(0,E.OB)("components.Select.draft-info-title"),defaultMessage:"State: Draft"},d={id:(0,E.OB)("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=a(c?i:d);return e.createElement($r.O,{value:r,textValue:s},e.createElement(x.k,null,e.createElement(Cc,{title:u,isDraft:c}),e.createElement(z.Z,{ellipsis:!0},s)))}return e.createElement($r.O,{value:r,textValue:s},s)};Jn.defaultProps={mainField:void 0,publicationState:void 0},Jn.propTypes={id:n().number.isRequired,mainField:n().oneOfType([n().string,n().number]),publicationState:n().oneOfType([n().string,n().bool])};var wr=l(77622);const Ht=50,Et=4,Br=(0,V.ZP)(x.k)`
195
- width: 100%;
196
- /* Used to prevent endAction to be pushed out of container */
197
- min-width: 0;
198
-
199
- & > div[role='button'] {
200
- cursor: all-scroll;
201
- }
202
- `,Nr=(0,V.ZP)(x.k)`
203
- width: 100%;
204
- /* Used to prevent endAction to be pushed out of container */
205
- min-width: 0;
206
- `,_n=({ariaDescribedBy:t,children:o,displayValue:r,canDrag:a,disabled:s,endAction:c,iconButtonAriaLabel:i,style:d,id:u,index:m,name:p,onCancel:y,onDropItem:f,onGrabItem:g,status:b,updatePositionOfRelation:C,...k})=>{const[{handlerId:v,isDragging:M,handleKeyDown:L},W,T,D,N]=(0,wr.Y)(a&&!s,{type:`${E._Q.RELATION}_${p}`,index:m,item:{displayedValue:r,status:b,id:u},onGrabItem:g,onDropItem:f,onCancel:y,onMoveItem:C,dropSensitivity:"immediate"}),$=(0,E.FE)(W,D);return(0,e.useEffect)(()=>{N((0,xt.rX)())},[N]),e.createElement(H.x,{style:d,as:"li",ref:T,"aria-describedby":t,cursor:a?"all-scroll":"default"},M?e.createElement(Rc,null):e.createElement(x.k,{paddingTop:2,paddingBottom:2,paddingLeft:a?2:4,paddingRight:4,hasRadius:!0,borderSize:1,borderColor:"neutral200",background:s?"neutral150":"neutral0",justifyContent:"space-between",ref:a?$:void 0,"data-handler-id":v,...k},e.createElement(Br,{gap:1},a?e.createElement(Re.h,{forwardedAs:"div",role:"button",tabIndex:0,"aria-label":i,noBorder:!0,onKeyDown:L,disabled:s},e.createElement(Ye.Z,null)):null,e.createElement(Nr,{justifyContent:"space-between"},o)),c&&e.createElement(H.x,{paddingLeft:4},c)))},Rc=()=>e.createElement(H.x,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",background:"primary100",height:`calc(100% - ${Et}px)`});_n.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},_n.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 Mc=(0,V.ZP)(H.x)`
207
- position: relative;
208
- overflow: hidden;
209
- flex: 1;
210
-
211
- &:before,
212
- &:after {
213
- position: absolute;
214
- width: 100%;
215
- height: 4px;
216
- z-index: 1;
217
- }
218
-
219
- &:before {
220
- /* TODO: as for DS Table component we would need this to be handled by the DS theme */
221
- content: '';
222
- background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
223
- top: 0;
224
- opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="top"?1:0};
225
- transition: opacity 0.2s ease-in-out;
226
- }
227
-
228
- &:after {
229
- /* TODO: as for DS Table component we would need this to be handled by the DS theme */
230
- content: '';
231
- background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
232
- bottom: 0;
233
- opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="bottom"?1:0};
234
- transition: opacity 0.2s ease-in-out;
235
- }
236
- `,eo=({children:t,overflow:o,...r})=>e.createElement(Mc,{overflowDirection:o,...r},t);eo.defaultProps={overflow:""},eo.propTypes={children:n().node.isRequired,overflow:n().oneOf(["top-bottom","bottom","top",""])};const jr=(0,V.ZP)(Ec.r)`
237
- display: block;
238
-
239
- > span {
240
- white-space: nowrap;
241
- overflow: hidden;
242
- text-overflow: ellipsis;
243
- display: block;
244
- }
245
- `,Wr=V.ZP.button`
246
- svg path {
247
- fill: ${({theme:t,disabled:o})=>o?t.colors.neutral600:t.colors.neutral500};
248
- }
249
-
250
- &:hover svg path,
251
- &:focus svg path {
252
- fill: ${({theme:t,disabled:o})=>!o&&t.colors.neutral600};
253
- }
254
- `,to=({canReorder:t,description:o,disabled:r,error:a,iconButtonAriaLabel:s,id:c,name:i,numberOfRelationsToDisplay:d,label:u,labelAction:m,labelLoadMore:p,labelDisconnectRelation:y,listAriaDescription:f,liveText:g,loadingMessage:b,onCancel:C,onDropItem:k,onGrabItem:v,noRelationsMessage:M,onRelationConnect:L,onRelationLoadMore:W,onRelationDisconnect:T,onRelationReorder:D,onSearchNextPage:N,onSearch:$,placeholder:P,publicationStateTranslations:B,required:U,relations:I,searchResults:G,size:Z})=>{const[q,S]=(0,e.useState)(""),[F,R]=(0,e.useState)(""),X=(0,e.useRef)(),K=(0,e.useRef)(),{data:Y}=G,A=I.data,j=A.length??0,oe=(0,e.useMemo)(()=>j>d?Math.min(j,d)*(Ht+Et)+Ht/2:Math.min(j,d)*(Ht+Et),[j,d]),ue=!!p&&I.hasNextPage,fe=(0,e.useMemo)(()=>Y.flat().filter(Boolean).map(ce=>({...ce,value:ce.id,label:ce.mainField})),[Y]);(0,e.useEffect)(()=>{if(j<=d)return R("");const ce=Ne=>{const Ze=Ne.target.parentNode.scrollHeight,He=Ne.target.scrollHeight-Ne.target.scrollTop;return Ne.target.scrollTop===0?R("bottom"):R(He===Ze?"top":"top-bottom")},xe=K?.current;return!I.isLoading&&A.length>0&&xe&&K.current.addEventListener("scroll",ce),()=>{xe&&xe.removeEventListener("scroll",ce)}},[I,A,d,j]);const Ee=ce=>{ce&&$()},O=(ce,xe)=>{D&&ce>=0&&ce<A.length&&D(xe,ce)},ee=(0,te.zH)(A.length),pe=(0,e.useRef)(),Ie=()=>{pe.current="loadMore",W()};(0,e.useEffect)(()=>{pe.current==="onChange"&&S(""),pe.current==="onChange"&&A.length!==ee?(X.current.scrollToItem(A.length,"end"),pe.current=void 0):pe.current==="loadMore"&&A.length!==ee&&(X.current.scrollToItem(0,"start"),pe.current=void 0)},[ee,A]);const Ue=`${i}-item-instructions`;return e.createElement(x.k,{gap:3,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},e.createElement(x.k,{direction:"column",alignItems:"stretch",basis:Z<=6?"100%":"70%",gap:2},e.createElement(bc.hQ,{autocomplete:"list",error:a,name:i,hint:o,id:c,required:U,label:u,labelAction:m,disabled:r,placeholder:P,hasMoreItems:G.hasNextPage,loading:G.isLoading,onOpenChange:Ee,noOptionsMessage:()=>M,loadingMessage:b,onLoadMore:()=>{N()},textValue:q,onChange:ce=>{ce&&(L(fe.find(xe=>xe.id===ce)),pe.current="onChange")},onTextValueChange:ce=>{S(ce)},onInputChange:ce=>{$(ce.currentTarget.value)}},fe.map(ce=>e.createElement(Jn,{key:ce.id,...ce}))),ue&&e.createElement(Fr.A,{disabled:I.isLoading||I.isFetchingNextPage,onClick:Ie,loading:I.isLoading||I.isFetchingNextPage,startIcon:e.createElement(mn.Z,null)},p)),A.length>0&&e.createElement(eo,{overflow:F},e.createElement(_e.T,{id:Ue},f),e.createElement(_e.T,{"aria-live":"assertive"},g),e.createElement(vc.t7,{height:oe,ref:X,outerRef:K,itemCount:j,itemSize:Ht+Et,itemData:{name:i,ariaDescribedBy:Ue,canDrag:t,disabled:r,handleCancel:C,handleDropItem:k,handleGrabItem:v,iconButtonAriaLabel:s,labelDisconnectRelation:y,onRelationDisconnect:T,publicationStateTranslations:B,relations:A,updatePositionOfRelation:O},itemKey:ce=>`${A[ce].mainField}_${A[ce].id}`,innerElementType:"ol"},no)))},Tc=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}),Dc=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});to.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:[]}},to.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:Dc,size:n().number.isRequired,relations:Tc};const no=({data:t,index:o,style:r})=>{const{ariaDescribedBy:a,canDrag:s,disabled:c,handleCancel:i,handleDropItem:d,handleGrabItem:u,iconButtonAriaLabel:m,name:p,labelDisconnectRelation:y,onRelationDisconnect:f,publicationStateTranslations:g,relations:b,updatePositionOfRelation:C}=t,{publicationState:k,href:v,mainField:M,id:L}=b[o],W=k==="draft"?"secondary":"success";return e.createElement(_n,{ariaDescribedBy:a,canDrag:s,disabled:c,displayValue:String(M??L),iconButtonAriaLabel:m,id:L,index:o,name:p,endAction:e.createElement(Wr,{"data-testid":`remove-relation-${L}`,disabled:c,type:"button",onClick:()=>f(b[o]),"aria-label":y},e.createElement(ht.J,{width:"12px",as:qt.Z})),onCancel:i,onDropItem:d,onGrabItem:u,status:k||void 0,style:{...r,bottom:r.bottom??0+Et,height:r.height??0-Et},updatePositionOfRelation:C},e.createElement(H.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement($t.u,{description:M??`${L}`},v?e.createElement(jr,{to:v},M??L):e.createElement(z.Z,{textColor:c?"neutral600":"primary600",ellipsis:!0},M??L))),k&&e.createElement(Xn.q,{variant:W,showBullet:!1,size:"S"},e.createElement(z.Z,{fontWeight:"bold",textColor:`${W}700`},g[k])))};no.defaultProps={data:{}},no.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 Oc=to;const oo=({error:t,entityId:o,componentId:r,isComponentRelation:a,editable:s,description:c,intlLabel:i,isCreatingEntry:d,isCloningEntry:u,isFieldAllowed:m,isFieldReadable:p,labelAction:y,mainField:f,name:g,queryInfos:{endpoints:b,defaultParams:C,shouldDisplayRelationLink:k},placeholder:v,required:M,relationType:L,size:W,targetModel:T})=>{const[D,N]=(0,e.useState)(""),{formatMessage:$}=(0,Q.Z)(),{slug:P,initialData:B,modifiedData:U,relationConnect:I,relationDisconnect:G,relationLoad:Z,relationReorder:q}=(0,h.Wq)(),S=g.split("."),F=Ar(B,U)(g),R=w()(U,g,[]),X=Math.ceil(w()(B,g,[]).length/Kn),{relations:K,search:Y,searchFor:A}=yc([P,F.join("."),U.id,C],{relation:{enabled:!!b.relation,endpoint:b.relation,pageGoal:X,pageParams:{...C,pageSize:Kn},onLoad(he){Z({target:{initialDataPath:["initialData",...F],modifiedDataPath:["modifiedData",...S],value:he}})},normalizeArguments:{mainFieldName:f.name,shouldAddLink:k,targetModel:T}},search:{endpoint:b.search,pageParams:{...C,entityId:d||u?void 0:a?r:o,pageSize:uc}}}),j=(0,e.useMemo)(()=>L.toLowerCase().includes("morph"),[L]),oe=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(L),ue=(0,e.useMemo)(()=>j?!0:d?!s:!m&&p||!s,[j,d,s,m,p]),fe=he=>{const Me=Yn(he,{mainFieldName:f.name,shouldAddLink:k,targetModel:T});I({name:g,value:Me,toOneRelation:oe})},Ee=he=>{G({name:g,id:he.id})},O=()=>{K.fetchNextPage()},ee=(he="")=>{const[Me,et]=dc(R,w()(B,g));A(he,{idsToInclude:et,idsToOmit:Me})},pe=()=>{Y.fetchNextPage()},Ie=he=>`${he+1} of ${R.length}`,Ue=(he,Me)=>{const et=R[he];N($({id:(0,E.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:et.mainField??et.id,position:Ie(Me)})),q({name:g,newIndex:Me,oldIndex:he})},ce=he=>{const Me=R[he];N($({id:(0,E.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:Me.mainField??Me.id,position:Ie(he)}))},xe=he=>{const Me=R[he];N($({id:(0,E.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:Me.mainField??Me.id,position:Ie(he)}))},Ne=he=>{const Me=R[he];N($({id:(0,E.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:Me.mainField??Me.id}))};if(!m&&d||!d&&!m&&!p)return e.createElement(h.X0,{name:g,intlLabel:i,labelAction:y});const Ze=R.length,He=(w()(B,F)??[]).length,Mt=K.data?.pages[0]?.pagination?.total??0,lt=!K.data&&Ze===He?Ze:Ze-He+Mt;return e.createElement(Oc,{error:t,canReorder:!oe,description:c,disabled:ue,iconButtonAriaLabel:$({id:(0,E.OB)("components.RelationInput.icon-button-aria-label"),defaultMessage:"Drag"}),id:g,label:`${$({id:i.id,defaultMessage:i.defaultMessage})} ${lt>0?`(${lt})`:""}`,labelAction:y,labelLoadMore:!d||u?$({id:(0,E.OB)("relation.loadMore"),defaultMessage:"Load More"}):null,labelDisconnectRelation:$({id:(0,E.OB)("relation.disconnect"),defaultMessage:"Remove"}),listAriaDescription:$({id:(0,E.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"}),listHeight:320,liveText:D,loadingMessage:$({id:(0,E.OB)("relation.isLoading"),defaultMessage:"Relations are loading"}),name:g,noRelationsMessage:$({id:(0,E.OB)("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:Kn,onDropItem:xe,onGrabItem:ce,onCancel:Ne,onRelationConnect:fe,onRelationDisconnect:Ee,onRelationLoadMore:O,onRelationReorder:Ue,onSearch:he=>ee(he),onSearchNextPage:()=>pe(),placeholder:$(v||{id:(0,E.OB)("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[it.DRAFT]:$({id:(0,E.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[it.PUBLISHED]:$({id:(0,E.OB)("relation.publicationState.published"),defaultMessage:"Published"})},relations:ic()({...K,data:R},"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:M,searchResults:gc(Y,{mainFieldName:f.name}),size:W})};oo.defaultProps={componentId:void 0,entityId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},oo.propTypes={componentId:n().number,entityId: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,isCloningEntry:n().bool.isRequired,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 Pc=(0,e.memo)(oo);var Ic=cc(Pc,hc);const ro=({id:t,error:o,name:r,hint:a})=>a.length===0||o?null:e.createElement(z.Z,{as:"p",variant:"pi",id:`${t||r}-hint`,textColor:"neutral600"},a);ro.defaultProps={id:void 0,error:void 0,hint:""},ro.propTypes={hint:n().oneOfType([n().string,n().array]),error:n().string,id:n().string,name:n().string.isRequired};var xc=ro,Zc=l(87702),ao=l.n(Zc),so=l(59845),kc=l(88591),Lc=l.n(kc),Sc=l(20871),Ac=l.n(Sc),Fc=l(48375),zr=l.n(Fc),$c=l(31089),wc=l.n($c),Bc=l(16043),Nc=l.n(Bc),jc=l(5109),Wc=l.n(jc),zc=l(47955),Vc=l.n(zc),Uc=l(95706),qc=l.n(Uc),Hc=l(6658),Gc=l.n(Hc),Qc=l(36407),Kc=l.n(Qc);(async()=>{await l.e(7347).then(l.bind(l,74194))})();const bt=new(Lc())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(t,o){if(o&&o!=="auto"&&(0,so.getLanguage)(o))return'<pre class="hljs language-'+bt.utils.escapeHtml(o.toLowerCase())+'"><code>'+(0,so.highlight)(o,t,!0).value+"</code></pre>";if(o==="auto"){const r=(0,so.highlightAuto)(t);return'<pre class="hljs language-'+bt.utils.escapeHtml(r.language)+'"><code>'+r.value+"</code></pre>"}return'<pre class="hljs"><code>'+bt.utils.escapeHtml(t)+"</code></pre>"}}).use(Ac()).use(zr(),"warning").use(zr(),"tip").use(wc()).use(Nc()).use(Wc()).use(Vc()).use(qc()).use(Gc()).use(Kc());bt.renderer.rules.footnote_ref=(t,o,r,a,s)=>'<sup class="footnote-ref"><span>'+s.rules.footnote_caption(t,o,r,a,s)+"</span></sup>",bt.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';var Yc=bt,Xc=l(13993),Vr=l.n(Xc);const Jc={...Vr().defaults,allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}};var _c=t=>Vr()(t,Jc),ed=V.ZP.div`
255
- position: absolute;
256
- top: 0;
257
- width: 100%;
258
- height: 100%;
259
- overflow: auto;
260
- padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
261
- font-size: ${14/16}rem;
262
- background-color: ${({theme:t})=>t.colors.neutral0};
263
- color: ${({theme:t})=>t.colors.neutral800};
264
- line-height: ${({theme:t})=>t.lineHeights[6]};
265
-
266
- h1,
267
- h2,
268
- h3,
269
- h4,
270
- h5,
271
- h6 {
272
- margin-block-start: ${({theme:t})=>t.spaces[2]};
273
- margin-block-end: ${({theme:t})=>t.spaces[2]};
274
- }
275
-
276
- p {
277
- margin-bottom: ${({theme:t})=>t.spaces[2]};
278
- }
279
-
280
- h1 {
281
- font-size: ${36/16}rem;
282
- font-weight: 600;
283
- }
284
-
285
- h2 {
286
- font-size: ${30/16}rem;
287
- font-weight: 500;
288
- }
289
-
290
- h3 {
291
- font-size: ${24/16}rem;
292
- font-weight: 500;
293
- }
294
-
295
- h4 {
296
- font-size: ${20/16}rem;
297
- font-weight: 500;
298
- }
299
-
300
- strong {
301
- font-weight: 800;
302
- }
303
-
304
- em {
305
- font-style: italic;
306
- }
307
-
308
- blockquote {
309
- margin-top: ${({theme:t})=>t.spaces[8]};
310
- margin-bottom: ${({theme:t})=>t.spaces[7]};
311
- font-size: ${14/16}rem;
312
- font-weight: 400;
313
- border-left: 4px solid ${({theme:t})=>t.colors.neutral150};
314
- font-style: italic;
315
- padding: ${({theme:t})=>t.spaces[2]} ${({theme:t})=>t.spaces[5]};
316
- }
317
-
318
- img {
319
- max-width: 100%;
320
- }
321
-
322
- table {
323
- thead {
324
- background: ${({theme:t})=>t.colors.neutral150};
325
-
326
- th {
327
- padding: ${({theme:t})=>t.spaces[4]};
328
- }
329
- }
330
- tr {
331
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
332
- }
333
- th,
334
- td {
335
- padding: ${({theme:t})=>t.spaces[4]};
336
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
337
- border-bottom: 0;
338
- border-top: 0;
339
- }
340
- }
341
-
342
- pre,
343
- code {
344
- font-size: ${14/16}rem;
345
- border-radius: 4px;
346
- /*
347
- Hard coded since the color is the same between themes,
348
- theme.colors.neutral800 changes between themes.
349
-
350
- Matches the color of the JSON Input component.
351
- */
352
- background-color: #32324d;
353
- max-width: 100%;
354
- overflow: auto;
355
- padding: ${({theme:t})=>t.spaces[2]};
356
- }
357
-
358
- /* Inline code */
359
- p,
360
- pre,
361
- td {
362
- > code {
363
- color: #839496;
364
- }
365
- }
366
-
367
- ol {
368
- list-style-type: decimal;
369
- margin-block-start: ${({theme:t})=>t.spaces[4]};
370
- margin-block-end: ${({theme:t})=>t.spaces[4]};
371
- margin-inline-start: 0px;
372
- margin-inline-end: 0px;
373
- padding-inline-start: ${({theme:t})=>t.spaces[4]};
374
-
375
- ol,
376
- ul {
377
- margin-block-start: 0px;
378
- margin-block-end: 0px;
379
- }
380
- }
381
-
382
- ul {
383
- list-style-type: disc;
384
- margin-block-start: ${({theme:t})=>t.spaces[4]};
385
- margin-block-end: ${({theme:t})=>t.spaces[4]};
386
- margin-inline-start: 0px;
387
- margin-inline-end: 0px;
388
- padding-inline-start: ${({theme:t})=>t.spaces[4]};
389
-
390
- ul,
391
- ol {
392
- margin-block-start: 0px;
393
- margin-block-end: 0px;
394
- }
395
- }
396
- `;const io=({data:t})=>{const o=(0,e.useMemo)(()=>_c(Yc.render(t.replaceAll("\\n",`
397
- `)||"")),[t]);return e.createElement(ed,null,e.createElement("div",{dangerouslySetInnerHTML:{__html:o}}))};io.defaultProps={data:""},io.propTypes={data:n().string};var Ur=(0,e.memo)(io);const td=V.ZP.div`
398
- cursor: ${({disabled:t})=>t?"not-allowed !important":"auto"};
399
- height: 100%;
400
- /* BASICS */
401
- .CodeMirror-placeholder {
402
- color: ${({theme:t})=>t.colors.neutral600} !important;
403
- }
404
-
405
- .CodeMirror {
406
- /* Set height, width, borders, and global font properties here */
407
- font-size: ${14/16}rem;
408
- height: ${({isExpandMode:t})=>t?"100%":"290px"};
409
- color: ${({theme:t})=>t.colors.neutral800};
410
- direction: ltr;
411
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
412
- 'Open Sans', 'Helvetica Neue', sans-serif;
413
- }
414
-
415
- /* PADDING */
416
-
417
- .CodeMirror-lines {
418
- padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
419
- /* Vertical padding around content */
420
- }
421
-
422
- .CodeMirror-scrollbar-filler,
423
- .CodeMirror-gutter-filler {
424
- /* The little square between H and V scrollbars */
425
- background-color: ${({theme:t})=>`${t.colors.neutral0}`};
426
- }
427
-
428
- /* GUTTER */
429
-
430
- .CodeMirror-gutters {
431
- border-right: 1px solid #ddd;
432
- background-color: #f7f7f7;
433
- white-space: nowrap;
434
- }
435
- .CodeMirror-linenumbers {
436
- }
437
- .CodeMirror-linenumber {
438
- padding: 0 3px 0 5px;
439
- min-width: 20px;
440
- text-align: right;
441
- color: #999;
442
- white-space: nowrap;
443
- }
444
-
445
- .CodeMirror-guttermarker {
446
- color: black;
447
- }
448
- .CodeMirror-guttermarker-subtle {
449
- color: #999;
450
- }
451
-
452
- /* CURSOR */
453
-
454
- .CodeMirror-cursor {
455
- border-left: 1px solid black;
456
- border-right: none;
457
- width: 0;
458
- }
459
- /* Shown when moving in bi-directional text */
460
- .CodeMirror div.CodeMirror-secondarycursor {
461
- border-left: 1px solid silver;
462
- }
463
- .cm-fat-cursor .CodeMirror-cursor {
464
- width: auto;
465
- border: 0 !important;
466
- background: #7e7;
467
- }
468
- .cm-fat-cursor div.CodeMirror-cursors {
469
- /* z-index: 1; */
470
- }
471
-
472
- .cm-fat-cursor-mark {
473
- background-color: rgba(20, 255, 20, 0.5);
474
- -webkit-animation: blink 1.06s steps(1) infinite;
475
- -moz-animation: blink 1.06s steps(1) infinite;
476
- animation: blink 1.06s steps(1) infinite;
477
- }
478
- .cm-animate-fat-cursor {
479
- width: auto;
480
- border: 0;
481
- -webkit-animation: blink 1.06s steps(1) infinite;
482
- -moz-animation: blink 1.06s steps(1) infinite;
483
- animation: blink 1.06s steps(1) infinite;
484
- background-color: #7e7;
485
- }
486
-
487
- /* Can style cursor different in overwrite (non-insert) mode */
488
- .CodeMirror-overwrite .CodeMirror-cursor {
489
- }
490
-
491
- .cm-tab {
492
- display: inline-block;
493
- text-decoration: inherit;
494
- }
495
-
496
- .CodeMirror-rulers {
497
- position: absolute;
498
- left: 0;
499
- right: 0;
500
- top: -50px;
501
- bottom: 0;
502
- overflow: hidden;
503
- }
504
- .CodeMirror-ruler {
505
- border-left: 1px solid #ccc;
506
- top: 0;
507
- bottom: 0;
508
- position: absolute;
509
- }
510
-
511
- /* DEFAULT THEME */
512
-
513
- .cm-header,
514
- .cm-strong {
515
- font-weight: bold;
516
- }
517
- .cm-em {
518
- font-style: italic;
519
- }
520
- .cm-link {
521
- text-decoration: underline;
522
- }
523
- .cm-strikethrough {
524
- text-decoration: line-through;
525
- }
526
-
527
- .CodeMirror-composing {
528
- border-bottom: 2px solid;
529
- }
530
-
531
- /* Default styles for common addons */
532
-
533
- div.CodeMirror span.CodeMirror-matchingbracket {
534
- color: #0b0;
535
- }
536
- div.CodeMirror span.CodeMirror-nonmatchingbracket {
537
- color: #a22;
538
- }
539
- .CodeMirror-matchingtag {
540
- background: rgba(255, 150, 0, 0.3);
541
- }
542
- .CodeMirror-activeline-background {
543
- background: #e8f2ff;
544
- }
545
-
546
- /* STOP */
547
-
548
- /* The rest of this file contains styles related to the mechanics of
549
- the editor. You probably shouldn't touch them. */
550
-
551
- .CodeMirror {
552
- position: relative;
553
- overflow: hidden;
554
- background: ${({theme:t})=>`${t.colors.neutral0}`};
555
- }
556
-
557
- .CodeMirror-scroll {
558
- overflow: scroll !important; /* Things will break if this is overridden */
559
- /* 50px is the magic margin used to hide the element's real scrollbars */
560
- /* See overflow: hidden in .CodeMirror */
561
- margin-bottom: -50px;
562
- margin-right: -50px;
563
- padding-bottom: 50px;
564
- height: 100%;
565
- outline: none; /* Prevent dragging from highlighting the element */
566
- position: relative;
567
- }
568
- .CodeMirror-sizer {
569
- position: relative;
570
- border-right: 50px solid transparent;
571
- }
572
-
573
- /* The fake, visible scrollbars. Used to force redraw during scrolling
574
- before actual scrolling happens, thus preventing shaking and
575
- flickering artifacts. */
576
- .CodeMirror-vscrollbar,
577
- .CodeMirror-hscrollbar,
578
- .CodeMirror-scrollbar-filler,
579
- .CodeMirror-gutter-filler {
580
- position: absolute;
581
- z-index: 1;
582
- display: none;
583
- outline: none;
584
- }
585
-
586
- .CodeMirror-vscrollbar {
587
- right: 0;
588
- top: 0;
589
- overflow-x: hidden;
590
- overflow-y: scroll;
591
- }
592
- .CodeMirror-hscrollbar {
593
- bottom: 0;
594
- left: 0;
595
- overflow-y: hidden;
596
- overflow-x: scroll;
597
- }
598
- .CodeMirror-scrollbar-filler {
599
- right: 0;
600
- bottom: 0;
601
- }
602
-
603
- .CodeMirror-lines {
604
- cursor: text;
605
- min-height: 1px; /* prevents collapsing before first draw */
606
- }
607
- /* Reset some styles that the rest of the page might have set */
608
- .CodeMirror pre.CodeMirror-line,
609
- .CodeMirror pre.CodeMirror-line-like {
610
- -moz-border-radius: 0;
611
- -webkit-border-radius: 0;
612
- border-radius: 0;
613
- border-width: 0;
614
- background: transparent;
615
- font-family: inherit;
616
- font-size: inherit;
617
- margin: 0;
618
- white-space: pre;
619
- word-wrap: normal;
620
- line-height: 1.5;
621
- color: inherit;
622
- /* z-index: 2; */
623
- position: relative;
624
- overflow: visible;
625
- -webkit-tap-highlight-color: transparent;
626
- -webkit-font-variant-ligatures: contextual;
627
- font-variant-ligatures: contextual;
628
- }
629
-
630
- .CodeMirror pre.CodeMirror-line-like {
631
- z-index: 2;
632
- }
633
-
634
- .CodeMirror-wrap pre.CodeMirror-line,
635
- .CodeMirror-wrap pre.CodeMirror-line-like {
636
- word-wrap: break-word;
637
- white-space: pre-wrap;
638
- word-break: normal;
639
- }
640
-
641
- .CodeMirror-linebackground {
642
- position: absolute;
643
- left: 0;
644
- right: 0;
645
- top: 0;
646
- bottom: 0;
647
- z-index: 0;
648
- }
649
-
650
- .CodeMirror-linewidget {
651
- position: relative;
652
- /* z-index: 2; */
653
- padding: 0.1px; /* Force widget margins to stay inside of the container */
654
- }
655
-
656
- .CodeMirror-widget {
657
- }
658
-
659
- .CodeMirror-rtl pre {
660
- direction: rtl;
661
- }
662
-
663
- .CodeMirror-code {
664
- outline: none;
665
- }
666
-
667
- /* Force content-box sizing for the elements where we expect it */
668
- .CodeMirror-scroll,
669
- .CodeMirror-sizer,
670
- .CodeMirror-gutter,
671
- .CodeMirror-gutters,
672
- .CodeMirror-linenumber {
673
- -moz-box-sizing: content-box;
674
- box-sizing: content-box;
675
- }
676
-
677
- .CodeMirror-measure {
678
- position: absolute;
679
- width: 100%;
680
- height: 0;
681
- overflow: hidden;
682
- visibility: hidden;
683
- }
684
-
685
- .CodeMirror-cursor {
686
- position: absolute;
687
- pointer-events: none;
688
- border-color: ${({theme:t})=>`${t.colors.neutral800}`};
689
- }
690
- .CodeMirror-measure pre {
691
- position: static;
692
- }
693
-
694
- div.CodeMirror-cursors {
695
- visibility: hidden;
696
- position: relative;
697
- + div {
698
- z-index: 0 !important;
699
- }
700
- }
701
-
702
- div.CodeMirror-dragcursors {
703
- visibility: visible;
704
- }
705
-
706
- .CodeMirror-focused div.CodeMirror-cursors {
707
- visibility: visible;
708
- }
709
-
710
- .CodeMirror-selected {
711
- background: ${({theme:t})=>t.colors.neutral200};
712
- /* z-index: -10; */
713
- }
714
- .CodeMirror-crosshair {
715
- cursor: crosshair;
716
- }
717
-
718
- /* Used to force a border model for a node */
719
- .cm-force-border {
720
- padding-right: 0.1px;
721
- }
722
-
723
- /* See issue #2901 */
724
- .cm-tab-wrap-hack:after {
725
- content: '';
726
- }
727
-
728
- /* Help users use markselection to safely style text background */
729
- span.CodeMirror-selectedtext {
730
- background: none;
731
- }
732
-
733
- span {
734
- color: ${({theme:t})=>t.colors.neutral800} !important;
735
- }
736
- `;var Gt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,nd=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,od=/[*+-]\s/;function rd(t){if(t.getOption("disableInput"))return ao().Pass;for(var o=t.listSelections(),r=[],a=0;a<o.length;a++){var s=o[a].head,c=t.getStateAfter(s.line),i=c.list!==!1,d=c.quote!==0,u=t.getLine(s.line),m=Gt.exec(u),p=/^\s*$/.test(u.slice(0,s.ch));if(!o[a].empty()||!i&&!d||!m||p){t.execCommand("newlineAndIndent");return}if(nd.test(u)){var y=d&&/>\s*$/.test(u),f=!/>\s*$/.test(u);(y||f)&&t.replaceRange("",{line:s.line,ch:0},{line:s.line,ch:s.ch+1}),r[a]=`
737
- `}else{var g=m[1],b=m[5],C=!(od.test(m[2])||m[2].indexOf(">")>=0),k=C?parseInt(m[3],10)+1+m[4]:m[2].replace("x"," ");r[a]=`
738
- `+g+k+b,C&&ad(t,s)}}t.replaceSelections(r)}function ad(t,o){var r=o.line,a=0,s=0,c=Gt.exec(t.getLine(r)),i=c[1];do{a+=1;var d=r+a,u=t.getLine(d),m=Gt.exec(u);if(m){var p=m[1],y=parseInt(c[3],10)+a-s,f=parseInt(m[3],10),g=f;if(i===p&&!isNaN(f))y===f&&(g=f+1),y>f&&(g=y+1),t.replaceRange(u.replace(Gt,p+g+m[4]+m[5]),{line:d,ch:0},{line:d,ch:u.length});else{if(i.length>p.length||i.length<p.length&&a===1)return;s+=1}}}while(m)}var sd=rd;const Le=(0,V.ZP)(Re.h)`
739
- padding: ${({theme:t})=>t.spaces[2]};
740
- /* Trick to prevent the outline from overflowing because of the general outline-offset */
741
- outline-offset: -2px !important;
742
-
743
- svg {
744
- width: ${18/16}rem;
745
- height: ${18/16}rem;
746
- }
747
- `,id=(0,V.ZP)(Le)`
748
- svg {
749
- width: ${8/16}rem;
750
- height: ${8/16}rem;
751
- }
752
- `,qr=(0,V.ZP)(Re.o)`
753
- margin-left: ${({theme:t})=>t.spaces[4]};
754
- `,Hr=(0,V.ZP)(Re.h)`
755
- margin: ${({theme:t})=>`0 ${t.spaces[2]}`};
756
- padding: ${({theme:t})=>t.spaces[2]};
757
-
758
- svg {
759
- width: ${18/16}rem;
760
- height: ${18/16}rem;
761
- }
762
- `,ld=(0,V.ZP)(Re.o)`
763
- margin-right: ${({theme:t})=>`${t.spaces[2]}`};
764
- `,cd=V.ZP.div`
765
- position: relative;
766
- height: calc(100% - 48px);
767
- `,dd=(0,V.ZP)($n.Y)`
768
- background-color: transparent;
769
- border: none;
770
- align-items: center;
771
-
772
- svg {
773
- margin-left: ${({theme:t})=>`${t.spaces[2]}`};
774
- path {
775
- fill: ${({theme:t})=>t.colors.neutral700};
776
- width: ${12/16}rem;
777
- height: ${12/16}rem;
778
- }
779
- }
780
- `;var cg=l(27217);const lo=({disabled:t,editorRef:o,error:r,isPreviewMode:a,isExpandMode:s,name:c,onChange:i,placeholder:d,textareaRef:u,value:m})=>{const p=(0,e.useRef)(i);return(0,e.useEffect)(()=>{o.current=ao().fromTextArea(u.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:d,spellcheck:!0,inputStyle:"contenteditable"}),ao().commands.newlineAndIndentContinueMarkdownList=sd,o.current.on("change",y=>{p.current({target:{name:c,value:y.getValue(),type:"wysiwyg"}})})},[o,u,c,d]),(0,e.useEffect)(()=>{m&&!o.current.hasFocus()&&o.current.setValue(m)},[o,m]),(0,e.useEffect)(()=>{a||t?o.current.setOption("readOnly","nocursor"):o.current.setOption("readOnly",!1)},[t,a,o]),(0,e.useEffect)(()=>{r?o.current.setOption("screenReaderLabel",r):o.current.setOption("screenReaderLabel","Editor")},[o,r]),e.createElement(cd,null,e.createElement(td,{isExpandMode:s,disabled:t||a},e.createElement("textarea",{ref:u})),a&&e.createElement(Ur,{data:m}))};lo.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},lo.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 ud=lo,md=l(71933),pd=l(67563);const gd=(t,o)=>`${t}${Math.floor(o*255).toString(16).padStart(2,0)}`,fd=(0,V.ZP)(x.k)`
781
- background: ${({theme:t})=>gd(t.colors.neutral800,.2)};
782
- `,hd=(0,V.ZP)(H.x)`
783
- border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
784
- `,yd=(0,V.ZP)($n.Y)`
785
- background-color: transparent;
786
- border: none;
787
- align-items: center;
788
-
789
- svg {
790
- margin-left: ${({theme:t})=>`${t.spaces[2]}`};
791
-
792
- path {
793
- fill: ${({theme:t})=>t.colors.neutral700};
794
- width: ${12/16}rem;
795
- height: ${12/16}rem;
796
- }
797
- }
798
- `,co=({children:t,isExpandMode:o,error:r,previewContent:a,onCollapse:s})=>{const{formatMessage:c}=(0,Q.Z)();return(0,h.F5)(o),o?e.createElement(md.h,{role:"dialog","aria-modal":!1},e.createElement(pd.i,{onEscape:s},e.createElement(fd,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:s},e.createElement(H.x,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},e.createElement(x.k,{height:"100%",alignItems:"flex-start"},e.createElement(hd,{flex:"1",height:"100%"},t),e.createElement(x.k,{alignItems:"start",direction:"column",flex:1,height:"100%",width:"100%"},e.createElement(x.k,{height:(0,h.Q1)(48),background:"neutral100",justifyContent:"flex-end",shrink:0,width:"100%"},e.createElement(yd,{onClick:s},e.createElement(z.Z,null,c({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),e.createElement(or.Z,null))),e.createElement(H.x,{position:"relative",height:"100%",width:"100%"},e.createElement(Ur,{data:a})))))))):e.createElement(H.x,{borderColor:r?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},t)};co.defaultProps={error:void 0,previewContent:""},co.propTypes={children:n().node.isRequired,error:n().string,isExpandMode:n().bool.isRequired,previewContent:n().string,onCollapse:n().func.isRequired};const Gr=(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=`\`\`\`
799
- ${o}
800
- \`\`\``;break;case"Link":r=`[${o}](link)`;break;case"Quote":r=`>${o}`;break;default:r=o}return r},Qr=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=`\`\`\`
801
- ${t}
802
- \`\`\``,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}},Kr=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},Yr=(t,o)=>{const r=t.current.getSelection();let a;if(r){const s=Gr(o,r);t.current.replaceSelection(s),t.current.focus()}else{a=Qr(o),t.current.replaceSelection(a.editedText),t.current.focus();const{line:s,ch:c}=t.current.getCursor(),i=c-a.selection.end,d=c-a.selection.end-a.selection.start;t.current.setSelection({line:s,ch:d},{line:s,ch:i})}},Ed=(t,o)=>{const r=t.current.getDoc(),a=o==="BulletList"?"- ":"1. ";if(r.somethingSelected()){const s=r.listSelections();let c=null;t.current.operation(function(){s.forEach(function(i){const d=[i.head.line,i.anchor.line].sort();c==null&&(c=r.getLine(d[0]).startsWith(a));for(let u=d[0];u<=d[1];u++)if(c)r.getLine(u).startsWith(a)&&r.replaceRange("",{line:u,ch:0},{line:u,ch:a.length});else{const m=o==="BulletList"?"- ":`${u+1}. `;r.replaceRange(m,{line:u,ch:0})}})})}else{let{line:s}=r.getCursor();const c=Kr(o),i=t.current.getLine(s),d=c+i;t.current.setSelection({line:s,ch:0},{line:s,ch:i.length}),t.current.replaceSelection(d)}t.current.focus()},bd=(t,o)=>{let{line:r}=t.current.getCursor();const a=Kr(o),s=t.current.getLine(r),c=s.replace(/#{1,6}\s/g,"").trim(),i=a+c;t.current.setSelection({line:r,ch:0},{line:r,ch:s.length}),t.current.replaceSelection(i),setTimeout(()=>{const d=t.current.getLine(r).length;t.current.focus(),t.current.setCursor({line:r,ch:d})},0)},vd=(t,o)=>{let{line:r,ch:a}=t.current.getCursor();o.forEach((s,c)=>{let i=t.current.getLine(r).length;t.current.setCursor({line:r,ch:i}),(c>0||c===0&&a!==0)&&(i=t.current.getLine(r).length,t.current.setCursor({line:r,ch:i}),r++,t.current.replaceSelection(`
803
- `)),s.mime.includes("image")?t.current.replaceSelection(`![${s.alt}](${s.url})`):t.current.replaceSelection(`[${s.alt}](${s.url})`)}),setTimeout(()=>t.current.focus(),0)},Cd=(t,o,r,a,s)=>{const c=Gr(o,s),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:a}),t.current.replaceSelection(`
804
- `),t.current.replaceSelection(c),o==="Code"){let{line:d}=t.current.getCursor();t.current.setCursor({line:d-1,ch:s.length})}t.current.replaceRange(i,{line:r+4,ch:0},{line:1/0,ch:1/0}),t.current.focus()},Rd=(t,o,r,a)=>{const s=Qr(o),c=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:a}),t.current.replaceSelection(`
805
- `),t.current.replaceSelection(s.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(),d=i-s.selection.end,u=i-s.selection.end-s.selection.start;t.current.setSelection({line:r,ch:u},{line:r,ch:d})}t.current.replaceRange(c,{line:r+2,ch:0},{line:1/0,ch:1/0}),t.current.focus()},Md=(t,o)=>{const r=t.current.getSelection();let{line:a}=t.current.getCursor(),s=t.current.getLine(a).length;r?Cd(t,o,a,s,r):Rd(t,o,a,s)},uo=({onToggleExpand:t})=>{const{formatMessage:o}=(0,Q.Z)();return e.createElement(H.x,{padding:2,background:"neutral100",hasRadius:!0},e.createElement(x.k,{justifyContent:"flex-end",alignItems:"flex-end"},e.createElement(dd,{id:"expand",onClick:t},e.createElement(z.Z,null,o({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),e.createElement(rr.Z,null))))};uo.defaultProps={onToggleExpand(){}},uo.propTypes={onToggleExpand:n().func};var Td=uo,Dd=l(5383),Od=l(20063);const mo=({disabled:t,editorRef:o,isExpandMode:r,isPreviewMode:a,onActionClick:s,onToggleMediaLib:c,onTogglePreviewMode:i})=>{const[d,u]=(0,e.useState)(!1),{formatMessage:m}=(0,Q.Z)(),p=m({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),y=(0,e.useRef)(),f=()=>{u(g=>!g)};return t||a?e.createElement(x.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(Xr,null,e.createElement(Fe.P,{disabled:!0,placeholder:p,size:"S",label:p},e.createElement(Ce.W,{value:"h1"},"h1"),e.createElement(Ce.W,{value:"h2"},"h2"),e.createElement(Ce.W,{value:"h3"},"h3"),e.createElement(Ce.W,{value:"h4"},"h4"),e.createElement(Ce.W,{value:"h5"},"h5"),e.createElement(Ce.W,{value:"h6"},"h6")),e.createElement(qr,null,e.createElement(Le,{disabled:!0,label:"Bold",name:"Bold",icon:e.createElement(dn.Z,null)}),e.createElement(Le,{disabled:!0,label:"Italic",name:"Italic",icon:e.createElement(un.Z,null)}),e.createElement(Le,{disabled:!0,label:"Underline",name:"Underline",icon:e.createElement(pn.Z,null)})),e.createElement(Hr,{disabled:!0,label:"More",icon:e.createElement(Un.Z,null)})),!r&&e.createElement(le.z,{onClick:i,variant:"tertiary"},m({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"}))):e.createElement(x.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(Xr,null,e.createElement(Fe.P,{placeholder:p,label:p,size:"S",onChange:g=>s(g,o)},e.createElement(Ce.W,{value:"h1"},"h1"),e.createElement(Ce.W,{value:"h2"},"h2"),e.createElement(Ce.W,{value:"h3"},"h3"),e.createElement(Ce.W,{value:"h4"},"h4"),e.createElement(Ce.W,{value:"h5"},"h5"),e.createElement(Ce.W,{value:"h6"},"h6")),e.createElement(qr,null,e.createElement(Le,{onClick:()=>s("Bold",o),label:"Bold",name:"Bold",icon:e.createElement(dn.Z,null)}),e.createElement(Le,{onClick:()=>s("Italic",o),label:"Italic",name:"Italic",icon:e.createElement(un.Z,null)}),e.createElement(Le,{onClick:()=>s("Underline",o),label:"Underline",name:"Underline",icon:e.createElement(pn.Z,null)})),e.createElement(Hr,{ref:y,onClick:f,label:"More",icon:e.createElement(Un.Z,null)}),d&&e.createElement(Dd.J2,{onDismiss:f,centered:!0,source:y,spacing:4},e.createElement(x.k,null,e.createElement(ld,null,e.createElement(Le,{onClick:()=>s("Strikethrough",o,f),label:"Strikethrough",name:"Strikethrough",icon:e.createElement(dr.Z,null)}),e.createElement(Le,{onClick:()=>s("BulletList",o,f),label:"BulletList",name:"BulletList",icon:e.createElement(tr.Z,null)}),e.createElement(Le,{onClick:()=>s("NumberList",o,f),label:"NumberList",name:"NumberList",icon:e.createElement(Od.Z,null)})),e.createElement(Re.o,null,e.createElement(Le,{onClick:()=>s("Code",o,f),label:"Code",name:"Code",icon:e.createElement(nr.Z,null)}),e.createElement(Le,{onClick:()=>{f(),c()},label:"Image",name:"Image",icon:e.createElement(lr.Z,null)}),e.createElement(id,{onClick:()=>s("Link",o,f),label:"Link",name:"Link",icon:e.createElement(ir.Z,null)}),e.createElement(Le,{onClick:()=>s("Quote",o,f),label:"Quote",name:"Quote",icon:e.createElement(cr.Z,null)}))))),i&&e.createElement(le.z,{onClick:i,variant:"tertiary"},m({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"})))};mo.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},mo.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 Pd=mo;const Xr=(0,V.ZP)(x.k)`
806
- /* Hide the label, every input needs a label. */
807
- label {
808
- border: 0;
809
- clip: rect(0 0 0 0);
810
- height: 1px;
811
- margin: -1px;
812
- overflow: hidden;
813
- padding: 0;
814
- position: absolute;
815
- width: 1px;
816
- }
817
- `,Id=(0,V.ZP)(H.x)`
818
- svg path {
819
- fill: ${({theme:t})=>t.colors.neutral500};
820
- }
821
- `,xd=(0,V.ZP)(z.Z)`
822
- line-height: 0;
823
- `,po=({hint:t,disabled:o,error:r,intlLabel:a,labelAction:s,name:c,onChange:i,placeholder:d,value:u,required:m})=>{const{formatMessage:p}=(0,Q.Z)(),y=(0,e.useRef)(null),f=(0,e.useRef)(null),[g,b]=(0,e.useState)(!1),[C,k]=(0,e.useState)(!1),[v,M]=(0,e.useState)(!1),{components:L}=(0,h.yX)(),W=L["media-library"],T=()=>k(I=>!I),D=()=>b(I=>!I),N=()=>{b(!1),M(I=>!I)},$=(I,G,Z)=>{switch(I){case"Link":case"Strikethrough":{Yr(G,I),Z();break}case"Code":case"Quote":{Md(G,I),Z();break}case"Bold":case"Italic":case"Underline":{Yr(G,I);break}case"BulletList":case"NumberList":{Ed(G,I),Z();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{bd(G,I);break}default:}},P=I=>{const G=I.map(Z=>({alt:Z.alternativeText||Z.name,url:(0,h.CR)(Z.url),mime:Z.mime}));vd(f,G),k(!1)},B=d?p({id:d.id,defaultMessage:d.defaultMessage},{...d.values}):"",U=a.id?p({id:a.id,defaultMessage:a.defaultMessage},{...a.values}):c;return e.createElement(e.Fragment,null,e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:1},e.createElement(x.k,{gap:1},e.createElement(z.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},U,m&&e.createElement(xd,{textColor:"danger600"},"*")),s&&e.createElement(Id,{paddingLeft:1},s)),e.createElement(co,{isExpandMode:v,error:r,previewContent:u,onCollapse:N},e.createElement(Pd,{isExpandMode:v,editorRef:f,isPreviewMode:g,onActionClick:$,onToggleMediaLib:T,onTogglePreviewMode:v?void 0:D,disabled:o}),e.createElement(ud,{disabled:o,isExpandMode:v,editorRef:f,error:r,isPreviewMode:g,name:c,onChange:i,placeholder:B,textareaRef:y,value:u}),!v&&e.createElement(Td,{onToggleExpand:N})),e.createElement(xc,{hint:t,name:c,error:r})),r&&e.createElement(H.x,{paddingTop:1},e.createElement(z.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},r)),C&&e.createElement(W,{onClose:T,onSelectAssets:P}))};po.defaultProps={disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:"",hint:""},po.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 Zd=po;function kd(t,o){return r=>{const a=o(r.keys);return e.createElement(t,{...r,...a})}}var Ld=kd,Sd=(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}))],Ad=l(59578),Fd=l.n(Ad),$d=(t="")=>{switch(Fd()(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"}};function wd(t){const{createActionAllowedFields:o,formErrors:r,isCreatingEntry:a,modifiedData:s,onChange:c,readActionAllowedFields:i,shouldNotRunValidations:d,updateActionAllowedFields:u}=(0,h.Wq)(),m=(0,e.useMemo)(()=>a?o:u,[a,o,u]),p=(0,e.useMemo)(()=>a?[]:i,[a,i]),y=w()(s,t,null);return{allowedFields:m,formErrors:r,isCreatingEntry:a,onChange:c,readableFields:p,shouldNotRunValidations:d,value:y}}var Bd=wd,Jr=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];function go({allowedFields:t,componentUid:o,fieldSchema:r,formErrors:a,isCreatingEntry:s,keys:c,labelAction:i,metadatas:d,onChange:u,readableFields:m,shouldNotRunValidations:p,queryInfos:y,value:f,size:g,customFieldInputs:b}){const{fields:C}=(0,h.yX)(),{formatMessage:k}=(0,Q.Z)(),{contentType:v}=(0,te.PL)(),M=(0,e.useMemo)(()=>!w()(d,"editable",!0),[d]),{type:L,customField:W}=r,T=w()(a,[c],null),D=(0,e.useMemo)(()=>(0,E.Ts)(c),[c]),N=(0,e.useMemo)(()=>{const A=Xl()(r,p?[...Jr,"required","minLength"]:Jr),j=r.regex||null;if(j){const oe=new RegExp(j);oe&&(A.regex=oe)}return A},[r,p]),$=(0,e.useMemo)(()=>w()(N,["required"],!1),[N]),P=(0,e.useMemo)(()=>{const A=w()(v,["attributes"],{});return w()(A,[D[0],"type"],null)==="dynamiczone"},[v,D]),B=$d(L),U=L==="media"&&!f?[]:f,I=(0,e.useMemo)(()=>{const A=D.join(".");if(t.includes(A))return!0;if(P)return t.includes(D[0]);if(D.length>1){const oe=At()(D,D.length-1).join(".");return t.includes(oe)}return!1},[t,D,P]),G=(0,e.useMemo)(()=>{const A=D.join(".");if(m.includes(A))return!0;if(P)return m.includes(D[0]);if(D.length>1){const oe=At()(D,D.length-1).join(".");return m.includes(oe)}return!1},[m,D,P]),Z=(0,e.useMemo)(()=>G||I,[I,G]),q=(0,e.useMemo)(()=>s?M:G&&!I?!0:M,[M,s,I,G]),S=(0,e.useMemo)(()=>Sd(r.enum||[],$),[r,$]),{label:F,description:R,placeholder:X,visible:K}=d;if(K===!1)return null;if(!Z)return e.createElement(h.X0,{description:R?{id:R,defaultMessage:R}:null,intlLabel:{id:F,defaultMessage:F},labelAction:i,error:T&&k(T),name:c,required:$});if(L==="relation")return e.createElement(Ic,{...d,...r,componentUid:o,description:d.description?k({id:d.description,defaultMessage:d.description}):void 0,intlLabel:{id:d.label,defaultMessage:d.label},labelAction:i,isUserAllowedToEditField:I,isUserAllowedToReadField:G,name:c,placeholder:d.placeholder?{id:d.placeholder,defaultMessage:d.placeholder}:null,queryInfos:y,size:g,value:f,error:T&&k(T)});const Y={uid:ac,media:C.media,wysiwyg:Zd,...C,...b};return e.createElement(h.jm,{attribute:r,autoComplete:"new-password",intlLabel:{id:F,defaultMessage:F},isNullable:B==="bool"&&[null,void 0].includes(r.default),description:R?{id:R,defaultMessage:R}:null,disabled:q,error:T,labelAction:i,contentTypeUID:v.uid,customInputs:Y,multiple:r.multiple||!1,name:c,onChange:u,options:S,placeholder:X?{id:X,defaultMessage:X}:null,required:r.required||!1,step:Nd(L),type:W||B,value:U,withDefaultValue:!1})}go.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},go.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 Nd=t=>{switch(t){case"float":case"decimal":return .01;default:return 1}},jd=(0,e.memo)(go,Pe());var fo=Ld(jd,Bd);const ho=({componentUid:t,isFromDynamicZone:o,isNested:r,name:a})=>{const{getComponentLayout:s}=(0,te.PL)(),i=(0,e.useMemo)(()=>s(t),[t,s]).layouts.edit,{lazyComponentStore:d}=Hn();return e.createElement(H.x,{background:o?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:r,borderColor:r?"neutral200":""},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:6},i.map((u,m)=>e.createElement(Oe.r,{gap:4,key:m},u.map(({name:p,size:y,metadatas:f,fieldSchema:g,queryInfos:b})=>{const C=g.type==="component",k=`${a}.${p}`;if(C){const v=g.component;return e.createElement(ve.P,{col:y,s:12,xs:12,key:p},e.createElement(Qt,{componentUid:v,intlLabel:{id:f.label,defaultMessage:f.label},isNested:!0,isRepeatable:g.repeatable,max:g.max,min:g.min,name:k,required:g.required||!1}))}return e.createElement(ve.P,{col:y,key:p,s:12,xs:12},e.createElement(fo,{componentUid:t,keys:k,fieldSchema:g,metadatas:f,queryInfos:b,size:y,customFieldInputs:d}))})))))};ho.defaultProps={isFromDynamicZone:!1,isNested:!1},ho.propTypes={componentUid:n().string.isRequired,isFromDynamicZone:n().bool,isNested:n().bool,name:n().string.isRequired};var Wd=ho;const zd=(0,V.ZP)(H.x)`
824
- overflow: hidden;
825
- border-bottom: 1px solid ${({theme:t})=>t.colors.neutral200};
826
- border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
827
- border-left: 1px solid ${({theme:t})=>t.colors.neutral200};
828
- border-radius: 0 0 ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius};
829
- `,Vd=(0,V.ZP)(H.x)`
830
- border-bottom: none;
831
-
832
- /* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
833
- & > div > div {
834
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
835
- border-top-color: transparent;
836
- }
837
-
838
- /* the top accordion _does_ need a border though */
839
- & > div:first-child > div {
840
- border-top: 1px solid ${({theme:t})=>t.colors.neutral200};
841
- }
842
-
843
- /* Reset all the border-radius' */
844
- & > div > div,
845
- & > div > div > div {
846
- border-radius: unset;
847
- }
848
-
849
- /* Give the border radius back to the first accordion */
850
- & > div:first-child > div,
851
- & > div:first-child > div > div {
852
- border-radius: ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius} 0 0;
853
- }
854
-
855
- & > div > div[data-strapi-expanded='true'] {
856
- border: 1px solid ${({theme:t})=>t.colors.primary600};
857
- }
858
- `,yo=({children:t,error:o})=>{const{formatMessage:r}=(0,Q.Z)();return e.createElement(xr.k,{attributeName:"data-strapi-accordion-toggle"},t,o&&e.createElement(H.x,{paddingTop:1},e.createElement(z.Z,{variant:"pi",textColor:"danger600"},r({id:o.id,defaultMessage:o.defaultMessage},{...o.values}))))};yo.defaultProps={error:void 0},yo.propTypes={children:n().node.isRequired,error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object})};var Ud=l(41119),_r=l.n(Ud);const qd=V.ZP.span`
859
- display: block;
860
- background-color: ${({theme:t})=>t.colors.primary100};
861
- outline: 1px dashed ${({theme:t})=>t.colors.primary500};
862
- outline-offset: -1px;
863
- padding: ${({theme:t})=>t.spaces[6]};
864
- `;var Hd=()=>e.createElement(qd,{padding:6,background:"primary100"});const Gd=(0,V.ZP)(Re.h)`
865
- background-color: transparent;
866
-
867
- svg {
868
- path {
869
- fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
870
- }
871
- }
872
-
873
- &:hover {
874
- svg {
875
- path {
876
- fill: ${({theme:t})=>t.colors.primary600};
877
- }
878
- }
879
- }
880
- `,Qd=(0,V.ZP)(x.k)`
881
- & .drag-handle {
882
- background: unset;
883
-
884
- svg {
885
- path {
886
- fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:void 0};
887
- }
888
- }
889
-
890
- &:hover {
891
- svg {
892
- path {
893
- /* keeps the hover style of the accordion */
894
- fill: ${({theme:t})=>t.colors.primary600};
895
- }
896
- }
897
- }
898
- }
899
- `,Eo=({componentFieldName:t,componentUid:o,fields:r,index:a,isOpen:s,isReadOnly:c,mainField:i,moveComponentField:d,onClickToggle:u,toggleCollapses:m,onGrabItem:p,onDropItem:y,onCancel:f})=>{const{modifiedData:g,removeRepeatableField:b,triggerFormValidation:C}=(0,h.Wq)(),k=_r()(w()(g,[...t.split("."),i],"")),v=(0,e.useRef)(null),{formatMessage:M}=(0,Q.Z)(),L=t.split(".").slice(0,-1).join("."),[{handlerId:W,isDragging:T,handleKeyDown:D},N,$,P,B]=(0,wr.Y)(!c,{type:`${E._Q.COMPONENT}_${L}`,index:a,item:{displayedValue:k},onMoveItem:d,onStart(){m()},onEnd(){C()},onGrabItem:p,onDropItem:y,onCancel:f});(0,e.useEffect)(()=>{B((0,xt.rX)(),{captureDraggingState:!1})},[B,a]);const U=(0,E.FE)(v,P),I=(0,E.FE)(N,$),{lazyComponentStore:G}=Hn();return e.createElement(H.x,{ref:I},T?e.createElement(Hd,null):e.createElement(Nn.U,{expanded:s,onToggle:u,id:t,size:"S"},e.createElement(jn.B,{action:c?null:e.createElement(Qd,{gap:0,expanded:s},e.createElement(Gd,{expanded:s,noBorder:!0,onClick:()=>{b(t),m()},label:M({id:(0,E.OB)("containers.Edit.delete"),defaultMessage:"Delete"}),icon:e.createElement(qe.Z,null)}),e.createElement(Re.h,{className:"drag-handle",ref:U,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:Z=>Z.stopPropagation(),"data-handler-id":W,label:M({id:(0,E.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:D},e.createElement(Ye.Z,null))),title:k,togglePosition:"left"}),e.createElement(Wn.v,null,e.createElement(x.k,{direction:"column",alignItems:"stretch",background:"neutral100",padding:6,gap:6},r.map((Z,q)=>e.createElement(Oe.r,{gap:4,key:q},Z.map(({name:S,fieldSchema:F,metadatas:R,queryInfos:X,size:K})=>{const Y=F.type==="component",A=`${t}.${S}`;if(Y){const j=F.component;return e.createElement(ve.P,{col:K,s:12,xs:12,key:S},e.createElement(Qt,{componentUid:j,intlLabel:{id:R.label,defaultMessage:R.label},isRepeatable:F.repeatable,isNested:!0,name:A,max:F.max,min:F.min,required:F.required}))}return e.createElement(ve.P,{key:A,col:K,s:12,xs:12},e.createElement(fo,{componentUid:o,fieldSchema:F,keys:A,metadatas:R,queryInfos:X,size:K,customFieldInputs:G}))})))))))};Eo.defaultProps={componentUid:void 0,fields:[],isReadOnly:!1,isOpen:!1,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0,toggleCollapses(){}},Eo.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 Kd=(0,e.memo)(Eo);function Yd(t,o={}){return Object.keys(o).filter(r=>r.startsWith(t)).map(r=>r.split(".").slice(0,t.split(".").length+1).join("."))}const Xd=(0,V.ZP)(Fr.A)`
900
- height: 100%;
901
- width: 100%;
902
- border-radius: 0 0 4px 4px;
903
- display: flex;
904
- justify-content: center;
905
- span {
906
- font-weight: 600;
907
- font-size: 14px;
908
- }
909
- `,bo=({componentUid:t,componentValue:o,componentValueLength:r,isReadOnly:a,max:s,min:c,name:i})=>{const{addRepeatableComponentToField:d,formErrors:u,moveComponentField:m}=(0,h.Wq)(),p=(0,h.lm)(),{formatMessage:y}=(0,Q.Z)(),[f,g]=(0,e.useState)(""),[b,C]=(0,e.useState)(""),{getComponentLayout:k,components:v}=(0,te.PL)(),M=(0,e.useMemo)(()=>k(t),[t,k]),L=(0,e.useMemo)(()=>(0,E.Uo)(o||[])+1,[o]),W=Yd(i,u),T=c-r,D=w()(u,i,{id:""}).id.includes("min"),N=()=>{g("")},$=()=>{a||(r<s?(d(i,M,v,D),g(L)):r>=s&&p({type:"info",message:{id:(0,E.OB)("components.notification.info.maximum-requirement")}}))},P=(R,X)=>{C(y({id:(0,E.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${i}.${X}`,position:I(R)})),m({name:i,newIndex:R,currentIndex:X})},B=w()(M,["settings","mainField"],"id"),U=R=>()=>{g(f===R?"":R)},I=R=>`${R+1} of ${r}`,G=R=>{C(y({id:(0,E.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${i}.${R}`}))},Z=R=>{C(y({id:(0,E.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}.${R}`,position:I(R)}))},q=R=>{C(y({id:(0,E.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${i}.${R}`,position:I(R)}))};let S=u[i];if(D?S={id:(0,E.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:T}}:W.some(R=>R.split(".").length>1)&&!D&&(S={id:(0,E.OB)("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r===0)return e.createElement(kr,{error:S,isReadOnly:a,onClick:$});const F=`${i}-item-instructions`;return e.createElement(H.x,{hasRadius:!0},e.createElement(_e.T,{id:F},y({id:(0,E.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(_e.T,{"aria-live":"assertive"},b),e.createElement(yo,{error:S,ariaDescribedBy:F},e.createElement(Vd,{"aria-describedby":F},o.map(({__temp_key__:R},X)=>e.createElement(Kd,{componentFieldName:`${i}.${X}`,componentUid:t,fields:M.layouts.edit,key:R,index:X,isOpen:f===R,isReadOnly:a,mainField:B,moveComponentField:P,onClickToggle:U(R),toggleCollapses:N,onCancel:G,onDropItem:q,onGrabItem:Z}))),e.createElement(zd,null,e.createElement(x.k,{justifyContent:"center",height:"48px",background:"neutral0"},e.createElement(Xd,{disabled:a,onClick:$,startIcon:e.createElement(gt.Z,null)},y({id:(0,E.OB)("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"}))))))};bo.defaultProps={componentValue:null,componentValueLength:0,isReadOnly:!1,max:1/0,min:0},bo.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 Jd=(0,e.memo)(bo);const _d=(0,V.ZP)(H.x)`
910
- svg path {
911
- fill: ${({theme:t})=>t.colors.neutral500};
912
- }
913
- `,vo=({intlLabel:t,id:o,labelAction:r,name:a,numberOfEntries:s,showNumberOfEntries:c,required:i})=>{const{formatMessage:d}=(0,Q.Z)(),u=t?.id?d(t):a;return e.createElement(H.x,{paddingBottom:1},e.createElement(x.k,null,e.createElement(z.Z,{textColor:"neutral800",htmlFor:o||a,variant:"pi",fontWeight:"bold",as:"label"},u,c&&e.createElement(e.Fragment,null,"\xA0(",s,")"),i&&e.createElement(z.Z,{textColor:"danger600"},"*")),r&&e.createElement(_d,{paddingLeft:1},r)))};vo.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},vo.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 eu=vo;function tu(t,o){return r=>{const a=o(r);return e.createElement(t,{...r,...a})}}var nu=tu;function ou({isFromDynamicZone:t,name:o}){const{addNonRepeatableComponentToField:r,createActionAllowedFields:a,isCreatingEntry:s,modifiedData:c,removeComponentFromField:i,readActionAllowedFields:d,updateActionAllowedFields:u,formErrors:m}=(0,h.Wq)(),{contentType:p}=(0,te.PL)(),y=(0,e.useMemo)(()=>{const M=w()(p,["attributes"],{});return Object.keys(M).filter(W=>w()(M,[W,"type"],"")==="dynamiczone")},[p]),f=(0,e.useMemo)(()=>s?a:u,[s,a,u]),g=w()(c,o,null),b=(0,e.useMemo)(()=>(0,E.Ts)(o),[o]),C=(0,e.useMemo)(()=>t&&s||f.filter(W=>W===b[0]).length>0?!0:f.map(W=>W.split(".")).filter(W=>W.length<b.length?!1:At()(W,b.length).join(".")===b.join(".")).length>0,[t,s,f,b]),k=(0,e.useMemo)(()=>t||y.includes(b[0])?!0:(s?[]:d).map(W=>W.split(".")).filter(W=>W.length<b.length?!1:At()(W,b.length).join(".")===b.join(".")).length>0,[t,y,b,s,d]),v=(0,e.useMemo)(()=>s||C?!1:k,[C,k,s]);return{addNonRepeatableComponentToField:r,formErrors:m,hasChildrenAllowedFields:C,hasChildrenReadableFields:k,isCreatingEntry:s,isReadOnly:v,removeComponentFromField:i,componentValue:g}}var ru=ou;const Co=({addNonRepeatableComponentToField:t,componentUid:o,intlLabel:r,isCreatingEntry:a,isFromDynamicZone:s,isRepeatable:c,isNested:i,labelAction:d,max:u,min:m,name:p,hasChildrenAllowedFields:y,hasChildrenReadableFields:f,isReadOnly:g,componentValue:b,removeComponentFromField:C,required:k})=>{const{formatMessage:v}=(0,Q.Z)(),M=Ql()(b),L=b!==null||s,W=!c&&L&&!s&&y,{getComponentLayout:T,components:D}=(0,te.PL)(),N=(0,e.useMemo)(()=>T(o),[o,T]);if(!y&&a)return e.createElement(h.X0,{labelAction:d,intlLabel:r,name:p});if(!y&&!a&&!f)return e.createElement(h.X0,{labelAction:d,intlLabel:r,name:p});const $=()=>{t(p,N,D)};return e.createElement(H.x,null,e.createElement(x.k,{justifyContent:"space-between"},r&&e.createElement(eu,{intlLabel:r,labelAction:d,name:p,numberOfEntries:M,showNumberOfEntries:c,required:k}),W&&e.createElement(Re.h,{label:v({id:(0,E.OB)("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:e.createElement(qe.Z,null),noBorder:!0,onClick:()=>{C(p,o)}})),e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:1},!c&&!L&&e.createElement(kr,{isReadOnly:g,onClick:$}),!c&&L&&e.createElement(Wd,{componentUid:o,isFromDynamicZone:s,isNested:i,name:p}),c&&e.createElement(Jd,{componentValue:b,componentValueLength:M,componentUid:o,isReadOnly:g,max:u,min:m,name:p})))};Co.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},Co.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 au=(0,e.memo)(Co,Pe());var Qt=nu(au,ru);const Ro=({componentUid:t,formErrors:o,index:r,isFieldAllowed:a,name:s,onRemoveComponentClick:c,onMoveComponent:i,onGrabItem:d,onDropItem:u,onCancel:m,dynamicComponentsByCategory:p,onAddComponent:y})=>{const[f,g]=(0,e.useState)(!0),{formatMessage:b}=(0,Q.Z)(),{getComponentLayout:C}=(0,te.PL)(),{modifiedData:k}=(0,h.Wq)(),{icon:v,friendlyName:M,mainValue:L}=(0,e.useMemo)(()=>{const S=C(t),{info:{icon:F,displayName:R}}=S,X=w()(S,["settings","mainField"],"id"),K=w()(k,[s,r,X])??"",Y=X==="id"?"":String(K).trim(),A=Y.length>0?` - ${Y}`:Y;return{friendlyName:R,icon:F,mainValue:A}},[t,C,k,s,r]),W=Object.keys(o).filter(S=>{const F=S.split(".");return`${F[0]}.${F[1]}`==`${s}.${r}`});let T;W.length>0&&(T=b({id:(0,E.OB)("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const D=()=>{g(S=>!S)},[{handlerId:N,isDragging:$,handleKeyDown:P},B,U,I,G]=(0,te.Y9)(a,{type:`${E._Q.DYNAMIC_ZONE}_${s}`,index:r,item:{displayedValue:`${M}${L}`,icon:v},onMoveItem:i,onGrabItem:d,onDropItem:u,onCancel:m});(0,e.useEffect)(()=>{G((0,xt.rX)(),{captureDraggingState:!1})},[G,r]);const Z=(0,E.FE)(B,U),q=a?e.createElement(su,{gap:0,expanded:f},e.createElement(iu,{noBorder:!0,label:b({id:(0,E.OB)("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:M}),onClick:c},e.createElement(qe.Z,null)),e.createElement(Re.h,{forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:S=>S.stopPropagation(),"data-handler-id":N,ref:I,label:b({id:(0,E.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:P},e.createElement(Ye.Z,null)),e.createElement(ge.fC,null,e.createElement(ge.xz,{size:"S",endIcon:void 0,paddingLeft:2,paddingRight:2},e.createElement(Un.Z,{"aria-hidden":!0,focusable:!1}),e.createElement(_e.T,{as:"span"},b({id:(0,E.OB)("components.DynamicZone.more-actions"),defaultMessage:"More actions"}))),e.createElement(ge.VY,null,e.createElement(ge.rl,null,e.createElement(ge.fF,null,b({id:(0,E.OB)("components.DynamicZone.add-item-above"),defaultMessage:"Add component above"})),e.createElement(ge.tu,null,Object.entries(p).map(([S,F])=>e.createElement(e.Fragment,{key:S},e.createElement(ge.__,null,S),F.map(({componentUid:R,info:{displayName:X}})=>e.createElement(Zr.sN,{key:R,onSelect:()=>y(R,r)},X)))))),e.createElement(ge.rl,null,e.createElement(ge.fF,null,b({id:(0,E.OB)("components.DynamicZone.add-item-below"),defaultMessage:"Add component below"})),e.createElement(ge.tu,null,Object.entries(p).map(([S,F])=>e.createElement(e.Fragment,{key:S},e.createElement(ge.__,null,S),F.map(({componentUid:R,info:{displayName:X}})=>e.createElement(Zr.sN,{key:R,onSelect:()=>y(R,r+1)},X))))))))):null;return e.createElement(mu,{as:"li",width:"100%"},e.createElement(x.k,{justifyContent:"center"},e.createElement(du,{background:"neutral200"})),e.createElement(lu,{ref:Z,hasRadius:!0},$?e.createElement(uu,{padding:6,background:"primary100"}):e.createElement(Nn.U,{expanded:f,onToggle:D,size:"S",error:T},e.createElement(jn.B,{startIcon:e.createElement(Zt,{icon:v,showBackground:!1,size:"S"}),action:q,title:`${M}${L}`,togglePosition:"left"}),e.createElement(Wn.v,null,e.createElement(cu,{background:"neutral0"},e.createElement(Qt,{componentUid:t,icon:v,name:`${s}.${r}`,isFromDynamicZone:!0}))))))},su=(0,V.ZP)(x.k)`
914
- /*
915
- we need to remove the background from the button but we can't
916
- wrap the element in styled because it breaks the forwardedAs which
917
- we need for drag handler to work on firefox
918
- */
919
- div[role='button'] {
920
- background: transparent;
921
- }
922
- `,iu=(0,V.ZP)(Re.h)`
923
- background-color: transparent;
924
-
925
- svg path {
926
- fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
927
- }
928
- `,lu=(0,V.ZP)(H.x)`
929
- > div:first-child {
930
- box-shadow: ${({theme:t})=>t.shadows.tableShadow};
931
- }
932
- `,cu=(0,V.ZP)(H.x)`
933
- border-radius: 0 0 ${({theme:t})=>t.spaces[1]} ${({theme:t})=>t.spaces[1]};
934
- `,du=(0,V.ZP)(H.x)`
935
- width: ${({theme:t})=>t.spaces[2]};
936
- height: ${({theme:t})=>t.spaces[4]};
937
- `,uu=V.ZP.span`
938
- display: block;
939
- background-color: ${({theme:t})=>t.colors.primary100};
940
- outline: 1px dashed ${({theme:t})=>t.colors.primary500};
941
- outline-offset: -1px;
942
- padding: ${({theme:t})=>t.spaces[6]};
943
- `,mu=(0,V.ZP)(H.x)`
944
- list-style: none;
945
- padding: 0;
946
- margin: 0;
947
- `;Ro.defaultProps={dynamicComponentsByCategory:{},formErrors:{},index:0,isFieldAllowed:!0,onAddComponent:void 0,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0},Ro.propTypes={componentUid:n().string.isRequired,dynamicComponentsByCategory:n().shape({components:n().arrayOf(n().shape({componentUid:n().string.isRequired,info:n().object}))}),formErrors:n().object,index:n().number,isFieldAllowed:n().bool,name:n().string.isRequired,onAddComponent:n().func,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onMoveComponent:n().func.isRequired,onRemoveComponentClick:n().func.isRequired};const Mo=({label:t,labelAction:o,name:r,numberOfComponents:a,required:s,intlDescription:c})=>{const{formatMessage:i}=(0,Q.Z)(),d=i({id:t||r,defaultMessage:t||r});return e.createElement(x.k,{justifyContent:"center"},e.createElement(H.x,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,borderRadius:26,background:"neutral0",shadow:"filterShadow",color:"neutral500"},e.createElement(x.k,{direction:"column",justifyContent:"center"},e.createElement(x.k,{maxWidth:(0,h.Q1)(356)},e.createElement(z.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},d,"\xA0"),e.createElement(z.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",a,")"),s&&e.createElement(z.Z,{textColor:"danger600"},"*"),o&&e.createElement(H.x,{paddingLeft:1},o)),c&&e.createElement(H.x,{paddingTop:1,maxWidth:(0,h.Q1)(356)},e.createElement(z.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(c))))))};Mo.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},Mo.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};const To=({name:t,labelAction:o,fieldSchema:r,metadatas:a})=>{const{max:s=1/0,min:c=-1/0,components:i=[],required:d=!1}=r,[u,m]=(0,e.useState)(!1),[p,y]=(0,e.useState)(""),{addComponentToDynamicZone:f,createActionAllowedFields:g,isCreatingEntry:b,formErrors:C,modifiedData:k,moveComponentField:v,removeComponentFromDynamicZone:M,readActionAllowedFields:L,updateActionAllowedFields:W}=(0,h.Wq)(),T=(0,e.useMemo)(()=>(k?.[t]??[]).map(O=>({componentUid:O.__component,id:O.id??O.__temp_key__})),[k,t]),{getComponentLayout:D,components:N}=(0,te.PL)(),$=(0,e.useMemo)(()=>i.reduce((O,ee)=>{const{category:pe,info:Ie,attributes:Ue}=D(ee),ce={componentUid:ee,info:Ie,attributes:Ue};return O[pe]||(O[pe]=[]),O[pe]=[...O[pe],ce],O},{}),[i,D]),{formatMessage:P}=(0,Q.Z)(),B=(0,h.lm)(),U=(0,e.useMemo)(()=>(b?g:W).includes(t),[t,b,g,W]),I=(0,e.useMemo)(()=>(b?[]:L).includes(t),[t,b,L]),G=T.length,Z=a.description?{id:a.description,defaultMessage:a.description}:null,q=C[t],S=c-G,F=!!q,R=(O,ee)=>{m(!1);const pe=D(O);f(t,pe,N,F,ee)},X=()=>{G<s?m(O=>!O):B({type:"info",message:{id:(0,E.OB)("components.notification.info.maximum-requirement")}})},K=(O,ee)=>{y(P({id:(0,E.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${t}.${ee}`,position:Y(O)})),v({name:t,newIndex:O,currentIndex:ee})},Y=O=>`${O+1} of ${T.length}`,A=O=>{y(P({id:(0,E.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${t}.${O}`}))},j=O=>{y(P({id:(0,E.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}.${O}`,position:Y(O)}))},oe=O=>{y(P({id:(0,E.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${t}.${O}`,position:Y(O)}))},ue=(O,ee)=>()=>{M(O,ee)},fe=()=>u?P({id:"app.utils.close-label",defaultMessage:"Close"}):F&&q.id.includes("max")?P({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."}):F&&q.id.includes("min")?P({id:(0,E.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:S}):P({id:(0,E.OB)("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:a.label||t});if(!U&&(b||!I&&!b))return e.createElement(h.X0,{description:Z,intlLabel:{id:a.label,defaultMessage:a.label},labelAction:o,name:t});const Ee=`${t}-item-instructions`;return e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:6},G>0&&e.createElement(H.x,null,e.createElement(Mo,{intlDescription:Z,label:a.label,labelAction:o,name:t,numberOfComponents:G,required:d}),e.createElement(_e.T,{id:Ee},P({id:(0,E.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(_e.T,{"aria-live":"assertive"},p),e.createElement("ol",{"aria-describedby":Ee},T.map(({componentUid:O,id:ee},pe)=>e.createElement(Ro,{componentUid:O,formErrors:C,key:`${O}-${ee}`,index:pe,isFieldAllowed:U,name:t,onMoveComponent:K,onRemoveComponentClick:ue(t,pe),onCancel:A,onDropItem:oe,onGrabItem:j,onAddComponent:R,dynamicComponentsByCategory:$})))),e.createElement(x.k,{justifyContent:"center"},e.createElement(wn,{hasError:F,isDisabled:!U,isOpen:u,onClick:X},fe())),e.createElement(Vn,{dynamicComponentsByCategory:$,isOpen:u,onClickAddComponent:R}))};To.defaultProps={fieldSchema:{},labelAction:null},To.propTypes={fieldSchema:n().shape({components:n().array,max:n().number,min:n().number,required:n().bool}),labelAction:n().element,metadatas:n().shape({description:n().string,label:n().string}).isRequired,name:n().string.isRequired};var pu=l(86834),Be=l.n(pu),ea=l(12788),Do=l(99526),gu=l(10268),ta=l.n(gu),fu=l(56236),hu=l.n(fu),yu=l(77236),Eu=l.n(yu),bu=l(85973),vu=l.n(bu);const Cu=({browserState:t,serverState:o},r,a)=>{const s=o,c=t,i=(m,p)=>w()(m,["attributes",p,"type"],""),d=(m,p)=>w()(m,["attributes",...p],""),u=(m,p,y,f)=>Object.keys(m).reduce((g,b)=>{const C=f?`${f}.${b}`:b,k=i(y,b),v=w()(m,b),M=w()(p,b),L=d(y,[b,"component"]),W=d(y,[b,"repeatable"]);let T;switch(k){case"json":T=JSON.parse(v);break;case"time":{T=v,v&&v.split(":").length<3&&(T=`${v}:00`);break}case"media":d(y,[b,"multiple"])===!0?T=v?v.filter(D=>!(D instanceof File)):null:T=w()(v,0)instanceof File?null:w()(v,"id",null);break;case"component":W?T=v&&v.map((D,N)=>u(D,(M??[])[N],a[L],`${C}.${N}`)):T=v&&u(v,M,a[L],C);break;case"relation":{const D=Ar(s,c)(C).join(".");let N=w()(s,D,[]);const $=v.reduce((B,U,I,G)=>{const Z=N.find(S=>S.id===U.id),q=G[I+1];if(!Z||Z.__temp_key__!==U.__temp_key__){const S=q?{before:q.id}:{end:!0};return[...B,{id:U.id,position:S}]}return B},[]);T={disconnect:N.reduce((B,U)=>v.find(I=>I.id===U.id)?B:[...B,{id:U.id}],[]),connect:$.reverse()};break}case"dynamiczone":T=v.map((D,N)=>u(D,(M??[])[N],a[D.__component],`${C}.${N}`));break;default:T=Ru(v,"id")}return g[b]=T,g},{});return u(t,o,r,"")},Ru=(t,o)=>Eu()(t)?t.map(r=>r[o]?r[o]:r):vu()(t)?t[o]:t;var Mu=Cu;const Kt=(t,o=()=>!1,r=void 0)=>{const a=(s,c,{ignoreFalseyValues:i=!1,path:d=[],parent:u=c}={})=>Object.entries(c).reduce((m,[p,y])=>{if(i&&(m==null||m[p]===void 0||m[p]===null))return m;if(o(y,{path:[...d,p],parent:u})&&(m[p]=typeof r=="function"?r(m[p],{path:[...d,p],parent:m}):r),y.type==="component"){const f=t[y.component].attributes;!y.repeatable&&m[p]&&typeof m[p]=="object"?m[p]=a(m[p],f,{ignoreFalseyValues:i,path:[...d,p],parent:c[p]}):y.repeatable&&Array.isArray(m[p])&&(m[p]=m[p].map((g,b)=>a(g,f,{ignoreFalseyValues:i,path:[...d,p,b],parent:c[p]})))}else y.type==="dynamiczone"&&Array.isArray(m[p])&&(m[p]=m[p].map((f,g)=>{const b=t[f.__component].attributes;return a(f,b,{ignoreFalseyValues:i,path:[...d,p,g],parent:c[p]})}));return m},{...s});return a};var na=(t,o,r,a)=>{const s=t.slice();return s.splice(o,1),s.splice(r,0,a),s};const Tu={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}};var Du=(t,o)=>(0,Pn.ZP)(t,r=>{switch(o.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:a,allComponents:s}=o,c={...t.componentsDataStructure[a.uid]},d=Kt(s,u=>u.type==="relation",[])(c,a.attributes);ne()(r,["modifiedData",...o.keys],d);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:a,allComponents:s,componentLayoutData:c,shouldCheckErrors:i,position:d=void 0}=o;i&&(r.shouldCheckErrors=!t.shouldCheckErrors),o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(r.modifiedDZName=a[0]);const u=[...w()(t,["modifiedData",...a],[])];let m=d;m===void 0?m=u.length:m<0&&(m=0);const p=o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?{...t.componentsDataStructure[c.uid],__component:c.uid,__temp_key__:(0,E.Uo)(u)+1}:{...t.componentsDataStructure[c.uid],__temp_key__:(0,E.Uo)(u)+1},f=Kt(s,g=>g.type==="relation",[])(p,c.attributes);u.splice(m,0,f),ne()(r,["modifiedData",...a],u);break}case"LOAD_RELATION":{const{initialDataPath:a,modifiedDataPath:s,value:c}=o,i=w()(t,a),d=w()(t,s),u=i?c.filter(y=>!i.some(f=>f.id===y.id)):c,m=(0,Do.zJ)(null,d[0]?.__temp_key__,u.length),p=u.map((y,f)=>({...y,__temp_key__:m[f]}));ne()(r,a,ta()([...p,...i],"id")),ne()(r,s,ta()([...p,...d],"id"));break}case"CONNECT_RELATION":{const a=["modifiedData",...o.keys],{value:s,toOneRelation:c}=o;if(c)ne()(r,a,[s]);else{const i=w()(t,a),[d]=(0,Do.zJ)(i.at(-1)?.__temp_key__,null,1),u=[...i,{...s,__temp_key__:d}];ne()(r,a,u)}break}case"DISCONNECT_RELATION":{const a=["modifiedData",...o.keys],{id:s}=o,i=w()(t,[...a]).filter(d=>d.id!==s);ne()(r,a,i);break}case"MOVE_COMPONENT_FIELD":case"REORDER_RELATION":{const{oldIndex:a,newIndex:s,keys:c}=o,i=["modifiedData",...c],d=w()(t,[...i]),u=d[a],m=[...d];if(o.type==="REORDER_RELATION"){const p=a>s?d[s-1]?.__temp_key__:d[s]?.__temp_key__,y=a>s?d[s]?.__temp_key__:d[s+1]?.__temp_key__,[f]=(0,Do.zJ)(p,y,1);m.splice(a,1),m.splice(s,0,{...u,__temp_key__:f})}else m.splice(a,1),m.splice(s,0,u);ne()(r,i,m);break}case"INIT_FORM":{const{initialValues:a,components:s={},attributes:c={},setModifiedDataOnly:i}=o,d=$e()(a),m=Kt(s,f=>f.type==="relation",(f,{path:g})=>t.modifiedData?.id===d.id&&w()(t.modifiedData,g)?w()(t.modifiedData,g):[])(d,c),y=Kt(s,f=>f.type==="dynamiczone"||f.type==="component"&&!f.repeatable,f=>Array.isArray(f)?f.map((g,b)=>({...g,__temp_key__:b})):{...f,__temp_key__:0})(m,c,{ignoreFalseyValues:!0});i||(r.initialData=y),r.modifiedData=y,r.formErrors={},r.modifiedDZName=null,r.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:a,dynamicZoneName:s,shouldCheckErrors:c}=o;c&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=t.modifiedData[s],d=o.type==="MOVE_COMPONENT_UP"?a-1:a+1,u=t.modifiedData[s][a],m=na(i,a,d,u);ne()(r,["modifiedData",o.dynamicZoneName],m);break}case"MOVE_FIELD":{const a=w()(t,["modifiedData",...o.keys],[]).slice(),s=w()(t,["modifiedData",...o.keys,o.dragIndex]),c=na(a,o.dragIndex,o.overIndex,s);ne()(r,["modifiedData",...o.keys],c);break}case"ON_CHANGE":{const[a]=o.keys;if(o.shouldSetInitialValue&&ne()(r,["initialData",...o.keys],o.value),o.keys.length===2&&w()(t,["modifiedData",a])===null){ne()(r,["modifiedData",a],{[o.keys[1]]:o.value});break}ne()(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 a=["modifiedData",...o.keys];ne()(r,a,null);break}case"REMOVE_PASSWORD_FIELD":{hu()(r,["modifiedData",...o.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const a=o.keys.length-1,s=["modifiedData",...At()(o.keys,a)];Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=w()(t,s).slice();i.splice(parseInt(o.keys[a],10),1),ne()(r,s,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 Oo=({allLayoutData:t,allowedActions:{canRead:o,canUpdate:r},children:a,componentsDataStructure:s,contentTypeDataStructure:c,createActionAllowedFields:i,from:d,initialValues:u,isCreatingEntry:m,isLoadingForData:p,isSingleType:y,onPost:f,onPublish:g,onDraftRelationCheck:b,onPut:C,onUnpublish:k,readActionAllowedFields:v,redirectToPreviousPage:M,slug:L,status:W,updateActionAllowedFields:T})=>{const[D,N]=e.useState(!1),[$,P]=(0,e.useReducer)(Du,Tu),{formErrors:B,initialData:U,modifiedData:I,modifiedDZName:G,shouldCheckErrors:Z,publishConfirmation:q}=$,{setModifiedDataOnly:S}=(0,se.v9)(An),F=(0,se.I0)(),R=(0,h.lm)(),{lockApp:X,unlockApp:K}=(0,h.o1)(),Y=w()(t,["contentType"],{}),A=(0,e.useMemo)(()=>w()(Y,["options","draftAndPublish"],!1),[Y]),j=(0,e.useMemo)(()=>A&&!U.publishedAt,[A,U.publishedAt]),{trackUsage:oe}=(0,h.rS)(),{formatMessage:ue}=(0,Q.Z)(),fe=(0,e.useRef)(oe),Ee=(0,e.useMemo)(()=>p||m?!1:o===!1&&r===!1,[p,m,o,r]);(0,e.useEffect)(()=>{W==="resolved"?K():X()},[X,K,W]),(0,e.useEffect)(()=>{p||He()},[Z]),(0,e.useEffect)(()=>{const _=Object.keys(B);if(_.length>0){const J=_[0],ie=document.getElementById(J);ie&&ie.focus()}},[B]),(0,e.useEffect)(()=>{Ee&&R({type:"info",message:{id:(0,E.OB)("permissions.not-allowed.update")}})},[Ee,R]),(0,e.useEffect)(()=>{P({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:s,contentTypeDataStructure:c})},[s,c]);const{components:O}=t,ee=(0,te.zH)(u);(0,e.useEffect)(()=>{u&&Y?.attributes&&!Pe()(ee,u)&&(P({type:"INIT_FORM",initialValues:u,components:O,attributes:Y.attributes,setModifiedDataOnly:S}),S&&F(zl()))},[u,Y,O,S,F,ee]);const pe=(0,e.useCallback)(_=>(J,ie,Se,ct=!1,Bt=void 0)=>{fe.current("didAddComponentToDynamicZone"),P({type:_,keys:J.split("."),position:Bt,componentLayoutData:ie,allComponents:Se,shouldCheckErrors:ct})},[]),Ie=pe("ADD_COMPONENT_TO_DYNAMIC_ZONE"),Ue=(0,e.useCallback)((_,J,ie)=>{P({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:_.split("."),componentLayoutData:J,allComponents:ie})},[]),ce=(0,e.useCallback)(({name:_,value:J,toOneRelation:ie})=>{P({type:"CONNECT_RELATION",keys:_.split("."),value:J,toOneRelation:ie})},[]),xe=(0,e.useCallback)(({target:{initialDataPath:_,modifiedDataPath:J,value:ie,modifiedDataOnly:Se}})=>{P({type:"LOAD_RELATION",modifiedDataPath:J,initialDataPath:_,value:ie,modifiedDataOnly:Se})},[]),Ne=pe("ADD_REPEATABLE_COMPONENT_TO_FIELD"),Ze=(0,e.useMemo)(()=>{const _={isCreatingEntry:m,isDraft:j,isFromComponent:!1};return(0,E.Ex)(Y,{components:t.components||{}},_)},[t.components,Y,m,j]),He=(0,e.useCallback)(async(_={})=>{let J={};const ie=$e()(I);Be()(ie)||ne()(ie,_.path,_.value);try{await Ze.validate(ie,{abortEarly:!1})}catch(Se){J=(0,h.CJ)(Se),G&&(J=Object.keys(J).reduce((ct,Bt)=>(Bt.split(".")[0]!==G&&(ct[Bt]=J[Bt]),ct),{}))}P({type:"SET_FORM_ERRORS",errors:J})},[G,I,Ze]),Mt=(0,e.useCallback)(({target:{name:_,value:J,type:ie}},Se=!1)=>{let ct=J;if(["text","textarea","string","email","uid","select","select-one","number"].includes(ie)&&!J&&J!==0&&(ct=null),ie==="password"&&!J){P({type:"REMOVE_PASSWORD_FIELD",keys:_.split(".")});return}P({type:"ON_CHANGE",keys:_.split("."),value:ct,shouldSetInitialValue:Se})},[]),lt=(0,e.useCallback)((_,J)=>Mu({browserState:_,serverState:J},Y,t.components),[t.components,Y]),he=(0,e.useMemo)(()=>A?j?{status:"draft"}:{}:{},[A,j]),Me=(0,e.useCallback)(async _=>(_.preventDefault(),P({type:"RESET_PUBLISH_CONFIRMATION"})),[]),et=(0,e.useCallback)(async _=>{_.preventDefault();let J={};try{await Ze.validate(I,{abortEarly:!1})}catch(ie){J=(0,h.CJ)(ie)}try{if(Be()(J)){const ie=lt(I,U);(0,ea.flushSync)(()=>{N(!0)}),m?await f(ie,he):await C(ie,he),N(!1)}}catch(ie){N(!1),J={...J,...(0,h.nn)(ie,{getTrad:E.OB})}}P({type:"SET_FORM_ERRORS",errors:J})},[lt,m,I,U,f,C,he,Ze]),ae=(0,e.useCallback)(async()=>{const _=(0,E.Ex)(Y,{components:w()(t,"components",{})},{isCreatingEntry:m,isDraft:!1,isFromComponent:!1}),J=await b();if(!q.show&&J>0){P({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:J}});return}P({type:"RESET_PUBLISH_CONFIRMATION"});let ie={};try{await _.validate(I,{abortEarly:!1})}catch(Se){ie=(0,h.CJ)(Se)}try{Be()(ie)&&((0,ea.flushSync)(()=>{N(!0)}),await g(),N(!1))}catch(Se){N(!1),ie={...ie,...(0,h.nn)(Se,{getTrad:E.OB})}}P({type:"SET_FORM_ERRORS",errors:ie})},[t,Y,m,I,q.show,g,b]),de=(0,e.useCallback)(_=>{const J=Object.keys(B).some(Se=>Se.split(".")[0]===_);return!Be()(B)&&J},[B]),be=(0,e.useCallback)((_,J)=>{fe.current("changeComponentsOrder"),P({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:_,currentIndex:J,shouldCheckErrors:de(_)})},[de]),ye=(0,e.useCallback)((_,J)=>{fe.current("changeComponentsOrder"),P({type:"MOVE_COMPONENT_UP",dynamicZoneName:_,currentIndex:J,shouldCheckErrors:de(_)})},[de]),tt=(0,e.useCallback)(({name:_,newIndex:J,currentIndex:ie})=>{P({type:"MOVE_COMPONENT_FIELD",keys:_.split("."),newIndex:J,oldIndex:ie})},[]),rn=(0,e.useCallback)(({name:_,id:J})=>{P({type:"DISCONNECT_RELATION",keys:_.split("."),id:J})},[]),qp=(0,e.useCallback)(({name:_,oldIndex:J,newIndex:ie})=>{P({type:"REORDER_RELATION",keys:_.split("."),oldIndex:J,newIndex:ie})},[]),Hp=(0,e.useCallback)((_,J)=>{fe.current("removeComponentFromDynamicZone"),P({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:_,index:J,shouldCheckErrors:de(_)})},[de]),Gp=(0,e.useCallback)((_,J)=>{P({type:"REMOVE_COMPONENT_FROM_FIELD",keys:_.split("."),componentUid:J})},[]),Qp=(0,e.useCallback)((_,J)=>{P({type:"REMOVE_REPEATABLE_FIELD",keys:_.split("."),componentUid:J})},[]),Kp=(0,e.useCallback)(()=>{P({type:"TRIGGER_FORM_VALIDATION"})},[]);return Ee?e.createElement(re.l_,{to:d}):I?e.createElement(h.W1.Provider,{value:{addComponentToDynamicZone:Ie,addNonRepeatableComponentToField:Ue,addRepeatableComponentToField:Ne,allLayoutData:t,checkFormErrors:He,createActionAllowedFields:i,formErrors:B,hasDraftAndPublish:A,initialData:U,isCreatingEntry:m,isSingleType:y,shouldNotRunValidations:j,status:W,layout:Y,modifiedData:I,moveComponentField:tt,moveComponentDown:be,moveComponentUp:ye,onChange:Mt,onPublish:ae,onUnpublish:k,readActionAllowedFields:v,redirectToPreviousPage:M,removeComponentFromDynamicZone:Hp,removeComponentFromField:Gp,removeRepeatableField:Qp,relationConnect:ce,relationDisconnect:rn,relationLoad:xe,relationReorder:qp,slug:L,triggerFormValidation:Kp,updateActionAllowedFields:T,onPublishPromptDismissal:Me,publishConfirmation:q}},p||!m&&!U.id?e.createElement(Te.o,{"aria-busy":"true"},e.createElement(h.dO,null)):e.createElement(e.Fragment,null,D?null:e.createElement(re.NL,{when:!Pe()(I,U),message:ue({id:"global.prompt.unsaved"})}),e.createElement("form",{noValidate:!0,onSubmit:et},a))):null};Oo.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},Oo.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 Ou=Oo;const Pu=(t={})=>Object.values(t).reduce((o,r)=>Object.assign(o,r),{});var oa=(t={})=>{const{plugins:o,_q:r,...a}={...t,...Pu(t.plugins)};return r&&(a._q=encodeURIComponent(r)),a};const ra=({allLayoutData:t,children:o,slug:r})=>{const a=(0,we.useQueryClient)(),{trackUsage:s}=(0,h.rS)(),{push:c}=(0,re.k6)(),{setCurrentStep:i}=(0,h.c1)(),d=(0,e.useRef)(s),[u,m]=(0,e.useState)(!0),[{query:p,rawQuery:y}]=(0,h.Kx)(),f=(0,e.useMemo)(()=>oa(p),[p]),g=(0,h.lm)(),b=(0,se.I0)(),{formatAPIError:C}=(0,h.So)(E.OB),k=(0,h.kY)(),{post:v,put:M,del:L}=k,{componentsDataStructure:W,contentTypeDataStructure:T,data:D,isLoading:N,status:$}=(0,se.v9)(An),P=(0,e.useCallback)(F=>{const R=(0,E.kc)(F,t.contentType,t.components);return(0,h.dU)(R,t.contentType,t.components)},[t]);(0,e.useEffect)(()=>()=>{b(Or())},[b]),(0,e.useEffect)(()=>{const F=Object.keys(t.components).reduce((K,Y)=>{const A=(0,E.Di)(w()(t,["components",Y,"attributes"],{}),t.components);return K[Y]=(0,h.dU)(A,t.components[Y],t.components),K},{}),R=(0,E.Di)(t.contentType.attributes,t.components),X=(0,h.dU)(R,t.contentType,t.components);b(Pr(F,X))},[t,b]),(0,e.useEffect)(()=>{const R=ze.default.CancelToken.source();return(async K=>{b(Ut()),m(!0);try{const{data:Y}=await k.get(`/content-manager/single-types/${r}`,{cancelToken:K.token,params:f});b(Ln(P(Y))),m(!1)}catch(Y){if(ze.default.isCancel(Y))return;const A=w()(Y,"response.status",null);A===404&&b(Sn(y,!0)),A===403&&(g({type:"info",message:{id:(0,E.OB)("permissions.not-allowed.update")}}),c("/"))}})(R),()=>R.cancel("Operation canceled by the user.")},[k,P,c,r,b,f,y,g]);const B=(0,e.useCallback)(F=>{g({type:"warning",message:C(F)})},[g,C]),U=(0,e.useCallback)(async F=>{try{d.current("willDeleteEntry",F);const{data:R}=await L(`/content-manager/single-types/${r}`,{params:f});return g({type:"success",message:{id:(0,E.OB)("success.record.delete")}}),d.current("didDeleteEntry",F),m(!0),b(Sn(y,!0)),Promise.resolve(R)}catch(R){return d.current("didNotDeleteEntry",{error:R,...F}),B(R),Promise.reject(R)}},[L,r,f,g,b,y,B]),I=(0,e.useCallback)(async(F,R)=>{const X=`/content-manager/single-types/${r}`;try{b(me("submit-pending"));const{data:K}=await M(X,F,{params:p});return d.current("didCreateEntry",R),g({type:"success",message:{id:(0,E.OB)("success.record.save")}}),i("contentManager.success"),a.invalidateQueries(["relation"]),b(Je(P(K))),m(!1),b(me("resolved")),Promise.resolve(K)}catch(K){return d.current("didNotCreateEntry",{error:K,trackerProperty:R}),B(K),b(me("resolved")),Promise.reject(K)}},[M,P,B,r,b,p,g,i,a]),G=(0,e.useCallback)(async()=>{try{d.current("willCheckDraftRelations");const F=`/content-manager/single-types/${r}/actions/countDraftRelations`;b(me("draft-relation-check-pending"));const R=await k.get(F);return d.current("didCheckDraftRelations"),b(me("resolved")),R.data.data}catch(F){return B(F),b(me("resolved")),Promise.reject(F)}},[k,B,r,b]),Z=(0,e.useCallback)(async()=>{try{d.current("willPublishEntry");const F=`/content-manager/single-types/${r}/actions/publish`;b(me("publish-pending"));const{data:R}=await v(F,{},{params:f});return d.current("didPublishEntry"),g({type:"success",message:{id:(0,E.OB)("success.record.publish")}}),b(Je(P(R))),b(me("resolved")),Promise.resolve(R)}catch(F){return B(F),b(me("resolved")),Promise.reject(F)}},[r,b,v,f,g,P,B]),q=(0,e.useCallback)(async(F,R)=>{const X=`/content-manager/single-types/${r}`;try{d.current("willEditEntry",R),b(me("submit-pending"));const{data:K}=await M(X,F,{params:p});return g({type:"success",message:{id:(0,E.OB)("success.record.save")}}),d.current("didEditEntry",{trackerProperty:R}),a.invalidateQueries(["relation"]),b(Je(P(K))),b(me("resolved")),Promise.resolve(K)}catch(K){return B(K),d.current("didNotEditEntry",{error:K,trackerProperty:R}),b(me("resolved")),Promise.reject(K)}},[M,P,B,r,b,p,g,a]),S=(0,e.useCallback)(async()=>{const F=`/content-manager/single-types/${r}/actions/unpublish`;b(me("unpublish-pending"));try{d.current("willUnpublishEntry");const{data:R}=await v(F,{},{params:f});d.current("didUnpublishEntry"),g({type:"success",message:{id:(0,E.OB)("success.record.unpublish")}}),b(Je(P(R))),b(me("resolved"))}catch(R){b(me("resolved")),B(R)}},[r,b,v,f,g,P,B]);return o({componentsDataStructure:W,contentTypeDataStructure:T,data:D,isCreatingEntry:u,isLoadingForData:N,onDelete:U,onPost:I,onDraftRelationCheck:G,onPublish:Z,onPut:q,onUnpublish:S,redirectionLink:"/",status:$})};ra.propTypes={allLayoutData:n().shape({components:n().object.isRequired,contentType:n().object.isRequired}).isRequired,children:n().func.isRequired,slug:n().string.isRequired};var Iu=(0,e.memo)(ra);function xu(t,o){return r=>{const a=o();return e.createElement(t,{...r,...a})}}var Zu=xu;function ku(){const{hasDraftAndPublish:t,modifiedData:o}=(0,h.Wq)();let r={};return t&&(r=Be()(o.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:t,trackerProperty:r}}var Lu=ku;const aa=({onDelete:t,trackerProperty:o})=>{const[r,a]=(0,e.useState)(!1),[s,c]=(0,e.useState)(!1),{formatMessage:i}=(0,Q.Z)(),{formatAPIError:d}=(0,h.So)(E.OB),u=(0,h.lm)(),m=()=>a(y=>!y),p=async()=>{try{c(!0),await t(o),c(!1),m()}catch(y){c(!1),m(),u({type:"warning",message:d(y)})}};return e.createElement(e.Fragment,null,e.createElement(le.z,{onClick:m,size:"S",startIcon:e.createElement(qe.Z,null),variant:"danger-light"},i({id:(0,E.OB)("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),e.createElement(h.QH,{isConfirmButtonLoading:s,isOpen:r,onConfirm:p,onToggleDialog:m}))};aa.propTypes={onDelete:n().func.isRequired,trackerProperty:n().object.isRequired};const Su=(0,e.memo)(aa,Pe());var Au=Zu(Su,Lu),Fu=l(56243);function $u(t,o){return r=>{const a=o();return e.createElement(t,{...r,...a})}}var wu=$u;function Bu(){const{initialData:t,hasDraftAndPublish:o}=(0,h.Wq)(),r=t.publishedAt!==void 0&&t.publishedAt!==null;return{hasDraftAndPublish:o,isPublished:r}}var Nu=Bu;const ju=(0,V.ZP)(Fu.Z)`
948
- width: ${(0,h.Q1)(6)};
949
- height: ${(0,h.Q1)(6)};
950
- * {
951
- fill: ${({theme:t,$bulletColor:o})=>t.colors[o]};
952
- }
953
- `,sa=({hasDraftAndPublish:t,isPublished:o})=>{const{formatMessage:r}=(0,Q.Z)();if(!t)return null;const a={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},s=o?a.published:a.draft;return e.createElement(H.x,{hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5,...s.box},e.createElement(H.x,{as:x.k},e.createElement(ju,{$bulletColor:s.bulletColor}),e.createElement(H.x,{paddingLeft:3},e.createElement(z.Z,{textColor:s.textColor},r({id:(0,E.OB)("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),e.createElement(z.Z,{fontWeight:"bold",textColor:s.textColor},o&&r({id:(0,E.OB)("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!o&&r({id:(0,E.OB)("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};sa.propTypes={hasDraftAndPublish:n().bool.isRequired,isPublished:n().bool.isRequired};var Wu=wu(sa,Nu);const Po=({columns:t,customFieldInputs:o})=>e.createElement(Oe.r,{gap:4},t.map(({fieldSchema:r,labelAction:a,metadatas:s,name:c,size:i,queryInfos:d})=>{if(r.type==="component"){const{component:m,max:p,min:y,repeatable:f=!1,required:g=!1}=r;return e.createElement(ve.P,{col:i,s:12,xs:12,key:m},e.createElement(Qt,{componentUid:m,labelAction:a,isRepeatable:f,intlLabel:{id:s.label,defaultMessage:s.label},max:p,min:y,name:c,required:g}))}return e.createElement(ve.P,{col:i,key:c,s:12,xs:12},e.createElement(fo,{size:i,fieldSchema:r,keys:c,labelAction:a,metadatas:s,queryInfos:d,customFieldInputs:o}))}));Po.defaultProps={customFieldInputs:{}},Po.propTypes={columns:n().array.isRequired,customFieldInputs:n().object};var zu=Po,Yt=l(22342),Xt=l(96166),Jt=l(88693);function Vu(t,o){return r=>{const a=o();return e.createElement(t,{...r,...a})}}var Uu=Vu;function qu(){const{initialData:t,isCreatingEntry:o,isSingleType:r,status:a,layout:s,hasDraftAndPublish:c,modifiedData:i,onPublish:d,onUnpublish:u,publishConfirmation:m,onPublishPromptDismissal:p}=(0,h.Wq)();return{initialData:t,isCreatingEntry:o,isSingleType:r,status:a,layout:s,hasDraftAndPublish:c,modifiedData:i,onPublish:d,onUnpublish:u,publishConfirmation:m,onPublishPromptDismissal:p}}var Hu=qu;const ia=(0,V.ZP)(x.k)`
954
- text-align: center;
955
- `,la=({allowedActions:{canUpdate:t,canCreate:o,canPublish:r},initialData:a,isCreatingEntry:s,isSingleType:c,hasDraftAndPublish:i,layout:d,modifiedData:u,onPublish:m,onUnpublish:p,status:y,publishConfirmation:{show:f,draftCount:g},onPublishPromptDismissal:b})=>{const{goBack:C}=(0,re.k6)(),[k,v]=(0,e.useState)(!1),{formatMessage:M}=(0,Q.Z)(),L=w()(d,["settings","mainField"],"id"),W=w()(d,["info","displayName"],"NOT FOUND"),T=!Pe()(a,u)||s&&!Be()(u);let N=M({id:(0,E.OB)("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!s&&!c&&(N=a[L]||W),c&&(N=W);let $=null;if(s&&o&&($=e.createElement(x.k,{gap:2},i&&e.createElement(le.z,{disabled:!0,startIcon:e.createElement(We.Z,null),variant:"secondary"},M({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(le.z,{disabled:!T,loading:y==="submit-pending",type:"submit"},M({id:(0,E.OB)("containers.Edit.submit"),defaultMessage:"Save"})))),!s&&t){const I=i&&r,G=!Be()(a.publishedAt),Z=G?y==="unpublish-pending":y==="publish-pending",q=G?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},S=G?()=>v(!0):()=>m();$=e.createElement(x.k,null,I&&e.createElement(le.z,{disabled:T,loading:Z,onClick:S,startIcon:e.createElement(We.Z,null),variant:"secondary"},M(q)),e.createElement(H.x,{paddingLeft:I?2:0},e.createElement(le.z,{disabled:!T,loading:y==="submit-pending",type:"submit"},M({id:(0,E.OB)("containers.Edit.submit"),defaultMessage:"Save"}))))}const P=()=>v(I=>!I),B=()=>{P(),p()},U=`${M({id:(0,E.OB)("api.id"),defaultMessage:"API ID "})} : ${d.apiID}`;return e.createElement(e.Fragment,null,e.createElement(De.T,{title:N.toString(),primaryAction:$,subtitle:U,navigationAction:e.createElement(h.rU,{startIcon:e.createElement(rt.Z,null),onClick:I=>{I.preventDefault(),C()},to:"/"},M({id:"global.back",defaultMessage:"Back"}))}),e.createElement(Yt.V,{onClose:P,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:k},e.createElement(Xt.a,{icon:e.createElement(Ft.Z,null)},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(x.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(z.Z,{id:"confirm-description"},M({id:(0,E.OB)("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>e.createElement("br",null)}))),e.createElement(x.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(z.Z,{id:"confirm-description"},M({id:(0,E.OB)("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),e.createElement(Jt.c,{startAction:e.createElement(le.z,{onClick:P,variant:"tertiary"},M({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(le.z,{variant:"danger-light",onClick:B},M({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),e.createElement(Yt.V,{onClose:b,title:M({id:(0,E.OB)("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:f},e.createElement(Xt.a,{icon:e.createElement(Ft.Z,null)},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(ia,{justifyContent:"center"},e.createElement(z.Z,{id:"confirm-description"},g,M({id:(0,E.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:I=>e.createElement(z.Z,{fontWeight:"bold"},I),count:g}))),e.createElement(ia,{justifyContent:"center"},e.createElement(z.Z,{id:"confirm-description"},M({id:(0,E.OB)("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),e.createElement(Jt.c,{startAction:e.createElement(le.z,{onClick:b,variant:"tertiary"},M({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(le.z,{variant:"success",onClick:m},M({id:(0,E.OB)("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};la.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 Gu=(0,e.memo)(la,Pe());var Qu=Uu(Gu,Hu);const Ku=t=>(0,e.useEffect)(t,Yu),Yu=[];var Io=l(98865);function Xu(){return e.createElement(Io.d.Root,null,e.createElement(Io.d.Title,null),e.createElement(Io.d.Body,null))}var xo=l(98178),Ju=t=>{if(!t.layouts)return[];const o=t.layouts.edit,r=t.attributes,a=i=>w()(r,[i,"type"],"");let s=0;const c=[];return o.forEach(i=>{const d=i.some(({name:u})=>a(u)==="dynamiczone");c[s]||(c[s]=[]),d?(s=s===0&&Be()(c[0])?0:s+1,c[s]||(c[s]=[]),c[s].push(i),s+=1):c[s].push(i)}),c.filter(i=>i.length>0)},_u=t=>{if(!t)return[];const r=[...t.contentType.layouts.edit,...Object.values(t.components).flatMap(s=>s.layouts.edit)].flat().filter(s=>s.fieldSchema.customField).map(s=>s.fieldSchema.customField);return[...new Set(r)]},em=l(3704),tm=l.n(em),nm=l(91815),om=l.n(nm),rm=(t,o)=>{const r=a=>{const s=(0,h.ZT)(t,[{action:`plugin::content-manager.explorer.${a}`,subject:o}]);return om()(tm()(s,"properties.fields"))};return{createActionAllowedFields:r("create"),readActionAllowedFields:r("read"),updateActionAllowedFields:r("update")}};const Zo=t=>t["content-manager_editViewLayoutManager"].currentLayout,am=(0,xo.P1)(Zo,t=>Ju(t?.contentType??{})),sm=(0,xo.P1)(Zo,t=>_u(t)),im=[{action:"plugin::content-type-builder.read",subject:null}],ko=({allowedActions:t,isSingleType:o,goBack:r,slug:a,id:s,origin:c,userPermissions:i})=>{const{trackUsage:d}=(0,h.rS)(),{formatMessage:u}=(0,Q.Z)(),m=(0,se.v9)(je._),p=(0,re.TH)(),y=(0,h.lm)(),f=(0,kn.c)(Xu,async()=>(await l.e(5483).then(l.bind(l,90978))).InformationBoxEE);Ku(()=>{p?.state&&"error"in p.state&&y({type:"warning",message:p.state.error,timeout:5e3})});const{layout:g,formattedContentTypeLayout:b,customFieldUids:C}=(0,se.v9)(P=>({layout:Zo(P),formattedContentTypeLayout:am(P),customFieldUids:sm(P)})),{isLazyLoading:k,lazyComponentStore:v}=Hn(C),{createActionAllowedFields:M,readActionAllowedFields:L,updateActionAllowedFields:W}=rm(i,a),T=o?m.contentManager.singleTypesConfigurations:m.contentManager.collectionTypesConfigurations,D=`/content-manager/${o?"singleType":"collectionType"}/${a}/configurations/edit`,N=o?Iu:Vl,$=P=>P.every(B=>B.every(U=>U.fieldSchema.type==="dynamiczone"));return k?e.createElement(h.dO,null):f?e.createElement(N,{allLayoutData:g,slug:a,id:s,origin:c},({componentsDataStructure:P,contentTypeDataStructure:B,data:U,isCreatingEntry:I,isLoadingForData:G,onDelete:Z,onPost:q,onPublish:S,onDraftRelationCheck:F,onPut:R,onUnpublish:X,redirectionLink:K,status:Y})=>e.createElement(Ou,{allowedActions:t,allLayoutData:g,createActionAllowedFields:M,componentsDataStructure:P,contentTypeDataStructure:B,from:K,initialValues:U,isCreatingEntry:I,isLoadingForData:G,isSingleType:o,onPost:q,onPublish:S,onDraftRelationCheck:F,onPut:R,onUnpublish:X,readActionAllowedFields:L,redirectToPreviousPage:r,slug:a,status:Y,updateActionAllowedFields:W},e.createElement(Te.o,{"aria-busy":Y!=="resolved"},e.createElement(Qu,{allowedActions:t}),e.createElement(Qe.D,null,e.createElement(Oe.r,{gap:4},e.createElement(ve.P,{col:9,s:12},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:6},b.map((A,j)=>{if($(A)){const{0:{0:{name:oe,fieldSchema:ue,metadatas:fe,labelAction:Ee}}}=A;return e.createElement(H.x,{key:j},e.createElement(Oe.r,{gap:4},e.createElement(ve.P,{col:12,s:12,xs:12},e.createElement(To,{name:oe,fieldSchema:ue,labelAction:Ee,metadatas:fe}))))}return e.createElement(H.x,{key:j,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:6},A.map((oe,ue)=>e.createElement(zu,{columns:oe,customFieldInputs:v,key:ue}))))}))),e.createElement(ve.P,{col:3,s:12},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Wu,null),e.createElement(H.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(f,null),e.createElement(Vt,{area:"contentManager.editView.informations"})),e.createElement(H.x,{as:"aside","aria-labelledby":"links"},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Vt,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&e.createElement(h.jW,{permissions:im},e.createElement(h.Qj,{onClick:()=>{d("willEditEditLayout")},size:"S",startIcon:e.createElement(Ke.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},u({id:(0,E.OB)("link-to-ctb"),defaultMessage:"Edit the model"}))),e.createElement(h.jW,{permissions:T},e.createElement(h.Qj,{size:"S",startIcon:e.createElement(sr.Z,null),style:{width:"100%"},to:D,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),t.canDelete&&!I&&e.createElement(Au,{onDelete:Z})))))))))):null};ko.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},ko.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 lm=ko;const Lo=t=>{const o=(0,e.useMemo)(()=>(0,E.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:a}=(0,h.ss)(o,t.userPermissions);return r?e.createElement(h.dO,null):e.createElement(lm,{...t,allowedActions:a})};Lo.defaultProps={permissions:[]},Lo.propTypes={permissions:n().array,slug:n().string.isRequired,userPermissions:n().array.isRequired};var cm=(0,e.memo)(Lo,Pe()),dm=l(53634);const ca=({layout:t,...o})=>{const r=(0,se.v9)(dm.Z),a=(0,se.I0)(),[{query:s}]=(0,h.Kx)(),{runHookWaterfall:c}=(0,h.j1)(),{permissions:i,isValid:d}=(0,te.r5)(s,o.slug,"editView");return(0,e.useEffect)(()=>{const u=c(zt.Eo,{layout:t,query:s});return a(Nl(u.layout,s)),()=>{a(Bl())}},[t,a,s,c]),!r||!d?e.createElement(h.dO,null):e.createElement(cm,{...o,userPermissions:i})};ca.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 _t=ca,en=l(33348);const um=(0,V.ZP)(x.k)`
956
- svg {
957
- width: ${32/16}rem;
958
- height: ${24/16}rem;
959
- margin-right: ${({theme:t})=>t.spaces[3]};
960
- }
961
- `,da=({attributes:t,fieldForm:o,fieldToEdit:r,onCloseModal:a,onChangeEditLabel:s,onSubmit:c,type:i})=>{const{formatMessage:d}=(0,Q.Z)(),u=t[r].relationType;let m=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(u)&&(m=!0),e.createElement(hn.P,{onClose:a,labelledBy:"title"},e.createElement("form",{onSubmit:c},e.createElement(yn.x,null,e.createElement(um,null,e.createElement(br,{type:i}),e.createElement(z.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},d({id:(0,E.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:at()(r)})))),e.createElement(En.f,null,e.createElement(Oe.r,{gap:4},e.createElement(ve.P,{s:12,col:6},e.createElement(Mn.o,{id:"label-input",label:d({id:(0,E.OB)("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:p=>s(p),value:o.label,hint:d({id:(0,E.OB)("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),m&&e.createElement(ve.P,{s:12,col:6},e.createElement(Lt.s,{"data-testid":"Enable sort on this field",checked:o.sortable,label:d({id:(0,E.OB)("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:p=>s({target:{name:"sortable",value:p.target.checked}}),onLabel:d({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:d({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),e.createElement(bn.m,{startActions:e.createElement(le.z,{onClick:a,variant:"tertiary"},d({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(le.z,{type:"submit"},d({id:"global.finish",defaultMessage:"Finish"}))})))};da.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};const So=({modifiedData:t,onChange:o,sortOptions:r})=>{const{formatMessage:a}=(0,Q.Z)(),{settings:s,metadatas:c}=t;return e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(z.Z,{variant:"delta",as:"h2"},a({id:(0,E.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(x.k,{justifyContent:"space-between",gap:4},e.createElement(H.x,{width:"100%"},e.createElement(Lt.s,{label:a({id:(0,E.OB)("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{o({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:s.searchable})),e.createElement(H.x,{width:"100%"},e.createElement(Lt.s,{label:a({id:(0,E.OB)("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{o({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:s.filterable})),e.createElement(H.x,{width:"100%"},e.createElement(Lt.s,{label:a({id:(0,E.OB)("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{o({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:s.bulkable}))),e.createElement(Oe.r,{gap:4},e.createElement(ve.P,{s:12,col:6},e.createElement(Fe.P,{label:a({id:(0,E.OB)("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:a({id:(0,E.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(Ce.W,{key:i,value:i},i)))),e.createElement(ve.P,{s:12,col:3},e.createElement(Fe.P,{label:a({id:(0,E.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(Ce.W,{key:i,value:i},c[i].list.label||i)))),e.createElement(ve.P,{s:12,col:3},e.createElement(Fe.P,{label:a({id:(0,E.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(Ce.W,{key:i,value:i},i))))))};So.defaultProps={modifiedData:{},sortOptions:[]},So.propTypes={modifiedData:n().object,onChange:n().func.isRequired,sortOptions:n().array};const Ao=(0,V.ZP)(x.k)`
962
- height: ${({theme:t})=>t.spaces[7]};
963
-
964
- &:last-child {
965
- padding: 0 ${({theme:t})=>t.spaces[3]};
966
- }
967
- `,mm=(0,V.ZP)(Ao)`
968
- border-right: 1px solid
969
- ${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
970
-
971
- svg {
972
- width: ${12/16}rem;
973
- height: ${12/16}rem;
974
- }
975
- `,pm=(0,V.ZP)(x.k)`
976
- border: 1px solid
977
- ${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
978
-
979
- svg {
980
- width: ${10/16}rem;
981
- height: ${10/16}rem;
982
-
983
- path {
984
- fill: ${({theme:t,isSibling:o})=>o?void 0:t.colors.primary600};
985
- }
986
- }
987
- `,gm=(0,V.ZP)(z.Z)`
988
- max-width: ${72/16}rem;
989
- `;function wt({labelField:t,transparent:o,isSibling:r}){return e.createElement(pm,{background:r?"neutral100":"primary100",display:"inline-flex",gap:3,hasRadius:!0,justifyContent:"space-between",transparent:o,isSibling:r,"max-height":(0,h.Q1)(32),maxWidth:"min-content",opacity:o?0:1},e.createElement(x.k,{gap:3},e.createElement(mm,{alignItems:"center",cursor:"all-scroll",padding:3},e.createElement(Ye.Z,null)),e.createElement(gm,{textColor:r?void 0:"primary600",fontWeight:"bold",ellipsis:!0},t)),e.createElement(x.k,null,e.createElement(Ao,{alignItems:"center"},e.createElement(Ke.Z,null)),e.createElement(Ao,{alignItems:"center"},e.createElement(qt.Z,null))))}wt.defaultProps={isSibling:!1,transparent:!1},wt.propTypes={isSibling:n().bool,labelField:n().string.isRequired,transparent:n().bool};const Fo=V.ZP.button`
990
- display: flex;
991
- align-items: center;
992
- height: ${({theme:t})=>t.spaces[7]};
993
-
994
- &:last-child {
995
- padding: 0 ${({theme:t})=>t.spaces[3]};
996
- }
997
- `,ua=(0,V.ZP)(Fo)`
998
- padding: 0 ${({theme:t})=>t.spaces[3]};
999
- border-right: 1px solid ${({theme:t})=>t.colors.neutral150};
1000
- cursor: all-scroll;
1001
-
1002
- svg {
1003
- width: ${12/16}rem;
1004
- height: ${12/16}rem;
1005
- }
1006
- `,fm=(0,V.ZP)(x.k)`
1007
- max-height: ${32/16}rem;
1008
- cursor: pointer;
1009
-
1010
- svg {
1011
- width: ${10/16}rem;
1012
- height: ${10/16}rem;
1013
-
1014
- path {
1015
- fill: ${({theme:t})=>t.colors.neutral600};
1016
- }
1017
- }
1018
-
1019
- &:hover {
1020
- background-color: ${({theme:t})=>t.colors.primary100};
1021
- border-color: ${({theme:t})=>t.colors.primary200};
1022
-
1023
- svg {
1024
- path {
1025
- fill: ${({theme:t})=>t.colors.primary600};
1026
- }
1027
- }
1028
-
1029
- ${z.Z} {
1030
- color: ${({theme:t})=>t.colors.primary600};
1031
- }
1032
-
1033
- ${ua} {
1034
- border-right: 1px solid ${({theme:t})=>t.colors.primary200};
1035
- }
1036
- }
1037
- `,hm=(0,V.ZP)(H.x)`
1038
- &:last-child {
1039
- padding-right: ${({theme:t})=>t.spaces[3]};
1040
- }
1041
- `,ma=({index:t,isDraggingSibling:o,labelField:r,onClickEditField:a,onMoveField:s,onRemoveField:c,name:i,setIsDraggingSibling:d})=>{const{formatMessage:u}=(0,Q.Z)(),m=(0,e.useRef)(null),p=(0,e.useRef)(null),[,y]=(0,e.useState)(!1),f=(0,e.useRef)(),g=()=>{f.current&&f.current.click()},[,b]=(0,jt.useDrop)({accept:E._Q.FIELD,hover(L,W){if(!p.current)return;const T=L.index,D=t;if(T===D)return;const N=p.current.getBoundingClientRect(),$=(N.right-N.left)/2,B=W.getClientOffset().x-N.left;T>D&&B>$||T<D&&B<$||(s(T,D),L.index=D)}}),[{isDragging:C},k,v]=(0,jt.useDrag)({type:E._Q.FIELD,item(){return{index:t,labelField:r,name:i}},collect:L=>({isDragging:L.isDragging()}),end(){d(!1)}});(0,e.useEffect)(()=>{v((0,xt.rX)(),{captureDraggingState:!1})},[v]),(0,e.useEffect)(()=>{C&&d(!0)},[C,d]),(0,e.useEffect)(()=>{o||y(L=>!L)},[o]);const M={dragRef:k(m),dropRef:b(p)};return e.createElement(hm,{ref:M?M.dropRef:null},C&&e.createElement(wt,{transparent:!0,labelField:r}),!C&&o&&e.createElement(wt,{isSibling:!0,labelField:r}),!C&&!o&&e.createElement(fm,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:g,isDragging:C},e.createElement(x.k,{gap:3},e.createElement(ua,{as:"span","aria-label":u({id:(0,E.OB)("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:r}),onClick:L=>L.stopPropagation(),ref:M.dragRef,type:"button"},e.createElement(Ye.Z,null)),e.createElement(z.Z,{fontWeight:"bold"},r)),e.createElement(x.k,{paddingLeft:3},e.createElement(Fo,{ref:f,onClick:L=>{L.stopPropagation(),a(i)},"aria-label":u({id:(0,E.OB)("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:r}),type:"button"},e.createElement(Ke.Z,null)),e.createElement(Fo,{onClick:c,"data-testid":`delete-${i}`,"aria-label":u({id:(0,E.OB)("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:r}),type:"button"},e.createElement(qt.Z,null)))))};ma.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 ym=ma;const pa=({displayedFields:t,listRemainingFields:o,metadatas:r,onAddField:a,onClickEditField:s,onMoveField:c,onRemoveField:i})=>{const{formatMessage:d}=(0,Q.Z)(),[u,m]=(0,e.useState)(!1),[p,y]=(0,e.useState)(null),f=(0,e.useRef)();function g(...C){y("add"),a(...C)}function b(...C){y("remove"),i(...C)}return(0,e.useEffect)(()=>{p==="add"&&f?.current&&(f.current.scrollLeft=f.current.scrollWidth)},[t,p]),e.createElement(x.k,{alignItems:"stretch",direction:"column",gap:4},e.createElement(z.Z,{variant:"delta",as:"h2"},d({id:(0,E.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(x.k,{padding:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},e.createElement(H.x,{flex:"1",overflow:"scroll hidden",ref:f},e.createElement(x.k,{gap:3},t.map((C,k)=>e.createElement(ym,{key:C,index:k,isDraggingSibling:u,onMoveField:c,onClickEditField:s,onRemoveField:v=>b(v,k),name:C,labelField:r[C].list.label||C,setIsDraggingSibling:m})))),e.createElement(ge.fC,null,e.createElement(ge.xz,{paddingLeft:2,paddingRight:2,justifyContent:"center",endIcon:null,disabled:o.length<=0,variant:"tertiary"},e.createElement(_e.T,{as:"span"},d({id:(0,E.OB)("components.FieldSelect.label"),defaultMessage:"Add a field"})),e.createElement(gt.Z,{"aria-hidden":!0,focusable:!1,style:{position:"relative",top:2}})),e.createElement(ge.VY,null,o.map(C=>e.createElement(ge.ck,{key:C,onSelect:()=>g(C)},r[C].list.label||C))))))};pa.propTypes={displayedFields:ke.PropTypes.array.isRequired,listRemainingFields:ke.PropTypes.array.isRequired,metadatas:ke.PropTypes.objectOf(ke.PropTypes.shape({list:ke.PropTypes.shape({label:ke.PropTypes.string})})).isRequired,onAddField:ke.PropTypes.func.isRequired,onClickEditField:ke.PropTypes.func.isRequired,onMoveField:ke.PropTypes.func.isRequired,onRemoveField:ke.PropTypes.func.isRequired};const Em=["media","richtext","dynamiczone","relation","component","json"],$o={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}};var bm=(t=$o,o)=>(0,Pn.ZP)(t,r=>{const a=["modifiedData","layouts","list"];switch(o.type){case"ADD_FIELD":{const s=w()(t,a,[]);ne()(r,a,[...s,o.item]);break}case"MOVE_FIELD":{const s=w()(t,a,[]),{originalIndex:c,atIndex:i}=o;ne()(r,a,(0,E.W3)(s,c,i));break}case"ON_CHANGE":{ne()(r,["modifiedData",...o.keys.split(".")],o.value);break}case"ON_CHANGE_FIELD_METAS":{ne()(r,["fieldForm",o.name],o.value);break}case"REMOVE_FIELD":{const s=w()(t,a,[]);ne()(r,a,s.filter((c,i)=>o.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:s}=o;r.fieldToEdit=s,r.fieldForm.label=w()(r,["modifiedData","metadatas",s,"list","label"],""),r.fieldForm.sortable=w()(r,["modifiedData","metadatas",s,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{r.fieldForm={},r.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const s=["modifiedData","metadatas",t.fieldToEdit,"list"];ne()(r,[...s,"label"],t.fieldForm.label),ne()(r,[...s,"sortable"],t.fieldForm.sortable);break}default:return r}});const ga=({layout:t,slug:o})=>{const{put:r}=(0,h.kY)(),{formatMessage:a}=(0,Q.Z)(),{trackUsage:s}=(0,h.rS)(),c=(0,te.fi)(),i=(0,h.lm)(),{refetchData:d}=e.useContext(Pt),[{fieldToEdit:u,fieldForm:m,initialData:p,modifiedData:y},f]=e.useReducer(bm,$o,()=>({...$o,initialData:t,modifiedData:t})),g=Object.keys(m).length!==0,{attributes:b}=t,C=y.layouts.list,k=()=>{const{settings:{pageSize:Z,defaultSortBy:q,defaultSortOrder:S},kind:F,uid:R}=p,X=`${q}:${S}`,K=`${(0,en.stringify)({page:1,pageSize:Z,sort:X},{encode:!1})}${c?`&${c}`:""}`;return`/content-manager/${F}/${R}?${K}`},v=({target:{name:Z,value:q}})=>{f({type:"ON_CHANGE",keys:Z,value:Z==="settings.pageSize"?parseInt(q,10):q})},{isLoading:M,mutate:L}=(0,we.useMutation)(Z=>r(`/content-manager/content-types/${o}/configuration`,Z),{onSuccess(){s("didEditListSettings"),d()},onError(){i({type:"warning",message:{id:"notification.error"}})}}),W=Z=>{f({type:"ADD_FIELD",item:Z})},T=(Z,q)=>{Z.stopPropagation(),C.length===1?i({type:"info",message:{id:(0,E.OB)("notification.info.minimumFields")}}):f({type:"REMOVE_FIELD",index:q})},D=Z=>{Z.preventDefault();const{layouts:q,settings:S,metadatas:F}=y;L({layouts:q,settings:S,metadatas:F}),s("willSaveContentTypeLayout")},N=Z=>{f({type:"SET_FIELD_TO_EDIT",fieldToEdit:Z})},$=()=>{f({type:"UNSET_FIELD_TO_EDIT"})},P=Z=>{Z.preventDefault(),f({type:"SUBMIT_FIELD_FORM"}),$()},B=({target:{name:Z,value:q}})=>{f({type:"ON_CHANGE_FIELD_METAS",name:Z,value:q})},U=Object.entries(b).filter(([Z,q])=>(0,E.ko)(q)&&!C.includes(Z)).map(([Z])=>Z).sort(),I=Object.entries(b).filter(([,Z])=>!Em.includes(Z.type)).map(([Z])=>Z),G=(Z,q)=>{f({type:"MOVE_FIELD",originalIndex:Z,atIndex:q})};return e.createElement(nt.A,null,e.createElement(Te.o,{"aria-busy":M},e.createElement("form",{onSubmit:D},e.createElement(De.T,{navigationAction:e.createElement(h.rU,{startIcon:e.createElement(rt.Z,null),to:k,id:"go-back"},a({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(le.z,{size:"S",startIcon:e.createElement(We.Z,null),disabled:Pe()(y,p),type:"submit"},a({id:"global.save",defaultMessage:"Save"})),subtitle:a({id:(0,E.OB)("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:a({id:(0,E.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:at()(y.info.displayName)})}),e.createElement(Qe.D,null,e.createElement(x.k,{alignItems:"stretch",background:"neutral0",direction:"column",gap:6,hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(So,{modifiedData:y,onChange:v,sortOptions:I}),e.createElement(Nt.i,null),e.createElement(pa,{listRemainingFields:U,displayedFields:C,onAddField:W,onClickEditField:N,onMoveField:G,onRemoveField:T,metadatas:y.metadatas})))),g&&e.createElement(da,{attributes:b,fieldForm:m,fieldToEdit:u,onChangeEditLabel:B,onCloseModal:$,onSubmit:P,type:b?.[u]?.type??"text"})))};ga.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 vt=l(93088);const vm=()=>({type:vt.ZA}),Cm=(t,o)=>({type:vt.Id,pagination:t,data:o}),Rm=()=>({type:vt.MP});function Mm(){return{type:vt.c2}}const Tm=({components:t,contentType:o})=>{const{layouts:r}=o;return{contentType:o,components:t,displayedHeaders:r.list,type:vt.Zz}},wo=t=>({type:vt.Rp,target:t});var Bo=l(94638),fa=l(99223),ha=l(94547),Ve=l(19786),Dm=l(12301),Om=l(59177),ya=l(6680);const Ea=({displayedFilters:t})=>{const[o,r]=(0,e.useState)(!1),{formatMessage:a}=(0,Q.Z)(),s=(0,e.useRef)(),{trackUsage:c}=(0,h.rS)(),i=()=>{o||c("willFilterEntries"),r(d=>!d)};return e.createElement(e.Fragment,null,e.createElement(H.x,{paddingTop:1,paddingBottom:1},e.createElement(le.z,{variant:"tertiary",ref:s,startIcon:e.createElement(ar.Z,null),onClick:i,size:"S"},a({id:"app.utils.filters",defaultMessage:"Filters"})),o&&e.createElement(h.J5,{displayedFilters:t,isVisible:o,onToggle:i,source:s})),e.createElement(h.W$,{filtersSchema:t}))};Ea.propTypes={displayedFilters:n().arrayOf(n().shape({name:n().string.isRequired,metadatas:n().shape({label:n().string}),fieldSchema:n().shape({type:n().string})})).isRequired};var Pm=Ea;const Im=["json","component","media","richtext","dynamiczone","password"],xm=["createdAt","updatedAt"];var Zm=(t,o)=>{const{allPermissions:r}=(0,h.vn)(),a=(0,h.ZT)(r,[{action:"plugin::content-manager.explorer.read",subject:o}]),s=w()(a,["0","properties","fields"],[]);return Object.keys(w()(t,["attributes"]),{}).filter(d=>{const u=w()(t,["attributes",d],{});return!(!u.type||Im.includes(u.type)||!s.includes(d)&&d!=="id"&&!xm.includes(d))}).sort()};const ba=({contentType:t,slug:o,metadatas:r})=>{const{formatMessage:a}=(0,Q.Z)(),c=Zm(t,o).map(i=>{const d=t.attributes[i],{type:u,enum:m}=d,p={name:"didFilterEntries",properties:{useRelation:u==="relation"}},{mainField:y,label:f}=r[i].list;return{name:i,metadatas:{label:a({id:f,defaultMessage:f})},fieldSchema:{type:u,options:m,mainField:y},trackedEvent:p}});return e.createElement(Pm,{displayedFilters:c})};ba.propTypes={contentType:n().object.isRequired,metadatas:n().object.isRequired,slug:n().string.isRequired};var km=ba,Lm=l(82884),Sm=l(47765);const va=({area:t,...o})=>{const r=Tr(t);return r?e.createElement("ul",null,r.map(a=>a.Component(o)?e.createElement(H.x,{key:a.name,padding:3,style:{textAlign:"center"}},e.createElement(a.Component,{...o})):null)):null};va.propTypes={area:n().string.isRequired};var tn=va;const Ca=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(Yt.V,{onClose:r,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(Xt.a,{icon:e.createElement(Ft.Z,null)},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(x.k,{justifyContent:"center"},e.createElement(z.Z,{id:"confirm-description"},s({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),e.createElement(x.k,null,e.createElement(tn,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(Jt.c,{startAction:e.createElement(le.z,{onClick:r,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(le.z,{onClick:a,variant:"danger-light",startIcon:e.createElement(qe.Z,null),id:"confirm-delete",loading:t},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Ca.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};const Ra=t=>t.stopPropagation(),Ma=({rowId:t,index:o})=>{const{selectedEntries:r,onSelectRow:a}=(0,h.Sh)(),{formatMessage:s}=(0,Q.Z)(),c=r.findIndex(d=>d===t)!==-1,i=s({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:o+1});return e.createElement(Ve.Td,{onClick:Ra},e.createElement(Lm.C,{"aria-label":i,checked:c,onChange:()=>{a({name:t,value:!c})}}))};Ma.propTypes={rowId:n().number.isRequired,index:n().number.isRequired};const No=({rowId:t,index:o,canCreate:r,canDelete:a,setIsConfirmDeleteRowOpen:s,handleCloneClick:c})=>{const{formatMessage:i}=(0,Q.Z)(),{trackUsage:d}=(0,h.rS)(),{setSelectedEntries:u}=(0,h.Sh)(),m=(0,te.fi)(),{location:{pathname:p}}=(0,re.k6)(),y=i({id:"content-manager.components.ListViewTable.row-line",defaultMessage:"item line {number}"},{number:o+1});return e.createElement(Ve.Td,null,e.createElement(x.k,{gap:1,justifyContent:"end",onClick:Ra},e.createElement(Re.h,{forwardedAs:ft.rU,onClick:()=>{d("willEditEntryFromButton")},to:{pathname:`${p}/${t}`,state:{from:p},search:m},label:i({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:y}),noBorder:!0},e.createElement(Ke.Z,null)),r&&e.createElement(Re.h,{onClick:c(t),label:i({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:y}),noBorder:!0},e.createElement(Sm.Z,null)),a&&e.createElement(Re.h,{onClick:()=>{d("willDeleteEntryFromList"),u([t]),s(!0)},label:i({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:y}),noBorder:!0},e.createElement(qe.Z,null))))};No.defaultProps={canCreate:!1,canDelete:!1},No.propTypes={rowId:n().number.isRequired,index:n().number.isRequired,setIsConfirmDeleteRowOpen:n().func.isRequired,handleCloneClick:n().func.isRequired,canCreate:n().bool,canDelete:n().bool};const Ta=({children:t,onConfirmDelete:o,isConfirmDeleteRowOpen:r,setIsConfirmDeleteRowOpen:a})=>{const[s,c]=e.useState(!1),{selectedEntries:i,setSelectedEntries:d}=(0,h.Sh)(),u=async()=>{try{c(!0),await o(i[0]),a(!1),c(!1),d([])}catch{c(!1),a(!1)}};return e.createElement(h.iA.Body,null,t,e.createElement(Ca,{isConfirmButtonLoading:s,onConfirm:u,onToggleDialog:()=>a(!r),isOpen:r}))};Ta.propTypes={children:n().node.isRequired,onConfirmDelete:n().func.isRequired,isConfirmDeleteRowOpen:n().bool.isRequired,setIsConfirmDeleteRowOpen:n().func.isRequired};const nn={CheckboxDataCell:Ma,EntityActionsDataCell:No,Root:Ta};var Am=l(14090);const Ct=()=>t=>t["content-manager_listView"]||Am.E,Fm=()=>(0,xo.P1)(Ct(),t=>t),Da=t=>{const{displayedHeaders:o}=t["content-manager_listView"];return o};var $m=Fm;const on=({onToggleDialog:t,isOpen:o,dialogBody:r,endAction:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(Yt.V,{onClose:t,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),isOpen:o},e.createElement(Xt.a,{icon:e.createElement(Ft.Z,null)},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:2},r)),e.createElement(Jt.c,{startAction:e.createElement(le.z,{onClick:t,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:a}))};on.propTypes={isOpen:n().bool.isRequired,onToggleDialog:n().func.isRequired,dialogBody:n().node.isRequired,endAction:n().node.isRequired};const jo={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired},wm=t=>e.createElement(z.Z,{fontWeight:"bold"},t),Oa=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)(),{get:c}=(0,h.kY)(),{selectedEntries:i}=(0,h.Sh)(),d=(0,h.lm)(),{formatAPIError:u}=(0,h.So)(E.OB),{contentType:{uid:m}}=(0,se.v9)(Ct()),{data:p,isLoading:y,isError:f}=(0,we.useQuery)(["content-manager","draft-relations",m,i],async()=>{const{data:{data:g}}=await c(`/content-manager/collection-types/${m}/actions/countManyEntriesDraftRelations`,{params:{ids:i}});return g},{enabled:i.length>0,onError(g){d({type:"warning",message:u(g)})}});return f?null:e.createElement(on,{isOpen:t&&!y,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(z.Z,{id:"confirm-description",textAlign:"center"},p>0&&s({id:(0,E.OB)("popUpwarning.warning.bulk-has-draft-relations.message"),defaultMessage:"<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "},{b:wm,count:p,entities:i.length}),s({id:(0,E.OB)("popUpWarning.bodyMessage.contentType.publish.all"),defaultMessage:"Are you sure you want to publish these entries?"})),e.createElement(tn,{area:"contentManager.listView.publishModalAdditionalInfos"})),endAction:e.createElement(le.z,{onClick:a,variant:"secondary",startIcon:e.createElement(We.Z,null),loading:r},s({id:"app.utils.publish",defaultMessage:"Publish"}))})};Oa.propTypes=jo;var Pa=l(23866),Bm=l(88890),Nm=l(5074);const jm=(0,V.ZP)(z.Z)`
1042
- max-width: 300px;
1043
- `,Wo=({validationErrors:t,isPublished:o})=>{const{formatMessage:r}=(0,Q.Z)();if(t){const a=Object.entries(t).map(([s,c])=>r({id:`${c.id}.withField`,defaultMessage:c.defaultMessage},{field:s})).join(" ");return e.createElement(x.k,{gap:2},e.createElement(ht.J,{color:"danger600",as:Bm.Z}),e.createElement($t.u,{description:a},e.createElement(jm,{textColor:"danger600",variant:"omega",fontWeight:"semiBold",ellipsis:!0},a)))}return o?e.createElement(x.k,{gap:2},e.createElement(ht.J,{color:"success600",as:Gn.Z}),e.createElement(z.Z,{textColor:"success600",fontWeight:"bold"},r({id:"content-manager.bulk-publish.already-published",defaultMessage:"Already Published"}))):e.createElement(x.k,{gap:2},e.createElement(ht.J,{color:"success600",as:Gn.Z}),e.createElement(z.Z,null,r({id:"app.utils.ready-to-publish",defaultMessage:"Ready to publish"})))};Wo.defaultProps={validationErrors:void 0,isPublished:!1},Wo.propTypes={validationErrors:n().shape({[n().string]:n().shape({id:n().string,defaultMessage:n().string})}),isPublished:n().bool};const zo=({isPublishing:t,rowsToDisplay:o,entriesToPublish:r,validationErrors:a})=>{const{location:{pathname:s}}=(0,re.k6)(),{formatMessage:c}=(0,Q.Z)(),i=(0,se.v9)(Ct()),{mainField:d}=i.contentType.settings,u=d!=null&&d!=="id",m=p=>c({id:"content-manager.components.ListViewTable.row-line",defaultMessage:"item line {number}"},{number:p+1});return e.createElement(h.iA.Content,null,e.createElement(h.iA.Head,null,e.createElement(h.iA.HeaderCheckboxCell,null),e.createElement(h.iA.HeaderCell,{fieldSchemaType:"number",label:"id",name:"id"}),u&&e.createElement(h.iA.HeaderCell,{fieldSchemaType:"string",label:"name",name:"name"}),e.createElement(h.iA.HeaderCell,{fieldSchemaType:"string",label:"status",name:"status"})),e.createElement(h.iA.LoadingBody,null),e.createElement(h.iA.Body,null,o.map((p,y)=>e.createElement(ha.Tr,{key:p.id},e.createElement(nn.CheckboxDataCell,{rowId:p.id,index:y}),e.createElement(Ve.Td,null,e.createElement(z.Z,null,p.id)),u&&e.createElement(Ve.Td,null,e.createElement(z.Z,null,p[d])),e.createElement(Ve.Td,null,t&&r.includes(p.id)?e.createElement(x.k,{gap:2},e.createElement(z.Z,null,c({id:"content-manager.success.record.publishing",defaultMessage:"Publishing..."})),e.createElement(Pa.a,{small:!0})):e.createElement(Wo,{validationErrors:a[p.id],isPublished:p.publishedAt!==null})),e.createElement(Ve.Td,null,e.createElement(Re.h,{forwardedAs:ft.rU,to:{pathname:`${s}/${p.id}`,state:{from:s}},label:c({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:m(y)}),noBorder:!0,target:"_blank",marginLeft:"auto"},e.createElement(Ke.Z,null)))))))};zo.defaultProps={isPublishing:!1,rowsToDisplay:[],entriesToPublish:[],validationErrors:{}},zo.propTypes={isPublishing:n().bool,rowsToDisplay:n().arrayOf(n().object),entriesToPublish:n().arrayOf(n().number),validationErrors:n().shape({[n().string]:n().shape({id:n().string,defaultMessage:n().string})})};const Ia=t=>e.createElement(z.Z,{fontWeight:"bold"},t),Vo=({toggleModal:t,refetchModalData:o,setEntriesToFetch:r,setSelectedListViewEntries:a,validationErrors:s})=>{const{formatMessage:c}=(0,Q.Z)(),{selectedEntries:i,rows:d,onSelectRow:u,isLoading:m,isFetching:p}=(0,h.Sh)(),[y,f]=e.useState(!1),[g,b]=e.useState([]),[C,k]=e.useState(0),v=d.filter(({id:I})=>i.includes(I)&&!s[I]).map(({id:I})=>I),{post:M}=(0,h.kY)(),L=(0,h.lm)(),{contentType:W}=(0,se.v9)(Ct()),T=g.filter(({id:I})=>i.includes(I)&&s[I]).length,D=g.filter(({id:I,publishedAt:G})=>i.includes(I)&&G).length,N=i.length-T-D,$=(0,we.useMutation)(I=>M(`/content-manager/collection-types/${W.uid}/actions/bulkPublish`,I),{onSuccess(){const I=g.filter(Z=>(v.includes(Z.id)&&u({name:Z.id,value:!1}),!v.includes(Z.id)));b(I);const G=I.map(({id:Z})=>Z);r(G),a(G),I.length===0&&t(),L({type:"success",message:{id:"content-manager.success.record.publish",defaultMessage:"Published"}})},onError(I){L({type:"warning",message:(0,Nm.Z)(I)})}}),P=()=>f(I=>!I),B=async()=>{P();const{data:I}=await $.mutateAsync({ids:v});k(I.count)},U=()=>C?c({id:(0,E.OB)("containers.ListPage.selectedEntriesModal.publishedCount"),defaultMessage:"<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."},{publishedCount:C,withErrorsCount:T,b:Ia}):c({id:(0,E.OB)("containers.ListPage.selectedEntriesModal.selectedCount"),defaultMessage:"<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."},{readyToPublishCount:N,withErrorsCount:T,alreadyPublishedCount:D,b:Ia});return e.useEffect(()=>{d.length>0&&b(d)},[d]),e.createElement(hn.P,{onClose:t,labelledBy:"title"},e.createElement(yn.x,null,e.createElement(z.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,E.OB)("containers.ListPage.selectedEntriesModal.title"),defaultMessage:"Publish entries"}))),e.createElement(En.f,null,e.createElement(z.Z,null,U()),e.createElement(H.x,{marginTop:5},e.createElement(zo,{isPublishing:$.isLoading,rowsToDisplay:g,entriesToPublish:v,validationErrors:s}))),e.createElement(bn.m,{startActions:e.createElement(le.z,{onClick:t,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(x.k,{gap:2},e.createElement(le.z,{onClick:o,variant:"tertiary",loading:p},c({id:"app.utils.refresh",defaultMessage:"Refresh"})),e.createElement(le.z,{onClick:P,disabled:i.length===0||i.length===T||m,loading:$.isLoading},c({id:"app.utils.publish",defaultMessage:"Publish"})))}),e.createElement(Oa,{isOpen:y,onToggleDialog:P,isConfirmButtonLoading:$.isLoading,onConfirm:B}))};Vo.defaultProps={validationErrors:{}},Vo.propTypes={toggleModal:n().func.isRequired,refetchModalData:n().func.isRequired,setEntriesToFetch:n().func.isRequired,setSelectedListViewEntries:n().func.isRequired,validationErrors:n().shape({[n().string]:n().shape({id:n().string,defaultMessage:n().string})})};const xa=({onToggle:t})=>{const{selectedEntries:o,setSelectedEntries:r}=(0,h.Sh)(),{contentType:a,components:s}=(0,se.v9)(Ct()),[c,i]=e.useState(o),[{query:{sort:d}}]=(0,h.Kx)(),u={page:1,pageSize:c.length,sort:d,filters:{id:{$in:c}}},{get:m}=(0,h.kY)(),{data:p,isLoading:y,isFetching:f,refetch:g}=(0,we.useQuery)(["entries",a.uid,u],async()=>{const{data:b}=await m(`content-manager/collection-types/${a.uid}`,{params:u});if(b.results){const C=(0,E.Ex)(a,{components:s},{isDraft:!1}),k={};return{rows:b.results.map(M=>{try{return C.validateSync(M,{abortEarly:!1}),M}catch(L){return k[M.id]=(0,h.CJ)(L),M}}),validationErrors:k}}return{rows:[],validationErrors:{}}});return e.createElement(h.iA.Root,{rows:p?.rows,defaultSelectedEntries:o,colCount:4,isLoading:y,isFetching:f},e.createElement(Vo,{setSelectedListViewEntries:r,setEntriesToFetch:i,toggleModal:t,refetchModalData:g,validationErrors:p?.validationErrors}))};xa.propTypes={onToggle:n().func.isRequired};var Wm=xa;const Za=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(on,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(z.Z,{id:"confirm-description",textAlign:"center"},s({id:(0,E.OB)("popUpWarning.bodyMessage.contentType.unpublish.all"),defaultMessage:"Are you sure you want to unpublish these entries?"})),e.createElement(tn,{area:"contentManager.listView.unpublishModalAdditionalInfos"})),endAction:e.createElement(le.z,{onClick:a,variant:"secondary",startIcon:e.createElement(We.Z,null),loading:r},s({id:"app.utils.unpublish",defaultMessage:"Unpublish"}))})};Za.propTypes=jo;const ka=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(on,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(z.Z,{id:"confirm-description",textAlign:"center"},s({id:(0,E.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"})),e.createElement(tn,{area:"contentManager.listView.deleteModalAdditionalInfos"})),endAction:e.createElement(le.z,{onClick:a,variant:"danger-light",startIcon:e.createElement(qe.Z,null),id:"confirm-delete",loading:r},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))})};ka.propTypes=jo;const Uo=({showPublish:t,showDelete:o,onConfirmDeleteAll:r,onConfirmUnpublishAll:a,refetchData:s})=>{const{formatMessage:c}=(0,Q.Z)(),{trackUsage:i}=(0,h.rS)(),{data:d}=(0,se.v9)(Ct()),{selectedEntries:u,setSelectedEntries:m}=(0,h.Sh)(),[p,y]=e.useState(!1),[f,g]=e.useState(!1),[b,C]=e.useState(null),k=d.filter(P=>u.includes(P.id)),v=t&&k.some(P=>!P.publishedAt),M=t&&k.some(P=>P.publishedAt),L=()=>{b==="delete"?C(null):(C("delete"),i("willBulkDeleteEntries"))},W=()=>{b==="unpublish"?C(null):(C("unpublish"),i("willBulkUnpublishEntries"))},T=async(P,B)=>{try{y(!0),await P(u),y(!1),B(),m([])}catch{y(!1),B()}},D=()=>T(r,L),N=()=>T(a,W),$=()=>{g(P=>(P&&s(),!P))};return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement(le.z,{variant:"tertiary",onClick:$},c({id:"app.utils.publish",defaultMessage:"Publish"})),f&&e.createElement(Wm,{onToggle:$})),M&&e.createElement(e.Fragment,null,e.createElement(le.z,{variant:"tertiary",onClick:W},c({id:"app.utils.unpublish",defaultMessage:"Unpublish"})),e.createElement(Za,{isOpen:b==="unpublish",onToggleDialog:W,isConfirmButtonLoading:p,onConfirm:N})),o&&e.createElement(e.Fragment,null,e.createElement(le.z,{variant:"danger-light",onClick:L},c({id:"global.delete",defaultMessage:"Delete"})),e.createElement(ka,{isOpen:b==="delete",onToggleDialog:L,isConfirmButtonLoading:p,onConfirm:D})))};Uo.defaultProps={showPublish:!1,showDelete:!1,onConfirmDeleteAll(){},onConfirmUnpublishAll(){},refetchData(){}},Uo.propTypes={showPublish:n().bool,showDelete:n().bool,onConfirmDeleteAll:n().func,onConfirmUnpublishAll:n().func,refetchData:n().func};var zm=Uo,Vm=l(96315);const La=({type:t,value:o})=>{const{formatDate:r,formatTime:a,formatNumber:s}=(0,Q.Z)();let c=o;if(t==="date"&&(c=r((0,Vm.Z)(o),{dateStyle:"full"})),t==="datetime"&&(c=r(o,{dateStyle:"full",timeStyle:"short"})),t==="time"){const[i,d,u]=o.split(":"),m=new Date;m.setHours(i),m.setMinutes(d),m.setSeconds(u),c=a(m,{numeric:"auto",style:"short"})}return["float","decimal"].includes(t)&&(c=s(o,{maximumFractionDigits:20})),["integer","biginteger"].includes(t)&&(c=s(o,{maximumFractionDigits:0})),_r()(c)};La.propTypes={type:n().string.isRequired,value:n().any.isRequired};var Rt=La,Um=l(69033);const qm=(0,V.ZP)(x.k)`
1044
- position: relative;
1045
- border-radius: 50%;
1046
- width: 26px;
1047
- height: 26px;
1048
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
1049
- background: ${({theme:t})=>t.colors.neutral150};
1050
- padding-left: 1px;
1051
-
1052
- span {
1053
- line-height: 0.6rem;
1054
- font-size: 0.6rem;
1055
- }
1056
- `,Sa=({children:t,...o})=>e.createElement(qm,{justifyContent:"center",alignItems:"center",as:"span",...o},e.createElement(z.Z,{variant:"sigma",textColor:"neutral600"},t));Sa.propTypes={children:n().string.isRequired};var Aa=Sa;const qo=({url:t,mime:o,alternativeText:r,name:a,ext:s,formats:c})=>{const i=(0,h.CR)(t);if(o.includes("image")){const m=c?.thumbnail?.url||null,p=(0,h.CR)(m)||i;return e.createElement(Um.q,{src:p,alt:r||a,preview:!0})}const d=(0,h.mD)(s),u=a.length>100?`${a.substring(0,100)}...`:a;return e.createElement($t.u,{description:u},e.createElement(Aa,null,d))};qo.defaultProps={alternativeText:null,formats:null},qo.propTypes={alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired};var Fa=qo,Hm=l(25898);const $a=({value:t})=>e.createElement(Hm.H,null,t.map((o,r)=>{const a=`${o.id}${r}`;if(r===3){const s=`+${t.length-3}`;return e.createElement(Aa,{key:a,preview:!1},s)}return r>3?null:e.createElement(Fa,{key:a,...o})}));$a.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 Gm=$a,wa=l(6518);const Ba=({fieldSchema:t,metadatas:o,name:r,entityId:a,value:s,contentType:c})=>{const{formatMessage:i}=(0,Q.Z)(),{notifyStatus:d}=(0,Bo.G)(),[u,m]=(0,e.useState)(!1),{get:p}=(0,h.kY)(),{data:y,status:f}=(0,we.useQuery)([t.targetModel,a],async()=>{const{data:{results:g,pagination:b}}=await p(`/content-manager/relations/${c.uid}/${a}/${r.split(".")[0]}`);return{results:g,pagination:b}},{enabled:u,staleTime:0,select:g=>({...g,results:[...g.results].reverse()})});return(0,e.useEffect)(()=>{y&&d(i({id:(0,E.OB)("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"}))},[y,i,d]),e.createElement(ge.fC,{onOpenChange:g=>m(g)},e.createElement(Km,{onClick:g=>g.stopPropagation()},e.createElement(x.k,{gap:1,wrap:"nowrap"},e.createElement(wa.C,null,s.count),i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:s.count}))),e.createElement(ge.VY,null,f!=="success"&&e.createElement(ge.ck,{disabled:!0},e.createElement(Pa.a,{small:!0},i({id:(0,E.OB)("ListViewTable.relation-loading"),defaultMessage:"Relations are loading"}))),f==="success"&&e.createElement(e.Fragment,null,y?.results.map(g=>e.createElement(ge.ck,{key:g.id,disabled:!0},e.createElement(Qm,{ellipsis:!0},e.createElement(Rt,{type:o.mainField.schema.type,value:g[o.mainField.name]||g.id})))),y?.pagination.total>10&&e.createElement(ge.ck,{"aria-disabled":!0,"aria-label":i({id:(0,E.OB)("ListViewTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},e.createElement(z.Z,null,"\u2026")))))};Ba.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};const Qm=(0,V.ZP)(z.Z)`
1057
- max-width: 500px;
1058
- `,Km=(0,V.ZP)(ge.xz)`
1059
- svg {
1060
- width: ${6/16}rem;
1061
- height: ${4/16}rem;
1062
- }
1063
- `;var Ym=Ba;const Xm=(0,V.ZP)(z.Z)`
1064
- max-width: 500px;
1065
- `,Na=({metadatas:t,value:o})=>e.createElement(Xm,{textColor:"neutral800",ellipsis:!0},e.createElement(Rt,{type:t.mainField.schema.type,value:o[t.mainField.name]??o.id}));Na.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 Jm=Na;const _m=(0,V.ZP)(z.Z)`
1066
- max-width: 500px;
1067
- `,ja=({value:t,metadatas:o})=>{const{formatMessage:r}=(0,Q.Z)(),{mainField:{type:a,name:s}}=o;return e.createElement(ge.fC,null,e.createElement(ep,{onClick:c=>c.stopPropagation()},e.createElement(wa.C,null,t.length)," ",r({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:t.length})),e.createElement(ge.VY,null,t.map(c=>e.createElement(ge.ck,{key:c.id,disabled:!0},e.createElement(_m,{ellipsis:!0},e.createElement(Rt,{type:a,value:c[s]||c.id}))))))};ja.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().array.isRequired};const ep=(0,V.ZP)(ge.xz)`
1068
- svg {
1069
- width: ${6/16}rem;
1070
- height: ${4/16}rem;
1071
- }
1072
- `;var tp=ja;const np=(0,V.ZP)(z.Z)`
1073
- max-width: 250px;
1074
- `,Wa=({value:t,metadatas:o})=>{const{mainField:r}=o,a=t[r.name];return e.createElement($t.u,{label:a},e.createElement(np,{textColor:"neutral800",ellipsis:!0},e.createElement(Rt,{type:r.type,value:a})))};Wa.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().object.isRequired};var op=Wa,rp=l(80022),za=l.n(rp),Va=l(73347);function Ua(t){return["oneToOne","manyToOne","oneToOneMorph"].includes(t)}function ap(t,o,r,a){if(t==="component"){const{mainField:{name:s,type:c}}=r;if(a?.repeatable)return o.length>0;const i=o?.[s];return s==="id"&&![void 0,null].includes(i)?!0:(0,Va.Z)(c)&&c!=="biginteger"&&s!=="id"?za()(i):!Be()(i)}return t==="relation"?Ua(a.relation)?!Be()(o):o?.count>0:(0,Va.Z)(t)&&t!=="biginteger"?za()(o):t==="boolean"?o!==null:!Be()(o)}const qa=(0,V.ZP)(z.Z)`
1075
- max-width: 300px;
1076
- `,Ho=({content:t,fieldSchema:o,metadatas:r,name:a,rowId:s,contentType:c})=>{const{type:i}=o;if(!ap(i,t,r,o))return e.createElement(z.Z,{textColor:"neutral800"},"-");switch(i){case"media":return o.multiple?e.createElement(Gm,{value:t}):e.createElement(Fa,{...t});case"relation":return Ua(o.relation)?e.createElement(Jm,{metadatas:r,value:t}):e.createElement(Ym,{fieldSchema:o,metadatas:r,value:t,name:a,entityId:s,contentType:c});case"component":return o.repeatable===!0?e.createElement(tp,{value:t,metadatas:r}):e.createElement(op,{value:t,metadatas:r});case"string":return e.createElement($t.u,{description:t},e.createElement(qa,{ellipsis:!0,textColor:"neutral800"},e.createElement(Rt,{type:i,value:t})));default:return e.createElement(qa,{ellipsis:!0,textColor:"neutral800"},e.createElement(Rt,{type:i,value:t}))}};Ho.defaultProps={content:void 0},Ho.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 sp=Ho;const Ha=({layout:t})=>{const o=(0,se.I0)(),r=(0,se.v9)(Da),{trackUsage:a}=(0,h.rS)(),{formatMessage:s}=(0,Q.Z)(),c=ip(t.contentType.attributes).map(u=>{const m=t.contentType.metadatas[u].list;return{name:u,intlLabel:{id:m.label,defaultMessage:m.label}}}),i=r.map(({name:u})=>u),d=u=>{if(a("didChangeDisplayedFields"),u.length<i.length){const m=i.filter(p=>u.indexOf(p)===-1);o(wo({name:m[0],value:!0}))}else{const m=u.filter(p=>i.indexOf(p)===-1);o(wo({name:m[0],value:!1}))}};return e.createElement(H.x,{paddingTop:1,paddingBottom:1},e.createElement(Fe.P,{"aria-label":"change displayed fields",value:i,onChange:d,customizeContent:u=>s({id:(0,E.OB)("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:u.length}),multi:!0,size:"S"},c.map(u=>e.createElement(Ce.W,{key:u.name,value:u.name},s({id:u.intlLabel.id||u.name,defaultMessage:u.intlLabel.defaultMessage||u.name})))))};Ha.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};const ip=t=>Object.keys(t).reduce((r,a)=>{const s=t[a];return(0,E.ko)(s)&&r.push(a),r},[]).sort(),lp=(0,V.ZP)(H.x)`
1077
- svg {
1078
- path {
1079
- fill: ${({theme:t})=>t.colors.neutral900};
1080
- }
1081
- }
1082
- `,cp=null,dp=()=>null;function Ga({canCreate:t,canDelete:o,canRead:r,canPublish:a,data:s,getData:c,getDataSucceeded:i,isLoading:d,layout:u,pagination:m,slug:p}){const{total:y}=m,{contentType:f}=u,{info:g,options:b,metadatas:C,settings:{bulkable:k,filterable:v,searchable:M}}=f,[L,W]=e.useState(!1),T=(0,h.lm)(),{trackUsage:D}=(0,h.rS)(),{refetchPermissions:N}=(0,h.vn)(),$=e.useRef(D),P=e.useRef(N),{notifyStatus:B}=(0,Bo.G)(),{formatAPIError:U}=(0,h.So)(E.OB),I=(0,se.v9)(je._);(0,h.go)();const[{query:G}]=(0,h.Kx)(),Z=e.useMemo(()=>oa(G),[G]),q=(0,en.stringify)({plugins:G.plugins},{encode:!1}),{pathname:S}=(0,re.TH)(),{push:F}=(0,re.k6)(),{formatMessage:R}=(0,Q.Z)(),X=(0,h.kY)(),K=b?.draftAndPublish??!1,Y=b?.reviewWorkflows??!1,A=(0,kn.c)(cp,async()=>(await l.e(6158).then(l.bind(l,76158))).REVIEW_WORKFLOW_COLUMNS_EE,{enabled:!!b?.reviewWorkflows}),j=(0,kn.c)(dp,async()=>(await l.e(3984).then(l.bind(l,33984))).ReviewWorkflowsStageEE,{enabled:Y}),{post:oe,del:ue}=X,fe=(0,we.useMutation)(ae=>oe(`/content-manager/collection-types/${f.uid}/actions/bulkUnpublish`,ae),{onSuccess(){T({type:"success",message:{id:"content-manager.success.record.unpublish",defaultMessage:"Unpublished"}}),O(`/content-manager/collection-types/${p}`,{params:Z})},onError(ae){T({type:"warning",message:U(ae)})}}),Ee=e.useRef(""),O=e.useCallback(async(ae,de)=>{c();try{const{data:{results:be,pagination:ye}}=await X.get(ae,de);if(ye.page>ye.pageCount&&ye.pageCount>0){const tt={...Z,page:ye.pageCount};F({pathname:S,state:{from:S},search:(0,en.stringify)(tt)});return}B(R({id:(0,E.OB)("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:ye.count})),i(ye,be)}catch(be){if(ze.default.isCancel(be))return;if((be?.response?.status??null)===403){await P.current(),T({type:"info",message:{id:(0,E.OB)("permissions.not-allowed.update")}}),F("/");return}T({type:"warning",message:{id:(0,E.OB)("error.model.fetch")}})}},[R,c,i,B,F,T,X,Z,S]),ee=e.useCallback(async ae=>{try{await oe(`/content-manager/collection-types/${p}/actions/bulkDelete`,{ids:ae}),O(`/content-manager/collection-types/${p}`,{params:Z}),$.current("didBulkDeleteEntries")}catch(de){T({type:"warning",message:U(de)})}},[p,T,U,oe,O,Z]),pe=e.useCallback(async ae=>{try{await ue(`/content-manager/collection-types/${p}/${ae}`);const de=`/content-manager/collection-types/${p}`;O(de,{params:Z}),T({type:"success",message:{id:(0,E.OB)("success.record.delete")}})}catch(de){T({type:"warning",message:U(de)})}},[p,T,U,ue,O,Z]),Ie=ae=>fe.mutateAsync({ids:ae});e.useEffect(()=>{const de=ze.default.CancelToken.source(),be=r,ye=`/content-manager/collection-types/${p}`;return be&&ye.includes(Ee.current)&&O(ye,{cancelToken:de.token,params:Z}),()=>{Ee.current=p,de.cancel("Operation canceled by the user.")}},[r,c,p,Z,i,O]);const Ue=R({id:(0,E.OB)("header.name"),defaultMessage:"Content"}),ce=R({id:g.displayName,defaultMessage:g.displayName||Ue}),{runHookWaterfall:xe}=(0,h.j1)(),Ne=(0,se.v9)(Da),Ze=e.useMemo(()=>{const de=xe(zt.No,{displayedHeaders:Ne,layout:u}).displayedHeaders.map(be=>{const{metadatas:ye}=be;if(be.fieldSchema.type==="relation"){const tt=`${be.name}.${be.metadatas.mainField.name}`;return{...be,metadatas:{...ye,label:R({id:(0,E.OB)(`containers.ListPage.table-headers.${be.name}`),defaultMessage:ye.label})},name:tt}}return{...be,metadatas:{...ye,label:R({id:(0,E.OB)(`containers.ListPage.table-headers.${be.name}`),defaultMessage:ye.label})}}});return K&&de.push({key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:R({id:(0,E.OB)("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0}}),A&&(typeof A.metadatas.label!="string"&&(A.metadatas.label=R(A.metadatas.label)),de.push(A)),de},[xe,Ne,u,A,K,R]),He=r?R({id:(0,E.OB)("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:y}):null,Mt=ae=>t?e.createElement(le.z,{...ae,forwardedAs:ft.rU,onClick:()=>{const de=K?{status:"draft"}:{};$.current("willCreateEntry",de)},to:{pathname:`${S}/create`,search:G.plugins?q:""},startIcon:e.createElement(gt.Z,null),style:{textDecoration:"none"}},R({id:(0,E.OB)("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null,lt=ae=>()=>{D("willEditEntryFromList"),F({pathname:`${S}/${ae}`,state:{from:S},search:q})},he=ae=>async()=>{try{const{data:de}=await oe(`/content-manager/collection-types/${f.uid}/auto-clone/${ae}?${q}`);"id"in de&&F({pathname:`${S}/${de.id}`,state:{from:S},search:q})}catch(de){de instanceof Om.d7&&F({pathname:`${S}/create/clone/${ae}`,state:{from:S,error:U(de)},search:q})}},Me=Ze.length+2,et=()=>{O(`/content-manager/collection-types/${p}`,{params:Z})};return j?e.createElement(Te.o,{"aria-busy":d},e.createElement(De.T,{primaryAction:Mt(),subtitle:He,title:ce,navigationAction:e.createElement(h.rU,{startIcon:e.createElement(rt.Z,null),to:"/content-manager/"},R({id:"global.back",defaultMessage:"Back"}))}),!r&&e.createElement(fa.Z,{endActions:e.createElement(Vt,{area:"contentManager.listView.actions"})}),r&&e.createElement(fa.Z,{endActions:e.createElement(e.Fragment,null,e.createElement(Vt,{area:"contentManager.listView.actions"}),e.createElement(Ha,{layout:u}),e.createElement(h.jW,{permissions:I.contentManager.collectionTypesConfigurations},e.createElement(lp,{paddingTop:1,paddingBottom:1},e.createElement(Re.h,{onClick:()=>{D("willEditListLayout")},forwardedAs:ft.rU,to:{pathname:`${p}/configurations/list`,search:q},icon:e.createElement(cn.Z,null),label:R({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:e.createElement(e.Fragment,null,M&&e.createElement(h.m,{label:R({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:ce}),placeholder:R({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),v&&e.createElement(km,{contentType:f,slug:p,metadatas:C}))}),e.createElement(Qe.D,null,r?e.createElement(x.k,{gap:4,direction:"column",alignItems:"stretch"},e.createElement(h.iA.Root,{rows:s,isLoading:d,colCount:Me},e.createElement(h.iA.ActionBar,null,e.createElement(zm,{showPublish:a&&K,showDelete:o,onConfirmDeleteAll:ee,onConfirmUnpublishAll:Ie,refetchData:et})),e.createElement(h.iA.Content,null,e.createElement(h.iA.Head,null,e.createElement(h.iA.HeaderCheckboxCell,null),Ze.map(({fieldSchema:ae,key:de,name:be,metadatas:ye})=>e.createElement(h.iA.HeaderCell,{key:de,name:be,fieldSchemaType:ae.type,relationFieldName:ye.mainField?.name,isSortable:ye.sortable,label:ye.label})),e.createElement(h.iA.HeaderHiddenActionsCell,null)),e.createElement(h.iA.LoadingBody,null),e.createElement(h.iA.EmptyBody,{contentType:ce,aciton:Mt({variant:"secondary"})}),e.createElement(nn.Root,{onConfirmDelete:pe,isConfirmDeleteRowOpen:L,setIsConfirmDeleteRowOpen:W},s.map((ae,de)=>e.createElement(ha.Tr,{cursor:"pointer",key:s.id,onClick:lt(ae.id)},e.createElement(nn.CheckboxDataCell,{rowId:ae.id,index:de}),Ze.map(({key:be,name:ye,cellFormatter:tt,...rn})=>K&&ye==="publishedAt"?e.createElement(Ve.Td,{key:be},e.createElement(Xn.q,{width:"min-content",showBullet:!1,variant:ae.publishedAt?"success":"secondary",size:"S"},e.createElement(z.Z,{fontWeight:"bold",textColor:`${ae.publishedAt?"success":"secondary"}700`},R({id:(0,E.OB)(`containers.List.${ae.publishedAt?"published":"draft"}`),defaultMessage:ae.publishedAt?"Published":"Draft"})))):Y&&ye==="strapi_stage"?e.createElement(Ve.Td,{key:be},ae.strapi_stage?e.createElement(j,{color:ae.strapi_stage.color??Dm.W.colors.primary600,name:ae.strapi_stage.name}):e.createElement(z.Z,{textColor:"neutral800"},"-")):typeof tt=="function"?e.createElement(Ve.Td,{key:be},tt(ae,{key:be,name:ye,...rn})):e.createElement(Ve.Td,{key:be},e.createElement(sp,{content:ae[ye.split(".")[0]],name:ye,contentType:u.contentType,...rn,rowId:ae.id}))),(o||a)&&k&&e.createElement(nn.EntityActionsDataCell,{rowId:ae.id,index:de,setIsConfirmDeleteRowOpen:W,canCreate:t,canDelete:o,handleCloneClick:he})))))),e.createElement(x.k,{alignItems:"flex-end",justifyContent:"space-between"},e.createElement(h.v4,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),e.createElement(h.tU,{pagination:{pageCount:m?.pageCount||1}}))):e.createElement(h.ZF,null))):null}Ga.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 up=$m();function mp(t){return(0,ya.bindActionCreators)({getData:vm,getDataSucceeded:Cm,onChangeListHeaders:wo,onResetListHeaders:Rm},t)}const pp=(0,se.$j)(up,mp);var gp=(0,ya.compose)(pp)(e.memo(Ga,Pe()));const Go=t=>{const o=(0,e.useMemo)(()=>(0,E.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:a}=(0,h.ss)(o,t.permissions);return r?e.createElement(h.dO,null):e.createElement(gp,{...t,...a})};Go.defaultProps={permissions:[]},Go.propTypes={permissions:n().array,slug:n().string.isRequired};var fp=(0,e.memo)(Go,(t,o)=>{const r=(0,h.e5)(t,o);return Object.keys(r).filter(s=>s!=="state").length>0});const Qa=({layout:t,...o})=>{const r=(0,se.I0)(),{replace:a}=(0,re.k6)(),[{query:s,rawQuery:c}]=(0,h.Kx)(),{permissions:i,isValid:d}=(0,te.r5)(s,o.slug,"listView"),u=(0,te.Ky)(o.slug);return(0,e.useEffect)(()=>{c||a(u)},[c,a,u]),(0,e.useEffect)(()=>{r(Tm(t))},[r,t]),(0,e.useEffect)(()=>()=>{r(Mm())},[r]),d?e.createElement(fp,{...o,layout:t,permissions:i}):null};Qa.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 hp=Qa,yp=()=>e.createElement(H.x,{padding:8},e.createElement(h.Hn,null));const Ka=({match:{params:{slug:t},url:o}})=>{const r=(0,se.v9)(je._),{isLoading:a,layout:s,updateLayout:c}=(0,te.zE)(t),{rawContentTypeLayout:i,rawComponentsLayouts:d}=(0,e.useMemo)(()=>{let y={},f={};return s.contentType&&(y=(0,E.du)(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((g,b)=>(g[b]=(0,E.du)(s.components[b]),g),{})),{rawContentTypeLayout:y,rawComponentsLayouts:f}},[s]);if((s?.contentType?.uid??null)!==t||a)return e.createElement(h.dO,null);const m=({location:{state:y},history:{goBack:f},match:{params:{id:g,origin:b}}},C)=>e.createElement(C,{slug:t,layout:s,state:y,goBack:f,id:g,origin:b}),p=[{path:"create/clone/:origin",comp:_t},{path:"create",comp:_t},{path:":id",comp:_t},{path:"",comp:hp}].map(({path:y,comp:f})=>e.createElement(re.AW,{key:y,path:`${o}/${y}`,render:g=>m(g,f)}));return e.createElement(ot.ErrorBoundary,{FallbackComponent:yp},e.createElement(It.Provider,{value:s},e.createElement(re.rs,null,e.createElement(re.AW,{path:`${o}/configurations/list`},e.createElement(h.O4,{permissions:r.contentManager.collectionTypesConfigurations},e.createElement(ga,{layout:i,slug:t,updateLayout:c}))),e.createElement(re.AW,{path:`${o}/configurations/edit`},e.createElement(h.O4,{permissions:r.contentManager.collectionTypesConfigurations},e.createElement(Zn,{components:d,isContentTypeView:!0,mainLayout:i,slug:t,updateLayout:c}))),p)))};Ka.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Ep=(0,e.memo)(Ka),Ya=l(4214);const bp=()=>{const[{isLoading:t,data:o},r]=(0,e.useReducer)(Ya.Z,Ya.q),a=(0,e.useMemo)(pt.Vo,[]),{schemas:s}=(0,se.v9)(u=>a(u),se.wU),c=(0,se.v9)(je._),{uid:i}=(0,re.UO)(),{get:d}=(0,h.kY)();return(0,e.useEffect)(()=>{const m=ze.default.CancelToken.source();return(async y=>{try{r(Ut());const{data:{data:f}}=await d(`/content-manager/components/${i}/configuration`,{cancelToken:y.token});r(Ln((0,E.w8)(f,s,"component")))}catch(f){if(ze.default.isCancel(f))return;console.error(f)}})(m),()=>{m.cancel("Operation canceled by the user.")}},[i,s,d]),t?e.createElement(h.dO,null):e.createElement(h.O4,{permissions:c.contentManager.componentsConfigurations},e.createElement(Zn,{components:o.components,mainLayout:o.component,slug:i}))};var vp=(0,e.memo)(bp),Cp=l(9695),Rp=l(54725),Mp=()=>{const{formatMessage:t}=(0,Q.Z)();return(0,h.go)(),e.createElement(Te.o,null,e.createElement(De.T,{title:t({id:(0,E.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(Qe.D,null,e.createElement(Cp.x,{action:e.createElement(h.Qj,{variant:"secondary",startIcon:e.createElement(gt.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(Rp.Z,{width:"10rem"}),shadow:"tableShadow"})))},Tp=()=>{const{formatMessage:t}=(0,Q.Z)();return(0,h.go)(),e.createElement(Te.o,null,e.createElement(De.T,{title:t({id:(0,E.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(Qe.D,null,e.createElement(h.ZF,null)))};const Xa=({match:{params:{slug:t},url:o}})=>{const r=(0,se.v9)(je._),{isLoading:a,layout:s,updateLayout:c}=(0,te.zE)(t),{rawContentTypeLayout:i,rawComponentsLayouts:d}=(0,e.useMemo)(()=>{let u={},m={};return s.contentType&&(m=(0,E.du)(s.contentType)),s.components&&(u=Object.keys(s.components).reduce((p,y)=>(p[y]=(0,E.du)(s.components[y]),p),{})),{rawContentTypeLayout:m,rawComponentsLayouts:u}},[s]);return a?e.createElement(h.dO,null):e.createElement(It.Provider,{value:s},e.createElement(re.rs,null,e.createElement(re.AW,{path:`${o}/configurations/edit`},e.createElement(h.O4,{permissions:r.contentManager.singleTypesConfigurations},e.createElement(Zn,{components:d,isContentTypeView:!0,mainLayout:i,slug:t,updateLayout:c}))),e.createElement(re.AW,{path:o,render:({location:{state:u},history:{goBack:m}})=>e.createElement(_t,{layout:s,slug:t,isSingleType:!0,state:u,goBack:m})})))};Xa.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Dp=(0,e.memo)(Xa),Op=l(16899);const Pp=(0,V.ZP)(x.k)`
1083
- border-radius: 50%;
1084
-
1085
- svg {
1086
- height: ${6/16}rem;
1087
- width: ${11/16}rem;
1088
- > path {
1089
- fill: ${({theme:t})=>t.colors.neutral600};
1090
- }
1091
- }
1092
- `,Ip=V.ZP.button`
1093
- border: none;
1094
- background: transparent;
1095
- display: block;
1096
- width: 100%;
1097
- text-align: unset;
1098
- padding: 0;
1099
- `;function Ja({displayedValue:t}){return e.createElement(x.k,{background:"neutral0",borderColor:"neutral200",justifyContent:"space-between",gap:3,padding:3,width:(0,h.Q1)(300)},e.createElement(Ip,{type:"button"},e.createElement(x.k,{gap:6},e.createElement(Pp,{alignItems:"center",justifyContent:"center",background:"neutral200",height:(0,h.Q1)(32),width:(0,h.Q1)(32)},e.createElement(Op.Z,null)),e.createElement(x.k,{maxWidth:(0,h.Q1)(150)},e.createElement(z.Z,{textColor:"neutral700",ellipsis:!0},t)))),e.createElement(x.k,{gap:2},e.createElement(Re.h,{noBorder:!0},e.createElement(qe.Z,null)),e.createElement(Re.h,{noBorder:!0},e.createElement(Ye.Z,null))))}Ja.propTypes={displayedValue:n().string.isRequired};const _a=({status:t,displayedValue:o,width:r})=>{const{formatMessage:a}=(0,Q.Z)(),s={[it.DRAFT]:a({id:(0,E.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[it.PUBLISHED]:a({id:(0,E.OB)("relation.publicationState.published"),defaultMessage:"Published"})},c=t===it.DRAFT?"secondary":"success";return e.createElement(H.x,{style:{width:r}},e.createElement(x.k,{paddingTop:2,paddingBottom:2,paddingLeft:2,paddingRight:4,hasRadius:!0,borderSize:1,background:"neutral0",borderColor:"neutral200",justifyContent:"space-between"},e.createElement(Br,{gap:1},e.createElement(Re.h,{noBorder:!0},e.createElement(Ye.Z,null)),e.createElement(Nr,{maxWidth:"100%",justifyContent:"space-between"},e.createElement(H.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(jr,null,e.createElement(z.Z,{textColor:"primary600",ellipsis:!0},o))),t&&e.createElement(Xn.q,{variant:c,showBullet:!1,size:"S"},e.createElement(z.Z,{fontWeight:"bold",textColor:`${c}700`},s[t])))),e.createElement(H.x,{paddingLeft:4},e.createElement(Wr,{type:"button"},e.createElement(ht.J,{width:"12px",as:qt.Z})))))};_a.propTypes={status:n().string.isRequired,displayedValue:n().string.isRequired,width:n().number.isRequired};var xp=l(90700),Zp=l(78090),kp=l(77013),Lp=l(79318),Sp=l(66618),Ap=()=>{const[t,o]=(0,e.useState)(""),{formatMessage:r,locale:a}=(0,Q.Z)(),s=(0,e.useMemo)(pt.KQ,[]),{collectionTypeLinks:c,singleTypeLinks:i}=(0,se.v9)(s,se.wU),{startsWith:d}=(0,h.L0)(a,{sensitivity:"base"}),u=(0,h.Xe)(a,{sensitivity:"base"}),m=(0,e.useMemo)(()=>[{id:"collectionTypes",title:{id:(0,Ae.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:c},{id:"singleTypes",title:{id:(0,Ae.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:i}].map(g=>({...g,links:g.links.filter(b=>d(b.title,t)).sort((b,C)=>u.compare(b.title,C.title)).map(b=>({...b,title:r({id:b.title,defaultMessage:b.title})}))})),[c,t,i,d,r,u]),p=()=>{o("")},y=({target:{value:g}})=>{o(g)},f=r({id:(0,Ae.Z)("header.name"),defaultMessage:"Content"});return e.createElement(xp.m,{ariaLabel:f},e.createElement(Zp.p,{label:f,searchable:!0,value:t,onChange:y,onClear:p,searchLabel:r({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),e.createElement(kp.Z,null,m.map(g=>{const b=r({id:g.title.id,defaultMessage:g.title.defaultMessage},g.title.values);return e.createElement(Lp.D,{key:g.id,label:b,badgeLabel:g.links.length.toString()},g.links.map(C=>{const k=C.search?`?${C.search}`:"";return e.createElement(Sp.E,{as:ft.OL,key:C.uid,to:`${C.to}${k}`},C.title)}))})))},Qo=l(70475);const Fp=()=>({type:Qo.fn}),$p=()=>({type:Qo.sZ}),wp=({authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,contentTypeSchemas:r,components:a,fieldSizes:s})=>({type:Qo.IX,data:{authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,components:a,contentTypeSchemas:r,fieldSizes:s}});var es=(t,o)=>o.map(({permissions:r})=>(0,h.qX)(t,r)),Bp=l(81346),Np=l.n(Bp);const ts=(t,o,r=[])=>t.filter(a=>a.isDisplayed).map(a=>{const s=[{action:"plugin::content-manager.explorer.create",subject:a.uid},{action:"plugin::content-manager.explorer.read",subject:a.uid}],c=[{action:"plugin::content-manager.explorer.read",subject:a.uid}],i=o==="collectionTypes"?s:c,d=r.find(({uid:m})=>m===a.uid);let u=null;if(d){const m={page:1,pageSize:d.settings.pageSize,sort:`${d.settings.defaultSortBy}:${d.settings.defaultSortOrder}`};u=(0,en.stringify)(m,{encode:!1})}return{permissions:i,search:u,kind:a.kind,title:a.info.displayName,to:`/content-manager/${a.kind}/${a.uid}`,uid:a.uid,name:a.uid,isDisplayed:a.isDisplayed}});var jp=(t,o)=>{const r=Object.entries(Np()(t,"kind")).map(([c,i])=>({name:c,links:i})),[a,s]=ut()(r,"name");return{collectionTypeSectionLinks:ts(a?.links||[],"collectionTypes",o),singleTypeSectionLinks:ts(s?.links??[],"singleTypes")}},Wp=async({models:t,userPermissions:o,toggleNotification:r})=>{const{get:a}=(0,h.tg)();try{const{data:{data:s}}=await a("/content-manager/content-types-settings"),{collectionTypeSectionLinks:c,singleTypeSectionLinks:i}=jp(t,s),d=await Promise.all(es(o,c)),u=c.filter((y,f)=>d[f]),m=await Promise.all(es(o,i)),p=i.filter((y,f)=>m[f]);return{authorizedCollectionTypeLinks:u,authorizedSingleTypeLinks:p}}catch(s){return console.error(s),r({type:"warning",message:{id:"notification.error"}}),{authorizedCollectionTypeLinks:[],authorizedSingleTypeLinks:[]}}},zp=()=>{const t=(0,se.I0)(),o=(0,h.lm)(),r=(0,se.v9)((0,pt.Yg)()),a=(0,e.useRef)(),{allPermissions:s}=(0,h.vn)(),{runHookWaterfall:c}=(0,h.j1)(),d=ze.default.CancelToken.source(),{notifyStatus:u}=(0,Bo.G)(),{formatMessage:m}=(0,Q.Z)(),{get:p}=(0,h.kY)(),y=async()=>{t(Fp());try{const{data:{data:{components:f,contentTypes:g,fieldSizes:b}}}=await p("/content-manager/init",{cancelToken:d.token});u(m({id:(0,E.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const C=await Wp({models:g,userPermissions:s,toggleNotification:o}),{ctLinks:k}=c(zt.LK,{ctLinks:C.authorizedCollectionTypeLinks,models:g}),{stLinks:v}=c(zt.dV,{stLinks:C.authorizedSingleTypeLinks,models:g}),M=wp({authorizedCollectionTypeLinks:k,authorizedSingleTypeLinks:v,contentTypeSchemas:g,components:f,fieldSizes:b});t(M)}catch(f){if(ze.default.isCancel(f))return;console.error(f),o({type:"warning",message:{id:"notification.error"}})}};return a.current=y,(0,e.useEffect)(()=>(a.current(),()=>{d.cancel("Operation canceled by the user."),t($p())}),[t,o]),{...r,refetchData:a.current}};function Vp({type:t,item:o}){if([mt.Z.EDIT_FIELD,mt.Z.FIELD].includes(t))return e.createElement(wt,{labelField:o.labelField});const[r]=t.split("_");switch(r){case mt.Z.COMPONENT:case mt.Z.DYNAMIC_ZONE:return e.createElement(Ja,{displayedValue:o.displayedValue});case mt.Z.RELATION:return e.createElement(_a,{displayedValue:o.displayedValue,status:o.status,width:o.width});default:return null}}const ns=()=>{const t=(0,re.$B)("/content-manager/:kind/:uid"),{status:o,collectionTypeLinks:r,singleTypeLinks:a,models:s,refetchData:c}=zp(),i=ut()([...r,...a],g=>g.title.toLowerCase()),{pathname:d}=(0,re.TH)(),{formatMessage:u}=(0,Q.Z)(),{startSection:m}=(0,h.c1)(),p=(0,e.useRef)(m),y=(0,se.v9)(je._);if((0,e.useEffect)(()=>{p.current&&p.current("contentManager")},[]),o==="loading")return e.createElement(Te.o,{"aria-busy":"true"},e.createElement(De.T,{title:u({id:(0,Ae.Z)("header.name"),defaultMessage:"Content"})}),e.createElement(h.dO,null));const f=s.filter(({isDisplayed:g})=>g);return i.length===0&&f.length>0&&d!=="/content-manager/403"?e.createElement(re.l_,{to:"/content-manager/403"}):f.length===0&&d!=="/content-manager/no-content-types"?e.createElement(re.l_,{to:"/content-manager/no-content-types"}):!t&&i.length>0?e.createElement(re.l_,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):e.createElement(nt.A,{sideNav:e.createElement(Ap,null)},e.createElement(Dt.r,{renderItem:Vp}),e.createElement(Pt.Provider,{value:{refetchData:c}},e.createElement(re.rs,null,e.createElement(re.AW,{path:"/content-manager/components/:uid/configurations/edit"},e.createElement(h.O4,{permissions:y.contentManager.componentsConfigurations},e.createElement(vp,null))),e.createElement(re.AW,{path:"/content-manager/collectionType/:slug",component:Ep}),e.createElement(re.AW,{path:"/content-manager/singleType/:slug",component:Dp}),e.createElement(re.AW,{path:"/content-manager/403"},e.createElement(Tp,null)),e.createElement(re.AW,{path:"/content-manager/no-content-types"},e.createElement(Mp,null)),e.createElement(re.AW,{path:"",component:h.Hn}))))};function Up(){const{formatMessage:t}=(0,Q.Z)();return e.createElement(e.Fragment,null,e.createElement(Ge.q,{title:t({id:(0,Ae.Z)("plugin.name"),defaultMessage:"Content Manager"})}),e.createElement(ns,null))}},98865:function(Ko,dt,l){"use strict";l.d(dt,{d:function(){return Xo}});var e=l(32735),Te=l(87933),De=l(49372),nt=l(72850),h=l(9026),Tt=l(19565),ut=l(60216),Ge=l.n(ut),Q=l(67879),se=l(24388),re=l(69997);const Dt=60*1e3,je=Dt*60,Ot=je*24,Pt=Ot*30,Ae=Ot*365;var ke=te=>te<Dt?{unit:"second",value:-Math.round(te/1e3)}:te<je?{unit:"minute",value:-Math.round(te/Dt)}:te<Ot?{unit:"hour",value:-Math.round(te/je)}:te<Pt?{unit:"day",value:-Math.round(te/Ot)}:te<Ae?{unit:"month",value:-Math.round(te/Pt)}:{unit:"year",value:-Math.round(te/Ae)};const n=()=>{const{formatMessage:te}=(0,Q.Z)();return e.createElement(Te.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(De.Z,{variant:"sigma",textColor:"neutral600",id:"additional-information"},te({id:(0,re.OB)("containers.Edit.information"),defaultMessage:"Information"})),e.createElement(nt.x,null,e.createElement(h.i,null)))},ot=({label:te,value:E})=>e.createElement(Te.k,{justifyContent:"space-between"},e.createElement(De.Z,{as:"dt",fontWeight:"bold",textColor:"neutral800",variant:"pi"},te),e.createElement(De.Z,{as:"dd",variant:"pi",textColor:"neutral600"},E));ot.propTypes={label:Ge().string.isRequired,value:Ge().string.isRequired};const Yo=()=>{const{formatMessage:te,formatRelativeTime:E}=(0,Q.Z)(),{initialData:le,isCreatingEntry:Qe}=(0,Tt.Wq)(),H=(0,e.useRef)(Date.now()),x=(ve,Fe)=>{const{firstname:Ce,lastname:Nt,username:rt}=le[Fe]??{},We=Ce??"",an=Nt??"",$e=rt??(0,se.Pp)(We,an),Pe=(le[ve]?new Date(le[ve]).getTime():Date.now())-H.current,{unit:sn,value:at}=ke(-Pe);return{at:E(at,sn,{numeric:"auto"}),by:Qe?"-":$e}},z=x("updatedAt","updatedBy"),Oe=x("createdAt","createdBy");return e.createElement(Te.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Te.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(ot,{label:te({id:(0,re.OB)("containers.Edit.information.created"),defaultMessage:"Created"}),value:Oe.at}),e.createElement(ot,{label:te({id:(0,re.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:Oe.by})),e.createElement(Te.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(ot,{label:te({id:(0,re.OB)("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"}),value:z.at}),e.createElement(ot,{label:te({id:(0,re.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:z.by})))},It=({children:te})=>e.createElement(Te.k,{direction:"column",alignItems:"stretch",gap:4},te);It.propTypes={children:Ge().oneOfType([Ge().arrayOf(Ge().node),Ge().node]).isRequired};const Xo={Root:It,Title:n,Body:Yo}},99097:function(Ko,dt,l){"use strict";var e=l(32735);const Te=(De,nt)=>{const[h,Tt]=(0,e.useState)(De);return(0,e.useEffect)(()=>{const ut=setTimeout(()=>{Tt(De)},nt);return()=>{clearTimeout(ut)}},[De,nt]),h};dt.Z=Te},57544:function(){},59599:function(){},42310:function(){},33842:function(){},85695:function(){}}]);