PageSourceSearch

https://xyrus.ai/_next/static/chunks/1410-17cecce160612b22.js

js xyrus.ai collected 2026-10-05 15:08:48 UTC 27,249 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1410],{1410:(e,t,a)=>{a.d(t,{Q:()=>v});var l=a(12115),r=a(20063),i=a(16419),n=a(41180),s=a(42208),u=a(75358),o=a(99429),c=a(18720),d=a(806),_=a(83098),m=a(30590),S=a(73977);let v=()=>{var e,t,a,v,p;let A=(0,r.useRouter)(),E=(0,r.useSearchParams)(),T=null!=(v=null==(e=E.get(m.uB.RST_TEMPLATE))?void 0:e.trim())?v:"",C=null!=(p=null==(t=E.get(m.uB.PROJECT_ID))?void 0:t.trim())?p:"",I=!!(T||C),g=l.useRef(null),[h,B]=l.useState(I),[f,y]=l.useState(),[R,k]=l.useState(i.hv.ACTIVE),[b,P]=l.useState(i.Gg.All),[N,L]=l.useState([]),[w,G]=l.useState(1),[M,O]=l.useState(20),[D,U]=l.useState(""),[V,j]=l.useState("asc"),[x,Y]=l.useState(!0),[Z,H]=l.useState(0),[F,z]=l.useState([]),[q,K]=l.useState(0),[J,W]=l.useState(!1),[Q,X]=l.useState(!1),[$,ee]=l.useState(!0),[et,ea]=l.useState({name:"",rst_template:"",project_id:"",current_company:"",current_role:"",smart_search:""}),{templates:el,loadInitialTemplates:er,loadMoreTemplates:ei,ensureRstTemplateInList:en,isLoading:es,hasMore:eu,totalItems:eo}=(0,s.d)(),ec=l.useMemo(()=>i.UH[R],[R]),ed=l.useMemo(()=>i.Qc[b],[b]),[e_,em]=l.useState(!1),[eS,ev]=l.useState(!1),[ep,eA]=l.useState([]),[eE,eT]=l.useState(0),[eC,eI]=l.useState(0),[eg,eh]=l.useState(""),[eB,ef]=l.useState(),ey=l.useRef([]);ey.current=ep;let{execute:eR,isLoading:ek}=(0,u.sO)(e=>o.Sn.CALENDAR_EVENTS.PROJECTS_COMMON_LIST_ENDPOINT(e)),{execute:eb}=(0,u.sO)(e=>o.Sn.PROJECT.BASE_BY_ID(e),{queryKey:e=>["candidate-search-project",e]}),[eP,eN]=l.useState({firstName:"",middleName:"",lastName:"",linkedinProfile:"",rst_ids:[]}),[eL,ew]=l.useState({}),[eG,eM]=l.useState({}),[eO,eD]=l.useState(!1),eU=(0,u._g)(),eV=(0,u.L2)({method:"patch",url:""}),[ej,ex]=l.useState(null),eY=l.useMemo(()=>el.map(e=>({value:e.id,label:e.name})),[el]),eZ=l.useMemo(()=>ep.map(e=>({value:e.id,label:e.title})),[ep]),eH=l.useMemo(()=>{var e;let t=et.project_id.trim();if(t)return null!=eB?eB:null==(e=ep.find(e=>e.id===t))?void 0:e.title},[et.project_id,ep,eB]),eF=l.useCallback(async e=>{let t=e.trim();if(t&&!ey.current.some(e=>e.id===t))try{var a;let e=await eb(t),l=null==e||null==(a=e.data)?void 0:a.project;if(!(null==l?void 0:l.id)||!l.title)return;eA(e=>{var t,a,r,i,n,s,u,o,c,d,_,m,S,v;return e.some(e=>e.id===l.id)?e:[{id:l.id,title:l.title,description:null!=(t=l.description)?t:"",status:l.status,location:null!=(a=l.location)?a:"",recommendations_count:null!=(r=l.recommendations_count)?r:0,last_updated_on:null!=(i=l.last_updated_on)?i:"",created_at:null!=(n=l.created_at)?n:"",updated_at:null!=(s=l.updated_at)?s:"",client_id:null!=(u=l.client_id)?u:"",client_invitation_status:null!=(o=l.client_invitation_status)?o:"",client_poc_id:null!=(c=l.client_poc_id)?c:"",rst_template_id:null!=(d=l.rst_template_id)?d:"",rst_template_name:null!=(_=l.rst_template_name)?_:null,xqtiv_poc_id:null!=(m=l.xqtiv_poc_id)?m:null,xqtiv_poc_name:null!=(S=l.xqtiv_poc_name)?S:null,days_active:null!=(v=l.days_active)?v:0},...e]}),ef(l.title)}catch(e){(0,S.yG)("error","Failed to resolve engagement for display",{projectId:t,error:e})}},[eb]),ez=l.useCallback((e,t)=>{if("firstName"===e||"lastName"===e){var a,l;if(!t.trim())return"".concat("firstName"===e?"First Name":"Last Name"," is required");let r=(0,d.yS)(t);return r.success?null:(null==(l=r.error)||null==(a=l.issues[0])?void 0:a.message)||"Invalid name"}if("linkedinProfile"===e){if(!t.trim())return"LinkedIn Profile is required";if(!t.startsWith("https://"))return"LinkedIn URL must start with https://";try{let e=new URL(t);if("www.linkedin.com"!==e.hostname&&"linkedin.com"!==e.hostname)return"Please enter a valid LinkedIn profile URL (e.g., https://www.linkedin.com/in/username)"}catch(e){return"Please enter a valid LinkedIn profile URL"}}return null},[]),eq=l.useCallback(()=>{let e={},t=!0;return Object.keys(eP).forEach(a=>{let l=eP[a],r=ez(a,l);r&&(e[a]=r,t=!1)}),eP.rst_ids&&0!==eP.rst_ids.length||(e.rst_ids="Competency Matrix is required",t=!1),ew(e),t},[eP,ez]),eK=l.useCallback(e=>{let{name:t,value:a}=e.target;eN(e=>({...e,[t]:a})),eM(e=>({...e,[t]:!0})),eL[t]&&ew(e=>{let a={...e};return delete a[t],a})},[eL]),eJ=l.useCallback(e=>{eM(t=>({...t,[e]:!0}));let t=eP[e],a=ez(e,t);a&&ew(t=>({...t,[e]:a}))},[eP,ez]),eW=l.useCallback(e=>{let t=e&&""!==e.trim()?[e]:[];eN(e=>({...e,rst_ids:t})),eM(e=>({...e,rst_ids:!0}
1))},[]),eQ=l.useCallback(e=>eG[e]?eL[e]:void 0,[eG,eL]),eX=l.useCallback(()=>{eN({firstName:"",middleName:"",lastName:"",linkedinProfile:"",rst_ids:[]}),ew({}),eM({}),eD(!1)},[]),e$=l.useMemo(()=>""!==eP.firstName.trim()&&""!==eP.lastName.trim()&&""!==eP.linkedinProfile.trim()&&Array.isArray(eP.rst_ids)&&eP.rst_ids.length>0,[eP]),e0=l.useCallback(()=>{e_||0!==el.length||(em(!0),er())},[er,e_,el.length]),e1=l.useCallback(e=>{er(void 0,void 0,e.toLowerCase())},[er]),e2=l.useMemo(()=>(0,_.s)(e1,300),[e1]),e3=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=arguments.length>3?arguments[3]:void 0;try{var r,i,n,s,u,o;let c={[m.uB.SKIP]:e,[m.uB.LIMIT]:10,...t.trim()?{[m.uB.SEARCH]:t.trim()}:{},...(null==l?void 0:l.trim())?{[m.uB.RST_TEMPLATE_ID]:l.trim()}:{}},d=await eR(c),_=null!=(s=null!=(n=null==d||null==(r=d.data)?void 0:r.data)?n:null==d?void 0:d.data)?s:[],S=null!=(o=null!=(u=null==d||null==(i=d.data)?void 0:i.total_count)?u:null==d?void 0:d.total_count)?o:0;Array.isArray(_)&&(eA(e=>a?[...e,..._]:_),eI(S),eT(e))}catch(e){(0,S.yG)("error","Failed to load engagements",{error:e})}},[10,eR]),e9=l.useCallback(()=>{eS||ev(!0),e3(0,eg,!1,et.rst_template.trim()||void 0)},[et.rst_template,eS,eg,e3]),e8=l.useCallback(e=>{eh(e);let t=et.rst_template.trim()||void 0;e3(0,e.toLowerCase(),!1,t)},[et.rst_template,e3]),e4=l.useMemo(()=>(0,_.s)(e8,300),[e8]),e7=l.useCallback(async()=>{if(ek||ep.length>=eC)return;let e=et.rst_template.trim()||void 0;await e3(eE+10,eg,!0,e)},[10,et.rst_template,ek,ep.length,eg,eE,eC,e3]),e5=l.useCallback(e=>e&&Array.isArray(e)?e.map(e=>({id:e.id,templateName:e.templateName||e.template_name||"",score:e.score})):[],[]),e6=(0,u.sO)(e=>{var t,a;let l=new URLSearchParams,r=e[m.uB.NAME];"string"==typeof r&&r.trim()&&l.append(m.uB.NAME,r);let i=e[m.uB.CURRENT_COMPANY];"string"==typeof i&&i.trim()&&l.append(m.uB.CURRENT_COMPANY,i);let n=e[m.uB.SMART_SEARCH];"string"==typeof n&&n.trim()&&l.append(m.uB.SMART_SEARCH,n);let s=e[m.uB.RST_TEMPLATE];"string"==typeof s&&s.trim()&&l.append(m.uB.RST_TEMPLATE,s);let u=e[m.uB.CURRENT_ROLE];"string"==typeof u&&u.trim()&&l.append(m.uB.CURRENT_ROLE,u);let c=e[m.uB.PROJECT_ID];"string"==typeof c&&c.trim()&&l.append(m.uB.PROJECT_ID,c),void 0!==e[m.uB.PAGE]&&l.append(m.uB.PAGE,(null==(t=e[m.uB.PAGE])?void 0:t.toString())||""),void 0!==e[m.uB.PAGE_SIZE]&&l.append(m.uB.PAGE_SIZE,(null==(a=e[m.uB.PAGE_SIZE])?void 0:a.toString())||"");let d=e[m.uB.SORT_BY];"string"==typeof d&&d.trim()&&l.append(m.uB.SORT_BY,d);let _=e[m.uB.SORT_ORDER2];return"string"==typeof _&&_.trim()&&l.append(m.uB.SORT_ORDER2,_),"".concat(o.Sn.CANDIDATES.CANDIDATE_AI_SEARCH,"?").concat(l.toString())},{onError:e=>{(0,S.yG)("error","AI Search Error",{error:e}),L([]),H(0)}}),te=(0,u.sO)(e=>{var t,a;let l=new URLSearchParams;void 0!==e[m.uB.PAGE]&&l.append(m.uB.PAGE,(null==(t=e[m.uB.PAGE])?void 0:t.toString())||""),void 0!==e[m.uB.PAGE_SIZE]&&l.append(m.uB.PAGE_SIZE,(null==(a=e[m.uB.PAGE_SIZE])?void 0:a.toString())||""),void 0!==e[m.uB.IS_ACTIVE]&&l.append(m.uB.IS_ACTIVE,e[m.uB.IS_ACTIVE]?"true":"false"),void 0!==e[m.uB.IS_INVITED]&&l.append(m.uB.IS_INVITED,e[m.uB.IS_INVITED]?"true":"false");let r=e[m.uB.SORT_BY];if("string"==typeof r||Array.isArray(r)){let e=Array.isArray(r)?r.join(","):r;e&&l.append(m.uB.SORT_BY,e)}return"".concat(o.Sn.CANDIDATES.SMARTSEARCH_LIST,"?").concat(l.toString())},{onError:e=>{(0,S.yG)("error","Smart List Error",{error:e}),z([]),K(0)}}),tt=l.useCallback(async function(){var e,t,a,l;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{[m.uB.PAGE]:1,[m.uB.PAGE_SIZE]:20},n=null!=(e=r[m.uB.PAGE])?e:1,s=null!=(t=r[m.uB.PAGE_SIZE])?t:20,u=null!=(a=r[m.uB.SORT_BY])?a:null,o=r[m.uB.IS_ACTIVE],c=r[m.uB.IS_INVITED],d=await te.execute({[m.uB.PAGE]:n,[m.uB.PAGE_SIZE]:s,[m.uB.SORT_BY]:u,...void 0!==o?{[m.uB.IS_ACTIVE]:o}:{},...void 0!==c?{[m.uB.IS_INVITED]:c}:{}});return d&&Array.isArray(null==d?void 0:d.results)&&(z((null==d||null==(l=d.results)?void 0:l.map(e=>({id:(null==e?void 0:e.id)||"",candidate_id:(null==e?void 0:e.candidate_id)||"",name:"".concat((null==e?void 0:e.first_name)||""," ").concat((null==e?void 0:e.last_name)||"").trim(),firstName:(null==e?void 0:e.first_name)||"",lastName:(null==e?void 0:e.last_name)||"",email:(null==e?void 0:e.email)||"",currentCompany:(null==e?void 0:e.current_organisation)||"",currentRole:(null==e?void 0:e.current_title)||"",linkedin:(null==e?void 0:e.linkedin_profile_url)||"",phone:(null==e?void 0:e.phone_number)||"",...(null==e?void 0:e.country_code)?{countryCode:null==e?void 0:e.country_code}:{},status:(null==e?void 0:e.is_active)?i.U1.Active:i.U1.Suspended,modifiedAt:null==e?void 0:e.modified_at,createdAt:null==e?void 0:e.created_at,linkedToActiveProject:!1,aiMatchScores:e5((null==e?void 0:e.aiMatchScores)||(null==e?void 0:e.ai_match_scores))}))).sort((e,t)=>
1{let a=e.modifiedAt?new Date(e.modifiedAt).getTime():0;return(t.modifiedAt?new Date(t.modifiedAt).getTime():0)-a})),K(d.total_count||0),G(n)),d},[te,e5]);l.useEffect(()=>{I||tt({[m.uB.PAGE]:1,[m.uB.PAGE_SIZE]:20,...R===i.hv.ALL?{}:{[m.uB.IS_ACTIVE]:R===i.hv.ACTIVE},...b===i.Gg.All?{}:{[m.uB.IS_INVITED]:b===i.Gg.Invited}})},[]);let ta=l.useCallback(async()=>{L([]),y(void 0),H(0),G(1),(T||C)&&(g.current="__cleared__",A.replace("/candidates",{scroll:!1})),await tt({[m.uB.PAGE]:1,[m.uB.PAGE_SIZE]:M,...R===i.hv.ALL?{}:{[m.uB.IS_ACTIVE]:R===i.hv.ACTIVE},...b===i.Gg.All?{}:{[m.uB.IS_INVITED]:b===i.Gg.Invited}})},[R,tt,M,C,A,T,b]),tl=l.useCallback(async e=>{try{let l=await e6.execute(e);if(l){var t,a;let r=null==l||null==(t=l.results)?void 0:t.map(e=>({id:(null==e?void 0:e.id)||"",candidate_id:(null==e?void 0:e.candidate_id)||"",name:"".concat((null==e?void 0:e.first_name)||""," ").concat((null==e?void 0:e.middle_name)||""," ").concat((null==e?void 0:e.last_name)||"").trim(),firstName:(null==e?void 0:e.first_name)||"",lastName:(null==e?void 0:e.last_name)||"",email:(null==e?void 0:e.email)||"",currentCompany:(null==e?void 0:e.current_organisation)||"",currentRole:(null==e?void 0:e.current_title)||"",linkedin:(null==e?void 0:e.linkedin_profile_url)||"",phone:(null==e?void 0:e.phone_number)||"",...(null==e?void 0:e.country_code)?{countryCode:null==e?void 0:e.country_code}:{},status:(null==e?void 0:e.is_active)?i.U1.Active:i.U1.Suspended,modifiedAt:null==e?void 0:e.modified_at,createdAt:null==e?void 0:e.created_at,linkedToActiveProject:!1,aiMatchScores:e5((null==e?void 0:e.aiMatchScores)||(null==e?void 0:e.ai_match_scores))})),n="string"==typeof e[m.uB.SORT_BY]&&(null==(a=e[m.uB.SORT_BY])?void 0:a.trim())?r:r.sort((e,t)=>{let a=e.modifiedAt?new Date(e.modifiedAt).getTime():0;return(t.modifiedAt?new Date(t.modifiedAt).getTime():0)-a});return L(n),H(l.total_count||0),G(e.page||1),l}}catch(e){throw e}},[e6]),tr=l.useCallback(function(e,t,a){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"desc";return{...e.name?{[m.uB.NAME]:e.name}:{},...e.current_company?{[m.uB.CURRENT_COMPANY]:e.current_company}:{},...e.smart_search?{[m.uB.SMART_SEARCH]:e.smart_search}:{},...e.rst_template?{[m.uB.RST_TEMPLATE]:e.rst_template}:{},...e.current_role?{[m.uB.CURRENT_ROLE]:e.current_role}:{},...e.project_id?{[m.uB.PROJECT_ID]:e.project_id}:{},[m.uB.PAGE]:t,[m.uB.PAGE_SIZE]:a,...e.rst_template?{[m.uB.SORT_BY]:"xyrus_score",[m.uB.SORT_ORDER2]:l}:{}}},[]),ti=e6.isLoading,tn=(null==(a=e6.error)?void 0:a.message)||null,ts=te.isLoading,tu=l.useCallback(()=>{J?(W(!1),setTimeout(()=>ee(!1),300)):(ee(!0),setTimeout(()=>W(!0),10))},[J]),to=l.useCallback((e,t)=>{ea(a=>{let l={...a,[e]:t};if("rst_template"===e&&t!==a.rst_template&&(l.project_id="",ef(void 0),e3(0,eg,!1,t||void 0)),"project_id"===e){let e=eZ.find(e=>e.value===t);(null==e?void 0:e.label)?ef(e.label):t?eF(t):ef(void 0)}return l})},[eZ,eg,eF,e3]),tc=l.useMemo(()=>et.name.trim().length>0||et.rst_template.trim().length>0||et.project_id.trim().length>0||et.current_company.trim().length>0||et.current_role.trim().length>0||et.smart_search.trim().length>0,[et]),td=l.useCallback(()=>{tc&&(X(!0),W(!1),setTimeout(()=>{X(!1)},2e3),tR(et))},[et,tc]),t_=l.useCallback(()=>{ea({name:"",rst_template:"",project_id:"",current_company:"",current_role:"",smart_search:""}),ef(void 0),ta()},[ta]),tm=l.useCallback(e=>{"project_id"===e&&ef(void 0),ea(t=>{let a={...t,[e]:""};return Object.values(a).every(e=>""===e.trim())&&ta(),a})},[ta]),tS=l.useCallback(()=>{W(!1),tB()},[]),tv=l.useCallback((e,t)=>{let a=et[e];
1if(!a)return t;if("rst_template"===e){let e=eY.find(e=>e.value===a||e.label===a);return e?e.label:a}if("project_id"===e){if(eH)return eH;let e=eZ.find(e=>e.value===a||e.label===a);return e?e.label:a}return a},[et,eZ,eY,eH]),tp=l.useCallback(()=>{J?(W(!1),setTimeout(()=>ee(!1),300)):(ee(!0),setTimeout(()=>W(!0),10))},[J]),tA=l.useCallback((e,t)=>{to(e,t)},[to]),tE=l.useCallback(()=>{tc&&(X(!0),W(!1),setTimeout(()=>{X(!1)},2e3),tR(et))},[et,tc]),tT=l.useCallback(()=>{t_()},[t_]),tC=l.useCallback(e=>{tm(e)},[tm]),tI=l.useCallback(()=>{W(!1),tB()},[]),tg=l.useCallback((e,t)=>tv(e,t),[tv]),th=l.useCallback(()=>{ta()},[ta]),tB=()=>{Y(!1)},tf=l.useCallback(()=>{em(!1),er()},[er]),ty=l.useMemo(()=>[{key:"firstName",label:"First Name",sortable:!0},{key:"lastName",label:"Last Name",sortable:!0},{key:"aiScore",label:"xyrus score",sortable:!0},{key:"currentCompany",label:"Current Org",sortable:!1},{key:"linkedToActiveProject",label:"Linked to Active Project",sortable:!1},{key:"actions",label:"Actions",sortable:!1}],[]),tR=async e=>{y(e),e.rst_template&&(U("aiScore"),j("desc"));try{await tl(tr(e,1,M,"desc"))}catch(e){c.oR.error(e),G(1)}},tk=l.useRef(tR);tk.current=tR,l.useEffect(()=>{let e=!!T,t=!!C;if("__cleared__"===g.current){e||t||(g.current=null);return}if(!e&&!t)return;let a="".concat(T,"|").concat(C);g.current!==a&&(g.current=a,(async()=>{B(!0);try{e&&(e_||em(!0),await er(),await en(T)),t&&(eS||ev(!0),await e3(0,"",!1,T||void 0),await eF(C));let a={...e?{rst_template:T}:{},...t?{project_id:C}:{}};ea({name:"",rst_template:T,project_id:C,current_company:"",current_role:"",smart_search:""}),ee(!0),W(!0),await tk.current(a),X(!0),W(!1),window.setTimeout(()=>{X(!1),ee(!1)},300)}catch(e){(0,S.yG)("error","Failed to apply dashboard search filters",{error:e})}finally{B(!1)}})())},[eF,en,eS,e3,er,C,T,e_]);let tb=l.useCallback(async e=>{if(f)try{let t="aiScore"===D?V:"desc";await tl(tr(f,e,M,t))}catch(e){(0,S.yG)("error","AI search pagination failed",{error:e})}},[f,tl,M,tr,D,V]),tP=(0,u.L2)({method:"post",url:o.Sn.CANDIDATES.CREATE}),tN=l.useCallback(async e=>{if(e.preventDefault(),eq()){eD(!0);try{let e={first_name:eP.firstName,middle_name:eP.middleName,last_name:eP.lastName,linkedin_profile_url:eP.linkedinProfile,...eP.rst_ids&&eP.rst_ids.length>0?{rst_ids:eP.rst_ids}:{}},t=await tP.mutateAsync({data:e});n.Lx.closeAllModals();let a=3,l=c.oR.success("Candidate created successfully! Redirecting to profile in ".concat(a," seconds..."),{duration:1/0}),r=setInterval(()=>{--a>0?c.oR.success("Candidate created successfully! Redirecting to profile in ".concat(a," seconds..."),{id:l,duration:1/0}):(clearInterval(r),c.oR.dismiss(l),window.location.href="/candidates/".concat(t.candidate_id))},1e3);if(f){let e="aiScore"===D?V:"desc";await tl(tr(f,w,M,e))}else await tl({[m.uB.PAGE]:1,[m.uB.PAGE_SIZE]:M});eX()}catch(l){var t,a;let e=(null==l||null==(a=l.response)||null==(t=a.data)?void 0:t.detail)||"Failed to create candidate";e?c.oR.error(e):c.oR.error("Failed to create candidate")}finally{eD(!1)}}},[eP,eq,tP,f,w,M,D,V,tl,tr,eX]),tL=l.useCallback(e=>{k(e),G(1),f||tt({[m.uB.PAGE]:1,[m.uB.PAGE_SIZE]:M,...e===i.hv.ALL?{}:{[m.uB.IS_ACTIVE]:e===i.hv.ACTIVE},...b===i.Gg.All?{}:{[m.uB.IS_INVITED]:b===i.Gg.Invited}})},[tt,M,f,b]),tw=l.useCallback(e=>{P(e),G(1),tt({[m.uB.PAGE]:1,[m.uB.PAGE_SIZE]:M,...R===i.hv.ALL?{}:{[m.uB.IS_ACTIVE]:R===i.hv.ACTIVE},...e===i.Gg.All?{}:{[m.uB.IS_INVITED]:e===i.Gg.Invited}})},[tt,M,R]),tG=e=>{eV.mutate({url:o.Sn.CANDIDATES.CANDIDATE_ACTIVATION(e)},{onSuccess:()=>{c.oR.success("Candidate status changed successfully"),L(t=>t.map(t=>t.id===e?{...t,status:i.U1.Active}:t)),z(t=>t.map(t=>t.id===e?{...t,status:i.U1.Active}:t)),eU.invalidateQueries({queryKey:["candidates"]}),eU.invalidateQueries({predicate:e=>{let t=e.queryKey;return!!Array.isArray(t)&&t.some(e=>{let t=String(e);return t.includes("candidates")||t.includes("typesense/semantic-search")||t.includes("semantic-search")})}})},onError:e=>{let t=(null==e?void 0:e.message)||"Failed to activate candidate";c.oR.error(t)}})};return{searchData:f,candidates:N,listCandidates:F,currentPage:w,sortColumn:D,sortDirection:V,isAccordionOpen:x,columns:ty,pagination:{currentPage:w,totalPages:Math.ceil(((f?Z:q)||0)/M),totalItems:f?Z:q,itemsPerPage:M},rstTemplateOptions:eY,rstLoading:es,loadRstTemplates:e0,searchRstTemplates:e2,resetRstTemplates:tf,hasMore:eu,totalItems:eo,loadMoreTemplates:ei,engagementOptions:eZ,engagementLoading:ek,loadEngagements:e9,searchEngagements:e4,engagementHasMore:ep.length<eC,engagementTotalCount:eC,loadM
1oreEngagements:e7,...eH?{selectedEngagementLabel:eH}:{},isAISearchLoading:ti,isApplyingDashboardFilters:h,aiSearchError:tn,totalAISearchResults:Z,performAISearch:tl,isSmartListLoading:ts,totalListResults:q,loadSmartList:tt,isActivationLoading:eV.isPending,activationError:eV.error,activationLoadingId:ej,isCreationLoading:tP.isPending,creationError:tP.error,formData:eP,formErrors:eL,formTouched:eG,isFormSubmitting:eO,isFormValid:e$,handleFormChange:eK,handleFormBlur:eJ,getFormFieldError:eQ,handleFormSubmit:tN,resetForm:eX,setRstTemplateId:eW,isAccordionContentOpen:J,isAccordionAnimating:Q,shouldRenderAccordionContent:$,accordionFormData:et,isAccordionSearchEnabled:tc,handleAccordionToggle:tu,handleAccordionInputChange:to,handleAccordionSearch:td,handleAccordionClear:t_,handleAccordionClearField:tm,handleAccordionHide:tS,getAccordionDisplayValue:tv,handleLocalAccordionToggle:tp,handleLocalAccordionInputChange:tA,handleLocalAccordionSearch:tE,handleLocalAccordionClear:tT,handleLocalAccordionClearField:tC,handleLocalAccordionHide:tI,getLocalAccordionDisplayValue:tg,handleSearch:tR,handlePageChange:e=>{G(e),f?tb(e):tt({[m.uB.PAGE]:e,[m.uB.PAGE_SIZE]:M,...R===i.hv.ALL?{}:{[m.uB.IS_ACTIVE]:R===i.hv.ACTIVE},...b===i.Gg.All?{}:{[m.uB.IS_INVITED]:b===i.Gg.Invited}})},handlePageSizeChange:e=>{O(e),G(1),f?tl(tr(f,1,e,"aiScore"===D?V:"desc")):tt({[m.uB.PAGE]:1,[m.uB.PAGE_SIZE]:e,...R===i.hv.ALL?{}:{[m.uB.IS_ACTIVE]:R===i.hv.ACTIVE},...b===i.Gg.All?{}:{[m.uB.IS_INVITED]:b===i.Gg.Invited}})},handleAISearchPageChange:tb,handleSort:(e,t)=>{if("firstName"!==e&&"lastName"!==e&&"aiScore"!==e)return;if(U(e),j(t),"aiScore"===e&&(null==f?void 0:f.rst_template)){G(1),tl(tr(f,1,M,t)).catch(e=>{(0,S.yG)("error","AI search sort by xyrus score failed",{error:e})});return}let a=(a,l)=>{if("aiScore"===e){var r,i;let e=(null==(r=a.aiMatchScores)?void 0:r.length)?Math.max(...a.aiMatchScores.map(e=>e.score)):0,n=(null==(i=l.aiMatchScores)?void 0:i.length)?Math.max(...l.aiMatchScores.map(e=>e.score)):0;return"asc"===t?e-n:n-e}
1let n=a[e],s=l[e],u="string"==typeof n?n:"",o="string"==typeof s?s:"";return"asc"===t?u.localeCompare(o):o.localeCompare(u)};N.length>0&&L([...N].sort(a)),F.length>0&&z([...F].sort(a))},handleCreate:()=>{n.Lx.openDialog("add-candidate",{title:"Add Candidate",size:"md",data:{onSubmit:tN,onCancel:()=>{(0,S.yG)("info","Add candidate cancelled"),eX()}}})},handleClearSearch:th,handleHideAccordion:tB,handleEditCandidate:e=>{tG(e)},handleCandidateActivation:tG,handleToggleActivation:e=>{var t;if(eV.isPending)return;let a=N.find(t=>t.id===e),l=F.find(t=>t.id===e),r=(null==(t=a||l)?void 0:t.status)===i.U1.Active?i.U1.Inactive:i.U1.Active;ex(e),eV.mutate({url:o.Sn.CANDIDATES.CANDIDATE_ACTIVATION(e)},{onSuccess:async()=>{c.oR.success(r===i.U1.Active?"Candidate activated successfully":"Candidate deactivated successfully"),L(t=>t.map(t=>t.id===e?{...t,status:r}:t)),z(t=>t.map(t=>t.id===e?{...t,status:r}:t))},onError:e=>{let t=(null==e?void 0:e.message)||"Failed to toggle candidate status";c.oR.error(t)},onSettled:()=>{ex(null)}})},getStatusColor:e=>i.Q9[e]||"bg-gray-100 text-gray-800",getStatusText:e=>i.mt[e]||"Unknown",filterValue:R,filterLabel:ec,handleFilter:tL,verifiedFilterValue:b,verifiedFilterLabel:ed,handleVerifiedFilter:tw}}},42208:(e,t,a)=>{a.d(t,{d:()=>_});var l=a(12115),r=a(75358),i=a(83098),n=a(99429),s=a(30590),u=a(92096),o=a(18720),c=a(41180),d=a(73977);function _(){let[e,t]=(0,l.useState)([]),[a,_]=(0,l.useState)(0),[m,S]=(0,l.useState)(0),[v,p]=(0,l.useState)(u.aw.NEWEST),[A,E]=(0,l.useState)(""),[T,C]=(0,l.useState)(u.mI.ALL),[I,g]=(0,l.useState)(null),[h,B]=(0,l.useState)([]),[f,y]=(0,l.useState)(1),[R,k]=(0,l.useState)(0),[b,P]=(0,l.useState)(""),N=(0,r.L2)({method:"put"}),L=(0,l.useRef)([]);L.current=e;let{execute:w}=(0,r.sO)(e=>n.Sn.RST_TEMPLATES.DETAILS(e),{queryKey:e=>["rst-template-details",e]}),{isLoading:G,error:M,execute:O}=(0,r.sO)(e=>{let t={[s.uB.SKIP]:e[s.uB.SKIP]||0,[s.uB.LIMIT]:e[s.uB.LIMIT]||10,[s.uB.SEARCH]:e[s.uB.SEARCH]||A};return e[s.uB.SORT_BY]&&(t[s.uB.SORT_BY]=e[s.uB.SORT_BY]||""),e[s.uB.STATUS]&&(t[s.uB.STATUS]=e[s.uB.STATUS]||""),n.Sn.RST_TEMPLATES.ADVANCED_RST_ENDPOINT(t)}),{isLoading:D,error:U,execute:V}=(0,r.sO)(e=>{let t=new URLSearchParams;return t.set(s.uB.PAGE,(e.page||1).toString()),t.set(s.uB.STATUS,"active"),t.set("page_size",(e.page_size||10).toString()),e.search&&e.search.trim()&&t.set(s.uB.SEARCH,e.search.trim()),"".concat(n.Sn.PROJECT.LIST,"?").concat(t.toString())}),j=(0,l.useCallback)(()=>{t([]),_(0),S(0)},[]),x=(0,l.useCallback)(async e=>{let a=e.trim();if(a&&!L.current.some(e=>e.id===a))try{var l,r,i,n,s,u,o,c;let e=await w(a);if((null==e?void 0:e.status_code)!==200||!e.data)return;let d={id:(l=e.data).id,name:l.name,description:null!=(r=l.description)?r:"",template_type:null!=(i=l.template_type)?i:"",is_active:l.is_active,created_by:null!=(n=l.created_by)?n:"",created_at:null!=(s=l.created_at)?s:"",modified_at:null!=(u=l.modified_at)?u:"",version:null!=(o=l.version)?o:0,domains_processed:null!=(c=l.domains_processed)?c:[]};t(e=>e.some(e=>e.id===d.id)?e:[d,...e])}catch(e){(0,d.yG)("error","Failed to resolve competency matrix for display",{templateId:a,error:e})}},[w]),Y=(0,l.useCallback)(async(e,a,l,r,i)=>{try{let n=void 0!==l?l:A;void 0!==l&&E(l);let o=await O({[s.uB.SKIP]:r||0,[s.uB.LIMIT]:i||10,[s.uB.SEARCH]:n,...a!==u.aw.NEWEST&&{[s.uB.SORT_BY]:a||v},...e!==u.mI.ALL&&{[s.uB.STATUS]:e||T}});(null==o?void 0:o.status_code)===200&&(t(o.data),_(1),S(o.total_count))}catch(e){o.oR.error("Failed to load initial templates"),console.error("Error loading initial templates:",e)}},[O,A,v,T]),Z=(0,l.useCallback)(async()=>{if(!(e.length>=m))try{let e=await O({[s.uB.SKIP]:10*a,[s.uB.LIMIT]:10,[s.uB.SEARCH]:A,...v!==u.aw.NEWEST&&{[s.uB.SORT_BY]:v},...T!==u.mI.ALL&&{[s.uB.STATUS]:T}});if((null==e?void 0:e.status_code)===200){let a=e.data;t(e=>[...e,...a]),_(e=>e+1),S(e.total_count)}}catch(e){o.oR.error("Failed to load templates"),console.error("Error loading templates:",e)}},[O,a,A,v,T,m,e.length]),H=(0,l.useCallback)(async e=>{try{if(E(e),t(e=>e),j(),!e.trim())return void await Y();let a=await O({[s.uB.SKIP]:0,[s.uB.LIMIT]:10,[s.uB.SEARCH]:e,...v!==u.aw.NEWEST&&{[s.uB.SORT_BY]:v},...T!==u.mI.ALL&&{[s.uB.STATUS]:T}});(null==a?void 0:a.status_code)===200&&(t(a.data),_(1),S(a.total_count))}catch(e){o.oR.error("Failed to search templates"),console.error("Error searching templates:",e)}},[O,Y,j,v,T]),F=(0,l.useCallback)(async(e,a)=>{try{g(e);let l=await N.mutateAsync({url:n.Sn.RST_TEMPLATES.ACTIVATE(e),data:{is_active:a}});(null==l?void 0:l.status_code)===200&&(t(t=>t.map(t=>
1t.id===e?{...t,is_active:a}:t)),o.oR.success("Template ".concat(a?"activated":"deactivated"," successfully")))}catch(e){o.oR.error("Failed to ".concat(a?"activate":"deactivate"," template")),console.error("Error updating template status:",e)}finally{g(null)}},[N]),z=(0,l.useMemo)(()=>({templates:e,isLoading:G,hasMore:e.length<m,error:M?String(M):null,totalItems:m,loadedItems:e.length}),[e,G,m,M]),q=(0,l.useCallback)((e,t)=>{p(e),t||(j(),setTimeout(()=>Y(T,e,A,0,10),0))},[Y,j,T,A]),K=(0,l.useMemo)(()=>(0,i.s)(H,400),[]),J=(0,l.useCallback)((e,t)=>{E(e),t||K(e)},[K]),W=(0,l.useCallback)((e,t)=>{C(e),t||(j(),setTimeout(()=>Y(e,v,A,0,10),0))},[Y,j,v,A]),Q=(0,l.useCallback)(()=>{j(),Y()},[j,Y]),X=(0,l.useCallback)(()=>{c.Lx.openDialog("create-rst-template",{title:"Create New Competency Matrix",size:"full",width:"50vw",data:{onCancel:()=>{console.log("Template creation cancelled")},onUploadComplete:Q}})},[Q]),$=(0,l.useCallback)(e=>I===e,[I]),ee=(0,l.useCallback)(()=>{B([]),y(1),k(0)},[]),et=(0,l.useCallback)(async(e,t,a)=>{try{let l=await V({status:T,page:t||1,page_size:a||10,search:void 0!==e?e:b});if((null==l?void 0:l.status_code)===200){let e=(null==l?void 0:l.data)||[];B(e),y(1),k((null==l?void 0:l.total_count)||0)}}catch(e){console.error("Error loading initial users:",e)}},[V,b]),ea=(0,l.useCallback)(async()=>{try{let e=await V({page:f+1,page_size:10,search:b});if((null==e?void 0:e.status_code)===200){let t=(null==e?void 0:e.data)||[];B(e=>[...e,...t]),y(e=>e+1),k((null==e?void 0:e.total_count)||0)}}catch(e){console.error("Error loading more users:",e)}},[V,f,b]),el=(0,l.useCallback)(async e=>{try{if(ee(),!e.trim())return void await et("",1,10);let t=await V({page:1,page_size:10,search:e});if((null==t?void 0:t.status_code)===200){let e=(null==t?void 0:t.data)||[];B(e),y(1),k((null==t?void 0:t.total_count)||0)}}catch(e){console.error("Error searching users:",e)}},[V,et,ee]),er=(0,l.useMemo)(()=>(0,i.s)(el,400),[el]),ei=(0,l.useCallback)((e,t)=>{P(e),t||er(e)},[er]),en=(0,l.useMemo)(()=>({users:h,isLoadingUsers:D,usersHasMore:h.length<R,usersError:U?String(U):null,usersTotalItems:R,usersLoadedItems:h.length}),[h,D,R,U]);return{...z,loadInitialTemplates:Y,loadMoreTemplates:Z,ensureRstTemplateInList:x,resetTemplates:j,searchTemplates:H,sortBy:v,searchQuery:A,status:T,onSortChange:q,onSearchChange:J,onStatusChange:W,onCreateTemplate:X,onActivateDeactivate:F,isActivateDeactivateLoading:N.isPending,isTemplateLoading:$,...en,loadInitialUsers:et,loadMoreUsers:ea,resetUsers:ee,searchUsers:el,usersSearchQuery:b,xQtivPOCError:U,isLoadingXQtivPOC:D,onUsersSearchChange:ei}}},92096:(e,t,a)=>{a.d(t,{UB:()=>i,aw:()=>s,ej:()=>r,mI:()=>n,u0:()=>u});var l=a(98734),r=function(e){return e.All="all",e.Active="active",e.Inactive="inactive",e}({}),i=function(e){return e.Newest="newest_to_oldest",e.Oldest="oldest_to_newest",e.AZ="a_to_z",e.ZA="z_to_a",e}({});let n={ALL:"all",ACTIVE:"active",INACTIVE:"inactive"},s={NEWEST:"newest_to_oldest",OLDEST:"oldest_to_newest",AZ:"a_to_z",ZA:"z_to_a"},u=l.Ik({rstTemplate:l.KC([l.Yj().min(1,"Please select at least one RST template"),l.YO(l.Yj()).min(1,"Please select at least one RST template")])})}}]);

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.