import{dn as D,dp as I,R as j,dq as T,j as e,ap as v,o as l,s as C,p as A,w as E,h as u,K as o,ar as S,aR as g,i as h}from"./app-BgLa5dit.js";import{O as R}from"./B-fq6xxv.chunk.js";import{C as f}from"./CTg_3F42.chunk.js";import{E as O}from"./RTbqjc8Y.chunk.js";import"./BfMtaC_g.chunk.js";function V(i){const a=i.dashboards.map(t=>{var n;return{...t,presentationDescription:t.presentation.id&&((n=i.presentations.find(d=>d.id===t.presentation.id))==null?void 0:n.description)||""}}),r=D.getColumnSet(I.VideoCuratedTopics),c=j.useMemo(()=>T({columns:r,columnData:i.columnData}),[i.columnData]);return e.jsx(e.Fragment,{children:i.dashboards.length?e.jsx(v,{theme:f,columns:c,data:a}):e.jsx("p",{className:"py-3",children:e.jsx("em",{children:"This video is not used in any dashboard"})})})}function U(i){var p;const[a,r]=j.useState(null),c=l(C.video(i.videoId)),t=l(g.currentUser()),n=l(A.getVideoDashboardsDetails(i.videoId,a==null?void 0:a.id)),d=E.uniq((p=n.data)==null?void 0:p.map(s=>s.presentation),s=>s.id);function x(s){return[{label:"Open curated topic",openInNewTab:!0,appLink:{application:h.DASHBOARD_EDITOR,action:u.DashboardEditor.EDIT_DASHBOARD,args:[s.id]}},{label:"Open classification details",openInNewTab:!0,appLink:{application:h.SUBJECTS,action:u.Subjects.EDIT_CLASSIFICATION,args:[s.presentation.id,s.classificationId]}}]}const b={actions:x},m=!n.hasCompleted;return e.jsxs(e.Fragment,{children:[!!t.data&&e.jsx(O,{videoId:i.videoId,activeAction:u.Videos.EDIT_VIDEO_CURATED_TOPICS,currentUser:t.data}),c.data&&e.jsx(R,{object:c.data}),e.jsx("p",{children:"View all the curated topics this video is in."}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("p",{className:"me-2",children:"Filter by presentation:"}),e.jsxs(o,{children:[e.jsx(o.Toggle,{id:"presentation-filter",variant:"outline-dark",className:"mb-3",disabled:m,children:(a==null?void 0:a.description)||"All Presentations"}),e.jsxs(o.Menu,{children:[e.jsx(o.Item,{onClick:()=>r(null),active:a===null,children:"All Presentations"}),d==null?void 0:d.map(s=>s?e.jsx(o.Item,{onClick:()=>r(s),active:(a==null?void 0:a.id)===s.id,children:s.description},s.id):null)]})]})]}),e.jsx("div",{className:"pb-3 my-3",children:m?e.jsx("div",{children:e.jsx(S,{as:"div",size:"sm",animation:"border",role:"status"})}):e.jsx(V,{dashboards:n.data||[],columnData:b,videoId:i.videoId,presentations:d})})]})}export{U as EditVideoCuratedTopicsView};
//# sourceMappingURL=0zEQ0PVq.chunk.js.map
