1import{d as be,j as s,B as P,C as T,v as M,T as U,S as X,b as he,a as i,F as le,ds as O,dF as je,aD as ve,i as Ne,P as Le,aA as ye,A as $e,cI as Be,y as Ue,a5 as ke,bm as Ee,bq as Ae,bt as ze,at as Ye,Z as lt,di as rt,bZ as We,eo as Ke,$ as Ve,bn as qe,bk as Je,e as Se,ep as pe,ai as ot,g as ct,c as Xe,u as et,k as dt,bl as Pe,ef as mt,bb as wt,cS as ut,cT as ft,b7 as gt,eq as ht,L as tt,ad as st,bP as pt}from"./registration-0c84e8c2.js";import{u as xe,P as bt,T as at}from"./TeamPlanOverview-49591d80.js";import{r as g}from"./azure-b7f4c004.js";import"./analytics-99e053f8.js";import{k as vt,w as xt,T as _t}from"./RegisterLinks-92c41860.js";import"./iconsax-fa9e39a7.js";import"./sentry-e70f6bf5.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="328576ba-361e-4760-8588-832cb5cb1a17",t._sentryDebugIdIdentifier="sentry-dbid-328576ba-361e-4760-8588-832cb5cb1a17")}catch{}})();const Ze=t=>{const e=be.c(19),{open:C,onClose:u,onPurchase:v,unassignedCount:o,unassignedSelectedCount:x,isLoading:I,purchaseButtonText:p,purchaseButtonTestId:n}=t,c=I===void 0?!1:I,b=p===void 0?"Purchase seats":p,_=n===void 0?"purchase-seats-button-on-warning-dialog-to-puchase-seats":n;let k;e[0]!==u?(k=s(P,{wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.PRIMARY,variant:M.GHOST,onClick:u,children:"Cancel"}),e[0]=u,e[1]=k):k=e[1];let S;e[2]!==c||e[3]!==v||e[4]!==_||e[5]!==b?(S=s(P,{"data-testid":_,wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.PRIMARY,variant:M.FILLED,loading:c,onClick:v,children:b}),e[2]=c,e[3]=v,e[4]=_,e[5]=b,e[6]=S):S=e[6];let y;e[7]!==k||e[8]!==S?(y=i("div",{className:"tw-flex tw-gap-3 tw-flex-col-reverse sm:tw-flex-row tw-w-full tw-items-center tw-justify-between",children:[k,S]}),e[7]=k,e[8]=S,e[9]=y):y=e[9];let l;e[10]!==o||e[11]!==x?(l=s(U,{"data-testid":"text-on-warning-dialog-to-puchase-seats",size:X.BASE,weight:he.REGULAR,tagName:"p",className:"tw-text-gray-500 tw-flex tw-items-center tw-justify-center !tw-text-center tw-leading-normal",children:o===0?i(le,{children:["No seats are available.",s("br",{}),"Purchase seats to give everyone in your team access."]}):i("span",{children:["You are assigning seats to"," ",i("b",{children:[x," team ",O("member",x)]}),s("br",{}),"but only"," ",i("b",{children:[o," ",O("seat",o)]})," ",o>1?" are ":" is "," available.",s("br",{})," To give everyone access please purchase more seats"]})}),e[10]=o,e[11]=x,e[12]=l):l=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=s("div",{className:"tw-w-20 tw-h-20 tw-mb-40 sm:tw-mb-12 tw-flex tw-items-center tw-justify-center tw-m-auto tw-bg-warning-100 tw-my-12 tw-rounded-full",children:s("img",{"data-testid":"image-on-warning-dialog-to-puchase-seats",className:"tw-object-cover tw-w-6",src:je,alt:"seat"})}),e[13]=N):N=e[13];let F;return e[14]!==u||e[15]!==C||e[16]!==y||e[17]!==l?(F=i(ve,{open:C,title:"You need more team seats",modalClasses:"tw-h-[85vh] sm:tw-h-fit",isHeaderSticky:!0,onClose:u,footer:y,children:[l,N]}),e[14]=u,e[15]=C,e[16]=y,e[17]=l,e[18]=F):F=e[18],F},nt=t=>{const e=be.c(20),{open:C,onClose:u,onConfirm:v,seatCount:o,isLoading:x}=t,I=x===void 0?!1:x,p=`Confirm unassigning team ${O("seat",o)}`;let n;e[0]!==u?(n=s(P,{wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.PRIMARY,variant:M.GHOST,onClick:u,children:"Cancel"}),e[0]=u,e[1]=n):n=e[1];let c;e[2]!==o?(c=O("seat",o),e[2]=o,e[3]=c):c=e[3];let b;e[4]!==I||e[5]!==v||e[6]!==c?(b=i(P,{"data-testid":"confirm-unassign-dialog-button",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.DANGER,variant:M.FILLED,onClick:v,loading:I,children:["Unassign ",c]}),e[4]=I,e[5]=v,e[6]=c,e[7]=b):b=e[7];let _;e[8]!==n||e[9]!==b?(_=i("div",{className:"tw-flex tw-gap-3 tw-flex-col-reverse sm:tw-flex-row tw-w-full tw-items-center tw-justify-between",children:[n,b]}),e[8]=n,e[9]=b,e[10]=_):_=e[10];const k=`Unassigning team ${O("seat",o)} will downgrade 2 ${O("clinician",o)} to the free plan, removing access to key features like 3 notes creation, supervision, and treatment plans.`;let S;e[11]!==k?(S=s(U,{"data-testid":"confirm-unassign-dialog-message",size:X.BASE,weight:he.REGULAR,tagName:"p",className:"tw-text-gray-500 tw-flex tw-items-center tw-text-center tw-px-4 tw-leading-normal",children:k}),e[11]=k,e[12]=S):S=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=s("div",{className:"tw-w-20 tw-h-20 tw-mb-40 sm:tw-mb-12 tw-flex tw-items-center tw-justify-center tw-m-auto tw-bg-warning-100 tw-my-12 tw-rounded-full",children:s("img",{className:"tw-object-cover tw-w-6",src:je,alt:"seat icon"})}),e[13]=y):y=e[13];let l;return e[14]!==u||e[15]!==C||e[16]!==p||e[17]!==_||e[18]!==S?(l=i(ve,{open:C,modalClasses:"tw-h-[85vh] sm:tw-h-fit",isHeaderSticky:!0,title:p,onClose:u,footer:_,children:[S,y]}),e[14]=u,e[15]=C,e[16]=p,e[17]=_,e[18]=S,e[19]=l):l=e[19],l};function Qe({activeClinicians:t,prepareAddClinician:e,setPurchaseTeamSeatsModalVisible:C}){const[u,v]=g.useState(""),[o,x]=g.useState(!0),[I,p]=g.useState(null),[n,c]=g.useState([]),[b,_]=g.useState(!1),[k,S]=g.useState(!1),[y,l]=g.useState(!1),{loggedUserId:N,activeSubscription:F,teamId:E}=Ne(),{sendReminderToFinalizeNotes:Y,archiveSelectedMembers:B,teamOwnerData:h,unAssignSeatsToActiveMembers:ae,assignSeatsToActiveMembers:ne,alertAssignAll:d,setAlertAssignAll:z,loadingStates:V,isLoadingClinicians:q}=xe(),{planOverview:A,planCount:j}=Le(),Q=g.useMemo(()=>{const a=u.trim().toLowerCase(),f=a.includes("-")?a.split("-")[0]:a,R=I?parseInt(I):null,$=Date.now(),D=R?R*60*60*1e3:null;return t.filter(H=>{const te=!f||H.user_name.toLowerCase().includes(f),L=parseInt(H.last_session),ie=D===null||$-L<=D;return te&&ie}).map(H=>({...H,id:H.user_id,seat_assigned:H.user_id===h.user_id||Array.isArray(A?.assigned)&&A?.assigned?.some(te=>te.user_id===H.user_id&&te.reserved===!0),disabled:H.user_id===h.user_id})).sort((H,te)=>{const L=H.user_id===h.user_id,ie=te.user_id===h.user_id;if(L&&!ie)return-1;if(!L&&ie)return 1;const re=H.seat_assigned?1:0;return(te.seat_assigned?1:0)-re})},[t,u,I,N,A]),G=g.useMemo(()=>Q.filter(a=>
3n.includes(a.user_id)&&h.user_id!==a.user_id),[Q,n]);g.useEffect(()=>{const a=new Set(Q.map(f=>f.user_id));c(f=>f.filter(R=>a.has(R)))},[u,I]);const{assignedCount:ee,unassignedCount:Z}=g.useMemo(()=>{const a=G.filter(R=>R.seat_assigned).length,f=G.length-a;return{assignedCount:a,unassignedCount:f}},[G]),W=async(a=!1,f)=>{let R=G;a?R=t.map(L=>({...L,id:L.user_id,seat_assigned:L.user_id===h.user_id||Array.isArray(A?.assigned)&&A?.assigned?.some(ie=>ie.user_id===L.user_id&&ie.reserved===!0),disabled:L.user_id===h.user_id})).filter(L=>!L.seat_assigned):f&&(R=Q.filter(L=>f.includes(L.user_id)));const $=R.filter(L=>L.seat_assigned===!1);if($.length===0){Se("No eligible clinicians selected. Select at least one clinician to continue.");return}if($.length>j.unAssigned){S(!0);return}const D=$.map(L=>L.user_id),H=D.map((L,ie)=>({userId:L,seatId:A?.unAssigned[ie]?.subscription_item_id||null})),te={teamId:E,clinicians:H,invitations:null};try{await ne(te),c([]),m()}catch(L){Se(`Unable to assign team ${O("seat",D.length)} at this time. Please try again later.`),console.error(L)}},r=async()=>{const a=G.filter($=>A?.assigned.some(D=>D.user_id===$.user_id&&D.reserved===!0));if(a.length===0){Se("No eligible clinicians selected. Select at least one clinician to continue.");return}const R={userIds:a.map($=>$.user_id),teamId:E,invitationIds:null};try{await ae(R),l(!1),c([]),m()}catch($){console.error($)}};function m(){v(""),p(null)}const w=!!(u||I),J=g.useMemo(()=>{const a=t.map(f=>({...f,id:f.user_id,seat_assigned:f.user_id===h.user_id||Array.isArray(A?.assigned)&&A?.assigned?.some(R=>R.user_id===f.user_id&&R.reserved===!0),disabled:f.user_id===h.user_id})).filter(f=>!f.seat_assigned);return N===h.user_id&&d&&j.unAssigned>1&&j.unAssigned===a.length},[N,h.user_id,d,j,A,t]),K=F?.trial_end!==null&&F?.subscription_active===!1;return i("div",{className:"tw-w-full tw-flex tw-items-center tw-flex-col",children:[t.length>0?i(le,{children:[i("div",{className:"tw-flex-col md:tw-flex-row tw-w-full tw-flex md:tw-items-end sm:tw-gap-2 sm:tw-mb-4",children:[i("div",{className:"tw-w-full tw-flex tw-flex-col md:tw-flex-row tw-items-center tw-gap-3",children:[s("div",{className:"!tw-w-full sm:tw-w-fit",id:"clinician-name-filter",children:s(ye,{"data-testid":"select-clinician-filter",label:"Clinician name",placeholder:"Select clinician",value:u,onChange:a=>v(a),options:t?.map(a=>({label:a.user_name,value:`${a.user_name}-${a.user_id}`})),disabled:t.length===0})}),N===h.user_id&&s("div",{"data-testid":"select-duration-filter",className:"!tw-w-full sm:tw-w-fit",id:"duration-filter",children:s(ye,{label:"Time period",placeholder:"Select time period",infoText:"Filter clinicians with unsaved notes older than the selected time.",value:I??void 0,onChange:a=>p(a),options:[{label:"Last 24h",value:"24"},{label:"Last 48h",value:"48"},{label:"Last 72h",value:"72"}],disabled:t.length===0})})]}),i("div",{className:"tw-min-h-10 tw-flex tw-flex-row-reverse md:tw-flex-row tw-w-full tw-items-center",children:[w&&s(P,{variant:M.GHOST,icon:"Add",iconProps:{className:"tw-rotate-45",size:"22"},onClick:m,children:"Clear filters"}),s("div",{className:"lines !tw-m-0 tw-flex-1"})]})]}),J?s($e,{"data-testid":"assign-seats-automatically-alert-box",alertClasses:"tw-min-w-full !tw-mb-4",variant:T.INFO,icon:"People",title:`${j.unAssigned} team ${O("seat",j.unAssigned)} available`,description:"Assign them to your team members automatically?",contentWrapperClasses:"md:!tw-flex-row md:!tw-items-center md:!tw-justify-between",actions:[{"data-testid":"assign-seats-manually-button",children:"Assign manually",onClick:()=>z(!1),variant:M.GHOST},{"data-testid":"assign-all-seats-automatically-button",children:"Assign All",onClick:()=>W(!0)}]}):null,n.length>0&&i("div",{className:"tw-w-full tw-min-h-[1rem] tw-flex-1 tw-flex tw-items-center tw-justify-center md:tw-justify-end tw-mb-4",children:[i(U,{size:X.BASE,className:"tw-mr-auto tw-min-w-fit tw-text-gray-500",tagName:"span",children:[n.length," selected"]}),i(P,{"data-testid":"show-actions-button",wrapperClasses:"tw-flex sm:tw-hidden",onClick:()=>x(!o),variant:M.GHOST,iconPosition:Be.RIGHT,icon:"ArrowDown2",iconProps:{className:`${o?"tw-rotate-180":""} tw-w-4 tw-h-4 tw-mb-[1px]`},children:[o?"Hide":"Show"," actions"]}),i("div",{id:"actions","data-testid":"contextual-actions-toolbar",className:Ue(o?"":"tw-hidden sm:tw-flex","tw-fixed tw-z-20 -tw-bottom-0 tw-bg-white tw-w-full tw-py-5 md:tw-px-4 tw-flex tw-flex-col sm:tw-flex-wrap sm:tw-items-center sm:tw-justify-end","sm:tw-relative sm:tw-bg-transparent sm:tw-w-fit sm:tw-flex-row sm:tw-p-0"),children:[!K&&Z>0&&ee===0&&i(P,{"data-testid":"assign-seats-button",onClick:()=>W(),loading:V.assignActiveSeats,variant:M.GHOST,disabled:j.unAssigned!==A.unAssigned.length,icon:"ProfileTick",children:["Assign ",O("seat",G.length)]}),Z===0?s(P,{"data-testid":"remind-to-finalize-notes-button",onClick:()=>Y(G),loading:V.sendReminder,variant:M.GHOST,icon:"Notification",iconProps:{className:"tw-w-4 tw-h-4 tw-mb-[1px]"},children:"Remind to finalize notes"}):null,s(ke,{wrapperClasses:"tw-py-2 tw-w-full sm:tw-hidden"}),!K&&ee>0&&Z===0&&i(P,{"data-testid":"unassign-seats-button",onClick:()=>l(!0),loading:V.unassignActiveSeats,variant:M.GHOST,color:T.DANGER,icon:"ProfileDelete",iconProps:{className:"!tw-text-danger-500 tw-w-4 tw-h-4 tw-mb-[1px]"},children:["Unassign ",O("seat",G.length)]}),s(P,{"data-testid":"deactivate-button",onClick:()=>_(!0),loading:V.archiveMembers,variant:M.GHOST,color:T.DANGER,icon:"ProfileRemove",iconProps:{className:"!tw-text-danger-500 tw-w-4 tw-h-4 tw-mb-[1px]"},children:"Deactivate"})]})]}),Q.length>0?s(Ee,{permissionMessage:"Cannot perform any actions on team admin",disableRowSelection:N!==h.user_id,c
3olumns:[{id:"user_name",label:"Clinician name",renderCell:a=>i("span",{className:"tw-whitespace-nowrap !tw-text-sm tw-overflow-hide tw-text-ellipsis tw-flex tw-items-center tw-gap-1",children:[s(Ae,{name:a.user_name.split(" ")[0],maxLength:16}),a.user_id===h.user_id&&s("span",{className:"tw-text-gray-500 tw-italic tw-text-xs",children:"(admin)"})]}),pinLeft:!0,sort:{sortKey:"user_name"}},{hide:N!==h.user_id,id:"last_session",label:"Last session",renderCell:a=>a.last_session?ze(a.last_session):"-",sort:{sortKey:"last_session"}},{hide:N!==h.user_id,id:"active_clients",label:"Active clients",renderCell:a=>a.active_clients?a.active_clients:"-",sort:{sortKey:"active_clients"}},{hide:N===h.user_id,id:"email",label:"Email",renderCell:a=>a.user_email?a.user_email:"-",sort:{sortKey:"user_email"}},{hide:N!==h.user_id,id:"saved_notes",label:"Saved notes",renderCell:a=>a.saved_notes?a.saved_notes:"-",sort:{sortKey:"saved_notes"}},{hide:N!==h.user_id,id:"unsaved_notes",label:"Unsaved notes",renderCell:a=>a.unsaved_notes?a.unsaved_notes:"-",sort:{sortKey:"unsaved_notes"}},{id:"teamseat",label:"Team seat",renderCell:a=>{const f=a.seat_assigned&&F?.product_name?.toLowerCase()!=="free",R=K?"Team trial":f?"Assigned":"Unassigned";return s(Ye,{"data-testid":"team-seat-badge",color:K?T.GRAY:f?T.SUCCESS:T.GRAY,label:R})},sort:{sortKey:"seat_assigned"},sortFunc(a,f){const R=a.seat_assigned?1:0;return(f.seat_assigned?1:0)-R}},{id:"menu",label:"",hide:N!==h.user_id,renderCell:a=>s(lt,{asChild:!a.disabled,side:rt.LEFT,content:"Cannot perform any actions on team admin",hidden:!a.disabled,children:s(We,{"data-testid":"clinician-menu-dialog",disabled:a.disabled,align:Ke.END,onOpenChange:()=>{pe("profile-layout-section")()},items:[...K?[{label:"Remind to finalize notes",icon:"Notification",textClasses:"tw-text-primary-500 tw-text-base tw-font-medium",showSeparatorBelow:!0,onClick:()=>Y(G)}]:a.seat_assigned===!1?[{label:"Assign seat",icon:"ProfileTick",textClasses:"tw-text-primary-500 tw-text-base tw-font-medium",onClick:()=>{W(!1,[a.id])}}]:[{label:"Remind to finalize notes",showSeparatorBelow:!0,textClasses:"tw-text-primary-500 tw-text-base tw-font-medium",onClick:()=>{Y([a])},icon:"Notification"},{label:"Unassigned seat",icon:"ProfileDelete",textClasses:"!tw-text-danger-500 tw-text-base tw-font-medium",onClick:()=>{c(()=>[a.id]),l(!0)}}],{label:"Deactivate clinician",icon:"ProfileRemove",textClasses:"!tw-text-danger-500 tw-text-base tw-font-medium",onClick:()=>{c(()=>[a.id]),_(!0)}}],children:s(Ve,{iconName:"More",className:"tw-rotate-90",size:"20",hasInteractionFeedback:!a.disabled})})})}],customTheme:{Table:N===h.user_id?` 4 --data-table-library_grid-template-columns: 2.8rem minmax(148px, 1fr) minmax(134px, 1fr) minmax(140px, 1fr) minmax(131px, 1fr) minmax(150px, 1fr) minmax(7.5rem, 7.5rem) 4.2rem; 5 `:" --data-table-library_grid-template-columns: minmax(148px, 1fr) minmax(134px, 1fr) minmax(7.5rem, 7.5rem);",BaseCell:`&:nth-of-type(1) { 6 left: 0rem; 7 } 8 &:nth-of-type(2) { 9 left: 2.8rem; 10 } 11 `},selectedRows:n,setSelectedRows:a=>{const f=pe("profile-layout-section");c(a),f()},data:Q,selectionType:qe.MULTIPLE}):i(U,{color:T.GRAY,tagName:"span",className:"sm:tw-mt-8 tw-mt-4 tw-text-center",children:["No clinicians found.",s("br",{}),"Try adjusting your filters."]})]}):!q&&s("div",{className:"tw-flex tw-flex-col sm:tw-flex-row tw-items-center tw-gap-1 tw-justify-center tw-mt-10",children:s(Je,{hideBorder:!0,description:"You have no clinicians here yet",buttonText:"Invite now",onClick:N===h.user_id?()=>e():void 0})}),s(Ze,{open:k,onClose:()=>S(!1),onPurchase:()=>{S(!1),C(!0)},unassignedCount:j.unAssigned,unassignedSelectedCount:Z}),s(nt,{open:y,onClose:()=>l(!1),onConfirm:()=>r(),seatCount:n.length,isLoading:V.unassignActiveSeats}),i(ve,{open:b,modalClasses:"tw-h-[85vh] sm:tw-h-fit",title:`Confirm deactivating ${O("clinician",n.length)}`,onClose:()=>_(!1),footer:i("div",{className:"tw-flex tw-gap-3 tw-flex-col-reverse sm:tw-flex-row tw-w-full tw-items-center tw-justify-between",children:[s(P,{wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.PRIMARY,variant:M.GHOST,onClick:()=>_(!1),children:"Cancel"}),i(P,{"data-testid":"confirm-deactivating-dialog-button",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.DANGER,variant:M.FILLED,loading:V.archiveMembers,onClick:()=>{B(G),c([]),_(!1)},children:["Remove ",O("clinician",n.length)]})]}),children:[i(U,{"data-testid":"confirm-deactivating-dialog-message",size:X.BASE,weight:he.REGULAR,tagName:"p",className:"tw-text-gray-500 tw-flex tw-items-center tw-text-center tw-px-4 tw-leading-normal",children:["Deactivating ",O("clinician",n.length)," will remove them from the team and unassign their ",O("seat",n.length),". Their notes will be retained in the deactivated section.",s("br",{}),"You can reactivate them at any time."]}),s("div",{className:"tw-w-20 tw-h-20 tw-mb-40 sm:tw-mb-0 tw-flex tw-items-center tw-justify-center tw-m-auto tw-bg-danger-100 tw-my-12 tw-rounded-full",children:s("img",{className:"tw-object-cover tw-w-6",src:vt,alt:"package icon"})})]})]})}function Ct({pendingInvitations:t,prepareAddClinician:e,setPurchaseTeamSeatsModalVisible:C}){const[u,v]=g.useState(""),[o,x]=g.useState(!0),[I,p]=g.useState(!1),[n,c]=g.useState([]),[b,_]=g.useState(!1),[k,S]=g.useState(!1),{cancelInvitations:y,resendMailForSelectedInvitations:l,teamOwnerData:N,assignSeatsToInvitedMembers:F,unAssignSeatsToInvitedMembers:E,loadingStates:Y}=xe(),{planOverview:B,planCount:h}=Le(),ae=ot(),{activeSubscription:ne,teamId:d,loggedUserId:z}=Ne(),V=ne?.trial_end!==null&&ne?.subscription_active===!1,q=g.useMemo(()=>{const r=u.trim().toLowerCase();return t.filter(m=>!r||m?.user_email.toLowerCase().includes(r)).map(m=>({...m,seat_assigned:B?.assigned.some(w=>w.subscription_item_id===m.subscription_item_id&&w.reserved===!0),id:m.invitation_id})).sort((m,w)=>{const J=m.seat_assigned?1:0;return(w.seat_assigned?1:0)-J})},[u,B,t,h.assigned]),A=g.useMemo(()=>q.filter(r=>n.includes(r.invitation_id)),[q,n]);g.useEffect(()=>{const r=new Set(q.map(m=>m.invitation_id));c(m=>m.filter(w=>r.has(w)))},[u]);const{assignedCount:j,unassignedCount:Q}=g.useMemo(()=>{const r=A.filter(w=>w.seat_assigned).length,m=A.length-r;return{assignedCount:r,unassignedCount:m}},[A]);function G(r){if(r){const m=q.filter(w=>w.invitation_id===r);l(m)}else l(A);c([])}async function ee(){const r=A.filter(w=>!w.subscription_item_id).map(w=>
11({invitationId:w.invitation_id,subscriptionId:w?.subscription_item_id??""}));if(r.length===0){Se("No unassigned team invitation to be assigned.");return}if(r.length>h.unAssigned){_(!0);return}r.forEach((w,J)=>{const K=B.unAssigned[J]?.subscription_item_id??null;w.subscriptionId=K});const m={teamId:d,invitations:r,clinicians:null};try{await F(m),c([]),W()}catch(w){console.error(w)}}async function Z(){const r=A.filter(w=>w.subscription_item_id).map(w=>({invitationId:w.invitation_id,subscriptionId:w.subscription_item_id??""}));if(r.length===0){Se("No selected assigned team invitation to be unassigned.");return}await E({invitationIds:r,teamId:d,userIds:null}),S(!1),c([]),W()}function W(){v("")}return i("div",{className:"tw-w-full tw-flex tw-items-center tw-flex-col",children:[t.length>0?i(le,{children:[i("div",{className:"tw-flex-col md:tw-flex-row tw-w-full tw-flex md:tw-items-end sm:tw-gap-2 sm:tw-mb-4 ",children:[s("div",{className:"tw-w-full md:tw-w-[35%] tw-flex tw-flex-col md:tw-flex-row tw-items-center tw-gap-3",children:s("div",{className:"tw-w-full",children:s(ye,{label:"Clinician name",placeholder:"Select clinician",value:u,onChange:r=>{v(r)},options:t?.map(r=>({label:r.user_email,value:r.user_email})),maxSelectCount:5,disabled:t.length===0})})}),i("div",{className:"tw-min-h-10 tw-flex tw-flex-row-reverse md:tw-flex-row tw-w-full tw-items-center",children:[u&&s(P,{color:T.PRIMARY,variant:M.GHOST,textClasses:"tw-flex tw-flex-nowrap tw-gap-1",icon:"Add",iconProps:{className:"tw-w-4 tw-h-4 tw-mb-[1.5px] tw-rotate-45"},onClick:W,children:"Clear filters"}),s(ke,{})]})]}),n.length>0&&i("div",{className:"tw-w-full tw-min-h-[1rem] tw-flex-1 tw-flex tw-items-center tw-justify-center md:tw-justify-end tw-mb-4",children:[i(U,{size:X.BASE,className:"tw-mr-auto tw-min-w-fit tw-text-gray-500",tagName:"span",children:[n.length," selected"]}),i(P,{"data-testid":"show-actions-button",wrapperClasses:"tw-flex sm:tw-hidden",onClick:()=>x(!o),variant:M.GHOST,iconPosition:Be.RIGHT,icon:"ArrowDown2",iconProps:{className:`${o?"tw-rotate-180":""} tw-w-4 tw-h-4 tw-mb-[1.5px]`},children:[o?"Hide":"Show"," actions"]}),i("div",{id:"actions","data-testid":"contextual-actions-toolbar",className:Ue(o?"":"tw-hidden sm:tw-flex","tw-fixed tw-z-20 -tw-bottom-0 tw-bg-white tw-w-full tw-py-5 md:tw-px-4 tw-flex tw-flex-col sm:tw-flex-wrap sm:tw-items-center sm:tw-justify-end","sm:tw-relative sm:tw-bg-transparent sm:tw-w-fit sm:tw-flex-row sm:tw-p-0"),children:[!V&&Q>0&&i(P,{"data-testid":"assign-seats-button",onClick:()=>ee(),loading:Y.assignInvitedSeats,variant:M.GHOST,disabled:Q<=0||h.unAssigned!==B.unAssigned.length,fullWidth:!0,wrapperClasses:"tw-w-full sm:tw-w-fit",icon:"ProfileTick",children:["Assign ",O("seat",A.length)]}),i(P,{"data-testid":"resend-invites-button",onClick:()=>G(),loading:Y.resendInvitations,variant:M.GHOST,icon:"Send",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,iconProps:{className:"tw-w-4 tw-h-4 tw-mb-[1.5px]"},children:["Resend ",O("invite",A.length)]}),s(ke,{wrapperClasses:"tw-py-2 tw-w-full sm:tw-hidden"}),!V&&j>0&&i(P,{"data-testid":"unassign-seats-button",onClick:()=>S(!0),loading:Y.unassignInvitedSeats,variant:M.GHOST,color:T.DANGER,disabled:j<=0,icon:"ProfileDelete",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,iconProps:{className:"!tw-text-danger-500 tw-w-4 tw-h-4 tw-mb-[1.5px]"},children:["Unassign ",O("seat",A.length)]}),i(P,{"data-testid":"cancel-invites-button",onClick:()=>p(!0),loading:Y.cancelInvitations,variant:M.GHOST,color:T.DANGER,icon:"Trash",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,iconProps:{className:"!tw-text-danger-500 tw-w-4 tw-h-4 tw-mb-[1.5px]"},children:["Cancel ",O("invite",A.length)]})]})]}),q.length>0?s("div",{className:"tw-w-full tw-mb-8",children:s(Ee,{columns:[{id:"Email",label:"Email",renderCell:r=>ae<=645?s(Ae,{name:r.user_email,maxLength:10}):s(Ae,{name:r.user_email,maxLength:20}),sort:{sortKey:"user_email"}},{id:"Invitation date",label:"Invitation date",renderCell:r=>ze(r.sent_timestamp),sort:{sortKey:"sent_timestamp"}},{id:"Team seat",label:"Team seat",renderCell:r=>
11{const m=r.seat_assigned,w=V?"Team trial":m?"Assigned":"Unassigned";return s(Ye,{"data-testid":"team-seat-badge",color:V?T.GRAY:m?T.SUCCESS:T.GRAY,label:w})},sort:{sortKey:"seat_assigned"},sortFunc(r,m){const w=r.seat_assigned?1:0;return(m.seat_assigned?1:0)-w}},{id:"",label:"",pinRight:!0,width:"4.2rem",renderCell:r=>s(We,{"data-testid":"clinician-menu-dialog",align:Ke.END,onOpenChange:()=>{pe("profile-layout-section")()},items:[{label:"Resend invite",showSeparatorBelow:!0,onClick:()=>G(r.invitation_id),icon:"Send",textClasses:"tw-text-primary-500"},{label:"Cancel invite",onClick:()=>{c([r.invitation_id]),p(!0)},icon:"Trash",textClasses:"!tw-text-danger-500"}],children:s(Ve,{iconName:"More",className:"tw-rotate-90",size:"20"})})}],data:q,selectedRows:n,setSelectedRows:r=>{const m=pe("profile-layout-section");c(r),m()},selectionType:qe.MULTIPLE})}):i(U,{color:T.GRAY,tagName:"span",className:"sm:tw-mt-8 tw-mt-4 tw-text-center",children:["No clinicians found.",s("br",{}),"Try adjusting your filters."]})]}):s("div",{className:" tw-flex tw-flex-col sm:tw-flex-row tw-items-center tw-gap-1 tw-justify-center tw-mt-10",children:s(Je,{hideBorder:!0,description:"You have no clinicians here yet",buttonText:"Invite now",onClick:z===N.user_id?()=>e():void 0})}),i(ve,{open:I,title:`Confirm canceling ${O("invitation",n.length)}`,onClose:()=>p(!1),modalClasses:"tw-h-[85vh] sm:tw-h-fit",isHeaderSticky:!0,footer:i("div",{className:"tw-flex tw-gap-3 tw-flex-col-reverse sm:tw-flex-row tw-w-full tw-items-center tw-justify-between",children:[s(P,{wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.PRIMARY,variant:M.GHOST,onClick:()=>p(!1),children:"Keep invite"}),i(P,{"data-testid":"confirm-canceling-invites-dialog-button",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.DANGER,variant:M.FILLED,onClick:()=>{y(A),c([]),p(!1)},loading:Y.cancelInvitations,children:["Cancel ",O("invite",n.length)]})]}),children:[s(U,{"data-testid":"confirm-canceling-invites-dialog-text",size:X.BASE,tagName:"p",className:"tw-text-gray-500 tw-text-center tw-px-4 tw-leading-normal",children:"If you cancel, the link in the email will become invalid, and they will no longer be able to join your team."}),s("div",{className:"tw-w-20 tw-h-20 tw-mb-40 sm:tw-mb-0 tw-flex tw-items-center tw-justify-center tw-m-auto tw-bg-danger-500/20 tw-my-12 tw-rounded-full",children:s("img",{className:"tw-object-cover tw-w-6",src:xt,alt:"basket icon"})})]}),s(Ze,{open:b,onClose:()=>_(!1),onPurchase:()=>{_(!1),C(!0)},unassignedCount:h.unAssigned,unassignedSelectedCount:Q}),s(nt,{open:k,onClose:()=>S(!1),onConfirm:()=>Z(),seatCount:n.length,isLoading:Y.unassignActiveSeats})]})}function St(t){const e=be.c(63),{deactivatedClinicians:C,setPurchaseTeamSeatsModalVisible:u}=t,[v,o]=g.useState(""),[x,I]=g.useState(!0);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[n,c]=g.useState(p),[b,_]=g.useState(!1),[k,S]=g.useState(!1),{reactivateClinician:y,loadingStates:l}=xe(),{planCount:N}=Le(),{activeSubscription:F}=Ne(),E=F?.trial_end!==null&&F?.subscription_active===!1;let Y;if(e[1]!==C||e[2]!==v){const D=v.trim().toLowerCase();Y=C.filter(H=>!D||H.user_name.toLowerCase().includes(D)).map(kt),e[1]=C,e[2]=v,e[3]=Y}else Y=e[3];const B=Y;let h;e[4]!==B?(h=()=>{const D=new Set(B.map(Pt));c(H=>H.filter(te=>D.has(te)))},e[4]=B,e[5]=h):h=e[5];let ae;e[6]!==v?(ae=[v],e[6]=v,e[7]=ae):ae=e[7],g.useEffect(h,ae);let ne;e[8]===Symbol.for("react.memo_cache_sentinel")?(ne=function(){o("")},e[8]=ne):ne=e[8];const d=ne;let z;e[9]!==C||e[10]!==v||e[11]!==B||e[12]!==E||e[13]!==l.reactivateClinician||e[14]!==y||e[15]!==n||e[16]!==x?(z=C.length>0?i(le,{children:[i("div",{className:"tw-flex-col md:tw-flex-row tw-w-full tw-flex md:tw-items-end sm:tw-gap-2 sm:tw-mb-4",children:[s("div",{className:"tw-w-full md:tw-w-[35%] tw-flex tw-flex-col md:tw-flex-row tw-items-center tw-gap-3",children:s("div",{className:"tw-w-full",children:s(ye,{placeholder:"Select clinician",label:"Clinician name",value:v,onChange:D=>o(D),options:C?.map(Mt),disabled:C.length===0})})}),i("div",{className:"tw-min-h-10 tw-flex tw-flex-row-reverse md:tw-flex-row tw-w-full tw-items-center",children:[v&&s(P,{color:T.PRIMARY,variant:M.GHOST,textClasses:"tw-flex tw-flex-nowrap tw-gap-1",icon:"Add",iconProps:{className:"tw-w-4 tw-h-4 tw-mb-[1.5px] tw-rotate-45"},onClick:d,children:"Clear filters"}),s("div",{className:"lines"})]})]}),n.length>0&&i("div",{className:"tw-w-full tw-min-h-[1rem] tw-flex-1 tw-flex tw-items-center tw-justify-center md:tw-justify-end tw-mb-4",children:[i(U,{size:X.BASE,className:"tw-mr-auto tw-min-w-fit tw-text-gray-500",tagName:"span",children:[n.length," selected"]}),i(P,{"data-testid":"show-actions-button",wrapperClasses:"tw-flex sm:tw-hidden",onClick:()=>I(!x),variant:M.GHOST,iconPosition:Be.RIGHT,icon:"ArrowDown2",iconProps:{className:`${x?"tw-rotate-180":""} tw-w-4 tw-h-4 tw-mb-[1.5px]`},children:[x?"Hide":"Show"," actions"]}),s("div",{id:"actions","data-testid":"contextual-actions-toolbar",className:Ue(x?"":"tw-hidden sm:tw-flex ","tw-fixed tw-z-20 -tw-bottom-0 tw-bg-white tw-w-full tw-py-5 md:tw-px-4 tw-flex tw-flex-col sm:tw-flex-wrap sm:tw-items-center sm:tw-justify-end","sm:tw-relative sm:tw-bg-transparent sm:tw-w-fit sm:tw-flex-row sm:tw-p-0"),children:s(P,{"data-testid":"reactivate-button",onClick:()=>{E?y(n,!1):_(!0)},loading:l.reactivateClinician,variant:M.GHOST,icon:"ProfileAdd",wrapperClasses:"!tw-w-full sm:tw-w-fit",iconProps:{className:"tw-w-4 tw-h-4 tw-mb-[1.5px]"},children:"Reactivate"})})]}),B.length>0?s("div",{className:"tw-w-full tw-mb-8",children:s(Ee,{columns:[{id:"Clinician name",pinLeft:!0,width:"minmax(148px, 1fr)",label:"Clinician name",renderCell:Rt,sort:{sortKey:"user_name"}},{id:"Last session",width:"minmax(134px, 1fr)",label:"Last session",renderCell:It,sort:{sortKey:"last_session"}},{id:"Active clients",width:"minmax(140px, 1fr)",label:"Active clients",renderCell:Tt,sort:{sortKey:"active_clients"}},{id:"Saved notes",width:"minmax(131px, 1fr)",label:"Saved notes",renderCell:Nt,sort:{sortKey:"saved_notes"}},{id:"Unsaved notes",width:"minmax(150px, 1fr)",label:"Unsaved notes",renderCell:At,sort:{sortKey:"unsaved_notes"}},{id:"",label:"",pinRight:!0,width:"4.2rem",renderCell:D=>s(We,{"data-testid":"clinician-menu-dialog",align:Ke.END,onOpenChange:yt,items:[{label:"Reactivate clinician",onClick:()=>{E?y([D.team_member_id],!1):(c(()=>[D.team_member_id]),_(!0))},icon:"ProfileAdd",textClasses:"tw-text-primary-500"}],children:s(Ve,{iconName:"More",className:"tw-rotate-90",size:"20"})})}],data:B,selectionType:qe.MULTIPLE,selectedRows:n,setSelectedRows:D=>{const H=pe("profile-layout-section");c(D),H()}})}):i(U,{color:T.GRAY,tagName:"span",className:"sm:tw-mt-8 tw-mt-4 tw-text-center",children:["No clinicians foun
11d.",s("br",{}),"Try adjusting your filters."]})]}):i(le,{children:[s(U,{color:T.GRAY,tagName:"span",className:"tw-mt-10",children:"No inactive clinicians."}),s(U,{color:T.GRAY,tagName:"span",children:"Deactivated team members will appear here."})]}),e[9]=C,e[10]=v,e[11]=B,e[12]=E,e[13]=l.reactivateClinician,e[14]=y,e[15]=n,e[16]=x,e[17]=z):z=e[17];const V=`Reactivate ${O("clinician",n.length)} 12 and assign ${O("seat",n.length)}`;let q;e[18]===Symbol.for("react.memo_cache_sentinel")?(q=()=>_(!1),e[18]=q):q=e[18];let A;e[19]!==y||e[20]!==n?(A=()=>{y(n,!1),c([]),_(!1)},e[19]=y,e[20]=n,e[21]=A):A=e[21];let j;e[22]!==l.reactivateClinician||e[23]!==A?(j=s(P,{"data-testid":"confirm-reactivating-without-seat-assign-dialog-button",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.PRIMARY,variant:M.GHOST,loading:l.reactivateClinician,onClick:A,children:"Assign later"}),e[22]=l.reactivateClinician,e[23]=A,e[24]=j):j=e[24];const Q=l.reactivateClinician;let G;e[25]!==N.unAssigned||e[26]!==y||e[27]!==n?(G=()=>{if(n.length>N.unAssigned){S(!0),_(!1);return}y(n,!0),c([]),_(!1)},e[25]=N.unAssigned,e[26]=y,e[27]=n,e[28]=G):G=e[28];let ee;e[29]!==n.length?(ee=O("seat",n.length),e[29]=n.length,e[30]=ee):ee=e[30];let Z;e[31]!==l.reactivateClinician||e[32]!==G||e[33]!==ee?(Z=i(P,{"data-testid":"confirm-reactivating-with-seat-assign-dialog-button",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,color:T.PRIMARY,variant:M.FILLED,loading:Q,onClick:G,children:["Assign ",ee]}),e[31]=l.reactivateClinician,e[32]=G,e[33]=ee,e[34]=Z):Z=e[34];let W;e[35]!==j||e[36]!==Z?(W=i("div",{className:"tw-flex tw-gap-3 tw-flex-col-reverse sm:tw-flex-row tw-w-full tw-items-center tw-justify-between",children:[j,Z]}),e[35]=j,e[36]=Z,e[37]=W):W=e[37];let r;e[38]!==n.length?(r=O("clinician",n.length),e[38]=n.length,e[39]=r):r=e[39];let m;e[40]!==n.length?(m=O("seat",n.length),e[40]=n.length,e[41]=m):m=e[41];let w;e[42]!==r||e[43]!==m?(w=i(U,{"data-testid":"confirm-reactivating-dialog-message",size:X.BASE,tagName:"p",className:"tw-text-gray-500 tw-text-center tw-px-4 tw-leading-normal",children:["You are about to restore removed ",r,". Would you like to assign available team ",m]}),e[42]=r,e[43]=m,e[44]=w):w=e[44];let J;e[45]===Symbol.for("react.memo_cache_sentinel")?(J=s("div",{className:"tw-my-10 tw-mb-40 sm:tw-mb-0",children:s("div",{className:"tw-w-20 tw-h-20 tw-flex tw-items-center tw-justify-center tw-m-auto tw-bg-warning-100 tw-my-12 tw-rounded-full",children:s("img",{className:"tw-object-cover tw-w-6",src:je,alt:"seat icon"})})}),e[45]=J):J=e[45];let K;e[46]!==b||e[47]!==W||e[48]!==w||e[49]!==V?(K=i(ve,{open:b,title:V,onClose:q,modalClasses:"tw-h-[85vh] sm:tw-h-fit",isHeaderSticky:!0,footer:W,children:[w,J]}),e[46]=b,e[47]=W,e[48]=w,e[49]=V,e[50]=K):K=e[50];let a;e[51]===Symbol.for("react.memo_cache_sentinel")?(a=()=>S(!1),e[51]=a):a=e[51];let f;e[52]!==u?(f=()=>{S(!1),u(!0)},e[52]=u,e[53]=f):f=e[53];let R;e[54]!==k||e[55]!==N.unAssigned||e[56]!==n.length||e[57]!==f?(R=s(Ze,{open:k,onClose:a,onPurchase:f,unassignedCount:N.unAssigned,unassignedSelectedCount:n.length}),e[54]=k,e[55]=N.unAssigned,e[56]=n.length,e[57]=f,e[58]=R):R=e[58];let $;
12return e[59]!==K||e[60]!==R||e[61]!==z?($=i("div",{className:"tw-w-full tw-flex tw-items-center tw-flex-col",children:[z,K,R]}),e[59]=K,e[60]=R,e[61]=z,e[62]=$):$=e[62],$}function yt(){pe("profile-layout-section")()}function At(t){return t.unsaved_notes?t.unsaved_notes:"-"}function Nt(t){return t.saved_notes?t.saved_notes:"-"}function Tt(t){return t.active_clients?t.active_clients:"-"}function It(t){return t.last_session?ze(t.last_session):"-"}function Rt(t){return s(U,{"data-testid":"deactivated-username-on-table",children:t.user_name})}function Mt(t){return{label:t.user_name,value:t.user_name}}function Pt(t){return t.team_member_id}function kt(t){return{...t,id:t.team_member_id}}function Lt(){const t=be.c(83),[e,C]=g.useState("Active"),[u,v]=g.useState(!1),[o,x]=g.useState(!1),[I,p]=g.useState(!1),[n,c]=g.useState(!1),[b,_]=g.useState(null),k=ct(),S=Xe(),{isOwner:y}=et(),{activeSubscription:l,isLoadingSubscription:N,loggedUserId:F,plans:E}=Ne(),{createInvitation:Y,activeClinicians:B,pendingInvitations:h,deactivatedClinicians:ae,teamOwnerData:ne}=xe(),{planCount:d,quantity:z,defaultCard:V,setQuantity:q,selectedPlan:A,planOverview:j,cancelSubscriptionEnd:Q,setPlan:G,purchaseTeamSeats:ee,handleSubscriptionUpdate:Z}=Le();let W,r;t[0]!==S||t[1]!==k?(W=()=>{k.state?.invitation&&(C("Pending invites"),S.replace({...k,state:{...k.state,invitation:void 0}}))},r=[k,S],t[0]=S,t[1]=k,t[2]=W,t[3]=r):(W=t[2],r=t[3]),g.useEffect(W,r);let m;t[4]!==l?.team_price_id||t[5]!==E?(m=()=>{if(!E||E.length===0)return;const se=ut(ft,E,l?.team_price_id);_(se[0]||null)},t[4]=l?.team_price_id,t[5]=E,t[6]=m):m=t[6];let w;t[7]!==l||t[8]!==E?(w=[E,l],t[7]=l,t[8]=E,t[9]=w):w=t[9],g.useEffect(m,w);let J;t[10]!==l?.period||t[11]!==G||t[12]!==b?(J=()=>{b&&b.prices&&l?.period&&G(b.prices,l?.period)},t[10]=l?.period,t[11]=G,t[12]=b,t[13]=J):J=t[13];const K=l?.period;let a;t[14]!==K||t[15]!==b?(a=[b,K],t[14]=K,t[15]=b,t[16]=a):a=t[16],g.useEffect(J,a);let f;t[17]===Symbol.for("react.memo_cache_sentinel")?(f=async()=>{v(!0)},t[17]=f):f=t[17];const R=f;let $;t[18]!==l?.next_billing_plan||t[19]!==Q||t[20]!==Z||t[21]!==d.canceled||t[22]!==d.purchased||t[23]!==ee||t[24]!==z||t[25]!==A?.id?($=async()=>{if(z-(d.purchased-d.canceled)>0){if(x(!0),Q&&l?.next_billing_plan===A?.id)await Z();else try{await ee(z-(d.purchased-d.canceled)),p(!1)}catch(se){console.log(se)}x(!1)}},t[18]=l?.next_billing_plan,t[19]=Q,t[20]=Z,t[21]=d.canceled,t[22]=d.purchased,t[23]=ee,t[24]=z,t[25]=A?.id,t[26]=$):$=t[26];const D=$;let H;t[27]!==Y?(H=async se=>{await Y(se),C("Pending invites")},t[27]=Y,t[28]=H):H=t[28];const te=H;let L;t[29]!==l?.product_name||t[30]!==d.canceled||t[31]!==d.purchased||t[32]!==q?(L=()=>{const se=l?.product_name?.toLowerCase()!==gt.TEAM.toLowerCase()?2:d.purchased-d.canceled;q(se)},t[29]=l?.product_name,t[30]=d.canceled,t[31]=d.purchased,t[32]=q,t[33]=L):L=t[33];const ie=l?.product_name;let re;t[34]!==d.canceled||t[35]!==d.purchased||t[36]!==I||t[37]!==ie?(re=[ie,I,d.purchased,d.canceled],t[34]=d.canceled,t[35]=d.purchased,t[36]=I,t[37]=ie,t[38]=re):re=t[38],g.useEffect(L,re);let _e;t[39]!==l?.next_billing_plan||t[40]!==d.canceled?(_e=se=>{if(se<=0)return"Purchase seat";if(l?.next_billing_plan)return`Purchase ${se} seat${se>1?"s":""}`;const ge=Math.min(se,d.canceled),Ce=Math.max(se-d.canceled,0);return ge>0&&Ce>0?`Resume ${ge} and purchase ${Ce} seat${Ce>1?"s":""}`:ge>0?`Resume ${ge} seat${ge>1?"s":""}`:`Purchase ${Ce} seat${Ce>1?"s":""}`},t[39]=l?.next_billing_plan,t[40]=d.canceled,t[41]=_e):_e=t[41];const it=_e,De=e==="Active"?B?.length:e==="Pending invites"?h?.length:ae?.length;let oe;t[42]!==B||t[43]!==e||t[44]!==De||t[45]!==ae||t[46]!==te||t[47]!==N||t[48]!==y||t[49]!==F||t[50]!==h||t[51]!==j?.unAssigned||t[52]!==u||t[53]!==ne?(oe=s("div",{children:N?s("div",{className:"tw-grid tw-place-items-center",children:s(dt,{size:"large"})}):i("section",{className:"tw-mb-10",children:[i("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-items-start tw-justify-start sm:tw-items-center sm:tw-flex-row sm:tw-justify-between tw-mb-4",children:[s(U,{"data-testid":"team-table-title",size:X.H3,weight:he.BOLD,tagName:"h3",children:"Team members"}
12),y()&&s(P,{"data-testid":"invite-team-members-button",onClick:()=>{R()},icon:"Sms",children:"Invite team members"})]}),F===ne.user_id?i(Pe,{defaultValue:"Active",value:e,sticky:!1,variant:mt.DEFAULT,activeCount:De,onChange:se=>{C(se)},children:[s(Pe.Tab,{"data-testid":"active-members-tab",id:"active-members-tab",value:"Active",label:"Active",count:B?.length,children:s(Qe,{activeClinicians:B,prepareAddClinician:R,setPurchaseTeamSeatsModalVisible:p})},1),s(Pe.Tab,{"data-testid":"pending-members-tab",id:"pending-members-tab",value:"Pending invites",label:"Pending invites",count:h?.length||0,children:s(Ct,{prepareAddClinician:R,pendingInvitations:h,setPurchaseTeamSeatsModalVisible:p})},2),s(Pe.Tab,{"data-testid":"deactivated-members-tab",id:"deactivated-members-tab",value:"Deactivated",label:"Deactivated",count:ae.length,children:s(St,{deactivatedClinicians:ae,setPurchaseTeamSeatsModalVisible:p})},3)]}):s(Qe,{activeClinicians:B,prepareAddClinician:R,setPurchaseTeamSeatsModalVisible:p}),u&&s(wt,{openModal:u,setOpenModal:v,availableSubscriptions:j?.unAssigned||[],createInvitation:te,handleTeamSeatPurchase:()=>p(!0)})]})}),t[42]=B,t[43]=e,t[44]=De,t[45]=ae,t[46]=te,t[47]=N,t[48]=y,t[49]=F,t[50]=h,t[51]=j?.unAssigned,t[52]=u,t[53]=ne,t[54]=oe):oe=t[54];let Te;t[55]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>{p(!1),c(!1)},t[55]=Te):Te=t[55];let Ie;t[56]===Symbol.for("react.memo_cache_sentinel")?(Ie=s(P,{wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,onClick:()=>p(!1),variant:M.GHOST,children:"Cancel"}),t[56]=Ie):Ie=t[56];const Oe=z<=d.purchased-d.canceled||o||!V,Ge=V?it(z-(d.purchased-d.canceled)):"Add payment method";let ce;t[57]!==D||t[58]!==o||t[59]!==Oe||t[60]!==Ge?(ce=i("div",{className:"tw-flex tw-gap-3 tw-flex-col-reverse sm:tw-flex-row tw-w-full tw-items-center tw-justify-between",children:[Ie,s(P,{loading:o,"data-testid":"purchase-seats-button-on-purchase-dialog",wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,disabled:Oe,onClick:D,variant:M.FILLED,children:Ge})]}),t[57]=D,t[58]=o,t[59]=Oe,t[60]=Ge,t[61]=ce):ce=t[61];let Re;t[62]===Symbol.for("react.memo_cache_sentinel")?(Re=s(ke,{wrapperClasses:"tw-mb-6 tw-mt-3"}),t[62]=Re):Re=t[62];let de;t[63]!==d.canceled||t[64]!==d.purchased||t[65]!==z?(de=d.purchased-d.canceled===z&&s(U,{tagName:"p",size:X.BASE,weight:he.BOLD,className:"t tw-my-0 tw-text-gray-black",children:"Current plan pricing"}),t[63]=d.canceled,t[64]=d.purchased,t[65]=z,t[66]=de):de=t[66];const He=l?.period,Fe=l?.period;let me;t[67]!==He||t[68]!==Fe?(me=s(bt,{billingDuration:He,currentDuration:Fe,showPurchaseButton:!1,showPurchaseSeats
12Button:!1}),t[67]=He,t[68]=Fe,t[69]=me):me=t[69];let we;t[70]!==n?(we=s("div",{"data-testid":"payment-method-container-on-purchase-dialog",className:"tw-mt-4 tw-text-left",children:s(ht,{toggle:n,setToggle:c,setLoading:x})}),t[70]=n,t[71]=we):we=t[71];let ue;t[72]!==de||t[73]!==me||t[74]!==we?(ue=i("div",{className:"tw-overflow-y-scroll tw-px-2 tw-mb-36 sm:tw-mb-0",children:[de,me,we]}),t[72]=de,t[73]=me,t[74]=we,t[75]=ue):ue=t[75];let fe;t[76]!==I||t[77]!==ce||t[78]!==ue?(fe=i(ve,{title:"Purchase team seats",description:"Add more seats to your subscription below.",isHeaderSticky:!0,open:I,onClose:Te,footer:ce,children:[Re,ue]}),t[76]=I,t[77]=ce,t[78]=ue,t[79]=fe):fe=t[79];let Me;return t[80]!==oe||t[81]!==fe?(Me=i(le,{children:[oe,fe]}),t[80]=oe,t[81]=fe,t[82]=Me):Me=t[82],Me}const Et=t=>{const e=be.c(16),{isLoadingSubscription:C}=t,u=Dt,{teamOwnerData:v,activeClinicians:o}=xe(),[x,I]=g.useState(""),[p,n]=g.useState(!1),c=!!x;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=E=>I(E),e[0]=b):b=e[0];let _;e[1]!==o?(_=o?.map(Ot),e[1]=o,e[2]=_):_=e[2];const k=o.length===0;let S;e[3]!==x||e[4]!==_||e[5]!==k?(S=[s(ye,{"data-testid":"select-clinician-filter",label:"Clinician name",placeholder:"Select clinician",value:x,onChange:b,options:_,disabled:k},"clinician")],e[3]=x,e[4]=_,e[5]=k,e[6]=S):S=e[6];const y=S;let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{I("")},e[7]=l):l=e[7];const N=l;let F;return e[8]!==o||e[9]!==c||e[10]!==x||e[11]!==p||e[12]!==C||e[13]!==y||e[14]!==v?(F=s(le,{children:C?s(tt,{}):i("div",{className:st("tw-flex tw-flex-col tw-gap-2 tw-mb-6"),children:[s(U,{tagName:X.H1,size:X.H1,"data-testid":"team-management-page-title",children:"Team management"}),s(U,{className:"tw-text-gray-500",children:"Invite your team members, assign and unassign team seats, monitor team information."}),s($e,{dismissible:!0,icon:"Lock1",title:"Team management is only available on the new Team plan",description:"To access updated features like assigning, unassigning, and reassigning team seats, transfer your team to the new Team plan. Reach out and we will help you migrate your team subscription and answer any questions along the way!",variant:T.PRIMARY_GRADIENT,actions:[{children:"Book a call",onClick:u,variant:M.OUTLINED}]}),s("div",{className:"-tw-mt-4 tw-bg-transparent",children:s(at,{children:s(le,{})})}),s(U,{"data-testid":"team-table-title",size:X.H3,weight:he.BOLD,tagName:"h3",children:"Team members"}),s(pt,{primaryFilters:y,isFilterOpen:p,onFilterToggle:n,onClearAll:N,areFiltersApplied:c,containerClasses:"tw-mb-4"}
12),s(Ee,{columns:[{id:"user_name",label:"Clinician name",renderCell:E=>i("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-flex tw-items-center tw-gap-1",children:[s(Ae,{name:E.user_name.split(" ")[0],maxLength:16}),E.user_id===v.user_id&&s("span",{className:"tw-text-gray-500 tw-italic tw-text-xs",children:"(admin)"})]}),sort:{sortKey:"user_name"}},{id:"Email",label:"Email",renderCell:Gt,sort:{sortKey:"user_email"}},{id:"saved_notes",label:"Saved notes",renderCell:Ht,sort:{sortKey:"saved_notes"}},{id:"teamseat",label:"Team seat",renderCell:Ft,sort:{sortKey:"teamseat"}}],customTheme:{Table:` 13 --data-table-library_grid-template-columns: minmax(7rem, 1fr) minmax(7rem, 1fr) minmax(7rem, 1fr) minmax(7rem, 1fr) ; 14 `,HeaderCell:` 15 div > button > div { 16 margin-right:0.1875rem; 17 font-weight: 600; 18 max-width: fit-content; 19 display: inline-block; 20 } 21 `},data:[...o.filter(E=>E.user_name.toLowerCase().includes(x.trim().toLowerCase()))].map(jt)})]})}),e[8]=o,e[9]=c,e[10]=x,e[11]=p,e[12]=C,e[13]=y,e[14]=v,e[15]=F):F=e[15],F};function Dt(){window.open("https://www.calendly.com/mentalyc-com/meet","_blank")}function Ot(t){return{label:t.user_name,value:t.user_name}}function Gt(t){return s(Ae,{name:t.user_email,maxLength:20})}function Ht(t){return t.saved_notes?t.saved_notes:"-"}function Ft(){return s(Ye,{"data-testid":"team-seat-badge",color:T.SUCCESS,label:"Assigned"})}function jt(t){return{id:t.user_id,user_name:t.user_name,user_email:t.user_email,saved_notes:t.saved_notes,teamseat:!0}}const $t=()=>{const t=be.c(11),e=Xe(),{isTeamMember:C,isOwner:u,isActivated:v,hasOldTeamSubscription:o}=et(),{activeSubscription:x,isLoadingSubscription:I,teamId:p}=Ne(),{teamOwnerData:n}=xe(),c=x?.trial_end!==null&&x?.subscription_active===!1;let b;return t[0]!==x?.product_name||t[1]!==o||t[2]!==e||t[3]!==v||t[4]!==I||t[5]!==c||t[6]!==u||t[7]!==C||t[8]!==p||t[9]!==n?(b=s(le,{children:I?s(tt,{}):o()?s(Et,{isLoadingSubscription:I}):i("div",{className:st("tw-flex tw-flex-col tw-gap-3",!v()&&"tw-gap-3"),children:[s(U,{tagName:X.H1,size:X.H1,"data-testid":"team-management-page-title",children:"Team management"}),v()||!p?i(le,{children:[C?s($e,{"data-testid":"admin-info-banner-on-team-member-account",icon:"Message",title:"Want to make any change?",description:`Only your team admin can invite team members and manage seats for your team.</br> Please reach out to <b>${n.user_name}</b>`,variant:T.INFO}):s(U,{size:X.BASE,children:"Invite your team members, assign and unassign team seats, monitor team information."}),!(C&&x?.product_name==="Free")&&s(at,{children:u()&&!C&&(c?s(P,{onClick:()=>e.push("subscription"),color:T.PRIMARY_GRADIENT,wrapperClasses:"tw-w-full sm:tw-w-fit",fullWidth:!0,variant:M.FILLED,children:"Subscribe"}):s(P,{"data-testid":"add-or-remove-seats-cta",color:T.PRIMARY,icon:"Setting2",fullWidth:!0,onClick:()=>e.push("subscription"),variant:M.GHOST,children:"Add or remove seats"}))}),s(Lt,{})]}):s(_t,{})]})}),t[0]=x?.product_name,t[1]=o,t[2]=e,t[3]=v,t[4]=I,t[5]=c,t[6]=u,t[7]=C,t[8]=p,t[9]=n,t[10]=b):b=t[10],b},qt=$t;export{qt as default}; 22//# sourceMappingURL=index-267f4a09.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.