@strapi/admin 4.13.0-alpha.0 → 4.13.0-alpha.1

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