import{i as e}from"./chunk-B3pr0VN8.js";import{n as t,t as n}from"./jsx-runtime-wTfS3W87.js";import{m as r}from"./chunk-6CSD65Y2-Dj7xjS5D.js";import{r as i}from"./authSession-CrP9lMPq.js";import{r as a}from"./norm-CeclA1Tu.js";import{r as o}from"./billingCopy-19NcY4pu.js";import{f as s}from"./cloudModel-CGo_el7I.js";import{n as c}from"./llmSettings-A1Pww_S_.js";import{t as l}from"./resumeAiConsent-Cb5Qq4UE.js";import{t as u}from"./createLucideIcon-D8EZdzY3.js";import{t as d}from"./copy-Dd_CSnp-.js";import{t as f}from"./download-8udYNbpo.js";import{t as p}from"./file-text-CHBGhHo7.js";import{t as m}from"./printer-OxZToARA.js";import{t as h}from"./refresh-cw-BgzRAeGH.js";import{t as g}from"./browser-Jwned2-9.js";import{t as _}from"./PlatformTokenUsage-DOyFOKQg.js";import{n as ee,r as v,t as y}from"./FallbackNoticeCard-B3WK5QL2.js";import{t as te}from"./EditorialMarkdown-C2waBXeA.js";import{a as b,i as ne,l as re,n as x,s as ie,t as ae,u as oe}from"./toolRuntime-wpPmOqkC.js";import{t as se}from"./pdfUtils-Bnt45Amd.js";import{c as ce,t as S,u as le}from"./proxyOps-D3Awrk7b.js";import{i as C}from"./llm-C3ZnNouF.js";import{n as w,t as ue}from"./ToolSidebarNav-ChQWauy7.js";import{t as T}from"./ThinkingPanel-DWgqEvqz.js";import{t as E}from"./MarkdownText-PFZ-Hr7C.js";import{t as de}from"./ToolLiveStreamPanel-NdoSsKvg.js";import{i as fe,r as pe}from"./ToolConversationBilling-tfxRkJpq.js";import{n as me}from"./aiResumeOptimize-Bp5qe6zO.js";import{n as he}from"./taskPointGuard-Cj3sjKf6.js";import{n as ge,t as _e}from"./toolSkillSummary-B3044xDN.js";import{t as ve}from"./cloudWorkspaceShares-Dkgf6OcS.js";import{n as ye,t as be}from"./resumeWebShare-B98dsaKF.js";import{n as xe,r as D,t as Se}from"./ToolConversationPersistence-BktXM-PD.js";import{a as Ce,i as we,r as Te,t as O}from"./ToolConversationExecution-BnhU63Mh.js";import{n as Ee,t as De}from"./useToolRunState-lqkZz3ea.js";import{t as k}from"./JdBuzzwordDetector-BRBwbLvV.js";import{t as A}from"./ToolRunStatus-sSVJghbX.js";import{n as Oe,t as ke}from"./useRestoredFieldsHighlight-C1fpbsAB.js";import{t as j}from"./FilePicker-BfdbCP5q.js";var Ae=u(`Share2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),M=e(t(),1),N=`deepseek_pro`,je=`deepseek`,Me=`deepseek-v4-pro`,P=e=>String(e||``).replace(/^\s*```(?:markdown|md|text)?\s*/i,``).replace(/\s*```\s*$/i,``).replace(/^-{3,}\s*\n?/,``).replace(/\n?-{3,}$/,``).trim(),Ne=e=>{let t=String(e||``).trim();return t?/^#{1,6}\s+/.test(t)||/^[【\[][^】\]]+[】\]]$/.test(t)||/^(?:\d+[.、]|[一二三四五六七八九十]+[、.])\s*/.test(t)?!0:t.length<=42&&/(完整简历|改写说明|优化说明|改写分析|ATS|关键词|投递建议|下一步)/i.test(t):!1},F=(e,t,n)=>{let r=String(e||``).replace(/\r/g,``).split(`
`),i=-1;for(let e=0;e<r.length;e++)if(t.test(r[e]||``)){i=e+1;break}if(i<0)return``;let a=r.length;for(let e=i;e<r.length;e++){let t=r[e]||``;if(n.test(t)&&Ne(t)){a=e;break}}return P(r.slice(i,a).join(`
`))},Pe=e=>{let t=String(e||``),n=Ge(t,`optimizedResume`);if(n)return n;let r=F(t,/(改写后(?:的)?完整简历|优化后(?:的)?完整简历|最终(?:可投递)?简历|完整简历)/i,/(改写说明|重点优化说明|优化说明|改写分析|ATS|关键词|下一步|投递建议|风险提示|补充建议)/i);if(r)return r;let i=t.match(/(?:#+ *[📄]?[^\n]*(?:改写后|完整简历)[^\n]*\n+)([\s\S]*?)(?=\n{0,2}#+ *[📝]|\n{0,2}#+ *(?:改写说明|ATS|优化说明|分析)|$)/iu);return i?.[1]?P(i[1]):``},Fe=e=>{let t=String(e||``),n=[],r=t.match(/✅\s+([\u4e00-\u9fa5A-Za-z0-9·\/\-·•]+)/g)||[];n.push(...r.map(e=>e.replace(/^✅\s+/,``).trim()));let i=F(t,/(ATS|关键词)/i,/(下一步|投递建议|风险提示|改写说明|优化说明|改写分析)/i);return i&&n.push(...i.split(/[\n,，、；;|]/g).map(e=>e.replace(/^[-*•\d.、\s✅]+/,``).replace(/[:：].*$/,``).trim()).filter(e=>e.length>=2&&e.length<=24)),[...new Set(n)].slice(0,24)},Ie=e=>{let t=String(e||``),n=[],r=t.match(/^\|[^|\n]+\|[^|\n]+\|[^|\n]+\|[^|\n]+\|/gm)||[];for(let e of r){let t=e.split(`|`).filter(Boolean).map(e=>e.trim());if(!(!t.length||/^[-:]+$/.test(t[0])||t[0]===`改动`||t[0]===`模块`||t[0]===`项目`)&&(n.push(t.filter(Boolean).join(` → `)),n.length>=12))break}if(!n.length){let e=F(t,/(改写说明|重点优化说明|优化说明|改写分析)/i,/(ATS|关键词|下一步|投递建议|风险提示)/i);n.push(...e.split(`
`).map(e=>e.replace(/^[-*•\d.、\s]+/,``).trim()).filter(e=>e.length>=8&&e.length<=180).slice(0,12))}return n.slice(0,12)},Le=e=>{let t=String(e||``).match(/\(requestId:([^)]+)\)/i);return t?.[1]?String(t[1]).trim():``},I=(e,t)=>{let n=Le(t);return n?`${e} 请求ID：${n}`:e},Re=e=>{let t=String(e||``);return t.includes(`"code":"1305"`)||t.includes(`访问量过大`)||t.toLowerCase().includes(`rate limit`)},ze=e=>{let t=String(e||``);return Re(t)||t.includes(`timeout`)},Be=e=>new Promise(t=>{window.setTimeout(t,e)}),Ve=e=>{let t=a(e);if(!t)return``;let n=t.replace(/\s+/g,` `).trim();return!n||n.length>36||/[：:]/.test(n)||/(职位描述|任职要求|岗位职责|工作职责|岗位要求|职责描述|JD)/i.test(n)||/\d+[、.．]/.test(n)||/[，,。；;]/.test(n)?``:n},He=()=>{try{let e=new Uint8Array(12);return crypto.getRandomValues(e),Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}catch{return`${Date.now().toString(16)}${Math.random().toString(16).slice(2)}`.replace(/[^a-f0-9]/gi,``).slice(0,24)}},Ue=(e,t)=>[a(e),a(t)].filter(Boolean).join(`:`).toLowerCase(),We=e=>e?[a(e.scoreText)?`综合匹配：${a(e.scoreText)}`:``,a(e.summary)?`匹配结论：${a(e.summary)}`:``,L(`最强优势`,Array.isArray(e.strengths)?e.strengths.map(a).filter(Boolean):[]),L(`关键缺口`,Array.isArray(e.gaps)?e.gaps.map(a).filter(Boolean):[]),L(`优先改写动作`,Array.isArray(e.actions)?e.actions.map(a).filter(Boolean):[]),L(`重点关键词`,Array.isArray(e.keywords)?e.keywords.map(a).filter(Boolean):[],8),`请基于以上匹配结论改写简历，优先补足缺口、保留真实经历，不要编造不存在的信息。`].filter(Boolean).join(`

`):``,Ge=(e,t)=>{let n=String(e||``),r=`"${t}"`,i=n.indexOf(r);if(i<0)return``;let a=n.indexOf(`:`,i+r.length);if(a<0)return``;let o=a+1;for(;o<n.length&&/\s/.test(n[o]);)o++;if(n[o]!==`"`)return``;o++;let s=``;for(let e=o;e<n.length;e++){let t=n[e];if(t===`"`)return s;if(t===`\\`){let t=n[e+1];if(t==null)return s;if(t===`n`){s+=`
`,e++;continue}if(t===`r`){s+=`\r`,e++;continue}if(t===`t`){s+=`	`,e++;continue}if(t===`"`||t===`\\`||t===`/`){s+=t,e++;continue}if(t===`u`){let t=n.slice(e+2,e+6);if(t.length<4)return s;if(/^[0-9a-fA-F]{4}$/.test(t)){s+=String.fromCharCode(parseInt(t,16)),e+=5;continue}return s}s+=t,e++;continue}s+=t}return s},Ke=(e,t,n=80)=>{let r=String(e||``),i=`"${t}"`,a=r.indexOf(i);if(a<0)return[];let o=r.indexOf(`:`,a+i.length);if(o<0)return[];let s=o+1;for(;s<r.length&&/\s/.test(r[s]);)s++;if(r[s]!==`[`)return[];s++;let c=[],l=``,u=!1;for(let e=s;e<r.length;e++){let t=r[e];if(!u){if(t===`]`)break;if(t===`"`){u=!0,l=``;continue}continue}if(t===`"`){let e=String(l||``).trim();if(e&&c.push(e),c.length>=n)break;u=!1;continue}if(t===`\\`){let t=r[e+1];if(t==null)break;if(t===`n`){l+=`
`,e++;continue}if(t===`r`){l+=`\r`,e++;continue}if(t===`t`){l+=`	`,e++;continue}if(t===`"`||t===`\\`||t===`/`){l+=t,e++;continue}if(t===`u`){let t=r.slice(e+2,e+6);if(t.length<4)break;if(/^[0-9a-fA-F]{4}$/.test(t)){l+=String.fromCharCode(parseInt(t,16)),e+=5;continue}break}l+=t,e++;continue}l+=t}return c},qe=e=>{let t=a(e).toLowerCase();return t===`match`?`较高匹配`:t===`partial`?`基本匹配`:t===`miss`?`仍有缺口`:a(e)},Je=(e,t)=>{let n=String(e||``).replace(/\r\n/g,`
`).split(`
`),r=String(t||``).replace(/\r\n/g,`
`).split(`
`),i=Math.min(600,n.length),a=Math.min(600,r.length),o=n.slice(0,i),s=r.slice(0,a),c=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)c[e][t]=o[e]===s[t]?c[e+1][t+1]+1:Math.max(c[e+1][t],c[e][t+1]);let l=[],u=0,d=0;for(;u<i&&d<a;){if(o[u]===s[d]){l.push({kind:`ctx`,text:o[u]}),u++,d++;continue}if(c[u+1][d]>=c[u][d+1]){l.push({kind:`del`,text:o[u]}),u++;continue}l.push({kind:`add`,text:s[d]}),d++}for(;u<i;u++)l.push({kind:`del`,text:o[u]});for(;d<a;d++)l.push({kind:`add`,text:s[d]});return l},Ye=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.kind===`ctx`){t.push({left:r.text,right:r.text,leftKind:`ctx`,rightKind:`ctx`});continue}if(r.kind===`del`){let r=[],i=[];for(;n<e.length&&e[n].kind===`del`;n++)r.push(e[n].text);for(;n<e.length&&e[n].kind===`add`;n++)i.push(e[n].text);n--;let a=Math.max(r.length,i.length);for(let e=0;e<a;e++){let n=r[e]??``,a=i[e]??``;t.push({left:n,right:a,leftKind:n?`del`:`empty`,rightKind:a?`add`:`empty`})}continue}if(r.kind===`add`){t.push({left:``,right:r.text,leftKind:`empty`,rightKind:`add`});continue}}return t},L=(e,t,n=4)=>{let r=t.slice(0,n).map(e=>String(e||``).trim()).filter(Boolean);return r.length?`${e}：\n${r.map(e=>`- ${e}`).join(`
`)}`:``},Xe=(e,t)=>{if(!t||typeof t!=`object`)return null;let n=Array.isArray(t.items)?t.items[0]:null,r=(Array.isArray(n?.strengths)?n.strengths:Array.isArray(t.highlights)?t.highlights:[]).map(e=>a(e)).filter(Boolean).slice(0,4),i=(Array.isArray(t.gapsSummary)?t.gapsSummary:Array.isArray(n?.gaps)?n.gaps:[]).map(e=>a(e)).filter(Boolean).slice(0,4),o=(Array.isArray(n?.actions)?n.actions:[]).map(e=>a(e)).filter(Boolean).slice(0,4),s=(Array.isArray(t.keywords)?t.keywords:[]).map(e=>a(e?.keyword||e)).filter(Boolean).slice(0,8),c=Number(t.overallScore),l=Number.isFinite(c)?`${Math.round(c)}%`:``,u=a(t.summary||n?.fit||``),d=[l?`综合匹配：${l}`:``,u?`匹配结论：${u}`:``,L(`最强优势`,r),L(`关键缺口`,i),L(`优先改写动作`,o),L(`重点关键词`,s,8),`请基于以上匹配结论改写简历，优先补足缺口、保留真实经历，不要编造不存在的信息。`].filter(Boolean).join(`

`);return{sourceRid:a(e),scoreText:l,summary:u,strengths:r,gaps:i,actions:o,keywords:s,prompt:d}},Ze=(e,t)=>{let n=Pe(e);return n?[{jobId:``,jobTitle:Ve(a(t).slice(0,60)),company:``,fitSummary:`Agent 改写完成，完整简历已提取至编辑区，可直接生成 PDF 或查看改动对比。`,gaps:[],optimizedResume:n,atsKeywords:Fe(e),highlights:[],changes:Ie(e),atsNotes:[],caveats:[]}]:[]},R=n();function Qe(){let[e,t]=(0,M.useState)(null),[n,u]=(0,M.useState)(``),[d]=r();(0,M.useEffect)(()=>{if(d.get(`cc_ref`)!==`career_coach`)return;let e=d.get(`cc_resume`)||``;e&&u(t=>t||e)},[]);let[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(`professional`),[g,_]=(0,M.useState)(!1),[ee,v]=(0,M.useState)(``),[y,te]=(0,M.useState)([]),{runState:w,progress:ue,setProgress:T,setRunState:E,start:de,partial:ve,done:ye,failByMessage:be}=Ee(),[O,k]=(0,M.useState)(null),[A,Oe]=(0,M.useState)(null),[j,Ae]=(0,M.useState)(null),[P,Ne]=(0,M.useState)(``),{restoredFields:F,setRestoredFields:L,isRestored:Qe,hasRestored:$e}=ke(),et=(0,M.useRef)(null),tt=(0,M.useRef)(null),nt=(0,M.useRef)(null),z=(0,M.useRef)(0),B=(0,M.useRef)(null),V=(0,M.useRef)(``),H=(0,M.useRef)(4),U=(0,M.useRef)(0),rt=(0,M.useRef)(null),it=(0,M.useRef)(null),[W,G]=(0,M.useState)(``),[at,K]=(0,M.useState)(``),[ot,q]=(0,M.useState)(``),[st,ct]=(0,M.useState)(``),[lt,J]=(0,M.useState)(null),[ut,Y]=(0,M.useState)(``),[X,dt]=(0,M.useState)(!1),[ft,Z]=(0,M.useState)(``),[pt,mt]=(0,M.useState)(``),[ht,gt]=(0,M.useState)(!1),[_t,Q]=(0,M.useState)(``),[vt,$]=(0,M.useState)(``),[yt,bt]=(0,M.useState)(``),[xt,St]=(0,M.useState)(``),[Ct,wt]=(0,M.useState)(null),[Tt,Et]=(0,M.useState)(``),[Dt,Ot]=(0,M.useState)(``),[kt,At]=(0,M.useState)(``),[jt,Mt]=(0,M.useState)(!0),[Nt,Pt]=(0,M.useState)(`delivery`),[Ft,It]=(0,M.useState)(``),[Lt,Rt]=(0,M.useState)(!1),[zt,Bt]=(0,M.useState)(!0);(0,M.useEffect)(()=>{let e=!0,t=async()=>{let t=await i();e&&Rt(!!t)};t();let n=()=>{t()};try{window.addEventListener(`AUTH_SESSION_UPDATED_WEB`,n)}catch{}try{window.addEventListener(`focus`,n)}catch{}return()=>{e=!1;try{window.removeEventListener(`AUTH_SESSION_UPDATED_WEB`,n)}catch{}try{window.removeEventListener(`focus`,n)}catch{}}},[]),(0,M.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=a(e.get(`source`));if(t!==`career_coach`&&t!==`public_jobs`)return;let r=ne(a(e.get(`sid`)));r&&(a(r.resumeText)&&!a(n)&&u(a(r.resumeText)),a(r.jdText)&&!a(f)&&p(a(r.jdText)))},[]);let[Vt,Ht]=(0,M.useState)([]),[Ut,Wt]=(0,M.useState)(``),Gt=(0,M.useRef)(null),Kt=(0,M.useRef)(``),qt=(0,M.useRef)(0),Jt=(0,M.useMemo)(()=>a(f).length>20&&(a(n).length>30||!!e),[f,n,e]),Yt=(0,M.useMemo)(()=>Ge(W,`optimizedResume`),[W]),Xt=(0,M.useMemo)(()=>Ke(W,`atsKeywords`,40),[W]),Zt=(0,M.useMemo)(()=>Ke(W,`changes`,40),[W]),Qt=(0,M.useMemo)(()=>{let e=a(O?.[0]?.optimizedResume||``);return w===`running`||w===`partial`?Yt||e:e||Yt},[O,w,Yt]);(0,M.useEffect)(()=>{let e=a(Qt);!e||e===Kt.current||(Kt.current=e,It(e))},[Qt]);let $t=(0,M.useMemo)(()=>a(Ft)||a(Qt),[Ft,Qt]),en=(0,M.useMemo)(()=>{let e=Array.isArray(O?.[0]?.atsKeywords)?O[0].atsKeywords.map(e=>String(e||``).trim()).filter(Boolean):[];return w===`running`||w===`partial`?Xt.length?Xt:e:e.length?e:Xt},[O,w,Xt]),tn=(0,M.useMemo)(()=>{let e=Array.isArray(O?.[0]?.changes)?O?.[0]?.changes.map(e=>String(e||``).trim()).filter(Boolean):[];return w===`running`||w===`partial`?Zt.length?Zt:e:e.length?e:Zt},[O,w,Zt]),nn=()=>{gt(!1),Q(``),$(``),bt(``),St(``),wt(null),Et(``),Ot(``),At(``)},rn=(0,M.useMemo)(()=>{let e=String(ut||``).trim(),t=String($t||``).trim();return!e||!t||e.length>12e4||t.length>12e4?[]:Ye(Je(e,t)).slice(0,2200)},[$t,ut]),an=(0,M.useMemo)(()=>a([...y].reverse().find(e=>e.role===`assistant`)?.id),[y]),on=(0,M.useMemo)(()=>{let e=O?.[0];return{fitSummary:qe(e?.fitSummary||e?.fitLevel),fitLevel:a(e?.fitLevel),fitScore:Number.isFinite(Number(e?.fitScore))?Math.round(Number(e?.fitScore)):null,outputLength:String($t||``).trim().length,changeCount:tn.length,caveatCount:Array.isArray(e?.caveats)?e.caveats.length:0,highlightCount:Array.isArray(e?.highlights)?e.highlights.length:0,jobTitle:Ve(a(e?.jobTitle)),company:a(e?.company)}},[$t,O,tn]),sn=(0,M.useMemo)(()=>O?.length?ge(`resume_optimize`,{items:O}):null,[O]),cn=(0,M.useMemo)(()=>Array.isArray(O?.[0]?.missingCriticalKeywords)?O[0].missingCriticalKeywords.slice(0,8).map(e=>a(e)).filter(Boolean):[],[O]),ln=(0,M.useMemo)(()=>Array.isArray(O?.[0]?.atsNotes)?O[0].atsNotes.slice(0,6).map(e=>a(e)).filter(Boolean):[],[O]),un=(0,M.useMemo)(()=>Array.isArray(O?.[0]?.matchMatrix)?O[0].matchMatrix.slice(0,6):[],[O]),dn=()=>{let t=[];return a(f)&&t.push(`JD 已提供（${a(f).length} 字）`),a(n)&&t.push(`简历已提供（${a(n).length} 字）`),e&&t.push(`附件：${a(e.name)}`),A?.sourceRid&&t.push(`已承接上一轮简历匹配结论（${A.sourceRid.slice(-6)}）`),t.join(`
`)},fn=e=>{let t=[];return a(e?.fit)&&t.push(`我先给你一个判断：这版简历优化后，和目标岗位的贴合度会更接近“${a(e.fit)}”。`),Array.isArray(e?.changes)&&e.changes.length&&t.push(`这轮我重点改了这些地方：\n${e.changes.slice(0,4).map(e=>`- ${a(e)}`).join(`
`)}`),Array.isArray(e?.atsKeywords)&&e.atsKeywords.length&&t.push(`我补强了这些 ATS 关键词：\n${e.atsKeywords.slice(0,8).map(e=>`- ${a(e)}`).join(`
`)}`),a(e?.optimizedResume)&&t.push(`改写后的正文已经准备好，你可以继续调整，也可以直接查看下方详情。`),t.join(`

`)||`已生成简历优化建议。`};xe({tool:`resume_optimize`,onRestore:e=>{if(a(e.resumeText)&&u(a(e.resumeText)),a(e.jd)&&p(a(e.jd)),e&&typeof e.resumeStyle==`string`&&h(e.resumeStyle),Array.isArray(e.items))k(e.items);else if(a(e.streamText)){let t=Ze(a(e.streamText),a(e.jd)||a(f));t.length&&(k(t),It(t[0]?.optimizedResume||``))}e&&typeof e.fallbackInfo==`object`&&J(e.fallbackInfo),e.matchCarryover&&typeof e.matchCarryover==`object`&&(Oe(e.matchCarryover),Ae(e.matchCarryover)),Array.isArray(e.chatTurns)&&te(e.chatTurns.slice(-80)),a(e.streamText)&&(G(a(e.streamText)),Wt(a(e.streamText))),a(e.streamThinking)&&K(a(e.streamThinking)),a(e.streamStage)&&q(a(e.streamStage)),a(e.streamActor)&&ct(a(e.streamActor)),a(e.sourceResumeForRun)&&Y(a(e.sourceResumeForRun)),Number.isFinite(Number(e.progress))&&T(Number(e.progress));let t=a(e.streamRequestId),n=Math.max(0,Number(e.streamLastEventId||0)),r=a(e.streamModelKey);(e.runState===`running`||e.runState===`partial`)&&t&&(Bt(!0),B.current={requestId:t,lastEventId:n,modelKey:r})},syncEntries:[{key:`items`,signature:e=>Array.isArray(e.items)?JSON.stringify(e.items):``,apply:e=>k(Array.isArray(e.items)?e.items:null)},{key:`fallbackInfo`,signature:e=>e&&typeof e.fallbackInfo==`object`?JSON.stringify(e.fallbackInfo):``,apply:e=>J(e&&typeof e.fallbackInfo==`object`?e.fallbackInfo:null)},{key:`streamText`,signature:e=>a(e.streamText),apply:e=>{let t=a(e.streamText);if(G(t),Wt(t),!Array.isArray(e.items)&&t){let n=Ze(t,a(e.jd)||a(f));n.length&&(k(n),It(n[0]?.optimizedResume||``))}}},{key:`streamThinking`,signature:e=>a(e.streamThinking),apply:e=>K(a(e.streamThinking))},{key:`streamStage`,signature:e=>a(e.streamStage),apply:e=>q(a(e.streamStage))},{key:`streamActor`,signature:e=>a(e.streamActor),apply:e=>ct(a(e.streamActor))},{key:`sourceResumeForRun`,signature:e=>a(e.sourceResumeForRun),apply:e=>Y(a(e.sourceResumeForRun))},{key:`resumeStyle`,signature:e=>a(e?.resumeStyle),apply:e=>{a(e?.resumeStyle)&&h(e.resumeStyle)}},{key:`progress`,signature:e=>Number.isFinite(Number(e.progress))?String(Number(e.progress)):``,apply:e=>{Number.isFinite(Number(e.progress))&&T(Number(e.progress))}}],onRunState:(e,t)=>{e===`running`?(E(`running`),_(!0)):e===`partial`?(ve(),_(!0)):e===`done`?(ye(),_(!1)):e===`failed`?(be(String(t.err||`生成失败`),v),_(!1)):e===`cancelled`&&(be(`已取消`,v),_(!1))},shouldStop:e=>e!==`running`&&e!==`partial`}),(0,M.useEffect)(()=>{let e=Gt.current;if(e)try{e.scrollTop=e.scrollHeight}catch{}},[y.length,at,W,g]),(0,M.useEffect)(()=>{try{it.current&&window.clearTimeout(it.current)}catch{}return it.current=window.setTimeout(()=>{D(`resume_optimize`,{resumeText:a(n),jd:a(f),matchCarryover:j||A,resumeStyle:m})},300),()=>{try{it.current&&window.clearTimeout(it.current)}catch{}it.current=null}},[j,f,A,m,n]),(0,M.useEffect)(()=>{if(!g)return;let e=window.setInterval(()=>{let e=Number(U.current||0);if(!e)return;let t=String(w||``).trim();if(!(t!==`running`&&t!==`partial`)&&!(Date.now()-e<12e4)){_(!1),be(`生成停滞：请点击重新生成或切换模型后重试`,v),D(`resume_optimize`,{runState:`failed`,err:`stalled`});try{et.current?.abort()}catch{}}},1e3);return()=>{try{window.clearInterval(e)}catch{}}},[g,w]),(0,M.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=String(e.get(`focus`)||``).trim(),r=String(e.get(`rid`)||``).trim(),i=String(e.get(`matchRid`)||``).trim();if(r&&!$e){let e=b(r,`简历优化`);if(e&&typeof e==`object`){let t=[];if(Ne(`已恢复历史记录 ${r.slice(-6)}`),a(e?.resumeText)&&!a(n)&&(u(a(e.resumeText)),t.push(`简历文本`)),a(e?.jd)&&!a(f)&&(p(a(e.jd)),t.push(`JD`)),a(e?.resumeStyle)&&h(a(e.resumeStyle)),Array.isArray(e?.items)&&!O&&(k(e.items),t.push(`结果`)),e?.fallbackInfo&&typeof e.fallbackInfo==`object`&&J(e.fallbackInfo),e?.matchCarryover&&typeof e.matchCarryover==`object`&&!A)Oe(e.matchCarryover),Ae(e.matchCarryover),t.push(`匹配结论`);else if(a(e?.matchRid)&&!A){let n=b(a(e.matchRid),`简历匹配`),r=Xe(a(e.matchRid),n?.result);r&&(Oe(r),Ae(r),t.push(`匹配结论`))}L(t)}}else if(i&&!$e){let e=b(i,`简历匹配`),t=ne(i),r=Se(`resume_match`),o=a(r?.latestResultId)===i?r:null,s=Xe(i,e?.result||o?.out);if(e&&typeof e==`object`||t||o){let r=[];Ne(`已承接简历匹配 ${i.slice(-6)}`);let c=a(e?.resumeText)||a(t?.resumeText)||a(o?.resumeText),l=a(e?.jd)||a(t?.jdText)||a(o?.jd);c&&!a(n)&&(u(c),r.push(`简历文本`)),l&&!a(f)&&(p(l),r.push(`JD`)),a(e?.resumeStyle)&&h(a(e.resumeStyle)),s&&(Oe(s),Ae(s),r.push(`匹配结论`)),L(r)}}t===`result`&&window.setTimeout(()=>{try{rt.current?.scrollIntoView({behavior:`smooth`,block:`start`})}catch{}},80)},[$e,O,f,A,n]);let pn=async t=>{if(nt.current)return await nt.current;if(!e)throw Error(`请上传 PDF 简历或粘贴简历文本`);let n=e;if(String(n.type||``).toLowerCase()!==`application/pdf`&&!/\.pdf$/i.test(n.name||``))throw Error(`仅支持 PDF 格式`);if(n.size>1e7)throw Error(`PDF 文件过大（限制 10MB）`);tt.current?.abort();let r=new AbortController;tt.current=r,mt(``),dt(!0),Z(t===`auto`?`自动解析中…`:`解析中…`);let a=(async()=>{if(!await i())throw Error(`请先登录后解析`);let e=await se(n),t=await ce({fileDataUrl:await S(n),fileName:n.name||`resume.pdf`,pages:e,minLength:800,signal:r.signal,onStage:Z});if(!t)throw Error(`解析结果为空`);return u(t),Z(`解析完成`),t})();nt.current=a;try{return await a}finally{nt.current=null,dt(!1);try{tt.current=null}catch{}Z(``)}},mn=async()=>a(n)||await pn(`run`);(0,M.useEffect)(()=>{if(!e){dt(!1),Z(``),mt(``),tt.current?.abort(),nt.current=null;return}(async()=>{if(await l())try{await pn(`auto`)}catch(e){mt(a(e?.message||`解析失败`))}})()},[e]);let hn=()=>({id:`web_${Math.random().toString(16).slice(2)}`,pool:`jobseeker`,title:`（网页输入 JD）`,company:``,salary:{min:0,max:0,currency:`CNY`,text:``},description:[a(f),We(j||A)?`上一步简历匹配结论（必须结合处理）：\n${We(j||A)}`:``].filter(Boolean).join(`

`).trim(),url:`https://bysjob.com`,platform:`import`,tags:[],created_at:Date.now(),updated_at:Date.now()}),gn=async()=>{if(g)return;let e=++z.current;if(!await _n()||(v(``),!await l()))return;nn(),k(null),J(null),G(``),K(``),q(``),ct(``),qt.current=0,It(``),Pt(`delivery`),de(),et.current=new AbortController,_(!0);let t=await fe({rangeDays:1,pageSize:100}),r=j||A;D(`resume_optimize`,{runState:`running`,progress:0,resumeText:a(n),jd:a(f),chatTurns:y,matchCarryover:r,matchRid:a(r?.sourceRid),resumeStyle:m});try{J(null);let n=await mn();Y(n),D(`resume_optimize`,{sourceResumeForRun:n,matchCarryover:r,matchRid:a(r?.sourceRid)});let i={},o=await oe(me([hn()],n,{provider:je,model:Me,thinking:!0,signal:et.current.signal,onProgress:e=>{U.current=Date.now();let t=Math.max(1,Math.min(99,Math.round(e||0)));T(t),D(`resume_optimize`,{runState:`running`,progress:t})},onPartial:t=>{if(e!==z.current)return;U.current=Date.now(),ve();try{let e=Number(t?._attempt||0);e&&e!==qt.current&&(qt.current=e,G(``),K(``));let n=String(t?._streamStage||``).trim(),r=String(t?._streamActor||``).trim(),i=String(t?._streamText||``).trim(),a=String(t?._streamThinking||``).trim();n&&q(n),r&&ct(r),i&&G(i),a&&K(a)}catch{}Object.assign(i,t||{});let n=Array.isArray(i?.items)?i.items:[],r=t?._fallback||i?._fallback||null;r&&J(r),k(n),D(`resume_optimize`,{runState:`partial`,progress:ue,items:n,fallbackInfo:r,streamText:String(t?._streamText||``),streamThinking:String(t?._streamThinking||``),streamStage:String(t?._streamStage||``),streamActor:String(t?._streamActor||``)})}}),24e4,`简历优化生成`);if(e!==z.current)return;let s=Array.isArray(o?.items)?o.items:[],c=o?._fallback&&typeof o._fallback==`object`?o._fallback:null;J(c),k(s);let l=await pe({beforeIds:t,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}),u={id:`turn_a_${Date.now()}_${Math.random().toString(16).slice(2,8)}`,role:`assistant`,content:fn(s?.[0]),createdAt:Date.now(),billing:l},d=[...y,u].slice(-80);te(d),ye(),T(100);let p=`resume_opt_${Date.now()}_${Math.random().toString(16).slice(2,8)}`;_(!1),Mt(!0),Pt(`delivery`),D(`resume_optimize`,{runState:`done`,progress:100,items:s,fallbackInfo:c,chatTurns:d,matchCarryover:r,matchRid:a(r?.sourceRid),resumeStyle:m}),queueMicrotask(()=>{re(_e({id:p,toolLabel:`简历优化`,toolType:`resume_optimize`,title:`简历优化结果`,score:a(s?.[0]?.fit)||``,deepLink:x(`/tools/resume-optimize`,`result`,{rid:p}),result:{items:s,...c?{_fallback:c}:{}}}),{resumeText:n,jd:a(f),items:s,fallbackInfo:c,resumeStyle:m,matchRid:a(r?.sourceRid),matchCarryover:r}).catch(()=>{})})}catch(t){if(e!==z.current)return;let n=ie(t,`生成失败`);be(n,v),D(`resume_optimize`,{runState:String(n||``).includes(`取消`)?`cancelled`:`failed`,err:String(n||``),progress:ue})}finally{_(!1)}},_n=async e=>{let t=await i();if(!t)return v((0,R.jsxs)(`p`,{style:{color:`var(--accent)`,fontSize:`13px`},children:[`请先`,(0,R.jsx)(`a`,{href:ae(),children:`登录`}),`后使用简历优化功能`]})),null;if(!e?.skipQuote)try{let e=await he({tool:`resume_optimize`,modelChoice:N,resumeChars:a(n).length,jdChars:a(f).length});if(!e.ok)return v((0,R.jsxs)(`p`,{style:{color:`var(--accent)`,fontSize:`13px`},children:[e.message,` `,(0,R.jsx)(`a`,{href:e.rechargeHref,children:`先充值`})]})),null}catch(e){return v((0,R.jsx)(`p`,{style:{color:`var(--accent)`,fontSize:`13px`},children:String(e?.message||`暂时无法校验积分余额，请稍后重试。`)})),null}return t},vn=async e=>{let t=!!e?.requestId;if(g&&!t)return;let r=++z.current,i=await _n({skipQuote:t});if(!i)return;v(``),t||(nn(),k(null),Ht([]),Wt(``),G(``),K(``),q(``),ct(``),It(``),J(null),Pt(`delivery`)),H.current=4,U.current=Date.now(),de(),_(!0),et.current=new AbortController;let o=await fe({rangeDays:1,pageSize:100});try{let l=await mn();Y(l);let u=await c();if(!u.enabled||!u.proxyUrl)throw Error(`AI 服务未启用，请在设置中开启 AI 代理`);let d=s(N),p=Ue(d?.provider,d?.model),h=e?.requestId||He(),g=Math.max(0,Number(e?.lastEventId||0));D(`resume_optimize`,{runState:`running`,progress:0,err:``,...t?{}:{items:null},resumeText:a(n),jd:a(f),matchCarryover:j||A,matchRid:a((j||A)?.sourceRid),resumeStyle:m,...t?{}:{streamText:``,streamThinking:``},streamStage:t?ot||`正在续传`:`准备开始`,streamActor:`agent`,streamRequestId:h,streamLastEventId:g,streamMode:`agent`,streamModelKey:p});let _=await C({op:`resume_optimize_agent`,proxyUrl:u.proxyUrl,gatewayApiKey:u.gatewayApiKey,clientId:i?.user?.id?`u:${i.user.id}`:void 0,thinking:!0,subProvider:d?.provider,subModel:d?.model,data:{resume:l,jd:a(f),jobTitle:Ve(a(f).slice(0,60))},signal:et.current.signal,requestId:h,resumeFromSeq:g,onToolStart:(e,t,n)=>{if(r!==z.current)return;U.current=Date.now(),H.current=Math.max(1,Number(n||0)||1),Ht(t=>Ce(t,e)),q(`步骤 ${t}/${n}`);let i=De(t,n,`start`);T(i),D(`resume_optimize`,{runState:`running`,progress:i,streamStage:`步骤 ${t}/${n}`,streamActor:e})},onToolDone:(e,t)=>{if(r!==z.current)return;U.current=Date.now(),Ht(t=>Te(t,e));let n=De(t,H.current,`done`);T(n),D(`resume_optimize`,{runState:`partial`,progress:n,streamStage:`已完成 ${t}/${H.current}`,streamActor:e})},onProcess:e=>{r===z.current&&(U.current=Date.now(),K(t=>{let n=we(t,String(e||``),12e3);return D(`resume_optimize`,{runState:`partial`,streamThinking:n}),n}))},onThinking:e=>{r===z.current&&(U.current=Date.now(),K(t=>{let n=we(t,String(e||``),12e3);return D(`resume_optimize`,{runState:`partial`,streamThinking:n}),n}))},onText:e=>{r===z.current&&(U.current=Date.now(),Wt(e),G(e),D(`resume_optimize`,{runState:`partial`,streamText:e}))},onMeta:e=>{e.type===`start`&&D(`resume_optimize`,{streamRequestId:String(e.requestId||h),streamMode:`agent`,streamModelKey:p})},onHeartbeat:()=>{U.current=Date.now()},onEventId:e=>{g=Math.max(g,Number(e||0)),D(`resume_optimize`,{streamRequestId:h,streamLastEventId:g,streamMode:`agent`,streamModelKey:p})}});if(r!==z.current)return;Wt(_),G(_);let ee=Pe(_),v=[];if(ee){It(ee);let e={jobId:``,jobTitle:Ve(a(f).slice(0,60)),company:``,fitSummary:`Agent 改写完成，完整简历已提取至编辑区，可直接生成 PDF 或查看改动对比。`,gaps:[],optimizedResume:ee,atsKeywords:Fe(_),highlights:[],changes:Ie(_),atsNotes:[],caveats:[]};v.push(e),k(v)}let b=j||A,ne=await pe({beforeIds:o,requestId:h,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}),re={id:`turn_a_${Date.now()}_${Math.random().toString(16).slice(2,8)}`,role:`assistant`,content:fn(v?.[0]),createdAt:Date.now(),billing:ne},x=[...y,re].slice(-80);te(x),D(`resume_optimize`,{runState:`done`,progress:100,streamText:_,streamStage:`分析完成`,streamActor:`agent`,sourceResumeForRun:l,resumeText:a(n)||l,jd:a(f),chatTurns:x,matchCarryover:b,matchRid:a(b?.sourceRid),resumeStyle:m,streamRequestId:h,streamLastEventId:g,streamMode:`agent`,streamModelKey:p,...v.length?{items:v}:{}}),ye(),U.current=0}catch(e){if(r!==z.current)return;let t=ie(e,`生成失败`);D(`resume_optimize`,{runState:`failed`,err:t,streamMode:`agent`}),be(t,v)}finally{U.current=0,_(!1)}};return(0,M.useEffect)(()=>{let e=B.current;if(!e)return;let t=`${e.requestId}:${e.lastEventId}:${a(e.modelKey)}`;V.current!==t&&(V.current=t,B.current=null,(async()=>{let t=!0;try{let n=s(N),r=Ue(n?.provider,n?.model),i=a(e.modelKey);i&&r&&i!==r&&(t=!1)}catch{}if(!t){Ne(`检测到模型已切换：当前进行中的简历优化流式结果已失效，请重新点击“Agent 深度改写”。`);return}await vn(e)})())},[n,f]),{isAuthed:Lt,resumeFile:e,setResumeFile:t,resumeText:n,setResumeText:u,jd:f,setJd:p,resumeStyle:m,setResumeStyle:h,busy:g,setBusy:_,runState:w,progress:ue,failByMessage:be,err:ee,setErr:v,chatTurns:y,setChatTurns:te,items:O,setItems:k,matchCarryover:A,setMatchCarryover:Oe,editableCarryover:j,setEditableCarryover:Ae,restoredHint:P,setRestoredHint:Ne,restoredFields:F,isRestored:Qe,hasRestored:$e,abortRef:et,parseAbortRef:tt,parsePromiseRef:nt,runSeqRef:z,lastStreamAtRef:U,resultCardRef:rt,draftTimerRef:it,streamText:W,setStreamText:G,streamThinking:at,setStreamThinking:K,streamStage:ot,setStreamStage:q,streamActor:st,setStreamActor:ct,fallbackInfo:lt,setFallbackInfo:J,sourceResumeForRun:ut,setSourceResumeForRun:Y,parseBusy:X,setParseBusy:dt,parseStage:ft,setParseStage:Z,parseErrText:pt,setParseErrText:mt,resumePreviewBusy:ht,setResumePreviewBusy:gt,resumePreviewErrText:_t,setResumePreviewErrText:Q,resumePreviewHtml:vt,setResumePreviewHtml:$,resumePreviewSourceHtml:yt,setResumePreviewSourceHtml:bt,resumePreviewModel:xt,setResumePreviewModel:St,resumePreviewBilling:Ct,setResumePreviewBilling:wt,resumePreviewStep:Tt,setResumePreviewStep:Et,resumePreviewNoticeText:Dt,setResumePreviewNoticeText:Ot,clearResumePreviewState:nn,lastResumePreviewText:kt,setLastResumePreviewText:At,detailExpanded:jt,setDetailExpanded:Mt,resultTab:Nt,setResultTab:Pt,chatScrollRef:Gt,canRun:Jt,streamedOptimizedResume:Yt,streamedAtsKeywords:Xt,streamedChanges:Zt,shownOptimizedResume:Qt,effectiveOptimizedResume:$t,editableOptimizedResume:Ft,setEditableOptimizedResume:It,shownAtsKeywords:en,shownChanges:tn,sideBySideRows:rn,latestAssistantTurnId:an,optimizePrimary:on,unifiedSummary:sn,optimizeMissingKeywords:cn,optimizeAtsNotes:ln,optimizeMatchMatrix:un,buildUserRunSummary:dn,buildAssistantSummary:fn,runParseResume:pn,parseResumeIfNeeded:mn,buildJob:hn,run:gn,runAgent:vn,agentMode:zt,setAgentMode:Bt,agentSteps:Vt,agentText:Ut,runResumePdfPreview:async e=>{if(ht)return;if(!await i()){Q(`请先登录后再生成网页简历`);return}let t=String(e||$t||``).trim();if(!t){Q(`请先完成简历优化，再生成网页简历`);return}At(t),Q(``),Ot(``),bt(``),wt(null),Et(`正在生成 HTML 简历…`),gt(!0);let n=await fe({rangeDays:1,pageSize:100}),r=``;try{$(``),St(``);let e=await c(),i=``,o=``,s=null;for(let n=0;n<2;n++){i=``;try{n>0?(bt(``),Et(`正在自动重试生成网页简历…`),Ot(`系统正在自动重试本次网页简历生成，请稍候。`)):Et(`正在生成 HTML 源码，请稍候…`);let c=!1,l=0,u=``,d=()=>{l=0,u&&bt(u)},f=await le({resumeText:t,styleVariant:m,timeoutMs:24e4,tier:e.tier,onMeta:e=>{e?.requestId&&(r=String(e.requestId)),e?.model&&(o=String(e.model))},onDelta:(e,t)=>{c||(c=!0,Et(`正在实时输出 HTML 源码…`)),u=t,l||=window.requestAnimationFrame(d)}});if(l&&=(window.cancelAnimationFrame(l),0),u&&bt(u),i=String(f?.html||``).trim(),o=a(f?.model)||o,!i)throw Error(`生成失败：未返回 HTML`);s=null,Ot(``);break}catch(e){s=e;let r=a(e?.message||`生成失败`),i=Le(r);if(console.warn(`[resume_html_pdf]`,{message:r,requestId:i||void 0,styleVariant:m,textLength:t.length,attempt:n+1}),n<1&&ze(r)){Q(``),Ot(I(`当前生成请求较多，正在自动重试一次。`,r)),await Be(Re(r)?1500:1e3);continue}throw e}}if(s)throw s;if(i=String(i||``).trim(),o&&St(`glm/${o}`),!i)throw Error(`生成失败：未返回 HTML`);bt(i),$(i),Ot(``),Et(`HTML 代码已生成，正在渲染网页简历预览`),wt(await pe({beforeIds:n,requestId:r||void 0,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}))}catch(e){wt(await pe({beforeIds:n,requestId:r||void 0,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}));let i=a(e?.message||`生成失败`),s=Le(i);console.warn(`[resume_html_pdf]`,{message:i,requestId:s||void 0,styleVariant:m,textLength:t.length,attempt:`final`}),Ot(``),Re(i)?Q(I(`当前生成请求较多，请稍后重试。`,i)):i.includes(`invalid_html_output`)?Q(I(`模型输出格式异常，请重试。`,i)):i.includes(`insufficient_points`)?Q(I(`${o}。`,i)):i.includes(`billing_failed`)?Q(I(`扣费失败，请稍后重试。`,i)):i.includes(`timeout`)?Q(I(`请求超时，请检查网络后重试。`,i)):Q(I(i,i)),Et(``)}finally{gt(!1)}},printHtmlResume:()=>{let e=vt;if(!e)return;let t=new Blob([e],{type:`text/html;charset=utf-8`}),n=URL.createObjectURL(t),r=window.open(n,`_blank`);if(!r){URL.revokeObjectURL(n);return}r.addEventListener(`load`,()=>{r.print(),URL.revokeObjectURL(n)},{once:!0})}}}var $e=e(g(),1),et={jd_analysis:`正在解析岗位要求与关键词…`,resume_match:`正在评估简历与岗位的匹配度…`,resume_optimize:`正在逐条改写并注入关键词…`,orchestrator:`正在规划下一步…`,interview_questions:`正在生成面试题库…`,salary_research:`正在调研薪酬数据…`,career_assessment:`正在评估职业路径…`};function tt({step:e,label:t,isLast:n,isActive:r}){let i=e.status===`done`;return(0,R.jsxs)(`div`,{className:`agent-progress-step`,"data-status":i?`done`:`active`,children:[(0,R.jsxs)(`div`,{className:`agent-progress-step-rail`,children:[(0,R.jsx)(`div`,{className:`agent-progress-step-dot ${i?`done`:`active`}`,children:i?(0,R.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3.5,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M5 13l4 4L19 7`})}):(0,R.jsx)(`span`,{className:`agent-progress-pulse`})}),!n&&(0,R.jsx)(`div`,{className:`agent-progress-step-line ${i?`done`:``}`})]}),(0,R.jsxs)(`div`,{className:`agent-progress-step-body`,children:[(0,R.jsxs)(`div`,{className:`agent-progress-step-header`,children:[(0,R.jsx)(`span`,{className:`agent-progress-step-label ${i?`done`:`active`}`,children:t}),i&&(0,R.jsx)(`span`,{className:`agent-progress-step-badge`,children:`完成`}),r&&!i&&(0,R.jsx)(`span`,{className:`agent-progress-step-badge active`,children:`进行中`})]}),r&&!i&&(0,R.jsx)(`div`,{className:`agent-progress-step-desc`,children:et[e.tool]||`处理中…`})]})]})}function nt({title:e,busy:t,progress:n=0,steps:r,labels:i,streamThinking:o,streamStage:s,streamActor:c,emptyText:l}){let[u,d]=(0,M.useState)(!0),f=Math.max(0,Math.min(100,Math.round(Number(n||0)))),p=r.filter(e=>e.status===`done`).length,m=r.length,h=!t&&m>0&&p===m,g=a(o),_=[a(s),a(c)].filter(Boolean).join(` · `),ee=(0,M.useMemo)(()=>r.map((e,t)=>({step:e,label:a(i[e.tool])||a(e.tool)||`步骤 ${t+1}`,isLast:t===r.length-1,isActive:e.status===`running`})),[r,i]);return r.length?(0,R.jsxs)(`div`,{className:`agent-progress-panel ${h?`completed`:``}`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`agent-progress-header`,onClick:()=>d(!u),"aria-expanded":u,children:[(0,R.jsxs)(`div`,{className:`agent-progress-header-left`,children:[h?(0,R.jsx)(`span`,{className:`agent-progress-done-icon`,children:(0,R.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M5 13l4 4L19 7`})})}):(0,R.jsx)(`span`,{className:`agent-progress-spinner`}),(0,R.jsx)(`span`,{className:`agent-progress-title`,children:h?`${e} · 已完成`:e})]}),(0,R.jsxs)(`div`,{className:`agent-progress-header-right`,children:[!h&&(0,R.jsxs)(`span`,{className:`agent-progress-pct`,children:[f,`%`]}),_&&!h&&(0,R.jsx)(`span`,{className:`agent-progress-meta`,children:_}),(0,R.jsx)(`span`,{className:`agent-progress-chevron ${u?`open`:``}`,children:(0,R.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M6 9l6 6 6-6`})})})]})]}),!h&&(0,R.jsx)(`div`,{className:`agent-progress-bar-track`,children:(0,R.jsx)(`div`,{className:`agent-progress-bar-fill`,style:{width:`${Math.max(4,f)}%`}})}),u&&(0,R.jsxs)(`div`,{className:`agent-progress-body`,children:[(0,R.jsx)(`div`,{className:`agent-progress-steps`,children:ee.map((e,t)=>(0,R.jsx)(tt,{step:e.step,label:e.label,isLast:e.isLast,isActive:e.isActive},`${e.step.tool}_${t}`))}),g&&(0,R.jsx)(`div`,{className:`agent-progress-thinking`,children:(0,R.jsx)(T,{thinking:g,title:`思考过程`,stageText:_,defaultCollapsed:!1,maxHeight:160,fontSize:11,lineHeight:1.45,embedded:!0,collapsedPreview:g.split(`
`)[0]?.slice(0,60)||``})}),t&&l&&!g&&(0,R.jsx)(`div`,{className:`agent-progress-empty`,children:l})]})]}):null}var z=e=>e===`academic`?`强化结构、项目/研究经历与成果表达。`:e===`graduate`?`更轻量，适合应届与校招投递。`:`通用职场版，强调清晰度、业绩证据与 ATS 友好。`;function B({label:e,value:t,helper:n,tone:r=`neutral`}){return(0,R.jsxs)(`div`,{className:`he-opt-metric he-opt-metric-${r}`,children:[(0,R.jsx)(`div`,{className:`he-opt-metric-label`,children:e}),(0,R.jsx)(`div`,{className:`he-opt-metric-value`,children:t}),(0,R.jsx)(`div`,{className:`he-opt-metric-helper`,children:n})]})}function V({items:e,limit:t=6}){let n=e.map(e=>a(e)).filter(Boolean).slice(0,t);return n.length?(0,R.jsx)(`div`,{className:`he-opt-bullet-list`,children:n.map((e,t)=>(0,R.jsxs)(`div`,{className:`he-opt-bullet-item`,children:[(0,R.jsx)(`span`,{className:`he-opt-bullet-index`,children:t+1}),(0,R.jsx)(`div`,{children:(0,R.jsx)(E,{text:e})})]},`${e}_${t}`))}):null}function H({items:e,tone:t=`success`}){let n=e.map(e=>a(e)).filter(Boolean);return n.length?(0,R.jsx)(`div`,{className:`he-opt-keyword-cloud`,children:n.map((e,n)=>(0,R.jsx)(`span`,{className:`he-opt-keyword he-opt-keyword-${t}`,children:e},`${e}_${n}`))}):null}function U({text:e}){return(0,R.jsx)(`div`,{className:`he-opt-empty`,children:e})}var rt={height:30,minHeight:30,padding:`0 10px`,gap:6,fontSize:12,fontWeight:600};function it({busy:e,resultHeading:t,optimizePrimary:n,items:r,resultTab:i,setResultTab:o,effectiveOptimizedResume:s,editableOptimizedResume:c,setEditableOptimizedResume:l,shownOptimizedResume:u,shownChanges:f,shownAtsKeywords:m,optimizeMissingKeywords:h,optimizeAtsNotes:g,optimizeMatchMatrix:_,sideBySideRows:ee,resumeStyle:v,setResumeStyle:y,resumeStyleOptions:te,resumePreviewBusy:b,onGenerateWebResume:ne}){let re=String(s||``).trim(),x=!!re,ie=r?.[0],ae=Array.isArray(ie?.caveats)?ie.caveats.map(e=>a(e)).filter(Boolean):[],oe=Array.isArray(ie?.highlights)?ie.highlights.map(e=>a(e)).filter(Boolean).slice(0,5):[],se=[{key:`delivery`,label:`最终简历`,meta:x?`${re.length} 字`:``},{key:`diff`,label:`改动对比`,meta:f.length?`${f.length} 项`:``},{key:`insight`,label:`ATS 分析`,meta:m.length?`${m.length} 词`:``}];return(0,R.jsxs)(`div`,{className:`he-opt-result he-opt-editorial`,children:[(0,R.jsxs)(`div`,{className:`he-opt-hero`,children:[(0,R.jsxs)(`div`,{className:`he-opt-hero-main`,children:[(0,R.jsx)(`div`,{className:`he-opt-eyebrow`,children:`AI 简历优化报告`}),(0,R.jsx)(`div`,{className:`he-opt-title-row`,children:(0,R.jsx)(`h2`,{className:`he-opt-title`,children:t||`简历优化结果`})}),n.company?(0,R.jsxs)(`div`,{className:`he-opt-subtitle`,children:[`目标企业：`,n.company]}):null,(0,R.jsx)(`div`,{className:`he-opt-summary`,children:(0,R.jsx)(E,{text:n.fitSummary||`已完成针对目标岗位的专业化改写，你可以继续编辑正文、查看差异或生成网页简历。`})}),(0,R.jsxs)(`div`,{className:`he-opt-hero-actions`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:rt,onClick:async()=>{try{await navigator.clipboard.writeText(re)}catch{}},disabled:!x,children:[(0,R.jsx)(d,{size:13,"aria-hidden":`true`}),(0,R.jsx)(`span`,{children:`复制正文`})]}),(0,R.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-primary ds-btn-sm`,style:rt,onClick:ne,disabled:!x||b,children:[(0,R.jsx)(p,{size:13,"aria-hidden":`true`}),(0,R.jsx)(`span`,{children:b?`排版生成中…`:`生成网页简历`})]})]})]}),(0,R.jsxs)(`div`,{className:`he-opt-metric-grid`,children:[(0,R.jsx)(B,{label:`改写长度`,value:x?`${re.length}`:`-`,helper:`可直接编辑并同步到排版`}),(0,R.jsx)(B,{label:`关键改动`,value:`${f.length||n.changeCount||0}`,helper:`结构、量化与表达优化`,tone:`success`}),(0,R.jsx)(B,{label:`ATS 关键词`,value:`${m.length}`,helper:`已注入岗位相关关键词`,tone:`success`}),(0,R.jsx)(B,{label:`待补充提醒`,value:`${ae.length||n.caveatCount||0}`,helper:`避免把占位内容当作事实`,tone:ae.length?`warning`:`neutral`})]})]}),oe.length?(0,R.jsxs)(`div`,{className:`he-opt-highlight-strip`,children:[(0,R.jsx)(`div`,{className:`he-opt-strip-title`,children:`本轮强化亮点`}),(0,R.jsx)(H,{items:oe,tone:`success`})]}):null,(0,R.jsx)(`div`,{className:`he-opt-tabs`,role:`tablist`,"aria-label":`简历优化结果视图`,children:se.map(e=>(0,R.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i===e.key,className:`he-opt-tab ${i===e.key?`he-opt-tab-active`:``}`,onClick:()=>o(e.key),children:[(0,R.jsx)(`span`,{children:e.label}),e.meta?(0,R.jsx)(`small`,{children:e.meta}):null]},e.key))}),i===`delivery`?(0,R.jsxs)(`div`,{className:`he-opt-delivery-stack`,children:[(0,R.jsxs)(`div`,{className:`he-opt-resume-stage`,children:[(0,R.jsxs)(`div`,{className:`he-opt-paper-toolbar`,children:[(0,R.jsx)(`span`,{children:`最终可投递版本`}),(0,R.jsx)(`span`,{children:e?`生成中…`:x?`可编辑`:`等待生成`})]}),(0,R.jsx)(`textarea`,{className:`he-opt-resume-textarea`,"aria-label":`最终可投递简历正文`,value:c,onChange:e=>l(e.target.value),placeholder:e?`生成中…`:`改写后的简历内容将显示在这里`})]}),(0,R.jsxs)(`div`,{className:`he-opt-style-row`,children:[te.map(e=>(0,R.jsxs)(`button`,{type:`button`,className:`he-opt-style-chip ${v===e.value?`he-opt-style-chip-active`:``}`,"aria-pressed":v===e.value,onClick:()=>y(e.value),children:[(0,R.jsx)(`strong`,{children:e.label}),(0,R.jsx)(`span`,{children:z(String(e.value))})]},e.value)),(0,R.jsx)(`button`,{type:`button`,className:`he-opt-style-chip he-opt-style-chip-muted`,onClick:()=>{let e=String(u||``).trim();e&&window.confirm(`将回退到本次 AI 生成的未修改版本，你当前手动编辑的内容会被覆盖。回退不会退回本次已消耗的积分，是否继续？`)&&l(e)},disabled:!String(u||``).trim(),children:`回退到未修改版本`})]})]}):null,i===`diff`?(0,R.jsxs)(`div`,{className:`he-opt-stack`,children:[f.length?(0,R.jsxs)(`div`,{className:`he-opt-card`,children:[(0,R.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,R.jsx)(`span`,{children:`关键改动`}),(0,R.jsxs)(`small`,{children:[f.length,` 项`]})]}),(0,R.jsx)(V,{items:f,limit:20})]}):null,(0,R.jsx)(`div`,{className:`he-opt-diff-legend`,children:`左侧为原始简历，右侧为改写结果；红色代表删除，绿色代表新增或强化。`}),(0,R.jsxs)(`div`,{className:`he-diff-shell he-opt-diff-shell`,children:[(0,R.jsxs)(`div`,{className:`he-diff-header`,children:[(0,R.jsx)(`div`,{className:`he-diff-title`,children:`原始简历`}),(0,R.jsx)(`div`,{className:`he-diff-title`,children:`改写结果`})]}),(0,R.jsx)(`div`,{className:`he-diff-scroll`,children:ee.length?ee.map((e,t)=>{let n=e.leftKind===`del`?{background:`rgba(239,68,68,0.07)`,color:`var(--danger)`,textDecoration:`line-through`,textDecorationThickness:`1.5px`}:e.leftKind===`empty`?{background:`transparent`,color:`transparent`}:{background:`transparent`,color:`var(--text-2)`},r=e.rightKind===`add`?{background:`rgba(34,197,94,0.07)`,color:`var(--success)`,boxShadow:`inset 3px 0 0 rgba(34,197,94,0.45)`}:e.rightKind===`empty`?{background:`transparent`,color:`transparent`}:{background:`transparent`,color:`var(--text-2)`};return(0,R.jsxs)(`div`,{className:`he-diff-row`,children:[(0,R.jsxs)(`div`,{className:`he-diff-cell`,style:{display:`grid`,gridTemplateColumns:`32px minmax(0,1fr)`,gap:8,alignItems:`start`,...n},children:[(0,R.jsx)(`span`,{className:`he-opt-line-no`,children:t+1}),(0,R.jsx)(`div`,{children:(0,R.jsx)(E,{text:e.left||` `})})]}),(0,R.jsxs)(`div`,{className:`he-diff-cell`,style:{display:`grid`,gridTemplateColumns:`32px minmax(0,1fr)`,gap:8,alignItems:`start`,...r},children:[(0,R.jsx)(`span`,{className:`he-opt-line-no`,children:t+1}),(0,R.jsx)(`div`,{children:(0,R.jsx)(E,{text:e.right||` `})})]})]},`resume_diff_${t}`)}):(0,R.jsx)(U,{text:e?`生成中…`:`暂无对比内容，请先完成改写。`})})]})]}):null,i===`insight`?(0,R.jsxs)(`div`,{className:`he-opt-insight-grid`,children:[(0,R.jsxs)(`div`,{className:`he-opt-card`,children:[(0,R.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,R.jsx)(`span`,{children:`已注入 ATS 关键词`}),(0,R.jsxs)(`small`,{children:[m.length,` 个`]})]}),m.length?(0,R.jsx)(H,{items:m.slice(0,30),tone:`success`}):(0,R.jsx)(U,{text:`关键词会在改写完成后显示。`})]}),(0,R.jsxs)(`div`,{className:`he-opt-card he-opt-card-warning`,children:[(0,R.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,R.jsx)(`span`,{children:`建议补充关键词`}),(0,R.jsxs)(`small`,{children:[h.length,` 个`]})]}),h.length?(0,R.jsx)(H,{items:h,tone:`warning`}):(0,R.jsx)(U,{text:`暂无明显缺失关键词。`})]}),g.length?(0,R.jsxs)(`div`,{className:`he-opt-card`,children:[(0,R.jsx)(`div`,{className:`he-opt-card-head`,children:(0,R.jsx)(`span`,{children:`ATS 建议`})}),(0,R.jsx)(V,{items:g})]}):null,_.length?(0,R.jsxs)(`div`,{className:`he-opt-card`,children:[(0,R.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,R.jsx)(`span`,{children:`岗位要求覆盖`}),(0,R.jsxs)(`small`,{children:[_.length,` 项`]})]}),(0,R.jsx)(V,{items:_.map(e=>`${a(e.requirement)}：${a(e.resumeStatus)}${a(e.gapType)?`（${a(e.gapType)}）`:``}`)})]}):null,ae.length?(0,R.jsxs)(`div`,{className:`he-opt-card he-opt-card-danger`,children:[(0,R.jsx)(`div`,{className:`he-opt-card-head`,children:(0,R.jsx)(`span`,{children:`注意事项`})}),(0,R.jsx)(V,{items:ae})]}):null,!m.length&&!h.length&&!g.length?(0,R.jsx)(U,{text:`ATS 分析数据将在改写完成后显示。`}):null]}):null]})}var W=e=>{let t=String(e||``).replace(/\r/g,``).replace(/```[\s\S]*?```/g,``).split(`
`).map(e=>e.trimEnd()),n=[],r=``;for(let e of t){let t=String(e||``).trim();t&&(/output_schema|schema|compact_json|max_tokens|response_format|max_chars|字符|5200/i.test(t)||/^[\{\}\[\],]+$/.test(t)||t!==r&&(r=t,n.push(t)))}let i=n.join(`
`);return i.length<=12e3?i:`…\n${i.slice(-12e3)}`},G=(e,t)=>{let n=new Blob([String(t||``)],{type:`text/plain;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)},at=[{value:`professional`,label:`专业样式`},{value:`academic`,label:`学术样式`},{value:`graduate`,label:`应届生样式`}],K=e=>{let t=a(e);return t===`7d`?new Date(Date.now()+10080*60*1e3).toISOString():t===`30d`?new Date(Date.now()+720*60*60*1e3).toISOString():``},ot=e=>{let t=a(e?.message||e),n=t.toLowerCase();return t===`Requested function was not found`||t===`NOT_FOUND`||n.includes(`requested function was not found`)?`分享服务未部署成功，请先部署 国内后端 workspace API 后再重试`:t||`请重试`},q={height:30,minHeight:30,padding:`0 10px`,gap:6,fontSize:12,fontWeight:600};function st(){let[e]=r(),t=(0,M.useRef)(null),{isAuthed:n,resumeFile:i,setResumeFile:o,resumeText:s,setResumeText:c,jd:u,setJd:d,resumeStyle:p,setResumeStyle:g,busy:b,setBusy:ne,runState:re,progress:x,failByMessage:ie,err:ae,setErr:oe,chatTurns:se,items:ce,matchCarryover:S,setMatchCarryover:le,editableCarryover:C,setEditableCarryover:T,restoredHint:E,restoredFields:fe,isRestored:pe,abortRef:me,parseAbortRef:he,runSeqRef:ge,resultCardRef:_e,streamText:xe,streamThinking:D,streamStage:Se,streamActor:Ce,fallbackInfo:we,parseBusy:Te,parseStage:Ee,parseErrText:De,setParseErrText:ke,resumePreviewBusy:N,resumePreviewErrText:je,setResumePreviewErrText:Me,resumePreviewHtml:P,setResumePreviewHtml:Ne,resumePreviewSourceHtml:F,setResumePreviewSourceHtml:Pe,resumePreviewBilling:Fe,resumePreviewStep:Ie,setResumePreviewStep:Le,resumePreviewNoticeText:I,setResumePreviewNoticeText:Re,clearResumePreviewState:ze,lastResumePreviewText:Be,canRun:Ve,shownOptimizedResume:He,effectiveOptimizedResume:Ue,editableOptimizedResume:We,setEditableOptimizedResume:Ge,shownAtsKeywords:Ke,shownChanges:qe,sideBySideRows:Je,optimizePrimary:Ye,optimizeMissingKeywords:L,optimizeAtsNotes:Xe,optimizeMatchMatrix:Ze,runParseResume:et,run:tt,runAgent:z,agentMode:B,agentSteps:V,agentText:H,resultTab:U,setResultTab:rt,runResumePdfPreview:st,printHtmlResume:ct}=Qe(),[lt,J]=(0,M.useState)(!1),[ut,Y]=(0,M.useState)(``),[X,dt]=(0,M.useState)(``),[ft,Z]=(0,M.useState)(``),[pt,mt]=(0,M.useState)(`30d`);(0,M.useEffect)(()=>{if(!X){Z(``);return}let e=!0;return $e.toDataURL(X,{errorCorrectionLevel:`M`,margin:1,width:168,color:{dark:`#111827`,light:`#ffffff`}}).then(t=>{e&&Z(t)}).catch(()=>{e&&Z(``)}),()=>{e=!1}},[X]),(0,M.useEffect)(()=>{if(!N||!F)return;let e=t.current;if(!e)return;let n=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight});return()=>window.cancelAnimationFrame(n)},[N,F]);let ht=(0,M.useMemo)(()=>ee(we),[we]),gt=(0,M.useMemo)(()=>v(we),[we]),_t=(0,M.useMemo)(()=>[...Array.isArray(se)?se:[]].reverse().find(e=>e?.role===`assistant`&&e?.billing)?.billing||null,[se]),Q=B?`本次 Agent 深度改写`:`本次简历优化`,vt=(0,M.useMemo)(()=>a(Ye.jobTitle)||`简历优化结果`,[Ye.jobTitle]),$=C||S,yt=(0,M.useMemo)(()=>{let e=[...Array.isArray($?.gaps)?$.gaps:[],...Array.isArray($?.actions)?$.actions:[],...Array.isArray($?.keywords)?$.keywords:[]].map(e=>a(e)).filter(Boolean);return Array.from(new Set(e)).length},[$]),bt=(0,M.useMemo)(()=>a(e.get(`source`))===`resume_match`||a(e.get(`matchRid`))||a(E).includes(`承接简历匹配`)?!0:!!$?.sourceRid,[$?.sourceRid,E,e]),xt=(0,M.useMemo)(()=>{if(!bt)return[];let e=new Set((Array.isArray(fe)?fe:[]).map(e=>a(e))),t=e.has(`简历文本`)||!!a(s),n=e.has(`JD`)||!!a(u),r=yt>0;return[{key:`resume`,active:t,text:t?`已自动带入简历`:`当前未自动带入简历`},{key:`jd`,active:n,text:n?`已自动带入 JD`:`当前未自动带入 JD`},{key:`carryover`,active:r,text:r?`已带入 ${yt} 条匹配建议`:`当前未带入匹配建议`}]},[yt,u,fe,s,bt]),St=(e,t)=>{T(n=>n&&{...n,[e]:t.split(`
`).map(e=>a(e)).filter(Boolean)})},Ct=(0,M.useMemo)(()=>N?Ie||`正在排版…`:``,[N,Ie]),wt=(0,M.useMemo)(()=>n?``:`请先登录后使用简历优化功能`,[n]);return(0,R.jsx)(w,{title:`简历优化`,subTitle:`上传 PDF 简历（或粘贴文本）+ 粘贴 JD，生成针对该岗位的优化简历文本。`,forceThinkingEnabled:!0,hideThinkingToggle:!0,hideModelSelector:!0,defaultModelChoice:`deepseek_pro`,sidebar:(0,R.jsx)(ue,{current:`/tools/resume-optimize`}),children:(0,R.jsxs)(`div`,{className:`he-tools-main`,children:[xt.length?(0,R.jsxs)(`div`,{className:`he-card`,style:{marginBottom:14,background:`color-mix(in srgb, var(--surface) 97%, rgba(59,130,246,0.04))`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`he-label`,children:`已自动承接上一轮简历匹配`}),(0,R.jsx)(`div`,{className:`he-muted`,style:{marginTop:6,fontSize:13,lineHeight:1.7},children:`当前会直接沿用匹配页带过来的简历、JD 和匹配建议，你可以在下方继续补充或修改。`})]}),(0,R.jsx)(`span`,{className:`he-chip`,children:$?.scoreText||`已承接匹配上下文`})]}),(0,R.jsx)(`div`,{style:{marginTop:12,display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(180px, 1fr))`,gap:10},children:xt.map(e=>(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 12px`,borderRadius:14,border:`1px solid ${e.active?`rgba(34,197,94,0.18)`:`var(--border-soft)`}`,background:e.active?`rgba(34,197,94,0.05)`:`var(--surface)`},children:[(0,R.jsx)(`span`,{style:{fontSize:11,lineHeight:1,padding:`3px 8px`,borderRadius:999,background:e.active?`rgba(34,197,94,0.10)`:`var(--surface2)`,color:e.active?`var(--success)`:`var(--text-3)`,fontWeight:700},children:e.active?`已带入`:`未带入`}),(0,R.jsx)(`span`,{style:{fontSize:13,color:e.active?`var(--text-1)`:`var(--text-3)`,fontWeight:e.active?600:500},children:e.text})]},e.key))})]}):null,(0,R.jsxs)(`div`,{className:`he-form-grid`,children:[(0,R.jsxs)(`div`,{className:`he-form-block he-accent-blue`,children:[n?null:(0,R.jsx)(`div`,{className:`ui-alert ui-alert-info text-[12px] leading-relaxed`,style:{marginBottom:12},children:`请先登录后使用简历优化功能。未登录状态下暂不支持上传、粘贴和生成。`}),(0,R.jsxs)(`div`,{className:`he-pill`,children:[(0,R.jsx)(`span`,{className:`he-pill-dot`}),`简历`]}),(0,R.jsxs)(`div`,{style:{marginTop:12},children:[(0,R.jsx)(j,{label:`PDF 简历（可选）`,accept:`application/pdf,.pdf`,file:i,onPick:o,disabled:!n,hint:`上传后会自动解析；也可直接粘贴简历文本。解析按页计费（会消耗积分），生成结果另按 token 计费。`}),i&&!a(s)?(0,R.jsxs)(`div`,{className:`he-muted he-parse-status`,children:[(0,R.jsx)(`div`,{className:`he-parse-status-text`,children:Te?`解析中… ${Ee||``}`:De?`解析失败：${De}`:`等待解析…`}),(0,R.jsx)(`div`,{className:`he-inline-actions`,children:Te?(0,R.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,onClick:()=>{try{he.current?.abort()}catch{}},children:`取消解析`}):(0,R.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,disabled:!n,onClick:async()=>{if(await l())try{await et(`run`)}catch(e){ke(a(e?.message||`解析失败`))}},children:`重新解析`})})]}):null]}),(0,R.jsx)(`div`,{className:`he-sep`}),(0,R.jsx)(`div`,{className:`he-label`,children:`简历文本（可直接粘贴，优先使用）`}),(0,R.jsx)(`textarea`,{className:[`he-textarea`,pe(`简历文本`)?`he-restored-field`:``].join(` `),value:s,onChange:e=>c(e.target.value),placeholder:wt||`粘贴简历文本…`,disabled:!n})]}),(0,R.jsxs)(`div`,{className:`he-form-block he-accent-orange`,children:[(0,R.jsxs)(`div`,{className:`he-pill`,children:[(0,R.jsx)(`span`,{className:`he-pill-dot`}),`职位`]}),(0,R.jsx)(`div`,{style:{marginTop:10},className:`he-label`,children:`职位描述 JD（必填）`}),(0,R.jsx)(`textarea`,{className:[`he-textarea`,pe(`JD`)?`he-restored-field`:``].join(` `),value:u,onChange:e=>d(e.target.value),placeholder:wt||`粘贴职位描述 / 任职要求…`,disabled:!n}),(0,R.jsx)(k,{jd:u,sourceTool:`resume_optimize`,disabled:!n}),(0,R.jsx)(`div`,{style:{marginTop:14,display:`flex`,justifyContent:`flex-end`},children:(0,R.jsxs)(`div`,{className:`he-action-pill-group`,children:[(0,R.jsx)(`button`,{type:`button`,className:`he-action-pill`,onClick:()=>{B?z():tt()},disabled:!n||!Ve||b,children:b?B?`Agent 分析中…`:`生成中… ${Math.max(1,Math.min(100,Math.round(x||0)))}%`:n?B?`深度优化`:`开始生成`:`登录后使用`}),(0,R.jsx)(`button`,{type:`button`,className:`he-action-pill he-action-pill--ghost`,onClick:()=>O({tool:`resume_optimize`,runSeqRef:ge,abortRef:me,setBusy:ne,onCancelled:()=>ie(`已取消`,oe)}),disabled:!b,children:`取消`})]})})]})]}),C||S?(0,R.jsxs)(`div`,{className:`he-card`,style:{marginTop:14,background:`color-mix(in srgb, var(--surface) 98%, rgba(244,136,53,0.03))`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`he-label`,children:`已承接上一轮匹配结论`}),(0,R.jsxs)(`div`,{className:`he-muted`,style:{marginTop:6,fontSize:13,lineHeight:1.75},children:[`已从上次匹配结果带入 `,yt||0,` 个改进点。现在可以直接编辑这些带入信息，确认哪些要保留、删减或重写。`]})]}),(0,R.jsx)(`span`,{className:`he-chip`,children:$?.scoreText||`已带入改进点`})]}),(0,R.jsxs)(`div`,{style:{marginTop:12,display:`grid`,gap:10},children:[(0,R.jsx)(`textarea`,{className:`he-textarea`,value:a((C||S)?.summary),onChange:e=>T(t=>t&&{...t,summary:e.target.value}),placeholder:`匹配结论摘要`,disabled:!n}),(0,R.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, minmax(0, 1fr))`,gap:10},children:[(0,R.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((C||S)?.strengths)?(C||S).strengths.join(`
`):``,onChange:e=>St(`strengths`,e.target.value),placeholder:`最强优势，每行一条`,disabled:!n}),(0,R.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((C||S)?.gaps)?(C||S).gaps.join(`
`):``,onChange:e=>St(`gaps`,e.target.value),placeholder:`关键缺口，每行一条`,disabled:!n}),(0,R.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((C||S)?.actions)?(C||S).actions.join(`
`):``,onChange:e=>St(`actions`,e.target.value),placeholder:`优先动作，每行一条`,disabled:!n}),(0,R.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((C||S)?.keywords)?(C||S).keywords.join(`
`):``,onChange:e=>St(`keywords`,e.target.value),placeholder:`重点关键词，每行一条`,disabled:!n})]}),(0,R.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:Array.isArray((C||S)?.keywords)?(C||S).keywords.slice(0,6).map(e=>(0,R.jsx)(`span`,{className:`he-chip`,children:e},e)):null}),(0,R.jsxs)(`div`,{className:`he-inline-actions`,children:[(0,R.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,onClick:()=>T(S),disabled:!n,children:`恢复匹配原结论`}),(0,R.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,onClick:()=>{T(null),le(null)},disabled:!n,children:`移除 carryover`})]})]})]}):null,(0,R.jsx)(A,{state:re,progress:x}),ae?(0,R.jsx)(`div`,{className:`he-err`,children:ae}):null,B&&(V.length>0||a(D))?(0,R.jsx)(nt,{title:`简历优化 Agent`,busy:b,progress:x,steps:V,labels:{orchestrator:`编排调度`,jd_analysis:`岗位解析`,resume_match:`匹配评估`,resume_optimize:`逐条优化`,resume_translate:`简历翻译`,resume_html:`HTML 排版`,resume_pdf_extract:`PDF 解析`,interview_questions:`面试题库`,salary_research:`薪酬调研`,career_assessment:`职业评估`,cover_letter:`求职信`,jd_optimize:`JD 优化`,session_note:`会话记录`,finalize:`结果整合`},streamThinking:W(D),streamStage:Se,streamActor:Ce,emptyText:`正在按岗位要求优化简历并整理改动原因…`}):null,B&&a(xe)?(0,R.jsxs)(`div`,{className:`he-opt-report-card`,children:[(0,R.jsx)(`div`,{className:`he-opt-report-card-head`,children:`Agent 分析报告`}),(0,R.jsx)(_,{billing:_t,label:Q,style:{marginTop:6,marginBottom:12}}),(0,R.jsx)(te,{text:xe||``})]}):null,!B&&(b||xe||D)?(0,R.jsx)(de,{assistantLabel:`简历优化助手`,busy:b,streamText:xe,streamThinking:W(D),streamStage:Se,streamActor:Ce,agentMode:!1,agentText:H,agentSteps:V,stepLabels:{jd_analysis:`岗位解析`,resume_match:`匹配评估`,resume_optimize:`逐条优化`},emptyText:`正在流式生成优化结果…`,fullWidth:!0}):null,B&&H&&ce&&ce.length?(0,R.jsxs)(`div`,{style:{marginTop:24,padding:`16px 20px`,borderRadius:16,background:`var(--surface)`,border:`1px solid rgba(34,197,94,0.3)`,boxShadow:`0 4px 20px rgba(34,197,94,0.06)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,R.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:24,height:24,borderRadius:`50%`,background:`rgba(34,197,94,0.15)`,color:`var(--success)`},children:(0,R.jsx)(`svg`,{width:`14`,height:`14`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:3,children:(0,R.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,R.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:`var(--text-1)`},children:`Agent 优化完成 · 已解析结构化结果`})]}),(0,R.jsx)(`div`,{className:`he-muted`,style:{fontSize:13,marginTop:6,paddingLeft:34},children:`简历正文已提取到编辑区，原文对比与 ATS 分析也已就绪，请在下方查看。`})]}):null,(0,R.jsx)(`div`,{style:{marginTop:24,width:`100%`},children:ce&&ce.length||E||ht?(0,R.jsxs)(`div`,{className:[`he-split-card`,E?`he-restored-focus`:``].join(` `),ref:_e,style:{width:`100%`},children:[(0,R.jsx)(`div`,{className:`he-split-head`,children:(0,R.jsx)(`div`,{children:(0,R.jsx)(Oe,{restoredHint:E,restoredFields:fe,runState:re})})}),(0,R.jsxs)(`div`,{className:`he-split-body report-light-surface report-light-scrollbar`,children:[ht?(0,R.jsx)(y,{raw:we,variant:`notice`,style:{marginBottom:12,padding:`10px 14px`,borderRadius:14,background:`rgba(244, 136, 53, 0.08)`,border:`1px solid rgba(244, 136, 53, 0.18)`},textStyle:{color:`var(--text-1)`,fontSize:13,fontWeight:600}}):null,B?null:(0,R.jsx)(_,{billing:_t,label:Q,style:{marginBottom:12}}),ce&&ce.length?(0,R.jsxs)(`div`,{children:[gt?(0,R.jsx)(y,{raw:we,variant:`hint`,style:{marginBottom:12,padding:`10px 14px`,borderRadius:14,background:`rgba(244,136,53,0.07)`,border:`1px solid rgba(244,136,53,0.16)`},textStyle:{color:`var(--text-2)`,fontSize:13,lineHeight:1.65}}):null,(0,R.jsx)(it,{busy:b,resultHeading:vt,optimizePrimary:Ye,items:ce,resultTab:U,setResultTab:rt,effectiveOptimizedResume:String(Ue||``).trim(),editableOptimizedResume:We,setEditableOptimizedResume:Ge,shownOptimizedResume:He,shownChanges:qe,shownAtsKeywords:Ke,optimizeMissingKeywords:L,optimizeAtsNotes:Xe,optimizeMatchMatrix:Ze,sideBySideRows:Je,resumeStyle:p,setResumeStyle:e=>g(e),resumeStyleOptions:at,resumePreviewBusy:N,onGenerateWebResume:()=>{Y(``),dt(``),ze(),Me(``),st(String(Ue||``).trim())}})]}):null]})]}):null}),N||P||F||je?(0,R.jsxs)(`div`,{style:{margin:`16px 0`,border:`1px solid var(--border)`,borderRadius:12,background:`var(--surface)`,overflow:`hidden`},children:[(0,R.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10},children:[(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:`var(--text-1)`},children:N?Ie||`生成中…`:P?`网页简历已生成`:`生成失败`}),N?null:(0,R.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{padding:`2px 10px`,fontSize:12},onClick:()=>{Y(``),dt(``),Ne(``),Pe(``),Me(``),Le(``),Re(``)},children:`关闭`})]}),(0,R.jsxs)(`div`,{style:{padding:`12px 16px`},children:[I?(0,R.jsx)(`div`,{style:{marginBottom:12,padding:`10px 12px`,borderRadius:12,border:`1px solid rgba(59,130,246,0.22)`,background:`rgba(239,246,255,0.85)`,color:`var(--text-1)`,fontSize:13,lineHeight:1.65},children:I}):null,je?(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,R.jsx)(`div`,{className:`he-err`,style:{flex:`1 1 auto`},children:je}),Be?(0,R.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{fontSize:12},onClick:()=>st(Be),disabled:N,children:`重试`}):null]}):null,ut?(0,R.jsx)(`div`,{style:{marginBottom:12},className:ut.startsWith(`分享失败`)?`he-err`:`he-muted`,children:ut}):null,N?(0,R.jsx)(`div`,{className:`he-muted`,style:{marginBottom:12},children:Ie||`正在生成简历页面…`}):null,(0,R.jsx)(_,{billing:Fe,label:`本次 HTML 简历生成`,style:{marginBottom:12}}),N?(0,R.jsxs)(`div`,{style:{marginBottom:16},children:[(0,R.jsx)(`div`,{className:`he-label`,style:{marginBottom:8},children:`排版进度`}),(0,R.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:12,background:`var(--surface2)`,padding:12},children:[(0,R.jsx)(`div`,{style:{fontSize:14,color:`var(--text-1)`,lineHeight:1.7},children:Ct}),(0,R.jsx)(`div`,{className:`he-muted`,style:{marginTop:6,fontSize:12,lineHeight:1.65},children:`系统正在把确认后的内容排成可打印简历，可在下方查看实时生成的 HTML 代码。`})]})]}):null,F?(0,R.jsxs)(`div`,{style:{marginBottom:16,border:`1px solid var(--border)`,borderRadius:10,overflow:`hidden`,background:`#0f172a`},children:[(0,R.jsxs)(`div`,{style:{padding:`10px 12px`,borderBottom:`1px solid rgba(148,163,184,0.25)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,R.jsx)(`div`,{style:{fontSize:12,fontWeight:800,color:`#e5e7eb`},children:N?F.length<80?`正在等待模型输出 HTML 代码`:`HTML 代码实时生成中`:`HTML 代码`}),(0,R.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`},children:[F.length.toLocaleString(),` 字符`]})]}),(0,R.jsx)(`pre`,{ref:t,style:{margin:0,maxHeight:N?260:180,overflow:`auto`,padding:12,color:`#dbeafe`,fontSize:12,lineHeight:1.65,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`var(--ds-font-mono)`},children:F})]}):null,P?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`iframe`,{title:`resume_html_preview`,srcDoc:P,style:{width:`100%`,height:480,border:`1px solid var(--border)`,borderRadius:8,background:`#fff`,display:`block`}}),(0,R.jsxs)(`div`,{style:{marginTop:10,display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,R.jsx)(`div`,{className:`he-muted`,style:{fontSize:12},children:`分享有效期`}),(0,R.jsxs)(`select`,{value:pt,onChange:e=>mt(e.target.value),style:{minHeight:32,borderRadius:10,border:`1px solid var(--border)`,background:`var(--surface)`,color:`var(--text-1)`,padding:`0 10px`,fontSize:12},children:[(0,R.jsx)(`option`,{value:`7d`,children:`7 天`}),(0,R.jsx)(`option`,{value:`30d`,children:`30 天`}),(0,R.jsx)(`option`,{value:`never`,children:`长期有效`})]})]}),(0,R.jsxs)(`div`,{style:{marginTop:10,display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,R.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-primary ds-btn-sm`,style:q,onClick:async()=>{if(!(!P||lt)){J(!0),Y(``),Z(``);try{let e=await ve({kind:`resume_web_page`,payload:await be({html:P,styleVariant:p}),expiresAt:K(pt)||void 0});if(!e.ok||!e.id)throw Error(a(e?.error)||`share_failed`);let t=ye(e.id);dt(t);try{await navigator.clipboard.writeText(t)}catch{}Y(t?`已生成并复制分享链接：${t}`:`已生成分享链接`)}catch(e){dt(``),Z(``),Y(`分享失败：${ot(e)}`)}finally{J(!1)}}},disabled:lt,children:[(0,R.jsx)(Ae,{size:13,"aria-hidden":`true`}),(0,R.jsx)(`span`,{children:lt?`生成分享中…`:`生成分享链接`})]}),(0,R.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:q,onClick:ct,children:[(0,R.jsx)(m,{size:13,"aria-hidden":`true`}),(0,R.jsx)(`span`,{children:`打印 / 保存 PDF`})]}),(0,R.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:q,onClick:()=>G(`resume.html`,P),children:[(0,R.jsx)(f,{size:13,"aria-hidden":`true`}),(0,R.jsx)(`span`,{children:`下载 HTML`})]}),(0,R.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:q,onClick:()=>{Y(``),dt(``),Z(``),Me(``),Re(``),Pe(``),st()},disabled:N,children:[(0,R.jsx)(h,{size:13,"aria-hidden":`true`}),(0,R.jsx)(`span`,{children:`重新生成`})]})]}),X||ft?(0,R.jsxs)(`div`,{style:{marginTop:12,padding:`14px 16px`,borderRadius:14,border:`1px solid rgba(59,130,246,0.22)`,background:`linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(239,246,255,0.85) 100%)`},children:[(0,R.jsx)(`div`,{className:`he-label`,style:{marginBottom:10},children:`网页简历分享链接`}),(0,R.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) auto`,gap:14,alignItems:`start`},children:[(0,R.jsxs)(`div`,{style:{minWidth:0},children:[(0,R.jsx)(`div`,{style:{fontSize:13,lineHeight:1.7,color:`var(--text-1)`,wordBreak:`break-all`},children:X}),(0,R.jsx)(`div`,{className:`he-muted`,style:{marginTop:8,lineHeight:1.65},children:`任何人打开该链接，或扫描右侧二维码，都可以直接查看这份公开网页简历。`}),(0,R.jsxs)(`div`,{style:{marginTop:10,display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{padding:`6px 12px`,fontSize:12},onClick:async()=>{if(X)try{await navigator.clipboard.writeText(X),Y(`已复制分享链接：${X}`)}catch{Y(`复制失败，请手动复制分享链接`)}},children:`复制链接`}),X?(0,R.jsx)(`a`,{href:X,target:`_blank`,rel:`noreferrer`,className:`btn-secondary`,style:{padding:`6px 12px`,fontSize:12,textDecoration:`none`,display:`inline-flex`,alignItems:`center`},children:`打开链接`}):null]})]}),(0,R.jsxs)(`div`,{style:{width:184,display:`grid`,justifyItems:`center`,gap:8},children:[(0,R.jsx)(`div`,{style:{width:184,minHeight:184,borderRadius:16,border:`1px solid var(--border)`,background:`#fff`,display:`grid`,placeItems:`center`,padding:8},children:ft?(0,R.jsx)(`img`,{src:ft,alt:`网页简历分享二维码`,style:{width:168,height:168,display:`block`}}):(0,R.jsx)(`div`,{className:`he-muted`,style:{fontSize:12},children:`二维码生成中…`})}),(0,R.jsx)(`div`,{className:`he-muted`,style:{fontSize:12,textAlign:`center`,lineHeight:1.6},children:`扫码即可打开该网页简历`})]})]})]}):null]}):null]})]}):null]})})}export{st as default};