"use strict";(self.webpackChunkmavunoorgbackend=self.webpackChunkmavunoorgbackend||[]).push([[2600],{27852:(Te,Q,t)=>{t.r(Q),t.d(Q,{default:()=>Xe});var e=t(19968),S=t(49008),b=t(95840),p=t(42816),ne=t(10556),d=t(62552),G=t(14632),j=t(5e3),ae=t(20596),$=t(3704),H=t(28724);const ie=`${232/16}rem`,J=(0,$.cp)(H.y)`
  width: ${ie};
  background: ${({theme:s})=>s.colors.neutral100};
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid ${({theme:s})=>s.colors.neutral200};
  z-index: 1;
`,m=({ariaLabel:s,...n})=>(0,e.jsx)(J,{"aria-label":s,as:"nav",...n});var re=t(85088),je=t(89192),w=t(37856),C=t(79141),le=t(57064),oe=t(86400),Z=t(6912),x=t(48936),l=t(63358),A=t(23264);const K=(0,$.cp)(Z.c)`
  width: ${24/16}rem;
  background-color: ${({theme:s})=>s.colors.neutral200};
`,F=({as:s="h2",label:n,searchLabel:f="",searchable:c,onChange:E=()=>{},value:B="",onClear:L=()=>{},onSubmit:M=()=>{},id:R})=>{const[I,g]=(0,d.useState)(!1),W=(0,C.i)(I),u=(0,w.I)(R),D=(0,d.useRef)(null),v=(0,d.useRef)(null);(0,d.useEffect)(()=>{I&&D.current&&D.current.focus(),W&&!I&&v.current&&v.current.focus()},[I,W]);const i=()=>{g(h=>!h)},P=h=>{L(h),D?.current&&D.current.focus()},T=h=>{h.relatedTarget?.id!==u&&g(!1)},o=h=>{h.key===je._.ESCAPE&&g(!1)};return I?(0,e.jsxs)(j.k,{paddingLeft:4,paddingTop:5,paddingBottom:2,paddingRight:4,children:[(0,e.jsx)(le.y,{children:(0,e.jsx)(oe.E,{name:"searchbar",value:B,onChange:E,placeholder:"e.g: strapi-plugin-abcd",onKeyDown:o,ref:D,onBlur:T,onClear:P,onSubmit:M,clearLabel:"Clear",size:"S",children:f})}),(0,e.jsx)(j.k,{paddingLeft:2,paddingTop:4,children:(0,e.jsx)(K,{})})]}):(0,e.jsxs)(j.k,{paddingLeft:6,paddingTop:6,paddingBottom:2,paddingRight:4,children:[(0,e.jsxs)(x.C,{justifyContent:"space-between",alignItems:"flex-start",children:[(0,e.jsx)(l.O,{variant:"beta",as:s,children:n}),c&&(0,e.jsx)(A.w,{ref:v,onClick:i,label:f,icon:(0,e.jsx)(re.c,{})})]}),(0,e.jsx)(j.k,{paddingTop:4,children:(0,e.jsx)(K,{})})]})},q=({children:s,spacing:n=2,horizontal:f=!1,...c})=>(0,e.jsx)(j.k,{paddingTop:2,paddingBottom:4,children:(0,e.jsx)(x.C,{as:"ol",gap:n,direction:f?"row":"column",alignItems:f?"center":"stretch",...c,children:d.Children.map(s,(E,B)=>(0,e.jsx)("li",{children:E},B))})});var z=t(14520);const Y=(0,$.cp)(x.C)`
  border: none;
  padding: 0;
  background: transparent;
`,_=$.cp.div`
  display: flex;
  align-items: center;
  transform: rotateX(${({rotated:s})=>s?"0deg":"180deg"});
`,X=({collapsable:s=!1,label:n,onClick:f=()=>{},ariaExpanded:c,ariaControls:E})=>s?(0,e.jsxs)(Y,{as:"button",onClick:f,"aria-expanded":c,"aria-controls":E,textAlign:"left",children:[(0,e.jsx)(j.k,{paddingRight:1,children:(0,e.jsx)(l.O,{variant:"sigma",textColor:"neutral600",children:n})}),s&&(0,e.jsx)(_,{rotated:c,children:(0,e.jsx)(z.c,{"aria-hidden":!0})})]}):(0,e.jsx)(Y,{children:(0,e.jsx)(j.k,{paddingRight:1,children:(0,e.jsx)(l.O,{variant:"sigma",textColor:"neutral600",children:n})})});var ee=t(37976);const de=(0,$.cp)(j.k)`
  svg {
    height: ${4/16}rem;
    path {
      fill: ${({theme:s})=>s.colors.neutral500};
    }
  }
`,te=({collapsable:s=!1,label:n,badgeLabel:f,children:c,id:E})=>{const[B,L]=d.useState(!0),M=(0,w.I)(E),R=()=>{L(I=>!I)};return(0,e.jsxs)(x.C,{direction:"column",alignItems:"stretch",gap:1,children:[(0,e.jsx)(de,{paddingLeft:6,paddingTop:1,paddingBottom:1,paddingRight:4,children:(0,e.jsxs)(j.k,{position:"relative",paddingRight:f?6:0,children:[(0,e.jsx)(X,{onClick:R,ariaExpanded:B,ariaControls:M,collapsable:s,label:n}),f&&(0,e.jsx)(ee.k,{backgroundColor:"neutral150",textColor:"neutral600",position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",children:f})]})}),(!s||B)&&(0,e.jsx)("ol",{id:M,children:d.Children.map(c,(I,g)=>(0,e.jsx)("li",{children:I},g))})]})};var ce=t(65816),y=t(39380);const N=(0,$.cp)(j.k)`
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: ${({theme:s})=>s.colors.neutral800};
  svg > * {
    fill: ${({theme:s})=>s.colors.neutral600};
  }

  &.active {
    ${({theme:s})=>`
      background-color: ${s.colors.primary100};
      border-right: 2px solid ${s.colors.primary600};
      svg > * {
        fill: ${s.colors.primary700};
      }
      ${l.O} {
        color: ${s.colors.primary700};
        font-weight: 500;
      }
      `}
  }

  &:focus-visible {
    outline-offset: -2px;
  }
`,me=(0,$.cp)(ce.c)`
  width: ${12/16}rem;
  height: ${4/16}rem;
  * {
    fill: ${({theme:s,$active:n})=>n?s.colors.primary600:s.colors.neutral600};
  }
`,Be=$.cp.div`
  svg {
    height: ${12/16}rem;
    width: ${12/16}rem;
  }
`,Ce=({children:s,icon:n,withBullet:f=!1,isSubSectionChild:c=!1,...E})=>(0,e.jsxs)(N,{as:y.Af,icon:n,background:"neutral100",paddingLeft:c?9:7,paddingBottom:2,paddingTop:2,...E,children:[(0,e.jsxs)(x.C,{children:[n?(0,e.jsx)(Be,{children:n}):(0,e.jsx)(me,{}),(0,e.jsx)(j.k,{paddingLeft:2,children:(0,e.jsx)(l.O,{as:"span",children:s})})]}),f&&(0,e.jsx)(j.k,{as:x.C,paddingRight:4,children:(0,e.jsx)(me,{$active:!0})})]});var ye=t(89296),r=t(6324),Le=t(27860),Re=t(28464),$e=t(65280),Ae=t(20436),be=t(42848),We=t(20464),ge=t(76512),O=t(9752),Ee=t(19576),Ke=t(35480),Fe=t(48744),Me=t(11208),Ie=t(2931),Se=t(25824),De=t(3548),se=t(35676),Ne=t(6464),ke=t(15396),ue=t(51384),he=t(71324),Ue=t(79848),He=t(9704);const Ze=({contentType:s})=>{const{formatMessage:n,formatDate:f}=(0,G.c)(),{get:c,put:E}=(0,b.Qn)(),{allPermissions:B}=(0,b.c_)(),[L,M]=(0,d.useState)(!0),[R,I]=(0,d.useState)(null),[g,W]=(0,d.useState)(null),[u,D]=(0,d.useState)([]),[v,i]=(0,d.useState)([]),[P,T]=(0,d.useState)(void 0),o=B.some(a=>a.action===`plugin::${p.I.pluginId}.explorer.restore`&&a.subject===s?.uid),h=B.some(a=>a.action===`plugin::${p.I.pluginId}.explorer.delete-permanently`&&a.subject===s?.uid),xe=g&&B.some(a=>a.action==="plugin::content-manager.explorer.read"&&a.subject===s?.uid&&a.properties.fields.includes(g));(0,d.useEffect)(()=>{i([]),D([]),W(null),s&&(M(!0),c(`/content-manager/content-types/${s.uid}/configuration`).then(a=>{W(a.data.data.contentType.settings.mainField)}).catch(a=>{I(a)}),c(`/${p.I.pluginId}/${s.kind}/${s.uid}`).then(a=>{D(a.data)}).catch(a=>{I(a)}).finally(()=>{M(!1)}))},[s]);const[fe,k]=(0,d.useState)([]),[V,Pe]=(0,d.useState)(!1),Qe=()=>{V||(T(void 0),Pe(!0),E(`/${p.I.pluginId}/${s?.kind}/${s?.uid}/restore`,{data:{ids:fe}}).then(()=>{D(u.filter(a=>!fe.includes(a.id))),i([]),T({variant:"success",message:n({id:(0,r.c)("explorer.restore.success"),defaultMessage:"Entries restored successfully"})})}).catch(a=>{T({variant:"danger",message:n({id:(0,r.c)("explorer.restore.error"),defaultMessage:"Error restoring entries"})})}).finally(()=>{k([]),Pe(!1),setTimeout(()=>{T(void 0)},3e3)}))},[ve,U]=(0,d.useState)([]),[pe,Oe]=(0,d.useState)(!1),Ye=()=>{pe||(T(void 0),Oe(!0),E(`/${p.I.pluginId}/${s?.kind}/${s?.uid}/delete`,{data:{ids:ve}}).then(()=>{D(u.filter(a=>!ve.includes(a.id))),i([]),T({variant:"success",message:n({id:(0,r.c)("explorer.deletePermanently.success"),defaultMessage:"Entries deleted permanently successfully"})})}).catch(a=>{T({variant:"danger",message:n({id:(0,r.c)("explorer.deletePermanently.error"),defaultMessage:"Error deleting entries permanently"})})}).finally(()=>{U([]),Oe(!1),setTimeout(()=>{T(void 0)},3e3)}))};return(0,e.jsxs)(e.Fragment,{children:[L&&(0,e.jsx)(x.C,{justifyContent:"center",alignItems:"center",height:"100%",children:(0,e.jsx)(ye.c,{})}),!L&&!R&&s&&(0,e.jsx)(Re.s,{navigationAction:(0,e.jsx)($e.c,{startIcon:(0,e.jsx)(ke.c,{}),to:`/plugins/${p.I.pluginId}`,children:n({id:(0,r.c)("back"),defaultMessage:"Back"})}),title:s.label,subtitle:n({id:(0,r.c)("explorer.countEntriesFound"),defaultMessage:`${u.length} entries found`},{count:u.length}),as:"h2"}),!L&&!R&&s&&(0,e.jsx)(Ae.S,{children:(0,e.jsxs)(be.o,{colCount:g&&g!="id"&&xe?6:5,rowCount:u.length+1,children:[(0,e.jsx)(We.o,{children:(0,e.jsxs)(ge.Tr,{children:[(0,e.jsx)(O.Th,{children:(0,e.jsx)(Ee.c,{"aria-label":"Select all entries",disabled:!o&&!h||!u.length,checked:u.length&&v.length===u.length,indeterminate:u.length&&v.length&&v.length!==u.length,onChange:()=>v.length===u.length?i([]):i(u.map(a=>a.id))})}),(0,e.jsx)(O.Th,{children:(0,e.jsx)(l.O,{variant:"sigma",children:"ID"})}),(0,e.jsx)(O.Th,{children:(0,e.jsx)(l.O,{variant:"sigma",children:n({id:(0,r.c)("explorer.softDeletedAt"),defaultMessage:"Soft Deleted At"})})}),(0,e.jsx)(O.Th,{children:(0,e.jsx)(l.O,{variant:"sigma",children:n({id:(0,r.c)("explorer.softDeletedBy"),defaultMessage:"Soft Deleted By"})})}),g&&g!="id"&&xe&&(0,e.jsx)(O.Th,{children:(0,e.jsx)(l.O,{variant:"sigma",children:g})}),(0,e.jsx)(O.Th,{children:v.length&&(0,e.jsxs)(x.C,{justifyContent:"end",gap:"1",width:"100%",children:[o&&(0,e.jsx)(A.w,{onClick:()=>{U([]),k(v)},label:n({id:(0,r.c)("explorer.restore"),defaultMessage:"Restore"}),icon:(0,e.jsx)(ue.c,{})}),h&&(0,e.jsx)(A.w,{onClick:()=>{k([]),U(v)},label:n({id:(0,r.c)("explorer.deletePermanently"),defaultMessage:"Delete Permanently"}),icon:(0,e.jsx)(he.c,{})})]})||(0,e.jsx)(Ke.K,{children:n({id:(0,r.c)("explorer.actions"),defaultMessage:"Actions"})})})]})}),(0,e.jsx)(Fe.K,{children:u.length&&u.map(a=>(0,e.jsxs)(ge.Tr,{children:[(0,e.jsx)(O.Td,{children:(0,e.jsx)(Ee.c,{"aria-label":`Select ${a.name}`,disabled:!o&&!h,checked:v.includes(a.id),onChange:()=>v.includes(a.id)?i(v.filter(Ve=>Ve!==a.id)):i([...v,a.id])})}),(0,e.jsx)(O.Td,{children:(0,e.jsx)(l.O,{textColor:"neutral800",children:a.id})}),(0,e.jsx)(O.Td,{children:(0,e.jsx)(l.O,{textColor:"neutral800",children:f((0,Le.c)(a._softDeletedAt),{dateStyle:"full",timeStyle:"short"})})}),(0,e.jsx)(O.Td,{children:(0,e.jsxs)(l.O,{textColor:"neutral800",children:[a._softDeletedBy.name||a._softDeletedBy.id||"-","\xA0(",a._softDeletedBy.type,")"]})}),g&&g!="id"&&xe&&(0,e.jsx)(O.Td,{children:(0,e.jsx)(l.O,{textColor:"neutral800",children:a[g]})}),(0,e.jsx)(O.Td,{children:(0,e.jsxs)(x.C,{justifyContent:"end",gap:"1",children:[o&&(0,e.jsx)(A.w,{onClick:()=>{U([]),k([a.id])},label:n({id:(0,r.c)("explorer.restore"),defaultMessage:"Restore"}),icon:(0,e.jsx)(ue.c,{})}),h&&(0,e.jsx)(A.w,{onClick:()=>{k([]),U([a.id])},label:n({id:(0,r.c)("explorer.deletePermanently"),defaultMessage:"Delete Permanently"}),icon:(0,e.jsx)(he.c,{})})]})})]},a.id))||(0,e.jsx)(ge.Tr,{children:(0,e.jsx)(O.Td,{colSpan:5,children:(0,e.jsxs)(x.C,{direction:"column",gap:"6",padding:"4rem",children:[(0,e.jsx)(Ue.c,{width:"10rem",height:"5.5rem"}),(0,e.jsx)(l.O,{variant:"delta",textColor:"neutral600",children:n({id:(0,r.c)("explorer.noEntriesFound"),defaultMessage:"No entries found"})})]})})})})]})}),!L&&R&&(0,e.jsxs)(x.C,{direction:"column",gap:"2",justifyContent:"center",alignItems:"center",height:"100%",children:[(0,e.jsx)(l.O,{variant:"delta",textColor:"neutral500",children:n({id:(0,r.c)("explorer.errorLoadingEntries"),defaultMessage:"Error loading entries"})}),(0,e.jsx)(l.O,{variant:"delta",textColor:"neutral600",children:R.message})]}),!L&&!R&&!s&&(0,e.jsxs)(x.C,{direction:"column",gap:"2",justifyContent:"center",alignItems:"center",height:"100%",children:[(0,e.jsx)(He.c,{width:"10rem",height:"5.5rem"}),(0,e.jsx)(l.O,{variant:"delta",textColor:"neutral600",children:n({id:(0,r.c)("explorer.noContentTypeSelected"),defaultMessage:"No type selected"})})]}),fe.length&&(0,e.jsxs)(Me.E,{onClose:V?null:()=>k([]),labelledBy:"title",children:[(0,e.jsx)(Ie.k,{children:(0,e.jsx)(l.O,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title",children:n({id:(0,r.c)("explorer.confirmation.restore.title"),defaultMessage:"Confirm Restoration"})})}),(0,e.jsx)(Se.a,{children:(0,e.jsx)(l.O,{textColor:"neutral800",children:n({id:(0,r.c)("explorer.confirmation.restore.description"),defaultMessage:"Are you sure you want to restore this?"})})}),(0,e.jsx)(De._,{startActions:(0,e.jsx)(se.Z,{variant:"tertiary",onClick:()=>k([]),disabled:V,children:n({id:(0,r.c)("cancel"),defaultMessage:"Cancel"})}),endActions:(0,e.jsx)(se.Z,{variant:"default",onClick:Qe,loading:V,startIcon:(0,e.jsx)(ue.c,{}),children:n({id:(0,r.c)("explorer.restore"),defaultMessage:"Restore"})})})]})||(0,e.jsx)(e.Fragment,{}),ve.length&&(0,e.jsxs)(Me.E,{onClose:pe?null:()=>U([]),labelledBy:"title",children:[(0,e.jsx)(Ie.k,{children:(0,e.jsx)(l.O,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title",children:n({id:(0,r.c)("explorer.confirmation.deletePermanently.title"),defaultMessage:"Confirm Delete Permanently"})})}),(0,e.jsx)(Se.a,{children:(0,e.jsx)(l.O,{textColor:"neutral800",children:n({id:(0,r.c)("explorer.confirmation.deletePermanently.description"),defaultMessage:"Are you sure you want to delete this permanently?"})})}),(0,e.jsx)(De._,{startActions:(0,e.jsx)(se.Z,{onClick:()=>U([]),variant:"tertiary",disabled:pe,children:n({id:(0,r.c)("cancel"),defaultMessage:"Cancel"})}),endActions:(0,e.jsx)(se.Z,{variant:"danger-light",onClick:Ye,loading:V,startIcon:(0,e.jsx)(he.c,{}),children:n({id:(0,r.c)("explorer.deletePermanently"),defaultMessage:"Delete permanently"})})})]})||(0,e.jsx)(e.Fragment,{}),P&&(0,e.jsx)(Ne._,{position:"fixed",top:"5%",left:"40%",zIndex:"100",variant:P.variant,onClose:()=>T(void 0),children:P.message})||(0,e.jsx)(e.Fragment,{})]})},ze=()=>{const s=(0,S.W4)(),{formatMessage:n}=(0,G.c)(),f=(0,S.Uz)(),[c,E]=(0,d.useState)(""),{get:B}=(0,b.Qn)(),{allPermissions:L}=(0,b.c_)(),[M,R]=(0,d.useState)([]),[I,g]=(0,d.useState)(!0),[W,u]=(0,d.useState)(void 0),[D,v]=(0,d.useState)(void 0);return(0,d.useEffect)(()=>{g(!0),u(void 0),B("/content-manager/init").then(i=>{const P=i.data.data.contentTypes.filter(o=>o.isDisplayed&&o.kind==="collectionType"&&p.I.supportsContentType(o.uid)).filter(o=>L.some(h=>h.action===`plugin::${p.I.pluginId}.explorer.read`&&h.subject===o.uid)).map(o=>({uid:o.uid,kind:o.kind,label:o.info.displayName,to:`/plugins/${p.I.pluginId}/collectionType/${o.uid}`})),T=i.data.data.contentTypes.filter(o=>o.isDisplayed&&o.kind==="singleType"&&p.I.supportsContentType(o.uid)).filter(o=>L.some(h=>h.action===`plugin::${p.I.pluginId}.explorer.read`&&h.subject===o.uid)).map(o=>({uid:o.uid,kind:o.kind,label:o.info.displayName,to:`/plugins/${p.I.pluginId}/singleType/${o.uid}`}));R(P.concat(T))}).catch(i=>{u(i)}).finally(()=>{g(!1)})},[]),(0,d.useEffect)(()=>{const i=M[0];i&&(!s.kind||!s.uid)?f.push(`/plugins/${p.I.pluginId}/${i.kind}/${i.uid}`):s.kind&&s.uid&&v(M.filter(P=>s.kind===P.kind&&s.uid===P.uid)[0])},[M,s.kind,s.uid]),(0,e.jsx)(j.k,{background:"neutral100",children:(0,e.jsx)(ae._,{sideNav:(0,e.jsxs)(m,{ariaLabel:"Soft Delete sub nav",children:[(0,e.jsx)(F,{label:n({id:(0,r.c)("name"),defaultMessage:"Soft Delete"}),searchable:!0,value:c,onChange:i=>E(i.target.value),onClear:()=>E(""),searchLabel:n({id:(0,r.c)("explorer.searchContentTypes"),defaultMessage:"Search Content Types"}),searchPlaceholder:n({id:(0,r.c)("explorer.searchContentTypes"),defaultMessage:"Search Content Types"})}),(0,e.jsxs)(q,{children:[(0,e.jsx)(te,{label:n({id:(0,r.c)("explorer.collectionTypes"),defaultMessage:"Collection Types"}),collapsable:!0,badgeLabel:M.filter(i=>i.kind==="collectionType").length.toString(),children:M.filter(i=>i.kind==="collectionType"&&(c?i.label.toLowerCase().includes(c.toLowerCase()):!0)).map((i,P)=>(0,e.jsx)(Ce,{to:i.to,active:i.uid===D?.uid,children:i.label},P))}),(0,e.jsx)(te,{label:n({id:(0,r.c)("explorer.singleTypes"),defaultMessage:"Single Types"}),collapsable:!0,badgeLabel:M.filter(i=>i.kind==="singleType").length.toString(),children:M.filter(i=>i.kind==="singleType"&&(c?i.label.toLowerCase().includes(c.toLowerCase()):!0)).map((i,P)=>(0,e.jsx)(Ce,{to:i.to,active:i.uid===D?.uid,children:i.label},P))})]})]}),children:(0,e.jsx)(e.Fragment,{children:I&&(0,e.jsx)(x.C,{direction:"column",gap:"2",justifyContent:"center",alignItems:"center",height:"100%",children:(0,e.jsx)(ye.c,{})})||!I&&W&&(0,e.jsxs)(x.C,{direction:"column",gap:"2",justifyContent:"center",alignItems:"center",height:"100%",children:[(0,e.jsx)(l.O,{variant:"delta",textColor:"neutral500",children:n({id:(0,r.c)("explorer.errorLoadingContentTypes"),defaultMessage:"Error loading types"})}),(0,e.jsx)(l.O,{variant:"delta",textColor:"neutral600",children:W.message})]})||(0,e.jsx)(Ze,{contentType:D})})})})},Xe=()=>(0,e.jsx)(b.rF,{permissions:ne.c.main,children:(0,e.jsxs)(S.Wk,{children:[(0,e.jsx)(S.kX,{path:`/plugins/${p.I.pluginId}/:kind?/:uid?`,component:ze,exact:!0}),(0,e.jsx)(S.kX,{component:b.wF})]})})},54244:(Te,Q,t)=>{t.r(Q),t.d(Q,{default:()=>w});var e=t(19968),S=t(62552),b=t(14632),p=t(6464),ne=t(5e3),d=t(20596),G=t(28464),j=t(35676),ae=t(20436),$=t(48936),H=t(56104),ie=t(53305),J=t(42816),m=t(6324),re=t(95840);const w=()=>{const{formatMessage:C}=(0,b.c)(),{get:le,put:oe}=(0,re.Qn)(),[Z,x]=(0,S.useState)(void 0),[l,A]=(0,S.useState)(!1),[K,F]=(0,S.useState)(void 0),q=[{label:C({id:(0,m.c)("setting.restorationBehavior.softDeleteExisting"),defaultMessage:"Soft Delete existing"}),value:"soft-delete"},{label:C({id:(0,m.c)("setting.restorationBehavior.deletePermanentlyExisting"),defaultMessage:"Delete Permanently existing"}),value:"delete-permanently"}],[z,Y]=(0,S.useState)(q[0].value),_=[{label:C({id:(0,m.c)("setting.restorationBehavior.draft"),defaultMessage:"Draft"}),value:"draft"},{label:C({id:(0,m.c)("setting.restorationBehavior.unchanged"),defaultMessage:"Unchanged"}),value:"unchanged"}],[X,ee]=(0,S.useState)(_[0].value),[de,te]=(0,S.useState)(!1);(0,S.useEffect)(()=>{Z&&te(Z.singleTypesRestorationBehavior!==z||Z.draftPublishRestorationBehavior!==X)},[Z,z,X]),(0,S.useEffect)(()=>{A(!0),le(`/${J.I.pluginId}/settings`).catch(y=>{F({variant:"danger",message:C({id:(0,m.c)("settings.load.error"),defaultMessage:"Error while loading Settings"}),error:y})}).then(y=>{x(y.data),Y(y.data.singleTypesRestorationBehavior),ee(y.data.draftPublishRestorationBehavior)}).finally(()=>{A(!1)})},[]);const ce=()=>{A(!0),oe(`/${J.I.pluginId}/settings`,{singleTypesRestorationBehavior:z,draftPublishRestorationBehavior:X}).catch(y=>{F({variant:"danger",message:C({id:(0,m.c)("settings.save.error"),defaultMessage:"Error while saving Settings"}),error:y})}).then(y=>{x(y.data),F({variant:"success",message:C({id:(0,m.c)("settings.save.success"),defaultMessage:"Successfully saved Setings"})})}).finally(()=>{A(!1),setTimeout(()=>{F(void 0)},3e3)})};return(0,e.jsxs)(e.Fragment,{children:[K&&(0,e.jsxs)(p._,{position:"fixed",top:"5%",left:"40%",zIndex:"100",variant:K.variant,onClose:()=>F(void 0),children:[K.message," ",K.error?.message]})||(0,e.jsx)(e.Fragment,{}),(0,e.jsx)(ne.k,{background:"neutral100",children:(0,e.jsxs)(d._,{children:[(0,e.jsx)(G.s,{title:C({id:(0,m.c)("setting.restorationBehavior"),defaultMessage:"Restoration Behavior"}),as:"h1",primaryAction:(0,e.jsx)(j.Z,{startIcon:(0,e.jsx)(ie.c,{}),disabled:!de||l,onClick:ce,loading:l,children:C({id:(0,m.c)("save"),defaultMessage:"Save"})})}),(0,e.jsx)(ae.S,{children:(0,e.jsxs)($.C,{hasRadius:!0,background:"neutral0",width:"100%",padding:6,direction:"column",alignItems:"stretch",gap:6,children:[(0,e.jsx)(H.K_,{disabled:l,value:z,onChange:Y,label:C({id:(0,m.c)("explorer.singleTypes"),defaultMessage:"Single Types"}),hint:C({id:(0,m.c)("setting.restorationBehavior.singleTypes.hint"),defaultMessage:"Single types cannot be restored in the same way as collections. You can choose to soft delete the existing unique type or delete it permanently."}),children:q.map(({label:y,value:N})=>(0,e.jsx)(H.kH,{value:N,children:y},N))}),(0,e.jsx)(H.K_,{disabled:l,value:X,onChange:ee,label:C({id:(0,m.c)("explorer.draftPublish"),defaultMessage:"Draft & Publish"}),hint:C({id:(0,m.c)("setting.restorationBehavior.draftPublish.hint"),defaultMessage:"You can choose to restore an entry supporting Draft & Publish to a draft or unchanged."}),children:_.map(({label:y,value:N})=>(0,e.jsx)(H.kH,{value:N,children:y},N))})]})})]})})]})}}}]);
