@petercjl/omni-desktop-app 0.1.6 → 0.1.8

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.
Files changed (116) hide show
  1. package/app/assets/{CartesianChart-BLyO9U-C.js → CartesianChart-Bwf4u0Tg.js} +4 -4
  2. package/app/assets/CollaborationWorkspace-Bd6Sjj31.js +57 -0
  3. package/app/assets/CollaborationWorkspace-D7ttfUjn.css +1 -0
  4. package/app/assets/EmptyState-CE7obISq.js +1 -0
  5. package/app/assets/{EvidenceSourceGuide-BqwES_45.js → EvidenceSourceGuide-CwfB7Z6T.js} +1 -1
  6. package/app/assets/Favorites-4oU1mgEb.js +1 -0
  7. package/app/assets/{HelpTip-DgowTr-K.js → HelpTip-CX2LFdwD.js} +1 -1
  8. package/app/assets/{LineChart-BOoSfV72.js → LineChart-B6igYupv.js} +1 -1
  9. package/app/assets/Opportunities-CogyuZvI.css +1 -0
  10. package/app/assets/Opportunities-a5IpRN6k.js +1 -0
  11. package/app/assets/ProgressiveRows-ByxDeTyy.js +1 -0
  12. package/app/assets/ShopLayoutPage-BlPpfB06.css +1 -0
  13. package/app/assets/ShopLayoutPage-D7KKJVEq.js +1 -0
  14. package/app/assets/{TrendChart-ozEGn1ai.js → TrendChart-BdRXaz4z.js} +1 -1
  15. package/app/assets/api-hjUd9Skg.js +1 -0
  16. package/app/assets/arrow-down-DSjucZgz.js +1 -0
  17. package/app/assets/arrow-left-DmIga4jN.js +1 -0
  18. package/app/assets/arrow-up-right-DzAKT3cL.js +1 -0
  19. package/app/assets/book-open-C0B9Pao9.js +1 -0
  20. package/app/assets/chart-no-axes-combined-XDy9u9SV.js +1 -0
  21. package/app/assets/check-BB89tIU6.js +1 -0
  22. package/app/assets/chevron-down-BiokgLxD.js +1 -0
  23. package/app/assets/chevron-right-CZlQQ5gV.js +1 -0
  24. package/app/assets/clock-3-TH35nOP-.js +1 -0
  25. package/app/assets/components-C2-vHJtu.js +2 -0
  26. package/app/assets/{download-DYUXwy45.js → download-BlJN0Lg8.js} +1 -1
  27. package/app/assets/entry-B_LLuTIf.css +1 -0
  28. package/app/assets/entry-BryQeuNT.css +1 -0
  29. package/app/assets/entry-Bxc-KNuY.js +1 -0
  30. package/app/assets/entry-CYGrMJuR.js +2 -0
  31. package/app/assets/entry-CdLi3Z9F.js +2 -0
  32. package/app/assets/entry-DM3aLe2I.js +1 -0
  33. package/app/assets/entry-OcErMaMp.css +1 -0
  34. package/app/assets/entry-ZwyGbRek.js +1 -0
  35. package/app/assets/entry-ffP7X21A.js +2 -0
  36. package/app/assets/{file-text-BE0hF4rH.js → file-text-Hd45wNTe.js} +1 -1
  37. package/app/assets/{grid-2x2-lULFcGs7.js → grid-2x2-C0aJVeyS.js} +1 -1
  38. package/app/assets/index-BguiS02-.js +10 -0
  39. package/app/assets/index-D1qZkLPg.css +1 -0
  40. package/app/assets/{layers-shcwXKIH.js → layers-Dj9z2et6.js} +1 -1
  41. package/app/assets/layout-dashboard-DS537D8b.js +1 -0
  42. package/app/assets/{link-2-BlbKNthn.js → link-2-CCKUDMV6.js} +1 -1
  43. package/app/assets/{list-CrDQ8uHL.js → list-LZcXKWKD.js} +1 -1
  44. package/app/assets/market-DqV9l-vR.css +1 -0
  45. package/app/assets/market.module-BSrEp5Ak.js +1 -0
  46. package/app/assets/module-host-C4vqZw2y.js +1 -0
  47. package/app/assets/orbit-G4ZspWKB.js +1 -0
  48. package/app/assets/package-BFlv-jYw.js +1 -0
  49. package/app/assets/play-DxbesM66.js +1 -0
  50. package/app/assets/plus-QakkcxdA.js +1 -0
  51. package/app/assets/products-BAKFF--e.js +1 -0
  52. package/app/assets/project-public-BCoD2Anq.js +1 -0
  53. package/app/assets/project-public-HdtYycKS.js +4 -0
  54. package/app/assets/public-JUGpS2z7.js +1 -0
  55. package/app/assets/{refresh-cw-C_4G0Mri.js → refresh-cw-dsQ_f-9j.js} +1 -1
  56. package/app/assets/search-Cisx0wBF.js +1 -0
  57. package/app/assets/triangle-alert-l-Mfj0iE.js +1 -0
  58. package/app/assets/{create-intent-ZWl5yZd5.css → ui-public-BPe2GJZ-.css} +1 -1
  59. package/app/assets/ui-public-DWkIf658.js +1 -0
  60. package/app/assets/{use-favorites-BOjIArhk.js → use-favorites-ALxrDxDW.js} +1 -1
  61. package/app/assets/workbench-DZTf1DRZ.js +2 -0
  62. package/app/assets/workbench-Db45mF6t.css +1 -0
  63. package/app/assets/{workspace-view-state-CRfq5jgZ.js → workspace-view-state-BJMX6vWb.js} +1 -1
  64. package/app/index.html +2 -2
  65. package/package.json +1 -1
  66. package/release.json +1 -1
  67. package/release.sig +1 -1
  68. package/app/assets/EmptyState-Cgx7dIy3.js +0 -1
  69. package/app/assets/Favorites-JpOkiZFS.js +0 -1
  70. package/app/assets/ShopLayoutPage-BPjWnPjn.css +0 -1
  71. package/app/assets/ShopLayoutPage-xv0PhUXv.js +0 -1
  72. package/app/assets/activity-BV0UMcx6.js +0 -1
  73. package/app/assets/api-DTsZ_OeY.js +0 -1
  74. package/app/assets/arrow-right-DMEu-HBO.js +0 -1
  75. package/app/assets/arrow-up-right-Bi_SzYu1.js +0 -1
  76. package/app/assets/chart-column-x5fvXs9m.js +0 -1
  77. package/app/assets/check-qCcwSYDE.js +0 -1
  78. package/app/assets/chevron-down-p3oUrcsv.js +0 -1
  79. package/app/assets/chevron-right-DqmFJybY.js +0 -1
  80. package/app/assets/clock-3-BThph9Fd.js +0 -1
  81. package/app/assets/components-BVWswT0B.js +0 -2
  82. package/app/assets/create-intent-9uYVhJHt.js +0 -1
  83. package/app/assets/demand-planning-client-DVOcsKAy.css +0 -1
  84. package/app/assets/demand-planning-client-cRvN3aET.js +0 -130
  85. package/app/assets/entry-BXB2Nzyc.js +0 -2
  86. package/app/assets/entry-BxaHKvMx.js +0 -2
  87. package/app/assets/entry-C3TFTQrn.js +0 -1
  88. package/app/assets/entry-C_j4PEhB.css +0 -1
  89. package/app/assets/entry-Crfux-R-.js +0 -1
  90. package/app/assets/entry-DHP4cb-p.css +0 -1
  91. package/app/assets/entry-DQpz8kvM.js +0 -58
  92. package/app/assets/entry-OPB3MGoc.css +0 -1
  93. package/app/assets/entry-WYptT5dv.js +0 -2
  94. package/app/assets/flag-DspBXBR4.js +0 -1
  95. package/app/assets/git-branch-BAJikW8Q.js +0 -1
  96. package/app/assets/index-7NKGenq7.css +0 -1
  97. package/app/assets/index-Cez2mr3h.js +0 -10
  98. package/app/assets/market-B2oImfqS.css +0 -1
  99. package/app/assets/market.module-vHIsXpQH.js +0 -1
  100. package/app/assets/module-host-CyMfvPpR.js +0 -1
  101. package/app/assets/pin-C4E_u351.js +0 -1
  102. package/app/assets/play-D07b6r1X.js +0 -1
  103. package/app/assets/plus-iTTlNMxD.js +0 -1
  104. package/app/assets/products-fIIO39ry.js +0 -1
  105. package/app/assets/project-execution-DMEIpSz3.js +0 -1
  106. package/app/assets/project-public-4Gjaxeyh.js +0 -1
  107. package/app/assets/project-public-DCJ5Ry0f.js +0 -4
  108. package/app/assets/project-public-tKjd5rma.js +0 -1
  109. package/app/assets/public-BlU5YmdO.js +0 -1
  110. package/app/assets/search-CUzSX_06.js +0 -1
  111. package/app/assets/ui-public-9lmhhAop.js +0 -1
  112. package/app/assets/use-workspace-query-C-vrOrvK.js +0 -1
  113. package/app/assets/workbench-13XxpUuA.css +0 -1
  114. package/app/assets/workbench-BMO5cSO0.js +0 -2
  115. /package/app/assets/{graphicalItemSelectors-DGWLDzMl.js → graphicalItemSelectors-Hc730Dd1.js} +0 -0
  116. /package/app/assets/{group-eZxxe_Hb.js → group-CjIFQYrJ.js} +0 -0
@@ -1,4 +0,0 @@
1
- import{t as e}from"./arrow-up-right-Bi_SzYu1.js";import{n as t,t as n}from"./link-2-BlbKNthn.js";import{t as r}from"./chevron-right-DqmFJybY.js";import{t as i}from"./download-DYUXwy45.js";import{t as a}from"./file-text-BE0hF4rH.js";import{t as o}from"./plus-iTTlNMxD.js";import{t as s}from"./search-CUzSX_06.js";import{a as c,c as l,g as u,p as d,u as f}from"./index-Cez2mr3h.js";import{n as p}from"./workspace-view-state-CRfq5jgZ.js";import{t as m}from"./HelpTip-DgowTr-K.js";import{t as h}from"./EmptyState-Cgx7dIy3.js";var g=f(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),_=f(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),v=f(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),y=u(d(),1),b=c(),x={simulated:`模拟数据`,"declared-real":`来源标注为真实(尚需核实)`,unverified:`真实性待核`},S=(e,t)=>e==null?`—`:typeof e!=`number`||!Number.isFinite(e)?C(e):t.type===`percent`?(e*100).toLocaleString(`zh-CN`,{maximumFractionDigits:2})+`%`:t.type===`text`?String(e):e.toLocaleString(`zh-CN`,{maximumFractionDigits:[`元`,`CNY`].includes(t.unit)?2:6}),C=e=>e==null?`—`:typeof e==`object`?JSON.stringify(e):String(e);function w({data:e,api:n,initialId:a=``,onWiki:o,onPrepare:c,onArchive:u,onSelect:d}){let[f,g]=(0,y.useState)([]),[v,w]=(0,y.useState)(0),[T,E]=(0,y.useState)(a),[D,O]=(0,y.useState)(null),[k,A]=p(`resources.data.`+e.project.id+`.query`,``),[j,M]=p(`resources.data.`+e.project.id+`.`+a+`.page`,1),[N,P]=(0,y.useState)(``),[ee,F]=(0,y.useState)(!0),[I,L]=(0,y.useState)(0),[R,z]=(0,y.useState)(!1);(0,y.useEffect)(()=>{let t=!0;return F(!0),P(``),n(`/`+e.project.id+`/datasets`).then(e=>{t&&(g(e.datasets),w(e.pendingImports),E(t=>e.datasets.some(e=>e.id===t)?t:a?``:e.datasets[0]?.id||``),a&&!e.datasets.some(e=>e.id===a)&&P(`指定的数据集不可访问或已变更,请在目录中重新选择。`))}).catch(e=>t&&P(e.message)).finally(()=>t&&F(!1)),()=>{t=!1}},[e.project.id,n,I]),(0,y.useEffect)(()=>{if(!T)return;let t=!0;return O(null),P(``),n(`/`+e.project.id+`/datasets/`+encodeURIComponent(T)+`?page=`+j).then(e=>t&&O(e)).catch(e=>t&&P(e.message)),()=>{t=!1}},[T,j,e.project.id,n,I]);let B=(0,y.useMemo)(()=>f.filter(e=>`${e.title} ${e.source} ${e.period}`.toLowerCase().includes(k.toLowerCase())),[f,k]);function V(e){M(1),E(e),d?.(e)}return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{children:[`数据中心`,(0,b.jsx)(m,{label:`查看经营数据`,children:`先按资料名称、来源或统计时间查找,再查看明细。空值表示缺失,不等于零;原始经营数据保存在数据库。`})]}),(0,b.jsx)(`p`,{className:`muted`,children:`查询数据集、统计窗口与来源。缺失值显示为「—」,真实零保留为 0。`})]}),(0,b.jsxs)(`span`,{className:`wb-chip`,children:[(0,b.jsx)(l,{size:14}),` 专用数据库 · `,f.length,` 个数据集`]})]}),N&&(0,b.jsxs)(`div`,{role:`alert`,className:`error`,children:[N,` `,(0,b.jsx)(`button`,{onClick:()=>L(e=>e+1),children:`重新读取`})]}),v>0&&(0,b.jsxs)(`div`,{className:`wb-callout`,children:[`有 `,v,` 份 JSON 附件尚未进入数据中心。原件仍在「证据与附件」中,可由维护人员核验后迁移。`]}),ee?(0,b.jsx)(`p`,{role:`status`,children:`正在读取数据库目录…`}):f.length?(0,b.jsxs)(`div`,{className:`wb-data-layout`,children:[(0,b.jsxs)(`section`,{className:`card wb-catalog`,children:[(0,b.jsxs)(`label`,{className:`wb-search`,children:[(0,b.jsx)(s,{size:16}),(0,b.jsx)(`input`,{"aria-label":`搜索数据集`,placeholder:`搜索资料名称、来源、统计时间`,value:k,onChange:e=>A(e.target.value)})]}),(0,b.jsxs)(`p`,{className:`muted`,children:[`找到 `,B.length,` 个数据集`]}),(0,b.jsxs)(`div`,{className:`wb-dataset-list`,children:[B.map(e=>(0,b.jsxs)(`button`,{className:T===e.id?`active`:``,onClick:()=>V(e.id),children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(_,{size:16}),(0,b.jsx)(`b`,{children:e.title})]}),(0,b.jsxs)(`small`,{children:[e.rowCount,` 行 · `,x[e.mode]]}),(0,b.jsx)(`small`,{children:e.period||String(e.created).slice(0,10)})]},e.id)),!B.length&&(0,b.jsx)(`p`,{className:`muted`,children:`没有匹配的数据集。`})]})]}),(0,b.jsx)(`section`,{className:`card wb-data-detail`,"aria-live":`polite`,children:D?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{className:`wb-chip `+(D.mode===`simulated`?`warning`:``),children:x[D.mode]}),(0,b.jsx)(`h2`,{children:D.title})]}),(0,b.jsxs)(`a`,{className:`wb-link-button`,href:`/api/workbench/`+e.project.id+`/file/`+D.artifactId,children:[(0,b.jsx)(i,{size:15}),` 原始文件`]})]}),(0,b.jsxs)(`dl`,{className:`wb-metadata`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:`统计窗口`}),(0,b.jsx)(`dd`,{children:D.period||`未提供`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:`归档时间`}),(0,b.jsx)(`dd`,{children:D.created})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:`数据来源`}),(0,b.jsx)(`dd`,{children:D.source||`未提供`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:`数据状态`}),(0,b.jsxs)(`dd`,{children:[D.rowCount,` 行 · 原始记录保留 · `,x[D.mode]]})]})]}),(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:`原始记录的口径、备注与假设`}),(0,b.jsx)(`p`,{children:D.note==null?`原数据集未单独提供备注。请结合来源和原件核对。`:typeof D.note==`string`?D.note:JSON.stringify(D.note,null,2)})]}),(0,b.jsxs)(`label`,{className:`wb-raw-toggle`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:R,onChange:e=>z(e.target.checked)}),` 显示原始值`,(0,b.jsx)(`span`,{children:`金额按单位显示,百分比按列定义换算;原值保留不变。`})]}),(0,b.jsx)(`div`,{className:`wb-table-wrap`,tabIndex:0,"aria-label":`数据表,可横向滚动`,children:(0,b.jsxs)(`table`,{className:`wb-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`col`,children:`行号`}),D.columns.map(e=>(0,b.jsxs)(`th`,{scope:`col`,children:[e.label||e.key,e.unit?`(`+e.unit+`)`:``]},e.key))]})}),(0,b.jsx)(`tbody`,{children:D.rows.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`row`,children:e.index+1}),D.columns.map(t=>(0,b.jsx)(`td`,{title:C(e.values[t.key]),children:R?C(e.values[t.key]):S(e.values[t.key],t)},t.key))]},e.index))})]})}),(0,b.jsxs)(`div`,{className:`wb-pagination`,children:[(0,b.jsxs)(`span`,{children:[`共 `,D.rowCount,` 行 · 第 `,j,` / `,Math.max(1,Math.ceil(D.rowCount/50)),` 页`]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`button`,{"aria-label":`上一页`,disabled:j===1,onClick:()=>M(e=>e-1),children:(0,b.jsx)(t,{size:16})}),(0,b.jsx)(`button`,{"aria-label":`下一页`,disabled:j*50>=D.rowCount,onClick:()=>M(e=>e+1),children:(0,b.jsx)(r,{size:16})})]})]}),(0,b.jsxs)(`details`,{className:`wb-provenance`,children:[(0,b.jsx)(`summary`,{children:`查看记录标识与完整性校验`}),(0,b.jsxs)(`p`,{children:[`数据集 ID:`,D.id]}),(0,b.jsxs)(`p`,{children:[`来源 SHA256:`,D.sha]}),(0,b.jsxs)(`p`,{children:[`数据格式:`,D.format]})]}),(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>o(D.id),children:`用这份数据记录分析结论 →`}),u&&(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>u(D.id),children:`用这份数据进入分析任务 →`})]}):(0,b.jsx)(`p`,{role:`status`,children:N?`数据读取失败,请重试。`:`正在读取数据行…`})})]}):(0,b.jsx)(`section`,{className:`card`,children:(0,b.jsxs)(h,{title:`还没有入库数据`,children:[`先准备本项目原始文件,注明店铺/商品、统计日期、指标含义和来源。普通表格需整理成该模块认可的资料格式后才能入库;上传附件不等于已完成数据导入。系统不会创建示例经营数据。`,c&&(0,b.jsx)(`p`,{children:(0,b.jsx)(`button`,{onClick:c,children:`查看或准备项目原件`})})]})})]})}var T={keyword:`关键词证据`,review:`评价证据`,product:`商品资料`,analysis:`分析导入`,artifact:`制作产物`};function E({data:e,api:t,onSaved:n,onDirty:r,onBusy:a}){let[o,c]=p(`resources.files.`+e.project.id+`.query`,``),[l,u]=p(`resources.files.`+e.project.id+`.kind`,`all`),[d,f]=(0,y.useState)(!1),[g,_]=(0,y.useState)(null),[v,x]=(0,y.useState)(``),[S,C]=(0,y.useState)(`keyword`),[w,E]=(0,y.useState)(!1),[D,O]=(0,y.useState)(``),k=(0,y.useRef)(null);(0,y.useEffect)(()=>{r?.(!!g||!!v.trim())},[g,v,r]),(0,y.useEffect)(()=>(a?.(w),()=>a?.(!1)),[w,a]);async function A(){if(!(!g||w)){E(!0),O(``);try{if(g.size>2e6)throw Error(`单文件上限2MB`);let r=new Uint8Array(await g.arrayBuffer()),i=``;for(let e of r)i+=String.fromCharCode(e);await t(`/`+e.project.id+`/file`,{name:g.name,source:v,kind:S,base64:btoa(i)}),_(null),x(``),k.current&&(k.current.value=``),await n(),O(`原文件已归档。数据入库与内容核验仍需在相应模块完成。`)}catch(e){O(e.message)}finally{E(!1)}}}let j=e.files.filter(e=>(l===`all`||e.kind===l)&&`${e.name} ${e.source}`.toLowerCase().includes(o.toLowerCase()));return(0,b.jsxs)(`section`,{className:`card`,children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{children:[`证据与附件`,(0,b.jsx)(m,{label:`上传与引用资料`,children:`这里保留原文件。上传时说明来源和采集日期;文件存在不代表内容真实,分析前仍需核对。`})]}),(0,b.jsx)(`p`,{className:`muted`,children:`保留原文件、来源和完整性校验信息,便于核对分析依据。`})]}),(0,b.jsx)(`button`,{onClick:()=>f(!d),children:d?`收起上传`:`上传原始资料`})]}),d&&(0,b.jsxs)(`form`,{className:`wb-upload-form`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,b.jsxs)(`label`,{children:[`资料类型`,(0,b.jsx)(`select`,{disabled:w,value:S,onChange:e=>C(e.target.value),children:Object.entries(T).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))})]}),(0,b.jsxs)(`label`,{children:[`来源与采集日期`,(0,b.jsx)(`input`,{disabled:w,required:!0,value:v,onChange:e=>x(e.target.value),placeholder:`说明来源、日期和是否为模拟资料`})]}),(0,b.jsxs)(`label`,{children:[`原始文件(≤2MB)`,(0,b.jsx)(`input`,{ref:k,disabled:w,type:`file`,onChange:e=>_(e.target.files?.[0]||null)})]}),(0,b.jsx)(`p`,{className:`muted`,children:`保存原件与来源,不自动导入数据或生成分析结论。`}),(0,b.jsx)(`button`,{disabled:w||!g||!v.trim(),children:w?`正在上传…`:`上传并归档`})]}),D&&(0,b.jsx)(`p`,{role:`status`,children:D}),(0,b.jsxs)(`div`,{className:`wb-toolbar`,children:[(0,b.jsxs)(`label`,{className:`wb-search`,children:[(0,b.jsx)(s,{size:16}),(0,b.jsx)(`input`,{"aria-label":`搜索附件`,placeholder:`搜索文件名称或来源`,value:o,onChange:e=>c(e.target.value)})]}),(0,b.jsxs)(`select`,{"aria-label":`附件类型`,value:l,onChange:e=>u(e.target.value),children:[(0,b.jsx)(`option`,{value:`all`,children:`全部类型`}),Object.entries(T).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})]}),j.length?(0,b.jsx)(`div`,{className:`wb-table-wrap`,children:(0,b.jsxs)(`table`,{className:`wb-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`文件名称`}),(0,b.jsx)(`th`,{children:`类型`}),(0,b.jsx)(`th`,{children:`来源`}),(0,b.jsx)(`th`,{children:`归档时间`}),(0,b.jsx)(`th`,{children:`文件大小`}),(0,b.jsx)(`th`,{children:`操作`})]})}),(0,b.jsx)(`tbody`,{children:j.map(t=>(0,b.jsxs)(`tr`,{children:[(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`b`,{children:t.name}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`查看文件标识与完整性信息`}),(0,b.jsxs)(`p`,{className:`wb-hash`,children:[`ID:`,t.id,(0,b.jsx)(`br`,{}),`SHA256:`,t.sha]})]})]}),(0,b.jsx)(`td`,{children:T[t.kind]||t.kind}),(0,b.jsx)(`td`,{children:t.source}),(0,b.jsx)(`td`,{children:String(t.created).slice(0,10)}),(0,b.jsxs)(`td`,{children:[(t.bytes/1024).toFixed(1),` KB`]}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`a`,{"aria-label":`下载 `+t.name,href:`/api/workbench/`+e.project.id+`/file/`+t.id,children:(0,b.jsx)(i,{size:16})})})]},t.id))})]})}):(0,b.jsx)(h,{title:`没有匹配的附件`,children:`可先准备表格、文本或图片,注明来源与日期。单文件不超过2MB;点击上方按钮直接上传。原件归档后仍需对应模块整理与核验,不会自动变成分析结果。`})]})}var D=[[`question`,`分析问题`,`这次要回答什么问题,影响哪个决策?`],[`method`,`方法与选择理由`,`使用什么方法,为什么适合这个问题?`],[`metricDefinitions`,`指标口径`,`时间窗口、样本范围、分母、单位与对比基准`],[`steps`,`数据处理与分析步骤`,`按顺序记录筛选、清洗、比较、计算和检查;原始表保留在数据中心`],[`rationale`,`关键判断依据`,`哪些观测支持结论?按所选数据集、行 ID 或附件位置标出每个判断的证据。`],[`counterEvidence`,`反证与替代解释`,`哪些证据不支持当前判断?考虑过哪些其他解释?`],[`assumptions`,`假设与待验证项`,`哪些前提尚未验证?区分事实、推断和假设`],[`limitations`,`适用边界与限制`,`样本偏差、缺失数据、不可外推的对象和周期`],[`action`,`行动与负责人`,`准备做什么、由谁负责;记录计划不代表已经执行`],[`expected`,`预期指标与验收标准`,`指标、基线、目标、观察窗口和停止条件`],[`actual`,`实际结果摘要`,`复盘时填写实测结果摘要,并选择对应结果数据;没有实测则留空`],[`learning`,`复盘判断与方法调整`,`预期和实际差异、原假设是否成立、下一次如何调整方法`],[`changes`,`本版变更说明`,`本次补充、纠正或调整了什么,为什么`]],O=()=>({...Object.fromEntries(D.map(([e])=>[e,``])),status:`draft`,reviewOn:``}),k={draft:`草稿 · 待补充`,planned:`已记录计划 · 待复盘`,reviewed:`已填写复盘`};function A({form:e,change:t,evidenceOptions:n,busy:r}){let i=e.reviewRecord,a=(e,n)=>t(`reviewRecord`,{...i,[e]:n});return(0,b.jsxs)(`fieldset`,{className:`wb-analysis-fields`,disabled:r,children:[(0,b.jsxs)(`legend`,{children:[`分析方法与复盘记录`,(0,b.jsx)(m,{label:`怎样复盘`,children:`写清问题、用到的资料、判断依据、反例和实际结果。完成复盘需选择结果证据;没有执行的计划不能当作结果。`})]}),(0,b.jsx)(`p`,{className:`muted`,children:`记录可核查的方法、依据和结果。未知内容留空,按草稿保存;不要补造历史过程或把未经验证的计划记为执行结果。`}),(0,b.jsxs)(`div`,{className:`two`,children:[(0,b.jsxs)(`label`,{children:[`记录状态`,(0,b.jsx)(`select`,{value:i.status,onChange:e=>a(`status`,e.target.value),children:Object.entries(k).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))})]}),(0,b.jsxs)(`label`,{children:[`计划复盘日期`,(0,b.jsx)(`input`,{type:`date`,value:i.reviewOn,onChange:e=>a(`reviewOn`,e.target.value)})]})]}),D.map(([e,t,n])=>(0,b.jsxs)(`label`,{children:[t,(0,b.jsx)(`textarea`,{rows:e===`steps`?4:3,maxLength:1e4,value:i[e]||``,placeholder:n,onChange:t=>a(e,t.target.value)})]},e)),(0,b.jsxs)(`fieldset`,{className:`wb-evidence-picker`,children:[(0,b.jsx)(`legend`,{children:`实际结果证据(完成复盘时必选)`}),e.refs.length?e.refs.map(r=>(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:e.resultRefs.includes(r),onChange:n=>t(`resultRefs`,n.target.checked?[...e.resultRefs,r]:e.resultRefs.filter(e=>e!==r))}),n.find(e=>e.id===r)?.label||r]},r)):(0,b.jsx)(`p`,{className:`muted`,children:`请先在下方选择本项目证据,再标记哪些是实际复盘结果。`})]})]})}function j({current:e,entries:t,onSelect:n}){let r=e.analysisRecord,i=e.analysisOrigin&&t.find(t=>t.id===e.analysisOrigin.id&&t.kind===e.analysisOrigin.kind);if(!r)return(0,b.jsxs)(`div`,{className:`wb-callout`,children:[(0,b.jsx)(`b`,{children:`尚未建立完整分析复盘记录`}),(0,b.jsx)(`p`,{children:`此记录保留了当时填写的内容。已有内容在上方展示;空缺项表示“当时未记录”。未记录的步骤、口径、假设、反证和复盘结果无法还原;可创建关联分析,逐项补充有依据的说明。`})]});let a=t.find(t=>t.id===e.parentRevisionId),o=a?.analysisRecord?D.filter(([e])=>r[e]!==a.analysisRecord[e]).map(([,e])=>e):[];return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`wb-analysis-status`,children:[(0,b.jsx)(`span`,{className:`wb-chip`,children:k[r.status]}),(0,b.jsxs)(`span`,{children:[`计划复盘:`,r.reviewOn||`未安排`]}),r.reviewedAt&&(0,b.jsxs)(`span`,{children:[`记录复盘结果:`,r.reviewedAt.slice(0,10)]})]}),e.analysisGaps?.length>0&&(0,b.jsxs)(`div`,{className:`wb-callout`,children:[`尚未记录:`,e.analysisGaps.join(`、`),`。缺项保持为空,不能视为已验证。`]}),e.analysisOrigin&&(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:`关联原记录`}),i?(0,b.jsxs)(`button`,{className:`wb-text-button`,onClick:()=>n(i.id),children:[i.title,` →`]}):(0,b.jsx)(`p`,{children:`原记录已不可读取,保留归档时的快照。`}),(0,b.jsxs)(`p`,{className:`muted`,children:[e.originSnapshot?.created,` · `,e.originSnapshot?.version?`v`+e.originSnapshot.version:`原记录未提供版本号`]}),e.originChanged&&(0,b.jsx)(`div`,{className:`wb-callout`,children:`原记录已变化或无法读取。此分析使用归档时快照,请在修订时重新核对。`}),(0,b.jsxs)(`details`,{className:`wb-provenance`,children:[(0,b.jsx)(`summary`,{children:`查看原记录归档快照`}),(0,b.jsx)(`p`,{children:e.originSnapshot?.summary}),(0,b.jsxs)(`p`,{children:[`原分析文字:`,e.originSnapshot?.analysis||`未记录`]}),(0,b.jsxs)(`p`,{children:[`原方法名称:`,e.originSnapshot?.method||`未记录`]}),(0,b.jsxs)(`p`,{children:[`原步骤:`,e.originSnapshot?.recordedSteps||`未记录`]}),(0,b.jsxs)(`p`,{children:[`原预期:`,e.originSnapshot?.outputs||`未记录`]}),(0,b.jsxs)(`p`,{children:[`快照 SHA256:`,e.originSnapshot?.hash]})]})]}),D.filter(([e])=>r[e]).map(([e,t])=>(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:t}),(0,b.jsx)(`p`,{children:r[e]})]},e)),a&&(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:`版本变更`}),(0,b.jsxs)(`p`,{children:[`相对 v`,a.version,`:`,o.length?o.join(`、`):`分析字段未变;请同时核对结论、来源与状态`,`。`]}),(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>n(a.id),children:`查看上一版本 →`})]}),!!e.sourceSnapshots?.length&&(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:`使用的输入与来源版本`}),(0,b.jsx)(`p`,{className:`muted`,children:`保存时固定来源标识与版本信息。原始指标和完整数据仍在数据库及附件中。`}),e.sourceSnapshots.map(e=>(0,b.jsxs)(`div`,{className:`wb-reference`,children:[(0,b.jsx)(`b`,{children:e.title||`阶段版本`}),r.resultRefs?.includes(e.id)&&(0,b.jsx)(`span`,{className:`wb-chip`,children:`实际结果证据`}),(0,b.jsxs)(`p`,{children:[e.period||`未提供统计窗口`,` · `,e.version?`v`+e.version:e.created]}),(0,b.jsx)(`p`,{children:e.source||`来源描述未记录`}),(0,b.jsxs)(`details`,{className:`wb-provenance`,children:[(0,b.jsx)(`summary`,{children:`来源标识与文件完整性信息`}),(0,b.jsx)(`p`,{children:e.id}),(0,b.jsxs)(`p`,{children:[`SHA256:`,e.sha||`未提供`]})]})]},e.id))]})]})}var M={method:`任务与方法`,analysis:`分析与复盘`,action:`行动与验证`,node:`流程分析与确认`,demand:`需求分析`,note:`分析文档`,finding:`结论记录`,step:`阶段记录`,playbook:`方法论`};function N(e){let t=String(e.title||`未命名记录`);return e.kind===`node`?t.replace(/\s*·\s*[a-z0-9-]+-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,``):t}function P(e){return e.kind===`node`&&String(e.summary||``).startsWith(`由工作台提交运行 · `)?`本节点资料已提交并留档。请查看输入、证据和待复核事项;提交记录不代表已完成人工确认或真实经营执行。`:e.summary}var ee={title:``,summary:``,analysis:``,source:``,refs:[],pageId:``,expectedVersion:0,reviewRecord:O(),resultRefs:[],origin:null,originHash:``};function F({data:t,api:r,initialRef:i=``,initialEntry:c=``,onDirty:l,onData:u,onMethods:d}){let[f,_]=(0,y.useState)([]),[x,S]=(0,y.useState)([]),[C,w]=p(`resources.wiki.`+t.project.id+`.query`,``),[T,E]=p(`resources.wiki.`+t.project.id+`.kind`,`all`),[D,k]=p(`resources.wiki.`+t.project.id+`.selected`,c),[F,I]=(0,y.useState)(!0),[L,R]=(0,y.useState)(``),[z,B]=(0,y.useState)(``),[V,H]=(0,y.useState)(!1),[U,W]=(0,y.useState)(!!i),[G,K]=(0,y.useState)({...ee,refs:i?[i]:[]}),[q,te]=(0,y.useState)(!1),[ne,re]=(0,y.useState)(0),[J,Y]=(0,y.useState)(``),[ie,ae]=p(`resources.wiki.`+t.project.id+`.reviewFilter`,`all`);(0,y.useEffect)(()=>{c&&k(c)},[c]),(0,y.useEffect)(()=>{let e=!0;return I(!0),R(``),Promise.all([r(`/`+t.project.id+`/knowledge`),r(`/`+t.project.id+`/datasets`)]).then(([t,n])=>{e&&(_(t.entries),S(n.datasets),k(e=>t.entries.some(t=>t.id===e)?e:(t.entries.find(e=>e.kind===`note`||e.kind===`finding`||e.kind===`demand`)||t.entries[0])?.id||``))}).catch(t=>e&&R(t.message)).finally(()=>e&&I(!1)),()=>{e=!1}},[t.project.id,r,ne]);let X=(0,y.useMemo)(()=>{let e=new Map;for(let t of f){let n=e.get(t.pageId);(!n||Number(t.version)>Number(n.version))&&e.set(t.pageId,t)}return[...e.values()]},[f]),oe=X.filter(e=>(T===`all`||e.kind===T)&&(ie===`all`||(ie===`missing`?e.analysisGaps?.length>0:e.analysisRecord?.status===ie))&&`${e.title} ${e.summary} ${e.analysis}`.toLowerCase().includes(C.toLowerCase())),Z=f.find(e=>e.id===D),se=f.filter(e=>e.pageId===Z?.pageId).sort((e,t)=>Number(t.version)-Number(e.version));function ce(){return!q||confirm(`分析文档有未保存修改,放弃这些修改?`)}function le(e){ce()&&(k(e),W(!1),te(!1),l(!1),R(``))}function ue(e){if(!ce())return;W(!0),te(!1),l(!1),B(``);let t=e&&f.filter(t=>t.analysisOrigin?.id===e.id&&t.analysisOrigin?.kind===e.kind).sort((e,t)=>t.version-e.version)[0]||e;if(t?.analysisRecord){let e=f.find(e=>e.id===t.analysisOrigin?.id&&e.kind===t.analysisOrigin?.kind);K({title:t.title,summary:t.summary,source:t.source,analysis:``,refs:t.refs||[],pageId:t.pageId,expectedVersion:t.version,reviewRecord:{...t.analysisRecord,changes:``},resultRefs:t.analysisRecord.resultRefs||[],origin:t.analysisOrigin,originHash:e?.originHash||t.originSnapshot?.hash||``})}else K({...ee,reviewRecord:{...O(),method:e?.method||``,steps:e?.recordedSteps||``},title:e?.title||``,summary:e?.summary||``,source:e?[e.source,e.period].filter(Boolean).join(` / `):``,refs:e?.refs||(i?[i]:[]),origin:e?{id:e.id,kind:e.kind}:null,originHash:e?.originHash||``})}function de(e,t){K(n=>({...n,[e]:t,...e===`refs`?{resultRefs:n.resultRefs.filter(e=>t.includes(e))}:{}})),te(!0),l(!0)}async function fe(){H(!0),R(``);try{let e=await r(`/`+t.project.id+`/knowledge`,{...G,pageId:G.pageId||void 0});te(!1),l(!1),W(!1),k(e.id),re(e=>e+1),B(`已保存 v${e.version},历史版本继续保留。`)}catch(e){R(e.message)}finally{H(!1)}}let pe=[...x.map(e=>({id:e.id,label:`数据集 · `+e.title})),...t.files.filter(e=>!x.some(t=>t.id===e.id)).map(e=>({id:e.id,label:`附件 · `+e.name})),...t.revisions.map(e=>({id:e.id,label:`阶段版本 · v`+e.version+` · `+t.steps[e.step]?.title}))],Q=pe.filter(e=>G.refs.includes(e.id)||e.label.toLowerCase().includes(J.toLowerCase())).sort((e,t)=>Number(G.refs.includes(t.id))-Number(G.refs.includes(e.id))).slice(0,60);return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{children:[`分析与复盘`,(0,b.jsx)(m,{label:`保存分析`,children:`记录问题、分析方法、依据、结论及复盘结果,并选择来源。数据明细留在数据库;修改会保留历史版本。`})]}),(0,b.jsx)(`p`,{className:`muted`,children:`记录问题、方法、证据与结果,按版本复盘项目判断。`})]}),(0,b.jsxs)(`button`,{onClick:()=>ue(),disabled:V,children:[(0,b.jsx)(o,{size:16}),` 新建分析`]})]}),L&&(0,b.jsxs)(`div`,{className:`error`,role:`alert`,children:[L,` `,(0,b.jsx)(`button`,{onClick:()=>re(e=>e+1),children:`重新读取`})]}),z&&(0,b.jsx)(`div`,{className:`notice`,role:`status`,children:z}),F?(0,b.jsx)(`p`,{role:`status`,children:`正在读取分析记录…`}):(0,b.jsxs)(`div`,{className:`wb-wiki-layout`,children:[(0,b.jsxs)(`section`,{className:`card wb-catalog`,children:[(0,b.jsxs)(`label`,{className:`wb-search`,children:[(0,b.jsx)(s,{size:16}),(0,b.jsx)(`input`,{"aria-label":`搜索分析文档`,value:C,onChange:e=>w(e.target.value),placeholder:`搜索标题、结论与分析`})]}),(0,b.jsxs)(`label`,{className:`wb-filter-label`,children:[`记录分类`,(0,b.jsxs)(`select`,{value:T,onChange:e=>E(e.target.value),children:[(0,b.jsxs)(`option`,{value:`all`,children:[`全部记录(`,X.length,`)`]}),Object.entries(M).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})]}),(0,b.jsxs)(`label`,{className:`wb-filter-label`,children:[`复盘状态`,(0,b.jsxs)(`select`,{"aria-label":`复盘状态筛选`,value:ie,onChange:e=>ae(e.target.value),children:[(0,b.jsx)(`option`,{value:`all`,children:`全部`}),(0,b.jsx)(`option`,{value:`missing`,children:`过程待补充`}),(0,b.jsx)(`option`,{value:`planned`,children:`待复盘`}),(0,b.jsx)(`option`,{value:`reviewed`,children:`已填写复盘`})]})]}),(0,b.jsxs)(`div`,{className:`wb-dataset-list`,children:[oe.map(e=>(0,b.jsxs)(`button`,{className:Z?.pageId===e.pageId&&!U?`active`:``,onClick:()=>le(e.id),children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(a,{size:16}),(0,b.jsx)(`b`,{children:N(e)})]}),(0,b.jsxs)(`small`,{children:[M[e.kind],` · `,e.version?`v`+e.version:`未记录版本`]}),(0,b.jsxs)(`small`,{children:[String(e.created).slice(0,10),e.supersededBy?` · 已被取代`:``,e.stale?` · 待复核`:``]})]},e.id)),!oe.length&&(0,b.jsx)(`p`,{className:`muted`,children:`没有匹配的分析记录。`})]})]}),(0,b.jsx)(`section`,{className:`card wb-wiki-content`,children:U?(0,b.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),fe()},children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsx)(`h2`,{children:G.pageId?`修订分析`:`新建分析文档`}),(0,b.jsx)(`span`,{className:`wb-chip`,children:q?`未保存`:`编辑中`})]}),(0,b.jsx)(`p`,{className:`muted`,children:`结论保存为新版本。原始指标表请上传至数据中心,在这里选择引用。`}),(0,b.jsxs)(`label`,{children:[`文档标题`,(0,b.jsx)(`input`,{required:!0,maxLength:200,value:G.title,onChange:e=>de(`title`,e.target.value),placeholder:`例如:本周转化下降的原因与验证计划`})]}),(0,b.jsxs)(`label`,{children:[`结论与建议`,(0,b.jsx)(`textarea`,{required:!0,rows:4,maxLength:12e3,value:G.summary,onChange:e=>de(`summary`,e.target.value),placeholder:`先写结论、适用范围与下一步行动`})]}),(0,b.jsx)(A,{form:G,change:de,evidenceOptions:pe,busy:V}),(0,b.jsxs)(`label`,{children:[`资料来源与统计时间`,(0,b.jsx)(`input`,{required:!0,maxLength:2e3,value:G.source,onChange:e=>de(`source`,e.target.value),placeholder:`资料来源、分析日期、使用的数据窗口`})]}),(0,b.jsxs)(`label`,{children:[`查找证据`,(0,b.jsx)(`input`,{"aria-label":`查找引用证据`,value:J,onChange:e=>Y(e.target.value),placeholder:`搜索数据集、附件或阶段版本`})]}),(0,b.jsxs)(`p`,{className:`muted`,children:[`已选 `,G.refs.length,` 项证据 · 共 `,pe.length,` 项可用 · 最多显示 60 项,已选项优先`]}),(0,b.jsxs)(`fieldset`,{className:`wb-evidence-picker`,children:[(0,b.jsx)(`legend`,{children:`引用本项目证据(关联历史记录时可先存草稿)`}),pe.length?Q.map(e=>(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:G.refs.includes(e.id),onChange:t=>de(`refs`,t.target.checked?[...G.refs,e.id]:G.refs.filter(t=>t!==e.id))}),(0,b.jsx)(`span`,{children:e.label})]},e.id)):(0,b.jsx)(`p`,{children:`暂无可引用证据,请先在阶段工作区保存资料。`})]}),(0,b.jsxs)(`div`,{className:`wb-actions`,children:[(0,b.jsx)(`button`,{type:`submit`,disabled:V||!G.refs.length&&!G.origin,children:V?`保存中…`:`保存新版本`}),(0,b.jsx)(`button`,{type:`button`,className:`secondary`,disabled:V,onClick:()=>{ce()&&(W(!1),te(!1),l(!1))},children:`取消`})]})]}):Z?(0,b.jsxs)(`article`,{children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsxs)(`span`,{className:`wb-chip`,children:[(0,b.jsx)(g,{size:14}),M[Z.kind]]}),Z.kind===`demand`&&(0,b.jsx)(`span`,{className:`wb-chip`,children:`需求结果仍在需求拆分中修订`}),Z.kind===`method`?(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>d?.(Z.methodRecordId),children:`在任务与方法中查看 / 追加版本 →`}):(0,b.jsxs)(`button`,{className:`wb-text-button`,onClick:()=>ue(se[0]),children:[Z.kind===`analysis`?`修订分析 / 记录复盘`:`补充分析记录 / 复盘`,` `,(0,b.jsx)(e,{size:14})]})]}),(0,b.jsx)(`h2`,{className:`wb-doc-title`,children:N(Z)}),(0,b.jsxs)(`p`,{className:`muted`,children:[Z.created,` · `,Z.version?`v`+Z.version:`历史记录,未提供版本号`]}),Z.stale&&(0,b.jsx)(`div`,{className:`wb-callout`,children:`上游资料已更新,此阶段结论需要复核。`}),Z.supersededBy&&(0,b.jsx)(`div`,{className:`wb-callout`,children:`此结论已被后续结论取代,保留供历史追溯。`}),se.length>1&&(0,b.jsxs)(`label`,{className:`wb-history`,children:[(0,b.jsx)(v,{size:16}),` 历史版本`,(0,b.jsx)(`select`,{"aria-label":`历史版本`,value:D,onChange:e=>le(e.target.value),children:se.map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[`v`,e.version,` · `,String(e.created).slice(0,16)]},e.id))})]}),[[`输入与约束`,Z.context],[`结论与建议`,P(Z)],[`已记录的方法名称`,Z.method],[`已记录的分析过程`,Z.analysisRecord?``:Z.analysis],[`已记录的分析步骤`,Z.recordedSteps],[`验证窗口`,Z.reviewWindow],[`判断与规则`,Z.reason],[`修订与注意事项`,Z.repair],[`预期产出`,Z.outputs]].filter(([,e])=>e).map(([e,t])=>(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:e}),(0,b.jsx)(`p`,{children:t})]},e)),Z.kind===`action`&&(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:`关联结论`}),Z.linkedFinding&&f.some(e=>e.id===Z.linkedFinding)?(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>le(Z.linkedFinding),children:`查看关联结论 →`}):(0,b.jsx)(`p`,{className:`muted`,children:`当时未记录可定位的结论关联。`})]}),Z.kind!==`method`&&(0,b.jsx)(j,{current:Z,entries:f,onSelect:le}),f.some(e=>e.analysisOrigin?.id===Z.id)&&(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:`关联分析与复盘`}),X.filter(e=>e.analysisOrigin?.id===Z.id).map(e=>(0,b.jsxs)(`button`,{className:`wb-text-button`,onClick:()=>le(e.id),children:[N(e),` · v`,e.version,` →`]},e.id))]}),(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:`来源与范围`}),(0,b.jsxs)(`p`,{children:[Z.kind===`node`?`本项目节点保存记录;这是操作留档,不是外部经营数据来源。`:Z.source||`未记录`,Z.period?`
2
- 统计窗口:`+Z.period:``]})]}),(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsxs)(`h3`,{children:[(0,b.jsx)(n,{size:16}),` 证据引用`]}),Z.refs?.length?Z.refs.map(e=>{let n=x.find(t=>t.id===e),r=t.files.find(t=>t.id===e),i=f.find(t=>t.id===e);return(0,b.jsx)(`div`,{className:`wb-reference`,children:n?(0,b.jsxs)(`button`,{className:`wb-text-button`,onClick:()=>u(e),children:[`数据集 · `,n.title,` →`]}):r?(0,b.jsxs)(`a`,{href:`/api/workbench/`+t.project.id+`/file/`+e,children:[`附件 · `,r.name]}):i?(0,b.jsxs)(`button`,{className:`wb-text-button`,onClick:()=>le(e),children:[`阶段版本 · v`,i.version,` `,N(i)]}):(0,b.jsxs)(`span`,{children:[`引用待核:`,e]})},e)}):(0,b.jsx)(`p`,{className:`muted`,children:`此历史记录未提供可定位的引用;请结合下方来源描述复核。`}),Z.evidence?.length>0&&(0,b.jsx)(`div`,{className:`wb-table-wrap`,children:(0,b.jsxs)(`table`,{className:`wb-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`指标摘要`}),(0,b.jsx)(`th`,{children:`引用值`}),(0,b.jsx)(`th`,{children:`对比基准`}),(0,b.jsx)(`th`,{children:`来源描述`})]})}),(0,b.jsx)(`tbody`,{children:Z.evidence.map((e,t)=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:e.metric}),(0,b.jsxs)(`td`,{children:[e.value??`—`,e.unit]}),(0,b.jsx)(`td`,{children:e.benchmark||`—`}),(0,b.jsx)(`td`,{children:e.source||`未提供`})]},t))})]})})]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`高级:原始标题、记录标识与来源`}),(0,b.jsxs)(`p`,{className:`wb-record-id`,children:[`原始标题:`,Z.title,(0,b.jsx)(`br`,{}),`原始摘要:`,Z.summary||`未记录`,(0,b.jsx)(`br`,{}),`来源:`,Z.source||`未记录`,(0,b.jsx)(`br`,{}),`记录 ID:`,Z.id]})]})]}):(0,b.jsx)(h,{title:`还没有分析文档`,children:`从数据中心选择证据,记录分析方法、判断依据和复盘计划。`})})]})]})}var I={brief:`任务定义`,hypothesis:`候选解释`,feedback:`错误与反馈`,rule:`候选规则`,case:`验证案例`,evaluation:`验证登记`},L={brief:[[`object`,`对象`,`商品、对象或流程;未知可留空`],[`goal`,`目标`,`要完成什么;清晰任务无需重复澄清`],[`conflict`,`现象或冲突`,`实际与期望哪里不同`],[`constraints`,`约束`,`时间、预算、不能改变的条件`],[`feedback`,`反馈方式`,`用哪些观测判断是否改善`]],hypothesis:[[`explanation`,`候选解释`,`这是待验证解释,不是事实`],[`mechanism`,`可能机制`,`为何可能出现该现象`],[`counterCondition`,`反证条件`,`什么证据会推翻解释`],[`signal`,`验证信号`,`指标、口径、窗口及观察位置`],[`stopCondition`,`停止条件`,`何时停止继续采用该解释`],[`failureBranch`,`失败分支`,`证据不支持或无法取得时下一步做什么`]],feedback:[[`observed`,`错误或反馈`,`保留实际问题,勿把猜测当已定位原因`],[`impact`,`实际影响`,`未测量的影响留空`],[`correction`,`纠正依据与建议`,`哪些证据支持纠正;哪些仍不确定`]],rule:[[`rule`,`判断规则`,`明确条件与判断动作,避免泛化口号`],[`scope`,`适用范围`,`商品、渠道、阶段、时间及输入条件`],[`exceptions`,`不适用条件与反例`,`哪些情况不能套用`],[`counterCondition`,`推翻或停用条件`,`哪些观察要求退回候选或停用`],[`expectedChange`,`预期改善`,`与普通明确指令相比预期改变什么`]],case:[[`scope`,`案例范围`,`真实/模拟性质、适用条件;原始材料选择数据库或附件`],[`criteria`,`评价口径`,`标准答案的评审方式,不向干净执行者暴露答案`]],evaluation:[[`scope`,`本次验证范围`,`限定可以支持的结论`],[`model`,`隔离执行模型`,`记录外部实际使用的模型;此页不调用模型`],[`timeout`,`预留时间与依据`,`按实际任务耗时估计`],[`report`,`人工评审报告`,`记录触发、运行、泄漏、输出与合理表达差异`],[`nextAction`,`后续建议`,`报告后先由用户审核,不自动修改再测`]]},R={unknown:`尚未定位`,definition:`问题定义`,evidence:`证据或口径`,rule:`判断规则`,execution:`执行过程`,tool:`工具或平台`,permission:`权限或依赖`,expression:`表达或交付`},z={development:`开发案例`,holdout:`未参与修改的留出案例`,regression:`旧案例回归`,counterexample:`反例`},B={pass:`通过(限记录范围)`,partial:`部分通过`,not_triggered:`未触发`,timeout:`触发后超时`,runtime:`运行或平台失败`,missing_tool:`依赖缺失`,context_leak:`上下文或答案泄漏`,output_failure:`输出失败`,cannot_judge:`无法判断`},V=(e=`brief`)=>({kind:e,title:``,summary:``,fields:Object.fromEntries((L[e]||[]).map(([e])=>[e,``])),nodes:[],analysisIds:[],relatedIds:[],refs:[],cause:`unknown`,role:`development`,usedForDevelopment:!1,inputRef:``,expectedRef:``,ruleRevisionId:``,caseRevisionIds:[],trialRef:``,approvalRef:``,requestRef:``,revisionApprovalRef:``,stable:!1,level:`synthetic`,outcome:`cannot_judge`,results:[]});function H(e){return e.kind===`rule`?e.state===`verified`?e.level===`business`?`已人工验证 · 限所述业务范围`:`已人工验证 · 仅模拟案例`:`候选 · 未验证`:e.kind===`evaluation`?{draft:`准备中`,authorized:`已登记前提 · 未自动执行`,reported:`已登记报告 · 等待人工决定`,interrupted:`已中断 · 未验证`}[e.state]||`准备中`:`已记录 · 待核验`}function U({data:e,api:t,onDirty:n,initialNode:r=``,initialRecord:i=``,onWiki:a}){let[o,s]=(0,y.useState)([]),[c,l]=(0,y.useState)([]),[u,d]=(0,y.useState)(!0),[f,p]=(0,y.useState)(``),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(!1),[x,S]=(0,y.useState)(`all`),[C,w]=(0,y.useState)(``),[T,E]=(0,y.useState)(r),[D,O]=(0,y.useState)(``),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(V()),[N,P]=(0,y.useState)(!1),[ee,F]=(0,y.useState)(``),[U,W]=(0,y.useState)(!1),[G,K]=(0,y.useState)(``),[q,te]=(0,y.useState)(``),[ne,re]=(0,y.useState)(``),J=(0,y.useRef)(null),Y=(0,y.useRef)(!0);(0,y.useEffect)(()=>(Y.current=!0,ie(),()=>{Y.current=!1}),[e.project.id]),(0,y.useEffect)(()=>{n(N||_)},[N,_,n]);async function ie(n){d(!0);try{let[r,a]=await Promise.all([t(`/`+e.project.id+`/methods`),t(`/`+e.project.id+`/knowledge`)]);if(!Y.current)return;s(r.records),l(a.entries),O(n||r.records.find(e=>e.recordId===i)?.id||``),p(``)}catch(e){Y.current&&p(e.message)}finally{Y.current&&d(!1)}}let ae=(0,y.useMemo)(()=>{let e=new Map;for(let t of o)(!e.has(t.recordId)||e.get(t.recordId).version<t.version)&&e.set(t.recordId,t);return[...e.values()]},[o]),X=o.find(e=>e.id===D),oe=o.filter(e=>e.recordId===X?.recordId).sort((e,t)=>t.version-e.version),Z=oe[0],se=e.files||[],ce=ae.filter(e=>e.kind===`case`),le=ae.filter(e=>e.kind===`rule`);function ue(){return!_&&(!N||confirm(`有未保存内容,放弃这些修改?`))}function de(e){ue()&&(O(e),A(!1),P(!1),F(``),W(!1),g(``),p(``))}function fe(e){ue()&&(M({...V(e),nodes:T?[T]:[]}),O(``),A(!0),P(!1),F(``),W(!1),p(``))}function pe(){ue()&&(O(Z.id),M(structuredClone(Z)),A(!0),P(!1),F(``),W(!1),p(``))}function Q(e,t){M(n=>({...n,[e]:t})),P(!0)}function me(e,t){Q(`fields`,{...j.fields,[e]:t})}let he=(e,t,n=!1)=>(0,b.jsxs)(`label`,{children:[e,(0,b.jsxs)(`select`,{value:j[t]||``,disabled:n,onChange:e=>Q(t,e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`未记录 / 待补充`}),se.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]},t),ge=(e,t,n,r=!1)=>(0,b.jsxs)(`fieldset`,{className:`wb-evidence-picker`,disabled:r,children:[(0,b.jsx)(`legend`,{children:e}),n.length?n.map(e=>(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:(j[t]||[]).includes(e.id),onChange:n=>Q(t,n.target.checked?[...j[t]||[],e.id]:j[t].filter(t=>t!==e.id))}),(0,b.jsx)(`span`,{children:e.label})]},e.id)):(0,b.jsx)(`p`,{className:`muted`,children:`暂无可选记录。`})]});async function _e(n){if(_)return;let r={op:n,record:j,recordId:X?.recordId,expectedVersion:X?.version||0,reason:ee,ackHuman:U,evaluationRevisionId:G,targetRevisionId:q,revisionApprovalRef:ne},i=JSON.stringify(r);J.current?.key!==i&&(J.current={key:i,id:crypto.randomUUID()}),r.mutationId=J.current.id,v(!0),p(``);try{let n=await t(`/`+e.project.id+`/methods`,r);if(!Y.current)return;P(!1),A(!1),W(!1),J.current=null,await ie(n.id),g(`已保存 v${n.version}。仅登记方法与审核,未执行店铺操作或干净回归。`)}catch(e){Y.current&&p(e.message+`。若连接中断,请先重新读取;同一提交可安全重试。`)}finally{Y.current&&v(!1)}}let $=k&&j.kind===`evaluation`&&X?.state===`authorized`,ve=ae.filter(e=>(x===`all`||e.kind===x)&&(!T||e.nodes.includes(T))&&`${e.title} ${e.summary} ${JSON.stringify(e.fields)}`.toLowerCase().includes(C.toLowerCase())),ye=(e,t,n)=>{let r=j.results.find(t=>t.caseRevisionId===e)||{caseRevisionId:e,baselineRef:``,candidateRef:``,verdict:`unknown`,reason:``,elapsedSeconds:null,rework:null};Q(`results`,[...j.results.filter(t=>t.caseRevisionId!==e),{...r,[t]:n}])};return(0,b.jsxs)(`div`,{className:`wb-methods`,children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{children:[`任务与方法`,(0,b.jsx)(m,{label:`记录分析方法`,children:`任务明确时不用重复填写。新增方法先保存为待验证候选,模型建议不能直接成为业务规则,也不会授权店铺操作。`})]}),(0,b.jsx)(`p`,{className:`muted`,children:`明确问题 → 候选解释 → 现实反馈 → 规则候选 → 人工验证与复盘`})]}),(0,b.jsx)(`button`,{disabled:_,onClick:()=>fe(x===`all`?`brief`:x),children:`新增记录`})]}),(0,b.jsx)(`div`,{className:`wb-callout`,children:`清晰任务可直接进行;只按需补充未知信息。这里保存可审计依据和方法,不保存模型内部推理链。规则与店铺操作权限分离。`}),f&&(0,b.jsxs)(`div`,{className:`error`,role:`alert`,children:[f,(0,b.jsx)(`button`,{disabled:_,onClick:()=>ie(X?.id),children:`重新读取`})]}),h&&(0,b.jsx)(`div`,{className:`notice`,role:`status`,children:h}),(0,b.jsxs)(`div`,{className:`wb-method-filters`,children:[(0,b.jsxs)(`label`,{children:[`记录类型`,(0,b.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),children:[(0,b.jsx)(`option`,{value:`all`,children:`全部`}),Object.entries(I).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})]}),(0,b.jsxs)(`label`,{children:[`关联节点`,(0,b.jsxs)(`select`,{value:T,onChange:e=>E(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`全部节点`}),e.nodeStatus.map(e=>(0,b.jsx)(`option`,{value:e.node,children:e.name},e.node))]})]}),(0,b.jsxs)(`label`,{children:[`查找记录`,(0,b.jsx)(`input`,{value:C,onChange:e=>w(e.target.value),placeholder:`标题、说明或方法字段`})]})]}),u?(0,b.jsx)(`p`,{role:`status`,children:`正在读取版本记录…`}):(0,b.jsxs)(`div`,{className:`wb-wiki-layout`,children:[(0,b.jsx)(`aside`,{className:`card wb-catalog`,children:(0,b.jsxs)(`div`,{className:`wb-dataset-list`,children:[ve.map(e=>(0,b.jsxs)(`button`,{className:e.recordId===X?.recordId?`active`:``,disabled:_,onClick:()=>de(e.id),children:[(0,b.jsx)(`b`,{children:e.title}),(0,b.jsxs)(`small`,{children:[I[e.kind],` · v`,e.version]}),(0,b.jsx)(`small`,{children:H(e)})]},e.id)),!ve.length&&(0,b.jsx)(`p`,{children:`暂无匹配记录。历史没有记录的内容不会自动补造。`})]})}),(0,b.jsx)(`section`,{className:`card wb-wiki-content`,children:k?(0,b.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e($?`report`:`save`)},children:(0,b.jsxs)(`fieldset`,{disabled:_,className:`wb-analysis-fields`,children:[(0,b.jsx)(`legend`,{children:X?`追加版本`:`新增记录`}),!X&&(0,b.jsxs)(`label`,{children:[`新增类型`,(0,b.jsx)(`select`,{value:j.kind,onChange:e=>{(!N||confirm(`更换类型会清空未保存表单,继续?`))&&(M({...V(e.target.value),nodes:T?[T]:[]}),P(!1))},children:Object.entries(I).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))})]}),(0,b.jsxs)(`label`,{children:[`标题`,(0,b.jsx)(`input`,{required:!0,maxLength:200,disabled:$,value:j.title,onChange:e=>Q(`title`,e.target.value)})]}),(0,b.jsxs)(`label`,{children:[`简要说明 / 下一步`,(0,b.jsx)(`textarea`,{rows:2,maxLength:12e3,disabled:$,value:j.summary,onChange:e=>Q(`summary`,e.target.value)})]}),j.kind===`brief`&&(0,b.jsx)(`p`,{className:`muted`,children:`以下五项均可留空,不要求为清晰任务重复填写问卷。`}),L[j.kind].map(([e,t,n])=>(0,b.jsxs)(`label`,{children:[t,(0,b.jsx)(`textarea`,{rows:3,maxLength:1e4,placeholder:n,value:j.fields[e]||``,disabled:$&&![`report`,`nextAction`].includes(e),onChange:t=>me(e,t.target.value)})]},e)),j.kind===`feedback`&&(0,b.jsxs)(`label`,{children:[`可能出错的环节`,(0,b.jsx)(`select`,{value:j.cause,onChange:e=>Q(`cause`,e.target.value),children:Object.entries(R).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))})]}),j.kind===`rule`&&(0,b.jsxs)(b.Fragment,{children:[he(`报告后修改:用户明确要求修改的依据`,`revisionApprovalRef`),(0,b.jsx)(`p`,{className:`muted`,children:`新建和修订都先保存为候选。模型建议、格式通过和模拟表现不能自动成为真实业务验证。`})]}),j.kind===`case`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`案例用途`,(0,b.jsx)(`select`,{value:j.role,onChange:e=>Q(`role`,e.target.value),children:Object.entries(z).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:j.usedForDevelopment,onChange:e=>Q(`usedForDevelopment`,e.target.checked)}),`此输入曾参与规则修改或开发`]}),he(`原始输入(数据库/附件)`,`inputRef`),he(`人工认可参考依据(不进入运行上下文)`,`expectedRef`),(0,b.jsx)(`p`,{className:`muted`,children:`案例原件和答案保存在数据库及附件,不写入 Wiki 正文。留出状态是人工声明,系统会检查已登记的内容重复,不能证明人从未见过该案例。`})]}),j.kind===`evaluation`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`wb-callout`,children:`干净回归门禁:用户认可的标准答案、当前迭代完成、用户主动要求,三者齐备。这里只登记前提和外部结果,不启动子代理。外部应仅启动一个隔离执行者,普通任务提示不得夹带答案、Skill 路径、评分表或设计历史;报告后先交用户审核,不自动修改再测。`}),(0,b.jsxs)(`label`,{children:[`本次验证固定使用的方法版本`,(0,b.jsxs)(`select`,{disabled:$,value:j.ruleRevisionId,onChange:e=>Q(`ruleRevisionId`,e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`请选择规则`}),($?o.filter(e=>e.id===j.ruleRevisionId):le).map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.title,` · v`,e.version]},e.id))]})]}),ge(`验证案例(分别保留留出、旧例与反例)`,`caseRevisionIds`,($?o.filter(e=>j.caseRevisionIds.includes(e.id)):ce).map(e=>({id:e.id,label:`${e.title} · v${e.version} · ${z[e.role]}`})),$),he(`真实/代表性主对话试用与标准答案依据`,`trialRef`,$),he(`用户已认可该标准答案的依据`,`approvalRef`,$),he(`用户本次明确要求干净回归的依据`,`requestRef`,$),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,disabled:$,checked:j.stable,onChange:e=>Q(`stable`,e.target.checked)}),`当前迭代已完成,不在调试途中`]}),(0,b.jsxs)(`label`,{children:[`验证性质`,(0,b.jsxs)(`select`,{disabled:$,value:j.level,onChange:e=>Q(`level`,e.target.value),children:[(0,b.jsx)(`option`,{value:`synthetic`,children:`模拟案例验证,不代表业务效果`}),!e.project.simulated&&(0,b.jsx)(`option`,{value:`business`,children:`人工核验的真实业务范围`})]})]}),$&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`外部运行结果`,(0,b.jsx)(`select`,{value:j.outcome,onChange:e=>Q(`outcome`,e.target.value),children:Object.entries(B).map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))})]}),j.caseRevisionIds.map(e=>{let t=o.find(t=>t.id===e),n=j.results.find(t=>t.caseRevisionId===e)||{};return(0,b.jsxs)(`fieldset`,{className:`wb-analysis-fields`,children:[(0,b.jsx)(`legend`,{children:t?.title||e}),[[`baselineRef`,`普通明确指令的输出证据`],[`candidateRef`,`加入候选规则的输出证据`]].map(([t,r])=>(0,b.jsxs)(`label`,{children:[r,(0,b.jsxs)(`select`,{value:n[t]||``,onChange:n=>ye(e,t,n.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`未记录`}),se.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]},t)),(0,b.jsxs)(`label`,{children:[`案例判断`,(0,b.jsxs)(`select`,{value:n.verdict||`unknown`,onChange:t=>ye(e,`verdict`,t.target.value),children:[(0,b.jsx)(`option`,{value:`unknown`,children:`无法判断`}),(0,b.jsx)(`option`,{value:`pass`,children:`通过`}),(0,b.jsx)(`option`,{value:`fail`,children:`失败`})]})]}),(0,b.jsxs)(`label`,{children:[`判断依据`,(0,b.jsx)(`textarea`,{value:n.reason||``,onChange:t=>ye(e,`reason`,t.target.value)})]}),[[`elapsedSeconds`,`耗时(秒)`],[`rework`,`人工返工次数`]].map(([t,r])=>(0,b.jsxs)(`label`,{children:[r,(0,b.jsx)(`input`,{type:`number`,min:`0`,value:n[t]??``,onChange:n=>ye(e,t,n.target.value===``?null:Number(n.target.value))})]},t))]},e)})]})]}),!$&&(0,b.jsxs)(`details`,{className:`wb-method-links`,open:!!r,children:[(0,b.jsx)(`summary`,{children:`关联节点、分析、反馈和证据`}),ge(`关联节点`,`nodes`,e.nodeStatus.map(e=>({id:e.node,label:e.name}))),ge(`关联分析或节点记录版本`,`analysisIds`,c.filter(e=>!String(e.id).includes(`-audit-`)).map(e=>({id:e.id,label:`${e.title} · ${e.version?`v`+e.version:`未记录版本`}`}))),ge(`关联反馈、解释或规则版本`,`relatedIds`,ae.filter(e=>e.recordId!==X?.recordId).map(e=>({id:e.id,label:`${I[e.kind]} · ${e.title} · v${e.version}`}))),ge(`来源证据`,`refs`,se.map(e=>({id:e.id,label:e.name})))]}),X&&(0,b.jsxs)(`label`,{children:[`本版变更 / 审核理由`,(0,b.jsx)(`textarea`,{required:!0,value:ee,maxLength:2e3,onChange:e=>{F(e.target.value),P(!0)}})]}),($||j.kind===`rule`)&&(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked)}),`我已人工核对来源和适用边界;需要修订时已有用户明确要求`]}),(0,b.jsxs)(`div`,{className:`wb-actions`,children:[(0,b.jsx)(`button`,{type:`submit`,children:_?`保存中…`:$?`登记报告为新版本`:`保存为新版本`}),(0,b.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>{ue()&&(A(!1),P(!1))},children:`取消`})]}),(0,b.jsx)(`p`,{className:`muted`,children:`提交后离开页面不会撤销已完成的保存。连接中断先回读,再重试;不会自动重跑验证。`})]})}):X?(0,b.jsxs)(`article`,{children:[(0,b.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,b.jsx)(`span`,{className:`wb-chip`,children:I[X.kind]}),(0,b.jsx)(`span`,{children:H(X)})]}),(0,b.jsx)(`h2`,{className:`wb-doc-title`,children:X.title}),(0,b.jsxs)(`p`,{className:`muted`,children:[`v`,X.version,` · `,X.created]}),(0,b.jsxs)(`label`,{children:[`历史版本`,(0,b.jsx)(`select`,{value:X.id,onChange:e=>de(e.target.value),children:oe.map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[`v`,e.version,` · `,H(e)]},e.id))})]}),(0,b.jsx)(`p`,{className:`wb-prose`,children:X.summary||`当时未记录简要说明。`}),L[X.kind].map(([e,t])=>(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:t}),(0,b.jsx)(`p`,{children:X.fields[e]||`当时未记录`})]},e)),X.kind===`feedback`&&(0,b.jsxs)(`p`,{children:[`疑似原因:`,R[X.cause],`(并非已经证实)`]}),X.kind===`case`&&(0,b.jsxs)(`p`,{children:[z[X.role],` · `,X.usedForDevelopment?`已参与开发`:`未参与开发(人工声明)`]}),X.kind===`evaluation`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`wb-callout`,children:[H(X),`。本系统未启动干净回归;不把模型建议或模拟结果当真实业务效果。`,X.ruleRevisionId&&o.some(e=>e.id===X.ruleRevisionId&&ae.some(t=>t.recordId===e.recordId&&t.id!==e.id))?`规则已产生后续版本,本报告只对应冻结版本。`:``]}),(0,b.jsxs)(`p`,{children:[`运行结果:`,B[X.outcome],` · `,X.level===`business`?`真实业务范围(人工声明)`:`仅模拟案例`]}),X.results.map(e=>(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsx)(`h3`,{children:o.find(t=>t.id===e.caseRevisionId)?.title||e.caseRevisionId}),(0,b.jsxs)(`p`,{children:[e.verdict,` · `,e.reason||`未记录判断`,` · 耗时 `,e.elapsedSeconds??`未记录`,` 秒 · 返工 `,e.rework??`未记录`,` 次`]})]},e.caseRevisionId))]}),X.review&&(0,b.jsxs)(`div`,{className:`wb-callout`,children:[`人工审核记录:`,X.review.reason,` · `,X.review.at,`。仅限:`,X.review.declaredScope,`;不自动启用业务动作。`]}),(0,b.jsxs)(`section`,{className:`wb-prose`,children:[(0,b.jsxs)(`h3`,{children:[`关联与追溯`,(0,b.jsx)(m,{label:`追溯依据`,children:`关联具体资料与分析版本。历史没记录的内容应标明缺失,不要用事后推测补成当时事实。`})]}),(0,b.jsxs)(`p`,{children:[`节点:`,X.nodes.map(t=>e.nodeStatus.find(e=>e.node===t)?.name||t).join(`、`)||`未关联`]}),X.analysisIds.map(e=>(0,b.jsxs)(`button`,{className:`wb-text-button`,onClick:()=>a?.(e),children:[`查看分析 / 节点版本:`,c.find(t=>t.id===e)?.title||e,` →`]},e)),X.relatedIds.map(e=>(0,b.jsxs)(`button`,{className:`wb-text-button`,onClick:()=>de(e),children:[`关联记录:`,o.find(t=>t.id===e)?.title||e,` →`]},e)),X.kind!==`case`&&(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>a?.(X.id),children:`在分析 Wiki 阅读 →`})]}),(0,b.jsxs)(`details`,{className:`wb-provenance`,children:[(0,b.jsx)(`summary`,{children:`证据版本、输入与完整性校验`}),(X.sourceSnapshots||[]).map(t=>(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t.id,children:t.name}),` · `,t.created,(0,b.jsx)(`br`,{}),`SHA256 `,t.sha]},t.id)),X.analysisSnapshots?.map(e=>(0,b.jsxs)(`p`,{children:[`关联 `,e.id,` · `,e.version?`v`+e.version:`未记录版本`,` · SHA256 `,e.sha]},e.id))]}),(0,b.jsxs)(`p`,{className:`muted`,children:[`本版说明:`,X.changeReason||`首次记录`,X.rollbackOf?`;恢复自 `+X.rollbackOf:``]}),X.id===Z?.id&&(0,b.jsxs)(`div`,{className:`wb-method-review`,children:[(X.kind!==`evaluation`||X.state===`draft`||X.state===`authorized`)&&(0,b.jsx)(`button`,{disabled:_,onClick:pe,children:X.kind===`evaluation`&&X.state===`authorized`?`登记外部验证报告`:`编辑并保存新版本`}),(X.kind===`rule`||X.kind===`evaluation`)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`本次审核 / 中断 / 回滚理由`,(0,b.jsx)(`textarea`,{maxLength:2e3,value:ee,onChange:e=>F(e.target.value)})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked)}),`人工核对:依据真实记录、范围和用户要求,模型自评不能替代`]})]}),X.kind===`evaluation`&&X.state===`draft`&&(0,b.jsx)(`button`,{disabled:_,onClick:()=>_e(`authorize`),children:`记录验证条件已齐备(不开始运行)`}),X.kind===`evaluation`&&[`draft`,`authorized`].includes(X.state)&&(0,b.jsx)(`button`,{className:`secondary`,disabled:_,onClick:()=>_e(`interrupt`),children:`登记中断`}),X.kind===`rule`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`本版本验证报告`,(0,b.jsxs)(`select`,{value:G,onChange:e=>K(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`请选择已报告的验证`}),ae.filter(e=>e.kind===`evaluation`&&e.ruleRevisionId===X.id&&e.state===`reported`).map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.title,` · `,B[e.outcome]]},e.id))]})]}),(0,b.jsx)(`button`,{disabled:_||!G,onClick:()=>_e(`verify`),children:`人工审核为已验证(限记录范围)`}),oe.length>1&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`恢复哪个历史版本`,(0,b.jsxs)(`select`,{value:q,onChange:e=>te(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`请选择历史版本`}),oe.filter(e=>e.id!==X.id).map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[`v`,e.version,` · `,e.title]},e.id))]})]}),(0,b.jsxs)(`label`,{children:[`报告后修改的用户要求依据`,(0,b.jsxs)(`select`,{value:ne,onChange:e=>re(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`未提供`}),se.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,b.jsx)(`button`,{className:`secondary`,disabled:_||!q,onClick:()=>_e(`rollback`),children:`将历史内容另存为待验证版本`})]})]})]})]}):(0,b.jsxs)(`div`,{className:`wb-empty`,children:[(0,b.jsx)(`h3`,{children:`按需记录,不增加重复问卷`}),(0,b.jsx)(`p`,{children:`任务已明确可直接推进现有流程;需要分析或复盘时,再创建任务定义、候选解释或错误反馈。`}),(0,b.jsx)(`button`,{onClick:()=>fe(`brief`),children:`记录任务`})]})})]})]})}var W=[[`finding`,`分析结论`,`每条结论必须挂数据依据,可被后续结论取代`],[`action-item`,`下一步动作`,`必须写清改哪里、改什么、因果链、怎么验证`],[`playbook`,`方法论库`,`可复用的分析套路,换项目也能照着跑`]],G={todo:`待办`,doing:`进行中`,done:`已完成`,dropped:`已放弃`,blocked:`受阻`},K=e=>Object.values(e||{}).some(e=>e!==``&&e!=null),q={high:`高`,medium:`中`,low:`低`};function te(e){return e.split(`
3
- `).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,n,r,i,a]=e.split(`|`).map(e=>(e||``).trim());return{metric:t,value:n,unit:r,benchmark:i,source:a}})}function ne({data:e,api:t,onSaved:n,onWikiEntry:r,onDirty:i,onBusy:a}){let[o,s]=(0,y.useState)(`finding`),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(``),[f,p]=(0,y.useState)(!1),[h,g]=(0,y.useState)({}),_=h[o]||{},v=e=>g(t=>({...t,[o]:typeof e==`function`?e(t[o]||{}):e})),x=Object.values(h).some(e=>K(e));(0,y.useEffect)(()=>{i?.(x)},[x,i]),(0,y.useEffect)(()=>(a?.(c),()=>a?.(!1)),[c,a]);let S=e.findings||[],C=e.actionItems||[],w=e.playbooks||[],T={finding:S.length,"action-item":C.length,playbook:w.length};(0,y.useEffect)(()=>{p(K(h[o])),d(``)},[o]);function E(e,t){v(n=>({...n,[e]:t}))}async function D(){l(!0),d(``);try{let a={kind:o,op:`create`,data:{}};if(o===`finding`)a.data={title:_.title,conclusion:_.conclusion,scope:_.scope,window:_.window,method:_.method,confidence:_.confidence||`medium`,evidence:te(_.evidenceText||``)};else if(o===`action-item`)a.data={title:_.title,priority:Number(_.priority)||5,target:_.target,change:_.change,causal:_.causal,expected:_.expected,verifyDays:Number(_.verifyDays)||7,requiresApproval:_.requiresApproval!==!1,evidence:te(_.evidenceText||``)};else{let e=e=>String(_[e]||``).split(`
4
- `).map(e=>e.trim()).filter(Boolean);a.data={name:_.name,when:_.when,dataNeeded:e(`dataNeededText`),steps:e(`stepsText`),rules:e(`rulesText`),pitfalls:e(`pitfallsText`),outputs:_.outputs}}let s=await t(`/`+e.project.id+`/insight`,a);v({}),p(!1),d(`已保存`),await n(),i?.(Object.entries(h).some(([e,t])=>e!==o&&K(t))),o===`finding`&&!Object.entries(h).some(([e,t])=>e!==o&&K(t))&&r?.(s.id,!0)}catch(e){d(e.message)}finally{l(!1)}}async function O(r,i){l(!0),d(``);try{await t(`/`+e.project.id+`/insight`,{kind:`action-item`,op:`update`,id:r,data:{status:i}}),await n()}catch(e){d(e.message)}finally{l(!1)}}async function k(r,i){if(confirm(`确认删除这条记录?删除后不可恢复。`)){l(!0);try{await t(`/`+e.project.id+`/insight`,{kind:r,op:`delete`,id:i}),await n()}catch(e){d(e.message)}finally{l(!1)}}}let A=e=>e.list?.length?(0,b.jsx)(`div`,{className:`wb-table-wrap wb-insight-evidence`,role:`region`,"aria-label":`结论与行动的数据依据,可横向滚动`,tabIndex:0,children:(0,b.jsxs)(`table`,{className:`wb-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`col`,children:`指标`}),(0,b.jsx)(`th`,{scope:`col`,children:`数值`}),(0,b.jsx)(`th`,{scope:`col`,children:`对比基准`}),(0,b.jsx)(`th`,{scope:`col`,children:`来源`})]})}),(0,b.jsx)(`tbody`,{children:e.list.map((e,t)=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`row`,children:e.metric}),(0,b.jsxs)(`td`,{children:[e.value??`—`,e.unit]}),(0,b.jsx)(`td`,{children:e.benchmark||`—`}),(0,b.jsx)(`td`,{children:e.source||`未提供`})]},t))})]})}):null,j=(e,t,n,r=3)=>(0,b.jsxs)(`label`,{children:[t,(0,b.jsx)(`textarea`,{rows:r,value:_[e]||``,onChange:t=>E(e,t.target.value),placeholder:n})]});return(0,b.jsxs)(`section`,{className:`wb-insights`,children:[(0,b.jsxs)(`div`,{className:`section-title`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`eyebrow`,children:`ANALYSIS → DECISION → ACTION`}),(0,b.jsxs)(`h2`,{children:[`结论与行动`,(0,b.jsx)(m,{label:`结论与行动`,children:`结论要写适用范围和证据;行动写负责人、预期和复盘时间。删除前确认是否还需保留该记录。`})]})]}),(0,b.jsxs)(`span`,{className:`muted`,children:[S.length,` 条结论 · `,C.length,` 个动作 · `,w.length,` 套方法论`]})]}),(0,b.jsx)(`div`,{className:`tabs`,style:{marginBottom:14},children:W.map(([e,t,n])=>(0,b.jsxs)(`button`,{disabled:c,"aria-pressed":o===e,className:o===e?`selected`:``,onClick:()=>s(e),children:[t,` `,(0,b.jsxs)(`small`,{children:[T[e],K(h[e])?` · 草稿`:``]})]},e))}),(0,b.jsx)(`p`,{className:`hint`,style:{marginBottom:14},children:W.find(e=>e[0]===o)?.[2]}),u&&(0,b.jsx)(`div`,{role:`status`,className:`notice`,children:u}),(0,b.jsx)(`button`,{disabled:c,onClick:()=>p(!f),style:{marginBottom:14},children:f?`收起表单`:`+ 新增`+(o===`finding`?`结论`:o===`action-item`?`动作`:`方法论`)}),f&&(0,b.jsxs)(`section`,{className:`card`,style:{marginBottom:18},children:[K(_)&&(0,b.jsxs)(`p`,{className:`notice`,children:[`切换本页标签会保留草稿。`,(0,b.jsx)(`button`,{disabled:c,onClick:()=>{confirm(`放弃当前标签的草稿?`)&&v({})},children:`放弃此草稿`})]}),o===`finding`&&(0,b.jsx)(`p`,{className:`wb-callout`,children:`此处保存简要结论,过程标记为待补充。保存后进入 Wiki,补充分析依据与复盘计划。`}),o===`finding`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`结论标题`,(0,b.jsx)(`input`,{value:_.title||``,onChange:e=>E(`title`,e.target.value),placeholder:`例如:暖棚退款主因是价格不是履约`})]}),j(`conclusion`,`结论正文`,`把「多少、占比、和谁比」写进去,不要只写方向`,4),(0,b.jsxs)(`div`,{className:`two`,children:[(0,b.jsxs)(`label`,{children:[`结论适用时间`,(0,b.jsx)(`input`,{value:_.window||``,onChange:e=>E(`window`,e.target.value),placeholder:`2026-10-26|2026-11-01`})]}),(0,b.jsxs)(`label`,{children:[`适用范围`,(0,b.jsx)(`input`,{value:_.scope||``,onChange:e=>E(`scope`,e.target.value),placeholder:`项目 / 商品ID / 全店`})]})]}),(0,b.jsxs)(`div`,{className:`two`,children:[(0,b.jsxs)(`p`,{children:[`判断把握程度`,(0,b.jsx)(m,{label:`如何填写判断把握程度`,children:`依据资料完整性、来源可靠性和反例填写。这个数值是人工判断,不是经过统计验证的成功概率。`})]}),(0,b.jsxs)(`label`,{children:[`判断把握程度`,(0,b.jsxs)(`select`,{value:_.confidence||`medium`,onChange:e=>E(`confidence`,e.target.value),children:[(0,b.jsx)(`option`,{value:`high`,children:`高(全量实测)`}),(0,b.jsx)(`option`,{value:`medium`,children:`中(样本有限)`}),(0,b.jsx)(`option`,{value:`low`,children:`低(待复核)`})]})]}),(0,b.jsxs)(`label`,{children:[`方法论`,(0,b.jsx)(`input`,{value:_.method||``,onChange:e=>E(`method`,e.target.value),placeholder:`退款原因归因法`})]})]}),j(`evidenceText`,`数据依据(每行一条:指标|数值|单位|对比基准|来源)`,`退款额|8806|元|退款总额28320元|达摩盘`,4)]}),o===`action-item`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`行动标题`,(0,b.jsx)(`input`,{value:_.title||``,onChange:e=>E(`title`,e.target.value),placeholder:`净费比目标 4.95% → 6.0%`})]}),(0,b.jsxs)(`div`,{className:`two`,children:[(0,b.jsxs)(`label`,{children:[`优先级`,(0,b.jsx)(`input`,{type:`number`,min:1,max:9,value:_.priority??5,onChange:e=>E(`priority`,e.target.value)})]}),(0,b.jsxs)(`label`,{children:[`验证周期(天)`,(0,b.jsx)(`input`,{type:`number`,min:1,max:90,value:_.verifyDays??7,onChange:e=>E(`verifyDays`,e.target.value)})]})]}),j(`target`,`改哪里`,`计划ID / 详情页第几屏 / 商品ID`,2),j(`change`,`改什么`,`具体到数值或文案,不要写「优化一下」`,2),j(`causal`,`因果链`,`为什么这个改动能解决问题`,3),j(`expected`,`预期结果与验证标准`,`7天后看什么数、达到多少算成功`,2),j(`evidenceText`,`数据依据(每行一条:指标|数值|单位|对比基准|来源)`,`预算使用率|36|%|预算3500元实花1259元|阿里妈妈计划配置`,4),(0,b.jsxs)(`label`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:_.requiresApproval!==!1,onChange:e=>E(`requiresApproval`,e.target.checked),style:{width:`auto`}}),`需要人工确认后才执行`]})]}),o===`playbook`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[`方法论名称`,(0,b.jsx)(`input`,{value:_.name||``,onChange:e=>E(`name`,e.target.value),placeholder:`渠道结构对比法`})]}),j(`when`,`什么时候用`,`判断流量下滑是量的问题还是质的问题`,2),j(`dataNeededText`,`需要的数据(每行一个)`,`item.flow-source-tree-v3 前后两个7天窗口`,3),j(`stepsText`,`步骤(每行一步)`,`按 UV 和支付额排序渠道|算每渠道边际产出|找出亏损渠道`,5),j(`rulesText`,`判读规则(每行一条)`,`边际产出差10倍以上才可迁预算`,3),j(`pitfallsText`,`坑(每行一条)`,`别用总UV价值掩盖单渠道塌陷`,3),j(`outputs`,`产出物`,`渠道对比表 + 预算迁移建议`,2)]}),(0,b.jsx)(`button`,{disabled:c,onClick:D,children:`保存`})]}),o===`finding`&&(0,b.jsxs)(`section`,{children:[!S.length&&(0,b.jsx)(`p`,{className:`muted`,children:`还没有结论。取完数先落结论,再谈动作。`}),S.map(e=>(0,b.jsxs)(`article`,{className:`card wb-insight-record`,style:{marginBottom:12},children:[(0,b.jsxs)(`div`,{className:`section-title`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{className:`eyebrow`,children:[e.window||`—`,` · `,e.scope||`—`,` · 判断把握程度 `,q[e.confidence]||e.confidence]}),(0,b.jsx)(`h3`,{children:e.title})]}),(0,b.jsx)(`button`,{className:`secondary wb-record-delete`,"aria-label":`删除结论:`+e.title,disabled:c,onClick:()=>k(`finding`,e.id),children:`删除`})]}),(0,b.jsx)(`p`,{className:`wb-insight-conclusion`,style:{whiteSpace:`pre-wrap`},children:e.conclusion}),(0,b.jsx)(A,{list:e.evidence}),r&&(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>r(e.id),children:`查看分析过程 / 补充复盘 →`}),(0,b.jsxs)(`p`,{className:`muted`,children:[`方法论:`,e.method||`—`,` 记录ID:`,e.id,e.supersededBy?` 已被新结论取代`:``]})]},e.id))]}),o===`action-item`&&(0,b.jsxs)(`section`,{children:[!C.length&&(0,b.jsx)(`p`,{className:`muted`,children:`还没有动作。动作必须能从一条结论推出来。`}),C.map(e=>(0,b.jsxs)(`article`,{className:`card wb-insight-record`,style:{marginBottom:12},children:[(0,b.jsxs)(`div`,{className:`section-title`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{className:`eyebrow`,children:[`P`,e.priority,` · `,G[e.status]||e.status,e.requiresApproval?` · 需人工确认`:``]}),(0,b.jsx)(`h3`,{children:e.title})]}),(0,b.jsx)(`button`,{className:`secondary wb-record-delete`,"aria-label":`删除动作:`+e.title,disabled:c,onClick:()=>k(`action-item`,e.id),children:`删除`})]}),(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`b`,{children:`改哪里`}),` `,e.target]}),(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`b`,{children:`改什么`}),` `,e.change]}),(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`b`,{children:`因果链`}),` `,e.causal]}),(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`b`,{children:`预期与验证`}),` `,e.expected,`(`,e.verifyDays,`天)`]}),(0,b.jsx)(A,{list:e.evidence}),r&&(0,b.jsx)(`button`,{className:`wb-text-button`,onClick:()=>r(e.id),children:`查看分析过程 / 补充复盘 →`}),!!e.steps?.length&&(0,b.jsxs)(`details`,{style:{marginTop:10},open:!0,children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`b`,{children:`操作步骤`}),`(`,e.steps.length,` 步)`]}),(0,b.jsx)(`ol`,{style:{marginTop:8,lineHeight:1.75},children:e.steps.map((e,t)=>e?(0,b.jsx)(`li`,{children:e},t):(0,b.jsx)(`li`,{style:{listStyle:`none`,height:8}},t))})]}),(0,b.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,marginTop:10},children:[`todo`,`doing`,`done`,`dropped`,`blocked`].map(t=>(0,b.jsx)(`button`,{className:e.status===t?``:`secondary`,disabled:c||e.status===t,onClick:()=>O(e.id,t),children:G[t]},t))})]},e.id))]}),o===`playbook`&&(0,b.jsxs)(`section`,{children:[!w.length&&(0,b.jsx)(`p`,{className:`muted`,children:`还没有方法论。每次分析完把套路存下来,下次换项目直接跑。`}),w.map(e=>(0,b.jsxs)(`article`,{className:`card wb-insight-record`,style:{marginBottom:12},children:[(0,b.jsxs)(`div`,{className:`section-title`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`eyebrow`,children:`PLAYBOOK`}),(0,b.jsx)(`h3`,{children:e.name})]}),(0,b.jsx)(`button`,{className:`secondary wb-record-delete`,"aria-label":`删除方法论:`+e.name,disabled:c,onClick:()=>k(`playbook`,e.id),children:`删除`})]}),(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`b`,{children:`何时使用`}),` `,e.when||`—`]}),!!e.dataNeeded?.length&&(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`b`,{children:`需要的数据`}),` `,e.dataNeeded.map(e=>(0,b.jsx)(`code`,{style:{marginRight:6},children:e},e))]}),(0,b.jsx)(`ol`,{children:e.steps?.map((e,t)=>(0,b.jsx)(`li`,{children:e},t))}),!!e.rules?.length&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:(0,b.jsx)(`b`,{children:`判读规则`})}),(0,b.jsx)(`ul`,{children:e.rules.map((e,t)=>(0,b.jsx)(`li`,{children:e},t))})]}),!!e.pitfalls?.length&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:(0,b.jsx)(`b`,{children:`坑`})}),(0,b.jsx)(`ul`,{children:e.pitfalls.map((e,t)=>(0,b.jsx)(`li`,{children:e},t))})]}),(0,b.jsxs)(`p`,{className:`muted`,children:[`产出:`,e.outputs||`—`,` 记录ID:`,e.id]})]},e.id))]})]})}function re(e){return[`pending`,`processing`].includes(e.state)||e.dispatch?.state===`dispatching`||!!e.analysis&&[`not_reported`,`reporting`].includes(e.notification?.state||``)}var J={page:`_page_18h23_2`,heading:`_heading_18h23_3`,notice:`_notice_18h23_6`,projectPicker:`_projectPicker_18h23_8`,error:`_error_18h23_14`},Y={AUTOLOOP_DISABLED:`AutoLoop 尚未启用`,SUPERVISED_WORKER_MISSING:`尚未绑定可监管、可取消的执行器`,MODEL_DATA_SCOPE_MISSING:`尚未绑定模型与资料处理范围`,NOTIFICATION_SCOPE_MISSING:`审核通知尚未绑定或授权`,PROJECT_AUTHORIZATION_MISSING:`本项目的运行授权未配置或已到期`,EVENT_ADAPTER_MISSING:`事件来源及派发适配器尚未绑定`,TRUSTED_SESSION_ADAPTER_MISSING:`尚未接通可信人工登录`,HUMAN_PRODUCTION_SESSION_REQUIRED:`开发登录不能用于审核`,SIGN_IN_REQUIRED:`请先完成可信人工登录`,SESSION_EXPIRED:`人工登录已过期`,SESSION_VERIFICATION_FAILED:`人工登录校验失败`,PROJECT_OWNER_MISMATCH:`人工登录与项目归属不符`},ie={waiting_human:`等待审核`,feedback_pending:`已反馈,待继续分析`,paused:`已暂缓`,reviewed:`已审阅(不等于业务批准)`,pending:`等待受监管执行器`,processing:`正在分析`,failed:`分析失败,需核对后重试`},ae={completed:`已完成`,pending:`等待处理`,processing:`正在处理`,blocked:`运行条件未满足`,not_connected:`未接通`,not_sent:`尚未派发`,dispatching:`正在投递,等待确认`,sent:`已派发`,unrouted:`已送达,但没有匹配规则`,unknown:`结果未知,需核对中台,不能直接重发`,not_reported:`尚未提交回执`,reporting:`回执提交中`,accepted:`中台已接受回执(不代表通知已送达)`,rejected:`中台拒绝部分回执操作,需核对`};async function X(e,t){let n=await fetch(e,{method:t?`POST`:`GET`,headers:{"Content-Type":`application/json`},body:t?JSON.stringify(t):void 0}),r=await n.json();if(!n.ok)throw Error(r.error||`请求失败`);return r}function oe({initialProject:e=``,initialDataset:t=``,onDirty:n,onBusy:r}){let[i,a]=(0,y.useState)(e),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)([]),[u,d]=(0,y.useState)(t),[f,p]=(0,y.useState)(``),[h,g]=(0,y.useState)([]),[_,v]=(0,y.useState)({}),[x,S]=(0,y.useState)(!1),[C,w]=(0,y.useState)(``),[T,E]=(0,y.useState)([]),[D,O]=(0,y.useState)(!0),[k,A]=(0,y.useState)(``),[j,M]=(0,y.useState)(!!e),[N,P]=(0,y.useState)({}),[ee,F]=(0,y.useState)([]),I=(0,y.useRef)(0),L=(0,y.useRef)(!1),R=(0,y.useRef)(0);function z(e){g(e.tasks||[]),P(e.capabilities||{}),F(e.blockers||[])}let B=(0,y.useCallback)(e=>{L.current||(f.trim()||Object.values(_).some(e=>e.trim()))&&!confirm(`放弃未提交的分析目标或核对意见并切换项目?`)||(I.current++,s(null),l([]),d(``),p(``),g([]),v({}),P({}),F([]),w(``),M(!!e),a(e))},[f,_]),V=(0,y.useCallback)(()=>{let t=++R.current;return X(`/api/workbench`).then(n=>{if(t===R.current){if(!Array.isArray(n))throw Error(`项目列表格式异常`);E(n),n.length===1&&!e&&a(n[0].id)}}).catch(e=>{t===R.current&&A(e.message)}).finally(()=>{t===R.current&&O(!1)})},[e]);(0,y.useEffect)(()=>{let e=R,t=I;return V(),()=>{e.current++,t.current++}},[V]),(0,y.useEffect)(()=>{let e=I,t=++e.current;if(!i)return;let n=`/api/workbench/`+encodeURIComponent(i);return Promise.all([X(n),X(n+`/datasets`),X(n+`/analysis-queue`)]).then(([e,n,r])=>{t===I.current&&(s(e.project||e),l(n.datasets||[]),d(e=>(n.datasets||[]).some(t=>t.id===e)?e:``),z(r))}).catch(e=>{t===I.current&&w(e.message)}).finally(()=>{t===I.current&&M(!1)}),()=>{e.current++}},[i]),(0,y.useEffect)(()=>{n?.(!!f.trim()||Object.values(_).some(e=>!!e.trim()))},[f,_,n]),(0,y.useEffect)(()=>(r?.(x),()=>r?.(!1)),[x,r]);let H=h.some(re);(0,y.useEffect)(()=>{if(!i||!H)return;let e=I.current,t=setInterval(()=>{document.hidden||L.current||X(`/api/workbench/`+encodeURIComponent(i)+`/analysis-queue`).then(t=>{e===I.current&&z(t)}).catch(()=>{})},5e3);return()=>clearInterval(t)},[i,H]);async function U(e,t){return X(`/api/workbench/`+encodeURIComponent(i)+e,t)}async function W(){let e=I.current,t=await U(`/analysis-queue`);e===I.current&&z(t)}async function G(e){if(L.current)return;L.current=!0,S(!0),w(``);let t=I.current;try{await e()}catch(e){t===I.current&&w(e.message)}finally{L.current=!1,S(!1)}}async function K(e,t,n={}){await U(`/analysis-queue`,{op:t,taskId:e.id,expectedVersion:e.version,inputHash:e.inputHash,...n}),t===`review`&&v(t=>({...t,[e.id]:``})),await W()}let q=N.autoloop&&N.trustedReview;return(0,b.jsxs)(`main`,{className:J.page,children:[(0,b.jsxs)(`header`,{className:J.heading,children:[(0,b.jsxs)(`h1`,{children:[`已存资料分析 · 发起、结果与审核`,(0,b.jsx)(m,{label:`分析范围`,children:`选择项目已有资料和目标商品。同页完成归属检查、任务发起、结果查看及人工反馈;未满足运行条件时只做本地检查。`})]}),(0,b.jsx)(`p`,{children:`原始资料不会因重复点击而重复派发;分析草稿不自动批准业务,也不操作店铺。`})]}),!e&&(0,b.jsxs)(`section`,{className:J.projectPicker,"aria-label":`选择项目`,children:[(0,b.jsxs)(`label`,{htmlFor:`archive-project`,children:[`项目名称`,(0,b.jsxs)(`select`,{id:`archive-project`,value:i,disabled:D||x,onChange:e=>B(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:D?`正在加载项目…`:`请选择项目`}),T.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.name||`未命名项目`},e.id))]})]}),(0,b.jsx)(`p`,{children:`切换项目前会提醒保存或放弃意见。只显示当前账号可访问的项目。`}),k&&(0,b.jsxs)(`div`,{role:`alert`,children:[(0,b.jsx)(`p`,{children:k}),(0,b.jsx)(`button`,{disabled:D,onClick:()=>{O(!0),A(``),V()},children:`重试项目列表`})]}),!D&&!k&&!T.length&&(0,b.jsx)(`p`,{role:`status`,children:`当前账号暂无项目,请先创建项目或确认登录账号。`})]}),j&&(0,b.jsx)(`p`,{role:`status`,children:`正在加载项目归档与任务…`}),C&&(0,b.jsxs)(`p`,{role:`alert`,className:J.error,children:[C,`。提交结果不明确时先刷新状态,避免重复操作。`]}),o&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`section`,{"aria-label":`运行条件`,className:J.notice,children:[(0,b.jsx)(`p`,{children:q?`本项目已绑定执行条件,可以同页发起分析。`:`当前可做归属与去重检查;完整自动分析尚未启用。`}),ee.length>0&&(0,b.jsx)(`ul`,{children:ee.map(e=>(0,b.jsx)(`li`,{children:Y[e]||e},e))}),(0,b.jsx)(`p`,{children:`接通状态由服务端核实,不能通过在页面填写“已授权”绕过。`})]}),(0,b.jsxs)(`h2`,{children:[`选择归档并发起`,(0,b.jsx)(m,{label:`资料要求`,children:`需包含评价正文 text、商品 item_id、评价 review_id、唯一行标识 row_id。缺失项保持缺失,不能猜测。`})]}),(0,b.jsxs)(`label`,{children:[`已有归档`,(0,b.jsxs)(`select`,{value:u,disabled:x,onChange:e=>d(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`请选择`}),c.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,b.jsxs)(`label`,{children:[`目标商品编号`,(0,b.jsx)(`input`,{value:f,disabled:x,onChange:e=>p(e.target.value)})]}),!c.length&&(0,b.jsx)(`p`,{role:`status`,children:`此项目暂无可用归档,请先在工作台导入资料。`}),(0,b.jsx)(`button`,{disabled:x||!u||!/^\d{1,30}$/.test(f),onClick:()=>void G(async()=>{await U(`/analysis-queue`,{op:`enqueue`,datasetId:u,targetItem:f,expectedProjectVersion:o.version,expectedSourceSha:c.find(e=>e.id===u)?.sha}),p(``),await W()}),children:x?`处理中…`:q?`一键发起归档分析`:`检查资料并建立任务`}),(0,b.jsx)(`button`,{disabled:x,onClick:()=>void G(W),children:`刷新执行状态`}),H&&(0,b.jsx)(`p`,{role:`status`,children:`本页每 5 秒刷新进行中的任务。投递不明时不会自动重发。`}),!h.length&&(0,b.jsx)(`p`,{role:`status`,children:`此项目暂无执行记录。`}),h.map(e=>(0,b.jsxs)(`section`,{style:{border:`1px solid #294248`,padding:16,marginTop:16},children:[(0,b.jsx)(`h2`,{children:ie[e.state]||e.state}),(0,b.jsxs)(`p`,{children:[`任务 `,e.id,` · 版本 `,e.version??`旧记录`,` · 第 `,e.cycle??`未知`,` 轮 · 商品 `,e.targetItem??`未记录`]}),(0,b.jsxs)(`p`,{children:[`来源 `,e.datasetId??`旧记录未提供`,` · 输入标识 `,e.inputHash]}),e.schema!==`workbench-archive-task/v2`&&(0,b.jsx)(`p`,{children:`此记录使用旧协议,保留供查看。请重新选择归档发起新任务,不会自动迁移或执行。`}),e.steps?.map(e=>(0,b.jsxs)(`p`,{children:[e.name,`:`,ae[e.state]||e.state]},e.name)),e.lastError&&(0,b.jsx)(`p`,{role:`alert`,children:e.lastError}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`查看归属与去重结果`}),(0,b.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify(e.result??{message:`尚无结果`},null,2)})]}),e.analysis?.result&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h3`,{children:`内容分析草稿 · 未经人工核验`}),(0,b.jsx)(`p`,{children:e.analysis.result.summary}),(0,b.jsxs)(`details`,{open:!0,children:[(0,b.jsx)(`summary`,{children:`分析方法、逐行依据与缺失项`}),(0,b.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify(e.analysis.result,null,2)})]})]}),e.dispatch?.state===`not_sent`&&(0,b.jsx)(`button`,{disabled:x||!q||e.schema!==`workbench-archive-task/v2`||e.state!==`waiting_human`,onClick:()=>void G(()=>K(e,`dispatch`)),children:`发起内容分析`}),(0,b.jsxs)(`label`,{children:[`人工核对意见`,(0,b.jsx)(`textarea`,{rows:3,value:_[e.id]||``,disabled:x,onChange:t=>v({..._,[e.id]:t.target.value})})]}),!N.trustedReview&&(0,b.jsx)(`p`,{children:`可信人工登录尚不可用,暂不能提交审核。输入的草稿仅保留在本页。`}),[[`reviewed`,`确认已审阅`],[`changes_requested`,`要求修改`],[`paused`,`暂缓`]].map(([t,n])=>(0,b.jsx)(`button`,{disabled:x||!N.trustedReview||!_[e.id]?.trim()||![`waiting_human`,`paused`,`feedback_pending`].includes(e.state)||[`reporting`,`unknown`].includes(e.notification?.state)||e.schema!==`workbench-archive-task/v2`,onClick:()=>void G(()=>K(e,`review`,{decision:t,note:_[e.id],humanConfirmed:!0})),children:n},t)),(0,b.jsx)(`p`,{children:`继续分析会绑定本次反馈并保留上一轮草稿。投递结果未知时须先核对中台。`}),(0,b.jsx)(`button`,{disabled:x||!N.trustedReview||![`feedback_pending`,`paused`,`failed`].includes(e.state)||[`unknown`,`dispatching`].includes(e.dispatch?.state)||[`unknown`,`reporting`].includes(e.notification?.state)||e.schema!==`workbench-archive-task/v2`,onClick:()=>void G(()=>K(e,`resume`)),children:q?`继续分析 / 重试`:`检查续办条件`}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`历史草稿与人工反馈`}),(0,b.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify({revisions:e.revisions||[],feedback:e.feedback||[],resumeAttempts:e.resumeAttempts||[]},null,2)})]})]},e.id))]})]})}function Z({section:e,project:t}){let{route:n,onRoute:r}=t,i=e=>r({center:!1,tab:`wiki`,wikiRef:e,wikiEntry:``}),a=(e,t=!1)=>r({center:!1,tab:`wiki`,wikiRef:``,wikiEntry:e},{confirmed:t}),o=e=>r({center:!1,tab:`data`,datasetId:e}),s=(e=``,t=``)=>r({center:!1,tab:`methods`,methodNode:t,methodRecord:e});return e===`archive`?(0,b.jsx)(oe,{initialProject:t.projectId,initialDataset:n.datasetId,onDirty:t.onDirty,onBusy:t.onBusy}):e===`data`?(0,b.jsx)(w,{...t,initialId:n.datasetId,onWiki:i,onArchive:e=>r({center:!1,tab:`archive`,datasetId:e}),onSelect:e=>r({datasetId:e},{replace:!0}),onPrepare:()=>r({center:!1,tab:`files`})},t.projectId+n.datasetId):e===`files`?(0,b.jsx)(E,{...t}):e===`wiki`?(0,b.jsx)(F,{...t,initialRef:n.wikiRef,initialEntry:n.wikiEntry,onMethods:s,onData:o},t.projectId+n.wikiRef+n.wikiEntry):e===`methods`?(0,b.jsx)(U,{...t,initialNode:n.methodNode,initialRecord:n.methodRecord,onWiki:a},t.projectId+n.methodNode+n.methodRecord):e===`insight`?(0,b.jsx)(ne,{...t,onWikiEntry:a}):null}export{Z as default};
@@ -1 +0,0 @@
1
- import{a as e,g as t,p as n}from"./index-Cez2mr3h.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./demand-planning-client-cRvN3aET.js";import{t as p}from"./HelpTip-DgowTr-K.js";var m=t(n(),1),h=e(),g=[`目标与约束`,`资料与证据`,`需求机会`,`商品方案`,`成本与可行性`,`评审与下一步`],_=[`要服务谁?预算、周期、供给和停止条件是什么?`,`分别整理关键词与评价证据,标明时间、来源和缺口。`,`哪个需求有证据?反证是什么?不要把搜索热度当成交保证。`,`商品如何满足需求?规格、样品、交期和待验证能力是什么?`,`成本包含哪些项?价格与销量假设是否区分?能承受什么风险?`,`继续、返修还是停止?记录人工判断、负责人和下一验证窗口。`],v={input:``,source:``,analysis:``,output:``,reason:``,repair:``,refs:[],status:`draft`,layer:`human`,business:null};function y({project:e}){let t=e.data,n=e.route.step,i=e.api,o=e=>{if(!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`)throw Error(`保存结果缺少记录编号,请核对资料`);return e.id},c=t.steps[n].latest,[u,d]=(0,m.useState)(()=>a(t,n,c?Object.fromEntries(Object.keys(v).map(e=>[e,c[e]??v[e]])):{...v,refs:[]})),[f,y]=(0,m.useState)(!1),[b,x]=(0,m.useState)(`keyword`),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(null),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(``),[A,j]=(0,m.useState)(``);function M(){y(!0),e.onDirty(!0)}function N(t){e.onRoute({center:!1,tab:t})}function P(t){e.onRoute({center:!1,tab:`work`,step:t})}async function F(t){D(!0),e.onBusy(!0),k(``),j(``);try{await t()}catch(e){k(e instanceof Error?e.message:`保存失败`)}finally{D(!1),e.onBusy(!1)}}function I(e,t){d({...u,[e]:t,...u.business&&[`input`,`source`,`analysis`,`output`,`reason`,`repair`].includes(e)?{business:{...u.business,guidance:{...u.business.guidance,recordEdited:{...u.business.guidance?.recordEdited,[e]:!0}}}}:{}}),M()}async function L(){await F(async()=>{await i(`/`+t.project.id+`/revision`,{...r(t,n,u),step:n,version:t.project.version}),await e.onSaved(),y(!1),e.onDirty(!1),j(`已保存新版本,可在分析与复盘中查看历史。`)})}async function R(){await F(async()=>{if(!w)throw Error(`请先选择文件`);if(w.size>2e6)throw Error(`单文件上限2MB`);let n=new Uint8Array(await w.arrayBuffer()),r=``;for(let e of n)r+=String.fromCharCode(e);let a=await i(`/`+t.project.id+`/file`,{name:w.name,source:S,kind:b,base64:btoa(r)});await e.onSaved(),d({...u,refs:[...u.refs,o(a)]}),M(),j(`文件已保存,并加入本次草稿引用;请保存步骤版本。`)})}async function z(n,r,a,s){let c=new TextEncoder().encode(r),l=``;for(let e of c)l+=String.fromCharCode(e);let u=await i(`/`+t.project.id+`/file`,{name:n,base64:btoa(l),kind:a,source:s});return await e.onSaved(),o(u)}let B=e.onDirty,V=e.onSaved;return(0,h.jsxs)(h.Fragment,{children:[O&&(0,h.jsx)(`p`,{role:`alert`,className:`error`,children:O}),A&&(0,h.jsx)(`p`,{role:`status`,className:`notice`,children:A}),(0,h.jsxs)(`div`,{className:`notice`,children:[`历史六步工作记录:与业务节点分别保存,不重复计算完成率。`,(0,h.jsx)(`button`,{onClick:()=>N(`overview`),children:`返回节点主流程`})]}),(0,h.jsx)(`div`,{className:`progress wb-progress`,"aria-label":`项目阶段`,children:t.steps.map((e,t)=>(0,h.jsxs)(`button`,{"aria-current":n===t?`step`:void 0,onClick:()=>P(t),className:n===t?`current`:``,children:[(0,h.jsxs)(`span`,{children:[`0`,t+1]}),e.title,(0,h.jsx)(`small`,{children:e.stale?`待复核`:e.latest?.status===`confirmed`?`已确认`:e.latest?.status===`stopped`?`已停止`:e.latest?`已记录`:`未开始`})]},t))}),(0,h.jsxs)(`div`,{className:`wb-stage-work`,children:[(0,h.jsx)(l,{data:t,step:n,form:u,onChange:e=>{d(e),M()},storeFile:z,api:i,dirty:f,onDirty:B,onAcquired:V},t.project.id+`:`+n),(0,h.jsxs)(`div`,{className:`work-grid`,children:[(0,h.jsxs)(`section`,{className:`card`,children:[(0,h.jsxs)(`div`,{className:`section-title`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{className:`eyebrow`,children:[`STEP 0`,n+1]}),(0,h.jsx)(`h2`,{children:g[n]})]}),(0,h.jsx)(`span`,{className:`muted`,children:f?`有未保存修改`:`已与服务器同步`})]}),(0,h.jsx)(`p`,{className:`hint`,children:_[n]}),t.steps[n].stale&&(0,h.jsx)(`div`,{className:`error`,children:`上游已变更。旧版本保留,请复核内容与引用后保存新版本。`}),(0,h.jsx)(s,{data:t,step:n,form:u,onChange:I,busy:E,onSave:L})]}),(0,h.jsxs)(`section`,{className:`right-rail`,children:[(0,h.jsxs)(`div`,{className:`card`,children:[(0,h.jsxs)(`h3`,{children:[`本阶段交接`,(0,h.jsx)(p,{label:`阶段确认`,children:`先保存输入、证据和结论,再填写人工判断。前一步资料变化后,后续步骤需要重新核对。`})]}),(0,h.jsx)(`p`,{children:`输入 → 证据 → 分析 → 产物 → 人工判断`}),(0,h.jsx)(`p`,{className:`muted`,children:`保存不会覆盖历史。更改上游后,下游显示“待复核”。确认仅代表本阶段人工评审,不代表真实销量或盈利。`})]}),(0,h.jsxs)(`div`,{className:`card`,children:[(0,h.jsxs)(`h3`,{children:[`上传资料或分析文件`,(0,h.jsx)(p,{label:`上传资料`,children:`选择文件并填写真实来源与日期。每个文件不超过2MB;上传后需保存本步骤,才能保留本次引用。`})]}),(0,h.jsxs)(`label`,{children:[`资料类型`,(0,h.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),children:[(0,h.jsx)(`option`,{value:`keyword`,children:`关键词证据`}),(0,h.jsx)(`option`,{value:`review`,children:`评价证据`}),(0,h.jsx)(`option`,{value:`product`,children:`商品资料`}),(0,h.jsx)(`option`,{value:`analysis`,children:`AI分析结果导入`}),(0,h.jsx)(`option`,{value:`artifact`,children:`生成/制作产物`})]})]}),(0,h.jsxs)(`label`,{children:[`来源与采集时间`,(0,h.jsx)(`input`,{value:S,onChange:e=>{C(e.target.value),M()},placeholder:`例如:虚构样本,2026-10-28`})]}),(0,h.jsxs)(`label`,{children:[`选择文件(≤2MB)`,(0,h.jsx)(`input`,{type:`file`,onChange:e=>{T(e.target.files?.[0]||null),M()}})]}),(0,h.jsx)(`button`,{disabled:E||!w||!S.trim(),className:`secondary`,onClick:R,children:`上传并加入引用`}),(0,h.jsx)(`p`,{className:`muted`,children:`保留原文件和完整性校验信息,方便追溯。上传不会运行文件。每个项目文件总量不超过10MB。`})]}),(0,h.jsx)(`div`,{className:`boundary`,children:`本项目归档读取、上游继承和成本计算已接通;平台取数经本机执行通道由助手执行。所有结果需人工复核。`})]})]})]})]})}var b={pipeline:f,content:i,visual:u,publish:c};function x({section:e,project:t}){let{route:n,onRoute:r}=t,i=e=>r({center:!1,tab:e,node:``,datasetId:``,wikiRef:``,wikiEntry:``,methodNode:``,methodRecord:``}),a=e=>r({center:!1,tab:`methods`,methodNode:e,methodRecord:``}),s=(e,t=!1)=>r({center:!1,tab:`wiki`,wikiEntry:e,wikiRef:``},{confirmed:t});if(e===`overview`)return(0,h.jsx)(o,{...t,onNavigate:i,onMethodNode:a});if(e===`demand`)return(0,h.jsx)(d,{projectId:t.projectId,onDirty:t.onDirty,onSaved:t.onSaved,onOpenData:e=>r({center:!1,tab:`data`,datasetId:e}),onOpenWiki:()=>i(`wiki`)});if(e===`work`)return(0,h.jsx)(y,{project:t},t.projectId+`:`+n.step);let c=b[e];return(0,h.jsx)(`div`,{className:`projects-module wb-legacy-tools`,onChangeCapture:e=>{e.target.matches(`input:not([type=checkbox]):not([aria-label="搜索业务节点"]),textarea`)&&t.onDirty(!0)},children:c&&(0,h.jsx)(c,{...t,initialNode:n.node,onWikiEntry:s,onMethodNode:a},t.projectId+n.node)})}export{x as default};
@@ -1 +0,0 @@
1
- import"./workspace-view-state-CRfq5jgZ.js";
@@ -1 +0,0 @@
1
- import{u as e}from"./index-Cez2mr3h.js";var t=e(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]);export{t};
@@ -1 +0,0 @@
1
- import{r as e}from"./create-intent-9uYVhJHt.js";import"./products-fIIO39ry.js";import{a as t,g as n,p as r}from"./index-Cez2mr3h.js";import{n as i}from"./workspace-view-state-CRfq5jgZ.js";import"./public-BlU5YmdO.js";import"./demand-planning-client-cRvN3aET.js";import"./HelpTip-DgowTr-K.js";import"./EmptyState-Cgx7dIy3.js";function a(){return i(`products.key`,``)}function o(){let[,e]=a(),[,t]=i(`products.query`,``),[,n]=i(`products.metric`,``),[,r]=i(`products.scope`,`real`);return(i,a)=>{a&&r(a),i&&(e(i),t(``),n(``))}}var s=n(r(),1);t();var c=Object.fromEntries([{label:`工作空间`,items:[[`overview`,`项目总览`],[`methods`,`任务与方法`],[`pipeline`,`分析流程`],[`work`,`分步工作`],[`demand`,`需求拆分`]]},{label:`数据与知识`,items:[[`data`,`数据中心`],[`dashboard`,`指标看板`],[`wiki`,`分析与复盘`],[`insight`,`结论与行动`],[`files`,`证据与附件`]]},{label:`运营执行`,items:[[`monitor`,`每日监控`],[`optimization`,`商品优化`],[`finance`,`经营核算`],[`fulfillment`,`库存与售后`],[`content`,`商品内容检查`],[`visual`,`商品图片策划`],[`publish`,`上新演练`]]}].flatMap(e=>e.items));function l({onClose:t,onDirty:n}){return(0,s.useEffect)(()=>{e(),n(!1),t(),window.dispatchEvent(new CustomEvent(`omni:route`,{detail:`/?mode=center&view=projects&section=all`}))},[t,n]),null}export{c as n,o as r,l as t};
@@ -1 +0,0 @@
1
- import{g as e,p as t}from"./index-Cez2mr3h.js";var n=e(t(),1);function r(e){let[t,r]=(0,n.useState)(null),[i,a]=(0,n.useState)(``),[o,s]=(0,n.useState)(!0),c=(0,n.useRef)(0),l=(0,n.useCallback)(()=>{let t=++c.current;return e().then(e=>{c.current===t&&(r(e),a(``))}).catch(e=>{c.current===t&&a(e instanceof Error?e.message:`资料读取失败`)}).finally(()=>{c.current===t&&s(!1)})},[e]),u=(0,n.useCallback)(()=>{c.current++},[]);return(0,n.useEffect)(()=>(l(),u),[l,u]),{data:t,error:i,busy:o,refresh:(0,n.useCallback)(()=>{s(!0),a(``),l()},[l])}}export{r as t};
@@ -1 +0,0 @@
1
- .wb-shared-nav{--ws-rail-width:72px;--ws-menu-width:208px;--ws-header-height:0px}.wb-shared-nav.ws-content-navigation{--ws-menu-width:0px}.wb-shared-nav.ws-content-navigation .wb-mobile-menu,.wb-shared-nav.ws-content-navigation>.wb-main>.wb-topbar{display:none}.wb-shared-nav.ws-content-navigation>.wb-main>.wb-content,.wb-shared-nav.ws-market-content>.wb-main>.wb-content{max-width:none;padding:0}.wb-shared-nav.ws-market-content>.wb-main>.wb-content>footer{padding-inline:24px}.wb-shared-nav.ws-content-navigation>.wb-main>.wb-content>footer{display:none}.omni-workspace .wb-shared-nav{--ws-header-height:48px}.wb-shared-nav .ws-module-rail{inset:var(--ws-header-height) auto 0 0;width:var(--ws-rail-width);z-index:46;background:var(--omni-bg,var(--omni-paint-surface-0a1729,#0a1729));border-right:1px solid var(--omni-line,var(--omni-paint-line-294468,#294468));flex-direction:column;align-items:center;gap:8px;padding:12px 6px 170px;display:flex;position:fixed;overflow-y:auto}.wb-shared-nav .ws-module-rail button{width:58px;min-height:58px;color:var(--omni-muted,var(--omni-paint-ink-91abc5,#91abc5));white-space:nowrap;background:0 0;border:1px solid #0000;border-radius:9px;flex-direction:column;flex-shrink:0;justify-content:center;align-items:center;gap:6px;padding:7px 2px;font-size:10px;display:flex}.wb-shared-nav .ws-module-rail button[aria-current]{color:var(--omni-accent,var(--omni-paint-accent-61d6f1,#61d6f1));background:var(--omni-panel,var(--omni-paint-surface-132d49,#132d49));border-color:var(--omni-line,var(--omni-paint-line-315775,#315775))}.wb-shared-nav .ws-module-rail button:hover{background:var(--omni-panel,var(--omni-paint-surface-132d49,#132d49))}.ws-rail-mark{flex:0 0 38px;place-items:center;width:38px;height:38px;display:grid}.ws-rail-mark img{object-fit:contain;border-radius:10px;width:38px;height:38px;display:block}.wb-shared-nav .ws-module-sidebar,.omni-workspace .wb-shared-nav .ws-module-sidebar{left:var(--ws-rail-width);top:var(--ws-header-height);width:var(--ws-menu-width);height:calc(100dvh - var(--ws-header-height));z-index:40;padding:22px 12px;display:flex;overflow-y:auto}.wb-shared-nav .wb-main{margin-left:calc(var(--ws-rail-width) + var(--ws-menu-width));width:calc(100% - var(--ws-rail-width) - var(--ws-menu-width))}.ws-module-heading{color:var(--omni-text,var(--omni-paint-ink-d7e8fa,#d7e8fa));justify-content:space-between;align-items:center;padding:4px 12px 22px;font-size:18px;display:flex}.ws-module-sidebar .ws-context{padding-top:0}.ws-module-sidebar .ws-context button{justify-content:space-between;gap:8px;min-height:38px;font-size:12px;display:flex}.ws-module-sidebar .ws-project{border-top:1px solid var(--omni-line,var(--omni-paint-line-294468,#294468));margin-top:12px;padding:12px 8px}.ws-module-note{color:var(--omni-muted,var(--omni-paint-ink-91abc5,#91abc5));margin-top:auto;padding:24px 12px 0;font-size:11px;line-height:1.8}.omni-workspace .omni-workspace-tools,.omni-workspace.omni-sidebar-collapsed .omni-workspace-tools{border:0;border-right:1px solid var(--omni-line);background:var(--omni-bg);z-index:48;border-radius:0;flex-direction:column;justify-content:center;gap:5px;width:72px;height:180px;display:flex;bottom:0;left:0;right:auto}.omni-workspace .omni-workspace-tools .omni-account-popover{bottom:0;left:76px;right:auto}.omni-workspace .omni-workspace-tools .omni-store-popover{bottom:90px;left:76px;right:auto}.omni-workspace .omni-workspace-tools .omni-update-popover{bottom:42px;left:76px;right:auto}.omni-sidebar-collapsed .wb-shared-nav .ws-module-sidebar{display:none}.omni-workspace.omni-sidebar-collapsed .wb-shared-nav.wb-unified .wb-main{width:calc(100% - 72px);margin-left:72px}.wb-shared-nav .ws-module-rail button:focus-visible,.ws-module-sidebar button:focus-visible{outline:2px solid var(--omni-accent,var(--omni-paint-line-61d6f1,#61d6f1));outline-offset:2px}@media (width<=760px){.wb-shared-nav .ws-module-sidebar,.omni-workspace .wb-shared-nav .ws-module-sidebar{display:none}.wb-shared-nav .ws-module-sidebar.is-open,.omni-workspace .wb-shared-nav .ws-module-sidebar.is-open{box-shadow:12px 0 30px var(--omni-paint-shadow-0004,#0004);display:flex}.wb-shared-nav .wb-main{width:calc(100% - 72px);margin-left:72px}}.omni-workspace .wb-shared-nav .ws-module-rail{padding-bottom:12px;bottom:180px}:root[data-omni-theme=light]{--omni-paint-surface-0a1729:#f5f6fa;--omni-paint-line-294468:#dde1eb;--omni-paint-ink-91abc5:#626e80;--omni-paint-accent-61d6f1:#4055db;--omni-paint-surface-132d49:#fff;--omni-paint-line-315775:#dde1eb;--omni-paint-ink-d7e8fa:#252831;--omni-paint-line-61d6f1:#dde1eb;--omni-paint-shadow-0004:#0001}:root[data-omni-theme=dark]{--omni-paint-surface-0a1729:#0b1727;--omni-paint-line-294468:#2c435b;--omni-paint-ink-91abc5:#91a9bd;--omni-paint-accent-61d6f1:#61d3df;--omni-paint-surface-132d49:#102235;--omni-paint-line-315775:#2c435b;--omni-paint-ink-d7e8fa:#dceaf7;--omni-paint-line-61d6f1:#2c435b;--omni-paint-shadow-0004:#0001}
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./entry-C3TFTQrn.js","./index-Cez2mr3h.js","./index-7NKGenq7.css","./arrow-right-DMEu-HBO.js","./chart-column-x5fvXs9m.js","./clock-3-BThph9Fd.js","./pin-C4E_u351.js","./git-branch-BAJikW8Q.js","./layers-shcwXKIH.js","./search-CUzSX_06.js","./activity-BV0UMcx6.js","./module-host-CyMfvPpR.js","./public-BlU5YmdO.js","./workspace-view-state-CRfq5jgZ.js","./entry-OPB3MGoc.css","./entry-BxaHKvMx.js","./link-2-BlbKNthn.js","./chevron-right-DqmFJybY.js","./grid-2x2-lULFcGs7.js","./list-CrDQ8uHL.js","./components-BVWswT0B.js","./chevron-down-p3oUrcsv.js","./format-BCxMsVJh.js","./market.module-vHIsXpQH.js","./market-B2oImfqS.css","./api-DTsZ_OeY.js","./entry-Crfux-R-.js","./check-qCcwSYDE.js","./arrow-up-right-Bi_SzYu1.js","./create-intent-9uYVhJHt.js","./flag-DspBXBR4.js","./project-execution-DMEIpSz3.js","./play-D07b6r1X.js","./plus-iTTlNMxD.js","./refresh-cw-C_4G0Mri.js","./use-workspace-query-C-vrOrvK.js","./create-intent-ZWl5yZd5.css","./products-fIIO39ry.js","./products-BTd3YVqO.css","./demand-planning-client-cRvN3aET.js","./EvidenceSourceGuide-BqwES_45.js","./HelpTip-DgowTr-K.js","./HelpTip-BsHPhMNf.css","./demand-planning-client-DVOcsKAy.css","./group-eZxxe_Hb.js","./ui-public-9lmhhAop.js","./EmptyState-Cgx7dIy3.js","./entry-C_j4PEhB.css","./entry-BXB2Nzyc.js","./entry-DQpz8kvM.js","./file-text-BE0hF4rH.js","./entry-DHP4cb-p.css","./entry-WYptT5dv.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./chart-column-x5fvXs9m.js";import{t}from"./chevron-right-DqmFJybY.js";import{t as n}from"./download-DYUXwy45.js";import{t as r}from"./git-branch-BAJikW8Q.js";import{t as i}from"./layers-shcwXKIH.js";import{a,c as o,d as s,g as c,i as l,o as u,p as d,t as f,u as p}from"./index-Cez2mr3h.js";import{t as m}from"./module-host-CyMfvPpR.js";import{t as h}from"./workspace-view-state-CRfq5jgZ.js";import"./public-BlU5YmdO.js";import{n as g,r as _,t as ee}from"./ui-public-9lmhhAop.js";var v=p(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),y=p(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),b=p(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),x=c(d(),1),S=[{id:`home`,label:`首页`,menus:[[`overview`,`首页总览`],[`recent`,`最近访问`],[`favorites`,`我的收藏`]],note:`从这里继续你的工作`,load:()=>f(()=>import(`./entry-C3TFTQrn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url)},{id:`market`,label:`市场大盘`,menus:[[`categories`,`类目概览`],[`products`,`商品排行榜`],[`shops`,`店铺排行榜`],[`shop-layout`,`店铺品类布局`],[`favorites`,`我的收藏`]],note:`按企业授权查看市场类目`,load:()=>f(()=>import(`./entry-BxaHKvMx.js`),__vite__mapDeps([15,1,2,16,17,18,19,20,21,9,22,23,24,12,13,25]),import.meta.url)},{id:`overview`,label:`工作台`,menus:[[`overview`,`经营总览`],[`tasks`,`待处理事项`],[`records`,`执行记录`]],shopScope:!0,note:`仅展示当前账号获准的资料`,load:()=>f(()=>import(`./entry-Crfux-R-.js`),__vite__mapDeps([26,1,2,27,3,28,17,29,30,8,31,32,33,34,9,11,35,12,13,36,37,5,38,39,21,7,40,41,42,43,44,45,46,10,47]),import.meta.url)},{id:`products`,label:`商品`,menus:[[`all`,`全部商品`],[`test`,`新品测试`],[`incubate`,`持续孵化`],[`scale`,`重点推广`],[`unassigned`,`待分组`]],projectMenus:[[`dashboard`,`指标概览`],[`monitor`,`每日监控`],[`optimization`,`商品优化`],[`finance`,`经营核算`],[`fulfillment`,`库存与售后`]],shopScope:!0,note:`仅展示当前账号获准的资料`,projectEntry:!0,load:()=>f(()=>import(`./entry-BXB2Nzyc.js`),__vite__mapDeps([48,1,2,3,17,37,5,30,32,33,38,8,34,9,44,11,12,13]),import.meta.url)},{id:`projects`,label:`项目`,menus:[[`all`,`全部项目`]],projectMenus:[[`overview`,`项目总览`],[`pipeline`,`完整分析流程`],[`demand`,`需求拆分`],[`content`,`内容检查`],[`visual`,`图片策划`],[`publish`,`上新演练`]],legacyTabs:[`work`],projectPicker:!0,projectEntry:!0,load:()=>f(()=>import(`./entry-DQpz8kvM.js`),__vite__mapDeps([49,1,2,27,21,17,29,3,30,8,31,32,33,34,9,11,35,12,13,36,50,6,19,51]),import.meta.url),shopScope:!0,contentNavigation:!0,note:`仅展示当前账号获准的资料`},{id:`data`,label:`资料中心`,menus:[[`all`,`数据集目录`]],projectMenus:[[`data`,`项目数据`],[`files`,`证据附件`],[`wiki`,`分析复盘`],[`insight`,`结论行动`],[`methods`,`任务方法`],[`archive`,`分析任务`]],projectEntry:!0,load:()=>f(()=>import(`./entry-WYptT5dv.js`),__vite__mapDeps([52,1,2,34,9,11,35,12,13]),import.meta.url),shopScope:!0,note:`仅展示当前账号获准的资料`}],C=S.map(e=>[e.id,e.label]),w=Object.fromEntries(S.map(e=>[e.id,e.menus]));function T(e){return S.find(t=>t.id===e)}function E(e){return T(e)?.menus[0]?.[0]||`overview`}function D(e){return T(e)?.label||`工作区`}var O=[`home`,`market`,`overview`,`products`,`projects`,`data`],k=[`overview`,`pipeline`,`work`,`methods`,`demand`,`monitor`,`optimization`,`finance`,`content`,`visual`,`publish`,`fulfillment`,`data`,`dashboard`,`wiki`,`insight`,`files`,`archive`],A={center:!0,centerNav:`home`,section:`overview`,projectId:``,tab:`overview`,step:0,node:``,itemId:``,datasetId:``,wikiRef:``,wikiEntry:``,methodNode:``,methodRecord:``},j={projectId:`project`,node:`node`,itemId:`item`,datasetId:`dataset`,wikiRef:`evidence`,wikiEntry:`record`,methodNode:`methodNode`,methodRecord:`method`};function M(e){let t=new URL(e,`https://omni.local`),n=t.searchParams,r={...A};for(let[e,t]of Object.entries(j))r[e]=(n.get(t)||``).slice(0,256);r.center=n.get(`mode`)===`center`||!n.has(`mode`)&&!r.projectId,O.some(e=>e===n.get(`view`))&&(r.centerNav=n.get(`view`)),k.some(e=>e===n.get(`tab`))&&(r.tab=n.get(`tab`));let i=Number(n.get(`step`));return r.step=Number.isInteger(i)&&i>=0&&i<6?i:0,t.pathname===`/market-overview`&&(r.center=!0,r.centerNav=`market`),t.pathname===`/archive-analysis`&&(r.center=!1,r.tab=`archive`),r.section=w[r.centerNav]?.some(([e])=>e===n.get(`section`))?n.get(`section`):E(r.centerNav),r}function N(e){let t=new URLSearchParams({mode:e.center?`center`:`project`,view:e.centerNav,section:e.section,tab:e.tab});for(let[n,r]of Object.entries(j))e[n]&&t.set(r,e[n]);return e.step&&t.set(`step`,String(e.step)),`/?`+t.toString()}function P(e){return e.center?e.centerNav:S.find(t=>t.projectMenus?.some(([t])=>t===e.tab)||t.legacyTabs?.includes(e.tab))?.id||`projects`}var F=a(),te={home:v,market:e,overview:y,products:i,projects:r,data:o};function ne({projects:e,project:n,route:r,menuOpen:i,busy:a,onClose:o,onProject:c,onCenter:d,onSection:f,onNavigate:p,onCreate:m}){(0,x.useEffect)(()=>{let e=e=>{let t=e.detail;C.some(([e])=>e===t)&&d(String(t))};return window.addEventListener(`omni:navigate`,e),()=>window.removeEventListener(`omni:navigate`,e)},[d]);let h=P(r),g=T(h),_=g?.projectMenus;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`nav`,{className:`ws-module-rail`,"aria-label":`主模块`,children:[(0,F.jsx)(`div`,{className:`ws-rail-mark`,children:(0,F.jsx)(`img`,{src:s,alt:`山海 · OMNI`,width:38,height:38,draggable:!1})}),C.map(([e,t])=>{let n=te[e];return(0,F.jsxs)(`button`,{"aria-label":t,"aria-current":h===e?`page`:void 0,onClick:()=>d(e),children:[(0,F.jsx)(n,{size:21}),(0,F.jsx)(`span`,{children:t})]},e)})]}),!(r.center&&g?.contentNavigation)&&(0,F.jsxs)(`aside`,{className:`wb-sidebar ws-sidebar ws-module-sidebar `+(i?`is-open`:``),"aria-label":D(h)+`菜单`,children:[(0,F.jsxs)(`div`,{className:`ws-module-heading`,children:[(0,F.jsx)(`strong`,{children:D(h)}),(0,F.jsx)(`button`,{className:`wb-mobile-close`,"aria-label":`关闭模块菜单`,onClick:o,children:(0,F.jsx)(u,{size:18})})]}),g?.shopScope&&(0,F.jsx)(l,{}),(0,F.jsx)(`nav`,{"aria-label":`模块导航`,children:(0,F.jsx)(`div`,{className:`wb-nav-group ws-context`,children:(w[h]||[]).map(([e,n])=>(0,F.jsxs)(`button`,{className:r.center&&r.section===e?`active`:``,"aria-current":r.center&&r.section===e?`page`:void 0,onClick:()=>f(e),children:[(0,F.jsx)(`span`,{children:n}),(0,F.jsx)(t,{size:14})]},e))})}),g?.projectPicker&&(0,F.jsxs)(`div`,{className:`ws-project`,children:[(0,F.jsxs)(`label`,{children:[`当前项目`,(0,F.jsxs)(`select`,{"aria-label":`当前项目`,value:n?.id||``,disabled:a,onChange:e=>c(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`请选择项目`}),e.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),n&&(0,F.jsx)(`small`,{children:n.simulated?`模拟项目`:`资料项目 · 按来源核验`}),(0,F.jsx)(`button`,{className:`ws-new-project`,disabled:a,onClick:m,children:`+ 新建项目`})]}),_&&(0,F.jsxs)(`nav`,{"aria-label":`项目功能`,children:[(0,F.jsxs)(`div`,{className:`wb-nav-group ws-context`,children:[(0,F.jsx)(`p`,{children:n?.name||`项目内功能`}),_.map(([e,t])=>(0,F.jsx)(`button`,{disabled:a,className:!r.center&&r.tab===e?`active`:``,"aria-current":!r.center&&r.tab===e?`page`:void 0,onClick:()=>p(e),children:(0,F.jsx)(`span`,{children:t})},e))]}),h===`projects`&&(0,F.jsxs)(`details`,{className:`ws-history`,children:[(0,F.jsx)(`summary`,{children:`历史工作记录`}),(0,F.jsx)(`button`,{onClick:()=>p(`work`),children:`历史六步工作`})]})]}),(0,F.jsx)(`p`,{className:`ws-module-note`,children:g?.note})]})]})}function re({navigation:e,canGoBack:n,onBack:r,onOpenMenu:i,title:a,dirty:o,children:s}){let c=(0,x.useRef)(null),l=(0,x.useRef)(null);(0,x.useEffect)(()=>{let e=l.current;if(!e)return;let t=()=>{let t=getComputedStyle(e),n=t.position===`sticky`?(parseFloat(t.top)||0)+e.getBoundingClientRect().height:0;c.current?.style.setProperty(`--workspace-sticky-top`,`${n}px`)},n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),t(),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[]);let{route:u}=e,d=n&&!(u.center&&u.centerNav===`market`),f=u.center&&T(u.centerNav)?.contentNavigation;return(0,F.jsxs)(`main`,{ref:c,className:`wb-shell wb-unified wb-shared-nav`+(u.center?` wb-mission-home`:``)+(f?` ws-content-navigation`:``)+(u.center&&u.centerNav===`market`?` ws-market-content`:``),children:[(0,F.jsx)(`a`,{className:`wb-skip`,href:`#workspace-content`,children:`跳到工作区`}),(0,F.jsx)(ne,{...e}),(0,F.jsxs)(`section`,{className:`main wb-main`,children:[(0,F.jsxs)(`header`,{ref:l,className:`wb-topbar`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`button`,{className:`wb-mobile-menu`,"aria-label":`打开导航`,onClick:i,children:(0,F.jsx)(b,{size:20})}),d&&(0,F.jsx)(`button`,{className:`wb-back`,"aria-label":`返回上一工作位置`,onClick:r,children:`← 返回`}),(0,F.jsx)(`span`,{children:u.center?`全局视图`:`项目工作区`}),(0,F.jsx)(t,{size:14}),(0,F.jsx)(`b`,{children:u.center?D(u.centerNav):a})]}),(0,F.jsx)(`div`,{children:o&&(0,F.jsx)(`span`,{className:`wb-chip warning`,children:`有未保存修改`})})]}),(0,F.jsxs)(`div`,{id:`workspace-content`,className:`wb-content`,tabIndex:-1,children:[s,(0,F.jsx)(`footer`,{children:`新品经营工作台 · 数据有来源,判断有版本,行动可追溯`})]})]})]})}var I=new Map(S.filter(e=>e.load).map(e=>[e.id,(0,x.lazy)(e.load)])),L=class extends x.Component{constructor(...e){super(...e),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,F.jsxs)(`section`,{role:`alert`,className:`card`,children:[(0,F.jsxs)(`h2`,{children:[this.props.label,`暂时无法打开`]}),(0,F.jsx)(`p`,{children:`可以重试,或从左侧进入其他模块。`}),(0,F.jsx)(`button`,{onClick:this.props.onRetry,children:`重试`})]}):(0,F.jsx)(`div`,{className:`ws-module-surface`,children:this.props.children})}};function R({moduleId:e,section:t,onSection:n,project:r,children:i}){let a=T(e),[o,s]=(0,x.useState)(0),c=I.get(e);function l(){a?.load&&I.set(e,(0,x.lazy)(a.load)),s(e=>e+1)}return(0,F.jsx)(L,{label:a?.label||`模块`,onRetry:l,children:(0,F.jsx)(x.Suspense,{fallback:(0,F.jsxs)(`p`,{role:`status`,children:[`正在打开`,a?.label,`…`]}),children:c?(0,F.jsx)(c,{section:t,onSection:n,project:r}):i})},`${e}:${r?.projectId||`center`}:${o}`)}function ie(e,t=`web`){let n=typeof window<`u`&&!!window.omni,r=e=>e?.scope===t&&e.route?M(N(e.route)):null,[i,a]=(0,x.useState)(()=>typeof window>`u`?{...A}:r(window.history.state?.omniWorkspace)||M(window.location.href)),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)([]);function u(e){e.center&&e.centerNav===`home`||l(t=>[{route:{...e},at:new Date().toISOString()},...t.filter(t=>N(t.route)!==N(e))].slice(0,30))}let d=(0,x.useRef)(i),f=(0,x.useRef)(e),p=(0,x.useRef)(0),m=(0,x.useRef)(!1),h=(0,x.useRef)(new Map),g=(0,x.useRef)(null);f.current=e,d.current=i,(0,x.useEffect)(()=>{let e=window.history.state?.omniWorkspace,i=e?.scope===t?e:null;p.current=Number.isInteger(i?.index)?i.index:0,s(p.current>0),window.history.replaceState({...window.history.state,omniWorkspace:{scope:t,index:p.current,route:d.current}},``,n?window.location.pathname:N(d.current));let o=window.history.scrollRestoration;window.history.scrollRestoration=`manual`;let c=()=>{g.current===null&&h.current.set(p.current,window.scrollY)},l=e=>{if(m.current){m.current=!1;return}let i=e.state?.omniWorkspace,o=i?.scope===t?i.index:0;if(!f.current()){Number.isInteger(o)&&o!==p.current?(m.current=!0,window.history.go(p.current-o)):window.history.replaceState({omniWorkspace:{scope:t,index:p.current,route:d.current}},``,n?window.location.pathname:N(d.current));return}u(d.current),p.current=Number.isInteger(o)?o:0,g.current=h.current.get(p.current)||0,s(p.current>0),a(r(i)||(n?{...A}:M(window.location.href)))};return window.addEventListener(`popstate`,l),window.addEventListener(`scroll`,c,{passive:!0}),()=>{window.removeEventListener(`popstate`,l),window.removeEventListener(`scroll`,c),window.history.scrollRestoration=o}},[]),(0,x.useEffect)(()=>{if(g.current===null)return;let e=g.current,t=performance.now()+2500,n=0,r=()=>{cancelAnimationFrame(n),g.current=null},i=()=>{if(window.scrollTo(0,e),document.documentElement.scrollHeight-window.innerHeight>=e||performance.now()>t){g.current=null;return}n=requestAnimationFrame(i)};return n=requestAnimationFrame(i),window.addEventListener(`wheel`,r,{once:!0,passive:!0}),window.addEventListener(`pointerdown`,r,{once:!0}),()=>{cancelAnimationFrame(n),window.removeEventListener(`wheel`,r),window.removeEventListener(`pointerdown`,r)}},[i]);function _(e,r={}){let i={...d.current,...e};if(N(i)===N(d.current))return!0;if(!r.confirmed&&!f.current())return!1;u(d.current),h.current.set(p.current,window.scrollY),r.replace||(g.current=0),r.replace||p.current++;let o={...window.history.state,omniWorkspace:{scope:t,index:p.current,route:i}};return n?window.history[r.replace?`replaceState`:`pushState`](o,``):window.history[r.replace?`replaceState`:`pushState`](o,``,N(i)),d.current=i,a(i),s(p.current>0),!0}return{route:i,go:_,visits:c,canGoBack:o,back:()=>{p.current>0&&window.history.back()}}}async function z(e=``,t){let n=await fetch(`/api/workbench`+e,{method:t?`POST`:`GET`,headers:t?{"Content-Type":`application/json`}:{},body:t?JSON.stringify(t):void 0}),r=await n.json();if(!n.ok)throw Error(r.error||`操作失败`);return r}function B({historyScope:e=`web`}={}){return(0,F.jsx)(h,{children:(0,F.jsx)(V,{historyScope:e})})}function V({historyScope:e}){let[t,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(``),[c,l]=(0,x.useState)(``),[u,d]=(0,x.useState)(!1),[f,p]=(0,x.useState)(!1),[h,v]=(0,x.useState)(!1),[y,b]=(0,x.useState)(!1),[S,C]=(0,x.useState)(0);(0,x.useEffect)(()=>{let e=e=>C(e.detail);return window.addEventListener(`omni:writes`,e),()=>window.removeEventListener(`omni:writes`,e)},[]);let O=(0,x.useRef)(()=>!0),{route:k,go:A,back:j,canGoBack:te,visits:ne}=ie(()=>O.current(),e),{center:I,centerNav:L,tab:B,step:V,node:ae,itemId:H,datasetId:oe}=k,[U,se]=(0,x.useState)(null),[ce,W]=(0,x.useState)(!1),[G,K]=(0,x.useState)(!1),le=_(),q=(0,x.useRef)(new Map),ue=ne.map(e=>({...e,key:N(e.route),moduleLabel:D(P(e.route)),title:e.route.center?D(e.route.centerNav)+` · `+(w[e.route.centerNav]?.find(([t])=>t===e.route.section)?.[1]||`总览`):(t.find(t=>t.id===e.route.projectId)?.name||`项目`)+` · `+(g[e.route.tab]||`项目资料`)}));function de(e){A({center:!0,centerNav:P(k),section:e})&&p(!1)}let[fe,pe]=(0,x.useState)({tab:`overview`}),J=(0,x.useRef)(0),Y=y;function X(e=!0){return u||S?(l(`正在保存,请完成后再切换。`),!1):(Y||e&&G)&&!confirm(`当前有未保存修改,放弃修改并切换?`)?!1:(e&&G&&(K(!1),W(!1)),b(!1),!0)}function Z(e){!I&&e===B||(A({center:!1,tab:e,node:``,datasetId:``,wikiRef:``,wikiEntry:``,methodNode:``,methodRecord:``}),p(!1))}O.current=X;async function Q(){try{r(await z())}catch(e){s(e.message)}}(0,x.useEffect)(()=>{let e=e=>A(M(e.detail));return window.addEventListener(`omni:route`,e),()=>window.removeEventListener(`omni:route`,e)}),(0,x.useEffect)(()=>{Q()},[]),(0,x.useEffect)(()=>{if(!k.projectId){a(null);return}if(i?.project.id===k.projectId)return;let e=++J.current;return v(!0),s(``),z(`/`+encodeURIComponent(k.projectId)).then(t=>{e===J.current&&(a(t),se({id:t.project.id,name:t.project.name}))}).catch(t=>{e===J.current&&(a(null),s(t.message))}).finally(()=>{e===J.current&&v(!1)}),()=>{J.current++}},[k.projectId]),(0,x.useEffect)(()=>{let e=e=>{O.current()||e.preventDefault()};return window.addEventListener(`omni:before-leave`,e),()=>window.removeEventListener(`omni:before-leave`,e)},[]),(0,x.useEffect)(()=>(window.dispatchEvent(new CustomEvent(`omni:workspace-safety`,{detail:{dirty:Y||G,busy:u||S}})),()=>{window.dispatchEvent(new CustomEvent(`omni:workspace-safety`,{detail:{dirty:!1,busy:!1}}))}),[Y,G,u,S]),(0,x.useEffect)(()=>{let e=e=>{(Y||G||u||S)&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Y,G,u,S]);function me(e){!I&&i&&pe({tab:B,step:V,node:ae,itemId:H,datasetId:oe}),q.current.set(P(k),{...k}),A(q.current.get(e)||{center:!0,centerNav:e,section:E(e)})&&p(!1)}function he(){X()&&(W(!0),p(!1))}async function $(e,t,n=!1){if(!X())return;let r=t?.step??0;A({projectId:e,center:n,tab:t?.tab||`overview`,step:r,node:t?.node||``,itemId:t?.itemId||``,datasetId:t?.datasetId||``,wikiRef:``,wikiEntry:``,methodNode:``,methodRecord:``},{confirmed:!0}),s(``),l(``),p(!1),W(!1)}async function ge(){a(await z(`/`+i.project.id)),B!==`insight`&&b(!1),await Q()}return(0,F.jsxs)(re,{navigation:{projects:t,project:i?.project,route:k,menuOpen:f,busy:u||h||!!S,onClose:()=>p(!1),onProject:e=>$(e,{tab:`overview`}),onCenter:me,onSection:de,onNavigate:Z,onCreate:he},canGoBack:te,onBack:j,onOpenMenu:()=>p(!0),title:B===`archive`?`分析任务`:g[B],dirty:Y||G,children:[o&&(0,F.jsx)(`div`,{role:`alert`,className:`error`,children:o}),c&&(0,F.jsx)(`div`,{role:`status`,className:`notice`,children:c}),ce&&(0,F.jsx)(ee,{api:z,onDirty:K,onBusy:d,onClose:()=>W(!1),onCreated:async(e,t)=>{await Q(),A({projectId:e,center:!1,tab:`overview`,step:0,node:``,itemId:``,datasetId:``,wikiRef:``,wikiEntry:``,methodNode:``,methodRecord:``},{confirmed:!0}),W(!1),K(!1),t&&l(t)}}),!I&&(h||k.projectId&&i?.project.id!==k.projectId&&!o)?(0,F.jsx)(`section`,{className:`card`,children:(0,F.jsx)(`p`,{role:`status`,children:`正在读取项目资料…`})}):I?(0,F.jsxs)(F.Fragment,{children:[U&&L!==`home`&&(0,F.jsxs)(`p`,{className:`pn-return`,children:[(0,F.jsx)(`span`,{children:`当前查看全局资料`}),(0,F.jsxs)(`button`,{onClick:()=>$(U.id,fe),children:[`返回刚才项目:`,U.name]})]}),(0,F.jsx)(m,{value:{layoutScope:e===`web`?void 0:e.split(`:`)[0],api:z,visits:ue,onGo:e=>{A(e)},onOpen:$,onModule:me,onCreate:he,onDirty:b,onBusy:d,onProductGroup:(e,t,n)=>{A({center:!0,centerNav:`products`,section:e})&&le(t?.key,n)}},children:(0,F.jsx)(R,{moduleId:L,section:k.section,onSection:(e,t)=>A({section:e},t)})})]}):i?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`wb-page-heading`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`wb-kicker`,children:g[B]}),(0,F.jsx)(`h1`,{children:i.project.name}),(0,F.jsxs)(`p`,{children:[(0,F.jsx)(`span`,{className:`wb-chip `+(i.project.simulated?`warning`:``),children:i.project.simulated?`模拟项目 · 非真实经营`:`资料项目 · 真实性按来源核验`}),(0,F.jsxs)(`span`,{className:`muted`,children:[`项目 `,i.project.id.slice(0,8),` · `,i.project.version,` 条阶段版本`]})]})]}),(0,F.jsxs)(`details`,{className:`wb-export-menu`,children:[(0,F.jsxs)(`summary`,{children:[(0,F.jsx)(n,{size:15}),` 导出资料`]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`a`,{href:`/api/workbench/`+i.project.id+`/wiki`,children:`分析 Wiki · Markdown`}),(0,F.jsx)(`a`,{href:`/api/workbench/`+i.project.id+`/export`,children:`完整项目资料包 · JSON`})]})]})]}),T(P(k))?.projectEntry&&(0,F.jsx)(R,{moduleId:P(k),section:B,onSection:e=>Z(e),project:{route:k,onRoute:(e,t)=>{A(e,t)},projectId:i.project.id,data:i,api:z,initialItemId:H,dirty:y,onDirty:b,onBusy:d,onSaved:ge,onPrepare:()=>Z(`data`)}})]}):(0,F.jsxs)(`section`,{className:`card wb-menu-welcome`,children:[(0,F.jsxs)(`h1`,{children:[g[B],` · 先选择项目`]}),(0,F.jsxs)(`p`,{children:[`选好项目就会直接打开`,g[B],`。之后可在左侧直接切换功能。`]}),(0,F.jsxs)(`label`,{children:[`选择项目`,(0,F.jsxs)(`select`,{"aria-label":`主菜单选择项目`,value:``,onChange:e=>e.target.value&&$(e.target.value,{tab:B}),children:[(0,F.jsx)(`option`,{value:``,children:`请选择要处理的项目`}),t.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]})]})}export{B as default};