import{R as p,o as g,aU as h,k as j,l as v,j as e,E as y,a9 as n,ag as c,aJ as m}from"./app-BgLa5dit.js";function x(t){switch(t){case c.Interactive:return"interactive";case c.Clip:return"clip";case c.Video:return"video"}}function f(t){var o;const[l,i]=p.useState(!1),s=g(h.getObject(t.id)),a=x((o=s.data)==null?void 0:o.typeId),u=j(),r=v();function d(){i(!0),u(h.updateStatus(t.id,m.Archived)).then(()=>{r.success(`Successfully archived <strong>${s.data.name}</strong>.`),t.closePopup()}).catch(()=>{r.error(`Something went wrong while trying to archive <strong>${s.data.name}</strong>. Please try again.`),i(!1)})}return e.jsx(y,{title:`Archive ${a}`,closePopup:t.closePopup,showLoadingSpinner:!s.data,children:s.data&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive ",e.jsx("strong",{children:s.data.name}),"?"]}),e.jsxs("p",{children:["Archiving an ",a," will make it inaccessible to users unless they have shared it already or had it shared to them."]}),e.jsxs("p",{children:["This is so that schools can still access results for this ",a," in their analytics for any students who have completed it."]}),e.jsxs(n,{children:[e.jsx(n.Cancel,{onClick:t.closePopup}),e.jsx(n.Submit,{variant:"danger",type:"button",text:`Archive ${a}`,onClick:d,showSpinner:l})]})]})})}export{f as ArchiveObjectView};
//# sourceMappingURL=B6aFDXB_.chunk.js.map
