import{eg as p,eh as S,j as e,Y as x,ak as y,d3 as k,al as C,Q as m,gf as w,b7 as L,Z as d,fH as T,fs as P,bi as u,gW as A,bh as D,k as z,l as B,o as M,bg as i,E as b,a9 as v,F as U}from"./app-BgLa5dit.js";import{L as _}from"./DUGw_22-.chunk.js";import{C as I}from"./RZFsSqVM.chunk.js";import{G as H}from"./DIopWku2.chunk.js";import{L as E}from"./CEktWpXS.chunk.js";import{L as f}from"./CCXfeKmU.chunk.js";const F="_logoContainer_vn3gg_1",G={logoContainer:F},$="streamable.livestreamDetails";function O(a){var h;function o(){return`${u.diffBetween(a.endTime,a.startTime,"minutes")}m`}function n(t){return D.convertUTCToTimezoneDate(t)}function s(t){return u.format(n(t),"h:mma")}function l(t){return u.format(n(t),"Do MMMM")}function r(t){var g;return(g=A[t])==null?void 0:g.name}function c(){var t;return(t=P.getMergedPresentationAudienceString(a.audiences))==null?void 0:t.name}const N=p(a.companyName,S);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"d-flex align-items-center mb-2",children:[a.logoUrl&&e.jsx(x,{appLink:a.companyAppLink,children:e.jsx("div",{className:`${G.logoContainer} rounded-circle flex-shrink-0 overflow-hidden partial-loading-background me-2`,children:e.jsx(y,{data:k.createUrl(a.logoUrl,{size:C.Small}),alt:a.companyName,className:!a.logoBgColour&&N,imageStyle:{backgroundColor:a.logoBgColour},preload:!0})})}),e.jsxs("div",{className:"d-flex flex-column justify-content-between",children:[a.companyName&&e.jsx(x,{appLink:a.companyAppLink,className:"text-uppercase text-wrap d-block text-truncate mb-0",title:a.companyName,children:a.companyName}),e.jsx("h1",{className:"h4 mb-0",children:a.eventName})]})]}),e.jsxs("div",{className:"d-flex gap-2 mb-3",children:[!!((h=a.audiences)!=null&&h.length)&&e.jsx("div",{className:"rounded-pill border border-dark px-2",children:c()}),e.jsx("div",{className:"rounded-pill fw-semibold bg-dark text-white px-2",children:e.jsx("span",{className:"align-middle",children:o()})})]}),a.isPastLivestream&&e.jsxs("div",{className:"d-inline-block bg-light-green rounded-pill mb-3",children:[e.jsx(m,{svg:w}),e.jsx("p",{className:"d-inline ms-1 mb-0",children:e.jsx(L,{namespace:$,phrase:"pastEvent"})})]}),!a.isPastLivestream&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mb-2",children:[e.jsx(m,{svg:T,size:d.Small}),e.jsx("span",{className:"ms-1",children:s(a.startTime)})]}),e.jsxs("p",{className:"mb-2",children:[e.jsx(m,{svg:I,size:d.Small}),e.jsx("span",{className:"ms-1",children:l(a.startTime)})]}),e.jsxs("p",{className:"mb-3",children:[e.jsx(m,{svg:H,size:d.Small}),e.jsx("span",{className:"ms-1",children:r(a.timezone)})]})]}),a.description&&e.jsx("p",{className:"mb-3 pre-wrap text-break",dangerouslySetInnerHTML:{__html:_.linkifyText(a.description)}})]})}const R="streamable.livestreamStatusUpdate",j=U.encloseNamespace(R);function J(a){var c;const o=z(),n=B(),s=M(f.livestream(a.livestreamId));function l(){switch(a.status){case i.Draft:return"Draft";case i.Archived:return"Archive";case i.Published:return"Publish"}}async function r(){try{await o(f.updateLivestream(a.livestreamId,{...s.data,status:a.status})),n.success(j("success"))}catch{n.error(j("error"))}a.closePopup()}return a.status===i.Published?e.jsxs(b,{title:"Publish livestream",closePopup:a.closePopup,showLoadingSpinner:!s.data,children:[e.jsx("p",{className:"fw-semibold",children:"Are you sure you want to publish this livestream?"}),e.jsx("p",{children:"When a livestream gets published, it will become visible in the Calendar, and users will be able to sign up for it."}),e.jsx("p",{children:"Please ensure that all of the following details are correct before publishing:"}),e.jsx(E,{livestream:s.data,hideStatus:!0}),e.jsxs(v,{children:[e.jsx("button",{onClick:a.closePopup,className:"btn btn-link me-2",children:"Cancel"}),e.jsx("button",{onClick:r,className:"btn btn-dark",children:"Publish"})]})]}):e.jsxs(b,{title:`${l()} livestream`,closePopup:a.closePopup,showLoadingSpinner:!s.data,children:[a.status===i.Draft&&e.jsx("p",{className:"fw-semibold",children:"Are you sure you want to draft this livestream?"}),a.status===i.Archived&&e.jsxs("div",{children:[e.jsx("p",{children:"Archiving this livestream will cancel the livestream. If there are any users who have registered they will be notified."}),e.jsx("p",{className:"fw-semibold",children:"Are you sure you want to archive this livestream?"})]}),s.data&&e.jsx(O,{logoUrl:(c=s.data.company.logo)==null?void 0:c.url,companyName:s.data.company.name,startTime:s.data.startDateTime,endTime:s.data.endDateTime,audiences:s.data.audiences,description:s.data.description,eventName:s.data.name,timezone:s.data.timezone}),e.jsxs(v,{children:[e.jsx("button",{onClick:a.closePopup,className:"btn btn-link me-2",children:"Cancel"}),e.jsx("button",{onClick:r,className:"btn btn-dark",children:l()})]})]})}export{J as StreamableLivestreamStatusUpdateView};
//# sourceMappingURL=CAsncjKD.chunk.js.map
