import{dF as m,iv as p,fH as e,iY as h,iF as x,C as j,fI as f,A as R,bV as o,bU as g,b5 as k,aD as d,gZ as w,a$ as C,d2 as v,jD as y}from"./strapi-ye6TfKul.js";import{W as l}from"./WidgetHelpers-DvKGKEsV.js";import{g as b,R as E}from"./ReleasesPage-DzhQaVs3.js";import"./schemas-xpBv1dp3.js";import"./index-Dll6c3MH.js";import"./index-BRVyLNfZ.js";import"./index-DJ1SXY40.js";const T=m.enhanceEndpoints({addTagTypes:["UpcomingReleasesList"]}).injectEndpoints({endpoints:t=>({getUpcomingReleases:t.query({query:()=>"/content-releases/homepage/upcoming-releases",transformResponse:a=>a.data,providesTags:(a,n)=>["UpcomingReleasesList"]})}),overrideExisting:!0}),{useGetUpcomingReleasesQuery:L}=T,U=y(d)`
  display: block;
  max-width: 14.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
`,A=({items:t})=>{const{formatMessage:a}=p(),{trackUsage:n}=h(),i=x(),c=s=>`/plugins/content-releases/${s.id}`,u=s=>()=>{n("willEditReleaseFromHome");const r=c(s);i(r)};return e.jsx(j,{colCount:4,rowCount:t?.length??0,children:e.jsx(f,{children:t?.map(s=>e.jsxs(R,{onClick:u(s),cursor:"pointer",children:[e.jsx(o,{children:e.jsx(U,{title:s.name,variant:"omega",textColor:"neutral800",children:s.name})}),e.jsx(o,{children:e.jsx(g,{display:"inline-block",children:s.status?e.jsx(k,{...b(s.status),children:s.status}):e.jsx(d,{textColor:"neutral600","aria-hidden":!0,children:"-"})})}),e.jsx(o,{children:e.jsx(d,{variant:"omega",textTransform:"capitalize",textColor:"neutral600",children:s.scheduledAt?e.jsx(E,{timestamp:new Date(s.scheduledAt)}):a({id:"content-releases.pages.Releases.not-scheduled",defaultMessage:"Not scheduled"})})}),e.jsx(o,{onClick:r=>r.stopPropagation(),children:e.jsx(g,{display:"inline-block",children:e.jsx(w,{tag:C,to:c(s),onClick:()=>n("willEditReleaseFromHome"),label:a({id:"content-manager.actions.edit.label",defaultMessage:"Edit"}),variant:"ghost",children:e.jsx(v,{})})})})]},s.documentId))})})},_=()=>{const{formatMessage:t}=p(),{data:a,isLoading:n,error:i}=L();return n?e.jsx(l.Loading,{}):i||!a?e.jsx(l.Error,{}):a.length===0?e.jsx(l.NoData,{children:t({id:"content-releases.widget.upcoming-releases.no-data",defaultMessage:"No releases"})}):e.jsx(A,{items:a})};export{_ as UpcomingReleasesWidget};
