import{ao as t,au as d,b9 as h,L as l,aw as x,aI as C,c8 as S,bv as m,M as o,by as y,aQ as f,a_ as v,a$ as j,e8 as I,aC as N}from"./app-k0jcl5PQ.js";import{m as T}from"./BUELddOb.chunk.js";import{s as i,U as b}from"./CnoMMtVD.chunk.js";import{T as p}from"./D1M9dqnr.chunk.js";import{T as R}from"./CnSDR2E3.chunk.js";import{I as $}from"./CovT_itD.chunk.js";const E="shared.classroomGroupRecipientItemMetadata";function _(e){var s,r;const a=((s=e.users)==null?void 0:s.count)??0,n=(r=e.classroom)==null?void 0:r.name;return n?l.getPhrase(E,"subheading",{classroomName:n,smartCount:a}):""}function U(e){var a;return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`${i.avatarContainer} d-inline-block`,children:t.jsx(d,{svg:h,variant:T((a=e.classroomGroup.metadata)==null?void 0:a.colour)})}),t.jsxs("div",{className:e.detailsClassName,children:[t.jsx("h4",{className:"font-size-normal fw-normal m-0",children:e.classroomGroup.name}),t.jsx("p",{className:"text-secondary m-0",children:_(e.classroomGroup)})]})]})}const w="shared.classroomRecipientItemMetadata";function k(e){var n,s;const a=((n=e.users)==null?void 0:n.count)??((s=e.enrolments)==null?void 0:s.count);return Number.isInteger(a)?l.getPhrase(w,"subheading",{smartCount:a}):""}function G(e){return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`${i.avatarContainer} d-inline-block`,children:t.jsx(d,{svg:x,variant:"teal"})}),t.jsxs("div",{className:e.detailsClassName,children:[t.jsx("h4",{className:"font-size-normal fw-normal m-0",children:e.classroom.name}),t.jsx("p",{className:"text-secondary m-0",children:k(e.classroom)})]})]})}const O="share.recipientItem",u=l.encloseNamespace(O);function D(e){switch(e){case o.User:return u("removeUser");case o.Classroom:return u("removeClassroom");case o.ClassroomGroup:return u("removeGroup")}return null}function M(e){const[a,n]=C.useState(!1);let s=`${i.recipientItem} d-flex`;a&&(s+=` ${i.showSpinner}`);const r=`${e.removeRecipient?i.recipientDetailsWithRemoveButton:i.recipientDetails} d-inline-block ms-2`;function g(){n(!0),e.removeRecipient(e.entity.id,()=>n(!1))}return t.jsxs("div",{className:s,children:[(()=>{if(m.isType(e.entity,o.User))return t.jsx(b,{user:e.entity,imageCdnUrl:e.imageCdnUrl,detailsClassName:r,showDisplayName:e.showDisplayName,getSubText:e.getSubText,showSubText:!0});if(m.isType(e.entity,o.Classroom))return t.jsx(G,{classroom:e.entity,detailsClassName:r});if(m.isType(e.entity,o.ClassroomGroup))return t.jsx(U,{classroomGroup:e.entity,detailsClassName:r})})(),S.isFunction(e.removeRecipient)&&t.jsx("div",{className:`${i.removeRecipient} d-inline-flex justify-content-center align-items-center`,children:a?t.jsx(y,{as:"div",size:"sm",animation:"border",role:"status"}):t.jsx(f,{title:D(e.entity.typeId),spanHack:!0,children:t.jsx("div",{className:"btn-close cursor-pointer",role:"button","aria-label":"Close",onClick:g})})})]})}const P="_container_sxosy_1",H="_suggestionsContainerOpen_sxosy_11",F="_selectionContainer_sxosy_18",z="_sectionContainer_sxosy_28",c={container:P,suggestionsContainerOpen:H,selectionContainer:F,sectionContainer:z},B="shared.tokenizedTypeahead",Z=10;A.defaultProps={renderSuggestionsOnInputFocus:!0};function A(e){var a;return t.jsxs("div",{className:`form-control h-auto d-flex align-items-top position-relative ${e.hideIcon?"":"py-1 px-0"} ${e.className}`,children:[!e.hideIcon&&t.jsx(v,{className:"svg-container m-1",svg:j}),t.jsxs("div",{className:`${c.selectionContainer} d-flex flex-wrap align-items-center mt-n1`,children:[e.selections.map(n=>e.getInputTokenComponent?e.getInputTokenComponent(n):t.jsx($,{selection:n,onClickRemove:e.removeSelection,onClickExpand:e.fetchSelectionMembers,hasStudentExperience:e.hasStudentExperience},n.id)),t.jsx(I,{...e,onBackspace:()=>{e.selections.length&&e.removeSelection(N.last(e.selections))},recentSearchHeading:e.recentSearchHeading||l.getPhrase(B,"recentSearchHeading"),placeholder:(a=e.selections)!=null&&a.length?" ":e.placeholder,searchIconPlacement:!1,clearQueryOnSelect:!0,getSuggestionComponent:n=>e.getSuggestionComponent?e.getSuggestionComponent(n):t.jsx(M,{entity:n,imageCdnUrl:e.imageCdnUrl,showDisplayName:e.hasStudentExperience}),getEmptyStateComponent:n=>{if(e.getEmptyStateComponent)return e.getEmptyStateComponent(n);e.emptyStateImageUrl&&(p,e.emptyStateImageUrl)},getErrorStateComponent:n=>t.jsx(R,{imageUrl:e.errorStateImageUrl,onClickTryAgain:n}),theme:{container:c.container,suggestionsContainerOpen:`bg-white py-1 rounded border mt-1 ${c.suggestionsContainerOpen}`,sectionContainer:`border-bottom py-1 ${c.sectionContainer}`},sectionTitleClassName:"ps-2",renderSuggestionsOnInputFocus:e.renderSuggestionsOnInputFocus,onSuggestionDependencies:[e.selections]})]}),!!e.sharePermissionsDescription&&t.jsx("span",{className:"px-2 text-secondary text-nowrap",children:e.sharePermissionsDescription})]})}export{M as R,A as T,Z as a};
//# sourceMappingURL=m0YrH4Ug.chunk.js.map
