@petercjl/omni-desktop-app 0.1.8 → 0.1.10

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 (104) hide show
  1. package/INSTALL.md +9 -0
  2. package/README.md +4 -4
  3. package/UPDATE.md +7 -0
  4. package/app/assets/{CartesianChart-Bwf4u0Tg.js → CartesianChart-CP7p2vlm.js} +2 -2
  5. package/app/assets/{CollaborationWorkspace-Bd6Sjj31.js → CollaborationWorkspace-Cnp5PNn_.js} +3 -3
  6. package/app/assets/CompetitorAnalysis-Cujy_a2L.js +1 -0
  7. package/app/assets/CompetitorAnalysis-h1zdt0F2.css +1 -0
  8. package/app/assets/EmptyState-CUHuNsaV.js +1 -0
  9. package/app/assets/ErrorBarContext-BJE5-ljg.js +1 -0
  10. package/app/assets/{EvidenceSourceGuide-CwfB7Z6T.js → EvidenceSourceGuide-B1AJCZm2.js} +1 -1
  11. package/app/assets/FavoritePicker-XD1a_uOa.js +1 -0
  12. package/app/assets/Favorites-B5_fdEvZ.js +1 -0
  13. package/app/assets/{HelpTip-CX2LFdwD.js → HelpTip-BqRBO41J.js} +1 -1
  14. package/app/assets/LineChart-Ckvg5wfQ.js +4 -0
  15. package/app/assets/{Opportunities-a5IpRN6k.js → Opportunities-BvH64-dz.js} +1 -1
  16. package/app/assets/{ProgressiveRows-ByxDeTyy.js → ProgressiveRows-NojOUgmr.js} +1 -1
  17. package/app/assets/ShopLayoutPage-CCrRwaAx.js +1 -0
  18. package/app/assets/TrendChart-BF4JgwxH.js +1 -0
  19. package/app/assets/arrow-down-B1nil3T4.js +1 -0
  20. package/app/assets/arrow-left-BhFSpYzK.js +1 -0
  21. package/app/assets/arrow-up-right-IBQoN72x.js +1 -0
  22. package/app/assets/{book-open-C0B9Pao9.js → book-open-Cqdn6s-H.js} +1 -1
  23. package/app/assets/chart-column-DCwNhXki.js +1 -0
  24. package/app/assets/{chart-no-axes-combined-XDy9u9SV.js → chart-no-axes-combined-DVgKs36j.js} +1 -1
  25. package/app/assets/check-DBnlZFEo.js +1 -0
  26. package/app/assets/chevron-down-DO6RUQm8.js +1 -0
  27. package/app/assets/chevron-right-e65CaeL6.js +1 -0
  28. package/app/assets/{clock-3-TH35nOP-.js → clock-3-CDHtQwAe.js} +1 -1
  29. package/app/assets/competitor-analysis-D6eM9ugQ.js +1 -0
  30. package/app/assets/{components-C2-vHJtu.js → components-B5Xyjfpi.js} +2 -2
  31. package/app/assets/{download-BlJN0Lg8.js → download-DfM49VvV.js} +1 -1
  32. package/app/assets/entry-Bq7tA83b.js +1 -0
  33. package/app/assets/{entry-OcErMaMp.css → entry-CMur_AE7.css} +1 -1
  34. package/app/assets/entry-DC4oDjzU.js +2 -0
  35. package/app/assets/{entry-DM3aLe2I.js → entry-DM64sJfS.js} +1 -1
  36. package/app/assets/entry-DbqMDIJi.js +1 -0
  37. package/app/assets/{entry-CdLi3Z9F.js → entry-N8bfKXTF.js} +2 -2
  38. package/app/assets/{entry-CYGrMJuR.js → entry-kAWoaIsV.js} +2 -2
  39. package/app/assets/favorites.module-CHYv-Z8y.js +1 -0
  40. package/app/assets/{file-text-Hd45wNTe.js → file-text-DKAT5fzJ.js} +1 -1
  41. package/app/assets/getRadiusAndStrokeWidthFromDot-bv_ksZ7y.js +1 -0
  42. package/app/assets/{grid-2x2-C0aJVeyS.js → grid-2x2-DB6zRPIV.js} +1 -1
  43. package/app/assets/index-BgJNmU0Z.css +1 -0
  44. package/app/assets/{index-BguiS02-.js → index-DLSVWUSu.js} +2 -2
  45. package/app/assets/{layers-Dj9z2et6.js → layers-CjsT_HGi.js} +1 -1
  46. package/app/assets/{layout-dashboard-DS537D8b.js → layout-dashboard-sgUrlApv.js} +1 -1
  47. package/app/assets/{link-2-CCKUDMV6.js → link-2-VLti-YG9.js} +1 -1
  48. package/app/assets/{list-LZcXKWKD.js → list-Dfzc0sXQ.js} +1 -1
  49. package/app/assets/market-SuD7x_Hf.css +1 -0
  50. package/app/assets/market.module-VpU4XmGg.js +1 -0
  51. package/app/assets/{module-host-C4vqZw2y.js → module-host-DNtiV4gZ.js} +1 -1
  52. package/app/assets/{orbit-G4ZspWKB.js → orbit-CrQs6cpl.js} +1 -1
  53. package/app/assets/play-BxTFlaQX.js +1 -0
  54. package/app/assets/plus-D78h7lrw.js +1 -0
  55. package/app/assets/{products-BAKFF--e.js → products-B5vjXM_b.js} +1 -1
  56. package/app/assets/{project-public-HdtYycKS.js → project-public-CgW1u7BI.js} +1 -1
  57. package/app/assets/{project-public-BCoD2Anq.js → project-public-DWTt808B.js} +1 -1
  58. package/app/assets/public-C-PBMVOQ.js +1 -0
  59. package/app/assets/{refresh-cw-dsQ_f-9j.js → refresh-cw-CxbRf97c.js} +1 -1
  60. package/app/assets/search-DFdSppzm.js +1 -0
  61. package/app/assets/{triangle-alert-l-Mfj0iE.js → triangle-alert-C7qiylOf.js} +1 -1
  62. package/app/assets/{ui-public-BPe2GJZ-.css → ui-public-DHoRDp5_.css} +1 -1
  63. package/app/assets/{ui-public-DWkIf658.js → ui-public-Dt5dHt-8.js} +1 -1
  64. package/app/assets/workbench-DIKJZNJQ.js +2 -0
  65. package/app/assets/{workspace-view-state-BJMX6vWb.js → workspace-view-state-D0ujRczW.js} +1 -1
  66. package/app/desktop/main.mjs +7719 -0
  67. package/app/desktop/preload.cjs +30 -0
  68. package/app/index.html +2 -2
  69. package/app/package.json +1 -0
  70. package/app/public/omni-icon.png +0 -0
  71. package/app/tools/bootstrap.bin +0 -0
  72. package/app/tools/omni-desktop.mjs +526 -0
  73. package/package.json +7 -2
  74. package/release.json +1 -1
  75. package/release.sig +1 -1
  76. package/app/assets/EmptyState-CE7obISq.js +0 -1
  77. package/app/assets/Favorites-4oU1mgEb.js +0 -1
  78. package/app/assets/LineChart-B6igYupv.js +0 -4
  79. package/app/assets/ShopLayoutPage-D7KKJVEq.js +0 -1
  80. package/app/assets/TrendChart-BdRXaz4z.js +0 -1
  81. package/app/assets/arrow-down-DSjucZgz.js +0 -1
  82. package/app/assets/arrow-left-DmIga4jN.js +0 -1
  83. package/app/assets/arrow-up-right-DzAKT3cL.js +0 -1
  84. package/app/assets/check-BB89tIU6.js +0 -1
  85. package/app/assets/chevron-down-BiokgLxD.js +0 -1
  86. package/app/assets/chevron-right-CZlQQ5gV.js +0 -1
  87. package/app/assets/entry-Bxc-KNuY.js +0 -1
  88. package/app/assets/entry-ZwyGbRek.js +0 -1
  89. package/app/assets/entry-ffP7X21A.js +0 -2
  90. package/app/assets/index-D1qZkLPg.css +0 -1
  91. package/app/assets/market-DqV9l-vR.css +0 -1
  92. package/app/assets/market.module-BSrEp5Ak.js +0 -1
  93. package/app/assets/package-BFlv-jYw.js +0 -1
  94. package/app/assets/play-DxbesM66.js +0 -1
  95. package/app/assets/plus-QakkcxdA.js +0 -1
  96. package/app/assets/public-JUGpS2z7.js +0 -1
  97. package/app/assets/search-Cisx0wBF.js +0 -1
  98. package/app/assets/use-favorites-ALxrDxDW.js +0 -1
  99. package/app/assets/workbench-DZTf1DRZ.js +0 -2
  100. /package/app/assets/{api-hjUd9Skg.js → api-KZa8CR8X.js} +0 -0
  101. /package/app/assets/{use-favorites-_eKBQGeF.css → favorites-_eKBQGeF.css} +0 -0
  102. /package/app/assets/{format-BCxMsVJh.js → format-DL7i7_eV.js} +0 -0
  103. /package/app/assets/{graphicalItemSelectors-Hc730Dd1.js → graphicalItemSelectors-CJfZ6cht.js} +0 -0
  104. /package/app/assets/{group-CjIFQYrJ.js → group-Ed305HyG.js} +0 -0
@@ -1 +1 @@
1
- import{g as e,o as t,y as n}from"./index-BguiS02-.js";import{t as r}from"./HelpTip-CX2LFdwD.js";import{t as i}from"./EvidenceSourceGuide-CwfB7Z6T.js";import{it as a,n as o,r as s,s as c,y as l}from"./CartesianChart-Bwf4u0Tg.js";import{a as u,n as d,t as f}from"./LineChart-B6igYupv.js";var p=n(e(),1),m=t(),h=[`var(--omni-chart-teal)`,`var(--omni-danger)`,`var(--omni-chart-primary)`,`var(--omni-chart-orange)`,`var(--omni-chart-secondary)`,`var(--omni-accent)`,`var(--omni-warning)`],g=(e,t)=>{if(e==null)return`—`;let n=Number(e);return Number.isFinite(n)?t===`%`?n.toFixed(2)+`%`:Math.abs(n)>=1e4?(n/1e4).toFixed(2)+`万`:n.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):String(e)};function _({data:e,api:t,onPrepare:n}){let[i,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(``),[w,T]=(0,p.useState)(!1),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(``),[A,j]=(0,p.useState)(null);async function M(){x(!0),C(``);try{let n=await t(`/`+e.project.id+`/dashboard`);_(n),n.metrics?.length&&!v&&y(n.metrics[0].key||n.metrics[0].metric),n.metrics?.length||C(`本项目还没有可展示的已保存的数据。请先检查数据中心的导入状态与现有资料。`)}catch(e){C(e.message)}finally{x(!1)}}(0,p.useEffect)(()=>{M()},[e.project.id]);let N=(0,p.useMemo)(()=>i?.metrics?.find(e=>(e.key||e.metric)===v)||i?.metrics?.[0]||null,[i,v]),P=(0,p.useMemo)(()=>N?N.points.map(e=>({date:e.date,value:e.value})):[],[N]),F=(0,p.useMemo)(()=>i?.metrics?.filter(e=>E.includes(e.key||e.metric))||[],[i,E]),I=(0,p.useMemo)(()=>new Set(F.map(e=>String(e.unit||``))),[F]),L=I.size<=1,R=(0,p.useMemo)(()=>{if(!w||!F.length)return[];let e=new Map;for(let t of F){let n=Math.max(...t.points.map(e=>Math.abs(Number(e.value)||0)),1);for(let r of t.points)e.has(r.date)||e.set(r.date,{date:r.date}),e.get(r.date)[t.key||t.metric]=r.value===null?null:L?Number(r.value):+(Number(r.value)/n*100).toFixed(1)}return[...e.values()].sort((e,t)=>e.date.localeCompare(t.date))},[w,F,L]);function z(e){D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}return(0,m.jsxs)(`section`,{className:`card`,style:{marginBottom:20},children:[!i?.metrics?.length&&n&&(0,m.jsxs)(`p`,{children:[(0,m.jsx)(`button`,{onClick:n,children:`查看本项目资料与导入状态`}),(0,m.jsx)(`span`,{children:` 这里只展示已归档资料;没有资料不补零、不生成示例。`})]}),(0,m.jsxs)(`h2`,{children:[`经营指标看板`,(0,m.jsx)(r,{label:`理解指标`,children:`先核对来源、统计日期和单位。不同单位的指标对比会缩放为相对趋势,不能据此比较金额或人数大小。`})]}),(0,m.jsx)(`p`,{className:`muted`,children:`从专用数据库读取项目指标与对比数据。同口径、同日期取最新采集值;缺失值保留空档。`}),(0,m.jsxs)(`div`,{className:`exports`,children:[(0,m.jsx)(`button`,{disabled:b,onClick:M,children:b?`读取中…`:`刷新看板`}),(0,m.jsx)(`button`,{className:w?``:`secondary`,onClick:()=>{T(!w),!w&&!E.length&&i?.metrics?.length&&D(i.metrics.slice(0,2).map(e=>e.key||e.metric))},children:w?`退出多指标对比`:`多指标对比`}),i&&(0,m.jsxs)(`span`,{className:`muted`,children:[` 指标 `,i.metrics?.length||0,` 个 · 源文件 `,i.files||0,` 个 · 区间 `,i.range?`${i.range.start} ~ ${i.range.end}`:`—`]})]}),S&&(0,m.jsx)(`p`,{role:`status`,children:S}),i?.metrics?.length>0&&(0,m.jsxs)(m.Fragment,{children:[w?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`muted`,style:{margin:`10px 0`},children:L?`同单位叠加:选中指标均为 ${Array.from(I)[0]||`-`},直接同轴比较绝对值。`:`混合单位叠加(${Array.from(I).join(` / `)||`-`}):已按各自最大值归一到 0–100,只比走势方向,不能比绝对值。`}),(0,m.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`10px 0`},children:i.metrics.map((e,t)=>{let n=e.key||e.metric,r=E.includes(n);return(0,m.jsx)(`button`,{onClick:()=>z(n),style:{padding:`4px 10px`,borderRadius:14,fontSize:12,cursor:`pointer`,border:`1px solid `+(r?h[t%h.length]:`var(--omni-line)`),background:r?`var(--omni-selected,var(--omni-panel,#193954))`:`var(--omni-panel,var(--omni-panel,#102235))`,color:`var(--omni-text,var(--omni-text,#dceaf7))`},children:e.name},n)})}),F.length===0?(0,m.jsx)(`p`,{className:`muted`,children:`请至少选择一个指标。`}):(0,m.jsx)(`div`,{style:{width:`100%`,height:300},children:(0,m.jsx)(a,{children:(0,m.jsxs)(f,{data:R,margin:{top:8,right:16,bottom:8,left:8},children:[(0,m.jsx)(c,{strokeDasharray:`3 3`,stroke:`var(--omni-line)`}),(0,m.jsx)(s,{dataKey:`date`,tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,interval:`preserveStartEnd`,minTickGap:16}),(0,m.jsx)(o,{tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,width:56,domain:L?[`auto`,`auto`]:[0,100],tickFormatter:L?(e=>g(e,Array.from(I)[0]||``)):void 0}),(0,m.jsx)(l,{}),(0,m.jsx)(u,{wrapperStyle:{fontSize:12}}),F.map((e,t)=>(0,m.jsx)(d,{type:`monotone`,dataKey:e.key||e.metric,name:e.name,stroke:h[t%h.length],strokeWidth:2,dot:!1,connectNulls:!1,isAnimationActive:!1},e.key||e.metric))]})})})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill,minmax(170px,1fr))`,gap:10,margin:`14px 0`},children:i.metrics.map(e=>{let t=e.key||e.metric,n=e.points||[],r=n[n.length-1],i=n[n.length-2],a=r?.value!=null&&i?.value!=null?r.value-i.value:null,o=a==null||![`higher`,`lower`].includes(e.direction)?null:e.direction===`higher`?a>0:a<0;return(0,m.jsxs)(`div`,{onClick:()=>y(t),style:{cursor:`pointer`,padding:10,borderRadius:8,border:v===t?`2px solid var(--omni-accent,var(--omni-line,#61d3df))`:`1px solid var(--omni-line,var(--omni-line,#2c435b))`,background:`var(--omni-panel)`},children:[(0,m.jsxs)(`div`,{style:{fontSize:12,color:`var(--omni-muted)`},children:[e.name,e.scope?(0,m.jsxs)(`span`,{title:e.scope,style:{color:`var(--omni-muted,var(--omni-muted,#91a9bd))`},children:[` · `,/^[0-9a-f]{8}-/i.test(e.scope)?`范围 `+e.scope.slice(0,8):e.scope]}):null]}),(0,m.jsxs)(`div`,{style:{fontSize:20,fontWeight:600,margin:`2px 0`},children:[g(r?.value,e.unit),(0,m.jsx)(`span`,{style:{fontSize:12,color:`var(--omni-muted)`,marginLeft:4},children:e.unit===`%`?``:e.unit})]}),(0,m.jsx)(`div`,{style:{fontSize:12,color:o===null?`var(--omni-muted)`:o?`var(--omni-success)`:`var(--omni-danger)`},children:a===null?`暂无可比值`:`${a>0?`+`:``}${g(a,e.unit)} 较上一观测日`}),(0,m.jsxs)(`div`,{style:{fontSize:11,color:`var(--omni-muted)`,marginTop:2},children:[e.count,` 天 · `,r?.date||`-`]})]},t)})}),N&&(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsxs)(`div`,{className:`section-title`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`eyebrow`,children:N.metric}),(0,m.jsxs)(`h3`,{children:[N.name,` · 走势`]})]}),(0,m.jsxs)(`span`,{className:`muted`,children:[N.count,` 个数据点 · 单位 `,N.unit,` · `,N.direction===`higher`?`越高越好`:N.direction===`lower`?`越低越好`:`方向待核`]})]}),(0,m.jsx)(`div`,{style:{width:`100%`,height:280},children:(0,m.jsx)(a,{children:(0,m.jsxs)(f,{data:P,margin:{top:8,right:16,bottom:8,left:8},children:[(0,m.jsx)(c,{strokeDasharray:`3 3`,stroke:`var(--omni-line)`}),(0,m.jsx)(s,{dataKey:`date`,tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,interval:`preserveStartEnd`,minTickGap:16}),(0,m.jsx)(o,{tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,width:56,tickFormatter:e=>g(e,N.unit)}),(0,m.jsx)(l,{formatter:e=>[g(e,N.unit),N.name],labelFormatter:e=>`日期 `+e}),(0,m.jsx)(d,{type:`monotone`,dataKey:`value`,stroke:`var(--omni-chart-teal)`,strokeWidth:2,dot:{r:2},connectNulls:!1,isAnimationActive:!1})]})})})]})]}),(0,m.jsxs)(`details`,{style:{marginTop:12},children:[(0,m.jsxs)(`summary`,{children:[`指标来源文件(`,i.files,` 个)`]}),i.metrics.map(t=>(0,m.jsxs)(`div`,{style:{margin:`6px 0`},children:[(0,m.jsxs)(`b`,{children:[t.name,`(`,t.metric,`)`]}),t.files.map(t=>(0,m.jsx)(`p`,{className:`muted`,style:{margin:`2px 0 2px 12px`},children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t.id,children:t.name})},t.id))]},t.key||t.metric))]}),(0,m.jsx)(`p`,{className:`muted`,children:`看板只做展示与描述统计,不判断因果;缺日不插值,单位差异不做换算。`})]}),(i?.datasets?.length||0)>0&&(()=>{let e=i.datasets.find(e=>e.fileId===O)||i.datasets[0],t=e.columns||[],n=[...e.rows];if(A){let e=t.find(e=>e.key===A.key);n.sort((t,n)=>{let r=t[A.key],i=n[A.key];if(e?.type===`text`)return A.desc?String(i??``).localeCompare(String(r??``)):String(r??``).localeCompare(String(i??``));let a=Number(r),o=Number(i);return!Number.isFinite(a)&&!Number.isFinite(o)?0:Number.isFinite(a)?Number.isFinite(o)?A.desc?o-a:a-o:-1:1})}let r=(e,t)=>{if(e==null||e===``)return`—`;if(t.type===`percent`){let t=Number(e);return Number.isFinite(t)?(t*100).toFixed(2)+`%`:String(e)}if(t.type===`number`){let t=Number(e);return Number.isFinite(t)?t.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):String(e)}return String(e)};return(0,m.jsxs)(`div`,{style:{marginTop:24,paddingTop:20,borderTop:`2px solid var(--omni-line)`},children:[(0,m.jsxs)(`div`,{className:`section-title`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`eyebrow`,children:`STRUCTURED COMPARISON`}),(0,m.jsx)(`h2`,{children:`数据明细对比`})]}),(0,m.jsxs)(`span`,{className:`muted`,children:[`数据集 `,i.datasets.length,` 个`]})]}),i.datasets.length>1&&(0,m.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`10px 0`},children:i.datasets.map(t=>(0,m.jsx)(`button`,{className:t.fileId===e.fileId?``:`secondary`,onClick:()=>{k(t.fileId),j(null)},children:t.title},t.fileId))}),(0,m.jsxs)(`div`,{className:`section-title`,style:{marginTop:8},children:[(0,m.jsx)(`div`,{children:(0,m.jsx)(`h3`,{children:e.title})}),(0,m.jsxs)(`span`,{className:`muted`,children:[e.window?`窗口 ${e.window} · `:``,n.length,` 行`,e.kind?` · ${e.kind}`:``]})]}),e.note&&(0,m.jsx)(`p`,{className:`hint`,children:e.note}),(0,m.jsx)(`div`,{style:{overflowX:`auto`},children:(0,m.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:13},children:[(0,m.jsx)(`thead`,{children:(0,m.jsx)(`tr`,{children:t.map(e=>(0,m.jsxs)(`th`,{onClick:()=>j(t=>t&&t.key===e.key?{key:e.key,desc:!t.desc}:{key:e.key,desc:!0}),style:{cursor:`pointer`,textAlign:e.type===`text`?`left`:`right`,padding:`8px 10px`,borderBottom:`2px solid var(--omni-line)`,whiteSpace:`nowrap`,userSelect:`none`},children:[e.label,e.unit?`(${e.unit})`:``,A&&A.key===e.key?A.desc?` ▼`:` ▲`:``]},e.key))})}),(0,m.jsx)(`tbody`,{children:n.map((e,n)=>(0,m.jsx)(`tr`,{style:{background:(n%2,`var(--omni-panel)`)},children:t.map(t=>(0,m.jsx)(`td`,{style:{padding:`7px 10px`,textAlign:t.type===`text`?`left`:`right`,borderBottom:`1px solid var(--omni-line)`,color:t.direction===`lower`&&Number(e[t.key])>0?`var(--omni-danger)`:void 0},children:r(e[t.key],t)},t.key))},n))}),e.totals&&(0,m.jsx)(`tfoot`,{children:(0,m.jsx)(`tr`,{style:{fontWeight:600,background:`var(--omni-panel)`},children:t.map((t,n)=>(0,m.jsx)(`td`,{style:{padding:`8px 10px`,textAlign:t.type===`text`?`left`:`right`,borderTop:`2px solid var(--omni-line)`},children:n===0?`合计`:e.totals[t.key]===void 0?``:r(e.totals[t.key],t)},t.key))})})]})}),(0,m.jsx)(`p`,{className:`muted`,style:{marginTop:8},children:`点表头可排序。数据来自本项目归档的 analysis-dataset-v1 数据集,不插值、不换算单位。`})]})})()]})}var v=`1.0.0-local`;function y(e,t=!1){return{format:`project-daily-review-v1`,project_id:e,mode:`simulated`,workflow:`operating-reconciliation`,evidence:{source:`虚构每日核算快照`,collectedAt:`2026-10-29T00:00:00Z`},config:{timezone:`Asia/Shanghai`,metric:`specifiedCostProfit`,scope:`fictional-cup`,unit:`CNY`,direction:`higher`,start:`2026-10-01`,end:`2026-10-03`},snapshots:(t?[1,2,3]:[1,3]).map(t=>({date:`2026-10-0${t}`,project_id:e,workflow:`operating-reconciliation`,mode:`simulated`,scope:`fictional-cup`,unit:`CNY`,source:`虚构归档账本`,collectedAt:`2026-10-29T00:00:00Z`,complete:!0,version:1,value:200+t*10})),method:{name:`降低低效广告支出候选`,version:`candidate-1`,productType:`虚构杯具`,channel:`搜索`,stage:`在售`,window:`7日`,sampleSize:0,observationDays:3,successDefinition:`足窗同口径贡献增加且退款不恶化`,failureDefinition:`贡献下降或退款恶化`,limits:`模拟、无对照、样本不足`,sourceRun:`虚构核算示例`,failures:[`模拟缺日分支`]}}}function b(e){let t=new Date;return t.setDate(t.getDate()+e),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function x({data:e,api:t,dirty:n,onSaved:a,onDirty:o,initialItemId:s=``}){let[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(!1),[f,h]=(0,p.useState)(``),[g,_]=(0,p.useState)(``),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(e.monitorConfig?.enabled||!1),[k,A]=(0,p.useState)(e.monitorConfig?.followLatest||!1),[j,M]=(0,p.useState)(s),[N,P]=(0,p.useState)(()=>b(-30)),[F,I]=(0,p.useState)(()=>b(-1)),[L,R]=(0,p.useState)(`revenue`),[z,B]=(0,p.useState)(``),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(!1),[G,ee]=(0,p.useState)(`inventory`),[K,te]=(0,p.useState)(`revenue`),[q,ne]=(0,p.useState)(``),[J,Y]=(0,p.useState)(!1),[X,re]=(0,p.useState)(``),[Z,ie]=(0,p.useState)(!1),Q=e.monitorStreams||[];async function $(n,r,i,o){Y(!0),h(``);try{let s=n+`-`+r;await t(`/`+e.project.id+`/monitor-stream`,{version:e.project.version,key:s,enabled:o,timezone:`Asia/Shanghai`,workflow:`fulfillment-retention`,branch:n,metric:r,scope:null,sourceFileId:i||null,followLatest:!1,itemId:String(X).trim()||null,autoUpdate:Z}),h(`命名流 ${n}(${r})已保存${o?`并启用`:`并关闭`};未创建日程、未获取新数据`),await a()}catch(e){h(e.message)}finally{Y(!1)}}async function ae(n){let r=JSON.stringify(n,null,2),i=new TextEncoder().encode(r),a=``;for(let e of i)a+=String.fromCharCode(e);let o=`每日快照-${n.config.metric}-${n.config.start}_${n.config.end}.json`;return(await t(`/`+e.project.id+`/file`,{name:o,kind:`analysis`,source:`生意参谋逐日取数 ${n.evidence.collectedAt}`,base64:btoa(a)})).id}async function oe(){W(!0),h(``);try{let n=await t(`/`+e.project.id+`/job`,{kind:`daily-review-collect`,step:5,version:e.project.version,input:{itemId:String(j).trim(),from:N,to:F,metric:L,workflow:`listed-optimization`},refs:[]});B(n.id),H({id:n.id,status:`pending`}),h(`取数任务已提交,等待本机执行(约 2–3 秒/天,串行)。`)}catch(e){h(e.message)}finally{W(!1)}}(0,p.useEffect)(()=>{if(!z)return;let n=setInterval(async()=>{try{let r=await t(`/`+e.project.id+`/job/`+z);if(H(r),r.status!==`pending`&&(clearInterval(n),r.status===`done`&&r.result)){let e=r.result;l(JSON.stringify(e,null,2));try{let t=await ae(e);try{await a()}catch{}_(t),h(`已取到 ${e.snapshots?.length||0} 天快照并归档为本项目文件;已自动选为来源,打开启用开关后保存配置即可。`)}catch(t){h(`已取到 ${e.snapshots?.length||0} 天快照并填入,但归档失败:${t.message}。可手动保存为文件。`)}}}catch{}},4e3);return()=>clearInterval(n)},[z]);let se=e.acquisitionJobs.filter(e=>e.type===`project-daily-review`);async function ce(){d(!0);try{let n=await t(`/`+e.project.id+`/project-daily-review`,{run_id:crypto.randomUUID(),version:e.project.version,raw:c,previous_run_id:x||null,feedback:x?{action:`更新执行/观察证据`,observation:C,reason:C}:null});E(n),h(n.status===`done`?n.reused?`返回已有运行,不重复写入`:`证据、评审与Wiki新版本已保存`:n.error),await a()}catch(e){h(e.message)}finally{d(!1)}}return(0,m.jsxs)(`section`,{className:`card`,children:[(0,m.jsxs)(`h2`,{children:[`每日监控与复盘`,(0,m.jsx)(r,{label:`设置监控`,children:`先核对商品、指标和日期。启用监控是保存任务设置,不能据此判断后台已运行;查看实际任务记录确认结果。`})]}),(0,m.jsx)(i,{data:e,raw:c,disabled:u,onLoad:e=>{l(e),o?.(!0)},onSourceSelected:_,format:`project-daily-review-v1`,source:`逐日指标快照`,question:`要观察哪个商品和指标?先确认日期范围,再选择已归档快照或手动发起平台取数。配置日检是独立操作,不会因读取资料而启用。`},e.project.id),(0,m.jsx)(`p`,{children:`监控配置 → 归档每日快照 → 缺日与更正检查 → 指标变化 → 阶段复盘 → 候选方法复用`}),(0,m.jsxs)(`p`,{children:[`版本 `,v,` · `,e.project.simulated?`模拟项目,不能证明真实效果`:`人工资料项目`,`。平台取数已接入(生意参谋逐日,生成标准快照);模型语义诊断、店铺执行未接入。`]}),(0,m.jsxs)(`div`,{style:{margin:`14px 0`,padding:12,border:`1px solid var(--omni-line,#294248)`,borderRadius:8,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`平台取数 · 生成每日快照`}),(0,m.jsx)(`p`,{className:`muted`,style:{margin:`4px 0 8px`},children:`从生意参谋拉逐日原值,直接生成 project-daily-review-v1 并归档为本项目文件。只能取本店商品;贡献与利润类指标平台不提供。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`p`,{children:[`读取平台资料`,(0,m.jsx)(r,{label:`资料获取范围`,children:`先确认商品和日期。提交只创建请求,是否执行以实际记录为准;不要为试用功能恢复已暂停的采集。`})]}),(0,m.jsxs)(`label`,{children:[`商品ID(本店在售)`,(0,m.jsx)(`input`,{value:j,onChange:e=>M(e.target.value),placeholder:`如 100000000001`})]}),(0,m.jsxs)(`label`,{children:[`监控指标`,(0,m.jsxs)(`select`,{value:L,onChange:e=>R(e.target.value),children:[(0,m.jsx)(`option`,{value:`revenue`,children:`支付金额`}),(0,m.jsx)(`option`,{value:`buyers`,children:`支付买家数`}),(0,m.jsx)(`option`,{value:`visitors`,children:`商品访客数`}),(0,m.jsx)(`option`,{value:`pageViews`,children:`商品浏览量`}),(0,m.jsx)(`option`,{value:`spend`,children:`广告花费`}),(0,m.jsx)(`option`,{value:`refunds`,children:`退款成功金额`}),(0,m.jsx)(`option`,{value:`newBuyers`,children:`新客支付买家`}),(0,m.jsx)(`option`,{value:`oldBuyers`,children:`老客支付买家`}),(0,m.jsx)(`option`,{value:`descScore`,children:`描述评分`}),(0,m.jsx)(`option`,{value:`oldBuyerShare`,children:`老客支付买家占比(非复购率)`}),(0,m.jsx)(`option`,{value:`uvValue`,children:`UV价值(派生)`}),(0,m.jsx)(`option`,{value:`netUvValue`,children:`期间差额/UV(非利润)`})]})]}),(0,m.jsxs)(`label`,{children:[`日期区间(默认近30天)`,(0,m.jsx)(`input`,{type:`date`,value:N,onChange:e=>P(e.target.value)}),` 至 `,(0,m.jsx)(`input`,{type:`date`,value:F,onChange:e=>I(e.target.value)})]})]}),(0,m.jsxs)(`div`,{className:`exports`,children:[(0,m.jsx)(`button`,{disabled:U||!j||!N||!F,onClick:oe,children:`从平台取数`}),V&&(0,m.jsxs)(`span`,{className:`muted`,children:[` `,V.id,` · `,V.status===`pending`?`等待执行`:V.status===`done`?`已返回`:V.error||`失败`]})]}),Array.isArray(V?.notes)&&V.notes.length>0&&(0,m.jsx)(`p`,{className:`muted`,children:V.notes.join(`;`)})]}),(0,m.jsxs)(`div`,{className:`card`,children:[(0,m.jsxs)(`h3`,{children:[`项目每日监控配置`,(0,m.jsx)(r,{label:`启用监控前`,children:`核对监控范围和资料来源后再保存。自动更新取决于实际接入和权限,缺日期的数据不能补成零。`})]}),(0,m.jsx)(`p`,{children:`默认未启用,批处理排除模拟项目。目标窗口自动到Asia/Shanghai昨天;没有新数据会记录缺日,不启动取数。`}),(0,m.jsxs)(`label`,{children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked)}),`启用本项目日检`]}),(0,m.jsxs)(`label`,{children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>A(e.target.checked)}),`跟随同名归档最新版本(仍验证项目与类型)`]}),(0,m.jsxs)(`p`,{children:[`在下方选择本项目标准JSON来源;不选择来源保存为待接通。当前:`,e.monitorConfig?.enabled?`已启用`:`未启用`,` · `,e.monitorConfig?.sourceFileId||`缺源`]}),(0,m.jsx)(`button`,{disabled:u||n,onClick:async()=>{d(!0);try{await t(`/`+e.project.id+`/monitor-config`,{version:e.project.version,enabled:D,timezone:`Asia/Shanghai`,sourceFileId:g||e.monitorConfig?.sourceFileId||null,followLatest:k}),h(`监控配置已保存;未创建日程、未获取新数据`),await a()}catch(e){h(e.message)}finally{d(!1)}},children:`保存日检配置`}),(0,m.jsxs)(`div`,{className:`card`,children:[(0,m.jsx)(`h3`,{children:`独立监控任务 · 发货与售后`}),(0,m.jsx)(`p`,{className:`muted`,children:`在 default 流(上方日检配置)之外,按分支加独立监控流。每条流独立来源、独立缺日判断、独立通知,互不影响。当前仅支持 fulfillment-retention 的两分支。`}),Q.length>0&&(0,m.jsx)(`div`,{children:Q.map(e=>(0,m.jsxs)(`div`,{style:{margin:`6px 0`,padding:6,border:`1px solid var(--omni-line,#294248)`,borderRadius:6},children:[(0,m.jsx)(`b`,{children:e.branch===`inventory`?`库存履约`:`售后回流`}),`(`,e.key,`) · 指标 `,e.metric,` · `,e.enabled?`已启用`:`已关闭`,` · 来源 `,e.sourceName||`缺源`,(0,m.jsx)(`button`,{className:`secondary`,style:{marginLeft:8},disabled:J,onClick:()=>$(e.branch,e.metric,e.sourceFileId||``,!e.enabled),children:e.enabled?`关闭`:`启用`})]},e.id))}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`label`,{children:[`分支`,(0,m.jsxs)(`select`,{value:G,onChange:e=>ee(e.target.value),children:[(0,m.jsx)(`option`,{value:`inventory`,children:`库存履约`}),(0,m.jsx)(`option`,{value:`after-sales`,children:`售后回流`})]})]}),(0,m.jsxs)(`label`,{children:[`监控指标(与导入资料中的指标一致)`,(0,m.jsx)(`input`,{value:K,onChange:e=>te(e.target.value),placeholder:`如 revenue / buyers / refunds`})]}),(0,m.jsxs)(`label`,{children:[`商品ID(开启自动更新必填)`,(0,m.jsx)(`input`,{value:X,onChange:e=>re(e.target.value),placeholder:`如 100000000001`})]}),(0,m.jsxs)(`label`,{style:{flexDirection:`row`,alignItems:`center`,gap:6},children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:Z,onChange:e=>ie(e.target.checked)}),`每日自动更新快照`]}),(0,m.jsxs)(`label`,{children:[`来源快照`,(0,m.jsxs)(`select`,{value:q,onChange:e=>ne(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`选择 project-daily-review-v1 归档`}),e.files.filter(e=>e.name.endsWith(`.json`)).map(e=>(0,m.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,m.jsx)(`button`,{disabled:J||!K,onClick:()=>$(G,K,q,!0),children:`保存并启用此监控任务`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`日检状态历史`}),e.acquisitionJobs.filter(e=>e.type===`monitor-event`).map(e=>(0,m.jsxs)(`p`,{children:[e.targetDay,` · `,e.state,` · `,e.created]},e.id))]})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`监控状态和复用边界`}),(0,m.jsx)(`p`,{children:`默认Asia/Shanghai;配置闭环、指标、范围、单位、起止日。仅分析本项目已归档或导入的快照,不抓平台,不创建调度。缺日、不完整、延迟退款更正需保留版本及理由。`}),(0,m.jsx)(`p`,{children:`方法记录适用商品/渠道/阶段/窗口、样本量、观察时长、成功与失败定义、限制与来源版本;只能形成候选。复用目标条件不匹配会提示,不生成高成功率,不自动执行店铺调整。`})]}),c&&(()=>{try{let e=JSON.parse(c),t=e.snapshots?.length||0,n=e.snapshots?.filter(e=>e.value==null).length||0;return(0,m.jsxs)(`div`,{style:{margin:`10px 0`,padding:10,border:`1px solid var(--omni-line,#294248)`,borderRadius:6,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`当前证据`}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:`4px 0`},children:[`快照 `,t,` 天`,e.config?.start?` `+e.config.start+`~`+e.config.end:``,` · 指标 `,e.config?.metric||`-`,` · 时区 `,e.config?.timezone||`-`,` · 流程 `,e.workflow||`-`]}),n>0&&(0,m.jsxs)(`p`,{className:`muted`,style:{margin:0},children:[`有 `,n,` 天值为空 —— 缺日不能跳过,需补数据或调整窗口`]})]})}catch{return(0,m.jsx)(`p`,{className:`muted`,children:`资料格式无法读取,请检查 JSON 文件格式`})}})(),(0,m.jsxs)(`details`,{style:{margin:`10px 0`},children:[(0,m.jsx)(`summary`,{style:{cursor:`pointer`},children:`手动补充资料(历史数据、外部导出或模拟演示)`}),(0,m.jsx)(`p`,{className:`muted`,children:`自动取数盖不住这些情况时才用:补成本与利润、历史或外部导出数据、不碰真实店铺的模拟测试。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsx)(`button`,{disabled:!e.project.simulated||u,onClick:()=>{l(JSON.stringify(y(e.project.id),null,2)),h(`虚构账本已载入;没有执行记录,不会假称已执行`)},children:`载入缺日模拟快照`}),(0,m.jsx)(`button`,{disabled:!e.project.simulated||!c||u,onClick:()=>{l(JSON.stringify(y(e.project.id,!0),null,2)),h(`已载入明确标记的虚构执行与后窗。请选前次运行并填写反馈再保存。`)},children:`模拟补齐每日快照`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`商品与证据包`,(0,m.jsx)(`textarea`,{"aria-label":`每日复盘证据包`,rows:12,value:c,onChange:e=>l(e.target.value)})]})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次检查`,(0,m.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次诊断/计划`}),se.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.result?.conclusion,` · `,e.created]},e.id))]})]}),x&&(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:C,onChange:e=>w(e.target.value)})]}),(0,m.jsx)(`button`,{disabled:u||n||!c||!!x&&!C.trim(),onClick:ce,children:u?`校验与保存中…`:x?`保存反馈并重评`:`检查每日快照并保存`}),n&&(0,m.jsx)(`p`,{children:`先保存当前其他步骤的编辑。`}),(0,m.jsx)(`p`,{role:`status`,children:f}),T?.result&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`h3`,{children:T.result.conclusion}),(0,m.jsx)(`p`,{children:T.result.causality}),(0,m.jsx)(`pre`,{children:JSON.stringify(T.result,null,2)})]}),(0,m.jsx)(`h3`,{children:`监控历史与待复核`}),se.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.result?.conclusion||t.error,t.savedVersion===e.project.version?``:` · 上游/项目已变更,需复核`,t.skill_version===`1.0.0-local`?``:` · 旧规则需重评`]}),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,t.skill_version,` · SHA256 `,t.input_sha]}),(0,m.jsx)(`pre`,{children:JSON.stringify(t.result,null,2)}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:`读取证据或评审文件`})},t))]},t.id)),(0,m.jsx)(`p`,{children:`所有运行进入项目Wiki的“评审与下一步”版本;保留原件与哈希。建议保留/调整/回滚仅为建议,系统不执行真实变更。`})]})}var S=`1.0.0-local`;function C(e,t=!1){let n=(e,t)=>Array.from({length:7},(n,r)=>({date:`2026-10-${String(e+r).padStart(2,`0`)}`,impressions:1e3,clicks:t,visitors:100,buyers:10,revenue:500,refunds:20,spend:50,variableCost:200})),r={itemId:`fictional-listed-001`,currency:`CNY`,revenueBasis:`gross_paid`,refundBasis:`paid_order_cohort`,costBasis:`ex_ads_ex_refunds`,scope:`全量支付/订单队列退款;非广告归因`,channel:`手机搜索`,device:`mobile`,timezone:`Asia/Shanghai`};return{format:`listed-optimization-v1`,project_id:e,mode:`simulated`,itemId:r.itemId,goal:`ctr`,evidence:{source:`虚构在售商品演练,非平台数据`,collectedAt:`2026-10-29T00:00:00Z`,mode:`simulated`},pre:{...r,start:`2026-10-01`,end:`2026-10-07`,daily:n(1,30)},plan:{changes:[`主图利益点文案`],hypothesis:`虚构假设:明确容量表达可能增加点击`,reason:`仅验证工作流,不证明业务原因`,minDays:7,minDenominator:1e3,stopRule:`贡献减少或退款异常时人工评估停止`},execution:t?{mode:`simulated`,confirmed:!0,actor:`模拟测试角色`,date:`2026-10-08`,change:`主图利益点文案`,proof:`模拟执行记录,未操作店铺`}:null,post:t?{...r,start:`2026-10-09`,end:`2026-10-15`,daily:n(9,35)}:null,confounders:[],refundMature:t}}function w(e){let t=new Date;return t.setDate(t.getDate()+e),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function T({data:e,api:t,dirty:n,onSaved:a,onDirty:o,initialItemId:s=``}){let[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(!1),[f,h]=(0,p.useState)(``),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(s),[k,A]=(0,p.useState)(()=>w(-30)),[j,M]=(0,p.useState)(()=>w(-1)),[N,P]=(0,p.useState)(``),[F,I]=(0,p.useState)(null),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(`pre`);function V(t){let n={};try{n=c?JSON.parse(c):{}}catch{n={}}n.format!==`listed-optimization-v1`&&(n={format:`listed-optimization-v1`,project_id:e.project.id,mode:`manual`,itemId:t.itemId,goal:`cvr`,evidence:t.evidence,pre:null,plan:null,execution:null,post:null,confounders:[],refundMature:!1});let r={...t.sample,start:t.start,end:t.end,daily:t.daily};if(t.window===`post`){let e=n.pre?Object.fromEntries([`itemId`,`currency`,`revenueBasis`,`refundBasis`,`costBasis`,`scope`,`channel`,`device`,`timezone`].map(e=>[e,n.pre[e]])):t.sample;n.post={...e,itemId:t.itemId,start:t.start,end:t.end,daily:t.daily}}else n.pre=r;return n.collectionLast=t.collection,l(JSON.stringify(n,null,2)),t.daily.length}async function H(){R(!0),h(``);try{let n=await t(`/`+e.project.id+`/job`,{kind:`listed-collect`,step:5,version:e.project.version,input:{itemId:String(D).trim(),from:k,to:j,window:z},refs:[]});P(n.id),I({id:n.id,status:`pending`}),h(`取数任务已提交(${z===`post`?`调整后数据`:`调整前数据`}),等待处理,是否完成请查看实际任务记录。`)}catch(e){h(e.message)}finally{R(!1)}}(0,p.useEffect)(()=>{if(!N)return;let n=setInterval(async()=>{try{let r=await t(`/`+e.project.id+`/job/`+N);if(I(r),r.status!==`pending`&&(clearInterval(n),r.status===`done`&&r.result)){let e=V(r.result);h(`已取到 ${r.result.window===`post`?`调整后数据`:`调整前数据`} ${e} 天逐日数据并写入证据包。impressions 与 variableCost 平台无数据,需人工补齐后才能算贡献。`)}}catch{}},4e3);return()=>clearInterval(n)},[N]);let U=e.acquisitionJobs.filter(e=>e.type===`listed-optimization`),W=e=>{try{let t=JSON.parse(c);e(t),l(JSON.stringify(t,null,2))}catch{h(`请先载入或导入证据`)}};async function G(){d(!0);try{let n=await t(`/`+e.project.id+`/listed-optimization`,{run_id:crypto.randomUUID(),version:e.project.version,raw:c,previous_run_id:v||null,feedback:v?{action:`更新执行/观察证据`,observation:b,reason:b}:null});E(n),h(n.status===`done`?n.reused?`返回已有运行,不重复写入`:`证据、评审与Wiki新版本已保存`:n.error),await a()}catch(e){h(e.message)}finally{d(!1)}}return(0,m.jsxs)(`section`,{className:`card`,children:[(0,m.jsxs)(`h2`,{children:[`在售商品优化`,(0,m.jsx)(r,{label:`验证优化效果`,children:`先选择商品和调整前资料,每次明确一个主要改动。复盘时补充实际执行与调整后数据;计划不能当作已执行。`})]}),(0,m.jsx)(i,{data:e,raw:c,disabled:u,onLoad:e=>{l(e),o?.(!0)},format:`listed-optimization-v1`,source:`调整前后同口径数据`,question:`这次想改善点击还是转化?先准备同一商品的调整前数据,再说明只改了什么;执行后再补观察窗口,不能拿计划代替已执行。`},e.project.id),(0,m.jsx)(`p`,{children:`选择商品与目标 → 读取证据 → 诊断假设 → 单变量计划 → 执行记录 → 观察复盘`}),(0,m.jsxs)(`p`,{children:[`版本 `,S,` · `,e.project.simulated?`模拟项目,不能证明真实效果`:`人工资料项目`,`。平台取数已接入(生意参谋逐日);模型语义诊断、店铺执行未接入。`]}),(0,m.jsxs)(`div`,{style:{margin:`14px 0`,padding:12,border:`1px solid var(--omni-line,#294248)`,borderRadius:8,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`平台取数 · 生意参谋`}),(0,m.jsx)(`p`,{className:`muted`,style:{margin:`4px 0 8px`},children:`填本店在售商品ID和前调整后数据日期,自动取逐日收入/访客/买家/退款/广告花费。只能取本店商品,不取竞品。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`label`,{children:[`商品ID(本店在售,纯数字)`,(0,m.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:`如 100000000001`})]}),(0,m.jsxs)(`label`,{children:[`要读取哪个阶段的数据`,(0,m.jsxs)(`select`,{value:z,onChange:e=>B(e.target.value),children:[(0,m.jsx)(`option`,{value:`pre`,children:`调整前数据(变更前)`}),(0,m.jsx)(`option`,{value:`post`,children:`调整后数据(变更后)`})]})]}),(0,m.jsxs)(`label`,{children:[`统计区间(默认近30天)`,(0,m.jsx)(`input`,{type:`date`,value:k,onChange:e=>A(e.target.value)}),` 至 `,(0,m.jsx)(`input`,{type:`date`,value:j,onChange:e=>M(e.target.value)})]})]}),(0,m.jsxs)(`div`,{className:`exports`,children:[(0,m.jsx)(`button`,{disabled:L||!D||!k||!j,onClick:H,children:`从平台取数`}),F&&(0,m.jsxs)(`span`,{className:`muted`,children:[` `,F.id,` · `,F.status===`pending`?`等待执行`:F.status===`done`?`已返回`:F.error||`失败`]})]}),Array.isArray(F?.notes)&&F.notes.length>0&&(0,m.jsx)(`p`,{className:`muted`,children:F.notes.join(`;`)})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`字段、人工判断与观察门槛`}),(0,m.jsx)(`p`,{children:`输入商品ID、目标ctr/cvr/contribution、来源时间、前后逐日数据及渠道设备时区。收入为全量支付毛额,退款按支付订单队列,变动成本不含广告和退款;缺值不能填0。等长窗口、事件日单列。至少7日是资料观察门槛,不是显著性保证。`}),(0,m.jsx)(`p`,{children:`人工确认问题、假设、单一变更、停止条件。执行须有actor/date/change/proof/confirmed及与项目一致的mode;导入的确认只是提交者声明,不是系统验证。未执行保持execution:null,未观察保持post:null。`})]}),c&&(()=>{try{let e=JSON.parse(c),t=e.pre?.daily?.length||0,n=e.post?.daily?.length||0,r=!!e.execution;return(0,m.jsxs)(`div`,{style:{margin:`10px 0`,padding:10,border:`1px solid var(--omni-line,#294248)`,borderRadius:6,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`当前证据`}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:`4px 0`},children:[`调整前数据 `,t,` 天`,e.pre?.start?` `+e.pre.start+`~`+e.pre.end:``,` · 调整后数据 `,n,` 天`,e.post?.start?` `+e.post.start+`~`+e.post.end:``,` · 执行记录:`,r?`已填`:`未填`,` · 目标 `,e.goal||`-`]}),t>0&&(e.pre.daily||[]).every(e=>e.variableCost==null)&&(0,m.jsx)(`p`,{className:`muted`,style:{margin:0},children:`变动成本全为空 —— 贡献类指标算不出来,需先补`})]})}catch{return(0,m.jsx)(`p`,{className:`muted`,children:`资料格式无法读取,请检查 JSON 文件格式`})}})(),(0,m.jsxs)(`details`,{style:{margin:`10px 0`},children:[(0,m.jsx)(`summary`,{style:{cursor:`pointer`},children:`手动补充资料(历史数据、外部导出或模拟演示)`}),(0,m.jsx)(`p`,{className:`muted`,children:`自动取数盖不住这些情况时才用:补变动成本、历史或外部导出数据、不碰真实店铺的模拟测试。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsx)(`button`,{disabled:!e.project.simulated||u,onClick:()=>{l(JSON.stringify(C(e.project.id),null,2)),h(`虚构调整前数据已载入;没有执行记录,不会假称已执行`)},children:`载入虚构调整前数据与计划`}),(0,m.jsx)(`button`,{disabled:!e.project.simulated||!c||u,onClick:()=>{l(JSON.stringify(C(e.project.id,!0),null,2)),h(`已载入明确标记的虚构执行与调整后数据。请选前次运行并填写反馈再保存。`)},children:`模拟补充执行与观察`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`商品与证据包`,(0,m.jsx)(`textarea`,{"aria-label":`在售优化证据包`,rows:12,value:c,onChange:e=>l(e.target.value)})]})]})]}),c&&(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`label`,{children:[`优化目标`,(0,m.jsxs)(`select`,{onChange:e=>W(t=>{t.goal=e.target.value}),defaultValue:`ctr`,children:[(0,m.jsx)(`option`,{value:`ctr`,children:`点击率`}),(0,m.jsx)(`option`,{value:`cvr`,children:`支付转化率`}),(0,m.jsx)(`option`,{value:`contribution`,children:`期间贡献金额`})]})]}),(0,m.jsxs)(`label`,{children:[`单一变更(替换证据包计划变量)`,(0,m.jsx)(`input`,{placeholder:`例如:主图容量表达`,onBlur:e=>{e.target.value&&W(t=>{t.plan={...t.plan,changes:[e.target.value]}})}})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次分析`,(0,m.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次诊断/计划`}),U.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.result?.conclusion,` · `,e.created]},e.id))]})]}),v&&(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:b,onChange:e=>x(e.target.value)})]}),(0,m.jsx)(`button`,{disabled:u||n||!c||!!v&&!b.trim(),onClick:G,children:u?`校验与保存中…`:v?`保存反馈并重评`:`检查证据并保存计划`}),n&&(0,m.jsx)(`p`,{children:`先保存当前其他步骤的编辑。`}),(0,m.jsx)(`p`,{role:`status`,children:f}),T?.result&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`h3`,{children:T.result.conclusion}),(0,m.jsx)(`p`,{children:T.result.causality}),(0,m.jsx)(`pre`,{children:JSON.stringify(T.result,null,2)})]}),(0,m.jsx)(`h3`,{children:`优化历史与待复核`}),U.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.result?.conclusion||t.error,t.savedVersion===e.project.version?``:` · 上游/项目已变更,需复核`,t.skill_version===`1.0.0-local`?``:` · 旧规则需重评`]}),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,t.skill_version,` · SHA256 `,t.input_sha]}),(0,m.jsx)(`pre`,{children:JSON.stringify(t.result,null,2)}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:`读取证据或评审文件`})},t))]},t.id)),(0,m.jsx)(`p`,{children:`所有运行进入项目Wiki的“评审与下一步”版本;保留原件与哈希。建议保留/调整/回滚仅为建议,系统不执行真实变更。`})]})}var E=`1.0.0-local`;function D(e,t=!1){function n(e,t,n){return{start:e,end:t,currency:`CNY`,unit:`yuan`,timezone:`Asia/Shanghai`,scope:{type:`item`,id:`fictional-cup`},revenueBasis:`gross_paid`,refundBasis:`paid_order_cohort`,costPolicy:`六类费用互斥;不含退款及固定成本`,taxPolicy:`已提供本范围实际税费;不推算税率`,source:{name:`虚构商品账本,非真实账务`,at:`2026-10-29T00:00:00Z`,mode:`simulated`},complete:!0,refundMature:!0,orders:[{id:`order-`+e,date:e,gross:`10000.00`}],refunds:[{id:`refund-`+e,orderId:`order-`+e,date:t,amount:`1000.00`}],costs:[`product`,`fulfillment`,`platform`,`ads`,`tax`,`other`].map((r,i)=>({kind:r,amount:[`4000.00`,`500.00`,`300.00`,n,`200.00`,`0.00`][i],start:e,end:t,scopeId:`fictional-cup`,proof:`虚构凭证-`+r})),fixed:{method:`allocated_pool`,pool:`1000.00`,numerator:1,denominator:2,basis:`本商品占用工时/全店工时`,proof:`虚构分摊记录`,start:e,end:t},settlement:{basis:`same_order_cohort`,scopeId:`fictional-cup`,start:e,end:t,opening:`0.00`,withheld:`300.00`,received:`8000.00`,closing:`700.00`,proof:`虚构结算账单;扣留仅用于现金勾稽`}}}return{format:`operating-reconciliation-v1`,project_id:e,mode:`simulated`,evidence:{source:`本地模拟经营核算数据,所有金额虚构`,collectedAt:`2026-10-29T00:00:00Z`},before:n(`2026-10-01`,`2026-10-07`,`1500.00`),plan:{action:`收缩低效广告支出`,reason:`假设同等收入下减少广告费`,expected:`广告费用1500降至1000;不预设真实销量保持`,stopRule:`收入或贡献下降时人工复核停止`},execution:t?{mode:`simulated`,confirmed:!0,actor:`模拟测试角色`,date:`2026-10-08`,action:`收缩低效广告支出`,proof:`仅虚构执行记录,未操作投放`}:null,after:t?n(`2026-10-09`,`2026-10-15`,`1000.00`):null}}function O({data:e,api:t,dirty:n,onSaved:a,onDirty:o}){let[s,c]=(0,p.useState)(``),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(``),[h,g]=(0,p.useState)(``),[_,v]=(0,p.useState)(``),[y,b]=(0,p.useState)(``),[x,S]=(0,p.useState)(null),C=e.acquisitionJobs.filter(e=>e.type===`operating-reconciliation`);async function w(){u(!0);try{let n=await t(`/`+e.project.id+`/operating-reconciliation`,{run_id:crypto.randomUUID(),version:e.project.version,raw:s,previous_run_id:_||null,feedback:_?{action:`更新执行/观察证据`,observation:y,reason:y}:null});S(n),f(n.status===`done`?n.reused?`返回已有运行,不重复写入`:`证据、评审与Wiki新版本已保存`:n.error),await a()}catch(e){f(e.message)}finally{u(!1)}}return(0,m.jsxs)(`section`,{className:`card`,children:[(0,m.jsxs)(`h2`,{children:[`经营核算与复盘`,(0,m.jsx)(r,{label:`核对经营账目`,children:`导入同一周期的收入、退款和成本资料,核对金额口径后保存。模拟账本只用于演示;未计入的费用需要单独说明。`})]}),(0,m.jsx)(i,{data:e,raw:s,disabled:l,onLoad:e=>{c(e),o?.(!0)},format:`operating-reconciliation-v1`,source:`财务账本或结算明细`,question:`核算哪个商品、哪个周期?请向财务确认收入、退款、货品成本、运费、广告、税费和固定分摊。金额缺失保留空值,不按零处理。`},e.project.id),(0,m.jsx)(`p`,{children:`确定核算范围 → 读取收入退款成本 → 核对账目并计算 → 调整计划 → 执行记录 → 同口径复盘`}),(0,m.jsxs)(`p`,{children:[`版本 `,E,` · `,e.project.simulated?`模拟项目,不能证明真实效果`:`人工资料项目`,`。本闭环仅本地归档分析;平台实时取数、模型语义诊断、店铺执行均未接入。`]}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsx)(`button`,{disabled:!e.project.simulated||l,onClick:()=>{c(JSON.stringify(D(e.project.id),null,2)),f(`虚构账本已载入;没有执行记录,不会假称已执行`)},children:`载入虚构账本与计划`}),(0,m.jsx)(`button`,{disabled:!e.project.simulated||!s||l,onClick:()=>{c(JSON.stringify(D(e.project.id,!0),null,2)),f(`已载入明确标记的虚构执行与后窗。请选前次运行并填写反馈再保存。`)},children:`模拟补充执行与观察`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`核算口径与金额说明`}),(0,m.jsx)(`p`,{children:`元字符串最多2位小数,缺项不补0。支付毛额与订单队列退款分开。成本明确货品、履约、平台、广告、税费及其他;固定成本单列分摊。成交不等于结算,结算只勾稽,不再次扣利润。`}),(0,m.jsx)(`p`,{children:`贡献=毛额−退款−非税变动成本;经营结余=贡献−税费−固定分摊。非财务净利润,税费及分摊仍需人工确认。`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`商品与证据包`,(0,m.jsx)(`textarea`,{"aria-label":`经营核算证据包`,rows:12,value:s,onChange:e=>c(e.target.value)})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次核算`,(0,m.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次诊断/计划`}),C.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.result?.conclusion,` · `,e.created]},e.id))]})]}),_&&(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:y,onChange:e=>b(e.target.value)})]}),(0,m.jsx)(`button`,{disabled:l||n||!s||!!_&&!y.trim(),onClick:w,children:l?`校验与保存中…`:_?`保存反馈并重评`:`核对账目并保存计划`}),n&&(0,m.jsx)(`p`,{children:`先保存当前其他步骤的编辑。`}),(0,m.jsx)(`p`,{role:`status`,children:d}),x?.result&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`h3`,{children:x.result.conclusion}),(0,m.jsx)(`p`,{children:x.result.causality}),(0,m.jsx)(`pre`,{children:JSON.stringify(x.result,null,2)})]}),(0,m.jsx)(`h3`,{children:`核算历史与待复核`}),C.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.result?.conclusion||t.error,t.savedVersion===e.project.version?``:` · 上游/项目已变更,需复核`,t.skill_version===`1.0.0-local`?``:` · 旧规则需重评`]}),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,t.skill_version,` · SHA256 `,t.input_sha]}),(0,m.jsx)(`pre`,{children:JSON.stringify(t.result,null,2)}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:`读取证据或评审文件`})},t))]},t.id)),(0,m.jsx)(`p`,{children:`所有运行进入项目Wiki的“评审与下一步”版本;保留原件与哈希。建议保留/调整/回滚仅为建议,系统不执行真实变更。`})]})}var k=`1.0.0-local`;function A(e,t=!1){return{format:`fulfillment-retention-v1`,project_id:e,run_id:null,mode:`simulated`,schema_version:`v1`,skill_version:k,timezone:`Asia/Shanghai`,as_of:`2026-11-01`,window_start:`2026-10-01`,window_end:`2026-10-31`,collected_at:`2026-11-01T00:00:00Z`,source_files:[],source_verification:`脱敏合成 fixture,仅规则验收,非真实经营`,inventory:{skus:[{sku_id:`A`,warehouse_id:`W1`,snapshot_at:`2026-10-31`,sellable_mode:`derived`,on_hand:100,reserved:30,unsellable:10,pending_inspection:4,inbound_qty:20,inbound_eta_known:t,batch_age:12,sellable_definition:`总在库-预占-不可售`}]},replenish:t?{units_sold:70,demand_window_days:7,lead_time:5,review_cycle:2,safety_stock:20,available:60,confirmed_inbound:20,pack_multiple:10,moq:10,budget_cap:5e3,unit_cost:12}:{units_sold:70,demand_window_days:7,lead_time:null,review_cycle:2,safety_stock:20,available:60,confirmed_inbound:null,pack_multiple:10},orders:t?{observed_at:`2026-11-01`,lines:[{line_id:`L1`,order_id:`O1`,sku_id:`A`,qty:5,promise_ship_at:`2026-10-28`,cancel_status:null,shipped_qty:5,shipped_at:`2026-10-27`},{line_id:`L2`,order_id:`O2`,sku_id:`A`,qty:3,promise_ship_at:`2026-10-29`,cancel_status:null,shipped_qty:0,shipped_at:null},{line_id:`L3`,order_id:`O3`,sku_id:`A`,qty:2,promise_ship_at:`2026-10-30`,cancel_status:`cancelled`,shipped_qty:0,shipped_at:null}]}:{observed_at:`2026-11-01`,lines:[]},refunds:t?{view:`success`,denominator:100,list:[{ticket_id:`T1`,order_id:`O10`,cohort_key:`C10`,reason_raw:`色差`,reason_std:`视觉描述不符`,reason_manual:`unknown`,applied_at:`2026-10-20`,success_at:`2026-10-25`,amount:88,currency:`CNY`,status:`success`},{ticket_id:`T2`,order_id:`O10`,cohort_key:`C10`,reason_raw:`色差补寄`,reason_std:`视觉描述不符`,reason_manual:`unknown`,applied_at:`2026-10-21`,success_at:`2026-10-25`,amount:0,currency:`CNY`,status:`success`}]}:{view:`success`,denominator:500,list:[]},retention:t?{eligible_count:200,repurchase_event_keys:[`C1`,`C2`,`C2`,`C3`],matured:!0,observed_deadline:`2026-11-30`}:{eligible_count:200,repurchase_event_keys:[],matured:!1,observed_deadline:null}}}function j(e){return A(e,!0)}function M({data:e,api:t,onSaved:n,dirty:a,onDirty:o}){let[s,c]=(0,p.useState)(``),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(``),[h,g]=(0,p.useState)(null),[_,v]=(0,p.useState)(``),[y,b]=(0,p.useState)(``),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(``),T=(e.acquisitionJobs||[]).filter(e=>e.type===`fulfillment-retention`);async function E(){u(!0),f(`正在本地校验与情景计算`);try{let r=await t(`/`+e.project.id+`/fulfillment-retention`,{run_id:crypto.randomUUID(),version:e.project.version,raw:s,previous_run_id:_||null,feedback:_?{action:y,observation:x,reason:C}:null});g(r),f(r.status===`done`?r.reused?`相同输入已运行,返回原记录`:`证据、评审与Wiki新版本已保存`:r.error),await n()}catch(e){f(e.message)}finally{u(!1)}}let D=s?(()=>{try{let e=JSON.parse(s),t=e.inventory?.skus?.length||0,n=+!!e.replenish,r=e.orders?.lines?.length||0,i=e.refunds?.list?.length||0,a=+!!e.retention;return(0,m.jsxs)(`div`,{style:{margin:`10px 0`,padding:10,border:`1px solid var(--omni-line,#294248)`,borderRadius:6,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`当前证据`}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:`4px 0`},children:[`库存 SKU `,t,` 个 · 补货参数 `,n?`已填`:`缺`,` · 订单行 `,r,` · 退款工单 `,i,` · 回流队列 `,a?`已填`:`缺`]}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:0},children:[`as_of `,e.as_of||`-`,` · 区间 `,e.window_start||`-`,` ~ `,e.window_end||`-`,` · 模式 `,e.mode]})]})}catch{return(0,m.jsx)(`p`,{className:`muted`,children:`资料格式无法读取,请检查 JSON 文件格式`})}})():null;return(0,m.jsxs)(`section`,{className:`card`,style:{marginBottom:20},children:[(0,m.jsxs)(`h2`,{children:[`库存、发货与售后复盘`,(0,m.jsx)(r,{label:`库存与售后分析`,children:`导入库存、订单和售后资料,查看缺项和预估结果。这里只分析和保存,不会采购、退款、发消息或修改库存。`})]}),(0,m.jsx)(i,{data:e,raw:s,disabled:l,onLoad:e=>{c(e),o?.(!0)},format:`fulfillment-retention-v1`,source:`ERP、订单、售后工单或 CRM 导出`,question:`要判断缺货、补货还是售后回流?请提供对应库存、订单或工单资料及统计日期。仅使用聚合或假名数据,不填写客户姓名、电话和地址。`},e.project.id),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,k,` · `,e.project.simulated?`模拟项目`:`人工资料项目`,` · 两条并行分支,共用证据·计划·执行·观察·复盘。`]}),(0,m.jsx)(`p`,{children:`本地确定性校验与情景计算;不自动采购、不自动退款、不发消息、不改库存。`}),D,(0,m.jsx)(`div`,{className:`two`,children:(0,m.jsx)(`button`,{disabled:l||!e.project.simulated,onClick:()=>{c(JSON.stringify(j(e.project.id),null,2)),f(`已载入虚构演示资料:仅规则验收,非经营结果。`)},children:`载入虚构演示资料`})}),(0,m.jsxs)(`details`,{style:{margin:`10px 0`},children:[(0,m.jsx)(`summary`,{style:{cursor:`pointer`},children:`手工补充与兜底(ERP/工单导出、历史数据、直接改字段)`}),(0,m.jsx)(`p`,{className:`muted`,children:`库存、订单、退款、复购字段来自 ERP/工单/CRM 导出,平台没有;只收聚合或假名数据。散列≠匿名,仍按受限资料处理。`}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`证据包内容`,(0,m.jsx)(`textarea`,{"aria-label":`履约回流证据包`,rows:14,value:s,onChange:e=>c(e.target.value)})]})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次分析`,(0,m.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次评审`}),T.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.created,` · `,e.result?.conclusion]},e.id))]})]}),_&&(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:y,onChange:e=>b(e.target.value),placeholder:`动作(如:调整补货安全量)/观察(如:缺货天数)/理由`})]})}),(0,m.jsx)(`button`,{disabled:l||a||!s.trim(),onClick:E,children:l?`运行中…`:_?`保存反馈并重新评审`:`检查资料并计算预估结果`}),a&&(0,m.jsx)(`p`,{children:`先保存当前步骤修改,避免覆盖未保存内容。`}),(0,m.jsx)(`p`,{role:`status`,children:d}),h?.result&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`strong`,{children:h.result.conclusion}),Array.isArray(h.result.issues)&&h.result.issues.filter(e=>e.level===`block`||e.level===`missing`).map(e=>(0,m.jsxs)(`p`,{style:{color:`var(--omni-danger,#ffabae)`},children:[`⚠ `,e.key,`:`,e.message]},e.key+String(e.message))),(0,m.jsx)(`h4`,{children:`情景计算结果`}),h.result.inventory?.length>0&&(0,m.jsxs)(`p`,{className:`muted`,children:[`可售:`,h.result.inventory.map(e=>`${e.sku}=${e.available??`缺`}${e.negative?`(负!)`:``}`).join(`,`),h.result.inventory.some(e=>e.pendingInspection!=null)?` · 待检独立`:` · 无待检`]}),h.result.replenish&&(0,m.jsxs)(`p`,{className:`muted`,children:[`补货:需求率 `,h.result.replenish.rate??`—`,` · 净需求 `,h.result.replenish.net??`—`,` · 建议量 `,h.result.replenish.suggested??`未生成(缺参数)`]}),h.result.fulfillment&&(0,m.jsxs)(`p`,{className:`muted`,children:[`履约:分母 `,h.result.fulfillment.denominator,` · 超时 `,h.result.fulfillment.overdue,` · 超时率 `,h.result.fulfillment.rate==null?`—`:(h.result.fulfillment.rate*100).toFixed(1)+`%`]}),h.result.refunds&&(0,m.jsxs)(`p`,{className:`muted`,children:[`退款:`,h.result.refunds.view,` 口径 · 去重订单 `,h.result.refunds.distinctOrders,` · 发生率 `,h.result.refunds.rate==null?`—`:(h.result.refunds.rate*100).toFixed(2)+`%`]}),h.result.retention&&(0,m.jsxs)(`p`,{className:`muted`,children:[`复购:合格 `,h.result.retention.eligible,` · 复购 `,h.result.retention.repurchased,` · 率 `,h.result.retention.rate==null?`未成熟/不可算`:(h.result.retention.rate*100).toFixed(2)+`%`]}),Array.isArray(h.result.nextActions)&&h.result.nextActions.length>0&&(0,m.jsxs)(`p`,{className:`muted`,children:[`下一步:`,h.result.nextActions.join(`;`)]})]}),(0,m.jsx)(`h3`,{children:`本项目运行历史`}),T.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.status,` · `,t.result?.conclusion||t.error,t.skill_version===`1.0.0-local`?``:` · 旧规则版本,需重新评审`,t.savedVersion===e.project.version?``:` · 项目版本已变化,需复核`]}),(0,m.jsxs)(`p`,{children:[`运行 `,t.id,` · 分析方法版本 `,t.skill_version,` · 证据SHA256 `,t.input_sha]}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsxs)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:[`读取原始证据/评审产物 `,t]})},t)),(0,m.jsx)(`pre`,{children:JSON.stringify({gates:t.result?.gates,issues:t.result?.issues?.slice(0,20),nextActions:t.result?.nextActions,feedback:t.feedback},null,2)})]},t.id)),(0,m.jsx)(`p`,{className:`muted`,children:`人工判断:库存口径与身份、承诺时点、退款责任证据、复购许可、采购审批。规则计算不证明真实经营改善。`})]})}var N={dashboard:_,monitor:x,optimization:T,finance:O,fulfillment:M};function P({section:e,project:t}){let n=N[e];return(0,m.jsx)(`div`,{className:`products-module wb-legacy-tools`,onChangeCapture:e=>{e.target.matches(`input:not([type=checkbox]),textarea`)&&t.onDirty(!0)},children:n&&(0,m.jsx)(n,{...t},t.projectId)})}export{_ as DashboardPanel,O as FinancePanel,M as FulfillmentPanel,x as MonitorPanel,T as OptimizationPanel,P as default};
1
+ import{g as e,o as t,y as n}from"./index-DLSVWUSu.js";import{t as r}from"./HelpTip-BqRBO41J.js";import{t as i}from"./EvidenceSourceGuide-B1AJCZm2.js";import{_ as a,n as o,nt as s,o as c,r as l}from"./CartesianChart-CP7p2vlm.js";import{n as u,r as d,t as f}from"./LineChart-Ckvg5wfQ.js";var p=n(e(),1),m=t(),h=[`var(--omni-chart-teal)`,`var(--omni-danger)`,`var(--omni-chart-primary)`,`var(--omni-chart-orange)`,`var(--omni-chart-secondary)`,`var(--omni-accent)`,`var(--omni-warning)`],g=(e,t)=>{if(e==null)return`—`;let n=Number(e);return Number.isFinite(n)?t===`%`?n.toFixed(2)+`%`:Math.abs(n)>=1e4?(n/1e4).toFixed(2)+`万`:n.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):String(e)};function _({data:e,api:t,onPrepare:n}){let[i,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(``),[w,T]=(0,p.useState)(!1),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(``),[A,j]=(0,p.useState)(null);async function M(){x(!0),C(``);try{let n=await t(`/`+e.project.id+`/dashboard`);_(n),n.metrics?.length&&!v&&y(n.metrics[0].key||n.metrics[0].metric),n.metrics?.length||C(`本项目还没有可展示的已保存的数据。请先检查数据中心的导入状态与现有资料。`)}catch(e){C(e.message)}finally{x(!1)}}(0,p.useEffect)(()=>{M()},[e.project.id]);let N=(0,p.useMemo)(()=>i?.metrics?.find(e=>(e.key||e.metric)===v)||i?.metrics?.[0]||null,[i,v]),P=(0,p.useMemo)(()=>N?N.points.map(e=>({date:e.date,value:e.value})):[],[N]),F=(0,p.useMemo)(()=>i?.metrics?.filter(e=>E.includes(e.key||e.metric))||[],[i,E]),I=(0,p.useMemo)(()=>new Set(F.map(e=>String(e.unit||``))),[F]),L=I.size<=1,R=(0,p.useMemo)(()=>{if(!w||!F.length)return[];let e=new Map;for(let t of F){let n=Math.max(...t.points.map(e=>Math.abs(Number(e.value)||0)),1);for(let r of t.points)e.has(r.date)||e.set(r.date,{date:r.date}),e.get(r.date)[t.key||t.metric]=r.value===null?null:L?Number(r.value):+(Number(r.value)/n*100).toFixed(1)}return[...e.values()].sort((e,t)=>e.date.localeCompare(t.date))},[w,F,L]);function z(e){D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}return(0,m.jsxs)(`section`,{className:`card`,style:{marginBottom:20},children:[!i?.metrics?.length&&n&&(0,m.jsxs)(`p`,{children:[(0,m.jsx)(`button`,{onClick:n,children:`查看本项目资料与导入状态`}),(0,m.jsx)(`span`,{children:` 这里只展示已归档资料;没有资料不补零、不生成示例。`})]}),(0,m.jsxs)(`h2`,{children:[`经营指标看板`,(0,m.jsx)(r,{label:`理解指标`,children:`先核对来源、统计日期和单位。不同单位的指标对比会缩放为相对趋势,不能据此比较金额或人数大小。`})]}),(0,m.jsx)(`p`,{className:`muted`,children:`从专用数据库读取项目指标与对比数据。同口径、同日期取最新采集值;缺失值保留空档。`}),(0,m.jsxs)(`div`,{className:`exports`,children:[(0,m.jsx)(`button`,{disabled:b,onClick:M,children:b?`读取中…`:`刷新看板`}),(0,m.jsx)(`button`,{className:w?``:`secondary`,onClick:()=>{T(!w),!w&&!E.length&&i?.metrics?.length&&D(i.metrics.slice(0,2).map(e=>e.key||e.metric))},children:w?`退出多指标对比`:`多指标对比`}),i&&(0,m.jsxs)(`span`,{className:`muted`,children:[` 指标 `,i.metrics?.length||0,` 个 · 源文件 `,i.files||0,` 个 · 区间 `,i.range?`${i.range.start} ~ ${i.range.end}`:`—`]})]}),S&&(0,m.jsx)(`p`,{role:`status`,children:S}),i?.metrics?.length>0&&(0,m.jsxs)(m.Fragment,{children:[w?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`muted`,style:{margin:`10px 0`},children:L?`同单位叠加:选中指标均为 ${Array.from(I)[0]||`-`},直接同轴比较绝对值。`:`混合单位叠加(${Array.from(I).join(` / `)||`-`}):已按各自最大值归一到 0–100,只比走势方向,不能比绝对值。`}),(0,m.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`10px 0`},children:i.metrics.map((e,t)=>{let n=e.key||e.metric,r=E.includes(n);return(0,m.jsx)(`button`,{onClick:()=>z(n),style:{padding:`4px 10px`,borderRadius:14,fontSize:12,cursor:`pointer`,border:`1px solid `+(r?h[t%h.length]:`var(--omni-line)`),background:r?`var(--omni-selected,var(--omni-panel,#193954))`:`var(--omni-panel,var(--omni-panel,#102235))`,color:`var(--omni-text,var(--omni-text,#dceaf7))`},children:e.name},n)})}),F.length===0?(0,m.jsx)(`p`,{className:`muted`,children:`请至少选择一个指标。`}):(0,m.jsx)(`div`,{style:{width:`100%`,height:300},children:(0,m.jsx)(s,{children:(0,m.jsxs)(f,{data:R,margin:{top:8,right:16,bottom:8,left:8},children:[(0,m.jsx)(c,{strokeDasharray:`3 3`,stroke:`var(--omni-line)`}),(0,m.jsx)(l,{dataKey:`date`,tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,interval:`preserveStartEnd`,minTickGap:16}),(0,m.jsx)(o,{tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,width:56,domain:L?[`auto`,`auto`]:[0,100],tickFormatter:L?(e=>g(e,Array.from(I)[0]||``)):void 0}),(0,m.jsx)(a,{}),(0,m.jsx)(d,{wrapperStyle:{fontSize:12}}),F.map((e,t)=>(0,m.jsx)(u,{type:`monotone`,dataKey:e.key||e.metric,name:e.name,stroke:h[t%h.length],strokeWidth:2,dot:!1,connectNulls:!1,isAnimationActive:!1},e.key||e.metric))]})})})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill,minmax(170px,1fr))`,gap:10,margin:`14px 0`},children:i.metrics.map(e=>{let t=e.key||e.metric,n=e.points||[],r=n[n.length-1],i=n[n.length-2],a=r?.value!=null&&i?.value!=null?r.value-i.value:null,o=a==null||![`higher`,`lower`].includes(e.direction)?null:e.direction===`higher`?a>0:a<0;return(0,m.jsxs)(`div`,{onClick:()=>y(t),style:{cursor:`pointer`,padding:10,borderRadius:8,border:v===t?`2px solid var(--omni-accent,var(--omni-line,#61d3df))`:`1px solid var(--omni-line,var(--omni-line,#2c435b))`,background:`var(--omni-panel)`},children:[(0,m.jsxs)(`div`,{style:{fontSize:12,color:`var(--omni-muted)`},children:[e.name,e.scope?(0,m.jsxs)(`span`,{title:e.scope,style:{color:`var(--omni-muted,var(--omni-muted,#91a9bd))`},children:[` · `,/^[0-9a-f]{8}-/i.test(e.scope)?`范围 `+e.scope.slice(0,8):e.scope]}):null]}),(0,m.jsxs)(`div`,{style:{fontSize:20,fontWeight:600,margin:`2px 0`},children:[g(r?.value,e.unit),(0,m.jsx)(`span`,{style:{fontSize:12,color:`var(--omni-muted)`,marginLeft:4},children:e.unit===`%`?``:e.unit})]}),(0,m.jsx)(`div`,{style:{fontSize:12,color:o===null?`var(--omni-muted)`:o?`var(--omni-success)`:`var(--omni-danger)`},children:a===null?`暂无可比值`:`${a>0?`+`:``}${g(a,e.unit)} 较上一观测日`}),(0,m.jsxs)(`div`,{style:{fontSize:11,color:`var(--omni-muted)`,marginTop:2},children:[e.count,` 天 · `,r?.date||`-`]})]},t)})}),N&&(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsxs)(`div`,{className:`section-title`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`eyebrow`,children:N.metric}),(0,m.jsxs)(`h3`,{children:[N.name,` · 走势`]})]}),(0,m.jsxs)(`span`,{className:`muted`,children:[N.count,` 个数据点 · 单位 `,N.unit,` · `,N.direction===`higher`?`越高越好`:N.direction===`lower`?`越低越好`:`方向待核`]})]}),(0,m.jsx)(`div`,{style:{width:`100%`,height:280},children:(0,m.jsx)(s,{children:(0,m.jsxs)(f,{data:P,margin:{top:8,right:16,bottom:8,left:8},children:[(0,m.jsx)(c,{strokeDasharray:`3 3`,stroke:`var(--omni-line)`}),(0,m.jsx)(l,{dataKey:`date`,tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,interval:`preserveStartEnd`,minTickGap:16}),(0,m.jsx)(o,{tick:{fontSize:11,fill:`var(--omni-muted)`},stroke:`var(--omni-line)`,width:56,tickFormatter:e=>g(e,N.unit)}),(0,m.jsx)(a,{formatter:e=>[g(e,N.unit),N.name],labelFormatter:e=>`日期 `+e}),(0,m.jsx)(u,{type:`monotone`,dataKey:`value`,stroke:`var(--omni-chart-teal)`,strokeWidth:2,dot:{r:2},connectNulls:!1,isAnimationActive:!1})]})})})]})]}),(0,m.jsxs)(`details`,{style:{marginTop:12},children:[(0,m.jsxs)(`summary`,{children:[`指标来源文件(`,i.files,` 个)`]}),i.metrics.map(t=>(0,m.jsxs)(`div`,{style:{margin:`6px 0`},children:[(0,m.jsxs)(`b`,{children:[t.name,`(`,t.metric,`)`]}),t.files.map(t=>(0,m.jsx)(`p`,{className:`muted`,style:{margin:`2px 0 2px 12px`},children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t.id,children:t.name})},t.id))]},t.key||t.metric))]}),(0,m.jsx)(`p`,{className:`muted`,children:`看板只做展示与描述统计,不判断因果;缺日不插值,单位差异不做换算。`})]}),(i?.datasets?.length||0)>0&&(()=>{let e=i.datasets.find(e=>e.fileId===O)||i.datasets[0],t=e.columns||[],n=[...e.rows];if(A){let e=t.find(e=>e.key===A.key);n.sort((t,n)=>{let r=t[A.key],i=n[A.key];if(e?.type===`text`)return A.desc?String(i??``).localeCompare(String(r??``)):String(r??``).localeCompare(String(i??``));let a=Number(r),o=Number(i);return!Number.isFinite(a)&&!Number.isFinite(o)?0:Number.isFinite(a)?Number.isFinite(o)?A.desc?o-a:a-o:-1:1})}let r=(e,t)=>{if(e==null||e===``)return`—`;if(t.type===`percent`){let t=Number(e);return Number.isFinite(t)?(t*100).toFixed(2)+`%`:String(e)}if(t.type===`number`){let t=Number(e);return Number.isFinite(t)?t.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):String(e)}return String(e)};return(0,m.jsxs)(`div`,{style:{marginTop:24,paddingTop:20,borderTop:`2px solid var(--omni-line)`},children:[(0,m.jsxs)(`div`,{className:`section-title`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`eyebrow`,children:`STRUCTURED COMPARISON`}),(0,m.jsx)(`h2`,{children:`数据明细对比`})]}),(0,m.jsxs)(`span`,{className:`muted`,children:[`数据集 `,i.datasets.length,` 个`]})]}),i.datasets.length>1&&(0,m.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`10px 0`},children:i.datasets.map(t=>(0,m.jsx)(`button`,{className:t.fileId===e.fileId?``:`secondary`,onClick:()=>{k(t.fileId),j(null)},children:t.title},t.fileId))}),(0,m.jsxs)(`div`,{className:`section-title`,style:{marginTop:8},children:[(0,m.jsx)(`div`,{children:(0,m.jsx)(`h3`,{children:e.title})}),(0,m.jsxs)(`span`,{className:`muted`,children:[e.window?`窗口 ${e.window} · `:``,n.length,` 行`,e.kind?` · ${e.kind}`:``]})]}),e.note&&(0,m.jsx)(`p`,{className:`hint`,children:e.note}),(0,m.jsx)(`div`,{style:{overflowX:`auto`},children:(0,m.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:13},children:[(0,m.jsx)(`thead`,{children:(0,m.jsx)(`tr`,{children:t.map(e=>(0,m.jsxs)(`th`,{onClick:()=>j(t=>t&&t.key===e.key?{key:e.key,desc:!t.desc}:{key:e.key,desc:!0}),style:{cursor:`pointer`,textAlign:e.type===`text`?`left`:`right`,padding:`8px 10px`,borderBottom:`2px solid var(--omni-line)`,whiteSpace:`nowrap`,userSelect:`none`},children:[e.label,e.unit?`(${e.unit})`:``,A&&A.key===e.key?A.desc?` ▼`:` ▲`:``]},e.key))})}),(0,m.jsx)(`tbody`,{children:n.map((e,n)=>(0,m.jsx)(`tr`,{style:{background:(n%2,`var(--omni-panel)`)},children:t.map(t=>(0,m.jsx)(`td`,{style:{padding:`7px 10px`,textAlign:t.type===`text`?`left`:`right`,borderBottom:`1px solid var(--omni-line)`,color:t.direction===`lower`&&Number(e[t.key])>0?`var(--omni-danger)`:void 0},children:r(e[t.key],t)},t.key))},n))}),e.totals&&(0,m.jsx)(`tfoot`,{children:(0,m.jsx)(`tr`,{style:{fontWeight:600,background:`var(--omni-panel)`},children:t.map((t,n)=>(0,m.jsx)(`td`,{style:{padding:`8px 10px`,textAlign:t.type===`text`?`left`:`right`,borderTop:`2px solid var(--omni-line)`},children:n===0?`合计`:e.totals[t.key]===void 0?``:r(e.totals[t.key],t)},t.key))})})]})}),(0,m.jsx)(`p`,{className:`muted`,style:{marginTop:8},children:`点表头可排序。数据来自本项目归档的 analysis-dataset-v1 数据集,不插值、不换算单位。`})]})})()]})}var v=`1.0.0-local`;function y(e,t=!1){return{format:`project-daily-review-v1`,project_id:e,mode:`simulated`,workflow:`operating-reconciliation`,evidence:{source:`虚构每日核算快照`,collectedAt:`2026-10-29T00:00:00Z`},config:{timezone:`Asia/Shanghai`,metric:`specifiedCostProfit`,scope:`fictional-cup`,unit:`CNY`,direction:`higher`,start:`2026-10-01`,end:`2026-10-03`},snapshots:(t?[1,2,3]:[1,3]).map(t=>({date:`2026-10-0${t}`,project_id:e,workflow:`operating-reconciliation`,mode:`simulated`,scope:`fictional-cup`,unit:`CNY`,source:`虚构归档账本`,collectedAt:`2026-10-29T00:00:00Z`,complete:!0,version:1,value:200+t*10})),method:{name:`降低低效广告支出候选`,version:`candidate-1`,productType:`虚构杯具`,channel:`搜索`,stage:`在售`,window:`7日`,sampleSize:0,observationDays:3,successDefinition:`足窗同口径贡献增加且退款不恶化`,failureDefinition:`贡献下降或退款恶化`,limits:`模拟、无对照、样本不足`,sourceRun:`虚构核算示例`,failures:[`模拟缺日分支`]}}}function b(e){let t=new Date;return t.setDate(t.getDate()+e),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function x({data:e,api:t,dirty:n,onSaved:a,onDirty:o,initialItemId:s=``}){let[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(!1),[f,h]=(0,p.useState)(``),[g,_]=(0,p.useState)(``),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(e.monitorConfig?.enabled||!1),[k,A]=(0,p.useState)(e.monitorConfig?.followLatest||!1),[j,M]=(0,p.useState)(s),[N,P]=(0,p.useState)(()=>b(-30)),[F,I]=(0,p.useState)(()=>b(-1)),[L,R]=(0,p.useState)(`revenue`),[z,B]=(0,p.useState)(``),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(!1),[G,ee]=(0,p.useState)(`inventory`),[K,te]=(0,p.useState)(`revenue`),[q,ne]=(0,p.useState)(``),[J,Y]=(0,p.useState)(!1),[X,re]=(0,p.useState)(``),[Z,ie]=(0,p.useState)(!1),Q=e.monitorStreams||[];async function $(n,r,i,o){Y(!0),h(``);try{let s=n+`-`+r;await t(`/`+e.project.id+`/monitor-stream`,{version:e.project.version,key:s,enabled:o,timezone:`Asia/Shanghai`,workflow:`fulfillment-retention`,branch:n,metric:r,scope:null,sourceFileId:i||null,followLatest:!1,itemId:String(X).trim()||null,autoUpdate:Z}),h(`命名流 ${n}(${r})已保存${o?`并启用`:`并关闭`};未创建日程、未获取新数据`),await a()}catch(e){h(e.message)}finally{Y(!1)}}async function ae(n){let r=JSON.stringify(n,null,2),i=new TextEncoder().encode(r),a=``;for(let e of i)a+=String.fromCharCode(e);let o=`每日快照-${n.config.metric}-${n.config.start}_${n.config.end}.json`;return(await t(`/`+e.project.id+`/file`,{name:o,kind:`analysis`,source:`生意参谋逐日取数 ${n.evidence.collectedAt}`,base64:btoa(a)})).id}async function oe(){W(!0),h(``);try{let n=await t(`/`+e.project.id+`/job`,{kind:`daily-review-collect`,step:5,version:e.project.version,input:{itemId:String(j).trim(),from:N,to:F,metric:L,workflow:`listed-optimization`},refs:[]});B(n.id),H({id:n.id,status:`pending`}),h(`取数任务已提交,等待本机执行(约 2–3 秒/天,串行)。`)}catch(e){h(e.message)}finally{W(!1)}}(0,p.useEffect)(()=>{if(!z)return;let n=setInterval(async()=>{try{let r=await t(`/`+e.project.id+`/job/`+z);if(H(r),r.status!==`pending`&&(clearInterval(n),r.status===`done`&&r.result)){let e=r.result;l(JSON.stringify(e,null,2));try{let t=await ae(e);try{await a()}catch{}_(t),h(`已取到 ${e.snapshots?.length||0} 天快照并归档为本项目文件;已自动选为来源,打开启用开关后保存配置即可。`)}catch(t){h(`已取到 ${e.snapshots?.length||0} 天快照并填入,但归档失败:${t.message}。可手动保存为文件。`)}}}catch{}},4e3);return()=>clearInterval(n)},[z]);let se=e.acquisitionJobs.filter(e=>e.type===`project-daily-review`);async function ce(){d(!0);try{let n=await t(`/`+e.project.id+`/project-daily-review`,{run_id:crypto.randomUUID(),version:e.project.version,raw:c,previous_run_id:x||null,feedback:x?{action:`更新执行/观察证据`,observation:C,reason:C}:null});E(n),h(n.status===`done`?n.reused?`返回已有运行,不重复写入`:`证据、评审与Wiki新版本已保存`:n.error),await a()}catch(e){h(e.message)}finally{d(!1)}}return(0,m.jsxs)(`section`,{className:`card`,children:[(0,m.jsxs)(`h2`,{children:[`每日监控与复盘`,(0,m.jsx)(r,{label:`设置监控`,children:`先核对商品、指标和日期。启用监控是保存任务设置,不能据此判断后台已运行;查看实际任务记录确认结果。`})]}),(0,m.jsx)(i,{data:e,raw:c,disabled:u,onLoad:e=>{l(e),o?.(!0)},onSourceSelected:_,format:`project-daily-review-v1`,source:`逐日指标快照`,question:`要观察哪个商品和指标?先确认日期范围,再选择已归档快照或手动发起平台取数。配置日检是独立操作,不会因读取资料而启用。`},e.project.id),(0,m.jsx)(`p`,{children:`监控配置 → 归档每日快照 → 缺日与更正检查 → 指标变化 → 阶段复盘 → 候选方法复用`}),(0,m.jsxs)(`p`,{children:[`版本 `,v,` · `,e.project.simulated?`模拟项目,不能证明真实效果`:`人工资料项目`,`。平台取数已接入(生意参谋逐日,生成标准快照);模型语义诊断、店铺执行未接入。`]}),(0,m.jsxs)(`div`,{style:{margin:`14px 0`,padding:12,border:`1px solid var(--omni-line,#294248)`,borderRadius:8,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`平台取数 · 生成每日快照`}),(0,m.jsx)(`p`,{className:`muted`,style:{margin:`4px 0 8px`},children:`从生意参谋拉逐日原值,直接生成 project-daily-review-v1 并归档为本项目文件。只能取本店商品;贡献与利润类指标平台不提供。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`p`,{children:[`读取平台资料`,(0,m.jsx)(r,{label:`资料获取范围`,children:`先确认商品和日期。提交只创建请求,是否执行以实际记录为准;不要为试用功能恢复已暂停的采集。`})]}),(0,m.jsxs)(`label`,{children:[`商品ID(本店在售)`,(0,m.jsx)(`input`,{value:j,onChange:e=>M(e.target.value),placeholder:`如 100000000001`})]}),(0,m.jsxs)(`label`,{children:[`监控指标`,(0,m.jsxs)(`select`,{value:L,onChange:e=>R(e.target.value),children:[(0,m.jsx)(`option`,{value:`revenue`,children:`支付金额`}),(0,m.jsx)(`option`,{value:`buyers`,children:`支付买家数`}),(0,m.jsx)(`option`,{value:`visitors`,children:`商品访客数`}),(0,m.jsx)(`option`,{value:`pageViews`,children:`商品浏览量`}),(0,m.jsx)(`option`,{value:`spend`,children:`广告花费`}),(0,m.jsx)(`option`,{value:`refunds`,children:`退款成功金额`}),(0,m.jsx)(`option`,{value:`newBuyers`,children:`新客支付买家`}),(0,m.jsx)(`option`,{value:`oldBuyers`,children:`老客支付买家`}),(0,m.jsx)(`option`,{value:`descScore`,children:`描述评分`}),(0,m.jsx)(`option`,{value:`oldBuyerShare`,children:`老客支付买家占比(非复购率)`}),(0,m.jsx)(`option`,{value:`uvValue`,children:`UV价值(派生)`}),(0,m.jsx)(`option`,{value:`netUvValue`,children:`期间差额/UV(非利润)`})]})]}),(0,m.jsxs)(`label`,{children:[`日期区间(默认近30天)`,(0,m.jsx)(`input`,{type:`date`,value:N,onChange:e=>P(e.target.value)}),` 至 `,(0,m.jsx)(`input`,{type:`date`,value:F,onChange:e=>I(e.target.value)})]})]}),(0,m.jsxs)(`div`,{className:`exports`,children:[(0,m.jsx)(`button`,{disabled:U||!j||!N||!F,onClick:oe,children:`从平台取数`}),V&&(0,m.jsxs)(`span`,{className:`muted`,children:[` `,V.id,` · `,V.status===`pending`?`等待执行`:V.status===`done`?`已返回`:V.error||`失败`]})]}),Array.isArray(V?.notes)&&V.notes.length>0&&(0,m.jsx)(`p`,{className:`muted`,children:V.notes.join(`;`)})]}),(0,m.jsxs)(`div`,{className:`card`,children:[(0,m.jsxs)(`h3`,{children:[`项目每日监控配置`,(0,m.jsx)(r,{label:`启用监控前`,children:`核对监控范围和资料来源后再保存。自动更新取决于实际接入和权限,缺日期的数据不能补成零。`})]}),(0,m.jsx)(`p`,{children:`默认未启用,批处理排除模拟项目。目标窗口自动到Asia/Shanghai昨天;没有新数据会记录缺日,不启动取数。`}),(0,m.jsxs)(`label`,{children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked)}),`启用本项目日检`]}),(0,m.jsxs)(`label`,{children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>A(e.target.checked)}),`跟随同名归档最新版本(仍验证项目与类型)`]}),(0,m.jsxs)(`p`,{children:[`在下方选择本项目标准JSON来源;不选择来源保存为待接通。当前:`,e.monitorConfig?.enabled?`已启用`:`未启用`,` · `,e.monitorConfig?.sourceFileId||`缺源`]}),(0,m.jsx)(`button`,{disabled:u||n,onClick:async()=>{d(!0);try{await t(`/`+e.project.id+`/monitor-config`,{version:e.project.version,enabled:D,timezone:`Asia/Shanghai`,sourceFileId:g||e.monitorConfig?.sourceFileId||null,followLatest:k}),h(`监控配置已保存;未创建日程、未获取新数据`),await a()}catch(e){h(e.message)}finally{d(!1)}},children:`保存日检配置`}),(0,m.jsxs)(`div`,{className:`card`,children:[(0,m.jsx)(`h3`,{children:`独立监控任务 · 发货与售后`}),(0,m.jsx)(`p`,{className:`muted`,children:`在 default 流(上方日检配置)之外,按分支加独立监控流。每条流独立来源、独立缺日判断、独立通知,互不影响。当前仅支持 fulfillment-retention 的两分支。`}),Q.length>0&&(0,m.jsx)(`div`,{children:Q.map(e=>(0,m.jsxs)(`div`,{style:{margin:`6px 0`,padding:6,border:`1px solid var(--omni-line,#294248)`,borderRadius:6},children:[(0,m.jsx)(`b`,{children:e.branch===`inventory`?`库存履约`:`售后回流`}),`(`,e.key,`) · 指标 `,e.metric,` · `,e.enabled?`已启用`:`已关闭`,` · 来源 `,e.sourceName||`缺源`,(0,m.jsx)(`button`,{className:`secondary`,style:{marginLeft:8},disabled:J,onClick:()=>$(e.branch,e.metric,e.sourceFileId||``,!e.enabled),children:e.enabled?`关闭`:`启用`})]},e.id))}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`label`,{children:[`分支`,(0,m.jsxs)(`select`,{value:G,onChange:e=>ee(e.target.value),children:[(0,m.jsx)(`option`,{value:`inventory`,children:`库存履约`}),(0,m.jsx)(`option`,{value:`after-sales`,children:`售后回流`})]})]}),(0,m.jsxs)(`label`,{children:[`监控指标(与导入资料中的指标一致)`,(0,m.jsx)(`input`,{value:K,onChange:e=>te(e.target.value),placeholder:`如 revenue / buyers / refunds`})]}),(0,m.jsxs)(`label`,{children:[`商品ID(开启自动更新必填)`,(0,m.jsx)(`input`,{value:X,onChange:e=>re(e.target.value),placeholder:`如 100000000001`})]}),(0,m.jsxs)(`label`,{style:{flexDirection:`row`,alignItems:`center`,gap:6},children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:Z,onChange:e=>ie(e.target.checked)}),`每日自动更新快照`]}),(0,m.jsxs)(`label`,{children:[`来源快照`,(0,m.jsxs)(`select`,{value:q,onChange:e=>ne(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`选择 project-daily-review-v1 归档`}),e.files.filter(e=>e.name.endsWith(`.json`)).map(e=>(0,m.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,m.jsx)(`button`,{disabled:J||!K,onClick:()=>$(G,K,q,!0),children:`保存并启用此监控任务`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`日检状态历史`}),e.acquisitionJobs.filter(e=>e.type===`monitor-event`).map(e=>(0,m.jsxs)(`p`,{children:[e.targetDay,` · `,e.state,` · `,e.created]},e.id))]})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`监控状态和复用边界`}),(0,m.jsx)(`p`,{children:`默认Asia/Shanghai;配置闭环、指标、范围、单位、起止日。仅分析本项目已归档或导入的快照,不抓平台,不创建调度。缺日、不完整、延迟退款更正需保留版本及理由。`}),(0,m.jsx)(`p`,{children:`方法记录适用商品/渠道/阶段/窗口、样本量、观察时长、成功与失败定义、限制与来源版本;只能形成候选。复用目标条件不匹配会提示,不生成高成功率,不自动执行店铺调整。`})]}),c&&(()=>{try{let e=JSON.parse(c),t=e.snapshots?.length||0,n=e.snapshots?.filter(e=>e.value==null).length||0;return(0,m.jsxs)(`div`,{style:{margin:`10px 0`,padding:10,border:`1px solid var(--omni-line,#294248)`,borderRadius:6,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`当前证据`}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:`4px 0`},children:[`快照 `,t,` 天`,e.config?.start?` `+e.config.start+`~`+e.config.end:``,` · 指标 `,e.config?.metric||`-`,` · 时区 `,e.config?.timezone||`-`,` · 流程 `,e.workflow||`-`]}),n>0&&(0,m.jsxs)(`p`,{className:`muted`,style:{margin:0},children:[`有 `,n,` 天值为空 —— 缺日不能跳过,需补数据或调整窗口`]})]})}catch{return(0,m.jsx)(`p`,{className:`muted`,children:`资料格式无法读取,请检查 JSON 文件格式`})}})(),(0,m.jsxs)(`details`,{style:{margin:`10px 0`},children:[(0,m.jsx)(`summary`,{style:{cursor:`pointer`},children:`手动补充资料(历史数据、外部导出或模拟演示)`}),(0,m.jsx)(`p`,{className:`muted`,children:`自动取数盖不住这些情况时才用:补成本与利润、历史或外部导出数据、不碰真实店铺的模拟测试。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsx)(`button`,{disabled:!e.project.simulated||u,onClick:()=>{l(JSON.stringify(y(e.project.id),null,2)),h(`虚构账本已载入;没有执行记录,不会假称已执行`)},children:`载入缺日模拟快照`}),(0,m.jsx)(`button`,{disabled:!e.project.simulated||!c||u,onClick:()=>{l(JSON.stringify(y(e.project.id,!0),null,2)),h(`已载入明确标记的虚构执行与后窗。请选前次运行并填写反馈再保存。`)},children:`模拟补齐每日快照`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`商品与证据包`,(0,m.jsx)(`textarea`,{"aria-label":`每日复盘证据包`,rows:12,value:c,onChange:e=>l(e.target.value)})]})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次检查`,(0,m.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次诊断/计划`}),se.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.result?.conclusion,` · `,e.created]},e.id))]})]}),x&&(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:C,onChange:e=>w(e.target.value)})]}),(0,m.jsx)(`button`,{disabled:u||n||!c||!!x&&!C.trim(),onClick:ce,children:u?`校验与保存中…`:x?`保存反馈并重评`:`检查每日快照并保存`}),n&&(0,m.jsx)(`p`,{children:`先保存当前其他步骤的编辑。`}),(0,m.jsx)(`p`,{role:`status`,children:f}),T?.result&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`h3`,{children:T.result.conclusion}),(0,m.jsx)(`p`,{children:T.result.causality}),(0,m.jsx)(`pre`,{children:JSON.stringify(T.result,null,2)})]}),(0,m.jsx)(`h3`,{children:`监控历史与待复核`}),se.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.result?.conclusion||t.error,t.savedVersion===e.project.version?``:` · 上游/项目已变更,需复核`,t.skill_version===`1.0.0-local`?``:` · 旧规则需重评`]}),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,t.skill_version,` · SHA256 `,t.input_sha]}),(0,m.jsx)(`pre`,{children:JSON.stringify(t.result,null,2)}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:`读取证据或评审文件`})},t))]},t.id)),(0,m.jsx)(`p`,{children:`所有运行进入项目Wiki的“评审与下一步”版本;保留原件与哈希。建议保留/调整/回滚仅为建议,系统不执行真实变更。`})]})}var S=`1.0.0-local`;function C(e,t=!1){let n=(e,t)=>Array.from({length:7},(n,r)=>({date:`2026-10-${String(e+r).padStart(2,`0`)}`,impressions:1e3,clicks:t,visitors:100,buyers:10,revenue:500,refunds:20,spend:50,variableCost:200})),r={itemId:`fictional-listed-001`,currency:`CNY`,revenueBasis:`gross_paid`,refundBasis:`paid_order_cohort`,costBasis:`ex_ads_ex_refunds`,scope:`全量支付/订单队列退款;非广告归因`,channel:`手机搜索`,device:`mobile`,timezone:`Asia/Shanghai`};return{format:`listed-optimization-v1`,project_id:e,mode:`simulated`,itemId:r.itemId,goal:`ctr`,evidence:{source:`虚构在售商品演练,非平台数据`,collectedAt:`2026-10-29T00:00:00Z`,mode:`simulated`},pre:{...r,start:`2026-10-01`,end:`2026-10-07`,daily:n(1,30)},plan:{changes:[`主图利益点文案`],hypothesis:`虚构假设:明确容量表达可能增加点击`,reason:`仅验证工作流,不证明业务原因`,minDays:7,minDenominator:1e3,stopRule:`贡献减少或退款异常时人工评估停止`},execution:t?{mode:`simulated`,confirmed:!0,actor:`模拟测试角色`,date:`2026-10-08`,change:`主图利益点文案`,proof:`模拟执行记录,未操作店铺`}:null,post:t?{...r,start:`2026-10-09`,end:`2026-10-15`,daily:n(9,35)}:null,confounders:[],refundMature:t}}function w(e){let t=new Date;return t.setDate(t.getDate()+e),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function T({data:e,api:t,dirty:n,onSaved:a,onDirty:o,initialItemId:s=``}){let[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(!1),[f,h]=(0,p.useState)(``),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(s),[k,A]=(0,p.useState)(()=>w(-30)),[j,M]=(0,p.useState)(()=>w(-1)),[N,P]=(0,p.useState)(``),[F,I]=(0,p.useState)(null),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(`pre`);function V(t){let n={};try{n=c?JSON.parse(c):{}}catch{n={}}n.format!==`listed-optimization-v1`&&(n={format:`listed-optimization-v1`,project_id:e.project.id,mode:`manual`,itemId:t.itemId,goal:`cvr`,evidence:t.evidence,pre:null,plan:null,execution:null,post:null,confounders:[],refundMature:!1});let r={...t.sample,start:t.start,end:t.end,daily:t.daily};if(t.window===`post`){let e=n.pre?Object.fromEntries([`itemId`,`currency`,`revenueBasis`,`refundBasis`,`costBasis`,`scope`,`channel`,`device`,`timezone`].map(e=>[e,n.pre[e]])):t.sample;n.post={...e,itemId:t.itemId,start:t.start,end:t.end,daily:t.daily}}else n.pre=r;return n.collectionLast=t.collection,l(JSON.stringify(n,null,2)),t.daily.length}async function H(){R(!0),h(``);try{let n=await t(`/`+e.project.id+`/job`,{kind:`listed-collect`,step:5,version:e.project.version,input:{itemId:String(D).trim(),from:k,to:j,window:z},refs:[]});P(n.id),I({id:n.id,status:`pending`}),h(`取数任务已提交(${z===`post`?`调整后数据`:`调整前数据`}),等待处理,是否完成请查看实际任务记录。`)}catch(e){h(e.message)}finally{R(!1)}}(0,p.useEffect)(()=>{if(!N)return;let n=setInterval(async()=>{try{let r=await t(`/`+e.project.id+`/job/`+N);if(I(r),r.status!==`pending`&&(clearInterval(n),r.status===`done`&&r.result)){let e=V(r.result);h(`已取到 ${r.result.window===`post`?`调整后数据`:`调整前数据`} ${e} 天逐日数据并写入证据包。impressions 与 variableCost 平台无数据,需人工补齐后才能算贡献。`)}}catch{}},4e3);return()=>clearInterval(n)},[N]);let U=e.acquisitionJobs.filter(e=>e.type===`listed-optimization`),W=e=>{try{let t=JSON.parse(c);e(t),l(JSON.stringify(t,null,2))}catch{h(`请先载入或导入证据`)}};async function G(){d(!0);try{let n=await t(`/`+e.project.id+`/listed-optimization`,{run_id:crypto.randomUUID(),version:e.project.version,raw:c,previous_run_id:v||null,feedback:v?{action:`更新执行/观察证据`,observation:b,reason:b}:null});E(n),h(n.status===`done`?n.reused?`返回已有运行,不重复写入`:`证据、评审与Wiki新版本已保存`:n.error),await a()}catch(e){h(e.message)}finally{d(!1)}}return(0,m.jsxs)(`section`,{className:`card`,children:[(0,m.jsxs)(`h2`,{children:[`在售商品优化`,(0,m.jsx)(r,{label:`验证优化效果`,children:`先选择商品和调整前资料,每次明确一个主要改动。复盘时补充实际执行与调整后数据;计划不能当作已执行。`})]}),(0,m.jsx)(i,{data:e,raw:c,disabled:u,onLoad:e=>{l(e),o?.(!0)},format:`listed-optimization-v1`,source:`调整前后同口径数据`,question:`这次想改善点击还是转化?先准备同一商品的调整前数据,再说明只改了什么;执行后再补观察窗口,不能拿计划代替已执行。`},e.project.id),(0,m.jsx)(`p`,{children:`选择商品与目标 → 读取证据 → 诊断假设 → 单变量计划 → 执行记录 → 观察复盘`}),(0,m.jsxs)(`p`,{children:[`版本 `,S,` · `,e.project.simulated?`模拟项目,不能证明真实效果`:`人工资料项目`,`。平台取数已接入(生意参谋逐日);模型语义诊断、店铺执行未接入。`]}),(0,m.jsxs)(`div`,{style:{margin:`14px 0`,padding:12,border:`1px solid var(--omni-line,#294248)`,borderRadius:8,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`平台取数 · 生意参谋`}),(0,m.jsx)(`p`,{className:`muted`,style:{margin:`4px 0 8px`},children:`填本店在售商品ID和前调整后数据日期,自动取逐日收入/访客/买家/退款/广告花费。只能取本店商品,不取竞品。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`label`,{children:[`商品ID(本店在售,纯数字)`,(0,m.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:`如 100000000001`})]}),(0,m.jsxs)(`label`,{children:[`要读取哪个阶段的数据`,(0,m.jsxs)(`select`,{value:z,onChange:e=>B(e.target.value),children:[(0,m.jsx)(`option`,{value:`pre`,children:`调整前数据(变更前)`}),(0,m.jsx)(`option`,{value:`post`,children:`调整后数据(变更后)`})]})]}),(0,m.jsxs)(`label`,{children:[`统计区间(默认近30天)`,(0,m.jsx)(`input`,{type:`date`,value:k,onChange:e=>A(e.target.value)}),` 至 `,(0,m.jsx)(`input`,{type:`date`,value:j,onChange:e=>M(e.target.value)})]})]}),(0,m.jsxs)(`div`,{className:`exports`,children:[(0,m.jsx)(`button`,{disabled:L||!D||!k||!j,onClick:H,children:`从平台取数`}),F&&(0,m.jsxs)(`span`,{className:`muted`,children:[` `,F.id,` · `,F.status===`pending`?`等待执行`:F.status===`done`?`已返回`:F.error||`失败`]})]}),Array.isArray(F?.notes)&&F.notes.length>0&&(0,m.jsx)(`p`,{className:`muted`,children:F.notes.join(`;`)})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`字段、人工判断与观察门槛`}),(0,m.jsx)(`p`,{children:`输入商品ID、目标ctr/cvr/contribution、来源时间、前后逐日数据及渠道设备时区。收入为全量支付毛额,退款按支付订单队列,变动成本不含广告和退款;缺值不能填0。等长窗口、事件日单列。至少7日是资料观察门槛,不是显著性保证。`}),(0,m.jsx)(`p`,{children:`人工确认问题、假设、单一变更、停止条件。执行须有actor/date/change/proof/confirmed及与项目一致的mode;导入的确认只是提交者声明,不是系统验证。未执行保持execution:null,未观察保持post:null。`})]}),c&&(()=>{try{let e=JSON.parse(c),t=e.pre?.daily?.length||0,n=e.post?.daily?.length||0,r=!!e.execution;return(0,m.jsxs)(`div`,{style:{margin:`10px 0`,padding:10,border:`1px solid var(--omni-line,#294248)`,borderRadius:6,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`当前证据`}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:`4px 0`},children:[`调整前数据 `,t,` 天`,e.pre?.start?` `+e.pre.start+`~`+e.pre.end:``,` · 调整后数据 `,n,` 天`,e.post?.start?` `+e.post.start+`~`+e.post.end:``,` · 执行记录:`,r?`已填`:`未填`,` · 目标 `,e.goal||`-`]}),t>0&&(e.pre.daily||[]).every(e=>e.variableCost==null)&&(0,m.jsx)(`p`,{className:`muted`,style:{margin:0},children:`变动成本全为空 —— 贡献类指标算不出来,需先补`})]})}catch{return(0,m.jsx)(`p`,{className:`muted`,children:`资料格式无法读取,请检查 JSON 文件格式`})}})(),(0,m.jsxs)(`details`,{style:{margin:`10px 0`},children:[(0,m.jsx)(`summary`,{style:{cursor:`pointer`},children:`手动补充资料(历史数据、外部导出或模拟演示)`}),(0,m.jsx)(`p`,{className:`muted`,children:`自动取数盖不住这些情况时才用:补变动成本、历史或外部导出数据、不碰真实店铺的模拟测试。`}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsx)(`button`,{disabled:!e.project.simulated||u,onClick:()=>{l(JSON.stringify(C(e.project.id),null,2)),h(`虚构调整前数据已载入;没有执行记录,不会假称已执行`)},children:`载入虚构调整前数据与计划`}),(0,m.jsx)(`button`,{disabled:!e.project.simulated||!c||u,onClick:()=>{l(JSON.stringify(C(e.project.id,!0),null,2)),h(`已载入明确标记的虚构执行与调整后数据。请选前次运行并填写反馈再保存。`)},children:`模拟补充执行与观察`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`商品与证据包`,(0,m.jsx)(`textarea`,{"aria-label":`在售优化证据包`,rows:12,value:c,onChange:e=>l(e.target.value)})]})]})]}),c&&(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsxs)(`label`,{children:[`优化目标`,(0,m.jsxs)(`select`,{onChange:e=>W(t=>{t.goal=e.target.value}),defaultValue:`ctr`,children:[(0,m.jsx)(`option`,{value:`ctr`,children:`点击率`}),(0,m.jsx)(`option`,{value:`cvr`,children:`支付转化率`}),(0,m.jsx)(`option`,{value:`contribution`,children:`期间贡献金额`})]})]}),(0,m.jsxs)(`label`,{children:[`单一变更(替换证据包计划变量)`,(0,m.jsx)(`input`,{placeholder:`例如:主图容量表达`,onBlur:e=>{e.target.value&&W(t=>{t.plan={...t.plan,changes:[e.target.value]}})}})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次分析`,(0,m.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次诊断/计划`}),U.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.result?.conclusion,` · `,e.created]},e.id))]})]}),v&&(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:b,onChange:e=>x(e.target.value)})]}),(0,m.jsx)(`button`,{disabled:u||n||!c||!!v&&!b.trim(),onClick:G,children:u?`校验与保存中…`:v?`保存反馈并重评`:`检查证据并保存计划`}),n&&(0,m.jsx)(`p`,{children:`先保存当前其他步骤的编辑。`}),(0,m.jsx)(`p`,{role:`status`,children:f}),T?.result&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`h3`,{children:T.result.conclusion}),(0,m.jsx)(`p`,{children:T.result.causality}),(0,m.jsx)(`pre`,{children:JSON.stringify(T.result,null,2)})]}),(0,m.jsx)(`h3`,{children:`优化历史与待复核`}),U.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.result?.conclusion||t.error,t.savedVersion===e.project.version?``:` · 上游/项目已变更,需复核`,t.skill_version===`1.0.0-local`?``:` · 旧规则需重评`]}),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,t.skill_version,` · SHA256 `,t.input_sha]}),(0,m.jsx)(`pre`,{children:JSON.stringify(t.result,null,2)}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:`读取证据或评审文件`})},t))]},t.id)),(0,m.jsx)(`p`,{children:`所有运行进入项目Wiki的“评审与下一步”版本;保留原件与哈希。建议保留/调整/回滚仅为建议,系统不执行真实变更。`})]})}var E=`1.0.0-local`;function D(e,t=!1){function n(e,t,n){return{start:e,end:t,currency:`CNY`,unit:`yuan`,timezone:`Asia/Shanghai`,scope:{type:`item`,id:`fictional-cup`},revenueBasis:`gross_paid`,refundBasis:`paid_order_cohort`,costPolicy:`六类费用互斥;不含退款及固定成本`,taxPolicy:`已提供本范围实际税费;不推算税率`,source:{name:`虚构商品账本,非真实账务`,at:`2026-10-29T00:00:00Z`,mode:`simulated`},complete:!0,refundMature:!0,orders:[{id:`order-`+e,date:e,gross:`10000.00`}],refunds:[{id:`refund-`+e,orderId:`order-`+e,date:t,amount:`1000.00`}],costs:[`product`,`fulfillment`,`platform`,`ads`,`tax`,`other`].map((r,i)=>({kind:r,amount:[`4000.00`,`500.00`,`300.00`,n,`200.00`,`0.00`][i],start:e,end:t,scopeId:`fictional-cup`,proof:`虚构凭证-`+r})),fixed:{method:`allocated_pool`,pool:`1000.00`,numerator:1,denominator:2,basis:`本商品占用工时/全店工时`,proof:`虚构分摊记录`,start:e,end:t},settlement:{basis:`same_order_cohort`,scopeId:`fictional-cup`,start:e,end:t,opening:`0.00`,withheld:`300.00`,received:`8000.00`,closing:`700.00`,proof:`虚构结算账单;扣留仅用于现金勾稽`}}}return{format:`operating-reconciliation-v1`,project_id:e,mode:`simulated`,evidence:{source:`本地模拟经营核算数据,所有金额虚构`,collectedAt:`2026-10-29T00:00:00Z`},before:n(`2026-10-01`,`2026-10-07`,`1500.00`),plan:{action:`收缩低效广告支出`,reason:`假设同等收入下减少广告费`,expected:`广告费用1500降至1000;不预设真实销量保持`,stopRule:`收入或贡献下降时人工复核停止`},execution:t?{mode:`simulated`,confirmed:!0,actor:`模拟测试角色`,date:`2026-10-08`,action:`收缩低效广告支出`,proof:`仅虚构执行记录,未操作投放`}:null,after:t?n(`2026-10-09`,`2026-10-15`,`1000.00`):null}}function O({data:e,api:t,dirty:n,onSaved:a,onDirty:o}){let[s,c]=(0,p.useState)(``),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(``),[h,g]=(0,p.useState)(``),[_,v]=(0,p.useState)(``),[y,b]=(0,p.useState)(``),[x,S]=(0,p.useState)(null),C=e.acquisitionJobs.filter(e=>e.type===`operating-reconciliation`);async function w(){u(!0);try{let n=await t(`/`+e.project.id+`/operating-reconciliation`,{run_id:crypto.randomUUID(),version:e.project.version,raw:s,previous_run_id:_||null,feedback:_?{action:`更新执行/观察证据`,observation:y,reason:y}:null});S(n),f(n.status===`done`?n.reused?`返回已有运行,不重复写入`:`证据、评审与Wiki新版本已保存`:n.error),await a()}catch(e){f(e.message)}finally{u(!1)}}return(0,m.jsxs)(`section`,{className:`card`,children:[(0,m.jsxs)(`h2`,{children:[`经营核算与复盘`,(0,m.jsx)(r,{label:`核对经营账目`,children:`导入同一周期的收入、退款和成本资料,核对金额口径后保存。模拟账本只用于演示;未计入的费用需要单独说明。`})]}),(0,m.jsx)(i,{data:e,raw:s,disabled:l,onLoad:e=>{c(e),o?.(!0)},format:`operating-reconciliation-v1`,source:`财务账本或结算明细`,question:`核算哪个商品、哪个周期?请向财务确认收入、退款、货品成本、运费、广告、税费和固定分摊。金额缺失保留空值,不按零处理。`},e.project.id),(0,m.jsx)(`p`,{children:`确定核算范围 → 读取收入退款成本 → 核对账目并计算 → 调整计划 → 执行记录 → 同口径复盘`}),(0,m.jsxs)(`p`,{children:[`版本 `,E,` · `,e.project.simulated?`模拟项目,不能证明真实效果`:`人工资料项目`,`。本闭环仅本地归档分析;平台实时取数、模型语义诊断、店铺执行均未接入。`]}),(0,m.jsxs)(`div`,{className:`two`,children:[(0,m.jsx)(`button`,{disabled:!e.project.simulated||l,onClick:()=>{c(JSON.stringify(D(e.project.id),null,2)),f(`虚构账本已载入;没有执行记录,不会假称已执行`)},children:`载入虚构账本与计划`}),(0,m.jsx)(`button`,{disabled:!e.project.simulated||!s||l,onClick:()=>{c(JSON.stringify(D(e.project.id,!0),null,2)),f(`已载入明确标记的虚构执行与后窗。请选前次运行并填写反馈再保存。`)},children:`模拟补充执行与观察`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`核算口径与金额说明`}),(0,m.jsx)(`p`,{children:`元字符串最多2位小数,缺项不补0。支付毛额与订单队列退款分开。成本明确货品、履约、平台、广告、税费及其他;固定成本单列分摊。成交不等于结算,结算只勾稽,不再次扣利润。`}),(0,m.jsx)(`p`,{children:`贡献=毛额−退款−非税变动成本;经营结余=贡献−税费−固定分摊。非财务净利润,税费及分摊仍需人工确认。`})]}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`商品与证据包`,(0,m.jsx)(`textarea`,{"aria-label":`经营核算证据包`,rows:12,value:s,onChange:e=>c(e.target.value)})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次核算`,(0,m.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次诊断/计划`}),C.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.result?.conclusion,` · `,e.created]},e.id))]})]}),_&&(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:y,onChange:e=>b(e.target.value)})]}),(0,m.jsx)(`button`,{disabled:l||n||!s||!!_&&!y.trim(),onClick:w,children:l?`校验与保存中…`:_?`保存反馈并重评`:`核对账目并保存计划`}),n&&(0,m.jsx)(`p`,{children:`先保存当前其他步骤的编辑。`}),(0,m.jsx)(`p`,{role:`status`,children:d}),x?.result&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`h3`,{children:x.result.conclusion}),(0,m.jsx)(`p`,{children:x.result.causality}),(0,m.jsx)(`pre`,{children:JSON.stringify(x.result,null,2)})]}),(0,m.jsx)(`h3`,{children:`核算历史与待复核`}),C.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.result?.conclusion||t.error,t.savedVersion===e.project.version?``:` · 上游/项目已变更,需复核`,t.skill_version===`1.0.0-local`?``:` · 旧规则需重评`]}),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,t.skill_version,` · SHA256 `,t.input_sha]}),(0,m.jsx)(`pre`,{children:JSON.stringify(t.result,null,2)}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsx)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:`读取证据或评审文件`})},t))]},t.id)),(0,m.jsx)(`p`,{children:`所有运行进入项目Wiki的“评审与下一步”版本;保留原件与哈希。建议保留/调整/回滚仅为建议,系统不执行真实变更。`})]})}var k=`1.0.0-local`;function A(e,t=!1){return{format:`fulfillment-retention-v1`,project_id:e,run_id:null,mode:`simulated`,schema_version:`v1`,skill_version:k,timezone:`Asia/Shanghai`,as_of:`2026-11-01`,window_start:`2026-10-01`,window_end:`2026-10-31`,collected_at:`2026-11-01T00:00:00Z`,source_files:[],source_verification:`脱敏合成 fixture,仅规则验收,非真实经营`,inventory:{skus:[{sku_id:`A`,warehouse_id:`W1`,snapshot_at:`2026-10-31`,sellable_mode:`derived`,on_hand:100,reserved:30,unsellable:10,pending_inspection:4,inbound_qty:20,inbound_eta_known:t,batch_age:12,sellable_definition:`总在库-预占-不可售`}]},replenish:t?{units_sold:70,demand_window_days:7,lead_time:5,review_cycle:2,safety_stock:20,available:60,confirmed_inbound:20,pack_multiple:10,moq:10,budget_cap:5e3,unit_cost:12}:{units_sold:70,demand_window_days:7,lead_time:null,review_cycle:2,safety_stock:20,available:60,confirmed_inbound:null,pack_multiple:10},orders:t?{observed_at:`2026-11-01`,lines:[{line_id:`L1`,order_id:`O1`,sku_id:`A`,qty:5,promise_ship_at:`2026-10-28`,cancel_status:null,shipped_qty:5,shipped_at:`2026-10-27`},{line_id:`L2`,order_id:`O2`,sku_id:`A`,qty:3,promise_ship_at:`2026-10-29`,cancel_status:null,shipped_qty:0,shipped_at:null},{line_id:`L3`,order_id:`O3`,sku_id:`A`,qty:2,promise_ship_at:`2026-10-30`,cancel_status:`cancelled`,shipped_qty:0,shipped_at:null}]}:{observed_at:`2026-11-01`,lines:[]},refunds:t?{view:`success`,denominator:100,list:[{ticket_id:`T1`,order_id:`O10`,cohort_key:`C10`,reason_raw:`色差`,reason_std:`视觉描述不符`,reason_manual:`unknown`,applied_at:`2026-10-20`,success_at:`2026-10-25`,amount:88,currency:`CNY`,status:`success`},{ticket_id:`T2`,order_id:`O10`,cohort_key:`C10`,reason_raw:`色差补寄`,reason_std:`视觉描述不符`,reason_manual:`unknown`,applied_at:`2026-10-21`,success_at:`2026-10-25`,amount:0,currency:`CNY`,status:`success`}]}:{view:`success`,denominator:500,list:[]},retention:t?{eligible_count:200,repurchase_event_keys:[`C1`,`C2`,`C2`,`C3`],matured:!0,observed_deadline:`2026-11-30`}:{eligible_count:200,repurchase_event_keys:[],matured:!1,observed_deadline:null}}}function j(e){return A(e,!0)}function M({data:e,api:t,onSaved:n,dirty:a,onDirty:o}){let[s,c]=(0,p.useState)(``),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(``),[h,g]=(0,p.useState)(null),[_,v]=(0,p.useState)(``),[y,b]=(0,p.useState)(``),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(``),T=(e.acquisitionJobs||[]).filter(e=>e.type===`fulfillment-retention`);async function E(){u(!0),f(`正在本地校验与情景计算`);try{let r=await t(`/`+e.project.id+`/fulfillment-retention`,{run_id:crypto.randomUUID(),version:e.project.version,raw:s,previous_run_id:_||null,feedback:_?{action:y,observation:x,reason:C}:null});g(r),f(r.status===`done`?r.reused?`相同输入已运行,返回原记录`:`证据、评审与Wiki新版本已保存`:r.error),await n()}catch(e){f(e.message)}finally{u(!1)}}let D=s?(()=>{try{let e=JSON.parse(s),t=e.inventory?.skus?.length||0,n=+!!e.replenish,r=e.orders?.lines?.length||0,i=e.refunds?.list?.length||0,a=+!!e.retention;return(0,m.jsxs)(`div`,{style:{margin:`10px 0`,padding:10,border:`1px solid var(--omni-line,#294248)`,borderRadius:6,background:`var(--omni-field,#101e25)`},children:[(0,m.jsx)(`b`,{children:`当前证据`}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:`4px 0`},children:[`库存 SKU `,t,` 个 · 补货参数 `,n?`已填`:`缺`,` · 订单行 `,r,` · 退款工单 `,i,` · 回流队列 `,a?`已填`:`缺`]}),(0,m.jsxs)(`p`,{className:`muted`,style:{margin:0},children:[`as_of `,e.as_of||`-`,` · 区间 `,e.window_start||`-`,` ~ `,e.window_end||`-`,` · 模式 `,e.mode]})]})}catch{return(0,m.jsx)(`p`,{className:`muted`,children:`资料格式无法读取,请检查 JSON 文件格式`})}})():null;return(0,m.jsxs)(`section`,{className:`card`,style:{marginBottom:20},children:[(0,m.jsxs)(`h2`,{children:[`库存、发货与售后复盘`,(0,m.jsx)(r,{label:`库存与售后分析`,children:`导入库存、订单和售后资料,查看缺项和预估结果。这里只分析和保存,不会采购、退款、发消息或修改库存。`})]}),(0,m.jsx)(i,{data:e,raw:s,disabled:l,onLoad:e=>{c(e),o?.(!0)},format:`fulfillment-retention-v1`,source:`ERP、订单、售后工单或 CRM 导出`,question:`要判断缺货、补货还是售后回流?请提供对应库存、订单或工单资料及统计日期。仅使用聚合或假名数据,不填写客户姓名、电话和地址。`},e.project.id),(0,m.jsxs)(`p`,{children:[`分析方法版本 `,k,` · `,e.project.simulated?`模拟项目`:`人工资料项目`,` · 两条并行分支,共用证据·计划·执行·观察·复盘。`]}),(0,m.jsx)(`p`,{children:`本地确定性校验与情景计算;不自动采购、不自动退款、不发消息、不改库存。`}),D,(0,m.jsx)(`div`,{className:`two`,children:(0,m.jsx)(`button`,{disabled:l||!e.project.simulated,onClick:()=>{c(JSON.stringify(j(e.project.id),null,2)),f(`已载入虚构演示资料:仅规则验收,非经营结果。`)},children:`载入虚构演示资料`})}),(0,m.jsxs)(`details`,{style:{margin:`10px 0`},children:[(0,m.jsx)(`summary`,{style:{cursor:`pointer`},children:`手工补充与兜底(ERP/工单导出、历史数据、直接改字段)`}),(0,m.jsx)(`p`,{className:`muted`,children:`库存、订单、退款、复购字段来自 ERP/工单/CRM 导出,平台没有;只收聚合或假名数据。散列≠匿名,仍按受限资料处理。`}),(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`高级:查看或修改原始资料字段`}),(0,m.jsxs)(`label`,{children:[`证据包内容`,(0,m.jsx)(`textarea`,{"aria-label":`履约回流证据包`,rows:14,value:s,onChange:e=>c(e.target.value)})]})]})]}),(0,m.jsxs)(`label`,{children:[`本次反馈对应哪次分析`,(0,m.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`首次评审`}),T.filter(e=>e.status===`done`).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.created,` · `,e.result?.conclusion]},e.id))]})]}),_&&(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)(`label`,{children:[`本次实际变更、观察和判断理由`,(0,m.jsx)(`textarea`,{value:y,onChange:e=>b(e.target.value),placeholder:`动作(如:调整补货安全量)/观察(如:缺货天数)/理由`})]})}),(0,m.jsx)(`button`,{disabled:l||a||!s.trim(),onClick:E,children:l?`运行中…`:_?`保存反馈并重新评审`:`检查资料并计算预估结果`}),a&&(0,m.jsx)(`p`,{children:`先保存当前步骤修改,避免覆盖未保存内容。`}),(0,m.jsx)(`p`,{role:`status`,children:d}),h?.result&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`strong`,{children:h.result.conclusion}),Array.isArray(h.result.issues)&&h.result.issues.filter(e=>e.level===`block`||e.level===`missing`).map(e=>(0,m.jsxs)(`p`,{style:{color:`var(--omni-danger,#ffabae)`},children:[`⚠ `,e.key,`:`,e.message]},e.key+String(e.message))),(0,m.jsx)(`h4`,{children:`情景计算结果`}),h.result.inventory?.length>0&&(0,m.jsxs)(`p`,{className:`muted`,children:[`可售:`,h.result.inventory.map(e=>`${e.sku}=${e.available??`缺`}${e.negative?`(负!)`:``}`).join(`,`),h.result.inventory.some(e=>e.pendingInspection!=null)?` · 待检独立`:` · 无待检`]}),h.result.replenish&&(0,m.jsxs)(`p`,{className:`muted`,children:[`补货:需求率 `,h.result.replenish.rate??`—`,` · 净需求 `,h.result.replenish.net??`—`,` · 建议量 `,h.result.replenish.suggested??`未生成(缺参数)`]}),h.result.fulfillment&&(0,m.jsxs)(`p`,{className:`muted`,children:[`履约:分母 `,h.result.fulfillment.denominator,` · 超时 `,h.result.fulfillment.overdue,` · 超时率 `,h.result.fulfillment.rate==null?`—`:(h.result.fulfillment.rate*100).toFixed(1)+`%`]}),h.result.refunds&&(0,m.jsxs)(`p`,{className:`muted`,children:[`退款:`,h.result.refunds.view,` 口径 · 去重订单 `,h.result.refunds.distinctOrders,` · 发生率 `,h.result.refunds.rate==null?`—`:(h.result.refunds.rate*100).toFixed(2)+`%`]}),h.result.retention&&(0,m.jsxs)(`p`,{className:`muted`,children:[`复购:合格 `,h.result.retention.eligible,` · 复购 `,h.result.retention.repurchased,` · 率 `,h.result.retention.rate==null?`未成熟/不可算`:(h.result.retention.rate*100).toFixed(2)+`%`]}),Array.isArray(h.result.nextActions)&&h.result.nextActions.length>0&&(0,m.jsxs)(`p`,{className:`muted`,children:[`下一步:`,h.result.nextActions.join(`;`)]})]}),(0,m.jsx)(`h3`,{children:`本项目运行历史`}),T.map(t=>(0,m.jsxs)(`details`,{children:[(0,m.jsxs)(`summary`,{children:[t.created,` · `,t.status,` · `,t.result?.conclusion||t.error,t.skill_version===`1.0.0-local`?``:` · 旧规则版本,需重新评审`,t.savedVersion===e.project.version?``:` · 项目版本已变化,需复核`]}),(0,m.jsxs)(`p`,{children:[`运行 `,t.id,` · 分析方法版本 `,t.skill_version,` · 证据SHA256 `,t.input_sha]}),t.artifactIds?.map(t=>(0,m.jsx)(`p`,{children:(0,m.jsxs)(`a`,{href:`/api/workbench/`+e.project.id+`/file/`+t,children:[`读取原始证据/评审产物 `,t]})},t)),(0,m.jsx)(`pre`,{children:JSON.stringify({gates:t.result?.gates,issues:t.result?.issues?.slice(0,20),nextActions:t.result?.nextActions,feedback:t.feedback},null,2)})]},t.id)),(0,m.jsx)(`p`,{className:`muted`,children:`人工判断:库存口径与身份、承诺时点、退款责任证据、复购许可、采购审批。规则计算不证明真实经营改善。`})]})}var N={dashboard:_,monitor:x,optimization:T,finance:O,fulfillment:M};function P({section:e,project:t}){let n=N[e];return(0,m.jsx)(`div`,{className:`products-module wb-legacy-tools`,onChangeCapture:e=>{e.target.matches(`input:not([type=checkbox]),textarea`)&&t.onDirty(!0)},children:n&&(0,m.jsx)(n,{...t},t.projectId)})}export{_ as DashboardPanel,O as FinancePanel,M as FulfillmentPanel,x as MonitorPanel,T as OptimizationPanel,P as default};
@@ -0,0 +1 @@
1
+ import"./workspace-view-state-D0ujRczW.js";
@@ -1 +1 @@
1
- import{p as e}from"./index-BguiS02-.js";var t=e(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
1
+ import{p as e}from"./index-DLSVWUSu.js";var t=e(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{p as e}from"./index-DLSVWUSu.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 +1 @@
1
- import{p as e}from"./index-BguiS02-.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
1
+ import{p as e}from"./index-DLSVWUSu.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};