@strapi/admin 4.11.0-beta.1 → 4.11.0-exp.push-transfer-push-stuck

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 (53) hide show
  1. package/admin/src/components/Providers/index.js +32 -32
  2. package/admin/src/components/Theme/index.js +3 -5
  3. package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDeleteAll/index.js +73 -0
  4. package/admin/src/content-manager/components/DynamicTable/index.js +4 -20
  5. package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +2 -3
  6. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +1 -0
  7. package/admin/src/content-manager/{utils → components/EditViewDataManagerProvider/utils}/schema.js +1 -1
  8. package/admin/src/content-manager/components/Inputs/index.js +11 -18
  9. package/admin/src/content-manager/components/Inputs/utils/getStep.js +13 -0
  10. package/admin/src/content-manager/components/Inputs/utils/index.js +1 -0
  11. package/admin/src/content-manager/pages/ListView/index.js +2 -118
  12. package/admin/src/content-manager/utils/index.js +0 -2
  13. package/admin/src/injectionZones.js +1 -6
  14. package/admin/src/translations/ar.json +1 -684
  15. package/admin/src/translations/en.json +1 -6
  16. package/build/3816.60f858cf.chunk.js +211 -0
  17. package/build/6858.85d76858.chunk.js +50 -0
  18. package/build/6970.6a329e15.chunk.js +1 -0
  19. package/build/{Admin-authenticatedApp.990df65d.chunk.js → Admin-authenticatedApp.d425b485.chunk.js} +2 -2
  20. package/build/{Admin_marketplace.1436fc2b.chunk.js → Admin_marketplace.717bd7ca.chunk.js} +1 -1
  21. package/build/Admin_pluginsPage.7df6b5a9.chunk.js +6 -0
  22. package/build/{Admin_profilePage.75bc083a.chunk.js → Admin_profilePage.a8fa3a56.chunk.js} +1 -1
  23. package/build/{Admin_settingsPage.bd715ed3.chunk.js → Admin_settingsPage.1394aaf2.chunk.js} +1 -1
  24. package/build/{admin-app.8b102fe2.chunk.js → admin-app.ac5b1f59.chunk.js} +8 -8
  25. package/build/ar-json.39e54aba.chunk.js +1 -0
  26. package/build/content-manager.70548048.chunk.js +1123 -0
  27. package/build/{email-settings-page.4368689f.chunk.js → email-settings-page.dba83275.chunk.js} +1 -1
  28. package/build/{en-json.0f5cc115.chunk.js → en-json.d965e364.chunk.js} +1 -1
  29. package/build/i18n-settings-page.55628f74.chunk.js +114 -0
  30. package/build/i18n-translation-en-json.60af6722.chunk.js +1 -0
  31. package/build/index.html +1 -1
  32. package/build/main.d9d9ed10.js +2630 -0
  33. package/build/{review-workflows-settings.4b39b837.chunk.js → review-workflows-settings.56cab253.chunk.js} +1 -1
  34. package/build/{runtime~main.55d43bd7.js → runtime~main.adbe36a4.js} +2 -2
  35. package/build/users-advanced-settings-page.4f49ca57.chunk.js +9 -0
  36. package/build/users-email-settings-page.d2429d0a.chunk.js +24 -0
  37. package/build/users-providers-settings-page.50c5ba27.chunk.js +29 -0
  38. package/build/{users-roles-settings-page.c773086b.chunk.js → users-roles-settings-page.2549794b.chunk.js} +1 -1
  39. package/build/{webhook-list-page.b0f5a02c.chunk.js → webhook-list-page.e2fca9f8.chunk.js} +1 -1
  40. package/package.json +15 -15
  41. package/admin/src/content-manager/components/DynamicTable/BulkActionsBar/index.js +0 -307
  42. package/build/3562.e0b1a0b3.chunk.js +0 -50
  43. package/build/456.9b85d4c6.chunk.js +0 -39
  44. package/build/6970.7ea35fbd.chunk.js +0 -1
  45. package/build/Admin_pluginsPage.e1afd5ed.chunk.js +0 -6
  46. package/build/ar-json.f530bc3f.chunk.js +0 -1
  47. package/build/content-manager.89099707.chunk.js +0 -1123
  48. package/build/i18n-settings-page.7988d872.chunk.js +0 -114
  49. package/build/i18n-translation-en-json.1ec7becf.chunk.js +0 -1
  50. package/build/main.5a232c3d.js +0 -2630
  51. package/build/users-advanced-settings-page.2cfb5d24.chunk.js +0 -9
  52. package/build/users-email-settings-page.bd6c774a.chunk.js +0 -24
  53. package/build/users-providers-settings-page.528f0036.chunk.js +0 -29
@@ -1,1123 +0,0 @@
1
- (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{42814:function(pt,Oe){"use strict";Oe.Z=()=>null},51686:function(pt,Oe,d){"use strict";d.r(Oe),d.d(Oe,{App:function(){return Ws},default:function(){return dm}});var e=d(32735),Te=d(74758),te=d(53038),y=d(24989),De=d(27649),he=d(82055),Se=d(96709),V=d(67879),it=d(98978),Le=d.n(it),we=d(83983),ve=d(47510),$e=d(55433),Ze=(0,e.createContext)(),_e=d(47533),ye=d(60216),n=d.n(ye),Be=(0,e.createContext)(),Nt=d(73386),pe=d(56327),h=d(51375),J=d(15062),je=d(46339),et=d(4460);const Dt=()=>({type:et.c}),kt=(t,o)=>({type:et.O,layout:t,query:o});var ft=d(70031),lt=d(89793),Ce=d.n(lt),We=d(17e3),Ie=d(15335),ge=d(5803),F=d(87933),S=d(72850),Ve=d(68625),Ke=d(2669),tt=d(66694),Pt=()=>(0,e.useContext)(tt.ux),jt=t=>{const{getAdminInjectedComponents:o}=Pt(),[r,s,a]=t.split(".");return o(r,s,a)};const Wo=({area:t,...o})=>jt(t).map(s=>e.createElement(s.Component,{key:s.name,...o}));Wo.propTypes={area:n().string.isRequired};var Wt=Wo,zs=d(33795),x=d.n(zs),ht=d(3685);function Us(t,o){return r=>{const s=o(r.name);return e.createElement(t,{...r,...s})}}var Vs=Us;function Hs(t){const{addComponentToDynamicZone:o,createActionAllowedFields:r,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentField:i,removeComponentFromDynamicZone:c,readActionAllowedFields:g,updateActionAllowedFields:u}=(0,y.Wq)(),p=(0,e.useMemo)(()=>x()(l,[t],[]).map(b=>({componentUid:b.__component,id:b.id??b.__temp_key__})),[l,t]),f=(0,e.useMemo)(()=>(s?r:u).includes(t),[t,s,r,u]),m=(0,e.useMemo)(()=>(s?[]:g).includes(t),[t,s,g]);return{addComponentToDynamicZone:o,formErrors:a,isCreatingEntry:s,isFieldAllowed:f,isFieldReadable:m,moveComponentField:i,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:p}}var Qs=Hs,j=d(8471),wt=d(51968),be=d(50563),dn=d(83828),un=d(61762),mn=d(89966),Ye=d(4038),nt=d(47081),Gs=d(61868),Ks=d.n(Gs);function Ys(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var Xs=Ys,Js=d(88708),xt=d.n(Js);function _s({isFromDynamicZone:t,name:o}){const{addNonRepeatableComponentToField:r,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:c,updateActionAllowedFields:g,formErrors:u}=(0,y.Wq)(),{contentType:p}=(0,pe.PL)(),f=(0,e.useMemo)(()=>{const T=x()(p,["attributes"],{});return Object.keys(T).filter(D=>x()(T,[D,"type"],"")==="dynamiczone")},[p]),m=(0,e.useMemo)(()=>a?s:g,[a,s,g]),b=x()(l,o,null),E=(0,e.useMemo)(()=>(0,h.Ts)(o),[o]),v=(0,e.useMemo)(()=>t&&a||m.filter(D=>D===E[0]).length>0?!0:m.map(D=>D.split(".")).filter(D=>D.length<E.length?!1:xt()(D,E.length).join(".")===E.join(".")).length>0,[t,a,m,E]),k=(0,e.useMemo)(()=>t||f.includes(E[0])?!0:(a?[]:c).map(D=>D.split(".")).filter(D=>D.length<E.length?!1:xt()(D,E.length).join(".")===E.join(".")).length>0,[t,f,E,a,c]),R=(0,e.useMemo)(()=>a||v?!1:k,[v,k,a]);return{addNonRepeatableComponentToField:r,formErrors:u,hasChildrenAllowedFields:v,hasChildrenReadableFields:k,isCreatingEntry:a,isReadOnly:R,removeComponentFromField:i,componentValue:b}}var ea=_s,Q=d(49372);const ta=(0,j.ZP)(S.x)`
2
- svg path {
3
- fill: ${({theme:t})=>t.colors.neutral500};
4
- }
5
- `,pn=({intlLabel:t,id:o,labelAction:r,name:s,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:c}=(0,V.Z)(),g=t?.id?c(t):s;return e.createElement(S.x,{paddingBottom:1},e.createElement(F.k,null,e.createElement(Q.Z,{textColor:"neutral800",htmlFor:o||s,variant:"pi",fontWeight:"bold",as:"label"},g,l&&e.createElement(e.Fragment,null,"\xA0(",a,")"),i&&e.createElement(Q.Z,{textColor:"danger600"},"*")),r&&e.createElement(ta,{paddingLeft:1},r)))};pn.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},pn.propTypes={id:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,numberOfEntries:n().number,required:n().bool,showNumberOfEntries:n().bool};var na=pn,zo=d(86308);const oa=j.ZP.span`
6
- > svg {
7
- width: ${(0,y.Q1)(24)};
8
- height: ${(0,y.Q1)(24)};
9
- > circle {
10
- fill: ${({theme:t})=>t.colors.primary200};
11
- }
12
- > path {
13
- fill: ${({theme:t})=>t.colors.primary600};
14
- }
15
- }
16
- `,gn=({error:t,isReadOnly:o,onClick:r})=>{const{formatMessage:s}=(0,V.Z)();return e.createElement(e.Fragment,null,e.createElement(S.x,{as:"button",background:"neutral100",borderColor:t?"danger600":"neutral200",disabled:o,hasRadius:!0,onClick:r,paddingTop:9,paddingBottom:9,type:"button"},e.createElement(F.k,{direction:"column",gap:2},e.createElement(F.k,{justifyContent:"center",style:{cursor:o?"not-allowed":"inherit"}},e.createElement(oa,null,e.createElement(zo.Z,null))),e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},s({id:(0,h.OB)("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),t?.id&&e.createElement(Q.Z,{textColor:"danger600",variant:"pi"},s(t,{...t.values})))};gn.defaultProps={error:void 0,isReadOnly:!1},gn.propTypes={error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),isReadOnly:n().bool,onClick:n().func.isRequired};var Uo=gn,ra=d(9086),sa=d.n(ra),aa=d(87702),fn=d.n(aa),vm=d(27217),ia=d(88591),la=d.n(ia),hn=d(59845),ca=d(20871),da=d.n(ca),ua=d(48375),Vo=d.n(ua),ma=d(31089),pa=d.n(ma),ga=d(16043),fa=d.n(ga),ha=d(5109),ya=d.n(ha),ba=d(47955),Ea=d.n(ba),va=d(95706),Ca=d.n(va),Ra=d(6658),Ma=d.n(Ra),Ta=d(36407),Da=d.n(Ta);(async()=>{await d.e(7347).then(d.bind(d,74194))})();const yt=new(la())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(t,o){if(o&&o!=="auto"&&(0,hn.getLanguage)(o))return'<pre class="hljs language-'+yt.utils.escapeHtml(o.toLowerCase())+'"><code>'+(0,hn.highlight)(o,t,!0).value+"</code></pre>";if(o==="auto"){const r=(0,hn.highlightAuto)(t);return'<pre class="hljs language-'+yt.utils.escapeHtml(r.language)+'"><code>'+r.value+"</code></pre>"}return'<pre class="hljs"><code>'+yt.utils.escapeHtml(t)+"</code></pre>"}}).use(da()).use(Vo(),"warning").use(Vo(),"tip").use(pa()).use(fa()).use(ya()).use(Ea()).use(Ca()).use(Ma()).use(Da());yt.renderer.rules.footnote_ref=(t,o,r,s,a)=>'<sup class="footnote-ref"><span>'+a.rules.footnote_caption(t,o,r,s,a)+"</span></sup>",yt.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';var ka=yt,Ia=d(13993),Ho=d.n(Ia);const Pa={...Ho().defaults,allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}};var Oa=t=>Ho()(t,Pa),wa=j.ZP.div`
17
- position: absolute;
18
- top: 0;
19
- width: 100%;
20
- height: 100%;
21
- overflow: auto;
22
- padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
23
- font-size: ${14/16}rem;
24
- background-color: ${({theme:t})=>t.colors.neutral0};
25
- color: ${({theme:t})=>t.colors.neutral800};
26
- line-height: ${({theme:t})=>t.lineHeights[6]};
27
-
28
- h1,
29
- h2,
30
- h3,
31
- h4,
32
- h5,
33
- h6 {
34
- margin-block-start: ${({theme:t})=>t.spaces[2]};
35
- margin-block-end: ${({theme:t})=>t.spaces[2]};
36
- }
37
-
38
- p {
39
- margin-bottom: ${({theme:t})=>t.spaces[2]};
40
- }
41
-
42
- h1 {
43
- font-size: ${36/16}rem;
44
- font-weight: 600;
45
- }
46
-
47
- h2 {
48
- font-size: ${30/16}rem;
49
- font-weight: 500;
50
- }
51
-
52
- h3 {
53
- font-size: ${24/16}rem;
54
- font-weight: 500;
55
- }
56
-
57
- h4 {
58
- font-size: ${20/16}rem;
59
- font-weight: 500;
60
- }
61
-
62
- strong {
63
- font-weight: 800;
64
- }
65
-
66
- em {
67
- font-style: italic;
68
- }
69
-
70
- blockquote {
71
- margin-top: ${({theme:t})=>t.spaces[8]};
72
- margin-bottom: ${({theme:t})=>t.spaces[7]};
73
- font-size: ${14/16}rem;
74
- font-weight: 400;
75
- border-left: 4px solid ${({theme:t})=>t.colors.neutral150};
76
- font-style: italic;
77
- padding: ${({theme:t})=>t.spaces[2]} ${({theme:t})=>t.spaces[5]};
78
- }
79
-
80
- img {
81
- max-width: 100%;
82
- }
83
-
84
- table {
85
- thead {
86
- background: ${({theme:t})=>t.colors.neutral150};
87
-
88
- th {
89
- padding: ${({theme:t})=>t.spaces[4]};
90
- }
91
- }
92
- tr {
93
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
94
- }
95
- th,
96
- td {
97
- padding: ${({theme:t})=>t.spaces[4]};
98
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
99
- border-bottom: 0;
100
- border-top: 0;
101
- }
102
- }
103
-
104
- pre,
105
- code {
106
- font-size: ${14/16}rem;
107
- border-radius: 4px;
108
- /*
109
- Hard coded since the color is the same between themes,
110
- theme.colors.neutral800 changes between themes.
111
-
112
- Matches the color of the JSON Input component.
113
- */
114
- background-color: #32324d;
115
- max-width: 100%;
116
- overflow: auto;
117
- padding: ${({theme:t})=>t.spaces[2]};
118
- }
119
-
120
- /* Inline code */
121
- p,
122
- pre,
123
- td {
124
- > code {
125
- color: #839496;
126
- }
127
- }
128
-
129
- ol {
130
- list-style-type: decimal;
131
- margin-block-start: ${({theme:t})=>t.spaces[4]};
132
- margin-block-end: ${({theme:t})=>t.spaces[4]};
133
- margin-inline-start: 0px;
134
- margin-inline-end: 0px;
135
- padding-inline-start: ${({theme:t})=>t.spaces[4]};
136
-
137
- ol,
138
- ul {
139
- margin-block-start: 0px;
140
- margin-block-end: 0px;
141
- }
142
- }
143
-
144
- ul {
145
- list-style-type: disc;
146
- margin-block-start: ${({theme:t})=>t.spaces[4]};
147
- margin-block-end: ${({theme:t})=>t.spaces[4]};
148
- margin-inline-start: 0px;
149
- margin-inline-end: 0px;
150
- padding-inline-start: ${({theme:t})=>t.spaces[4]};
151
-
152
- ul,
153
- ol {
154
- margin-block-start: 0px;
155
- margin-block-end: 0px;
156
- }
157
- }
158
- `;const yn=({data:t})=>{const o=(0,e.useMemo)(()=>Oa(ka.render(t.replaceAll("\\n",`
159
- `)||"")),[t]);return e.createElement(wa,null,e.createElement("div",{dangerouslySetInnerHTML:{__html:o}}))};yn.defaultProps={data:""},yn.propTypes={data:n().string};var Qo=(0,e.memo)(yn);const xa=j.ZP.div`
160
- cursor: ${({disabled:t})=>t?"not-allowed !important":"auto"};
161
- height: 100%;
162
- /* BASICS */
163
- .CodeMirror-placeholder {
164
- color: ${({theme:t})=>t.colors.neutral600} !important;
165
- }
166
-
167
- .CodeMirror {
168
- /* Set height, width, borders, and global font properties here */
169
- font-size: ${14/16}rem;
170
- height: ${({isExpandMode:t})=>t?"100%":"290px"};
171
- color: ${({theme:t})=>t.colors.neutral800};
172
- direction: ltr;
173
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
174
- 'Open Sans', 'Helvetica Neue', sans-serif;
175
- }
176
-
177
- /* PADDING */
178
-
179
- .CodeMirror-lines {
180
- padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
181
- /* Vertical padding around content */
182
- }
183
-
184
- .CodeMirror-scrollbar-filler,
185
- .CodeMirror-gutter-filler {
186
- /* The little square between H and V scrollbars */
187
- background-color: ${({theme:t})=>`${t.colors.neutral0}`};
188
- }
189
-
190
- /* GUTTER */
191
-
192
- .CodeMirror-gutters {
193
- border-right: 1px solid #ddd;
194
- background-color: #f7f7f7;
195
- white-space: nowrap;
196
- }
197
- .CodeMirror-linenumbers {
198
- }
199
- .CodeMirror-linenumber {
200
- padding: 0 3px 0 5px;
201
- min-width: 20px;
202
- text-align: right;
203
- color: #999;
204
- white-space: nowrap;
205
- }
206
-
207
- .CodeMirror-guttermarker {
208
- color: black;
209
- }
210
- .CodeMirror-guttermarker-subtle {
211
- color: #999;
212
- }
213
-
214
- /* CURSOR */
215
-
216
- .CodeMirror-cursor {
217
- border-left: 1px solid black;
218
- border-right: none;
219
- width: 0;
220
- }
221
- /* Shown when moving in bi-directional text */
222
- .CodeMirror div.CodeMirror-secondarycursor {
223
- border-left: 1px solid silver;
224
- }
225
- .cm-fat-cursor .CodeMirror-cursor {
226
- width: auto;
227
- border: 0 !important;
228
- background: #7e7;
229
- }
230
- .cm-fat-cursor div.CodeMirror-cursors {
231
- /* z-index: 1; */
232
- }
233
-
234
- .cm-fat-cursor-mark {
235
- background-color: rgba(20, 255, 20, 0.5);
236
- -webkit-animation: blink 1.06s steps(1) infinite;
237
- -moz-animation: blink 1.06s steps(1) infinite;
238
- animation: blink 1.06s steps(1) infinite;
239
- }
240
- .cm-animate-fat-cursor {
241
- width: auto;
242
- border: 0;
243
- -webkit-animation: blink 1.06s steps(1) infinite;
244
- -moz-animation: blink 1.06s steps(1) infinite;
245
- animation: blink 1.06s steps(1) infinite;
246
- background-color: #7e7;
247
- }
248
-
249
- /* Can style cursor different in overwrite (non-insert) mode */
250
- .CodeMirror-overwrite .CodeMirror-cursor {
251
- }
252
-
253
- .cm-tab {
254
- display: inline-block;
255
- text-decoration: inherit;
256
- }
257
-
258
- .CodeMirror-rulers {
259
- position: absolute;
260
- left: 0;
261
- right: 0;
262
- top: -50px;
263
- bottom: 0;
264
- overflow: hidden;
265
- }
266
- .CodeMirror-ruler {
267
- border-left: 1px solid #ccc;
268
- top: 0;
269
- bottom: 0;
270
- position: absolute;
271
- }
272
-
273
- /* DEFAULT THEME */
274
-
275
- .cm-header,
276
- .cm-strong {
277
- font-weight: bold;
278
- }
279
- .cm-em {
280
- font-style: italic;
281
- }
282
- .cm-link {
283
- text-decoration: underline;
284
- }
285
- .cm-strikethrough {
286
- text-decoration: line-through;
287
- }
288
-
289
- .CodeMirror-composing {
290
- border-bottom: 2px solid;
291
- }
292
-
293
- /* Default styles for common addons */
294
-
295
- div.CodeMirror span.CodeMirror-matchingbracket {
296
- color: #0b0;
297
- }
298
- div.CodeMirror span.CodeMirror-nonmatchingbracket {
299
- color: #a22;
300
- }
301
- .CodeMirror-matchingtag {
302
- background: rgba(255, 150, 0, 0.3);
303
- }
304
- .CodeMirror-activeline-background {
305
- background: #e8f2ff;
306
- }
307
-
308
- /* STOP */
309
-
310
- /* The rest of this file contains styles related to the mechanics of
311
- the editor. You probably shouldn't touch them. */
312
-
313
- .CodeMirror {
314
- position: relative;
315
- overflow: hidden;
316
- background: ${({theme:t})=>`${t.colors.neutral0}`};
317
- }
318
-
319
- .CodeMirror-scroll {
320
- overflow: scroll !important; /* Things will break if this is overridden */
321
- /* 50px is the magic margin used to hide the element's real scrollbars */
322
- /* See overflow: hidden in .CodeMirror */
323
- margin-bottom: -50px;
324
- margin-right: -50px;
325
- padding-bottom: 50px;
326
- height: 100%;
327
- outline: none; /* Prevent dragging from highlighting the element */
328
- position: relative;
329
- }
330
- .CodeMirror-sizer {
331
- position: relative;
332
- border-right: 50px solid transparent;
333
- }
334
-
335
- /* The fake, visible scrollbars. Used to force redraw during scrolling
336
- before actual scrolling happens, thus preventing shaking and
337
- flickering artifacts. */
338
- .CodeMirror-vscrollbar,
339
- .CodeMirror-hscrollbar,
340
- .CodeMirror-scrollbar-filler,
341
- .CodeMirror-gutter-filler {
342
- position: absolute;
343
- z-index: 1;
344
- display: none;
345
- outline: none;
346
- }
347
-
348
- .CodeMirror-vscrollbar {
349
- right: 0;
350
- top: 0;
351
- overflow-x: hidden;
352
- overflow-y: scroll;
353
- }
354
- .CodeMirror-hscrollbar {
355
- bottom: 0;
356
- left: 0;
357
- overflow-y: hidden;
358
- overflow-x: scroll;
359
- }
360
- .CodeMirror-scrollbar-filler {
361
- right: 0;
362
- bottom: 0;
363
- }
364
-
365
- .CodeMirror-lines {
366
- cursor: text;
367
- min-height: 1px; /* prevents collapsing before first draw */
368
- }
369
- /* Reset some styles that the rest of the page might have set */
370
- .CodeMirror pre.CodeMirror-line,
371
- .CodeMirror pre.CodeMirror-line-like {
372
- -moz-border-radius: 0;
373
- -webkit-border-radius: 0;
374
- border-radius: 0;
375
- border-width: 0;
376
- background: transparent;
377
- font-family: inherit;
378
- font-size: inherit;
379
- margin: 0;
380
- white-space: pre;
381
- word-wrap: normal;
382
- line-height: 1.5;
383
- color: inherit;
384
- /* z-index: 2; */
385
- position: relative;
386
- overflow: visible;
387
- -webkit-tap-highlight-color: transparent;
388
- -webkit-font-variant-ligatures: contextual;
389
- font-variant-ligatures: contextual;
390
- }
391
-
392
- .CodeMirror pre.CodeMirror-line-like {
393
- z-index: 2;
394
- }
395
-
396
- .CodeMirror-wrap pre.CodeMirror-line,
397
- .CodeMirror-wrap pre.CodeMirror-line-like {
398
- word-wrap: break-word;
399
- white-space: pre-wrap;
400
- word-break: normal;
401
- }
402
-
403
- .CodeMirror-linebackground {
404
- position: absolute;
405
- left: 0;
406
- right: 0;
407
- top: 0;
408
- bottom: 0;
409
- z-index: 0;
410
- }
411
-
412
- .CodeMirror-linewidget {
413
- position: relative;
414
- /* z-index: 2; */
415
- padding: 0.1px; /* Force widget margins to stay inside of the container */
416
- }
417
-
418
- .CodeMirror-widget {
419
- }
420
-
421
- .CodeMirror-rtl pre {
422
- direction: rtl;
423
- }
424
-
425
- .CodeMirror-code {
426
- outline: none;
427
- }
428
-
429
- /* Force content-box sizing for the elements where we expect it */
430
- .CodeMirror-scroll,
431
- .CodeMirror-sizer,
432
- .CodeMirror-gutter,
433
- .CodeMirror-gutters,
434
- .CodeMirror-linenumber {
435
- -moz-box-sizing: content-box;
436
- box-sizing: content-box;
437
- }
438
-
439
- .CodeMirror-measure {
440
- position: absolute;
441
- width: 100%;
442
- height: 0;
443
- overflow: hidden;
444
- visibility: hidden;
445
- }
446
-
447
- .CodeMirror-cursor {
448
- position: absolute;
449
- pointer-events: none;
450
- border-color: ${({theme:t})=>`${t.colors.neutral800}`};
451
- }
452
- .CodeMirror-measure pre {
453
- position: static;
454
- }
455
-
456
- div.CodeMirror-cursors {
457
- visibility: hidden;
458
- position: relative;
459
- + div {
460
- z-index: 0 !important;
461
- }
462
- }
463
-
464
- div.CodeMirror-dragcursors {
465
- visibility: visible;
466
- }
467
-
468
- .CodeMirror-focused div.CodeMirror-cursors {
469
- visibility: visible;
470
- }
471
-
472
- .CodeMirror-selected {
473
- background: ${({theme:t})=>t.colors.neutral200};
474
- /* z-index: -10; */
475
- }
476
- .CodeMirror-crosshair {
477
- cursor: crosshair;
478
- }
479
-
480
- /* Used to force a border model for a node */
481
- .cm-force-border {
482
- padding-right: 0.1px;
483
- }
484
-
485
- /* See issue #2901 */
486
- .cm-tab-wrap-hack:after {
487
- content: '';
488
- }
489
-
490
- /* Help users use markselection to safely style text background */
491
- span.CodeMirror-selectedtext {
492
- background: none;
493
- }
494
-
495
- span {
496
- color: ${({theme:t})=>t.colors.neutral800} !important;
497
- }
498
- `;var bn=d(69783);const Ae=(0,j.ZP)(be.h)`
499
- padding: ${({theme:t})=>t.spaces[2]};
500
- /* Trick to prevent the outline from overflowing because of the general outline-offset */
501
- outline-offset: -2px !important;
502
-
503
- svg {
504
- width: ${18/16}rem;
505
- height: ${18/16}rem;
506
- }
507
- `,Fa=(0,j.ZP)(Ae)`
508
- svg {
509
- width: ${8/16}rem;
510
- height: ${8/16}rem;
511
- }
512
- `,Go=(0,j.ZP)(be.o)`
513
- margin-left: ${({theme:t})=>t.spaces[4]};
514
- `,Ko=(0,j.ZP)(be.h)`
515
- margin: ${({theme:t})=>`0 ${t.spaces[2]}`};
516
- padding: ${({theme:t})=>t.spaces[2]};
517
-
518
- svg {
519
- width: ${18/16}rem;
520
- height: ${18/16}rem;
521
- }
522
- `,La=(0,j.ZP)(be.o)`
523
- margin-right: ${({theme:t})=>`${t.spaces[2]}`};
524
- `,Aa=j.ZP.div`
525
- position: relative;
526
- height: calc(100% - 48px);
527
- `,Sa=(0,j.ZP)(bn.Y)`
528
- background-color: transparent;
529
- border: none;
530
- align-items: center;
531
-
532
- svg {
533
- margin-left: ${({theme:t})=>`${t.spaces[2]}`};
534
- path {
535
- fill: ${({theme:t})=>t.colors.neutral700};
536
- width: ${12/16}rem;
537
- height: ${12/16}rem;
538
- }
539
- }
540
- `;var zt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,$a=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Za=/[*+-]\s/;function Ba(t){if(t.getOption("disableInput"))return fn().Pass;for(var o=t.listSelections(),r=[],s=0;s<o.length;s++){var a=o[s].head,l=t.getStateAfter(a.line),i=l.list!==!1,c=l.quote!==0,g=t.getLine(a.line),u=zt.exec(g),p=/^\s*$/.test(g.slice(0,a.ch));if(!o[s].empty()||!i&&!c||!u||p){t.execCommand("newlineAndIndent");return}if($a.test(g)){var f=c&&/>\s*$/.test(g),m=!/>\s*$/.test(g);(f||m)&&t.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),r[s]=`
541
- `}else{var b=u[1],E=u[5],v=!(Za.test(u[2])||u[2].indexOf(">")>=0),k=v?parseInt(u[3],10)+1+u[4]:u[2].replace("x"," ");r[s]=`
542
- `+b+k+E,v&&qa(t,a)}}t.replaceSelections(r)}function qa(t,o){var r=o.line,s=0,a=0,l=zt.exec(t.getLine(r)),i=l[1];do{s+=1;var c=r+s,g=t.getLine(c),u=zt.exec(g);if(u){var p=u[1],f=parseInt(l[3],10)+s-a,m=parseInt(u[3],10),b=m;if(i===p&&!isNaN(m))f===m&&(b=m+1),f>m&&(b=f+1),t.replaceRange(g.replace(zt,p+b+u[4]+u[5]),{line:c,ch:0},{line:c,ch:g.length});else{if(i.length>p.length||i.length<p.length&&s===1)return;a+=1}}}while(u)}var Na=Ba;const En=({disabled:t,editorRef:o,error:r,isPreviewMode:s,isExpandMode:a,name:l,onChange:i,placeholder:c,textareaRef:g,value:u})=>{const p=(0,e.useRef)(i);return(0,e.useEffect)(()=>{o.current=fn().fromTextArea(g.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:c,spellcheck:!0,inputStyle:"contenteditable"}),fn().commands.newlineAndIndentContinueMarkdownList=Na,o.current.on("change",f=>{p.current({target:{name:l,value:f.getValue(),type:"wysiwyg"}})})},[o,g,l,c]),(0,e.useEffect)(()=>{u&&!o.current.hasFocus()&&o.current.setValue(u)},[o,u]),(0,e.useEffect)(()=>{s||t?o.current.setOption("readOnly","nocursor"):o.current.setOption("readOnly",!1)},[t,s,o]),(0,e.useEffect)(()=>{r?o.current.setOption("screenReaderLabel",r):o.current.setOption("screenReaderLabel","Editor")},[o,r]),e.createElement(Aa,null,e.createElement(xa,{isExpandMode:a,disabled:t||s},e.createElement("textarea",{ref:g})),s&&e.createElement(Qo,{data:u}))};En.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},En.propTypes={disabled:n().bool,editorRef:n().shape({current:n().any}).isRequired,error:n().string,isPreviewMode:n().bool,isExpandMode:n().bool,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().string,textareaRef:n().shape({current:n().any}).isRequired,value:n().string};var ja=En,He=d(68465),Ee=d(84967),ce=d(41415),Wa=d(54015),Yo=d(73906),Xo=d(49844),Jo=d(99283),_o=d(49825),za=d(83139),Ua=d(35635),Va=d(20063),Ha=d(80601),Qa=d(11417),Ga=d(43231),Ka=d(65663);const vn=({disabled:t,editorRef:o,isExpandMode:r,isPreviewMode:s,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[c,g]=(0,e.useState)(!1),{formatMessage:u}=(0,V.Z)(),p=u({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,e.useRef)(),m=()=>{g(b=>!b)};return t||s?e.createElement(F.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(er,null,e.createElement(He.P,{disabled:!0,placeholder:p,size:"S",label:p},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Go,null,e.createElement(Ae,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Yo.Z,null)}),e.createElement(Ae,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Xo.Z,null)}),e.createElement(Ae,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(Jo.Z,null)})),e.createElement(Ko,{disabled:!0,id:"more",label:"More",icon:e.createElement(_o.Z,null)})),!r&&e.createElement(ce.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"}))):e.createElement(F.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(er,null,e.createElement(He.P,{placeholder:p,label:p,size:"S",onChange:b=>a(b,o)},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Go,null,e.createElement(Ae,{onClick:()=>a("Bold",o),id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Yo.Z,null)}),e.createElement(Ae,{onClick:()=>a("Italic",o),id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Xo.Z,null)}),e.createElement(Ae,{onClick:()=>a("Underline",o),id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(Jo.Z,null)})),e.createElement(Ko,{ref:f,onClick:m,id:"more",label:"More",icon:e.createElement(_o.Z,null)}),c&&e.createElement(Wa.J2,{onDismiss:m,centered:!0,source:f,spacing:4,id:"popover"},e.createElement(F.k,null,e.createElement(La,null,e.createElement(Ae,{onClick:()=>a("Strikethrough",o,m),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:e.createElement(za.Z,null)}),e.createElement(Ae,{onClick:()=>a("BulletList",o,m),id:"BulletList",label:"BulletList",name:"BulletList",icon:e.createElement(Ua.Z,null)}),e.createElement(Ae,{onClick:()=>a("NumberList",o,m),id:"NumberList",label:"NumberList",name:"NumberList",icon:e.createElement(Va.Z,null)})),e.createElement(be.o,null,e.createElement(Ae,{onClick:()=>a("Code",o,m),id:"Code",label:"Code",name:"Code",icon:e.createElement(Ha.Z,null)}),e.createElement(Ae,{onClick:()=>{m(),l()},id:"Image",label:"Image",name:"Image",icon:e.createElement(Qa.Z,null)}),e.createElement(Fa,{onClick:()=>a("Link",o,m),id:"Link",label:"Link",name:"Link",icon:e.createElement(Ga.Z,null)}),e.createElement(Ae,{onClick:()=>a("Quote",o,m),id:"Quote",label:"Quote",name:"Quote",icon:e.createElement(Ka.Z,null)}))))),i&&e.createElement(ce.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"})))};vn.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},vn.propTypes={disabled:n().bool.isRequired,editorRef:n().shape({current:n().any}).isRequired,isExpandMode:n().bool.isRequired,isPreviewMode:n().bool,onActionClick:n().func,onToggleMediaLib:n().func,onTogglePreviewMode:n().func};var Ya=vn;const er=(0,j.ZP)(F.k)`
543
- /* Hide the label, every input needs a label. */
544
- label {
545
- border: 0;
546
- clip: rect(0 0 0 0);
547
- height: 1px;
548
- margin: -1px;
549
- overflow: hidden;
550
- padding: 0;
551
- position: absolute;
552
- width: 1px;
553
- }
554
- `;var Xa=d(18070);const Cn=({onToggleExpand:t})=>{const{formatMessage:o}=(0,V.Z)();return e.createElement(S.x,{padding:2,background:"neutral100",hasRadius:!0},e.createElement(F.k,{justifyContent:"flex-end",alignItems:"flex-end"},e.createElement(Sa,{id:"expand",onClick:t},e.createElement(Q.Z,null,o({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),e.createElement(Xa.Z,null))))};Cn.defaultProps={onToggleExpand(){}},Cn.propTypes={onToggleExpand:n().func};var Ja=Cn;const Rn=({id:t,error:o,name:r,hint:s})=>s.length===0||o?null:e.createElement(Q.Z,{as:"p",variant:"pi",id:`${t||r}-hint`,textColor:"neutral600"},s);Rn.defaultProps={id:void 0,error:void 0,hint:""},Rn.propTypes={hint:n().oneOfType([n().string,n().array]),error:n().string,id:n().string,name:n().string.isRequired};var _a=Rn;const tr=(t,o)=>{let r;switch(t){case"Strikethrough":r=`~~${o}~~`;break;case"Bold":r=`**${o}**`;break;case"Italic":r=`_${o}_`;break;case"Underline":r=`<u>${o}</u>`;break;case"Code":r=`\`\`\`
555
- ${o}
556
- \`\`\``;break;case"Link":r=`[${o}](link)`;break;case"Quote":r=`>${o}`;break;default:r=o}return r},nr=t=>{let o,r={start:t.length,end:0};switch(t){case"Strikethrough":o=`~~${t}~~`,r.end=2;break;case"Bold":o=`**${t}**`,r.end=2;break;case"Italic":o=`_${t}_`,r.end=1;break;case"alt":o=`[${t}]()`,r.end=3;break;case"Underline":o=`<u>${t}</u>`,r.end=4;break;case"Code":o=`\`\`\`
557
- ${t}
558
- \`\`\``,r.end=3;break;case"Link":o=`[${t}](link)`,r.end=7;break;case"Quote":o=`>${t}`,r.end=0;break;default:o=""}return{editedText:o,selection:r}},or=t=>{let o;switch(t){case"BulletList":o="- ";break;case"NumberList":o="1. ";break;case"h1":o="# ";break;case"h2":o="## ";break;case"h3":o="### ";break;case"h4":o="#### ";break;case"h5":o="##### ";break;case"h6":o="###### ";break;default:return""}return o},rr=(t,o)=>{const r=t.current.getSelection();let s;if(r){const a=tr(o,r);t.current.replaceSelection(a),t.current.focus()}else{s=nr(o),t.current.replaceSelection(s.editedText),t.current.focus();const{line:a,ch:l}=t.current.getCursor(),i=l-s.selection.end,c=l-s.selection.end-s.selection.start;t.current.setSelection({line:a,ch:c},{line:a,ch:i})}},ei=(t,o)=>{const r=t.current.getDoc(),s=o==="BulletList"?"- ":"1. ";if(r.somethingSelected()){const a=r.listSelections();let l=null;t.current.operation(function(){a.forEach(function(i){const c=[i.head.line,i.anchor.line].sort();l==null&&(l=r.getLine(c[0]).startsWith(s));for(let g=c[0];g<=c[1];g++)if(l)r.getLine(g).startsWith(s)&&r.replaceRange("",{line:g,ch:0},{line:g,ch:s.length});else{const u=o==="BulletList"?"- ":`${g+1}. `;r.replaceRange(u,{line:g,ch:0})}})})}else{let{line:a}=r.getCursor();const l=or(o),i=t.current.getLine(a),c=l+i;t.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),t.current.replaceSelection(c)}t.current.focus()},ti=(t,o)=>{let{line:r}=t.current.getCursor();const s=or(o),a=t.current.getLine(r),l=a.replace(/#{1,6}\s/g,"").trim(),i=s+l;t.current.setSelection({line:r,ch:0},{line:r,ch:a.length}),t.current.replaceSelection(i),setTimeout(()=>{const c=t.current.getLine(r).length;t.current.focus(),t.current.setCursor({line:r,ch:c})},0)},ni=(t,o)=>{let{line:r,ch:s}=t.current.getCursor();o.forEach((a,l)=>{let i=t.current.getLine(r).length;t.current.setCursor({line:r,ch:i}),(l>0||l===0&&s!==0)&&(i=t.current.getLine(r).length,t.current.setCursor({line:r,ch:i}),r++,t.current.replaceSelection(`
559
- `)),a.mime.includes("image")?t.current.replaceSelection(`![${a.alt}](${a.url})`):t.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>t.current.focus(),0)},oi=(t,o,r,s,a)=>{const l=tr(o,a),i=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.replaceSelection(""),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
560
- `),t.current.replaceSelection(l),o==="Code"){let{line:c}=t.current.getCursor();t.current.setCursor({line:c-1,ch:a.length})}t.current.replaceRange(i,{line:r+4,ch:0},{line:1/0,ch:1/0}),t.current.focus()},ri=(t,o,r,s)=>{const a=nr(o),l=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
561
- `),t.current.replaceSelection(a.editedText),o==="Code")r+=2,t.current.setSelection({line:r,ch:0},{line:r,ch:4});else{r+=1;let{ch:i}=t.current.getCursor(),c=i-a.selection.end,g=i-a.selection.end-a.selection.start;t.current.setSelection({line:r,ch:g},{line:r,ch:c})}t.current.replaceRange(l,{line:r+2,ch:0},{line:1/0,ch:1/0}),t.current.focus()},si=(t,o)=>{const r=t.current.getSelection();let{line:s}=t.current.getCursor(),a=t.current.getLine(s).length;r?oi(t,o,s,a,r):ri(t,o,s,a)};var ai=d(71933),ii=d(67563),li=d(74464);const ci=(t,o)=>`${t}${Math.floor(o*255).toString(16).padStart(2,0)}`,di=(0,j.ZP)(F.k)`
562
- background: ${({theme:t})=>ci(t.colors.neutral800,.2)};
563
- `,ui=(0,j.ZP)(S.x)`
564
- border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
565
- `,mi=(0,j.ZP)(bn.Y)`
566
- background-color: transparent;
567
- border: none;
568
- align-items: center;
569
-
570
- svg {
571
- margin-left: ${({theme:t})=>`${t.spaces[2]}`};
572
-
573
- path {
574
- fill: ${({theme:t})=>t.colors.neutral700};
575
- width: ${12/16}rem;
576
- height: ${12/16}rem;
577
- }
578
- }
579
- `,Mn=({children:t,isExpandMode:o,error:r,previewContent:s,onCollapse:a})=>{const{formatMessage:l}=(0,V.Z)();return(0,y.F5)(o),o?e.createElement(ai.h,{role:"dialog","aria-modal":!1},e.createElement(ii.i,{onEscape:a},e.createElement(di,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},e.createElement(S.x,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},e.createElement(F.k,{height:"100%",alignItems:"flex-start"},e.createElement(ui,{flex:"1",height:"100%"},t),e.createElement(F.k,{alignItems:"start",direction:"column",flex:1,height:"100%",width:"100%"},e.createElement(F.k,{height:(0,y.Q1)(48),background:"neutral100",justifyContent:"flex-end",shrink:0,width:"100%"},e.createElement(mi,{onClick:a},e.createElement(Q.Z,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),e.createElement(li.Z,null))),e.createElement(S.x,{position:"relative",height:"100%",width:"100%"},e.createElement(Qo,{data:s})))))))):e.createElement(S.x,{borderColor:r?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},t)};Mn.defaultProps={error:void 0,previewContent:""},Mn.propTypes={children:n().node.isRequired,error:n().string,isExpandMode:n().bool.isRequired,previewContent:n().string,onCollapse:n().func.isRequired};const pi=(0,j.ZP)(S.x)`
580
- svg path {
581
- fill: ${({theme:t})=>t.colors.neutral500};
582
- }
583
- `,gi=(0,j.ZP)(Q.Z)`
584
- line-height: 0;
585
- `,Tn=({hint:t,disabled:o,error:r,intlLabel:s,labelAction:a,name:l,onChange:i,placeholder:c,value:g,required:u})=>{const{formatMessage:p}=(0,V.Z)(),f=(0,e.useRef)(null),m=(0,e.useRef)(null),[b,E]=(0,e.useState)(!1),[v,k]=(0,e.useState)(!1),[R,T]=(0,e.useState)(!1),{components:w}=(0,y.yX)(),D=w["media-library"],C=()=>k(W=>!W),M=()=>E(W=>!W),I=()=>{E(!1),T(W=>!W)},A=(W,G,z)=>{switch(W){case"Link":case"Strikethrough":{rr(G,W),z();break}case"Code":case"Quote":{si(G,W),z();break}case"Bold":case"Italic":case"Underline":{rr(G,W);break}case"BulletList":case"NumberList":{ei(G,W),z();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{ti(G,W);break}default:}},B=W=>{const G=W.map(z=>({alt:z.alternativeText||z.name,url:(0,y.CR)(z.url),mime:z.mime}));ni(m,G),k(!1)},$=c?p({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):"",K=s.id?p({id:s.id,defaultMessage:s.defaultMessage},{...s.values}):l;return e.createElement(e.Fragment,null,e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:1},e.createElement(F.k,{gap:1},e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},K,u&&e.createElement(gi,{textColor:"danger600"},"*")),a&&e.createElement(pi,{paddingLeft:1},a)),e.createElement(Mn,{isExpandMode:R,error:r,previewContent:g,onCollapse:I},e.createElement(Ya,{isExpandMode:R,editorRef:m,isPreviewMode:b,onActionClick:A,onToggleMediaLib:C,onTogglePreviewMode:R?void 0:M,disabled:o}),e.createElement(ja,{disabled:o,isExpandMode:R,editorRef:m,error:r,isPreviewMode:b,name:l,onChange:i,placeholder:$,textareaRef:f,value:g}),!R&&e.createElement(Ja,{onToggleExpand:I})),e.createElement(_a,{hint:t,name:l,error:r})),r&&e.createElement(S.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},r)),v&&e.createElement(D,{onClose:C,onSelectAssets:B}))};Tn.defaultProps={disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:"",hint:""},Tn.propTypes={hint:n().oneOfType([n().string,n().array]),disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,value:n().string};var fi=Tn,Dn=d(10369),hi=d(38705),Ft=d(69932),yi=d(27169),sr=d(44647),ar=d(75536),bi=/^[A-Za-z0-9-_.~]*$/,Ei=d(63642);const vi=(0,j.ZP)(Ei.E)`
586
- svg {
587
- height: 1rem;
588
- width: 1rem;
589
- path {
590
- fill: ${({theme:t})=>t.colors.neutral400};
591
- }
592
- }
593
-
594
- svg:hover {
595
- path {
596
- fill: ${({theme:t})=>t.colors.primary600};
597
- }
598
- }
599
- `,ir=(0,j.ZP)(F.k)`
600
- svg {
601
- height: ${12/16}rem;
602
- width: ${12/16}rem;
603
-
604
- path {
605
- fill: ${({theme:t,available:o})=>o?t.colors.success600:t.colors.danger600};
606
- }
607
- }
608
- `,Ci=j.F4`
609
- from {
610
- transform: rotate(0deg);
611
- }
612
- to {
613
- transform: rotate(359deg);
614
- }
615
- `,Ri=(0,j.ZP)(F.k)`
616
- animation: ${Ci} 2s infinite linear;
617
- `,kn=({attribute:t,contentTypeUID:o,hint:r,disabled:s,error:a,intlLabel:l,labelAction:i,name:c,onChange:g,value:u,placeholder:p,required:f})=>{const{modifiedData:m,initialData:b,layout:E}=(0,y.Wq)(),[v,k]=(0,e.useState)(!1),[R,T]=(0,e.useState)(null),w=(0,ar.Z)(u,300),D=(0,e.useRef)(),C=(0,y.lm)(),{formatAPIError:M}=(0,y.So)(),I=b[c],{formatMessage:A}=(0,V.Z)(),B=E?.options?.timestamps??0,$=!b[B],K=(0,ar.Z)(m[t.targetField],300),[W,G]=(0,e.useState)(!1),[z,X]=(0,e.useState)(null),{post:q}=(0,y.kY)(),U=l.id?A({id:l.id,defaultMessage:l.defaultMessage},{...l.values}):c,L=p?A({id:p.id,defaultMessage:p.defaultMessage},{...p.values}):"";D.current=async(Z=!1)=>{k(!0);try{const{data:{data:oe}}=await q((0,h.IF)("uid/generate"),{contentTypeUID:o,field:c,data:m});g({target:{name:c,value:oe,type:"text"}},Z),k(!1)}catch(oe){k(!1),C({type:"warning",message:M(oe)})}};const O=async()=>{if(u){k(!0);try{const{data:Z}=await q((0,h.IF)("uid/check-availability"),{contentTypeUID:o,field:c,value:u?u.trim():""});k(!1),T(Z)}catch(Z){k(!1),C({type:"warning",message:M(Z)})}}};(0,e.useEffect)(()=>{!u&&t.required&&D.current(!0)},[t.required,D,u]),(0,e.useEffect)(()=>{w?.trim().match(bi)&&w!==I&&O(),w||T(null)},[I,w]),(0,e.useEffect)(()=>{let Z;return R?.isAvailable&&(Z=setTimeout(()=>{T(null)},4e3)),()=>{Z&&clearTimeout(Z)}},[R]),(0,e.useEffect)(()=>{!W&&$&&K&&m[t.targetField]&&!u&&D.current(!0)},[K,W,$]);const N=()=>{X(A({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},Y=()=>{X(null)},P=Z=>{Z.target.value&&$&&G(!0),g(Z)};return e.createElement(Dn.o,{disabled:s,error:a,endAction:e.createElement(F.k,{position:"relative",gap:1},R&&!z&&e.createElement(ir,{alignItems:"center",gap:1,justifyContent:"flex-end",available:!!R?.isAvailable,"data-not-here-outer":!0,position:"absolute",pointerEvents:"none",right:6,width:"100px"},R?.isAvailable?e.createElement(hi.Z,null):e.createElement(Ft.Z,null),e.createElement(Q.Z,{textColor:R.isAvailable?"success600":"danger600",variant:"pi"},A(R.isAvailable?{id:"content-manager.components.uid.available",defaultMessage:"Available"}:{id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),!s&&e.createElement(e.Fragment,null,z&&e.createElement(ir,{alignItems:"center",justifyContent:"flex-end",gap:1},e.createElement(Q.Z,{textColor:"primary600",variant:"pi"},z)),e.createElement(vi,{onClick:()=>D.current(),label:A({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}),onMouseEnter:N,onMouseLeave:Y},v?e.createElement(Ri,{"data-testid":"loading-wrapper"},e.createElement(yi.Z,null)):e.createElement(sr.Z,null)))),hint:r,label:U,labelAction:i,name:c,onChange:P,placeholder:L,value:u||"",required:f})};kn.propTypes={attribute:n().shape({targetField:n().string,required:n().bool}).isRequired,contentTypeUID:n().string.isRequired,disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,hint:n().oneOfType([n().string,n().array])},kn.defaultProps={disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1,hint:""};var Mi=kn,Ti=d(88423),In=d.n(Ti),Di=d(41044),ki=d(50428),Ii=d(87107),Pi=d(28847),lr=d(7563),Oi=d(67014),wi=d(47851),cr=d(99140),Ut=d(63919),Pn=d(41234),Vt=d(35331);const On=({children:t,loadMore:o,search:r,totalNumberOfRelations:s,size:a,...l})=>e.createElement(e.Fragment,null,e.createElement(F.k,{paddingBottom:s>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},e.createElement(F.k,{direction:"column",alignItems:"stretch",basis:a<=6?"100%":"70%",gap:1,...l},r),o),t);On.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},On.propTypes={children:n().node.isRequired,search:n().node,loadMore:n().node,size:n().number.isRequired,totalNumberOfRelations:n().number};var dr=d(90553);const Ht=50,bt=4,ur=(0,j.ZP)(F.k)`
618
- width: 100%;
619
- /* Used to prevent endAction to be pushed out of container */
620
- min-width: 0;
621
-
622
- & > div[role='button'] {
623
- cursor: all-scroll;
624
- }
625
- `,mr=(0,j.ZP)(F.k)`
626
- width: 100%;
627
- /* Used to prevent endAction to be pushed out of container */
628
- min-width: 0;
629
- `,wn=({ariaDescribedBy:t,children:o,displayValue:r,canDrag:s,disabled:a,endAction:l,iconButtonAriaLabel:i,style:c,id:g,index:u,name:p,onCancel:f,onDropItem:m,onGrabItem:b,status:E,updatePositionOfRelation:v,...k})=>{const[{handlerId:R,isDragging:T,handleKeyDown:w},D,C,M,I]=(0,dr.Y)(s&&!a,{type:`${h._Q.RELATION}_${p}`,index:u,item:{displayedValue:r,status:E,id:g},onGrabItem:b,onDropItem:m,onCancel:f,onMoveItem:v,dropSensitivity:"immediate"}),A=(0,h.FE)(D,M);return(0,e.useEffect)(()=>{I((0,wt.rX)())},[I]),e.createElement(S.x,{style:c,as:"li",ref:C,"aria-describedby":t,cursor:s?"all-scroll":"default"},T?e.createElement(xi,null):e.createElement(F.k,{paddingTop:2,paddingBottom:2,paddingLeft:s?2:4,paddingRight:4,hasRadius:!0,borderSize:1,borderColor:"neutral200",background:a?"neutral150":"neutral0",justifyContent:"space-between",ref:s?A:void 0,"data-handler-id":R,...k},e.createElement(ur,{gap:1},s?e.createElement(be.h,{forwardedAs:"div",role:"button",tabIndex:0,"aria-label":i,noBorder:!0,onKeyDown:w,disabled:a},e.createElement(nt.Z,null)):null,e.createElement(mr,{justifyContent:"space-between"},o)),l&&e.createElement(S.x,{paddingLeft:4},l)))},xi=()=>e.createElement(S.x,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",background:"primary100",height:`calc(100% - ${bt}px)`});wn.defaultProps={ariaDescribedBy:"",canDrag:!1,displayValue:"",disabled:!1,endAction:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,style:void 0,status:void 0,updatePositionOfRelation:void 0},wn.propTypes={ariaDescribedBy:n().string,canDrag:n().bool,children:n().node.isRequired,displayValue:n().string,disabled:n().bool,endAction:n().node,iconButtonAriaLabel:n().string.isRequired,id:n().number.isRequired,index:n().number.isRequired,name:n().string.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,status:n().string,style:n().shape({height:n().number,left:n().number,position:n().string,right:n().number,width:n().string}),updatePositionOfRelation:n().func};const Fi=(0,j.ZP)(S.x)`
630
- position: relative;
631
- overflow-x: hidden;
632
- overflow-y: auto;
633
-
634
- &:before,
635
- &:after {
636
- position: absolute;
637
- width: 100%;
638
- height: 4px;
639
- z-index: 1;
640
- }
641
-
642
- &:before {
643
- /* TODO: as for DS Table component we would need this to be handled by the DS theme */
644
- content: '';
645
- background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
646
- top: 0;
647
- opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="top"?1:0};
648
- transition: opacity 0.2s ease-in-out;
649
- }
650
-
651
- &:after {
652
- /* TODO: as for DS Table component we would need this to be handled by the DS theme */
653
- content: '';
654
- background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
655
- bottom: 0;
656
- opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="bottom"?1:0};
657
- transition: opacity 0.2s ease-in-out;
658
- }
659
- `,xn=({children:t,overflow:o,...r})=>e.createElement(Fi,{overflowDirection:o,...r},t);xn.defaultProps={overflow:""},xn.propTypes={children:n().node.isRequired,overflow:n().oneOf(["top-bottom","bottom","top",""])};var Li=d(67582);const Ai=j.ZP.div`
660
- flex-shrink: 0;
661
- width: ${(0,y.Q1)(6)};
662
- height: ${(0,y.Q1)(6)};
663
- margin-right: ${({theme:t})=>t.spaces[2]};
664
- background-color: ${({theme:t,isDraft:o})=>t.colors[o?"secondary600":"success600"]};
665
- border-radius: 50%;
666
- `,pr=t=>{const{formatMessage:o}=(0,V.Z)(),r=Li.c.Option,{publicationState:s,mainField:a,id:l}=t.data;if(s){const i=s==="draft",c={id:(0,h.OB)("components.Select.draft-info-title"),defaultMessage:"State: Draft"},g={id:(0,h.OB)("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=o(i?c:g);return e.createElement(r,{...t},e.createElement(F.k,null,e.createElement(Ai,{title:u,isDraft:i}),e.createElement(Q.Z,{ellipsis:!0},a??l)))}return e.createElement(r,{...t},a??l)};pr.propTypes={isFocused:n().bool.isRequired,data:n().shape({id:n().number.isRequired,isDraft:n().bool,mainField:n().string,publicationState:n().oneOfType([n().string,n().bool])}).isRequired};const gr=(0,j.ZP)(ki.r)`
667
- display: block;
668
-
669
- > span {
670
- white-space: nowrap;
671
- overflow: hidden;
672
- text-overflow: ellipsis;
673
- display: block;
674
- }
675
- `,fr=j.ZP.button`
676
- svg path {
677
- fill: ${({theme:t,disabled:o})=>o?t.colors.neutral600:t.colors.neutral500};
678
- }
679
-
680
- &:hover svg path,
681
- &:focus svg path {
682
- fill: ${({theme:t,disabled:o})=>!o&&t.colors.neutral600};
683
- }
684
- `,Fn=({canReorder:t,description:o,disabled:r,error:s,iconButtonAriaLabel:a,id:l,name:i,numberOfRelationsToDisplay:c,label:g,labelAction:u,labelLoadMore:p,labelDisconnectRelation:f,listAriaDescription:m,liveText:b,loadingMessage:E,onCancel:v,onDropItem:k,onGrabItem:R,noRelationsMessage:T,onRelationConnect:w,onRelationLoadMore:D,onRelationDisconnect:C,onRelationReorder:M,onSearchNextPage:I,onSearch:A,placeholder:B,publicationStateTranslations:$,required:K,relations:W,searchResults:G,size:z})=>{const[X,q]=(0,e.useState)(null),[U,L]=(0,e.useState)(""),O=(0,e.useRef)(),N=(0,e.useRef)(),{data:Y}=G,P=W.data,Z=P.length??0,oe=(0,e.useMemo)(()=>Z>c?Math.min(Z,c)*(Ht+bt)+Ht/2:Math.min(Z,c)*(Ht+bt),[Z,c]),re=!!p&&W.hasNextPage,me=(0,e.useMemo)(()=>Y.flat().filter(Boolean).map(_=>({..._,value:_.id,label:_.mainField})),[Y]);(0,e.useEffect)(()=>{if(Z<=c)return L("");const _=ze=>{const No=ze.target.parentNode.scrollHeight,at=ze.target.scrollHeight-ze.target.scrollTop;return ze.target.scrollTop===0?L("bottom"):L(at===No?"top":"top-bottom")},fe=N?.current;return!W.isLoading&&P.length>0&&fe&&N.current.addEventListener("scroll",_),()=>{fe&&fe.removeEventListener("scroll",_)}},[W,P,c,Z]);const[H,ae]=(0,e.useState)(!1),Pe=(0,e.useRef)(),Ne=(0,e.useRef)([]);(0,e.useEffect)(()=>(me.length>0&&Ne.current.length===0&&ae(_=>(_&&(Pe.current=setTimeout(()=>{ae(!0)},10)),!1)),()=>{Ne.current=me||[]}),[me]),(0,e.useEffect)(()=>()=>{Pe.current&&clearTimeout(Pe.current)},[]);const de=()=>{ae(!1)},ue=()=>{ae(!0),A()},Fe=(_,fe)=>{M&&_>=0&&_<P.length&&M(fe,_)},Re=(0,pe.zH)(P.length),ke=(0,e.useRef)(),Tt=()=>{ke.current="loadMore",D()};(0,e.useEffect)(()=>{ke.current==="onChange"&&P.length!==Re?O.current.scrollToItem(P.length,"end"):ke.current==="loadMore"&&P.length!==Re&&O.current.scrollToItem(0,"start"),ke.current=void 0},[Re,P]);const Me=`${i}-item-instructions`;return e.createElement(Ii.g,{error:s,name:i,hint:o,id:l,required:K},e.createElement(On,{totalNumberOfRelations:Z,size:z,search:e.createElement(e.Fragment,null,e.createElement(Pi.Q,{action:u},g),e.createElement(y.JV,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:pr},options:me,isDisabled:r,isLoading:G.isLoading,error:s,inputId:l,isSearchable:!0,isClear:!0,loadingMessage:()=>E,onChange:_=>{q(null),w(_),ke.current="onChange"},onInputChange:_=>{q(_),A(_)},onMenuClose:de,onMenuOpen:ue,menuIsOpen:H,noOptionsMessage:()=>T,onMenuScrollToBottom:()=>{G.hasNextPage&&I()},placeholder:B,name:i,value:X})),loadMore:re&&e.createElement(lr.A,{disabled:W.isLoading||W.isFetchingNextPage,onClick:Tt,loading:W.isLoading||W.isFetchingNextPage,startIcon:e.createElement(sr.Z,null)},p)},P.length>0&&e.createElement(xn,{overflow:U},e.createElement(ht.T,{id:Me},m),e.createElement(ht.T,{"aria-live":"assertive"},b),e.createElement(Di.t7,{height:oe,ref:O,outerRef:N,itemCount:Z,itemSize:Ht+bt,itemData:{name:i,ariaDescribedBy:Me,canDrag:t,disabled:r,handleCancel:v,handleDropItem:k,handleGrabItem:R,iconButtonAriaLabel:a,labelDisconnectRelation:f,onRelationDisconnect:C,publicationStateTranslations:$,relations:P,updatePositionOfRelation:Fe},itemKey:_=>`${P[_].mainField}_${P[_].id}`,innerElementType:"ol"},Ln)),(o||s)&&e.createElement(S.x,{paddingTop:2},e.createElement(Oi.J,null),e.createElement(wi.c,null))))},Si=n().shape({data:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),hasNextPage:n().bool,isFetchingNextPage:n().bool.isRequired,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired}),$i=n().shape({data:n().arrayOf(n().shape({id:n().number.isRequired,href:n().string,mainField:n().oneOfType([n().string,n().number]),publicationState:n().oneOfType([n().string,n().bool])})),hasNextPage:n().bool,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired});Fn.defaultProps={canReorder:!1,description:void 0,disabled:!1,error:void 0,labelAction:null,labelLoadMore:null,liveText:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,required:!1,relations:{data:[]},searchResults:{data:[]}},Fn.propTypes={error:n().string,canReorder:n().bool,description:n().string,disabled:n().bool,iconButtonAriaLabel:n().string.isRequired,id:n().string.isRequired,label:n().string.isRequired,labelAction:n().element,labelLoadMore:n().string,labelDisconnectRelation:n().string.isRequired,listAriaDescription:n().string.isRequired,liveText:n().string,loadingMessage:n().string.isRequired,name:n().string.isRequired,noRelationsMessage:n().string.isRequired,numberOfRelationsToDisplay:n().number.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,onRelationConnect:n().func.isRequired,onRelationDisconnect:n().func.isRequired,onRelationLoadMore:n().func.isRequired,onRelationReorder:n().func.isRequired,onSearch:n().func.isRequired,onSearchNextPage:n().func.isRequired,placeholder:n().string.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,required:n().bool,searchResults:$i,size:n().number.isRequired,relations:Si};const Ln=({data:t,index:o,style:r})=>{const{ariaDescribedBy:s,canDrag:a,disabled:l,handleCancel:i,handleDropItem:c,handleGrabItem:g,iconButtonAriaLabel:u,name:p,labelDisconnectRelation:f,onRelationDisconnect:m,publicationStateTranslations:b,relations:E,updatePositionOfRelation:v}=t,{publicationState:k,href:R,mainField:T,id:w}=E[o],D=k==="draft"?"secondary":"success";return e.createElement(wn,{ariaDescribedBy:s,canDrag:a,disabled:l,displayValue:String(T??w),iconButtonAriaLabel:u,id:w,index:o,name:p,endAction:e.createElement(fr,{"data-testid":`remove-relation-${w}`,disabled:l,type:"button",onClick:()=>m(E[o]),"aria-label":f},e.createElement(cr.J,{width:"12px",as:Vt.Z})),onCancel:i,onDropItem:c,onGrabItem:g,status:k||void 0,style:{...r,bottom:r.bottom??0+bt,height:r.height??0-bt},updatePositionOfRelation:v},e.createElement(S.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(Ut.u,{description:T??`${w}`},R?e.createElement(gr,{to:R},T??w):e.createElement(Q.Z,{textColor:l?"neutral600":"primary600",ellipsis:!0},T??w))),k&&e.createElement(Pn.q,{variant:D,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${D}700`},b[k])))};Ln.defaultProps={data:{}},Ln.propTypes={data:n().shape({ariaDescribedBy:n().string.isRequired,canDrag:n().bool.isRequired,disabled:n().bool.isRequired,handleCancel:n().func,handleDropItem:n().func,handleGrabItem:n().func,iconButtonAriaLabel:n().string.isRequired,labelDisconnectRelation:n().string.isRequired,name:n().string.isRequired,onRelationDisconnect:n().func.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,relations:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),updatePositionOfRelation:n().func.isRequired}),index:n().number.isRequired,style:n().object.isRequired};var Zi=Fn,Xe=d(20108);function Bi(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var qi=Bi;function Ni({componentUid:t,isUserAllowedToEditField:o,isUserAllowedToReadField:r,name:s,queryInfos:a}){const{isCreatingEntry:l,createActionAllowedFields:i,readActionAllowedFields:c,updateActionAllowedFields:g,slug:u,modifiedData:p}=(0,y.Wq)(),f=(0,e.useMemo)(()=>o===!0?!0:(l?i:g).includes(s),[l,i,s,o,g]),m=(0,e.useMemo)(()=>r?!0:(l?[]:c).includes(s),[l,r,s,c]),b=s.split(".");let E;t&&(E=x()(p,b.slice(0,-1))?.id);const v=(0,e.useMemo)(()=>l?null:t?E?(0,h.IF)(`relations/${t}/${E}/${b.at(-1)}`):null:(0,h.IF)(`relations/${u}/${p.id}/${s.split(".").at(-1)}`),[l,t,u,p.id,s,E,b]),k=(0,e.useMemo)(()=>t?(0,h.IF)(`relations/${t}/${s.split(".").at(-1)}`):(0,h.IF)(`relations/${u}/${s.split(".").at(-1)}`),[t,u,s]);return{componentId:E,isComponentRelation:Boolean(t),queryInfos:{...a,endpoints:{search:k,relation:v}},isCreatingEntry:l,isFieldAllowed:f,isFieldReadable:m}}var ji=Ni;function Wi(t,o){return`${(0,h.IF)(`collectionType/${t}/${o??""}`)}`}const ct={DRAFT:"draft",PUBLISHED:"published"},An=5,zi=10,Sn=(t,{shouldAddLink:o,mainFieldName:r,targetModel:s})=>{const a={...t};return o&&(a.href=Wi(s,a.id)),a.publicationState=!1,a?.publishedAt!==void 0&&(a.publicationState=a.publishedAt?ct.PUBLISHED:ct.DRAFT),a.mainField=a[r],a},Ui=(t,{shouldAddLink:o=!1,mainFieldName:r,targetModel:s}={})=>[...t].map(a=>Sn(a,{shouldAddLink:o,mainFieldName:r,targetModel:s})),Vi=(t,{mainFieldName:o})=>{const{data:r}=t,{pages:s=[]}=r??{};return{...t,data:s.map(a=>a?.results.map(l=>Sn(l,{mainFieldName:o}))).filter(Boolean).flat()}},Hi=(t=[],o=[])=>{const r=t.reduce((a,l)=>o.find(i=>i.id===l.id)?a:[...a,l.id],[]),s=o.reduce((a,l)=>t.find(i=>i.id===l.id)?a:[...a,l.id],[]);return[r,s]},Qi=(t,{relation:o,search:r})=>{const[s,a]=(0,e.useState)({}),[l,i]=(0,e.useState)(0),{get:c}=(0,y.kY)(),g=async({pageParam:C=1})=>{try{const{data:M}=await c(o?.endpoint,{params:{...o.pageParams??{},page:C}});return i(C),M}catch{return null}},u=async({pageParam:C=1})=>{try{const{data:M}=await c(r.endpoint,{params:{...r.pageParams??{},...s,page:C}});return M}catch{return null}},{onLoad:p,normalizeArguments:f={}}=o,m=(0,Xe.useInfiniteQuery)(["relation",...t],g,{cacheTime:0,enabled:o.enabled,getNextPageParam(C){const M=!C?.pagination;if(!(!C||M||C?.pagination.page>=C?.pagination.pageCount))return C.pagination.page+1},select:C=>({...C,pages:C.pages.map(M=>{if(!M)return M;const{data:I,results:A,pagination:B}=M,$=!!I;let K=[];return $?K=[I]:A&&(K=[...A].reverse()),{pagination:B,results:K}})})}),{pageGoal:b}=o,{status:E,data:v,fetchNextPage:k,hasNextPage:R}=m;(0,e.useEffect)(()=>{b>l&&R&&E==="success"&&k({pageParam:l+1})},[b,l,k,R,E]);const T=(0,y.W6)(p);(0,e.useEffect)(()=>{if(E==="success"&&v&&v.pages?.at(-1)?.results&&T){const C=Ui(v.pages.at(-1).results,f);T(C)}},[E,T,v]);const w=(0,Xe.useInfiniteQuery)(["relation",...t,"search",JSON.stringify(s)],u,{enabled:Object.keys(s).length>0,getNextPageParam(C){if(!(!C?.pagination||C.pagination.page>=C.pagination.pageCount))return C.pagination.page+1}});return{relations:m,search:w,searchFor:(C,M={})=>{a({...M,_q:C})}}},hr=(t,o)=>r=>{const s=r.split(".");return s.reduce((a,l,i)=>{const c=x()(t,a),g=x()(o,[...s.slice(0,i),l,"__temp_key__"]);if(Array.isArray(c)&&typeof g=="number"){const u=c.findIndex(p=>p.__temp_key__===g);return a.push(u.toString()),a}return a.push(l),a},[])},$n=({error:t,componentId:o,isComponentRelation:r,editable:s,description:a,intlLabel:l,isCreatingEntry:i,isFieldAllowed:c,isFieldReadable:g,labelAction:u,mainField:p,name:f,queryInfos:{endpoints:m,defaultParams:b,shouldDisplayRelationLink:E},placeholder:v,required:k,relationType:R,size:T,targetModel:w})=>{const[D,C]=(0,e.useState)(""),{formatMessage:M}=(0,V.Z)(),{slug:I,initialData:A,modifiedData:B,relationConnect:$,relationDisconnect:K,relationLoad:W,relationReorder:G}=(0,y.Wq)(),z=f.split("."),X=hr(A,B)(f),q=x()(B,f,[]),U=Math.ceil(x()(A,f,[]).length/An),{relations:L,search:O,searchFor:N}=Qi([I,X.join("."),B.id,b],{relation:{enabled:!!m.relation,endpoint:m.relation,pageGoal:U,pageParams:{...b,pageSize:An},onLoad(_){W({target:{initialDataPath:["initialData",...X],modifiedDataPath:["modifiedData",...z],value:_}})},normalizeArguments:{mainFieldName:p.name,shouldAddLink:E,targetModel:w}},search:{endpoint:m.search,pageParams:{...b,entityId:i?void 0:r?o:A.id,pageSize:zi}}}),Y=(0,e.useMemo)(()=>R.toLowerCase().includes("morph"),[R]),P=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(R),Z=(0,e.useMemo)(()=>Y?!0:i?!s:!c&&g||!s,[Y,i,s,c,g]),oe=_=>{const fe=Sn(_,{mainFieldName:p.name,shouldAddLink:E,targetModel:w});$({name:f,value:fe,toOneRelation:P})},re=_=>{K({name:f,id:_.id})},me=()=>{L.fetchNextPage()},H=(_="")=>{const[fe,ze]=Hi(q,x()(A,f));N(_,{idsToInclude:ze,idsToOmit:fe})},ae=()=>{O.fetchNextPage()},Pe=_=>`${_+1} of ${q.length}`,Ne=(_,fe)=>{const ze=q[_];C(M({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:ze.mainField??ze.id,position:Pe(fe)})),G({name:f,newIndex:fe,oldIndex:_})},de=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:fe.mainField??fe.id,position:Pe(_)}))},ue=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:fe.mainField??fe.id,position:Pe(_)}))},Fe=_=>{const fe=q[_];C(M({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:fe.mainField??fe.id}))};if(!c&&i||!i&&!c&&!g)return e.createElement(y.X0,{name:f,intlLabel:l,labelAction:u});const Re=q.length,ke=(x()(A,X)??[]).length,Tt=L.data?.pages[0]?.pagination?.total??0,Me=!L.data&&Re===ke?Re:Re-ke+Tt;return e.createElement(Zi,{error:t,canReorder:!P,description:a,disabled:Z,iconButtonAriaLabel:M({id:(0,h.OB)("components.RelationInput.icon-button-aria-label"),defaultMessage:"Drag"}),id:f,label:`${M({id:l.id,defaultMessage:l.defaultMessage})} ${Me>0?`(${Me})`:""}`,labelAction:u,labelLoadMore:i?null:M({id:(0,h.OB)("relation.loadMore"),defaultMessage:"Load More"}),labelDisconnectRelation:M({id:(0,h.OB)("relation.disconnect"),defaultMessage:"Remove"}),listAriaDescription:M({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"}),listHeight:320,liveText:D,loadingMessage:M({id:(0,h.OB)("relation.isLoading"),defaultMessage:"Relations are loading"}),name:f,noRelationsMessage:M({id:(0,h.OB)("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:An,onDropItem:ue,onGrabItem:de,onCancel:Fe,onRelationConnect:oe,onRelationDisconnect:re,onRelationLoadMore:me,onRelationReorder:Ne,onSearch:_=>H(_),onSearchNextPage:()=>ae(),placeholder:M(v||{id:(0,h.OB)("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[ct.DRAFT]:M({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ct.PUBLISHED]:M({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},relations:In()({...L,data:q},"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:k,searchResults:Vi(O,{mainFieldName:p.name}),size:T})};$n.defaultProps={componentId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},$n.propTypes={componentId:n().number,editable:n().bool,error:n().string,description:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,isCreatingEntry:n().bool.isRequired,isComponentRelation:n().bool,isFieldAllowed:n().bool,isFieldReadable:n().bool.isRequired,mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired}).isRequired,name:n().string.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,relationType:n().string.isRequired,size:n().number.isRequired,targetModel:n().string.isRequired,queryInfos:n().shape({defaultParams:n().shape({locale:n().string}),endpoints:n().shape({relation:n().string,search:n().string.isRequired}).isRequired,shouldDisplayRelationLink:n().bool.isRequired}).isRequired};const Gi=(0,e.memo)($n);var Ki=qi(Gi,ji);function Yi(t,o){return r=>{const s=o(r.keys);return e.createElement(t,{...r,...s})}}var Xi=Yi,Ji=(t,o=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:o,hidden:o},key:"__enum_option_null",value:""},...t.map(r=>({metadatas:{intlLabel:{id:r,defaultMessage:r},hidden:!1,disabled:!1},key:r,value:r}))],_i=d(59578),el=d.n(_i),tl=(t="")=>{switch(el()(t)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return t;case"email":return"email";case"enumeration":return"select";case"password":return"password";case"string":return"text";case"text":return"textarea";case"media":case"file":case"files":return"media";case"json":return"json";case"wysiwyg":case"WYSIWYG":case"richtext":return"wysiwyg";case"uid":return"uid";default:return t||"text"}};function nl(t){const{createActionAllowedFields:o,formErrors:r,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:c,updateActionAllowedFields:g}=(0,y.Wq)(),u=(0,e.useMemo)(()=>s?o:g,[s,o,g]),p=(0,e.useMemo)(()=>s?[]:i,[s,i]),f=x()(a,t,null);return{allowedFields:u,formErrors:r,isCreatingEntry:s,onChange:l,readableFields:p,shouldNotRunValidations:c,value:f}}var ol=nl,yr=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];function Zn({allowedFields:t,componentUid:o,fieldSchema:r,formErrors:s,isCreatingEntry:a,keys:l,labelAction:i,metadatas:c,onChange:g,readableFields:u,shouldNotRunValidations:p,queryInfos:f,value:m,size:b,customFieldInputs:E}){const{fields:v}=(0,y.yX)(),{formatMessage:k}=(0,V.Z)(),{contentType:R}=(0,pe.PL)(),T=(0,e.useMemo)(()=>!x()(c,"editable",!0),[c]),{type:w,customField:D}=r,C=x()(s,[l],null),M=(0,e.useMemo)(()=>(0,h.Ts)(l),[l]),I=(0,e.useMemo)(()=>{const oe=sa()(r,p?[...yr,"required","minLength"]:yr),re=r.regex||null;if(re){const me=new RegExp(re);me&&(oe.regex=me)}return oe},[r,p]),A=(0,e.useMemo)(()=>x()(I,["required"],!1),[I]),B=(0,e.useMemo)(()=>{const oe=x()(R,["attributes"],{});return x()(oe,[M[0],"type"],null)==="dynamiczone"},[R,M]),$=(0,e.useMemo)(()=>tl(w),[w]),K=(0,e.useMemo)(()=>w==="media"&&!m?[]:m,[w,m]),W=rl(w),G=(0,e.useMemo)(()=>{const oe=M.join(".");if(t.includes(oe))return!0;if(B)return t.includes(M[0]);if(M.length>1){const me=xt()(M,M.length-1).join(".");return t.includes(me)}return!1},[t,M,B]),z=(0,e.useMemo)(()=>{const oe=M.join(".");if(u.includes(oe))return!0;if(B)return u.includes(M[0]);if(M.length>1){const me=xt()(M,M.length-1).join(".");return u.includes(me)}return!1},[u,M,B]),X=(0,e.useMemo)(()=>z||G,[G,z]),q=(0,e.useMemo)(()=>a?T:z&&!G?!0:T,[T,a,G,z]),U=(0,e.useMemo)(()=>Ji(r.enum||[],A),[r,A]),{label:L,description:O,placeholder:N,visible:Y}=c,P=(0,e.useMemo)(()=>{if(!c.step||$!=="datetime"&&$!=="time")return W;if(!K)return c.step;let oe;return $==="datetime"?oe=parseInt(K.substr(14,2),10):$==="time"&&(oe=parseInt(K.slice(-2),10)),oe%c.step===0?c.step:W},[$,K,c.step,W]);if(Y===!1)return null;if(!X)return e.createElement(y.X0,{description:O?{id:O,defaultMessage:O}:null,intlLabel:{id:L,defaultMessage:L},labelAction:i,error:C&&k(C),name:l,required:A});if(w==="relation")return e.createElement(Ki,{...c,...r,componentUid:o,description:c.description?k({id:c.description,defaultMessage:c.description}):void 0,intlLabel:{id:c.label,defaultMessage:c.label},labelAction:i,isUserAllowedToEditField:G,isUserAllowedToReadField:z,name:l,placeholder:c.placeholder?{id:c.placeholder,defaultMessage:c.placeholder}:null,queryInfos:f,size:b,value:m,error:C&&k(C)});const Z={uid:Mi,media:v.media,wysiwyg:fi,...v,...E};return e.createElement(y.jm,{attribute:r,autoComplete:"new-password",intlLabel:{id:L,defaultMessage:L},isNullable:$==="bool"&&[null,void 0].includes(r.default),description:O?{id:O,defaultMessage:O}:null,disabled:q,error:C,labelAction:i,contentTypeUID:R.uid,customInputs:Z,multiple:r.multiple||!1,name:l,onChange:g,options:U,placeholder:N?{id:N,defaultMessage:N}:null,required:r.required||!1,step:P,type:D||$,value:K,withDefaultValue:!1})}Zn.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},Zn.propTypes={allowedFields:n().array.isRequired,componentUid:n().string,fieldSchema:n().object.isRequired,formErrors:n().object,keys:n().string.isRequired,isCreatingEntry:n().bool.isRequired,labelAction:n().element,metadatas:n().object.isRequired,onChange:n().func.isRequired,readableFields:n().array.isRequired,size:n().number,shouldNotRunValidations:n().bool.isRequired,value:n().any,queryInfos:n().shape({containsKey:n().string,defaultParams:n().object,endPoint:n().string}),customFieldInputs:n().object};const rl=t=>{switch(t){case"float":case"decimal":return .01;case"time":case"datetime":return 15;default:return 1}},sl=(0,e.memo)(Zn,Ce());var Bn=Xi(sl,ol);const Lt=new Map;var qn=(t=[])=>{const[o,r]=(0,e.useState)(Object.fromEntries(Lt)),s=t.filter(g=>!Lt.get(g)),[a,l]=(0,e.useState)(()=>!!s.length),i=(0,y.mZ)();(0,e.useEffect)(()=>{const g=p=>{r(p),l(!1)},u=async(p,f)=>{const m=await Promise.all(f);p.forEach((b,E)=>{Lt.set(b,m[E].default)}),g(Object.fromEntries(Lt))};if(s.length>0){l(!0);const p=s.reduce((f,m)=>{const b=i.get(m);return b&&f.push(b.components.Input()),f},[]);p.length>0&&u(s,p)}},[s,i]);const c=(0,e.useCallback)(()=>{Lt.clear(),r({})},[]);return{isLazyLoading:a,lazyComponentStore:o,cleanup:c}};const Nn=({componentUid:t,isFromDynamicZone:o,isNested:r,name:s})=>{const{getComponentLayout:a}=(0,pe.PL)(),i=(0,e.useMemo)(()=>a(t),[t,a]).layouts.edit,{lazyComponentStore:c}=qn();return e.createElement(S.x,{background:o?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:r,borderColor:r?"neutral200":""},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},i.map((g,u)=>e.createElement(Ie.r,{gap:4,key:u},g.map(({name:p,size:f,metadatas:m,fieldSchema:b,queryInfos:E})=>{const v=b.type==="component",k=`${s}.${p}`;if(v){const R=b.component;return e.createElement(ge.P,{col:f,s:12,xs:12,key:p},e.createElement(Qt,{componentUid:R,intlLabel:{id:m.label,defaultMessage:m.label},isNested:!0,isRepeatable:b.repeatable,max:b.max,min:b.min,name:k,required:b.required||!1}))}return e.createElement(ge.P,{col:f,key:p,s:12,xs:12},e.createElement(Bn,{componentUid:t,keys:k,fieldSchema:b,metadatas:m,queryInfos:E,size:f,customFieldInputs:c}))})))))};Nn.defaultProps={isFromDynamicZone:!1,isNested:!1},Nn.propTypes={componentUid:n().string.isRequired,isFromDynamicZone:n().bool,isNested:n().bool,name:n().string.isRequired};var al=Nn,At=d(19406),il=d(41119),br=d.n(il);const ll=j.ZP.span`
685
- display: block;
686
- background-color: ${({theme:t})=>t.colors.primary100};
687
- outline: 1px dashed ${({theme:t})=>t.colors.primary500};
688
- outline-offset: -1px;
689
- padding: ${({theme:t})=>t.spaces[6]};
690
- `;var cl=()=>e.createElement(ll,{padding:6,background:"primary100"});const dl=(0,j.ZP)(be.h)`
691
- background-color: transparent;
692
-
693
- svg {
694
- path {
695
- fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
696
- }
697
- }
698
-
699
- &:hover {
700
- svg {
701
- path {
702
- fill: ${({theme:t})=>t.colors.primary600};
703
- }
704
- }
705
- }
706
- `,ul=(0,j.ZP)(F.k)`
707
- & .drag-handle {
708
- background: unset;
709
-
710
- svg {
711
- path {
712
- fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:void 0};
713
- }
714
- }
715
-
716
- &:hover {
717
- svg {
718
- path {
719
- /* keeps the hover style of the accordion */
720
- fill: ${({theme:t})=>t.colors.primary600};
721
- }
722
- }
723
- }
724
- }
725
- `,jn=({componentFieldName:t,componentUid:o,fields:r,index:s,isOpen:a,isReadOnly:l,mainField:i,moveComponentField:c,onClickToggle:g,toggleCollapses:u,onGrabItem:p,onDropItem:f,onCancel:m})=>{const{modifiedData:b,removeRepeatableField:E,triggerFormValidation:v}=(0,y.Wq)(),k=br()(x()(b,[...t.split("."),i],"")),R=(0,e.useRef)(null),{formatMessage:T}=(0,V.Z)(),w=t.split(".").slice(0,-1).join("."),[{handlerId:D,isDragging:C,handleKeyDown:M},I,A,B,$]=(0,dr.Y)(!l,{type:`${h._Q.COMPONENT}_${w}`,index:s,item:{displayedValue:k},onMoveItem:c,onStart(){u()},onEnd(){v()},onGrabItem:p,onDropItem:f,onCancel:m});(0,e.useEffect)(()=>{$((0,wt.rX)(),{captureDraggingState:!1})},[$,s]);const K=(0,h.FE)(R,B),W=(0,h.FE)(I,A),{lazyComponentStore:G}=qn();return e.createElement(S.x,{ref:W},C?e.createElement(cl,null):e.createElement(dn.U,{expanded:a,onToggle:g,id:t,size:"S"},e.createElement(un.B,{action:l?null:e.createElement(ul,{gap:0,expanded:a},e.createElement(dl,{expanded:a,noBorder:!0,onClick:()=>{E(t),u()},label:T({id:(0,h.OB)("containers.Edit.delete"),defaultMessage:"Delete"}),icon:e.createElement(Ye.Z,null)}),e.createElement(be.h,{className:"drag-handle",ref:K,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:z=>z.stopPropagation(),"data-handler-id":D,label:T({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:M},e.createElement(nt.Z,null))),title:k,togglePosition:"left"}),e.createElement(mn.v,null,e.createElement(F.k,{direction:"column",alignItems:"stretch",background:"neutral100",padding:6,gap:6},r.map((z,X)=>e.createElement(Ie.r,{gap:4,key:X},z.map(({name:q,fieldSchema:U,metadatas:L,queryInfos:O,size:N})=>{const Y=U.type==="component",P=`${t}.${q}`;if(Y){const Z=U.component;return e.createElement(ge.P,{col:N,s:12,xs:12,key:q},e.createElement(Qt,{componentUid:Z,intlLabel:{id:L.label,defaultMessage:L.label},isRepeatable:U.repeatable,isNested:!0,name:P,max:U.max,min:U.min,required:U.required}))}return e.createElement(ge.P,{key:P,col:N,s:12,xs:12},e.createElement(Bn,{componentUid:o,fieldSchema:U,keys:P,metadatas:L,queryInfos:O,size:N,customFieldInputs:G}))})))))))};jn.defaultProps={componentUid:void 0,fields:[],isReadOnly:!1,isOpen:!1,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0,toggleCollapses(){}},jn.propTypes={componentFieldName:n().string.isRequired,componentUid:n().string,fields:n().array,index:n().number.isRequired,isOpen:n().bool,isReadOnly:n().bool,mainField:n().string.isRequired,moveComponentField:n().func.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onClickToggle:n().func.isRequired,toggleCollapses:n().func};var ml=(0,e.memo)(jn),Er=d(861);const pl=(0,j.ZP)(S.x)`
726
- overflow: hidden;
727
- border-bottom: 1px solid ${({theme:t})=>t.colors.neutral200};
728
- border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
729
- border-left: 1px solid ${({theme:t})=>t.colors.neutral200};
730
- border-radius: 0 0 ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius};
731
- `,gl=(0,j.ZP)(S.x)`
732
- border-bottom: none;
733
-
734
- /* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
735
- & > div > div {
736
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
737
- border-top-color: transparent;
738
- }
739
-
740
- /* the top accordion _does_ need a border though */
741
- & > div:first-child > div {
742
- border-top: 1px solid ${({theme:t})=>t.colors.neutral200};
743
- }
744
-
745
- /* Reset all the border-radius' */
746
- & > div > div,
747
- & > div > div > div {
748
- border-radius: unset;
749
- }
750
-
751
- /* Give the border radius back to the first accordion */
752
- & > div:first-child > div,
753
- & > div:first-child > div > div {
754
- border-radius: ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius} 0 0;
755
- }
756
-
757
- & > div > div[data-strapi-expanded='true'] {
758
- border: 1px solid ${({theme:t})=>t.colors.primary600};
759
- }
760
- `,Wn=({children:t,error:o})=>{const{formatMessage:r}=(0,V.Z)();return e.createElement(Er.k,{attributeName:"data-strapi-accordion-toggle"},t,o&&e.createElement(S.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600"},r({id:o.id,defaultMessage:o.defaultMessage},{...o.values}))))};Wn.defaultProps={error:void 0},Wn.propTypes={children:n().node.isRequired,error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object})};function fl(t,o={}){return Object.keys(o).filter(r=>r.startsWith(t)).map(r=>r.split(".").slice(0,t.split(".").length+1).join("."))}const hl=(0,j.ZP)(lr.A)`
761
- height: 100%;
762
- width: 100%;
763
- border-radius: 0 0 4px 4px;
764
- display: flex;
765
- justify-content: center;
766
- span {
767
- font-weight: 600;
768
- font-size: 14px;
769
- }
770
- `,zn=({componentUid:t,componentValue:o,componentValueLength:r,isReadOnly:s,max:a,min:l,name:i})=>{const{addRepeatableComponentToField:c,formErrors:g,moveComponentField:u}=(0,y.Wq)(),p=(0,y.lm)(),{formatMessage:f}=(0,V.Z)(),[m,b]=(0,e.useState)(""),[E,v]=(0,e.useState)(""),{getComponentLayout:k,components:R}=(0,pe.PL)(),T=(0,e.useMemo)(()=>k(t),[t,k]),w=(0,e.useMemo)(()=>(0,h.Uo)(o||[])+1,[o]),D=fl(i,g),C=l-r,M=x()(g,i,{id:""}).id.includes("min"),I=()=>{b("")},A=()=>{s||(r<a?(c(i,T,R,M),b(w)):r>=a&&p({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}}))},B=(L,O)=>{v(f({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${i}.${O}`,position:W(L)})),u({name:i,newIndex:L,currentIndex:O})},$=x()(T,["settings","mainField"],"id"),K=L=>()=>{b(m===L?"":L)},W=L=>`${L+1} of ${r}`,G=L=>{v(f({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${i}.${L}`}))},z=L=>{v(f({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${i}.${L}`,position:W(L)}))},X=L=>{v(f({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${i}.${L}`,position:W(L)}))};let q=g[i];if(M?q={id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:C}}:D.some(L=>L.split(".").length>1)&&!M&&(q={id:(0,h.OB)("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r===0)return e.createElement(Uo,{error:q,isReadOnly:s,onClick:A});const U=`${i}-item-instructions`;return e.createElement(S.x,{hasRadius:!0},e.createElement(ht.T,{id:U},f({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ht.T,{"aria-live":"assertive"},E),e.createElement(Wn,{error:q,ariaDescribedBy:U},e.createElement(gl,{"aria-describedby":U},o.map(({__temp_key__:L},O)=>e.createElement(ml,{componentFieldName:`${i}.${O}`,componentUid:t,fields:T.layouts.edit,key:L,index:O,isOpen:m===L,isReadOnly:s,mainField:$,moveComponentField:B,onClickToggle:K(L),toggleCollapses:I,onCancel:G,onDropItem:X,onGrabItem:z}))),e.createElement(pl,null,e.createElement(F.k,{justifyContent:"center",height:"48px",background:"neutral0"},e.createElement(hl,{disabled:s,onClick:A,startIcon:e.createElement(At.Z,null)},f({id:(0,h.OB)("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"}))))))};zn.defaultProps={componentValue:null,componentValueLength:0,isReadOnly:!1,max:1/0,min:0},zn.propTypes={componentUid:n().string.isRequired,componentValue:n().oneOfType([n().array,n().object]),componentValueLength:n().number,isReadOnly:n().bool,max:n().number,min:n().number,name:n().string.isRequired};var yl=(0,e.memo)(zn);const Un=({addNonRepeatableComponentToField:t,componentUid:o,intlLabel:r,isCreatingEntry:s,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:c,max:g,min:u,name:p,hasChildrenAllowedFields:f,hasChildrenReadableFields:m,isReadOnly:b,componentValue:E,removeComponentFromField:v,required:k})=>{const{formatMessage:R}=(0,V.Z)(),T=Ks()(E),w=E!==null||a,D=!l&&w&&!a&&f,{getComponentLayout:C,components:M}=(0,pe.PL)(),I=(0,e.useMemo)(()=>C(o),[o,C]);if(!f&&s)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:p});if(!f&&!s&&!m)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:p});const A=()=>{t(p,I,M)};return e.createElement(S.x,null,e.createElement(F.k,{justifyContent:"space-between"},r&&e.createElement(na,{intlLabel:r,labelAction:c,name:p,numberOfEntries:T,showNumberOfEntries:l,required:k}),D&&e.createElement(be.h,{label:R({id:(0,h.OB)("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:e.createElement(Ye.Z,null),noBorder:!0,onClick:()=>{v(p,o)}})),e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:1},!l&&!w&&e.createElement(Uo,{isReadOnly:b,onClick:A}),!l&&w&&e.createElement(al,{componentUid:o,isFromDynamicZone:a,isNested:i,name:p}),l&&e.createElement(yl,{componentValue:E,componentValueLength:T,componentUid:o,isReadOnly:b,max:g,min:u,name:p})))};Un.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},Un.propTypes={addNonRepeatableComponentToField:n().func.isRequired,componentUid:n().string.isRequired,componentValue:n().oneOfType([n().object,n().array]),hasChildrenAllowedFields:n().bool,hasChildrenReadableFields:n().bool,isCreatingEntry:n().bool.isRequired,isFromDynamicZone:n().bool,isReadOnly:n().bool,isRepeatable:n().bool,isNested:n().bool,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),labelAction:n().element,max:n().number,min:n().number,name:n().string.isRequired,removeComponentFromField:n().func.isRequired,required:n().bool};const bl=(0,e.memo)(Un,Ce());var Qt=Xs(bl,ea);const El=(0,j.ZP)(F.k)`
771
- /*
772
- we need to remove the background from the button but we can't
773
- wrap the element in styled because it breaks the forwardedAs which
774
- we need for drag handler to work on firefox
775
- */
776
- div[role='button'] {
777
- background: transparent;
778
- }
779
- `,vl=(0,j.ZP)(be.h)`
780
- background-color: transparent;
781
-
782
- svg path {
783
- fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
784
- }
785
- `,Cl=(0,j.ZP)(S.x)`
786
- > div:first-child {
787
- box-shadow: ${({theme:t})=>t.shadows.tableShadow};
788
- }
789
- `,Rl=(0,j.ZP)(S.x)`
790
- border-radius: 0 0 ${({theme:t})=>t.spaces[1]} ${({theme:t})=>t.spaces[1]};
791
- `,Ml=(0,j.ZP)(S.x)`
792
- width: ${({theme:t})=>t.spaces[2]};
793
- height: ${({theme:t})=>t.spaces[4]};
794
- `,Tl=j.ZP.span`
795
- display: block;
796
- background-color: ${({theme:t})=>t.colors.primary100};
797
- outline: 1px dashed ${({theme:t})=>t.colors.primary500};
798
- outline-offset: -1px;
799
- padding: ${({theme:t})=>t.spaces[6]};
800
- `,Dl=(0,j.ZP)(S.x)`
801
- list-style: none;
802
- padding: 0;
803
- margin: 0;
804
- `,Vn=({componentUid:t,formErrors:o,index:r,isFieldAllowed:s,name:a,onRemoveComponentClick:l,onMoveComponent:i,onGrabItem:c,onDropItem:g,onCancel:u})=>{const[p,f]=(0,e.useState)(!0),{formatMessage:m}=(0,V.Z)(),{getComponentLayout:b}=(0,pe.PL)(),{modifiedData:E}=(0,y.Wq)(),{icon:v,friendlyName:k,mainValue:R}=(0,e.useMemo)(()=>{const z=b(t),{info:{icon:X,displayName:q}}=z,U=x()(z,["settings","mainField"],"id"),L=x()(E,[a,r,U])??"",O=U==="id"?"":String(L).trim(),N=O.length>0?` - ${O}`:O;return{friendlyName:q,icon:X,mainValue:N}},[t,b,E,a,r]),T=Object.keys(o).filter(z=>{const X=z.split(".");return`${X[0]}.${X[1]}`==`${a}.${r}`});let w;T.length>0&&(w=m({id:(0,h.OB)("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const D=()=>{f(z=>!z)},[{handlerId:C,isDragging:M,handleKeyDown:I},A,B,$,K]=(0,pe.Y9)(s,{type:`${h._Q.DYNAMIC_ZONE}_${a}`,index:r,item:{displayedValue:`${k}${R}`,icon:v},onMoveItem:i,onGrabItem:c,onDropItem:g,onCancel:u});(0,e.useEffect)(()=>{K((0,wt.rX)(),{captureDraggingState:!1})},[K,r]);const W=(0,h.FE)(A,B),G=s?e.createElement(El,{gap:0,expanded:p},e.createElement(vl,{noBorder:!0,label:m({id:(0,h.OB)("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:k}),onClick:l},e.createElement(Ye.Z,null)),e.createElement(be.h,{forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:z=>z.stopPropagation(),"data-handler-id":C,ref:$,label:m({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:I},e.createElement(nt.Z,null))):null;return e.createElement(Dl,{as:"li"},e.createElement(F.k,{justifyContent:"center"},e.createElement(Ml,{background:"neutral200"})),e.createElement(Cl,{ref:W,hasRadius:!0},M?e.createElement(Tl,{padding:6,background:"primary100"}):e.createElement(dn.U,{expanded:p,onToggle:D,size:"S",error:w},e.createElement(un.B,{action:G,title:`${k}${R}`,togglePosition:"left"}),e.createElement(mn.v,null,e.createElement(Rl,{background:"neutral0"},e.createElement(Qt,{componentUid:t,icon:v,name:`${a}.${r}`,isFromDynamicZone:!0}))))))};Vn.defaultProps={formErrors:{},index:0,isFieldAllowed:!0,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0},Vn.propTypes={componentUid:n().string.isRequired,formErrors:n().object,index:n().number,isFieldAllowed:n().bool,name:n().string.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onMoveComponent:n().func.isRequired,onRemoveComponentClick:n().func.isRequired};var kl=Vn;const Hn=(0,j.ZP)(zo.Z)`
805
- transform: ${({$isOpen:t})=>t?"rotate(45deg)":"rotate(0deg)"};
806
- > circle {
807
- fill: ${({theme:t,$hasError:o})=>o?t.colors.danger200:t.colors.neutral150};
808
- }
809
- > path {
810
- fill: ${({theme:t,$hasError:o})=>o?t.colors.danger600:t.colors.neutral600};
811
- }
812
- `,Il=(0,j.ZP)(bn.Y)`
813
- border-radius: 26px;
814
- border-color: ${({theme:t})=>t.colors.neutral150};
815
- background: ${({theme:t})=>t.colors.neutral0};
816
- padding-top: ${({theme:t})=>t.spaces[3]};
817
- padding-right: ${({theme:t})=>t.spaces[4]};
818
- padding-bottom: ${({theme:t})=>t.spaces[3]};
819
- padding-left: ${({theme:t})=>t.spaces[4]};
820
-
821
- box-shadow: ${({theme:t})=>t.shadows.filterShadow};
822
-
823
- svg {
824
- height: ${({theme:t})=>t.spaces[6]};
825
- width: ${({theme:t})=>t.spaces[6]};
826
- > path {
827
- fill: ${({theme:t})=>t.colors.neutral600};
828
- }
829
- }
830
- &:hover {
831
- color: ${({theme:t})=>t.colors.primary600} !important;
832
- ${Q.Z} {
833
- color: ${({theme:t})=>t.colors.primary600} !important;
834
- }
835
-
836
- ${Hn} {
837
- > circle {
838
- fill: ${({theme:t})=>t.colors.primary600};
839
- }
840
- > path {
841
- fill: ${({theme:t})=>t.colors.neutral100};
842
- }
843
- }
844
- }
845
- &:active {
846
- ${Q.Z} {
847
- color: ${({theme:t})=>t.colors.primary600};
848
- }
849
- ${Hn} {
850
- > circle {
851
- fill: ${({theme:t})=>t.colors.primary600};
852
- }
853
- > path {
854
- fill: ${({theme:t})=>t.colors.neutral100};
855
- }
856
- }
857
- }
858
- `,Pl=(0,j.ZP)(S.x)`
859
- height: 100%;
860
- `,Qn=({hasError:t,hasMaxError:o,hasMinError:r,isDisabled:s,isOpen:a,label:l,missingComponentNumber:i,name:c,onClick:g})=>{const{formatMessage:u}=(0,V.Z)(),p=u({id:(0,h.OB)("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||c}),f=u({id:"app.utils.close-label",defaultMessage:"Close"});let m=a?f:p;return o&&!a&&(m=u({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),r&&!a&&(m=u({id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),e.createElement(F.k,{justifyContent:"center"},e.createElement(S.x,{style:{cursor:s?"not-allowed":"pointer"}},e.createElement(Il,{type:"button",onClick:g,disabled:s,hasError:t},e.createElement(F.k,null,e.createElement(Pl,{"aria-hidden":!0,paddingRight:2},e.createElement(Hn,{$isOpen:a,$hasError:t&&!a})),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:t&&!a?"danger600":"neutral500"},m)))))};Qn.defaultProps={hasError:!1,hasMaxError:!1,hasMinError:!1,isDisabled:!1,isOpen:!1,label:"",missingComponentNumber:0},Qn.propTypes={label:n().string,hasError:n().bool,hasMaxError:n().bool,hasMinError:n().bool,isDisabled:n().bool,isOpen:n().bool,missingComponentNumber:n().number,name:n().string.isRequired,onClick:n().func.isRequired};var Ol=Qn;const wl=(0,j.ZP)(S.x)`
861
- border-radius: ${(0,y.Q1)(26)};
862
- `,Gn=({label:t,labelAction:o,name:r,numberOfComponents:s,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,V.Z)(),c=i({id:t||r,defaultMessage:t||r});return e.createElement(F.k,{justifyContent:"center"},e.createElement(S.x,null,e.createElement(wl,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},e.createElement(F.k,{direction:"column",justifyContent:"center"},e.createElement(F.k,{maxWidth:(0,y.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},c,"\xA0"),e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",s,")"),a&&e.createElement(Q.Z,{textColor:"danger600"},"*"),o&&e.createElement(S.x,{paddingLeft:1},o)),l&&e.createElement(S.x,{paddingTop:1,maxWidth:(0,y.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};Gn.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},Gn.propTypes={intlDescription:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}),label:n().string,labelAction:n().element,name:n().string.isRequired,numberOfComponents:n().number,required:n().bool};var xl=Gn,Fl=d(81346),vr=d.n(Fl);const Gt=5,Kt=8,Ll=(0,j.ZP)(F.k)`
863
- border-radius: ${({showBackground:t})=>t?"50%":0};
864
- color: ${({theme:t})=>t.colors.neutral600};
865
- height: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt:Kt]};
866
- width: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt:Kt]};
867
-
868
- svg {
869
- height: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt-2:Kt-3]};
870
- width: ${({theme:t,size:o})=>t.spaces[o==="S"?Gt-2:Kt-3]};
871
- }
872
- `;function Yt({showBackground:t=!0,size:o="M"}){return e.createElement(Ll,{alignItems:"center",background:t?"neutral200":null,justifyContent:"center",size:o,showBackground:t},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e.createElement("path",{d:"M216.3 2c4.8-2.6 10.5-2.6 15.3 0L422.3 106c5.1 2.8 8.3 8.2 8.3 14s-3.2 11.2-8.3 14L231.7 238c-4.8 2.6-10.5 2.6-15.3 0L25.7 134c-5.1-2.8-8.3-8.2-8.3-14s3.2-11.2 8.3-14L216.3 2zM23.7 170l176 96c5.1 2.8 8.3 8.2 8.3 14V496c0 5.6-3 10.9-7.8 13.8s-10.9 3-15.8 .3L8.3 414C3.2 411.2 0 405.9 0 400V184c0-5.6 3-10.9 7.8-13.8s10.9-3 15.8-.3zm400.7 0c5-2.7 11-2.6 15.8 .3s7.8 8.1 7.8 13.8V400c0 5.9-3.2 11.2-8.3 14l-176 96c-5 2.7-11 2.6-15.8-.3s-7.8-8.1-7.8-13.8V280c0-5.9 3.2-11.2 8.3-14l176-96z",fill:"currentColor"})))}Yt.defaultProps={showBackground:!0,size:"M"},Yt.propTypes={showBackground:n().bool,size:n().string};const Al=(0,j.ZP)(S.x)`
873
- flex-shrink: 0;
874
- height: ${(0,y.Q1)(84)};
875
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
876
- background: ${({theme:t})=>t.colors.neutral100};
877
- border-radius: ${({theme:t})=>t.borderRadius};
878
- display: flex;
879
- justify-content: center;
880
- align-items: center;
881
-
882
- &:focus,
883
- &:hover {
884
- border: 1px solid ${({theme:t})=>t.colors.primary200};
885
- background: ${({theme:t})=>t.colors.primary100};
886
-
887
- ${Q.Z} {
888
- color: ${({theme:t})=>t.colors.primary600};
889
- }
890
-
891
- /* > Flex > ComponentIcon */
892
- > div > div:first-child {
893
- background: ${({theme:t})=>t.colors.primary200};
894
- color: ${({theme:t})=>t.colors.primary600};
895
- }
896
- }
897
- `;function Kn({children:t,onClick:o}){return e.createElement(Al,{as:"button",type:"button",onClick:o,hasRadius:!0},e.createElement(F.k,{direction:"column",gap:1,alignItems:"center",justifyContent:"center"},e.createElement(Yt,null),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},t)))}Kn.defaultProps={onClick(){}},Kn.propTypes={children:n().node.isRequired,onClick:n().func};const Sl=j.ZP.div`
898
- display: grid;
899
- grid-template-columns: repeat(auto-fit, ${140/16}rem);
900
- grid-gap: ${({theme:t})=>t.spaces[1]};
901
- `,Yn=({category:t,components:o,variant:r,isOpen:s,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,V.Z)(),c=()=>{l(t)};return e.createElement(dn.U,{expanded:s,onToggle:c,size:"S"},e.createElement(un.B,{variant:r,title:i({id:t,defaultMessage:t}),togglePosition:"left"}),e.createElement(mn.v,null,e.createElement(S.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},e.createElement(Sl,null,o.map(({componentUid:g,info:{displayName:u}})=>e.createElement(Kn,{key:g,onClick:a(g)},i({id:u,defaultMessage:u})))))))};Yn.defaultProps={components:[],isOpen:!1,variant:"primary"},Yn.propTypes={category:n().string.isRequired,components:n().array,isOpen:n().bool,onAddComponent:n().func.isRequired,onToggle:n().func.isRequired,variant:n().oneOf(["primary","secondary"])};var $l=Yn;const Xn=({components:t,isOpen:o,onClickAddComponent:r})=>{const{formatMessage:s}=(0,V.Z)(),{getComponentLayout:a}=(0,pe.PL)(),[l,i]=(0,e.useState)(""),c=(0,e.useMemo)(()=>{const p=t.map(m=>{const{category:b,info:E}=a(m);return{componentUid:m,category:b,info:E}}),f=vr()(p,"category");return Object.keys(f).reduce((m,b)=>(m.push({category:b,components:f[b]}),m),[])},[t,a]);(0,e.useEffect)(()=>{o&&c.length>0&&i(c[0].category)},[o,c]);const g=p=>()=>{r(p),i("")},u=p=>{i(f=>f===p?"":p)};return o?e.createElement(S.x,{paddingBottom:6},e.createElement(S.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral600"},s({id:(0,h.OB)("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),e.createElement(S.x,{paddingTop:2},e.createElement(Er.k,{attributeName:"data-strapi-accordion-toggle"},c.map(({category:p,components:f},m)=>e.createElement($l,{key:p,category:p,components:f,onAddComponent:g,isOpen:p===l,onToggle:u,variant:m%2===1?"primary":"secondary"})))))):null};Xn.defaultProps={components:[],isOpen:!1},Xn.propTypes={components:n().array,isOpen:n().bool,onClickAddComponent:n().func.isRequired};var Zl=Xn;const Jn=({name:t,addComponentToDynamicZone:o,formErrors:r,isCreatingEntry:s,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentField:c,removeComponentFromDynamicZone:g,dynamicDisplayedComponents:u,fieldSchema:p,metadatas:f})=>{const[m,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(""),{formatMessage:k}=(0,V.Z)(),R=(0,y.lm)(),{getComponentLayout:T,components:w}=(0,pe.PL)(),D=u.length,C=f.description?{id:f.description,defaultMessage:f.description}:null,{max:M=1/0,min:I=-1/0}=p,A=(0,e.useMemo)(()=>Object.keys(r).filter(P=>P===t).map(P=>r[P]),[r,t]),B=I-D,$=A.length>0,K=A.length>0&&x()(A,[0,"id"],"").includes("min"),W=$&&x()(A,[0,"id"],"")==="components.Input.error.validation.max",G=P=>{b(!1);const Z=T(P);o(t,Z,w,$)},z=()=>{D<M?b(P=>!P):R({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}})},X=(P,Z)=>{v(k({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${t}.${Z}`,position:q(P)})),c({name:t,newIndex:P,currentIndex:Z})},q=P=>`${P+1} of ${u.length}`,U=P=>{v(k({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${t}.${P}`}))},L=P=>{v(k({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${t}.${P}`,position:q(P)}))},O=P=>{v(k({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${t}.${P}`,position:q(P)}))},N=(P,Z)=>()=>{g(P,Z)};if(!a&&(s||!l&&!s))return e.createElement(y.X0,{description:C,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:i,name:t});const Y=`${t}-item-instructions`;return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},D>0&&e.createElement(S.x,null,e.createElement(xl,{intlDescription:C,label:f.label,labelAction:i,name:t,numberOfComponents:D,required:p.required||!1}),e.createElement(ht.T,{id:Y},k({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ht.T,{"aria-live":"assertive"},E),e.createElement("ol",{"aria-describedby":Y},u.map(({componentUid:P,id:Z},oe)=>e.createElement(kl,{componentUid:P,formErrors:r,key:`${P}-${Z}`,index:oe,isFieldAllowed:a,name:t,onMoveComponent:X,onRemoveComponentClick:N(t,oe),onCancel:U,onDropItem:O,onGrabItem:L})))),e.createElement(Ol,{hasError:$,hasMaxError:W,hasMinError:K,isDisabled:!a,label:f.label,missingComponentNumber:B,isOpen:m,name:t,onClick:z}),e.createElement(Zl,{isOpen:m,components:p.components??[],onClickAddComponent:G}))};Jn.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},Jn.propTypes={addComponentToDynamicZone:n().func.isRequired,dynamicDisplayedComponents:n().arrayOf(n().shape({componentUid:n().string.isRequired,id:n().number.isRequired})),fieldSchema:n().shape({components:n().array.isRequired,max:n().number,min:n().number,required:n().bool}),formErrors:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isFieldAllowed:n().bool.isRequired,isFieldReadable:n().bool.isRequired,labelAction:n().element,metadatas:n().shape({description:n().string,label:n().string}).isRequired,moveComponentField:n().func.isRequired,name:n().string.isRequired,removeComponentFromDynamicZone:n().func.isRequired};const Bl=(0,e.memo)(Jn,Ce());var ql=Vs(Bl,Qs),Qe=d(84306),ot=d(41578);const Xt=()=>({type:ot.ZA}),_n=t=>({type:ot.Id,data:t}),eo=(t,o=!1)=>({type:ot.TP,rawQuery:t,isSingleType:o}),Cr=()=>({type:ot.c2}),Rr=(t,o)=>({type:ot.w7,componentsDataStructure:t,contentTypeDataStructure:o}),le=t=>({type:ot.d0,status:t}),rt=t=>({type:ot.t9,data:t}),Nl=()=>({type:ot.tE});var to=t=>t["content-manager_editViewCrudReducer"];const no=({allLayoutData:t,children:o,slug:r,id:s,origin:a})=>{const l=(0,Xe.useQueryClient)(),i=(0,y.lm)(),{setCurrentStep:c}=(0,y.c1)(),{trackUsage:g}=(0,y.rS)(),{push:u,replace:p}=(0,te.k6)(),[{rawQuery:f}]=(0,y.Kx)(),m=(0,J.I0)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:v,isLoading:k,status:R}=(0,J.v9)(to),T=(0,pe.Ky)(r),{formatAPIError:w}=(0,y.So)(h.OB),D=(0,e.useRef)(!0),C=(0,e.useRef)(g),M=(0,e.useRef)(t),I=(0,y.kY)(),{put:A,post:B,del:$}=I,K=s===null,W=(0,e.useMemo)(()=>K&&!a?null:(0,h.IF)(`collection-types/${r}/${a||s}`),[r,s,K,a]),G=(0,e.useCallback)(P=>a?(0,y.w6)(P,M.current.contentType,M.current.components):P,[a]),z=(0,e.useCallback)(P=>{const Z=(0,h.kc)(P,M.current.contentType,M.current.components);return(0,y.dU)(Z,M.current.contentType,M.current.components)},[]);(0,e.useEffect)(()=>{const P=Object.keys(t.components).reduce((re,me)=>{const H=(0,h.Di)(x()(t,["components",me,"attributes"],{}),t.components);return re[me]=(0,y.dU)(H,t.components[me],t.components),re},{}),Z=(0,h.Di)(t.contentType.attributes,t.components),oe=(0,y.dU)(Z,t.contentType,t.components);m(Rr(P,oe))},[t,m]),(0,e.useEffect)(()=>()=>{m(Cr())},[m]),(0,e.useEffect)(()=>{const Z=Qe.default.CancelToken.source(),oe=async me=>{m(Xt());try{const{data:H}=await I.get(W,{cancelToken:me.token});m(_n(z(G(H))))}catch(H){if(Qe.default.isCancel(H))return;const ae=x()(H,"response.status",null);if(ae===404){u(T);return}ae===403&&(i({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),u(T))}},re=async()=>{await m(Xt()),await m(eo(f))};return D.current?(W?oe(Z):re(),()=>{Z.cancel("Operation canceled by the user.")}):()=>{}},[I,G,z,u,W,m,f,T,i]);const X=(0,e.useCallback)(P=>{i({type:"warning",message:w(P)})},[i,w]),q=(0,e.useCallback)(async P=>{try{C.current("willDeleteEntry",P);const{data:Z}=await $((0,h.IF)(`collection-types/${r}/${s}`));return i({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),C.current("didDeleteEntry",P),p(T),Promise.resolve(Z)}catch(Z){return C.current("didNotDeleteEntry",{error:Z,...P}),Promise.reject(Z)}},[s,r,i,$,T,p]),U=(0,e.useCallback)(async(P,Z)=>{const oe=`${(0,h.IF)(`collection-types/${r}`)}${f}`;try{m(le("submit-pending"));const{data:re}=await B(oe,P);return C.current("didCreateEntry",Z),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c("contentManager.success"),l.invalidateQueries(["relation"]),m(rt(z(re))),m(le("resolved")),p(`/content-manager/collectionType/${r}/${re.id}${f}`),Promise.resolve(re)}catch(re){return X(re),C.current("didNotCreateEntry",{error:re,trackerProperty:Z}),m(le("resolved")),Promise.reject(re)}},[z,X,p,r,m,f,i,c,l,B]),L=(0,e.useCallback)(async()=>{try{C.current("willCheckDraftRelations");const P=(0,h.IF)(`collection-types/${r}/${s}/actions/numberOfDraftRelations`);m(le("draft-relation-check-pending"));const Z=await I.get(P);return C.current("didCheckDraftRelations"),m(le("resolved")),Z.data.data}catch(P){return X(P),m(le("resolved")),Promise.reject(P)}},[X,s,r,m,I]),O=(0,e.useCallback)(async()=>{try{C.current("willPublishEntry");const P=(0,h.IF)(`collection-types/${r}/${s}/actions/publish`);m(le("publish-pending"));const{data:Z}=await B(P);return C.current("didPublishEntry"),m(rt(z(Z))),m(le("resolved")),i({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),Promise.resolve(Z)}catch(P){return X(P),m(le("resolved")),Promise.reject(P)}},[z,X,s,r,m,i,B]),N=(0,e.useCallback)(async(P,Z)=>{const oe=(0,h.IF)(`collection-types/${r}/${s}`);try{C.current("willEditEntry",Z),m(le("submit-pending"));const{data:re}=await A(oe,P);return C.current("didEditEntry",{trackerProperty:Z}),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),l.invalidateQueries(["relation"]),m(rt(z(re))),m(le("resolved")),Promise.resolve(re)}catch(re){return C.current("didNotEditEntry",{error:re,trackerProperty:Z}),X(re),m(le("resolved")),Promise.reject(re)}},[z,X,r,s,m,i,l,A]),Y=(0,e.useCallback)(async()=>{const P=(0,h.IF)(`collection-types/${r}/${s}/actions/unpublish`);m(le("unpublish-pending"));try{C.current("willUnpublishEntry");const{data:Z}=await B(P);return C.current("didUnpublishEntry"),i({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),m(rt(z(Z))),m(le("resolved")),Promise.resolve(Z)}catch(Z){return m(le("resolved")),X(Z),Promise.reject(Z)}},[z,X,s,r,m,i,B]);return o({componentsDataStructure:b,contentTypeDataStructure:E,data:v,isCreatingEntry:K,isLoadingForData:k,onDelete:q,onPost:U,onPublish:O,onDraftRelationCheck:L,onPut:N,onUnpublish:Y,status:R,redirectionLink:T})};no.defaultProps={id:null,origin:null},no.propTypes={allLayoutData:n().exact({components:n().object.isRequired,contentType:n().shape({apiID:n().string.isRequired,attributes:n().object.isRequired,info:n().object.isRequired,isDisplayed:n().bool.isRequired,kind:n().string.isRequired,layouts:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,pluginOptions:n().object,settings:n().object.isRequired,uid:n().string.isRequired}).isRequired}).isRequired,children:n().func.isRequired,id:n().string,origin:n().string,slug:n().string.isRequired};var jl=(0,e.memo)(no,Ce()),Wl=d(86834),qe=d.n(Wl),zl=d(99381),Je=d.n(zl),Ul=d(3040),se=d.n(Ul),oo=d(97889),Vl=d(56236),Hl=d.n(Vl),Ql=d(10268),Mr=d.n(Ql),ro=d(99526),Tr=(t,o,r,s)=>{const a=t.slice();return a.splice(o,1),a.splice(r,0,s),a},Gl=d(77236),Kl=d.n(Gl),Yl=d(85973),Xl=d.n(Yl);const Jl=({browserState:t,serverState:o},r,s)=>{const a=o,l=t,i=(u,p)=>x()(u,["attributes",p,"type"],""),c=(u,p)=>x()(u,["attributes",...p],""),g=(u,p,f,m)=>Object.keys(u).reduce((b,E)=>{const v=m?`${m}.${E}`:E,k=i(f,E),R=x()(u,E),T=x()(p,E),w=c(f,[E,"component"]),D=c(f,[E,"repeatable"]);let C;switch(k){case"json":C=JSON.parse(R);break;case"time":{C=R,R&&R.split(":").length<3&&(C=`${R}:00`);break}case"media":c(f,[E,"multiple"])===!0?C=R?R.filter(M=>!(M instanceof File)):null:C=x()(R,0)instanceof File?null:x()(R,"id",null);break;case"component":D?C=R&&R.map((M,I)=>g(M,(T??[])[I],s[w],`${v}.${I}`)):C=R&&g(R,T,s[w],v);break;case"relation":{const M=hr(a,l)(v).join(".");let I=x()(a,M,[]);const A=R.reduce(($,K,W,G)=>{const z=I.find(q=>q.id===K.id),X=G[W+1];if(!z||z.__temp_key__!==K.__temp_key__){const q=X?{before:X.id}:{end:!0};return[...$,{id:K.id,position:q}]}return $},[]);C={disconnect:I.reduce(($,K)=>R.find(W=>W.id===K.id)?$:[...$,{id:K.id}],[]),connect:A.reverse()};break}case"dynamiczone":C=R.map((M,I)=>g(M,(T??[])[I],s[M.__component],`${v}.${I}`));break;default:C=_l(R,"id")}return b[E]=C,b},{});return g(t,o,r,"")},_l=(t,o)=>Kl()(t)?t.map(r=>r[o]?r[o]:r):Xl()(t)?t[o]:t;var ec=Jl;const Jt=(t,o=()=>!1,r=void 0)=>{const s=(a,l,{ignoreFalseyValues:i=!1,path:c=[],parent:g=l}={})=>Object.entries(l).reduce((u,[p,f])=>{if(i&&(u==null||u[p]===void 0||u[p]===null))return u;if(o(f,{path:[...c,p],parent:g})&&(u[p]=typeof r=="function"?r(u[p],{path:[...c,p],parent:u}):r),f.type==="component"){const m=t[f.component].attributes;!f.repeatable&&u[p]&&typeof u[p]=="object"?u[p]=s(u[p],m,{ignoreFalseyValues:i,path:[...c,p],parent:l[p]}):f.repeatable&&Array.isArray(u[p])&&(u[p]=u[p].map((b,E)=>s(b,m,{ignoreFalseyValues:i,path:[...c,p,E],parent:l[p]})))}else f.type==="dynamiczone"&&Array.isArray(u[p])&&(u[p]=u[p].map((m,b)=>{const E=t[m.__component].attributes;return s(m,E,{ignoreFalseyValues:i,path:[...c,p,b],parent:l[p]})}));return u},{...a});return s},tc={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}};var nc=(t,o)=>(0,oo.ZP)(t,r=>{switch(o.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:s,allComponents:a}=o,l={...t.componentsDataStructure[s.uid]},c=Jt(a,g=>g.type==="relation",[])(l,s.attributes);se()(r,["modifiedData",...o.keys],c);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:s,allComponents:a,componentLayoutData:l,shouldCheckErrors:i}=o;i&&(r.shouldCheckErrors=!t.shouldCheckErrors),o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(r.modifiedDZName=s[0]);const c=x()(t,["modifiedData",...s],[]),g=o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?{...t.componentsDataStructure[l.uid],__component:l.uid,__temp_key__:(0,h.Uo)(c)+1}:{...t.componentsDataStructure[l.uid],__temp_key__:(0,h.Uo)(c)+1},p=Jt(a,m=>m.type==="relation",[])(g,l.attributes),f=Array.isArray(c)?[...c,p]:[p];se()(r,["modifiedData",...s],f);break}case"LOAD_RELATION":{const{initialDataPath:s,modifiedDataPath:a,value:l}=o,i=x()(t,s),c=x()(t,a),g=i?l.filter(f=>!i.some(m=>m.id===f.id)):l,u=(0,ro.zJ)(null,c[0]?.__temp_key__,g.length),p=g.map((f,m)=>({...f,__temp_key__:u[m]}));se()(r,s,Mr()([...p,...i],"id")),se()(r,a,Mr()([...p,...c],"id"));break}case"CONNECT_RELATION":{const s=["modifiedData",...o.keys],{value:a,toOneRelation:l}=o;if(l)se()(r,s,[a]);else{const i=x()(t,s),[c]=(0,ro.zJ)(i.at(-1)?.__temp_key__,null,1),g=[...i,{...a,__temp_key__:c}];se()(r,s,g)}break}case"DISCONNECT_RELATION":{const s=["modifiedData",...o.keys],{id:a}=o,i=x()(t,[...s]).filter(c=>c.id!==a);se()(r,s,i);break}case"MOVE_COMPONENT_FIELD":case"REORDER_RELATION":{const{oldIndex:s,newIndex:a,keys:l}=o,i=["modifiedData",...l],c=x()(t,[...i]),g=c[s],u=[...c];if(o.type==="REORDER_RELATION"){const p=s>a?c[a-1]?.__temp_key__:c[a]?.__temp_key__,f=s>a?c[a]?.__temp_key__:c[a+1]?.__temp_key__,[m]=(0,ro.zJ)(p,f,1);u.splice(s,1),u.splice(a,0,{...g,__temp_key__:m})}else u.splice(s,1),u.splice(a,0,g);se()(r,i,u);break}case"INIT_FORM":{const{initialValues:s,components:a={},attributes:l={},setModifiedDataOnly:i}=o,c=Je()(s),u=Jt(a,m=>m.type==="relation",(m,{path:b})=>t.modifiedData?.id===c.id&&x()(t.modifiedData,b)?x()(t.modifiedData,b):[])(c,l),f=Jt(a,m=>m.type==="dynamiczone"||m.type==="component"&&!m.repeatable,m=>Array.isArray(m)?m.map((b,E)=>({...b,__temp_key__:E})):{...m,__temp_key__:0})(u,l,{ignoreFalseyValues:!0});i||(r.initialData=f),r.modifiedData=f,r.formErrors={},r.modifiedDZName=null,r.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:s,dynamicZoneName:a,shouldCheckErrors:l}=o;l&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=t.modifiedData[a],c=o.type==="MOVE_COMPONENT_UP"?s-1:s+1,g=t.modifiedData[a][s],u=Tr(i,s,c,g);se()(r,["modifiedData",o.dynamicZoneName],u);break}case"MOVE_FIELD":{const s=x()(t,["modifiedData",...o.keys],[]).slice(),a=x()(t,["modifiedData",...o.keys,o.dragIndex]),l=Tr(s,o.dragIndex,o.overIndex,a);se()(r,["modifiedData",...o.keys],l);break}case"ON_CHANGE":{const[s]=o.keys;if(o.shouldSetInitialValue&&se()(r,["initialData",...o.keys],o.value),o.keys.length===2&&x()(t,["modifiedData",s])===null){se()(r,["modifiedData",s],{[o.keys[1]]:o.value});break}se()(r,["modifiedData",...o.keys],o.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{o.shouldCheckErrors&&(r.shouldCheckErrors=!t.shouldCheckErrors),r.modifiedData[o.dynamicZoneName].splice(o.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const s=["modifiedData",...o.keys];se()(r,s,null);break}case"REMOVE_PASSWORD_FIELD":{Hl()(r,["modifiedData",...o.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=o.keys.length-1,a=["modifiedData",...xt()(o.keys,s)];Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=x()(t,a).slice();i.splice(parseInt(o.keys[s],10),1),se()(r,a,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{r.componentsDataStructure=o.componentsDataStructure,r.contentTypeDataStructure=o.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{r.modifiedDZName=null,r.formErrors=o.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);break}case"SET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...o.publishConfirmation};break}case"RESET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...t.publishConfirmation,show:!1};break}default:return r}});const so=({allLayoutData:t,allowedActions:{canRead:o,canUpdate:r},children:s,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:c,initialValues:g,isCreatingEntry:u,isLoadingForData:p,isSingleType:f,onPost:m,onPublish:b,onDraftRelationCheck:E,onPut:v,onUnpublish:k,readActionAllowedFields:R,redirectToPreviousPage:T,slug:w,status:D,updateActionAllowedFields:C})=>{const[M,I]=(0,e.useReducer)(nc,tc),{formErrors:A,initialData:B,modifiedData:$,modifiedDZName:K,shouldCheckErrors:W,publishConfirmation:G}=M,{setModifiedDataOnly:z}=(0,J.v9)(to),X=(0,J.I0)(),q=(0,y.lm)(),{lockApp:U,unlockApp:L}=(0,y.o1)(),O=x()(t,["contentType"],{}),N=(0,e.useMemo)(()=>x()(O,["options","draftAndPublish"],!1),[O]),Y=(0,e.useMemo)(()=>N&&!B.publishedAt,[N,B.publishedAt]),{trackUsage:P}=(0,y.rS)(),{formatMessage:Z}=(0,V.Z)(),oe=(0,e.useRef)(P),re=(0,e.useMemo)(()=>p||u?!1:o===!1&&r===!1,[p,u,o,r]);(0,e.useEffect)(()=>{D==="resolved"?L():U()},[U,L,D]),(0,e.useEffect)(()=>{p||ke()},[W]),(0,e.useEffect)(()=>{const ne=Object.keys(A);if(ne.length>0){const ee=ne[0],ie=document.getElementById(ee);ie&&ie.focus()}},[A]),(0,e.useEffect)(()=>{re&&q({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}})},[re,q]),(0,e.useEffect)(()=>{I({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]);const{components:me}=t,H=(0,pe.zH)(g);(0,e.useEffect)(()=>{g&&O?.attributes&&!Ce()(H,g)&&(I({type:"INIT_FORM",initialValues:g,components:me,attributes:O.attributes,setModifiedDataOnly:z}),z&&X(Nl()))},[g,O,me,z,X,H]);const ae=(0,e.useCallback)(ne=>(ee,ie,Ue,mt=!1)=>{oe.current("didAddComponentToDynamicZone"),I({type:ne,keys:ee.split("."),componentLayoutData:ie,allComponents:Ue,shouldCheckErrors:mt})},[]),Pe=ae("ADD_COMPONENT_TO_DYNAMIC_ZONE"),Ne=(0,e.useCallback)((ne,ee,ie)=>{I({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:ne.split("."),componentLayoutData:ee,allComponents:ie})},[]),de=(0,e.useCallback)(({name:ne,value:ee,toOneRelation:ie})=>{I({type:"CONNECT_RELATION",keys:ne.split("."),value:ee,toOneRelation:ie})},[]),ue=(0,e.useCallback)(({target:{initialDataPath:ne,modifiedDataPath:ee,value:ie}})=>{I({type:"LOAD_RELATION",modifiedDataPath:ee,initialDataPath:ne,value:ie})},[]),Fe=ae("ADD_REPEATABLE_COMPONENT_TO_FIELD"),Re=(0,e.useMemo)(()=>{const ne={isCreatingEntry:u,isDraft:Y,isFromComponent:!1};return(0,h.Ex)(O,{components:t.components||{}},ne)},[t.components,O,u,Y]),ke=(0,e.useCallback)(async(ne={})=>{let ee={};const ie=Je()($);qe()(ie)||se()(ie,ne.path,ne.value);try{await Re.validate(ie,{abortEarly:!1})}catch(Ue){ee=(0,y.CJ)(Ue),K&&(ee=Object.keys(ee).reduce((mt,jo)=>(jo.split(".")[0]!==K&&(mt[jo]=ee[jo]),mt),{}))}I({type:"SET_FORM_ERRORS",errors:ee})},[K,$,Re]),Tt=(0,e.useCallback)(({target:{name:ne,value:ee,type:ie}},Ue=!1)=>{let mt=ee;if(["text","textarea","string","email","uid","select","select-one","number"].includes(ie)&&!ee&&ee!==0&&(mt=null),ie==="password"&&!ee){I({type:"REMOVE_PASSWORD_FIELD",keys:ne.split(".")});return}I({type:"ON_CHANGE",keys:ne.split("."),value:mt,shouldSetInitialValue:Ue})},[]),Me=(0,e.useCallback)((ne,ee)=>ec({browserState:ne,serverState:ee},O,t.components),[t.components,O]),_=(0,e.useMemo)(()=>N?Y?{status:"draft"}:{}:{},[N,Y]),fe=(0,e.useCallback)(async ne=>(ne.preventDefault(),I({type:"RESET_PUBLISH_CONFIRMATION"})),[]),ze=(0,e.useCallback)(async ne=>{ne.preventDefault();let ee={};try{await Re.validate($,{abortEarly:!1})}catch(ie){ee=(0,y.CJ)(ie)}try{if(qe()(ee)){const ie=Me($,B);u?await m(ie,_):await v(ie,_)}}catch(ie){ee={...ee,...(0,y.nn)(ie,{getTrad:h.OB})}}I({type:"SET_FORM_ERRORS",errors:ee})},[Me,u,$,B,m,v,_,Re]),No=(0,e.useCallback)(async()=>{const ne=(0,h.Ex)(O,{components:x()(t,"components",{})},{isCreatingEntry:u,isDraft:!1,isFromComponent:!1}),ee=await E();if(!G.show&&ee>0){I({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:ee}});return}I({type:"RESET_PUBLISH_CONFIRMATION"});let ie={};try{await ne.validate($,{abortEarly:!1})}catch(Ue){ie=(0,y.CJ)(Ue)}try{qe()(ie)&&await b()}catch(Ue){ie={...ie,...(0,y.nn)(Ue,{getTrad:h.OB})}}I({type:"SET_FORM_ERRORS",errors:ie})},[t,O,u,$,G.show,b,E]),at=(0,e.useCallback)(ne=>{const ee=Object.keys(A).some(Ue=>Ue.split(".")[0]===ne);return!qe()(A)&&ee},[A]),um=(0,e.useCallback)((ne,ee)=>{oe.current("changeComponentsOrder"),I({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:ne,currentIndex:ee,shouldCheckErrors:at(ne)})},[at]),mm=(0,e.useCallback)((ne,ee)=>{oe.current("changeComponentsOrder"),I({type:"MOVE_COMPONENT_UP",dynamicZoneName:ne,currentIndex:ee,shouldCheckErrors:at(ne)})},[at]),pm=(0,e.useCallback)(({name:ne,newIndex:ee,currentIndex:ie})=>{I({type:"MOVE_COMPONENT_FIELD",keys:ne.split("."),newIndex:ee,oldIndex:ie})},[]),gm=(0,e.useCallback)(({name:ne,id:ee})=>{I({type:"DISCONNECT_RELATION",keys:ne.split("."),id:ee})},[]),fm=(0,e.useCallback)(({name:ne,oldIndex:ee,newIndex:ie})=>{I({type:"REORDER_RELATION",keys:ne.split("."),oldIndex:ee,newIndex:ie})},[]),hm=(0,e.useCallback)((ne,ee)=>{oe.current("removeComponentFromDynamicZone"),I({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:ne,index:ee,shouldCheckErrors:at(ne)})},[at]),ym=(0,e.useCallback)((ne,ee)=>{I({type:"REMOVE_COMPONENT_FROM_FIELD",keys:ne.split("."),componentUid:ee})},[]),bm=(0,e.useCallback)((ne,ee)=>{I({type:"REMOVE_REPEATABLE_FIELD",keys:ne.split("."),componentUid:ee})},[]),Em=(0,e.useCallback)(()=>{I({type:"TRIGGER_FORM_VALIDATION"})},[]);return re?e.createElement(te.l_,{to:c}):$?e.createElement(y.W1.Provider,{value:{addComponentToDynamicZone:Pe,addNonRepeatableComponentToField:Ne,addRepeatableComponentToField:Fe,allLayoutData:t,checkFormErrors:ke,createActionAllowedFields:i,formErrors:A,hasDraftAndPublish:N,initialData:B,isCreatingEntry:u,isSingleType:f,shouldNotRunValidations:Y,status:D,layout:O,modifiedData:$,moveComponentField:pm,moveComponentDown:um,moveComponentUp:mm,onChange:Tt,onPublish:No,onUnpublish:k,readActionAllowedFields:R,redirectToPreviousPage:T,removeComponentFromDynamicZone:hm,removeComponentFromField:ym,removeRepeatableField:bm,relationConnect:de,relationDisconnect:gm,relationLoad:ue,relationReorder:fm,slug:w,triggerFormValidation:Em,updateActionAllowedFields:C,onPublishPromptDismissal:fe,publishConfirmation:G}},p||!u&&!B.id?e.createElement(De.o,{"aria-busy":"true"},e.createElement(y.dO,null)):e.createElement(e.Fragment,null,e.createElement(te.NL,{when:!Ce()($,B),message:Z({id:"global.prompt.unsaved"})}),e.createElement("form",{noValidate:!0,onSubmit:ze},s))):null};so.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},so.propTypes={allLayoutData:n().object.isRequired,allowedActions:n().object.isRequired,children:n().node.isRequired,componentsDataStructure:n().object.isRequired,contentTypeDataStructure:n().object.isRequired,createActionAllowedFields:n().array.isRequired,from:n().string,initialValues:n().object,isCreatingEntry:n().bool.isRequired,isLoadingForData:n().bool.isRequired,isSingleType:n().bool.isRequired,onPost:n().func.isRequired,onPublish:n().func.isRequired,onDraftRelationCheck:n().func.isRequired,onPut:n().func.isRequired,onUnpublish:n().func.isRequired,readActionAllowedFields:n().array.isRequired,redirectToPreviousPage:n().func,slug:n().string.isRequired,status:n().string.isRequired,updateActionAllowedFields:n().array.isRequired};var oc=so,dt=t=>(0,h.IF)(`single-types/${t}`),_t=d(33348),rc=t=>Object.values(t||{}).reduce((o,r)=>Object.assign(o,r),{}),Dr=(t={})=>{const{plugins:o,_q:r,...s}={...t,...rc(t.plugins)};return r&&se()(s,"_q",encodeURIComponent(r)),`${(0,_t.stringify)(s,{encode:!1,addQueryPrefix:!0})}`};const kr=({allLayoutData:t,children:o,slug:r})=>{const s=(0,Xe.useQueryClient)(),{trackUsage:a}=(0,y.rS)(),{push:l}=(0,te.k6)(),{setCurrentStep:i}=(0,y.c1)(),c=(0,e.useRef)(a),[g,u]=(0,e.useState)(!0),[{query:p,rawQuery:f}]=(0,y.Kx)(),m=Dr(p),b=(0,y.lm)(),E=(0,J.I0)(),{formatAPIError:v}=(0,y.So)(h.OB),k=(0,y.kY)(),{post:R,put:T,del:w}=k,{componentsDataStructure:D,contentTypeDataStructure:C,data:M,isLoading:I,status:A}=(0,J.v9)(to),B=(0,e.useCallback)(U=>{const L=(0,h.kc)(U,t.contentType,t.components);return(0,y.dU)(L,t.contentType,t.components)},[t]);(0,e.useEffect)(()=>()=>{E(Cr())},[E]),(0,e.useEffect)(()=>{const U=Object.keys(t.components).reduce((N,Y)=>{const P=(0,h.Di)(x()(t,["components",Y,"attributes"],{}),t.components);return N[Y]=(0,y.dU)(P,t.components[Y],t.components),N},{}),L=(0,h.Di)(t.contentType.attributes,t.components),O=(0,y.dU)(L,t.contentType,t.components);E(Rr(U,O))},[t,E]),(0,e.useEffect)(()=>{const L=Qe.default.CancelToken.source();return(async N=>{E(Xt()),u(!0);try{const{data:Y}=await k.get(dt(`${r}${m}`),{cancelToken:N.token});E(_n(B(Y))),u(!1)}catch(Y){if(Qe.default.isCancel(Y))return;const P=x()(Y,"response.status",null);P===404&&E(eo(f,!0)),P===403&&(b({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),l("/"))}})(L),()=>L.cancel("Operation canceled by the user.")},[k,B,l,r,E,m,f,b]);const $=(0,e.useCallback)(U=>{b({type:"warning",message:v(U)})},[b,v]),K=(0,e.useCallback)(async U=>{try{c.current("willDeleteEntry",U);const{data:L}=await w(dt(`${r}${m}`));return b({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),c.current("didDeleteEntry",U),u(!0),E(eo(f,!0)),Promise.resolve(L)}catch(L){return c.current("didNotDeleteEntry",{error:L,...U}),$(L),Promise.reject(L)}},[w,r,$,b,m,E,f]),W=(0,e.useCallback)(async(U,L)=>{const O=dt(`${r}${f}`);try{E(le("submit-pending"));const{data:N}=await T(O,U);return c.current("didCreateEntry",L),b({type:"success",message:{id:(0,h.OB)("success.record.save")}}),i("contentManager.success"),s.invalidateQueries(["relation"]),E(rt(B(N))),u(!1),E(le("resolved")),Promise.resolve(N)}catch(N){return c.current("didNotCreateEntry",{error:N,trackerProperty:L}),$(N),E(le("resolved")),Promise.reject(N)}},[T,B,$,r,E,f,b,i,s]),G=(0,e.useCallback)(async()=>{try{c.current("willCheckDraftRelations");const U=dt(`${r}/actions/numberOfDraftRelations`);E(le("draft-relation-check-pending"));const L=await k.get(U);return c.current("didCheckDraftRelations"),E(le("resolved")),L.data.data}catch(U){return $(U),E(le("resolved")),Promise.reject(U)}},[k,$,r,E]),z=(0,e.useCallback)(async()=>{try{c.current("willPublishEntry");const U=dt(`${r}/actions/publish${m}`);E(le("publish-pending"));const{data:L}=await R(U);return c.current("didPublishEntry"),b({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),E(rt(B(L))),E(le("resolved")),Promise.resolve(L)}catch(U){return $(U),E(le("resolved")),Promise.reject(U)}},[R,B,$,r,m,E,b]),X=(0,e.useCallback)(async(U,L)=>{const O=dt(`${r}${f}`);try{c.current("willEditEntry",L),E(le("submit-pending"));const{data:N}=await T(O,U);return b({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c.current("didEditEntry",{trackerProperty:L}),s.invalidateQueries(["relation"]),E(rt(B(N))),E(le("resolved")),Promise.resolve(N)}catch(N){return $(N),c.current("didNotEditEntry",{error:N,trackerProperty:L}),E(le("resolved")),Promise.reject(N)}},[T,B,$,r,E,f,b,s]),q=(0,e.useCallback)(async()=>{const U=dt(`${r}/actions/unpublish${m}`);E(le("unpublish-pending"));try{c.current("willUnpublishEntry");const{data:L}=await R(U);c.current("didUnpublishEntry"),b({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),E(rt(B(L))),E(le("resolved"))}catch(L){E(le("resolved")),$(L)}},[R,B,b,$,r,E,m]);return o({componentsDataStructure:D,contentTypeDataStructure:C,data:M,isCreatingEntry:g,isLoadingForData:I,onDelete:K,onPost:W,onDraftRelationCheck:G,onPublish:z,onPut:X,onUnpublish:q,redirectionLink:"/",status:A})};kr.propTypes={allLayoutData:n().shape({components:n().object.isRequired,contentType:n().object.isRequired}).isRequired,children:n().func.isRequired,slug:n().string.isRequired};var sc=(0,e.memo)(kr),ac=d(56243);function ic(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var lc=ic;function cc(){const{initialData:t,hasDraftAndPublish:o}=(0,y.Wq)(),r=t.publishedAt!==void 0&&t.publishedAt!==null;return{hasDraftAndPublish:o,isPublished:r}}var dc=cc;const uc=(0,j.ZP)(ac.Z)`
902
- width: ${(0,y.Q1)(6)};
903
- height: ${(0,y.Q1)(6)};
904
- * {
905
- fill: ${({theme:t,$bulletColor:o})=>t.colors[o]};
906
- }
907
- `,Ir=({hasDraftAndPublish:t,isPublished:o})=>{const{formatMessage:r}=(0,V.Z)();if(!t)return null;const s={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=o?s.published:s.draft;return e.createElement(S.x,{hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5,...a.box},e.createElement(S.x,{as:F.k},e.createElement(uc,{$bulletColor:a.bulletColor}),e.createElement(S.x,{paddingLeft:3},e.createElement(Q.Z,{textColor:a.textColor},r({id:(0,h.OB)("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),e.createElement(Q.Z,{fontWeight:"bold",textColor:a.textColor},o&&r({id:(0,h.OB)("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!o&&r({id:(0,h.OB)("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};Ir.propTypes={hasDraftAndPublish:n().bool.isRequired,isPublished:n().bool.isRequired};var mc=lc(Ir,dc),st=d(66456),en=d(29439),tn=d(22342),nn=d(96166),on=d(88693);function pc(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var gc=pc;function fc(){const{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:g,publishConfirmation:u,onPublishPromptDismissal:p}=(0,y.Wq)();return{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:g,publishConfirmation:u,onPublishPromptDismissal:p}}var hc=fc;const Pr=(0,j.ZP)(F.k)`
908
- text-align: center;
909
- `,Or=({allowedActions:{canUpdate:t,canCreate:o,canPublish:r},initialData:s,isCreatingEntry:a,isSingleType:l,hasDraftAndPublish:i,layout:c,modifiedData:g,onPublish:u,onUnpublish:p,status:f,publishConfirmation:{show:m,draftCount:b},onPublishPromptDismissal:E})=>{const{goBack:v}=(0,te.k6)(),[k,R]=(0,e.useState)(!1),{formatMessage:T}=(0,V.Z)(),w=x()(c,["settings","mainField"],"id"),D=x()(c,["info","displayName"],"NOT FOUND"),C=!Ce()(s,g)||a&&!qe()(g);let I=T({id:(0,h.OB)("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!a&&!l&&(I=s[w]||D),l&&(I=D);let A=null;if(a&&o&&(A=e.createElement(F.k,{gap:2},i&&e.createElement(ce.z,{disabled:!0,startIcon:e.createElement(st.Z,null),variant:"secondary"},T({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(ce.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},T({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"})))),!a&&t){const W=i&&r,G=!qe()(s.publishedAt),z=G?f==="unpublish-pending":f==="publish-pending",X=G?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},q=G?()=>R(!0):()=>u();A=e.createElement(F.k,null,W&&e.createElement(ce.z,{disabled:C,loading:z,onClick:q,startIcon:e.createElement(st.Z,null),variant:"secondary"},T(X)),e.createElement(S.x,{paddingLeft:W?2:0},e.createElement(ce.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},T({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"}))))}const B=()=>R(W=>!W),$=()=>{B(),p()},K=`${T({id:(0,h.OB)("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return e.createElement(e.Fragment,null,e.createElement(he.T,{title:I.toString(),primaryAction:A,subtitle:K,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),onClick:W=>{W.preventDefault(),v()},to:"/"},T({id:"global.back",defaultMessage:"Back"}))}),e.createElement(tn.V,{onClose:B,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:k},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(F.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>e.createElement("br",null)}))),e.createElement(F.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:B,variant:"tertiary"},T({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{variant:"danger-light",onClick:$},T({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),e.createElement(tn.V,{onClose:E,title:T({id:(0,h.OB)("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:m},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Pr,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},b,T({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, one { relation is} other { relations are}}</b> not published yet and might lead to unexpected behavior."},{b:W=>e.createElement(Q.Z,{fontWeight:"bold"},W),count:b}))),e.createElement(Pr,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},T({id:(0,h.OB)("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:E,variant:"tertiary"},T({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{variant:"success",onClick:u},T({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};Or.propTypes={allowedActions:n().shape({canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canPublish:n().bool.isRequired}).isRequired,initialData:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isSingleType:n().bool.isRequired,status:n().string.isRequired,layout:n().object.isRequired,hasDraftAndPublish:n().bool.isRequired,modifiedData:n().object.isRequired,onPublish:n().func.isRequired,onUnpublish:n().func.isRequired,publishConfirmation:n().shape({show:n().bool.isRequired,draftCount:n().number.isRequired}).isRequired,onPublishPromptDismissal:n().func.isRequired};const yc=(0,e.memo)(Or,Ce());var bc=gc(yc,hc),Ec=t=>{if(!t.layouts)return[];const o=t.layouts.edit,r=t.attributes,s=i=>x()(r,[i,"type"],"");let a=0;const l=[];return o.forEach(i=>{const c=i.some(({name:g})=>s(g)==="dynamiczone");l[a]||(l[a]=[]),c?(a=a===0&&qe()(l[0])?0:a+1,l[a]||(l[a]=[]),l[a].push(i),a+=1):l[a].push(i)}),l.filter(i=>i.length>0)},vc=d(91815),Cc=d.n(vc),Rc=d(3704),wr=d.n(Rc),Mc=(t,o)=>{const r=s=>{const a=(0,y.ZT)(t,[{action:`plugin::content-manager.explorer.${s}`,subject:o}]);return Cc()(wr()(a,"properties.fields"))};return{createActionAllowedFields:r("create"),readActionAllowedFields:r("read"),updateActionAllowedFields:r("update")}},Tc=t=>{if(!t)return[];const r=[...t.contentType.layouts.edit,...Object.values(t.components).flatMap(a=>a.layouts.edit)].flat().filter(a=>a.fieldSchema.customField).map(a=>a.fieldSchema.customField);return[...new Set(r)]};function Dc(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var kc=Dc;function Ic(){const{hasDraftAndPublish:t,modifiedData:o}=(0,y.Wq)();let r={};return t&&(r=qe()(o.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:t,trackerProperty:r}}var Pc=Ic;const xr=({onDelete:t,trackerProperty:o})=>{const[r,s]=(0,e.useState)(!1),[a,l]=(0,e.useState)(!1),{formatMessage:i}=(0,V.Z)(),{formatAPIError:c}=(0,y.So)(h.OB),g=(0,y.lm)(),u=()=>s(f=>!f),p=async()=>{try{l(!0),await t(o),l(!1),u()}catch(f){l(!1),u(),g({type:"warning",message:c(f)})}};return e.createElement(e.Fragment,null,e.createElement(ce.z,{onClick:u,size:"S",startIcon:e.createElement(Ye.Z,null),variant:"danger-light"},i({id:(0,h.OB)("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),e.createElement(y.QH,{isConfirmButtonLoading:a,isOpen:r,onConfirm:p,onToggleDialog:u}))};xr.propTypes={onDelete:n().func.isRequired,trackerProperty:n().object.isRequired};const Oc=(0,e.memo)(xr,Ce());var wc=kc(Oc,Pc);const ao=({columns:t,customFieldInputs:o})=>e.createElement(Ie.r,{gap:4},t.map(({fieldSchema:r,labelAction:s,metadatas:a,name:l,size:i,queryInfos:c})=>{if(r.type==="component"){const{component:u,max:p,min:f,repeatable:m=!1,required:b=!1}=r;return e.createElement(ge.P,{col:i,s:12,xs:12,key:u},e.createElement(Qt,{componentUid:u,labelAction:s,isRepeatable:m,intlLabel:{id:a.label,defaultMessage:a.label},max:p,min:f,name:l,required:b}))}return e.createElement(ge.P,{col:i,key:l,s:12,xs:12},e.createElement(Bn,{size:i,fieldSchema:r,keys:l,labelAction:s,metadatas:a,queryInfos:c,customFieldInputs:o}))}));ao.defaultProps={customFieldInputs:{}},ao.propTypes={columns:n().array.isRequired,customFieldInputs:n().object};var xc=ao,io=d(98178);const lo=t=>t["content-manager_editViewLayoutManager"].currentLayout,Fc=(0,io.P1)(lo,t=>Ec(t?.contentType??{})),Lc=(0,io.P1)(lo,t=>Tc(t)),Ac=(()=>window&&window.strapi&&window.strapi.isEE?d(28243).Z:d(73710).Z)(),Fr=we.Z.contentManager,Sc=[{action:"plugin::content-type-builder.read",subject:null}],co=t=>{let{allowedActions:o,isSingleType:r,goBack:s,slug:a,id:l,origin:i,userPermissions:c}=t;const{trackUsage:g}=(0,y.rS)(),{formatMessage:u}=(0,V.Z)(),{layout:p,formattedContentTypeLayout:f,customFieldUids:m}=(0,J.v9)(M=>({layout:lo(M),formattedContentTypeLayout:Fc(M),customFieldUids:Lc(M)})),{isLazyLoading:b,lazyComponentStore:E}=qn(m),{createActionAllowedFields:v,readActionAllowedFields:k,updateActionAllowedFields:R}=Mc(c,a),T=r?Fr.singleTypesConfigurations:Fr.collectionTypesConfigurations,w=`/content-manager/${r?"singleType":"collectionType"}/${a}/configurations/edit`,D=r?sc:jl,C=M=>M.every(I=>I.every(A=>A.fieldSchema.type==="dynamiczone"));return b?e.createElement(y.dO,null):e.createElement(D,{allLayoutData:p,slug:a,id:l,origin:i},M=>{let{componentsDataStructure:I,contentTypeDataStructure:A,data:B,isCreatingEntry:$,isLoadingForData:K,onDelete:W,onPost:G,onPublish:z,onDraftRelationCheck:X,onPut:q,onUnpublish:U,redirectionLink:L,status:O}=M;return e.createElement(oc,{allowedActions:o,allLayoutData:p,createActionAllowedFields:v,componentsDataStructure:I,contentTypeDataStructure:A,from:L,initialValues:B,isCreatingEntry:$,isLoadingForData:K,isSingleType:r,onPost:G,onPublish:z,onDraftRelationCheck:X,onPut:q,onUnpublish:U,readActionAllowedFields:k,redirectToPreviousPage:s,slug:a,status:O,updateActionAllowedFields:R},e.createElement(De.o,{"aria-busy":O!=="resolved"},e.createElement(bc,{allowedActions:o}),e.createElement(We.D,null,e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{col:9,s:12},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},f.map((N,Y)=>{if(C(N)){const{0:{0:{name:P,fieldSchema:Z,metadatas:oe,labelAction:re}}}=N;return e.createElement(S.x,{key:Y},e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{col:12,s:12,xs:12},e.createElement(ql,{name:P,fieldSchema:Z,labelAction:re,metadatas:oe}))))}return e.createElement(S.x,{key:Y,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:6},N.map((P,Z)=>e.createElement(xc,{columns:P,customFieldInputs:E,key:Z}))))}))),e.createElement(ge.P,{col:3,s:12},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(mc,null),e.createElement(S.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(Ac,null),e.createElement(Wt,{area:"contentManager.editView.informations"})),e.createElement(S.x,{as:"aside","aria-labelledby":"links"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Wt,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&e.createElement(y.jW,{permissions:Sc},e.createElement(y.Qj,{onClick:()=>{g("willEditEditLayout")},size:"S",startIcon:e.createElement(Ve.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},u({id:(0,h.OB)("link-to-ctb"),defaultMessage:"Edit the model"}))),e.createElement(y.jW,{permissions:T},e.createElement(y.Qj,{size:"S",startIcon:e.createElement(Ke.Z,null),style:{width:"100%"},to:w,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),o.canDelete&&!$&&e.createElement(wc,{onDelete:W})))))))))})};co.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},co.propTypes={allowedActions:n().shape({canRead:n().bool.isRequired,canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canDelete:n().bool.isRequired}).isRequired,id:n().string,isSingleType:n().bool,goBack:n().func.isRequired,origin:n().string,slug:n().string.isRequired,userPermissions:n().array};var $c=(0,e.memo)(co);const uo=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.userPermissions);return r?e.createElement(y.dO,null):e.createElement($c,{...t,allowedActions:s})};uo.defaultProps={permissions:[]},uo.propTypes={permissions:n().array,slug:n().string.isRequired,userPermissions:n().array.isRequired};var Zc=(0,e.memo)(uo,Ce());const Lr=({layout:t,...o})=>{const r=(0,J.v9)(ft.Z),s=(0,J.I0)(),[{query:a}]=(0,y.Kx)(),{runHookWaterfall:l}=(0,y.j1)(),i=(0,pe.r5)(a,o.slug,"editView");return(0,e.useEffect)(()=>{const c=l(je.Eo,{layout:t,query:a});return s(kt(c.layout,a)),()=>{s(Dt())}},[t,s,a,l]),!r||!i?e.createElement(y.dO,null):e.createElement(Zc,{...o,userPermissions:i})};Lr.propTypes={layout:n().shape({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,settings:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().object.isRequired}).isRequired}).isRequired};var rn=Lr,Bc=d(23940),St=d.n(Bc),Ar=d(9026);const mo=t=>t.reduce((o,r)=>o+r.size,0),qc=t=>t.reduce((o,r,s)=>{const a={rowId:s,rowContent:r};return o.concat(a)},[]),Et=t=>t.reduce((o,r)=>{let s=[];const a=r.rowContent.reduce((c,g)=>{const u=mo(c);return g.name==="_TEMP_"||(u+g.size<=12?c.push(g):s.push(g)),c},[]),l=o.length===0?0:Math.max.apply(Math,o.map(c=>c.rowId))+1,i=mo(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),o.push({rowId:l,rowContent:a}),s.length>0){const c=mo(s);c<12&&s.push({name:"_TEMP_",size:12-c}),o.push({rowId:l+1,rowContent:s}),s=[]}return o},[]).filter(o=>o.rowContent.length>0).filter(o=>o.rowContent.length===1?o.rowContent[0].name!=="_TEMP_":!0),Nc=t=>t.reduce((o,r)=>{const s=r.rowContent.filter(a=>a.name!=="_TEMP_");return o.concat([s])},[]),jc=(t,o=[])=>o.reduce((r,{rowContent:s})=>{const a=s.find(l=>l.name===t)?.size??null;return a&&(r=a),r},null),Wc=(t,o,r=[])=>r.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===t?{...a,size:o}:a),s)),Sr=6,po={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}};var zc=(t=po,o)=>(0,oo.ZP)(t,r=>{const s=["modifiedData","layouts","edit"];switch(o.type){case"MOVE_ROW":{const a=x()(t,s,[]),{fromIndex:l,toIndex:i}=o;se()(r,s,(0,h.W3)(a,l,i));break}case"ON_ADD_FIELD":{const a=Je()(t),l=x()(a,["modifiedData","attributes",o.name],{}),i=o.fieldSizes[l?.customField]?.default??o.fieldSizes[l?.type]?.default??Sr,c=x()(a,s,[]).length,g=[...s,c-1,"rowContent"],u=x()(a,g,[]);let p=x()(a,s,[]);Array.isArray(u)?se()(p,[c>0?c-1:0,"rowContent"],[...u,{name:o.name,size:i}]):se()(p,[c>0?c-1:0,"rowContent"],[{name:o.name,size:i}]);const f=Et(p);se()(r,s,f);break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys],o.value);break}case"ON_CHANGE_META":{se()(r,["metaForm","metadata",...o.keys],o.value);break}case"ON_CHANGE_SIZE":{se()(r,["metaForm","size"],o.value);break}case"ON_RESET":{r.modifiedData=t.initialData;break}case"REMOVE_FIELD":{const a=x()(t,[...s,o.rowIndex,"rowContent"],[]);let l=Je()(t);if(a.length===1||a.length===2&&x()(a,[1,"name"],"")==="_TEMP_"){const c=x()(t,s,[]);se()(l,s,c.filter((g,u)=>o.rowIndex!==u))}else se()(l,[...s,o.rowIndex,"rowContent"],a.filter((c,g)=>g!==o.fieldIndex));const i=Et(x()(l,s,[]));se()(r,s,i);break}case"REORDER_DIFF_ROW":{const a=x()(t,[...s,o.dragRowIndex,"rowContent"],[]),l=x()(t,[...s,o.hoverRowIndex,"rowContent"],[]),i=x()(t,[...s,o.dragRowIndex,"rowContent",o.dragIndex],{}),c=[...l,i];let g=Je()(t);se()(g,[...s,o.dragRowIndex,"rowContent"],a.filter((p,f)=>o.dragIndex!==f)),se()(g,[...s,o.hoverRowIndex,"rowContent"],(0,h.W3)(c,c.length-1,o.hoverIndex));const u=Et(x()(g,s,[]));se()(r,s,u);break}case"REORDER_ROW":{const a=Je()(t),l=x()(a,[...s,o.dragRowIndex,"rowContent"],[]);se()(a,[...s,o.dragRowIndex,"rowContent"],(0,h.W3)(l,o.dragIndex,o.hoverIndex));const i=Et(x()(a,s,[]));se()(r,s,i);break}case"SET_FIELD_TO_EDIT":{r.metaToEdit=o.name,r.metaForm={metadata:x()(t,["modifiedData","metadatas",o.name,"edit"],{}),size:jc(o.name,t.modifiedData?.layouts?.edit)??Sr};break}case"SUBMIT_META_FORM":{se()(r,["modifiedData","metadatas",t.metaToEdit,"edit"],t.metaForm.metadata);const a=Je()(x()(t,s,[])),l=Wc(t.metaToEdit,t.metaForm.size,a);l.length>0&&se()(r,s,Et(l));break}case"SUBMIT_SUCCEEDED":{r.initialData=t.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{r.metaToEdit="",r.metaForm={};break}default:return r}}),Uc=(t,o,r)=>{let s=Je()(o);return se()(s,["layouts","edit"],Et(qc(o.layouts.edit))),{...t,initialData:s,modifiedData:s,componentLayouts:r}},Ge=d(34853);const $r=e.createContext();function go({attributes:t,buttonData:o,children:r,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:g,relationsLayout:u,removeField:p,selectedItemName:f,setEditFieldToSelect:m,...b}){return e.createElement($r.Provider,{value:{attributes:t,buttonData:o,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:g,relationsLayout:u,removeField:p,selectedItemName:f,setEditFieldToSelect:m,...b}},r)}go.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},go.propTypes={attributes:n().object,buttonData:n().array,children:n().node.isRequired,goTo:n().func,layout:n().array,metadatas:n().object,moveItem:n().func,moveRow:n().func,onAddData:n().func,relationsLayout:n().array,removeField:n().func,selectedItemName:n().string,setEditFieldToSelect:n().func};function ut(){return e.useContext($r)}var sn=d(74506),Zr=d(45112);const Br=({componentUid:t})=>{const{componentLayouts:o}=ut(),{formatMessage:r}=(0,V.Z)(),s=x()(o,[t],{}),a=x()(s,["layouts","edit"],[]);return e.createElement(S.x,{padding:3},a.map((l,i)=>e.createElement(Ie.r,{gap:4,key:i},l.map(c=>e.createElement(ge.P,{key:c.name,col:c.size},e.createElement(S.x,{paddingTop:2},e.createElement(F.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},e.createElement(Q.Z,{textColor:"neutral800"},c.name))))))),e.createElement(S.x,{paddingTop:2},e.createElement(y.rU,{startIcon:e.createElement(Zr.Z,null),to:`/content-manager/components/${t}/configurations/edit`},r({id:(0,ve.Z)("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};Br.propTypes={componentUid:n().string.isRequired};var Vc=Br,vt=d(14911);const Hc=(0,j.ZP)(F.k)`
910
- text-decoration: none;
911
-
912
- &:focus,
913
- &:hover {
914
- ${({theme:t})=>`
915
- background-color: ${t.colors.primary100};
916
- border-color: ${t.colors.primary200};
917
-
918
- ${Q.Z} {
919
- color: ${t.colors.primary600};
920
- }
921
- `}
922
-
923
- /* > ComponentIcon */
924
- > div:first-child {
925
- background: ${({theme:t})=>t.colors.primary200};
926
- color: ${({theme:t})=>t.colors.primary600};
927
- }
928
- }
929
- `,qr=({components:t})=>{const{componentLayouts:o}=ut();return e.createElement(F.k,{gap:2,overflow:"scroll hidden",padding:3},t.map(r=>e.createElement(Hc,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:r,padding:2,direction:"column",borderColor:"neutral200",as:vt.rU,to:`/content-manager/components/${r}/configurations/edit`},e.createElement(Yt,null),e.createElement(S.x,{paddingTop:1},e.createElement(Q.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},o?.[r]?.info?.displayName??"")))))};qr.propTypes={components:n().arrayOf(n().string).isRequired};var Qc=qr;const Nr=(0,j.ZP)(be.h)`
930
- background-color: transparent;
931
- path {
932
- fill: ${({theme:t})=>t.colors.neutral600};
933
- }
934
- `,fo=({attribute:t,onEditField:o,onDeleteField:r,children:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(S.x,{overflow:"hidden",width:"100%"},e.createElement(F.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},e.createElement(Q.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},s),e.createElement(F.k,null,e.createElement(Nr,{label:a({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:s}),onClick:o,icon:e.createElement(Ve.Z,null),noBorder:!0}),e.createElement(Nr,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:s}),"data-testid":"delete-field",onClick:r,icon:e.createElement(Ye.Z,null),noBorder:!0}))),t?.type==="component"&&e.createElement(Vc,{componentUid:t.component}),t?.type==="dynamiczone"&&e.createElement(Qc,{components:t.components}))};fo.defaultProps={attribute:void 0},fo.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),onEditField:n().func.isRequired,onDeleteField:n().func.isRequired,children:n().string.isRequired};var Gc=fo;const Kc=(0,j.ZP)(F.k)`
935
- position: relative;
936
- ${({isFirst:t,isLast:o,hasHorizontalPadding:r})=>t?`
937
- padding-right: 4px;
938
- `:o?`
939
- padding-left: 4px;
940
- `:r?`
941
- padding: 0 4px;
942
- `:""}
943
- ${({showRightCarret:t,showLeftCarret:o,theme:r})=>t?`
944
- &:after {
945
- content: '';
946
- position: absolute;
947
- right: -1px;
948
- background-color: ${r.colors.primary600};
949
- width: 2px;
950
- height: 100%;
951
- align-self: stretch;
952
- z-index: 1;
953
- }
954
- `:o?`
955
- &:before {
956
- content: '';
957
- position: absolute;
958
- left: -1px;
959
- background-color: ${r.colors.primary600};
960
- width: 2px;
961
- height: 100%;
962
- align-self: stretch;
963
- z-index: 1;
964
- }
965
- `:""};
966
- `,Yc=(0,j.ZP)(nt.Z)`
967
- height: ${12/16}rem;
968
- width: ${12/16}rem;
969
- path {
970
- fill: ${({theme:t})=>t.colors.neutral600};
971
- }
972
- `,Xc=(0,j.ZP)(F.k)`
973
- display: ${({dragStart:t})=>t?"none":"flex"};
974
- opacity: ${({isDragging:t,isFullSize:o,isHidden:r})=>t&&!o?.2:t&&o||r?0:1};
975
- `,Jc=(0,j.ZP)(F.k)`
976
- cursor: all-scroll;
977
- border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
978
- `,ho=({attribute:t,children:o,index:r,lastIndex:s,moveItem:a,moveRow:l,name:i,onDeleteField:c,onEditField:g,rowIndex:u,size:p})=>{const[f,m]=(0,e.useState)(!1),b=i==="_TEMP_",{setIsDraggingSibling:E}=ut(),v=p===12,k=(0,e.useRef)(null),R=(0,e.useRef)(null),[{clientOffset:T,isOver:w},D]=(0,sn.useDrop)({accept:h._Q.EDIT_FIELD,hover(q,U){if(!R.current||q.size!==12)return;const L=U.getItem().index,O=r,N=U.getItem().rowIndex,Y=u;if(L===O&&N===Y)return;const P=R.current.getBoundingClientRect(),Z=(P.bottom-P.top)/2,re=U.getClientOffset().y-P.top;N<Y&&re<Z||N>Y&&re>Z||(l(N,Y),q.rowIndex=Y,q.itemIndex=O)},drop(q,U){if(!R.current)return;const L=U.getItem().index,O=r,N=U.getItem().rowIndex,Y=u;if(q.size===12||L===O&&N===Y)return;const P=R.current.getBoundingClientRect();if(Math.abs(U.getClientOffset().x-P.left)>P.width/1.8){a(L,O+1,N,Y),q.itemIndex=O+1,q.rowIndex=Y;return}a(L,O,N,Y),q.itemIndex=O,q.rowIndex=Y},collect:q=>({canDrop:q.canDrop(),clientOffset:q.getClientOffset(),isOver:q.isOver(),isOverCurrent:q.isOver({shallow:!0}),itemType:q.getItemType()})}),[{isDragging:C,getItem:M},I,A]=(0,sn.useDrag)({type:h._Q.EDIT_FIELD,item(){return E(!0),{index:r,labelField:o,rowIndex:u,name:i,size:p}},canDrag(){return i!=="_TEMP_"},collect:q=>({isDragging:q.isDragging(),getItem:q.getItem()}),end(){E(!1)}});(0,e.useEffect)(()=>{A((0,wt.rX)(),{captureDraggingState:!0})},[A]);const B={dragRef:I(k),dropRef:D(R)};let $=!1,K=!1;if(R.current&&T){const q=R.current.getBoundingClientRect();$=w&&M.size!==12&&Math.abs(T.x-q.left)<q.width/2,K=w&&M.size!==12&&Math.abs(T.x-q.left)>q.width/2,i==="_TEMP_"&&($=w&&M.size!==12,K=!1)}const W=()=>t&&v?`${74/16}rem`:`${32/16}rem`,G=r===0&&!v,z=r===s&&!v,X=r!==0&&!v;return e.createElement(ge.P,{col:p},e.createElement(Kc,{ref:B.dropRef,showLeftCarret:$,showRightCarret:K,isFirst:G,isLast:z,hasHorizontalPadding:X,onDrag:()=>{v&&!f&&m(!0)},onDragEnd:()=>{v&&m(!1)}},f&&v&&e.createElement(S.x,{width:"100%",height:"2px",background:"primary600"}),e.createElement(Xc,{width:v&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:W(),alignItems:"stretch",isDragging:C,dragStart:f,isFullSize:v,isHidden:b},e.createElement(Jc,{as:"span",type:"button",ref:B.dragRef,onClick:q=>q.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},e.createElement(Yc,null)),!b&&e.createElement(Gc,{attribute:t,onEditField:g,onDeleteField:c},o))))};ho.defaultProps={attribute:void 0},ho.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),children:n().string.isRequired,index:n().number.isRequired,moveItem:n().func.isRequired,moveRow:n().func.isRequired,name:n().string.isRequired,onDeleteField:n().func.isRequired,onEditField:n().func.isRequired,rowIndex:n().number.isRequired,lastIndex:n().number.isRequired,size:n().number.isRequired};var _c=ho;const jr=({rowItem:t,onRemoveField:o,rowId:r,rowIndex:s,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:c,modifiedData:g,moveRow:u,moveItem:p}=ut(),f=x()(c,[t.name],{}),m=x()(g,["metadatas",t.name,"edit","label"],"");return e.createElement(_c,{onEditField:()=>i(t.name),onDeleteField:()=>o(r,a),attribute:f,index:a,lastIndex:l,rowIndex:s,name:t.name,size:t.size,moveRow:u,moveItem:p},m||t.name)};jr.propTypes={index:n().number.isRequired,lastIndex:n().number.isRequired,onRemoveField:n().func.isRequired,rowId:n().number.isRequired,rowIndex:n().number.isRequired,rowItem:n().object.isRequired};var ed=jr;const Wr=({row:t,onRemoveField:o,rowIndex:r})=>e.createElement(Ie.r,null,t.rowContent.map((s,a)=>e.createElement(ed,{key:s.name,rowItem:s,index:a,rowId:t.rowId,onRemoveField:o,rowIndex:r,lastIndex:t.rowContent.length-1})));Wr.propTypes={onRemoveField:n().func.isRequired,row:n().object.isRequired,rowIndex:n().number.isRequired};var td=Wr;const nd=[{action:"plugin::content-type-builder.read",subject:null}];var od=()=>{const{trackUsage:t}=(0,y.rS)(),{formatMessage:o}=(0,V.Z)(),{slug:r,modifiedData:s,isContentTypeView:a}=ut(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,c=x()(s,"category",""),g=l==="content-types"?r:`${c}/${r}`,u=()=>{t("willEditEditLayout")};return r==="strapi::administrator"?null:e.createElement(y.jW,{permissions:nd},e.createElement(y.Qj,{to:`${i}/${g}`,onClick:u,size:"S",startIcon:e.createElement(Ve.Z,null),variant:"secondary"},o({id:(0,ve.Z)(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))};const zr=({editLayout:t,fields:o,onRemoveField:r,onAddField:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(F.k,{justifyContent:"space-between"},e.createElement("div",null,e.createElement(S.x,null,e.createElement(Q.Z,{fontWeight:"bold"},a({id:(0,h.OB)("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),e.createElement(S.x,null,e.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),e.createElement(od,null)),e.createElement(S.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},t.map((l,i)=>e.createElement(td,{key:l.rowId,row:l,rowIndex:i,onRemoveField:r})),e.createElement(Ge.O,{id:"label",label:a({id:(0,h.OB)("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:ce.z,"data-testid":"add-field",fullWidth:!0,startIcon:e.createElement(At.Z,null),endIcon:null,variant:"secondary",disabled:o.length===0},o.map(l=>e.createElement(Ge.s,{key:l,onClick:()=>s(l)},l))))))};zr.propTypes={editLayout:n().array.isRequired,fields:n().array.isRequired,onAddField:n().func.isRequired,onRemoveField:n().func.isRequired};var rd=zr,Ur=d(85025),Vr=d(55225),Hr=d(31600),Qr=d(11406),$t=d(32031),sd=d(73779),an=d(88675),ad=d(22348),Gr=d(7184),yo=d(43475),id=d(82512),bo=d(83218),ld=d(872),cd=d(17757),dd=d(1176),ud=d(15431);const Kr={biginteger:e.createElement($t.Z,null),boolean:e.createElement(sd.Z,null),date:e.createElement(an.Z,null),datetime:e.createElement(an.Z,null),decimal:e.createElement($t.Z,null),email:e.createElement(ad.Z,null),enum:e.createElement(Gr.Z,null),enumeration:e.createElement(Gr.Z,null),file:e.createElement(yo.Z,null),files:e.createElement(yo.Z,null),float:e.createElement($t.Z,null),integer:e.createElement($t.Z,null),media:e.createElement(yo.Z,null),number:e.createElement($t.Z,null),relation:e.createElement(id.Z,null),string:e.createElement(bo.Z,null),text:e.createElement(bo.Z,null),richtext:e.createElement(bo.Z,null),time:e.createElement(an.Z,null),timestamp:e.createElement(an.Z,null),json:e.createElement(ld.Z,null),uid:e.createElement(cd.Z,null),component:e.createElement(dd.Z,null),dynamiczone:e.createElement(ud.Z,null)},Eo=({type:t,customFieldUid:o})=>{const r=(0,y.mZ)();let s=Kr[t];if(o){const l=r.get(o).icon;l&&(s=e.createElement(S.x,{marginRight:3,width:7,height:6},e.createElement(l,null)))}return Kr[t]?s:null};Eo.defaultProps={customFieldUid:null},Eo.propTypes={type:n().string.isRequired,customFieldUid:n().string};var Yr=Eo,md=t=>t.reduce((o,r)=>{const s=r?.attributes??{},a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes(s?.[l]?.type??""));return o[r.uid]=a,o},{}),Xr=t=>{let o;switch(t){case"description":case"label":case"placeholder":o="text";break;case"mainField":o="select";break;case"editable":o="bool";break;default:o=""}const r=t==="mainField"?(0,h.OB)("containers.SettingPage.editSettings.entry.title"):(0,h.OB)(`form.Input.${t}`);return{type:o,label:{id:r}}},Ct=d(42882),Zt=d(9139);const vo=({type:t,options:o,onChange:r,value:s,name:a,...l})=>{const{formatMessage:i}=(0,V.Z)();switch(t){case"text":return e.createElement(Dn.o,{onChange:r,value:s,name:a,...l});case"bool":return e.createElement(Zt.s,{onChange:c=>{r({target:{name:a,value:c.target.checked}})},checked:s,name:a,onLabel:i({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:i({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),...l});case"select":return e.createElement(He.P,{value:s,name:a,onChange:c=>r({target:{name:a,value:c}}),...l},o.map(c=>e.createElement(Ee.W,{key:c,value:c},c)));default:return null}};vo.defaultProps={options:void 0},vo.propTypes={type:n().string.isRequired,options:n().arrayOf(n().string),onChange:n().func.isRequired,value:n().oneOfType([n().string,n().bool]).isRequired,name:n().string.isRequired};var pd=vo;const gd=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],fd=[1,5,10,15,30,60],hd=["datetime","time"],Jr=({onMetaChange:t,onSizeChange:o})=>{const{formatMessage:r}=(0,V.Z)(),{modifiedData:s,selectedField:a,attributes:l,fieldForm:i}=ut(),c=(0,e.useMemo)(Ct.Vo,[]),{schemas:g}=(0,J.v9)(D=>c(D),J.wU),u=(0,J.v9)(Ct.Jg),p=(0,e.useMemo)(()=>{if(!a)return[];const D=x()(s,["metadatas",a,"edit"],{});return Object.keys(D).filter(C=>C!=="visible")},[a,s]),f=(0,e.useMemo)(()=>md(g),[g]),m=(0,e.useCallback)(D=>{if(D!=="relation"&&D!=="component")return[];const C=D==="component"?"component":"targetModel",M=x()(s,["attributes",a,C],"");return x()(f,[M],[])},[a,f,s]),b=p.map(D=>{const C=x()(l,[a,"type"]);return["component","dynamiczone"].includes(C)&&!["label","description"].includes(D)||C==="component"&&D!=="label"||["media","json","boolean"].includes(C)&&D==="placeholder"||D==="step"?null:e.createElement(ge.P,{col:6,key:D},e.createElement(pd,{type:Xr(D).type,hint:D==="mainField"?r({id:(0,ve.Z)("containers.SettingPage.editSettings.relation-field.description")}):"",label:r({id:x()(Xr(D),"label.id","app.utils.defaultMessage")}),name:D,onChange:t,value:x()(i,["metadata",D],""),options:m(C)}))}),{type:E,customField:v}=l[a],{isResizable:k}=u[v]??u[E],R=e.createElement(ge.P,{col:6,key:"size"},e.createElement(He.P,{value:i?.size,name:"size",onChange:D=>{o({name:a,value:D})},label:r({id:(0,ve.Z)("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},gd.map(([D,C])=>e.createElement(Ee.W,{key:D,value:D},C)))),T=hd.includes(l[a].type),w=e.createElement(ge.P,{col:6,key:"step"},e.createElement(He.P,{value:x()(i,["metadata","step"],1),name:"step",onChange:D=>t({target:{name:"step",value:D}}),label:r({id:(0,ve.Z)("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},fd.map(D=>e.createElement(Ee.W,{key:D,value:D},D))));return e.createElement(e.Fragment,null,b,k&&R,T&&w)};Jr.propTypes={onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired};var yd=Jr;const bd=(0,j.ZP)(F.k)`
979
- svg {
980
- width: ${32/16}rem;
981
- height: ${24/16}rem;
982
- margin-right: ${({theme:t})=>t.spaces[3]};
983
- }
984
- `,Co=({onToggle:t,onMetaChange:o,onSizeChange:r,onSubmit:s,type:a,customFieldUid:l})=>{const{selectedField:i}=ut(),{formatMessage:c}=(0,V.Z)(),g=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return e.createElement(Ur.P,{onClose:t,labelledBy:"title"},e.createElement("form",{onSubmit:s},e.createElement(Vr.x,null,e.createElement(bd,null,e.createElement(Yr,{type:g(),customFieldUid:l}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:St()(i)})))),e.createElement(Hr.f,null,e.createElement(Ie.r,{gap:4},e.createElement(yd,{onMetaChange:o,onSizeChange:r}))),e.createElement(Qr.m,{startActions:e.createElement(ce.z,{onClick:t,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(ce.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Co.defaultProps={customFieldUid:null},Co.propTypes={customFieldUid:n().string,onSubmit:n().func.isRequired,onToggle:n().func.isRequired,onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired,type:n().string.isRequired};var Ed=Co,vd=(t,o,r)=>{const{put:s}=(0,y.tg)();return s((0,h.IF)(r?`content-types/${o}/configuration`:`components/${o}/configuration`),t)};const Ro=({mainLayout:t,components:o,isContentTypeView:r,slug:s,updateLayout:a})=>{const[l,i]=(0,e.useReducer)(zc,po,()=>Uc(po,t,o)),[c,g]=(0,e.useState)(!1),{trackUsage:u}=(0,y.rS)(),p=(0,y.lm)(),{goBack:f}=(0,te.k6)(),[m,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(!1),{componentLayouts:k,initialData:R,modifiedData:T,metaToEdit:w,metaForm:D}=l,{formatMessage:C}=(0,V.Z)(),M=x()(t,["info","displayName"],""),I=x()(T,["attributes"],{}),A=(0,J.v9)(Ct.Jg),B=Object.keys(I).filter(H=>{const ae=x()(I,[H,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(ae)&&!!ae}),$=x()(T,["layouts","edit"],[]),K=wr()($,"rowContent"),W=Object.keys(T.attributes).filter(H=>x()(T,["metadatas",H,"edit","visible"],!1)===!0).filter(H=>K.findIndex(ae=>ae.name===H)===-1).sort(),G=({target:{name:H,value:ae}})=>{i({type:"ON_CHANGE",keys:H.split("."),value:ae})},z=()=>{b(H=>!H)},X=()=>{v(H=>!H)},q=({target:{name:H,value:ae}})=>{i({type:"ON_CHANGE_META",keys:H.split("."),value:ae})},U=({name:H,value:ae})=>{i({type:"ON_CHANGE_SIZE",name:H,value:ae})},L=H=>{H.preventDefault(),i({type:"SUBMIT_META_FORM"}),z()},O=H=>{H.preventDefault(),X()},N=(0,Xe.useMutation)(H=>vd(H,s,r),{onSuccess({data:H}){a&&a(H.data),i({type:"SUBMIT_SUCCEEDED"}),X(),u("didEditEditSettings")},onError(){p({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=N,P=()=>{const H=In()(Je()(T),["layouts","metadatas","settings"]);se()(H,"layouts.edit",Nc(H.layouts.edit)),N.mutate(H)},Z=(H,ae)=>{i({type:"MOVE_RELATION",fromIndex:H,toIndex:ae})},oe=(H,ae)=>{i({type:"MOVE_FIELD",fromIndex:H,toIndex:ae})},re=(H,ae,Pe,Ne)=>{i(Pe===Ne?{type:"REORDER_ROW",dragRowIndex:Pe,dragIndex:H,hoverIndex:ae}:{type:"REORDER_DIFF_ROW",dragIndex:H,hoverIndex:ae,dragRowIndex:Pe,hoverRowIndex:Ne})},me=(H,ae)=>{i({type:"MOVE_ROW",fromIndex:H,toIndex:ae})};return e.createElement(go,{isContentTypeView:r,attributes:I,modifiedData:T,slug:s,componentLayouts:k,selectedField:w,fieldForm:D,onMoveRelation:Z,onMoveField:oe,moveRow:me,moveItem:re,setEditFieldToSelect:H=>{i({type:"SET_FIELD_TO_EDIT",name:H}),z()},isDraggingSibling:c,setIsDraggingSibling:g},e.createElement(De.o,null,e.createElement("form",{onSubmit:O},e.createElement(he.T,{title:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${St()(M)}`},{name:St()(M)}),subtitle:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),onClick:H=>{H.preventDefault(),f()},to:"/"},C({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(ce.z,{disabled:Ce()(R,T),startIcon:e.createElement(st.Z,null),type:"submit"},C({id:"global.save",defaultMessage:"Save"}))}),e.createElement(We.D,null,e.createElement(S.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},C({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(Ie.r,null,e.createElement(ge.P,{col:6,s:12},e.createElement(He.P,{label:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:H=>{G({target:{name:"settings.mainField",value:H===""?null:H}})},value:T.settings.mainField},B.map(H=>e.createElement(Ee.W,{key:H,value:H},H))))),e.createElement(S.x,{paddingTop:2,paddingBottom:2},e.createElement(Ar.i,null)),e.createElement(Q.Z,{variant:"delta",as:"h3"},C({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(rd,{attributes:I,editLayout:$,fields:W,onAddField:H=>{i({type:"ON_ADD_FIELD",name:H,fieldSizes:A})},onRemoveField:(H,ae)=>{i({type:"REMOVE_FIELD",rowIndex:H,fieldIndex:ae})}})))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(st.Z,null),isConfirmButtonLoading:Y,isOpen:E,onToggleDialog:X,onConfirm:P,variantRightButton:"success-light"})),m&&e.createElement(Ed,{onSubmit:L,onToggle:z,onMetaChange:q,onSizeChange:U,type:x()(I,[w,"type"],""),customFieldUid:x()(I,[w,"customField"],"")})))};Ro.defaultProps={isContentTypeView:!1,updateLayout:null},Ro.propTypes={components:n().object.isRequired,isContentTypeView:n().bool,mainLayout:n().shape({attributes:n().object.isRequired,info:n().object.isRequired,layouts:n().shape({list:n().array.isRequired,edit:n().array.isRequired}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired}).isRequired,slug:n().string.isRequired,updateLayout:n().func};var Mo=Ro,Rt=d(37617);const Cd=()=>({type:Rt.ZA}),Rd=(t,o)=>({type:Rt.Id,pagination:t,data:o}),Md=()=>({type:Rt.MP});function Td(){return{type:Rt.c2}}const Dd=({components:t,contentType:o})=>{const{layouts:r}=o;return{contentType:o,components:t,displayedHeaders:r.list,type:Rt.Zz}},To=t=>({type:Rt.Rp,target:t});var _r=d(6680),Do=d(7395),es=d(99223),kd=d(70664);const ts=()=>t=>t["content-manager_listView"]||kd.E,Id=()=>(0,io.P1)(ts(),t=>t),ns=t=>{const{displayedHeaders:o}=t["content-manager_listView"];return o};var Pd=Id,Od=d(35658),wd=d(94547),ko=d(19786),xd=d(82884),Fd=d(47765),Ld=d(8997),Ad=d(69033);const Sd=(0,j.ZP)(F.k)`
985
- position: relative;
986
- border-radius: 50%;
987
- width: 26px;
988
- height: 26px;
989
- border: 1px solid ${({theme:t})=>t.colors.neutral200};
990
- background: ${({theme:t})=>t.colors.neutral150};
991
- padding-left: 1px;
992
-
993
- span {
994
- line-height: 0.6rem;
995
- font-size: 0.6rem;
996
- }
997
- `,os=({children:t,...o})=>e.createElement(Sd,{justifyContent:"center",alignItems:"center",as:"span",...o},e.createElement(Q.Z,{variant:"sigma",textColor:"neutral600"},t));os.propTypes={children:n().string.isRequired};var rs=os;const Io=({url:t,mime:o,alternativeText:r,name:s,ext:a,formats:l})=>{const i=(0,y.CR)(t);if(o.includes("image")){const u=l?.thumbnail?.url||null,p=(0,y.CR)(u)||i;return e.createElement(Ad.q,{src:p,alt:r||s,preview:!0})}const c=(0,y.mD)(a),g=s.length>100?`${s.substring(0,100)}...`:s;return e.createElement(Ut.u,{description:g},e.createElement(rs,null,c))};Io.defaultProps={alternativeText:null,formats:null},Io.propTypes={alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired};var ss=Io,$d=d(25898);const as=({value:t})=>e.createElement($d.H,null,t.map((o,r)=>{const s=`${o.id}${r}`;if(r===3){const a=`+${t.length-3}`;return e.createElement(rs,{key:s,preview:!1},a)}return r>3?null:e.createElement(ss,{key:s,...o})}));as.propTypes={value:n().arrayOf(n().shape({alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired})).isRequired};var Zd=as,is=d(6518),Bd=d(23866),qd=d(96315);const ls=({type:t,value:o})=>{const{formatDate:r,formatTime:s,formatNumber:a}=(0,V.Z)();let l=o;if(t==="date"&&(l=r((0,qd.Z)(o),{dateStyle:"full"})),t==="datetime"&&(l=r(o,{dateStyle:"full",timeStyle:"short"})),t==="time"){const[i,c,g]=o.split(":"),u=new Date;u.setHours(i),u.setMinutes(c),u.setSeconds(g),l=s(u,{numeric:"auto",style:"short"})}return["float","decimal"].includes(t)&&(l=a(o,{maximumFractionDigits:20})),["integer","biginteger"].includes(t)&&(l=a(o,{maximumFractionDigits:0})),br()(l)};ls.propTypes={type:n().string.isRequired,value:n().any.isRequired};var Mt=ls;const Nd=(0,j.ZP)(Q.Z)`
998
- max-width: 500px;
999
- `,jd=async(t,o,r)=>{const{data:{results:s,pagination:a}}=await r(t);return o(),{results:s,pagination:a}},cs=({fieldSchema:t,metadatas:o,name:r,entityId:s,value:a,contentType:l})=>{const{formatMessage:i}=(0,V.Z)(),{notifyStatus:c}=(0,Do.G)(),g=(0,e.useMemo)(()=>(0,h.IF)(`relations/${l.uid}/${s}/${r.split(".")[0]}`),[s,r,l]),[u,p]=(0,e.useState)(!1),{get:f}=(0,y.kY)(),m=e.createElement(F.k,{gap:1,wrap:"nowrap"},e.createElement(is.C,null,a.count),i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:a.count})),b=()=>{const k=i({id:(0,h.OB)("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});c(k)},{data:E,status:v}=(0,Xe.useQuery)([t.targetModel,s],()=>jd(g,b,f),{enabled:u,staleTime:0,select:k=>({...k,results:[...k.results].reverse()})});return e.createElement(S.x,{...y.UW},e.createElement(Ge.O,{label:m,size:"S",onOpen:()=>p(!0),onClose:()=>p(!1)},v!=="success"&&e.createElement(Ge.s,{"aria-disabled":!0},e.createElement(Bd.a,{small:!0},i({id:(0,h.OB)("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),v==="success"&&e.createElement(e.Fragment,null,E?.results.map(k=>e.createElement(Ge.s,{key:k.id,"aria-disabled":!0},e.createElement(Nd,{ellipsis:!0},e.createElement(Mt,{type:o.mainField.schema.type,value:k[o.mainField.name]||k.id})))),E?.pagination.total>10&&e.createElement(Ge.s,{"aria-disabled":!0,"aria-label":i({id:(0,h.OB)("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},e.createElement(Q.Z,null,"\u2026")))))};cs.propTypes={contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({relation:n().string,targetModel:n().string,type:n().string.isRequired}).isRequired,metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,name:n().string.isRequired,entityId:n().oneOfType([n().string,n().number]).isRequired,value:n().object.isRequired};var Wd=cs;const zd=(0,j.ZP)(Q.Z)`
1000
- max-width: 500px;
1001
- `,ds=({metadatas:t,value:o})=>e.createElement(zd,{textColor:"neutral800",ellipsis:!0},e.createElement(Mt,{type:t.mainField.schema.type,value:o[t.mainField.name]??o.id}));ds.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,value:n().object.isRequired};var Ud=ds;const Vd=(0,j.ZP)(Q.Z)`
1002
- max-width: 500px;
1003
- `,us=({value:t,metadatas:o})=>{const{formatMessage:r}=(0,V.Z)(),{mainField:{type:s,name:a}}=o,l=e.createElement(e.Fragment,null,e.createElement(is.C,null,t.length)," ",r({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:t.length}));return e.createElement(S.x,{...y.UW},e.createElement(Ge.O,{label:l,size:"S"},t.map(i=>e.createElement(Ge.s,{key:i.id,"aria-disabled":!0},e.createElement(Vd,{ellipsis:!0},e.createElement(Mt,{type:s,value:i[a]||i.id}))))))};us.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().array.isRequired};var Hd=us;const Qd=(0,j.ZP)(Q.Z)`
1004
- max-width: 250px;
1005
- `,ms=({value:t,metadatas:o})=>{const{mainField:r}=o,s=t[r.name];return e.createElement(Ut.u,{label:s},e.createElement(Qd,{textColor:"neutral800",ellipsis:!0},e.createElement(Mt,{type:r.type,value:s})))};ms.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().object.isRequired};var Gd=ms,Kd=d(80022),ps=d.n(Kd);function gs(t){return["oneToOne","manyToOne","oneToOneMorph"].includes(t)}var fs=d(82293);function Yd(t,o,r,s){if(t==="component"){const{mainField:{name:a,type:l}}=r;if(s?.repeatable)return o.length>0;const i=o?.[a];return a==="id"&&![void 0,null].includes(i)?!0:(0,fs.Z)(l)&&l!=="biginteger"&&a!=="id"?ps()(i):!qe()(i)}return t==="relation"?gs(s.relation)?!qe()(o):o?.count>0:(0,fs.Z)(t)&&t!=="biginteger"?ps()(o):t==="boolean"?o!==null:!qe()(o)}const hs=(0,j.ZP)(Q.Z)`
1006
- max-width: 300px;
1007
- `,Po=({content:t,fieldSchema:o,metadatas:r,name:s,rowId:a,contentType:l})=>{const{type:i}=o;if(!Yd(i,t,r,o))return e.createElement(Q.Z,{textColor:"neutral800"},"-");switch(i){case"media":return o.multiple?e.createElement(Zd,{value:t}):e.createElement(ss,{...t});case"relation":return gs(o.relation)?e.createElement(Ud,{metadatas:r,value:t}):e.createElement(Wd,{fieldSchema:o,metadatas:r,value:t,name:s,entityId:a,contentType:l});case"component":return o.repeatable===!0?e.createElement(Hd,{value:t,metadatas:r}):e.createElement(Gd,{value:t,metadatas:r});case"string":return e.createElement(Ut.u,{description:t},e.createElement(hs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Mt,{type:i,value:t})));default:return e.createElement(hs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Mt,{type:i,value:t}))}};Po.defaultProps={content:void 0},Po.propTypes={content:n().any,contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({component:n().string,multiple:n().bool,type:n().string.isRequired,repeatable:n().bool,relation:n().string}).isRequired,metadatas:n().object.isRequired,name:n().string.isRequired,rowId:n().oneOfType([n().string,n().number]).isRequired};var Xd=Po;const Oo=({canCreate:t,canDelete:o,contentType:r,headers:s,entriesToDelete:a,onClickDelete:l,onSelectRow:i,withMainAction:c,withBulkActions:g,rows:u})=>{const{push:p,location:{pathname:f}}=(0,te.k6)(),{formatMessage:m}=(0,V.Z)(),{trackUsage:b}=(0,y.rS)(),E=(0,pe.fi)();return e.createElement(Od.p,null,u.map((v,k)=>{const R=a.findIndex(w=>w===v.id)!==-1,T=m({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:k});return e.createElement(wd.Tr,{key:v.id,...(0,y.X7)({fn(){b("willEditEntryFromList"),p({pathname:`${f}/${v.id}`,state:{from:f},search:E})},condition:g})},c&&e.createElement(ko.Td,{...y.UW},e.createElement(xd.C,{"aria-label":m({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,Ld.Pp)(v.firstname,v.lastname)}),checked:R,onChange:()=>{i({name:v.id,value:!R})}})),s.map(({key:w,cellFormatter:D,name:C,...M})=>e.createElement(ko.Td,{key:w},typeof D=="function"?D(v,{key:w,name:C,...M}):e.createElement(Xd,{content:v[C.split(".")[0]],name:C,contentType:r,...M,rowId:v.id}))),g&&e.createElement(ko.Td,null,e.createElement(F.k,{justifyContent:"end",...y.UW},e.createElement(be.h,{forwardedAs:vt.rU,onClick:()=>{b("willEditEntryFromButton")},to:{pathname:`${f}/${v.id}`,state:{from:f},search:E},label:m({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:T}),noBorder:!0,icon:e.createElement(Ve.Z,null)}),t&&e.createElement(S.x,{paddingLeft:1},e.createElement(be.h,{forwardedAs:vt.rU,to:{pathname:`${f}/create/clone/${v.id}`,state:{from:f},search:E},label:m({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:T}),noBorder:!0,icon:e.createElement(Fd.Z,null)})),o&&e.createElement(S.x,{paddingLeft:1},e.createElement(be.h,{onClick:()=>{b("willDeleteEntryFromList"),l(v.id)},label:m({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:T}),noBorder:!0,icon:e.createElement(Ye.Z,null)})))))}))};Oo.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},Oo.propTypes={canCreate:n().bool,canDelete:n().bool,contentType:n().shape({uid:n().string.isRequired}).isRequired,entriesToDelete:n().array,headers:n().array.isRequired,onClickDelete:n().func,onSelectRow:n().func,rows:n().array,withBulkActions:n().bool,withMainAction:n().bool};var Jd=Oo;const ys=({area:t,...o})=>{const r=jt(t);return r?e.createElement("ul",null,r.map(s=>s.Component(o)?e.createElement(S.x,{key:s.name,padding:3,style:{textAlign:"center"}},e.createElement(s.Component,{...o})):null)):null};ys.propTypes={area:n().string.isRequired};var ln=ys;const bs=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(tn.V,{onClose:r,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(F.k,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),e.createElement(F.k,null,e.createElement(ln,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:r,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(ce.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Ye.Z,null),id:"confirm-delete",loading:t},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};bs.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};var _d=bs;function Es({isPublished:t}){const{formatMessage:o}=(0,V.Z)(),r=t?"success":"secondary";return e.createElement(Pn.q,{showBullet:!1,variant:r,size:"S",width:"min-content"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${r}700`},o({id:(0,h.OB)(`containers.List.${t?"published":"draft"}`),defaultMessage:t?"Published":"Draft"})))}Es.propTypes={isPublished:n().bool.isRequired};const cn=({onToggleDialog:t,isOpen:o,dialogBody:r,endAction:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(tn.V,{onClose:t,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(nn.a,{icon:e.createElement(Ft.Z,null)},e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:2},r)),e.createElement(on.c,{startAction:e.createElement(ce.z,{onClick:t,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:s}))};cn.propTypes={isOpen:n().bool.isRequired,onToggleDialog:n().func.isRequired,dialogBody:n().node.isRequired,endAction:n().node.isRequired};const wo={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired},vs=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(cn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.publish.all"),defaultMessage:"Are you sure you want to publish these entries?"})),e.createElement(ln,{area:"contentManager.listView.publishModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"secondary",startIcon:e.createElement(st.Z,null),loading:r},a({id:"app.utils.publish",defaultMessage:"Publish"}))})};vs.propTypes=wo;const Cs=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(cn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.unpublish.all"),defaultMessage:"Are you sure you want to unpublish these entries?"})),e.createElement(ln,{area:"contentManager.listView.unpublishModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"secondary",startIcon:e.createElement(st.Z,null),loading:r},a({id:"app.utils.unpublish",defaultMessage:"Unpublish"}))})};Cs.propTypes=wo;const Rs=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:s})=>{const{formatMessage:a}=(0,V.Z)();return e.createElement(cn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(Q.Z,{id:"confirm-description",textAlign:"center"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"})),e.createElement(ln,{area:"contentManager.listView.deleteModalAdditionalInfos"})),endAction:e.createElement(ce.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Ye.Z,null),id:"confirm-delete",loading:r},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))})};Rs.propTypes=wo;const xo=({showPublish:t,showDelete:o,onConfirmDeleteAll:r,onConfirmPublishAll:s,onConfirmUnpublishAll:a,selectedEntries:l,clearSelectedEntries:i})=>{const{formatMessage:c}=(0,V.Z)(),{trackUsage:g}=(0,y.rS)(),{data:u}=(0,J.v9)(ts()),[p,f]=(0,e.useState)(!1),[m,b]=(0,e.useState)(null),E=u.filter(A=>l.includes(A.id)),v=t&&E.some(A=>!A.publishedAt),k=t&&E.some(A=>A.publishedAt),R=()=>{m==="delete"?b(null):(b("delete"),g("willBulkDeleteEntries"))},T=()=>{m==="publish"?b(null):(b("publish"),g("willBulkPublishEntries"))},w=()=>{m==="unpublish"?b(null):(b("unpublish"),g("willBulkUnpublishEntries"))},D=async(A,B)=>{try{f(!0),await A(l),f(!1),B(),i()}catch{f(!1),B()}},C=()=>D(r,R),M=()=>D(s,T),I=()=>D(a,w);return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"tertiary",onClick:T},c({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(vs,{isOpen:m==="publish",onToggleDialog:T,isConfirmButtonLoading:p,onConfirm:M})),k&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"tertiary",onClick:w},c({id:"app.utils.unpublish",defaultMessage:"Unpublish"})),e.createElement(Cs,{isOpen:m==="unpublish",onToggleDialog:w,isConfirmButtonLoading:p,onConfirm:I})),o&&e.createElement(e.Fragment,null,e.createElement(ce.z,{variant:"danger-light",onClick:R},c({id:"global.delete",defaultMessage:"Delete"})),e.createElement(Rs,{isOpen:m==="delete",onToggleDialog:R,isConfirmButtonLoading:p,onConfirm:C})))};xo.defaultProps={showPublish:!1,showDelete:!1,onConfirmDeleteAll(){},onConfirmPublishAll(){},onConfirmUnpublishAll(){}},xo.propTypes={showPublish:n().bool,showDelete:n().bool,onConfirmDeleteAll:n().func,onConfirmPublishAll:n().func,onConfirmUnpublishAll:n().func,selectedEntries:n().array.isRequired,clearSelectedEntries:n().func.isRequired};var eu=xo;const tu=(()=>window&&window.strapi&&window.strapi.isEE?d(57047).Z:d(42814).Z)(),Fo=t=>{let{canCreate:o,canDelete:r,canPublish:s,contentTypeName:a,action:l,isBulkable:i,isLoading:c,onConfirmDelete:g,onConfirmDeleteAll:u,onConfirmPublishAll:p,onConfirmUnpublishAll:f,layout:m,rows:b}=t;const{runHookWaterfall:E}=(0,y.j1)(),v=m.contentType.options?.draftAndPublish??!1,{formatMessage:k}=(0,V.Z)(),R=(0,J.v9)(ns),T=(0,e.useMemo)(()=>{const D=E(je.No,{displayedHeaders:R,layout:m}).displayedHeaders.map(M=>{const{fieldSchema:I,metadatas:A,name:B}=M;return{...M,metadatas:{...A,label:k({id:(0,h.OB)(`containers.ListPage.table-headers.${B}`),defaultMessage:A.label})},name:I.type==="relation"?`${B}.${A.mainField.name}`:B}});v&&D.push({key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:k({id:(0,h.OB)("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(M){let{publishedAt:I}=M;return e.createElement(Es,{isPublished:!!I})}});const C=tu(m);return C&&D.push(C),D},[E,R,m,v,k]);return e.createElement(y.tM,{components:{ConfirmDialogDelete:_d},contentType:a,action:l,isLoading:c,headers:T,onConfirmDelete:g,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:b,withBulkActions:!0,withMainAction:(r||s)&&i,renderBulkActionsBar:w=>{let{selectedEntries:D,clearSelectedEntries:C}=w;return e.createElement(eu,{showPublish:s&&v,showDelete:r,onConfirmDeleteAll:u,onConfirmPublishAll:p,onConfirmUnpublishAll:f,selectedEntries:D,clearSelectedEntries:C})}},e.createElement(Jd,{canCreate:o,canDelete:r,contentType:m.contentType,headers:T,rows:b,withBulkActions:!0,withMainAction:r&&i}))};Fo.defaultProps={action:void 0},Fo.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canPublish:n().bool.isRequired,contentTypeName:n().string.isRequired,action:n().node,isBulkable:n().bool.isRequired,isLoading:n().bool.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,onConfirmDelete:n().func.isRequired,onConfirmDeleteAll:n().func.isRequired,onConfirmPublishAll:n().func.isRequired,onConfirmUnpublishAll:n().func.isRequired,rows:n().array.isRequired};var nu=Fo;const ou=["json","component","media","richtext","dynamiczone","password"],ru=["createdAt","updatedAt"];var su=(t,o)=>{const{allPermissions:r}=(0,y.vn)(),s=(0,y.ZT)(r,[{action:"plugin::content-manager.explorer.read",subject:o}]),a=x()(s,["0","properties","fields"],[]);return Object.keys(x()(t,["attributes"]),{}).filter(c=>{const g=x()(t,["attributes",c],{});return!(!g.type||ou.includes(g.type)||!a.includes(c)&&c!=="id"&&!ru.includes(c))}).sort()},au=d(5644);const Ms=({displayedFilters:t})=>{const[o,r]=(0,e.useState)(!1),{formatMessage:s}=(0,V.Z)(),a=(0,e.useRef)(),{trackUsage:l}=(0,y.rS)(),i=()=>{o||l("willFilterEntries"),r(c=>!c)};return e.createElement(e.Fragment,null,e.createElement(S.x,{paddingTop:1,paddingBottom:1},e.createElement(ce.z,{variant:"tertiary",ref:a,startIcon:e.createElement(au.Z,null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),o&&e.createElement(y.J5,{displayedFilters:t,isVisible:o,onToggle:i,source:a})),e.createElement(y.W$,{filtersSchema:t}))};Ms.propTypes={displayedFilters:n().arrayOf(n().shape({name:n().string.isRequired,metadatas:n().shape({label:n().string}),fieldSchema:n().shape({type:n().string})})).isRequired};var iu=Ms;const Ts=({contentType:t,slug:o,metadatas:r})=>{const{formatMessage:s}=(0,V.Z)(),l=su(t,o).map(i=>{const c=t.attributes[i],{type:g,enum:u}=c,p={name:"didFilterEntries",properties:{useRelation:g==="relation"}},{mainField:f,label:m}=r[i].list;return{name:i,metadatas:{label:s({id:m,defaultMessage:m})},fieldSchema:{type:g,options:u,mainField:f},trackedEvent:p}});return e.createElement(iu,{displayedFilters:l})};Ts.propTypes={contentType:n().object.isRequired,metadatas:n().object.isRequired,slug:n().string.isRequired};var lu=Ts,cu=t=>Object.keys(t).reduce((r,s)=>{const a=t[s];return(0,h.ko)(a)&&r.push(s),r},[]).sort();const Ds=({layout:t})=>{const o=(0,J.I0)(),r=(0,J.v9)(ns),{trackUsage:s}=(0,y.rS)(),{formatMessage:a}=(0,V.Z)(),l=cu(t.contentType.attributes).map(g=>{const u=t.contentType.metadatas[g].list;return{name:g,intlLabel:{id:u.label,defaultMessage:u.label}}}),i=r.map(({name:g})=>g),c=g=>{if(s("didChangeDisplayedFields"),g.length<i.length){const u=i.filter(p=>g.indexOf(p)===-1);o(To({name:u[0],value:!0}))}else{const u=g.filter(p=>i.indexOf(p)===-1);o(To({name:u[0],value:!1}))}};return e.createElement(S.x,{paddingTop:1,paddingBottom:1},e.createElement(He.P,{"aria-label":"change displayed fields",value:i,onChange:c,customizeContent:g=>a({id:(0,ve.Z)("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:g.length}),multi:!0,size:"S"},l.map(g=>e.createElement(Ee.W,{key:g.name,value:g.name},a({id:g.intlLabel.id||g.name,defaultMessage:g.intlLabel.defaultMessage||g.name})))))};Ds.propTypes={layout:n().shape({contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired};var du=(0,e.memo)(Ds);const Lo=({pagination:t})=>e.createElement(S.x,{paddingTop:4},e.createElement(F.k,{alignItems:"flex-end",justifyContent:"space-between"},e.createElement(y.v4,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),e.createElement(y.tU,{pagination:t})));Lo.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},Lo.propTypes={pagination:n().shape({page:n().number,pageCount:n().number,pageSize:n().number,total:n().number})};var uu=Lo;const mu=we.Z.contentManager,pu=(0,j.ZP)(S.x)`
1008
- svg {
1009
- path {
1010
- fill: ${({theme:t})=>t.colors.neutral900};
1011
- }
1012
- }
1013
- `;function ks({canCreate:t,canDelete:o,canRead:r,canPublish:s,data:a,getData:l,getDataSucceeded:i,isLoading:c,layout:g,pagination:u,slug:p}){const{total:f}=u,{contentType:m}=g,{metadatas:b,settings:{bulkable:E,filterable:v,searchable:k}}=m,R=(0,y.lm)(),{trackUsage:T}=(0,y.rS)(),{refetchPermissions:w}=(0,y.vn)(),D=(0,e.useRef)(T),C=(0,e.useRef)(w),{notifyStatus:M}=(0,Do.G)(),{formatAPIError:I}=(0,y.So)(h.OB);(0,y.go)();const[{query:A}]=(0,y.Kx)(),B=Dr(A),$=(0,_t.stringify)({plugins:A.plugins},{encode:!1}),{pathname:K}=(0,te.TH)(),{push:W}=(0,te.k6)(),{formatMessage:G}=(0,V.Z)(),z=m.options?.draftAndPublish??!1,X=(0,y.kY)(),{post:q,del:U}=X,L=(0,Xe.useMutation)(de=>q(`/content-manager/collection-types/${m.uid}/actions/bulkPublish`,de),{onSuccess(){R({type:"success",message:{id:"content-manager.success.record.publish",defaultMessage:"Published"}}),Y(`/content-manager/collection-types/${p}${B}`)},onError(de){R({type:"warning",message:I(de)})}}),O=(0,Xe.useMutation)(de=>q(`/content-manager/collection-types/${m.uid}/actions/bulkUnpublish`,de),{onSuccess(){R({type:"success",message:{id:"content-manager.success.record.unpublish",defaultMessage:"Unpublished"}}),Y(`/content-manager/collection-types/${p}${B}`)},onError(de){R({type:"warning",message:I(de)})}}),N=(0,e.useRef)(""),Y=(0,e.useCallback)(async(de,ue)=>{l();try{const Fe=ue?{cancelToken:ue.token}:null,{data:{results:Re,pagination:ke}}=await X.get(de,Fe);M(G({id:(0,h.OB)("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:ke.count})),i(ke,Re)}catch(Fe){if(Qe.default.isCancel(Fe))return;if((Fe?.response?.status??null)===403){await C.current(),R({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),W("/");return}R({type:"warning",message:{id:(0,h.OB)("error.model.fetch")}})}},[G,l,i,M,W,R,X]),P=(0,e.useCallback)(async de=>{try{await q((0,h.IF)(`collection-types/${p}/actions/bulkDelete`),{ids:de});const ue=(0,h.IF)(`collection-types/${p}${B}`);Y(ue),D.current("didBulkDeleteEntries")}catch(ue){R({type:"warning",message:I(ue)})}},[Y,B,p,R,I,q]),Z=(0,e.useCallback)(async de=>{try{await U((0,h.IF)(`collection-types/${p}/${de}`));const ue=(0,h.IF)(`collection-types/${p}${B}`);Y(ue),R({type:"success",message:{id:(0,h.OB)("success.record.delete")}})}catch(ue){R({type:"warning",message:I(ue)})}},[p,B,Y,R,I,U]),oe=async de=>{const ue={validIds:[],errors:{}},Fe=(0,h.Ex)(m,{components:g.components},{isDraft:!1}),ke=a.filter(Me=>de.includes(Me.id)).map(Me=>Fe.validate(Me,{abortEarly:!1}));return(await Promise.allSettled(ke)).forEach(Me=>{if(Me.status==="rejected"){const _=Me.reason.value.id;ue.errors[_]=(0,y.CJ)(Me.reason)}Me.status==="fulfilled"&&ue.validIds.push(Me.value.id)}),ue},re=async de=>{const ue=await oe(de);if(Object.values(ue.errors).length)throw R({type:"warning",title:{id:"content-manager.listView.validation.errors.title",defaultMessage:"Action required"},message:{id:"content-manager.listView.validation.errors.message",defaultMessage:"Please make sure all fields are valid before publishing (required field, min/max character limit, etc.)"}}),new Error("Validation error");return L.mutateAsync({ids:de})},me=de=>O.mutateAsync({ids:de});(0,e.useEffect)(()=>{const ue=Qe.default.CancelToken.source(),Fe=r,Re=(0,h.IF)(`collection-types/${p}${B}`);return Fe&&Re.includes(N.current)&&Y(Re,ue),()=>{N.current=p,ue.cancel("Operation canceled by the user.")}},[r,l,p,B,i,Y]);const H=G({id:(0,h.OB)("header.name"),defaultMessage:"Content"}),ae=G({id:m.info.displayName,defaultMessage:m.info.displayName||H}),Pe=r?G({id:(0,h.OB)("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:f}):null,Ne=de=>t?e.createElement(ce.z,{...de,forwardedAs:vt.rU,onClick:()=>{const ue=z?{status:"draft"}:{};D.current("willCreateEntry",ue)},to:{pathname:`${K}/create`,search:A.plugins?$:""},startIcon:e.createElement(At.Z,null),style:{textDecoration:"none"}},G({id:(0,h.OB)("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return e.createElement(De.o,{"aria-busy":c},e.createElement(he.T,{primaryAction:Ne(),subtitle:Pe,title:ae,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),to:"/content-manager/"},G({id:"global.back",defaultMessage:"Back"}))}),!r&&e.createElement(es.Z,{endActions:e.createElement(Wt,{area:"contentManager.listView.actions"})}),r&&e.createElement(es.Z,{endActions:e.createElement(e.Fragment,null,e.createElement(Wt,{area:"contentManager.listView.actions"}),e.createElement(du,{layout:g}),e.createElement(y.jW,{permissions:mu.collectionTypesConfigurations},e.createElement(pu,{paddingTop:1,paddingBottom:1},e.createElement(be.h,{onClick:()=>{T("willEditListLayout")},forwardedAs:vt.rU,to:{pathname:`${p}/configurations/list`,search:$},icon:e.createElement(Zr.Z,null),label:G({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:e.createElement(e.Fragment,null,k&&e.createElement(y.m,{label:G({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:ae}),placeholder:G({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),v&&e.createElement(lu,{contentType:m,slug:p,metadatas:b}))}),e.createElement(We.D,null,r?e.createElement(e.Fragment,null,e.createElement(nu,{canCreate:t,canDelete:o,canPublish:s,contentTypeName:ae,onConfirmDelete:Z,onConfirmDeleteAll:P,onConfirmPublishAll:re,onConfirmUnpublishAll:me,isBulkable:E,isLoading:c,layout:g,rows:a,action:Ne({variant:"secondary"})}),e.createElement(uu,{pagination:{pageCount:u?.pageCount||1}})):e.createElement(y.ZF,null)))}ks.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canRead:n().bool.isRequired,canPublish:n().bool.isRequired,data:n().array.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,attributes:n().object.isRequired,metadatas:n().object.isRequired,info:n().shape({displayName:n().string.isRequired}).isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,isLoading:n().bool.isRequired,getData:n().func.isRequired,getDataSucceeded:n().func.isRequired,pagination:n().shape({total:n().number.isRequired,pageCount:n().number}).isRequired,slug:n().string.isRequired};const gu=Pd();function fu(t){return(0,_r.bindActionCreators)({getData:Cd,getDataSucceeded:Rd,onChangeListHeaders:To,onResetListHeaders:Md},t)}const hu=(0,J.$j)(gu,fu);var yu=(0,_r.compose)(hu)((0,e.memo)(ks,Ce()));const Ao=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.permissions);return r?e.createElement(y.dO,null):e.createElement(yu,{...t,...s})};Ao.defaultProps={permissions:[]},Ao.propTypes={permissions:n().array,slug:n().string.isRequired};var bu=(0,e.memo)(Ao,(t,o)=>{const r=(0,y.e5)(t,o);return Object.keys(r).filter(a=>a!=="state").length>0});const Is=({layout:t,...o})=>{const r=(0,J.I0)(),{replace:s}=(0,te.k6)(),[{query:a,rawQuery:l}]=(0,y.Kx)(),i=(0,pe.r5)(a,o.slug,"listView"),c=(0,pe.Ky)(o.slug);return(0,e.useEffect)(()=>{l||s(c)},[l,s,c]),(0,e.useEffect)(()=>{r(Dd(t))},[r,t]),(0,e.useEffect)(()=>()=>{r(Td())},[r]),i?e.createElement(bu,{...o,layout:t,permissions:i}):null};Is.propTypes={layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired,pluginOptions:n().object}).isRequired}).isRequired,slug:n().string.isRequired};var Eu=Is;const So=({modifiedData:t,onChange:o,sortOptions:r})=>{const{formatMessage:s}=(0,V.Z)(),{settings:a,metadatas:l}=t;return e.createElement(F.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},s({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(F.k,{justifyContent:"space-between",gap:4},e.createElement(S.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,h.OB)("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{o({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable})),e.createElement(S.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,h.OB)("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{o({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable})),e.createElement(S.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,h.OB)("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{o({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable}))),e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{s:12,col:6},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:s({id:(0,h.OB)("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>o({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:t.settings.pageSize||""},[10,20,50,100].map(i=>e.createElement(Ee.W,{key:i,value:i},i)))),e.createElement(ge.P,{s:12,col:3},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>o({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:t.settings.defaultSortBy||""},r.map(i=>e.createElement(Ee.W,{key:i,value:i},l[i].list.label||i)))),e.createElement(ge.P,{s:12,col:3},e.createElement(He.P,{label:s({id:(0,h.OB)("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>o({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:t.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>e.createElement(Ee.W,{key:i,value:i},i))))))};So.defaultProps={modifiedData:{},sortOptions:[]},So.propTypes={modifiedData:n().object,onChange:n().func.isRequired,sortOptions:n().array};var vu=So;const $o=(0,j.ZP)(F.k)`
1014
- height: ${({theme:t})=>t.spaces[7]};
1015
-
1016
- &:last-child {
1017
- padding: 0 ${({theme:t})=>t.spaces[3]};
1018
- }
1019
- `,Cu=(0,j.ZP)($o)`
1020
- border-right: 1px solid
1021
- ${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
1022
-
1023
- svg {
1024
- width: ${12/16}rem;
1025
- height: ${12/16}rem;
1026
- }
1027
- `,Ru=(0,j.ZP)(F.k)`
1028
- border: 1px solid
1029
- ${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
1030
-
1031
- svg {
1032
- width: ${10/16}rem;
1033
- height: ${10/16}rem;
1034
-
1035
- path {
1036
- fill: ${({theme:t,isSibling:o})=>o?void 0:t.colors.primary600};
1037
- }
1038
- }
1039
- `,Mu=(0,j.ZP)(Q.Z)`
1040
- max-width: ${72/16}rem;
1041
- `;function Bt({labelField:t,transparent:o,isSibling:r}){return e.createElement(Ru,{background:r?"neutral100":"primary100",display:"inline-flex",gap:3,hasRadius:!0,justifyContent:"space-between",transparent:o,isSibling:r,"max-height":(0,y.Q1)(32),maxWidth:"min-content",opacity:o?0:1},e.createElement(F.k,{gap:3},e.createElement(Cu,{alignItems:"center",cursor:"all-scroll",padding:3},e.createElement(nt.Z,null)),e.createElement(Mu,{textColor:r?void 0:"primary600",fontWeight:"bold",ellipsis:!0},t)),e.createElement(F.k,null,e.createElement($o,{alignItems:"center"},e.createElement(Ve.Z,null)),e.createElement($o,{alignItems:"center"},e.createElement(Vt.Z,null))))}Bt.defaultProps={isSibling:!1,transparent:!1},Bt.propTypes={isSibling:n().bool,labelField:n().string.isRequired,transparent:n().bool};const Zo=j.ZP.button`
1042
- display: flex;
1043
- align-items: center;
1044
- height: ${({theme:t})=>t.spaces[7]};
1045
-
1046
- &:last-child {
1047
- padding: 0 ${({theme:t})=>t.spaces[3]};
1048
- }
1049
- `,Ps=(0,j.ZP)(Zo)`
1050
- padding: 0 ${({theme:t})=>t.spaces[3]};
1051
- border-right: 1px solid ${({theme:t})=>t.colors.neutral150};
1052
- cursor: all-scroll;
1053
-
1054
- svg {
1055
- width: ${12/16}rem;
1056
- height: ${12/16}rem;
1057
- }
1058
- `,Tu=(0,j.ZP)(F.k)`
1059
- max-height: ${32/16}rem;
1060
- cursor: pointer;
1061
-
1062
- svg {
1063
- width: ${10/16}rem;
1064
- height: ${10/16}rem;
1065
-
1066
- path {
1067
- fill: ${({theme:t})=>t.colors.neutral600};
1068
- }
1069
- }
1070
-
1071
- &:hover {
1072
- background-color: ${({theme:t})=>t.colors.primary100};
1073
- border-color: ${({theme:t})=>t.colors.primary200};
1074
-
1075
- svg {
1076
- path {
1077
- fill: ${({theme:t})=>t.colors.primary600};
1078
- }
1079
- }
1080
-
1081
- ${Q.Z} {
1082
- color: ${({theme:t})=>t.colors.primary600};
1083
- }
1084
-
1085
- ${Ps} {
1086
- border-right: 1px solid ${({theme:t})=>t.colors.primary200};
1087
- }
1088
- }
1089
- `,Du=(0,j.ZP)(S.x)`
1090
- &:last-child {
1091
- padding-right: ${({theme:t})=>t.spaces[3]};
1092
- }
1093
- `,Os=({index:t,isDraggingSibling:o,labelField:r,onClickEditField:s,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:c})=>{const{formatMessage:g}=(0,V.Z)(),u=(0,e.useRef)(null),p=(0,e.useRef)(null),[,f]=(0,e.useState)(!1),m=(0,e.useRef)(),b=()=>{m.current&&m.current.click()},[,E]=(0,sn.useDrop)({accept:h._Q.FIELD,hover(w,D){if(!p.current)return;const C=w.index,M=t;if(C===M)return;const I=p.current.getBoundingClientRect(),A=(I.right-I.left)/2,$=D.getClientOffset().x-I.left;C>M&&$>A||C<M&&$<A||(a(C,M),w.index=M)}}),[{isDragging:v},k,R]=(0,sn.useDrag)({type:h._Q.FIELD,item(){return{index:t,labelField:r,name:i}},collect:w=>({isDragging:w.isDragging()}),end(){c(!1)}});(0,e.useEffect)(()=>{R((0,wt.rX)(),{captureDraggingState:!1})},[R]),(0,e.useEffect)(()=>{v&&c(!0)},[v,c]),(0,e.useEffect)(()=>{o||f(w=>!w)},[o]);const T={dragRef:k(u),dropRef:E(p)};return e.createElement(Du,{ref:T?T.dropRef:null},v&&e.createElement(Bt,{transparent:!0,labelField:r}),!v&&o&&e.createElement(Bt,{isSibling:!0,labelField:r}),!v&&!o&&e.createElement(Tu,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:v},e.createElement(F.k,{gap:3},e.createElement(Ps,{as:"span","aria-label":g({id:(0,h.OB)("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:r}),onClick:w=>w.stopPropagation(),ref:T.dragRef,type:"button"},e.createElement(nt.Z,null)),e.createElement(Q.Z,{fontWeight:"bold"},r)),e.createElement(F.k,{paddingLeft:3},e.createElement(Zo,{ref:m,onClick:w=>{w.stopPropagation(),s(i)},"aria-label":g({id:(0,h.OB)("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:r}),type:"button"},e.createElement(Ve.Z,null)),e.createElement(Zo,{onClick:l,"data-testid":`delete-${i}`,"aria-label":g({id:(0,h.OB)("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:r}),type:"button"},e.createElement(Vt.Z,null)))))};Os.propTypes={index:n().number.isRequired,isDraggingSibling:n().bool.isRequired,labelField:n().string.isRequired,name:n().string.isRequired,onClickEditField:n().func.isRequired,onMoveField:n().func.isRequired,onRemoveField:n().func.isRequired,setIsDraggingSibling:n().func.isRequired};var ku=Os;const ws=(0,j.ZP)(S.x)`
1094
- flex: ${({size:t})=>t};
1095
- `,Iu=(0,j.ZP)(ws)`
1096
- overflow-x: scroll;
1097
- overflow-y: hidden;
1098
- `,Pu=(0,j.ZP)(ws)`
1099
- max-width: ${32/16}rem;
1100
- `,xs=({displayedFields:t,listRemainingFields:o,metadatas:r,onAddField:s,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:c}=(0,V.Z)(),[g,u]=(0,e.useState)(!1),[p,f]=(0,e.useState)(null),m=(0,e.useRef)();function b(...v){f("add"),s(...v)}function E(...v){f("remove"),i(...v)}return(0,e.useEffect)(()=>{p==="add"&&m?.current&&(m.current.scrollLeft=m.current.scrollWidth)},[t,p]),e.createElement(e.Fragment,null,e.createElement(S.x,{paddingBottom:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},c({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"}))),e.createElement(F.k,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},e.createElement(Iu,{size:"1",paddingBottom:4,ref:m},e.createElement(F.k,{gap:3},t.map((v,k)=>e.createElement(ku,{key:v,index:k,isDraggingSibling:g,onMoveField:l,onClickEditField:a,onRemoveField:R=>E(R,k),name:v,labelField:r[v].list.label||v,setIsDraggingSibling:u})))),e.createElement(Pu,{size:"auto",paddingBottom:4},e.createElement(Ge.O,{label:c({id:(0,h.OB)("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:be.h,icon:e.createElement(At.Z,null),disabled:o.length<=0,"data-testid":"add-field"},o.map(v=>e.createElement(Ge.s,{key:v,onClick:()=>b(v)},r[v].list.label||v))))))};xs.propTypes={displayedFields:ye.PropTypes.array.isRequired,listRemainingFields:ye.PropTypes.array.isRequired,metadatas:ye.PropTypes.objectOf(ye.PropTypes.shape({list:ye.PropTypes.shape({label:ye.PropTypes.string})})).isRequired,onAddField:ye.PropTypes.func.isRequired,onClickEditField:ye.PropTypes.func.isRequired,onMoveField:ye.PropTypes.func.isRequired,onRemoveField:ye.PropTypes.func.isRequired};var Ou=xs;const wu=(0,j.ZP)(F.k)`
1101
- svg {
1102
- width: ${32/16}rem;
1103
- height: ${24/16}rem;
1104
- margin-right: ${({theme:t})=>t.spaces[3]};
1105
- }
1106
- `,Fs=({attributes:t,fieldForm:o,fieldToEdit:r,onCloseModal:s,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:c}=(0,V.Z)(),g=t[r].relationType;let u=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(g)&&(u=!0),e.createElement(Ur.P,{onClose:s,labelledBy:"title"},e.createElement("form",{onSubmit:l},e.createElement(Vr.x,null,e.createElement(wu,null,e.createElement(Yr,{type:i}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:St()(r)})))),e.createElement(Hr.f,null,e.createElement(Ie.r,{gap:4},e.createElement(ge.P,{s:12,col:6},e.createElement(Dn.o,{id:"label-input",label:c({id:(0,h.OB)("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:p=>a(p),value:o.label,hint:c({id:(0,h.OB)("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),u&&e.createElement(ge.P,{s:12,col:6},e.createElement(Zt.s,{"data-testid":"Enable sort on this field",checked:o.sortable,label:c({id:(0,h.OB)("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:p=>a({target:{name:"sortable",value:p.target.checked}}),onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),e.createElement(Qr.m,{startActions:e.createElement(ce.z,{onClick:s,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(ce.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Fs.propTypes={attributes:n().objectOf(n().shape({relationType:n().string})).isRequired,fieldForm:n().shape({label:n().string,sortable:n().bool}).isRequired,fieldToEdit:n().string.isRequired,onChangeEditLabel:n().func.isRequired,onCloseModal:n().func.isRequired,onSubmit:n().func.isRequired,type:n().string.isRequired};var xu=Fs,Fu=(t,o)=>({...t,initialData:o,modifiedData:o});const Bo={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}};var Lu=(t=Bo,o)=>(0,oo.ZP)(t,r=>{const s=["modifiedData","layouts","list"];switch(o.type){case"ADD_FIELD":{const a=x()(t,s,[]);se()(r,s,[...a,o.item]);break}case"MOVE_FIELD":{const a=x()(t,s,[]),{originalIndex:l,atIndex:i}=o;se()(r,s,(0,h.W3)(a,l,i));break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys.split(".")],o.value);break}case"ON_CHANGE_FIELD_METAS":{se()(r,["fieldForm",o.name],o.value);break}case"REMOVE_FIELD":{const a=x()(t,s,[]);se()(r,s,a.filter((l,i)=>o.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=o;r.fieldToEdit=a,r.fieldForm.label=x()(r,["modifiedData","metadatas",a,"list","label"],""),r.fieldForm.sortable=x()(r,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{r.fieldForm={},r.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",t.fieldToEdit,"list"];se()(r,[...a,"label"],t.fieldForm.label),se()(r,[...a,"sortable"],t.fieldForm.sortable);break}default:return r}});const Au=["media","richtext","dynamiczone","relation","component","json"],Ls=({layout:t,slug:o})=>{const{put:r}=(0,y.kY)(),{formatMessage:s}=(0,V.Z)(),{trackUsage:a}=(0,y.rS)(),l=(0,pe.fi)(),i=(0,y.lm)(),{refetchData:c}=(0,e.useContext)(Ze),[g,u]=(0,e.useState)(!1),p=()=>u(O=>!O),[f,m]=(0,e.useReducer)(Lu,Bo,()=>Fu(Bo,t)),{fieldToEdit:b,fieldForm:E,initialData:v,modifiedData:k}=f,R=!qe()(E),{attributes:T}=t,w=k.layouts.list,D=()=>{const{settings:{pageSize:O,defaultSortBy:N,defaultSortOrder:Y},kind:P,uid:Z}=v,oe=`${N}:${Y}`,re=`${(0,_t.stringify)({page:1,pageSize:O,sort:oe},{encode:!1})}${l?`&${l}`:""}`;return`/content-manager/${P}/${Z}?${re}`},C=({target:{name:O,value:N}})=>{m({type:"ON_CHANGE",keys:O,value:O==="settings.pageSize"?parseInt(N,10):N})},M=async()=>{const O=In()(k,["layouts","settings","metadatas"]);G.mutate(O)},I=O=>{m({type:"ADD_FIELD",item:O})},A=(O,N)=>{O.stopPropagation(),w.length===1?i({type:"info",message:{id:(0,h.OB)("notification.info.minimumFields")}}):m({type:"REMOVE_FIELD",index:N})},B=O=>{O.preventDefault(),p(),a("willSaveContentTypeLayout")},$=O=>{m({type:"SET_FIELD_TO_EDIT",fieldToEdit:O})},K=()=>{m({type:"UNSET_FIELD_TO_EDIT"})},W=O=>{O.preventDefault(),m({type:"SUBMIT_FIELD_FORM"}),K()},G=(0,Xe.useMutation)(O=>r(`/content-manager/content-types/${o}/configuration`,O),{onSuccess(){a("didEditListSettings"),c()},onError(){i({type:"warning",message:{id:"notification.error"}})}}),{isLoading:z}=G,X=({target:{name:O,value:N}})=>{m({type:"ON_CHANGE_FIELD_METAS",name:O,value:N})},q=Object.entries(T).filter(([O,N])=>(0,h.ko)(N)&&!w.includes(O)).map(([O])=>O).sort(),U=Object.entries(T).filter(([,O])=>!Au.includes(O.type)).map(([O])=>O),L=(O,N)=>{m({type:"MOVE_FIELD",originalIndex:O,atIndex:N})};return e.createElement(Se.A,null,e.createElement(De.o,{"aria-busy":z},e.createElement("form",{onSubmit:B},e.createElement(he.T,{navigationAction:e.createElement(y.rU,{startIcon:e.createElement(en.Z,null),to:D,id:"go-back"},s({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(ce.z,{size:"S",startIcon:e.createElement(st.Z,null),disabled:Ce()(k,v),type:"submit"},s({id:"global.save",defaultMessage:"Save"})),subtitle:s({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:s({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:St()(k.info.displayName)})}),e.createElement(We.D,null,e.createElement(S.x,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(vu,{modifiedData:k,onChange:C,sortOptions:U}),e.createElement(S.x,{paddingTop:6,paddingBottom:6},e.createElement(Ar.i,null)),e.createElement(Ou,{listRemainingFields:q,displayedFields:w,onAddField:I,onClickEditField:$,onMoveField:L,onRemoveField:A,metadatas:k.metadatas}))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(st.Z,null),isConfirmButtonLoading:z,isOpen:g,onToggleDialog:p,onConfirm:M,variantRightButton:"success-light"})),R&&e.createElement(xu,{attributes:T,fieldForm:E,fieldToEdit:b,onChangeEditLabel:X,onCloseModal:K,onSubmit:W,type:x()(T,[b,"type"],"text")})))};Ls.propTypes={layout:n().shape({uid:n().string.isRequired,settings:n().shape({bulkable:n().bool,defaultSortBy:n().string,defaultSortOrder:n().string,filterable:n().bool,pageSize:n().number,searchable:n().bool}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().objectOf(n().shape({type:n().string})).isRequired}).isRequired,slug:n().string.isRequired};var Su=(0,e.memo)(Ls),$u=()=>e.createElement(S.x,{padding:8},e.createElement(y.Hn,null));const As=we.Z.contentManager,Ss=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=(0,pe.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let p={},f={};return s.contentType&&(p=(0,h.du)(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((m,b)=>(m[b]=(0,h.du)(s.components[b]),m),{})),{rawContentTypeLayout:p,rawComponentsLayouts:f}},[s]);if((s?.contentType?.uid??null)!==t||r)return e.createElement(y.dO,null);const g=({location:{state:p},history:{goBack:f},match:{params:{id:m,origin:b}}},E)=>e.createElement(E,{slug:t,layout:s,state:p,goBack:f,id:m,origin:b}),u=[{path:"create/clone/:origin",comp:rn},{path:"create",comp:rn},{path:":id",comp:rn},{path:"",comp:Eu}].map(({path:p,comp:f})=>e.createElement(te.AW,{key:p,path:`${o}/${p}`,render:m=>g(m,f)}));return e.createElement(_e.ErrorBoundary,{FallbackComponent:$u},e.createElement(Be.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${o}/configurations/list`},e.createElement(y.O4,{permissions:As.collectionTypesConfigurations},e.createElement(Su,{layout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:As.collectionTypesConfigurations},e.createElement(Mo,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),u)))};Ss.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Zu=(0,e.memo)(Ss),$s=d(57678);const Bu=we.Z.contentManager,qu=()=>{const[{isLoading:t,data:o},r]=(0,e.useReducer)($s.Z,$s.q),s=(0,e.useMemo)(Ct.Vo,[]),{schemas:a}=(0,J.v9)(c=>s(c),J.wU),{uid:l}=(0,te.UO)(),{get:i}=(0,y.kY)();return(0,e.useEffect)(()=>{const g=Qe.default.CancelToken.source();return(async p=>{try{r(Xt());const{data:{data:f}}=await i(`/content-manager/components/${l}/configuration`,{cancelToken:p.token});r(_n((0,h.w8)(f,a,"component")))}catch(f){if(Qe.default.isCancel(f))return;console.error(f)}})(g),()=>{g.cancel("Operation canceled by the user.")}},[l,a,i]),t?e.createElement(y.dO,null):e.createElement(y.O4,{permissions:Bu.componentsConfigurations},e.createElement(Mo,{components:o.components,mainLayout:o.component,slug:l}))};var Nu=(0,e.memo)(qu),ju=d(9695),Wu=d(54725),zu=()=>{const{formatMessage:t}=(0,V.Z)();return(0,y.go)(),e.createElement(De.o,null,e.createElement(he.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(We.D,null,e.createElement(ju.x,{action:e.createElement(y.Qj,{variant:"secondary",startIcon:e.createElement(At.Z,null),to:"/plugins/content-type-builder/content-types/create-content-type"},t({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:t({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:e.createElement(Wu.Z,{width:"10rem"}),shadow:"tableShadow"})))},Uu=()=>{const{formatMessage:t}=(0,V.Z)();return(0,y.go)(),e.createElement(De.o,null,e.createElement(he.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(We.D,null,e.createElement(y.ZF,null)))};const Vu=we.Z.contentManager,Zs=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=(0,pe.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let c={},g={};return s.contentType&&(g=(0,h.du)(s.contentType)),s.components&&(c=Object.keys(s.components).reduce((u,p)=>(u[p]=(0,h.du)(s.components[p]),u),{})),{rawContentTypeLayout:g,rawComponentsLayouts:c}},[s]);return r?e.createElement(y.dO,null):e.createElement(Be.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:Vu.singleTypesConfigurations},e.createElement(Mo,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:o,render:({location:{state:c},history:{goBack:g}})=>e.createElement(rn,{layout:s,slug:t,isSingleType:!0,state:c,goBack:g})})))};Zs.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Hu=(0,e.memo)(Zs),Qu=d(90700),Gu=d(78090),Ku=d(77013),Yu=d(79318),Xu=d(66618),Ju=()=>{const[t,o]=(0,e.useState)(""),{formatMessage:r,locale:s}=(0,V.Z)(),a=(0,e.useMemo)(Ct.KQ,[]),{collectionTypeLinks:l,singleTypeLinks:i}=(0,J.v9)(a,J.wU),{startsWith:c}=(0,y.L0)(s,{sensitivity:"base"}),g=(0,y.Xe)(s,{sensitivity:"base"}),u=(0,e.useMemo)(()=>[{id:"collectionTypes",title:{id:(0,ve.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:l},{id:"singleTypes",title:{id:(0,ve.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:i}].map(b=>({...b,links:b.links.filter(E=>c(E.title,t)).sort((E,v)=>g.compare(E.title,v.title)).map(E=>({...E,title:r({id:E.title,defaultMessage:E.title})}))})),[l,t,i,c,r,g]),p=()=>{o("")},f=({target:{value:b}})=>{o(b)},m=r({id:(0,ve.Z)("header.name"),defaultMessage:"Content"});return e.createElement(Qu.m,{ariaLabel:m},e.createElement(Gu.p,{label:m,searchable:!0,value:t,onChange:f,onClear:p,searchLabel:r({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),e.createElement(Ku.Z,null,u.map(b=>{const E=r({id:b.title.id,defaultMessage:b.title.defaultMessage},b.title.values);return e.createElement(Yu.D,{key:b.id,label:E,badgeLabel:b.links.length.toString()},b.links.map(v=>{const k=v.search?`?${v.search}`:"";return e.createElement(Xu.E,{as:vt.OL,key:v.uid,to:`${v.to}${k}`},v.title)}))})))},qo=d(92886);const _u=()=>({type:qo.fn}),em=()=>({type:qo.sZ}),tm=({authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,contentTypeSchemas:r,components:s,fieldSizes:a})=>({type:qo.IX,data:{authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,components:s,contentTypeSchemas:r,fieldSizes:a}}),Bs=(t,o,r=[])=>t.filter(s=>s.isDisplayed).map(s=>{const a=[{action:"plugin::content-manager.explorer.create",subject:s.uid},{action:"plugin::content-manager.explorer.read",subject:s.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:s.uid}],i=o==="collectionTypes"?a:l,c=r.find(({uid:u})=>u===s.uid);let g=null;if(c){const u={page:1,pageSize:c.settings.pageSize,sort:`${c.settings.defaultSortBy}:${c.settings.defaultSortOrder}`};g=(0,_t.stringify)(u,{encode:!1})}return{permissions:i,search:g,kind:s.kind,title:s.info.displayName,to:`/content-manager/${s.kind}/${s.uid}`,uid:s.uid,name:s.uid,isDisplayed:s.isDisplayed}});var nm=(t,o)=>{const r=Object.entries(vr()(t,"kind")).map(([l,i])=>({name:l,links:i})),[s,a]=Le()(r,"name");return{collectionTypeSectionLinks:Bs(s?.links||[],"collectionTypes",o),singleTypeSectionLinks:Bs(a?.links??[],"singleTypes")}},qs=(t,o)=>o.map(({permissions:r})=>(0,y.qX)(t,r)),om=async({models:t,userPermissions:o,toggleNotification:r})=>{const{get:s}=(0,y.tg)();try{const{data:{data:a}}=await s((0,h.IF)("content-types-settings")),{collectionTypeSectionLinks:l,singleTypeSectionLinks:i}=nm(t,a),c=await Promise.all(qs(o,l)),g=l.filter((f,m)=>c[m]),u=await Promise.all(qs(o,i)),p=i.filter((f,m)=>u[m]);return{authorizedCollectionTypeLinks:g,authorizedSingleTypeLinks:p}}catch(a){return console.error(a),r({type:"warning",message:{id:"notification.error"}}),{authorizedCollectionTypeLinks:[],authorizedSingleTypeLinks:[]}}},rm=()=>{const t=(0,J.I0)(),o=(0,y.lm)(),r=(0,J.v9)((0,Ct.Yg)()),s=(0,e.useRef)(),{allPermissions:a}=(0,y.vn)(),{runHookWaterfall:l}=(0,y.j1)(),c=Qe.default.CancelToken.source(),{notifyStatus:g}=(0,Do.G)(),{formatMessage:u}=(0,V.Z)(),{get:p}=(0,y.kY)(),f=async()=>{t(_u());try{const{data:{data:{components:m,contentTypes:b,fieldSizes:E}}}=await p("/content-manager/init",{cancelToken:c.token});g(u({id:(0,h.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const v=await om({models:b,userPermissions:a,toggleNotification:o}),{ctLinks:k}=l(je.LK,{ctLinks:v.authorizedCollectionTypeLinks,models:b}),{stLinks:R}=l(je.dV,{stLinks:v.authorizedSingleTypeLinks,models:b}),T=tm({authorizedCollectionTypeLinks:k,authorizedSingleTypeLinks:R,contentTypeSchemas:b,components:m,fieldSizes:E});t(T)}catch(m){if(Qe.default.isCancel(m))return;console.error(m),o({type:"warning",message:{id:"notification.error"}})}};return s.current=f,(0,e.useEffect)(()=>(s.current(),()=>{c.cancel("Operation canceled by the user."),t(em())}),[t,o]),{...r,refetchData:s.current}},qt=d(25708),sm=d(16899);const am=(0,j.ZP)(F.k)`
1107
- border-radius: 50%;
1108
-
1109
- svg {
1110
- height: ${6/16}rem;
1111
- width: ${11/16}rem;
1112
- > path {
1113
- fill: ${({theme:t})=>t.colors.neutral600};
1114
- }
1115
- }
1116
- `,im=j.ZP.button`
1117
- border: none;
1118
- background: transparent;
1119
- display: block;
1120
- width: 100%;
1121
- text-align: unset;
1122
- padding: 0;
1123
- `;function Ns({displayedValue:t}){return e.createElement(F.k,{background:"neutral0",borderColor:"neutral200",justifyContent:"space-between",gap:3,padding:3,width:(0,y.Q1)(300)},e.createElement(im,{type:"button"},e.createElement(F.k,{gap:6},e.createElement(am,{alignItems:"center",justifyContent:"center",background:"neutral200",height:(0,y.Q1)(32),width:(0,y.Q1)(32)},e.createElement(sm.Z,null)),e.createElement(F.k,{maxWidth:(0,y.Q1)(150)},e.createElement(Q.Z,{textColor:"neutral700",ellipsis:!0},t)))),e.createElement(F.k,{gap:2},e.createElement(be.h,{noBorder:!0},e.createElement(Ye.Z,null)),e.createElement(be.h,{noBorder:!0},e.createElement(nt.Z,null))))}Ns.propTypes={displayedValue:n().string.isRequired};const js=({status:t,displayedValue:o,width:r})=>{const{formatMessage:s}=(0,V.Z)(),a={[ct.DRAFT]:s({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ct.PUBLISHED]:s({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},l=t===ct.DRAFT?"secondary":"success";return e.createElement(S.x,{style:{width:r}},e.createElement(F.k,{paddingTop:2,paddingBottom:2,paddingLeft:2,paddingRight:4,hasRadius:!0,borderSize:1,background:"neutral0",borderColor:"neutral200",justifyContent:"space-between"},e.createElement(ur,{gap:1},e.createElement(be.h,{noBorder:!0},e.createElement(nt.Z,null)),e.createElement(mr,{maxWidth:"100%",justifyContent:"space-between"},e.createElement(S.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(gr,null,e.createElement(Q.Z,{textColor:"primary600",ellipsis:!0},o))),t&&e.createElement(Pn.q,{variant:l,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${l}700`},a[t])))),e.createElement(S.x,{paddingLeft:4},e.createElement(fr,{type:"button"},e.createElement(cr.J,{width:"12px",as:Vt.Z})))))};js.propTypes={status:n().string.isRequired,displayedValue:n().string.isRequired,width:n().number.isRequired};const lm=we.Z.contentManager;function cm({type:t,item:o}){if([qt.Z.EDIT_FIELD,qt.Z.FIELD].includes(t))return e.createElement(Bt,{labelField:o.labelField});const[r]=t.split("_");switch(r){case qt.Z.COMPONENT:case qt.Z.DYNAMIC_ZONE:return e.createElement(Ns,{displayedValue:o.displayedValue});case qt.Z.RELATION:return e.createElement(js,{displayedValue:o.displayedValue,status:o.status,width:o.width});default:return null}}const Ws=()=>{const t=(0,te.$B)("/content-manager/:kind/:uid"),{status:o,collectionTypeLinks:r,singleTypeLinks:s,models:a,refetchData:l}=rm(),i=Le()([...r,...s],m=>m.title.toLowerCase()),{pathname:c}=(0,te.TH)(),{formatMessage:g}=(0,V.Z)(),{startSection:u}=(0,y.c1)(),p=(0,e.useRef)(u);if((0,e.useEffect)(()=>{p.current&&p.current("contentManager")},[]),o==="loading")return e.createElement(De.o,{"aria-busy":"true"},e.createElement(he.T,{title:g({id:(0,ve.Z)("header.name"),defaultMessage:"Content"})}),e.createElement(y.dO,null));const f=a.filter(({isDisplayed:m})=>m);return i.length===0&&f.length>0&&c!=="/content-manager/403"?e.createElement(te.l_,{to:"/content-manager/403"}):f.length===0&&c!=="/content-manager/no-content-types"?e.createElement(te.l_,{to:"/content-manager/no-content-types"}):!t&&i.length>0?e.createElement(te.l_,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):e.createElement(Se.A,{sideNav:e.createElement(Ju,null)},e.createElement($e.r,{renderItem:cm}),e.createElement(Ze.Provider,{value:{refetchData:l}},e.createElement(te.rs,null,e.createElement(te.AW,{path:"/content-manager/components/:uid/configurations/edit"},e.createElement(y.O4,{permissions:lm.componentsConfigurations},e.createElement(Nu,null))),e.createElement(te.AW,{path:"/content-manager/collectionType/:slug",component:Zu}),e.createElement(te.AW,{path:"/content-manager/singleType/:slug",component:Hu}),e.createElement(te.AW,{path:"/content-manager/403"},e.createElement(Uu,null)),e.createElement(te.AW,{path:"/content-manager/no-content-types"},e.createElement(zu,null)),e.createElement(te.AW,{path:"",component:y.Hn}))))};function dm(){const{formatMessage:t}=(0,V.Z)();return e.createElement(e.Fragment,null,e.createElement(Te.q,{title:t({id:(0,ve.Z)("plugin.name"),defaultMessage:"Content Manager"})}),e.createElement(Ws,null))}},92914:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return h}});var e=d(32735),Te=d(60216),te=d.n(Te),y=d(67879),De=d(24989),he=d(87933),Se=d(49372),V=d(72850),it=d(9026),Le=d(51375);const we=60*1e3,ve=we*60,$e=ve*24,xe=$e*30,Ze=$e*365;var ye=J=>J<we?{unit:"second",value:-Math.round(J/1e3)}:J<ve?{unit:"minute",value:-Math.round(J/we)}:J<$e?{unit:"hour",value:-Math.round(J/ve)}:J<xe?{unit:"day",value:-Math.round(J/$e)}:J<Ze?{unit:"month",value:-Math.round(J/xe)}:{unit:"year",value:-Math.round(J/Ze)},n=d(8997);const gt=()=>{const{formatMessage:J}=(0,y.Z)();return e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Se.Z,{variant:"sigma",textColor:"neutral600",id:"additional-information"},J({id:(0,Le.OB)("containers.Edit.information"),defaultMessage:"Information"})),e.createElement(V.x,null,e.createElement(it.i,null)))},Be=({label:J,value:je})=>e.createElement(he.k,{justifyContent:"space-between"},e.createElement(Se.Z,{as:"dt",fontWeight:"bold",textColor:"neutral800",variant:"pi"},J),e.createElement(Se.Z,{as:"dd",variant:"pi",textColor:"neutral600"},je));Be.propTypes={label:te().string.isRequired,value:te().string.isRequired};const Nt=()=>{const{formatMessage:J,formatRelativeTime:je}=(0,y.Z)(),{initialData:et,isCreatingEntry:Dt}=(0,De.Wq)(),kt=(0,e.useRef)(Date.now()),ft=(We,Ie)=>{const{firstname:ge,lastname:F,username:S}=et[Ie]??{},Ve=ge??"",Ke=F??"",tt=S??(0,n.Pp)(Ve,Ke),Pt=(et[We]?new Date(et[We]).getTime():Date.now())-kt.current,{unit:Ot,value:jt}=ye(-Pt);return{at:je(jt,Ot,{numeric:"auto"}),by:Dt?"-":tt}},lt=ft("updatedAt","updatedBy"),Ce=ft("createdAt","createdBy");return e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.created"),defaultMessage:"Created"}),value:Ce.at}),e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:Ce.by})),e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"}),value:lt.at}),e.createElement(Be,{label:J({id:(0,Le.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:lt.by})))},pe=({children:J})=>e.createElement(he.k,{direction:"column",alignItems:"stretch",gap:4},J);pe.propTypes={children:te().oneOfType([te().arrayOf(te().node),te().node]).isRequired};var h={Root:pe,Title:gt,Body:Nt}},73710:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return y}});var e=d(32735),Te=d(92914);function te(){return e.createElement(Te.Z.Root,null,e.createElement(Te.Z.Title,null),e.createElement(Te.Z.Body,null))}var y=te},75536:function(pt,Oe,d){"use strict";var e=d(32735);const Te=(te,y)=>{const[De,he]=(0,e.useState)(te);return(0,e.useEffect)(()=>{const Se=setTimeout(()=>{he(te)},y);return()=>{clearTimeout(Se)}},[te,y]),De};Oe.Z=Te},57047:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return xe}});var e=d(32735),Te=d(67879),te=d(49372),y=d(60216),De=d.n(y),he=d(87933),Se=d(72850),V=d(24989),it=d(54504);function Le({color:Ze,name:_e}){const{themeColorName:ye}=(0,it.k)(Ze);return e.createElement(he.k,{alignItems:"center",gap:2,maxWidth:(0,V.Q1)(300)},e.createElement(Se.x,{height:2,background:Ze,borderColor:ye==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),e.createElement(te.Z,{fontWeight:"regular",textColor:"neutral700",ellipsis:!0},_e))}Le.propTypes={color:De().string.isRequired,name:De().string.isRequired};var we=Le,ve=d(47510),$e=d(61937),xe=Ze=>{const{formatMessage:_e}=(0,Te.Z)();return(window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS)&&Ze.contentType.options?.reviewWorkflows)??!1?{key:"__strapi_reviewWorkflows_stage_temp_key__",name:"strapi_reviewWorkflows_stage",fieldSchema:{type:"relation"},metadatas:{label:_e({id:(0,ve.Z)("containers.ListPage.table-headers.reviewWorkflows.stage"),defaultMessage:"Review stage"}),searchable:!1,sortable:!0,mainField:{name:"name",schema:{type:"string"}}},cellFormatter({strapi_reviewWorkflows_stage:n}){if(!n)return e.createElement(te.Z,{textColor:"neutral800"},"-");const{color:gt,name:Be}=n;return e.createElement(we,{color:gt??$e.FT,name:Be})}}:null}},28243:function(pt,Oe,d){"use strict";d.d(Oe,{Z:function(){return _e}});var e=d(32735),Te=d(24989),te=d(87107),y=d(87933),De=d(28847),he=d(23866),Se=d(47851),V=d(67879),it=d(20108),Le=d(67350),we=d(28315),ve=d(8445),$e=d(92914);const xe="strapi_reviewWorkflows_stage";function Ze(){const{initialData:ye,isCreatingEntry:n,layout:{uid:gt},isSingleType:Be,onChange:Nt}=(0,Te.Wq)(),{put:pe}=(0,Te.kY)(),h=ye?.[xe]??null,J=Object.prototype.hasOwnProperty.call(ye,xe),{formatMessage:je}=(0,V.Z)(),{formatAPIError:et}=(0,Te.So)(),Dt=(0,Te.lm)(),{workflows:kt,isLoading:ft}=(0,Le.n)(),lt=kt?.[0]??null,{error:Ce,isLoading:We,mutateAsync:Ie}=(0,it.useMutation)(async({entityId:Ke,stageId:tt,uid:It})=>{const Pt=Be?"single-types":"collection-types",{data:{data:Ot}}=await pe(`/admin/content-manager/${Pt}/${It}/${Ke}/stage`,{data:{id:tt}});return Nt({target:{name:xe,value:Ot[xe]}},!0),Ot},{onSuccess(){Dt({type:"success",message:{id:"content-manager.reviewWorkflows.stage.notification.saved",defaultMessage:"Success: Review stage updated"}})}}),ge=h===null&&!ft&&!n&&je({id:"content-manager.reviewWorkflows.stage.select.placeholder",defaultMessage:"Select a stage"}),S=Ce&&et(Ce)||ge||null,Ve=async({value:Ke})=>{try{await Ie({entityId:ye.id,stageId:Ke,uid:gt})}catch{}};return e.createElement($e.Z.Root,null,e.createElement($e.Z.Title,null),J&&!n&&e.createElement(te.g,{error:S,name:xe,id:xe},e.createElement(y.k,{direction:"column",gap:2,alignItems:"stretch"},e.createElement(De.Q,null,je({id:"content-manager.reviewWorkflows.stage.label",defaultMessage:"Review stage"})),e.createElement(Te.JV,{components:{LoadingIndicator:()=>e.createElement(he.a,{small:!0}),Option:we.K,SingleValue:ve.R},error:S,inputId:xe,isLoading:We,isSearchable:!1,isClearable:!1,name:xe,onChange:Ve,options:lt?lt.stages.map(({id:Ke,color:tt,name:It})=>({value:Ke,label:It,color:tt})):[],value:{value:h?.id,label:h?.name,color:h?.color}}),e.createElement(Se.c,null))),e.createElement($e.Z.Body,null))}var _e=Ze},57544:function(){},59599:function(){},42310:function(){},33842:function(){},85695:function(){}}]);