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{n as o}from"./runtimeFeatures-C_7AZG1k.js";import{n as ee}from"./llmSettings-A1Pww_S_.js";import{t as s}from"./resumeAiConsent-Cb5Qq4UE.js";import{t as c}from"./PlatformTokenUsage-DOyFOKQg.js";import{n as l,t as u}from"./ToolConversationUI-SaFaLfJ7.js";import{i as d,l as f,n as p,s as m,t as h,u as te}from"./toolRuntime-wpPmOqkC.js";import{a as ne,i as g,n as re,t as ie}from"./llm-BJZzBJtf.js";import{i as _,n as v,t as ae}from"./ToolSidebarNav-ydI_X_Ab.js";import{t as y}from"./MarkdownText-PFZ-Hr7C.js";import{t as b}from"./ToolLiveStreamPanel-NdoSsKvg.js";import{i as oe,r as se,t as x}from"./ToolConversationBilling-tfxRkJpq.js";import{t as S}from"./supportFileText-L4xSfqOJ.js";import{n as ce}from"./taskPointGuard-Cj3sjKf6.js";import{n as le,t as ue}from"./toolSkillSummary-B3044xDN.js";import{n as C,r as w}from"./ToolConversationPersistence-DHdCZcA8.js";import{a as de,i as T,n as fe,o as E,r as D,t as O}from"./ToolConversationExecution-Dzjh1RyP.js";import{n as pe,t as k}from"./ComingSoonPanel-wdNeA4OD.js";import{n as me,t as he}from"./useToolRunState-lqkZz3ea.js";import{n as ge,r as _e,t as A}from"./ToolConversationHelpers-Bab8E63h.js";import{t as j}from"./ToolRunStatus-sSVJghbX.js";import{t as M}from"./AgentTaskPanel-DuwCymmK.js";var N=e(t(),1),P=n(),F=`deepseek_pro`,I=`deepseek`,L=`deepseek-v4-pro`,R=e=>(Array.isArray(e)?e:[]).map(e=>({title:a(e?.title||e?.url),url:a(e?.url),source:a(e?.source)})).filter(e=>/^https?:\/\//i.test(e.url)).slice(0,8);function z(){let[e,t]=(0,N.useState)(!1),[n,o]=(0,N.useState)(``),{runState:c,progress:l,setProgress:u,setRunState:v,start:ae,done:b,failByMessage:x}=me(),[O,k]=(0,N.useState)(null),[_e,A]=(0,N.useState)(``),[j]=r();(0,N.useEffect)(()=>{if(j.get(`cc_ref`)===`career_coach`){let e=j.get(`cc_resume`)||``;e&&A(t=>t||e)}let e=a(j.get(`source`));if(e!==`career_coach`&&e!==`public_jobs`)return;let t=d(j.get(`sid`)||``);if(!t)return;let n=e===`public_jobs`?`岗位库带入`:`职业教练带入`,r=[];a(t.resumeText)&&r.push({name:`${n}：简历`,content:a(t.resumeText),preview:a(t.resumeText).slice(0,120)}),a(t.jdText)&&r.push({name:`${n}：JD`,content:a(t.jdText),preview:a(t.jdText).slice(0,120)}),r.length&&(G(e=>e.length?e:r),U(e=>e.length?e:r.map(e=>({name:e.name,preview:e.preview}))));let i=a(t.prefillHint)||[a(t.targetRole)?`目标岗位：${a(t.targetRole)}`:``,a(t.nextQuestion)?`当前最该继续的问题：${a(t.nextQuestion)}`:``,a(t.primaryAction)?`建议重点：${a(t.primaryAction)}`:``].filter(Boolean).join(`
`);i&&A(e=>e||i)},[]);let[M,z]=(0,N.useState)([]),B=(0,N.useRef)([]),[ve,V]=(0,N.useState)([]),[H,U]=(0,N.useState)([]),[W,G]=(0,N.useState)([]),[K,q]=(0,N.useState)(``),[J,Y]=(0,N.useState)(``),[ye,X]=(0,N.useState)(``),[be,Z]=(0,N.useState)(``),[xe,Se]=(0,N.useState)(``),[Ce,we]=(0,N.useState)(!0),[Te,Ee]=(0,N.useState)(!0),[De,Oe]=(0,N.useState)([]),[ke,Q]=(0,N.useState)(``),Ae=(0,N.useRef)(``),je=(0,N.useRef)(null),Me=(0,N.useRef)(``),Ne=(0,N.useRef)(null),Pe=(0,N.useRef)(null),$=(0,N.useRef)(0),Fe=(0,N.useRef)(4),Ie=(0,N.useRef)(null),Le=e=>{z(t=>{let n=[...t,e].slice(-80);return B.current=n,n})};(0,N.useEffect)(()=>{B.current=M},[M]),(0,N.useEffect)(()=>{let e=()=>{try{_(`interview_coach`)}catch{}};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e)}},[]),C({tool:`interview_coach`,onRestore:e=>{Array.isArray(e.chatTurns)&&z(e.chatTurns.slice(-80)),e.result&&typeof e.result==`object`&&k(e.result),Array.isArray(e.uploadedDocs)&&G(e.uploadedDocs.slice(-20)),a(e.streamText)&&(q(a(e.streamText)),Q(a(e.streamText))),a(e.streamThinking)&&Y(a(e.streamThinking)),a(e.streamStage)&&X(a(e.streamStage)),a(e.streamActor)&&Z(a(e.streamActor))},syncEntries:[{key:`result`,signature:e=>e.result&&typeof e.result==`object`?JSON.stringify(e.result):``,apply:e=>{e.result&&typeof e.result==`object`&&k(e.result)}},{key:`chatTurns`,signature:e=>Array.isArray(e.chatTurns)?e.chatTurns.map(e=>`${a(e?.id)}:${a(e?.role)}:${String(e?.createdAt||``)}`).join(`|`):``,apply:e=>{Array.isArray(e.chatTurns)&&z(e.chatTurns.slice(-80))}},{key:`uploadedDocs`,signature:e=>Array.isArray(e.uploadedDocs)?e.uploadedDocs.map(e=>`${a(e?.name)}:${String(a(e?.content).length)}`).join(`|`):``,apply:e=>{Array.isArray(e.uploadedDocs)&&G(e.uploadedDocs.slice(-20))}},{key:`streamText`,signature:e=>a(e.streamText),apply:e=>{let t=a(e.streamText);q(t),Q(t)}},{key:`streamThinking`,signature:e=>a(e.streamThinking),apply:e=>Y(a(e.streamThinking))},{key:`streamStage`,signature:e=>a(e.streamStage),apply:e=>X(a(e.streamStage))},{key:`streamActor`,signature:e=>a(e.streamActor),apply:e=>Z(a(e.streamActor))}],onRunState:(e,n)=>{e===`running`?(v(`running`),t(!0)):e===`partial`?(v(`partial`),t(!0),o(``)):e===`done`?(b(),t(!1)):e===`failed`?(x(String(n.err||`生成失败`),o),t(!1)):e===`cancelled`&&(x(`已取消`,o),t(!1))},shouldStop:e=>e!==`running`&&e!==`partial`}),(0,N.useEffect)(()=>{w(`interview_coach`,{chatTurns:M.slice(-80),uploadedDocs:W.slice(-20)})},[M,W]),(0,N.useEffect)(()=>{let e=Ie.current;if(e)try{e.scrollTop=e.scrollHeight}catch{}},[M.length,J,K,xe,e]);let Re=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&&(/^\s*[\{\}\[\],]+\s*$/.test(t)||/output_schema|compact_json|response_format|max_tokens|prompt_tokens/i.test(t)||t!==r&&(r=t,n.push(t)))}let i=n.join(`
`);return i.length<=12e3?i:`…\n${i.slice(-12e3)}`},ze=e=>{let t=String(e||``).replace(/\r/g,``);if(!t)return``;let n=t,r=t.match(/---JSON_STATE---/);if(r&&typeof r.index==`number`)n=t.slice(0,r.index);else{let e=t.match(/```json\n([\s\S]*)/);e&&typeof e.index==`number`&&(n=t.slice(0,e.index))}n=n.replace(/^<对话回复>[\s\n]*/i,``).replace(/<\/?对话回复>[\s\n]*/gi,``).trim();let i=n.split(`
`).map(e=>e.trimEnd()).filter(e=>!!String(e||``).trim()).join(`
`);return i.length<=16e3?i:`…\n${i.slice(-16e3)}`},Be=e=>{let t=String(e||``);if(!t)return[];let n=t.match(/(?:\d{3,6}(?:\.\d+)?(?:元|块|rmb|cny)?(?:\/?(?:月|年))?|\d+(?:\.\d+)?\s*[kKwW万](?:\/?(?:月|年))?)/g)||[];return Array.from(new Set(n.map(e=>a(e)).filter(Boolean))).slice(0,20)},Ve=e=>{let t=[];return a(e.nextQuestion)&&t.push(`我接下来最想确认的是：${a(e.nextQuestion)}`),t.join(`

`)||`已生成面试辅导建议。`},He=e=>{let t=a(String(e||``).split(`
`).map(e=>a(e)).filter(Boolean).slice(0,3).join(`；`)||String(e||``).slice(0,120));return t.length<=120?t:`${t.slice(0,120)}…`},Ue=(e,t)=>{let n=String(e||``).trim();return n?t===`user`?(0,P.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:n}):(0,P.jsx)(y,{text:n}):null},We=e=>{let t=a(e);t&&A(t)},Ge=e=>{ge(a(e),`center`)},Ke=()=>{we(!0),ge(`coach-detail-view`,`start`)},qe=async e=>{let t=Array.isArray(e)?e.slice(0,5):[];if(!t.length)return;if(!(await i())?.token)throw Error(`请先登录后上传文件`);if(!await s())throw Error(`未同意隐私条款，已取消文件解析`);let n=[],r=[];for(let e of t){let t=a(e?.name)||`附件`,i=``;i=await S(e,{minLength:120,onStage:Se}).catch(()=>``);let o=a(i).slice(0,12e3);o&&(n.push({name:t,content:o}),r.push({name:t,preview:He(o)}))}if(n.length){let e=n.reduce((e,t)=>e+a(t.content).length,0);G(e=>[...e,...n].slice(-20)),U(e=>[...e,...r].slice(-10)),Le({id:`turn_s_${Date.now()}_${Math.random().toString(16).slice(2,8)}`,role:`system`,content:`已解析 ${n.length} 个附件，共提取约 ${e} 字内容。后续回答会自动结合这些材料继续分析。`,createdAt:Date.now(),attachments:r})}Se(``)},Je=async n=>{if(e)return;let r=a(n??_e),i=++$.current;o(``),Oe([]),Q(``),Fe.current=4,ae(),t(!0),Pe.current=new AbortController;let s=await ce({tool:`interview_coach`,modelChoice:F,dialogChars:r.length,docsChars:W.reduce((e,t)=>e+a(t?.content).length,0),chatChars:B.current.reduce((e,t)=>e+a(t?.content).length,0)});if(!s.ok){o((0,P.jsxs)(`span`,{children:[s.message,(0,P.jsx)(`a`,{href:s.rechargeHref,style:{color:`var(--accent)`,marginLeft:4},children:`充值`})]})),t(!1);return}try{let e=await ee();if(!e.enabled||!e.proxyUrl)throw Error(`AI 服务未启用，请在设置中开启 AI 代理`);let t={provider:I,model:L},n=W.slice(-20).map(e=>`附件《${a(e.name)}》：\n${a(e.content).slice(0,8e3)}`).filter(Boolean).join(`

`);w(`interview_coach`,{runState:`running`,progress:0,err:``,streamText:``,streamThinking:``,streamStage:`准备开始`,streamActor:`agent`});let o=await g({op:`interview_coach_agent`,proxyUrl:e.proxyUrl,gatewayApiKey:e.gatewayApiKey,thinking:!0,subProvider:t?.provider,subModel:t?.model,data:{resume:n||r,jd:r,jobTitle:r.slice(0,60),focusArea:r},signal:Pe.current.signal,onToolStart:(e,t,n)=>{if(i!==$.current)return;Fe.current=Math.max(1,Number(n||0)||1),Oe(t=>de(t,e)),X(`步骤 ${t}/${n}`);let r=he(t,n,`start`);u(r),w(`interview_coach`,{runState:`running`,progress:r,streamStage:`步骤 ${t}/${n}`,streamActor:e})},onToolDone:(e,t)=>{if(i!==$.current)return;Oe(t=>D(t,e));let n=he(t,Fe.current,`done`);u(n),w(`interview_coach`,{runState:`partial`,progress:n,streamStage:`已完成 ${t}/${Fe.current}`,streamActor:e})},onProcess:e=>{i===$.current&&q(t=>{let n=T(t,String(e||``));return Q(n),w(`interview_coach`,{runState:`partial`,streamText:n}),n})},onThinking:e=>{i===$.current&&Y(t=>{let n=T(t,String(e||``),12e3);return w(`interview_coach`,{runState:`partial`,streamThinking:n}),n})},onText:e=>{i===$.current&&(Q(e),q(e),w(`interview_coach`,{runState:`partial`,streamText:e}))}});if(i!==$.current)return;Q(o),q(o),A(``);let s={id:`turn_a_${Date.now()}_${Math.random().toString(16).slice(2,8)}`,role:`assistant`,content:o,createdAt:Date.now()},c=[...B.current,s].slice(-80);z(c),B.current=c,w(`interview_coach`,{runState:`done`,progress:100,streamText:o,streamStage:`分析完成`,streamActor:`agent`,chatTurns:c}),b()}catch(e){if(i!==$.current)return;let t=m(e,`生成失败`);w(`interview_coach`,{runState:`failed`,err:t}),x(t,o)}finally{t(!1)}},Ye=async n=>{if(e)return;let r=H.slice(),c=a(n)||(r.length?`我补充了几个附件，请结合这些信息继续帮我分析。`:``);if(!c)return;let l=++$.current;if(!(await i())?.token){o((0,P.jsxs)(`span`,{children:[`请先`,(0,P.jsx)(`a`,{href:h(),style:{color:`var(--accent)`,marginLeft:4},children:`登录`}),`后使用`]}));return}try{let e=await ce({tool:`interview_coach`,modelChoice:F,dialogChars:c.length,docsChars:W.reduce((e,t)=>e+a(t?.content).length,0),chatChars:B.current.reduce((e,t)=>e+a(t?.content).length,0)});if(!e.ok){o((0,P.jsxs)(`span`,{children:[e.message,(0,P.jsx)(`a`,{href:e.rechargeHref,style:{color:`var(--accent)`,marginLeft:4},children:`充值`})]}));return}}catch(e){o((0,P.jsx)(`span`,{children:String(e?.message||`暂时无法校验积分余额，请稍后重试。`)})),t(!1);return}if(W.length&&!await s())return;o(``),E({setStreamText:q,setStreamThinking:Y,setStreamStage:X,setStreamActor:Z,streamTextRawRef:Ae,streamThinkingRawRef:Me,streamTextFlushTimerRef:je,streamThinkingFlushTimerRef:Ne}),t(!0),ae();let u=`turn_u_${Date.now()}_${Math.random().toString(16).slice(2,8)}`;Le({id:u,role:`user`,content:c,createdAt:Date.now(),attachments:r}),w(`interview_coach`,{runState:`running`,chatTurns:[...M,{id:u,role:`user`,content:c,createdAt:Date.now(),attachments:r}].slice(-80),uploadedDocs:W.slice(-20)}),U([]),V([]),Pe.current=new AbortController;let d=Pe.current.signal;try{let e=await oe({rangeDays:1,pageSize:100}),t=``,n=null,r=[],i=e=>{if(!e||typeof e!=`object`)return;let t={fromProvider:a(e?.fromProvider||e?.from_provider),fromModel:a(e?.fromModel||e?.from_model),provider:a(e?.provider),model:a(e?.model)};!t.fromProvider&&!t.fromModel&&!t.provider&&!t.model||(n=n?{...n,...t}:t)},o=e=>{let t=R(e);t.length&&(r=t)},s=await ee();if(!s.enabled||!s.proxyUrl)throw Error(`AI 服务未启用，请在设置中开启 AI 代理`);let u=a(s.clientId)||`public`,m=String(globalThis?.navigator?.language||`zh-CN`),h=W.slice(-20).map(e=>`附件《${a(e.name)}》：\n${a(e.content).slice(0,12e3)}`).filter(Boolean).join(`

`),g=M.filter(e=>e.role===`user`||e.role===`assistant`).slice(-30).map(e=>`${e.role===`user`?`用户`:`助手`}：${a(e.content)}`).filter(Boolean).join(`
`),_=``;try{let e=await pe(c,void 0,e=>{X(e)});e.triggered&&e.contextText&&(_=e.contextText)}catch{}let v=[_,`请按真实面试教练对话继续，不要模板化问卷。`,`先询问：岗位JD核心要求、招聘方条件、用户当前经历证据；信息不足请连续追问。`,`输出要口语化、可直接练习复述。`,`格式要求：禁止使用 emoji 表情；禁止 ## 标题语法；禁止 --- 分隔线；禁止 > 引用块；禁止 markdown 表格；禁止 <> 尖括号。只用纯文字、加粗和列表。`,`每一轮都必须综合已有对话历史、所有已上传附件和本轮新增信息动态更新判断；如果用户补充了新的岗位、JD、简历或offer信息，要基于新信息修正之前建议，而不是重复旧结论。`,`用户输入里的金额数字必须原样保留，禁止擅自缩放、去零或改单位（例如 4000 不得写成 400）。`,`本轮识别到的金额片段：${Be(`${g}\n${c}\n${h}`).join(`，`)||`未识别到`}`,g?`对话历史：\n${g}`:``,h?`已上传文件内容：\n${h}`:``,`本轮用户输入：${c}`].filter(Boolean).join(`

`),ae={lang:m,job:{title:`对话式岗位收集`,jd:v,company:`未指定`},resume:h||v},y=fe({tool:`interview_coach`,runSeq:l,runSeqRef:$,stage:`interview_coach`,agentLabel:`Agent: interview-coach`,skillLabel:`Skill: interview_coach`,setStreamStage:X,setStreamActor:Z,setStreamText:q,setStreamThinking:Y,buildPlainStreamPreview:ze,sanitizeThinking:Re,streamTextRawRef:Ae,streamThinkingRawRef:Me,streamTextFlushTimerRef:je,streamThinkingFlushTimerRef:Ne}),x=await te(re({proxyUrl:s.proxyUrl,gatewayApiKey:s.gatewayApiKey,clientId:u,tier:s.tier,preset:`interview_coach`,provider:I,model:L,thinking:!0,data:ae,signal:d,onMeta:e=>{e?.fallback&&i(e.fallback),e?.webSearchCitations&&o(e.webSearchCitations),y.onMeta(e),t=y.getRequestId()},onText:y.onText,onThinking:y.onThinking}),6e5,`面试辅导生成`),S=null;try{S=JSON.parse(ne(x))}catch{S=null}let ce=!!(S&&typeof S==`object`&&!Array.isArray(S)&&Object.keys(S).length===0);if(!S||typeof S!=`object`||ce){let e=await te(ie({proxyUrl:s.proxyUrl,gatewayApiKey:s.gatewayApiKey,clientId:u,tier:s.tier,preset:`interview_coach`,provider:I,model:L,thinking:!0,data:{...ae,force_json:!0},signal:d,onResponseMeta:e=>{e?.fallback&&i(e.fallback),e?.webSearchCitations&&o(e.webSearchCitations)}}),6e5,`AI 重试`);try{S=JSON.parse(ne(e))}catch{S=null}}let le=!!(S&&typeof S==`object`&&!Array.isArray(S)&&Object.keys(S).length===0);if(!S||typeof S!=`object`||le)throw Error(`生成失败，请重试`);let C={...S,...r.length?{webSearchCitations:r}:{},...n?{_fallback:n}:{}};k(C);let de=await se({beforeIds:e,requestId:t,aggregateAllNew:!0,pageSize:100,rangeDays:1}),T={id:`turn_a_${Date.now()}_${Math.random().toString(16).slice(2,8)}`,role:`assistant`,content:Ve(C),createdAt:Date.now(),billing:de},E=[...B.current,T].slice(-80);z(E),B.current=E,b(),w(`interview_coach`,{runState:`done`,result:C,uploadedDocs:W.slice(-20),chatTurns:E});let D=`interview_coach_${Date.now()}_${Math.random().toString(16).slice(2,8)}`;queueMicrotask(()=>{f(ue({id:D,toolLabel:`面试辅导`,toolType:`interview_coach`,title:a(C.title)||`面试辅导结果`,score:``,deepLink:p(`/tools/interview-coach`,`result`,{rid:D}),result:C}),{result:C,uploadedDocs:W}).catch(()=>{})})}catch(e){if(l!==$.current)return;if(e?.name===`AbortError`){x(`已取消`,o);return}let t=m(e);x(t,o),o(t),w(`interview_coach`,{runState:String(t||``).includes(`取消`)?`cancelled`:`failed`,err:String(t||``)})}finally{q(``),t(!1)}},Xe=(0,N.useMemo)(()=>{let e=M.filter(e=>e.role===`assistant`&&e.billing);return e.length?e[e.length-1]:null},[M]),Ze=()=>{k(null),z([]),A(``),V([]),G([]),U([]),q(``),Y(``),X(``),Z(``),Se(``),w(`interview_coach`,{runState:`idle`,chatTurns:[],uploadedDocs:[],result:null,streamText:``,streamThinking:``,streamStage:``,streamActor:``})},Qe=[`我要应聘【岗位名称】，我目前最能证明自己的经历是【项目/工作】，请先一步步追问我还缺哪些关键信息。`,`我接下来要面【公司 / 团队】，最担心【问题类型】，请先追问我背景，再给我高频题和答法。`,`我准备上传 JD 和简历，你先解析，再按真实面试教练的方式带我做模拟问答。`,`我想同时准备 HR 面和业务面，我的目标岗位是【岗位名称】，请先帮我判断重点考察点。`],$e=e&&!!a(J),et=(0,N.useMemo)(()=>a([...M].reverse().find(e=>e.role===`assistant`)?.id),[M]),tt=(0,N.useMemo)(()=>O?le(`interview_coach`,O):null,[O]),nt=(0,N.useMemo)(()=>O?.starFeedback&&typeof O.starFeedback==`object`?O.starFeedback:{situation:`先快速交代业务背景与问题场景。`,task:`说明你负责的目标、约束和角色边界。`,action:`重点讲你具体做了什么、如何推进与协调。`,result:`补充量化结果或影响范围，避免只说“完成了”。`,overall:`尽量按 STAR 顺序回答，先结论，再证据，最后结果。`},[O]),rt=(0,N.useMemo)(()=>{let e=(Array.isArray(O?.followUpTemplates)?O.followUpTemplates:[]).map(e=>({label:a(e?.label),text:a(e?.text)})).filter(e=>e.label&&e.text);return e.length?e.slice(0,4):[{label:`感谢信模板`,text:`感谢今天的面试交流。我对这个岗位和团队更有兴趣了，尤其是今天聊到的业务目标与协作方式。如果需要，我也可以补充相关项目细节与结果数据。`},{label:`反馈追问`,text:`感谢你们推进这轮流程。如果方便的话，也很希望了解一下本轮面试中我最需要继续补强的地方，方便我后续针对性改进。`}]},[O]);return(0,N.useEffect)(()=>{O&&we(!0)},[O]),{busy:e,setBusy:t,runState:c,progress:l,failByMessage:x,err:n,setErr:o,result:O,setResult:k,dialogInput:_e,setDialogInput:A,chatTurns:M,setChatTurns:z,supportFiles:ve,setSupportFiles:V,pendingAttachments:H,setPendingAttachments:U,uploadedDocs:W,setUploadedDocs:G,streamText:K,setStreamText:q,streamThinking:J,setStreamThinking:Y,streamStage:ye,setStreamStage:X,streamActor:be,setStreamActor:Z,parseStage:xe,setParseStage:Se,detailExpanded:Ce,setDetailExpanded:we,streamTextRawRef:Ae,streamTextFlushTimerRef:je,streamThinkingRawRef:Me,streamThinkingFlushTimerRef:Ne,abortRef:Pe,runSeqRef:$,chatScrollRef:Ie,appendTurn:Le,sanitizeThinking:Re,buildPlainStreamPreview:ze,collectMoneySnippets:Be,buildAssistantReply:Ve,buildDocPreview:He,renderRichText:Ue,applyNextQuestion:We,jumpToTurn:Ge,jumpToDetailView:Ke,ingestFilesToChat:qe,run:Ye,runAgent:Je,agentMode:Te,setAgentMode:Ee,agentSteps:De,agentText:ke,latestBilling:Xe,resetAll:Ze,starterPrompts:Qe,showThinkingPanel:$e,latestAssistantTurnId:et,unifiedSummary:tt,starFeedback:nt,followUpTemplates:rt}}var B=(e,t=20)=>(Array.isArray(e)?e:[]).slice(0,t).map(e=>`- ${a(e)}`).filter(Boolean).join(`
`);function ve({result:e,questionSections:t,starFeedback:n,followUpTemplates:r,applyNextQuestion:i,copiedKey:o,copyText:ee}){let[s,c]=(0,N.useState)(!1),l=t.some(e=>e.items.length),u=t.flatMap(e=>e.items.map(t=>({...t,_label:e.label,_tone:e.tone}))),d=s?u:u.slice(0,5);return(0,P.jsxs)(`div`,{style:{marginTop:14,display:`grid`,gap:10},children:[a(e.summary)?(0,P.jsx)(`div`,{style:{fontSize:13,color:`var(--text-2)`},children:a(e.summary)}):null,Array.isArray(e.prepFocus)&&e.prepFocus.length?(0,P.jsxs)(`div`,{style:{border:`1px solid var(--border-soft)`,borderRadius:14,padding:`12px 14px`,background:`color-mix(in srgb, var(--surface) 98%, transparent)`},children:[(0,P.jsx)(`div`,{className:`he-label`,children:`重点准备方向`}),(0,P.jsx)(`div`,{style:{marginTop:8,display:`grid`,gap:6},children:e.prepFocus.slice(0,8).map((e,t)=>(0,P.jsx)(`div`,{style:{fontSize:13,color:`var(--text-1)`},children:`· ${String(e||``).trim()}`},`pf_${t}`))})]}):null,l?(0,P.jsxs)(`div`,{style:{border:`1px solid var(--border-soft)`,borderRadius:14,padding:`12px 14px`,background:`color-mix(in srgb, var(--surface) 98%, transparent)`},children:[(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,P.jsx)(`div`,{className:`he-label`,children:`面试题库（${u.length} 题）`}),u.length>5?(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{fontSize:11,padding:`2px 8px`,minHeight:24},onClick:()=>c(e=>!e),children:s?`收起`:`展开全部 ${u.length} 题`}):null]}),(0,P.jsx)(`div`,{style:{marginTop:10,display:`grid`,gap:8},children:d.map((e,t)=>(0,P.jsxs)(`div`,{style:{borderRadius:10,padding:`8px 10px`,background:`rgba(15,23,42,0.03)`},children:[(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexWrap:`wrap`},children:[(0,P.jsx)(`span`,{className:`he-chip`,style:{fontSize:10,padding:`1px 6px`,borderColor:`${e._tone}33`,color:e._tone,background:`${e._tone}12`},children:e._label}),(0,P.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:`var(--text-1)`,lineHeight:1.6},children:a(e?.question)})]}),a(e?.answerGuide)?(0,P.jsx)(`div`,{className:`he-muted`,style:{marginTop:4,fontSize:12,lineHeight:1.7},children:(0,P.jsx)(y,{text:a(e.answerGuide)})}):null]},`iq_${t}`))})]}):null,n&&(a(n.situation)||a(n.task)||a(n.action)||a(n.result))?(0,P.jsxs)(`div`,{style:{border:`1px solid var(--border-soft)`,borderRadius:14,padding:`12px 14px`},children:[(0,P.jsx)(`div`,{className:`he-label`,children:`STAR 回答结构提示`}),(0,P.jsx)(`div`,{style:{marginTop:8,color:`var(--text-1)`,fontSize:13,lineHeight:1.8},children:(0,P.jsx)(y,{text:[a(n.situation)?`- **S** ${a(n.situation)}`:``,a(n.task)?`- **T** ${a(n.task)}`:``,a(n.action)?`- **A** ${a(n.action)}`:``,a(n.result)?`- **R** ${a(n.result)}`:``,a(n.overall)?`\n${a(n.overall)}`:``].filter(Boolean).join(`
`)})})]}):null,r.length?(0,P.jsxs)(`div`,{style:{border:`1px solid var(--border-soft)`,borderRadius:14,padding:`12px 14px`},children:[(0,P.jsx)(`div`,{className:`he-label`,children:`面后跟进话术`}),(0,P.jsx)(`div`,{style:{marginTop:8,display:`grid`,gap:6},children:r.map((e,t)=>(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 8px`,borderRadius:8,background:`rgba(15,23,42,0.03)`},children:[(0,P.jsx)(`span`,{style:{flex:1,fontSize:13,color:`var(--text-1)`,lineHeight:1.6},children:a(e.label)||a(e.text).slice(0,40)}),(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{fontSize:11,padding:`2px 8px`,minHeight:22},onClick:()=>{ee(`ft_${t}`,a(e.text))},children:o===`ft_${t}`?`已复制`:`复制`}),(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{fontSize:11,padding:`2px 8px`,minHeight:22},onClick:()=>i(a(e.text)),children:`带入`})]},`ft_${t}`))})]}):null,Array.isArray(e.caveats)&&e.caveats.length?(0,P.jsxs)(`div`,{style:{border:`1px solid var(--border-soft)`,borderRadius:14,padding:`12px 14px`},children:[(0,P.jsx)(`div`,{className:`he-label`,children:`注意事项`}),(0,P.jsx)(`div`,{style:{marginTop:8,color:`var(--text-2)`,fontSize:13,lineHeight:1.8},children:(0,P.jsx)(y,{text:B(e.caveats,10)})})]}):null]})}function V(){return o(`/tools/interview-coach`)?(0,P.jsx)(v,{title:`面试辅导`,subTitle:`纯对话模式：你直接发内容，模型持续追问并输出题库与回答建议。`,hideModelSelector:!0,forceThinkingEnabled:!0,hideThinkingToggle:!0,children:(0,P.jsx)(k,{title:`面试辅导即将上线`,description:`面试辅导即将上线，建议先使用简历匹配与简历优化准备投递材料。`})}):(0,P.jsx)(H,{})}function H(){let{copiedKey:e,copyText:t}=_e(),{busy:n,setBusy:r,runState:i,progress:o,failByMessage:ee,err:s,setErr:d,result:f,dialogInput:p,setDialogInput:m,chatTurns:h,supportFiles:te,setSupportFiles:ne,pendingAttachments:g,setPendingAttachments:re,setUploadedDocs:ie,streamText:_,streamThinking:y,streamStage:oe,streamActor:se,parseStage:S,abortRef:ce,runSeqRef:le,chatScrollRef:ue,renderRichText:C,applyNextQuestion:w,ingestFilesToChat:de,run:T,runAgent:fe,agentMode:E,agentSteps:D,agentText:pe,starterPrompts:k,latestAssistantTurnId:me,starFeedback:he,followUpTemplates:ge}=z(),F=!h.length&&!n,I=(0,N.useMemo)(()=>x(h),[h]),L={jd_analysis:`岗位解析`,interview_questions:`题库生成`,interview_coach:`题库生成`,resume_optimize:`简历优化`},[R,B]=(0,N.useState)(null),[V,H]=(0,N.useState)(``),[U,W]=(0,N.useState)(null),G=(0,N.useRef)(n),K=(0,N.useCallback)(e=>{E?fe(e):T(e)},[E,fe,T]);(0,N.useEffect)(()=>{if(G.current&&!n&&U){let e=U;W(null),m(``),K(e)}G.current=n},[n,U,K,m]);let q=(0,N.useCallback)(()=>{let e=a(p);if(!(!e&&!g.length)){if(n){e&&(W(e),m(``));return}K(p)}},[n,p,g.length,K,m]),J=e=>{let t=a(e);t&&(E?fe(t):T(t))},Y=(0,N.useMemo)(()=>[{key:`business`,label:`专业题`,tone:`#2563eb`,items:Array.isArray(f?.businessQuestions)?f.businessQuestions:[]},{key:`hr`,label:`HR题`,tone:`#f97316`,items:Array.isArray(f?.hrQuestions)?f.hrQuestions:[]},{key:`tough`,label:`棘手题`,tone:`#dc2626`,items:Array.isArray(f?.toughQuestions)?f.toughQuestions:[]},{key:`case`,label:`场景题`,tone:`#7c3aed`,items:Array.isArray(f?.caseQuestions)?f.caseQuestions:[]}],[f]);return(0,P.jsx)(v,{title:`面试辅导`,subTitle:`纯对话模式：你直接发内容，模型持续追问并输出题库与回答建议。`,hideModelSelector:!0,defaultModelChoice:`deepseek_pro`,forceThinkingEnabled:!0,hideThinkingToggle:!0,sidebar:(0,P.jsx)(ae,{current:`/tools/interview-coach`}),children:(0,P.jsxs)(`div`,{className:`he-tools-main`,children:[(0,P.jsxs)(`div`,{className:`he-card`,style:{marginTop:6,padding:0,display:`flex`,flexDirection:`column`,minHeight:520,overflow:`hidden`},children:[F?(0,P.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,padding:`26px 24px 18px`},children:[(0,P.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border-soft)`,paddingBottom:16},children:[(0,P.jsx)(`div`,{className:`he-label`,children:`面试辅导对话`}),(0,P.jsx)(`div`,{style:{marginTop:8,fontSize:22,fontWeight:800,color:`var(--text-1)`,letterSpacing:`-0.02em`},children:`像对话一样准备面试，不再单独堆模块`}),(0,P.jsx)(`div`,{className:`he-muted`,style:{marginTop:8,fontSize:13,lineHeight:1.8,maxWidth:720},children:`直接发岗位、简历、附件和你最担心的问题。我会像职业教练一样先追问关键信息，再给你题库、回答建议和下一步动作。`})]}),(0,P.jsxs)(`div`,{style:{marginTop:16,padding:`16px 16px 12px`,borderRadius:18,border:`1px solid var(--border)`,background:`var(--surface)`},children:[(0,P.jsx)(`div`,{className:`he-label`,children:`建议这样开始`}),(0,P.jsx)(`div`,{style:{marginTop:12,display:`flex`,flexWrap:`wrap`,gap:10},children:k.slice(0,4).map(e=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>J(e),style:{padding:`10px 14px`,borderRadius:999,border:`1px solid var(--border)`,background:`var(--surface2)`,cursor:`pointer`,textAlign:`left`,transition:`transform 0.15s, border-color 0.15s`},onMouseEnter:e=>{e.currentTarget.style.transform=`translateY(-1px)`,e.currentTarget.style.borderColor=`var(--accent)`},onMouseLeave:e=>{e.currentTarget.style.transform=``,e.currentTarget.style.borderColor=`var(--border)`},children:(0,P.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:`var(--text-1)`,lineHeight:1.5},children:e})},e))}),(0,P.jsx)(`div`,{className:`he-muted`,style:{marginTop:12,fontSize:12,lineHeight:1.7},children:`你也可以直接粘贴简历、JD、offer 邮件、追问记录，或上传附件开始对话。`}),(0,P.jsx)(`div`,{className:`he-muted`,style:{marginTop:8,fontSize:12,lineHeight:1.7},children:`对话会保存在你当前的浏览器里，下次打开能接着练；换设备或清除浏览器数据后会丢失。`})]})]}):(0,P.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`16px 18px 0`,background:`color-mix(in srgb, var(--surface) 96%, transparent)`},children:(0,P.jsxs)(`div`,{style:{maxWidth:920,margin:`0 auto`},children:[(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,marginBottom:12,padding:`0 2px`},children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`he-label`,children:`对话面板`}),(0,P.jsx)(`div`,{className:`he-muted`,style:{marginTop:4,fontSize:12},children:`像职业教练一样先追问，再给题库、答案建议和下一步动作。`})]}),(0,P.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:[(0,P.jsx)(`span`,{className:`he-chip`,children:`持续追问`}),(0,P.jsx)(`span`,{className:`he-chip`,children:`结构化输出`}),(0,P.jsx)(`span`,{className:`he-chip`,children:`附件可用`})]})]}),I?(0,P.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,padding:`0 2px 8px`},children:(0,P.jsx)(c,{billing:I,label:`本次会话累计`,style:{marginTop:0,fontSize:11,lineHeight:1.5}})}):null,(0,P.jsx)(l,{turns:h,assistantLabel:`面试辅导助手`,emptyText:``,chatScrollRef:ue,renderContent:e=>C(e.content,e.role),copiedAssistantTurnId:e.startsWith(`msg_`)?e.slice(4):``,onCopyAssistantMessage:e=>{t(`msg_${e.id}`,e.content)},getAssistantActions:()=>A({nextQuestion:a(f?.nextQuestion),onUseNextQuestion:()=>w(a(f?.nextQuestion))}),getAssistantCards:n=>me!==n.id||!f?null:(0,P.jsx)(ve,{result:f,questionSections:Y,starFeedback:he,followUpTemplates:ge,applyNextQuestion:w,copiedKey:e,copyText:t}),streamPreview:!E&&n&&(_||y)?(0,P.jsx)(b,{assistantLabel:`面试辅导助手`,busy:n,streamText:_,streamThinking:y,streamStage:oe,streamActor:se,emptyText:`正在梳理你的经历、岗位要求和下一步追问…`}):null}),E&&n&&(pe||y||D.length)?(0,P.jsx)(b,{assistantLabel:`面试辅导 Agent`,busy:n,streamText:_,streamThinking:y,streamStage:oe,streamActor:se,agentMode:!0,agentText:pe,agentSteps:D,stepLabels:L,emptyText:`正在分步准备题库、评估缺口并生成追问建议…`}):null]})}),(0,P.jsxs)(`div`,{style:{padding:`0 18px 16px`,borderTop:F?`none`:`1px solid var(--border)`,paddingTop:F?0:14,marginTop:F?0:4,background:`var(--surface)`},children:[n&&E&&D.length>0?(0,P.jsx)(M,{title:`Agent 面试准备清单`,stage:[a(oe),a(se)].filter(Boolean).join(` · `),progress:o,steps:D,labels:L}):null,R?(0,P.jsxs)(`div`,{style:{marginBottom:12,padding:`14px 14px 12px`,borderRadius:16,border:`1px solid var(--border-soft)`,background:`color-mix(in srgb, var(--surface) 98%, rgba(37,99,235,0.04))`},children:[(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`he-label`,children:`当前练习：${R.label}`}),(0,P.jsx)(`div`,{style:{marginTop:6,color:`var(--text-1)`,lineHeight:1.75,fontWeight:700},children:R.question}),R.guide?(0,P.jsx)(`div`,{className:`he-muted`,style:{marginTop:8,fontSize:12,lineHeight:1.75},children:R.guide}):null]}),(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{minHeight:30,padding:`0 12px`},onClick:()=>{B(null),H(``)},children:`结束本题`})]}),(0,P.jsx)(`textarea`,{className:`he-textarea`,style:{marginTop:12,minHeight:120},value:V,onChange:e=>H(e.target.value),placeholder:`先在这里写下你的回答，再点“提交评分”进入 STAR 点评。`}),(0,P.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,marginTop:12},children:[(0,P.jsx)(`button`,{type:`button`,className:`btn-primary`,style:{minHeight:30,padding:`0 12px`},disabled:!a(V),onClick:()=>{let e=`这是我对这道题的回答，请按 STAR 结构逐段点评并打分：\n\n题目：${R.question}\n\n我的回答：${V}`;H(``),J(e)},children:`提交评分`}),(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{minHeight:30,padding:`0 12px`},onClick:()=>J(`请针对这道题继续追问，重点追结果量化和我的个人贡献：${R.question}`),children:`继续追问结果量化`}),(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{minHeight:30,padding:`0 12px`},onClick:()=>J(`请把这道题的示范答案按 STAR 四段写出来，并给我一个适合口语表达的版本：${R.question}`),children:`给示范答案`}),R.followUps.map((e,t)=>(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{minHeight:30,padding:`0 12px`},onClick:()=>J(e),children:e},`follow_${t}`))]})]}):null,(0,P.jsxs)(`div`,{children:[(0,P.jsx)(u,{busy:n,inputDisabled:!1,actionDisabled:!1,pendingAttachments:g,onRemoveAttachment:e=>{let t=g[e];re(t=>t.filter((t,n)=>n!==e)),ne(t=>t.filter((t,n)=>n!==e)),ie(e=>{let n=[...e],r=n.findIndex(e=>a(e?.name)===a(t?.name));return r>=0&&n.splice(r,1),n})},value:p,onChange:m,onSubmit:q,onFilesPicked:async e=>{ne(e);try{await de(e)}catch(e){d(a(e?.message||`文件解析失败`))}},placeholder:n&&U?`消息已排队，等当前回复结束后自动发送…`:`直接告诉我：你要面什么岗位、你目前的背景、JD重点、你担心的问题；也可以直接粘贴简历或岗位描述。`,supportFiles:te.map(e=>a(e?.name)).filter(Boolean),parseStage:S,submitDisabled:!a(p)&&!g.length,simpleStyle:!0,minTextareaHeight:120,maxTextareaHeight:260}),n&&U?(0,P.jsx)(`div`,{style:{marginTop:6,fontSize:11,color:`var(--text-3)`,textAlign:`center`},children:`已排队 1 条消息，等当前回复结束后自动发送`}):null]}),(0,P.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10},children:n?(0,P.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{fontSize:12,padding:`4px 10px`},onClick:()=>O({tool:`interview_coach`,runSeqRef:le,abortRef:ce,setBusy:r,onCancelled:()=>ee(`已取消`,d)}),children:`取消`}):null})]})]}),(0,P.jsx)(j,{state:i,progress:o}),s&&(0,P.jsx)(`div`,{className:`he-err`,children:s})]})})}export{V as default};