PageSourceSearch

https://xyrus.ai/_next/static/chunks/5514.29f3a0b74c902299.js

js xyrus.ai collected 2026-10-05 15:10:32 UTC 8,164 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5514],{18226:(e,t,a)=>{a.d(t,{Zo:()=>s,f4:()=>l});var r=a(67880),n=a(99429);let{useUpdateProjectRstDomainWeightsMutation:l,useSubmitAssessmentMutation:s}=r.q.injectEndpoints({endpoints:e=>({updateProjectRstDomainWeights:e.mutation({query:e=>{let{project_id:t,rst_id:a,data:r}=e;return{url:n.Sn.PROJECT.PROJECT_RST_DOMAIN_WEIGHTS(t,a),method:"PUT",data:r}},invalidatesTags:["Project"]}),submitAssessment:e.mutation({query:e=>{let{project_id:t,rst_id:a,data:r}=e;return{url:n.Sn.PROJECT.PROJECT_RST_DETAILS(t,a),method:"PUT",data:r}},invalidatesTags:["Project"]})})})},45514:(e,t,a)=>{a.r(t),a.d(t,{default:()=>g});var r=a(95155),n=a(12115),l=a(97003),s=a(33789),o=a(18226),c=a(68090),i=a(18720);let u=e=>c.JT.unescapeHtml(e).toLowerCase().trim(),d=(e,t,a)=>{if(0===t.length)return{};if(0===Object.keys(e).length)return a();let r=Math.floor(100/t.length),n=(e=>{let t=new Map;return Object.entries(e).forEach(e=>{let[a,r]=e;null!=r&&t.set(u(a),r)}),t})(e),l={};return t.forEach(e=>{let{key:t}=e;l[t]=((e,t,a)=>{let r=t.get(u(e));return void 0!==r?r:a})(t,n,r)}),l},m=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,a]=e;return[t,a>0?String(a):""]})),g=function(e){let{data:t}=e,{initialData:a={},domains:c=[],projectId:u,rstId:g}=t||{},[p,{isLoading:h}]=(0,o.f4)(),f=n.useMemo(()=>c.length>0?c.map(e=>({key:e,label:e})):[],[c]),b=n.useCallback(()=>{if(0===f.length)return{};let e=Math.floor(100/f.length),t=100%f.length,a={};return f.forEach((r,n)=>{a[r.key]=e+ +(n<t)}),a},[f]),[x,w]=(0,n.useState)({}),[v,j]=(0,n.useState)({}),y=(0,n.useRef)(!1),C=(0,n.useRef)(""),N=n.useMemo(()=>JSON.stringify(a),[a]);(0,n.useEffect)(()=>{if(0===f.length||y.current||C.current===N)return;let e=d(a,f,b);w(e),j(m(e)),C.current=N},[f,b,a,N]);
1let[S,T]=(0,n.useState)({}),D=n.useMemo(()=>Object.values(x).reduce((e,t)=>e+(t||0),0),[x]),M=h||0===f.length||100!==D,k=e=>Math.min(100-(e-1),98),E=(e,t)=>{var a;let r=null==(a=f.find(t=>t.key===e))?void 0:a.label,n=f.length;if(isNaN(t))return"".concat(r," must be a valid number");if(t<1)return"".concat(r," must be at least 1%");let l=k(n);return t>l?"".concat(r," cannot exceed ").concat(l,"% (maximum allowed for ").concat(n," fields)"):""},_=async()=>{let e={},a=!1;f.forEach(t=>{let{key:r}=t,n=E(r,x[r]||0);n&&(e[r]=n,a=!0)});let r=(e=>{let t=Object.values(e).reduce((e,t)=>e+t,0);return 100!==t?"Total weightage must equal exactly 100% (current: ".concat(t,"%)"):""})(x);if(T(e),a||r){if(r)i.oR.error(r);else if(a){let t=Object.values(e).find(e=>""!==e);t&&i.oR.error(t)}return}if(!a&&!r){var n,l,s,o,c;if(!u||!g)return void i.oR.error("Missing project ID or Competency Matrix ID for API call");try{let e=await p({project_id:u,rst_id:g,data:{domain_weights:x}}).unwrap();i.oR.success("Domain weights updated successfully! Competency Matrix ID: ".concat(e.rst_id)),null==t||null==(n=t.onSubmit)||n.call(t,e.domain_weights),null==t||null==(l=t.onSuccess)||l.call(t),null==t||null==(s=t.onRefresh)||s.call(t),null==t||null==(o=t.closeModal)||o.call(t)}catch(t){let e=(null==t||null==(c=t.data)?void 0:c.message)||(null==t?void 0:t.message)||"Failed to update domain weights";i.oR.error(e),console.error("Error updating domain weights:",t)}}},L=n.useCallback(()=>{y.current=!1;let e=d(a,f,b);w(e),j(m(e)),T({}),C.current=N},[a,f,b,N]),O=n.useCallback(()=>{var e;L(),null==t||null==(e=t.closeModal)||e.call(t)},[L,t]);return(0,r.jsxs)("div",{className:"w-full flex flex-col h-[94%]",children:[(0,r.jsxs)("div",{className:"flex-1 p-0",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600 mb-2",children:"Assign weight to each competency based on its importance"}),(0,r.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-md p-3 mb-4",children:(0,r.jsx)("p",{className:"text-sm text-blue-800 font-medium",children:"ℹ️ The total weightage must equal exactly 100%"})}),(0,r.jsx)("div",{className:"space-y-4",children:0===f.length?(0,r.jsx)("div",{className:"text-center py-8",children:(0,r.jsx)("p",{className:"text-gray-500",children:"No competency domains available"})}):f.map(e=>{var t;let{key:a,label:n}=e,l=S[a]||0===x[a];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-900 min-w-0 flex-1",children:n}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,r.jsx)(s.Input,{type:"number",value:null!=(t=v[a])?t:"",onChange:e=>((e,t)=>{y.current=!0;let a=k(f.length);if(""===t){j(t=>({...t,[e]:""})),w(t=>({...t,[e]:0})),T(t=>({...t,[e]:""}));return}let r=Number(t);if(Number.isNaN(r)||r>a)return;j(a=>({...a,[e]:t})),w(t=>({...t,[e]:r}));let n=E(e,r);T(t=>({...t,[e]:n}))})(a,e.target.value),className:"w-25 h-8 text-center text-sm border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield] ".concat(l?"border-red-500 focus:border-red-500 focus:ring-red-500":""),placeholder:"Enter percentage",min:"1",max:k(f.length),autoComplete:"off"}),(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"%"})]})]}),(S[a]||0===x[a])&&(0,r.jsx)("p",{className:"text-xs text-red-500 mt-1",children:S[a]||"0% is not allowed"})]},a)})})]}),(0,r.jsxs)("div",{className:"flex justify-start gap-3",children:[(0,r.jsx)(l.Button,{type:"submit",onClick:_,disabled:M,className:"cursor-pointer px-6","data-testid":"save-weightage-button",children:h?"Saving...":"Save"}),(0,r.jsx)(l.Button,{type:"button",variant:"outline",onClick:O,className:"cursor-pointer px-6","data-testid":"cancel-weightage-button",children:"Cancel"})]})]})}},68090:(e,t,a)=>{a.d(t,{JT:()=>n,Yq:()=>r});let r={short:e=>new Date(e).toLocaleDateString(),long:e=>new Date(e).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),time:e=>new Date(e).toLocaleTimeString(),dateTime:e=>
1new Date(e).toLocaleString(),relative:e=>{let t=new Date(e),a=Math.floor((new Date().getTime()-t.getTime())/1e3);return a<60?"just now":a<3600?"".concat(Math.floor(a/60)," minutes ago"):a<86400?"".concat(Math.floor(a/3600)," hours ago"):a<2592e3?"".concat(Math.floor(a/86400)," days ago"):a<31536e3?"".concat(Math.floor(a/2592e3)," months ago"):"".concat(Math.floor(a/31536e3)," years ago")},iso:e=>new Date(e).toISOString(),custom:(e,t)=>new Date(e).toLocaleDateString(void 0,t),input:e=>new Date(e).toISOString().split("T")[0]||"",withTimezone:e=>new Date(e).toLocaleString(void 0,{timeZoneName:"short"})},n={capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),titleCase:e=>e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()),truncate:function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return e.length<=t?e:e.substring(0,t)+a},slugify:e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,""),camelCase:e=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e,t)=>0===t?e.toLowerCase():e.toUpperCase()).replace(/\s+/g,""),kebabCase:e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),snakeCase:e=>e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase(),mask:(e,t)=>{switch(t){case"email":let[a,r]=e.split("@");return"".concat((null==a?void 0:a.charAt(0))||"","***@").concat(r||"");case"phone":return e.replace(/(\d{3})\d{3}(\d{4})/,"$1-***-$2");case"credit-card":return e.replace(/\d(?=\d{4})/g,"*");default:return e}},phone:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"(###) ###-####",a=e.replace(/\D/g,""),r=t;for(let e=0;e<a.length&&r.includes("#");e++)r=r.replace("#",a[e]||"");return r.replace(/#/g,"_")},creditCard:e=>{let t=e.replace(/\D/g,""),a=t.match(/.{1,4}/g);return a?a.join(" "):t},initials:e=>e.split(" ").map(e=>e.charAt(0)).join("").toUpperCase().slice(0,2),stripHtml:e=>e.replace(/<[^>]*>/g,""),escapeHtml:e=>{let t=document.createElement("div");return t.textContent=e,t.innerHTML},unescapeHtml:e=>{let t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""}}}}]);

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.