import{i as e}from"./chunk-B3pr0VN8.js";import{n as t,t as n}from"./jsx-runtime-wTfS3W87.js";import{t as r}from"./alert-circle-DbIrx97D.js";import{t as i}from"./check-circle-2-CiriN2_v.js";import{t as a}from"./chevron-down-B0T6sOHE.js";import{t as o}from"./chevron-up-D6LLrYny.js";import{t as s}from"./file-text-CHBGhHo7.js";import{t as c}from"./loader-2-3HttAI4E.js";import{i as l,l as u}from"./hrResumePdfQueue-CuLMwrTQ.js";import{t as d}from"./x-BDqDXavd.js";import{t as f}from"./HrUsageBadge-CQvABhaC.js";var p=e(t(),1),m=n(),h={queued:`待识别`,parsing:`识别中`,ready:`已就绪`,failed:`失败`};function g({status:e}){return e===`ready`?(0,m.jsx)(i,{size:15,className:`hr-upload-status-icon hr-upload-status-icon--ready`}):e===`failed`?(0,m.jsx)(r,{size:15,className:`hr-upload-status-icon hr-upload-status-icon--failed`}):e===`parsing`?(0,m.jsx)(c,{size:15,className:`hr-upload-status-icon hr-upload-status-icon--spin`}):(0,m.jsx)(s,{size:15,className:`hr-upload-status-icon`})}function _({rows:e,maxFiles:t,disabled:n,title:r,hint:i,emptyText:c,compactLimit:_=6,onFiles:v,onRemove:y}){let b=(0,p.useRef)(null),[x,S]=(0,p.useState)(!1),[C,w]=(0,p.useState)(!1),T=!!n||e.length>=t,E=e.filter(e=>e.status===`ready`).length,D=e.filter(e=>e.status===`failed`).length,O=e.filter(e=>e.status===`parsing`).length,k=e.length>_,A=k&&!C?e.slice(0,_):e,j=Math.max(0,e.length-A.length),M=e=>{let t=Array.from(e||[]);t.length&&v(t)};return(0,m.jsxs)(`div`,{className:`hr-upload-panel`,children:[(0,m.jsx)(`input`,{ref:b,type:`file`,accept:`.pdf,application/pdf`,multiple:!0,disabled:T,className:`hr-upload-input`,onChange:e=>{M(e.target.files),e.currentTarget.value=``}}),(0,m.jsxs)(`div`,{role:`button`,tabIndex:0,className:`hr-upload-drop${x?` is-over`:``}${T?` is-disabled`:``}${e.length?` has-files`:``}`,onClick:()=>{T||b.current?.click()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&!T&&b.current?.click()},onDragOver:e=>{e.preventDefault(),T||S(!0)},onDragLeave:()=>S(!1),onDrop:e=>{e.preventDefault(),S(!1),T||M(e.dataTransfer.files)},children:[(0,m.jsx)(`div`,{className:`hr-upload-icon`,children:(0,m.jsx)(u,{size:22})}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`hr-upload-title`,children:r}),(0,m.jsx)(`div`,{className:`hr-upload-hint`,children:i})]})]}),(0,m.jsxs)(`div`,{className:`hr-upload-summary`,children:[(0,m.jsxs)(`div`,{className:`hr-upload-stats`,children:[(0,m.jsxs)(`span`,{children:[`已添加 `,e.length,`/`,t]}),(0,m.jsxs)(`span`,{children:[`就绪 `,E]}),O?(0,m.jsxs)(`span`,{children:[`识别中 `,O]}):null,D?(0,m.jsxs)(`span`,{children:[`失败 `,D]}):null,j?(0,m.jsxs)(`span`,{children:[`收起 `,j,` 份`]}):null]}),k?(0,m.jsx)(`button`,{type:`button`,className:`hr-upload-toggle`,onClick:()=>w(e=>!e),children:C?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(o,{size:14}),` 收起列表`]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a,{size:14}),` 展开全部`]})}):null]}),e.length?(0,m.jsxs)(`div`,{className:`hr-upload-list${C?` is-expanded`:` is-collapsed`}`,children:[A.map((e,t)=>(0,m.jsxs)(`div`,{className:`hr-upload-row`,children:[(0,m.jsx)(`div`,{className:`hr-upload-fileicon`,children:(0,m.jsx)(s,{size:18})}),(0,m.jsxs)(`div`,{className:`hr-upload-filemain`,children:[(0,m.jsx)(`div`,{className:`hr-upload-filename`,children:e.fileName||`候选人 ${t+1}`}),(0,m.jsxs)(`div`,{className:`hr-upload-meta`,children:[(0,m.jsx)(g,{status:e.status}),(0,m.jsx)(`span`,{children:h[e.status]}),e.stage?(0,m.jsx)(`span`,{children:e.stage}):null,e.pages?(0,m.jsxs)(`span`,{children:[e.pages,` 页`]}):null,e.size?(0,m.jsx)(`span`,{children:l(e.size)}):null]}),(0,m.jsx)(f,{compact:!0,pdfBilling:e.pdfBilling||(e.pages?{pages:e.pages,costCents:e.pages*5,displayPoints:e.pages*.05,pointsPerPage:.05}:null)}),e.tags?.length?(0,m.jsx)(`div`,{className:`hr-tag-list`,children:e.tags.slice(0,3).map(t=>(0,m.jsx)(`span`,{className:`hr-auto-tag`,children:t},`${e.id}-${t}`))}):null,e.error?(0,m.jsx)(`div`,{className:`hr-upload-error`,children:e.error}):null]}),(0,m.jsx)(`button`,{type:`button`,className:`hr-upload-remove`,onClick:()=>y(e.id),disabled:n,"aria-label":`移除 ${e.fileName}`,children:(0,m.jsx)(d,{size:15})})]},e.id)),j?(0,m.jsxs)(`div`,{className:`hr-upload-more-note`,children:[`还有 `,j,` 份文件已收起`]}):null]}):(0,m.jsx)(`div`,{className:`hr-upload-empty`,children:c})]})}export{_ as t};