@petercjl/omni-desktop-app 0.1.5 → 0.1.7

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 (119) hide show
  1. package/app/assets/CartesianChart-acGhtLrw.js +33 -0
  2. package/app/assets/CollaborationWorkspace-DAWo2Vol.js +57 -0
  3. package/app/assets/CollaborationWorkspace-DHP4cb-p.css +1 -0
  4. package/app/assets/EmptyState-BgcduNtk.js +1 -0
  5. package/app/assets/{EvidenceSourceGuide-CEmQ3sdi.js → EvidenceSourceGuide-qBsaH1fx.js} +1 -1
  6. package/app/assets/Favorites-C3gPJxbl.js +1 -0
  7. package/app/assets/{HelpTip-BcLBMmZW.js → HelpTip-X4GpEnvk.js} +1 -1
  8. package/app/assets/LineChart-CyiCaQMM.js +4 -0
  9. package/app/assets/Opportunities-CogyuZvI.css +1 -0
  10. package/app/assets/Opportunities-DDR6jMz5.js +1 -0
  11. package/app/assets/ProgressiveRows-DPZqhsXV.js +1 -0
  12. package/app/assets/ShopLayoutPage-7lNMFD1W.js +1 -0
  13. package/app/assets/ShopLayoutPage-BlPpfB06.css +1 -0
  14. package/app/assets/TrendChart-ClEBAnKO.js +1 -0
  15. package/app/assets/api-DP_rt0Zx.js +1 -0
  16. package/app/assets/arrow-left-rfprDrQc.js +1 -0
  17. package/app/assets/arrow-up-right-Bp3gzP7v.js +1 -0
  18. package/app/assets/chart-no-axes-combined-dFluBLOV.js +1 -0
  19. package/app/assets/check-DokC3Ug0.js +1 -0
  20. package/app/assets/chevron-down-CHQKhw_4.js +1 -0
  21. package/app/assets/chevron-right-2HEa4oQb.js +1 -0
  22. package/app/assets/clock-3-DpvJxor3.js +1 -0
  23. package/app/assets/components-zDEQpnyp.js +2 -0
  24. package/app/assets/{download-D5rXx5AI.js → download-BQwcTDwB.js} +1 -1
  25. package/app/assets/entry-BNiO6CiP.js +2 -0
  26. package/app/assets/entry-B_LLuTIf.css +1 -0
  27. package/app/assets/entry-BleRLT_W.js +1 -0
  28. package/app/assets/entry-CO870j9p.css +1 -0
  29. package/app/assets/entry-CYsrxe4a.js +2 -0
  30. package/app/assets/entry-D2FD-KFx.js +1 -0
  31. package/app/assets/entry-DAnTlYgL.js +1 -0
  32. package/app/assets/entry-DSEbJ79v.js +2 -0
  33. package/app/assets/file-text-DF8-c_Tb.js +1 -0
  34. package/app/assets/format-jsGSJ1GL.js +1 -0
  35. package/app/assets/git-branch-CMQGDByc.js +1 -0
  36. package/app/assets/graphicalItemSelectors-GhHIivGe.js +1 -0
  37. package/app/assets/grid-2x2-BNdV1X54.js +1 -0
  38. package/app/assets/index-7NKGenq7.css +1 -0
  39. package/app/assets/{index-CDS2fIqN.js → index-BBySSIJT.js} +2 -2
  40. package/app/assets/{layers-BaGSABxV.js → layers-BY0DtVnH.js} +1 -1
  41. package/app/assets/link-2-B7GAWapc.js +1 -0
  42. package/app/assets/list-DrSHrHvT.js +1 -0
  43. package/app/assets/market-B2oImfqS.css +1 -0
  44. package/app/assets/market.module-BXeOH_ee.js +1 -0
  45. package/app/assets/module-host-BHOsDk69.js +1 -0
  46. package/app/assets/package-C_xD77DO.js +1 -0
  47. package/app/assets/pin-BEsLCHJL.js +1 -0
  48. package/app/assets/plus-C301wuGJ.js +1 -0
  49. package/app/assets/products-CfPFkCnk.js +1 -0
  50. package/app/assets/project-airtight-canisters-LLndxxjI.jpg +0 -0
  51. package/app/assets/project-collaboration-travel-bag-BB2ARGd7.jpg +0 -0
  52. package/app/assets/project-cutting-board-CeIWMQLS.jpg +0 -0
  53. package/app/assets/project-desktop-cable-clips-DdPGOqI8.jpg +0 -0
  54. package/app/assets/project-double-11-thermos-D7tzhW-B.jpg +0 -0
  55. package/app/assets/project-drinking-glass-D8H-30yp.jpg +0 -0
  56. package/app/assets/project-foldable-storage-crate-DlZP-j-z.jpg +0 -0
  57. package/app/assets/project-microfiber-cloths-Dda9f7He.jpg +0 -0
  58. package/app/assets/project-portable-blender-CLylHN-m.jpg +0 -0
  59. package/app/assets/{project-public-D9ifVghn.js → project-public-CYza4XVS.js} +4 -4
  60. package/app/assets/project-public-DqjxO6ad.js +1 -0
  61. package/app/assets/project-scented-candle-CDVqTvgw.jpg +0 -0
  62. package/app/assets/project-silicone-baking-mat-DUDDE63y.jpg +0 -0
  63. package/app/assets/project-tissue-box-DkxE74G5.jpg +0 -0
  64. package/app/assets/project-travel-bag-DWCGqkcM.png +0 -0
  65. package/app/assets/project-travel-bottles-CgRJiJGs.jpg +0 -0
  66. package/app/assets/project-tumbler-D2BmTnok.png +0 -0
  67. package/app/assets/public-DoBzMSlG.js +1 -0
  68. package/app/assets/{refresh-cw-OG4-Ic4x.js → refresh-cw-BZ6-gKfF.js} +1 -1
  69. package/app/assets/{Directory-ZWl5yZd5.css → ui-public-BPe2GJZ-.css} +1 -1
  70. package/app/assets/ui-public-CX7L8QF_.js +1 -0
  71. package/app/assets/use-favorites-ChTJGQkB.js +1 -0
  72. package/app/assets/use-favorites-_eKBQGeF.css +1 -0
  73. package/app/assets/workbench-13XxpUuA.css +1 -0
  74. package/app/assets/workbench-BCuh9Nyq.js +2 -0
  75. package/app/assets/workspace-view-state-CYNxOsyc.js +1 -0
  76. package/app/index.html +2 -2
  77. package/package.json +1 -1
  78. package/release.json +1 -1
  79. package/release.sig +1 -1
  80. package/app/assets/Directory-D0rZfh_1.js +0 -1
  81. package/app/assets/EmptyState-COLCkhZs.js +0 -1
  82. package/app/assets/LineChart-DC_iIB4m.js +0 -36
  83. package/app/assets/arrow-right-Bsei-31a.js +0 -1
  84. package/app/assets/arrow-up-right-CqmbLgtN.js +0 -1
  85. package/app/assets/chart-column-Dlmnr1y9.js +0 -1
  86. package/app/assets/check-QN7RSzdG.js +0 -1
  87. package/app/assets/chevron-down-BoU_rWJ-.js +0 -1
  88. package/app/assets/chevron-left-D1Tjivki.js +0 -1
  89. package/app/assets/chevron-right-CGVsdWp6.js +0 -1
  90. package/app/assets/clock-3-B99KnTzW.js +0 -1
  91. package/app/assets/demand-planning-client-DVOcsKAy.css +0 -1
  92. package/app/assets/demand-planning-client-DzZj_Q__.js +0 -130
  93. package/app/assets/entry-B68pyhTH.js +0 -2
  94. package/app/assets/entry-BzQWDj9a.css +0 -1
  95. package/app/assets/entry-CKQSyMns.js +0 -2
  96. package/app/assets/entry-C_j4PEhB.css +0 -1
  97. package/app/assets/entry-CxmvXNMW.js +0 -1
  98. package/app/assets/entry-DMn_VQx0.js +0 -2
  99. package/app/assets/entry-DzUnM_Wl.js +0 -1
  100. package/app/assets/entry-h5lCV6qJ.js +0 -1
  101. package/app/assets/flag-Dtu8lW8f.js +0 -1
  102. package/app/assets/git-branch-Cv69GSy-.js +0 -1
  103. package/app/assets/index-DYn6t59z.css +0 -1
  104. package/app/assets/module-host-BzwOcfIf.js +0 -1
  105. package/app/assets/play-DaJyx8oA.js +0 -1
  106. package/app/assets/plus-D0cC0DpO.js +0 -1
  107. package/app/assets/products-BxcSNL_f.js +0 -1
  108. package/app/assets/project-execution-VeMKoL0M.js +0 -1
  109. package/app/assets/project-public-D9qvuaHV.js +0 -1
  110. package/app/assets/project-public-DxYr-zt5.js +0 -1
  111. package/app/assets/public-DTqkVQos.js +0 -1
  112. package/app/assets/search-I3gdKVV9.js +0 -1
  113. package/app/assets/ui-public-BJV7qMHh.js +0 -2
  114. package/app/assets/use-workspace-query-Csm4EkUU.js +0 -1
  115. package/app/assets/workbench-BeiscSvD.js +0 -2
  116. package/app/assets/workbench-CrImV0L7.css +0 -1
  117. package/app/assets/workspace-view-state-C1Tia7X4.js +0 -1
  118. /package/app/assets/{activity-Cj90ZCJa.js → activity-idEO2qnr.js} +0 -0
  119. /package/app/assets/{group-B6vAoX5c.js → group--adLvfC6.js} +0 -0
@@ -0,0 +1 @@
1
+ import{t as e}from"./arrow-left-rfprDrQc.js";import{n as t}from"./clock-3-DpvJxor3.js";import{t as n}from"./arrow-up-right-Bp3gzP7v.js";import{t as r}from"./chart-no-axes-combined-dFluBLOV.js";import{t as i}from"./check-DokC3Ug0.js";import{t as a}from"./chevron-right-2HEa4oQb.js";import{n as o,t as s}from"./ui-public-CX7L8QF_.js";import{r as c}from"./CollaborationWorkspace-DAWo2Vol.js";import{a as l,n as u,o as d,r as f}from"./products-CfPFkCnk.js";import{t as p}from"./layers-BY0DtVnH.js";import{t as m}from"./refresh-cw-BZ6-gKfF.js";import{n as h,r as g}from"./workspace-view-state-CYNxOsyc.js";import{_,d as v,m as y,o as b,s as x}from"./index-BBySSIJT.js";import{n as S}from"./module-host-BHOsDk69.js";import"./public-DoBzMSlG.js";import{n as C,t as w}from"./activity-idEO2qnr.js";import{t as T}from"./group--adLvfC6.js";var E=v(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),D=v(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),O=v(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),k=v(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),A=v(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),j=v(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),M=_(y(),1),N={activity:`_activity_k9yph_1`,panel:`_panel_k9yph_1`},P=b();function F({mode:e,api:n,onOpen:r}){let[i,a]=(0,M.useState)([]),[o,s]=(0,M.useState)(!0),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(0),[f,p]=h(`workbench.`+e+`.search`,``);(0,M.useEffect)(()=>{let e=!0;return n(`/command-center`).then(t=>{let n=t?.projects;if(!Array.isArray(n))throw Error(`项目状态返回格式异常`);e&&(a(n.filter(e=>!e.simulated)),l(``))}).catch(t=>{e&&(a([]),l(t instanceof Error?t.message:`项目状态读取失败`))}).finally(()=>{e&&s(!1)}),()=>{e=!1}},[n,u]);let m=w(i),_=C(i),v=e=>e.toLowerCase().includes(f.trim().toLowerCase());return(0,P.jsxs)(`section`,{className:N.activity,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`h1`,{children:e===`tasks`?`待处理事项`:`执行记录`}),(0,P.jsxs)(`label`,{children:[(0,P.jsx)(g,{size:16}),(0,P.jsx)(`input`,{"aria-label":`搜索工作台事项与记录`,value:f,onChange:e=>p(e.target.value),placeholder:`搜索项目或事项`})]})]}),c&&(0,P.jsxs)(`p`,{role:`alert`,children:[c,` `,(0,P.jsx)(`button`,{onClick:()=>{s(!0),d(e=>e+1)},children:`重试`})]}),o?(0,P.jsx)(`p`,{role:`status`,children:`正在读取项目状态…`}):(0,P.jsx)(`div`,{className:N.panel,children:e===`tasks`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`h2`,{children:[`需要你处理 · `,m.length,` 项`]}),m.filter(({project:e,step:t})=>v(e.name+t.name)).slice(0,30).map(({project:e,step:n})=>(0,P.jsxs)(`button`,{onClick:()=>r(e.id,n.target),children:[(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`b`,{children:[n.name,` · `,n.state===`attention`?`待复核`:`待确认`]}),(0,P.jsxs)(`small`,{children:[e.name,` · `,n.description]})]}),(0,P.jsx)(t,{size:16})]},e.id+n.id)),!m.length&&(0,P.jsx)(`p`,{children:c?`连接恢复后显示待处理事项。`:`当前没有待复核或待确认的阶段。`})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`h2`,{children:`项目执行与确认记录`}),_.filter(({project:e,event:t})=>v(e.name+t.name)).slice(0,50).map(({project:e,event:n},i)=>(0,P.jsxs)(`button`,{onClick:()=>r(e.id,{tab:`wiki`}),children:[(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`b`,{children:[n.name,` · `,n.state]}),(0,P.jsxs)(`small`,{children:[e.name,` · `,new Date(n.at).toLocaleString(`zh-CN`)]})]}),(0,P.jsx)(t,{size:16})]},e.id+n.at+i)),!_.length&&(0,P.jsx)(`p`,{children:c?`连接恢复后显示执行记录。`:`当前没有执行记录。`})]})})]})}async function I(e){let[t,n]=await Promise.all([e(`/growth-center`),e(`/command-center`)]),r=t,i=n.projects;if(!Array.isArray(r?.products)||!Array.isArray(r?.catalog)||!Array.isArray(i))throw Error(`经营资料返回格式异常`);return{growth:r,projects:i}}var L={refunds:`同期支付订单的退款`,product:`货品成本`,fulfillment:`运费与履约`,platform:`平台费用`,ads:`广告花费`,tax:`税费`,other:`其他变动费用`,fixed:`固定费用分摊`};function R(e){try{let t=JSON.parse(e||`{}`);return t.version!==1||!t.orders||typeof t.orders!=`object`||Array.isArray(t.orders)?{}:Object.fromEntries(Object.entries(t.orders).slice(0,20).filter(([e,t])=>e.length<100&&Array.isArray(t)).map(([e,t])=>[e,[...new Set(t.filter(e=>typeof e==`string`&&e.length<200))].slice(0,2500)]))}catch{return{}}}function z(e,t){let n=new Set(t);return[...(e||[]).filter(e=>n.delete(e)),...t.filter(e=>n.delete(e))]}function ee(e,t,n,r){let i=[...new Set([...e||[],...t])];if(!t.includes(n)||!t.includes(r)||n===r)return i;let a=i.indexOf(n),o=i.indexOf(r);return i.splice(a,1),i.splice(o,0,n),i}var B=(0,M.createContext)(null);function V({scope:e,onDirty:t,children:n}){let r=e?`omni.dashboard-layout.v1:`+encodeURIComponent(e):null,[i]=(0,M.useState)(()=>{try{return r?R(localStorage.getItem(r)):{}}catch{return{}}}),[a,o]=h(`dashboard.layout.`+(e||`session`),i),[s,c]=(0,M.useState)(a),[l,u]=(0,M.useState)(!1),[d,f]=(0,M.useState)(``),[p,m]=(0,M.useState)(null),g=l&&JSON.stringify(s)!==JSON.stringify(a);(0,M.useEffect)(()=>(t?.(g),()=>t?.(!1)),[g,t]);let _=()=>{u(!1),m(null)};function v(){try{r&&localStorage.setItem(r,JSON.stringify({version:1,orders:s})),o(s),_(),f(r?`布局已保存到当前账号的此台设备。`:`布局已保存,本次会话内有效。`)}catch{f(`布局保存失败,请检查本机存储后重试;当前调整仍保留。`)}}let y={editing:l,orders:s,drag:p,setDrag:m,scope:e,message:d,begin:()=>{c(a),u(!0),f(`拖动卡片左上角,或用前移、后移按钮调整顺序。`)},save:v,cancel:()=>{c(a),_(),f(`已取消本次布局修改。`)},reset:e=>{c(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!e.includes(t)))),f(`当前页已恢复默认排列,点击保存后生效。`)},move:(e,t,n,r)=>{c(i=>({...i,[e]:ee(i[e],t,n,r)})),f(`顺序已调整,保存后记住布局。`)}};return(0,P.jsx)(B.Provider,{value:y,children:(0,P.jsx)(`div`,{className:l?`dashboard-editing`:``,onClickCapture:e=>{l&&!e.target.closest(`[data-layout-control]`)&&(e.preventDefault(),e.stopPropagation())},children:n})})}function te({enabled:e=!0,groups:t=[]}){let n=(0,M.useContext)(B);return!n||!e&&!n.editing?null:(0,P.jsxs)(`div`,{className:`dl-toolbar`,"data-layout-control":!0,children:[(0,P.jsx)(`div`,{className:`dl-toolbar-actions`,children:n.editing?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{children:`调整卡片顺序`}),(0,P.jsxs)(`button`,{onClick:()=>n.reset(t),children:[(0,P.jsx)(A,{size:13}),`恢复默认`]}),(0,P.jsxs)(`button`,{onClick:n.cancel,children:[(0,P.jsx)(x,{size:13}),`取消`]}),(0,P.jsxs)(`button`,{className:`dl-save`,onClick:n.save,children:[(0,P.jsx)(i,{size:14}),`保存布局`]})]}):(0,P.jsxs)(`button`,{onClick:n.begin,children:[(0,P.jsx)(c,{size:14}),`编辑页面`]})}),n.message&&(0,P.jsx)(`small`,{role:`status`,children:n.message})]})}function ne({group:n,className:r=``,children:i}){let a=(0,M.useContext)(B),o=M.Children.toArray(i).filter(M.isValidElement).map((e,t)=>({id:String(e.key??t).replace(/^\.\$/,``),el:e})),s=o.map(e=>e.id),c=z(a?.orders[n],s);return(0,P.jsx)(`div`,{className:r,children:c.map((r,i)=>{let l=o.find(e=>e.id===r).el,u=l.props[`data-layout-label`]||`卡片`;return(0,M.cloneElement)(l,{key:r,"data-layout-card":r,"data-layout-group":n,className:[l.props.className,`dl-card`,a?.editing?`dl-editable`:``,a?.drag?.group===n&&a.drag.id===r?`dl-dragging`:``].filter(Boolean).join(` `),onDragOver:e=>{a?.editing&&a.drag?.group===n&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`)},onDrop:e=>{a?.editing&&a.drag?.group===n&&(e.preventDefault(),e.stopPropagation(),a.move(n,s,a.drag.id,r),a.setDrag(null))}},a?.editing?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`dl-card-controls`,"data-layout-control":!0,children:[(0,P.jsxs)(`button`,{className:`dl-grip`,"aria-label":`拖动`+u,title:`拖动调整顺序`,onPointerDown:e=>{e.button===0&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),a.setDrag({group:n,id:r}))},onPointerUp:e=>{if(!e.currentTarget.hasPointerCapture(e.pointerId))return;e.currentTarget.releasePointerCapture(e.pointerId);let t=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-layout-group]`);for(;t&&t.dataset.layoutGroup!==n;)t=t.parentElement?.closest(`[data-layout-group]`);let i=t?.dataset.layoutCard;i&&i!==r&&a.move(n,s,r,i),a.setDrag(null)},onPointerCancel:()=>a.setDrag(null),children:[(0,P.jsx)(O,{size:14}),(0,P.jsx)(`span`,{children:u})]}),(0,P.jsx)(`button`,{disabled:i===0,"aria-label":`前移`+u,title:`前移`,onClick:()=>a.move(n,s,r,c[i-1]),children:(0,P.jsx)(e,{size:13})}),(0,P.jsx)(`button`,{disabled:i===c.length-1,"aria-label":`后移`+u,title:`后移`,onClick:()=>a.move(n,s,r,c[i+1]),children:(0,P.jsx)(t,{size:13})})]}),l.props.children]}):l.props.children)})})}var H=e=>typeof e==`number`?e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):`—`;function re({metrics:e,products:t,projects:i,ready:a,onOpen:o,onNav:s,onAssign:c,demo:l}){let[u,d]=(0,M.useState)(``),[f,m]=(0,M.useState)(``),h=e?.sales||[],g=h.find(e=>e.id===f)||h[0],_=(e?.finance||[]).filter(e=>!g||e.start===g.start&&e.end===g.end),v=_.find(e=>e.scope?.type===`shop`&&(l||e.project===g?.project)),y=_.filter(e=>e.scope?.type===`item`&&(l||e.project===g?.project)),b=y.filter(e=>e.complete),S=b.filter(e=>e.profit>0),C=b.filter(e=>e.profit<0),w=b.filter(e=>e.profit===0),T=e?.incubation||[],O=T.filter(e=>e.success),A=i.reduce((e,t)=>e+t.running,0),j=[{id:`sales`,label:`店铺销售额`,value:g?H(g.total):`暂无记录`,unit:g?`元`:``,note:g?`${g.start} — ${g.end}`:`先归档全店销售数据`,Icon:r},{id:`profit`,label:`店铺利润`,value:v?.complete?H(v.profit):`缺成本资料`,unit:v?.complete?`元`:``,note:`已列成本口径经营结余 · 点击核对`,Icon:D},{id:`links`,label:`盈利 / 亏损链接`,value:b.length?`${S.length} / ${C.length}`:`尚未核算`,unit:b.length?`个`:``,note:`${b.length} 个有核算结果 · ${w.length} 个持平`,Icon:p},{id:`incubation`,label:`孵化晋级记录`,value:T.length?`${O.length} / ${T.length}`:`尚无记录`,unit:T.length?`个`:``,note:`已记录晋级 / 累计纳入 · 不代表成功率`,Icon:k},{id:`tasks`,label:`正在执行的任务`,value:a?A:`—`,unit:`个`,note:`${i.filter(e=>e.complete).length} 个项目流程已确认`,Icon:E}];function N(e){if(e===`tasks`){s(`projects`);return}d(u===e?``:e)}let F=e=>l?`data:application/json;charset=utf-8,`+encodeURIComponent(JSON.stringify(e,null,2)):`/api/workbench/`+e.project+`/file/`+(e.artifactId||e.id);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(ne,{group:`cockpit.kpis`,className:`gc-kpis`,children:j.map(e=>(0,P.jsx)(`div`,{"data-layout-label":e.label,children:(0,P.jsxs)(`button`,{className:`gc-kpi gc-kpi-`+e.id+` `+(u===e.id?`is-open`:``),onClick:()=>N(e.id),"aria-expanded":u===e.id,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{className:`gc-kpi-icon`,children:(0,P.jsx)(e.Icon,{size:21})}),(0,P.jsx)(`span`,{children:e.label}),(0,P.jsx)(n,{size:13})]}),(0,P.jsxs)(`strong`,{className:String(e.value).length>9?`gc-long-value`:``,children:[e.value,(0,P.jsx)(`small`,{children:e.unit})]}),(0,P.jsx)(`p`,{children:e.note})]},e.id)},e.id))}),u&&(0,P.jsxs)(`section`,{className:`gb-detail`,"aria-label":`经营指标明细`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:l?`演示数据 · 不代表真实经营结果`:`归档数据 · 以原件日期和来源为准`}),(0,P.jsxs)(`h2`,{children:[j.find(e=>e.id===u)?.label,` · 明细与下一步`]})]}),(0,P.jsx)(`button`,{"aria-label":`关闭指标明细`,onClick:()=>d(``),children:(0,P.jsx)(x,{size:18})})]}),u===`sales`&&(0,P.jsxs)(P.Fragment,{children:[h.length>1&&(0,P.jsxs)(`label`,{children:[`选择统计记录`,(0,P.jsx)(`select`,{"aria-label":`销售统计记录`,value:g?.id||``,onChange:e=>m(e.target.value),children:h.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.projectName,` · `,e.start,` ~ `,e.end]},e.id))})]}),g?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{children:g.basis}),(0,P.jsxs)(`p`,{children:[`统计范围:`,g.scopeLabel,` · `,g.count,` 个链接 · `,g.identity,`。`,g.mode===`unverified`?`来源未完成独立核验。`:``]}),(0,P.jsx)(`div`,{className:`gb-table`,children:(0,P.jsxs)(`table`,{children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`商品 / 分类`}),(0,P.jsx)(`th`,{children:`支付销售额`}),(0,P.jsx)(`th`,{children:`链接数`}),(0,P.jsx)(`th`,{children:`下一步`})]})}),(0,P.jsx)(`tbody`,{children:g.breakdown.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:e.name}),(0,P.jsxs)(`td`,{children:[`¥ `,H(e.sales)]}),(0,P.jsx)(`td`,{children:e.count}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`button`,{onClick:()=>e.itemId?o(e.project,{tab:`monitor`,itemId:e.itemId}):o(g.project,{tab:`data`}),children:e.itemId?`看商品表现`:`核对来源数据`})})]},e.name))})]})}),(0,P.jsx)(`p`,{className:`gb-next`,children:`下一步:先看销售贡献高的商品,再核对退款和成本,决定继续推广还是调整商品。`}),(0,P.jsx)(`a`,{href:F(g),download:l?`模拟销售账本.json`:void 0,children:`查看原始记录`})]}):(0,P.jsx)(`p`,{children:`当前没有全店销售记录。先到数据中心归档同一店铺、同一统计窗口的数据。`}),(0,P.jsx)(`button`,{onClick:()=>s(`data`),children:`进入数据中心`})]}),u===`profit`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{children:`计算:支付销售额 − 同支付订单退款 − 货品、履约、平台、广告、税费、其他费用 − 固定费用分摊。结果是已列成本口径经营结余。`}),v?.complete?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`gb-costs`,children:[Object.entries(v.amounts).map(([e,t])=>(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:e===`gross`?`支付销售额`:L[e]}),(0,P.jsxs)(`b`,{children:[`¥ `,H(t)]})]},e)),(0,P.jsxs)(`div`,{className:`gb-profit`,children:[(0,P.jsx)(`span`,{children:`经营结余`}),(0,P.jsxs)(`b`,{children:[`¥ `,H(v.profit)]})]})]}),(0,P.jsx)(`a`,{href:F(v),download:l?`模拟利润账本.json`:void 0,children:`查看核算原件`})]}):(0,P.jsxs)(`div`,{className:`gb-gap`,children:[(0,P.jsx)(`b`,{children:`没有完整的真实店铺成本账本,不能计算利润。`}),(0,P.jsx)(`p`,{children:`需要补齐:货品、运费、平台、广告、税费、其他费用、固定费用分摊,以及同支付订单退款。明确没有发生的费用填0,未知项留空。`})]}),(0,P.jsx)(`p`,{className:`gb-next`,children:`下一步:核对金额和凭证;若亏损,先查看费用占比与亏损商品,再进入商品优化评估原因。`}),(0,P.jsx)(`button`,{onClick:()=>o(v?.project||g?.project||i[0]?.id,{tab:`finance`}),disabled:!i.length,children:`打开经营核算`})]}),u===`links`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{children:`按同周期、完整成本账本判断:结余大于0为盈利,小于0为亏损,等于0为持平;缺成本的商品不计入盈亏。当前仅统计有账本的范围。`}),(0,P.jsx)(`div`,{className:`gb-table`,children:(0,P.jsxs)(`table`,{children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`商品`}),(0,P.jsx)(`th`,{children:`销售额`}),(0,P.jsx)(`th`,{children:`经营结余`}),(0,P.jsx)(`th`,{children:`状态`}),(0,P.jsx)(`th`,{children:`下一步`})]})}),(0,P.jsx)(`tbody`,{children:y.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsxs)(`td`,{children:[e.projectName,(0,P.jsx)(`small`,{children:e.scope.id})]}),(0,P.jsxs)(`td`,{children:[`¥ `,H(e.gross)]}),(0,P.jsx)(`td`,{children:e.complete?`¥ `+H(e.profit):`费用不全`}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`span`,{className:e.profit<0?`gb-loss`:`gb-win`,children:e.complete?e.profit>0?`盈利`:e.profit<0?`亏损`:`持平`:`待核算`})}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`button`,{onClick:()=>o(e.project,{tab:e.complete?`optimization`:`finance`,itemId:e.scope.id}),children:e.complete?`查看并优化`:`补齐费用`})})]},e.id))})]})}),!y.length&&(0,P.jsx)(`p`,{children:`还没有商品级真实账本。当前看板商品不能仅凭销售额判定盈亏。`}),(0,P.jsx)(`button`,{disabled:!i.length,onClick:()=>o(g?.project||i[0]?.id,{tab:`finance`}),children:`补充商品成本账本`})]}),u===`incubation`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{children:`这里只统计已保存的运营晋级记录与累计纳入数量,不计算经营成功率。未晋级可能仍在观察,不代表失败;每条记录需要核对标准、证据和观察时间,不能推断可复制收益。`}),(0,P.jsxs)(`div`,{className:`gb-inc-summary`,children:[(0,P.jsxs)(`b`,{children:[O.length,(0,P.jsx)(`small`,{children:`达标晋级`})]}),(0,P.jsx)(`span`,{children:`/`}),(0,P.jsxs)(`b`,{children:[T.length,(0,P.jsx)(`small`,{children:`纳入孵化`})]})]}),(0,P.jsx)(`div`,{className:`gb-table`,children:(0,P.jsxs)(`table`,{children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`商品`}),(0,P.jsx)(`th`,{children:`加入时间`}),(0,P.jsx)(`th`,{children:`结果`}),(0,P.jsx)(`th`,{children:`老师标准与依据`}),(0,P.jsx)(`th`,{children:`下一步`})]})}),(0,P.jsx)(`tbody`,{children:T.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:e.itemId}),(0,P.jsx)(`td`,{children:e.started.slice(0,10)}),(0,P.jsx)(`td`,{children:e.success?`达标晋级`:`继续观察`}),(0,P.jsxs)(`td`,{className:`gb-wrap`,children:[e.standard||`待记录老师标准`,(0,P.jsx)(`small`,{children:e.evidence||`尚无达标证据`})]}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`button`,{onClick:()=>{let n=t.find(t=>t.itemId===e.itemId&&t.project===e.project);n?c(n):o(e.project,{tab:`data`})},children:e.success?`查看运营分组`:`核对并晋级`})})]},e.key))})]})}),!T.length&&(0,P.jsx)(`p`,{children:`还没有新品进入孵化的记录,暂不能评价。`}),(0,P.jsx)(`p`,{className:`gb-next`,children:`下一步:先把新品加入“新品测试”;达标后选择下一运营分组,填写老师标准与达标依据。单纯换组不计为已记录达标晋级。`}),(0,P.jsx)(`button`,{disabled:!t.length,onClick:()=>c(t.find(e=>e.tier===`unassigned`)||t[0],`test`),children:`登记新品,开始孵化`})]})]})]})}var ie=e=>Math.abs(e)>=1e4?(e/1e4).toFixed(1)+`万`:U(e),U=e=>typeof e==`number`?e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):`—`,W={scale:`#35dcca`,incubate:`#9880ff`,test:`#438bff`,unassigned:`var(--omni-muted,#91a9bd)`},G={scale:`重点推广`,incubate:`持续孵化`,test:`新品测试`,unassigned:`待分组`},K=[{id:`business`,label:`经营分析`,note:`查看商品经营趋势、销售构成和运营分组。`},{id:`projects`,label:`项目总览`,note:`全局看进度,卡片看状态,进入节点主流程继续推进。`},{id:`tasks`,label:`待办与任务`,note:`集中查看运营任务、巡店提醒和需要你处理的事项。`},{id:`history`,label:`复盘动态`,note:`回看项目阶段与历史记录,核对过程和依据。`}],q={done:`已确认`,review:`待确认`,attention:`需处理`,todo:`未开始`,stopped:`已停止`};function J({title:e,sub:t,children:n}){return(0,P.jsxs)(`div`,{className:`gc-panel-head`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`h2`,{children:[(0,P.jsx)(`span`,{}),` `,e]}),(0,P.jsx)(`small`,{children:t})]}),n]})}function ae({series:e,days:t,onOpen:i}){let[a,o]=(0,M.useState)(null),s=e?.points||[],c=Date.parse(s.at(-1)?.date)-(t-1)*864e5,l=s.filter(e=>Date.parse(e.date)>=c),u=l.filter(e=>e.value!==null).map(e=>e.value);if(!u.length)return(0,P.jsxs)(`div`,{className:`gc-chart-empty`,children:[(0,P.jsx)(r,{size:38}),(0,P.jsx)(`b`,{children:`这段时间还没有可用数据`}),(0,P.jsx)(`span`,{children:`进入商品监控,查看数据来源与日期`}),(0,P.jsxs)(`button`,{onClick:i,children:[`查看商品监控 `,(0,P.jsx)(n,{size:13})]})]});let d=Math.min(0,...u),f=Math.max(1,...u)-d,p=e=>54+(Date.parse(e.date)-c)/(Math.max(1,t-1)*864e5)*690,m=e=>220-(e-d)/f*180,h=null,g=[];return l.forEach(e=>{if(e.value===null){h=null;return}h&&Date.parse(e.date)-Date.parse(h.date)===864e5&&g.push((0,P.jsx)(`line`,{x1:p(h),y1:m(h.value),x2:p(e),y2:m(e.value)},e.date)),h=e}),(0,P.jsxs)(`div`,{className:`gc-chart`,children:[(0,P.jsxs)(`div`,{className:`gc-chart-reading`,children:[(0,P.jsxs)(`strong`,{children:[U(a?.value??l.at(-1)?.value),(0,P.jsx)(`small`,{children:e.unit})]}),(0,P.jsxs)(`span`,{children:[a?.date||l.at(-1)?.date,` · `,e.name]}),(0,P.jsx)(`i`,{children:`柱与线均为同一指标`})]}),(0,P.jsxs)(`svg`,{viewBox:`0 0 780 255`,role:`img`,"aria-label":`${e.name},最近${t}天归档趋势,缺失不补零`,children:[(0,P.jsx)(`defs`,{children:(0,P.jsxs)(`linearGradient`,{id:`gc-bar`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,P.jsx)(`stop`,{stopColor:`#5ec9ff`}),(0,P.jsx)(`stop`,{offset:`1`,stopColor:`#2857d6`,stopOpacity:`.3`})]})}),[0,.25,.5,.75,1].map(e=>(0,P.jsxs)(`g`,{children:[(0,P.jsx)(`line`,{className:`gc-gridline`,x1:`54`,x2:`750`,y1:m(d+f*e),y2:m(d+f*e)}),(0,P.jsx)(`text`,{x:`42`,y:m(d+f*e)+4,textAnchor:`end`,children:ie(d+f*e)})]},e)),l.map(n=>n.value===null?null:(0,P.jsxs)(`g`,{onMouseEnter:()=>o(n),onMouseLeave:()=>o(null),children:[(0,P.jsx)(`rect`,{x:p(n)-Math.min(8,230/t),y:Math.min(m(0),m(n.value)),width:Math.min(16,460/t),height:Math.max(1,Math.abs(m(0)-m(n.value))),rx:`2`,fill:`url(#gc-bar)`}),(0,P.jsx)(`circle`,{cx:p(n),cy:m(n.value),r:`3`,fill:`#6ceeff`}),(0,P.jsxs)(`title`,{children:[n.date,`:`,U(n.value),` `,e.unit]})]},n.date)),(0,P.jsx)(`g`,{className:`gc-line`,children:g}),[0,.25,.5,.75,1].map(e=>(0,P.jsx)(`text`,{x:54+690*e,y:`247`,textAnchor:`middle`,children:new Date(c+(t-1)*864e5*e).toISOString().slice(5,10)},e))]})]})}function Y(e){return(0,P.jsx)(V,{scope:e.layoutScope,onDirty:e.onDirty,children:(0,P.jsx)(X,{...e})})}function X({products:e,projects:t,catalog:r,ready:i,onAction:s,onAssign:c,onOpen:u,onNav:f,onTier:p,onCreate:m,onExecute:g,metrics:_,demo:v}){let[y,b]=h(`workbench.cockpit.tab`,`business`),x=K.find(e=>e.id===y)||K[0],S=(0,M.useRef)(null);function C(e){let t=K.findIndex(e=>e.id===x.id),n=e.key===`ArrowRight`?(t+1)%K.length:e.key===`ArrowLeft`?(t+K.length-1)%K.length:e.key===`Home`?0:e.key===`End`?K.length-1:-1;n<0||(e.preventDefault(),b(K[n].id),(S.current?.querySelectorAll(`[role=tab]`)[n])?.focus())}let[w,T]=h(`workbench.productKey`,``),[E,D]=h(`workbench.metric`,``),[O,k]=h(`workbench.days`,30),[A,N]=h(`workbench.timelineDays`,14),[F,I]=(0,M.useState)(null),L=e.find(e=>e.key===w)||e.find(e=>e.demoCurrent)||e[0],R=L?.series.find(e=>e.key===E)||L?.series.find(e=>[`paid`,`payAmt`,`sales`,`gmv`].includes(e.metric))||L?.series.find(e=>e.metric===`buyers`)||L?.series[0],z=t.reduce((e,t)=>e+t.running,0),ee=t.reduce((e,t)=>e+t.pending,0),B=e.filter(e=>l(e)),V=Object.keys(G).map(t=>({id:t,name:G[t],count:e.filter(e=>e.tier===t).length})),H=0,U=V.map(t=>{let n={...t,offset:H,length:e.length?t.count/e.length*314.16:0};return H+=n.length,n}),Y=t.filter(e=>e.replay?.some(e=>Number.isFinite(Date.parse(e.at)))).sort((e,t)=>String(t.updated).localeCompare(String(e.updated))),X=Math.max(0,...Y.flatMap(e=>e.replay.map(e=>Date.parse(e.at)).filter(Number.isFinite))),Z=X-(A-1)*864e5,le=[{label:`待选择运营分组`,items:e.filter(e=>e.tier===`unassigned`),color:`#8097b8`},{label:`数据需更新`,items:e.filter(e=>e.work?.needsUpdate),color:`#f3ba66`},{label:`任务需检查`,items:e.filter(e=>e.work?.problems?.length),color:`#f581a7`},{label:`近期运行中`,items:e.filter(e=>e.work?.active?.length),color:`#3ddad7`}],Q=_?.sales?.[0],$=(Q?.breakdown||[]).filter(e=>typeof e.sales==`number`).slice().sort((e,t)=>t.sales-e.sales).slice(0,8),ue=$.length>0&&$.every(e=>e.itemId),de=Math.max(1,...$.map(e=>e.sales));return(0,P.jsxs)(`div`,{className:`gc`,children:[(0,P.jsx)(te,{enabled:[`business`,`projects`].includes(x.id),groups:[`cockpit.kpis`,...x.id===`projects`?[`projects.modules`,`projects.stats`,`projects.cards`]:[`cockpit.business`]]}),(0,P.jsx)(re,{metrics:_,products:e,projects:t,ready:i,onOpen:u,onNav:f,onAssign:c,demo:v}),(0,P.jsxs)(`div`,{className:`gc-tabs-heading`,children:[(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`工作台分类`,className:`gc-tabs`,"data-layout-control":!0,ref:S,onKeyDown:C,children:K.map(e=>(0,P.jsx)(`button`,{role:`tab`,id:`gc-tab-`+e.id,"aria-controls":`gc-panel-`+e.id,"aria-selected":x.id===e.id,tabIndex:x.id===e.id?0:-1,onClick:()=>b(e.id),children:e.label},e.id))}),x.id===`projects`&&(0,P.jsxs)(`div`,{className:`pb-heading-actions`,children:[(0,P.jsxs)(`button`,{className:`pb-all-projects`,onClick:()=>f(`projects`),children:[`查看全部项目 `,(0,P.jsx)(n,{size:14})]}),(0,P.jsx)(`button`,{className:`pb-create`,onClick:m,children:`+ 新建项目`})]})]}),(0,P.jsx)(`p`,{className:`gc-tab-description`,children:x.note}),(0,P.jsxs)(`div`,{role:`tabpanel`,id:`gc-panel-`+x.id,"aria-labelledby":`gc-tab-`+x.id,tabIndex:0,className:`gc-tab-panel gc-tab-`+x.id,children:[x.id===`projects`&&(0,P.jsx)(o,{onExecute:g,projects:t,ready:i,onOpen:u,onCreate:m,showHeading:!1,previewLimit:8,onAllProjects:()=>f(`projects`)}),x.id===`tasks`&&(0,P.jsx)(`div`,{className:`gc-quick-tiers`,"aria-label":`运营策略任务速览`,children:[`test`,`incubate`,`scale`].map(t=>{let r=e.filter(e=>e.tier===t),i=r.filter(e=>e.work?.active?.length),o=r.filter(e=>l(e)),u=r.find(e=>e.demoCurrent)||i[0]||r[0];return(0,P.jsxs)(`section`,{style:{"--tier":W[t]},children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`b`,{children:G[t]}),(0,P.jsxs)(`span`,{children:[r.length,`个商品 · `,i.length,`个运行中`]}),(0,P.jsx)(`button`,{onClick:()=>p(t),"aria-label":`查看`+G[t]+`全部商品`,children:(0,P.jsx)(a,{size:14})})]}),(0,P.jsxs)(`button`,{className:`gc-quick-line`,disabled:!u,onClick:()=>s(u,`work`),children:[(0,P.jsx)(`em`,{children:`正在做`}),(0,P.jsxs)(`span`,{children:[u?u.demoCurrent||d(u):`等待商品加入`,u&&(0,P.jsx)(`small`,{children:u.projectName})]})]}),(0,P.jsxs)(`button`,{className:`gc-quick-line`,onClick:()=>u?s(u,`data`):c(null,t),children:[(0,P.jsx)(`em`,{children:`下一步`}),(0,P.jsx)(`span`,{children:u?.demoNext||(t===`test`?`核对点击和加购,选出潜力款`:t===`incubate`?`核对转化与成本,确认是否赚钱`:`检查推广效果,优化计划`)}),(0,P.jsx)(a,{size:12})]}),(0,P.jsxs)(`button`,{className:`gc-quick-alert `+(o.length?`has-issues`:``),onClick:()=>o.length?s(o[0],`work`):p(t),children:[o.length?`需要你处理 `+o.length+` 项 · `+l(o[0]):`暂无待处理提醒`,(0,P.jsx)(n,{size:12})]})]},t)})}),(0,P.jsxs)(ne,{group:`cockpit.`+x.id,className:`gc-main-grid`,children:[x.id===`business`&&(0,P.jsxs)(`section`,{"data-layout-label":`商品经营趋势`,className:`gc-panel gc-sales`,children:[(0,P.jsx)(J,{title:`商品经营趋势`,sub:`按商品查看归档数据,保留真实波动`,children:(0,P.jsx)(`div`,{className:`gc-toggle`,children:[7,30].map(e=>(0,P.jsxs)(`button`,{"aria-pressed":O===e,onClick:()=>k(e),children:[e,`天`]},e))})}),(0,P.jsxs)(`div`,{className:`gc-selects`,children:[(0,P.jsx)(`select`,{"aria-label":`驾驶舱商品`,value:L?.key||``,onChange:e=>{T(e.target.value),D(``)},children:e.map(e=>(0,P.jsxs)(`option`,{value:e.key,children:[e.title||e.projectName,` · `,e.shopName||e.itemId]},e.key))}),(0,P.jsx)(`select`,{"aria-label":`驾驶舱趋势指标`,value:R?.key||``,onChange:e=>D(e.target.value),children:L?.series.map(e=>(0,P.jsx)(`option`,{value:e.key,children:e.name},e.key))}),(0,P.jsxs)(`button`,{disabled:!L,onClick:()=>s(L,`data`),children:[`明细 `,(0,P.jsx)(a,{size:12})]})]}),(0,P.jsx)(ae,{series:R,days:O,onOpen:()=>L?s(L,`monitor`):f(`projects`)},L?.key+`|`+R?.key+`|`+O),(0,P.jsx)(`p`,{className:`gc-footnote`,children:`单商品数据,不等于全店销售额 · 缺失日期不连线 · 来源见归档详情`})]},`sales`),x.id===`business`&&(0,P.jsxs)(`section`,{"data-layout-label":`商品运营分组`,className:`gc-panel gc-structure`,children:[(0,P.jsx)(J,{title:`商品运营分组`,sub:`点击分类,查看商品和下一步`}),(0,P.jsxs)(`div`,{className:`gc-ring`,children:[(0,P.jsxs)(`svg`,{viewBox:`0 0 160 160`,role:`img`,"aria-label":V.map(e=>e.name+e.count+`个`).join(`,`),children:[(0,P.jsx)(`circle`,{cx:`80`,cy:`80`,r:`62`,fill:`none`,stroke:`#1e355b`,strokeWidth:`1`,strokeDasharray:`2 4`}),(0,P.jsx)(`circle`,{cx:`80`,cy:`80`,r:`50`,fill:`none`,stroke:`#152849`,strokeWidth:`18`}),U.filter(e=>e.count>0).map(e=>(0,P.jsx)(`circle`,{cx:`80`,cy:`80`,r:`50`,fill:`none`,stroke:W[e.id],strokeWidth:`18`,strokeDasharray:`${e.length} ${314.16-e.length}`,strokeDashoffset:-e.offset,transform:`rotate(-90 80 80)`},e.id)),(0,P.jsx)(`text`,{x:`80`,y:`80`,textAnchor:`middle`,className:`gc-ring-number`,children:i?e.length:`—`}),(0,P.jsx)(`text`,{x:`80`,y:`98`,textAnchor:`middle`,children:`商品观察对象`})]}),(0,P.jsx)(`div`,{className:`gc-ring-legend`,children:V.map(t=>(0,P.jsxs)(`button`,{onClick:()=>p(t.id),children:[(0,P.jsx)(`i`,{style:{background:W[t.id]}}),(0,P.jsx)(`span`,{children:t.name}),(0,P.jsx)(`b`,{children:t.count}),(0,P.jsxs)(`small`,{children:[e.length?Math.round(t.count/e.length*100):0,`%`]}),(0,P.jsx)(a,{size:12})]},t.id))})]}),(0,P.jsx)(`p`,{className:`gc-footnote`,children:`同一商品在不同项目中分别记录;人工策略分组以保存记录为准,不代表全店经营梯队。`})]},`structure`),x.id===`business`&&(0,P.jsxs)(`section`,{"data-layout-label":`销售构成`,className:`gc-panel gc-ranking`,children:[(0,P.jsx)(J,{title:ue?`商品销售排行`:`销售构成`,sub:Q?Q.start+` — `+Q.end+` · 同一份销售账本`:`按同一统计期的销售账本排名`}),(0,P.jsx)(`div`,{className:`gc-rank-list`,children:$.map((e,t)=>(0,P.jsxs)(`button`,{onClick:()=>u(e.project||Q.project,{tab:e.itemId?`monitor`:`data`,itemId:e.itemId}),children:[(0,P.jsx)(`i`,{children:t+1}),(0,P.jsxs)(`span`,{title:e.name||e.itemId,children:[e.name||e.itemId,(0,P.jsx)(`small`,{children:e.itemId||e.count+`个商品`})]}),(0,P.jsx)(`div`,{children:(0,P.jsx)(`b`,{style:{width:Math.max(2,e.sales/de*100)+`%`}})}),(0,P.jsxs)(`strong`,{children:[`¥`,ie(e.sales)]})]},e.project+`|`+(e.itemId||e.name)))}),!$.length&&(0,P.jsxs)(`p`,{className:`gc-no-data`,children:[`还没有同期商品销售明细。`,(0,P.jsx)(`button`,{onClick:()=>f(`data`),children:`查看已有资料`})]}),(0,P.jsx)(`p`,{className:`gc-footnote`,children:ue?`点击商品核对明细 · 销售排名不代表盈利排名`:`原件按品类汇总,点击查看归档;不是单品排名`})]},`ranking`),x.id===`tasks`&&(0,P.jsxs)(`section`,{"data-layout-label":`巡店检查`,className:`gc-panel gc-inspect`,children:[(0,P.jsx)(J,{title:`巡店检查`,sub:`基于归档与任务状态 · 点击查看待办`,children:(0,P.jsx)(j,{size:17})}),(0,P.jsx)(`div`,{className:`gc-checks`,children:le.map(t=>(0,P.jsxs)(`button`,{disabled:!t.items.length,onClick:()=>t.label===`待选择运营分组`?c(t.items[0]):s(t.items[0],`work`),children:[(0,P.jsx)(`span`,{children:t.label}),(0,P.jsx)(`div`,{children:(0,P.jsx)(`i`,{style:{width:`${e.length?t.items.length/e.length*100:0}%`,background:t.color}})}),(0,P.jsx)(`b`,{children:i?t.items.length:`—`}),(0,P.jsx)(a,{size:12})]},t.label))}),(0,P.jsx)(`p`,{className:`gc-footnote`,children:`同一商品可有多项提醒,数量不可相加;点击先处理一项。`}),(0,P.jsxs)(`div`,{className:`gc-archive`,children:[(0,P.jsx)(oe,{count:r.length}),(0,P.jsxs)(`button`,{onClick:()=>f(`data`),children:[`查看来源 `,(0,P.jsx)(n,{size:12})]})]})]},`inspect`),x.id===`history`&&(0,P.jsxs)(`section`,{"data-layout-label":`项目阶段记录`,className:`gc-panel gc-matrix`,children:[(0,P.jsx)(J,{title:`项目阶段记录`,sub:`节点流程与历史六步记录分别保留,点击核对对应阶段`,children:(0,P.jsxs)(`button`,{onClick:()=>f(`projects`),children:[`全部项目 `,(0,P.jsx)(n,{size:12})]})}),(0,P.jsx)(`div`,{className:`gc-state-legend`,children:Object.entries(q).map(([e,t])=>(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`i`,{className:e}),t]},e))}),(0,P.jsxs)(`div`,{className:`gc-matrix-scroll`,children:[t.slice(0,8).map(e=>(0,P.jsxs)(`div`,{className:`gc-matrix-row`,children:[(0,P.jsxs)(`button`,{className:`gc-project-name`,title:e.name,onClick:()=>u(e.id,{tab:`overview`}),children:[e.name,(0,P.jsxs)(`small`,{children:[e.done,`/`,e.total,` 阶段已确认`]})]}),(0,P.jsx)(`div`,{children:e.route.map((t,n)=>(0,P.jsx)(`button`,{className:`gc-cell `+t.state,"aria-label":`${e.name}:${t.name},${q[t.state]}`,title:`${t.name} · ${q[t.state]}`,onClick:()=>u(e.id,t.target),children:String(n+1).padStart(2,`0`)},t.id))})]},e.id)),!t.length&&(0,P.jsx)(`p`,{className:`gc-no-data`,children:`当前范围还没有项目。`})]})]},`matrix`),x.id===`history`&&(0,P.jsxs)(`section`,{"data-layout-label":`项目历史时间轴`,className:`gc-panel gc-history`,children:[(0,P.jsx)(J,{title:`项目历史时间轴`,sub:v?`模拟历史记录;每天的记录合并为一个色块`:`按真实归档时间显示;每天的记录合并为一个色块`,children:(0,P.jsx)(`div`,{className:`gc-toggle`,children:[14,30].map(e=>(0,P.jsxs)(`button`,{"aria-pressed":A===e,onClick:()=>N(e),children:[e,`天`]},e))})}),X>0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`gc-time-header`,children:[(0,P.jsx)(`span`,{children:`项目 / 点击查看记录`}),(0,P.jsx)(`div`,{children:[0,.25,.5,.75,1].map(e=>(0,P.jsx)(`span`,{children:new Date(Z+(X-Z)*e).toISOString().slice(5,10)},e))})]}),(0,P.jsx)(`div`,{className:`gc-time-scroll`,children:Y.filter(e=>e.replay.some(e=>Date.parse(e.at)>=Z)).slice(0,7).map(e=>(0,P.jsxs)(`div`,{className:`gc-time-row`,children:[(0,P.jsx)(`button`,{title:e.name,onClick:()=>I({project:e,events:e.replay}),children:e.name}),(0,P.jsx)(`div`,{children:se(e.replay.filter(e=>Date.parse(e.at)>=Z)).map(t=>(0,P.jsx)(`button`,{className:`gc-event `+(t.events.some(e=>/失败|停止/.test(e.state))?`bad`:t.events.some(e=>/确认|完成/.test(e.state))?`done`:`saved`),style:{left:`${(Date.parse(t.events[0].at)-Z)/(X-Z)*100}%`},title:`${t.date} · ${t.events.length} 条记录`,"aria-label":`${e.name}:${t.date},${t.events.length}条记录`,onClick:()=>I({project:e,events:t.events,date:t.date}),children:t.events.length},t.date))})]},e.id))}),(0,P.jsxs)(`p`,{className:`gc-footnote`,children:[`最近有记录的日期窗口 · 每个项目最多展示最近120条记录 · 点击色块展开当天记录,不代表运行时长;`,v?`演示操作会追加记录。`:`完整回放在项目执行页。`]})]}):(0,P.jsx)(`p`,{className:`gc-no-data`,children:`暂无可回放的历史记录。`})]},`history`),x.id===`tasks`&&(0,P.jsxs)(`section`,{"data-layout-label":`需要你处理`,className:`gc-panel gc-todo`,children:[(0,P.jsx)(J,{title:`需要你处理`,sub:`先做这一件,再继续下一步`,children:(0,P.jsxs)(`span`,{className:`gc-badge`,children:[B.length,` 项`]})}),(0,P.jsxs)(`div`,{className:`gc-todo-list`,children:[B.map((e,t)=>(0,P.jsxs)(`button`,{onClick:()=>e.tier===`unassigned`?c(e):s(e,`work`),children:[(0,P.jsx)(`span`,{className:`gc-todo-num`,children:String(t+1).padStart(2,`0`)}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:l(e)}),(0,P.jsxs)(`span`,{children:[e.title||e.projectName,` · `,e.shopName||e.itemId]}),(0,P.jsx)(`small`,{children:d(e)})]}),(0,P.jsx)(a,{size:15})]},e.key)),!B.length&&(0,P.jsx)(`p`,{className:`gc-no-data`,children:i?`当前没有商品待办。`:`正在读取…`}),(0,P.jsx)(`h3`,{className:`gc-next-label`,children:`接下来可以做`}),t.slice(0,5).map(e=>(0,P.jsxs)(`button`,{onClick:()=>u(e.id,{tab:`overview`}),children:[(0,P.jsx)(`span`,{className:`gc-next-dot`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:e.name}),(0,P.jsx)(`span`,{children:`查看项目节点与下一步`})]}),(0,P.jsx)(a,{size:13})]},`next-`+e.id))]})]},`todo`)]})]}),F&&(0,P.jsx)(ce,{...F,onClose:()=>I(null),onOpen:u}),(0,P.jsxs)(`div`,{className:`gc-status-strip`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`i`,{}),` `,v?`教学模拟`:`归档数据`,` · `,e.length,` 个商品`]}),(0,P.jsxs)(`span`,{children:[t.length,` 个项目 · `,t.filter(e=>e.started).length,` 个已开展 · `,t.filter(e=>e.complete).length,` 个流程已确认`]}),(0,P.jsxs)(`span`,{children:[z,` 项运行中 · `,ee,` 项待执行`]}),(0,P.jsxs)(`button`,{onClick:()=>f(`products`),children:[`展开运营工作清单 `,(0,P.jsx)(n,{size:13})]})]})]})}function oe({count:e}){return(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`b`,{children:e}),` 份归档资料可追溯`]})}function se(e){let t=new Map;for(let n of e){let e=new Date(Date.parse(n.at)+8*36e5).toISOString().slice(0,10);t.set(e,[...t.get(e)||[],n])}return[...t].map(([e,t])=>({date:e,events:t}))}function ce({project:e,events:t,date:n,onClose:r,onOpen:i}){let a=(0,M.useRef)(null);return(0,M.useEffect)(()=>{a.current?.showModal()},[]),(0,P.jsxs)(`dialog`,{className:`ta-dialog gc-history-dialog`,ref:a,onClose:r,"aria-labelledby":`gc-history-title`,children:[(0,P.jsxs)(`div`,{className:`ta-dialog-head`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:e.name}),(0,P.jsxs)(`h2`,{id:`gc-history-title`,children:[n||`项目历史`,` · `,t.length,` 条记录`]})]}),(0,P.jsx)(`button`,{"aria-label":`关闭历史记录`,onClick:r,children:`×`})]}),(0,P.jsx)(`p`,{children:`按发生时间排列。展开记录,查看当时做了什么。`}),(0,P.jsx)(`div`,{className:`gc-records`,children:t.map((t,n)=>(0,P.jsxs)(`details`,{children:[(0,P.jsxs)(`summary`,{children:[(0,P.jsx)(`span`,{children:new Date(t.at).toLocaleString(`zh-CN`,{timeZone:`Asia/Shanghai`})}),(0,P.jsx)(`b`,{children:t.name}),(0,P.jsx)(`em`,{children:t.state})]}),(0,P.jsx)(`p`,{children:t.detail||`此记录没有保存详细说明,可进入对应阶段核对原始资料。`}),(0,P.jsx)(`button`,{onClick:()=>{r(),i(e.id,e.route.find(e=>e.id===t.routeId)?.target||{tab:`data`})},children:`进入对应阶段 / 资料`})]},n))})]})}function Z(){let e=S(),[t,n]=(0,M.useState)(null),[r,i]=(0,M.useState)(!0),[a,o]=(0,M.useState)(``),[c,l]=(0,M.useState)(``),[d,p]=(0,M.useState)(0),[g,_]=h(`workbench.scope`,`real`),[v,y]=(0,M.useState)(null),[b,x]=(0,M.useState)(null);(0,M.useEffect)(()=>{let t=!0;return I(e.api).then(e=>{t&&(n(e),o(``))}).catch(e=>{t&&(n(null),o(e instanceof Error?e.message:`经营资料读取失败`))}).finally(()=>{t&&i(!1)}),()=>{t=!1}},[e.api,d]);let C=e=>g===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`,w=t?.growth.products.filter(C)||[],E=t?.growth.catalog.filter(C)||[],D=t?.projects.filter(e=>g===`stored-demo`?e.simulated:!e.simulated)||[],O={sales:t?.growth.metrics?.sales?.filter(C)||[],finance:t?.growth.metrics?.finance?.filter(C)||[],incubation:t?.growth.metrics?.incubation?.filter(C)||[]},k=(0,M.useCallback)(()=>{i(!0),p(e=>e+1)},[]);s(D.some(e=>e.execution?.state===`running`),k);function A(t,n){n===`work`?x(t):n===`data`?e.onProductGroup(`all`,t,g):e.onOpen(t.project,{tab:n,itemId:t.itemId})}return(0,P.jsx)(`div`,{className:`workbench-module`,children:(0,P.jsx)(`div`,{className:`gw`,children:(0,P.jsxs)(`div`,{className:`gw-body`,children:[(0,P.jsxs)(`header`,{className:`gw-header`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`工作台 / 经营总览`}),(0,P.jsx)(`h1`,{children:`电商运营作战台`})]}),(0,P.jsxs)(`div`,{className:`gw-header-actions`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`i`,{className:`gw-dot`}),g===`stored-demo`?`模拟归档 · 非真实经营`:`归档数据 · 非实时`]}),(0,P.jsxs)(`button`,{disabled:r,onClick:k,children:[(0,P.jsx)(m,{size:14}),r?`读取中`:`刷新数据`]})]})]}),(0,P.jsxs)(`div`,{className:`gw-scope`,children:[(0,P.jsx)(`div`,{children:[[`real`,`非模拟资料`],[`stored-demo`,`模拟资料`]].map(([e,t])=>(0,P.jsx)(`button`,{"aria-pressed":g===e,onClick:()=>{_(e),y(null),x(null),l(``)},children:t},e))}),(0,P.jsx)(`span`,{children:t?`${new Date(t.growth.updatedAt).toLocaleString(`zh-CN`)} 读取归档`:`正在读取归档…`})]}),a&&(0,P.jsxs)(`p`,{role:`alert`,className:`gw-message`,children:[a,` `,(0,P.jsx)(`button`,{onClick:k,children:`重试`})]}),c&&(0,P.jsx)(`p`,{role:`status`,className:`gw-message`,children:c}),(0,P.jsx)(Y,{layoutScope:e.layoutScope,onDirty:e.onDirty,onCreate:e.onCreate,products:w,projects:D,catalog:E,metrics:O,ready:!r&&!!t,demo:!1,onOpen:e.onOpen,onNav:e.onModule,onTier:t=>e.onProductGroup(t,void 0,g),onAction:A,onAssign:(e,t)=>y({product:e,suggestedTier:t})}),v&&(0,P.jsx)(u,{...v,products:w,onDirty:e.onDirty,onBusy:e.onBusy,onClose:()=>y(null),onSave:async(t,n,r,i)=>{await T(e.api,t,n,r,i),l(`分组已保存,正在更新看板。`),k()}}),b&&(0,P.jsx)(f,{product:b,onOpen:e.onOpen,onClose:()=>x(null)})]})})})}function le({section:e}){let t=S();return e===`tasks`||e===`records`?(0,P.jsx)(F,{mode:e,api:t.api,onOpen:t.onOpen},e):(0,P.jsx)(Z,{})}export{le as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./CollaborationWorkspace-DAWo2Vol.js";import{o as t}from"./index-BBySSIJT.js";var n=t();function r({selectedId:t,project:r}){let i=t||r?.projectId;return(0,n.jsx)(e,{initialProjectId:i},i||`directory`)}export{r as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./project-public-DqjxO6ad.js","./index-BBySSIJT.js","./index-7NKGenq7.css","./CartesianChart-acGhtLrw.js","./LineChart-CyiCaQMM.js","./EvidenceSourceGuide-qBsaH1fx.js","./HelpTip-X4GpEnvk.js","./HelpTip-BsHPhMNf.css"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./clock-3-DpvJxor3.js";import{t}from"./chevron-right-2HEa4oQb.js";import{i as n,n as r,r as i,t as a}from"./products-CfPFkCnk.js";import{t as o}from"./layers-BY0DtVnH.js";import{t as s}from"./refresh-cw-BZ6-gKfF.js";import{n as c,r as l}from"./workspace-view-state-CYNxOsyc.js";import{_ as u,a as d,d as f,m as p,o as m,s as h,t as g}from"./index-BBySSIJT.js";import{n as _}from"./module-host-BHOsDk69.js";import"./public-DoBzMSlG.js";import{t as v}from"./group--adLvfC6.js";var y=f(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),b=u(p(),1);async function x(e){let t=await e(`/growth-center`);if(!t||!Array.isArray(t.products)||typeof t.updatedAt!=`string`||t.products.some(e=>!e||typeof e.key!=`string`||typeof e.itemId!=`string`||typeof e.project!=`string`||!Array.isArray(e.series)||e.series.some(e=>!e||!Array.isArray(e.points))))throw Error(`商品资料返回格式异常`);return t}function S(e){let[t,n]=(0,b.useState)(null),[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(!0),s=(0,b.useRef)(0),c=(0,b.useRef)(!1),l=(0,b.useCallback)(()=>{let t=++s.current;return x(e).then(e=>c.current&&s.current===t?(n(e),i(``),!0):!1).catch(e=>(c.current&&s.current===t&&(n(null),i(e instanceof Error?e.message:`商品资料读取失败`)),!1)).finally(()=>{c.current&&s.current===t&&o(!1)})},[e]),u=(0,b.useCallback)(()=>(o(!0),i(``),l()),[l]);return(0,b.useEffect)(()=>(c.current=!0,l(),()=>{c.current=!1}),[l]),{data:t,error:r,loading:a,refresh:u}}var C=[{id:`test`,n:`03`,name:`新品测试`,caption:`运营策略 · 测试`,color:`#74c6ff`,goal:`少量投入,找到有人喜欢的商品`,cadence:`推广每天看 · 商品每5天看`,rule:`同品类、同属性、同材质一起测。对照店里第二梯队头部商品:低的继续跑,中的进入孵化候选,高的进一步评估。`,action:`查看点击、加购表现,筛选候选商品。`},{id:`incubate`,n:`02`,name:`持续孵化`,caption:`运营策略 · 培养`,color:`var(--omni-chart-secondary,#b99aff)`,goal:`培养潜力款,让成熟商品赚钱`,cadence:`新品每5天看 · 老品每7天看`,rule:`新商品看加购率与转化率;成熟商品看付费占比。低的放大,高的调整计划或暂停,同时优化主图、视频等。`,action:`区分赚钱款与潜力款,安排下一轮优化。`},{id:`scale`,n:`01`,name:`重点推广`,caption:`运营策略 · 放大`,color:`var(--omni-chart-teal,#44cdb5)`,goal:`集中资源,持续增加付款人数`,cadence:`推广每30–60分钟看 · 商品每天看`,rule:`拉新看点击成本、加购成本;收割看点击成本、成交成本。调整差计划,把预算分配给同类好计划;没有合适计划就新建测试。`,action:`查看广告计划,按老师给企业制定的标准处理。`}],w={unassigned:`待分组`,test:`新品测试`,incubate:`持续孵化`,scale:`重点推广`},T={simulated:`模拟数据`,"declared-real":`来源标注真实`,unverified:`来源待核实`},E=e=>typeof e==`number`?e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):`—`;function D(e,t){return e.filter(e=>t===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`)}function O(e,t,n){let r=n.trim().toLowerCase();return e.filter(e=>(t===`all`||e.tier===t)&&`${e.itemId} ${e.projectName} ${e.title||``} ${e.shopName||``}`.toLowerCase().includes(r))}function k(e,t){return e.find(e=>e.key===t)||e[0]}var A=m();function j({series:e}){if(!e?.points.length)return(0,A.jsx)(`div`,{className:`gw-chart-empty`,children:`选择商品后,查看已有数据趋势。`});let t=e.points.slice(-30),n=t.flatMap(e=>e.value===null?[]:[e.value]),r=n.length?Math.min(...n):0,i=n.length?Math.max(...n):1,a=(e,n)=>[32+n*636/Math.max(1,t.length-1),150-((e.value??r)-r)/(i-r||1)*115],o=null,s=[];return t.forEach((t,n)=>{if(t.value===null){o=null;return}let[r,i]=a(t,n);o&&Date.parse(t.date)-Date.parse(o.date)===864e5&&s.push((0,A.jsx)(`line`,{x1:o.x,y1:o.y,x2:r,y2:i},`l`+n)),s.push((0,A.jsx)(`circle`,{cx:r,cy:i,r:`3`,children:(0,A.jsxs)(`title`,{children:[t.date,`:`,E(t.value),` `,e.unit]})},`p`+n)),o={x:r,y:i,date:t.date}}),(0,A.jsxs)(`div`,{className:`gw-chart`,children:[(0,A.jsxs)(`svg`,{viewBox:`0 0 700 185`,role:`img`,"aria-label":`${e.name}最近${t.length}个归档日期的趋势,缺失日期不连线`,children:[(0,A.jsx)(`defs`,{children:(0,A.jsxs)(`linearGradient`,{id:`product-chart-bg`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,A.jsx)(`stop`,{stopColor:`#4cd5af`,stopOpacity:`.1`}),(0,A.jsx)(`stop`,{offset:`1`,stopColor:`#4cd5af`,stopOpacity:`0`})]})}),(0,A.jsx)(`rect`,{x:`30`,y:`20`,width:`640`,height:`145`,fill:`url(#product-chart-bg)`}),[35,92,150].map(e=>(0,A.jsx)(`line`,{x1:`30`,x2:`670`,y1:e,y2:e,className:`grid`},e)),(0,A.jsx)(`g`,{className:`plot`,children:s}),(0,A.jsx)(`text`,{x:`32`,y:`178`,children:t[0]?.date}),(0,A.jsx)(`text`,{x:`668`,y:`178`,textAnchor:`end`,children:t.at(-1)?.date}),(0,A.jsxs)(`text`,{x:`32`,y:`16`,children:[E(i),` `,e.unit]})]}),(0,A.jsx)(`span`,{children:`最近最多30个归档日期 · 缺失不补零 · 不同日期不汇总`})]})}function M({product:t,metricKey:n,onMetric:r,onGroup:i,onTask:o,onOpen:s}){if(!t)return(0,A.jsx)(`div`,{className:`gw-empty`,children:`选择商品查看趋势与后续操作。`});let c=t.series.find(e=>e.key===n)||t.series.find(e=>e.metric===`buyers`)||t.series[0],l=C.find(e=>e.id===t.tier);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`gw-selected-product`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(a,{product:t}),(0,A.jsx)(`span`,{className:`gw-tag `+t.tier,children:w[t.tier]})]}),(0,A.jsxs)(`button`,{onClick:()=>i(t),children:[(0,A.jsx)(y,{size:14}),`分组`]})]}),(0,A.jsxs)(`div`,{className:`gw-metric-selector`,children:[(0,A.jsx)(`select`,{"aria-label":`商品趋势指标`,value:c?.key||``,onChange:e=>r(e.target.value),children:t.series.map(e=>(0,A.jsxs)(`option`,{value:e.key,children:[e.name,` · `,e.unit||`原始单位`]},e.key))}),(0,A.jsxs)(`strong`,{children:[E(c?.points.at(-1)?.value),(0,A.jsx)(`small`,{children:c?.unit})]}),(0,A.jsxs)(`span`,{children:[`最后统计日:`,c?.points.at(-1)?.date||`—`]})]}),(0,A.jsx)(j,{series:c}),(0,A.jsxs)(`details`,{className:`gw-points`,children:[(0,A.jsx)(`summary`,{children:`查看每日原值与来源`}),(0,A.jsx)(`div`,{className:`gw-table-scroll`,children:(0,A.jsxs)(`table`,{children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{children:`日期`}),(0,A.jsx)(`th`,{children:`原值`}),(0,A.jsx)(`th`,{children:`来源`})]})}),(0,A.jsx)(`tbody`,{children:c?.points.slice(-30).map(e=>(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`td`,{children:e.date}),(0,A.jsx)(`td`,{children:E(e.value)}),(0,A.jsx)(`td`,{children:(0,A.jsx)(`a`,{href:`/api/workbench/`+t.project+`/file/`+e.fileId,children:`原始归档`})})]},e.date))})]})})]}),(0,A.jsxs)(`div`,{className:`gw-next`,children:[(0,A.jsx)(`span`,{children:`NEXT / 下一步`}),(0,A.jsx)(`h3`,{children:l?.action||`先选择这个商品的运营策略`}),(0,A.jsxs)(`p`,{children:[l?.cadence||`分组后查看对应检查频率和处理办法。`,t.note&&` · `+t.note]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`button`,{onClick:()=>o(t),children:`查看当前任务`}),(0,A.jsxs)(`button`,{className:`gw-primary`,onClick:()=>s(t.project,{tab:`monitor`,itemId:t.itemId}),children:[`查看监控与取数 `,(0,A.jsx)(e,{size:13})]}),(0,A.jsx)(`button`,{onClick:()=>s(t.project,{tab:`optimization`,itemId:t.itemId}),children:`商品优化`})]})]}),(0,A.jsx)(`p`,{className:`gw-detail-note`,children:`展示本项目归档的商品指标。点击率、加购率、计划成本等尚未汇入此表;请到来源数据中核对。`})]})}function N({section:e,onSection:u}){let d=_(),{data:f,error:p,loading:m,refresh:h}=S(d.api),[g,y]=c(`products.scope`,`real`),[x,E]=c(`products.query`,``),[j,N]=c(`products.key`,``),[P,F]=c(`products.metric`,``),[I,L]=(0,b.useState)(``),[R,z]=(0,b.useState)(null),[B,V]=(0,b.useState)(null),H=(0,b.useRef)(null),U=e===`all`||w[e]?e:`all`,W=D(f?.products||[],g),G=O(W,U,x),K=k(G,j);function q(e){N(e.key),F(``),L(``)}function J(e,t){if(t===`work`){V(e);return}t===`data`?(u(`all`),E(``),q(e),requestAnimationFrame(()=>{H.current?.scrollIntoView({behavior:`smooth`,block:`start`}),H.current?.focus({preventScroll:!0})})):d.onOpen(e.project,{tab:t,itemId:e.itemId})}return(0,A.jsx)(`div`,{className:`products-module`,children:(0,A.jsx)(`div`,{className:`gw`,children:(0,A.jsxs)(`div`,{className:`gw-body`,children:[(0,A.jsxs)(`header`,{className:`gw-header`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`small`,{children:`商品 / 商品看板`}),(0,A.jsx)(`h1`,{children:`从测试到重点推广`})]}),(0,A.jsxs)(`div`,{className:`gw-header-actions`,children:[(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`i`,{className:`gw-dot`}),g===`stored-demo`?`模拟归档 · 非真实经营`:`归档数据 · 非实时`]}),(0,A.jsxs)(`button`,{onClick:()=>void h(),disabled:m,children:[(0,A.jsx)(s,{size:14}),m?`读取中`:`刷新数据`]})]})]}),(0,A.jsxs)(`div`,{className:`gw-scope`,children:[(0,A.jsx)(`div`,{children:[[`real`,`非模拟资料`],[`stored-demo`,`模拟资料`]].map(([e,t])=>(0,A.jsx)(`button`,{"aria-pressed":g===e,onClick:()=>{y(e),N(``),z(null),V(null),L(``)},children:t},e))}),(0,A.jsx)(`span`,{children:f?`${new Date(f.updatedAt).toLocaleString(`zh-CN`)} 读取归档`:m?`正在读取归档…`:`商品资料未就绪`})]}),p&&(0,A.jsxs)(`p`,{role:`alert`,className:`gw-message`,children:[p,` `,(0,A.jsx)(`button`,{onClick:()=>void h(),children:`重试`})]}),I&&(0,A.jsx)(`p`,{role:`status`,className:`gw-message`,children:I}),(0,A.jsx)(n,{products:W,tiers:C,ready:!!f&&!m,onAction:J,onAssign:(e,t)=>z({product:e,suggestedTier:t})}),B&&(0,A.jsx)(i,{product:B,onOpen:d.onOpen,onClose:()=>V(null)}),R&&(0,A.jsx)(r,{...R,products:W,onDirty:d.onDirty,onBusy:d.onBusy,onClose:()=>z(null),onSave:async(e,t,n,r)=>{await v(d.api,e,t,n,r),L(await h()?`分组已保存,看板已更新。`:`分组已保存,但看板读取失败,请刷新后查看。`)}}),(0,A.jsxs)(`div`,{className:`gw-operating`,children:[(0,A.jsxs)(`section`,{className:`gw-panel gw-products`,children:[(0,A.jsxs)(`div`,{className:`gw-section-title`,children:[(0,A.jsx)(`h2`,{children:`商品工作清单`}),(0,A.jsxs)(`span`,{children:[G.length,` 个观察对象`]})]}),(0,A.jsxs)(`div`,{className:`gw-filters`,children:[(0,A.jsxs)(`label`,{children:[(0,A.jsx)(l,{size:14}),(0,A.jsx)(`input`,{"aria-label":`搜索经营商品`,placeholder:`搜索商品ID或项目`,value:x,onChange:e=>E(e.target.value)})]}),(0,A.jsxs)(`select`,{"aria-label":`商品运营分组`,value:U,onChange:e=>{u(e.target.value),N(``)},children:[(0,A.jsx)(`option`,{value:`all`,children:`全部运营分组`}),Object.entries(w).map(([e,t])=>(0,A.jsx)(`option`,{value:e,children:t},e))]})]}),U!==`all`&&(0,A.jsxs)(`div`,{className:`gw-rule`,children:[(0,A.jsx)(`b`,{children:w[U]}),(0,A.jsx)(`p`,{children:C.find(e=>e.id===U)?.rule||`选择商品后确认分组。归档记录不能直接证明商品属于哪个梯队。`})]}),(0,A.jsx)(`div`,{className:`gw-table-scroll`,children:(0,A.jsxs)(`table`,{children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{children:`商品 / 所属项目`}),(0,A.jsx)(`th`,{children:`当前运营分组`}),(0,A.jsx)(`th`,{children:`已有指标`}),(0,A.jsx)(`th`,{children:`操作`})]})}),(0,A.jsx)(`tbody`,{children:G.map(e=>(0,A.jsxs)(`tr`,{className:K?.key===e.key?`selected`:``,children:[(0,A.jsxs)(`td`,{children:[(0,A.jsx)(a,{product:e}),(0,A.jsx)(`em`,{children:T[e.mode]})]}),(0,A.jsx)(`td`,{children:(0,A.jsx)(`span`,{className:`gw-tag `+e.tier,children:w[e.tier]})}),(0,A.jsxs)(`td`,{children:[e.series.length,` 项`,(0,A.jsx)(`small`,{children:e.series.map(e=>e.name).slice(0,2).join(` / `)})]}),(0,A.jsx)(`td`,{children:(0,A.jsxs)(`button`,{"aria-label":`查看商品 `+e.itemId+` `+e.projectName,onClick:()=>q(e),children:[`查看 `,(0,A.jsx)(t,{size:12})]})})]},e.key))})]})}),!G.length&&(0,A.jsxs)(`div`,{className:`gw-empty`,children:[(0,A.jsx)(o,{size:29}),(0,A.jsx)(`b`,{children:p?`商品资料读取失败`:m?`正在读取商品…`:x?`没有匹配的商品`:`这个分组还没有商品`}),(0,A.jsx)(`p`,{children:`切换到“待分组”确认商品运营分组,或从项目监控中归档商品数据。`}),(0,A.jsx)(`button`,{onClick:()=>{E(``),u(`unassigned`)},children:`查看待分组`}),(0,A.jsx)(`button`,{onClick:()=>d.onModule(`projects`),children:`进入项目执行`})]})]}),(0,A.jsxs)(`section`,{ref:H,tabIndex:-1,className:`gw-panel gw-product-detail`,children:[(0,A.jsxs)(`div`,{className:`gw-section-title`,children:[(0,A.jsx)(`h2`,{children:`商品数据与下一步`}),(0,A.jsx)(`span`,{children:`点表格切换`})]}),(0,A.jsx)(M,{product:K,metricKey:P,onMetric:F,onGroup:e=>z({product:e}),onTask:V,onOpen:d.onOpen})]})]}),(0,A.jsx)(`p`,{className:`gw-detail-note`,children:`这里的“新品测试、持续孵化、重点推广”是人工保存的运营策略,不是按全店支付销售额贡献、访客和支付买家核验的第一、二、三梯队。切换分组不会自动投放或改变经营梯队。`}),(0,A.jsxs)(`footer`,{className:`gw-footer`,children:[(0,A.jsx)(`span`,{children:`规则来源:店铺链接 AI 自动化孵化与打爆`}),(0,A.jsxs)(`details`,{children:[(0,A.jsx)(`summary`,{children:`检查频率与执行状态说明`}),(0,A.jsx)(`p`,{children:`运营策略卡片展示原方案的建议检查频率,不表示调度已启用。老师结合企业数据制定具体判断标准;本页支持归档查询、趋势查看和分组保存。广告计划的建立、暂停及预算调整尚未在本页接通。`})]})]})]})})})}function P(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function F(e){return typeof e==`string`&&!!e.trim()}function I(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:typeof e==`string`?Number(e):NaN;if(!Number.isFinite(t)||t<0)throw Error(`商品价格格式异常`);return t}async function L(e){async function t(t){let n=await fetch(`/v1/enterprise/`+t,{signal:e,cache:`no-store`});if(!n.ok)throw Error(n.status===401?`登录已失效,请重新登录`:n.status===403?`当前账号没有店铺商品读取权限`:`店铺商品读取失败,请重试`);if(!n.headers.get(`content-type`)?.includes(`application/json`))throw Error(`店铺商品服务尚未接入`);return n.json()}let[n,r]=await Promise.all([t(`products`),t(`shops`)]);if(!P(n)||!Array.isArray(n.products)||!Array.isArray(n.listings)||!P(r)||!Array.isArray(r.shops))throw Error(`店铺商品返回格式异常`);let i=new Map;for(let e of n.products){if(!P(e)||!F(e.product_id)||!F(e.project_id)||!F(e.name))throw Error(`商品关联项目格式异常`);i.set(e.product_id,{id:e.project_id,name:e.name})}let a=new Map;for(let e of r.shops){if(!P(e)||!F(e.id)||!F(e.name)||![`real`,`simulated`,`unverified`].includes(String(e.mode)))throw Error(`店铺资料格式异常`);a.set(e.id,{name:e.name,mode:e.mode===`real`?`declared-real`:e.mode})}let o=[],s=new Set;for(let e of n.listings){if(!P(e)||!F(e.id)||!F(e.product_id)||!F(e.shop_id)||!F(e.platform_item_id)||typeof e.title!=`string`)throw Error(`店铺商品记录不完整`);let t=a.get(e.shop_id),n=i.get(e.product_id);if(!t)continue;if(!n)throw Error(`店铺商品关联项目缺失,请刷新重试`);let r=JSON.stringify([e.shop_id,e.platform_item_id]);if(s.has(r))throw Error(`店铺商品身份重复,请核对资料`);s.add(r),o.push({key:e.id,itemId:e.platform_item_id,title:e.title,image:typeof e.image_data_url==`string`?e.image_data_url:void 0,shopId:e.shop_id,shopName:t.name,project:n.id,projectName:n.name,mode:t.mode,category:typeof e.category==`string`?e.category:void 0,price:I(e.price)})}return o}function R(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(!0),o=(0,b.useRef)(null),s=(0,b.useCallback)(()=>{o.current?.abort();let e=new AbortController;return o.current=e,L(e.signal).then(n=>{e.signal.aborted||(t(n),r(``))}).catch(n=>{e.signal.aborted||(t(null),r(n instanceof Error?n.message:`店铺商品读取失败`))}).finally(()=>{e.signal.aborted||a(!1)})},[]),c=(0,b.useCallback)(()=>(a(!0),r(``),s()),[s]);return(0,b.useEffect)(()=>(s(),()=>o.current?.abort()),[s]),{data:e,error:n,loading:i,refresh:c}}function z(e,t,n,r=``){return e.filter(e=>(!r||e.shopId===r)&&(n===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`)).map(e=>({...e,archives:t.filter(t=>t.project===e.project&&t.itemId===e.itemId&&t.shopIds?.length===1&&t.shopIds[0]===e.shopId&&(n===`stored-demo`?t.mode===`simulated`:t.mode!==`simulated`))}))}function B(e){let t=e.archives.length===1?e.archives[0]:void 0,n=t?.series.flatMap(e=>e.points.map(e=>e.date)).sort().at(-1)||``;function r(e,r){let i=t?.series.filter(t=>e.includes(t.metric)&&r.includes(t.unit))||[];if(i.length!==1)return null;let a=i[0].points.find(e=>e.date===n);return typeof a?.value==`number`&&Number.isFinite(a.value)?a.value:null}return{date:n,paid:r([`paid`,`revenue`],[`元`,`CNY`]),uv:r([`visitors`,`uv`],[`人`]),buyers:r([`buyers`],[`人`])}}function V(e,t,n){let r=t.trim().toLowerCase();return e.filter(e=>`${e.itemId} ${e.title} ${e.shopName} ${e.projectName} ${e.category||``}`.toLowerCase().includes(r)&&(n===`all`||(e.archives.length===1?e.archives[0].tier:e.archives.length===0?`unassigned`:``)===n))}var H=20;function U(){let e=_(),n=d(),u=R(),f=S(e.api),[p,m]=c(`products.scope`,`real`),[g,y]=c(`products.query`,``),[x,C]=c(`products.shopTier`,`all`),[D,O]=c(`products.key`,``),[k,j]=c(`products.metric`,``),[N,P]=(0,b.useState)(1),[F,I]=(0,b.useState)(``),[L,U]=(0,b.useState)(null),[W,G]=(0,b.useState)(null),K=(0,b.useRef)(null),q=z(u.data||[],f.data?.products||[],p,n?.selected),J=f.error||f.loading?`all`:x,Y=V(q,g,J),X=Math.max(1,Math.ceil(Y.length/H)),Z=Math.min(N,X),Q=f.data?.products.find(e=>e.key===D&&(p===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`)),$=q.filter(e=>e.archives.some(e=>e.series.some(e=>e.points.length))).length,ee=u.loading||f.loading;function te(e){O(e.key),j(``),requestAnimationFrame(()=>{K.current?.scrollIntoView({behavior:`smooth`,block:`start`}),K.current?.focus({preventScroll:!0})})}return(0,A.jsx)(`div`,{className:`products-module`,children:(0,A.jsx)(`div`,{className:`gw shop-catalog`,children:(0,A.jsxs)(`div`,{className:`gw-body`,children:[(0,A.jsxs)(`header`,{className:`gw-header`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`small`,{children:`商品 / 全部商品`}),(0,A.jsx)(`h1`,{children:`店铺商品`}),(0,A.jsx)(`p`,{children:`查看店铺内已建档的商品与经营数据,再安排测试、孵化和推广。`})]}),(0,A.jsxs)(`div`,{className:`gw-header-actions`,children:[(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`i`,{className:`gw-dot`}),`店铺建档与归档数据 · 非实时`]}),(0,A.jsxs)(`button`,{disabled:ee,onClick:()=>{u.refresh(),f.refresh()},children:[(0,A.jsx)(s,{size:14}),ee?`读取中`:`刷新数据`]})]})]}),(0,A.jsxs)(`div`,{className:`gw-scope`,children:[(0,A.jsx)(`div`,{children:[[`real`,`非模拟资料`],[`stored-demo`,`模拟资料`]].map(([e,t])=>(0,A.jsx)(`button`,{"aria-pressed":p===e,onClick:()=>{m(e),P(1),O(``),U(null),G(null),I(``)},children:t},e))}),(0,A.jsx)(`span`,{children:n?.shops.find(e=>e.id===n.selected)?.name||`全部授权店铺`})]}),u.error&&(0,A.jsxs)(`p`,{className:`gw-message`,role:`alert`,children:[u.error,` `,(0,A.jsx)(`button`,{onClick:()=>void u.refresh(),children:`重试店铺商品`})]}),f.error&&(0,A.jsxs)(`p`,{className:`gw-message`,role:`alert`,children:[`经营指标暂不可用:`,f.error,` `,(0,A.jsx)(`button`,{onClick:()=>void f.refresh(),children:`重试经营指标`})]}),F&&(0,A.jsx)(`p`,{className:`gw-message`,role:`status`,children:F}),(0,A.jsxs)(`section`,{className:`gw-panel shop-catalog-list`,"aria-label":`店铺商品列表`,children:[(0,A.jsxs)(`div`,{className:`gw-section-title`,children:[(0,A.jsx)(`h2`,{children:`全部商品`}),(0,A.jsx)(`span`,{children:u.loading?`正在读取商品…`:u.error?`商品总数暂不可用`:`当前范围 ${q.length} 个已建档商品`})]}),!u.error&&u.data&&(0,A.jsxs)(`div`,{className:`shop-catalog-summary`,children:[(0,A.jsxs)(`span`,{children:[`已有经营归档 `,(0,A.jsx)(`b`,{children:f.error||f.loading?`—`:$})]}),(0,A.jsxs)(`span`,{children:[`待补充经营数据 `,(0,A.jsx)(`b`,{children:f.error||f.loading?`—`:q.length-$})]}),(0,A.jsx)(`span`,{children:`未归档的指标显示“—”`})]}),(0,A.jsxs)(`div`,{className:`gw-filters`,children:[(0,A.jsxs)(`label`,{children:[(0,A.jsx)(l,{size:15}),(0,A.jsx)(`input`,{"aria-label":`搜索店铺商品`,placeholder:`搜索商品名称、ID、店铺、类目或项目`,value:g,onChange:e=>{y(e.target.value),P(1)}})]}),(0,A.jsxs)(`select`,{"aria-label":`筛选店铺商品分组`,value:J,disabled:f.loading||!!f.error,onChange:e=>{C(e.target.value),P(1)},children:[(0,A.jsx)(`option`,{value:`all`,children:`全部运营分组`}),Object.entries(w).map(([e,t])=>(0,A.jsx)(`option`,{value:e,children:t},e))]})]}),(0,A.jsx)(`div`,{className:`gw-table-scroll`,children:(0,A.jsxs)(`table`,{children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{children:`商品 / 店铺`}),(0,A.jsx)(`th`,{children:`建档价格(元)`}),(0,A.jsx)(`th`,{children:`访客数`}),(0,A.jsx)(`th`,{children:`支付买家数`}),(0,A.jsx)(`th`,{children:`支付销售额(元)`}),(0,A.jsx)(`th`,{children:`统计日期`}),(0,A.jsx)(`th`,{children:`运营分组`}),(0,A.jsx)(`th`,{children:`操作`})]})}),(0,A.jsx)(`tbody`,{children:Y.slice((Z-1)*H,Z*H).map(n=>{let r=B(n),i=n.archives.length===1?n.archives[0]:void 0;return(0,A.jsxs)(`tr`,{className:i?.key===Q?.key&&i?`selected`:``,children:[(0,A.jsxs)(`td`,{children:[(0,A.jsx)(a,{product:n}),(0,A.jsxs)(`small`,{children:[n.category||`类目未录入`,` · `,n.projectName]}),(0,A.jsx)(`em`,{children:T[n.mode]})]}),(0,A.jsx)(`td`,{children:E(n.price)}),(0,A.jsx)(`td`,{children:E(r.uv)}),(0,A.jsx)(`td`,{children:E(r.buyers)}),(0,A.jsx)(`td`,{children:E(r.paid)}),(0,A.jsxs)(`td`,{children:[r.date||`—`,(0,A.jsx)(`small`,{children:f.loading?`读取指标中`:f.error?`指标读取失败`:n.archives.length>1?`多份归档,分别查看`:r.date?T[i.mode]:`暂无经营数据`})]}),(0,A.jsx)(`td`,{children:f.error||f.loading?`—`:n.archives.length>1?`分组待核对`:(0,A.jsx)(`span`,{className:`gw-tag `+(i?.tier||`unassigned`),children:w[i?.tier||`unassigned`]})}),(0,A.jsx)(`td`,{children:n.archives.length?n.archives.map(e=>(0,A.jsxs)(`button`,{"aria-label":`查看商品 ${n.itemId} ${n.shopName} ${T[e.mode]}`,onClick:()=>te(e),children:[n.archives.length>1?T[e.mode]:`查看数据`,(0,A.jsx)(t,{size:12})]},e.key)):(0,A.jsxs)(`button`,{disabled:f.loading||!!f.error,onClick:()=>e.onOpen(n.project,{tab:`monitor`,itemId:n.itemId}),children:[f.loading?`读取中`:f.error?`指标不可用`:`补充数据`,(0,A.jsx)(t,{size:12})]})})]},n.key)})})]})}),!Y.length&&(0,A.jsxs)(`div`,{className:`gw-empty`,role:`status`,children:[(0,A.jsx)(o,{size:29}),(0,A.jsx)(`b`,{children:u.error?`店铺商品读取失败`:u.loading?`正在读取店铺商品…`:g||J!==`all`?`没有匹配的商品`:`当前范围还没有已建档商品`}),(0,A.jsx)(`p`,{children:u.error?`请重试,或检查账号与数据服务连接。`:u.loading?`正在读取当前授权范围的商品目录。`:g||J!==`all`?`调整搜索或运营分组筛选后再查看。`:`请先关联店铺商品。已关联商品即使没有经营归档,也会显示在这里。`}),!u.loading&&!u.error&&(g||J!==`all`)&&(0,A.jsx)(`button`,{onClick:()=>{y(``),C(`all`),P(1)},children:`清除筛选`})]}),Y.length>0&&(0,A.jsxs)(`div`,{className:`shop-catalog-pagination`,children:[(0,A.jsxs)(`span`,{children:[`筛选结果 `,Y.length,` 个 · 第 `,Z,` / `,X,` 页`]}),(0,A.jsx)(`button`,{disabled:Z<=1,onClick:()=>P(Z-1),children:`上一页`}),(0,A.jsx)(`button`,{disabled:Z>=X,onClick:()=>P(Z+1),children:`下一页`})]})]}),(0,A.jsx)(`p`,{className:`gw-detail-note`,children:`仅显示当前授权店铺已建档商品,尚不代表平台全店商品已同步。经营指标按每个商品的最新归档统计日展示,不同商品日期可能不同;缺值不补零,多店合并归档不分摊到单店。`}),Q&&(0,A.jsxs)(`section`,{ref:K,tabIndex:-1,className:`gw-panel gw-product-detail shop-catalog-detail`,children:[(0,A.jsxs)(`div`,{className:`gw-section-title`,children:[(0,A.jsx)(`h2`,{children:`商品数据与下一步`}),(0,A.jsx)(`button`,{"aria-label":`关闭商品详情`,onClick:()=>O(``),children:(0,A.jsx)(h,{size:15})})]}),(0,A.jsx)(M,{product:Q,metricKey:k,onMetric:j,onGroup:U,onTask:G,onOpen:e.onOpen})]}),W&&(0,A.jsx)(i,{product:W,onOpen:e.onOpen,onClose:()=>G(null)}),L&&(0,A.jsx)(r,{product:L,products:(f.data?.products||[]).filter(e=>p===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`),onDirty:e.onDirty,onBusy:e.onBusy,onClose:()=>U(null),onSave:async(t,n,r,i)=>{await v(e.api,t,n,r,i),I(await f.refresh()?`分组已保存,商品数据已更新。`:`分组已保存,但数据读取失败,请刷新后查看。`)}})]})})})}var W=(0,b.lazy)(()=>g(()=>import(`./project-public-DqjxO6ad.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url));function G({section:e,onSection:t,project:n}){return n?(0,A.jsx)(b.Suspense,{fallback:(0,A.jsx)(`p`,{role:`status`,children:`正在打开商品工具…`}),children:(0,A.jsx)(W,{section:e,project:n})}):e===`all`?(0,A.jsx)(U,{}):(0,A.jsx)(N,{section:e,onSection:t})}export{G as default};
@@ -0,0 +1 @@
1
+ import{d as e}from"./index-BBySSIJT.js";var t=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};
@@ -0,0 +1 @@
1
+ var e=[`listingDays`,`sales`,`marketShare`,`views`,`conversionRate`,`unitPrice`,`units`,`searches`,`searchShare`,`paidClicks`,`paidClickShare`],t=[`sales`,`marketShare`,`views`,`conversionRate`,`unitPrice`,`units`,`searches`,`searchShare`,`paidClicks`,`paidClickShare`,`listedProducts`];function n(e){if(!/^\d{4}-(0[1-9]|1[0-2])$/.test(e))return[];let[t,n]=e.split(`-`).map(Number);return Array.from({length:12},(e,r)=>{let i=new Date(Date.UTC(t,n-12+r,1));return`${i.getUTCFullYear()}-${String(i.getUTCMonth()+1).padStart(2,`0`)}`})}function r(e){if(e)try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`?t.href:void 0}catch{return}}function i(e,t=`number`){if(e==null||!Number.isFinite(e))return`—`;if(t===`percent`)return e.toLocaleString(`zh-CN`,{maximumFractionDigits:2})+`%`;if(t===`number`)return e.toLocaleString(`zh-CN`,{maximumFractionDigits:2});let n=Math.abs(e);return(n>=1e8?(e/1e8).toFixed(2)+` 亿`:n>=1e4?(e/1e4).toFixed(2)+` 万`:e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}))+(t===`money`?`元`:``)}function a(e,t){let n=[],r=new Set,i=e.find(e=>e.id===t);for(;i&&!r.has(i.id);)r.add(i.id),n.unshift(i),i=e.find(e=>e.id===i?.parentId);return n}export{t as a,r as i,i as n,n as o,e as r,a as t};
@@ -0,0 +1 @@
1
+ import{d as e}from"./index-BBySSIJT.js";var t=e(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),n=e(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]);export{t as n,n as t};
@@ -0,0 +1 @@
1
+ function e(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function t(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}export{t as n,e as t};
@@ -0,0 +1 @@
1
+ import{d as e}from"./index-BBySSIJT.js";var t=e(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]);export{t};