import{ao as s,aO as v,aU as x,aP as C,aq as I,ca as _,ah as M,c4 as D,b0 as F,aX as G,aZ as H,az as o,aj as J,bN as q,L as z,b3 as B,bu as V,ay as $,aI as K,m as W,aR as X,f as l,e as c,v as N,Y}from"./app-k0jcl5PQ.js";import{S as Z}from"./6i75Rx5z.chunk.js";import{C as Q}from"./BRytmq3u.chunk.js";import{I as t,D as ss}from"./CsKElWLo.chunk.js";import{I as es}from"./C5n0s02L.chunk.js";import{C as h}from"./_XP6hjk3.chunk.js";import"./D51gfRTO.chunk.js";import"./CqF9ND51.chunk.js";import"./8YUd4Bv8.chunk.js";import"./BhAq_-86.chunk.js";import"./Bj7bJt_4.chunk.js";const as="classrooms.joinLinkEmptyState";function ts(){return s.jsx(v.Provider,{value:as,children:s.jsxs(x,{children:[s.jsx(x.Image,{src:C.EmptyStates.Classrooms.NO_STUDENTS_IN_CLASSROOM,size:"small"}),s.jsx(x.Heading,{children:s.jsx(I,{phrase:"heading"})})]})})}const ns="_avatarContainer_1h05x_1",is={avatarContainer:ns};function rs(e){var i;return s.jsx("div",{className:"col-3 mb-3",children:s.jsxs("div",{className:"border border-secondary rounded-3 d-flex p-2 align-items-center",children:[s.jsx("div",{className:`${is.avatarContainer} flex-shrink-0`,children:s.jsx(_,{imageUrl:(i=e.user.avatar)==null?void 0:i.url,imageCdnUrl:e.imageCdnUrl,initials:M.getInitials(e.user.name,e.user.surname)})}),s.jsxs("div",{className:"text-truncate ms-2",children:[e.user.name," ",e.user.surname]})]})})}const L="classrooms.generateJoinLink",n=z.encloseNamespace(L),os=15e3;function Ns(e){var S;const i=D(),T=F(),{hasPermissions:U}=G(),b=U(H.ManageIntegrations),r=o(h.generateJoinLink(e.classroomId)),p=o(J.currentUser()),j=o(p.data&&h.getClassroom(e.classroomId,p.data.id));q({title:j.data?n("pageTitle",{classroomName:(S=j.data)==null?void 0:S.name}):null});function m(a){return h.getClassroomStudents(e.classroomId,a)}function A(a){T(m(a))}const d=B(m,A),u=o(V.config()),{shareToGoogleClassroom:k,shareToMicrosoftTeams:O,isLoadingSettings:E}=$(null),f=e.source==="list";function R(){if(f){N.trigger({application:c.CLASSROOMS,action:l.Classrooms.HOME});return}N.trigger({application:c.CLASSROOMS,action:l.Classrooms.CLASSROOM_STUDENTS,args:[e.classroomId]})}function y(a,w){return es.getShareIntegrations(a,w).filter(g=>g.enabled).map(g=>g.id)}K.useEffect(()=>{const a=window.setInterval(()=>{W(i,m())},os);return()=>window.clearInterval(a)},[]);function P(){const a=new URL(u.data.liteUrl).hostname;return Y.safeUrlConcat(a,"/join")}return!r.data||!d.items||!u.data||E?s.jsx(s.Fragment,{}):s.jsxs(v.Provider,{value:L,children:[s.jsxs("div",{className:"d-flex px-3 ",children:[s.jsx("h1",{className:"h3 mb-3 flex-fill",children:s.jsx(I,{phrase:"title"})}),s.jsx("div",{className:"flex-fill text-end",children:s.jsx(X,{variant:"dark",onClick:R,children:n(f?"backToList":"backToClassroom")})})]}),s.jsxs("div",{className:"px-3",children:[s.jsxs("div",{className:"row mt-1",children:[s.jsxs("div",{className:"col-md-6 col-12",children:[s.jsxs(t,{spacing:"sm",bottomSpacing:"lg",children:[s.jsxs(t.Step,{number:1,children:[n("goToUrl"),s.jsx("span",{className:"text-primary",children:P()})]}),s.jsxs(t.Step,{number:2,children:[n("enterCode"),s.jsx(t.Code,{size:"lg",code:r.data.code,className:"mt-2"})]})]}),s.jsx(ss,{className:"mb-4 fs-6"}),s.jsx(t,{children:s.jsxs(t.Step,{number:1,children:[n("copyLinkAndShare"),s.jsxs("div",{className:"d-flex flex-column gap-2 mt-2",children:[s.jsx(Q,{value:r.data.link}),s.jsx(Z,{integrations:y(k,O),url:r.data.link,appLink:b?{application:c.SETTINGS,action:l.Settings.INTEGRATIONS}:{application:c.DEFAULT,action:l.Default.INTEGRATIONS_INFO}})]})]})})]}),s.jsx("div",{className:"col-md-6 col-12 text-center",children:s.jsx("img",{src:C.AddStudents.JOIN_LINK,className:"rounded-3 w-75 box-shadow img-fluid my-3"})})]}),s.jsx("hr",{}),s.jsxs("div",{children:[n("studentsWillAppear"),!d.items.length&&s.jsx(ts,{}),s.jsx("div",{className:"row mt-3",children:d.items.map(a=>s.jsx(rs,{user:a,imageCdnUrl:u.data.imageCdnUrl},a.id))})]})]})]})}export{Ns as GenerateJoinLinkView};
//# sourceMappingURL=DqnQ2EZ7.chunk.js.map
