1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8651],{28651:(e,t,a)=>{a.r(t),a.d(t,{default:()=>x});var n=a(95155),l=a(12115),i=a(97003),r=a(91837),s=a(86651),d=a(65229),o=a(35299),c=a(73697),m=a(41256),u=a(47507);let x=e=>{let{data:t}=e,a=(0,l.useRef)(null),x=(0,l.useRef)(null),{candidates:h,loadingCandidates:f,selectedCandidates:p,setSelectedCandidates:g,isLoading:_,handleSave:v,handleCancel:y,hasMore:b,onLoadMore:N,isLoadingMore:j,hasChanges:w,searchQuery:T,setSearchQuery:S,isSearching:C,sortBy:E,setSortBy:M}=(0,r.Y)(t),D=e=>{p.some(t=>t.id===e.id)?g(p.filter(t=>t.id!==e.id)):g([...p,e])};return((0,l.useEffect)(()=>{let e=a.current,t=x.current;if(!e||!t||!N)return;let n=new IntersectionObserver(e=>{let t=e[0];(null==t?void 0:t.isIntersecting)&&!1!==b&&!j&&N()},{root:e,rootMargin:"200px 0px 0px 0px",threshold:0});return n.observe(t),()=>n.disconnect()},[N,b,j]),f)?(0,n.jsx)("div",{className:"h-full flex flex-col items-center justify-center",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-4"}),(0,n.jsx)("p",{className:"text-gray-600",children:"Loading candidates..."})]})}):(0,n.jsxs)("div",{className:"h-full flex flex-col",children:[(0,n.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,n.jsx)("div",{className:"shrink-0 px-1",children:(0,n.jsxs)("div",{className:"flex items-stretch gap-2 mt-1",children:[(0,n.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,n.jsx)(s.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,n.jsx)("input",{type:"text",value:T,onChange:e=>S(e.target.value),placeholder:"Search candidates",className:"w-full h-10 pl-9 pr-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-transparent text-sm"})]}),(0,n.jsxs)(u.Select,{...E?{value:E}:{},onValueChange:e=>{("ai_score"===e||"ccm_score"===e)&&M(e)},children:[(0,n.jsx)(u.SelectTrigger,{className:"!h-10 w-[180px] shrink-0 bg-white shadow-none rounded-lg border border-gray-200 cursor-pointer px-3",children:(0,n.jsx)("span",{className:"truncate text-sm text-gray-900",children:"ai_score"===E?"Sort by : Xyrus match":"ccm_score"===E?"Sort by : Role match":"Sort by"})}),(0,n.jsxs)(u.SelectContent,{className:"bg-white z-[9999]",children:[(0,n.jsx)(u.SelectItem,{value:"ai_score",className:"cursor-pointer",children:"Xyrus match"}),(0,n.jsx)(u.SelectItem,{value:"ccm_score",className:"cursor-pointer",children:"Role match"})]})]})]})}),(0,n.jsx)("div",{className:"shrink-0 mt-4",children:p.length>0?(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:p.map(e=>(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-gray-100 border border-gray-200 rounded-lg px-2 text-sm text-gray-800",children:[e.name,(0,n.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void g(p.filter(e=>e.id!==t))},className:"p-0.5 cursor-pointer","aria-label":"Remove ".concat(e.name),children:(0,n.jsx)(d.A,{className:"w-3.5 h-3.5"})})]},e.id))}):(0,n.jsx)("p",{className:"mt text-sm text-gray-500",children:"No candidates selected"})}),(0,n.jsx)("div",{className:"mt-4 flex-1 min-h-0 flex flex-col",children:(0,n.jsx)("div",{ref:a,className:"flex-1 overflow-y-auto border border-gray-200 rounded-lg bg-white min-h-[200px]",children:C?(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,n.jsx)(o.A,{className:"w-6 h-6 animate-spin text-blue-600 mb-2"}),(0,n.jsx)("p",{className:"text-sm text-gray-600",children:"Searching candidates..."})]}):0===h.length?(0,n.jsx)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500 text-sm",children:"No candidates found"}):(0,n.jsxs)(n.Fragment,{children:[h.map(e=>{var t,a;let l=p.some(t=>t.id===e.id),i=null!=(t=e.ai_score_summary)?t:[];return(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>D(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),D(e))},className:"flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-gray-50 border-b border-gray-100 last:border-b-0",children:[(0,n.jsx)("input",{type:"checkbox",checked:l,onChange:t=>{t.stopPropagation(),D(e)},className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 shrink-0"}),(0,n.jsx)("div",{className:"w-8 h-8 bg-gray-300 rounded-full flex items-center justify-center shrink-0",children:(0,n.jsx)("span",{className:"text-gray-700 font-semibold text-xs",children:e.avatar})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium text-gray-900 truncate",children:e.name}),(0,n.jsx)("div",{className:"text-sm text-gray-600 truncate",children:e.role})]}),(0,n.jsxs)("div",{className:"flex items-center gap-4 shrink-0",children:[(0,n.jsx)(c.A,{rstScore:e.cdoRstScore,aiScoreSummary:i,scoreColor:"text-brand-2nd",scoreFontSize:"text-lg",tooltipSideOffset:178,className:"cursor-help"}),(0,n.jsx)(m.A,{ccmScore:Math.round((null!=(a=e.ccmScore)?a:0)*100),extraData:e.extra_data,aiScoreSummary:i,className:"text-center cursor-help group flex flex-col mb-1",scoreClassName:"text-brand-1st font-bold text-lg",labelClassName:"text-gray-600 text-[10px] group-hover:underline underline-offset-2",side:"left",sideOffset:235,tooltipContentClassName:"transform -translate-x-45",collisionPadding:0,avoidCollisions:!0})]})]},e.id)}),(0,n.jsx)("div",{ref:x,className:"h-4"}),j?(0,n.jsx)("div",{className:"flex justify-center py-3",children:(0,n.jsx)(o.A,{className:"w-5 h-5 animate-spin text-gray-400"})}):null,!1===b&&h.length>0?(0,n.jsx)("div",{className:"text-center py-2 text-gray-400 text-xs",children:"No more results"}):null]})})})]}),(0,n.jsxs)("div",{className:"flex gap-3 pt-4 pb-7 border-t border-gray-200 bg-gray-50 shrink-0",children:[(0,n.jsx)(i.Button,{onClick:v,disabled:_||!w,className:"px-6",children:_?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.A,{className:"w-4 h-4 animate-spin"})," ",(0,n.jsx)("span",{children:"Saving..."})]}):"Save"}),(0,n.jsx)(i.Button,{variant:"outline",onClick:y,disabled:_,className:"px-6",children:"Cancel"})]})]})}},41256:(e,t,a)=>{a.d(t,{A:()=>r});var n=a(95155),l=a(12115),i=a(82180);let r=e=>{let{ccmScore:t,extraData:a,aiScoreSummary:r=[],className:s="flex flex-col items-center mt-1 cursor-help group",scoreClassName:d="text-sm font-bold text-brand-1st",labelClassName:o="text-xs text-gray-500 pt-1 group-hover:underline underline-offset-2",side:c="top",sideOffset:m=10,align:u="center",tooltipContentClassName:x="",collisionPadding:h=20,avoidCollisions:f=!0}=e,p=l.useMemo(()=>(null==a?void 0:a.per_domain)?Object.entries(a.per_domain):[],[null==a?void 0:a.per_domain]),g=l.useMemo(()=>{let e=new Map;return r.forEach(t=>{e.set(t.domain_name,t.domain_reasoning)}),e},[r]);return(0,n.jsxs)(i.Tooltip,{children:[(0,n.jsx)(i.TooltipTrigger,{asChild:!0,children:(0,n.jsxs)("div",{className:s,children:[(0,n.jsx)("span",{className:d,children:t}),(0,n.jsx)("span",{className:o,children:"Role match"})]})}),(0,n.jsx)(i.TooltipContent,{side:c,sideOffset:m,align:u,collisionPadding:h,avoidCollisions:f,onClick:e=>{e.stopPropagation()},className:"z-9999 bg-white text-black p-3 rounded shadow-md w-[500px] max-h-[600px] flex flex-col ".concat(x),children:(0,n.jsxs)("div",{className:"flex flex-col gap-2 w-full h-full overflow-hidden",children:[(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsxs)("div",{className:"text-xl font-bold text-brand-primary",children:[(0,n.jsx)("span",{className:"text-text-primary",children:"Role Match:\xa0"}),t]})}),(0,n.jsx)("div",{className:"space-y-2 bg-text-placeholder/10 p-2 rounded-lg shrink-0",children:p.length>0?p.map(e=>
1{let[t,a]=e,l="number"==typeof a.distance_percent?Math.max(0,Math.min(100,100*a.distance_percent)):0;return(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,n.jsx)("span",{className:"text-s text-text-secondary shrink-0",children:t}),(0,n.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,n.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,n.jsx)("div",{className:"h-2 rounded-full ".concat(l<50?"bg-brand-1st":l<99?"bg-brand-2nd":"bg-brand-4th"),style:{width:"".concat(l,"%")}})}),(0,n.jsxs)("span",{className:"text-s font-medium text-text-primary shrink-0",children:[Math.round(l),"%"]})]})]},t)}):(0,n.jsx)("div",{className:"text-s text-text-secondary",children:"Domain-wise role match details are not available."})}),(0,n.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 bg-text-placeholder/10 rounded-lg p-2",children:[(0,n.jsx)("div",{className:"font-bold text-base shrink-0 mb-2",children:"Rationale"}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto space-y-2 pr-1",children:(null==p?void 0:p.length)>0?null==p?void 0:p.map(e=>{let[t]=e,a=g.get(t);return(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"font-semibold text-text-primary",children:[t,":"]}),(0,n.jsx)("div",{className:"text-xs text-text-secondary wrap-break-words",children:a||"Domain reasoning is currently unavailable for this area."})]},t)}):(null==a?void 0:a.recommendation_reason)?(0,n.jsx)("div",{className:"text-xs text-text-secondary wrap-break-words",children:a.recommendation_reason}):(0,n.jsx)("div",{className:"text-xs text-text-secondary",children:"AI reasoning details are not available."})})]})]})})]})}},73697:(e,t,a)=>{a.d(t,{A:()=>i});var n=a(95155);a(12115);var l=a(82180);function i(e){let{rstScore:t,aiScoreSummary:a=[],fitReason:i,label:r="xyrus match",tooltipSide:s="left",tooltipSideOffset:d=-5,tooltipAlign:o="start",tooltipAlignOffset:c=-50,className:m="text-right flex flex-col items-center cursor-help group",scoreColor:u="text-orange-500",scoreFontSize:x="text-2xl",labelFontSize:h="text-[10px]"}=e;return(0,n.jsxs)(l.Tooltip,{delayDuration:100,children:[(0,n.jsx)(l.TooltipTrigger,{asChild:!0,children:(0,n.jsxs)("div",{className:"text-right group cursor-pointer ".concat(m),children:[(0,n.jsx)("div",{className:"".concat(u," ").concat(x," font-bold leading-none"),children:t}),(0,n.jsx)("div",{className:"".concat(h," text-text-secondary mt-1 group-hover:underline underline-offset-2 truncate"),children:r})]})}),(0,n.jsx)(l.TooltipContent,{side:s,sideOffset:d,align:o,alignOffset:c,avoidCollisions:!0,className:"z-9999 bg-white text-black p-3 rounded shadow-md w-[500px] max-h-[600px] flex flex-col transform -translate-x-45",children:(0,n.jsxs)("div",{className:"flex flex-col gap-2 w-full h-full overflow-hidden",children:[(0,n.jsxs)("div",{className:"text-xl font-bold shrink-0",children:["xyrus score:\xa0",(0,n.jsx)("span",{className:"text-brand-4th",children:null!=t?t:"-"})]}),(0,n.jsx)("div",{className:"space-y-2 bg-text-placeholder/10 rounded-lg p-2 shrink-0",children:a.length>0?a.map(e=>{let t="number"==typeof e.score_percentage?Math.max(0,Math.min(100,Math.round(e.score_percentage))):0;return(0,n.jsx)("div",{className:"flex flex-col gap-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("span",{className:"text-s text-text-secondary font-medium min-w-[120px]",children:[e.domain_name,":"]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,n.jsx)("div",{className:"h-2 rounded-full ".concat(t<50?"bg-brand-1st":t<99?"bg-brand-2nd":"bg-brand-4th"),style:{width:"".concat(t,"%")}})}),(0,n.jsxs)("span",{className:"text-s font-medium text-text-primary shrink-0",children:[t,"%"]})]})]})},e.domain_name)}):(0,n.jsx)("div",{className:"text-s text-text-secondary",children:"Domain-wise AI score details are not available."})}),(0,n.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 bg-text-placeholder/10 rounded-lg p-2",children:[(0,n.jsx)("div",{className:"font-bold text-base shrink-0 mb-2",children:"Rationale"}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto space-y-2 pr-1",children:a.length>0?a.map(e=>(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"font-semibold text-text-primary",children:[e.domain_name,":"]}),(0,n.jsx)("div",{className:"text-xs text-text-secondary wrap-break-word",children:e.domain_reasoning||"Domain reasoning is currently unavailable for this area."})]},e.domain_name)):i?(0,n.jsx)("div",{className:"text-xs text-text-secondary wrap-break-word",children:i}):(0,n.jsx)("div",{className:"text-xs text-text-secondary",children:"AI reasoning details are not available."})})]})]})})]})}},91837:(e,t,a)=>{a.d(t,{Y:()=>f});var n=a(12115),l=a(94054),i=a(18720),r=a(75358),s=a(99429),d=a(75557),o=a(41180),c=a(9143),m=a(80587),u=a.n(m),x=a(78923);function h(e,t,a){if(t){let n=null!=e?e:new Date;return u().tz({year:n.getFullYear(),month:n.getMonth(),date:n.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()},a).toISOString()}if(e)return e.toISOString()}let f=e=>
1{let[t,a]=(0,n.useState)(void 0),[m,u]=(0,n.useState)(""),[f,p]=(0,n.useState)(""),[g,_]=(0,n.useState)(!1),[v,y]=(0,n.useState)([]),[b,N]=(0,n.useState)(!0),[j,w]=(0,n.useState)([]),[T,S]=(0,n.useState)(1),[C,E]=(0,n.useState)(1),[M,D]=(0,n.useState)(!1),[R,O]=(0,n.useState)(""),[k,A]=(0,n.useState)(!1),[I,P]=(0,n.useState)(null),[z,F]=(0,n.useState)({}),[L,J]=(0,n.useState)("events"),[H,U]=(0,n.useState)(!1),[V,q]=(0,n.useState)(!1),[K,W]=(0,n.useState)({}),[Y,B]=(0,n.useState)({}),[X,G]=(0,n.useState)({}),[Q,Z]=(0,n.useState)({}),[$,ee]=(0,n.useState)({}),[et,ea]=(0,n.useState)(null),[en,el]=(0,n.useState)(null),[ei,er]=(0,n.useState)(null),[es,ed]=(0,n.useState)(null),[eo,ec]=(0,n.useState)(!1),[em,eu]=(0,n.useState)({type:"",date:null,startTime:null,endTime:null,timezone:"",mode_of_interaction:"",person:"",selected_member_id:"",selected_member_type:"",description:"",client_member_name:""}),[ex,eh]=(0,n.useState)({title:"",content:""}),ef=(0,n.useMemo)(()=>{if(em.startTime instanceof Date&&!isNaN(em.startTime.getTime())&&em.endTime instanceof Date&&!isNaN(em.endTime.getTime())){let e=60*em.startTime.getHours()+em.startTime.getMinutes();return 60*em.endTime.getHours()+em.endTime.getMinutes()<=e}return!1},[em.startTime,em.endTime]),ep=(0,n.useMemo)(()=>{let e=e=>e instanceof Date&&!isNaN(e.getTime());return""!==em.type.trim()&&e(em.date)&&e(em.startTime)&&e(em.endTime)&&(""!==em.selected_member_id||""!==em.person.trim()||""!==em.client_member_name.trim())&&!ef},[em.type,em.date,em.startTime,em.endTime,em.timezone,em.mode_of_interaction,em.selected_member_id,em.person,em.client_member_name,ef]),eg=(0,c.GV)(e=>{var t;return null==(t=e.userProfile.profileData)?void 0:t.timezone})||(0,x.FJ)(),e_=(0,n.useMemo)(()=>(null==e?void 0:e.profiles)||[],[null==e?void 0:e.profiles]),ev=(0,n.useMemo)(()=>(null==e?void 0:e.selectedId)||void 0,[null==e?void 0:e.selectedId]),ey=(0,n.useMemo)(()=>(null==e?void 0:e.highlightedCandidateId)||void 0,[null==e?void 0:e.highlightedCandidateId]),eb=(0,n.useMemo)(()=>{var t;return null==(t=null==e?void 0:e.hideClientDetails)||t},[null==e?void 0:e.hideClientDetails]),eN=(0,n.useMemo)(()=>(null==e?void 0:e.projectId)||void 0,[null==e?void 0:e.projectId]),ej=(0,n.useMemo)(()=>(null==e?void 0:e.view)||(ev?"detail":"list"),[null==e?void 0:e.view,ev]),ew=null==e?void 0:e.clientContactsData,eT=(null==e?void 0:e.loadingClientContacts)||!1,eS=null==e?void 0:e.getClientContacts,eC=null==e?void 0:e.handleCreateEvent,eE=(null==e?void 0:e.isCreatingEvent)||!1,{data:eM,isLoading:eD,execute:eR}=(0,r.sO)(e=>s.Sn.PROJECT.EVENT_CANDIDATE_LIST(e),{queryKey:e=>["event-members-list",e]}),eO=(0,n.useRef)(!1),ek=(0,n.useRef)(!1),eA=(0,n.useRef)(""),eI=(0,n.useRef)(null);(0,n.useEffect)(()=>{eN&&!eO.current&&eS&&(eS(),eO.current=!0)},[eN]),(0,n.useEffect)(()=>{eN&&(H||et)&&eR(eN)},[eN,H,et]);let{data:eP,isLoading:ez,error:eF,execute:eL}=(0,r.sO)(e=>s.Sn.PROJECT.RECOMMENDATIONS_ALL_NOTES(e.projectId,e.candidateId),{queryKey:["notes"]}),eJ=(0,r.L2)({method:"post",url:eN&&ev?s.Sn.PROJECT.RECOMMENDATIONS_ADD_NOTE(ev):""}),eH=(0,r.L2)({method:"put"}),eU=(0,r.L2)({method:"delete"}),eV=(0,r.L2)({method:"delete"}),eq=(0,r.L2)({method:"put"}),{data:eK,isLoading:eW,error:eY,execute:eB}=(0,r.sO)(e=>s.Sn.PROJECT.RECOMMENDED_CANDIDATE_EVENT_FETCH(e.candidateId),{queryKey:e=>{var t,a;return["events",e.candidateId,null!=(a=null==(t=e.params)?void 0:t.project_id)?a:null]}}),eX=(0,r.L2)({method:"put"});(0,n.useEffect)(()=>{ek.current||((async()=>{try{N(!0);let t=null==e?void 0:e.getCandidatesPage;if("function"==typeof t){let e=await t(1,10,R||void 0,I);y(e.items||[]),S(1),E(e.totalPages||1)}else if((null==e?void 0:e.fetchCandidates)&&"function"==typeof e.fetchCandidates){let t=await e.fetchCandidates();y(t),S(1),E(1)}}catch(e){console.error("Failed to fetch candidates:",e),i.oR.error("Failed to load candidates list")}finally{N(!1)}})(),ek.current=!0)},[]);let eG=(0,l.d)(R,500);(0,n.useEffect)(()=>{let t=null==e?void 0:e.getCandidatesPage;"function"==typeof t&&ek.current&&eA.current!==eG&&(async()=>{try{A(!0);let e=await t(1,10,eG||void 0,I);y(e.items||[]),S(1),E(e.totalPages||1),eA.current=eG}catch(e){console.error("Failed to fetch candidates with search:",e),i.oR.error("Failed to search candidates")}finally{A(!1)}})()},[eG,I,e]),(0,n.useEffect)(()=>{let t=null==e?void 0:e.getCandidatesPage;"function"==typeof t&&ek.current&&eI.current!==I&&(async()=>{try{A(!0);let e=await t(1,10,eG||void 0,I);y(e.items||[]),S(1),E(e.totalPages||1),eI.current=I}catch(e){console.error("Failed to fetch candidates with sort:",e),i.oR.error("Failed to sort candidates")}finally{A(!1)}})()},[I,eG,e]);let eQ=(0,n.useCallback)(async()=>{let t=null==e?void 0:e.getCandidatesPage;if("function"==typeof t&&!M&&!(T>=C)){D(!0);try{let e=T+1,a=await t(e,10,R||void 0,I);y(e=>[...e,...a.items||[]]),S(e),E(a.totalPages||C)}catch(e){console.error("Failed to load more candidates",e)}finally{D(!1)}}},[e,M,T,C,R,I]);(0,n.useEffect)(()=>
1{if(v.length>0){let e=v.filter(e=>!0===e.added);w(t=>{let a=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!a.has(e.id))]})}},[v]),(0,n.useEffect)(()=>{let t=null==e?void 0:e.recommendation;t&&(a(t.status||void 0),u(t.name),p(""))},[null==e?void 0:e.recommendation]),(0,n.useEffect)(()=>{let e=setTimeout(()=>{let e=document.querySelector("[data-radix-select-trigger]");e&&e.focus()},100);return()=>clearTimeout(e)},[]);let eZ=(0,n.useMemo)(()=>v.filter(e=>e.added).map(e=>e.id),[v]),e$=(0,n.useMemo)(()=>j.map(e=>e.id),[j]),e0=(0,n.useMemo)(()=>e$.filter(e=>!eZ.includes(e)),[e$,eZ]),e1=(0,n.useMemo)(()=>eZ.filter(e=>!e$.includes(e)),[eZ,e$]),e2=(0,n.useMemo)(()=>e0.length>0||e1.length>0,[e0,e1]),e5=async()=>{let a=null==e?void 0:e.onSave;if(a){_(!0);try{var n;"function"==typeof(null==e?void 0:e.fetchCandidates)?(await a({candidate_ids:e0,remove_candidate_ids:e1}),w([])):await a({status:t,name:m}),null==e||null==(n=e.closeModal)||n.call(e)}catch(e){console.error("Error saving recommendations:",e)}finally{_(!1)}}},e9=(0,n.useMemo)(()=>eK&&"object"==typeof eK&&"data"in eK&&Array.isArray(eK.data)?eK.data.map(e=>({id:e.id,title:e.title,interactedWith:e.interactedWith,scheduledOn:e.scheduledOn||(e.scheduled_at?(0,d.r6)(e.scheduled_at):void 0),endsOn:e.ends_at?(0,d.r6)(e.ends_at):void 0,interactedOn:e.interactedOn||(e.interacted_at?(0,d.Yq)(e.interacted_at):void 0),description:e.description,scheduledRaw:e.scheduled_at,ends_at:e.ends_at,timezone:e.timezone,mode_of_interaction:e.mode_of_interaction,client_member_id:e.client_member_id,organization_member_id:e.organization_member_id,client_member_name:e.client_member_name,organization_member_name:e.organization_member_name})):[],[eK]),e6=(0,n.useMemo)(()=>{let e=[],t=(null==eM?void 0:eM.organization_members)||[],a=(null==eM?void 0:eM.client_pocs)||[];for(let a of t)(null==a?void 0:a.user_id)&&(null==a?void 0:a.full_name)&&e.push({id:String(a.user_id),label:a.full_name,type:"org"});for(let t of a)if(null==t?void 0:t.client_member_id){var n,l;let a="".concat(null!=(n=t.first_name)?n:""," ").concat(null!=(l=t.last_name)?l:"").trim();e.push({id:String(t.client_member_id),label:a?"".concat(a," (client)"):"(client)",type:"client"})}return e},[eM]),e4=(0,n.useCallback)(e=>{let t=e6.find(t=>String(t.id)===e);eu(a=>({...a,selected_member_id:e,selected_member_type:t?t.type:"",client_member_name:t?t.label:"",person:t?t.label:""}))},[e6]),e3=(0,n.useCallback)(e=>{ea(e.id),U(!1);let t=e.scheduledRaw?new Date(e.scheduledRaw):null,a=e.ends_at?new Date(e.ends_at):null,n=e.interactedWith||e.client_member_name||e.organization_member_name||"";eu({type:e.title||"",date:t,startTime:t,endTime:a,timezone:e.timezone||eg||"",mode_of_interaction:e.mode_of_interaction||"",person:n,selected_member_id:e.client_member_id?String(e.client_member_id):e.organization_member_id?String(e.organization_member_id):"",selected_member_type:e.client_member_id?"client":e.organization_member_id?"org":"",description:e.description||"",client_member_name:n})},[eg]),e8=(0,n.useMemo)(()=>eP&&"object"==typeof eP&&"data"in eP&&Array.isArray(eP.data)?eP.data.map(e=>{var t,a,n,l;return{id:e.id,title:e.note_title,content:e.note_data,addedBy:(null==(t=e.created_metadata)?void 0:t.full_name)?null==(a=e.created_metadata)?void 0:a.full_name:(null==(n=e.created_metadata)?void 0:n.first_name)+" "+(null==(l=e.created_metadata)?void 0:l.last_name),isOptimistic:!1}}):[],[eP]),e7=(0,n.useMemo)(()=>{if(!ev)return e8;let e=($[ev]||[]).filter(e=>!e8.some(t=>t.title===e.title&&t.content===e.content));return[...e8,...e]},[e8,$,ev]);(0,n.useEffect)(()=>{ev&&ee(e=>{let t={...e};return Object.keys(t).forEach(e=>{e!==ev&&delete t[e]}),t})},[ev]),(0,n.useEffect)(()=>{eN&&ev&&(eL({projectId:eN,candidateId:ev}),eB({candidateId:ev,params:{project_id:null!=eN?eN:null}}))},[ev,eN]);let te=async(t,a)=>{if(!eN||!t)return;let n=z[t];F(e=>({...e,[t]:a}));try{await eq.mutateAsync({url:s.Sn.PROJECT.RECOMMENDATIONS_STATUS_UPDATE(eN,t),data:{status:a}});let n=null==e?void 0:e.refreshRecommendations;"function"==typeof n&&await n()}catch(e){F(e=>({...e,[t]:n||""})),console.error("Failed to update recommendation status",e)}},tt=async()=>
1{if(ex.title.trim()&&ex.content.trim())try{let e=new FormData;e.append("note_input",JSON.stringify({title:ex.title,content:ex.content,project_id:eN})),await eJ.mutateAsync({data:e,config:{headers:{"Content-Type":"multipart/form-data"}}}),eN&&ev&&await eL({projectId:eN,candidateId:ev}),eh({title:"",content:""}),q(!1)}catch(e){console.error("Failed to create note:",e),i.oR.error("Failed to create note. Please try again.")}},ta=async()=>{if(en&&ev)try{let e=new FormData,t={title:ex.title,content:ex.content};eN&&(t.project_id=eN),e.append("note_input",JSON.stringify(t)),await eH.mutateAsync({url:s.Sn.CANDIDATES.NOTES.UPDATE(ev,en),data:e,config:{headers:{"Content-Type":"multipart/form-data"}}}),i.oR.success("Note updated successfully"),eN&&ev&&await eL({projectId:eN,candidateId:ev}),q(!1),eh({title:"",content:""}),el(null)}catch(e){throw console.error("Failed to update note:",e),i.oR.error("Failed to update note. Please try again."),e}},tn=async e=>{if(ev&&e)try{er(e);let t=await eU.mutateAsync({url:s.Sn.PROJECT.RECOMMENDED_NOTES_DELETION(ev,e)});if((null==t?void 0:t.status_code)===200)i.oR.success(null==t?void 0:t.message);else throw Error((null==t?void 0:t.message)||"Failed to delete note");eN&&ev&&await eL({projectId:eN,candidateId:ev})}catch(e){throw console.error("Failed to delete note:",e),i.oR.error("Failed to delete note. Please try again."),e}finally{er(null)}},tl=async e=>{if(e)try{ed(e);let t=await eV.mutateAsync({url:s.Sn.PROJECT.RECOMMENDED_EVENTS_DELETION(e)});if(null==t?void 0:t.success)i.oR.success(null==t?void 0:t.message);else throw Error(null==t?void 0:t.message);ev&&await eB({candidateId:ev,params:{project_id:null!=eN?eN:null}})}catch(e){throw i.oR.error("Failed to delete event. Please try again."),e}finally{ed(null)}},ti=(0,n.useCallback)(e=>()=>{eU.isPending||o.Lx.openDialog("confirmation",{title:"Delete Note",data:{message:"Are you sure you want to delete this note? This action cannot be undone.",confirmText:"Delete",cancelText:"Cancel",onConfirm:()=>tn(e),onCancel:()=>{}},size:"sm"})},[eU.isPending,tn]),tr=(0,n.useCallback)(e=>()=>{eV.isPending||o.Lx.openDialog("confirmation",{title:"Delete Event",data:{message:"Are you sure you want to delete this event? This action cannot be undone.",confirmText:"Delete",cancelText:"Cancel",onConfirm:()=>tl(e),onCancel:()=>{}},size:"sm"})},[eV.isPending,tl]),ts=async()=>{if(!eC){console.error("handleCreateEvent is not defined. Please pass handleCreateEvent in the data prop."),i.oR.error("Unable to create event. Please refresh and try again.");return}if(ec(!0),em.startTime&&em.endTime){let e=60*em.startTime.getHours()+em.startTime.getMinutes();if(60*em.endTime.getHours()+em.endTime.getMinutes()<=e){i.oR.error("End time must be after start time"),ec(!1);return}}try{await eC(em,ev||"",async()=>{ev&&await eB({candidateId:ev,params:{project_id:null!=eN?eN:null}}),U(!1),eu({type:"",date:null,startTime:null,endTime:null,timezone:"",mode_of_interaction:"",person:"",selected_member_id:"",selected_member_type:"",description:"",client_member_name:""}),ea(null)})}catch(e){console.error("Error in handleCreateEventSubmit:",e),i.oR.error("Failed to create event. Please try again.")}finally{ec(!1)}},td=async()=>{if(et){if(ec(!0),em.startTime&&em.endTime){let e=60*em.startTime.getHours()+em.startTime.getMinutes();if(60*em.endTime.getHours()+em.endTime.getMinutes()<=e){i.oR.error("End time must be after start time"),ec(!1);return}}try{let e=em.timezone||eg,t={event_type:em.type,title:em.type,description:em.description||""},a=h(em.date,em.startTime,e);a&&(t.scheduled_at=a);let n=h(em.date,em.endTime,e);n&&(t.ends_at=n),t.timezone=e,em.mode_of_interaction&&(t.mode_of_interaction=em.mode_of_interaction),em.selected_member_id&&("client"===em.selected_member_type?t.client_member_id=em.selected_member_id:"org"===em.selected_member_type&&(t.organization_member_id=em.selected_member_id)),await eX.mutateAsync({url:s.Sn.PROJECT.RECOMMENDED_CANDIDATE_EVENT_EDIT(et),data:t}),i.oR.success("Event updated successfully"),ev&&await eB({candidateId:ev,params:{project_id:null!=eN?eN:null}}),U(!1),eu({type:"",date:null,startTime:null,endTime:null,timezone:"",mode_of_interaction:"",person:"",selected_member_id:"",selected_member_type:"",description:"",client_member_name:""}),ea(null)}catch(e){throw console.error("Failed to update event:",e),i.oR.error("Failed to update event. Please try again."),e}finally{ec(!1)}}};return{status:t,setStatus:a,candidate:m,setCandidate:u,description:f,setDescription:p,isLoading:g,handleSave:e5,handleCancel:()=>{var t;w([]),null==e||null==(t=e.closeModal)||t.call(e)},candidates:v,loadingCandidates:b,isLoadingMore:M,selectedCandidates:j,setSelectedCandidates:w,handleSelectionChange:e=>{w(e)},hasMore:T<C,onLoadMore:eQ,hasChanges:e2,searchQuery:R,setSearchQuery:O,isSearching:k,sortBy:I,setSortBy:P,profiles:e_,selectedId:ev,highlightedCandidateId:ey,hideClientDetails:eb,view:ej,projectId:eN,localStatuses:z,activeTab:L,setActiveTab:J,showEventForm:H,setShowEventForm:U,showNoteForm:V,setShowNoteForm:q,expandedEvents:K,setExpandedEvents:W,truncatable:Y,setTruncatable:B,expandedNotes:X,setExpandedNotes:G,truncatableNotes:Q,setTruncatableNotes:Z,optimisticNotes:$,setOptimisticNotes:ee,newEvent:em,setNewEvent:eu,newNote:ex,setNewNote:eh,clientContactsData:ew,loadingClientContacts:eT,loadingNotes:ez,notesError:eF,loadingEvents:eW,eventsError:eY,interactionOptions:e6,loadingInteractionWith:eD,handleInteractionWithChange:e4,openEventEditor:e3,events:e9,notes:e8,allNotes:e7,addNoteMutation:eJ,updateRecommendationStatusMutation:eq,isCreatingEvent:eE,updateStatus:te,handleCreateNote:tt,handleCreateEventSubmit:ts,editingEventId:et,setEditingEventId:ea,handleUpdateEventSubmit:td,isUpdatingEvent:eX.isPending,isSavingEvent:eo,editingNoteId:en,setEditingNoteId:el,handleUpdateNoteSubmit:ta,isUpdatingNote:eH.isPending,deleteNoteMutation:eU,handleDeleteNote:tn,isDeletingNote:eU.isPending,deletingNoteId:ei,deleteEventMutation:eV,handleDeleteEvent:tl,isDeletingEvent:eV.isPending,deletingEventId:es,getDeleteNoteHandler:ti,getDeleteEventHandler:tr,isTimeInvalid:ef,isEventFormValid:ep}}}}]);
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.