var e=e=>{let t=String(e??``).replace(/\r\n/g,`
`).replace(/\r/g,`
`);return/[",\n]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t},t=(t,n,r={})=>[n.map(t=>e(r[t]||t)).join(`,`),...t.map(t=>n.map(n=>e(t[n])).join(`,`))].join(`
`),n=(e,t)=>{let n=new Blob([`\uFEFF${t}`],{type:`text/csv;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e.endsWith(`.csv`)?e:`${e}.csv`,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)},r=e=>{if(e==null||!Number.isFinite(Number(e)))return`待复核`;let t=Number(e);return t>=75?`优先推进`:t>=60?`进入备选`:t>=40?`谨慎推进`:`暂缓`},i=e=>{if(e==null||!Number.isFinite(Number(e)))return`pending`;let t=Number(e);return t>=75?`high`:t>=60?`medium`:`low`},a=e=>{let t={total:e.length,scored:0,averageScore:null,bestScore:null,topCandidate:``,priorityCount:0,backupCount:0,cautiousCount:0,pausedCount:0,pendingCount:0},n=0;return e.forEach(e=>{if(e.score==null||!Number.isFinite(Number(e.score))){t.pendingCount+=1;return}let r=Number(e.score);t.scored+=1,n+=r,(t.bestScore==null||r>t.bestScore)&&(t.bestScore=r,t.topCandidate=e.candidate_label),r>=75?t.priorityCount+=1:r>=60?t.backupCount+=1:r>=40?t.cautiousCount+=1:t.pausedCount+=1}),t.averageScore=t.scored?Math.round(n/t.scored):null,t};export{a,i,n,r,t};