@customize-agent/server 4.59.3 → 4.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +34 -18
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +6 -0
- package/.next/server/chunks/1243.js +1 -1
- package/.next/server/chunks/{7931.js → 7848.js} +45 -46
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/chunks/9666.js +13 -14
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/assets/generated/preview.js +1 -1
- package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -1
- package/.next/server/pages/api/assets/generated.js +1 -1
- package/.next/server/pages/api/assets/generated.js.nft.json +1 -1
- package/.next/server/pages/api/config/embedding/healthCheck.js.nft.json +1 -1
- package/.next/server/pages/api/documents/canvas/[id].js +1 -1
- package/.next/server/pages/api/documents/canvas/[id].js.nft.json +1 -1
- package/.next/server/pages/api/documents/export.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generate/preview.js +1 -1
- package/.next/server/pages/api/documents/generate/preview.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generate.js +1 -1
- package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/events.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/events.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/figure/[name].js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/figure/[name].js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/instruction.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/instruction.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/nodes/[nodeId].js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/nodes/[nodeId].js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/nodes.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/nodes.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/pause.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/pause.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/preview.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/preview.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/confirm.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/confirm.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/rollback.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/rollback.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/repair.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/repair.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/report.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/report.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id]/resume-generate.js +1 -1
- package/.next/server/pages/api/documents/generated/[id]/resume-generate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -1
- package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated.js +1 -1
- package/.next/server/pages/api/documents/generated.js.nft.json +1 -1
- package/.next/server/pages/api/health.js +1 -1
- package/.next/server/pages/api/jobs/[id].js.nft.json +1 -1
- package/.next/server/pages/api/kb/categories.js.nft.json +1 -1
- package/.next/server/pages/api/kb/duplicates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/detail.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/export.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/open.js +1 -1
- package/.next/server/pages/api/kb/files/open.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/preview-pdf-page.js +1 -1
- package/.next/server/pages/api/kb/files/preview-pdf-page.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/reindex.js +1 -1
- package/.next/server/pages/api/kb/files/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/search.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/source-preview.js +1 -0
- package/.next/server/pages/api/kb/files/source-preview.js.nft.json +1 -0
- package/.next/server/pages/api/kb/files.js.nft.json +1 -1
- package/.next/server/pages/api/kb/ignore.js.nft.json +1 -1
- package/.next/server/pages/api/kb/material-groups.js.nft.json +1 -1
- package/.next/server/pages/api/kb/operations.js.nft.json +1 -1
- package/.next/server/pages/api/kb/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/stats.js.nft.json +1 -1
- package/.next/server/pages/api/kb/tags.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload/complete.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload.js.nft.json +1 -1
- package/.next/server/pages/api/system/reset.js +1 -1
- package/.next/server/pages/api/system/reset.js.nft.json +1 -1
- package/.next/server/pages/canvas/[id].html +1 -1
- package/.next/server/pages/canvas.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/source-preview.html +1 -0
- package/.next/server/pages/knowledge/source-preview.js.nft.json +1 -0
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/skills.html +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages-manifest.json +33 -31
- package/.next/server/webpack-runtime.js +1 -1
- package/.next/static/77d815e00c04639e13f00085615df788b0e214c81a14c8f0ba89cbbe491ff7c3/_buildManifest.js +1 -0
- package/.next/static/chunks/511-75b881093a3e908b.js +1 -0
- package/.next/static/chunks/665-9607db8f8b43e52e.js +1 -0
- package/.next/static/chunks/709-a7c652953ccd3b4b.js +1 -0
- package/.next/static/chunks/823-ff35afb174f7998b.js +1 -0
- package/.next/static/chunks/835-d29f4cc7a3679606.js +1 -0
- package/.next/static/chunks/873-16d052cdd3768758.js +1 -0
- package/.next/static/chunks/992-8032f477230baaaf.js +1 -0
- package/.next/static/chunks/pages/{_app-591ac7a50d506b05.js → _app-c11b5e8072f49bcc.js} +1 -1
- package/.next/static/chunks/pages/canvas/{[id]-3c2b950c135f6699.js → [id]-37bee3f7b816ed18.js} +1 -1
- package/.next/static/chunks/pages/canvas-97971ae159337676.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-f89e6044f752277c.js +1 -0
- package/.next/static/chunks/pages/knowledge/source-preview-4a303fadb123430a.js +1 -0
- package/.next/static/chunks/pages/{models-baf1d15d79cb366b.js → models-3e486e49cca91e5a.js} +1 -1
- package/.next/static/chunks/pages/{skills-648c64f8cb37ef5d.js → skills-77ba363270239bbf.js} +1 -1
- package/.next/static/css/1a59bfb0aa677e69.css +1 -0
- package/package.json +2 -2
- package/.next/static/7819131dbd58574b80d0784549af250fc9b202d0e2317de83fe25857af834b79/_buildManifest.js +0 -1
- package/.next/static/chunks/506-93f730bc149d0dce.js +0 -1
- package/.next/static/chunks/709-14ed28f1f6d4b25e.js +0 -1
- package/.next/static/chunks/713-b1ce7a4a4ef015f4.js +0 -1
- package/.next/static/chunks/850-0f48354694fc6b3e.js +0 -1
- package/.next/static/chunks/90-3a5ea00990b4e72b.js +0 -1
- package/.next/static/chunks/pages/canvas-9086d8d3a7d32776.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-bd4b6e4264e812ff.js +0 -1
- package/.next/static/css/f35b901a72bb3ade.css +0 -1
- /package/.next/static/{7819131dbd58574b80d0784549af250fc9b202d0e2317de83fe25857af834b79 → 77d815e00c04639e13f00085615df788b0e214c81a14c8f0ba89cbbe491ff7c3}/_ssgManifest.js +0 -0
package/.next/static/chunks/pages/canvas/{[id]-3c2b950c135f6699.js → [id]-37bee3f7b816ed18.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[790],{38977:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>eY});var r=n(65321),l=n(97109),i=n(3454),a=n.n(i),o=n(43220),s=n.n(o),c=n(86109),d=n(48399),u=n(17807),h=n(42700),p=n(32941),m=n(33442),x=n(85114),g=n(25258),v=n(11702),f=n(85493),y=n(99811),j=n(6578),A=n(85587),b=n(93533),w=n(8090);function k(e){let{readings:t}=e,n=null==t?void 0:t.contractQuality;if(!n)return(0,r.jsx)("div",{role:"status",children:"七维评价尚未产出。"});let l=n.score,i=null==t?void 0:t.contractQualityStale;return Array.isArray(l.defects)?(0,r.jsxs)("div",{"aria-label":"七维评价",style:{fontSize:12,lineHeight:1.8},children:[(0,r.jsx)("strong",{children:i?"编辑前的历史七维诊断":"七维专业诊断"}),(0,r.jsxs)("span",{children:[";",i?"当前正文须重新评价":l.deliveryReady?"适用职责核验满足,待专业验收":"仍有缺陷或待核事项"]}),(0,r.jsxs)("div",{children:["阻断 ",l.blocking.length," 项;按根因归并的问题 ",l.defects.length," 项。专业档位不换算为未经标定的百分分数。"]}),i&&(0,r.jsx)("div",{children:i.reason}),(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:"查看七个维度"}),(0,r.jsxs)("table",{style:{width:"100%"},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"维度"}),(0,r.jsx)("th",{children:"质量档位"}),(0,r.jsx)("th",{children:"满足 / 未满足 / 未判定"})]})}),(0,r.jsx)("tbody",{children:l.dimensions.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.label}),(0,r.jsx)("td",{children:"not-applicable"===e.status?"不适用":e.qualityLabel}),(0,r.jsxs)("td",{children:[e.verification.met," / ",e.verification.failed," / ",e.verification.unmeasured]})]},e.id))})]}),(0,r.jsx)("div",{children:n.expertValidated?"已完成专家校准。":"尚未完成专家校准。"})]})]}):(0,r.jsx)("div",{role:"status",children:"历史评价回执保留;按当前专业诊断口径重新评价后显示核验与质量档位。"})}let{Paragraph:S,Text:I}=d.A;function C(e){return new Date(e).toLocaleString()}function z(e){var t,n,i;let{status:a,title:o,html:s,source:c,truncated:d,totalChars:u,renderedChars:p,stats:g,gate:y,loading:j,error:A,onRetry:b,updatedAt:z,generatedAt:R,className:N,t:E,deliveryReadings:M}=e,T=null!=s?s:"",L=T.trim().length>0,D=g?function(e){let t=[];return e.droppedDangerousBlocks>0&&t.push("删除了 ".concat(e.droppedDangerousBlocks," 处可执行/可加载内容(脚本、样式、内嵌页面等)")),e.blockedUrls>0&&t.push("拦截了 ".concat(e.blockedUrls," 个协议不安全的链接(如 javascript: / data:)")),e.escapedTags>0&&t.push("转义了 ".concat(e.escapedTags," 个不支持的标签(原文里的原始 HTML 会以文字显示)")),e.droppedAttributes>0&&t.push("剥离了 ".concat(e.droppedAttributes," 个属性(样式、事件、非白名单属性)")),e.droppedComments>0&&t.push("删除了 ".concat(e.droppedComments," 处注释/声明")),t}(g):[],[P,B]=(0,l.useState)(!1),q=null!=(t=null==y?void 0:y.issues)?t:[],H=q.length>5,_=P?q:q.slice(0,5),W=q.length-_.length,F=W+(null!=(n=null==y?void 0:y.truncatedCount)?n:0),U=(0,r.jsxs)("div",{className:"deliverablePreviewMeta",children:[o&&(0,r.jsx)(I,{strong:!0,style:{fontSize:15},children:o}),a&&(0,r.jsx)(v.A,{color:(0,w.uj)(a),children:(0,w.GC)(a,E)}),c&&(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"预览正文:".concat("editedMarkdown"===c?"编辑后的正文(以它为准)":"markdown"===c?"记录里的正文(markdown 字段)":"draft"===c?"生成时的草案正文(draft.markdown)":"none"===c?"没有正文":"未识别的正文来源(".concat(c,")"))}),R?(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"生成于 ".concat(C(R))}):null,z?(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"更新于 ".concat(C(z))}):null]}),G=q.length>0&&(0,r.jsxs)("div",{style:{fontSize:12.5,lineHeight:1.8},children:[_.map((e,t)=>(0,r.jsxs)("div",{children:["\xb7 ",e]},"".concat(t,"-").concat(e.slice(0,12)))),F>0&&(0,r.jsx)("div",{children:"…还有 ".concat(F," 项未列出").concat(W>0&&(null!=(i=null==y?void 0:y.truncatedCount)?i:0)>0?"(服务端只下发了 ".concat(q.length," 项)"):"")}),H&&(0,r.jsx)(x.Ay,{type:"link",size:"small",style:{paddingInline:0},onClick:()=>B(e=>!e),children:P?"收起阻断项":"展开全部 ".concat(q.length," 项")})]}),O=y?(0,r.jsx)(f.A,{style:{width:"100%"},type:y.passed?"success":"warning",showIcon:!0,message:y.passed?"交付门禁:通过":"交付门禁:阻断 ".concat(y.blockingCount," 项"),description:(0,r.jsxs)(m.A,{direction:"vertical",size:4,style:{width:"100%"},children:[(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"能否导出由服务端判定;此处仅供查看。"}),G]})}):(0,r.jsx)(f.A,{style:{width:"100%"},type:"info",showIcon:!0,message:"尚无交付门禁结论(生成中或尚未完成)——这不代表已通过。"});return(0,r.jsx)("div",{className:null!=N?N:"deliverablePreview",children:(0,r.jsxs)("div",{className:"deliverablePreviewStack",children:[U,(0,r.jsx)(k,{readings:M}),O,d&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"warning",showIcon:!0,message:"正文过长,预览只渲染了前 ".concat((null!=p?p:0).toLocaleString()," 字(共 ").concat((null!=u?u:0).toLocaleString()," 字)"),description:"后续内容未渲染;导出物是完整正文,不受预览截断影响。"}),D.length>0&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"info",showIcon:!0,message:"预览已对内容做安全处置(与导出物可能存在差异)",description:(0,r.jsx)("div",{style:{fontSize:12,lineHeight:1.7},children:D.map(e=>(0,r.jsxs)("div",{children:["\xb7 ",e]},e))})}),j&&(0,r.jsxs)(m.A,{align:"center",size:8,children:[(0,r.jsx)(h.A,{size:"small"}),(0,r.jsx)(I,{type:"secondary",children:"正在取回成稿预览(服务端渲染 + 清洗)…"})]}),!j&&A&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"error",showIcon:!0,message:"取回成稿预览失败",description:(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(I,{style:{fontSize:12},children:A}),b&&(0,r.jsx)(x.Ay,{size:"small",onClick:b,children:"重新取回"})]})}),!j&&!A&&!L&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"info",showIcon:!0,message:"这条记录还没有可预览的正文",description:"生成完成后这里会显示成稿全文;生成中的记录只有节点日志(见画布),没有正文可预览。"}),!A&&L&&(0,r.jsxs)("div",{className:"deliverablePreviewPaper",children:[(0,r.jsx)("article",{className:"deliverablePreviewBody","aria-label":"成稿预览正文",dangerouslySetInnerHTML:{__html:T}}),(0,r.jsxs)("div",{className:"deliverablePreviewEnd",children:[(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:d?"正文到此为止(预览有截断,见上方提示;导出物是完整正文)":p&&p>0?"正文到此为止:以上是本记录的全部正文,共 ".concat(p.toLocaleString()," 字(未截断)"):"正文到此为止:以上是本记录的全部正文(未截断)"}),y&&!y.passed&&(0,r.jsx)(I,{style:{fontSize:12,color:"var(--colorWarning)"},children:"交付门禁未通过(阻断 ".concat(y.blockingCount," 项)——正文在这里结束并不代表成稿完整,缺什么见上方的阻断项清单。")})]})]}),!A&&L&&(0,r.jsx)(S,{type:"secondary",style:{fontSize:12,marginBottom:0,textAlign:"center"},children:"预览为服务端渲染结果;排版细节(字体、页眉页脚、分页)以导出物为准。"})]})})}let R=new Set(["prepare","understand","plan","blueprint"]),N=new Set(["close","deliver"]),E=new Set(["chapter","write"]);function M(e,t){let n=new Map;for(let t of e){if(void 0===t.parentId)continue;let e=n.get(t.parentId);e?e.push(t.id):n.set(t.parentId,[t.id])}let r=new Set([t]),l=[t],i=[];for(;l.length>0;){var a;let e=l.shift();for(let t of(i.push(e),null!=(a=n.get(e))?a:[]))r.has(t)||(r.add(t),l.push(t))}return i}function T(e,t){var n;let r=new Map(e.map(e=>[e.id,e])),l=r.get(t);if(!l)return;let i=M(e,t),a=e.map(e=>e.id).sort();if(R.has(l.type))return{targetNodeId:t,kind:"contaminated",affectedNodeIds:a,reason:"".concat(l.type," 承载事实 / 命名 / 标题指纹 → 11.1:跨文档污染,**不可回滚**(要么回滚,要么重新校准)"),escalate:a.length>5,rollbackable:!1};let o=(n=l.type).split(".")[0]||n;if(N.has(l.type)||N.has(o))return{targetNodeId:t,kind:"propagated",affectedNodeIds:a,reason:"".concat(l.type," 属全篇收口 / 交付层 → 预算守恒与全量判据复检波及整篇(11.1)"),escalate:a.length>5,rollbackable:!0};if(E.has(l.type)||"round"===o){let n=function(e,t,n){let r=new Set([t]),l=e.get(t);for(;l;){if(n(l))return l;let t=l.parentId;if(void 0===t||r.has(t))break;r.add(t),l=e.get(t)}}(r,t,e=>E.has(e.type)),i=n?M(e,n.id):a;return{targetNodeId:t,kind:"propagated",affectedNodeIds:i,reason:n?"".concat(l.type," 在章级锚点「").concat(n.title||n.id,"」内 → 跨章数值一致性 / 复读 / 依据对账(11.1)波及同章其余部分"):"".concat(l.type," 无章级锚点 → 按整篇保守估算(11.1)"),escalate:i.length>5,rollbackable:!0}}return{targetNodeId:t,kind:"local",affectedNodeIds:i,reason:"".concat(l.type," 属定点补丁层(11.5:确定性处理节点)→ 影响面限自身子树"),escalate:i.length>5,rollbackable:!0}}function L(e){let t=Math.max(18,Math.abs(e.y2-e.y1)/2);return"M ".concat(e.x1," ").concat(e.y1," C ").concat(e.x1," ").concat(e.y1+t,", ").concat(e.x2," ").concat(e.y2-t,", ").concat(e.x2," ").concat(e.y2)}let D={default:"canvasEdge",active:"canvasEdge canvasEdgeActive",warn:"canvasEdge canvasEdgeWarn",affected:"canvasEdge canvasEdgeAffected"},P={default:"url(#canvasArrow)",active:"url(#canvasArrowActive)",warn:"url(#canvasArrowWarn)",affected:"url(#canvasArrow)"};function B(e){let{edge:t,tone:n="default"}=e;return(0,r.jsx)("path",{className:D[n],d:L(t),markerEnd:P[n],"data-edge":"".concat(t.fromId,"->").concat(t.toId)})}function q(e){let{edges:t,width:n,height:l,toneOf:i,flowing:a,style:o}=e;return(0,r.jsxs)("svg",{className:"canvasEdgeLayer",width:Math.max(1,n),height:Math.max(1,l),viewBox:"0 0 ".concat(Math.max(1,n)," ").concat(Math.max(1,l)),"aria-hidden":"true",focusable:"false",style:o,children:[(0,r.jsxs)("defs",{children:[(0,r.jsx)("marker",{id:"canvasArrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:(0,r.jsx)("path",{d:"M0,0 L8,4 L0,8 z",fill:"var(--canvasEdge)"})}),(0,r.jsx)("marker",{id:"canvasArrowActive",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:(0,r.jsx)("path",{d:"M0,0 L8,4 L0,8 z",fill:"var(--canvasEdgeActive)"})}),(0,r.jsx)("marker",{id:"canvasArrowWarn",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:(0,r.jsx)("path",{d:"M0,0 L8,4 L0,8 z",fill:"var(--canvasEdgeWarn)"})})]}),t.map(e=>{var t;return(0,r.jsxs)("g",{children:[(0,r.jsx)(B,{edge:e,tone:null!=(t=null==i?void 0:i(e))?t:"default"}),(null==a?void 0:a.has(e.id))&&(0,r.jsx)("path",{className:"canvasEdgeFlow",d:L(e),"data-flow":"".concat(e.fromId,"->").concat(e.toId)})]},e.id)})]})}let H=new Set(["completed","failed","skipped"]),_=[{key:"chars",unit:" 字"},{key:"words",unit:" 字"},{key:"noteChars",unit:" 字"},{key:"turn",unit:" 轮",prefix:"第 "},{key:"chapters",unit:" 章"},{key:"facts",unit:" 条事实"},{key:"evidence",unit:" 条证据"},{key:"issues",unit:" 个问题"},{key:"toolCalls",unit:" 次工具调用"},{key:"totalFiles",unit:" 份资料"},{key:"totalChunks",unit:" 个切片"},{key:"roundIteration",unit:" 轮修复",prefix:"第 "}];function W(e){var t;let n=null==(t=e.metrics)?void 0:t.note;return"string"==typeof n&&n.trim()?n.trim():void 0}function F(e,t){let{input:n,output:r}=function(e){let t=e=>"string"==typeof e&&e.trim()?e.trim():void 0;return{input:t(e.inputSummary),output:t(e.outputSummary)}}(e);for(let l of"dispatch"===t?[n,W(e),e.title]:[r,W(e),e.title,function(e){var t;let n=null!=(t=e.metrics)?t:{},r=[];for(let{key:e,unit:t,prefix:l}of _){let i=n[e];if(("number"==typeof i||"string"==typeof i)&&""!==i&&0!==i&&(r.push("".concat(null!=l?l:"").concat("number"==typeof i?i.toLocaleString():i).concat(t)),2===r.length))break}return r.length>0?r.join(" \xb7 "):void 0}(e)])if(l&&l.trim())return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=e.replace(/\s+/gu," ").trim();return n.length>t?"".concat(n.slice(0,t-1),"…"):n}(l)}function U(e){let{bubbles:t,layout:n,static:l=!1}=e;return 0===t.length?null:(0,r.jsx)("div",{className:"canvasBubbleLayer",style:{width:Math.max(1,n.width),height:Math.max(1,n.height)},"aria-hidden":"true",children:t.map(e=>{let t=function(e,t){let n=t.edges.find(t=>t.fromId===e.fromId&&t.toId===e.toId);if(n)return L(n);let r=t.edges.find(t=>t.fromId===e.toId&&t.toId===e.fromId);return r?function(e){let t=L(e),n=/^M ([\d.-]+) ([\d.-]+) C ([\d.-]+) ([\d.-]+), ([\d.-]+) ([\d.-]+), ([\d.-]+) ([\d.-]+)$/u.exec(t);if(!n)return t;let[,r,l,i,a,o,s,c,d]=n;return"M ".concat(c," ").concat(d," C ").concat(o," ").concat(s,", ").concat(i," ").concat(a,", ").concat(r," ").concat(l)}(r):null}(e,n);return t?(0,r.jsx)("div",{className:l?"canvasBubble canvasBubbleStatic":"canvasBubble","data-kind":e.kind,"data-from":e.fromId,"data-to":e.toId,style:{offsetPath:'path("'.concat(t,'")'),offsetRotate:"0deg",animationDuration:"".concat(1500,"ms")},children:(0,r.jsx)("span",{className:"canvasBubbleBody",children:(0,r.jsx)("span",{className:"canvasBubbleText",children:e.label})})},e.id):null})})}var G=n(94394);function O(e){return"stage-details"===e.source}let Q=new Set(["running","repairing"]),X=new Set(["role_binding","knowledge_retrieval","file_understanding","fact_extraction","chapter_generation","llm_review","validation","reference"]);function V(e){var t;return X.has(e)?null!=(t=G.i_[e])?t:e:(0,w.z9)(e)}function J(e,t){var n;let r=null==(n=e.metrics)?void 0:n[t];return"string"==typeof r&&r.trim()?r.trim():void 0}function Y(e,t,n){var r;let l=function(e){var t;let n=null==(t=e.metrics)?void 0:t.stageType;return"string"==typeof n&&n.trim()?n.trim():e.type.split(".")[0]||"default"}(e),i=null!=(r=J(e,"stageSubtitle"))?r:J(e,"stageRoleId"),a=J(e,"note");return{id:e.id,kind:l,kindLabel:V(l),...i&&i!==e.title?{role:i}:{},title:e.title||V(l),...a?{activity:a}:{},status:e.status,..."number"==typeof e.startedAt?{startedAt:e.startedAt}:{},..."number"==typeof e.completedAt?{completedAt:e.completedAt}:{},metrics:(0,w.dB)(e.metrics,8),depth:t}}function K(e,t){if("number"==typeof e.startedAt)return Math.max(0,("number"==typeof e.completedAt?e.completedAt:t)-e.startedAt)}var Z=n(46758),$=n(99605);let{Text:ee}=d.A,et=["error","warning","info"],en={error:"#ff4d4f",warning:"#faad14",info:"#1677ff"};function er(e){let{node:t,x:n,y:i,selected:a,affected:o,flashed:s,onSelect:c,onDrag:d,t:u}=e,h=function(e){let t=[],n=[];for(let r of e.issues)(O(r)?n:t).push(r);return{problems:t,details:n,counts:{error:t.filter(e=>"error"===e.level).length,warning:t.filter(e=>"warning"===e.level).length,info:t.filter(e=>"info"===e.level).length}}}(t),p=(0,w.Jy)(t),m=(0,w.O0)(t.metrics,2),x=(0,l.useRef)(null);return(0,l.useEffect)(()=>()=>{var e;null==(e=x.current)||e.call(x)},[]),(0,r.jsxs)("div",{className:"canvasNode".concat(a?" canvasNodeSelected":"").concat(o?" canvasNodeAffected":"").concat(s?" canvasNodeFlashed":""),style:{left:n,top:i,width:w.zT,height:w.EL},role:"button",tabIndex:0,"aria-label":"节点 ".concat(t.title),"data-node-id":t.id,onClick:e=>{e.stopPropagation(),c(t)},onPointerDown:e=>{var n,r;if(0!==e.button||(e.stopPropagation(),!d||(null==(r=e.target)||null==(n=r.closest)?void 0:n.call(r,"button, a, input, textarea"))))return;let l=e.clientX,i=e.clientY,a=e.pointerId,o=!1,s={dx:0,dy:0},c=e=>{e.pointerId===a&&(s={dx:e.clientX-l,dy:e.clientY-i},!o&&4>Math.abs(s.dx)&&4>Math.abs(s.dy)||(o=!0,d(t,s.dx,s.dy,"move")))},u=e=>{if(e.pointerId===a)document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u),x.current=null,o&&(document.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault()},{capture:!0,once:!0}),d(t,s.dx,s.dy,"end"))};document.addEventListener("pointermove",c),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",u),x.current=()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u)}},onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),c(t))},children:[(0,r.jsxs)("div",{className:"canvasNodeHeader",children:[(0,r.jsx)("span",{className:"canvasNodeIcon","data-status":t.status,children:(0,w.kH)(t.type)}),(0,r.jsx)(ee,{ellipsis:!0,style:{flex:1,minWidth:0,fontWeight:600,fontSize:13},title:t.title,children:t.title}),et.map(e=>h.counts[e]>0&&(0,r.jsx)("span",{"data-issue-level":e,style:{flexShrink:0},children:(0,r.jsx)(Z.A,{count:h.counts[e],size:"small",color:en[e]})},e))]}),(0,r.jsxs)("div",{className:"canvasNodeMeta",children:[(0,r.jsx)(v.A,{color:(0,w.uv)(t.status),style:{marginInlineEnd:4},children:(0,w.m_)(t.status,u)}),(0,r.jsx)(ee,{type:"secondary",style:{fontSize:11},ellipsis:!0,children:(0,w.z9)(t.type)})]}),t.progress&&t.progress.total>0?(0,r.jsx)($.A,{percent:Math.round(t.progress.current/t.progress.total*100),size:"small",showInfo:!1,status:"failed"===t.status?"exception":"completed"===t.status?"success":"active",style:{marginBottom:0}}):(0,r.jsxs)("div",{className:"canvasNodeMetrics",children:[m.map(e=>(0,r.jsx)(ee,{type:"secondary",style:{fontSize:11},ellipsis:!0,children:e},e)),0===m.length&&(0,r.jsx)(ee,{type:"secondary",style:{fontSize:11},children:(0,w.uH)(p)})]})]})}var el=n(14932),ei=n(57271),ea=n(55122),eo=n(32965),es=n(99271),ec=n(37510),ed=n(48156),eu=n(63046),eh=n(64068),ep=n(76830),em=n(83914);function ex(e){let{updatedAt:t,running:n}=e,[i,a]=(0,l.useState)(()=>Date.now());if((0,l.useEffect)(()=>{if(!n)return;let e=setInterval(()=>a(Date.now()),5e3);return()=>clearInterval(e)},[n]),!n||!t)return null;let o=Math.max(0,i-t);return o<=9e4?(0,r.jsx)(el.A,{title:"记录每 30 秒刷新一次(最近一次 ".concat(new Date(t).toLocaleTimeString(),")——长阶段里画布可能几分钟没有新节点,这个信号说明进程还在跑"),children:(0,r.jsxs)(v.A,{color:"processing",children:["心跳 ",Math.round(o/1e3)," 秒前"]})}):(0,r.jsx)(el.A,{title:"最后一次进度写入是 ".concat(new Date(t).toLocaleTimeString(),"——超过 ").concat(Math.round(1.5)," 分钟没有动静,进程可能已退出(可「继续生成」续跑)"),children:(0,r.jsxs)(v.A,{color:"warning",children:["心跳已停 ",Math.floor(o/6e4)," 分钟"]})})}function eg(e){let{startedAt:t,endedAt:n,running:i}=e,[a,o]=(0,l.useState)(()=>Date.now());if((0,l.useEffect)(()=>{if(!i)return;let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[i]),!t)return null;let s=Math.max(0,(i?a:null!=n?n:a)-t);return(0,r.jsx)(el.A,{title:"本轮生成的整体耗时(自 ".concat(new Date(t).toLocaleTimeString()," 起").concat(i?"":",已结束",")"),children:(0,r.jsx)(v.A,{color:"default",children:"耗时 ".concat((0,w.uH)(s))})})}var ev=n(55897),ef=n(49075),ey=n(84742);let{Text:ej}=d.A;function eA(e){var t;let{row:n,now:l,onLocate:i}=e;return(0,r.jsxs)("div",{className:"canvasAgentDetail","data-node-id":n.id,children:[(0,r.jsxs)("div",{className:"canvasAgentDetailHead",children:[(0,r.jsx)("span",{className:"canvasAgentIcon","data-status":n.status,children:(0,w.Qs)(n.kind)}),(0,r.jsx)(ej,{strong:!0,style:{fontSize:12},children:n.kindLabel}),n.role&&(0,r.jsxs)(ej,{type:"secondary",style:{fontSize:12},children:["\xb7 ",n.role]})]}),(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"在干什么"}),(0,r.jsx)(ej,{style:{fontSize:12},children:null!=(t=n.activity)?t:n.title})]}),n.activity&&n.title&&n.activity!==n.title&&(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"对象"}),(0,r.jsx)(ej,{style:{fontSize:12},children:n.title})]}),(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:n.completedAt?"耗时":"已跑"}),(0,r.jsx)(ej,{style:{fontSize:12},children:(0,w.uH)(K(n,l))})]}),n.metrics.length>0&&(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"指标"}),(0,r.jsx)(ej,{style:{fontSize:12},children:n.metrics.map(e=>e.text).join(" \xb7 ")})]}),(0,r.jsxs)("button",{type:"button",className:"canvasAgentLocate",onClick:()=>i(n.id),title:"在画布上定位到这条节点",children:[(0,r.jsx)(ef.A,{})," 定位到节点"]})]})}function eb(e){return e.some(e=>"failed"===e.status)?"repairing":"completed"}function ew(e){let{view:t,running:n,onLocate:i,decisions:a=[],active:o=!1}=e,[s,c]=(0,l.useState)(()=>Date.now());if((0,l.useEffect)(()=>{if(!n)return;let e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[n]),0===t.runningTotal&&0===t.recentTotal&&0===a.length&&!o)return null;let d=t.runningTotal-t.running.length;return(0,r.jsxs)(m.A,{size:4,align:"center",wrap:!0,"data-agents":t.runningTotal,className:"canvasAgentsChips",children:[(0,r.jsx)(el.A,{title:"本稿此刻在调度哪些智能体(点图标看在干什么)",children:(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"智能体调度中心"})}),(o||a.length>0)&&(0,r.jsx)(ev.A,{trigger:"click",placement:"bottomLeft",content:(0,r.jsx)("div",{className:"canvasAgentDetail",children:0===a.length?(0,r.jsx)("div",{className:"canvasAgentDetailRow",children:(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"尚无来源或任务裁决回执。主智能体负责施工部署、来源与工况核定及作者协调;当前执行进度见运行节点。"})}):a.map(e=>{var t;return(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:e.action}),(0,r.jsx)(ej,{style:{fontSize:12},children:null!=(t=e.note)?t:e.title})]},e.id)})}),children:(0,r.jsxs)("button",{type:"button",className:"canvasAgentChip canvasAgentChipMain","data-kind":"supervisor","data-status":eb(a),title:"主智能体:核定施工部署、裁决来源与工况、协调作者任务和交付",children:[(0,r.jsx)("span",{className:"canvasAgentAvatar","data-status":eb(a),children:(0,r.jsx)("span",{className:"canvasAgentAvatarGlyph",children:(0,w.Qs)("supervisor")})}),(0,r.jsx)("span",{className:"canvasAgentRole","data-role":"main",children:"主"})]})}),t.running.map(e=>{var t;return(0,r.jsx)(ev.A,{trigger:"click",placement:"bottomLeft",content:(0,r.jsx)(eA,{row:e,now:s,onLocate:i}),children:(0,r.jsxs)("button",{type:"button",className:"canvasAgentChip","data-node-id":e.id,"data-kind":e.kind,"data-status":e.status,title:"".concat(e.kindLabel).concat(e.role?" \xb7 ".concat(e.role):"",":").concat(null!=(t=e.activity)?t:e.title),children:[(0,r.jsx)("span",{className:"canvasAgentAvatar","data-status":e.status,children:(0,r.jsx)("span",{className:"canvasAgentAvatarGlyph",children:(0,w.Qs)(e.kind)})}),(0,r.jsx)("span",{className:"canvasAgentRole","data-role":"sub",title:"子智能体(执行具体环节)",children:"子"})]})},e.id)}),d>0&&(0,r.jsx)(el.A,{title:"另有 ".concat(d," 个在跑(画布上可逐个查看)"),children:(0,r.jsxs)(ej,{type:"secondary",style:{fontSize:12},children:["+",d]})}),t.recent.length>0&&(0,r.jsx)(el.A,{title:t.recent.map(e=>"".concat(e.kindLabel,":").concat(e.title,"(已完成)")).join("\n"),children:(0,r.jsxs)(ej,{type:"secondary",style:{fontSize:12},children:[(0,r.jsx)(ey.A,{})," 刚完成 ",t.recentTotal]})})]})}var ek=n(34052),eS=n(84253),eI=n(96538);function eC(e){let{reports:t,deliveryReadings:n,t:i}=e,[a,o]=(0,l.useState)(!1),s=(e,t)=>{let n=null==i?void 0:i(e);return n&&n!==e?n:t},c=(0,l.useSyncExternalStore)(j.p5,j.dH,j.dH),d=c?function(e,t){var n,r;let{receipt:l}=e,i=(e,n,r,l)=>t(e,n).replace("{count}",String(r))+(l?":".concat(l):""),a=[];"review"===l.exportPurpose&&a.push({key:"review-purpose",tone:"info",text:"审阅稿:验收结论保持原状态,独立问题报告与正文版本绑定"}),l.issuesReport&&a.push({key:"review-report",tone:"info",text:"独立问题报告:".concat(l.issuesReport.id.slice(0,12),";正文 SHA256:").concat(l.issuesReport.bodySha256)}),"mismatch"===l.gateBinding?a.push({key:"binding-mismatch",tone:"error",text:t("records.receiptBindingMismatch","正文与门禁指纹不匹配:放行依据不是这份正文(收口后被编辑/替换过)")}):"absent"===l.gateBinding&&a.push({key:"binding-absent",tone:"warning",text:t("records.receiptBindingAbsent","门禁未绑定正文指纹:无法核对放行依据是否就是这份正文")}),l.gateIssues&&l.gateIssues.length>0&&a.push({key:"gate-issues",tone:"error",text:i("records.receiptGateIssues","门禁阻断清单 {count} 项",l.gateIssues.length,l.gateIssues[0])}),l.contentIssues&&l.contentIssues.length>0&&a.push({key:"content-issues",tone:"warning",text:i("records.receiptContentIssues","内容问题 {count} 条",l.contentIssues.length,l.contentIssues[0])});let o=null!=(r=null==(n=l.figureInline)?void 0:n.failed)?r:[];return o.length>0&&a.push({key:"figure-inline",tone:"warning",text:i("records.receiptFigureFailures","图件未内联 {count} 张",o.length,o[0])}),l.renderAudit&&l.renderAudit.blockerCount>0&&a.push({key:"render-blockers",tone:"error",text:i("records.receiptRenderBlockers","渲染审计:源层结构缺陷 {count} 项",l.renderAudit.blockerCount)}),l.renderAudit&&l.renderAudit.notices.length>0&&a.push({key:"render-notices",tone:"warning",text:i("records.receiptRenderNotices","渲染审计告警 {count} 条",l.renderAudit.notices.length,l.renderAudit.notices[0])}),l.templateWarning&&a.push({key:"template-warning",tone:"warning",text:"".concat(t("records.receiptTemplateWarning","模板占位符缺失,已回退:")).concat(l.templateWarning)}),l.pageLimit&&a.push({key:"page-limit",tone:"warning",text:l.pageLimit}),"number"==typeof l.pdfPageCount&&a.push({key:"pdf-pages",tone:"info",text:t("records.receiptPdfPages","PDF 共 {count} 页").replace("{count}",String(l.pdfPageCount))}),a}(c,s):[],u=d.filter(e=>"info"!==e.tone),h=d.length>0;if(0===t.length&&!n&&0===u.length&&!(null==c?void 0:c.receipt.issuesReport)&&(null==c?void 0:c.receipt.exportPurpose)!=="review")return null;let p=[...t].sort((e,t)=>t.exportedAt-e.exportedAt),m=p.find(e=>{var t,n;return(null!=(n=null==(t=e.gateChecklist)?void 0:t.items.length)?n:0)>0});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(el.A,{title:s("records.reportTitle","导出闭环报告"),children:(0,r.jsxs)(x.Ay,{size:"small",icon:(0,r.jsx)(ep.A,{}),onClick:()=>o(!0),children:[(null==n?void 0:n.contractQuality)?"七维诊断".concat(n.contractQualityStale?"(历史)":n.contractQuality.score.deliveryReady?"(待验收)":"(待修验)"):s("records.reportEntry","导出报告"),t.length>0&&(0,r.jsx)("span",{className:"ml-1 text-[var(--colorTextTertiary)]",children:t.length}),u.length>0&&(0,r.jsx)(v.A,{color:u.some(e=>"error"===e.tone)?"error":"warning",className:"m-0 ml-1 border-0",children:s("records.receiptBadge","本次导出 {count} 项提醒").replace("{count}",String(u.length))})]})}),(0,r.jsxs)(ek.A,{title:s("records.reportTitle","导出闭环报告"),placement:"right",size:"default",open:a,onClose:()=>o(!1),styles:{body:{padding:16}},children:[h&&c&&(0,r.jsxs)("div",{className:"mb-3 rounded-xl border px-3 py-2.5 text-xs ".concat(u.length>0?"border-[var(--colorWarning)] bg-[var(--colorWarningBg)]":"border-[var(--borderColor)] bg-[var(--colorFillAlter)]"),children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"font-semibold",children:s("records.receiptTitle","最近一次导出回执")}),(0,r.jsx)(v.A,{color:"blue",className:"m-0 border-0 font-semibold",children:c.format.toUpperCase()}),(0,r.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:new Date(c.at).toLocaleString()}),c.filename&&(0,r.jsx)("span",{className:"break-all text-[var(--colorTextTertiary)]",children:c.filename})]}),c.receipt.issuesReport&&(0,r.jsx)("a",{className:"text-[var(--colorPrimary)] underline",href:(0,j.Es)(c,c.receipt.issuesReport),children:"下载本份正文的独立问题报告"}),(0,r.jsx)("div",{className:"mt-2 flex flex-col gap-1.5",children:d.map(e=>(0,r.jsx)("div",{className:"error"===e.tone?"text-[var(--colorError)]":"warning"===e.tone?"text-[var(--colorWarning)]":"text-[var(--colorTextSecondary)]",children:e.text},e.key))})]}),n&&(0,r.jsxs)("div",{className:"mb-3 flex flex-col gap-2 rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5 text-xs",children:[n.contractQuality&&(0,r.jsx)(k,{readings:n}),n.netChars&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:s("records.netCharsLabel","修复链净增字数")}),(0,r.jsxs)("span",{className:"font-semibold",children:[n.netChars.delta>0?"+":"",n.netChars.delta]}),(0,r.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["(",n.netChars.before," → ",n.netChars.after,",",s("records.netCharsRatio","占原稿")," ",(100*n.netChars.ratio).toFixed(1),"%)"]}),n.netChars.ratio>.05&&(0,r.jsx)(el.A,{title:s("records.netCharsWarn",'目标 ≤5%:净增越大,"分是修出来的"成分越高——首过写作的缺口被修复链补上了'),children:(0,r.jsx)(v.A,{color:"warning",className:"m-0 border-0",children:s("records.netCharsOver","超目标")})})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:s("records.reviewReportLabel","交付三件套报告")}),(0,r.jsx)("a",{href:"/api/documents/generated/".concat(encodeURIComponent(n.docId),"/report").concat(n.projectRoot?"?projectRoot=".concat(encodeURIComponent(n.projectRoot),"&download=1"):"?download=1"),className:"text-[var(--colorPrimary)] underline",children:s("records.reviewReportDownload","下载 .md")}),(0,r.jsx)("a",{href:"/api/documents/generated/".concat(encodeURIComponent(n.docId),"/report").concat(n.projectRoot?"?projectRoot=".concat(encodeURIComponent(n.projectRoot)):""),target:"_blank",rel:"noreferrer",className:"text-[var(--colorPrimary)] underline",children:s("records.reviewReportView","在线查看")}),(0,r.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:s("records.reviewReportHint","未跑到终门禁的记录没有报告(打开会说明原因)")})]})]}),0===p.length?(0,r.jsx)(eS.A,{image:eS.A.PRESENTED_IMAGE_SIMPLE,description:s("records.reportEmpty","还没有导出记录")}):(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[p.map((e,t)=>(0,r.jsxs)("div",{className:"rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5 text-xs",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(v.A,{color:"blue",className:"m-0 border-0 font-semibold",children:e.format.toUpperCase()}),(0,r.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:new Date(e.exportedAt).toLocaleString()}),"review"===e.exportPurpose&&(0,r.jsx)(v.A,{children:"审阅稿"}),e.reviewReport&&(0,r.jsx)("a",{className:"text-[var(--colorPrimary)] underline",href:(0,j.Es)({documentId:null==n?void 0:n.docId,projectRoot:null==n?void 0:n.projectRoot},e.reviewReport),children:"下载独立问题报告"})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[var(--colorTextSecondary)]",children:[void 0!==e.durationMs&&(0,r.jsxs)("span",{children:[s("records.reportDuration","总用时")," ",(0,eI.a)(e.durationMs,{unit:"ms",style:"fine-decimal"})]}),void 0!==e.repairedCount&&(0,r.jsxs)("span",{children:[s("records.reportRepaired","修复")," ",e.repairedCount,void 0!==e.blockingCount?"(".concat(s("records.reportBlocking","质量诊断快照阻断")," ").concat(e.blockingCount,")"):""]}),e.ruleSummary&&e.ruleSummary.length>0&&(0,r.jsxs)("span",{children:[s("records.reportRules","规则")," ",e.ruleSummary.length]}),!1===e.gatePassed&&(0,r.jsxs)(v.A,{color:"error",className:"m-0 border-0",children:[s("records.reportGateBlocked","非交付物"),void 0!==e.gateIssueCount&&e.gateIssueCount>0?" \xb7 ".concat(s("records.reportGateBlockedCount","门禁阻断")," ").concat(e.gateIssueCount," ").concat(s("records.reportGateBlockedUnit","项")):" \xb7 ".concat(s("records.reportGateBlockedUnknown","阻断数未记录(清单缺失)"))]}),e.healthAlerts&&e.healthAlerts.length>0&&(0,r.jsxs)(v.A,{color:"warning",className:"m-0 border-0",children:[s("records.reportHealthAlerts","健康告警")," ",e.healthAlerts.length]})]})]},"".concat(e.exportedAt,"-").concat(t))),(null==m?void 0:m.gateChecklist)&&(0,r.jsxs)("div",{className:"rounded-xl border border-[var(--colorWarning)] bg-[var(--colorWarningBg)] px-3 py-2.5",children:[(0,r.jsxs)("div",{className:"text-xs font-semibold text-[var(--colorWarning)]",children:[s("records.reportChecklistTitle","最近一次非交付物导出的未收敛项"),"(",s("records.reportChecklistTotal","共 {count} 项").replace("{count}",String(m.gateChecklist.total)),")"]}),(0,r.jsx)("div",{className:"mt-2 flex flex-col gap-2",children:m.gateChecklist.items.map(e=>(0,r.jsxs)("div",{className:"text-xs",children:[(0,r.jsx)("div",{className:"whitespace-pre-wrap text-[var(--colorText)]",children:"".concat(e.index,".【").concat(e.category,"】").concat(e.problem)}),(0,r.jsxs)("div",{className:"text-[var(--colorTextSecondary)]",children:[e.repairPath,e.detectorId?"|".concat(e.detectorId):""]})]},e.index))})]})]})]})]})}let{Text:ez}=d.A,eR={connecting:{text:"通道连接中",color:"default"},open:{text:"事件通道已连",color:"success"},error:{text:"通道已断(改用增量补差)",color:"warning"},closed:{text:"通道已关闭",color:"default"}};function eN(e){let{title:t,status:n,updatedAt:l,wordCount:i,nodeCount:a,visibleCount:o,hiddenCount:s,degraded:c,skills:d,gate:u,connection:h,lastSeq:p,zoom:g,depth:j,following:A,followStatus:b,generating:k,resumable:S,exporting:I,nonDeliverableExport:C,onZoomIn:z,onZoomOut:R,onZoomReset:N,onFit:E,onDepthChange:M,onToggleFollow:T,onContinue:L,onPause:D,onResume:P,onAbort:B,onExport:q,exportReports:H,deliveryReadings:_,previewOpen:W,onTogglePreview:F,hasNodeOffsets:U,onResetNodeLayout:G,agents:O,onLocateAgent:Q,supervisorDecisions:X,agentsActive:V,startedAt:J,t:Y}=e,K=k&&!S,Z=(0,r.jsxs)("div",{style:{fontSize:12,lineHeight:1.7},children:[(0,r.jsx)("div",{children:"导出当前真实正文供审阅,并下载独立问题报告;不会自动补齐缺章或签发交付验收。"}),(0,r.jsx)("div",{children:"审阅身份标在文件名和回执中,正文不添加诊断、封面或水印。"})]});return(0,r.jsxs)("div",{className:"canvasToolbar",children:[(0,r.jsxs)(m.A,{wrap:!0,size:8,align:"center",style:{flex:1,minWidth:0},children:[(0,r.jsx)(ez,{strong:!0,style:{fontSize:14},ellipsis:!0,title:t,children:t}),n&&(0,r.jsx)(v.A,{color:(0,w.uj)(n),children:(0,w.GC)(n,Y)}),(0,r.jsxs)(ez,{type:"secondary",style:{fontSize:12},children:[void 0!==i?"".concat(i.toLocaleString()," 字"):""," 已接收 ".concat(a," 个节点,显示 ").concat(o," 个"),s>0?"(未显示 ".concat(s,")"):"",l?" 更新于 ".concat(new Date(l).toLocaleTimeString()):""]}),(0,r.jsx)(ex,{updatedAt:l,running:K}),(0,r.jsx)(eg,{startedAt:J,endedAt:l,running:K}),O&&(0,r.jsx)(ew,{view:O,running:O.runningTotal>0,onLocate:null!=Q?Q:()=>{},...X?{decisions:X}:{},active:!!V}),(0,r.jsx)(el.A,{title:"通道游标 seq=".concat(null!=p?p:0,"(断线重连用它补发;节点增量用日志时间 t)"),children:(0,r.jsx)(v.A,{color:eR[h].color,children:eR[h].text})}),d.hits.length>0&&(0,r.jsx)(el.A,{title:d.hits.map(e=>"".concat(e.title,"(").concat(e.skillId,")")).join("、"),children:(0,r.jsxs)(v.A,{color:"blue",children:["技能命中 ",d.hits.length]})}),u&&(0,r.jsx)(el.A,{title:u.issues.length>0?u.issues.join("\n"):"服务端门禁结论:通过",children:(0,r.jsx)(v.A,{color:u.passed?"success":"error",children:u.passed?"门禁:通过":"门禁:阻断 ".concat(u.blockingCount," 项")})})]}),(0,r.jsxs)(m.A,{wrap:!0,size:6,align:"center",children:[(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(es.A,{}),onClick:R,"aria-label":"缩小"}),(0,r.jsxs)(ez,{type:"secondary",style:{fontSize:12,width:44,textAlign:"center"},children:[Math.round(100*g),"%"]}),(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(ec.A,{}),onClick:z,"aria-label":"放大"}),(0,r.jsx)(el.A,{title:"恢复到 100% 并回到原点",children:(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(y.A,{}),onClick:N,"aria-label":"重置视图"})}),(0,r.jsx)(el.A,{title:U?"把拖过的节点放回自动排布(手工摆放的是**偏移**,清空即恢复)":"没有手工拖过的节点:布局就是自动排布的",children:(0,r.jsx)(x.Ay,{size:"small",disabled:!U,onClick:G,children:"恢复布局"})}),(0,r.jsx)(el.A,{title:"适应窗口(按内容包围盒缩放)",children:(0,r.jsx)(x.Ay,{size:"small",onClick:E,children:"适应"})}),(0,r.jsx)(ei.A,{size:"small",value:j,style:{width:108},onChange:e=>M(e),options:[{value:1,label:"只看 1 层"},{value:2,label:"看 2 层"},{value:3,label:"看 3 层"},{value:"all",label:"全部层"}]}),(0,r.jsx)(el.A,{title:null!=b?b:"跟随最新:生成中新出现的节点自动定位(关掉就不再打扰你的视角)",children:(0,r.jsx)(x.Ay,{size:"small",type:A?"primary":"default",onClick:T,children:A?(null==b?void 0:b.startsWith("跟随暂停"))?"跟随暂停中":"跟随中":"跟随最新"})}),(0,r.jsx)(ea.A,{type:"vertical"}),K&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(el.A,{title:"立即取消模型调用并保存已完成正文,停稳后可继续",children:(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(ed.A,{}),onClick:D,children:"暂停"})}),(0,r.jsx)(eo.A,{title:"中止生成",description:"确定中止本次生成?已生成的章节会保留,可从中断处继续。",okText:"中止",cancelText:"取消",okButtonProps:{danger:!0},onConfirm:B,children:(0,r.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(eu.A,{}),children:"中止"})})]}),!K&&S&&(0,r.jsx)(x.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(eh.A,{}),onClick:L,children:"继续生成"}),!K&&!S&&"paused"===n&&(0,r.jsx)(x.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(eh.A,{}),onClick:P,children:"从暂停处继续"}),(0,r.jsx)(ea.A,{type:"vertical"}),(0,r.jsx)(el.A,{title:Z,children:(0,r.jsxs)(m.A,{size:4,children:[(0,r.jsx)(ez,{type:"secondary",children:"审阅导出"}),[{key:"markdown",label:"MD"},{key:"html",label:"HTML"},{key:"docx",label:"DOCX"},{key:"pdf",label:"PDF",primary:!0}].map(e=>(0,r.jsx)(x.Ay,{size:"small",type:e.primary?"primary":"default",icon:"markdown"===e.key?(0,r.jsx)(ep.A,{}):void 0,loading:I===e.key,disabled:null!==I&&I!==e.key,onClick:()=>q(e.key),children:e.label},e.key))]})}),(0,r.jsx)(eC,{reports:null!=H?H:[],..._?{deliveryReadings:_}:{},...Y?{t:Y}:{}}),(0,r.jsx)(el.A,{title:"成稿预览(服务端渲染并清洗后的全文;只读,不提供导出)",children:(0,r.jsx)(x.Ay,{size:"small",type:W?"primary":"default",onClick:F,children:"成稿预览"})})]}),C&&(0,r.jsx)(f.A,{style:{width:"100%",marginTop:8},type:"info",showIcon:!0,message:"已导出审阅稿与独立问题报告",description:(0,r.jsxs)("div",{style:{whiteSpace:"pre-wrap",fontSize:12},children:[(0,r.jsx)("div",{children:"正文保留实际内容;审阅导出不代表交付验收通过。"}),C.count>0&&(0,r.jsxs)("div",{style:{marginTop:4},children:["阻断项(".concat(C.count,"):"),C.issues.slice(0,5).map((e,t)=>(0,r.jsxs)("div",{children:["\xb7 ",e]},t)),C.count>5&&(0,r.jsx)("div",{children:"…还有 ".concat(C.count-5," 项")})]})]})}),c.length>0&&(0,r.jsx)(f.A,{style:{width:"100%",marginTop:8},type:"warning",showIcon:!0,message:"画布显示有取整(下列内容本次未下发;聚合值与节点信息不受影响)",description:(0,r.jsx)("div",{style:{fontSize:12},children:c.map((e,t)=>(0,r.jsxs)("div",{children:["\xb7 ",e]},t))})}),0===a&&k&&(0,r.jsx)(f.A,{style:{width:"100%",marginTop:8},type:"info",showIcon:!0,icon:(0,r.jsx)(em.A,{}),message:"还没有节点日志:生成侧尚未写入第一个节点(节点日志是唯一真相源,画布不伪造占位节点)"})]})}var eE=n(57481),eM=n(28629),eT=n(52057),eL=n(8665),eD=n(38332),eP=n(7576),eB=n(58569),eq=n(76506),eH=n(45042);let{Paragraph:e_,Text:eW}=d.A,eF={local:{text:"影响面:局部",color:"blue",hint:"改动只落在该节点自身子树:定点补丁即可。"},propagated:{text:"影响面:传播",color:"orange",hint:'改动会沿依赖传播到同章其余部分:按 11.1,走"变更传播"而不是重跑整个节点。'},contaminated:{text:"影响面:事实/命名类",color:"red",hint:"该节点持有事实 / 命名 / 标题指纹:按 11.1,**要么回滚、要么重新校准**,不能当普通改动提交。"}},eU={error:{color:"red",text:"错误"},warning:{color:"orange",text:"警告"},info:{color:"blue",text:"提示"}};function eG(e){var t,n,i,a,o,s,c,d,u,h,p;let{node:g,impact:f,flatNodes:y,highlighted:j,generating:A,repairPreview:b,onFocusNode:k,onRequestRepair:S,onClose:I,onDraftRepairNote:C,onCancelRepairPreview:z,onMention:R,onLocate:N,onPause:E,onResume:M,nodeEvents:T,t:L,onRunRepair:D,onConfirmRepair:P,onRollbackRepair:B,repairRun:q,defaultRepairNote:H}=e,_="skill.load"===g.type||"string"==typeof g.metrics.skillId,W=new Map(y.map(e=>[e.id,e])),F=(0,w.Jy)(g),U=(0,w.dB)(g.metrics,24),G=g.issues.filter(e=>!O(e)),Q=g.issues.filter(e=>O(e)),X=G.filter(e=>"error"===e.level).length,V=f?(0,r.jsxs)(m.A,{direction:"vertical",size:8,style:{width:"100%"},children:[(0,r.jsxs)(m.A,{wrap:!0,children:[(0,r.jsx)(v.A,{color:eF[f.kind].color,children:eF[f.kind].text}),(0,r.jsx)(v.A,{color:f.rollbackable?"default":"red",children:f.rollbackable?"可回滚":"需回滚或重新校准"}),(0,r.jsx)(v.A,{color:f.escalate?"red":"default",children:"波及 ".concat(f.affectedNodeIds.length," 节点").concat(f.escalate?"(超阈值)":"")})]}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:f.reason}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:eF[f.kind].hint}),f.escalate&&(0,r.jsx)(v.A,{color:"red",children:"影响面超出阈值:该改动需**人工确认**后才能提交(自动留痕不再适用)"}),(0,r.jsx)(eD.A,{size:"small",header:(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"波及节点(点击定位)"}),dataSource:f.affectedNodeIds,renderItem:e=>{let t=W.get(e);return(0,r.jsx)(eD.A.Item,{style:{paddingBlock:4},children:(0,r.jsx)(x.Ay,{type:"link",size:"small",style:{padding:0,height:"auto"},onClick:()=>k(e),children:t?"".concat(t.title,"(").concat((0,w.z9)(t.type),")"):"未知节点 ".concat(e)})})}})]}):(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(eS.A,{image:eS.A.PRESENTED_IMAGE_SIMPLE,description:"该节点没有预计算的影响面"}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"聚合接口只对**有问题的节点**与**修复节点**预计算影响面(首屏不做 O(n\xb2))。 这里可以按需触发一次修复请求,服务端会在事务前给出权威判定——**本面板不冒充结论**。"}),(0,r.jsx)(x.Ay,{size:"small",disabled:!S,onClick:()=>null==S?void 0:S(g),children:"按需评估影响面(走修复请求)"})]}),[J,Y]=(0,l.useState)("");(0,l.useEffect)(()=>{Y(null!=H?H:"")},[H,g.id]);let K=b&&b.nodeId===g.id?(0,r.jsx)("div",{className:"nodeInfoRepair",children:(0,r.jsxs)(m.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(eW,{strong:!0,style:{fontSize:13},children:"修复影响面预览"}),(0,r.jsx)(v.A,{color:eF[b.impact.kind].color,children:eF[b.impact.kind].text}),(0,r.jsx)(v.A,{color:b.impact.rollbackable?"default":"red",children:b.impact.rollbackable?"可回滚":"不可回滚"})]}),(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:12},children:["波及 ".concat(b.impact.affectedNodeIds.length," 个节点").concat(b.impact.escalate?",超出阈值需人工确认":"","。"),b.impact.reason]}),!b.impact.rollbackable&&(0,r.jsx)(eW,{style:{fontSize:12,color:"var(--colorError)"},children:"11.1:污染类改动**要么回滚、要么重新校准**,不能当普通改动提交。"}),(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(x.Ay,{size:"small",onClick:C,children:"把修复意图写进输入框"}),(0,r.jsx)(x.Ay,{size:"small",type:"text",onClick:z,children:"收起"})]}),D&&(0,r.jsxs)("div",{className:"nodeInfoRepairRun","data-repair-node":g.id,children:[(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"修复说明(会逐字记进修复请求;服务端按它定位与归因)"}),(0,r.jsx)(eP.A.TextArea,{size:"small",autoSize:{minRows:2,maxRows:4},value:J,onChange:e=>Y(e.target.value),placeholder:"例如:这一节的开挖深度与资料不符,应按图纸标注 5.15m 改写"}),(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(x.Ay,{size:"small",type:"primary",loading:(null==q?void 0:q.phase)==="creating"&&q.nodeId===g.id,disabled:0===J.trim().length,onClick:()=>D(J.trim()),children:"发起修复(@本节点)"}),(null==q?void 0:q.nodeId)===g.id&&"confirmable"===q.phase&&P&&!(q.needsLocalization&&(null!=(o=null==(t=q.candidates)?void 0:t.length)?o:0)>0)&&(0,r.jsx)(x.Ay,{size:"small",danger:!0,onClick:()=>P(),children:"确认执行变更事务"}),(null==q?void 0:q.nodeId)===g.id&&"executed"===q.phase&&q.requestId&&B&&(0,r.jsx)(x.Ay,{size:"small",onClick:B,children:"回滚这次修复"})]}),(null==q?void 0:q.nodeId)===g.id&&"creating"!==q.phase&&(0,r.jsxs)("div",{className:"nodeInfoRepairResult",children:["error"===q.phase&&(0,r.jsx)(eW,{style:{fontSize:12,color:"var(--colorError)"},children:"修复请求未建立:".concat(null!=(s=q.message)?s:"")}),"confirmable"===q.phase&&(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"请求已建立(".concat(null!=(c=q.requestId)?c:"",")").concat(q.attribution?";归因:".concat(q.attribution):"","。")+(q.needsLocalization&&(null!=(d=null==(n=q.candidates)?void 0:n.length)?d:0)>0?"这句话该改哪个节点由你定:下面列出系统定位到的候选,点一个才会执行(缺定位服务端一律拒绝)。":'点「确认执行变更事务」后才会真的改正文——这是"必须人工确认"的落点。')}),"confirmable"===q.phase&&q.needsLocalization&&(null!=(u=null==(i=q.candidates)?void 0:i.length)?u:0)>0&&(0,r.jsx)(m.A,{direction:"vertical",size:4,style:{width:"100%"},children:q.candidates.map(e=>(0,r.jsx)("div",{"data-testid":"repair-location-candidate",children:(0,r.jsxs)(m.A,{size:6,wrap:!0,children:[(0,r.jsx)(v.A,{children:"匹配 ".concat(e.score.toFixed(2))}),(0,r.jsx)(eW,{style:{fontSize:12},children:e.excerpt.slice(0,60)}),P&&(0,r.jsx)(x.Ay,{size:"small",type:"primary",onClick:()=>P(e.nodeId),children:"定位到该节点并执行"})]})},e.nodeId))}),"executed"===q.phase&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(v.A,{color:"applied"===q.outcome?"green":"rolled-back"===q.outcome?"orange":"red",children:"执行结果:".concat(null!=(h=q.outcome)?h:"未执行")}),q.attribution&&(0,r.jsx)(v.A,{children:"归因:".concat(q.attribution)}),void 0!==q.restoredChars&&(0,r.jsx)(v.A,{children:"恢复 ".concat(q.restoredChars," 字")})]}),q.notExecutedReason&&(0,r.jsx)(eW,{style:{fontSize:12,color:"var(--colorError)"},children:q.notExecutedReason})]})]})]})]})}):null;return(0,r.jsxs)("div",{className:"nodeInfoPanel","data-node-id":g.id,children:[(0,r.jsxs)("div",{className:"nodeInfoHeader",children:[(0,r.jsx)("span",{className:"nodeInfoHeaderIcon",children:(0,w.kH)(g.type)}),(0,r.jsx)(eW,{strong:!0,ellipsis:!0,style:{flex:1,minWidth:0,fontSize:14},title:g.title,children:g.title}),g.unknownType&&(0,r.jsx)(v.A,{children:"未知类型"}),(0,r.jsx)(v.A,{color:(0,w.uv)(g.status),children:(0,w.m_)(g.status,L)}),X>0&&(0,r.jsx)(v.A,{color:"red",children:"".concat(X," 个错误")}),A&&"running"===g.status&&(0,r.jsx)(eW,{type:"secondary",style:{fontSize:11},children:"运行中"}),I&&(0,r.jsx)(el.A,{title:"关闭(Esc)",children:(0,r.jsx)(x.Ay,{type:"text",size:"small",className:"nodeInfoClose","aria-label":"关闭信息卡片",onClick:I,children:(0,r.jsx)(eH.A,{})})})]}),(0,r.jsxs)("div",{className:"nodeInfoActions",children:[(0,r.jsx)(x.Ay,{size:"small",onClick:()=>null==R?void 0:R(g),children:"@ 到对话框"}),(0,r.jsx)(x.Ay,{size:"small",onClick:()=>null==N?void 0:N(g),children:"在画布中定位"}),(0,r.jsx)(x.Ay,{size:"small",danger:X>0,onClick:()=>null==S?void 0:S(g),children:"请求修复(预览影响面)"}),A&&"running"===g.status&&E&&(0,r.jsx)(x.Ay,{size:"small",onClick:E,children:"暂停"}),"paused"===g.status&&M&&(0,r.jsx)(x.Ay,{size:"small",onClick:M,children:"继续生成"})]}),K,(0,r.jsx)(eB.A,{size:"small",items:[{key:"overview",label:"概览",children:(0,r.jsxs)(eq.A,{size:"small",column:1,bordered:!0,children:[(0,r.jsx)(eq.A.Item,{label:"状态",children:(0,r.jsx)(v.A,{color:(0,w.uv)(g.status),children:(0,w.m_)(g.status,L)})}),(0,r.jsxs)(eq.A.Item,{label:"类型",children:[(0,w.z9)(g.type),g.unknownType?"(闭集外的类型,按通用卡片渲染)":""]}),(0,r.jsx)(eq.A.Item,{label:"节点 id",children:(0,r.jsx)(e_,{copyable:{text:g.id},style:{margin:0,fontSize:12},children:g.id})}),(0,r.jsx)(eq.A.Item,{label:"稳定序号",children:g.seq}),(0,r.jsx)(eq.A.Item,{label:"父节点",children:g.parentId?(0,r.jsx)(x.Ay,{type:"link",size:"small",style:{padding:0,height:"auto"},onClick:()=>k(g.parentId),children:null!=(p=null==(a=W.get(g.parentId))?void 0:a.title)?p:g.parentId}):"(根节点)"}),(0,r.jsxs)(eq.A.Item,{label:"耗时",children:[(0,w.uH)(F),"running"===g.status?"(运行中)":""]}),(0,r.jsx)(eq.A.Item,{label:"进度",children:g.progress?"".concat(g.progress.label||"进度",":").concat(g.progress.current,"/").concat(g.progress.total):"—"}),(0,r.jsxs)(eq.A.Item,{label:"子节点数",children:[g.children.length,j?"(当前处于影响面高亮)":""]}),(0,r.jsxs)(eq.A.Item,{label:"开始 / 完成",children:[g.startedAt?new Date(g.startedAt).toLocaleString():"—"," / ",g.completedAt?new Date(g.completedAt).toLocaleString():"—"]})]})},{key:"issues",label:"问题".concat(G.length>0?"(".concat(G.length,")"):""),children:0===G.length?(0,r.jsx)(eS.A,{image:eS.A.PRESENTED_IMAGE_SIMPLE,description:"该节点没有记录问题"}):(0,r.jsx)(eD.A,{size:"small",dataSource:G,renderItem:e=>{var t,n;let l=null!=(n=eU[e.level])?n:{color:"default",text:String(e.level)};return(0,r.jsx)(eD.A.Item,{children:(0,r.jsxs)(m.A,{direction:"vertical",size:2,style:{width:"100%"},children:[(0,r.jsxs)(m.A,{wrap:!0,size:4,children:[(0,r.jsx)(v.A,{color:l.color,children:l.text}),e.category&&(0,r.jsx)(v.A,{children:e.category}),e.repairability&&(0,r.jsx)(v.A,{color:"blue",children:e.repairability}),(null==(t=e.provenance)?void 0:t.detectorId)&&(0,r.jsx)(el.A,{title:e.provenance.fingerprint,children:(0,r.jsx)(v.A,{children:e.provenance.detectorId})})]}),(0,r.jsx)(eW,{style:{fontSize:12},children:e.message}),e.suggestion&&(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:12},children:["建议:",e.suggestion]}),(e.chapterId||e.sectionTitle)&&(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:11},children:["位置:",e.chapterId||""," ",e.sectionTitle||""]})]})})}})},...Q.length>0?[{key:"details",label:"明细(".concat(Q.length,")"),children:(0,r.jsx)(eD.A,{size:"small",dataSource:Q,renderItem:e=>(0,r.jsx)(eD.A.Item,{style:{paddingBlock:3},children:(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:e.message})})})}]:[],...T&&T.length>0?[{key:"events",label:"事件(".concat(T.length,")"),children:(0,r.jsx)(eD.A,{size:"small",dataSource:[...T].slice(-40).reverse(),renderItem:e=>(0,r.jsx)(eD.A.Item,{style:{paddingBlock:3},children:(0,r.jsxs)(m.A,{size:6,wrap:!0,children:[(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:11},children:["#",e.seq]}),(0,r.jsx)(v.A,{style:{fontSize:11},children:e.type}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:11},children:new Date(e.at).toLocaleTimeString()}),e.detail?(0,r.jsx)(eW,{style:{fontSize:11},ellipsis:!0,children:e.detail}):null]})})})}]:[],{key:"impact",label:"影响面",children:V},..._?[{key:"skills",label:"技能",children:(()=>{let e="string"==typeof g.metrics.skillId?g.metrics.skillId:void 0;return(0,r.jsxs)(eq.A,{size:"small",column:1,bordered:!0,children:[(0,r.jsx)(eq.A.Item,{label:"技能 id",children:null!=e?e:g.id}),(0,r.jsx)(eq.A.Item,{label:"技能名",children:g.title}),(0,r.jsx)(eq.A.Item,{label:"命中章节",children:"string"==typeof g.metrics.chapter?g.metrics.chapter:"—"}),(0,r.jsx)(eq.A.Item,{label:"状态",children:(0,r.jsx)(v.A,{color:(0,w.uv)(g.status),children:(0,w.m_)(g.status,L)})})]})})()}]:[],...U.length>0?[{key:"metrics",label:"指标",children:(0,r.jsx)(eq.A,{size:"small",column:1,bordered:!0,children:U.map(e=>(0,r.jsx)(eq.A.Item,{label:e.key,children:e.text.replace("".concat(e.key,": "),"")},e.key))})}]:[],...g.payloadRef?[{key:"payload",label:"载荷",children:(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(e_,{copyable:{text:g.payloadRef},style:{margin:0,fontSize:12},children:g.payloadRef}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"8.6 / 附录 F.2:节点**不得携带载荷**(`agentWorkflow` 已是 p50 2.2 MB / max 94.6 MB)。 prompt / response / 证据快照等明细都在内容寻址的 `artifacts/<sha256>` 里,这里只有引用。"})]})}]:[]]})]})}var eO=n(34038);let{Text:eQ}=d.A,eX=["upsert","status","rollup","reset","start","stage","thinking","text","tool_call_preview","progress","error","done","complete","log"];function eV(e,t){var n,r;let l=null!=(n=e.projectRoot)?n:t;return{specId:e.templateId||e.id,promptIds:null!=(r=e.promptIds)?r:[],...e.materialRoot?{materialRoot:e.materialRoot}:{},...l?{projectRoot:l}:{},...e.templateName?{title:e.templateName}:{}}}function eJ(e,t){let n=t.node;if(!n||"string"!=typeof n.id)return!0;if("upsert"===t.type)return e.set(n.id,n),!0;let r=e.get(n.id);if(!r){var l,i;return e.set(n.id,{...n,title:null!=(l=n.title)?l:n.id,seq:null!=(i=n.seq)?i:0}),!1}let{startedAt:a,...o}=n;return e.set(n.id,{...r,...o,id:r.id}),!0}function eY(){var e,t,n,i,o,d,k,S,I,C,R,N,E,M,L,D,P,B,_,W,G,O,X,V,J,Z,$,ee,et;let en=(0,c.useRouter)(),el=(0,A.Vr)(),{message:ei}=u.A.useApp(),ea="string"==typeof en.query.id?en.query.id:"",eo="string"==typeof en.query.projectRoot?en.query.projectRoot:void 0,[es,ec]=(0,l.useState)(null),[ed,eu]=(0,l.useState)(!0),[eh,ep]=(0,l.useState)(null),[em,ex]=(0,l.useState)(new Map),[eg,ev]=(0,l.useState)("connecting"),[ef,ey]=(0,l.useState)(0),[ej,eA]=(0,l.useState)(null),[eb,ew]=(0,l.useState)("all"),[ek,eS]=(0,l.useState)(!0),[eI,eC]=(0,l.useState)(0),[ez,eR]=(0,l.useState)(()=>Date.now()),eD=(0,l.useCallback)(()=>{ek&&eC(Date.now()+eT.WF)},[ek]),[eP,eB]=(0,l.useState)(""),[eq,eH]=(0,l.useState)(!1),[e_,eW]=(0,l.useState)([]),[,eF]=(0,l.useState)([]),[eU,eY]=(0,l.useState)([]),[eZ,e$]=(0,l.useState)(null),[e0,e1]=(0,l.useState)(null),{bubbles:e2,push:e4,clear:e5}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1500,[t,n]=(0,l.useState)([]),r=(0,l.useRef)(null),i=(0,l.useCallback)(t=>{let r=function(e){var t,n;let r=null!=(t=e.now)?t:Date.now(),l=null!=(n=e.freshMs)?n:15e3,{before:i,after:a}=e,o=a.parentId;if(!o)return null;if(!i){if("number"!=typeof a.startedAt||r-a.startedAt>l||r-a.startedAt<-l)return null;let e=F(a,"dispatch");return e?{id:"".concat(o,"->").concat(a.id,":dispatch"),fromId:o,toId:a.id,kind:"dispatch",label:e,at:r}:null}if(!(H.has(a.status)&&!H.has(i.status))||"number"!=typeof a.completedAt||r-a.completedAt>l||r-a.completedAt<-l)return null;let s=F(a,"report");return s?{id:"".concat(a.id,"->").concat(o,":report"),fromId:a.id,toId:o,kind:"report",label:s,at:r}:null}(t);r&&n(t=>(function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1500,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6,i=[...e.filter(e=>n-e.at<r&&e.id!==t.id),t];return i.length>l?i.slice(i.length-l):i})(t,r,r.at,e))},[e]),a=(0,l.useCallback)(()=>{n(e=>0===e.length?e:[])},[]);return(0,l.useEffect)(()=>{if(0!==t.length)return r.current=setTimeout(()=>{r.current=null,n(t=>(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1500,r=e.filter(e=>t-e.at<n);return r.length===e.length?e:r})(t,Date.now(),e))},Math.max(0,t.reduce((e,t)=>Math.min(e,t.at),1/0)+e-Date.now())),()=>{r.current&&(clearTimeout(r.current),r.current=null)}},[t,e]),{bubbles:t,push:i,clear:a}}(),[e8,e3]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if("function"!=typeof window.matchMedia)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=()=>e3(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]);let[e6,e7]=(0,l.useState)(null),[e9,te]=(0,l.useState)(()=>new Map),[tt,tn]=(0,l.useState)([]),[tr,tl]=(0,l.useState)(null),[ti,ta]=(0,l.useState)(!1),[to,ts]=(0,l.useState)([]),[tc,td]=(0,l.useState)(null),[tu,th]=(0,l.useState)(!1),tp=(0,eT.s_)(),{centerOn:tm,zoomAt:tx,fit:tg,reset:tv}=tp,tf=(0,l.useCallback)(()=>{var e;let t=null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect();if(!t)return{left:0,top:0,right:0,bottom:0};let n=e=>{let n=document.querySelector(e);if(!n)return null;let r=n.getBoundingClientRect();return{top:r.top-t.top,bottom:r.bottom-t.top}},r=n(".canvasToolbar"),l=n(".canvasInputBar"),i=Math.min(r?r.bottom+8:24,.4*t.height),a=Math.max(l?l.top-8:t.height-24,.6*t.height);return{left:24,top:i,right:t.width-24,bottom:a}},[tp.containerRef]),ty=(0,l.useRef)(new Map),tj=(0,l.useRef)(0),tA=(0,l.useRef)({nodes:[],events:[],cursor:0}),tb=(0,l.useRef)(null),tw=(0,l.useRef)(0),tk=(0,l.useRef)(eo),tS=(0,l.useRef)(!1),tI=(0,l.useCallback)(e=>{let t=e.key?el(e.key):e.text,n=t===e.key?e.text:t;tw.current+=1,eF(t=>[{id:tw.current,kind:e.kind,text:n,at:Date.now()},...t].slice(0,100)),"error"===e.kind?ei.error(n):"warning"===e.kind?ei.warning(n):"success"===e.kind&&ei.success(n)},[ei,el]),tC=(0,b.tl)({projectRoot:eo,documentId:ea||null,onNotice:tI,t:el}),{refreshDocuments:tz,applyRecord:tR}=tC,tN=function(e,t){let[n,r]=(0,l.useState)({loading:!1,error:null,preview:null}),i=(0,l.useRef)(0),a=(0,l.useCallback)(async()=>{if(!e)return void r({loading:!1,error:"缺少记录 id,无法取回成稿预览",preview:null});let n=i.current+1;i.current=n,r(e=>({...e,loading:!0,error:null}));try{let{preview:l}=await (0,j.sz)(e,t);if(i.current!==n)return;r({loading:!1,error:null,preview:l})}catch(e){if(i.current!==n)return;r({loading:!1,error:e instanceof Error?e.message:"取回成稿预览失败",preview:null})}},[e,t]),o=(0,l.useCallback)(()=>{i.current+=1,r({loading:!1,error:null,preview:null})},[]);return{...n,load:a,reset:o}}(ea,null!=(E=tk.current)?E:eo),tE=(0,l.useCallback)(()=>{var e;if(ti){tN.reset(),ta(!1);return}ta(!0),tN.load(),(0,j.f$)(null!=(e=tk.current)?e:eo).then(e=>ts(e.assets.filter(e=>e.usedByDocumentIds.includes(ea)))).catch(()=>ts([]))},[ti,tN,ea,eo]),tM=(0,l.useCallback)(e=>{var t;let n=null!=(t=tk.current)?t:eo;if("image"!==e.type)return void(0,j.oS)(e.id,"file",n).catch(()=>tI({kind:"error",text:"打开资产失败"}));th(!1),td(e)},[eo,tI]),tT=(0,l.useCallback)(e=>{tn(t=>t.includes(e)?t:[...t,e])},[]),tL=(0,l.useCallback)(()=>{tb.current||(tb.current=setTimeout(()=>{tb.current=null;let e=tA.current;if(tA.current={nodes:[],events:[],cursor:0},e.nodes.length>0){let n=ty.current,r=0;for(let l of e.nodes){var t;let e=null==(t=l.node)?void 0:t.id,i=e?n.get(e):void 0;eJ(n,l)||(r+=1);let a=e?n.get(e):void 0;a&&e4({...i?{before:i}:{},after:a})}ex(new Map(n)),r>0&&tT("通道收到 ".concat(r," 条指向未知节点的补丁:已按最小节点收下(说明本客户端漏读了 upsert,或日志存在损坏)"))}if(e.cursor>tj.current&&(tj.current=e.cursor),e.events.length>0){let t=e.events;eW(e=>[...t.reverse(),...e].slice(0,200)),ey(e=>t.reduce((e,t)=>Math.max(e,t.seq),e))}},120))},[tT,e4]);(0,l.useEffect)(()=>()=>{tb.current&&clearTimeout(tb.current)},[]);let tD=(0,l.useCallback)((e,t)=>{let n=tA.current;t&&n.nodes.push(t),n.events.push(e),(null==t?void 0:t.logT)&&t.logT>n.cursor&&(n.cursor=t.logT),tL()},[tL]),tP=(0,l.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(ea){e.silent||eu(!0);try{var t,n,r,l,i,a;let e=tk.current?"?projectRoot=".concat(encodeURIComponent(tk.current)):"",o=await fetch("/api/documents/canvas/".concat(encodeURIComponent(ea)).concat(e));if(404===o.status)return void ep("记录不存在(可能已被删除)");if(!o.ok)throw Error(await o.text()||"HTTP ".concat(o.status));let s=await o.json();tk.current=null!=(r=s.document.projectRoot)?r:tk.current,ec(s),ep(null),tn(null!=(l=s.degraded)?l:[]);let c=function(e){let t=[],n=e=>{for(let r of e){let{children:e,...l}=r;t.push(l),e&&n(e)}};return n(e),t}(null!=(i=null==(t=s.nodes)?void 0:t.tree)?i:[]),d=new Map(c.map(e=>[e.id,e]));ty.current=d,ex(d),tj.current=Math.max(tj.current,null!=(a=null==(n=s.nodes)?void 0:n.cursor)?a:0)}catch(e){ep(e instanceof Error?e.message:String(e))}finally{e.silent||eu(!1)}}},[ea]);(0,l.useEffect)(()=>{tP()},[tP]),(0,l.useEffect)(()=>{var e;let t=null==es||null==(e=es.nodes)?void 0:e.depth;null==t||tS.current||ew(t)},[es]),(0,l.useEffect)(()=>{ea&&tz()},[ea,tz]),(0,l.useEffect)(()=>{let e=tC.documents.find(e=>e.id===ea);e&&tR(e)},[tR,ea,tC.documents]);let tB=(0,l.useCallback)(async()=>{if(ea)try{var e,t;let n=new URLSearchParams({since:String(tj.current)});tk.current&&n.set("projectRoot",tk.current);let r=await fetch("/api/documents/generated/".concat(encodeURIComponent(ea),"/nodes?").concat(n.toString()));if(!r.ok)return;let l=await r.json(),i=ty.current;for(let t of null!=(e=l.nodes)?e:[])eJ(i,{type:"upsert",node:t});(null!=(t=l.nodes)?t:[]).length>0&&ex(new Map(i)),l.cursor&&(tj.current=Math.max(tj.current,l.cursor)),l.downgraded&&tT(l.reason||"增量过大,服务端已降级为全量快照")}catch(e){}},[tT,ea]);(0,l.useEffect)(()=>{if(!ea)return;let e=setInterval(()=>{tB()},1e4);return()=>clearInterval(e)},[ea,tB]),(0,l.useEffect)(()=>{if(!ea||"undefined"==typeof EventSource)return;let e=tk.current?"?projectRoot=".concat(encodeURIComponent(tk.current)):"",t=new EventSource("/api/documents/generated/".concat(encodeURIComponent(ea),"/events").concat(e));ev("connecting");let n=e=>t=>{var n,r,l;let i={};try{i=JSON.parse(t.data)}catch(e){}let a=null!=(l=i.type)?l:e;"reset"===a&&(e5(),tP({silent:!0}),tT("通道补发不可用(服务端重启或环形覆盖):已重取全量快照"));let o=null==(n=i.node)?void 0:n.title;tD({seq:"number"==typeof i.seq?i.seq:0,type:a,at:"number"==typeof i.at?i.at:Date.now(),...i.nodeId?{nodeId:i.nodeId}:{},...o?{nodeTitle:o}:{},...(null==(r=i.payload)?void 0:r.message)?{detail:i.payload.message}:{}},i.node?{type:a,node:i.node,...i.logT?{logT:i.logT}:{}}:void 0),i.node&&tz()},r=eX.map(e=>[e,n(e)]);for(let[e,n]of(t.onopen=()=>ev("open"),t.onerror=()=>{ev("error"),tB()},r))t.addEventListener(e,n);return t.onmessage=n("message"),()=>{for(let[e,n]of r)t.removeEventListener(e,n);t.close()}},[tT,e5,ea,tP,tD,tz,tB]),(0,l.useEffect)(()=>{e5()},[e5,ea]);let tq=(0,l.useMemo)(()=>(0,w.Jr)([...em.values()],"all"===eb?void 0:eb),[em,eb]),tH=(0,l.useMemo)(()=>(0,w.x8)(tq),[tq]),t_=(0,l.useMemo)(()=>(0,w.PI)(tq),[tq]),tW=(0,l.useMemo)(()=>0!==e9.size||e6?(0,w.bJ)(t_,(0,w.Kq)(e9,e6)):t_,[t_,e9,e6]),tF=(0,l.useRef)(1);tF.current=tp.view.k;let tU=(0,l.useRef)(!1);tU.current=null!==e6;let tG=(0,l.useCallback)((e,t,n,r)=>{let{dx:l,dy:i}=(0,w.qj)({dx:t,dy:n},tF.current);if("move"===r)return void e7({id:e.id,dx:l,dy:i});e7(null),(0!==t||0!==n)&&te(t=>{var n;let r=new Map(t),a=null!=(n=r.get(e.id))?n:{dx:0,dy:0};return r.set(e.id,{dx:a.dx+l,dy:a.dy+i}),r})},[]),tO=(0,l.useCallback)(()=>{e7(null),te(new Map)},[]),tQ=(0,l.useMemo)(()=>new Map(tH.map(e=>[e.id,e])),[tH]),tX=ej&&null!=(M=tQ.get(ej))?M:null,tV=(0,l.useMemo)(()=>{if(ej)return T(tH.map(eK),ej)},[tH,ej]),tJ=(0,l.useMemo)(()=>{var e;return new Set(null!=(e=null==tV?void 0:tV.affectedNodeIds)?e:[])},[tV]),tY=(0,l.useMemo)(()=>new Set(ej?[...(0,w.II)(tq,ej),ej]:[]),[tq,ej]),tK=(0,l.useMemo)(()=>(0,w.Kg)(tW),[tW]),tZ=(0,l.useMemo)(()=>(function(e,t){var n,r;let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=null!=(n=l.limit)?n:6,a=null!=(r=l.recentLimit)?r:3,o=[],s=[],c=(e,n)=>{for(let r of e)Q.has(r.status)?o.push(Y(r,n,t)):"completed"===r.status&&"number"==typeof r.completedAt&&t-r.completedAt<=9e4&&s.push(Y(r,n,t)),r.children.length>0&&c(r.children,n+1)};return c(e,0),o.sort((e,n)=>{var r,l;let i=null!=(r=K(e,t))?r:0;return(null!=(l=K(n,t))?l:0)-i||e.id.localeCompare(n.id)}),s.sort((e,t)=>{var n,r;return(null!=(n=t.completedAt)?n:0)-(null!=(r=e.completedAt)?r:0)||e.id.localeCompare(t.id)}),{running:o.slice(0,i),recent:s.slice(0,a),runningTotal:o.length,recentTotal:s.length}})(tq,Date.now()),[tq]),t$=(0,l.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=[],r=e=>{for(let i of e){if("supervisor"===i.type){var t,l;let e="string"==typeof(null==(t=i.metrics)?void 0:t.action)?i.metrics.action:"unknown",r="string"==typeof(null==(l=i.metrics)?void 0:l.note)?i.metrics.note:void 0;n.push({id:i.id,action:e,title:i.title||"调度决策",...r?{note:r}:{},status:i.status,..."number"==typeof i.completedAt?{at:i.completedAt}:"number"==typeof i.startedAt?{at:i.startedAt}:{}})}i.children.length>0&&r(i.children)}};return r(e),n.sort((e,t)=>{var n,r;return(null!=(n=t.at)?n:0)-(null!=(r=e.at)?r:0)||e.id.localeCompare(t.id)}),n.slice(0,t)})(tq),[tq]),t0=(0,l.useCallback)(e=>{let t=tQ.get(e.fromId);return t?tJ.has(e.fromId)&&tJ.has(e.toId)?"affected":2>=(0,w.vp)(t.status)?"warn":tY.has(e.fromId)&&tY.has(e.toId)?"active":"default":"default"},[tJ,tY,tQ]);(0,l.useEffect)(()=>{if(0===eI)return;let e=setInterval(()=>eR(Date.now()),1e3);return()=>clearInterval(e)},[eI]);let t1=(0,l.useMemo)(()=>{if(0===tH.length)return null;let e=tH.filter(e=>"running"===e.status),t=e.length>0?e:tH;return t.reduce((e,t)=>{var n,r;return(null!=(n=t.seq)?n:0)>=(null!=(r=e.seq)?r:0)?t:e},t[0])},[tH]),t2=null==t1?void 0:t1.id,t4=(0,l.useMemo)(()=>{var e;return(0,eT.be)({following:ek,pausedUntil:eI,now:ez,node:t1?{title:t1.title,...(null==(e=t1.metrics)?void 0:e.roundIteration)!==void 0?{round:t1.metrics.roundIteration}:{}}:void 0})},[ek,eI,ez,t1]);(0,l.useEffect)(()=>{var e;if(!ek||!t2||eI>Date.now()||tU.current)return;let t=null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect();if(!t)return;let n=tW.nodes.find(e=>e.node.id===t2);n&&(0,eT.xA)({x:n.x,y:n.y,width:w.zT,height:w.EL},tp.view,{width:t.width,height:t.height},tf())&&tm(n.x,n.y,void 0,tf())},[tm,ek,eI,tW.nodes,t2,tf,tp.containerRef,tp.view]),(0,l.useEffect)(()=>{var e;if(!(null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect())||0===tW.nodes.length)return;let{dx:t,dy:n}=(0,eT.B)({width:tW.width,height:tW.height},tp.view,tf());tp.panBy(t,n)},[tW.width,tW.height,tW.nodes.length]);let t5=(0,l.useCallback)(e=>{eA(e);let t=tW.nodes.find(t=>t.node.id===e);t&&tm(t.x,t.y,void 0,tf())},[tm,tW.nodes,tf]);(0,l.useEffect)(()=>{if(!ej)return;let e=e=>{"Escape"===e.key&&eA(null)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ej]);let t8=(0,l.useCallback)(e=>{eB(t=>""===t||t.endsWith(" ")?"".concat(t,"@").concat(e.title," "):"".concat(t," @").concat(e.title," "))},[]),t3=(0,l.useCallback)(()=>{let e=null==es?void 0:es.document;if(!e)return;let t=eP.trim();t&&(eH(!0),(0,j.wI)(e.id,t,{...tk.current?{projectRoot:tk.current}:{}}).then(e=>{var t;tI({kind:"info",text:e.answer?"".concat(e.receipt,"\n").concat(e.answer):e.receipt}),eY(null!=(t=e.candidates)?t:[]),eB("")}).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"指令未受理"})).finally(()=>eH(!1)))},[es,tI,eP]),t6=(0,l.useCallback)(()=>{let e=null==es?void 0:es.document;e&&(eH(!0),tC.startGeneration(eV(e,tk.current),eP.trim()).finally(()=>eH(!1)))},[es,tC,eP]),t7=(0,l.useCallback)(e=>{let t=null==es?void 0:es.document;t&&(eH(!0),(0,j.wI)(t.id,"(选定:".concat(e.label,")"),{...tk.current?{projectRoot:tk.current}:{},acceptedCandidate:{kind:e.kind}}).then(e=>{tI({kind:"info",text:e.receipt}),eY([])}).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"指令未受理"})).finally(()=>eH(!1)))},[es,tI]),t9=(0,l.useCallback)(async()=>{let e=null==es?void 0:es.document;if(!e)return;let t=eV(e,tk.current);if(!t.projectRoot)return void tI({kind:"error",text:"未识别当前项目,无法预览结构"});try{let e=await (0,j.dk)({promptIds:t.promptIds,requirement:eP.trim(),...t.materialRoot?{materialRoot:t.materialRoot}:{},...t.title?{title:t.title}:{},projectRoot:t.projectRoot});tl({title:e.title,chapters:e.chapters,outlineSource:e.derivation.outlineSource,materialScope:e.materialScope})}catch(e){tI({kind:"error",text:e instanceof Error?e.message:"结构预览失败"})}},[es,tI,eP]),ne=(0,l.useCallback)(e=>{let t=T(tH.map(eK),e.id);if(!t)return void tI({kind:"warning",text:"该节点不在当前节点集合里,无法评估影响面"});e$({nodeId:e.id,nodeTitle:e.title,nodeType:e.type,impact:t})},[tH,tI]),nt=(0,l.useCallback)(()=>{if(!eZ)return;let e=(0,w.RV)(eZ.nodeTitle,eZ.impact);eB(t=>t?"".concat(t," ").concat(e):e),e$(null)},[eZ]),[nn,nr]=(0,l.useState)(null),[nl,ni]=(0,l.useState)(null),na=(0,l.useCallback)(e=>{if(!eZ)return;let t=eZ.nodeId;nr({nodeId:t,phase:"creating"}),(0,j.xU)({documentId:ea,targetNodeId:t,userMessage:e}).then(e=>{var n,r,l,i;nr({nodeId:t,phase:"confirmable",requestId:null==(n=e.request)?void 0:n.id,attribution:"string"==typeof e.attribution?e.attribution:void 0,localizationNote:e.localizationNote,...e.needsLocalization?{needsLocalization:!0}:{},...(null==(i=e.request)||null==(l=i.localization)||null==(r=l.candidates)?void 0:r.length)?{candidates:e.request.localization.candidates}:{}})}).catch(e=>{nr({nodeId:t,phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea,eZ]),no=(0,l.useCallback)(e=>{ni({phase:"creating"}),(0,j.xU)({documentId:ea,userMessage:e}).then(e=>{var t,n,r,l;ni({phase:"confirmable",requestId:null==(t=e.request)?void 0:t.id,attribution:"string"==typeof e.attribution?e.attribution:void 0,candidates:null!=(l=null==(r=e.request)||null==(n=r.localization)?void 0:n.candidates)?l:[],localizationNote:e.localizationNote})}).catch(e=>{ni({phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea]),ns=(0,l.useCallback)(e=>{(null==nl?void 0:nl.requestId)&&(0,j.Ho)({documentId:ea,requestId:nl.requestId,acceptedNodeId:e}).then(e=>{var t;ni({...nl,phase:"executed",outcome:String(null!=(t=e.outcome)?t:""),notExecutedReason:e.notExecutedReason})}).catch(e=>{ni({...nl,phase:"error",message:e instanceof Error?e.message:String(e)})})},[nl,ea]),nc=(0,l.useCallback)(e=>{(null==nn?void 0:nn.requestId)&&(0,j.Ho)({documentId:ea,requestId:nn.requestId,...e?{acceptedNodeId:e}:{}}).then(e=>{var t;nr({...nn,phase:"executed",outcome:String(null!=(t=e.outcome)?t:""),notExecutedReason:e.notExecutedReason,attribution:"string"==typeof e.attribution?e.attribution:nn.attribution})}).catch(e=>{nr({...nn,phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea,nn]),nd=(0,l.useCallback)(()=>{(null==nn?void 0:nn.requestId)&&(0,j.vX)({documentId:ea,requestId:nn.requestId}).then(e=>{var t,n,r;let l=null==(t=e.restoredChars)?void 0:t.beforeChars,i=null==(n=e.restoredChars)?void 0:n.afterChars;nr({...nn,phase:"executed",outcome:String(null!=(r=e.outcome)?r:"rolled-back"),restoredChars:void 0!==l&&void 0!==i?l-i:void 0})}).catch(e=>{nr({...nn,phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea,nn]),nu=(0,l.useCallback)(()=>{tC.pauseDocument(ea).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"暂停失败"}))},[ea,tC,tI]),nh=(0,l.useCallback)(()=>{tC.resumePausedDocument(ea).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"继续失败"}))},[ea,tC,tI]),np=null==es?void 0:es.document.status,nm=tC.loading||"generating"===np||"queued"===np,nx=(0,l.useRef)(null),ng=(0,l.useRef)(null),[nv,nf]=(0,l.useState)({width:0,height:0});(0,l.useLayoutEffect)(()=>{let e=ng.current;if(!e)return void nf({width:0,height:0});let t=()=>{let t=e.firstElementChild;if(!t)return;let n=e.offsetWidth,r=Math.max(t.scrollHeight,t.offsetHeight);nf(e=>Math.abs(e.width-n)>2||Math.abs(e.height-r)>2?{width:n,height:r}:e)};t();let n=new ResizeObserver(t);return n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),()=>n.disconnect()},[ej]);let ny=(0,l.useMemo)(()=>{var e;if(!ej)return null;let t=tW.nodes.find(e=>e.node.id===ej),n=null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect();if(!t||!n)return null;let r=[".canvasToolbar",".canvasInputBar",".canvasRecordsBall"].map(e=>{var t;return null==(t=document.querySelector(e))?void 0:t.getBoundingClientRect()}).filter(e=>!!e).map(e=>({left:e.left-n.left,top:e.top-n.top,right:e.right-n.left,bottom:e.bottom-n.top})),l="".concat(tp.view.x,",").concat(tp.view.y,",").concat(tp.view.k),i=nx.current,a=i&&i.id===ej&&i.viewKey===l?i:null,o=(0,w.Aq)({node:{x:t.x,y:t.y},view:tp.view,box:n,panelWidth:nv.width>0?nv.width:462,panelHeight:nv.height>0?nv.height:480,obstacles:r,...a?{pin:{left:a.left,top:a.top}}:{}});nx.current={id:ej,viewKey:l,left:o.left,top:o.top};let s=Math.round(.62*n.height);return{left:o.left,top:o.top,maxHeight:Math.max(180,Math.min(o.maxHeight,s))}},[tW.nodes,ej,tp,nv]),nj=(0,l.useCallback)(e=>{t8(e),requestAnimationFrame(()=>{var e;return null==(e=document.querySelector(".canvasInputBar textarea"))?void 0:e.focus()})},[t8]),nA=(0,l.useCallback)(e=>{t5(e.id),e1(e.id),window.setTimeout(()=>e1(t=>t===e.id?null:t),1200)},[t5]),nb=(0,l.useCallback)(async e=>{if(ea)try{let{document:t}=await (0,j.v7)(ea,!1,tk.current);if(!t)return void tI({kind:"warning",text:"记录不存在,无法导出"});await tC.export.exportRecord(t,e)}catch(e){tI({kind:"error",text:e instanceof Error?e.message:"导出失败"})}},[ea,tC.export,tI]),nw=tC.boundRecord,nk=function(e,t){if(!e)return;let n=(null==t?void 0:t.docId)===e.id?t:void 0,r=e.deliveryQuality;return r?{...n,docId:e.id,...e.projectRoot?{projectRoot:e.projectRoot}:{},contractQuality:r.receipt,...r.stale?{contractQualityStale:r.stale}:{contractQualityStale:void 0}}:n}(null==es?void 0:es.document,tC.deliveryReadings),nS=tC.canResume;return ea?eh?(0,r.jsx)(p.Ay,{status:"warning",title:"画布打不开",subTitle:eh,extra:(0,r.jsxs)(m.A,{children:[(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(y.A,{}),onClick:()=>{tP()},children:"重试"}),(0,r.jsx)(s(),{href:"/documents",children:(0,r.jsx)(x.Ay,{type:"primary",children:"回到文档页"})})]})}):(0,r.jsxs)("div",{className:"canvasRoot",children:[(0,r.jsx)(a(),{children:(0,r.jsx)("title",{children:(null==es?void 0:es.document.title)?"".concat(es.document.title," \xb7 画布"):"生成画布"})}),(0,r.jsx)(eN,{title:(null==es?void 0:es.document.title)||"生成画布",...np?{status:np}:{},...(null==es?void 0:es.document.updatedAt)!==void 0?{updatedAt:es.document.updatedAt}:{},...(null==es?void 0:es.document.wordCount)!==void 0?{wordCount:es.document.wordCount}:{},agents:tZ,supervisorDecisions:t$,agentsActive:nm,...(null==es?void 0:es.document.createdAt)!==void 0?{startedAt:es.document.createdAt}:{},onLocateAgent:e=>{eA(e),e1(e)},nodeCount:em.size,visibleCount:tW.nodes.length,hiddenCount:null!=(L=null==es?void 0:es.nodes.hiddenCount)?L:0,degraded:tt,skills:{hits:null!=(D=null==es?void 0:es.skills.hits)?D:[],note:null!=(P=null==es?void 0:es.skills.note)?P:""},gate:null!=(B=null==es?void 0:es.gate)?B:null,connection:eg,lastSeq:ef,zoom:tp.view.k,depth:eb,following:ek,followStatus:t4.title,generating:!!nm,resumable:nS,exporting:tC.export.exporting,nonDeliverableExport:tC.export.nonDeliverableExport,onZoomIn:()=>tx(1.2),onZoomOut:()=>tx(1/1.2),onZoomReset:tv,onFit:()=>tg(tW.width,tW.height,tf()),onDepthChange:e=>{tS.current=!0,ew(e)},onToggleFollow:()=>eS(e=>!e),onContinue:()=>{nw&&tC.resumeDocument(nw)},onPause:nu,onResume:nh,onAbort:()=>{tC.abortGeneration()},onExport:e=>{nb(e)},exportReports:tC.export.exportReports,...nk?{deliveryReadings:nk}:{},previewOpen:ti,onTogglePreview:tE,hasNodeOffsets:e9.size>0,onResetNodeLayout:tO,t:el}),(0,r.jsxs)("div",{ref:tp.containerRef,className:"canvasStage",style:{backgroundImage:"radial-gradient(var(--canvasGridDot) 1px, transparent 1px)",backgroundSize:"".concat(eT.VF*tp.view.k,"px ").concat(eT.VF*tp.view.k,"px"),backgroundPosition:"".concat(tp.view.x,"px ").concat(tp.view.y,"px"),cursor:"grab"},onWheelCapture:eD,onPointerDown:e=>{var t;let n=e.target;null!=n&&null!=(t=n.closest)&&t.call(n,".nodeInfoLayer, .canvasToolbar, .canvasInputBar")||(eD(),tp.onPointerDown(e))},onPointerMove:tp.onPointerMove,onPointerUp:tp.endDrag,onPointerLeave:tp.endDrag,onClick:()=>eA(null),children:[ed&&(0,r.jsx)("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"},children:(0,r.jsxs)(m.A,{direction:"vertical",align:"center",children:[(0,r.jsx)(h.A,{}),(0,r.jsx)(eQ,{type:"secondary",children:"正在读取节点日志…"})]})}),!ed&&0===tW.nodes.length&&(0,r.jsx)("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,r.jsxs)(m.A,{direction:"vertical",align:"center",size:8,children:[(0,r.jsx)(eQ,{type:"secondary",children:"还没有节点日志"}),(0,r.jsx)(eQ,{type:"secondary",style:{fontSize:12},children:"节点日志是唯一真相源:这里**不造占位节点**,发起生成后节点会随日志追加而出现。"})]})}),(0,r.jsxs)("div",{style:{position:"absolute",left:0,top:0,transformOrigin:"0 0",transform:"translate(".concat(tp.view.x,"px, ").concat(tp.view.y,"px) scale(").concat(tp.view.k,")"),width:tW.width,height:tW.height},children:[(0,r.jsx)(q,{edges:tW.edges,width:tW.width,height:tW.height,toneOf:t0,flowing:tK}),(0,r.jsx)(U,{bubbles:e2,layout:tW,static:e8}),tW.nodes.map(e=>(0,r.jsx)(er,{node:e.node,x:e.x,y:e.y,selected:e.node.id===ej,affected:tJ.has(e.node.id)&&e.node.id!==ej,flashed:e0===e.node.id,onDrag:tG,onSelect:e=>eA(e.id),t:el},e.node.id))]}),tX&&ny&&(0,r.jsx)("div",{ref:ng,className:"nodeInfoLayer",style:{left:ny.left,top:ny.top,maxHeight:ny.maxHeight},onClick:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:(0,r.jsx)(eG,{node:tX,...tV?{impact:tV}:{},flatNodes:tH,highlighted:!!(ej&&tJ.has(ej)),generating:!!nm,repairPreview:eZ,repairRun:nn,onRunRepair:na,onConfirmRepair:nc,onRollbackRepair:nd,defaultRepairNote:eZ?(0,w.RV)(eZ.nodeTitle,eZ.impact):"",onFocusNode:t5,onRequestRepair:ne,onClose:()=>eA(null),onDraftRepairNote:nt,onCancelRepairPreview:()=>e$(null),onMention:nj,onLocate:nA,onPause:nu,onResume:nh,nodeEvents:e_.filter(e=>e.nodeId===(null==tX?void 0:tX.id)),t:el})})]}),(0,r.jsx)(eL._,{quickActions:[...eU.map(e=>({key:e.kind,label:"按「".concat(e.label,"」执行"),onClick:()=>t7(e)})),{key:"document-repair",label:"按这段要求修复正文(先定位)",onClick:()=>no(eP.trim())},{key:"regenerate",label:"按这段要求再生成一份",onClick:t6}],value:eP,onChange:eB,onSend:t3,generating:!!nm,submitting:eq,disabled:!es,...es?{}:{disabledReason:"正在读取记录…"},selectedNode:tX,onMentionSelected:()=>{tX&&t8(tX)},resumable:nS,onContinue:()=>{nw&&tC.resumeDocument(nw)},onPreviewStructure:()=>{t9()}}),(0,r.jsx)(eE._,{currentDocumentId:ea,...eo?{projectRoot:eo}:{},onSelect:e=>{en.push((0,eM.p)(e.id,e.projectRoot||eo))},onCurrentDeleted:()=>{en.push("/canvas")}}),(0,r.jsxs)(g.A,{open:!!nl,title:"文档级修复(先定位)",onCancel:()=>ni(null),footer:(0,r.jsx)(x.Ay,{onClick:()=>ni(null),children:"关闭"}),width:640,children:[(null==nl?void 0:nl.phase)==="creating"&&(0,r.jsx)(eQ,{type:"secondary",children:"正在定位要改的节点…"}),(null==nl?void 0:nl.phase)==="error"&&(0,r.jsx)(eQ,{type:"danger",children:"修复请求未建立:".concat(null!=(_=nl.message)?_:"")}),(null==nl?void 0:nl.phase)==="confirmable"&&(0,r.jsxs)(m.A,{direction:"vertical",size:8,style:{width:"100%"},children:[(0,r.jsx)(eQ,{type:"secondary",style:{fontSize:12},children:"请求已建立(".concat(null!=(W=nl.requestId)?W:"",")").concat(nl.attribution?";归因:".concat(nl.attribution):"","。")+"点一个候选才会真的改正文——定位这件事由你定,系统不替你点头。"}),(null!=(G=null==(e=nl.candidates)?void 0:e.length)?G:0)===0?(0,r.jsx)(eQ,{type:"warning",children:"系统定位不出候选节点:请改用「@ 节点名」指定,或在节点面板里发起(不猜一个节点去改)"}):nl.candidates.map(e=>(0,r.jsx)("div",{"data-testid":"document-repair-candidate",children:(0,r.jsxs)(m.A,{size:6,wrap:!0,children:[(0,r.jsx)(v.A,{children:"匹配 ".concat(e.score.toFixed(2))}),(0,r.jsx)(eQ,{style:{fontSize:12},children:e.excerpt.slice(0,80)}),(0,r.jsx)(x.Ay,{size:"small",type:"primary",onClick:()=>ns(e.nodeId),children:"定位到该节点并执行"})]})},e.nodeId))]}),(null==nl?void 0:nl.phase)==="executed"&&(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(v.A,{color:"applied"===nl.outcome?"green":"rolled-back"===nl.outcome?"orange":"red",children:"执行结果:".concat(null!=(O=nl.outcome)?O:"未执行")}),nl.notExecutedReason&&(0,r.jsx)(eQ,{type:"danger",style:{fontSize:12},children:nl.notExecutedReason})]})]}),(0,r.jsx)(eO.B,{open:!!tr,title:null!=(X=null==tr?void 0:tr.title)?X:"",chapters:null!=(V=null==tr?void 0:tr.chapters)?V:[],...(null==tr?void 0:tr.outlineSource)?{outlineSource:tr.outlineSource}:{},...(null==tr?void 0:tr.materialScope)?{materialScope:tr.materialScope}:{},onClose:()=>tl(null)}),(0,r.jsxs)(g.A,{open:ti,title:"成稿预览",onCancel:()=>{tN.reset(),ta(!1)},footer:(0,r.jsxs)(m.A,{children:[(0,r.jsx)(x.Ay,{onClick:()=>{tN.load()},loading:tN.loading,children:"重新取回"}),(0,r.jsx)(x.Ay,{type:"primary",onClick:()=>{tN.reset(),ta(!1)},children:"关闭"})]}),width:920,styles:{body:{maxHeight:"72vh",overflow:"auto",background:"var(--colorBgLayout)",padding:"16px 20px"}},style:{top:32},children:[(0,r.jsx)(z,{status:null!=(J=null==(t=tN.preview)?void 0:t.status)?J:np,title:null!=(Z=null==(n=tN.preview)?void 0:n.title)?Z:null==es?void 0:es.document.title,html:null==(i=tN.preview)?void 0:i.html,source:null==(o=tN.preview)?void 0:o.source,truncated:null==(d=tN.preview)?void 0:d.truncated,totalChars:null==(k=tN.preview)?void 0:k.totalChars,renderedChars:null==(S=tN.preview)?void 0:S.renderedChars,stats:null==(I=tN.preview)?void 0:I.stats,gate:null!=(ee=null!=($=null==(C=tN.preview)?void 0:C.gate)?$:null==es?void 0:es.gate)?ee:null,deliveryReadings:nk,loading:tN.loading,error:tN.error,onRetry:()=>{tN.load()},updatedAt:null==(R=tN.preview)?void 0:R.updatedAt,generatedAt:null==(N=tN.preview)?void 0:N.generatedAt,t:el}),(0,r.jsxs)("div",{style:{marginTop:16,borderTop:"1px solid var(--colorBorderSecondary)",paddingTop:12},children:[(0,r.jsx)(eQ,{strong:!0,style:{fontSize:13},children:"本档用到的资产"}),0===to.length?(0,r.jsx)("div",{children:(0,r.jsx)(eQ,{type:"secondary",style:{fontSize:12},children:"本档暂无资产"})}):(0,r.jsxs)(m.A,{direction:"vertical",size:4,style:{width:"100%",marginTop:6},children:[to.slice(0,20).map(e=>(0,r.jsxs)(m.A,{size:8,children:[(0,r.jsx)(eQ,{style:{fontSize:12},children:e.name}),(0,r.jsx)(x.Ay,{size:"small",type:"link",onClick:()=>tM(e),children:"打开"})]},e.id)),to.length>20?(0,r.jsxs)(eQ,{type:"secondary",style:{fontSize:12},children:["还有 ",to.length-20," 项未列出"]}):null]})]})]}),(0,r.jsxs)(g.A,{open:!!tc,title:tc?"资产预览:".concat(tc.name):"",onCancel:()=>{td(null),th(!1)},footer:(0,r.jsxs)(m.A,{children:[tu&&tc?(0,r.jsx)(x.Ay,{onClick:()=>{var e;(0,j.oS)(tc.id,"file",null!=(e=tk.current)?e:eo).catch(()=>tI({kind:"error",text:"打开资产失败"}))},children:"用系统程序打开"}):null,(0,r.jsx)(x.Ay,{type:"primary",onClick:()=>{td(null),th(!1)},children:"关闭"})]}),width:760,styles:{body:{maxHeight:"68vh",overflow:"auto"}},children:[tc&&!tu?(0,r.jsx)("img",{alt:tc.name,src:(0,j.iN)(tc.id,null!=(et=tk.current)?et:eo),style:{maxWidth:"100%",display:"block",margin:"0 auto"},onError:()=>th(!0)}):null,tu&&(0,r.jsx)(f.A,{type:"info",showIcon:!0,message:"这个资产不能在应用内渲染",description:"服务端只对图片(PNG / JPEG / WebP,按文件头验证)提供应用内渲染;其它形态请用系统程序打开。"})]})]}):(0,r.jsx)("div",{className:"appShellPlaceholder",children:(0,r.jsx)(h.A,{style:{margin:48}})})}function eK(e){return e}},72210:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/canvas/[id]",function(){return n(38977)}])}},e=>{e.O(0,[310,700,914,174,569,713,506,90,530,636,593,792],()=>e(e.s=72210)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[790],{38977:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>eY});var r=n(65321),l=n(97109),i=n(3454),a=n.n(i),o=n(43220),s=n.n(o),c=n(86109),d=n(48399),u=n(17807),h=n(42700),p=n(32941),m=n(33442),x=n(85114),g=n(25258),v=n(11702),f=n(85493),y=n(99811),j=n(6578),A=n(85587),b=n(93533),w=n(8090);function k(e){let{readings:t}=e,n=null==t?void 0:t.contractQuality;if(!n)return(0,r.jsx)("div",{role:"status",children:"七维评价尚未产出。"});let l=n.score,i=null==t?void 0:t.contractQualityStale;return Array.isArray(l.defects)?(0,r.jsxs)("div",{"aria-label":"七维评价",style:{fontSize:12,lineHeight:1.8},children:[(0,r.jsx)("strong",{children:i?"编辑前的历史七维诊断":"七维专业诊断"}),(0,r.jsxs)("span",{children:[";",i?"当前正文须重新评价":l.deliveryReady?"适用职责核验满足,待专业验收":"仍有缺陷或待核事项"]}),(0,r.jsxs)("div",{children:["阻断 ",l.blocking.length," 项;按根因归并的问题 ",l.defects.length," 项。专业档位不换算为未经标定的百分分数。"]}),i&&(0,r.jsx)("div",{children:i.reason}),(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:"查看七个维度"}),(0,r.jsxs)("table",{style:{width:"100%"},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"维度"}),(0,r.jsx)("th",{children:"质量档位"}),(0,r.jsx)("th",{children:"满足 / 未满足 / 未判定"})]})}),(0,r.jsx)("tbody",{children:l.dimensions.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.label}),(0,r.jsx)("td",{children:"not-applicable"===e.status?"不适用":e.qualityLabel}),(0,r.jsxs)("td",{children:[e.verification.met," / ",e.verification.failed," / ",e.verification.unmeasured]})]},e.id))})]}),(0,r.jsx)("div",{children:n.expertValidated?"已完成专家校准。":"尚未完成专家校准。"})]})]}):(0,r.jsx)("div",{role:"status",children:"历史评价回执保留;按当前专业诊断口径重新评价后显示核验与质量档位。"})}let{Paragraph:S,Text:I}=d.A;function C(e){return new Date(e).toLocaleString()}function z(e){var t,n,i;let{status:a,title:o,html:s,source:c,truncated:d,totalChars:u,renderedChars:p,stats:g,gate:y,loading:j,error:A,onRetry:b,updatedAt:z,generatedAt:R,className:N,t:E,deliveryReadings:M}=e,T=null!=s?s:"",L=T.trim().length>0,D=g?function(e){let t=[];return e.droppedDangerousBlocks>0&&t.push("删除了 ".concat(e.droppedDangerousBlocks," 处可执行/可加载内容(脚本、样式、内嵌页面等)")),e.blockedUrls>0&&t.push("拦截了 ".concat(e.blockedUrls," 个协议不安全的链接(如 javascript: / data:)")),e.escapedTags>0&&t.push("转义了 ".concat(e.escapedTags," 个不支持的标签(原文里的原始 HTML 会以文字显示)")),e.droppedAttributes>0&&t.push("剥离了 ".concat(e.droppedAttributes," 个属性(样式、事件、非白名单属性)")),e.droppedComments>0&&t.push("删除了 ".concat(e.droppedComments," 处注释/声明")),t}(g):[],[P,B]=(0,l.useState)(!1),q=null!=(t=null==y?void 0:y.issues)?t:[],H=q.length>5,_=P?q:q.slice(0,5),W=q.length-_.length,F=W+(null!=(n=null==y?void 0:y.truncatedCount)?n:0),U=(0,r.jsxs)("div",{className:"deliverablePreviewMeta",children:[o&&(0,r.jsx)(I,{strong:!0,style:{fontSize:15},children:o}),a&&(0,r.jsx)(v.A,{color:(0,w.uj)(a),children:(0,w.GC)(a,E)}),c&&(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"预览正文:".concat("editedMarkdown"===c?"编辑后的正文(以它为准)":"markdown"===c?"记录里的正文(markdown 字段)":"draft"===c?"生成时的草案正文(draft.markdown)":"none"===c?"没有正文":"未识别的正文来源(".concat(c,")"))}),R?(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"生成于 ".concat(C(R))}):null,z?(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"更新于 ".concat(C(z))}):null]}),G=q.length>0&&(0,r.jsxs)("div",{style:{fontSize:12.5,lineHeight:1.8},children:[_.map((e,t)=>(0,r.jsxs)("div",{children:["\xb7 ",e]},"".concat(t,"-").concat(e.slice(0,12)))),F>0&&(0,r.jsx)("div",{children:"…还有 ".concat(F," 项未列出").concat(W>0&&(null!=(i=null==y?void 0:y.truncatedCount)?i:0)>0?"(服务端只下发了 ".concat(q.length," 项)"):"")}),H&&(0,r.jsx)(x.Ay,{type:"link",size:"small",style:{paddingInline:0},onClick:()=>B(e=>!e),children:P?"收起阻断项":"展开全部 ".concat(q.length," 项")})]}),O=y?(0,r.jsx)(f.A,{style:{width:"100%"},type:y.passed?"success":"warning",showIcon:!0,message:y.passed?"交付门禁:通过":"交付门禁:阻断 ".concat(y.blockingCount," 项"),description:(0,r.jsxs)(m.A,{direction:"vertical",size:4,style:{width:"100%"},children:[(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:"能否导出由服务端判定;此处仅供查看。"}),G]})}):(0,r.jsx)(f.A,{style:{width:"100%"},type:"info",showIcon:!0,message:"尚无交付门禁结论(生成中或尚未完成)——这不代表已通过。"});return(0,r.jsx)("div",{className:null!=N?N:"deliverablePreview",children:(0,r.jsxs)("div",{className:"deliverablePreviewStack",children:[U,(0,r.jsx)(k,{readings:M}),O,d&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"warning",showIcon:!0,message:"正文过长,预览只渲染了前 ".concat((null!=p?p:0).toLocaleString()," 字(共 ").concat((null!=u?u:0).toLocaleString()," 字)"),description:"后续内容未渲染;导出物是完整正文,不受预览截断影响。"}),D.length>0&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"info",showIcon:!0,message:"预览已对内容做安全处置(与导出物可能存在差异)",description:(0,r.jsx)("div",{style:{fontSize:12,lineHeight:1.7},children:D.map(e=>(0,r.jsxs)("div",{children:["\xb7 ",e]},e))})}),j&&(0,r.jsxs)(m.A,{align:"center",size:8,children:[(0,r.jsx)(h.A,{size:"small"}),(0,r.jsx)(I,{type:"secondary",children:"正在取回成稿预览(服务端渲染 + 清洗)…"})]}),!j&&A&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"error",showIcon:!0,message:"取回成稿预览失败",description:(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(I,{style:{fontSize:12},children:A}),b&&(0,r.jsx)(x.Ay,{size:"small",onClick:b,children:"重新取回"})]})}),!j&&!A&&!L&&(0,r.jsx)(f.A,{style:{width:"100%"},type:"info",showIcon:!0,message:"这条记录还没有可预览的正文",description:"生成完成后这里会显示成稿全文;生成中的记录只有节点日志(见画布),没有正文可预览。"}),!A&&L&&(0,r.jsxs)("div",{className:"deliverablePreviewPaper",children:[(0,r.jsx)("article",{className:"deliverablePreviewBody","aria-label":"成稿预览正文",dangerouslySetInnerHTML:{__html:T}}),(0,r.jsxs)("div",{className:"deliverablePreviewEnd",children:[(0,r.jsx)(I,{type:"secondary",style:{fontSize:12},children:d?"正文到此为止(预览有截断,见上方提示;导出物是完整正文)":p&&p>0?"正文到此为止:以上是本记录的全部正文,共 ".concat(p.toLocaleString()," 字(未截断)"):"正文到此为止:以上是本记录的全部正文(未截断)"}),y&&!y.passed&&(0,r.jsx)(I,{style:{fontSize:12,color:"var(--colorWarning)"},children:"交付门禁未通过(阻断 ".concat(y.blockingCount," 项)——正文在这里结束并不代表成稿完整,缺什么见上方的阻断项清单。")})]})]}),!A&&L&&(0,r.jsx)(S,{type:"secondary",style:{fontSize:12,marginBottom:0,textAlign:"center"},children:"预览为服务端渲染结果;排版细节(字体、页眉页脚、分页)以导出物为准。"})]})})}let R=new Set(["prepare","understand","plan","blueprint"]),N=new Set(["close","deliver"]),E=new Set(["chapter","write"]);function M(e,t){let n=new Map;for(let t of e){if(void 0===t.parentId)continue;let e=n.get(t.parentId);e?e.push(t.id):n.set(t.parentId,[t.id])}let r=new Set([t]),l=[t],i=[];for(;l.length>0;){var a;let e=l.shift();for(let t of(i.push(e),null!=(a=n.get(e))?a:[]))r.has(t)||(r.add(t),l.push(t))}return i}function T(e,t){var n;let r=new Map(e.map(e=>[e.id,e])),l=r.get(t);if(!l)return;let i=M(e,t),a=e.map(e=>e.id).sort();if(R.has(l.type))return{targetNodeId:t,kind:"contaminated",affectedNodeIds:a,reason:"".concat(l.type," 承载事实 / 命名 / 标题指纹 → 11.1:跨文档污染,**不可回滚**(要么回滚,要么重新校准)"),escalate:a.length>5,rollbackable:!1};let o=(n=l.type).split(".")[0]||n;if(N.has(l.type)||N.has(o))return{targetNodeId:t,kind:"propagated",affectedNodeIds:a,reason:"".concat(l.type," 属全篇收口 / 交付层 → 预算守恒与全量判据复检波及整篇(11.1)"),escalate:a.length>5,rollbackable:!0};if(E.has(l.type)||"round"===o){let n=function(e,t,n){let r=new Set([t]),l=e.get(t);for(;l;){if(n(l))return l;let t=l.parentId;if(void 0===t||r.has(t))break;r.add(t),l=e.get(t)}}(r,t,e=>E.has(e.type)),i=n?M(e,n.id):a;return{targetNodeId:t,kind:"propagated",affectedNodeIds:i,reason:n?"".concat(l.type," 在章级锚点「").concat(n.title||n.id,"」内 → 跨章数值一致性 / 复读 / 依据对账(11.1)波及同章其余部分"):"".concat(l.type," 无章级锚点 → 按整篇保守估算(11.1)"),escalate:i.length>5,rollbackable:!0}}return{targetNodeId:t,kind:"local",affectedNodeIds:i,reason:"".concat(l.type," 属定点补丁层(11.5:确定性处理节点)→ 影响面限自身子树"),escalate:i.length>5,rollbackable:!0}}function L(e){let t=Math.max(18,Math.abs(e.y2-e.y1)/2);return"M ".concat(e.x1," ").concat(e.y1," C ").concat(e.x1," ").concat(e.y1+t,", ").concat(e.x2," ").concat(e.y2-t,", ").concat(e.x2," ").concat(e.y2)}let D={default:"canvasEdge",active:"canvasEdge canvasEdgeActive",warn:"canvasEdge canvasEdgeWarn",affected:"canvasEdge canvasEdgeAffected"},P={default:"url(#canvasArrow)",active:"url(#canvasArrowActive)",warn:"url(#canvasArrowWarn)",affected:"url(#canvasArrow)"};function B(e){let{edge:t,tone:n="default"}=e;return(0,r.jsx)("path",{className:D[n],d:L(t),markerEnd:P[n],"data-edge":"".concat(t.fromId,"->").concat(t.toId)})}function q(e){let{edges:t,width:n,height:l,toneOf:i,flowing:a,style:o}=e;return(0,r.jsxs)("svg",{className:"canvasEdgeLayer",width:Math.max(1,n),height:Math.max(1,l),viewBox:"0 0 ".concat(Math.max(1,n)," ").concat(Math.max(1,l)),"aria-hidden":"true",focusable:"false",style:o,children:[(0,r.jsxs)("defs",{children:[(0,r.jsx)("marker",{id:"canvasArrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:(0,r.jsx)("path",{d:"M0,0 L8,4 L0,8 z",fill:"var(--canvasEdge)"})}),(0,r.jsx)("marker",{id:"canvasArrowActive",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:(0,r.jsx)("path",{d:"M0,0 L8,4 L0,8 z",fill:"var(--canvasEdgeActive)"})}),(0,r.jsx)("marker",{id:"canvasArrowWarn",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:(0,r.jsx)("path",{d:"M0,0 L8,4 L0,8 z",fill:"var(--canvasEdgeWarn)"})})]}),t.map(e=>{var t;return(0,r.jsxs)("g",{children:[(0,r.jsx)(B,{edge:e,tone:null!=(t=null==i?void 0:i(e))?t:"default"}),(null==a?void 0:a.has(e.id))&&(0,r.jsx)("path",{className:"canvasEdgeFlow",d:L(e),"data-flow":"".concat(e.fromId,"->").concat(e.toId)})]},e.id)})]})}let H=new Set(["completed","failed","skipped"]),_=[{key:"chars",unit:" 字"},{key:"words",unit:" 字"},{key:"noteChars",unit:" 字"},{key:"turn",unit:" 轮",prefix:"第 "},{key:"chapters",unit:" 章"},{key:"facts",unit:" 条事实"},{key:"evidence",unit:" 条证据"},{key:"issues",unit:" 个问题"},{key:"toolCalls",unit:" 次工具调用"},{key:"totalFiles",unit:" 份资料"},{key:"totalChunks",unit:" 个切片"},{key:"roundIteration",unit:" 轮修复",prefix:"第 "}];function W(e){var t;let n=null==(t=e.metrics)?void 0:t.note;return"string"==typeof n&&n.trim()?n.trim():void 0}function F(e,t){let{input:n,output:r}=function(e){let t=e=>"string"==typeof e&&e.trim()?e.trim():void 0;return{input:t(e.inputSummary),output:t(e.outputSummary)}}(e);for(let l of"dispatch"===t?[n,W(e),e.title]:[r,W(e),e.title,function(e){var t;let n=null!=(t=e.metrics)?t:{},r=[];for(let{key:e,unit:t,prefix:l}of _){let i=n[e];if(("number"==typeof i||"string"==typeof i)&&""!==i&&0!==i&&(r.push("".concat(null!=l?l:"").concat("number"==typeof i?i.toLocaleString():i).concat(t)),2===r.length))break}return r.length>0?r.join(" \xb7 "):void 0}(e)])if(l&&l.trim())return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=e.replace(/\s+/gu," ").trim();return n.length>t?"".concat(n.slice(0,t-1),"…"):n}(l)}function U(e){let{bubbles:t,layout:n,static:l=!1}=e;return 0===t.length?null:(0,r.jsx)("div",{className:"canvasBubbleLayer",style:{width:Math.max(1,n.width),height:Math.max(1,n.height)},"aria-hidden":"true",children:t.map(e=>{let t=function(e,t){let n=t.edges.find(t=>t.fromId===e.fromId&&t.toId===e.toId);if(n)return L(n);let r=t.edges.find(t=>t.fromId===e.toId&&t.toId===e.fromId);return r?function(e){let t=L(e),n=/^M ([\d.-]+) ([\d.-]+) C ([\d.-]+) ([\d.-]+), ([\d.-]+) ([\d.-]+), ([\d.-]+) ([\d.-]+)$/u.exec(t);if(!n)return t;let[,r,l,i,a,o,s,c,d]=n;return"M ".concat(c," ").concat(d," C ").concat(o," ").concat(s,", ").concat(i," ").concat(a,", ").concat(r," ").concat(l)}(r):null}(e,n);return t?(0,r.jsx)("div",{className:l?"canvasBubble canvasBubbleStatic":"canvasBubble","data-kind":e.kind,"data-from":e.fromId,"data-to":e.toId,style:{offsetPath:'path("'.concat(t,'")'),offsetRotate:"0deg",animationDuration:"".concat(1500,"ms")},children:(0,r.jsx)("span",{className:"canvasBubbleBody",children:(0,r.jsx)("span",{className:"canvasBubbleText",children:e.label})})},e.id):null})})}var G=n(94394);function O(e){return"stage-details"===e.source}let Q=new Set(["running","repairing"]),X=new Set(["role_binding","knowledge_retrieval","file_understanding","fact_extraction","chapter_generation","llm_review","validation","reference"]);function V(e){var t;return X.has(e)?null!=(t=G.i_[e])?t:e:(0,w.z9)(e)}function J(e,t){var n;let r=null==(n=e.metrics)?void 0:n[t];return"string"==typeof r&&r.trim()?r.trim():void 0}function Y(e,t,n){var r;let l=function(e){var t;let n=null==(t=e.metrics)?void 0:t.stageType;return"string"==typeof n&&n.trim()?n.trim():e.type.split(".")[0]||"default"}(e),i=null!=(r=J(e,"stageSubtitle"))?r:J(e,"stageRoleId"),a=J(e,"note");return{id:e.id,kind:l,kindLabel:V(l),...i&&i!==e.title?{role:i}:{},title:e.title||V(l),...a?{activity:a}:{},status:e.status,..."number"==typeof e.startedAt?{startedAt:e.startedAt}:{},..."number"==typeof e.completedAt?{completedAt:e.completedAt}:{},metrics:(0,w.dB)(e.metrics,8),depth:t}}function K(e,t){if("number"==typeof e.startedAt)return Math.max(0,("number"==typeof e.completedAt?e.completedAt:t)-e.startedAt)}var Z=n(46758),$=n(99605);let{Text:ee}=d.A,et=["error","warning","info"],en={error:"#ff4d4f",warning:"#faad14",info:"#1677ff"};function er(e){let{node:t,x:n,y:i,selected:a,affected:o,flashed:s,onSelect:c,onDrag:d,t:u}=e,h=function(e){let t=[],n=[];for(let r of e.issues)(O(r)?n:t).push(r);return{problems:t,details:n,counts:{error:t.filter(e=>"error"===e.level).length,warning:t.filter(e=>"warning"===e.level).length,info:t.filter(e=>"info"===e.level).length}}}(t),p=(0,w.Jy)(t),m=(0,w.O0)(t.metrics,2),x=(0,l.useRef)(null);return(0,l.useEffect)(()=>()=>{var e;null==(e=x.current)||e.call(x)},[]),(0,r.jsxs)("div",{className:"canvasNode".concat(a?" canvasNodeSelected":"").concat(o?" canvasNodeAffected":"").concat(s?" canvasNodeFlashed":""),style:{left:n,top:i,width:w.zT,height:w.EL},role:"button",tabIndex:0,"aria-label":"节点 ".concat(t.title),"data-node-id":t.id,onClick:e=>{e.stopPropagation(),c(t)},onPointerDown:e=>{var n,r;if(0!==e.button||(e.stopPropagation(),!d||(null==(r=e.target)||null==(n=r.closest)?void 0:n.call(r,"button, a, input, textarea"))))return;let l=e.clientX,i=e.clientY,a=e.pointerId,o=!1,s={dx:0,dy:0},c=e=>{e.pointerId===a&&(s={dx:e.clientX-l,dy:e.clientY-i},!o&&4>Math.abs(s.dx)&&4>Math.abs(s.dy)||(o=!0,d(t,s.dx,s.dy,"move")))},u=e=>{if(e.pointerId===a)document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u),x.current=null,o&&(document.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault()},{capture:!0,once:!0}),d(t,s.dx,s.dy,"end"))};document.addEventListener("pointermove",c),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",u),x.current=()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u)}},onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),c(t))},children:[(0,r.jsxs)("div",{className:"canvasNodeHeader",children:[(0,r.jsx)("span",{className:"canvasNodeIcon","data-status":t.status,children:(0,w.kH)(t.type)}),(0,r.jsx)(ee,{ellipsis:!0,style:{flex:1,minWidth:0,fontWeight:600,fontSize:13},title:t.title,children:t.title}),et.map(e=>h.counts[e]>0&&(0,r.jsx)("span",{"data-issue-level":e,style:{flexShrink:0},children:(0,r.jsx)(Z.A,{count:h.counts[e],size:"small",color:en[e]})},e))]}),(0,r.jsxs)("div",{className:"canvasNodeMeta",children:[(0,r.jsx)(v.A,{color:(0,w.uv)(t.status),style:{marginInlineEnd:4},children:(0,w.m_)(t.status,u)}),(0,r.jsx)(ee,{type:"secondary",style:{fontSize:11},ellipsis:!0,children:(0,w.z9)(t.type)})]}),t.progress&&t.progress.total>0?(0,r.jsx)($.A,{percent:Math.round(t.progress.current/t.progress.total*100),size:"small",showInfo:!1,status:"failed"===t.status?"exception":"completed"===t.status?"success":"active",style:{marginBottom:0}}):(0,r.jsxs)("div",{className:"canvasNodeMetrics",children:[m.map(e=>(0,r.jsx)(ee,{type:"secondary",style:{fontSize:11},ellipsis:!0,children:e},e)),0===m.length&&(0,r.jsx)(ee,{type:"secondary",style:{fontSize:11},children:(0,w.uH)(p)})]})]})}var el=n(14932),ei=n(57271),ea=n(55122),eo=n(32965),es=n(99271),ec=n(37510),ed=n(48156),eu=n(63046),eh=n(64068),ep=n(76830),em=n(83914);function ex(e){let{updatedAt:t,running:n}=e,[i,a]=(0,l.useState)(()=>Date.now());if((0,l.useEffect)(()=>{if(!n)return;let e=setInterval(()=>a(Date.now()),5e3);return()=>clearInterval(e)},[n]),!n||!t)return null;let o=Math.max(0,i-t);return o<=9e4?(0,r.jsx)(el.A,{title:"记录每 30 秒刷新一次(最近一次 ".concat(new Date(t).toLocaleTimeString(),")——长阶段里画布可能几分钟没有新节点,这个信号说明进程还在跑"),children:(0,r.jsxs)(v.A,{color:"processing",children:["心跳 ",Math.round(o/1e3)," 秒前"]})}):(0,r.jsx)(el.A,{title:"最后一次进度写入是 ".concat(new Date(t).toLocaleTimeString(),"——超过 ").concat(Math.round(1.5)," 分钟没有动静,进程可能已退出(可「继续生成」续跑)"),children:(0,r.jsxs)(v.A,{color:"warning",children:["心跳已停 ",Math.floor(o/6e4)," 分钟"]})})}function eg(e){let{startedAt:t,endedAt:n,running:i}=e,[a,o]=(0,l.useState)(()=>Date.now());if((0,l.useEffect)(()=>{if(!i)return;let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[i]),!t)return null;let s=Math.max(0,(i?a:null!=n?n:a)-t);return(0,r.jsx)(el.A,{title:"本轮生成的整体耗时(自 ".concat(new Date(t).toLocaleTimeString()," 起").concat(i?"":",已结束",")"),children:(0,r.jsx)(v.A,{color:"default",children:"耗时 ".concat((0,w.uH)(s))})})}var ev=n(55897),ef=n(49075),ey=n(84742);let{Text:ej}=d.A;function eA(e){var t;let{row:n,now:l,onLocate:i}=e;return(0,r.jsxs)("div",{className:"canvasAgentDetail","data-node-id":n.id,children:[(0,r.jsxs)("div",{className:"canvasAgentDetailHead",children:[(0,r.jsx)("span",{className:"canvasAgentIcon","data-status":n.status,children:(0,w.Qs)(n.kind)}),(0,r.jsx)(ej,{strong:!0,style:{fontSize:12},children:n.kindLabel}),n.role&&(0,r.jsxs)(ej,{type:"secondary",style:{fontSize:12},children:["\xb7 ",n.role]})]}),(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"在干什么"}),(0,r.jsx)(ej,{style:{fontSize:12},children:null!=(t=n.activity)?t:n.title})]}),n.activity&&n.title&&n.activity!==n.title&&(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"对象"}),(0,r.jsx)(ej,{style:{fontSize:12},children:n.title})]}),(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:n.completedAt?"耗时":"已跑"}),(0,r.jsx)(ej,{style:{fontSize:12},children:(0,w.uH)(K(n,l))})]}),n.metrics.length>0&&(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"指标"}),(0,r.jsx)(ej,{style:{fontSize:12},children:n.metrics.map(e=>e.text).join(" \xb7 ")})]}),(0,r.jsxs)("button",{type:"button",className:"canvasAgentLocate",onClick:()=>i(n.id),title:"在画布上定位到这条节点",children:[(0,r.jsx)(ef.A,{})," 定位到节点"]})]})}function eb(e){return e.some(e=>"failed"===e.status)?"repairing":"completed"}function ew(e){let{view:t,running:n,onLocate:i,decisions:a=[],active:o=!1}=e,[s,c]=(0,l.useState)(()=>Date.now());if((0,l.useEffect)(()=>{if(!n)return;let e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[n]),0===t.runningTotal&&0===t.recentTotal&&0===a.length&&!o)return null;let d=t.runningTotal-t.running.length;return(0,r.jsxs)(m.A,{size:4,align:"center",wrap:!0,"data-agents":t.runningTotal,className:"canvasAgentsChips",children:[(0,r.jsx)(el.A,{title:"本稿此刻在调度哪些智能体(点图标看在干什么)",children:(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"智能体调度中心"})}),(o||a.length>0)&&(0,r.jsx)(ev.A,{trigger:"click",placement:"bottomLeft",content:(0,r.jsx)("div",{className:"canvasAgentDetail",children:0===a.length?(0,r.jsx)("div",{className:"canvasAgentDetailRow",children:(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:"尚无来源或任务裁决回执。主智能体负责施工部署、来源与工况核定及作者协调;当前执行进度见运行节点。"})}):a.map(e=>{var t;return(0,r.jsxs)("div",{className:"canvasAgentDetailRow",children:[(0,r.jsx)(ej,{type:"secondary",style:{fontSize:12},children:e.action}),(0,r.jsx)(ej,{style:{fontSize:12},children:null!=(t=e.note)?t:e.title})]},e.id)})}),children:(0,r.jsxs)("button",{type:"button",className:"canvasAgentChip canvasAgentChipMain","data-kind":"supervisor","data-status":eb(a),title:"主智能体:核定施工部署、裁决来源与工况、协调作者任务和交付",children:[(0,r.jsx)("span",{className:"canvasAgentAvatar","data-status":eb(a),children:(0,r.jsx)("span",{className:"canvasAgentAvatarGlyph",children:(0,w.Qs)("supervisor")})}),(0,r.jsx)("span",{className:"canvasAgentRole","data-role":"main",children:"主"})]})}),t.running.map(e=>{var t;return(0,r.jsx)(ev.A,{trigger:"click",placement:"bottomLeft",content:(0,r.jsx)(eA,{row:e,now:s,onLocate:i}),children:(0,r.jsxs)("button",{type:"button",className:"canvasAgentChip","data-node-id":e.id,"data-kind":e.kind,"data-status":e.status,title:"".concat(e.kindLabel).concat(e.role?" \xb7 ".concat(e.role):"",":").concat(null!=(t=e.activity)?t:e.title),children:[(0,r.jsx)("span",{className:"canvasAgentAvatar","data-status":e.status,children:(0,r.jsx)("span",{className:"canvasAgentAvatarGlyph",children:(0,w.Qs)(e.kind)})}),(0,r.jsx)("span",{className:"canvasAgentRole","data-role":"sub",title:"子智能体(执行具体环节)",children:"子"})]})},e.id)}),d>0&&(0,r.jsx)(el.A,{title:"另有 ".concat(d," 个在跑(画布上可逐个查看)"),children:(0,r.jsxs)(ej,{type:"secondary",style:{fontSize:12},children:["+",d]})}),t.recent.length>0&&(0,r.jsx)(el.A,{title:t.recent.map(e=>"".concat(e.kindLabel,":").concat(e.title,"(已完成)")).join("\n"),children:(0,r.jsxs)(ej,{type:"secondary",style:{fontSize:12},children:[(0,r.jsx)(ey.A,{})," 刚完成 ",t.recentTotal]})})]})}var ek=n(34052),eS=n(84253),eI=n(96538);function eC(e){let{reports:t,deliveryReadings:n,t:i}=e,[a,o]=(0,l.useState)(!1),s=(e,t)=>{let n=null==i?void 0:i(e);return n&&n!==e?n:t},c=(0,l.useSyncExternalStore)(j.p5,j.dH,j.dH),d=c?function(e,t){var n,r;let{receipt:l}=e,i=(e,n,r,l)=>t(e,n).replace("{count}",String(r))+(l?":".concat(l):""),a=[];"review"===l.exportPurpose&&a.push({key:"review-purpose",tone:"info",text:"审阅稿:验收结论保持原状态,独立问题报告与正文版本绑定"}),l.issuesReport&&a.push({key:"review-report",tone:"info",text:"独立问题报告:".concat(l.issuesReport.id.slice(0,12),";正文 SHA256:").concat(l.issuesReport.bodySha256)}),"mismatch"===l.gateBinding?a.push({key:"binding-mismatch",tone:"error",text:t("records.receiptBindingMismatch","正文与门禁指纹不匹配:放行依据不是这份正文(收口后被编辑/替换过)")}):"absent"===l.gateBinding&&a.push({key:"binding-absent",tone:"warning",text:t("records.receiptBindingAbsent","门禁未绑定正文指纹:无法核对放行依据是否就是这份正文")}),l.gateIssues&&l.gateIssues.length>0&&a.push({key:"gate-issues",tone:"error",text:i("records.receiptGateIssues","门禁阻断清单 {count} 项",l.gateIssues.length,l.gateIssues[0])}),l.contentIssues&&l.contentIssues.length>0&&a.push({key:"content-issues",tone:"warning",text:i("records.receiptContentIssues","内容问题 {count} 条",l.contentIssues.length,l.contentIssues[0])});let o=null!=(r=null==(n=l.figureInline)?void 0:n.failed)?r:[];return o.length>0&&a.push({key:"figure-inline",tone:"warning",text:i("records.receiptFigureFailures","图件未内联 {count} 张",o.length,o[0])}),l.renderAudit&&l.renderAudit.blockerCount>0&&a.push({key:"render-blockers",tone:"error",text:i("records.receiptRenderBlockers","渲染审计:源层结构缺陷 {count} 项",l.renderAudit.blockerCount)}),l.renderAudit&&l.renderAudit.notices.length>0&&a.push({key:"render-notices",tone:"warning",text:i("records.receiptRenderNotices","渲染审计告警 {count} 条",l.renderAudit.notices.length,l.renderAudit.notices[0])}),l.templateWarning&&a.push({key:"template-warning",tone:"warning",text:"".concat(t("records.receiptTemplateWarning","模板占位符缺失,已回退:")).concat(l.templateWarning)}),l.pageLimit&&a.push({key:"page-limit",tone:"warning",text:l.pageLimit}),"number"==typeof l.pdfPageCount&&a.push({key:"pdf-pages",tone:"info",text:t("records.receiptPdfPages","PDF 共 {count} 页").replace("{count}",String(l.pdfPageCount))}),a}(c,s):[],u=d.filter(e=>"info"!==e.tone),h=d.length>0;if(0===t.length&&!n&&0===u.length&&!(null==c?void 0:c.receipt.issuesReport)&&(null==c?void 0:c.receipt.exportPurpose)!=="review")return null;let p=[...t].sort((e,t)=>t.exportedAt-e.exportedAt),m=p.find(e=>{var t,n;return(null!=(n=null==(t=e.gateChecklist)?void 0:t.items.length)?n:0)>0});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(el.A,{title:s("records.reportTitle","导出闭环报告"),children:(0,r.jsxs)(x.Ay,{size:"small",icon:(0,r.jsx)(ep.A,{}),onClick:()=>o(!0),children:[(null==n?void 0:n.contractQuality)?"七维诊断".concat(n.contractQualityStale?"(历史)":n.contractQuality.score.deliveryReady?"(待验收)":"(待修验)"):s("records.reportEntry","导出报告"),t.length>0&&(0,r.jsx)("span",{className:"ml-1 text-[var(--colorTextTertiary)]",children:t.length}),u.length>0&&(0,r.jsx)(v.A,{color:u.some(e=>"error"===e.tone)?"error":"warning",className:"m-0 ml-1 border-0",children:s("records.receiptBadge","本次导出 {count} 项提醒").replace("{count}",String(u.length))})]})}),(0,r.jsxs)(ek.A,{title:s("records.reportTitle","导出闭环报告"),placement:"right",size:"default",open:a,onClose:()=>o(!1),styles:{body:{padding:16}},children:[h&&c&&(0,r.jsxs)("div",{className:"mb-3 rounded-xl border px-3 py-2.5 text-xs ".concat(u.length>0?"border-[var(--colorWarning)] bg-[var(--colorWarningBg)]":"border-[var(--borderColor)] bg-[var(--colorFillAlter)]"),children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"font-semibold",children:s("records.receiptTitle","最近一次导出回执")}),(0,r.jsx)(v.A,{color:"blue",className:"m-0 border-0 font-semibold",children:c.format.toUpperCase()}),(0,r.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:new Date(c.at).toLocaleString()}),c.filename&&(0,r.jsx)("span",{className:"break-all text-[var(--colorTextTertiary)]",children:c.filename})]}),c.receipt.issuesReport&&(0,r.jsx)("a",{className:"text-[var(--colorPrimary)] underline",href:(0,j.Es)(c,c.receipt.issuesReport),children:"下载本份正文的独立问题报告"}),(0,r.jsx)("div",{className:"mt-2 flex flex-col gap-1.5",children:d.map(e=>(0,r.jsx)("div",{className:"error"===e.tone?"text-[var(--colorError)]":"warning"===e.tone?"text-[var(--colorWarning)]":"text-[var(--colorTextSecondary)]",children:e.text},e.key))})]}),n&&(0,r.jsxs)("div",{className:"mb-3 flex flex-col gap-2 rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5 text-xs",children:[n.contractQuality&&(0,r.jsx)(k,{readings:n}),n.netChars&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:s("records.netCharsLabel","修复链净增字数")}),(0,r.jsxs)("span",{className:"font-semibold",children:[n.netChars.delta>0?"+":"",n.netChars.delta]}),(0,r.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["(",n.netChars.before," → ",n.netChars.after,",",s("records.netCharsRatio","占原稿")," ",(100*n.netChars.ratio).toFixed(1),"%)"]}),n.netChars.ratio>.05&&(0,r.jsx)(el.A,{title:s("records.netCharsWarn",'目标 ≤5%:净增越大,"分是修出来的"成分越高——首过写作的缺口被修复链补上了'),children:(0,r.jsx)(v.A,{color:"warning",className:"m-0 border-0",children:s("records.netCharsOver","超目标")})})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:s("records.reviewReportLabel","交付三件套报告")}),(0,r.jsx)("a",{href:"/api/documents/generated/".concat(encodeURIComponent(n.docId),"/report").concat(n.projectRoot?"?projectRoot=".concat(encodeURIComponent(n.projectRoot),"&download=1"):"?download=1"),className:"text-[var(--colorPrimary)] underline",children:s("records.reviewReportDownload","下载 .md")}),(0,r.jsx)("a",{href:"/api/documents/generated/".concat(encodeURIComponent(n.docId),"/report").concat(n.projectRoot?"?projectRoot=".concat(encodeURIComponent(n.projectRoot)):""),target:"_blank",rel:"noreferrer",className:"text-[var(--colorPrimary)] underline",children:s("records.reviewReportView","在线查看")}),(0,r.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:s("records.reviewReportHint","未跑到终门禁的记录没有报告(打开会说明原因)")})]})]}),0===p.length?(0,r.jsx)(eS.A,{image:eS.A.PRESENTED_IMAGE_SIMPLE,description:s("records.reportEmpty","还没有导出记录")}):(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[p.map((e,t)=>(0,r.jsxs)("div",{className:"rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5 text-xs",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(v.A,{color:"blue",className:"m-0 border-0 font-semibold",children:e.format.toUpperCase()}),(0,r.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:new Date(e.exportedAt).toLocaleString()}),"review"===e.exportPurpose&&(0,r.jsx)(v.A,{children:"审阅稿"}),e.reviewReport&&(0,r.jsx)("a",{className:"text-[var(--colorPrimary)] underline",href:(0,j.Es)({documentId:null==n?void 0:n.docId,projectRoot:null==n?void 0:n.projectRoot},e.reviewReport),children:"下载独立问题报告"})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[var(--colorTextSecondary)]",children:[void 0!==e.durationMs&&(0,r.jsxs)("span",{children:[s("records.reportDuration","总用时")," ",(0,eI.a)(e.durationMs,{unit:"ms",style:"fine-decimal"})]}),void 0!==e.repairedCount&&(0,r.jsxs)("span",{children:[s("records.reportRepaired","修复")," ",e.repairedCount,void 0!==e.blockingCount?"(".concat(s("records.reportBlocking","质量诊断快照阻断")," ").concat(e.blockingCount,")"):""]}),e.ruleSummary&&e.ruleSummary.length>0&&(0,r.jsxs)("span",{children:[s("records.reportRules","规则")," ",e.ruleSummary.length]}),!1===e.gatePassed&&(0,r.jsxs)(v.A,{color:"error",className:"m-0 border-0",children:[s("records.reportGateBlocked","非交付物"),void 0!==e.gateIssueCount&&e.gateIssueCount>0?" \xb7 ".concat(s("records.reportGateBlockedCount","门禁阻断")," ").concat(e.gateIssueCount," ").concat(s("records.reportGateBlockedUnit","项")):" \xb7 ".concat(s("records.reportGateBlockedUnknown","阻断数未记录(清单缺失)"))]}),e.healthAlerts&&e.healthAlerts.length>0&&(0,r.jsxs)(v.A,{color:"warning",className:"m-0 border-0",children:[s("records.reportHealthAlerts","健康告警")," ",e.healthAlerts.length]})]})]},"".concat(e.exportedAt,"-").concat(t))),(null==m?void 0:m.gateChecklist)&&(0,r.jsxs)("div",{className:"rounded-xl border border-[var(--colorWarning)] bg-[var(--colorWarningBg)] px-3 py-2.5",children:[(0,r.jsxs)("div",{className:"text-xs font-semibold text-[var(--colorWarning)]",children:[s("records.reportChecklistTitle","最近一次非交付物导出的未收敛项"),"(",s("records.reportChecklistTotal","共 {count} 项").replace("{count}",String(m.gateChecklist.total)),")"]}),(0,r.jsx)("div",{className:"mt-2 flex flex-col gap-2",children:m.gateChecklist.items.map(e=>(0,r.jsxs)("div",{className:"text-xs",children:[(0,r.jsx)("div",{className:"whitespace-pre-wrap text-[var(--colorText)]",children:"".concat(e.index,".【").concat(e.category,"】").concat(e.problem)}),(0,r.jsxs)("div",{className:"text-[var(--colorTextSecondary)]",children:[e.repairPath,e.detectorId?"|".concat(e.detectorId):""]})]},e.index))})]})]})]})]})}let{Text:ez}=d.A,eR={connecting:{text:"通道连接中",color:"default"},open:{text:"事件通道已连",color:"success"},error:{text:"通道已断(改用增量补差)",color:"warning"},closed:{text:"通道已关闭",color:"default"}};function eN(e){let{title:t,status:n,updatedAt:l,wordCount:i,nodeCount:a,visibleCount:o,hiddenCount:s,degraded:c,skills:d,gate:u,connection:h,lastSeq:p,zoom:g,depth:j,following:A,followStatus:b,generating:k,resumable:S,exporting:I,nonDeliverableExport:C,onZoomIn:z,onZoomOut:R,onZoomReset:N,onFit:E,onDepthChange:M,onToggleFollow:T,onContinue:L,onPause:D,onResume:P,onAbort:B,onExport:q,exportReports:H,deliveryReadings:_,previewOpen:W,onTogglePreview:F,hasNodeOffsets:U,onResetNodeLayout:G,agents:O,onLocateAgent:Q,supervisorDecisions:X,agentsActive:V,startedAt:J,t:Y}=e,K=k&&!S,Z=(0,r.jsxs)("div",{style:{fontSize:12,lineHeight:1.7},children:[(0,r.jsx)("div",{children:"导出当前真实正文供审阅,并下载独立问题报告;不会自动补齐缺章或签发交付验收。"}),(0,r.jsx)("div",{children:"审阅身份标在文件名和回执中,正文不添加诊断、封面或水印。"})]});return(0,r.jsxs)("div",{className:"canvasToolbar",children:[(0,r.jsxs)(m.A,{wrap:!0,size:8,align:"center",style:{flex:1,minWidth:0},children:[(0,r.jsx)(ez,{strong:!0,style:{fontSize:14},ellipsis:!0,title:t,children:t}),n&&(0,r.jsx)(v.A,{color:(0,w.uj)(n),children:(0,w.GC)(n,Y)}),(0,r.jsxs)(ez,{type:"secondary",style:{fontSize:12},children:[void 0!==i?"".concat(i.toLocaleString()," 字"):""," 已接收 ".concat(a," 个节点,显示 ").concat(o," 个"),s>0?"(未显示 ".concat(s,")"):"",l?" 更新于 ".concat(new Date(l).toLocaleTimeString()):""]}),(0,r.jsx)(ex,{updatedAt:l,running:K}),(0,r.jsx)(eg,{startedAt:J,endedAt:l,running:K}),O&&(0,r.jsx)(ew,{view:O,running:O.runningTotal>0,onLocate:null!=Q?Q:()=>{},...X?{decisions:X}:{},active:!!V}),(0,r.jsx)(el.A,{title:"通道游标 seq=".concat(null!=p?p:0,"(断线重连用它补发;节点增量用日志时间 t)"),children:(0,r.jsx)(v.A,{color:eR[h].color,children:eR[h].text})}),d.hits.length>0&&(0,r.jsx)(el.A,{title:d.hits.map(e=>"".concat(e.title,"(").concat(e.skillId,")")).join("、"),children:(0,r.jsxs)(v.A,{color:"blue",children:["技能命中 ",d.hits.length]})}),u&&(0,r.jsx)(el.A,{title:u.issues.length>0?u.issues.join("\n"):"服务端门禁结论:通过",children:(0,r.jsx)(v.A,{color:u.passed?"success":"error",children:u.passed?"门禁:通过":"门禁:阻断 ".concat(u.blockingCount," 项")})})]}),(0,r.jsxs)(m.A,{wrap:!0,size:6,align:"center",children:[(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(es.A,{}),onClick:R,"aria-label":"缩小"}),(0,r.jsxs)(ez,{type:"secondary",style:{fontSize:12,width:44,textAlign:"center"},children:[Math.round(100*g),"%"]}),(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(ec.A,{}),onClick:z,"aria-label":"放大"}),(0,r.jsx)(el.A,{title:"恢复到 100% 并回到原点",children:(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(y.A,{}),onClick:N,"aria-label":"重置视图"})}),(0,r.jsx)(el.A,{title:U?"把拖过的节点放回自动排布(手工摆放的是**偏移**,清空即恢复)":"没有手工拖过的节点:布局就是自动排布的",children:(0,r.jsx)(x.Ay,{size:"small",disabled:!U,onClick:G,children:"恢复布局"})}),(0,r.jsx)(el.A,{title:"适应窗口(按内容包围盒缩放)",children:(0,r.jsx)(x.Ay,{size:"small",onClick:E,children:"适应"})}),(0,r.jsx)(ei.A,{size:"small",value:j,style:{width:108},onChange:e=>M(e),options:[{value:1,label:"只看 1 层"},{value:2,label:"看 2 层"},{value:3,label:"看 3 层"},{value:"all",label:"全部层"}]}),(0,r.jsx)(el.A,{title:null!=b?b:"跟随最新:生成中新出现的节点自动定位(关掉就不再打扰你的视角)",children:(0,r.jsx)(x.Ay,{size:"small",type:A?"primary":"default",onClick:T,children:A?(null==b?void 0:b.startsWith("跟随暂停"))?"跟随暂停中":"跟随中":"跟随最新"})}),(0,r.jsx)(ea.A,{type:"vertical"}),K&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(el.A,{title:"立即取消模型调用并保存已完成正文,停稳后可继续",children:(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(ed.A,{}),onClick:D,children:"暂停"})}),(0,r.jsx)(eo.A,{title:"中止生成",description:"确定中止本次生成?已生成的章节会保留,可从中断处继续。",okText:"中止",cancelText:"取消",okButtonProps:{danger:!0},onConfirm:B,children:(0,r.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(eu.A,{}),children:"中止"})})]}),!K&&S&&(0,r.jsx)(x.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(eh.A,{}),onClick:L,children:"继续生成"}),!K&&!S&&"paused"===n&&(0,r.jsx)(x.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(eh.A,{}),onClick:P,children:"从暂停处继续"}),(0,r.jsx)(ea.A,{type:"vertical"}),(0,r.jsx)(el.A,{title:Z,children:(0,r.jsxs)(m.A,{size:4,children:[(0,r.jsx)(ez,{type:"secondary",children:"审阅导出"}),[{key:"markdown",label:"MD"},{key:"html",label:"HTML"},{key:"docx",label:"DOCX"},{key:"pdf",label:"PDF",primary:!0}].map(e=>(0,r.jsx)(x.Ay,{size:"small",type:e.primary?"primary":"default",icon:"markdown"===e.key?(0,r.jsx)(ep.A,{}):void 0,loading:I===e.key,disabled:null!==I&&I!==e.key,onClick:()=>q(e.key),children:e.label},e.key))]})}),(0,r.jsx)(eC,{reports:null!=H?H:[],..._?{deliveryReadings:_}:{},...Y?{t:Y}:{}}),(0,r.jsx)(el.A,{title:"成稿预览(服务端渲染并清洗后的全文;只读,不提供导出)",children:(0,r.jsx)(x.Ay,{size:"small",type:W?"primary":"default",onClick:F,children:"成稿预览"})})]}),C&&(0,r.jsx)(f.A,{style:{width:"100%",marginTop:8},type:"info",showIcon:!0,message:"已导出审阅稿与独立问题报告",description:(0,r.jsxs)("div",{style:{whiteSpace:"pre-wrap",fontSize:12},children:[(0,r.jsx)("div",{children:"正文保留实际内容;审阅导出不代表交付验收通过。"}),C.count>0&&(0,r.jsxs)("div",{style:{marginTop:4},children:["阻断项(".concat(C.count,"):"),C.issues.slice(0,5).map((e,t)=>(0,r.jsxs)("div",{children:["\xb7 ",e]},t)),C.count>5&&(0,r.jsx)("div",{children:"…还有 ".concat(C.count-5," 项")})]})]})}),c.length>0&&(0,r.jsx)(f.A,{style:{width:"100%",marginTop:8},type:"warning",showIcon:!0,message:"画布显示有取整(下列内容本次未下发;聚合值与节点信息不受影响)",description:(0,r.jsx)("div",{style:{fontSize:12},children:c.map((e,t)=>(0,r.jsxs)("div",{children:["\xb7 ",e]},t))})}),0===a&&k&&(0,r.jsx)(f.A,{style:{width:"100%",marginTop:8},type:"info",showIcon:!0,icon:(0,r.jsx)(em.A,{}),message:"还没有节点日志:生成侧尚未写入第一个节点(节点日志是唯一真相源,画布不伪造占位节点)"})]})}var eE=n(57481),eM=n(28629),eT=n(52057),eL=n(8665),eD=n(38332),eP=n(7576),eB=n(58569),eq=n(76506),eH=n(45042);let{Paragraph:e_,Text:eW}=d.A,eF={local:{text:"影响面:局部",color:"blue",hint:"改动只落在该节点自身子树:定点补丁即可。"},propagated:{text:"影响面:传播",color:"orange",hint:'改动会沿依赖传播到同章其余部分:按 11.1,走"变更传播"而不是重跑整个节点。'},contaminated:{text:"影响面:事实/命名类",color:"red",hint:"该节点持有事实 / 命名 / 标题指纹:按 11.1,**要么回滚、要么重新校准**,不能当普通改动提交。"}},eU={error:{color:"red",text:"错误"},warning:{color:"orange",text:"警告"},info:{color:"blue",text:"提示"}};function eG(e){var t,n,i,a,o,s,c,d,u,h,p;let{node:g,impact:f,flatNodes:y,highlighted:j,generating:A,repairPreview:b,onFocusNode:k,onRequestRepair:S,onClose:I,onDraftRepairNote:C,onCancelRepairPreview:z,onMention:R,onLocate:N,onPause:E,onResume:M,nodeEvents:T,t:L,onRunRepair:D,onConfirmRepair:P,onRollbackRepair:B,repairRun:q,defaultRepairNote:H}=e,_="skill.load"===g.type||"string"==typeof g.metrics.skillId,W=new Map(y.map(e=>[e.id,e])),F=(0,w.Jy)(g),U=(0,w.dB)(g.metrics,24),G=g.issues.filter(e=>!O(e)),Q=g.issues.filter(e=>O(e)),X=G.filter(e=>"error"===e.level).length,V=f?(0,r.jsxs)(m.A,{direction:"vertical",size:8,style:{width:"100%"},children:[(0,r.jsxs)(m.A,{wrap:!0,children:[(0,r.jsx)(v.A,{color:eF[f.kind].color,children:eF[f.kind].text}),(0,r.jsx)(v.A,{color:f.rollbackable?"default":"red",children:f.rollbackable?"可回滚":"需回滚或重新校准"}),(0,r.jsx)(v.A,{color:f.escalate?"red":"default",children:"波及 ".concat(f.affectedNodeIds.length," 节点").concat(f.escalate?"(超阈值)":"")})]}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:f.reason}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:eF[f.kind].hint}),f.escalate&&(0,r.jsx)(v.A,{color:"red",children:"影响面超出阈值:该改动需**人工确认**后才能提交(自动留痕不再适用)"}),(0,r.jsx)(eD.A,{size:"small",header:(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"波及节点(点击定位)"}),dataSource:f.affectedNodeIds,renderItem:e=>{let t=W.get(e);return(0,r.jsx)(eD.A.Item,{style:{paddingBlock:4},children:(0,r.jsx)(x.Ay,{type:"link",size:"small",style:{padding:0,height:"auto"},onClick:()=>k(e),children:t?"".concat(t.title,"(").concat((0,w.z9)(t.type),")"):"未知节点 ".concat(e)})})}})]}):(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(eS.A,{image:eS.A.PRESENTED_IMAGE_SIMPLE,description:"该节点没有预计算的影响面"}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"聚合接口只对**有问题的节点**与**修复节点**预计算影响面(首屏不做 O(n\xb2))。 这里可以按需触发一次修复请求,服务端会在事务前给出权威判定——**本面板不冒充结论**。"}),(0,r.jsx)(x.Ay,{size:"small",disabled:!S,onClick:()=>null==S?void 0:S(g),children:"按需评估影响面(走修复请求)"})]}),[J,Y]=(0,l.useState)("");(0,l.useEffect)(()=>{Y(null!=H?H:"")},[H,g.id]);let K=b&&b.nodeId===g.id?(0,r.jsx)("div",{className:"nodeInfoRepair",children:(0,r.jsxs)(m.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(eW,{strong:!0,style:{fontSize:13},children:"修复影响面预览"}),(0,r.jsx)(v.A,{color:eF[b.impact.kind].color,children:eF[b.impact.kind].text}),(0,r.jsx)(v.A,{color:b.impact.rollbackable?"default":"red",children:b.impact.rollbackable?"可回滚":"不可回滚"})]}),(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:12},children:["波及 ".concat(b.impact.affectedNodeIds.length," 个节点").concat(b.impact.escalate?",超出阈值需人工确认":"","。"),b.impact.reason]}),!b.impact.rollbackable&&(0,r.jsx)(eW,{style:{fontSize:12,color:"var(--colorError)"},children:"11.1:污染类改动**要么回滚、要么重新校准**,不能当普通改动提交。"}),(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(x.Ay,{size:"small",onClick:C,children:"把修复意图写进输入框"}),(0,r.jsx)(x.Ay,{size:"small",type:"text",onClick:z,children:"收起"})]}),D&&(0,r.jsxs)("div",{className:"nodeInfoRepairRun","data-repair-node":g.id,children:[(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"修复说明(会逐字记进修复请求;服务端按它定位与归因)"}),(0,r.jsx)(eP.A.TextArea,{size:"small",autoSize:{minRows:2,maxRows:4},value:J,onChange:e=>Y(e.target.value),placeholder:"例如:这一节的开挖深度与资料不符,应按图纸标注 5.15m 改写"}),(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(x.Ay,{size:"small",type:"primary",loading:(null==q?void 0:q.phase)==="creating"&&q.nodeId===g.id,disabled:0===J.trim().length,onClick:()=>D(J.trim()),children:"发起修复(@本节点)"}),(null==q?void 0:q.nodeId)===g.id&&"confirmable"===q.phase&&P&&!(q.needsLocalization&&(null!=(o=null==(t=q.candidates)?void 0:t.length)?o:0)>0)&&(0,r.jsx)(x.Ay,{size:"small",danger:!0,onClick:()=>P(),children:"确认执行变更事务"}),(null==q?void 0:q.nodeId)===g.id&&"executed"===q.phase&&q.requestId&&B&&(0,r.jsx)(x.Ay,{size:"small",onClick:B,children:"回滚这次修复"})]}),(null==q?void 0:q.nodeId)===g.id&&"creating"!==q.phase&&(0,r.jsxs)("div",{className:"nodeInfoRepairResult",children:["error"===q.phase&&(0,r.jsx)(eW,{style:{fontSize:12,color:"var(--colorError)"},children:"修复请求未建立:".concat(null!=(s=q.message)?s:"")}),"confirmable"===q.phase&&(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"请求已建立(".concat(null!=(c=q.requestId)?c:"",")").concat(q.attribution?";归因:".concat(q.attribution):"","。")+(q.needsLocalization&&(null!=(d=null==(n=q.candidates)?void 0:n.length)?d:0)>0?"这句话该改哪个节点由你定:下面列出系统定位到的候选,点一个才会执行(缺定位服务端一律拒绝)。":'点「确认执行变更事务」后才会真的改正文——这是"必须人工确认"的落点。')}),"confirmable"===q.phase&&q.needsLocalization&&(null!=(u=null==(i=q.candidates)?void 0:i.length)?u:0)>0&&(0,r.jsx)(m.A,{direction:"vertical",size:4,style:{width:"100%"},children:q.candidates.map(e=>(0,r.jsx)("div",{"data-testid":"repair-location-candidate",children:(0,r.jsxs)(m.A,{size:6,wrap:!0,children:[(0,r.jsx)(v.A,{children:"匹配 ".concat(e.score.toFixed(2))}),(0,r.jsx)(eW,{style:{fontSize:12},children:e.excerpt.slice(0,60)}),P&&(0,r.jsx)(x.Ay,{size:"small",type:"primary",onClick:()=>P(e.nodeId),children:"定位到该节点并执行"})]})},e.nodeId))}),"executed"===q.phase&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(m.A,{wrap:!0,size:6,children:[(0,r.jsx)(v.A,{color:"applied"===q.outcome?"green":"rolled-back"===q.outcome?"orange":"red",children:"执行结果:".concat(null!=(h=q.outcome)?h:"未执行")}),q.attribution&&(0,r.jsx)(v.A,{children:"归因:".concat(q.attribution)}),void 0!==q.restoredChars&&(0,r.jsx)(v.A,{children:"恢复 ".concat(q.restoredChars," 字")})]}),q.notExecutedReason&&(0,r.jsx)(eW,{style:{fontSize:12,color:"var(--colorError)"},children:q.notExecutedReason})]})]})]})]})}):null;return(0,r.jsxs)("div",{className:"nodeInfoPanel","data-node-id":g.id,children:[(0,r.jsxs)("div",{className:"nodeInfoHeader",children:[(0,r.jsx)("span",{className:"nodeInfoHeaderIcon",children:(0,w.kH)(g.type)}),(0,r.jsx)(eW,{strong:!0,ellipsis:!0,style:{flex:1,minWidth:0,fontSize:14},title:g.title,children:g.title}),g.unknownType&&(0,r.jsx)(v.A,{children:"未知类型"}),(0,r.jsx)(v.A,{color:(0,w.uv)(g.status),children:(0,w.m_)(g.status,L)}),X>0&&(0,r.jsx)(v.A,{color:"red",children:"".concat(X," 个错误")}),A&&"running"===g.status&&(0,r.jsx)(eW,{type:"secondary",style:{fontSize:11},children:"运行中"}),I&&(0,r.jsx)(el.A,{title:"关闭(Esc)",children:(0,r.jsx)(x.Ay,{type:"text",size:"small",className:"nodeInfoClose","aria-label":"关闭信息卡片",onClick:I,children:(0,r.jsx)(eH.A,{})})})]}),(0,r.jsxs)("div",{className:"nodeInfoActions",children:[(0,r.jsx)(x.Ay,{size:"small",onClick:()=>null==R?void 0:R(g),children:"@ 到对话框"}),(0,r.jsx)(x.Ay,{size:"small",onClick:()=>null==N?void 0:N(g),children:"在画布中定位"}),(0,r.jsx)(x.Ay,{size:"small",danger:X>0,onClick:()=>null==S?void 0:S(g),children:"请求修复(预览影响面)"}),A&&"running"===g.status&&E&&(0,r.jsx)(x.Ay,{size:"small",onClick:E,children:"暂停"}),"paused"===g.status&&M&&(0,r.jsx)(x.Ay,{size:"small",onClick:M,children:"继续生成"})]}),K,(0,r.jsx)(eB.A,{size:"small",items:[{key:"overview",label:"概览",children:(0,r.jsxs)(eq.A,{size:"small",column:1,bordered:!0,children:[(0,r.jsx)(eq.A.Item,{label:"状态",children:(0,r.jsx)(v.A,{color:(0,w.uv)(g.status),children:(0,w.m_)(g.status,L)})}),(0,r.jsxs)(eq.A.Item,{label:"类型",children:[(0,w.z9)(g.type),g.unknownType?"(闭集外的类型,按通用卡片渲染)":""]}),(0,r.jsx)(eq.A.Item,{label:"节点 id",children:(0,r.jsx)(e_,{copyable:{text:g.id},style:{margin:0,fontSize:12},children:g.id})}),(0,r.jsx)(eq.A.Item,{label:"稳定序号",children:g.seq}),(0,r.jsx)(eq.A.Item,{label:"父节点",children:g.parentId?(0,r.jsx)(x.Ay,{type:"link",size:"small",style:{padding:0,height:"auto"},onClick:()=>k(g.parentId),children:null!=(p=null==(a=W.get(g.parentId))?void 0:a.title)?p:g.parentId}):"(根节点)"}),(0,r.jsxs)(eq.A.Item,{label:"耗时",children:[(0,w.uH)(F),"running"===g.status?"(运行中)":""]}),(0,r.jsx)(eq.A.Item,{label:"进度",children:g.progress?"".concat(g.progress.label||"进度",":").concat(g.progress.current,"/").concat(g.progress.total):"—"}),(0,r.jsxs)(eq.A.Item,{label:"子节点数",children:[g.children.length,j?"(当前处于影响面高亮)":""]}),(0,r.jsxs)(eq.A.Item,{label:"开始 / 完成",children:[g.startedAt?new Date(g.startedAt).toLocaleString():"—"," / ",g.completedAt?new Date(g.completedAt).toLocaleString():"—"]})]})},{key:"issues",label:"问题".concat(G.length>0?"(".concat(G.length,")"):""),children:0===G.length?(0,r.jsx)(eS.A,{image:eS.A.PRESENTED_IMAGE_SIMPLE,description:"该节点没有记录问题"}):(0,r.jsx)(eD.A,{size:"small",dataSource:G,renderItem:e=>{var t,n;let l=null!=(n=eU[e.level])?n:{color:"default",text:String(e.level)};return(0,r.jsx)(eD.A.Item,{children:(0,r.jsxs)(m.A,{direction:"vertical",size:2,style:{width:"100%"},children:[(0,r.jsxs)(m.A,{wrap:!0,size:4,children:[(0,r.jsx)(v.A,{color:l.color,children:l.text}),e.category&&(0,r.jsx)(v.A,{children:e.category}),e.repairability&&(0,r.jsx)(v.A,{color:"blue",children:e.repairability}),(null==(t=e.provenance)?void 0:t.detectorId)&&(0,r.jsx)(el.A,{title:e.provenance.fingerprint,children:(0,r.jsx)(v.A,{children:e.provenance.detectorId})})]}),(0,r.jsx)(eW,{style:{fontSize:12},children:e.message}),e.suggestion&&(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:12},children:["建议:",e.suggestion]}),(e.chapterId||e.sectionTitle)&&(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:11},children:["位置:",e.chapterId||""," ",e.sectionTitle||""]})]})})}})},...Q.length>0?[{key:"details",label:"明细(".concat(Q.length,")"),children:(0,r.jsx)(eD.A,{size:"small",dataSource:Q,renderItem:e=>(0,r.jsx)(eD.A.Item,{style:{paddingBlock:3},children:(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:e.message})})})}]:[],...T&&T.length>0?[{key:"events",label:"事件(".concat(T.length,")"),children:(0,r.jsx)(eD.A,{size:"small",dataSource:[...T].slice(-40).reverse(),renderItem:e=>(0,r.jsx)(eD.A.Item,{style:{paddingBlock:3},children:(0,r.jsxs)(m.A,{size:6,wrap:!0,children:[(0,r.jsxs)(eW,{type:"secondary",style:{fontSize:11},children:["#",e.seq]}),(0,r.jsx)(v.A,{style:{fontSize:11},children:e.type}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:11},children:new Date(e.at).toLocaleTimeString()}),e.detail?(0,r.jsx)(eW,{style:{fontSize:11},ellipsis:!0,children:e.detail}):null]})})})}]:[],{key:"impact",label:"影响面",children:V},..._?[{key:"skills",label:"技能",children:(()=>{let e="string"==typeof g.metrics.skillId?g.metrics.skillId:void 0;return(0,r.jsxs)(eq.A,{size:"small",column:1,bordered:!0,children:[(0,r.jsx)(eq.A.Item,{label:"技能 id",children:null!=e?e:g.id}),(0,r.jsx)(eq.A.Item,{label:"技能名",children:g.title}),(0,r.jsx)(eq.A.Item,{label:"命中章节",children:"string"==typeof g.metrics.chapter?g.metrics.chapter:"—"}),(0,r.jsx)(eq.A.Item,{label:"状态",children:(0,r.jsx)(v.A,{color:(0,w.uv)(g.status),children:(0,w.m_)(g.status,L)})})]})})()}]:[],...U.length>0?[{key:"metrics",label:"指标",children:(0,r.jsx)(eq.A,{size:"small",column:1,bordered:!0,children:U.map(e=>(0,r.jsx)(eq.A.Item,{label:e.key,children:e.text.replace("".concat(e.key,": "),"")},e.key))})}]:[],...g.payloadRef?[{key:"payload",label:"载荷",children:(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(e_,{copyable:{text:g.payloadRef},style:{margin:0,fontSize:12},children:g.payloadRef}),(0,r.jsx)(eW,{type:"secondary",style:{fontSize:12},children:"8.6 / 附录 F.2:节点**不得携带载荷**(`agentWorkflow` 已是 p50 2.2 MB / max 94.6 MB)。 prompt / response / 证据快照等明细都在内容寻址的 `artifacts/<sha256>` 里,这里只有引用。"})]})}]:[]]})]})}var eO=n(34038);let{Text:eQ}=d.A,eX=["upsert","status","rollup","reset","start","stage","thinking","text","tool_call_preview","progress","error","done","complete","log"];function eV(e,t){var n,r;let l=null!=(n=e.projectRoot)?n:t;return{specId:e.templateId||e.id,promptIds:null!=(r=e.promptIds)?r:[],...e.materialRoot?{materialRoot:e.materialRoot}:{},...l?{projectRoot:l}:{},...e.templateName?{title:e.templateName}:{}}}function eJ(e,t){let n=t.node;if(!n||"string"!=typeof n.id)return!0;if("upsert"===t.type)return e.set(n.id,n),!0;let r=e.get(n.id);if(!r){var l,i;return e.set(n.id,{...n,title:null!=(l=n.title)?l:n.id,seq:null!=(i=n.seq)?i:0}),!1}let{startedAt:a,...o}=n;return e.set(n.id,{...r,...o,id:r.id}),!0}function eY(){var e,t,n,i,o,d,k,S,I,C,R,N,E,M,L,D,P,B,_,W,G,O,X,V,J,Z,$,ee,et;let en=(0,c.useRouter)(),el=(0,A.Vr)(),{message:ei}=u.A.useApp(),ea="string"==typeof en.query.id?en.query.id:"",eo="string"==typeof en.query.projectRoot?en.query.projectRoot:void 0,[es,ec]=(0,l.useState)(null),[ed,eu]=(0,l.useState)(!0),[eh,ep]=(0,l.useState)(null),[em,ex]=(0,l.useState)(new Map),[eg,ev]=(0,l.useState)("connecting"),[ef,ey]=(0,l.useState)(0),[ej,eA]=(0,l.useState)(null),[eb,ew]=(0,l.useState)("all"),[ek,eS]=(0,l.useState)(!0),[eI,eC]=(0,l.useState)(0),[ez,eR]=(0,l.useState)(()=>Date.now()),eD=(0,l.useCallback)(()=>{ek&&eC(Date.now()+eT.WF)},[ek]),[eP,eB]=(0,l.useState)(""),[eq,eH]=(0,l.useState)(!1),[e_,eW]=(0,l.useState)([]),[,eF]=(0,l.useState)([]),[eU,eY]=(0,l.useState)([]),[eZ,e$]=(0,l.useState)(null),[e0,e1]=(0,l.useState)(null),{bubbles:e2,push:e4,clear:e5}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1500,[t,n]=(0,l.useState)([]),r=(0,l.useRef)(null),i=(0,l.useCallback)(t=>{let r=function(e){var t,n;let r=null!=(t=e.now)?t:Date.now(),l=null!=(n=e.freshMs)?n:15e3,{before:i,after:a}=e,o=a.parentId;if(!o)return null;if(!i){if("number"!=typeof a.startedAt||r-a.startedAt>l||r-a.startedAt<-l)return null;let e=F(a,"dispatch");return e?{id:"".concat(o,"->").concat(a.id,":dispatch"),fromId:o,toId:a.id,kind:"dispatch",label:e,at:r}:null}if(!(H.has(a.status)&&!H.has(i.status))||"number"!=typeof a.completedAt||r-a.completedAt>l||r-a.completedAt<-l)return null;let s=F(a,"report");return s?{id:"".concat(a.id,"->").concat(o,":report"),fromId:a.id,toId:o,kind:"report",label:s,at:r}:null}(t);r&&n(t=>(function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1500,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6,i=[...e.filter(e=>n-e.at<r&&e.id!==t.id),t];return i.length>l?i.slice(i.length-l):i})(t,r,r.at,e))},[e]),a=(0,l.useCallback)(()=>{n(e=>0===e.length?e:[])},[]);return(0,l.useEffect)(()=>{if(0!==t.length)return r.current=setTimeout(()=>{r.current=null,n(t=>(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1500,r=e.filter(e=>t-e.at<n);return r.length===e.length?e:r})(t,Date.now(),e))},Math.max(0,t.reduce((e,t)=>Math.min(e,t.at),1/0)+e-Date.now())),()=>{r.current&&(clearTimeout(r.current),r.current=null)}},[t,e]),{bubbles:t,push:i,clear:a}}(),[e8,e3]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if("function"!=typeof window.matchMedia)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=()=>e3(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]);let[e6,e7]=(0,l.useState)(null),[e9,te]=(0,l.useState)(()=>new Map),[tt,tn]=(0,l.useState)([]),[tr,tl]=(0,l.useState)(null),[ti,ta]=(0,l.useState)(!1),[to,ts]=(0,l.useState)([]),[tc,td]=(0,l.useState)(null),[tu,th]=(0,l.useState)(!1),tp=(0,eT.s_)(),{centerOn:tm,zoomAt:tx,fit:tg,reset:tv}=tp,tf=(0,l.useCallback)(()=>{var e;let t=null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect();if(!t)return{left:0,top:0,right:0,bottom:0};let n=e=>{let n=document.querySelector(e);if(!n)return null;let r=n.getBoundingClientRect();return{top:r.top-t.top,bottom:r.bottom-t.top}},r=n(".canvasToolbar"),l=n(".canvasInputBar"),i=Math.min(r?r.bottom+8:24,.4*t.height),a=Math.max(l?l.top-8:t.height-24,.6*t.height);return{left:24,top:i,right:t.width-24,bottom:a}},[tp.containerRef]),ty=(0,l.useRef)(new Map),tj=(0,l.useRef)(0),tA=(0,l.useRef)({nodes:[],events:[],cursor:0}),tb=(0,l.useRef)(null),tw=(0,l.useRef)(0),tk=(0,l.useRef)(eo),tS=(0,l.useRef)(!1),tI=(0,l.useCallback)(e=>{let t=e.key?el(e.key):e.text,n=t===e.key?e.text:t;tw.current+=1,eF(t=>[{id:tw.current,kind:e.kind,text:n,at:Date.now()},...t].slice(0,100)),"error"===e.kind?ei.error(n):"warning"===e.kind?ei.warning(n):"success"===e.kind&&ei.success(n)},[ei,el]),tC=(0,b.tl)({projectRoot:eo,documentId:ea||null,onNotice:tI,t:el}),{refreshDocuments:tz,applyRecord:tR}=tC,tN=function(e,t){let[n,r]=(0,l.useState)({loading:!1,error:null,preview:null}),i=(0,l.useRef)(0),a=(0,l.useCallback)(async()=>{if(!e)return void r({loading:!1,error:"缺少记录 id,无法取回成稿预览",preview:null});let n=i.current+1;i.current=n,r(e=>({...e,loading:!0,error:null}));try{let{preview:l}=await (0,j.sz)(e,t);if(i.current!==n)return;r({loading:!1,error:null,preview:l})}catch(e){if(i.current!==n)return;r({loading:!1,error:e instanceof Error?e.message:"取回成稿预览失败",preview:null})}},[e,t]),o=(0,l.useCallback)(()=>{i.current+=1,r({loading:!1,error:null,preview:null})},[]);return{...n,load:a,reset:o}}(ea,null!=(E=tk.current)?E:eo),tE=(0,l.useCallback)(()=>{var e;if(ti){tN.reset(),ta(!1);return}ta(!0),tN.load(),(0,j.f$)(null!=(e=tk.current)?e:eo).then(e=>ts(e.assets.filter(e=>e.usedByDocumentIds.includes(ea)))).catch(()=>ts([]))},[ti,tN,ea,eo]),tM=(0,l.useCallback)(e=>{var t;let n=null!=(t=tk.current)?t:eo;if("image"!==e.type)return void(0,j.oS)(e.id,"file",n).catch(()=>tI({kind:"error",text:"打开资产失败"}));th(!1),td(e)},[eo,tI]),tT=(0,l.useCallback)(e=>{tn(t=>t.includes(e)?t:[...t,e])},[]),tL=(0,l.useCallback)(()=>{tb.current||(tb.current=setTimeout(()=>{tb.current=null;let e=tA.current;if(tA.current={nodes:[],events:[],cursor:0},e.nodes.length>0){let n=ty.current,r=0;for(let l of e.nodes){var t;let e=null==(t=l.node)?void 0:t.id,i=e?n.get(e):void 0;eJ(n,l)||(r+=1);let a=e?n.get(e):void 0;a&&e4({...i?{before:i}:{},after:a})}ex(new Map(n)),r>0&&tT("通道收到 ".concat(r," 条指向未知节点的补丁:已按最小节点收下(说明本客户端漏读了 upsert,或日志存在损坏)"))}if(e.cursor>tj.current&&(tj.current=e.cursor),e.events.length>0){let t=e.events;eW(e=>[...t.reverse(),...e].slice(0,200)),ey(e=>t.reduce((e,t)=>Math.max(e,t.seq),e))}},120))},[tT,e4]);(0,l.useEffect)(()=>()=>{tb.current&&clearTimeout(tb.current)},[]);let tD=(0,l.useCallback)((e,t)=>{let n=tA.current;t&&n.nodes.push(t),n.events.push(e),(null==t?void 0:t.logT)&&t.logT>n.cursor&&(n.cursor=t.logT),tL()},[tL]),tP=(0,l.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(ea){e.silent||eu(!0);try{var t,n,r,l,i,a;let e=tk.current?"?projectRoot=".concat(encodeURIComponent(tk.current)):"",o=await fetch("/api/documents/canvas/".concat(encodeURIComponent(ea)).concat(e));if(404===o.status)return void ep("记录不存在(可能已被删除)");if(!o.ok)throw Error(await o.text()||"HTTP ".concat(o.status));let s=await o.json();tk.current=null!=(r=s.document.projectRoot)?r:tk.current,ec(s),ep(null),tn(null!=(l=s.degraded)?l:[]);let c=function(e){let t=[],n=e=>{for(let r of e){let{children:e,...l}=r;t.push(l),e&&n(e)}};return n(e),t}(null!=(i=null==(t=s.nodes)?void 0:t.tree)?i:[]),d=new Map(c.map(e=>[e.id,e]));ty.current=d,ex(d),tj.current=Math.max(tj.current,null!=(a=null==(n=s.nodes)?void 0:n.cursor)?a:0)}catch(e){ep(e instanceof Error?e.message:String(e))}finally{e.silent||eu(!1)}}},[ea]);(0,l.useEffect)(()=>{tP()},[tP]),(0,l.useEffect)(()=>{var e;let t=null==es||null==(e=es.nodes)?void 0:e.depth;null==t||tS.current||ew(t)},[es]),(0,l.useEffect)(()=>{ea&&tz()},[ea,tz]),(0,l.useEffect)(()=>{let e=tC.documents.find(e=>e.id===ea);e&&tR(e)},[tR,ea,tC.documents]);let tB=(0,l.useCallback)(async()=>{if(ea)try{var e,t;let n=new URLSearchParams({since:String(tj.current)});tk.current&&n.set("projectRoot",tk.current);let r=await fetch("/api/documents/generated/".concat(encodeURIComponent(ea),"/nodes?").concat(n.toString()));if(!r.ok)return;let l=await r.json(),i=ty.current;for(let t of null!=(e=l.nodes)?e:[])eJ(i,{type:"upsert",node:t});(null!=(t=l.nodes)?t:[]).length>0&&ex(new Map(i)),l.cursor&&(tj.current=Math.max(tj.current,l.cursor)),l.downgraded&&tT(l.reason||"增量过大,服务端已降级为全量快照")}catch(e){}},[tT,ea]);(0,l.useEffect)(()=>{if(!ea)return;let e=setInterval(()=>{tB()},1e4);return()=>clearInterval(e)},[ea,tB]),(0,l.useEffect)(()=>{if(!ea||"undefined"==typeof EventSource)return;let e=tk.current?"?projectRoot=".concat(encodeURIComponent(tk.current)):"",t=new EventSource("/api/documents/generated/".concat(encodeURIComponent(ea),"/events").concat(e));ev("connecting");let n=e=>t=>{var n,r,l;let i={};try{i=JSON.parse(t.data)}catch(e){}let a=null!=(l=i.type)?l:e;"reset"===a&&(e5(),tP({silent:!0}),tT("通道补发不可用(服务端重启或环形覆盖):已重取全量快照"));let o=null==(n=i.node)?void 0:n.title;tD({seq:"number"==typeof i.seq?i.seq:0,type:a,at:"number"==typeof i.at?i.at:Date.now(),...i.nodeId?{nodeId:i.nodeId}:{},...o?{nodeTitle:o}:{},...(null==(r=i.payload)?void 0:r.message)?{detail:i.payload.message}:{}},i.node?{type:a,node:i.node,...i.logT?{logT:i.logT}:{}}:void 0),i.node&&tz()},r=eX.map(e=>[e,n(e)]);for(let[e,n]of(t.onopen=()=>ev("open"),t.onerror=()=>{ev("error"),tB()},r))t.addEventListener(e,n);return t.onmessage=n("message"),()=>{for(let[e,n]of r)t.removeEventListener(e,n);t.close()}},[tT,e5,ea,tP,tD,tz,tB]),(0,l.useEffect)(()=>{e5()},[e5,ea]);let tq=(0,l.useMemo)(()=>(0,w.Jr)([...em.values()],"all"===eb?void 0:eb),[em,eb]),tH=(0,l.useMemo)(()=>(0,w.x8)(tq),[tq]),t_=(0,l.useMemo)(()=>(0,w.PI)(tq),[tq]),tW=(0,l.useMemo)(()=>0!==e9.size||e6?(0,w.bJ)(t_,(0,w.Kq)(e9,e6)):t_,[t_,e9,e6]),tF=(0,l.useRef)(1);tF.current=tp.view.k;let tU=(0,l.useRef)(!1);tU.current=null!==e6;let tG=(0,l.useCallback)((e,t,n,r)=>{let{dx:l,dy:i}=(0,w.qj)({dx:t,dy:n},tF.current);if("move"===r)return void e7({id:e.id,dx:l,dy:i});e7(null),(0!==t||0!==n)&&te(t=>{var n;let r=new Map(t),a=null!=(n=r.get(e.id))?n:{dx:0,dy:0};return r.set(e.id,{dx:a.dx+l,dy:a.dy+i}),r})},[]),tO=(0,l.useCallback)(()=>{e7(null),te(new Map)},[]),tQ=(0,l.useMemo)(()=>new Map(tH.map(e=>[e.id,e])),[tH]),tX=ej&&null!=(M=tQ.get(ej))?M:null,tV=(0,l.useMemo)(()=>{if(ej)return T(tH.map(eK),ej)},[tH,ej]),tJ=(0,l.useMemo)(()=>{var e;return new Set(null!=(e=null==tV?void 0:tV.affectedNodeIds)?e:[])},[tV]),tY=(0,l.useMemo)(()=>new Set(ej?[...(0,w.II)(tq,ej),ej]:[]),[tq,ej]),tK=(0,l.useMemo)(()=>(0,w.Kg)(tW),[tW]),tZ=(0,l.useMemo)(()=>(function(e,t){var n,r;let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=null!=(n=l.limit)?n:6,a=null!=(r=l.recentLimit)?r:3,o=[],s=[],c=(e,n)=>{for(let r of e)Q.has(r.status)?o.push(Y(r,n,t)):"completed"===r.status&&"number"==typeof r.completedAt&&t-r.completedAt<=9e4&&s.push(Y(r,n,t)),r.children.length>0&&c(r.children,n+1)};return c(e,0),o.sort((e,n)=>{var r,l;let i=null!=(r=K(e,t))?r:0;return(null!=(l=K(n,t))?l:0)-i||e.id.localeCompare(n.id)}),s.sort((e,t)=>{var n,r;return(null!=(n=t.completedAt)?n:0)-(null!=(r=e.completedAt)?r:0)||e.id.localeCompare(t.id)}),{running:o.slice(0,i),recent:s.slice(0,a),runningTotal:o.length,recentTotal:s.length}})(tq,Date.now()),[tq]),t$=(0,l.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=[],r=e=>{for(let i of e){if("supervisor"===i.type){var t,l;let e="string"==typeof(null==(t=i.metrics)?void 0:t.action)?i.metrics.action:"unknown",r="string"==typeof(null==(l=i.metrics)?void 0:l.note)?i.metrics.note:void 0;n.push({id:i.id,action:e,title:i.title||"调度决策",...r?{note:r}:{},status:i.status,..."number"==typeof i.completedAt?{at:i.completedAt}:"number"==typeof i.startedAt?{at:i.startedAt}:{}})}i.children.length>0&&r(i.children)}};return r(e),n.sort((e,t)=>{var n,r;return(null!=(n=t.at)?n:0)-(null!=(r=e.at)?r:0)||e.id.localeCompare(t.id)}),n.slice(0,t)})(tq),[tq]),t0=(0,l.useCallback)(e=>{let t=tQ.get(e.fromId);return t?tJ.has(e.fromId)&&tJ.has(e.toId)?"affected":2>=(0,w.vp)(t.status)?"warn":tY.has(e.fromId)&&tY.has(e.toId)?"active":"default":"default"},[tJ,tY,tQ]);(0,l.useEffect)(()=>{if(0===eI)return;let e=setInterval(()=>eR(Date.now()),1e3);return()=>clearInterval(e)},[eI]);let t1=(0,l.useMemo)(()=>{if(0===tH.length)return null;let e=tH.filter(e=>"running"===e.status),t=e.length>0?e:tH;return t.reduce((e,t)=>{var n,r;return(null!=(n=t.seq)?n:0)>=(null!=(r=e.seq)?r:0)?t:e},t[0])},[tH]),t2=null==t1?void 0:t1.id,t4=(0,l.useMemo)(()=>{var e;return(0,eT.be)({following:ek,pausedUntil:eI,now:ez,node:t1?{title:t1.title,...(null==(e=t1.metrics)?void 0:e.roundIteration)!==void 0?{round:t1.metrics.roundIteration}:{}}:void 0})},[ek,eI,ez,t1]);(0,l.useEffect)(()=>{var e;if(!ek||!t2||eI>Date.now()||tU.current)return;let t=null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect();if(!t)return;let n=tW.nodes.find(e=>e.node.id===t2);n&&(0,eT.xA)({x:n.x,y:n.y,width:w.zT,height:w.EL},tp.view,{width:t.width,height:t.height},tf())&&tm(n.x,n.y,void 0,tf())},[tm,ek,eI,tW.nodes,t2,tf,tp.containerRef,tp.view]),(0,l.useEffect)(()=>{var e;if(!(null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect())||0===tW.nodes.length)return;let{dx:t,dy:n}=(0,eT.B)({width:tW.width,height:tW.height},tp.view,tf());tp.panBy(t,n)},[tW.width,tW.height,tW.nodes.length]);let t5=(0,l.useCallback)(e=>{eA(e);let t=tW.nodes.find(t=>t.node.id===e);t&&tm(t.x,t.y,void 0,tf())},[tm,tW.nodes,tf]);(0,l.useEffect)(()=>{if(!ej)return;let e=e=>{"Escape"===e.key&&eA(null)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ej]);let t8=(0,l.useCallback)(e=>{eB(t=>""===t||t.endsWith(" ")?"".concat(t,"@").concat(e.title," "):"".concat(t," @").concat(e.title," "))},[]),t3=(0,l.useCallback)(()=>{let e=null==es?void 0:es.document;if(!e)return;let t=eP.trim();t&&(eH(!0),(0,j.wI)(e.id,t,{...tk.current?{projectRoot:tk.current}:{}}).then(e=>{var t;tI({kind:"info",text:e.answer?"".concat(e.receipt,"\n").concat(e.answer):e.receipt}),eY(null!=(t=e.candidates)?t:[]),eB("")}).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"指令未受理"})).finally(()=>eH(!1)))},[es,tI,eP]),t6=(0,l.useCallback)(()=>{let e=null==es?void 0:es.document;e&&(eH(!0),tC.startGeneration(eV(e,tk.current),eP.trim()).finally(()=>eH(!1)))},[es,tC,eP]),t7=(0,l.useCallback)(e=>{let t=null==es?void 0:es.document;t&&(eH(!0),(0,j.wI)(t.id,"(选定:".concat(e.label,")"),{...tk.current?{projectRoot:tk.current}:{},acceptedCandidate:{kind:e.kind}}).then(e=>{tI({kind:"info",text:e.receipt}),eY([])}).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"指令未受理"})).finally(()=>eH(!1)))},[es,tI]),t9=(0,l.useCallback)(async()=>{let e=null==es?void 0:es.document;if(!e)return;let t=eV(e,tk.current);if(!t.projectRoot)return void tI({kind:"error",text:"未识别当前项目,无法预览结构"});try{let e=await (0,j.dk)({promptIds:t.promptIds,requirement:eP.trim(),...t.materialRoot?{materialRoot:t.materialRoot}:{},...t.title?{title:t.title}:{},projectRoot:t.projectRoot});tl({title:e.title,chapters:e.chapters,outlineSource:e.derivation.outlineSource,materialScope:e.materialScope})}catch(e){tI({kind:"error",text:e instanceof Error?e.message:"结构预览失败"})}},[es,tI,eP]),ne=(0,l.useCallback)(e=>{let t=T(tH.map(eK),e.id);if(!t)return void tI({kind:"warning",text:"该节点不在当前节点集合里,无法评估影响面"});e$({nodeId:e.id,nodeTitle:e.title,nodeType:e.type,impact:t})},[tH,tI]),nt=(0,l.useCallback)(()=>{if(!eZ)return;let e=(0,w.RV)(eZ.nodeTitle,eZ.impact);eB(t=>t?"".concat(t," ").concat(e):e),e$(null)},[eZ]),[nn,nr]=(0,l.useState)(null),[nl,ni]=(0,l.useState)(null),na=(0,l.useCallback)(e=>{if(!eZ)return;let t=eZ.nodeId;nr({nodeId:t,phase:"creating"}),(0,j.xU)({documentId:ea,targetNodeId:t,userMessage:e}).then(e=>{var n,r,l,i;nr({nodeId:t,phase:"confirmable",requestId:null==(n=e.request)?void 0:n.id,attribution:"string"==typeof e.attribution?e.attribution:void 0,localizationNote:e.localizationNote,...e.needsLocalization?{needsLocalization:!0}:{},...(null==(i=e.request)||null==(l=i.localization)||null==(r=l.candidates)?void 0:r.length)?{candidates:e.request.localization.candidates}:{}})}).catch(e=>{nr({nodeId:t,phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea,eZ]),no=(0,l.useCallback)(e=>{ni({phase:"creating"}),(0,j.xU)({documentId:ea,userMessage:e}).then(e=>{var t,n,r,l;ni({phase:"confirmable",requestId:null==(t=e.request)?void 0:t.id,attribution:"string"==typeof e.attribution?e.attribution:void 0,candidates:null!=(l=null==(r=e.request)||null==(n=r.localization)?void 0:n.candidates)?l:[],localizationNote:e.localizationNote})}).catch(e=>{ni({phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea]),ns=(0,l.useCallback)(e=>{(null==nl?void 0:nl.requestId)&&(0,j.Ho)({documentId:ea,requestId:nl.requestId,acceptedNodeId:e}).then(e=>{var t;ni({...nl,phase:"executed",outcome:String(null!=(t=e.outcome)?t:""),notExecutedReason:e.notExecutedReason})}).catch(e=>{ni({...nl,phase:"error",message:e instanceof Error?e.message:String(e)})})},[nl,ea]),nc=(0,l.useCallback)(e=>{(null==nn?void 0:nn.requestId)&&(0,j.Ho)({documentId:ea,requestId:nn.requestId,...e?{acceptedNodeId:e}:{}}).then(e=>{var t;nr({...nn,phase:"executed",outcome:String(null!=(t=e.outcome)?t:""),notExecutedReason:e.notExecutedReason,attribution:"string"==typeof e.attribution?e.attribution:nn.attribution})}).catch(e=>{nr({...nn,phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea,nn]),nd=(0,l.useCallback)(()=>{(null==nn?void 0:nn.requestId)&&(0,j.vX)({documentId:ea,requestId:nn.requestId}).then(e=>{var t,n,r;let l=null==(t=e.restoredChars)?void 0:t.beforeChars,i=null==(n=e.restoredChars)?void 0:n.afterChars;nr({...nn,phase:"executed",outcome:String(null!=(r=e.outcome)?r:"rolled-back"),restoredChars:void 0!==l&&void 0!==i?l-i:void 0})}).catch(e=>{nr({...nn,phase:"error",message:e instanceof Error?e.message:String(e)})})},[ea,nn]),nu=(0,l.useCallback)(()=>{tC.pauseDocument(ea).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"暂停失败"}))},[ea,tC,tI]),nh=(0,l.useCallback)(()=>{tC.resumePausedDocument(ea).catch(e=>tI({kind:"error",text:e instanceof Error?e.message:"继续失败"}))},[ea,tC,tI]),np=null==es?void 0:es.document.status,nm=tC.loading||"generating"===np||"queued"===np,nx=(0,l.useRef)(null),ng=(0,l.useRef)(null),[nv,nf]=(0,l.useState)({width:0,height:0});(0,l.useLayoutEffect)(()=>{let e=ng.current;if(!e)return void nf({width:0,height:0});let t=()=>{let t=e.firstElementChild;if(!t)return;let n=e.offsetWidth,r=Math.max(t.scrollHeight,t.offsetHeight);nf(e=>Math.abs(e.width-n)>2||Math.abs(e.height-r)>2?{width:n,height:r}:e)};t();let n=new ResizeObserver(t);return n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),()=>n.disconnect()},[ej]);let ny=(0,l.useMemo)(()=>{var e;if(!ej)return null;let t=tW.nodes.find(e=>e.node.id===ej),n=null==(e=tp.containerRef.current)?void 0:e.getBoundingClientRect();if(!t||!n)return null;let r=[".canvasToolbar",".canvasInputBar",".canvasRecordsBall"].map(e=>{var t;return null==(t=document.querySelector(e))?void 0:t.getBoundingClientRect()}).filter(e=>!!e).map(e=>({left:e.left-n.left,top:e.top-n.top,right:e.right-n.left,bottom:e.bottom-n.top})),l="".concat(tp.view.x,",").concat(tp.view.y,",").concat(tp.view.k),i=nx.current,a=i&&i.id===ej&&i.viewKey===l?i:null,o=(0,w.Aq)({node:{x:t.x,y:t.y},view:tp.view,box:n,panelWidth:nv.width>0?nv.width:462,panelHeight:nv.height>0?nv.height:480,obstacles:r,...a?{pin:{left:a.left,top:a.top}}:{}});nx.current={id:ej,viewKey:l,left:o.left,top:o.top};let s=Math.round(.62*n.height);return{left:o.left,top:o.top,maxHeight:Math.max(180,Math.min(o.maxHeight,s))}},[tW.nodes,ej,tp,nv]),nj=(0,l.useCallback)(e=>{t8(e),requestAnimationFrame(()=>{var e;return null==(e=document.querySelector(".canvasInputBar textarea"))?void 0:e.focus()})},[t8]),nA=(0,l.useCallback)(e=>{t5(e.id),e1(e.id),window.setTimeout(()=>e1(t=>t===e.id?null:t),1200)},[t5]),nb=(0,l.useCallback)(async e=>{if(ea)try{let{document:t}=await (0,j.v7)(ea,!1,tk.current);if(!t)return void tI({kind:"warning",text:"记录不存在,无法导出"});await tC.export.exportRecord(t,e)}catch(e){tI({kind:"error",text:e instanceof Error?e.message:"导出失败"})}},[ea,tC.export,tI]),nw=tC.boundRecord,nk=function(e,t){if(!e)return;let n=(null==t?void 0:t.docId)===e.id?t:void 0,r=e.deliveryQuality;return r?{...n,docId:e.id,...e.projectRoot?{projectRoot:e.projectRoot}:{},contractQuality:r.receipt,...r.stale?{contractQualityStale:r.stale}:{contractQualityStale:void 0}}:n}(null==es?void 0:es.document,tC.deliveryReadings),nS=tC.canResume;return ea?eh?(0,r.jsx)(p.Ay,{status:"warning",title:"画布打不开",subTitle:eh,extra:(0,r.jsxs)(m.A,{children:[(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(y.A,{}),onClick:()=>{tP()},children:"重试"}),(0,r.jsx)(s(),{href:"/documents",children:(0,r.jsx)(x.Ay,{type:"primary",children:"回到文档页"})})]})}):(0,r.jsxs)("div",{className:"canvasRoot",children:[(0,r.jsx)(a(),{children:(0,r.jsx)("title",{children:(null==es?void 0:es.document.title)?"".concat(es.document.title," \xb7 画布"):"生成画布"})}),(0,r.jsx)(eN,{title:(null==es?void 0:es.document.title)||"生成画布",...np?{status:np}:{},...(null==es?void 0:es.document.updatedAt)!==void 0?{updatedAt:es.document.updatedAt}:{},...(null==es?void 0:es.document.wordCount)!==void 0?{wordCount:es.document.wordCount}:{},agents:tZ,supervisorDecisions:t$,agentsActive:nm,...(null==es?void 0:es.document.createdAt)!==void 0?{startedAt:es.document.createdAt}:{},onLocateAgent:e=>{eA(e),e1(e)},nodeCount:em.size,visibleCount:tW.nodes.length,hiddenCount:null!=(L=null==es?void 0:es.nodes.hiddenCount)?L:0,degraded:tt,skills:{hits:null!=(D=null==es?void 0:es.skills.hits)?D:[],note:null!=(P=null==es?void 0:es.skills.note)?P:""},gate:null!=(B=null==es?void 0:es.gate)?B:null,connection:eg,lastSeq:ef,zoom:tp.view.k,depth:eb,following:ek,followStatus:t4.title,generating:!!nm,resumable:nS,exporting:tC.export.exporting,nonDeliverableExport:tC.export.nonDeliverableExport,onZoomIn:()=>tx(1.2),onZoomOut:()=>tx(1/1.2),onZoomReset:tv,onFit:()=>tg(tW.width,tW.height,tf()),onDepthChange:e=>{tS.current=!0,ew(e)},onToggleFollow:()=>eS(e=>!e),onContinue:()=>{nw&&tC.resumeDocument(nw)},onPause:nu,onResume:nh,onAbort:()=>{tC.abortGeneration()},onExport:e=>{nb(e)},exportReports:tC.export.exportReports,...nk?{deliveryReadings:nk}:{},previewOpen:ti,onTogglePreview:tE,hasNodeOffsets:e9.size>0,onResetNodeLayout:tO,t:el}),(0,r.jsxs)("div",{ref:tp.containerRef,className:"canvasStage",style:{backgroundImage:"radial-gradient(var(--canvasGridDot) 1px, transparent 1px)",backgroundSize:"".concat(eT.VF*tp.view.k,"px ").concat(eT.VF*tp.view.k,"px"),backgroundPosition:"".concat(tp.view.x,"px ").concat(tp.view.y,"px"),cursor:"grab"},onWheelCapture:eD,onPointerDown:e=>{var t;let n=e.target;null!=n&&null!=(t=n.closest)&&t.call(n,".nodeInfoLayer, .canvasToolbar, .canvasInputBar")||(eD(),tp.onPointerDown(e))},onPointerMove:tp.onPointerMove,onPointerUp:tp.endDrag,onPointerLeave:tp.endDrag,onClick:()=>eA(null),children:[ed&&(0,r.jsx)("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"},children:(0,r.jsxs)(m.A,{direction:"vertical",align:"center",children:[(0,r.jsx)(h.A,{}),(0,r.jsx)(eQ,{type:"secondary",children:"正在读取节点日志…"})]})}),!ed&&0===tW.nodes.length&&(0,r.jsx)("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,r.jsxs)(m.A,{direction:"vertical",align:"center",size:8,children:[(0,r.jsx)(eQ,{type:"secondary",children:"还没有节点日志"}),(0,r.jsx)(eQ,{type:"secondary",style:{fontSize:12},children:"节点日志是唯一真相源:这里**不造占位节点**,发起生成后节点会随日志追加而出现。"})]})}),(0,r.jsxs)("div",{style:{position:"absolute",left:0,top:0,transformOrigin:"0 0",transform:"translate(".concat(tp.view.x,"px, ").concat(tp.view.y,"px) scale(").concat(tp.view.k,")"),width:tW.width,height:tW.height},children:[(0,r.jsx)(q,{edges:tW.edges,width:tW.width,height:tW.height,toneOf:t0,flowing:tK}),(0,r.jsx)(U,{bubbles:e2,layout:tW,static:e8}),tW.nodes.map(e=>(0,r.jsx)(er,{node:e.node,x:e.x,y:e.y,selected:e.node.id===ej,affected:tJ.has(e.node.id)&&e.node.id!==ej,flashed:e0===e.node.id,onDrag:tG,onSelect:e=>eA(e.id),t:el},e.node.id))]}),tX&&ny&&(0,r.jsx)("div",{ref:ng,className:"nodeInfoLayer",style:{left:ny.left,top:ny.top,maxHeight:ny.maxHeight},onClick:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:(0,r.jsx)(eG,{node:tX,...tV?{impact:tV}:{},flatNodes:tH,highlighted:!!(ej&&tJ.has(ej)),generating:!!nm,repairPreview:eZ,repairRun:nn,onRunRepair:na,onConfirmRepair:nc,onRollbackRepair:nd,defaultRepairNote:eZ?(0,w.RV)(eZ.nodeTitle,eZ.impact):"",onFocusNode:t5,onRequestRepair:ne,onClose:()=>eA(null),onDraftRepairNote:nt,onCancelRepairPreview:()=>e$(null),onMention:nj,onLocate:nA,onPause:nu,onResume:nh,nodeEvents:e_.filter(e=>e.nodeId===(null==tX?void 0:tX.id)),t:el})})]}),(0,r.jsx)(eL._,{quickActions:[...eU.map(e=>({key:e.kind,label:"按「".concat(e.label,"」执行"),onClick:()=>t7(e)})),{key:"document-repair",label:"按这段要求修复正文(先定位)",onClick:()=>no(eP.trim())},{key:"regenerate",label:"按这段要求再生成一份",onClick:t6}],value:eP,onChange:eB,onSend:t3,generating:!!nm,submitting:eq,disabled:!es,...es?{}:{disabledReason:"正在读取记录…"},selectedNode:tX,onMentionSelected:()=>{tX&&t8(tX)},resumable:nS,onContinue:()=>{nw&&tC.resumeDocument(nw)},onPreviewStructure:()=>{t9()}}),(0,r.jsx)(eE._,{currentDocumentId:ea,...eo?{projectRoot:eo}:{},onSelect:e=>{en.push((0,eM.p)(e.id,e.projectRoot||eo))},onCurrentDeleted:()=>{en.push("/canvas")}}),(0,r.jsxs)(g.A,{open:!!nl,title:"文档级修复(先定位)",onCancel:()=>ni(null),footer:(0,r.jsx)(x.Ay,{onClick:()=>ni(null),children:"关闭"}),width:640,children:[(null==nl?void 0:nl.phase)==="creating"&&(0,r.jsx)(eQ,{type:"secondary",children:"正在定位要改的节点…"}),(null==nl?void 0:nl.phase)==="error"&&(0,r.jsx)(eQ,{type:"danger",children:"修复请求未建立:".concat(null!=(_=nl.message)?_:"")}),(null==nl?void 0:nl.phase)==="confirmable"&&(0,r.jsxs)(m.A,{direction:"vertical",size:8,style:{width:"100%"},children:[(0,r.jsx)(eQ,{type:"secondary",style:{fontSize:12},children:"请求已建立(".concat(null!=(W=nl.requestId)?W:"",")").concat(nl.attribution?";归因:".concat(nl.attribution):"","。")+"点一个候选才会真的改正文——定位这件事由你定,系统不替你点头。"}),(null!=(G=null==(e=nl.candidates)?void 0:e.length)?G:0)===0?(0,r.jsx)(eQ,{type:"warning",children:"系统定位不出候选节点:请改用「@ 节点名」指定,或在节点面板里发起(不猜一个节点去改)"}):nl.candidates.map(e=>(0,r.jsx)("div",{"data-testid":"document-repair-candidate",children:(0,r.jsxs)(m.A,{size:6,wrap:!0,children:[(0,r.jsx)(v.A,{children:"匹配 ".concat(e.score.toFixed(2))}),(0,r.jsx)(eQ,{style:{fontSize:12},children:e.excerpt.slice(0,80)}),(0,r.jsx)(x.Ay,{size:"small",type:"primary",onClick:()=>ns(e.nodeId),children:"定位到该节点并执行"})]})},e.nodeId))]}),(null==nl?void 0:nl.phase)==="executed"&&(0,r.jsxs)(m.A,{direction:"vertical",size:6,children:[(0,r.jsx)(v.A,{color:"applied"===nl.outcome?"green":"rolled-back"===nl.outcome?"orange":"red",children:"执行结果:".concat(null!=(O=nl.outcome)?O:"未执行")}),nl.notExecutedReason&&(0,r.jsx)(eQ,{type:"danger",style:{fontSize:12},children:nl.notExecutedReason})]})]}),(0,r.jsx)(eO.B,{open:!!tr,title:null!=(X=null==tr?void 0:tr.title)?X:"",chapters:null!=(V=null==tr?void 0:tr.chapters)?V:[],...(null==tr?void 0:tr.outlineSource)?{outlineSource:tr.outlineSource}:{},...(null==tr?void 0:tr.materialScope)?{materialScope:tr.materialScope}:{},onClose:()=>tl(null)}),(0,r.jsxs)(g.A,{open:ti,title:"成稿预览",onCancel:()=>{tN.reset(),ta(!1)},footer:(0,r.jsxs)(m.A,{children:[(0,r.jsx)(x.Ay,{onClick:()=>{tN.load()},loading:tN.loading,children:"重新取回"}),(0,r.jsx)(x.Ay,{type:"primary",onClick:()=>{tN.reset(),ta(!1)},children:"关闭"})]}),width:920,styles:{body:{maxHeight:"72vh",overflow:"auto",background:"var(--colorBgLayout)",padding:"16px 20px"}},style:{top:32},children:[(0,r.jsx)(z,{status:null!=(J=null==(t=tN.preview)?void 0:t.status)?J:np,title:null!=(Z=null==(n=tN.preview)?void 0:n.title)?Z:null==es?void 0:es.document.title,html:null==(i=tN.preview)?void 0:i.html,source:null==(o=tN.preview)?void 0:o.source,truncated:null==(d=tN.preview)?void 0:d.truncated,totalChars:null==(k=tN.preview)?void 0:k.totalChars,renderedChars:null==(S=tN.preview)?void 0:S.renderedChars,stats:null==(I=tN.preview)?void 0:I.stats,gate:null!=(ee=null!=($=null==(C=tN.preview)?void 0:C.gate)?$:null==es?void 0:es.gate)?ee:null,deliveryReadings:nk,loading:tN.loading,error:tN.error,onRetry:()=>{tN.load()},updatedAt:null==(R=tN.preview)?void 0:R.updatedAt,generatedAt:null==(N=tN.preview)?void 0:N.generatedAt,t:el}),(0,r.jsxs)("div",{style:{marginTop:16,borderTop:"1px solid var(--colorBorderSecondary)",paddingTop:12},children:[(0,r.jsx)(eQ,{strong:!0,style:{fontSize:13},children:"本档用到的资产"}),0===to.length?(0,r.jsx)("div",{children:(0,r.jsx)(eQ,{type:"secondary",style:{fontSize:12},children:"本档暂无资产"})}):(0,r.jsxs)(m.A,{direction:"vertical",size:4,style:{width:"100%",marginTop:6},children:[to.slice(0,20).map(e=>(0,r.jsxs)(m.A,{size:8,children:[(0,r.jsx)(eQ,{style:{fontSize:12},children:e.name}),(0,r.jsx)(x.Ay,{size:"small",type:"link",onClick:()=>tM(e),children:"打开"})]},e.id)),to.length>20?(0,r.jsxs)(eQ,{type:"secondary",style:{fontSize:12},children:["还有 ",to.length-20," 项未列出"]}):null]})]})]}),(0,r.jsxs)(g.A,{open:!!tc,title:tc?"资产预览:".concat(tc.name):"",onCancel:()=>{td(null),th(!1)},footer:(0,r.jsxs)(m.A,{children:[tu&&tc?(0,r.jsx)(x.Ay,{onClick:()=>{var e;(0,j.oS)(tc.id,"file",null!=(e=tk.current)?e:eo).catch(()=>tI({kind:"error",text:"打开资产失败"}))},children:"用系统程序打开"}):null,(0,r.jsx)(x.Ay,{type:"primary",onClick:()=>{td(null),th(!1)},children:"关闭"})]}),width:760,styles:{body:{maxHeight:"68vh",overflow:"auto"}},children:[tc&&!tu?(0,r.jsx)("img",{alt:tc.name,src:(0,j.iN)(tc.id,null!=(et=tk.current)?et:eo),style:{maxWidth:"100%",display:"block",margin:"0 auto"},onError:()=>th(!0)}):null,tu&&(0,r.jsx)(f.A,{type:"info",showIcon:!0,message:"这个资产不能在应用内渲染",description:"服务端只对图片(PNG / JPEG / WebP,按文件头验证)提供应用内渲染;其它形态请用系统程序打开。"})]})]}):(0,r.jsx)("div",{className:"appShellPlaceholder",children:(0,r.jsx)(h.A,{style:{margin:48}})})}function eK(e){return e}},72210:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/canvas/[id]",function(){return n(38977)}])}},e=>{e.O(0,[310,700,914,174,569,665,511,709,530,636,593,792],()=>e(e.s=72210)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[124],{48161:(e,t,o)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/canvas",function(){return o(88785)}])},88785:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>S});var n=o(65321),a=o(97109),r=o(3454),c=o.n(r),i=o(86109),l=o(17807),s=o(6578),u=o(85587),d=o(8665),p=o(57481),v=o(28629),m=o(34038),h=o(52057);function S(){var e,t,o;let r=(0,h.s_)(),S=(0,i.useRouter)(),g=(0,u.Vr)(),{message:x}=l.A.useApp(),[f,j]=(0,a.useState)([]),[w,b]=(0,a.useState)([]),[P,y]=(0,a.useState)(""),[_,k]=(0,a.useState)(""),[C,N]=(0,a.useState)([]),[E,R]=(0,a.useState)(""),[I,D]=(0,a.useState)(!1),[M,O]=(0,a.useState)(null);(0,a.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([(0,s.ef)(),(0,s.dx)()]);b(e.groups),y(e.projectRoot),j(t)}catch(e){x.error(e instanceof Error?e.message:"读取项目资料/提示词失败")}})()},[x]);let z=(0,a.useMemo)(()=>w.map(e=>({value:e.root,label:"".concat(e.root,"(").concat(e.fileCount," 份").concat(e.mixedProjectNos?" \xb7 含多个项目编号,需先拆分":"",")")})),[w]),A=(0,a.useMemo)(()=>f.filter(e=>"custom"===e.source).map(e=>({value:e.id,label:e.projectName})),[f,P]),T=(0,a.useMemo)(()=>A.filter(e=>C.includes(e.value)),[A,C]),U=null!=(e=z.find(e=>e.value===_))?e:null,V=(0,a.useCallback)(e=>{k(e)},[]),X=(0,a.useCallback)(async()=>{if(0!==T.length&&U){D(!0);try{let e=await (0,s.OX)({promptIds:C,requirement:E,materialRoot:_,..._?{projectName:_}:{},projectRoot:P});if(!e.documentId)throw Error("服务端未返回 documentId");await S.push("/canvas/".concat(encodeURIComponent(e.documentId),"?projectRoot=").concat(encodeURIComponent(P)))}catch(e){x.error(e instanceof Error?e.message:"创建生成任务失败")}finally{D(!1)}}},[T,U,C,E,P,S,x]),B=(0,a.useCallback)(async()=>{if(0!==T.length&&U)try{let e=await (0,s.dk)({promptIds:C,requirement:E,materialRoot:_,..._?{projectName:_}:{},projectRoot:P});O({title:e.title,chapters:e.chapters,outlineSource:e.derivation.outlineSource,materialScope:e.materialScope})}catch(e){x.error(e instanceof Error?e.message:"结构预览失败")}},[T,U,C,E,P,x]);return(0,n.jsxs)("div",{className:"canvasRoot",children:[(0,n.jsx)(c(),{children:(0,n.jsx)("title",{children:g("nav.canvas")})}),(0,n.jsx)("div",{ref:r.containerRef,className:"canvasStage",style:{backgroundImage:"radial-gradient(var(--canvasGridDot) 1px, transparent 1px)",backgroundSize:"".concat(h.VF*r.view.k,"px ").concat(h.VF*r.view.k,"px"),backgroundPosition:"".concat(r.view.x,"px ").concat(r.view.y,"px"),cursor:"grab"},onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.endDrag,onPointerLeave:r.endDrag,children:(0,n.jsx)("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,n.jsxs)("div",{style:{textAlign:"center",maxWidth:420},children:[(0,n.jsx)("div",{style:{fontSize:15,marginBottom:6},children:"新画布"}),(0,n.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",lineHeight:1.7},children:["还没有节点日志——节点日志是唯一真相源,这里不造占位节点。",(0,n.jsx)("br",{}),"用下方的「+」选择提示词与项目,写下要求后点「生成」,节点会随日志追加而出现。"]})]})})}),(0,n.jsx)(p._,{...P?{projectRoot:P}:{},onSelect:e=>{S.push((0,v.p)(e.id,e.projectRoot||P))},onCurrentDeleted:()=>void 0}),(0,n.jsx)(d._,{value:E,onChange:R,onSend:()=>{X()},generating:!1,submitting:I,disabled:!1,requireGenerationSetup:!0,promptOptions:A,projectOptions:z,selectedPrompts:T,selectedProject:U,onSelectPrompts:N,onSelectProject:V,selectedNode:null,onMentionSelected:()=>void 0,resumable:!1,onContinue:()=>void 0,onPreviewStructure:()=>{B()}}),(0,n.jsx)(m.B,{open:!!M,title:null!=(t=null==M?void 0:M.title)?t:"",chapters:null!=(o=null==M?void 0:M.chapters)?o:[],...(null==M?void 0:M.outlineSource)?{outlineSource:M.outlineSource}:{},...(null==M?void 0:M.materialScope)?{materialScope:M.materialScope}:{},onClose:()=>O(null)})]})}}},e=>{e.O(0,[310,700,174,511,835,530,636,593,792],()=>e(e.s=48161)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{9137:(e,l,t)=>{"use strict";t.d(l,{Ay:()=>A});var n=t(9750),r=t(97109),a=t(42644),o=t(10252),s=t(74567),i=t(48921),d=t(98379),c=t(3638),u=t(632),g=t(34475),m=t(52093),h=t(60815),p=t(5741);let f=null,x=e=>e(),w=[],y={};function k(){let{getContainer:e,duration:l,rtl:t,maxCount:n,top:r,stack:a}=y,o=e?.()||document.body;return{getContainer:()=>o,duration:l,rtl:t,maxCount:n,top:r,stack:a}}let v=r.forwardRef((e,l)=>{let{messageConfig:t,sync:n}=e,{getPrefixCls:a}=(0,r.useContext)(s.QO),i=y.prefixCls||a("message"),d=(0,r.useContext)(o.B),[c,u]=(0,h.y)({...t,prefixCls:i,...d.message});return r.useImperativeHandle(l,()=>{let e={...c};return Object.keys(e).forEach(l=>{e[l]=(...e)=>(n(),c[l].apply(c,e))}),{instance:e,sync:n}}),u}),b=r.forwardRef((e,l)=>{let[t,n]=r.useState(k),a=()=>{n(k)};r.useEffect(a,[]);let o=(0,i.cr)(),s=o.getRootPrefixCls(),d=o.getIconPrefixCls(),c=o.getTheme(),u=r.createElement(v,{ref:l,sync:a,messageConfig:t});return r.createElement(i.Ay,{prefixCls:s,iconPrefixCls:d,theme:c},o.holderRender?o.holderRender(u):u)}),j=()=>{if(!f){let e=document.createDocumentFragment(),l={fragment:e};f=l,x(()=>{(0,a.XX)(r.createElement(b,{ref:e=>{let{instance:t,sync:n}=e||{};Promise.resolve().then(()=>{!l.instance&&t&&(l.instance=t,l.sync=n,j())})}}),e)});return}f.instance&&(w.forEach(e=>{let{type:l,skipped:t}=e;if(!t)switch(l){case"open":x(()=>{let l=f.instance.open({...y,...e.config});l?.then(e.resolve),e.setCloseFn(l)});break;case"destroy":x(()=>{f?.instance.destroy(e.key)});break;default:x(()=>{var t;let r=(t=f.instance)[l].apply(t,(0,n.A)(e.args));r?.then(e.resolve),e.setCloseFn(r)})}}),w=[])},_={open:function(e){let l=(0,p.E)(l=>{let t,n={type:"open",config:e,resolve:l,setCloseFn:e=>{t=e}};return w.push(n),()=>{t?x(()=>{t()}):n.skipped=!0}});return j(),l},destroy:e=>{w.push({type:"destroy",key:e}),j()},config:function(e){y={...y,...e},x(()=>{f?.sync?.()})},useMessage:h.A,_InternalPanelDoNotUseOrYouWillBeFired:g.Ay,_InternalListDoNotUseOrYouWillBeFired:e=>{let{items:l,classNames:t,style:n}=e,{getPrefixCls:a}=(0,s.TP)("message"),o=a("message"),i=(0,u.A)(o),[h,p]=(0,m.A)(o,i),f=`${o}-notice`,x=l.map(e=>{let{content:l,duration:t,key:n,type:r}=e,a=r?`${f}-icon-${r}`:void 0;return{key:n,duration:t,icon:(0,g.HC)(r),title:l,className:`${f}-${r}`,classNames:{wrapper:`${o}-${r}`,icon:a}}});return r.createElement(d.qb,{prefixCls:o,placement:"top",configList:x,className:(0,c.$)(h,p,i),classNames:{...t,wrapper:t?.wrapper,title:t?.title},style:n,stack:!1})}};["success","info","warning","error","loading"].forEach(e=>{_[e]=(...l)=>(function(e,l){(0,i.cr)();let t=(0,p.E)(t=>{let n,r={type:e,args:l,resolve:t,setCloseFn:e=>{n=e}};return w.push(r),()=>{n?x(()=>{n()}):r.skipped=!0}});return j(),t})(e,l)});let A=_},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return t(48200)}])},45551:(e,l,t)=>{"use strict";t.d(l,{Jm:()=>i,fw:()=>a,je:()=>n.j,mc:()=>d,z3:()=>r});var n=t(96538);function r(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(t/60),r=Math.floor(n/24);return r>30?new Date(e).toLocaleDateString(l):"en-US"===l?r>0?"".concat(r,"d ago"):n>0?"".concat(n,"h ago"):t>0?"".concat(t,"m ago"):"Just now":r>0?"".concat(r," 天前"):n>0?"".concat(n," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}let o={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},s={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function i(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?s:o)[e])?l:e}let d={active:"common.statusIndexed",outdated:"common.statusOutdated",error:"common.statusAbnormal",deleted:"common.statusDeleted",disk:"common.statusNotIndexed"}},47210:(e,l,t)=>{"use strict";t.d(l,{A:()=>s});var n=t(97109),r=t(58970),a=t(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var t=arguments[l];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}let s=n.forwardRef((e,l)=>n.createElement(a.A,o({},e,{ref:l,icon:r.A})))},48200:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>T});var n=t(65321),r=t(97109),a=t(86109),o=t(48399),s=t(76506),i=t(33442),d=t(11702),c=t(9137),u=t(26964),g=t(68787),m=t(56985),h=t(49604),p=t(85493),f=t(88762),x=t(84253),w=t(85114),y=t(58569),k=t(7576),v=t(47210),b=t(6578),j=t(85587),_=t(45551),A=t(14569),C=t.n(A),N=t(58690);let{Paragraph:P}=o.A;function S(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function I(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function z(e,l){let t=l.trim()?[l.trim(),...l.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,l)=>l.length-e.length):[];if(0===t.length)return e;let r=RegExp("(".concat(t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,l)=>t.some(l=>l.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},l):e)}function F(e,l,t){return null==l||""===l||Array.isArray(l)&&0===l.length?null:(0,n.jsx)(s.A.Item,{label:e,children:Array.isArray(l)?(0,n.jsx)(i.A,{wrap:!0,children:l.map(e=>(0,n.jsx)(d.A,{className:"cursor-pointer",onClick:()=>null==t?void 0:t(String(e)),children:String(e)},String(e)))}):String(l)})}function R(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,t)=>({key:"".concat(l,"-").concat(t),name:e}))}function T(){var e,l,t,o,A,T,M,L;let E=(0,j.Vr)(),O=(0,a.useRouter)(),B="string"==typeof O.query.relativePath?O.query.relativePath:"",D="string"==typeof O.query.projectRoot?O.query.projectRoot:void 0,[J,H]=(0,r.useState)(),[K,$]=(0,r.useState)(!1),[U,V]=(0,r.useState)(""),[q,W]=(0,r.useState)(!1),[X,G]=(0,r.useState)(""),[Q,Y]=(0,r.useState)([]);(0,r.useEffect)(()=>{B&&($(!0),V(""),(0,b.xC)(B,D).then(H).catch(e=>{H(void 0),V(e instanceof Error?e.message:E("knowledge.fileDetailLoadFailed"))}).finally(()=>$(!1)))},[B,D,E]);let Z=(0,r.useMemo)(()=>(function(e){let l=S(null==e?void 0:e.file.metadataJson);return"object"==typeof l.extraction&&l.extraction?l.extraction:l})(J),[J]),ee=I(Z.layerNames);(0,r.useEffect)(()=>{Y(ee)},[null==J?void 0:J.file.relativePath,ee.join("|")]);let el=X.trim().toLowerCase(),et=(0,r.useMemo)(()=>{var e;return J&&el?J.chunks.filter(e=>{let l=S(e.metadataJson);return[e.content,e.sectionTitle,l.rowRange,l.chunkKind,l.parentId,JSON.stringify(l)].some(e=>String(null!=e?e:"").toLowerCase().includes(el))}):null!=(e=null==J?void 0:J.chunks)?e:[]},[J,el]),en=(0,r.useMemo)(()=>{var e;return J&&el?J.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(el))):null!=(e=null==J?void 0:J.parents)?e:[]},[J,el]),er=async()=>{if(B){W(!0);try{let e=await (0,b.HC)(B,D);e.detail&&H(e.detail),c.Ay.success(E("knowledge.fileReindexed"))}finally{W(!1)}}},ea=async e=>{e&&(await navigator.clipboard.writeText(e),c.Ay.success(E("knowledge.copied")))},eo=async e=>{B&&(await (0,b.tn)(B,e,D),c.Ay.success("file"===e?E("knowledge.openFileRequested"):E("knowledge.openDirectoryRequested")))},es=(0,r.useMemo)(()=>{var e,l,t,r;let a=[],o=I(Z.sheetNames),c=I(Z.columnNames),f=I(Z.layerNames),x=I(Z.blockNames),w=I(Z.entityTypes),y=I(Z.productNames),k=I(Z.materialNames),v=I(Z.entityNames),b=I(Z.dataPaths),j=o.length>0||c.length>0||null!=Z.rowCount||null!=Z.columnCount||null!=Z.formulaCount||null!=Z.mergeCount,_=R(c,"column"),A=(null!=(e=null==J?void 0:J.chunks)?e:[]).map(e=>S(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,l)=>({key:"row-".concat(l),name:e})),z=(null!=(l=null==J?void 0:J.chunks)?l:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,l)=>({key:"grid-".concat(l),cells:e.split("|").map(e=>e.trim()).filter(Boolean)}));(j||_.length>0||A.length>0||z.length>0)&&a.push({key:"table",label:E("knowledge.table"),children:(0,n.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[j&&(0,n.jsxs)(s.A,{size:"small",column:2,bordered:!0,children:[F(E("knowledge.sheet"),o,G),F(E("knowledge.header"),c,G),F(E("knowledge.rows"),Z.rowCount),F(E("knowledge.columns"),Z.columnCount),F(E("knowledge.formulaCount"),Z.formulaCount),F(E("knowledge.mergeCount"),Z.mergeCount)]}),_.length>0&&(0,n.jsx)(u.A,{size:"small",pagination:(0,N.B)(E),rowKey:"key",dataSource:_,columns:[{title:E("knowledge.columnName"),dataIndex:"name",render:e=>(0,n.jsx)(d.A,{className:"cursor-pointer m-0 border-0 bg-[var(--colorFillSecondary)] hover:bg-[var(--colorFillAlter)]",onClick:()=>G(String(e)),children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"}),A.length>0&&(0,n.jsx)(u.A,{size:"small",pagination:(0,N.B)(E),rowKey:"key",dataSource:A,columns:[{title:E("knowledge.rowRange"),dataIndex:"name",render:e=>(0,n.jsxs)(d.A,{color:"gold",className:"cursor-pointer m-0 border-0",onClick:()=>G(String(e)),children:[E("knowledge.rowPrefix")," ",String(e)]})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"}),z.length>0&&(0,n.jsx)(u.A,{size:"small",rowKey:"key",dataSource:z,pagination:{defaultPageSize:10},columns:[{title:E("knowledge.tableGridPreview"),dataIndex:"cells",render:e=>(0,n.jsx)(i.A,{wrap:!0,children:e.map((e,l)=>(0,n.jsx)(d.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:e},"".concat(e,"-").concat(l)))})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})});let T=f.length>0||x.length>0||w.length>0||y.length>0||k.length>0||v.length>0,M=[...R(f,"layer").map(e=>({...e,type:E("knowledge.layer")})),...R(w,"entity").map(e=>({...e,type:E("knowledge.entityType")})),...R(x,"block").map(e=>({...e,type:E("knowledge.blockSymbol")}))];(T||f.length>0||M.length>0)&&a.push({key:"drawing",label:E("knowledge.drawing"),children:(0,n.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[T&&(0,n.jsxs)(s.A,{size:"small",column:2,bordered:!0,children:[F(E("knowledge.layer"),f,G),F(E("knowledge.blockSymbol"),x,G),F(E("knowledge.entityType"),w,G),F(E("knowledge.productPart"),y,G),F(E("knowledge.material"),k,G),F(E("knowledge.entityName"),v,G)]}),f.length>0&&(0,n.jsxs)(g.A,{size:"small",title:E("knowledge.layerTogglePreview"),className:"rounded-xl border-[var(--borderColor)]",children:[(0,n.jsx)(m.A.Group,{value:Q,options:f.map(e=>({label:e,value:e})),onChange:e=>Y(e.map(String))}),(0,n.jsx)("div",{className:C().drawingPreview,children:Q.map(e=>(0,n.jsx)(d.A,{color:"blue",children:e},e))})]}),M.length>0&&(0,n.jsx)(u.A,{size:"small",pagination:(0,N.B)(E),rowKey:"key",dataSource:M,columns:[{title:E("knowledge.type"),dataIndex:"type",width:120},{title:E("knowledge.name"),dataIndex:"name",render:e=>(0,n.jsx)(d.A,{className:"cursor-pointer",onClick:()=>G(String(e)),children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})});let L=(null!=(t=null==J?void 0:J.chunks)?t:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,l)=>{var t,n,r,a;let o=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(l),path:null!=(r=null==o||null==(t=o[1])?void 0:t.trim())?r:e,value:null!=(a=null==o||null==(n=o[2])?void 0:n.trim())?a:""}});(b.length>0||L.length>0)&&a.push({key:"data",label:E("knowledge.dataPath"),children:(0,n.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[b.length>0&&(0,n.jsx)("div",{className:"bg-[var(--colorFillAlter)] border border-[var(--colorBorderSecondary)] rounded-xl p-3",children:(0,n.jsx)(h.A,{defaultExpandAll:!0,treeData:function(e){let l=new Map;for(let t of e){let e=l;for(let l of t.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(l)||e.set(l,new Map),e=e.get(l)}let t=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[n,r]=e;return{title:n,key:l?"".concat(l,".").concat(n):n,children:t(r,l?"".concat(l,".").concat(n):n)}})};return t(l)}(b),onSelect:e=>{var l;return G(String(null!=(l=e[0])?l:""))},className:"bg-transparent"})}),L.length>0&&(0,n.jsx)(u.A,{size:"small",rowKey:"key",dataSource:L,pagination:{defaultPageSize:20},columns:[{title:E("knowledge.path"),dataIndex:"path",width:260,render:e=>(0,n.jsx)(d.A,{className:"cursor-pointer",onClick:()=>G(String(e)),children:String(e)})},{title:E("knowledge.value"),dataIndex:"value",render:e=>(0,n.jsx)("span",{className:"break-all",children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})});let O=[Z.ocrRecommended,Z.ocrReason,Z.ocrProvider,Z.ocrLanguages,Z.ocrTextLength,Z.pdfPageOcrSupported,Z.ocrPageCount,Z.pdfOcrPageLimit,Z.pdfRenderer,Z.pdfPageCount,Z.textPages,Z.ocrAugmented,Z.ocrPages,Z.failedPages,Z.imagePreprocessor].some(e=>null!=e),B=(null!=(r=null==J?void 0:J.chunks)?r:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,l,t,n)=>{var r,a,o;return t%2==0&&e.push({key:"page-".concat(l),page:l,text:null!=(o=null==(a=n[t+1])||null==(r=a.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:r.trim())?o:""}),e},[]),D=(null==J?void 0:J.file.format)==="pdf";return(O||D||B.length>0)&&a.push({key:"ocr",label:E("knowledge.ocrPdf"),children:(0,n.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[D&&(null==J?void 0:J.pdfCoverage)&&(0,n.jsx)(p.A,{showIcon:!0,type:"complete"===J.pdfCoverage.status?"success":"warning",message:E("knowledge.pdfCoverage_".concat(J.pdfCoverage.status)),description:(0,n.jsxs)(i.A,{direction:"vertical",size:2,children:[J.pdfCoverage.pageCount&&(0,n.jsxs)("span",{children:[E("knowledge.pdfProcessedPages"),":",J.pdfCoverage.processedPages,"/",J.pdfCoverage.pageCount]}),J.pdfCoverage.missingPages.length>0&&(0,n.jsxs)("span",{children:[E("knowledge.pdfMissingPages"),":",J.pdfCoverage.missingPages.join(", ")]}),J.pdfCoverage.failedPages.length>0&&(0,n.jsxs)("span",{children:[E("knowledge.pdfFailedPages"),":",J.pdfCoverage.failedPages.join(", ")]})]})}),O&&(0,n.jsxs)(s.A,{size:"small",column:2,bordered:!0,children:[F(E("knowledge.ocrRecommended"),Z.ocrRecommended),F(E("knowledge.ocrReason"),Z.ocrReason),F(E("knowledge.ocrProvider"),Z.ocrProvider),F(E("knowledge.ocrLanguages"),Z.ocrLanguages),F(E("knowledge.ocrTextLength"),Z.ocrTextLength),F(E("knowledge.pdfPageCount"),Z.pdfPageCount),F(E("knowledge.pdfTextPages"),Z.textPages),F(E("knowledge.pdfOcrAugmented"),Z.ocrAugmented),F(E("knowledge.pdfOcrPages"),Array.isArray(Z.ocrPages)?Z.ocrPages.join(", "):Z.ocrPages),F(E("knowledge.pdfFailedPages"),Array.isArray(Z.failedPages)?Z.failedPages.map(e=>JSON.stringify(e)).join("; "):Z.failedPages),F(E("knowledge.pdfPageOcrSupported"),Z.pdfPageOcrSupported),F(E("knowledge.pdfOcrPageCount"),Z.ocrPageCount),F(E("knowledge.pdfOcrPageLimit"),Z.pdfOcrPageLimit),F(E("knowledge.pdfRenderer"),Z.pdfRenderer),F(E("knowledge.imagePreprocessor"),Z.imagePreprocessor)]}),D&&(0,n.jsx)(p.A,{type:"info",message:"原版本与解析结果的对照、页序和切片覆盖请使用上方“解析核查预览”。"}),B.length>0&&(0,n.jsx)(u.A,{size:"small",rowKey:"key",dataSource:B,pagination:{defaultPageSize:10},columns:[{title:E("knowledge.pageNumber"),dataIndex:"page",width:90},{title:E("knowledge.ocrText"),dataIndex:"text",render:e=>(0,n.jsx)(P,{ellipsis:{rows:4,expandable:!0,symbol:E("knowledge.openExpand")},children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})}),a},[Z,J,Q]),ei=[{title:E("knowledge.index"),key:"index",width:70,render:(e,l,t)=>t+1},{title:E("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:E("knowledge.chunkType"),width:110,render:(e,l)=>{var t;return(0,n.jsx)(d.A,{children:String(null!=(t=S(l.metadataJson).chunkKind)?t:l.category)})}},{title:E("knowledge.sectionOrRange"),width:220,render:(e,l)=>{let t=S(l.metadataJson),r="string"==typeof t.rowRange?t.rowRange:void 0;return(0,n.jsxs)(i.A,{wrap:!0,children:[l.sectionTitle?(0,n.jsx)(d.A,{color:"cyan",children:l.sectionTitle}):null,r?(0,n.jsxs)(d.A,{color:"gold",children:[E("knowledge.rowPrefix")," ",r]}):null]})}},{title:E("knowledge.tokens"),dataIndex:"tokenCount",width:90},{title:E("knowledge.chunkContent"),render:(e,l)=>(0,n.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:E("knowledge.openExpand")},className:C().searchContent,children:z(l.content,X)})}],ed=[{title:E("knowledge.index"),key:"index",width:70,render:(e,l,t)=>t+1},{title:E("knowledge.parentChunkId"),dataIndex:"parentId",width:260,render:e=>(0,n.jsx)("span",{className:"break-all",children:e})},{title:E("knowledge.chunkCount"),dataIndex:"chunkCount",width:90},{title:E("knowledge.section"),dataIndex:"sectionTitle",width:220},{title:E("knowledge.chunkContent"),render:(e,l)=>(0,n.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:E("knowledge.openExpand")},className:C().searchContent,children:z(l.content,X)})}];return K?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(f.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(f.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(f.A,{active:!0,paragraph:{rows:4}})})]}):U?(0,n.jsx)(p.A,{type:"error",showIcon:!0,description:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:E("knowledge.fileDetailLoadFailed")}),(0,n.jsx)("div",{children:U})]})}):J?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)("div",{className:"bg-[var(--colorBgContainer)] rounded-2xl overflow-hidden border border-[var(--borderColor)] p-6 mb-6",children:(0,n.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(w.Ay,{icon:(0,n.jsx)(v.A,{}),href:"/knowledge",type:"link",className:"p-0 mr-4 text-[var(--colorTextSecondary)] hover:text-[var(--colorText)] flex items-center h-auto",children:E("knowledge.backToFileList")}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-2xl font-bold text-[var(--colorText)] mb-1 flex items-center gap-2",children:E("knowledge.fileDetailTitle")}),(0,n.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:E("knowledge.fileDetailDesc")})]})]}),(0,n.jsxs)(i.A,{wrap:!0,className:"shrink-0",children:[(0,n.jsx)(w.Ay,{size:"small",onClick:()=>{O.push("/knowledge/source-preview?".concat(new URLSearchParams({relativePath:B,...D?{projectRoot:D}:{}})))},children:"解析核查预览"}),(0,n.jsx)(w.Ay,{size:"small",onClick:()=>{ea(null==J?void 0:J.absolutePath)},children:E("knowledge.copySourcePath")}),(0,n.jsx)(w.Ay,{size:"small",onClick:()=>{ea(null==J?void 0:J.directory)},children:E("knowledge.copyDirectory")}),(0,n.jsx)(w.Ay,{size:"small",onClick:()=>{eo("file")},children:E("assets.openFile")}),(0,n.jsx)(w.Ay,{size:"small",onClick:()=>{eo("directory")},children:E("assets.openDirectory")}),"pdf"===J.file.format?(0,n.jsx)(w.Ay,{size:"small",loading:q,onClick:()=>{er()},children:E("knowledge.reOcr")}):null,(0,n.jsx)(w.Ay,{size:"small",type:"primary",loading:q,onClick:()=>{er()},children:E("knowledge.reindexFile")})]})]})}),(null==(e=J.parseAttempt)?void 0:e.status)==="error"&&(0,n.jsx)(p.A,{showIcon:!0,type:"error",message:E("knowledge.latestParseFailed"),description:"".concat(null!=(t=J.parseAttempt.error)?t:"").concat(J.parseAttempt.recordRetained?";".concat(E("knowledge.previousParseRetained")):"")}),(null==(l=J.parseAttempt)?void 0:l.status)==="parsing"&&(0,n.jsx)(p.A,{showIcon:!0,type:"info",message:E("knowledge.currentParseInProgress")}),(0,n.jsx)(g.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsx)("span",{className:"font-semibold",children:E("knowledge.basicInfo")}),children:(0,n.jsxs)(s.A,{size:"small",column:{xxl:3,xl:2,lg:2,md:1,sm:1,xs:1},bordered:!0,styles:{label:{width:"120px",background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)"}},children:[(0,n.jsx)(s.A.Item,{label:E("knowledge.path"),span:3,children:(0,n.jsx)("span",{className:"break-all",children:J.file.relativePath})}),(0,n.jsx)(s.A.Item,{label:E("knowledge.originalFile"),span:3,children:(0,n.jsx)("span",{className:"break-all",children:null!=(o=J.absolutePath)?o:"-"})}),(0,n.jsx)(s.A.Item,{label:E("knowledge.directory"),span:3,children:(0,n.jsx)("span",{className:"break-all",children:null!=(A=J.directory)?A:"-"})}),(0,n.jsx)(s.A.Item,{label:E("knowledge.fileCategory"),children:(0,n.jsxs)(i.A,{size:4,children:[(0,n.jsx)(d.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:(0,_.Jm)(J.file.category)})," ",(0,n.jsx)(d.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:J.file.format})]})}),(0,n.jsx)(s.A.Item,{label:E("knowledge.fileSize"),children:(0,_.z3)(J.file.fileSize)}),(0,n.jsx)(s.A.Item,{label:E("knowledge.chunkCount"),children:J.file.chunkCount}),(0,n.jsx)(s.A.Item,{label:E("knowledge.status"),children:(0,n.jsx)(d.A,{color:"active"===J.file.status?"success":"error"===J.file.status?"error":"outdated"===J.file.status?"warning":"disk"===J.file.status||"deleted"===J.file.status?"default":"processing",className:"m-0",children:E(_.mc[J.file.status]||"common.unknown")})}),(0,n.jsx)(s.A.Item,{label:E("knowledge.extractionMode"),children:String(null!=(T=Z.extractionMode)?T:"-")}),(0,n.jsx)(s.A.Item,{label:E("knowledge.contentCoverage"),children:String(null!=(M=Z.contentCoverage)?M:"-")}),(0,n.jsx)(s.A.Item,{label:E("knowledge.textLength"),children:String(null!=(L=Z.textLength)?L:"-")})]})}),es.length>0&&(0,n.jsx)(g.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsx)("span",{className:"font-semibold",children:E("knowledge.structuredInfo")}),children:(0,n.jsx)(y.A,{items:es,className:"documents-tabs"})}),(0,n.jsx)(g.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsx)("span",{className:"font-semibold",children:E("knowledge.detailFilter")}),children:(0,n.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[(0,n.jsx)(k.A,{allowClear:!0,size:"large",value:X,onChange:e=>G(e.target.value),placeholder:E("knowledge.detailFilterPlaceholder"),className:"rounded-xl bg-[var(--colorBgHover)] border-[var(--borderColor)] focus:bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgContainer)] w-full"}),X?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center bg-[var(--colorFillAlter)] p-3 rounded-xl border border-[var(--colorBorderSecondary)]",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-[var(--colorTextSecondary)] mr-2",children:"过滤结果:"}),(0,n.jsxs)(d.A,{color:"blue",className:"m-0 border-0",children:[E("knowledge.parentMatches")," ",en.length]}),(0,n.jsxs)(d.A,{color:"green",className:"m-0 border-0",children:[E("knowledge.childMatches")," ",et.length]}),(0,n.jsx)("div",{className:"w-[1px] h-3 bg-[var(--colorBorderSecondary)] mx-1"}),(0,n.jsxs)("span",{className:"text-xs text-[var(--colorTextTertiary)]",children:[E("knowledge.filterTerm")," ",(0,n.jsx)("strong",{className:"text-[var(--colorText)]",children:X})]})]}):null]})}),(0,n.jsxs)(g.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsxs)("span",{className:"font-semibold",children:[E("knowledge.parentChunks")," ",(0,n.jsxs)(d.A,{className:"ml-2 border-0 bg-[var(--colorFillSecondary)] text-xs font-normal",children:[en.length," / ",J.parents.length]})]}),children:[(0,n.jsx)(p.A,{type:"info",showIcon:!0,description:E("knowledge.parentChunkHint"),className:"mb-4 rounded-xl border-blue-200 bg-blue-50/50"}),(0,n.jsx)(u.A,{rowKey:"id",columns:ed,dataSource:en,pagination:{defaultPageSize:10},size:"small",className:"custom-table"})]}),(0,n.jsx)(g.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsxs)("span",{className:"font-semibold",children:[E("knowledge.childChunks")," ",(0,n.jsxs)(d.A,{className:"ml-2 border-0 bg-[var(--colorFillSecondary)] text-xs font-normal",children:[et.length," / ",J.chunks.length]})]}),children:(0,n.jsx)(u.A,{rowKey:"id",columns:ei,dataSource:et,pagination:{defaultPageSize:20},size:"small",className:"custom-table"})})]}):(0,n.jsx)(x.A,{description:E("knowledge.selectFile")})}},58690:(e,l,t)=>{"use strict";function n(e){var l,t,n;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{defaultPageSize:null!=(l=r.pageSize)?l:10,pageSizeOptions:null!=(t=r.pageSizeOptions)?t:[10,20,50,100],showSizeChanger:!0,showTotal:l=>{var t,n;return e(null!=(t=r.totalLabelKey)?t:"common.totalRows",null!=(n=r.totalLabelFallback)?n:"共 {count} 条").replace("{count}",String(l))},hideOnSinglePage:null!=(n=r.hideOnSinglePage)&&n,showQuickJumper:!1}}t.d(l,{B:()=>n})},58970:(e,l)=>{"use strict";l.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"}},96538:(e,l,t)=>{"use strict";t.d(l,{a:()=>r,j:()=>a});let n={coarse:function(e,l){let t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),a=Math.floor(t%3600/60),o="en-US"===l;return n>0?o?"".concat(n,"d ").concat(r,"h"):"".concat(n," 天 ").concat(r," 小时"):r>0?o?"".concat(r,"h ").concat(a,"m"):"".concat(r," 小时 ").concat(a," 分"):a>0?o?"".concat(a,"m"):"".concat(a," 分"):o?"Just now":"刚刚"},fine:function(e){let l=Math.round(e/1e3);if(l<60)return"".concat(l," 秒");let t=Math.floor(l/60);return t<60?"".concat(t," 分 ").concat(l%60," 秒"):"".concat(Math.floor(t/60)," 小时 ").concat(t%60," 分")},"fine-decimal":function(e){return e>=6e4?"".concat(Math.floor(e/6e4)," 分 ").concat(Math.round(e%6e4/1e3)," 秒"):"".concat((e/1e3).toFixed(1)," 秒")},metric:function(e){return e<1e3?"".concat(Math.round(e),"ms"):e<6e4?"".concat((e/1e3).toFixed(1),"s"):"".concat((e/6e4).toFixed(1),"min")}};function r(e,l){var t;return n[l.style](function(e,l){let t="s"===l?1e3*e:e;return Number.isFinite(t)&&t>0?t:0}(e,l.unit),null!=(t=l.locale)?t:"zh-CN")}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return r(e,{unit:"s",style:"coarse",locale:l})}}},e=>{e.O(0,[310,700,914,174,189,569,278,964,787,665,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);
|