@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.
- package/INSTALL.md +9 -0
- package/README.md +4 -4
- package/UPDATE.md +7 -0
- package/app/assets/{CartesianChart-Bwf4u0Tg.js → CartesianChart-CP7p2vlm.js} +2 -2
- package/app/assets/{CollaborationWorkspace-Bd6Sjj31.js → CollaborationWorkspace-Cnp5PNn_.js} +3 -3
- package/app/assets/CompetitorAnalysis-Cujy_a2L.js +1 -0
- package/app/assets/CompetitorAnalysis-h1zdt0F2.css +1 -0
- package/app/assets/EmptyState-CUHuNsaV.js +1 -0
- package/app/assets/ErrorBarContext-BJE5-ljg.js +1 -0
- package/app/assets/{EvidenceSourceGuide-CwfB7Z6T.js → EvidenceSourceGuide-B1AJCZm2.js} +1 -1
- package/app/assets/FavoritePicker-XD1a_uOa.js +1 -0
- package/app/assets/Favorites-B5_fdEvZ.js +1 -0
- package/app/assets/{HelpTip-CX2LFdwD.js → HelpTip-BqRBO41J.js} +1 -1
- package/app/assets/LineChart-Ckvg5wfQ.js +4 -0
- package/app/assets/{Opportunities-a5IpRN6k.js → Opportunities-BvH64-dz.js} +1 -1
- package/app/assets/{ProgressiveRows-ByxDeTyy.js → ProgressiveRows-NojOUgmr.js} +1 -1
- package/app/assets/ShopLayoutPage-CCrRwaAx.js +1 -0
- package/app/assets/TrendChart-BF4JgwxH.js +1 -0
- package/app/assets/arrow-down-B1nil3T4.js +1 -0
- package/app/assets/arrow-left-BhFSpYzK.js +1 -0
- package/app/assets/arrow-up-right-IBQoN72x.js +1 -0
- package/app/assets/{book-open-C0B9Pao9.js → book-open-Cqdn6s-H.js} +1 -1
- package/app/assets/chart-column-DCwNhXki.js +1 -0
- package/app/assets/{chart-no-axes-combined-XDy9u9SV.js → chart-no-axes-combined-DVgKs36j.js} +1 -1
- package/app/assets/check-DBnlZFEo.js +1 -0
- package/app/assets/chevron-down-DO6RUQm8.js +1 -0
- package/app/assets/chevron-right-e65CaeL6.js +1 -0
- package/app/assets/{clock-3-TH35nOP-.js → clock-3-CDHtQwAe.js} +1 -1
- package/app/assets/competitor-analysis-D6eM9ugQ.js +1 -0
- package/app/assets/{components-C2-vHJtu.js → components-B5Xyjfpi.js} +2 -2
- package/app/assets/{download-BlJN0Lg8.js → download-DfM49VvV.js} +1 -1
- package/app/assets/entry-Bq7tA83b.js +1 -0
- package/app/assets/{entry-OcErMaMp.css → entry-CMur_AE7.css} +1 -1
- package/app/assets/entry-DC4oDjzU.js +2 -0
- package/app/assets/{entry-DM3aLe2I.js → entry-DM64sJfS.js} +1 -1
- package/app/assets/entry-DbqMDIJi.js +1 -0
- package/app/assets/{entry-CdLi3Z9F.js → entry-N8bfKXTF.js} +2 -2
- package/app/assets/{entry-CYGrMJuR.js → entry-kAWoaIsV.js} +2 -2
- package/app/assets/favorites.module-CHYv-Z8y.js +1 -0
- package/app/assets/{file-text-Hd45wNTe.js → file-text-DKAT5fzJ.js} +1 -1
- package/app/assets/getRadiusAndStrokeWidthFromDot-bv_ksZ7y.js +1 -0
- package/app/assets/{grid-2x2-C0aJVeyS.js → grid-2x2-DB6zRPIV.js} +1 -1
- package/app/assets/index-BgJNmU0Z.css +1 -0
- package/app/assets/{index-BguiS02-.js → index-DLSVWUSu.js} +2 -2
- package/app/assets/{layers-Dj9z2et6.js → layers-CjsT_HGi.js} +1 -1
- package/app/assets/{layout-dashboard-DS537D8b.js → layout-dashboard-sgUrlApv.js} +1 -1
- package/app/assets/{link-2-CCKUDMV6.js → link-2-VLti-YG9.js} +1 -1
- package/app/assets/{list-LZcXKWKD.js → list-Dfzc0sXQ.js} +1 -1
- package/app/assets/market-SuD7x_Hf.css +1 -0
- package/app/assets/market.module-VpU4XmGg.js +1 -0
- package/app/assets/{module-host-C4vqZw2y.js → module-host-DNtiV4gZ.js} +1 -1
- package/app/assets/{orbit-G4ZspWKB.js → orbit-CrQs6cpl.js} +1 -1
- package/app/assets/play-BxTFlaQX.js +1 -0
- package/app/assets/plus-D78h7lrw.js +1 -0
- package/app/assets/{products-BAKFF--e.js → products-B5vjXM_b.js} +1 -1
- package/app/assets/{project-public-HdtYycKS.js → project-public-CgW1u7BI.js} +1 -1
- package/app/assets/{project-public-BCoD2Anq.js → project-public-DWTt808B.js} +1 -1
- package/app/assets/public-C-PBMVOQ.js +1 -0
- package/app/assets/{refresh-cw-dsQ_f-9j.js → refresh-cw-CxbRf97c.js} +1 -1
- package/app/assets/search-DFdSppzm.js +1 -0
- package/app/assets/{triangle-alert-l-Mfj0iE.js → triangle-alert-C7qiylOf.js} +1 -1
- package/app/assets/{ui-public-BPe2GJZ-.css → ui-public-DHoRDp5_.css} +1 -1
- package/app/assets/{ui-public-DWkIf658.js → ui-public-Dt5dHt-8.js} +1 -1
- package/app/assets/workbench-DIKJZNJQ.js +2 -0
- package/app/assets/{workspace-view-state-BJMX6vWb.js → workspace-view-state-D0ujRczW.js} +1 -1
- package/app/desktop/main.mjs +7719 -0
- package/app/desktop/preload.cjs +30 -0
- package/app/index.html +2 -2
- package/app/package.json +1 -0
- package/app/public/omni-icon.png +0 -0
- package/app/tools/bootstrap.bin +0 -0
- package/app/tools/omni-desktop.mjs +526 -0
- package/package.json +7 -2
- package/release.json +1 -1
- package/release.sig +1 -1
- package/app/assets/EmptyState-CE7obISq.js +0 -1
- package/app/assets/Favorites-4oU1mgEb.js +0 -1
- package/app/assets/LineChart-B6igYupv.js +0 -4
- package/app/assets/ShopLayoutPage-D7KKJVEq.js +0 -1
- package/app/assets/TrendChart-BdRXaz4z.js +0 -1
- package/app/assets/arrow-down-DSjucZgz.js +0 -1
- package/app/assets/arrow-left-DmIga4jN.js +0 -1
- package/app/assets/arrow-up-right-DzAKT3cL.js +0 -1
- package/app/assets/check-BB89tIU6.js +0 -1
- package/app/assets/chevron-down-BiokgLxD.js +0 -1
- package/app/assets/chevron-right-CZlQQ5gV.js +0 -1
- package/app/assets/entry-Bxc-KNuY.js +0 -1
- package/app/assets/entry-ZwyGbRek.js +0 -1
- package/app/assets/entry-ffP7X21A.js +0 -2
- package/app/assets/index-D1qZkLPg.css +0 -1
- package/app/assets/market-DqV9l-vR.css +0 -1
- package/app/assets/market.module-BSrEp5Ak.js +0 -1
- package/app/assets/package-BFlv-jYw.js +0 -1
- package/app/assets/play-DxbesM66.js +0 -1
- package/app/assets/plus-QakkcxdA.js +0 -1
- package/app/assets/public-JUGpS2z7.js +0 -1
- package/app/assets/search-Cisx0wBF.js +0 -1
- package/app/assets/use-favorites-ALxrDxDW.js +0 -1
- package/app/assets/workbench-DZTf1DRZ.js +0 -2
- /package/app/assets/{api-hjUd9Skg.js → api-KZa8CR8X.js} +0 -0
- /package/app/assets/{use-favorites-_eKBQGeF.css → favorites-_eKBQGeF.css} +0 -0
- /package/app/assets/{format-BCxMsVJh.js → format-DL7i7_eV.js} +0 -0
- /package/app/assets/{graphicalItemSelectors-Hc730Dd1.js → graphicalItemSelectors-CJfZ6cht.js} +0 -0
- /package/app/assets/{group-CjIFQYrJ.js → group-Ed305HyG.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./arrow-up-right-IBQoN72x.js";import{t}from"./chart-column-DCwNhXki.js";import{t as n}from"./check-DBnlZFEo.js";import{t as r}from"./link-2-VLti-YG9.js";import{a as i,i as a,n as o,o as s,r as c}from"./competitor-analysis-D6eM9ugQ.js";import{t as l}from"./plus-D78h7lrw.js";import{t as u}from"./refresh-cw-CxbRf97c.js";import{g as d,o as f,p,s as m,y as h}from"./index-DLSVWUSu.js";import{a as ee,c as g,r as te}from"./components-B5Xyjfpi.js";import{_,n as v,nt as y,o as b,r as x}from"./CartesianChart-CP7p2vlm.js";import{n as S,r as C,t as w}from"./FavoritePicker-XD1a_uOa.js";var T=p(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),E=h(d(),1);async function D(e){if(!window.omni?.competitorAnalysis)throw Error(`请重启山海 Dev 以启用竞品取数连接`);let t=await window.omni.competitorAnalysis(e);if(!t.ok)throw Error(t.error);return t.value}var O={history:(e=0)=>D({op:`history`,page:e}),connect:()=>D({op:`connect`}),start:async e=>(await D({op:`history`,page:0}),D(e)),status:e=>D({op:`status`,id:e}),cancel:e=>D({op:`cancel`,id:e})},k={page:`_page_1yhky_1`,header:`_header_1yhky_2`,eyebrow:`_eyebrow_1yhky_3`,note:`_note_1yhky_5`,period:`_period_1yhky_5`,productSlots:`_productSlots_1yhky_9`,productCard:`_productCard_1yhky_10`,emptySlot:`_emptySlot_1yhky_10`,slotNumber:`_slotNumber_1yhky_11`,remove:`_remove_1yhky_11`,productInfo:`_productInfo_1yhky_12`,placeholder:`_placeholder_1yhky_12`,cardLinks:`_cardLinks_1yhky_13`,addForm:`_addForm_1yhky_14`,controls:`_controls_1yhky_14`,primary:`_primary_1yhky_14`,connection:`_connection_1yhky_15`,alert:`_alert_1yhky_16`,progress:`_progress_1yhky_17`,results:`_results_1yhky_18`,dimensionTabs:`_dimensionTabs_1yhky_18`,resultBody:`_resultBody_1yhky_18`,tableWrap:`_tableWrap_1yhky_18`,comparisonTable:`_comparisonTable_1yhky_18`,metricRow:`_metricRow_1yhky_18`,groupRow:`_groupRow_1yhky_18`,range:`_range_1yhky_18`,missing:`_missing_1yhky_18`,notes:`_notes_1yhky_18`,emptyResult:`_emptyResult_1yhky_19`,audienceToolbar:`_audienceToolbar_1yhky_21`,audienceBehaviors:`_audienceBehaviors_1yhky_22`,audienceLegend:`_audienceLegend_1yhky_22`,audienceTooltip:`_audienceTooltip_1yhky_22`,audienceMetrics:`_audienceMetrics_1yhky_23`,costColumns:`_costColumns_1yhky_24`,audienceColumns:`_audienceColumns_1yhky_24`,costColumn:`_costColumn_1yhky_24`,audienceColumn:`_audienceColumn_1yhky_24`,costProduct:`_costProduct_1yhky_24`,audienceProduct:`_audienceProduct_1yhky_24`,audienceChart:`_audienceChart_1yhky_25`,audienceChartEmpty:`_audienceChartEmpty_1yhky_25`,audienceEmpty:`_audienceEmpty_1yhky_25`,audienceMissing:`_audienceMissing_1yhky_25`,audienceValues:`_audienceValues_1yhky_27`,costChart:`_costChart_1yhky_30`,costChartEmpty:`_costChartEmpty_1yhky_30`,costCoverage:`_costCoverage_1yhky_30`,costTooltip:`_costTooltip_1yhky_30`,channelTable:`_channelTable_1yhky_32`,channelHeading:`_channelHeading_1yhky_32`,channelMetrics:`_channelMetrics_1yhky_32`,channelEmpty:`_channelEmpty_1yhky_32`,channelToggle:`_channelToggle_1yhky_34`,channelChild:`_channelChild_1yhky_34`,headerActions:`_headerActions_1yhky_36`,historyList:`_historyList_1yhky_36`,historyCard:`_historyCard_1yhky_36`,historyHeading:`_historyHeading_1yhky_36`,historyFooter:`_historyFooter_1yhky_36`,historyProducts:`_historyProducts_1yhky_36`,addDialog:`_addDialog_1yhky_38`,dialogHeading:`_dialogHeading_1yhky_38`,sourceChoices:`_sourceChoices_1yhky_38`,pickerForm:`_pickerForm_1yhky_38`,pickerBrowse:`_pickerBrowse_1yhky_38`},A=[{key:`viewers`,label:`浏览`,value:1},{key:`favorites`,label:`收藏`,value:2},{key:`cartAdders`,label:`加购`,value:3},{key:`buyers`,label:`购买`,value:4}];function j(e,t,n){let r=A.filter(e=>t.includes(e.key)),i=[...new Set(e.flatMap(e=>r.flatMap(({key:t})=>(e?.[t]||[]).map(e=>e.name))))],a=!1,o=e.map(e=>i.map(t=>({name:t,...Object.fromEntries(r.map(({key:r})=>{let i=e?.[r]?.find(e=>e.name===t)?.[n];return i==null?[r,null]:!Number.isFinite(i)||i<0||n===`rate`&&i>1?(a=!0,[r,null]):[r,i]}))}))),s=Math.max(1,...o.flatMap(e=>e.flatMap(e=>r.map(({key:t})=>e[t]??0)))),c=10**Math.floor(Math.log10(s)),l=Math.max(4,Math.ceil(Math.ceil(s/c)*c/4)*4);return{columns:o,ceiling:n===`rate`?1:l,invalid:a}}var M=f(),N={viewers:`var(--omni-chart-primary,#469eff)`,favorites:`var(--omni-chart-secondary,#b99aff)`,cartAdders:`var(--omni-chart-orange,#d4a25c)`,buyers:`var(--omni-chart-teal,#34b9ac)`};function P(e,t){return e==null?`—`:(t?e*100:e).toLocaleString(`zh-CN`,{maximumFractionDigits:2})+(t?`%`:``)}function F({x:e=0,y:t=0,payload:n}){let r=String(n?.value||``).match(/.{1,6}/gu)||[];return(0,M.jsx)(`text`,{x:e,y:t+12,textAnchor:`middle`,fill:`var(--omni-muted,var(--omni-chart-primary,#91a9c0))`,fontSize:10,children:r.map((t,n)=>(0,M.jsx)(`tspan`,{x:e,dy:n?14:0,children:t},n))})}function ne({results:e,products:t}){let[r,i]=g(`competitor.audienceDimension`,`性别`),[a,o]=g(`competitor.audienceMetric`,`rate`),[s,c]=g(`competitor.audienceBehaviors`,[`viewers`,`buyers`]),l=a===`rate`,u=A.filter(e=>s.includes(e.key)),d=Array.from({length:2},(n,i)=>{let a=t[i],o=e.find(e=>e.product.id===a?.id);return{product:o?.product||a,group:o?.audiences.find(e=>e.name===r)}}),f=j(d.map(e=>e.group),s,a),p=l?`占比`:`人数`,m=d.some(({group:e})=>e&&(e.favorites===void 0||e.cartAdders===void 0));return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:k.dimensionTabs,"aria-label":`画像维度`,children:[`性别`,`年龄`,`购买力`,`城市等级`].map(e=>(0,M.jsx)(`button`,{"aria-pressed":e===r,onClick:()=>i(e),children:e},e))}),(0,M.jsxs)(`div`,{className:k.audienceToolbar,children:[(0,M.jsxs)(`div`,{className:k.audienceBehaviors,role:`group`,"aria-label":`对比人群(可多选)`,children:[(0,M.jsxs)(`span`,{children:[`对比人群 `,(0,M.jsx)(`small`,{children:`可多选`})]}),A.map(({key:e,label:t})=>(0,M.jsxs)(`button`,{"aria-label":`${t}人群`,"aria-pressed":s.includes(e),onClick:()=>c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),children:[(0,M.jsx)(`i`,{style:{background:N[e]}}),t,s.includes(e)&&(0,M.jsx)(n,{size:12})]},e))]}),(0,M.jsx)(`div`,{className:k.audienceMetrics,role:`group`,"aria-label":`画像对比指标`,children:[`rate`,`count`].map(e=>(0,M.jsx)(`button`,{"aria-pressed":a===e,onClick:()=>o(e),children:e===`rate`?`占比`:`人数`},e))})]}),(0,M.jsxs)(`p`,{className:k.note,children:[`两列同刻度 · `,l?`0–100%`:`0–${P(f.ceiling,!1)} 人`,` · 同色代表同类人群`]}),u.length?(0,M.jsx)(`div`,{className:k.tableWrap,children:(0,M.jsx)(`div`,{className:k.audienceColumns,"aria-label":`${r} · ${p}竖向柱状对比`,children:d.map(({product:e,group:t},n)=>{let i=f.columns[n],a=u.filter(({key:e})=>!i.some(t=>t[e]!=null));return(0,M.jsxs)(`section`,{className:k.audienceColumn,"aria-label":`竞品 ${n+1} ${p}`,children:[(0,M.jsxs)(`header`,{className:k.audienceProduct,children:[(0,M.jsxs)(`small`,{children:[`竞品 `,n+1]}),(0,M.jsx)(`strong`,{title:e?.name,children:e?.name||`等待添加商品`})]}),(0,M.jsx)(`div`,{className:k.audienceLegend,children:u.map(({key:e,label:t})=>(0,M.jsxs)(`span`,{children:[(0,M.jsx)(`i`,{style:{background:N[e]}}),t]},e))}),e&&i.length&&a.length<u.length?(0,M.jsx)(`div`,{className:k.audienceChart,children:(0,M.jsx)(y,{width:`100%`,height:`100%`,minWidth:0,initialDimension:{width:400,height:300},children:(0,M.jsxs)(S,{data:i,margin:{top:16,right:14,bottom:8,left:0},barCategoryGap:`20%`,barGap:3,accessibilityLayer:!0,children:[(0,M.jsx)(b,{stroke:`var(--omni-line,var(--omni-chart-track,#294052))`,vertical:!1}),(0,M.jsx)(x,{dataKey:`name`,interval:0,tick:(0,M.jsx)(F,{}),height:54,tickLine:!1,axisLine:{stroke:`var(--omni-line,#294052)`}}),(0,M.jsx)(v,{domain:[0,f.ceiling],ticks:[0,.25,.5,.75,1].map(e=>e*f.ceiling),width:60,tickLine:!1,axisLine:!1,tick:{fontSize:10,fill:`var(--omni-muted,#91a9c0)`},tickFormatter:e=>l?`${e*100}%`:e>=1e4?`${P(e/1e4,!1)}万`:P(e,!1)}),(0,M.jsx)(_,{cursor:{fill:`var(--omni-panel,#102236)`,opacity:.45},content:({active:e,label:n})=>!e||n==null?null:(0,M.jsxs)(`div`,{className:k.audienceTooltip,children:[(0,M.jsx)(`strong`,{children:n}),u.map(({key:e,label:r})=>{let i=t?.[e]?.find(e=>e.name===String(n));return(0,M.jsxs)(`p`,{children:[(0,M.jsx)(`i`,{style:{background:N[e]}}),r,(0,M.jsxs)(`span`,{children:[P(i?.count,!1),` 人 · `,P(i?.rate,!0)]})]},e)})]})}),u.map(({key:e,label:t})=>(0,M.jsx)(C,{name:t,dataKey:e,fill:N[e],maxBarSize:40,radius:[3,3,0,0],isAnimationActive:!1},e))]},u.map(e=>e.key).join(`,`))})}):(0,M.jsx)(`div`,{className:k.audienceChartEmpty,children:e?`所选人群暂无可用数据`:`添加第二个商品即可对比`}),e&&a.length>0&&(0,M.jsxs)(`p`,{className:k.audienceMissing,children:[a.map(e=>e.label).join(`、`),`:当前维度暂无可用数据`]}),e&&i.length>0&&(0,M.jsxs)(`details`,{className:k.audienceValues,children:[(0,M.jsxs)(`summary`,{children:[`查看`,p,`明细(含缺失项)`]}),(0,M.jsxs)(`table`,{children:[(0,M.jsxs)(`caption`,{children:[r,` · `,p,!l&&`(人)`]}),(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`col`,children:`分类`}),u.map(({key:e,label:t})=>(0,M.jsx)(`th`,{scope:`col`,children:t},e))]})}),(0,M.jsx)(`tbody`,{children:i.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e.name}),u.map(({key:t})=>(0,M.jsx)(`td`,{children:P(e[t],l)},t))]},e.name))})]})]})]},n)})})}):(0,M.jsx)(`p`,{className:k.audienceEmpty,children:`请选择至少一类人群,可同时选择浏览和购买进行对比。`}),f.invalid&&(0,M.jsx)(`p`,{className:k.note,children:`部分数值超出有效范围,未绘制柱形;未按零值处理。`}),(0,M.jsxs)(`p`,{className:k.note,children:[`悬停查看人数与占比;明细中“—”表示缺失,0 表示已返回的零值。`,m&&`当前结果尚未采集收藏和加购人群,请重新开始分析。`]}),(0,M.jsx)(`p`,{className:k.note,children:`各类人群可能重叠,不相加为总人数;占比按各自人群的原始分母展示,差异反映人群结构,不能直接当作转化率。`})]})}function I({products:e,onAdd:t,onBrowse:n,onClose:r}){let i=(0,E.useRef)(null),[a,s]=(0,E.useState)(`id`),[c,l]=(0,E.useState)(``),[u,d]=(0,E.useState)(``);(0,E.useEffect)(()=>{let e=document.activeElement;return i.current?.showModal(),()=>e?.focus()},[]);function f(e){try{t(e),r()}catch(e){d(e instanceof Error?e.message:`添加未完成`)}}function p(){let e=o(c);if(!e){d(`请输入有效商品 ID,或带 id 参数的淘宝/天猫商品链接`);return}f({id:e,name:`商品 ${e}`})}return(0,M.jsxs)(`dialog`,{ref:i,className:k.addDialog,"aria-labelledby":`competitor-picker-title`,onCancel:e=>{e.preventDefault(),r()},onClick:e=>{e.target===e.currentTarget&&r()},children:[(0,M.jsxs)(`div`,{className:k.dialogHeading,children:[(0,M.jsx)(`h2`,{id:`competitor-picker-title`,children:`添加竞品商品`}),(0,M.jsx)(`button`,{onClick:r,"aria-label":`关闭商品选择`,children:(0,M.jsx)(m,{size:18})})]}),(0,M.jsxs)(`p`,{className:k.note,children:[`已选择 `,e.length,` / `,2,` 个商品`]}),(0,M.jsx)(`nav`,{className:k.sourceChoices,"aria-label":`商品添加方式`,children:[[`id`,`输入 ID / 链接`],[`ranking`,`从商品榜单添加`],[`favorites`,`从收藏商品添加`]].map(([e,t])=>(0,M.jsx)(`button`,{"aria-pressed":a===e,onClick:()=>{s(e),d(``)},children:t},e))}),u&&(0,M.jsx)(`p`,{role:`alert`,className:k.alert,children:u}),a===`id`&&(0,M.jsxs)(`form`,{className:k.pickerForm,onSubmit:e=>{e.preventDefault(),p()},children:[(0,M.jsx)(`label`,{htmlFor:`competitor-picker-id`,children:`商品 ID / 链接`}),(0,M.jsx)(`input`,{id:`competitor-picker-id`,value:c,onChange:e=>l(e.target.value),placeholder:`输入淘宝/天猫商品 ID 或链接`}),(0,M.jsx)(`button`,{type:`submit`,disabled:!c.trim()||e.length>=2,children:`添加到竞品分析`})]}),a===`ranking`&&(0,M.jsxs)(`div`,{className:k.pickerBrowse,children:[(0,M.jsx)(`p`,{children:`在商品排行榜选择商品,点击“加入分析”,已选商品会保留。`}),(0,M.jsx)(`button`,{onClick:()=>{r(),n()},children:`前往商品排行榜`})]}),a===`favorites`&&(0,M.jsx)(w,{kind:`product`,selectedIds:e.map(e=>e.id),onSelect:({record:e})=>{e?.id&&f({id:e.id,name:e.name||`商品 ${e.id}`,imageUrl:e.imageUrl,shopName:e.shopName})}})]})}var L={queued:`排队中`,running:`采集中`,complete:`已完成`,cancelled:`已停止`,error:`采集异常`,interrupted:`已中断`};function re({onOpen:e}){let[t,n]=(0,E.useState)(0),[r,i]=(0,E.useState)(0),[a,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(``);return(0,E.useEffect)(()=>{let e=!1,n;async function r(){try{let i=await O.history(t);if(e)return;o(i),c(``),n=setTimeout(()=>void r(),5e3)}catch(t){e||c(t instanceof Error?t.message:`历史分析加载失败`)}}return r(),()=>{e=!0,clearTimeout(n)}},[t,r]),(0,M.jsxs)(`section`,{"aria-label":`历史分析`,children:[(0,M.jsx)(`p`,{className:k.note,children:`历史按当前账号保存到企业数据库,换电脑登录后可查看。返回榜单不影响采集;请保持发起分析的电脑和 Dev 在线。`}),s&&(0,M.jsxs)(`div`,{className:k.alert,role:`alert`,children:[s,` `,(0,M.jsx)(`button`,{onClick:()=>{c(``),i(e=>e+1)},children:`重新加载`})]}),!a&&!s&&(0,M.jsx)(`p`,{role:`status`,children:`正在读取历史分析…`}),a?.items.length===0&&(0,M.jsxs)(`div`,{className:k.emptyResult,children:[(0,M.jsx)(`h2`,{children:`还没有历史分析`}),(0,M.jsx)(`p`,{children:`新建分析后会自动保存,可随时回来查看进度和结果。`})]}),(0,M.jsx)(`div`,{className:k.historyList,children:a?.items.map(t=>(0,M.jsxs)(`article`,{className:k.historyCard,children:[(0,M.jsxs)(`div`,{className:k.historyHeading,children:[(0,M.jsx)(`strong`,{children:L[t.status]}),(0,M.jsx)(`time`,{children:new Date(t.startedAt).toLocaleString(`zh-CN`)})]}),(0,M.jsx)(`div`,{className:k.historyProducts,children:t.products.map((e,t)=>(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`small`,{children:[`竞品 `,t+1]}),(0,M.jsx)(`strong`,{title:e.name,children:e.name}),(0,M.jsxs)(`small`,{children:[`ID `,e.id]})]},e.id))}),(0,M.jsxs)(`div`,{className:k.historyFooter,children:[(0,M.jsxs)(`span`,{children:[t.window.startDate,` 至 `,t.window.endDate,` · `,t.progress.completed,` / `,t.progress.total,` 项`]}),(0,M.jsx)(`button`,{onClick:()=>e(t.id),children:`查看分析`})]}),t.saveError&&(0,M.jsx)(`p`,{role:`alert`,children:t.saveError})]},t.id))}),a&&(0,M.jsxs)(`div`,{className:k.historyFooter,children:[(0,M.jsx)(`button`,{disabled:t===0,onClick:()=>{o(null),c(``),n(e=>e-1)},children:`上一页`}),(0,M.jsxs)(`span`,{children:[`第 `,t+1,` 页`]}),(0,M.jsx)(`button`,{disabled:!a.hasMore,onClick:()=>{o(null),c(``),n(e=>e+1)},children:`下一页`})]})]})}var R=[[`summary`,`核心对比`],[`costs`,`推广花费`],[`audience`,`人群画像`],[`strategies`,`投放策略`],[`channels`,`流量渠道`]];function z(e,t=!1){return e==null?`—`:(t?e*100:e).toLocaleString(`zh-CN`,{maximumFractionDigits:2})+(t?`%`:``)}function B({metric:e,percent:t=!1}){return!e||e.value==null?(0,M.jsx)(`span`,{className:k.missing,children:`—`}):(0,M.jsxs)(`span`,{className:e.precision===`range`?k.range:``,children:[typeof e.value==`number`?z(e.value,t):e.value,e.precision===`range`&&(0,M.jsx)(`small`,{children:`区间`})]})}function V({results:e,products:t,rows:n}){let r=Array.from({length:2},(n,r)=>({product:t[r],result:e.find(e=>e.product.id===t[r]?.id)}));return(0,M.jsx)(`div`,{className:k.tableWrap,children:(0,M.jsxs)(`table`,{className:k.comparisonTable,children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:r.map(({product:e,result:t},n)=>(0,M.jsxs)(`th`,{scope:`col`,children:[(0,M.jsxs)(`small`,{children:[`竞品 `,n+1]}),(0,M.jsx)(`strong`,{title:t?.product.name||e?.name,children:t?.product.name||e?.name||`等待添加商品`})]},n))})}),(0,M.jsx)(`tbody`,{children:n.map((e,t)=>(0,M.jsx)(`tr`,{className:e.render?void 0:k.groupRow,children:r.map(({result:t},n)=>(0,M.jsx)(`td`,{children:e.render?(0,M.jsxs)(`div`,{className:k.metricRow,children:[(0,M.jsx)(`span`,{children:e.label}),(0,M.jsx)(`span`,{children:t?e.render(t):`—`})]}):(0,M.jsx)(`strong`,{children:e.label})},n))},e.key||`${e.label}:${t}`))})]})})}function ie(e){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(V,{...e,rows:[{label:`推广总花费(元)`,render:e=>(0,M.jsx)(`strong`,{children:z(e.totalCost)})},{label:`花费记录天数`,render:e=>e.daily.length||`—`},{label:`推广点击量`,render:e=>(0,M.jsx)(B,{metric:e.metrics.click})},{label:`成交笔数(1 日归因)`,render:e=>(0,M.jsx)(B,{metric:e.metrics.alipayCnt1d})}]}),(0,M.jsx)(`p`,{className:k.note,children:`仅展示监控竞品的数据。平台区间保留原值,缺失项显示“—”;不把不同归因范围拼成精确销售额或整体 ROI。`})]})}function ae(e){let t=Date.parse(`${e.window.startDate}T00:00:00Z`),n=Array.from({length:e.window.days},(e,n)=>new Date(t+n*864e5).toISOString().slice(0,10)),r=Array.from({length:2},(t,r)=>{let i=e.products[r],a=e.results.find(e=>e.product.id===i?.id),o=new Map(a?.daily.map(e=>[e.date,e.cost]));return{product:a?.product||i,data:n.map(e=>({date:e,cost:o.get(e)??null}))}}),i=r.flatMap(e=>e.data.map(e=>e.cost)).filter(e=>e!==null&&Number.isFinite(e)),a=Math.max(1,...i),o=10**Math.floor(Math.log10(a)),s=Math.ceil(a/o)*o,c=Math.floor(Math.min(0,...i)/o)*o,l=Array.from({length:5},(e,t)=>c+(s-c)*t/4),u=n.filter((e,t)=>t%Math.ceil(n.length/6)===0||t===n.length-1);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(V,{...e,rows:[`关键词推广`,`货品全站推`,`人群推广`,`内容运营`,`线索推广`].map(e=>({label:`${e}(元)`,render:t=>z(t.costs.find(t=>t.label===e)?.value)}))}),(0,M.jsx)(`h3`,{children:`逐日推广花费`}),(0,M.jsx)(`p`,{className:k.note,children:`按日期查看每日花费 · 单位:元 · 两列同刻度 · 悬停查看当天金额`}),(0,M.jsx)(`div`,{className:k.tableWrap,children:(0,M.jsx)(`div`,{className:k.costColumns,"aria-label":`逐日推广花费柱状对比`,children:r.map(({product:e,data:t},n)=>{let r=t.filter(e=>e.cost===null),i=n===0?`var(--omni-chart-primary,#469eff)`:`var(--omni-chart-teal,#34b9ac)`;return(0,M.jsxs)(`section`,{className:k.costColumn,"aria-label":`竞品 ${n+1} 每日推广花费`,children:[(0,M.jsxs)(`header`,{className:k.costProduct,children:[(0,M.jsxs)(`small`,{children:[(0,M.jsx)(`i`,{style:{background:i}}),`竞品 `,n+1]}),(0,M.jsx)(`strong`,{title:e?.name,children:e?.name||`等待添加商品`})]}),e&&r.length<t.length?(0,M.jsx)(`div`,{className:k.costChart,children:(0,M.jsx)(y,{width:`100%`,height:`100%`,minWidth:0,initialDimension:{width:400,height:280},children:(0,M.jsxs)(S,{data:t,margin:{top:16,right:20,bottom:6,left:0},barCategoryGap:`24%`,accessibilityLayer:!0,children:[(0,M.jsx)(b,{stroke:`var(--omni-line,var(--omni-chart-track,#294052))`,vertical:!1}),(0,M.jsx)(x,{dataKey:`date`,ticks:u,interval:0,tickFormatter:e=>String(e).slice(5).replace(`-`,`/`),height:30,tick:{fontSize:10,fill:`var(--omni-muted,#91a9c0)`},tickLine:!1,axisLine:{stroke:`var(--omni-line,#294052)`}}),(0,M.jsx)(v,{domain:[c,s],ticks:l,width:60,tickLine:!1,axisLine:!1,tick:{fontSize:10,fill:`var(--omni-muted,#91a9c0)`},tickFormatter:e=>Math.abs(e)>=1e4?`${z(e/1e4)}万`:z(e)}),(0,M.jsx)(_,{filterNull:!1,cursor:{fill:`var(--omni-panel,#102236)`,opacity:.45},content:({active:e,label:r})=>{if(!e||r==null)return null;let i=t.find(e=>e.date===r)?.cost;return(0,M.jsxs)(`div`,{className:k.costTooltip,children:[(0,M.jsx)(`strong`,{children:r}),(0,M.jsxs)(`p`,{children:[`竞品 `,n+1,` · 推广花费`]}),(0,M.jsx)(`b`,{children:i==null?`未返回数据`:`${z(i)} 元`})]})}}),(0,M.jsx)(C,{dataKey:`cost`,name:`推广花费(元)`,fill:i,maxBarSize:32,radius:[3,3,0,0],isAnimationActive:!1})]})})}):(0,M.jsx)(`div`,{className:k.costChartEmpty,children:e?`当前商品暂无有效逐日花费`:`添加第二个商品即可对比`}),e&&(0,M.jsxs)(`p`,{className:k.costCoverage,children:[`有效花费 `,t.length-r.length,` / `,t.length,` 天`,r.length>0&&(0,M.jsxs)(M.Fragment,{children:[` · 缺失:`,r.slice(0,4).map(e=>e.date.slice(5)).join(`、`),r.length>4&&` 等 ${r.length} 天`]})]})]},n)})})}),(0,M.jsx)(`h3`,{children:`逐日花费明细(元)`}),(0,M.jsx)(V,{...e,rows:n.map(e=>({label:e,render:t=>z(t.daily.find(t=>t.date===e)?.cost)}))}),(0,M.jsx)(`p`,{className:k.note,children:`合计仅覆盖接口实际返回的日期;未返回的日期不补零。`})]})}var H=[[`impression`,`展现量`],[`click`,`点击量`],[`ctr`,`点击率`],[`cpc`,`点击成本(元)`],[`chargeRatio`,`消耗占比`],[`directDealAmount`,`直接成交额(元)`],[`directRoi`,`直接 ROI`]],U=[[`click`,`点击量`],[`alipayCnt`,`成交笔数`],[`cartRate`,`加购率`],[`alipayConversion`,`支付转化率`],[`clickRate`,`点击率`]];function W(e){return JSON.stringify([e.parent,e.name])}function oe(e){let t=[...new Map(e.results.flatMap(e=>e.scenes).map(e=>[W(e),e])).values()].flatMap(e=>[{label:[e.parent,e.name].filter(Boolean).join(` / `)},...H.map(([t,n])=>({label:n,render:n=>(0,M.jsx)(B,{metric:n.scenes.find(t=>W(t)===W(e))?.metrics[t],percent:t===`ctr`||t===`chargeRatio`})}))]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(V,{...e,rows:t.length?t:[{label:`投放策略`,render:()=>`暂无数据`}]}),(0,M.jsx)(`p`,{className:k.note,children:`两个竞品的场景和策略按同一顺序对齐。直接成交额属于相应场景,不代表商品全渠道销售额。`})]})}function G(e){let[t,n]=(0,E.useState)([]),r=[...new Map(e.results.flatMap(e=>e.channels).map(e=>[W(e),e])).values()],i=[...new Set(r.map(e=>e.parent||e.name))].flatMap(e=>[r.find(t=>!t.parent&&t.name===e)||{name:e,parent:null,type:``,metrics:{}},...t.includes(e)?r.filter(t=>t.parent===e):[]]),a=Array.from({length:2},(t,n)=>({product:e.products[n],result:e.results.find(t=>t.product.id===e.products[n]?.id)}));return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:k.tableWrap,tabIndex:0,role:`region`,"aria-label":`流量渠道对比,可横向滚动`,children:(0,M.jsxs)(`table`,{className:`${k.comparisonTable} ${k.channelTable}`,"aria-label":`两个竞品的渠道指标`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:a.map(({product:e,result:t},n)=>(0,M.jsxs)(`th`,{scope:`col`,children:[(0,M.jsxs)(`small`,{children:[`竞品 `,n+1]}),(0,M.jsx)(`strong`,{title:t?.product.name||e?.name,children:t?.product.name||e?.name||`等待添加商品`})]},n))})}),(0,M.jsx)(`tbody`,{children:r.length?i.map(e=>(0,M.jsx)(`tr`,{children:a.map(({result:i},a)=>{let o=i?.channels.find(t=>W(t)===W(e)),s=o?.type&&{organic:`免费`,ad:`付费`,brand_ad:`品牌广告`}[o.type]||`—`;return(0,M.jsxs)(`td`,{children:[(0,M.jsxs)(`div`,{className:k.channelHeading,children:[!e.parent&&r.some(t=>t.parent===e.name)?(0,M.jsxs)(`button`,{className:k.channelToggle,"aria-expanded":t.includes(e.name),onClick:()=>n(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name]),children:[t.includes(e.name)?`▾`:`▸`,` `,e.name,(0,M.jsxs)(`small`,{children:[r.filter(t=>t.parent===e.name).length,` 个子渠道`]})]}):(0,M.jsxs)(`strong`,{className:e.parent?k.channelChild:void 0,children:[e.parent?`↳ `:``,e.name]}),(0,M.jsxs)(`span`,{children:[`渠道类型:`,s]})]}),(0,M.jsx)(`dl`,{className:k.channelMetrics,children:U.map(([e,t])=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:t}),(0,M.jsx)(`dd`,{children:(0,M.jsx)(B,{metric:o?.metrics[e],percent:[`cartRate`,`alipayConversion`,`clickRate`].includes(e)})})]},e))})]},a)})},W(e))):(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:2,className:k.channelEmpty,children:`暂无流量渠道数据`})})})]})}),(0,M.jsx)(`p`,{className:k.note,children:`父渠道与子渠道存在包含关系,不能重复加总;没有广告曝光口径的渠道可能不返回点击率。`})]})}function K({products:d,onAdd:f,onRemove:p,onBrowse:h,onStarted:_}){let[v,y]=(0,E.useState)(``),[b,x]=(0,E.useState)(``),[S,C]=(0,E.useState)(!1),[w,D]=g(`competitor.days`,30),[A,j]=g(`competitor.endDate`,i()),[N,P]=g(`competitor.connection`,null),[F,z]=g(`competitor.job`,null),[B,V]=g(`competitor.section`,`summary`),[H,U]=g(`competitor.view.v2`,`new`),[W,K]=(0,E.useState)(!1),q=(0,E.useRef)(!0),J=(0,E.useRef)(0),Y=F?.status===`running`||F?.status===`queued`,X=F?.id;(0,E.useEffect)(()=>(q.current=!0,()=>{q.current=!1}),[]),(0,E.useEffect)(()=>{if(!X||!Y)return;let e=!1,t;async function n(){try{let r=await O.status(X);e||(z(r),(r.status===`error`||r.status===`cancelled`)&&P(null),x(``),(r.status===`running`||r.status===`queued`)&&(t=setTimeout(()=>void n(),1500)))}catch(r){e||(x(r instanceof Error?r.message:`分析状态读取失败`),t=setTimeout(()=>void n(),5e3))}}return t=setTimeout(()=>void n(),500),()=>{e=!0,clearTimeout(t)}},[X,Y,z,P]);async function Z(e){C(!0),x(``);try{await e()}catch(e){q.current&&x(e instanceof Error?e.message:`操作未完成`)}finally{q.current&&C(!1)}}function se(){try{let e=o(v);if(!e)throw Error(`请输入有效商品 ID,或带 id 参数的淘宝/天猫商品链接`);f({id:e,name:`商品 ${e}`}),y(``),x(``)}catch(e){x(e.message)}}let Q=``;try{let e=a(w,A);Q=`${e.startDate} 至 ${e.endDate}`}catch{}let $=F?.results||[];return(0,M.jsxs)(`section`,{className:k.page,"aria-label":`竞品分析`,children:[(0,M.jsxs)(`header`,{className:k.header,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:k.eyebrow,children:`市场大盘 / 竞品研究`}),(0,M.jsxs)(`h1`,{children:[H===`history`?`历史分析`:H===`new`?`新建竞品分析`:`竞品分析详情`,` `,H===`new`&&(0,M.jsxs)(`span`,{children:[d.length,` / `,2]})]}),(0,M.jsx)(`p`,{children:`从推广投入、客群与渠道,看清商品之间的差异。`})]}),(0,M.jsxs)(`div`,{className:k.headerActions,children:[(0,M.jsx)(`button`,{onClick:()=>{J.current++,U(`history`),x(``)},children:`历史分析`}),(0,M.jsx)(`button`,{onClick:()=>{J.current++,U(`new`),z(null),x(``)},children:`新建分析`}),(0,M.jsxs)(`button`,{onClick:h,children:[(0,M.jsx)(l,{size:15}),`从商品排行榜添加`]})]})]}),b&&(0,M.jsx)(`div`,{className:k.alert,role:`alert`,children:b}),H===`history`&&(0,M.jsx)(re,{onOpen:e=>{let t=++J.current;Z(async()=>{let n=await O.status(e);q.current&&t===J.current&&(z(n),U(`detail`))})}}),W&&(0,M.jsx)(I,{products:d,onAdd:f,onBrowse:h,onClose:()=>K(!1)}),H===`new`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:k.productSlots,children:Array.from({length:2},(t,n)=>{let i=d[n],a=$.find(e=>e.product.id===i?.id)?.product||i;return i?(0,M.jsxs)(`article`,{className:k.productCard,children:[(0,M.jsxs)(`span`,{className:k.slotNumber,children:[`0`,n+1]}),(0,M.jsx)(`button`,{className:k.remove,"aria-label":`移除商品 ${i.id}`,disabled:S,onClick:()=>p(i.id),children:(0,M.jsx)(m,{size:15})}),(0,M.jsxs)(`div`,{className:k.productInfo,children:[a.imageUrl?(0,M.jsx)(ee,{src:a.imageUrl,name:a.name}):(0,M.jsx)(`span`,{className:k.placeholder,children:(0,M.jsx)(s,{size:26})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`strong`,{title:a.name,children:a.name}),(0,M.jsx)(`small`,{children:a.shopName||`待查询店铺资料`}),(0,M.jsxs)(`small`,{children:[`ID `,i.id]})]})]}),(0,M.jsxs)(`div`,{className:k.cardLinks,children:[(0,M.jsxs)(`a`,{href:c(i),target:`_blank`,rel:`noreferrer`,children:[`商品链接 `,(0,M.jsx)(e,{size:13})]}),(0,M.jsx)(te,{text:c(i),label:`复制商品链接 ${i.id}`,title:`复制商品链接`,children:(0,M.jsx)(r,{size:14})})]})]},i.id):(0,M.jsxs)(`button`,{type:`button`,className:k.emptySlot,disabled:S,"aria-label":`添加第 ${n+1} 个竞品商品`,onClick:()=>K(!0),children:[(0,M.jsxs)(`span`,{children:[`0`,n+1]}),(0,M.jsx)(l,{size:22}),(0,M.jsx)(`p`,{children:n===0?`添加第一个分析商品`:`添加商品进行并排对比`})]},n)})}),(0,M.jsxs)(`form`,{className:k.addForm,onSubmit:e=>{e.preventDefault(),se()},children:[(0,M.jsx)(`label`,{htmlFor:`competitor-input`,children:`商品 ID / 链接`}),(0,M.jsx)(`input`,{id:`competitor-input`,value:v,onChange:e=>y(e.target.value),placeholder:`粘贴淘宝/天猫商品链接或商品 ID`,disabled:d.length>=2||S}),(0,M.jsxs)(`button`,{type:`submit`,disabled:!v.trim()||d.length>=2||S,children:[(0,M.jsx)(l,{size:15}),`添加商品`]})]}),(0,M.jsxs)(`div`,{className:k.controls,children:[(0,M.jsxs)(`label`,{children:[`分析周期`,(0,M.jsxs)(`select`,{value:w,disabled:S,onChange:e=>D(Number(e.target.value)),children:[(0,M.jsx)(`option`,{value:7,children:`近 7 天`}),(0,M.jsx)(`option`,{value:30,children:`近 30 天`})]})]}),(0,M.jsxs)(`label`,{children:[`截至日期`,(0,M.jsx)(`input`,{type:`date`,max:i(),value:A,disabled:S,onChange:e=>j(e.target.value)})]}),(0,M.jsxs)(`button`,{disabled:S,onClick:()=>void Z(async()=>{P(null);let e=await O.connect();q.current&&P(e)}),children:[(0,M.jsx)(u,{size:14}),S?`正在处理…`:N?`重新连接达摩盘`:`连接达摩盘`]}),(0,M.jsxs)(`button`,{className:k.primary,disabled:!d.length||!N||S,onClick:()=>void Z(async()=>{a(w,A);let e=await O.start({op:`start`,products:d,days:w,endDate:A,account:N.account});_(d),q.current&&(z(e),U(`detail`))}),children:[(0,M.jsx)(t,{size:16}),S?`正在保存…`:`开始分析并保存`]})]}),N?(0,M.jsx)(`div`,{className:k.connection,children:(0,M.jsxs)(`span`,{children:[(0,M.jsx)(n,{size:14}),`取数账号:`,N.account]})}):(0,M.jsxs)(`p`,{className:k.note,children:[`连接后确认达摩盘账号,再开始读取。最多 `,2,` 个竞品串行采集,期间可切换页面。`]}),Q&&(0,M.jsxs)(`p`,{className:k.period,children:[Q,` · 统一周期对比 · 数据截至完整自然日`]}),(0,M.jsx)(`p`,{className:k.note,children:`提交成功后清空榜单待选商品;已有采集时,新分析自动排队。保存失败会保留当前选择。`})]}),H===`detail`&&F&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:k.historyProducts,children:F.products.map((e,t)=>(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`small`,{children:[`竞品 `,t+1]}),(0,M.jsx)(`strong`,{children:F.results.find(t=>t.product.id===e.id)?.product.name||e.name}),(0,M.jsxs)(`small`,{children:[`ID `,e.id]})]},e.id))}),(0,M.jsxs)(`div`,{className:k.historyFooter,children:[(0,M.jsxs)(`span`,{children:[F.window.startDate,` 至 `,F.window.endDate,` · `,L[F.status]]}),Y&&F.canCancel&&(0,M.jsxs)(`button`,{disabled:S,onClick:()=>void Z(async()=>{let e=await O.cancel(F.id);q.current&&z(e)}),children:[(0,M.jsx)(T,{size:13}),F.status===`queued`?`取消排队`:`停止采集`]})]}),F.saveError?(0,M.jsxs)(`p`,{className:k.alert,role:`alert`,children:[F.saveError,`;当前页面可能含尚未保存的数据。`]}):F.savedAt&&(0,M.jsxs)(`p`,{className:k.note,children:[`已保存到企业数据库 · `,new Date(F.savedAt).toLocaleString(`zh-CN`)]}),F&&(0,M.jsxs)(`div`,{className:k.progress,role:`status`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`strong`,{children:F.progress.label}),(0,M.jsxs)(`span`,{children:[F.progress.completed,` / `,F.progress.total,` 项`]})]}),(0,M.jsx)(`progress`,{value:F.progress.completed,max:F.progress.total}),F.error&&(0,M.jsx)(`p`,{children:F.error})]}),$.length?(0,M.jsxs)(`section`,{className:k.results,children:[(0,M.jsx)(`nav`,{"aria-label":`竞品分析结果`,children:R.map(([e,t])=>(0,M.jsx)(`button`,{"aria-pressed":B===e,onClick:()=>V(e),children:t},e))}),(0,M.jsx)(`div`,{className:k.resultBody,children:B===`summary`?(0,M.jsx)(ie,{results:$,products:F.products}):B===`costs`?(0,M.jsx)(ae,{results:$,products:F.products,window:F.window}):B===`audience`?(0,M.jsx)(ne,{results:$,products:F.products}):B===`strategies`?(0,M.jsx)(oe,{results:$,products:F.products}):(0,M.jsx)(G,{results:$,products:F.products})}),$.some(e=>e.warnings.length||!e.complete)&&(0,M.jsxs)(`details`,{className:k.notes,children:[(0,M.jsx)(`summary`,{children:`数据完整性与口径说明`}),$.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`strong`,{children:e.product.name}),!e.complete&&(0,M.jsx)(`p`,{children:`该商品尚未完成全部查询,空白项不代表零。`}),e.warnings.map(e=>(0,M.jsx)(`p`,{children:e},e))]},e.product.id))]})]}):(0,M.jsxs)(`div`,{className:k.emptyResult,children:[(0,M.jsx)(t,{size:34}),(0,M.jsx)(`h2`,{children:`两个竞品,一眼对比`}),(0,M.jsx)(`p`,{children:`结果会随采集进度出现,可以返回历史列表或新建下一组分析。`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{children:`推广投入`}),(0,M.jsx)(`span`,{children:`购买人群`}),(0,M.jsx)(`span`,{children:`投放策略`}),(0,M.jsx)(`span`,{children:`流量渠道`})]})]})]})]})}export{K as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._page_1yhky_1{box-sizing:border-box;background:var(--omni-bg,var(--omni-paint-surface-0b1727,#0b1727));min-height:100%;color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7));--ca-line:var(--omni-line,var(--omni-paint-line-294052,#294052));--ca-muted:var(--omni-muted,var(--omni-paint-ink-91a9c0,#91a9c0));--ca-panel:var(--omni-panel,var(--omni-paint-ink-102236,#102236));--ca-accent:var(--omni-accent,var(--omni-paint-ink-28b9bf,#28b9bf));padding:24px;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,sans-serif}._header_1yhky_2{justify-content:space-between;align-items:center;gap:20px;margin-bottom:22px;display:flex}._eyebrow_1yhky_3{letter-spacing:.08em;color:var(--ca-muted);font-size:11px}._header_1yhky_2 h1{letter-spacing:-.02em;margin:6px 0;font-size:24px}._header_1yhky_2 h1 span{color:var(--ca-muted);margin-left:10px;font-size:13px;font-weight:400}._header_1yhky_2 p,._note_1yhky_5,._period_1yhky_5{color:var(--ca-muted);margin:8px 0;font-size:12px;line-height:1.8}._page_1yhky_1 button,._page_1yhky_1 input,._page_1yhky_1 select{font:inherit;border:1px solid var(--ca-line);color:inherit;background:0 0;border-radius:6px;min-height:32px;font-size:12px}._page_1yhky_1 button{cursor:pointer;white-space:nowrap;justify-content:center;align-items:center;gap:6px;padding:6px 11px;display:inline-flex}._page_1yhky_1 button:hover:not(:disabled){border-color:var(--ca-accent);color:var(--ca-accent)}._page_1yhky_1 button:disabled{opacity:.45;cursor:not-allowed}._page_1yhky_1 button:focus-visible,._page_1yhky_1 input:focus-visible,._page_1yhky_1 select:focus-visible,._page_1yhky_1 a:focus-visible{outline:2px solid var(--ca-accent);outline-offset:3px}._page_1yhky_1 input,._page_1yhky_1 select{padding:6px 10px}._page_1yhky_1 select option{background:var(--ca-panel);color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7))}._productSlots_1yhky_9{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;display:grid}._productCard_1yhky_10,._emptySlot_1yhky_10{border:1px solid var(--ca-line);background:var(--ca-panel);border-radius:10px;min-height:156px;padding:17px;position:relative}._slotNumber_1yhky_11,._emptySlot_1yhky_10>span{color:var(--ca-muted);letter-spacing:.08em;font-size:11px}._productCard_1yhky_10 ._remove_1yhky_11{border:0;min-height:24px;padding:4px;position:absolute;top:10px;right:10px}._productInfo_1yhky_12{align-items:center;gap:12px;min-width:0;margin:12px 0;display:flex}._productInfo_1yhky_12>div{min-width:0}._productInfo_1yhky_12>div>strong{-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:13px;line-height:1.55;display:-webkit-box;overflow:hidden}._productInfo_1yhky_12 small{color:var(--ca-muted);margin-top:4px;font-size:11px;display:block}._productInfo_1yhky_12>button{flex:0 0 56px;width:56px;height:56px;padding:0;overflow:hidden}._productInfo_1yhky_12 img{object-fit:cover;width:56px;height:56px}._placeholder_1yhky_12{background:color-mix(in srgb,var(--ca-accent) 9%,transparent);width:56px;height:56px;color:var(--ca-muted);border-radius:7px;flex-shrink:0;place-items:center;display:grid}._cardLinks_1yhky_13{align-items:center;gap:10px;display:flex}._cardLinks_1yhky_13 a{color:var(--ca-accent);align-items:center;gap:4px;font-size:11px;text-decoration:none;display:inline-flex}._emptySlot_1yhky_10{color:var(--ca-muted);background:0 0;border-style:dashed;flex-direction:column;justify-content:center;align-items:center;gap:8px;display:flex}._emptySlot_1yhky_10>span{position:absolute;top:17px;left:17px}._emptySlot_1yhky_10 p{margin:0;font-size:12px}._addForm_1yhky_14{align-items:center;gap:10px;margin:16px 0 22px;display:flex}._addForm_1yhky_14 label{white-space:nowrap;color:var(--ca-muted);margin:0;font-size:12px}._addForm_1yhky_14 input{flex:1;min-width:120px;margin:0}._addForm_1yhky_14 input,._addForm_1yhky_14 button{box-sizing:border-box;height:36px;min-height:36px}._controls_1yhky_14{border-top:1px solid var(--ca-line);flex-wrap:wrap;align-items:flex-end;gap:12px;padding-top:18px;display:flex}._controls_1yhky_14 label{color:var(--ca-muted);flex-direction:column;gap:6px;margin:0;font-size:11px;font-weight:500;line-height:16px;display:flex}._controls_1yhky_14 input,._controls_1yhky_14 select,._controls_1yhky_14 button{box-sizing:border-box;height:36px;min-height:36px;margin:0;line-height:18px}._controls_1yhky_14 input,._controls_1yhky_14 select{width:auto}._controls_1yhky_14 ._primary_1yhky_14{background:var(--ca-accent);border-color:var(--ca-accent);color:var(--omni-accent-text,var(--omni-paint-ink-06292d,#06292d));padding:0 18px;font-weight:650}._controls_1yhky_14 ._primary_1yhky_14:hover:not(:disabled){color:var(--omni-accent-text,var(--omni-paint-ink-06292d,#06292d));filter:brightness(1.08)}._connection_1yhky_15{flex-wrap:wrap;align-items:center;gap:16px;margin-top:14px;font-size:12px;display:flex}._connection_1yhky_15>span{color:var(--ca-accent);align-items:center;gap:5px;display:flex}._period_1yhky_5{font-size:11px}._alert_1yhky_16{border:1px solid var(--omni-paint-line-b98542,#b98542);background:var(--omni-paint-surface-b9854214,#b9854214);color:var(--omni-text,var(--omni-paint-ink-e4c9a6,#e4c9a6));border-radius:6px;margin:12px 0;padding:12px 14px;font-size:12px;line-height:1.7}._progress_1yhky_17{border:1px solid var(--ca-line);border-radius:8px;margin:16px 0;padding:12px 16px;font-size:12px}._progress_1yhky_17>div{justify-content:space-between;gap:12px;display:flex}._progress_1yhky_17 span{color:var(--ca-muted)}._progress_1yhky_17 progress{width:100%;height:5px;accent-color:var(--ca-accent);margin-top:10px}._progress_1yhky_17 p{margin-bottom:0;line-height:1.7}._results_1yhky_18{border:1px solid var(--ca-line);border-radius:10px;margin-top:20px;overflow:hidden}._results_1yhky_18 nav{border-bottom:1px solid var(--ca-line);background:var(--ca-panel);gap:6px;padding:10px 14px;display:flex;overflow-x:auto}._results_1yhky_18 nav button{border:0}._results_1yhky_18 nav button[aria-pressed=true],._dimensionTabs_1yhky_18 button[aria-pressed=true]{color:var(--ca-accent);background:color-mix(in srgb,var(--ca-accent) 12%,transparent)}._resultBody_1yhky_18{padding:18px}._page_1yhky_1 h3{margin:18px 0 12px;font-size:13px}._tableWrap_1yhky_18{overflow-x:auto}._comparisonTable_1yhky_18{table-layout:fixed;border-collapse:collapse;width:100%;min-width:540px;font-size:12px}._comparisonTable_1yhky_18 th,._comparisonTable_1yhky_18 td{border-bottom:1px solid var(--ca-line);text-align:left;vertical-align:middle;width:50%;padding:14px 18px}._comparisonTable_1yhky_18 th+th,._comparisonTable_1yhky_18 td+td{border-left:1px solid var(--ca-line)}._comparisonTable_1yhky_18 thead th{background:var(--ca-panel)}._comparisonTable_1yhky_18 thead small{color:var(--ca-accent);margin-bottom:7px;font-size:10px;font-weight:500;display:block}._comparisonTable_1yhky_18 thead strong{white-space:nowrap;text-overflow:ellipsis;font-size:12px;font-weight:600;display:block;overflow:hidden}._metricRow_1yhky_18{justify-content:space-between;align-items:center;gap:16px;min-height:20px;display:flex}._metricRow_1yhky_18>span:first-child{color:var(--ca-muted)}._metricRow_1yhky_18>span:last-child{text-align:right;font-variant-numeric:tabular-nums}._metricRow_1yhky_18 small{opacity:.75;margin-left:5px;font-size:10px;display:inline-block}._groupRow_1yhky_18{background:color-mix(in srgb,var(--ca-accent) 5%,transparent)}._groupRow_1yhky_18 strong{font-weight:600;line-height:1.6}._range_1yhky_18{color:var(--ca-accent)}._missing_1yhky_18{color:var(--ca-muted)}._dimensionTabs_1yhky_18{gap:8px;margin-bottom:16px;display:flex}._notes_1yhky_18{border-top:1px solid var(--ca-line);color:var(--ca-muted);padding:14px 18px;font-size:12px}._notes_1yhky_18 summary{cursor:pointer}._notes_1yhky_18 strong{margin-top:14px;display:block}._notes_1yhky_18 p{margin:6px 0}._emptyResult_1yhky_19{text-align:center;background:linear-gradient(120deg,color-mix(in srgb,var(--ca-accent) 6%,transparent),transparent);color:var(--ca-muted);border-radius:10px;margin:30px 0;padding:32px 20px}._emptyResult_1yhky_19 h2{color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7));font-size:17px;font-weight:500}._emptyResult_1yhky_19 p{font-size:12px}._emptyResult_1yhky_19>div{justify-content:center;gap:24px;margin-top:24px;font-size:11px;display:flex}._audienceToolbar_1yhky_21{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;margin:0 0 12px;display:flex}._audienceBehaviors_1yhky_22{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._audienceBehaviors_1yhky_22>span{margin-right:5px;font-size:12px}._audienceBehaviors_1yhky_22 small{color:var(--ca-muted);margin-left:4px;font-size:10px}._audienceBehaviors_1yhky_22 button{min-width:72px}._audienceBehaviors_1yhky_22 button[aria-pressed=true]{background:var(--ca-panel);border-color:var(--ca-accent)}._audienceBehaviors_1yhky_22 button[aria-pressed=false]{color:var(--ca-muted)}._audienceBehaviors_1yhky_22 i,._audienceLegend_1yhky_22 i,._audienceTooltip_1yhky_22 i{border-radius:2px;flex:none;width:9px;height:9px;display:inline-block}._audienceMetrics_1yhky_23{border:1px solid var(--ca-line);border-radius:8px;gap:3px;padding:3px;display:flex}._audienceMetrics_1yhky_23 button{min-height:28px;color:var(--ca-muted);border:0;padding:5px 12px}._audienceMetrics_1yhky_23 button[aria-pressed=true]{background:var(--ca-panel);color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7));box-shadow:0 1px 4px var(--omni-paint-shadow-0002,#0002);font-weight:600}._costColumns_1yhky_24,._audienceColumns_1yhky_24{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;min-width:800px;display:grid}._costColumn_1yhky_24,._audienceColumn_1yhky_24{border:1px solid var(--ca-line);border-radius:9px;min-width:0;overflow:hidden}._costProduct_1yhky_24,._audienceProduct_1yhky_24{background:var(--ca-panel);border-bottom:1px solid var(--ca-line);margin:0;padding:15px 18px;display:block}._costProduct_1yhky_24 small,._audienceProduct_1yhky_24 small{color:var(--ca-accent);margin-bottom:8px;font-size:11px;display:block}._costProduct_1yhky_24 strong,._audienceProduct_1yhky_24 strong{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;height:40px;font-size:12px;font-weight:600;line-height:20px;display:-webkit-box;overflow:hidden}._audienceLegend_1yhky_22{justify-content:center;align-items:center;gap:14px;min-height:18px;padding:16px 10px 0;font-size:11px;display:flex}._audienceLegend_1yhky_22 span{align-items:center;gap:5px;display:flex}._audienceChart_1yhky_25{height:300px;padding:4px 6px 0}._audienceChartEmpty_1yhky_25{height:304px;color:var(--ca-muted);place-items:center;font-size:12px;display:grid}._audienceEmpty_1yhky_25{color:var(--ca-muted);text-align:center;border:1px dashed var(--ca-line);border-radius:8px;padding:45px 12px;font-size:12px}._audienceMissing_1yhky_25{color:var(--ca-muted);margin:8px 0;padding:0 14px;font-size:11px}._audienceTooltip_1yhky_22{border:1px solid var(--ca-line);background:var(--omni-bg,var(--omni-paint-surface-0b1727,#0b1727));color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7));box-shadow:0 5px 20px var(--omni-paint-shadow-0003,#0003);border-radius:8px;padding:12px;font-size:11px}._audienceTooltip_1yhky_22 strong{margin-bottom:8px;display:block}._audienceTooltip_1yhky_22 p{align-items:center;gap:6px;margin:5px 0;display:flex}._audienceTooltip_1yhky_22 p>span{font-variant-numeric:tabular-nums;margin-left:12px}._audienceValues_1yhky_27{border-top:1px solid var(--ca-line);color:var(--ca-muted);padding:12px 14px;font-size:11px}._audienceValues_1yhky_27 summary{cursor:pointer}._audienceValues_1yhky_27 table{border-collapse:collapse;width:100%;margin:10px 0 0}._audienceValues_1yhky_27 caption{text-align:left;padding:5px 0}._audienceValues_1yhky_27 th,._audienceValues_1yhky_27 td{text-align:right;border-bottom:1px solid var(--ca-line);font-variant-numeric:tabular-nums;padding:8px 5px;font-weight:400}._audienceValues_1yhky_27 th:first-child{text-align:left}._audienceValues_1yhky_27 td{color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7))}@media (width<=1050px){._page_1yhky_1{padding:16px}._productSlots_1yhky_9{gap:8px}._productCard_1yhky_10,._emptySlot_1yhky_10{padding:12px}._productInfo_1yhky_12{gap:8px}._header_1yhky_2{align-items:flex-start}._page_1yhky_1 th,._page_1yhky_1 td{padding:10px}}._costColumns_1yhky_24{margin:12px 0 20px}._costProduct_1yhky_24 small{align-items:center;gap:6px;display:flex}._costProduct_1yhky_24 i{border-radius:2px;width:9px;height:9px}._costChart_1yhky_30{height:280px;padding:12px 8px 0}._costChartEmpty_1yhky_30{height:292px;color:var(--ca-muted);place-items:center;font-size:12px;display:grid}._costCoverage_1yhky_30{border-top:1px solid var(--ca-line);color:var(--ca-muted);margin:0;padding:10px 16px;font-size:11px;line-height:1.7}._costTooltip_1yhky_30{border:1px solid var(--ca-line);background:var(--omni-bg,var(--omni-paint-surface-0b1727,#0b1727));color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7));box-shadow:0 5px 20px var(--omni-paint-shadow-0003,#0003);border-radius:8px;padding:12px;font-size:12px}._costTooltip_1yhky_30 p{color:var(--ca-muted);margin:6px 0}._costTooltip_1yhky_30 b{font-variant-numeric:tabular-nums}._channelTable_1yhky_32{min-width:1000px}._channelTable_1yhky_32 tbody td{vertical-align:top;padding:14px}._channelTable_1yhky_32 tbody tr:nth-child(odd){background:color-mix(in srgb,var(--ca-panel) 45%,transparent)}._channelHeading_1yhky_32{justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:14px;line-height:1.5;display:flex}._channelHeading_1yhky_32 strong{overflow-wrap:anywhere;min-width:0;font-weight:600}._channelHeading_1yhky_32>span{color:var(--ca-muted);flex-shrink:0;font-size:10px}._channelMetrics_1yhky_32{grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:0;display:grid}._channelMetrics_1yhky_32>div{min-width:0}._channelMetrics_1yhky_32 dt{color:var(--ca-muted);white-space:nowrap;margin:0 0 6px;font-size:11px;line-height:1.5}._channelMetrics_1yhky_32 dd{font-variant-numeric:tabular-nums;overflow-wrap:anywhere;margin:0;font-size:12px;line-height:1.6}._channelMetrics_1yhky_32 small{opacity:.75;font-size:10px;display:block}._channelTable_1yhky_32 ._channelEmpty_1yhky_32{text-align:center;color:var(--ca-muted);padding:28px}._tableWrap_1yhky_18:focus-visible{outline:2px solid var(--ca-accent);outline-offset:-2px}._page_1yhky_1 ._channelToggle_1yhky_34{white-space:normal;text-align:left;border:0;justify-content:flex-start;min-height:20px;padding:0;font-weight:600}._channelToggle_1yhky_34 small{color:var(--ca-muted);white-space:nowrap;font-size:10px;font-weight:400}._channelChild_1yhky_34{color:var(--ca-muted);padding-left:16px}._headerActions_1yhky_36{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}._historyList_1yhky_36{gap:14px;margin:18px 0;display:grid}._historyCard_1yhky_36{border:1px solid var(--ca-line);background:var(--ca-panel);border-radius:10px;padding:18px}._historyHeading_1yhky_36,._historyFooter_1yhky_36{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;font-size:12px;display:flex}._historyHeading_1yhky_36 strong{color:var(--ca-accent)}._historyHeading_1yhky_36 time,._historyFooter_1yhky_36>span{color:var(--ca-muted)}._historyProducts_1yhky_36{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;margin:16px 0;display:grid}._historyProducts_1yhky_36>div{gap:5px;min-width:0;display:grid}._historyProducts_1yhky_36 strong{overflow-wrap:anywhere;font-size:13px;line-height:1.6}._historyProducts_1yhky_36 small{color:var(--ca-muted);font-size:11px}._page_1yhky_1 button._emptySlot_1yhky_10{border:1px dashed var(--ca-line);white-space:normal;border-radius:10px;min-height:156px;padding:17px;position:relative}._addDialog_1yhky_38{box-sizing:border-box;background:var(--omni-bg,var(--omni-paint-surface-0b1727,#0b1727));width:min(620px,100vw - 48px);max-height:80vh;color:var(--omni-text,var(--omni-paint-ink-dceaf7,#dceaf7));border:1px solid var(--ca-line);box-shadow:0 20px 80px var(--omni-paint-shadow-0006,#0006);border-radius:12px;margin:auto;padding:24px;overflow:auto}._addDialog_1yhky_38::backdrop{background:var(--omni-paint-overlay-0008,#0008)}._dialogHeading_1yhky_38{justify-content:space-between;align-items:center;gap:16px;display:flex}._dialogHeading_1yhky_38 h2{margin:0;font-size:18px}._sourceChoices_1yhky_38{flex-wrap:wrap;gap:8px;margin:18px 0;display:flex}._sourceChoices_1yhky_38 button[aria-pressed=true]{color:var(--ca-accent);border-color:var(--ca-accent);background:color-mix(in srgb,var(--ca-accent) 10%,transparent)}._pickerForm_1yhky_38{flex-direction:column;gap:10px;display:flex}._pickerForm_1yhky_38 label{color:var(--ca-muted);margin:0;font-size:12px}._pickerForm_1yhky_38 input{min-height:38px;margin:0}._pickerForm_1yhky_38 button{align-self:flex-end}._pickerBrowse_1yhky_38{padding:8px 0;font-size:13px;line-height:1.7}._pickerBrowse_1yhky_38 p{color:var(--ca-muted)}:root[data-omni-theme=light]{--omni-paint-surface-0b1727:#f5f6fa;--omni-paint-ink-dceaf7:#252831;--omni-paint-line-294052:#dde1eb;--omni-paint-ink-91a9c0:#626e80;--omni-paint-ink-102236:#252831;--omni-paint-ink-28b9bf:#626e80;--omni-paint-ink-06292d:#252831;--omni-paint-line-b98542:#dde1eb;--omni-paint-surface-b9854214:#eef0ff14;--omni-paint-ink-e4c9a6:#626e80;--omni-paint-shadow-0002:#00000009;--omni-paint-shadow-0003:#0000000d;--omni-paint-shadow-0006:#0000001a;--omni-paint-overlay-0008:#020a1580}:root[data-omni-theme=dark]{--omni-paint-surface-0b1727:#0b1727;--omni-paint-ink-dceaf7:#dceaf7;--omni-paint-line-294052:#2c435b;--omni-paint-ink-91a9c0:#91a9bd;--omni-paint-ink-102236:#dceaf7;--omni-paint-ink-28b9bf:#91a9bd;--omni-paint-ink-06292d:#dceaf7;--omni-paint-line-b98542:#2c435b;--omni-paint-surface-b9854214:#19395414;--omni-paint-ink-e4c9a6:#91a9bd;--omni-paint-shadow-0002:#00000009;--omni-paint-shadow-0003:#0000000d;--omni-paint-shadow-0006:#0000001a;--omni-paint-overlay-0008:#020a1580}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./layers-CjsT_HGi.js";import{o as t}from"./index-DLSVWUSu.js";var n=t();function r({title:t,children:r,action:i}){return(0,n.jsxs)(`div`,{className:`wb-empty`,children:[(0,n.jsx)(e,{size:30}),(0,n.jsx)(`h3`,{children:t}),(0,n.jsx)(`p`,{children:r}),i]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as e,y as t}from"./index-DLSVWUSu.js";import{Et as n,Ft as r,G as i,H as a,K as o,Lt as s,Mt as c,Nt as l,Pt as u,St as d,U as f,Ut as p,V as m,W as ee,kt as h,zt as g}from"./CartesianChart-CP7p2vlm.js";var _=Math.cos,v=Math.sin,y=Math.sqrt,b=Math.PI;b/2;var x=2*b,S={draw(e,t){let n=y(t/b);e.moveTo(n,0),e.arc(0,0,n,0,x)}},C={draw(e,t){let n=y(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},w=y(1/3),T=w*2,E={draw(e,t){let n=y(t/T),r=n*w;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},D={draw(e,t){let n=y(t),r=-n/2;e.rect(r,r,n,n)}},O=.8908130915292852,k=v(b/10)/v(7*b/10),A=v(x/10)*k,j=-_(x/10)*k,M={draw(e,t){let n=y(t*O),r=A*n,i=j*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=x*t/5,o=_(a),s=v(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},N=y(3),P={draw(e,t){let n=-y(t/(N*3));e.moveTo(0,n*2),e.lineTo(-N*n,-n),e.lineTo(N*n,-n),e.closePath()}},F=-.5,I=y(3)/2,L=1/y(12),te=(L/2+1)*3,ne={draw(e,t){let n=y(t/te),r=n/2,i=n*L,a=r,o=n*L+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(F*r-I*i,I*r+F*i),e.lineTo(F*a-I*o,I*a+F*o),e.lineTo(F*s-I*c,I*s+F*c),e.lineTo(F*r+I*i,F*i-I*r),e.lineTo(F*a+I*o,F*o-I*a),e.lineTo(F*s+I*c,F*c-I*s),e.closePath()}};function re(e,t){let n=null,i=u(a);e=typeof e==`function`?e:r(e||S),t=typeof t==`function`?t:r(t===void 0?64:+t);function a(){let r;if(n||=r=i(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+``||null}return a.type=function(t){return arguments.length?(e=typeof t==`function`?t:r(t),a):e},a.size=function(e){return arguments.length?(t=typeof e==`function`?e:r(+e),a):t},a.context=function(e){return arguments.length?(n=e??null,a):n},a}var R=t(e()),ie=[`type`,`size`,`sizeType`];function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?B(Object(n),!0).forEach(function(t){ae(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ae(e,t,n){return(t=oe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oe(e){var t=se(e,`string`);return typeof t==`symbol`?t:t+``}function se(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ce(e,t){if(e==null)return{};var n,r,i=le(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function le(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var H={symbolCircle:S,symbolCross:C,symbolDiamond:E,symbolSquare:D,symbolStar:M,symbolTriangle:P,symbolWye:ne},ue=Math.PI/180,U=e=>H[`symbol${c(e)}`]||S,de=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*ue;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},fe=(e,t)=>{H[`symbol${c(e)}`]=t},W=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=V(V({},ce(e,ie)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=U(a),t=re().type(e).size(de(n,r,a))();if(t!==null)return t},{className:s,cx:c,cy:l}=i,u=g(i);return h(c)&&h(l)&&h(n)?R.createElement(`path`,z({},u,{className:p(`recharts-symbols`,s),transform:`translate(${c}, ${l})`,d:o()})):null};W.registerSymbol=fe;function pe(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var me,he,ge,_e,ve;function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?G(Object(n),!0).forEach(function(t){ye(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ye(e,t,n){return(t=be(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function be(e){var t=xe(e,`string`);return typeof t==`symbol`?t:t+``}function xe(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(null,arguments)}function J(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Y=(e,t,n,r,i)=>{var a=n-r,o=l(me||=J([`M `,`,`,``]),e,t);return o+=l(he||=J([`L `,`,`,``]),e+n,t),o+=l(ge||=J([`L `,`,`,``]),e+n-a/2,t+i),o+=l(_e||=J([`L `,`,`,``]),e+n-a/2-r,t+i),o+=l(ve||=J([`L `,`,`,` Z`]),e,t),o},Se={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},Ce=e=>{var t=d(e,Se),{x:r,y:a,upperWidth:o,lowerWidth:s,height:c,className:l}=t,{animationEasing:u,animationDuration:m,animationBegin:h,isUpdateAnimationActive:_}=t,v=(0,R.useRef)(null),[y,b]=(0,R.useState)(-1),x=(0,R.useRef)(o),S=(0,R.useRef)(s),C=(0,R.useRef)(c),w=(0,R.useRef)(r),T=(0,R.useRef)(a),E=f(e,`trapezoid-`);if((0,R.useEffect)(()=>{if(v.current&&v.current.getTotalLength)try{var e=v.current.getTotalLength();e&&b(e)}catch{}},[]),r!==+r||a!==+a||o!==+o||s!==+s||c!==+c||o===0&&s===0||c===0)return null;var D=p(`recharts-trapezoid`,l);if(!_)return R.createElement(`g`,null,R.createElement(`path`,q({},g(t),{className:D,d:Y(r,a,o,s,c)})));var O=x.current,k=S.current,A=C.current,j=w.current,M=T.current,N=`0px ${y===-1?1:y}px`,P=`${y}px ${y}px`,F=i([`strokeDasharray`],m,u);return R.createElement(ee,{animationId:E,key:E,canBegin:y>0,duration:m,easing:u,isActive:_,begin:h},e=>{var i=n(O,o,e),l=n(k,s,e),u=n(A,c,e),d=n(j,r,e),f=n(M,a,e);v.current&&(x.current=i,S.current=l,C.current=u,w.current=d,T.current=f);var p=e>0?{transition:F,strokeDasharray:P}:{strokeDasharray:N};return R.createElement(`path`,q({},g(t),{className:D,d:Y(d,f,i,l,u),ref:v,style:K(K({},p),t.style)}))})},we=[`option`,`shapeType`,`activeClassName`,`inActiveClassName`];function Te(e,t){if(e==null)return{};var n,r,i=Ee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Ee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?X(Object(n),!0).forEach(function(t){De(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function De(e,t,n){return(t=Oe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oe(e){var t=ke(e,`string`);return typeof t==`symbol`?t:t+``}function ke(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Q(e,t){return Z(Z({},t),e)}function Ae(e,t){return e===`symbols`}function $(e){var{shapeType:t,elementProps:n}=e;switch(t){case`rectangle`:return R.createElement(a,n);case`trapezoid`:return R.createElement(Ce,n);case`sector`:return R.createElement(m,n);case`symbols`:if(Ae(t,n))return R.createElement(W,n);break;case`curve`:return R.createElement(o,n);default:return null}}function je(e){return(0,R.isValidElement)(e)?e.props:e}function Me(e){var{option:t,shapeType:n,activeClassName:r=`recharts-active-shape`,inActiveClassName:i=`recharts-shape`}=e,a=Te(e,we),o;if((0,R.isValidElement)(t))o=(0,R.cloneElement)(t,Z(Z({},a),je(t)));else if(typeof t==`function`)o=t(a,a.index);else if(pe(t)&&typeof t!=`boolean`){var c=Q(t,a);o=R.createElement($,{shapeType:n,elementProps:c})}else{var l=a;o=R.createElement($,{shapeType:n,elementProps:l})}return a.isActive?R.createElement(s,{className:r},o):R.createElement(s,{className:i},o)}var Ne=[`children`];function Pe(e,t){if(e==null)return{};var n,r,i=Fe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Fe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Ie=(0,R.createContext)({data:[],xAxisId:`xAxis-0`,yAxisId:`yAxis-0`,dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function Le(e){var{children:t}=e,n=Pe(e,Ne);return R.createElement(Ie.Provider,{value:n},t)}export{Me as n,W as r,Le as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,o as t,y as n}from"./index-
|
|
1
|
+
import{g as e,o as t,y as n}from"./index-DLSVWUSu.js";import{t as r}from"./HelpTip-BqRBO41J.js";var i=n(e(),1),a=t();function o(e,t,n){let r=JSON.parse(e);if(!r||r.project_id!==t||r.format!==n)throw Error(`资料不属于当前项目或类型不匹配,请选择对应的资料包。`);return r}function s({data:e,raw:t,onLoad:n,format:s,source:c,question:l,disabled:u=!1,onSourceSelected:d}){let[f,p]=(0,i.useState)(``),[m,h]=(0,i.useState)(``),[g,_]=(0,i.useState)(!1),[v,y]=(0,i.useState)(null),b=(0,i.useRef)(0),x=(0,i.useRef)(!0),S=(0,i.useRef)({raw:t,disabled:u,projectId:e.project.id});S.current={raw:t,disabled:u,projectId:e.project.id},(0,i.useEffect)(()=>(x.current=!0,()=>{x.current=!1,++b.current}),[]);async function C(r,i,a=``){if(u||t&&!window.confirm(`读取新资料会替换当前未保存草稿,是否继续?`))return;let c=t,l=e.project.id,f=++b.current;_(!0),h(``);try{let t=await i();if(o(t,e.project.id,s),!x.current||f!==b.current||S.current.projectId!==l)return;if(S.current.disabled||S.current.raw!==c){h(`读取期间草稿已变化或正在保存,未替换。请稍后重试。`);return}n(t),d?.(a),y({text:t,name:r}),h(`已填入当前草稿。请核对商品、日期和口径后再运行,尚未保存。`)}catch(e){x.current&&f===b.current&&h(e.message)}finally{x.current&&f===b.current&&_(!1)}}return(0,a.jsxs)(`div`,{className:`card`,children:[(0,a.jsxs)(`h3`,{children:[`先选资料,不用从空表开始`,(0,a.jsx)(r,{label:`如何准备资料`,children:`优先复用当前项目归档。读取时核对项目和资料类型;这不代表内容完整,最终仍需按原有规则校验。不会自动选择商品、日期、金额或启用监控。`})]}),(0,a.jsx)(`p`,{children:l}),(0,a.jsxs)(`p`,{className:`muted`,children:[`需要的来源:`,c,`。已有标准 JSON 资料可直接读取;Excel、截图和普通导出文件需先整理为对应资料包,不能直接当作标准资料导入。`]}),(0,a.jsxs)(`details`,{style:{margin:`12px 0`},children:[(0,a.jsx)(`summary`,{children:`只有 Excel、截图或普通导出?按这三步准备`}),(0,a.jsxs)(`ol`,{children:[(0,a.jsx)(`li`,{children:`保留原始文件,写清商品或店铺范围、统计起止日期、指标含义与单位。缺失值留空,不能当作零。`}),(0,a.jsx)(`li`,{children:`在“证据与附件”归档原件,或请助手按本页资料类型整理。这里只读取已整理资料,不会自动解析 Excel、识别截图或调用模型。`}),(0,a.jsx)(`li`,{children:`整理后核对原件行数、日期、金额/人数单位及来源,再从下方读取。读取只填草稿,之后仍需检查和保存。`})]}),(0,a.jsx)(`p`,{children:`给整理人员的要求:保留原文与来源;确认当前项目;不得补造缺失数据;使用本页对应的资料格式。结果必须通过本页的项目和类型校验。`}),(0,a.jsxs)(`details`,{children:[(0,a.jsx)(`summary`,{children:`整理人员需要的格式信息`}),(0,a.jsxs)(`p`,{children:[`资料格式:`,(0,a.jsx)(`code`,{children:s}),`;项目编号:`,(0,a.jsx)(`code`,{children:e.project.id}),`。详细必需字段以本页输入模板或业务校验为准,不能只填写这两个标识。`]})]})]}),(0,a.jsxs)(`label`,{children:[`已有资料在哪里?`,(0,a.jsxs)(`select`,{value:f,disabled:u||g,onChange:e=>p(e.target.value),children:[(0,a.jsx)(`option`,{value:``,children:`请选择本项目归档,不会自动替你选择`}),(e.files||[]).filter(e=>e.name.endsWith(`.json`)).map(e=>(0,a.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,a.jsx)(`button`,{type:`button`,disabled:u||g||!f,onClick:()=>C(e.files.find(e=>e.id===f)?.name||f,async()=>{let t=await fetch(`/api/workbench/`+encodeURIComponent(e.project.id)+`/file/`+encodeURIComponent(f));if(!t.ok)throw Error(`读取失败,原草稿未改变`);return t.text()},f),children:`读取资料到草稿`}),(0,a.jsxs)(`label`,{children:[`或选择已整理的 JSON 文件`,(0,a.jsx)(`input`,{type:`file`,accept:`.json`,disabled:u||g,onChange:e=>{let t=e.target.files?.[0];t&&C(t.name,async()=>{if(t.size>3e5)throw Error(`资料包上限 300KB`);return t.text()}),e.target.value=``}})]}),(0,a.jsx)(`p`,{role:`status`,children:m}),(0,a.jsx)(`p`,{className:`muted`,children:t?v?.text===t?`当前草稿来源:${v?.name};项目与资料类型已匹配,内容完整性待运行校验。`:`当前草稿来自其他入口或已手动修改,请重新核对来源及缺项。`:`待补:先选择资料来源,再核对商品、周期和必需字段。`})]})}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as e,o as t,y as n}from"./index-DLSVWUSu.js";import{t as r}from"./ProgressiveRows-NojOUgmr.js";import{$ as i,A as a,At as o,C as s,D as c,Dt as l,E as u,Et as d,F as f,Ht as p,L as m,Lt as h,M as g,N as _,O as v,Ot as y,P as ee,R as b,S as x,St as S,T as C,Tt as w,U as T,Ut as E,Vt as te,W as D,X as O,a as k,at as A,bt as j,ct as ne,d as M,dt as N,f as re,ft as ie,g as ae,h as oe,ht as P,i as se,it as ce,j as le,jt as ue,k as F,kt as de,l as fe,mt as pe,ot as me,p as he,q as ge,rt as _e,st as ve,t as ye,u as be,ut as xe,v as Se,vt as I,w as Ce,wt as we,x as Te,y as L,yt as R,z as Ee}from"./CartesianChart-CP7p2vlm.js";import{n as De,t as Oe}from"./ErrorBarContext-BJE5-ljg.js";import{n as z,t as B}from"./graphicalItemSelectors-CJfZ6cht.js";import{n as V,r as ke,t as Ae}from"./favorites.module-CHYv-Z8y.js";var H=e=>null;H.displayName=`Cell`;var je=(e,t,n)=>{var r=R();return(i,a)=>o=>{e?.(i,a,o),r(C({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},Me=e=>{var t=R();return(n,r)=>i=>{e?.(n,r,i),t(s())}},Ne=(e,t,n)=>{var r=R();return(i,a)=>o=>{e?.(i,a,o),r(Ce({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},Pe=(e,t,n)=>{var r=n??e;if(!y(r))return w(r,t,0)},Fe=(e,t,n)=>{var r={},i=e.filter(le),a=e.filter(e=>e.stackId==null),o=i.reduce((e,t)=>{var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},r),s=Object.entries(o).map(e=>{var[r,i]=e;return{stackId:r,dataKeys:i.map(e=>e.dataKey),barSize:Pe(t,n,i[0]?.barSize)}}),c=a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>e!=null),barSize:Pe(t,n,e.barSize)}));return[...s,...c]};function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ie(Object(n),!0).forEach(function(t){Le(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Le(e,t,n){return(t=Re(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e){var t=ze(e,`string`);return typeof t==`symbol`?t:t+``}function ze(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Be(e,t,n,r,i){var a=r.length;if(!(a<1)){var o=w(e,n,0,!0),s,c=[];if(P(r[0]?.barSize)){var l=!1,u=n/a,d=r.reduce((e,t)=>e+(t.barSize||0),0);d+=(a-1)*o,d>=n&&(d-=(a-1)*o,o=0),d>=n&&u>0&&(l=!0,u*=.9,d=a*u);var f={offset:((n-d)/2>>0)-o,size:0};s=r.reduce((e,t)=>{var n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f.offset+f.size+o,size:l?u:t.barSize??0}},r=[...e,n];return f=n.position,r},c)}else{var p=w(t,n,0,!0);n-2*p-(a-1)*o<=0&&(o=0);var m=(n-2*p-(a-1)*o)/a;m>1&&(m>>=0);var h=P(i)?Math.min(m,i):m;s=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+(m+o)*n+(m-h)/2,size:h}}],c)}return s}}var Ve=(e,t,n,r,i,a,o)=>{var s=y(o)?t:o,c=Be(n,r,i===a?a:i,e,s);return i!==a&&c!=null&&(c=c.map(e=>U(U({},e),{},{position:U(U({},e.position),{},{offset:e.position.offset-i/2})}))),c},He=(e,t)=>{var n=g(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:a}=i;if(a)return a.find(e=>e.key===n)}}}},Ue=(e,t)=>{if(!(e==null||t==null)){var n=e.find(e=>e.stackId===t.stackId&&t.dataKey!=null&&e.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function We(e,t){return e&&typeof e==`object`&&`zIndex`in e&&typeof e.zIndex==`number`&&P(e.zIndex)?e.zIndex:t}var Ge=!0,W=`Invariant failed`;function Ke(e,t){if(!e){if(Ge)throw Error(W);var n=typeof t==`function`?t():t,r=n?`${W}: ${n}`:W;throw Error(r)}}var G=n(e());function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},K.apply(null,arguments)}function q(e){return G.createElement(De,K({shapeType:`rectangle`,activeClassName:`recharts-active-bar`,inActiveClassName:`recharts-inactive-bar`},e))}var qe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(de(e))return e;var i=de(n)||y(n);return i?e(n,r):(!i&&Ke(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},Je=(e,t,n)=>n,J=I([a,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),Ye=I([J],e=>e?.maxBarSize),Xe=(e,t,n,r)=>r,Ze=I([O,a,B,z,Je],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),Qe=(e,t,n)=>{var r=O(e),i=B(e,t),a=z(e,t);if(!(i==null||a==null))return r===`horizontal`?v(e,`yAxis`,a,n):v(e,`xAxis`,i,n)},$e=I([Ze,m,(e,t)=>{var n=O(e),r=B(e,t),i=z(e,t);if(!(r==null||i==null))return n===`horizontal`?c(e,`xAxis`,r):c(e,`yAxis`,i)}],Fe),et=(e,t,n)=>{var r=J(e,t);if(r==null)return 0;var i=B(e,t),a=z(e,t);if(i==null||a==null)return 0;var o=O(e),s=b(e),{maxBarSize:c}=r,l=y(c)?s:c,d,f;return o===`horizontal`?(d=u(e,`xAxis`,i,n),f=F(e,`xAxis`,i,n)):(d=u(e,`yAxis`,a,n),f=F(e,`yAxis`,a,n)),me(d,f,!0)??l??0},tt=(e,t,n)=>{var r=O(e),i=B(e,t),a=z(e,t);if(!(i==null||a==null)){var o,s;return r===`horizontal`?(o=u(e,`xAxis`,i,n),s=F(e,`xAxis`,i,n)):(o=u(e,`yAxis`,a,n),s=F(e,`yAxis`,a,n)),me(o,s)}},nt=I([A,ce,(e,t,n)=>{var r=B(e,t);if(r!=null)return u(e,`xAxis`,r,n)},(e,t,n)=>{var r=z(e,t);if(r!=null)return u(e,`yAxis`,r,n)},(e,t,n)=>{var r=B(e,t);if(r!=null)return F(e,`xAxis`,r,n)},(e,t,n)=>{var r=z(e,t);if(r!=null)return F(e,`yAxis`,r,n)},I([I([$e,b,f,ee,et,tt,Ye],Ve),J],Ue),O,Ee,tt,I([Qe,J],He),J,Xe],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var{chartData:p,dataStartIndex:m,dataEndIndex:h}=c;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var{data:g}=d,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return Pt({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),rt=[`index`];function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y.apply(null,arguments)}function it(e,t){if(e==null)return{};var n,r,i=at(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function at(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ot=(0,G.createContext)(void 0),st=e=>{var t=(0,G.useContext)(ot);if(t!=null)return t.stackId;if(e!=null)return xe(e)},ct=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,lt=e=>{var t=(0,G.useContext)(ot);if(t!=null){var{stackId:n}=t;return`url(#${ct(n,e)})`}},ut=e=>{var{index:t}=e,n=it(e,rt),r=lt(t);return G.createElement(h,Y({className:`recharts-bar-stack-layer`,clipPath:r},n))},dt=[`onMouseEnter`,`onMouseLeave`,`onClick`],ft=[`value`,`background`,`tooltipPosition`],pt=[`id`],mt=[`onMouseEnter`,`onClick`,`onMouseLeave`];function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(null,arguments)}function ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ht(Object(n),!0).forEach(function(t){gt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gt(e,t,n){return(t=_t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _t(e){var t=vt(e,`string`);return typeof t==`symbol`?t:t+``}function vt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Q(e,t){if(e==null)return{};var n,r,i=yt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function yt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var bt=e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:N(n,t),payload:e}]},xt=G.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:a,hide:o,unit:s,tooltipType:c,id:l}=e,u={dataDefinedOnItem:void 0,getPosition:ue,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:N(a,t),hide:o,type:c,color:i,unit:s,graphicalItemId:l}};return G.createElement(re,{tooltipEntrySettings:u})});function St(e){var t=j(x),{data:n,dataKey:r,background:i,allOtherBarProps:a}=e,{onMouseEnter:o,onMouseLeave:s,onClick:c}=a,l=Q(a,dt),u=je(o,r,a.id),d=Me(s),f=Ne(c,r,a.id);if(!i||n==null)return null;var m=p(i);return G.createElement(L,{zIndex:We(i,_.barBackground)},n.map((e,n)=>{var{value:a,background:o,tooltipPosition:s}=e,c=Q(e,ft);if(!o)return null;var p=u(e,n),h=d(e,n),g=f(e,n),_=Z(Z(Z(Z(Z({option:i,isActive:String(n)===t},c),{},{fill:`#eee`},o),m),we(l,e,n)),{},{onMouseEnter:p,onMouseLeave:h,onClick:g,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return G.createElement(q,X({key:`background-bar-${n}`},_))}))}function Ct(e){var{showLabels:t,children:n,rects:r}=e,i=r?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return G.createElement(oe,{value:t?i:void 0},n)}function wt(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:a,dataKey:o}=e,s=j(x),c=j(Te),l=n&&String(i.originalDataIndex)===s&&(c==null||o===c),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1);(0,G.useEffect)(()=>{var e;return l?(d(!0),e=requestAnimationFrame(()=>{p(!0)})):p(!1),()=>{cancelAnimationFrame(e)}},[l]);var m=(0,G.useCallback)(()=>{l||d(!1)},[l]),h=l&&f,g=l||u,v=l?n===!0?t:n:t,y=G.createElement(q,X({},r,{name:String(r.name)},i,{isActive:h,option:v,index:a,dataKey:o,onTransitionEnd:m}));return g?G.createElement(L,{zIndex:_.activeBar},G.createElement(ut,{index:i.originalDataIndex},y)):y}function Tt(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:a}=e;return G.createElement(q,X({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a}))}function Et(e){var{data:t,props:n}=e,r=te(n)??{},{id:i}=r,a=Q(r,pt),{shape:o,dataKey:s,activeBar:c}=n,{onMouseEnter:l,onClick:u,onMouseLeave:d}=n,f=Q(n,mt),p=je(l,s,i),m=Me(d),h=Ne(u,s,i);return t?G.createElement(G.Fragment,null,t.map((e,t)=>G.createElement(ut,X({index:e.originalDataIndex,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},we(f,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:h(e,t)}),c?G.createElement(wt,{shape:o,activeBar:c,baseProps:a,entry:e,index:t,dataKey:s}):G.createElement(Tt,{shape:o,baseProps:a,entry:e,index:t,dataKey:s})))):null}function Dt(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,onAnimationEnd:l,onAnimationStart:u}=t,f=n.current,p=T(t,`recharts-bar-`),[m,g]=(0,G.useState)(!1),_=!m,v=(0,G.useCallback)(()=>{typeof l==`function`&&l(),g(!1)},[l]),y=(0,G.useCallback)(()=>{typeof u==`function`&&u(),g(!0)},[u]);return G.createElement(Ct,{showLabels:_,rects:r},G.createElement(D,{animationId:p,begin:o,duration:s,isActive:a,easing:c,onAnimationEnd:v,onAnimationStart:y,key:p},e=>{var a=e===1?r:r?.map((t,n)=>{var r=f&&f[n];if(r)return Z(Z({},t),{},{x:d(r.x,t.x,e),y:d(r.y,t.y,e),width:d(r.width,t.width,e),height:d(r.height,t.height,e)});if(i===`horizontal`){var a=d(0,t.height,e),o=d(t.stackedBarStart,t.y,e);return Z(Z({},t),{},{y:o,height:a})}var s=d(0,t.width,e),c=d(t.stackedBarStart,t.x,e);return Z(Z({},t),{},{width:s,x:c})});return e>0&&(n.current=a??null),a==null?null:G.createElement(h,null,G.createElement(Et,{props:t,data:a}))}),G.createElement(ae,{label:t.label}),t.children)}function Ot(e){var t=(0,G.useRef)(null);return G.createElement(Dt,{previousRectanglesRef:t,props:e})}var kt=0,At=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:ie(e,t)}},jt=class extends G.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:i,yAxisId:a,needClip:o,background:s,id:c}=this.props;if(e||t==null)return null;var l=E(`recharts-bar`,r),u=c;return G.createElement(h,{className:l,id:c},o&&G.createElement(`defs`,null,G.createElement(se,{clipPathId:u,xAxisId:i,yAxisId:a})),G.createElement(h,{className:`recharts-bar-rectangles`,clipPath:o?`url(#clipPath-${u})`:void 0},G.createElement(St,{data:t,dataKey:n,background:s,allOtherBarProps:this.props}),G.createElement(Ot,this.props)))}},Mt={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:kt,xAxisId:0,yAxisId:0,zIndex:_.bar};function Nt(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:a,minPointSize:o,activeBar:s,animationBegin:c,animationDuration:l,animationEasing:u,isAnimationActive:d}=e,{needClip:f}=k(t,n),p=i(),m=_e(),h=he(e.children,H),g=j(t=>nt(t,e.id,m,h));if(p!==`vertical`&&p!==`horizontal`)return null;var _,v=g?.[0];return _=v==null||v.height==null||v.width==null?0:p===`vertical`?v.height/2:v.width/2,G.createElement(Oe,{xAxisId:t,yAxisId:n,data:g,dataPointFormatter:At,errorBarOffset:_},G.createElement(jt,X({},e,{layout:p,needClip:f,data:g,xAxisId:t,yAxisId:n,hide:r,legendType:a,minPointSize:o,activeBar:s,animationBegin:c,animationDuration:l,animationEasing:u,isAnimationActive:d})))}function Pt(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:i},pos:a,bandSize:s,xAxis:c,yAxis:u,xAxisTicks:d,yAxisTicks:f,stackedData:p,displayedData:m,offset:h,cells:g,parentViewBox:_,dataStartIndex:v}=e,y=t===`horizontal`?u:c,ee=p?y.scale.domain():null,b=ve({numericAxis:y}),x=y.scale.map(b);return m.map((e,m)=>{var y,S,C,w,T,E;if(p){var te=p[m+v];if(te==null)return null;y=pe(te,ee)}else y=ie(e,n),Array.isArray(y)||(y=[b,y]);var D=qe(r,kt)(y[1],m);if(t===`horizontal`){var O=u.scale.map(y[0]),k=u.scale.map(y[1]);if(O==null||k==null)return null;S=ne({axis:c,ticks:d,bandSize:s,offset:a.offset,entry:e,index:m}),C=k??O??void 0,w=a.size;var A=O-k;if(T=l(A)?0:A,E={x:S,y:h.top,width:w,height:h.height},Math.abs(D)>0&&Math.abs(T)<Math.abs(D)){var j=o(T||D)*(Math.abs(D)-Math.abs(T));C-=j,T+=j}}else{var M=c.scale.map(y[0]),N=c.scale.map(y[1]);if(M==null||N==null)return null;if(S=M,C=ne({axis:u,ticks:f,bandSize:s,offset:a.offset,entry:e,index:m}),w=N-M,T=a.size,E={x:h.left,y:C,width:h.width,height:T},Math.abs(D)>0&&Math.abs(w)<Math.abs(D)){var re=o(w||D)*(Math.abs(D)-Math.abs(w));w+=re}}return S==null||C==null||w==null||T==null||!i&&(w===0||T===0)?null:Z(Z({},e),{},{stackedBarStart:x,x:S,y:C,width:w,height:T,value:p?y:y[1],payload:e,background:E,tooltipPosition:{x:S+w/2,y:C+T/2},parentViewBox:_,originalDataIndex:m},g&&g[m]&&g[m].props)}).filter(Boolean)}function Ft(e){var t=S(e,Mt),n=st(t.stackId),r=_e();return G.createElement(be,{id:t.id,type:`bar`},e=>G.createElement(G.Fragment,null,G.createElement(M,{legendPayload:bt(t)}),G.createElement(xt,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),G.createElement(fe,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null}),G.createElement(L,{zIndex:t.zIndex},G.createElement(Nt,X({},t,{id:e})))))}var It=G.memo(Ft,ge);It.displayName=`Bar`;var Lt=[`axis`,`item`],Rt=(0,G.forwardRef)((e,t)=>G.createElement(ye,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Lt,tooltipPayloadSearcher:Se,categoricalChartProps:e,ref:t})),$=t();function zt({kind:e,selectedIds:t=[],onSelect:n}){let i=ke(e);return(0,$.jsxs)(`div`,{className:Ae.picker,children:[i.loading&&(0,$.jsxs)(`p`,{role:`status`,children:[`正在读取收藏`,V[e],`…`]}),i.error&&(0,$.jsxs)(`p`,{role:`alert`,children:[i.error,(0,$.jsx)(`button`,{onClick:i.refresh,children:`重试`})]}),!i.loading&&!i.error&&!i.items.length&&(0,$.jsxs)(`p`,{children:[`暂无收藏`,V[e],`,可先在排行榜或“我的收藏”中添加。`]}),(0,$.jsx)(r,{items:i.items,resetKey:e,onVisibleCount:i.onVisibleCount,children:r=>{let a=i.resolve(r.key),o=a.category?.id||a.record?.id,s=!!o&&t.includes(o);return(0,$.jsxs)(`button`,{className:Ae.pickRow,disabled:!o||s,onClick:()=>n(a),children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`b`,{children:a.category?.name||a.record?.name||`收藏资料待更新`}),(0,$.jsx)(`small`,{children:a.category?a.categoryPath||a.category.name:o?`${V[e]} ID:${o}`:`资料尚未就绪`})]}),(0,$.jsx)(`span`,{children:s?`已选择`:`选择`})]},r.key)}})]})}export{H as i,Rt as n,It as r,zt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./competitor-analysis-D6eM9ugQ.js";import{g as n,o as r,y as i}from"./index-DLSVWUSu.js";import{t as a}from"./ProgressiveRows-NojOUgmr.js";import{a as o,r as s,s as c,t as l}from"./components-B5Xyjfpi.js";import{t as u}from"./api-KZa8CR8X.js";import{i as d}from"./format-DL7i7_eV.js";import{n as f,r as p,t as m}from"./favorites.module-CHYv-Z8y.js";var h=i(n(),1),g=r();function _({record:e,kind:n}){let r=d(e?.imageUrl),i=d(e?.url),a=n===`shop`?`店铺`:`商品`;return(0,g.jsxs)(`div`,{className:m.recordInfo,children:[n===`product`&&(0,g.jsx)(`div`,{className:m.thumbnail,children:r?(0,g.jsx)(o,{src:r,name:e?.name||`收藏商品`}):(0,g.jsx)(`span`,{children:(0,g.jsx)(t,{size:25})})}),(0,g.jsxs)(`div`,{className:m.recordText,children:[(0,g.jsx)(`b`,{children:e?.name||`收藏资料待更新`}),(0,g.jsxs)(`div`,{className:m.metadata,children:[(0,g.jsxs)(`span`,{children:[a,` ID:`,e?.id||`暂缺`]}),e?.id&&(0,g.jsx)(s,{text:e.id,label:`复制`+a+`ID`,title:`复制`+a+` ID`})]}),(0,g.jsx)(`div`,{className:m.metadata,children:i?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,children:[a,`链接`]}),(0,g.jsx)(s,{text:i,label:`复制`+a+`链接`,title:`复制`+a+`链接`})]}):(0,g.jsxs)(`span`,{children:[a,`链接暂缺`]})}),n===`product`&&e?.imageMonth&&(0,g.jsxs)(`small`,{children:[`图片来源:`,e.imageMonth,` 榜单`]})]})]})}function v({boot:e,initialKind:t,busy:n,onSave:r}){let[i,o]=(0,h.useState)(t),[s,d]=(0,h.useState)(``),[p,_]=(0,h.useState)(e.latestMonth||e.months.at(-1)||``),[v,y]=(0,h.useState)(``),[b,x]=(0,h.useState)([]),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(``),E=(0,h.useRef)(null);(0,h.useEffect)(()=>()=>E.current?.abort(),[]);function D(){E.current?.abort(),x([]),C(!1),T(``)}let O=t=>e.favorites?.some(e=>e.kind===i&&e.key===t);async function k(e){await r(i,e,!0)&&T(`已添加到我的收藏`)}async function A(){if(i===`category`){await k(s);return}E.current?.abort();let e=new AbortController;E.current=e,C(!0),T(``),x([]);try{let t=await u.query({...c,view:i===`shop`?`shops`:`products`,categoryId:s,month:p,q:v.trim(),pageSize:25},e.signal);e.signal.aborted||(x(t.rows),t.rows.length||T(`该类目与月份暂无匹配记录,可调整名称或筛选条件。`))}catch(t){e.signal.aborted||T(t instanceof Error?t.message:`搜索失败`)}finally{e.signal.aborted||C(!1)}}return(0,g.jsxs)(`section`,{className:m.adder,"aria-label":`直接添加收藏`,children:[(0,g.jsx)(`h2`,{children:`添加收藏`}),(0,g.jsx)(`p`,{children:`选择获准类目;店铺和商品从对应月份的已入库榜单中搜索确认。`}),(0,g.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),A()},children:[(0,g.jsxs)(`label`,{children:[`收藏类型`,(0,g.jsx)(`select`,{"aria-label":`收藏类型`,value:i,onChange:e=>{D(),o(e.target.value)},children:Object.keys(f).map(e=>(0,g.jsx)(`option`,{value:e,children:f[e]},e))})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{children:`类目`}),(0,g.jsx)(l,{categories:e.categories,value:s,onChoose:e=>{D(),d(e)},disabled:!e.categories.length,favoriteIds:(e.favorites||[]).filter(e=>e.kind===`category`).map(e=>e.key)})]}),i!==`category`&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`label`,{children:[`月份`,(0,g.jsx)(`select`,{"aria-label":`收藏搜索月份`,value:p,onChange:e=>{D(),_(e.target.value)},children:e.months.map(e=>(0,g.jsx)(`option`,{children:e},e))})]}),(0,g.jsxs)(`label`,{children:[f[i],`搜索`,(0,g.jsx)(`input`,{"aria-label":`搜索待收藏记录`,value:v,maxLength:100,placeholder:i===`shop`?`输入店铺名称`:`输入商品名称或 ID`,onChange:e=>{D(),y(e.target.value)}})]})]}),(0,g.jsx)(`button`,{type:`submit`,disabled:n||S||!s||(i===`category`?!!O(s):!p||!v.trim()),children:i===`category`?O(s)?`已收藏`:`收藏此类目`:S?`搜索中…`:`搜索`})]}),w&&(0,g.jsx)(`p`,{role:`status`,children:w}),(0,g.jsx)(a,{items:b,children:e=>(0,g.jsxs)(`div`,{className:m.row,children:[(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`b`,{children:e.name||`名称缺失`}),(0,g.jsxs)(`small`,{children:[`ID `,e.id||`缺失`,` · `,p]})]}),(0,g.jsx)(`button`,{disabled:n||!!O(e.key),onClick:()=>void k(e.key),children:O(e.key)?`已收藏`:`收藏`})]},e.key)})]})}function y({kind:e,busy:t,onSave:n,favorites:r}){let[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(``);return(0,h.useEffect)(()=>{let e=new AbortController;return u.bootstrap(e.signal).then(t=>{e.signal.aborted||a(t)}).catch(t=>{e.signal.aborted||s(t instanceof Error?t.message:`添加资料读取失败`)}),()=>e.abort()},[]),o?(0,g.jsx)(`p`,{role:`alert`,children:o}):i?(0,g.jsx)(v,{boot:{...i,favorites:r},initialKind:e,busy:t,onSave:n}):(0,g.jsx)(`p`,{role:`status`,children:`正在加载可添加的类目与月份…`})}function b({competitorIds:t=[],onAddCompetitor:n,onOpenCompetitors:r}){let[i,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(`category`),[l,u]=(0,h.useState)(!1),d=p(s);return(0,g.jsxs)(`div`,{className:m.home,children:[(0,g.jsxs)(`div`,{className:m.top,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{children:`我的收藏`}),(0,g.jsx)(`p`,{children:`管理当前账号的类目、店铺和商品收藏,供查询与分析时选择。`})]}),(0,g.jsxs)(`div`,{className:m.actions,children:[r&&(0,g.jsxs)(`button`,{onClick:r,children:[`竞品分析(`,t.length,`/`,2,`)`]}),(0,g.jsx)(`button`,{"aria-expanded":l,onClick:()=>u(e=>!e),children:l?`收起添加`:`添加收藏`}),(0,g.jsx)(`button`,{onClick:d.refresh,children:`刷新收藏`})]})]}),(0,g.jsx)(`nav`,{className:m.tabs,"aria-label":`收藏分类`,children:Object.keys(f).map(e=>(0,g.jsxs)(`button`,{"aria-pressed":s===e,onClick:()=>c(e),children:[f[e],`(`,d.collection?d.collection.counts[e]:`—`,`)`]},e))}),i&&(0,g.jsx)(`p`,{role:`status`,children:i}),d.error&&(0,g.jsx)(`p`,{role:`alert`,children:d.error}),d.syncError&&(0,g.jsx)(`p`,{role:`status`,children:d.syncError}),d.syncing&&(0,g.jsx)(`p`,{role:`status`,children:`正在后台更新收藏资料…`}),l&&(0,g.jsx)(y,{kind:s,favorites:d.collection?.entries||[],busy:!!d.busy,onSave:d.save},s),(0,g.jsxs)(`section`,{className:m.panel,"aria-label":f[s]+`收藏列表`,children:[d.loading&&(0,g.jsx)(`p`,{role:`status`,children:`正在读取收藏…`}),!d.loading&&!d.error&&!d.items.length&&(0,g.jsxs)(`p`,{className:m.empty,children:[`暂无收藏`,f[s],`,可直接添加或在排行榜中点击星标收藏。`]}),(0,g.jsx)(a,{items:d.items,resetKey:s,onVisibleCount:d.onVisibleCount,children:r=>{let{category:i,record:a,categoryPath:c}=d.resolve(r.key);return(0,g.jsxs)(`div`,{className:m.row,children:[s===`category`?(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`b`,{children:i?.name||`收藏资料待更新`}),(0,g.jsx)(`small`,{children:c||i?.name})]}):(0,g.jsx)(_,{record:a,kind:s}),(0,g.jsxs)(`div`,{className:m.actions,children:[s===`product`&&n&&(0,g.jsx)(`button`,{disabled:!e(a?.id)||t.includes(a?.id||``)||t.length>=2,onClick:()=>{if(a?.id)try{n({id:a.id,name:a.name||`商品 ${a.id}`,imageUrl:a.imageUrl,shopName:a.shopName}),o(`已加入竞品分析,可继续选择或点击上方竞品分析查看`)}catch(e){o(e instanceof Error?e.message:`添加未完成`)}},children:t.includes(a?.id||``)?`已加入分析`:t.length>=2?`已满 2 个`:`加入竞品分析`}),(0,g.jsx)(`button`,{disabled:!!d.busy,"aria-label":`取消收藏`+(i?.name||a?.name||f[s]),onClick:()=>void d.save(s,r.key,!1),children:`取消收藏`})]})]},r.kind+r.key)}})]})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,h as t,o as n,y as r}from"./index-
|
|
1
|
+
import{g as e,h as t,o as n,y as r}from"./index-DLSVWUSu.js";var i=r(e(),1),a=t(),o={trigger:`_trigger_10do5_1`,bubble:`_bubble_10do5_3`},s=n();function c({label:e,children:t}){let n=(0,i.useId)(),r=(0,i.useRef)(null),c=(0,i.useRef)(null),[l,u]=(0,i.useState)(!1),[d,f]=(0,i.useState)(null),p=(0,i.useRef)(!1),m=(0,i.useRef)(!1),h=(0,i.useRef)(null);function g(){h.current&&clearTimeout(h.current),u(!0)}function _(){h.current=setTimeout(()=>{!m.current&&document.activeElement!==r.current&&v()},160)}(0,i.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]);function v(){h.current&&clearTimeout(h.current),m.current=!1,u(!1),f(null)}return(0,i.useEffect)(()=>{if(!l)return;function e(){let e=r.current?.getBoundingClientRect(),t=c.current?.getBoundingClientRect();if(!e||!t)return;let n=document.documentElement.clientWidth,i=window.innerHeight;f({left:Math.max(8,Math.min(e.left,n-t.width-8)),top:Math.max(8,e.bottom+8+t.height<=i-8?e.bottom+8:e.top-t.height-8)})}function t(e){!r.current?.contains(e.target)&&!c.current?.contains(e.target)&&v()}function n(e){e.key===`Escape`&&v()}return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[l]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`button`,{ref:r,type:`button`,className:o.trigger,"aria-label":e+`:使用说明`,"aria-describedby":l?n:void 0,"aria-expanded":l,onPointerDown:()=>{p.current=l},onClick:e=>{e.stopPropagation();let t=e.detail===0?!m.current:!p.current;m.current=t,u(t)},onFocus:g,onBlur:()=>{m.current||v()},onMouseEnter:g,onMouseLeave:_,children:`?`}),l&&typeof document<`u`&&(0,a.createPortal)((0,s.jsx)(`span`,{ref:c,id:n,role:`tooltip`,className:o.bubble,style:{left:d?.left??8,top:d?.top??8,visibility:d?`visible`:`hidden`},onMouseEnter:g,onMouseLeave:_,children:t}),document.body)]})}export{c as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{g as e,h as t,y as n}from"./index-DLSVWUSu.js";import{$ as r,A as i,B as a,E as o,Et as s,It as c,J as l,Lt as u,N as d,Ot as f,Q as p,Rt as m,St as h,U as g,Ut as _,Vt as v,W as y,X as b,Y as x,_t as S,a as C,bt as w,c as T,d as E,dt as D,et as O,f as k,ft as A,g as ee,gt as te,h as ne,i as re,jt as ie,k as j,l as ae,lt as oe,m as se,ot as M,pt as ce,q as N,rt as P,t as le,tt as ue,u as de,v as fe,vt as F,wt as pe,xt as me,y as he,yt as I,zt as ge}from"./CartesianChart-CP7p2vlm.js";import{n as _e,r as ve,t as ye}from"./ErrorBarContext-BJE5-ljg.js";import{n as be,r as xe,t as Se}from"./getRadiusAndStrokeWidthFromDot-bv_ksZ7y.js";var Ce=t(),L=n(e());function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},R.apply(null,arguments)}function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?z(Object(n),!0).forEach(function(t){we(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function we(e,t,n){return(t=Te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Te(e){var t=Ee(e,`string`);return typeof t==`symbol`?t:t+``}function Ee(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var V=32,De={align:`center`,iconSize:14,inactiveColor:`#ccc`,layout:`horizontal`,verticalAlign:`middle`,labelStyle:{}};function Oe(e){if(typeof e==`object`&&e&&`strokeDasharray`in e)return String(e.strokeDasharray)}function ke(e){var{data:t,iconType:n,inactiveColor:r}=e,i=V/2,a=V/6,o=V/3,s=t.inactive?r:t.color,c=n??t.type;if(c===`none`)return null;if(c===`plainline`)return L.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:s,strokeDasharray:Oe(t.payload),x1:0,y1:i,x2:V,y2:i,className:`recharts-legend-icon`});if(c===`line`)return L.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:s,d:`M0,${i}h${o}
|
|
2
|
+
A${a},${a},0,1,1,${2*o},${i}
|
|
3
|
+
H${V}M${2*o},${i}
|
|
4
|
+
A${a},${a},0,1,1,${o},${i}`,className:`recharts-legend-icon`});if(c===`rect`)return L.createElement(`path`,{stroke:`none`,fill:s,d:`M0,${V/8}h${V}v${V*3/4}h${-V}z`,className:`recharts-legend-icon`});if(L.isValidElement(t.legendIcon)){var l=B({},t);return delete l.legendIcon,L.cloneElement(t.legendIcon,l)}return L.createElement(ve,{fill:s,cx:i,cy:i,size:V,sizeType:`diameter`,type:c})}function Ae(e){var{payload:t,iconSize:n,layout:r,formatter:i,inactiveColor:a,iconType:o,labelStyle:s}=e,c={x:0,y:0,width:V,height:V},l={display:r===`horizontal`?`inline-block`:`block`,marginRight:10},u={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return t.map((t,r)=>{var d=t.formatter||i,f=_({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var p=typeof s==`object`?B({},s):{};p.color=t.inactive?a:p.color||t.color;var h=d?d(t.value,t,r):t.value;return L.createElement(`li`,R({className:f,style:l,key:`legend-item-${r}`},pe(e,t,r)),L.createElement(m,{width:n,height:n,viewBox:c,style:u,"aria-label":`${h} legend icon`},L.createElement(ke,{data:t,iconType:o,inactiveColor:a})),L.createElement(`span`,{className:`recharts-legend-item-text`,style:p},h))})}var je=e=>{var t=h(e,De),{payload:n,layout:r,align:i}=t;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return L.createElement(`ul`,{className:`recharts-default-legend`,style:a},L.createElement(Ae,R({},t,{payload:n})))};function Me(){return w(S)}var Ne=[`contextPayload`];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},H.apply(null,arguments)}function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?U(Object(n),!0).forEach(function(t){Pe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Pe(e,t,n){return(t=Fe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fe(e){var t=Ie(e,`string`);return typeof t==`symbol`?t:t+``}function Ie(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Le(e,t){if(e==null)return{};var n,r,i=Re(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Re(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ze(e){return e.value}function Be(e){var{contextPayload:t}=e,n=Le(e,Ne),r=me(t,e.payloadUniqBy,ze),i=W(W({},n),{},{payload:r});return L.isValidElement(e.content)?L.cloneElement(e.content,i):typeof e.content==`function`?L.createElement(e.content,i):L.createElement(je,i)}function Ve(e,t,n,r,i,a){var{layout:o,align:s,verticalAlign:c}=t,l,u;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(l=s===`center`&&o===`vertical`?{left:((r||0)-a.width)/2}:s===`right`?{right:n&&n.right||0}:{left:n&&n.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(u=c===`middle`?{top:((i||0)-a.height)/2}:c===`bottom`?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),W(W({},l),u)}function He(e){var t=I();return(0,L.useEffect)(()=>{t(l(e))},[t,e]),null}function Ue(e){var t=I();return(0,L.useEffect)(()=>(t(x(e)),()=>{t(x({width:0,height:0}))}),[t,e]),null}function We(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var Ge={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,layout:`horizontal`,verticalAlign:`bottom`};function Ke(e){var t=h(e,Ge),n=Me(),r=c(),i=ue(),{width:a,height:o,wrapperStyle:s,portal:l}=t,[u,d]=te([n]),f=O(),m=p();if(f==null||m==null)return null;var g=f-(i?.left||0)-(i?.right||0),_=We(t.layout,o,a,g),v=l?s:W(W({position:`absolute`,width:_?.width||a||`auto`,height:_?.height||o||`auto`},Ve(s,t,i,f,m,u)),s),y=l??r;return y==null||n==null?null:(0,Ce.createPortal)(L.createElement(`div`,{className:`recharts-legend-wrapper`,style:v,ref:d},L.createElement(He,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!l&&L.createElement(Ue,{width:u.width,height:u.height}),L.createElement(Be,H({},t,_,{margin:i,chartWidth:f,chartHeight:m,contextPayload:n}))),y)}var G=L.memo(Ke,N);G.displayName=`Legend`;var K=(e,t,n,r)=>o(e,`xAxis`,t,r),q=(e,t,n,r)=>j(e,`xAxis`,t,r),J=(e,t,n,r)=>o(e,`yAxis`,n,r),Y=(e,t,n,r)=>j(e,`yAxis`,n,r),qe=F([b,K,J,q,Y],(e,t,n,r,i)=>ce(e,`xAxis`)?M(t,r,!1):M(n,i,!1)),Je=(e,t,n,r,i)=>i;function Ye(e){return e.type===`line`}var Xe=F([b,K,J,q,Y,F([i,Je],(e,t)=>e.filter(Ye).find(e=>e.id===t)),qe,a],(e,t,n,r,i,a,o,s)=>{var{chartData:c,dataStartIndex:l,dataEndIndex:u}=s;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var{dataKey:d,data:f}=a,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return yt({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Ze=[`id`],Qe=[`type`,`layout`,`connectNulls`,`needClip`,`shape`],$e=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(null,arguments)}function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Z(Object(n),!0).forEach(function(t){et(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function et(e,t,n){return(t=tt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tt(e){var t=nt(e,`string`);return typeof t==`symbol`?t:t+``}function nt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function $(e,t){if(e==null)return{};var n,r,i=rt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function rt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var it=e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:D(n,t),payload:e}]},at=L.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:ie,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:D(o,t),hide:s,type:l,color:r,unit:c,graphicalItemId:u}};return L.createElement(k,{tooltipEntrySettings:d})}),ot=(e,t)=>`${t}px ${e}px`;function st(e,t){for(var n=e.length%2==0?e:[...e,0],r=[],i=0;i<t;++i)r.push(...n);return r}var ct=(e,t,n)=>{var r=n.reduce((e,t)=>e+t,0);if(!r)return ot(t,e);for(var i=Math.floor(e/r),a=e%r,o=[],s=0,c=0;s<n.length;c+=(l=n[s])??0,++s){var l,u=n[s];if(u!=null&&c+u>a){o=[...n.slice(0,s),a-c];break}}var d=o.length%2==0?[0,t]:[t];return[...st(n,i),...o,...d].map(e=>`${e}px`).join(`, `)};function lt(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,c=v($(r,Ze));return L.createElement(xe,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function ut(e){var{showLabels:t,children:n,points:r}=e,i=(0,L.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Q(Q({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return L.createElement(ne,{value:t?i:void 0},n)}function dt(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:c,needClip:l,shape:u}=a,d=Q(Q({},ge($(a,Qe))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:l?`url(#clipPath-${t})`:void 0,points:r,type:o,layout:s,connectNulls:c,strokeDasharray:i??a.strokeDasharray});return L.createElement(L.Fragment,null,r?.length>1&&L.createElement(_e,X({shapeType:`curve`,option:u},d,{pathRef:n})),L.createElement(lt,{points:r,clipPathId:t,props:a}))}function ft(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function pt(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:c,isAnimationActive:l,animationBegin:u,animationDuration:d,animationEasing:f,animateNewValues:p,width:m,height:h,onAnimationEnd:_,onAnimationStart:v}=n,b=i.current,x=g(o,`recharts-line-`),S=(0,L.useRef)(x),[C,w]=(0,L.useState)(!1),T=!C,E=(0,L.useCallback)(()=>{typeof _==`function`&&_(),w(!1)},[_]),D=(0,L.useCallback)(()=>{typeof v==`function`&&v(),w(!0)},[v]),O=ft(r.current),k=(0,L.useRef)(0);S.current!==x&&(k.current=a.current,S.current=x);var A=k.current;return L.createElement(ut,{points:o,showLabels:T},n.children,L.createElement(y,{animationId:x,begin:u,duration:d,isActive:l,easing:f,onAnimationEnd:E,onAnimationStart:D,key:x},e=>{var u=s(A,O+A,e),d=Math.min(u,O),f=l?c?ct(d,O,`${c}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):ot(O,d):c==null?void 0:String(c);if(e>0&&O>0&&(i.current=o,a.current=Math.max(a.current,d)),b){var g=b.length/o.length,_=e===1?o:o.map((t,n)=>{var r=Math.floor(n*g);if(b[r]){var i=b[r];return Q(Q({},t),{},{x:s(i.x,t.x,e),y:s(i.y,t.y,e)})}return p?Q(Q({},t),{},{x:s(m*2,t.x,e),y:s(h/2,t.y,e)}):Q(Q({},t),{},{x:t.x,y:t.y})});return i.current=_,L.createElement(dt,{props:n,points:_,clipPathId:t,pathRef:r,strokeDasharray:f})}return L.createElement(dt,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:f})}),L.createElement(ee,{label:n.label}))}function mt(e){var{clipPathId:t,props:n}=e,r=(0,L.useRef)(null),i=(0,L.useRef)(0),a=(0,L.useRef)(null);return L.createElement(pt,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var ht=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:A(e.payload,t)}),gt=class extends L.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:c,height:l,id:d,needClip:f,zIndex:p}=this.props;if(e)return null;var m=_(`recharts-line`,r),h=d,{r:g,strokeWidth:v}=Se(t),y=se(t),b=g*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${h})`:void 0;return L.createElement(he,{zIndex:p},L.createElement(u,{className:m},f&&L.createElement(`defs`,null,L.createElement(re,{clipPathId:h,xAxisId:i,yAxisId:a}),!y&&L.createElement(`clipPath`,{id:`clipPath-dots-${h}`},L.createElement(`rect`,{x:s-b/2,y:o-b/2,width:c+b,height:l+b}))),L.createElement(ye,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:ht,errorBarOffset:0},L.createElement(mt,{props:this.props,clipPathId:h}))),L.createElement(be,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}},_t={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:d.line,type:`linear`};function vt(e){var t=h(e,_t),{activeDot:n,animateNewValues:i,animationBegin:a,animationDuration:o,animationEasing:s,connectNulls:c,dot:l,hide:u,isAnimationActive:d,label:f,legendType:p,xAxisId:m,yAxisId:g,id:_}=t,v=$(t,$e),{needClip:y}=C(m,g),b=T(),x=r(),S=P(),E=w(e=>Xe(e,m,g,S,_));if(x!==`horizontal`&&x!==`vertical`||E==null||b==null)return null;var{height:D,width:O,x:k,y:A}=b;return L.createElement(gt,X({},v,{id:_,connectNulls:c,dot:l,activeDot:n,animateNewValues:i,animationBegin:a,animationDuration:o,animationEasing:s,isAnimationActive:d,hide:u,label:f,legendType:p,xAxisId:m,yAxisId:g,points:E,layout:x,height:D,width:O,left:k,top:A,needClip:y}))}function yt(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:c}=e;return c.map((e,c)=>{var l=A(e,o);if(t===`horizontal`)return{x:oe({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(f(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=f(l)?null:n.scale.map(l),d=oe({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function bt(e){var t=h(e,_t),n=P();return L.createElement(de,{id:t.id,type:`line`},e=>L.createElement(L.Fragment,null,L.createElement(E,{legendPayload:it(t)}),L.createElement(at,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),L.createElement(ae,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),L.createElement(vt,X({},t,{id:e}))))}var xt=L.memo(bt,N);xt.displayName=`Line`;var St=[`axis`],Ct=(0,L.forwardRef)((e,t)=>L.createElement(le,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:St,tooltipPayloadSearcher:fe,categoricalChartProps:e,ref:t}));export{xt as n,G as r,Ct as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./arrow-left-DmIga4jN.js";import{t}from"./arrow-up-right-DzAKT3cL.js";import{t as n}from"./refresh-cw-dsQ_f-9j.js";import{t as r}from"./search-Cisx0wBF.js";import{g as i,o as a,p as o,y as s}from"./index-BguiS02-.js";import{c,i as l,o as u,t as d}from"./components-C2-vHJtu.js";import{t as f}from"./api-hjUd9Skg.js";import{i as p,n as m,t as h}from"./format-BCxMsVJh.js";import{t as g}from"./market.module-BSrEp5Ak.js";var _=o(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),v=s(i(),1),y={page:`_page_4wowc_1`,header:`_header_4wowc_2`,sectionHeader:`_sectionHeader_4wowc_4`,eyebrow:`_eyebrow_4wowc_5`,period:`_period_4wowc_6`,periodComparison:`_periodComparison_4wowc_9`,muted:`_muted_4wowc_11`,coverage:`_coverage_4wowc_11`,scope:`_scope_4wowc_12`,filters:`_filters_4wowc_14`,filterFields:`_filterFields_4wowc_15`,filterActions:`_filterActions_4wowc_16`,search:`_search_4wowc_22`,rule:`_rule_4wowc_25`,stats:`_stats_4wowc_26`,tableWrap:`_tableWrap_4wowc_35`,textButton:`_textButton_4wowc_43`,positive:`_positive_4wowc_45`,signals:`_signals_4wowc_46`,pager:`_pager_4wowc_49`,empty:`_empty_4wowc_51`,method:`_method_4wowc_53`,context:`_context_4wowc_55`,productSection:`_productSection_4wowc_59`,product:`_product_4wowc_59`},b=a(),x={minGrowth:`20`,minSales:`1000000`,minBase:`100000`,maxShops:`500`,q:``},S={...x,minSales:`10000`,minBase:`10000`},C=e=>e==null?`—`:`${e>0?`+`:``}${m(e,`percent`)}`;function w(e,t){let n=e?new URLSearchParams(e).toString():``,r=n+`:`+t,[i,a]=(0,v.useState)({key:``,data:null,error:``});return(0,v.useEffect)(()=>{if(!n)return;let e=new AbortController;return f.opportunities(Object.fromEntries(new URLSearchParams(n)),e.signal).then(t=>{e.signal.aborted||a({key:r,data:t,error:``})}).catch(t=>{e.signal.aborted||a({key:r,data:null,error:t instanceof Error?t.message:`机会数据读取失败`})}),()=>e.abort()},[n,r]),i.key===r?{...i,loading:!1}:{data:null,error:``,loading:!!n}}function T({value:e,onApply:t,products:n=!1}){let[i,a]=(0,v.useState)(e);function o(e){e.preventDefault(),t(i)}return(0,b.jsxs)(`form`,{className:y.filters,onSubmit:o,children:[(0,b.jsxs)(`div`,{className:y.filterFields,children:[(0,b.jsxs)(`label`,{children:[`环比增长 ≥`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最低环比增长`,type:`number`,min:`0`,max:`10000`,step:`0.01`,required:!0,value:i.minGrowth,onChange:e=>a({...i,minGrowth:e.target.value})}),`%`]})]}),(0,b.jsxs)(`label`,{children:[`本月销售额 ≥`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最低本月销售额(万元)`,type:`number`,min:`0`,max:`100000000`,step:`0.01`,required:!0,value:i.minSales===``?``:Number(i.minSales)/1e4,onChange:e=>a({...i,minSales:e.target.value===``?``:String(Math.round(Number(e.target.value)*1e6)/100)})}),`万元`]})]}),(0,b.jsxs)(`label`,{children:[`上月销售额 ≥`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最低上月销售额(万元)`,type:`number`,min:`0`,max:`100000000`,step:`0.01`,required:!0,value:i.minBase===``?``:Number(i.minBase)/1e4,onChange:e=>a({...i,minBase:e.target.value===``?``:String(Math.round(Number(e.target.value)*1e6)/100)})}),`万元`]})]}),!n&&(0,b.jsxs)(`label`,{children:[`店铺数 ≤`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最多竞争店铺数`,type:`number`,min:`1`,max:`1000000000`,step:`1`,required:!0,value:i.maxShops,onChange:e=>a({...i,maxShops:e.target.value})}),`家`]})]})]}),(0,b.jsxs)(`div`,{className:y.filterActions,children:[(0,b.jsxs)(`label`,{className:y.search,children:[`关键词`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(r,{size:14}),(0,b.jsx)(`input`,{"aria-label":n?`搜索机会商品`:`搜索机会类目`,placeholder:n?`商品名称 / ID`:`类目名称`,maxLength:120,value:i.q,onChange:e=>a({...i,q:e.target.value})})]})]}),(0,b.jsx)(`button`,{className:g.primary,type:`submit`,children:`筛选机会`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let e=n?S:x;a(e),t(e)},children:`重置`})]})]})}function E({page:e,total:t,onChange:n}){let r=Math.max(1,Math.ceil(t/25));return(0,b.jsxs)(`div`,{className:y.pager,children:[(0,b.jsxs)(`span`,{children:[`共 `,m(t),` 个候选`]}),(0,b.jsx)(`button`,{disabled:e<=1,onClick:()=>n(e-1),children:`上一页`}),(0,b.jsxs)(`span`,{children:[e,` / `,r]}),(0,b.jsx)(`button`,{disabled:e>=r,onClick:()=>n(e+1),children:`下一页`})]})}function D({message:e,retry:t}){return(0,b.jsxs)(`div`,{className:y.empty,role:`alert`,children:[(0,b.jsx)(`p`,{children:e}),(0,b.jsxs)(`button`,{onClick:t,children:[(0,b.jsx)(n,{size:14}),`重新读取`]})]})}function O({row:e}){return(0,b.jsxs)(`div`,{className:y.signals,children:[(0,b.jsx)(`span`,{children:e.salesGrowth!=null&&e.salesGrowth>0&&e.previousGrowth!=null&&e.previousGrowth>0?`连续两月增长`:`持续性待验证`}),(0,b.jsx)(`small`,{children:e.salesYoy==null?`去年同月未覆盖`:`同比 ${C(e.salesYoy)}`})]})}function k({record:e,onClose:t}){let[n,r]=(0,v.useState)({data:null,error:``});return(0,v.useEffect)(()=>{let t=new AbortController;return f.record(e.key,t.signal).then(e=>{t.signal.aborted||r({data:e,error:``})}).catch(e=>{t.signal.aborted||r({data:null,error:e instanceof Error?e.message:`走势读取失败`})}),()=>t.abort()},[e.key]),(0,b.jsx)(l,{title:e.name||e.id||`商品走势`,onClose:t,children:n.error?(0,b.jsx)(`p`,{role:`alert`,children:n.error}):n.data?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{points:n.data.trend}),(0,b.jsx)(`p`,{className:y.muted,children:`金额单位元;缺失月份不补零。同月冲突记录保持缺口。`}),n.data.warnings?.map(e=>(0,b.jsx)(`p`,{children:e},e))]}):(0,b.jsx)(`p`,{role:`status`,children:`正在读取商品走势…`})})}function A({month:n,categoryId:r,onBack:i,onOpenCategory:a}){let[o,s]=c(`opportunityProductFilters`,S),[l,d]=(0,v.useState)(1),[f,h]=(0,v.useState)(`salesIncrease`),[g,_]=(0,v.useState)(0),[x,A]=(0,v.useState)(null),{data:j,error:M,loading:N}=w({kind:`products`,month:n,categoryId:r,...o,sort:f,page:String(l)},g),P=j?.category;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.header,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{onClick:i,children:[(0,b.jsx)(e,{size:14}),`机会市场`]}),(0,b.jsx)(`h1`,{children:P?.name||`赛道详情`}),(0,b.jsxs)(`p`,{children:[n,` 对比 `,j?.previousMonth||`上月`,` · 在赛道中寻找增长商品`]})]}),(0,b.jsxs)(`button`,{onClick:()=>a(r,n),children:[`查看完整商品榜`,(0,b.jsx)(t,{size:14})]})]}),N&&(0,b.jsx)(`p`,{className:y.empty,role:`status`,children:`正在比较相邻月份的商品数据…`}),M&&(0,b.jsx)(D,{message:M,retry:()=>_(e=>e+1)}),j&&P&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.stats,children:[(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`类目销售额`}),(0,b.jsx)(`strong`,{children:m(P.sales,`money`)}),(0,b.jsxs)(`small`,{children:[`环比 `,C(P.salesGrowth)]})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`类目店铺数`}),(0,b.jsxs)(`strong`,{children:[m(P.shopCount),` `,(0,b.jsx)(`i`,{children:`家`})]}),(0,b.jsxs)(`small`,{children:[`环比 `,C(P.shopGrowth)]})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`平均每店市场规模`}),(0,b.jsx)(`strong`,{children:m(P.salesPerShop,`money`)}),(0,b.jsx)(`small`,{children:`类目销售额 ÷ 店铺数,不代表利润`})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`增长延续性`}),(0,b.jsx)(`strong`,{children:P.previousGrowth!=null&&P.previousGrowth>0&&P.salesGrowth!=null&&P.salesGrowth>0?`连续两月增长`:`需要继续观察`}),(0,b.jsxs)(`small`,{children:[`上期环比 `,C(P.previousGrowth)]})]})]}),(0,b.jsxs)(`div`,{className:y.context,children:[(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`h2`,{children:[`类目销售趋势 `,(0,b.jsx)(`small`,{children:`近 12 个自然月 · 元`})]}),(0,b.jsx)(u,{points:j.trend})]}),(0,b.jsxs)(`aside`,{children:[(0,b.jsx)(`h2`,{children:`入场前,还要验证`}),(0,b.jsx)(`p`,{children:`店铺数量少只是竞争初筛,可能存在头部垄断、资质门槛或需求过小。`}),(0,b.jsxs)(`ul`,{children:[(0,b.jsx)(`li`,{children:`结合完整店铺榜确认头部集中度与品牌壁垒。`}),(0,b.jsx)(`li`,{children:`对照同比和多个周期,区分季节性、活动与持续增长。`}),(0,b.jsx)(`li`,{children:`核算毛利、投放成本、供应链及资质;当前数据不包含这些成本。`})]}),(0,b.jsx)(O,{row:P})]})]}),(0,b.jsxs)(`section`,{className:y.productSection,children:[(0,b.jsxs)(`div`,{className:y.sectionHeader,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{children:[`机会商品 `,(0,b.jsx)(`small`,{children:`同一商品 ID 的跨月增长`})]}),(0,b.jsx)(`p`,{children:`展示该类目的增长候选,商品本身的同款竞争尚未判定。`})]}),(0,b.jsxs)(`label`,{children:[`排序 `,(0,b.jsxs)(`select`,{"aria-label":`机会商品排序`,value:f,onChange:e=>{h(e.target.value),d(1)},children:[(0,b.jsx)(`option`,{value:`salesIncrease`,children:`销售增量优先`}),(0,b.jsx)(`option`,{value:`salesGrowth`,children:`增长率优先`}),(0,b.jsx)(`option`,{value:`sales`,children:`销售规模优先`})]})]})]}),(0,b.jsx)(T,{products:!0,value:o,onApply:e=>{s(e),d(1)}}),j.availability.current!==`ready`||j.availability.previous!==`ready`?(0,b.jsxs)(`div`,{className:y.empty,children:[(0,b.jsx)(`h3`,{children:`这两个月的商品榜暂不能完整对比`}),(0,b.jsxs)(`p`,{children:[n,`:`,j.availability.current===`ready`?`已就绪`:j.availability.current===`pending`?`导入中`:`未覆盖`,`;`,j.previousMonth,`:`,j.availability.previous===`ready`?`已就绪`:j.availability.previous===`pending`?`导入中`:`未覆盖`,`。`]}),(0,b.jsx)(`p`,{children:`补齐后再计算增长,缺失榜单不会作为零销售额。`})]}):(0,b.jsxs)(b.Fragment,{children:[j.coverage&&(0,b.jsxs)(`p`,{className:y.coverage,children:[`本月 `,m(j.coverage.current),` 个已识别商品 · 可比 `,m(j.coverage.comparable),` 个 · 本月首次观察 `,m(j.coverage.newlyObserved),` 个 · 零基数或缺值 `,m(j.coverage.invalidBase),` 个 · 销售额冲突 `,m(j.coverage.conflicts),` 个`]}),j.rows.length?(0,b.jsx)(`div`,{className:y.tableWrap,children:(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`商品 / 店铺`}),(0,b.jsx)(`th`,{children:`本月销售额`}),(0,b.jsx)(`th`,{children:`上月销售额`}),(0,b.jsx)(`th`,{children:`增长金额`}),(0,b.jsx)(`th`,{children:`环比增长`}),(0,b.jsx)(`th`,{children:`件单价`}),(0,b.jsx)(`th`,{children:`查看`})]})}),(0,b.jsx)(`tbody`,{children:j.rows.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsxs)(`div`,{className:y.product,children:[p(e.imageUrl)&&(0,b.jsx)(`img`,{src:p(e.imageUrl),alt:``,loading:`lazy`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`button`,{className:y.textButton,onClick:()=>A(e),children:e.name||e.id}),(0,b.jsxs)(`small`,{children:[e.shopName||`店铺名称未提供`,` · `,e.id]})]})]})}),(0,b.jsx)(`td`,{children:m(e.sales,`money`)}),(0,b.jsx)(`td`,{children:m(e.previousSales,`money`)}),(0,b.jsxs)(`td`,{className:y.positive,children:[`+`,m(e.salesIncrease,`money`)]}),(0,b.jsx)(`td`,{className:y.positive,children:C(e.salesGrowth)}),(0,b.jsx)(`td`,{children:m(e.unitPrice,`money`)}),(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`button`,{onClick:()=>A(e),children:`走势`}),p(e.url)&&(0,b.jsx)(`a`,{href:p(e.url),target:`_blank`,rel:`noreferrer`,children:`商品链接 ↗`})]})]},e.id))})]})}):(0,b.jsxs)(`div`,{className:y.empty,children:[(0,b.jsx)(`h3`,{children:`没有符合当前条件的商品`}),(0,b.jsx)(`p`,{children:`可以调整增长率或销售额门槛;首次观察到的商品不等于新品,也不直接判为增长机会。`})]}),(0,b.jsx)(E,{page:l,total:j.total,onChange:d})]})]})]}),x&&(0,b.jsx)(k,{record:x,onClose:()=>A(null)})]})}function j({onOpenCategory:e}){let[n,r]=(0,v.useState)(0),[i,a]=(0,v.useState)({revision:-1,data:null,error:``}),[o,s]=c(`opportunityMonth`,``),[l,u]=c(`opportunityScope`,``),[p,S]=c(`opportunityFilters`,x),[k,j]=c(`opportunitySort`,`salesIncrease`),[M,N]=c(`opportunityPage`,1),[P,F]=c(`opportunitySelected`,null);(0,v.useEffect)(()=>{let e=new AbortController;return f.bootstrap(e.signal).then(t=>{e.signal.aborted||a({revision:n,data:t,error:``})}).catch(t=>{e.signal.aborted||a({revision:n,data:null,error:t instanceof Error?t.message:`市场数据读取失败`})}),()=>e.abort()},[n]);let I=i.revision===n?i.data:null,L=I?.status===`ready`&&I.capabilities?.opportunities,{data:R,error:z,loading:B}=w(L&&!P?{kind:`markets`,month:o,categoryId:l,...p,sort:k,page:String(M)}:null,n),V=()=>r(e=>e+1);return(0,b.jsxs)(`main`,{className:`${g.page} ${y.page}`,children:[!I&&i.revision!==n&&(0,b.jsx)(`p`,{className:y.empty,role:`status`,children:`正在读取市场范围…`}),i.revision===n&&i.error&&(0,b.jsx)(D,{message:i.error,retry:V}),I&&!L&&(0,b.jsx)(D,{message:I.status===`no-access`?`企业尚未获得市场类目授权`:I.status===`unpublished`?`市场数据尚未就绪`:`机会发现服务暂未就绪`,retry:V}),L&&P?(0,b.jsx)(A,{...P,onBack:()=>F(null),onOpenCategory:e},P.categoryId+P.month):L&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.header,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:y.eyebrow,children:[(0,b.jsx)(_,{size:15}),`市场洞察 / 机会发现`]}),(0,b.jsx)(`h1`,{children:`找到增长中的细分赛道`}),(0,b.jsx)(`p`,{children:`先看需求增长与竞争店铺,再进入赛道寻找增长商品。`})]}),(0,b.jsxs)(`div`,{className:y.period,children:[(0,b.jsxs)(`label`,{children:[`统计月份 `,(0,b.jsxs)(`select`,{"aria-label":`机会市场统计月份`,value:o||R?.month||``,onChange:e=>{s(e.target.value),N(1)},children:[(0,b.jsx)(`option`,{value:``,children:`最近可比月份`}),(R?.months||I.months).map(e=>(0,b.jsxs)(`option`,{value:e,children:[e,R?.missingStatisticsMonths?.includes(e)?` · 类目统计待补齐`:``]},e))]})]}),(0,b.jsxs)(`div`,{className:y.periodComparison,children:[(0,b.jsx)(`span`,{children:`对比月份`}),(0,b.jsx)(`strong`,{children:R?.previousMonth||`自动匹配上月`})]})]})]}),(0,b.jsxs)(`div`,{className:y.scope,children:[(0,b.jsx)(d,{categories:I.categories,favoriteIds:(I.favorites||[]).filter(e=>e.kind===`category`).map(e=>e.key),value:l,disabled:!1,onChoose:e=>{u(e),N(1)}}),(0,b.jsx)(`span`,{children:`只比较叶子类目,避免父子类目重复计算`})]}),(0,b.jsx)(T,{value:p,onApply:e=>{S(e),N(1)}}),(0,b.jsx)(`p`,{className:y.rule,children:`同时要求:销售额增速高于店铺数增速。门槛是可调整的筛选条件,不是行业通用标准。`}),B&&(0,b.jsx)(`p`,{className:y.empty,role:`status`,children:`正在筛选机会市场…`}),z&&(0,b.jsx)(D,{message:z,retry:V}),R?.month&&R.missingStatisticsMonths?.includes(R.month)&&(0,b.jsxs)(`div`,{className:y.empty,role:`status`,children:[(0,b.jsxs)(`h3`,{children:[R.month,` 榜单已入库,类目统计待补齐`]}),(0,b.jsx)(`p`,{children:`商品和店铺榜单可以查看;市场销售额与店铺数尚缺类目月度统计,补齐后可进行相邻月机会筛选。`}),(0,b.jsxs)(`button`,{onClick:()=>e(l,R.month),children:[`查看本月商品榜`,(0,b.jsx)(t,{size:14})]})]}),R?.previousMonth&&R.missingStatisticsMonths?.includes(R.previousMonth)&&!R.missingStatisticsMonths.includes(R.month||``)&&(0,b.jsxs)(`p`,{className:y.rule,role:`status`,children:[`对比月份 `,R.previousMonth,` 的类目统计待补齐,本月机会筛选暂无完整环比依据。`]}),R&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.stats,children:[(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`当前范围叶子类目`}),(0,b.jsx)(`strong`,{children:m(R.coverage.scanned)})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`相邻月数据可比`}),(0,b.jsx)(`strong`,{children:m(R.coverage.comparable)})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`符合条件的机会候选`}),(0,b.jsx)(`strong`,{className:y.positive,children:m(R.total)})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`缺失 / 零基数排除`}),(0,b.jsx)(`strong`,{children:m(R.coverage.excluded)})]})]}),(0,b.jsxs)(`div`,{className:y.sectionHeader,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{children:`机会市场`}),(0,b.jsx)(`p`,{children:`店铺数用于竞争初筛;点击候选查看趋势和机会商品。`})]}),(0,b.jsxs)(`label`,{children:[`排序 `,(0,b.jsxs)(`select`,{"aria-label":`机会市场排序`,value:k,onChange:e=>{j(e.target.value),N(1)},children:[(0,b.jsx)(`option`,{value:`salesIncrease`,children:`销售增量优先`}),(0,b.jsx)(`option`,{value:`salesGrowth`,children:`增长率优先`}),(0,b.jsx)(`option`,{value:`sales`,children:`销售规模优先`}),(0,b.jsx)(`option`,{value:`shopCount`,children:`店铺数量从少到多`})]})]})]}),R.rows.length?(0,b.jsx)(`div`,{className:y.tableWrap,children:(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`机会赛道 / 增长信号`}),(0,b.jsx)(`th`,{children:`本月销售额`}),(0,b.jsx)(`th`,{children:`增长金额`}),(0,b.jsx)(`th`,{children:`环比增长`}),(0,b.jsx)(`th`,{children:`店铺数`}),(0,b.jsx)(`th`,{children:`店铺数环比`}),(0,b.jsx)(`th`,{children:`平均每店市场规模`}),(0,b.jsx)(`th`,{children:`查看`})]})}),(0,b.jsx)(`tbody`,{children:R.rows.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`button`,{className:y.textButton,onClick:()=>F({categoryId:e.id,month:R.month}),children:e.name}),(0,b.jsx)(`small`,{children:h(I.categories,e.id).slice(0,-1).map(e=>e.name).join(` / `)}),(0,b.jsx)(O,{row:e})]}),(0,b.jsxs)(`td`,{children:[m(e.sales,`money`),(0,b.jsxs)(`small`,{children:[`上月 `,m(e.previousSales,`money`)]})]}),(0,b.jsxs)(`td`,{className:y.positive,children:[`+`,m(e.salesIncrease,`money`)]}),(0,b.jsx)(`td`,{className:y.positive,children:C(e.salesGrowth)}),(0,b.jsxs)(`td`,{children:[m(e.shopCount),` 家`]}),(0,b.jsx)(`td`,{children:C(e.shopGrowth)}),(0,b.jsx)(`td`,{children:m(e.salesPerShop,`money`)}),(0,b.jsx)(`td`,{children:(0,b.jsxs)(`button`,{onClick:()=>F({categoryId:e.id,month:R.month}),children:[`看机会商品`,(0,b.jsx)(t,{size:13})]})})]},e.id))})]})}):(0,b.jsxs)(`div`,{className:y.empty,children:[(0,b.jsx)(`h3`,{children:`当前条件下没有机会候选`}),(0,b.jsx)(`p`,{children:R.coverage.comparable===0?`相邻月份的销售额或店铺数缺少可比数据,不会把缺失月份当零。`:`可以切换类目或调整门槛;没有命中不代表市场不存在机会。`}),R.comparableMonths.at(-1)&&R.comparableMonths.at(-1)!==R.month&&(0,b.jsxs)(`button`,{onClick:()=>{s(R.comparableMonths.at(-1)),N(1)},children:[`查看最近可比月 `,R.comparableMonths.at(-1)]})]}),(0,b.jsx)(E,{page:M,total:R.total,onChange:N}),(0,b.jsxs)(`details`,{className:y.method,children:[(0,b.jsx)(`summary`,{children:`筛选依据与使用边界`}),(0,b.jsxs)(`p`,{children:[R.provenance.source,`。增长率 =(本月销售额 − 上月销售额)÷ 上月销售额;相邻自然月比较,不跨缺月。销售额、店铺数缺失及零基数不参与机会筛选。各类目独立比较,不做跨层级加总。`]}),(0,b.jsx)(`p`,{children:`销售增长快于店铺增长,表示平均每店市场规模扩大,仍不等于每家店增长。店铺少可能来自集中度、准入门槛或数据覆盖;需要进一步检查头部品牌、季节性、流量成本和利润。商品榜为已入库样本,首次观察不等于新上架。`})]})]})]})]})}export{j as default};
|
|
1
|
+
import{t as e}from"./arrow-left-BhFSpYzK.js";import{t}from"./arrow-up-right-IBQoN72x.js";import{t as n}from"./refresh-cw-CxbRf97c.js";import{t as r}from"./search-DFdSppzm.js";import{g as i,o as a,p as o,y as s}from"./index-DLSVWUSu.js";import{c,i as l,o as u,t as d}from"./components-B5Xyjfpi.js";import{t as f}from"./api-KZa8CR8X.js";import{i as p,n as m,t as h}from"./format-DL7i7_eV.js";import{t as g}from"./market.module-VpU4XmGg.js";var _=o(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),v=s(i(),1),y={page:`_page_4wowc_1`,header:`_header_4wowc_2`,sectionHeader:`_sectionHeader_4wowc_4`,eyebrow:`_eyebrow_4wowc_5`,period:`_period_4wowc_6`,periodComparison:`_periodComparison_4wowc_9`,muted:`_muted_4wowc_11`,coverage:`_coverage_4wowc_11`,scope:`_scope_4wowc_12`,filters:`_filters_4wowc_14`,filterFields:`_filterFields_4wowc_15`,filterActions:`_filterActions_4wowc_16`,search:`_search_4wowc_22`,rule:`_rule_4wowc_25`,stats:`_stats_4wowc_26`,tableWrap:`_tableWrap_4wowc_35`,textButton:`_textButton_4wowc_43`,positive:`_positive_4wowc_45`,signals:`_signals_4wowc_46`,pager:`_pager_4wowc_49`,empty:`_empty_4wowc_51`,method:`_method_4wowc_53`,context:`_context_4wowc_55`,productSection:`_productSection_4wowc_59`,product:`_product_4wowc_59`},b=a(),x={minGrowth:`20`,minSales:`1000000`,minBase:`100000`,maxShops:`500`,q:``},S={...x,minSales:`10000`,minBase:`10000`},C=e=>e==null?`—`:`${e>0?`+`:``}${m(e,`percent`)}`;function w(e,t){let n=e?new URLSearchParams(e).toString():``,r=n+`:`+t,[i,a]=(0,v.useState)({key:``,data:null,error:``});return(0,v.useEffect)(()=>{if(!n)return;let e=new AbortController;return f.opportunities(Object.fromEntries(new URLSearchParams(n)),e.signal).then(t=>{e.signal.aborted||a({key:r,data:t,error:``})}).catch(t=>{e.signal.aborted||a({key:r,data:null,error:t instanceof Error?t.message:`机会数据读取失败`})}),()=>e.abort()},[n,r]),i.key===r?{...i,loading:!1}:{data:null,error:``,loading:!!n}}function T({value:e,onApply:t,products:n=!1}){let[i,a]=(0,v.useState)(e);function o(e){e.preventDefault(),t(i)}return(0,b.jsxs)(`form`,{className:y.filters,onSubmit:o,children:[(0,b.jsxs)(`div`,{className:y.filterFields,children:[(0,b.jsxs)(`label`,{children:[`环比增长 ≥`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最低环比增长`,type:`number`,min:`0`,max:`10000`,step:`0.01`,required:!0,value:i.minGrowth,onChange:e=>a({...i,minGrowth:e.target.value})}),`%`]})]}),(0,b.jsxs)(`label`,{children:[`本月销售额 ≥`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最低本月销售额(万元)`,type:`number`,min:`0`,max:`100000000`,step:`0.01`,required:!0,value:i.minSales===``?``:Number(i.minSales)/1e4,onChange:e=>a({...i,minSales:e.target.value===``?``:String(Math.round(Number(e.target.value)*1e6)/100)})}),`万元`]})]}),(0,b.jsxs)(`label`,{children:[`上月销售额 ≥`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最低上月销售额(万元)`,type:`number`,min:`0`,max:`100000000`,step:`0.01`,required:!0,value:i.minBase===``?``:Number(i.minBase)/1e4,onChange:e=>a({...i,minBase:e.target.value===``?``:String(Math.round(Number(e.target.value)*1e6)/100)})}),`万元`]})]}),!n&&(0,b.jsxs)(`label`,{children:[`店铺数 ≤`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`input`,{"aria-label":`最多竞争店铺数`,type:`number`,min:`1`,max:`1000000000`,step:`1`,required:!0,value:i.maxShops,onChange:e=>a({...i,maxShops:e.target.value})}),`家`]})]})]}),(0,b.jsxs)(`div`,{className:y.filterActions,children:[(0,b.jsxs)(`label`,{className:y.search,children:[`关键词`,(0,b.jsxs)(`span`,{children:[(0,b.jsx)(r,{size:14}),(0,b.jsx)(`input`,{"aria-label":n?`搜索机会商品`:`搜索机会类目`,placeholder:n?`商品名称 / ID`:`类目名称`,maxLength:120,value:i.q,onChange:e=>a({...i,q:e.target.value})})]})]}),(0,b.jsx)(`button`,{className:g.primary,type:`submit`,children:`筛选机会`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let e=n?S:x;a(e),t(e)},children:`重置`})]})]})}function E({page:e,total:t,onChange:n}){let r=Math.max(1,Math.ceil(t/25));return(0,b.jsxs)(`div`,{className:y.pager,children:[(0,b.jsxs)(`span`,{children:[`共 `,m(t),` 个候选`]}),(0,b.jsx)(`button`,{disabled:e<=1,onClick:()=>n(e-1),children:`上一页`}),(0,b.jsxs)(`span`,{children:[e,` / `,r]}),(0,b.jsx)(`button`,{disabled:e>=r,onClick:()=>n(e+1),children:`下一页`})]})}function D({message:e,retry:t}){return(0,b.jsxs)(`div`,{className:y.empty,role:`alert`,children:[(0,b.jsx)(`p`,{children:e}),(0,b.jsxs)(`button`,{onClick:t,children:[(0,b.jsx)(n,{size:14}),`重新读取`]})]})}function O({row:e}){return(0,b.jsxs)(`div`,{className:y.signals,children:[(0,b.jsx)(`span`,{children:e.salesGrowth!=null&&e.salesGrowth>0&&e.previousGrowth!=null&&e.previousGrowth>0?`连续两月增长`:`持续性待验证`}),(0,b.jsx)(`small`,{children:e.salesYoy==null?`去年同月未覆盖`:`同比 ${C(e.salesYoy)}`})]})}function k({record:e,onClose:t}){let[n,r]=(0,v.useState)({data:null,error:``});return(0,v.useEffect)(()=>{let t=new AbortController;return f.record(e.key,t.signal).then(e=>{t.signal.aborted||r({data:e,error:``})}).catch(e=>{t.signal.aborted||r({data:null,error:e instanceof Error?e.message:`走势读取失败`})}),()=>t.abort()},[e.key]),(0,b.jsx)(l,{title:e.name||e.id||`商品走势`,onClose:t,children:n.error?(0,b.jsx)(`p`,{role:`alert`,children:n.error}):n.data?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{points:n.data.trend}),(0,b.jsx)(`p`,{className:y.muted,children:`金额单位元;缺失月份不补零。同月冲突记录保持缺口。`}),n.data.warnings?.map(e=>(0,b.jsx)(`p`,{children:e},e))]}):(0,b.jsx)(`p`,{role:`status`,children:`正在读取商品走势…`})})}function A({month:n,categoryId:r,onBack:i,onOpenCategory:a}){let[o,s]=c(`opportunityProductFilters`,S),[l,d]=(0,v.useState)(1),[f,h]=(0,v.useState)(`salesIncrease`),[g,_]=(0,v.useState)(0),[x,A]=(0,v.useState)(null),{data:j,error:M,loading:N}=w({kind:`products`,month:n,categoryId:r,...o,sort:f,page:String(l)},g),P=j?.category;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.header,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{onClick:i,children:[(0,b.jsx)(e,{size:14}),`机会市场`]}),(0,b.jsx)(`h1`,{children:P?.name||`赛道详情`}),(0,b.jsxs)(`p`,{children:[n,` 对比 `,j?.previousMonth||`上月`,` · 在赛道中寻找增长商品`]})]}),(0,b.jsxs)(`button`,{onClick:()=>a(r,n),children:[`查看完整商品榜`,(0,b.jsx)(t,{size:14})]})]}),N&&(0,b.jsx)(`p`,{className:y.empty,role:`status`,children:`正在比较相邻月份的商品数据…`}),M&&(0,b.jsx)(D,{message:M,retry:()=>_(e=>e+1)}),j&&P&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.stats,children:[(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`类目销售额`}),(0,b.jsx)(`strong`,{children:m(P.sales,`money`)}),(0,b.jsxs)(`small`,{children:[`环比 `,C(P.salesGrowth)]})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`类目店铺数`}),(0,b.jsxs)(`strong`,{children:[m(P.shopCount),` `,(0,b.jsx)(`i`,{children:`家`})]}),(0,b.jsxs)(`small`,{children:[`环比 `,C(P.shopGrowth)]})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`平均每店市场规模`}),(0,b.jsx)(`strong`,{children:m(P.salesPerShop,`money`)}),(0,b.jsx)(`small`,{children:`类目销售额 ÷ 店铺数,不代表利润`})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`增长延续性`}),(0,b.jsx)(`strong`,{children:P.previousGrowth!=null&&P.previousGrowth>0&&P.salesGrowth!=null&&P.salesGrowth>0?`连续两月增长`:`需要继续观察`}),(0,b.jsxs)(`small`,{children:[`上期环比 `,C(P.previousGrowth)]})]})]}),(0,b.jsxs)(`div`,{className:y.context,children:[(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`h2`,{children:[`类目销售趋势 `,(0,b.jsx)(`small`,{children:`近 12 个自然月 · 元`})]}),(0,b.jsx)(u,{points:j.trend})]}),(0,b.jsxs)(`aside`,{children:[(0,b.jsx)(`h2`,{children:`入场前,还要验证`}),(0,b.jsx)(`p`,{children:`店铺数量少只是竞争初筛,可能存在头部垄断、资质门槛或需求过小。`}),(0,b.jsxs)(`ul`,{children:[(0,b.jsx)(`li`,{children:`结合完整店铺榜确认头部集中度与品牌壁垒。`}),(0,b.jsx)(`li`,{children:`对照同比和多个周期,区分季节性、活动与持续增长。`}),(0,b.jsx)(`li`,{children:`核算毛利、投放成本、供应链及资质;当前数据不包含这些成本。`})]}),(0,b.jsx)(O,{row:P})]})]}),(0,b.jsxs)(`section`,{className:y.productSection,children:[(0,b.jsxs)(`div`,{className:y.sectionHeader,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{children:[`机会商品 `,(0,b.jsx)(`small`,{children:`同一商品 ID 的跨月增长`})]}),(0,b.jsx)(`p`,{children:`展示该类目的增长候选,商品本身的同款竞争尚未判定。`})]}),(0,b.jsxs)(`label`,{children:[`排序 `,(0,b.jsxs)(`select`,{"aria-label":`机会商品排序`,value:f,onChange:e=>{h(e.target.value),d(1)},children:[(0,b.jsx)(`option`,{value:`salesIncrease`,children:`销售增量优先`}),(0,b.jsx)(`option`,{value:`salesGrowth`,children:`增长率优先`}),(0,b.jsx)(`option`,{value:`sales`,children:`销售规模优先`})]})]})]}),(0,b.jsx)(T,{products:!0,value:o,onApply:e=>{s(e),d(1)}}),j.availability.current!==`ready`||j.availability.previous!==`ready`?(0,b.jsxs)(`div`,{className:y.empty,children:[(0,b.jsx)(`h3`,{children:`这两个月的商品榜暂不能完整对比`}),(0,b.jsxs)(`p`,{children:[n,`:`,j.availability.current===`ready`?`已就绪`:j.availability.current===`pending`?`导入中`:`未覆盖`,`;`,j.previousMonth,`:`,j.availability.previous===`ready`?`已就绪`:j.availability.previous===`pending`?`导入中`:`未覆盖`,`。`]}),(0,b.jsx)(`p`,{children:`补齐后再计算增长,缺失榜单不会作为零销售额。`})]}):(0,b.jsxs)(b.Fragment,{children:[j.coverage&&(0,b.jsxs)(`p`,{className:y.coverage,children:[`本月 `,m(j.coverage.current),` 个已识别商品 · 可比 `,m(j.coverage.comparable),` 个 · 本月首次观察 `,m(j.coverage.newlyObserved),` 个 · 零基数或缺值 `,m(j.coverage.invalidBase),` 个 · 销售额冲突 `,m(j.coverage.conflicts),` 个`]}),j.rows.length?(0,b.jsx)(`div`,{className:y.tableWrap,children:(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`商品 / 店铺`}),(0,b.jsx)(`th`,{children:`本月销售额`}),(0,b.jsx)(`th`,{children:`上月销售额`}),(0,b.jsx)(`th`,{children:`增长金额`}),(0,b.jsx)(`th`,{children:`环比增长`}),(0,b.jsx)(`th`,{children:`件单价`}),(0,b.jsx)(`th`,{children:`查看`})]})}),(0,b.jsx)(`tbody`,{children:j.rows.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsxs)(`div`,{className:y.product,children:[p(e.imageUrl)&&(0,b.jsx)(`img`,{src:p(e.imageUrl),alt:``,loading:`lazy`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`button`,{className:y.textButton,onClick:()=>A(e),children:e.name||e.id}),(0,b.jsxs)(`small`,{children:[e.shopName||`店铺名称未提供`,` · `,e.id]})]})]})}),(0,b.jsx)(`td`,{children:m(e.sales,`money`)}),(0,b.jsx)(`td`,{children:m(e.previousSales,`money`)}),(0,b.jsxs)(`td`,{className:y.positive,children:[`+`,m(e.salesIncrease,`money`)]}),(0,b.jsx)(`td`,{className:y.positive,children:C(e.salesGrowth)}),(0,b.jsx)(`td`,{children:m(e.unitPrice,`money`)}),(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`button`,{onClick:()=>A(e),children:`走势`}),p(e.url)&&(0,b.jsx)(`a`,{href:p(e.url),target:`_blank`,rel:`noreferrer`,children:`商品链接 ↗`})]})]},e.id))})]})}):(0,b.jsxs)(`div`,{className:y.empty,children:[(0,b.jsx)(`h3`,{children:`没有符合当前条件的商品`}),(0,b.jsx)(`p`,{children:`可以调整增长率或销售额门槛;首次观察到的商品不等于新品,也不直接判为增长机会。`})]}),(0,b.jsx)(E,{page:l,total:j.total,onChange:d})]})]})]}),x&&(0,b.jsx)(k,{record:x,onClose:()=>A(null)})]})}function j({onOpenCategory:e}){let[n,r]=(0,v.useState)(0),[i,a]=(0,v.useState)({revision:-1,data:null,error:``}),[o,s]=c(`opportunityMonth`,``),[l,u]=c(`opportunityScope`,``),[p,S]=c(`opportunityFilters`,x),[k,j]=c(`opportunitySort`,`salesIncrease`),[M,N]=c(`opportunityPage`,1),[P,F]=c(`opportunitySelected`,null);(0,v.useEffect)(()=>{let e=new AbortController;return f.bootstrap(e.signal).then(t=>{e.signal.aborted||a({revision:n,data:t,error:``})}).catch(t=>{e.signal.aborted||a({revision:n,data:null,error:t instanceof Error?t.message:`市场数据读取失败`})}),()=>e.abort()},[n]);let I=i.revision===n?i.data:null,L=I?.status===`ready`&&I.capabilities?.opportunities,{data:R,error:z,loading:B}=w(L&&!P?{kind:`markets`,month:o,categoryId:l,...p,sort:k,page:String(M)}:null,n),V=()=>r(e=>e+1);return(0,b.jsxs)(`main`,{className:`${g.page} ${y.page}`,children:[!I&&i.revision!==n&&(0,b.jsx)(`p`,{className:y.empty,role:`status`,children:`正在读取市场范围…`}),i.revision===n&&i.error&&(0,b.jsx)(D,{message:i.error,retry:V}),I&&!L&&(0,b.jsx)(D,{message:I.status===`no-access`?`企业尚未获得市场类目授权`:I.status===`unpublished`?`市场数据尚未就绪`:`机会发现服务暂未就绪`,retry:V}),L&&P?(0,b.jsx)(A,{...P,onBack:()=>F(null),onOpenCategory:e},P.categoryId+P.month):L&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.header,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:y.eyebrow,children:[(0,b.jsx)(_,{size:15}),`市场洞察 / 机会发现`]}),(0,b.jsx)(`h1`,{children:`找到增长中的细分赛道`}),(0,b.jsx)(`p`,{children:`先看需求增长与竞争店铺,再进入赛道寻找增长商品。`})]}),(0,b.jsxs)(`div`,{className:y.period,children:[(0,b.jsxs)(`label`,{children:[`统计月份 `,(0,b.jsxs)(`select`,{"aria-label":`机会市场统计月份`,value:o||R?.month||``,onChange:e=>{s(e.target.value),N(1)},children:[(0,b.jsx)(`option`,{value:``,children:`最近可比月份`}),(R?.months||I.months).map(e=>(0,b.jsxs)(`option`,{value:e,children:[e,R?.missingStatisticsMonths?.includes(e)?` · 类目统计待补齐`:``]},e))]})]}),(0,b.jsxs)(`div`,{className:y.periodComparison,children:[(0,b.jsx)(`span`,{children:`对比月份`}),(0,b.jsx)(`strong`,{children:R?.previousMonth||`自动匹配上月`})]})]})]}),(0,b.jsxs)(`div`,{className:y.scope,children:[(0,b.jsx)(d,{categories:I.categories,favoriteIds:(I.favorites||[]).filter(e=>e.kind===`category`).map(e=>e.key),value:l,disabled:!1,onChoose:e=>{u(e),N(1)}}),(0,b.jsx)(`span`,{children:`只比较叶子类目,避免父子类目重复计算`})]}),(0,b.jsx)(T,{value:p,onApply:e=>{S(e),N(1)}}),(0,b.jsx)(`p`,{className:y.rule,children:`同时要求:销售额增速高于店铺数增速。门槛是可调整的筛选条件,不是行业通用标准。`}),B&&(0,b.jsx)(`p`,{className:y.empty,role:`status`,children:`正在筛选机会市场…`}),z&&(0,b.jsx)(D,{message:z,retry:V}),R?.month&&R.missingStatisticsMonths?.includes(R.month)&&(0,b.jsxs)(`div`,{className:y.empty,role:`status`,children:[(0,b.jsxs)(`h3`,{children:[R.month,` 榜单已入库,类目统计待补齐`]}),(0,b.jsx)(`p`,{children:`商品和店铺榜单可以查看;市场销售额与店铺数尚缺类目月度统计,补齐后可进行相邻月机会筛选。`}),(0,b.jsxs)(`button`,{onClick:()=>e(l,R.month),children:[`查看本月商品榜`,(0,b.jsx)(t,{size:14})]})]}),R?.previousMonth&&R.missingStatisticsMonths?.includes(R.previousMonth)&&!R.missingStatisticsMonths.includes(R.month||``)&&(0,b.jsxs)(`p`,{className:y.rule,role:`status`,children:[`对比月份 `,R.previousMonth,` 的类目统计待补齐,本月机会筛选暂无完整环比依据。`]}),R&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:y.stats,children:[(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`当前范围叶子类目`}),(0,b.jsx)(`strong`,{children:m(R.coverage.scanned)})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`相邻月数据可比`}),(0,b.jsx)(`strong`,{children:m(R.coverage.comparable)})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`符合条件的机会候选`}),(0,b.jsx)(`strong`,{className:y.positive,children:m(R.total)})]}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:`缺失 / 零基数排除`}),(0,b.jsx)(`strong`,{children:m(R.coverage.excluded)})]})]}),(0,b.jsxs)(`div`,{className:y.sectionHeader,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{children:`机会市场`}),(0,b.jsx)(`p`,{children:`店铺数用于竞争初筛;点击候选查看趋势和机会商品。`})]}),(0,b.jsxs)(`label`,{children:[`排序 `,(0,b.jsxs)(`select`,{"aria-label":`机会市场排序`,value:k,onChange:e=>{j(e.target.value),N(1)},children:[(0,b.jsx)(`option`,{value:`salesIncrease`,children:`销售增量优先`}),(0,b.jsx)(`option`,{value:`salesGrowth`,children:`增长率优先`}),(0,b.jsx)(`option`,{value:`sales`,children:`销售规模优先`}),(0,b.jsx)(`option`,{value:`shopCount`,children:`店铺数量从少到多`})]})]})]}),R.rows.length?(0,b.jsx)(`div`,{className:y.tableWrap,children:(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`机会赛道 / 增长信号`}),(0,b.jsx)(`th`,{children:`本月销售额`}),(0,b.jsx)(`th`,{children:`增长金额`}),(0,b.jsx)(`th`,{children:`环比增长`}),(0,b.jsx)(`th`,{children:`店铺数`}),(0,b.jsx)(`th`,{children:`店铺数环比`}),(0,b.jsx)(`th`,{children:`平均每店市场规模`}),(0,b.jsx)(`th`,{children:`查看`})]})}),(0,b.jsx)(`tbody`,{children:R.rows.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`button`,{className:y.textButton,onClick:()=>F({categoryId:e.id,month:R.month}),children:e.name}),(0,b.jsx)(`small`,{children:h(I.categories,e.id).slice(0,-1).map(e=>e.name).join(` / `)}),(0,b.jsx)(O,{row:e})]}),(0,b.jsxs)(`td`,{children:[m(e.sales,`money`),(0,b.jsxs)(`small`,{children:[`上月 `,m(e.previousSales,`money`)]})]}),(0,b.jsxs)(`td`,{className:y.positive,children:[`+`,m(e.salesIncrease,`money`)]}),(0,b.jsx)(`td`,{className:y.positive,children:C(e.salesGrowth)}),(0,b.jsxs)(`td`,{children:[m(e.shopCount),` 家`]}),(0,b.jsx)(`td`,{children:C(e.shopGrowth)}),(0,b.jsx)(`td`,{children:m(e.salesPerShop,`money`)}),(0,b.jsx)(`td`,{children:(0,b.jsxs)(`button`,{onClick:()=>F({categoryId:e.id,month:R.month}),children:[`看机会商品`,(0,b.jsx)(t,{size:13})]})})]},e.id))})]})}):(0,b.jsxs)(`div`,{className:y.empty,children:[(0,b.jsx)(`h3`,{children:`当前条件下没有机会候选`}),(0,b.jsx)(`p`,{children:R.coverage.comparable===0?`相邻月份的销售额或店铺数缺少可比数据,不会把缺失月份当零。`:`可以切换类目或调整门槛;没有命中不代表市场不存在机会。`}),R.comparableMonths.at(-1)&&R.comparableMonths.at(-1)!==R.month&&(0,b.jsxs)(`button`,{onClick:()=>{s(R.comparableMonths.at(-1)),N(1)},children:[`查看最近可比月 `,R.comparableMonths.at(-1)]})]}),(0,b.jsx)(E,{page:M,total:R.total,onChange:N}),(0,b.jsxs)(`details`,{className:y.method,children:[(0,b.jsx)(`summary`,{children:`筛选依据与使用边界`}),(0,b.jsxs)(`p`,{children:[R.provenance.source,`。增长率 =(本月销售额 − 上月销售额)÷ 上月销售额;相邻自然月比较,不跨缺月。销售额、店铺数缺失及零基数不参与机会筛选。各类目独立比较,不做跨层级加总。`]}),(0,b.jsx)(`p`,{children:`销售增长快于店铺增长,表示平均每店市场规模扩大,仍不等于每家店增长。店铺少可能来自集中度、准入门槛或数据覆盖;需要进一步检查头部品牌、季节性、流量成本和利润。商品榜为已入库样本,首次观察不等于新上架。`})]})]})]})]})}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,o as t,y as n}from"./index-
|
|
1
|
+
import{g as e,o as t,y as n}from"./index-DLSVWUSu.js";var r=n(e(),1),i=t();function a({items:e,children:t,columns:n,batchSize:a=24,onVisibleCount:o,resetKey:s}){let c=s??e,[l,u]=(0,r.useState)({identity:c,count:a}),d=l.identity===c?l.count:a,f=(0,r.useRef)(null),p=d<e.length;function m(){u(t=>({identity:c,count:Math.min(e.length,(t.identity===c?t.count:a)+a)}))}(0,r.useEffect)(()=>{o?.(Math.min(d,e.length))},[d,e.length,o]),(0,r.useEffect)(()=>{let t=f.current;if(!t||!p||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&u(t=>({identity:c,count:Math.min(e.length,(t.identity===c?t.count:a)+a)}))},{rootMargin:`180px`});return n.observe(t),()=>n.disconnect()},[e,c,a,d,p]);let h=p&&(0,i.jsxs)(`button`,{ref:f,type:`button`,onClick:m,children:[`加载更多(`,Math.min(d,e.length),`/`,e.length,`)`]});return(0,i.jsxs)(i.Fragment,{children:[e.slice(0,d).map((e,n)=>(0,i.jsx)(r.Fragment,{children:t(e,n)},n)),h&&(n?(0,i.jsx)(`tr`,{children:(0,i.jsx)(`td`,{colSpan:n,children:h})}):(0,i.jsx)(`div`,{style:{gridColumn:`1 / -1`,flexShrink:0},children:h}))]})}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./arrow-down-B1nil3T4.js";import{t}from"./arrow-left-BhFSpYzK.js";import{n,t as r}from"./clock-3-CDHtQwAe.js";import{t as i}from"./chart-no-axes-combined-DVgKs36j.js";import{t as a}from"./check-DBnlZFEo.js";import{n as o}from"./link-2-VLti-YG9.js";import{t as s}from"./chevron-right-e65CaeL6.js";import{t as c}from"./grid-2x2-DB6zRPIV.js";import{t as l}from"./list-Dfzc0sXQ.js";import{t as u}from"./plus-D78h7lrw.js";import{t as d}from"./refresh-cw-CxbRf97c.js";import{t as f}from"./search-DFdSppzm.js";import{g as p,h as m,o as h,p as g,s as _,y as v}from"./index-DLSVWUSu.js";import{n as y}from"./workspace-view-state-D0ujRczW.js";import"./public-C-PBMVOQ.js";import{t as b}from"./ProgressiveRows-NojOUgmr.js";import{t as x}from"./api-KZa8CR8X.js";import{t as S}from"./format-DL7i7_eV.js";import{_ as C,n as w,nt as T,o as E,r as D}from"./CartesianChart-CP7p2vlm.js";import{n as O,r as k,t as ee}from"./LineChart-Ckvg5wfQ.js";import{i as te,n as A,r as ne,t as re}from"./FavoritePicker-XD1a_uOa.js";var ie=g(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ae=g(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),j=v(p(),1);function M(e=``){return{month:e,shops:[],metric:`sales`,category:``,shopFilter:``,recentYear:!1,productView:`list`,columns:[`shop`,`category`,`sales`,`salesYoy`,`salesMom`,`views`,`trends`],q:``,sort:`sales`,direction:`desc`}}var N=(e,t)=>JSON.stringify({name:e.trim()||`未命名分析`,config:t});function P(e){let[t,n]=y(`market.analysisDraft.`+e.id,e),r=(0,j.useRef)(t);(0,j.useEffect)(()=>{r.current=t},[t]);let i=(0,j.useRef)(t.revision),a=(0,j.useRef)(N(e.name,e.config)),o=(0,j.useRef)(Promise.resolve()),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(()=>N(e.name,e.config)),p=(0,j.useCallback)(()=>{let e=r.current,t=N(e.name,e.config),s=o.current.catch(()=>{}).then(async()=>{if(a.current!==t){c(!0),u(``);try{let r=await x.saveAnalysis({id:e.id,name:e.name.trim()||`未命名分析`,config:e.config,revision:i.current});i.current=r.revision,a.current=t,f(t),n(e=>({...e,revision:r.revision,updatedAt:r.updatedAt}))}catch(e){throw u(e instanceof Error?e.message:`自动保存失败`),e}finally{c(!1)}}});return o.current=s,s},[n]),m=N(t.name,t.config);return(0,j.useEffect)(()=>{if(m===a.current)return;let e=setTimeout(()=>void p().catch(()=>{}),700);return()=>clearTimeout(e)},[m,d,p]),{draft:t,config:t.config,name:t.name,saving:s,error:l,dirty:m!==d,flush:p,setName:e=>n(t=>({...t,name:e})),change:e=>n(t=>({...t,config:{...t.config,...e}}))}}function F(e,t=0){let n=e?new URLSearchParams(e).toString():``,r=n+`:`+t,[i,a]=(0,j.useState)({key:``,data:null,error:``});return(0,j.useEffect)(()=>{if(!n)return;let e=new AbortController;return x.shopLayout(Object.fromEntries(new URLSearchParams(n)),e.signal).then(t=>{e.signal.aborted||a({key:r,data:t,error:``})}).catch(t=>{e.signal.aborted||a({key:r,data:null,error:t instanceof Error?t.message:`数据读取失败`})}),()=>e.abort()},[n,r]),i.key===r?{...i,loading:!1}:{data:null,error:``,loading:!!n}}var oe=m(),I={root:`_root_mxmkq_1`,dialog:`_dialog_mxmkq_2`,primary:`_primary_mxmkq_4`,historyHeader:`_historyHeader_mxmkq_5`,eyebrow:`_eyebrow_mxmkq_5`,history:`_history_mxmkq_5`,panelHeading:`_panelHeading_mxmkq_5`,historyList:`_historyList_mxmkq_6`,historyIcon:`_historyIcon_mxmkq_6`,historyTitle:`_historyTitle_mxmkq_6`,emptyHistory:`_emptyHistory_mxmkq_6`,editorHeader:`_editorHeader_mxmkq_7`,inline:`_inline_mxmkq_7`,editorIdentity:`_editorIdentity_mxmkq_7`,editorTools:`_editorTools_mxmkq_7`,nameInput:`_nameInput_mxmkq_7`,saveStatus:`_saveStatus_mxmkq_7`,panel:`_panel_mxmkq_5`,horizontal:`_horizontal_mxmkq_8`,shopName:`_shopName_mxmkq_8`,summaryTable:`_summaryTable_mxmkq_8`,link:`_link_mxmkq_8`,sort:`_sort_mxmkq_8`,note:`_note_mxmkq_9`,error:`_error_mxmkq_9`,empty:`_empty_mxmkq_6`,metricBar:`_metricBar_mxmkq_10`,chartRange:`_chartRange_mxmkq_10`,chart:`_chart_mxmkq_10`,trendChart:`_trendChart_mxmkq_10`,filters:`_filters_mxmkq_11`,columnOptions:`_columnOptions_mxmkq_11`,product:`_product_mxmkq_12`,noImage:`_noImage_mxmkq_12`,categoryCell:`_categoryCell_mxmkq_12`,pagination:`_pagination_mxmkq_12`,productCards:`_productCards_mxmkq_12`,cardImage:`_cardImage_mxmkq_15`,cardDetails:`_cardDetails_mxmkq_18`,searchForm:`_searchForm_mxmkq_23`,searchResults:`_searchResults_mxmkq_23`,rangeTrack:`_rangeTrack_mxmkq_27`,rangeWindow:`_rangeWindow_mxmkq_27`,rangeHandle:`_rangeHandle_mxmkq_27`,rangeGrip:`_rangeGrip_mxmkq_27`},L=(e,t,n)=>Math.max(t,Math.min(n,e));function R(e,t){if(t<=0)return{start:0,size:0};let n=L(e.size,Math.min(3,t),t);return{start:L(e.start,0,t-n),size:n}}var z=e=>R({start:0,size:24},e);function se(e,t){if(t<=0)return{start:0,end:0,count:0};let n=R(e,t),r=Math.round(n.size),i=L(Math.round(n.start),0,t-r);return{start:i,end:i+r,count:r}}var B=(e,t,n)=>R({...e,start:e.start+t},n);function V(e,t,n,r){let i=R(e,r),a=L(n,0,1),o=R({start:0,size:i.size*t},r).size;return R({start:i.start+a*(i.size-o),size:o},r)}function H(e,t,n,r){let i=R(e,r),a=Math.min(3,r);if(t===`start`){let e=i.start+i.size,t=L(n,0,e-a);return{start:t,size:e-t}}return{...i,size:L(n,i.start+a,r)-i.start}}function U(e,t,n,r){let i=Math.max(1,n.width),a=t.deltaMode===1?16:t.deltaMode===2?i:1,o=(Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY)*a;if(t.ctrlKey||t.metaKey){let a=(t.clientX-n.left)/i;return V(e,Math.exp(L(o*.003,-1,1)),a,r)}return B(e,o/i*e.size,r)}var W=h();function G({view:e,total:t,onChange:n}){let r=(0,j.useRef)(null),i=(0,j.useRef)(null);function a(t){if(t.button!==0||!r.current)return;let n=t.target.closest(`[data-range-part]`)?.dataset.rangePart;n!==`pan`&&n!==`start`&&n!==`end`||(i.current={kind:n,x:t.clientX,width:r.current.getBoundingClientRect().width,view:e,pointer:t.pointerId},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault())}function o(e){let r=i.current;if(!r||r.pointer!==e.pointerId)return;let a=(e.clientX-r.x)/Math.max(1,r.width)*t;n(()=>r.kind===`pan`?B(r.view,a,t):H(r.view,r.kind,(r.kind===`start`?r.view.start:r.view.start+r.view.size)+a,t))}function s(e,r){let i=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);i&&(e.preventDefault(),n(e=>H(e,r,(r===`start`?e.start:e.start+e.size)+i,t)))}return(0,W.jsx)(`div`,{ref:r,className:I.rangeTrack,"aria-label":`图表显示范围`,onPointerDown:a,onPointerMove:o,onPointerUp:()=>{i.current=null},onPointerCancel:()=>{i.current=null},onLostPointerCapture:()=>{i.current=null},children:(0,W.jsxs)(`div`,{className:I.rangeWindow,"data-range-part":`pan`,style:{left:`${e.start/t*100}%`,width:`${e.size/t*100}%`},children:[(0,W.jsx)(`span`,{role:`slider`,tabIndex:0,"aria-label":`起始类目`,"aria-valuemin":1,"aria-valuemax":t,"aria-valuenow":Math.round(e.start)+1,"data-range-part":`start`,onKeyDown:e=>s(e,`start`),className:I.rangeHandle,children:`Ⅱ`}),(0,W.jsx)(`span`,{className:I.rangeGrip,"data-range-part":`pan`,"aria-hidden":`true`,children:`···`}),(0,W.jsx)(`span`,{role:`slider`,tabIndex:0,"aria-label":`结束类目`,"aria-valuemin":1,"aria-valuemax":t,"aria-valuenow":Math.round(e.start+e.size),"data-range-part":`end`,onKeyDown:e=>s(e,`end`),className:I.rangeHandle,children:`Ⅱ`})]})})}function ce(e,t,n){let r=(0,j.useRef)(null),[i,a]=(0,j.useState)(()=>({scope:e,view:z(t)})),o=i.scope===e?R(i.view,t):z(t),s=(0,j.useCallback)(n=>{a(r=>({scope:e,view:R(n(r.scope===e?r.view:z(t)),t)}))},[e,t]);return(0,j.useEffect)(()=>{let e=r.current;if(!e||!n||t<2)return;function i(n){if(!e||!n.deltaX&&!n.deltaY)return;n.preventDefault(),n.stopPropagation();let r=(e.querySelector(`.recharts-cartesian-grid`)||e).getBoundingClientRect();s(e=>U(e,n,r,t))}return e.addEventListener(`wheel`,i,{passive:!1}),()=>e.removeEventListener(`wheel`,i)},[n,t,s]),{plot:r,view:o,indices:se(o,t),update:s}}var K=[`var(--omni-chart-primary,#469eff)`,`var(--omni-chart-teal,#34b9ac)`,`var(--omni-chart-orange,#d4a25c)`],q=[{key:`sales`,label:`销售额`,unit:`元`},{key:`marketShare`,label:`市场占有率`,unit:`%`},{key:`itemCount`,label:`链接数`,unit:`个`},{key:`efficiency`,label:`链接效率`,unit:`元/链接`},{key:`views`,label:`浏览量`,unit:`次`}],J=(e,t=2)=>e==null?`—`:e.toLocaleString(`zh-CN`,{maximumFractionDigits:t}),Y=e=>e==null?`—`:e>=1e8?J(e/1e8)+`亿`:e>=1e4?J(e/1e4)+`万`:J(e);function le({x:e=0,y:t=0,payload:n}){let r=Array.from(String(n?.value||``)),i=[];for(let e=0;e<r.length;e+=16)i.push(r.slice(e,e+16).join(``));return(0,W.jsx)(`g`,{transform:`translate(${e},${t+10}) rotate(-45)`,children:(0,W.jsx)(`text`,{textAnchor:`end`,fill:`var(--omni-muted,var(--omni-chart-primary,#91abc5))`,fontSize:10,children:i.map((e,t)=>(0,W.jsx)(`tspan`,{x:0,dy:t?12:0,children:e},t))})})}function ue({categories:e,shops:t,metric:n,onCategory:r,selectedCategory:i,selectedShop:a}){let[o,s]=(0,j.useState)(!1),{plot:c,view:l,indices:u,update:d}=ce(e.map(e=>e.id).join(`,`),e.length,!o),{start:f,end:p,count:m}=u;function h(t){d(n=>B(n,t*m,e.length))}let g=q.find(e=>e.key===n),_=e.map(e=>({id:e.id,name:e.name,...Object.fromEntries(t.map(t=>[t.id,e.shops.find(e=>e.shopId===t.id)?.[n]??null]))})),v=_.slice(f,p);return(0,W.jsxs)(`section`,{className:I.panel,"aria-label":g.label+`品类对比`,children:[(0,W.jsxs)(`div`,{className:I.panelHeading,children:[(0,W.jsxs)(`h2`,{children:[g.label,(0,W.jsxs)(`small`,{children:[g.unit,` · 点击类目筛选商品`]})]}),(0,W.jsx)(`button`,{"aria-pressed":o,onClick:()=>s(!o),children:o?`查看图表`:`数据对比`})]}),o?(0,W.jsx)(`div`,{className:I.horizontal,children:(0,W.jsxs)(`table`,{children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{children:`叶子类目`}),t.map((e,t)=>(0,W.jsxs)(`th`,{children:[(0,W.jsx)(`i`,{style:{background:K[t]}}),e.name]},e.id))]})}),(0,W.jsx)(`tbody`,{children:(0,W.jsx)(b,{items:e||[],columns:t.length+1,children:e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{children:(0,W.jsx)(`button`,{className:I.link,onClick:()=>r(e.id),children:e.name})}),t.map(t=>(0,W.jsx)(`td`,{children:J(e.shops.find(e=>e.shopId===t.id)?.[n])},t.id))]},e.id)})})]})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:I.chartRange,children:[(0,W.jsxs)(`span`,{children:[`第 `,_.length?f+1:0,`–`,p,` 项 / 共 `,_.length,` 项`]}),_.length>12&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{onClick:()=>h(-1),disabled:f===0,children:`上一组`}),(0,W.jsx)(`button`,{onClick:()=>h(1),disabled:p===_.length,children:`下一组`}),(0,W.jsx)(`button`,{"aria-pressed":m===_.length,onClick:()=>d(()=>({start:0,size:_.length})),children:`显示全部`}),(0,W.jsx)(`button`,{"aria-pressed":m===Math.min(24,_.length),onClick:()=>d(()=>z(_.length)),children:`紧凑视图`}),(0,W.jsx)(`span`,{children:`滚轮 / 双指滑动平移 · Ctrl+滚轮 / 双指捏合缩放`})]})]}),(0,W.jsx)(`div`,{ref:c,className:I.chart,"aria-label":`品类图表,可滚轮平移及缩放`,children:(0,W.jsx)(T,{width:`100%`,height:`100%`,children:(0,W.jsxs)(A,{data:v,margin:{top:12,right:18,bottom:12,left:30},barCategoryGap:`12%`,barGap:2,accessibilityLayer:!0,children:[(0,W.jsx)(E,{stroke:`var(--omni-line,var(--omni-chart-track,#29445f))`,vertical:!1}),(0,W.jsx)(D,{dataKey:`name`,interval:0,height:145,tick:(0,W.jsx)(le,{})}),(0,W.jsx)(w,{tick:{fontSize:10,fill:`var(--omni-muted,#91abc5)`},tickFormatter:e=>n===`sales`||n===`efficiency`?Y(e):J(e,0),width:70}),(0,W.jsx)(C,{cursor:{fill:`var(--omni-panel,#132d49)`,opacity:.4},contentStyle:{background:`var(--omni-bg,#0a1524)`,border:`1px solid var(--omni-line,#29445f)`,borderRadius:8},formatter:e=>[J(typeof e==`number`?e:null)+` `+g.unit]}),(0,W.jsx)(k,{verticalAlign:`top`,height:34,wrapperStyle:{fontSize:12}}),t.map((e,t)=>(0,W.jsx)(ne,{isAnimationActive:!1,dataKey:e.id,name:e.name,fill:K[t],maxBarSize:28,radius:[3,3,0,0],onClick:t=>{let n=v[t.originalDataIndex];n&&r(n.id,e.id)},children:v.map(t=>(0,W.jsx)(te,{fillOpacity:i&&i===t.id&&(!a||a===e.id)?1:i?.7:1,stroke:i===t.id&&(!a||a===e.id)?`var(--omni-text,var(--omni-chart-primary,#dceaf7))`:void 0,strokeWidth:2},t.id))},e.id))]})})}),_.length>3&&(0,W.jsx)(G,{view:l,total:_.length,onChange:d})]}),(0,W.jsx)(`p`,{className:I.note,children:`链接效率=上榜商品销售额 ÷ 去重上榜链接数。浏览量为来源浏览次数;缺失值显示 —。`})]})}function de({query:e,onClose:t}){let n=(0,j.useRef)(null),r=F({...e,view:`analysis-trend`});return(0,j.useEffect)(()=>{let e=document.activeElement;return n.current?.showModal(),()=>e?.focus()},[]),(0,oe.createPortal)((0,W.jsxs)(`dialog`,{ref:n,className:I.dialog,onCancel:e=>{e.preventDefault(),t()},onClick:e=>{e.target===e.currentTarget&&t()},"aria-label":`销售走势`,children:[(0,W.jsxs)(`div`,{className:I.panelHeading,children:[(0,W.jsx)(`h2`,{children:r.data?.title||`销售走势`}),(0,W.jsx)(`button`,{autoFocus:!0,onClick:t,"aria-label":`关闭走势`,children:(0,W.jsx)(_,{size:18})})]}),r.loading?(0,W.jsx)(`p`,{role:`status`,children:`正在读取走势…`}):r.error?(0,W.jsx)(`p`,{role:`alert`,children:r.error}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:I.trendChart,children:(0,W.jsx)(T,{width:`100%`,height:`100%`,children:(0,W.jsxs)(ee,{data:r.data?.points,margin:{top:20,right:15,bottom:12,left:12},children:[(0,W.jsx)(E,{stroke:`var(--omni-line,var(--omni-chart-track,#29445f))`,vertical:!1}),(0,W.jsx)(D,{dataKey:`month`,tick:{fontSize:10}}),(0,W.jsx)(w,{tickFormatter:Y,tick:{fontSize:10},width:70}),(0,W.jsx)(C,{contentStyle:{background:`var(--omni-bg,#0a1524)`,border:`1px solid var(--omni-line,#29445f)`},formatter:e=>[Y(typeof e==`number`?e:null),`销售额(元)`]}),(0,W.jsx)(O,{dataKey:`sales`,name:`销售额`,stroke:K[0],strokeWidth:2,dot:{r:3},connectNulls:!1})]})})}),(0,W.jsx)(`p`,{className:I.note,children:r.data?.notice})]})]}),document.body)}var X=[[`shop`,`店铺`],[`category`,`叶子类目`],[`sales`,`销售额`],[`salesYoy`,`销售额同比`],[`salesMom`,`销售额环比`],[`views`,`浏览量`],[`units`,`成交件数`],[`unitPrice`,`件单价`],[`marketShare`,`市占率`],[`trends`,`走势`]],Z=new Set([`sales`,`salesYoy`,`salesMom`,`views`,`units`,`unitPrice`,`marketShare`]);function Q(e,t=!1){try{let n=new URL(e||``);return n.protocol===`https:`&&(t?n.hostname.endsWith(`.alicdn.com`):/\.(taobao|tmall)\.com$/.test(n.hostname))?n.href:void 0}catch{return}}function $({row:e}){let t=Q(e.imageUrl,!0);return t?(0,W.jsx)(`img`,{src:t,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`}):(0,W.jsx)(`span`,{className:I.noImage,children:`商品`})}function fe({config:t,layout:n,taxonomy:r,onChange:i,onTrend:a}){let[u,d]=(0,j.useState)(1),[p,m]=(0,j.useState)(t.q),[h,g]=(0,j.useState)(!1),_=[t.month,t.recentYear,t.category,t.shopFilter,t.q,t.sort,t.direction,t.shops.join(`,`)].join(`:`),[v,y]=(0,j.useState)(_),x=_===v?u:1,C=F({view:`analysis-items`,month:t.month,recentYear:String(t.recentYear),shops:t.shops.join(`,`),category:t.category,shopFilter:t.shopFilter,q:t.q,sort:t.sort,direction:t.direction,page:String(x),pageSize:`25`}),w=X.filter(([e])=>t.columns.includes(e)),T=new Set(n.categories.flatMap(e=>S(r,e.id).map(e=>e.id))),E=r.filter(e=>T.has(e.id)).map(e=>({id:e.id,name:S(r,e.id).map(e=>e.name).join(` / `)})).sort((e,t)=>e.name.localeCompare(t.name,`zh-CN`));function D(e,n){a({kind:n,product:e.id,category:e.categoryId,shops:t.shops.join(`,`),shopFilter:e.shopId,month:t.month})}function O(e,t){if(t===`shop`)return e.shopName;if(t===`category`)return S(r,e.categoryId).map(e=>e.name).join(` / `)||e.categoryName;if(t===`trends`)return(0,W.jsxs)(`span`,{className:I.inline,children:[(0,W.jsx)(`button`,{className:I.link,onClick:()=>D(e,`product`),children:`商品`}),(0,W.jsx)(`button`,{className:I.link,onClick:()=>D(e,`category`),children:`类目`})]});let n=e[t];return typeof n==`number`?t===`sales`||t===`unitPrice`?Y(n):[`salesYoy`,`salesMom`,`marketShare`].includes(t)?J(n)+`%`:J(n,0):`—`}let k=(e,t=!0)=>(0,W.jsxs)(`div`,{className:I.product,children:[t&&(0,W.jsx)($,{row:e}),(0,W.jsxs)(`div`,{children:[Q(e.url)?(0,W.jsx)(`a`,{href:Q(e.url),target:`_blank`,rel:`noreferrer`,children:e.name}):(0,W.jsx)(`b`,{children:e.name}),(0,W.jsxs)(`small`,{children:[`ID `,e.id,` · 原榜 `,e.sourceRank==null?`—`:`#`+e.sourceRank,e.conflicting?` · 指标冲突,保留为空`:``]})]})]});return(0,W.jsxs)(`section`,{className:I.panel,"aria-label":`上榜商品链接列表`,children:[(0,W.jsxs)(`div`,{className:I.panelHeading,children:[(0,W.jsxs)(`h2`,{children:[`上榜商品链接`,(0,W.jsxs)(`small`,{children:[J(C.data?.total,0),` 条`]})]}),(0,W.jsxs)(`div`,{className:I.inline,children:[(0,W.jsx)(`button`,{"aria-label":`商品大图`,"aria-pressed":t.productView===`grid`,onClick:()=>i({productView:`grid`}),children:(0,W.jsx)(c,{size:14})}),(0,W.jsx)(`button`,{"aria-label":`商品列表`,"aria-pressed":t.productView===`list`,onClick:()=>i({productView:`list`}),children:(0,W.jsx)(l,{size:14})}),(0,W.jsxs)(`button`,{"aria-expanded":h,onClick:()=>g(!h),children:[(0,W.jsx)(ae,{size:14}),`表格配置`]})]})]}),(0,W.jsxs)(`div`,{className:I.filters,children:[(0,W.jsxs)(`label`,{children:[`类目`,(0,W.jsxs)(`select`,{"aria-label":`上榜商品类目筛选`,value:T.has(t.category)?t.category:``,onChange:e=>i({category:e.target.value}),children:[(0,W.jsx)(`option`,{value:``,children:`全部上榜类目`}),E.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,W.jsxs)(`label`,{children:[`店铺`,(0,W.jsxs)(`select`,{"aria-label":`上榜商品店铺筛选`,value:t.shopFilter,onChange:e=>i({shopFilter:e.target.value}),children:[(0,W.jsx)(`option`,{value:``,children:`全部对比店铺`}),n.shops.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,W.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i({q:p.trim()})},children:[(0,W.jsx)(f,{size:14}),(0,W.jsx)(`input`,{"aria-label":`搜索上榜商品`,value:p,onChange:e=>m(e.target.value),placeholder:`商品名称 / ID`,maxLength:100}),(0,W.jsx)(`button`,{type:`submit`,children:`搜索`})]}),t.category&&(0,W.jsx)(`button`,{className:I.link,onClick:()=>i({category:``}),children:`清除类目筛选`})]}),h&&(0,W.jsxs)(`fieldset`,{className:I.columnOptions,children:[(0,W.jsx)(`legend`,{children:`显示字段`}),X.map(([e,n])=>(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:t.columns.includes(e),onChange:n=>i({columns:n.target.checked?[...t.columns,e]:t.columns.filter(t=>t!==e)})}),n]},e))]}),C.loading?(0,W.jsx)(`div`,{className:I.empty,role:`status`,children:`正在读取上榜商品…`}):C.error?(0,W.jsx)(`div`,{className:I.error,role:`alert`,children:C.error}):C.data?.rows.length?t.productView===`grid`?(0,W.jsx)(`div`,{className:I.productCards,children:(0,W.jsx)(b,{items:C.data.rows||[],children:e=>(0,W.jsxs)(`article`,{tabIndex:0,"aria-label":e.name,children:[(0,W.jsx)(`div`,{className:I.cardImage,children:(0,W.jsx)($,{row:e})}),(0,W.jsxs)(`div`,{className:I.cardDetails,children:[k(e,!1),(0,W.jsx)(`dl`,{children:w.map(([t,n])=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:n}),(0,W.jsx)(`dd`,{children:O(e,t)})]},t))})]})]},`${e.shopId}:${e.categoryId}:${e.id}`)})}):(0,W.jsx)(`div`,{className:I.horizontal,children:(0,W.jsxs)(`table`,{children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{children:`序号`}),(0,W.jsx)(`th`,{children:`商品`}),w.map(([n,r])=>(0,W.jsx)(`th`,{children:Z.has(n)?(0,W.jsxs)(`button`,{className:I.sort,onClick:()=>i({sort:n,direction:t.sort===n&&t.direction===`desc`?`asc`:`desc`}),children:[r,t.sort===n&&(t.direction===`desc`?(0,W.jsx)(e,{size:12}):(0,W.jsx)(ie,{size:12}))]}):r},n))]})}),(0,W.jsx)(`tbody`,{children:(0,W.jsx)(b,{items:C.data.rows||[],columns:w.length+2,children:(e,t)=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{children:(C.data.page-1)*25+t+1}),(0,W.jsx)(`td`,{children:k(e)}),w.map(([t])=>(0,W.jsx)(`td`,{className:t===`category`?I.categoryCell:void 0,children:O(e,t)},t))]},`${e.shopId}:${e.categoryId}:${e.id}`)})})]})}):(0,W.jsx)(`div`,{className:I.empty,children:`当前筛选下暂无已完成入库的上榜商品。`}),C.data&&(0,W.jsxs)(`div`,{className:I.pagination,children:[(0,W.jsx)(`span`,{children:C.data.notice}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`button`,{"aria-label":`上榜商品上一页`,disabled:C.data.page<=1,onClick:()=>{y(_),d(C.data.page-1)},children:(0,W.jsx)(o,{size:15})}),(0,W.jsxs)(`span`,{children:[C.data.page,` / `,Math.max(1,Math.ceil(C.data.total/25))]}),(0,W.jsx)(`button`,{"aria-label":`上榜商品下一页`,disabled:C.data.page*25>=C.data.total,onClick:()=>{y(_),d(C.data.page+1)},children:(0,W.jsx)(s,{size:15})})]})]})]})}function pe({month:e,selected:t,onAdd:n,onClose:r}){let[i,a]=(0,j.useState)(``),[o,s]=(0,j.useState)(``),[c,l]=(0,j.useState)(`search`),d=(0,j.useRef)(null),p=(0,j.useRef)(null),m=F(o?{view:`shop-search`,month:e,q:o}:null);return(0,j.useEffect)(()=>{let e=document.activeElement;return d.current?.showModal(),p.current?.focus(),()=>e?.focus()},[]),(0,W.jsxs)(`dialog`,{ref:d,className:I.dialog,onCancel:e=>{e.preventDefault(),r()},onClick:e=>{e.target===e.currentTarget&&r()},"aria-label":`添加对比店铺`,children:[(0,W.jsxs)(`div`,{className:I.panelHeading,children:[(0,W.jsx)(`h2`,{children:`添加对比店铺`}),(0,W.jsx)(`button`,{"aria-label":`关闭店铺搜索`,onClick:r,children:(0,W.jsx)(_,{size:18})})]}),(0,W.jsx)(`p`,{className:I.note,children:`最多对比 3 家店铺,搜索范围为企业获准类目。`}),(0,W.jsxs)(`div`,{className:I.inline,"aria-label":`店铺选择来源`,children:[(0,W.jsx)(`button`,{"aria-pressed":c===`search`,onClick:()=>l(`search`),children:`搜索店铺`}),(0,W.jsx)(`button`,{"aria-pressed":c===`favorites`,onClick:()=>l(`favorites`),children:`我的收藏`})]}),c===`favorites`?(0,W.jsx)(re,{kind:`shop`,selectedIds:t,onSelect:e=>{let t=e.record;t?.id&&n({id:t.id,name:t.name||t.id})}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`form`,{className:I.searchForm,onSubmit:e=>{e.preventDefault(),s(i.trim())},children:[(0,W.jsx)(f,{size:16}),(0,W.jsx)(`input`,{ref:p,"aria-label":`搜索对比店铺`,value:i,onChange:e=>a(e.target.value),maxLength:100,placeholder:`输入店铺名称或店铺 ID`}),(0,W.jsx)(`button`,{type:`submit`,disabled:!i.trim()||m.loading,children:`搜索`})]}),m.loading?(0,W.jsx)(`p`,{role:`status`,children:`正在搜索店铺…`}):m.error?(0,W.jsx)(`p`,{role:`alert`,className:I.error,children:m.error}):o&&(0,W.jsx)(`div`,{className:I.searchResults,children:m.data?.shops.length?m.data.shops.map(e=>(0,W.jsxs)(`button`,{disabled:t.includes(e.id),onClick:()=>n(e),children:[(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`b`,{children:e.name}),(0,W.jsxs)(`small`,{children:[`ID `,e.id]})]}),t.includes(e.id)?`已添加`:(0,W.jsx)(u,{size:16})]},e.id)):(0,W.jsx)(`p`,{children:`当前月份未找到匹配店铺,可尝试店铺编号或其他月份。`})})]})]})}function me({analysis:e,bootstrap:n,onBack:r}){let i=P(e),c=i.config,[l,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(0),[g,v]=(0,j.useState)(null),[y,x]=(0,j.useState)(!1),C=F(c.shops.length?{view:`shop-layout`,month:c.month,recentYear:String(c.recentYear),shops:c.shops.join(`,`)}:null,m),w=C.data,T=w?.categories.map(e=>({...e,name:S(n.categories,e.id).map(e=>e.name).join(` / `)||e.name}))||[],E=n.months.indexOf(c.month);async function D(){x(!0);try{await i.flush(),r()}catch{x(!1)}}function O(e){v({kind:`shop`,month:c.month,shops:c.shops.join(`,`),shopFilter:e.id})}return(0,W.jsxs)(`div`,{className:I.root,children:[(0,W.jsxs)(`header`,{className:I.editorHeader,children:[(0,W.jsxs)(`div`,{className:I.editorIdentity,children:[(0,W.jsx)(`button`,{"aria-label":`返回我的分析`,onClick:()=>void D(),disabled:y,children:(0,W.jsx)(t,{size:16})}),(0,W.jsx)(`input`,{"aria-label":`分析名称`,className:I.nameInput,value:i.name,maxLength:80,onChange:e=>i.setName(e.target.value),onBlur:()=>void i.flush().catch(()=>{})}),(0,W.jsx)(`span`,{className:I.saveStatus,role:`status`,children:i.error?`保存失败`:i.saving?`保存中…`:i.dirty?`待保存`:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(a,{size:12}),`已自动保存`]})})]}),(0,W.jsxs)(`div`,{className:I.editorTools,children:[(0,W.jsx)(`button`,{"aria-pressed":c.recentYear,onClick:()=>i.change({recentYear:!c.recentYear}),children:`最近一年`}),(0,W.jsx)(`button`,{"aria-label":`上一数据月份`,disabled:E<=0,onClick:()=>i.change({month:n.months[E-1]}),children:(0,W.jsx)(o,{size:15})}),(0,W.jsx)(`select`,{"aria-label":`分析统计月份`,value:c.month,onChange:e=>i.change({month:e.target.value}),children:n.months.map(e=>(0,W.jsx)(`option`,{children:e},e))}),(0,W.jsx)(`button`,{"aria-label":`下一数据月份`,disabled:E<0||E>=n.months.length-1,onClick:()=>i.change({month:n.months[E+1]}),children:(0,W.jsx)(s,{size:15})}),(0,W.jsx)(`button`,{onClick:()=>void D(),disabled:y,children:`我的分析`}),(0,W.jsx)(`button`,{"aria-label":`刷新分析数据`,onClick:()=>h(e=>e+1),children:(0,W.jsx)(d,{size:15})})]})]}),i.error&&(0,W.jsxs)(`p`,{role:`alert`,className:I.error,children:[i.error,(0,W.jsx)(`button`,{onClick:()=>void i.flush().catch(()=>{}),children:`重试保存`})]}),(0,W.jsxs)(`section`,{className:I.panel,"aria-label":`分析店铺汇总`,children:[(0,W.jsxs)(`div`,{className:I.panelHeading,children:[(0,W.jsxs)(`h2`,{children:[`品类分析`,(0,W.jsxs)(`small`,{children:[c.shops.length,` / 3 家店铺 · `,c.recentYear?`近 12 个月`:`所选月份`]})]}),c.shops.length<3&&(0,W.jsxs)(`button`,{className:I.primary,onClick:()=>p(!0),children:[(0,W.jsx)(u,{size:15}),`添加对比店铺`]})]}),c.shops.length?C.loading?(0,W.jsx)(`p`,{role:`status`,className:I.empty,children:`正在查询店铺品类数据…`}):C.error?(0,W.jsx)(`p`,{role:`alert`,className:I.error,children:C.error}):w&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:I.horizontal,children:(0,W.jsxs)(`table`,{className:I.summaryTable,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{children:`店铺`}),(0,W.jsx)(`th`,{children:`销售走势`}),(0,W.jsx)(`th`,{children:`所在地`}),(0,W.jsx)(`th`,{children:`类型`}),(0,W.jsx)(`th`,{children:`店铺上榜销售额`}),(0,W.jsx)(`th`,{children:`上榜链接销售额`}),(0,W.jsx)(`th`,{children:`上榜叶子类目`}),(0,W.jsx)(`th`,{children:`上榜商品链接`}),(0,W.jsx)(`th`,{})]})}),(0,W.jsx)(`tbody`,{children:(0,W.jsx)(b,{items:w.shops||[],columns:9,children:(e,t)=>(0,W.jsxs)(`tr`,{children:[(0,W.jsxs)(`td`,{children:[(0,W.jsxs)(`div`,{className:I.shopName,children:[(0,W.jsx)(`i`,{style:{background:K[t]}}),(0,W.jsx)(`b`,{children:e.name})]}),(0,W.jsxs)(`small`,{children:[`ID `,e.id,c.recentYear?` · 店铺榜覆盖 ${e.availableMonths} 个月`:``]})]}),(0,W.jsx)(`td`,{children:(0,W.jsx)(`button`,{className:I.link,onClick:()=>O(e),children:`查看`})}),(0,W.jsx)(`td`,{children:e.location||`—`}),(0,W.jsx)(`td`,{children:e.shopType||`—`}),(0,W.jsx)(`td`,{children:Y(e.summary.sales)}),(0,W.jsx)(`td`,{children:Y(e.summary.productSales)}),(0,W.jsx)(`td`,{children:e.categoryCount}),(0,W.jsx)(`td`,{children:J(e.summary.itemCount,0)}),(0,W.jsx)(`td`,{children:(0,W.jsx)(`button`,{"aria-label":`移除${e.name}`,onClick:()=>i.change({shops:c.shops.filter(t=>t!==e.id),category:``,shopFilter:``}),children:(0,W.jsx)(_,{size:14})})})]},e.id)})})]})}),(0,W.jsx)(`p`,{className:I.note,children:w.notice})]}):(0,W.jsxs)(`div`,{className:I.empty,children:[(0,W.jsx)(f,{size:28}),(0,W.jsx)(`h3`,{children:`从一家店铺开始分析`}),(0,W.jsx)(`p`,{children:`添加店铺后查看上榜销售表现、品类布局和商品链接。`}),(0,W.jsx)(`button`,{className:I.primary,onClick:()=>p(!0),children:`添加首家店铺`})]})]}),w&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:I.metricBar,role:`group`,"aria-label":`品类对比指标`,children:[q.map(e=>(0,W.jsx)(`button`,{"aria-pressed":c.metric===e.key,onClick:()=>i.change({metric:e.key}),children:e.label},e.key)),(0,W.jsxs)(`span`,{children:[T.length,` 个上榜叶子类目`]})]}),T.length?(0,W.jsx)(ue,{categories:T,shops:w.shops,metric:c.metric,selectedCategory:c.category,selectedShop:c.shopFilter,onCategory:(e,t)=>i.change({category:e,shopFilter:t||``})},c.shops.join(`,`)+c.month+c.recentYear):(0,W.jsx)(`div`,{className:I.empty,children:`所选月份及权限范围内暂无可展示的上榜叶子类目。`}),(0,W.jsx)(fe,{config:c,layout:w,taxonomy:n.categories,onChange:i.change,onTrend:v})]}),l&&(0,W.jsx)(pe,{month:c.month,selected:c.shops,onClose:()=>p(!1),onAdd:e=>{i.change({shops:[...c.shops,e.id],category:``,shopFilter:``}),i.name===`未命名分析`&&i.setName(e.name+`品类分析`),p(!1)}}),g&&(0,W.jsx)(de,{query:g,onClose:()=>v(null)})]})}function he({launch:e,onConsumeLaunch:t}){let[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)([]),[l,d]=(0,j.useState)(null),[f,p]=(0,j.useState)(!0),[m,h]=(0,j.useState)(``),[g,_]=(0,j.useState)(!1),[v,y]=(0,j.useState)(0),b=(0,j.useRef)(``);(0,j.useEffect)(()=>{let e=new AbortController;return Promise.all([x.bootstrap(e.signal),x.analyses(e.signal)]).then(([t,n])=>{e.signal.aborted||(o(t),c(n.analyses),h(``),p(!1))}).catch(t=>{e.signal.aborted||(h(t instanceof Error?t.message:`分析记录读取失败`),p(!1))}),()=>e.abort()},[v]),(0,j.useEffect)(()=>{if(!e||!a||b.current===e.id)return;b.current=e.id;let n={...M(e.month),shops:[e.shop.id]};x.saveAnalysis({id:e.id,name:e.shop.name+`品类分析`,config:n,revision:0}).then(e=>{d(e),t?.()}).catch(e=>h(e instanceof Error?e.message:`创建分析失败`))},[e,a,t]);async function S(){if(!(!a?.latestMonth||g)){_(!0),h(``);try{d(await x.saveAnalysis({id:crypto.randomUUID(),name:`未命名分析`,config:M(a.latestMonth),revision:0}))}catch(e){h(e instanceof Error?e.message:`创建分析失败`)}finally{_(!1)}}}return l&&a?(0,W.jsx)(me,{analysis:l,bootstrap:a,onBack:()=>{d(null),y(e=>e+1)}},l.id):(0,W.jsxs)(`main`,{className:I.root,children:[(0,W.jsxs)(`header`,{className:I.historyHeader,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:I.eyebrow,children:`市场大盘 / 我的分析`}),(0,W.jsx)(`h1`,{children:`店铺品类布局`}),(0,W.jsx)(`p`,{children:`从历史分析继续,或新建一份店铺对比。`})]}),(0,W.jsxs)(`button`,{className:I.primary,onClick:()=>void S(),disabled:f||g||!a?.latestMonth,children:[(0,W.jsx)(u,{size:16}),g?`正在创建…`:`新建分析`]})]}),m&&(0,W.jsxs)(`div`,{className:I.error,role:`alert`,children:[m,(0,W.jsx)(`button`,{onClick:()=>y(e=>e+1),children:`重新读取`})]}),(0,W.jsxs)(`section`,{className:I.history,"aria-label":`历史分析记录`,children:[(0,W.jsxs)(`div`,{className:I.panelHeading,children:[(0,W.jsxs)(`h2`,{children:[(0,W.jsx)(r,{size:16}),`历史分析`,(0,W.jsxs)(`small`,{children:[s.length,` 份`]})]}),(0,W.jsx)(`span`,{className:I.note,children:`方案按当前账号自动保存`})]}),f?(0,W.jsx)(`p`,{role:`status`,className:I.empty,children:`正在读取历史分析…`}):s.length?(0,W.jsx)(`div`,{className:I.historyList,children:s.map(e=>(0,W.jsxs)(`button`,{onClick:()=>d(e),children:[(0,W.jsx)(`span`,{className:I.historyIcon,children:(0,W.jsx)(i,{size:21})}),(0,W.jsxs)(`span`,{className:I.historyTitle,children:[(0,W.jsx)(`b`,{children:e.name}),(0,W.jsxs)(`small`,{children:[e.config.month,` · `,e.config.recentYear?`近一年 · `:``,e.config.shops.length?`${e.config.shops.length} 家店铺`:`尚未添加店铺`,` · `,q.find(t=>t.key===e.config.metric)?.label]})]}),(0,W.jsx)(`time`,{children:new Date(e.updatedAt).toLocaleString(`zh-CN`,{timeZone:`Asia/Shanghai`,hour12:!1})}),(0,W.jsx)(n,{size:16})]},e.id))}):!m&&(0,W.jsxs)(`div`,{className:I.emptyHistory,children:[(0,W.jsx)(i,{size:35}),(0,W.jsx)(`h3`,{children:`还没有历史分析`}),(0,W.jsx)(`p`,{children:`新建分析后添加店铺,逐步查看品类和上榜商品。`})]})]})]})}export{he as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as e,o as t,y as n}from"./index-DLSVWUSu.js";import{n as r}from"./format-DL7i7_eV.js";import{t as i}from"./market.module-VpU4XmGg.js";import{$ as a,A as o,Dt as s,E as c,Et as l,I as u,K as d,Lt as f,M as p,N as m,O as h,Ot as g,St as _,U as v,Ut as y,Vt as b,W as x,X as S,Z as ee,_ as C,a as w,b as T,bt as te,c as E,d as D,dt as O,f as k,ft as A,g as ne,h as re,ht as j,i as ie,jt as ae,k as oe,kt as M,l as se,lt as N,m as ce,n as le,o as ue,ot as P,pt as F,q as de,r as fe,rt as I,t as pe,u as me,ut as he,v as ge,vt as L,y as _e,z as ve,zt as ye}from"./CartesianChart-CP7p2vlm.js";import{n as R,r as be,t as xe}from"./getRadiusAndStrokeWidthFromDot-bv_ksZ7y.js";import{n as z,t as B}from"./graphicalItemSelectors-CJfZ6cht.js";var V=(e,t,n)=>c(e,`xAxis`,B(e,t),n),H=(e,t,n)=>oe(e,`xAxis`,B(e,t),n),U=(e,t,n)=>c(e,`yAxis`,z(e,t),n),W=(e,t,n)=>oe(e,`yAxis`,z(e,t),n),Se=L([S,V,U,H,W],(e,t,n,r,i)=>F(e,`xAxis`)?P(t,r,!1):P(n,i,!1)),G=L([o,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),K=e=>F(S(e),`xAxis`)?`yAxis`:`xAxis`,Ce=(e,t)=>K(e)===`yAxis`?z(e,t):B(e,t),we=L([S,V,U,H,W,L([G,(e,t,n)=>h(e,K(e),Ce(e,t),n)],(e,t)=>{if(!(e==null||t==null)){var{stackId:n}=e,r=p(e);if(!(n==null||r==null)){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),ve,Se,G,u],(e,t,n,r,i,a,o,s,c,l)=>{var{chartData:u,dataStartIndex:d,dataEndIndex:f}=o;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var{data:p}=c,m=p&&p.length>0?p:u?.slice(d,f+1);if(m!=null)return Ge({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:d,areaSettings:c,stackedData:a,displayedData:m,chartBaseValue:l,bandSize:s})}}),q=n(e()),Te=[`id`],Ee=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J.apply(null,arguments)}function Y(e,t){if(e==null)return{};var n,r,i=De(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function De(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?X(Object(n),!0).forEach(function(t){Oe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Oe(e,t,n){return(t=ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ke(e){var t=Ae(e,`string`);return typeof t==`symbol`?t:t+``}function Ae(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Q(e,t){return e&&e!==`none`?e:t}var je=e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:Q(r,i),value:O(n,t),payload:e}]},Me=q.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:ae,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:O(o,t),hide:s,type:l,color:Q(r,a),unit:c,graphicalItemId:u}};return q.createElement(k,{tooltipEntrySettings:d})});function Ne(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=b(r);return q.createElement(be,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function Pe(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return q.createElement(re,{value:t?i:void 0},n)}function Fe(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:c,connectNulls:l,isRange:u}=a,{id:p}=a,m=Y(a,Te),h=b(m),g=ye(m);return q.createElement(q.Fragment,null,t?.length>1&&q.createElement(f,{clipPath:r?`url(#clipPath-${i})`:void 0},q.createElement(d,J({},g,{id:p,points:t,connectNulls:l,type:s,baseLine:n,layout:o,stroke:`none`,className:`recharts-area-area`})),c!==`none`&&q.createElement(d,J({},h,{className:`recharts-area-curve`,layout:o,type:s,connectNulls:l,fill:`none`,points:t})),c!==`none`&&u&&Array.isArray(n)&&q.createElement(d,J({},h,{className:`recharts-area-curve`,layout:o,type:s,connectNulls:l,fill:`none`,points:n}))),q.createElement(Ne,{points:t,props:m,clipPathId:i}))}function Ie(e){var{alpha:t,baseLine:n,points:r,strokeWidth:i}=e,a=r[0]?.y,o=r[r.length-1]?.y;if(!j(a)||!j(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return M(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),M(c)?q.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function Le(e){var{alpha:t,baseLine:n,points:r,strokeWidth:i}=e,a=r[0]?.x,o=r[r.length-1]?.x;if(!j(a)||!j(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.y||0));return M(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),M(c)?q.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function Re(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return n===`vertical`?q.createElement(Ie,{alpha:t,points:r,baseLine:i,strokeWidth:a}):q.createElement(Le,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function ze(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:o,baseLine:c,isAnimationActive:u,animationBegin:d,animationDuration:p,animationEasing:m,onAnimationStart:h,onAnimationEnd:_}=r,y=v((0,q.useMemo)(()=>({points:o,baseLine:c}),[o,c]),`recharts-area-`),b=ee(),[S,C]=(0,q.useState)(!1),w=!S,T=(0,q.useCallback)(()=>{typeof _==`function`&&_(),C(!1)},[_]),te=(0,q.useCallback)(()=>{typeof h==`function`&&h(),C(!0)},[h]);if(b==null)return null;var E=i.current,D=a.current;return q.createElement(Pe,{showLabels:w,points:o},r.children,q.createElement(x,{animationId:y,begin:d,duration:p,isActive:u,easing:m,onAnimationEnd:T,onAnimationStart:te,key:y},e=>{if(E){var d=E.length/o.length,p=e===1?o:o.map((t,n)=>{var r=Math.floor(n*d);if(E[r]){var i=E[r];return Z(Z({},t),{},{x:l(i.x,t.x,e),y:l(i.y,t.y,e)})}return t}),m=M(c)?l(D,c,e):g(c)||s(c)?l(D,0,e):c.map((t,n)=>{var r=Math.floor(n*d);if(Array.isArray(D)&&D[r]){var i=D[r];return Z(Z({},t),{},{x:l(i.x,t.x,e),y:l(i.y,t.y,e)})}return t});return e>0&&(i.current=p,a.current=m),q.createElement(Fe,{points:p,baseLine:m,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=c),q.createElement(f,null,u&&q.createElement(`defs`,null,q.createElement(`clipPath`,{id:`animationClipPath-${n}`},q.createElement(Re,{alpha:e,points:o,baseLine:c,layout:b,strokeWidth:r.strokeWidth}))),q.createElement(f,{clipPath:`url(#animationClipPath-${n})`},q.createElement(Fe,{points:o,baseLine:c,needClip:t,clipPathId:n,props:r})))}),q.createElement(ne,{label:r.label}))}function Be(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,q.useRef)(null),a=(0,q.useRef)();return q.createElement(ze,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var Ve=class extends q.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:c,width:l,height:u,id:d,baseLine:p,zIndex:m}=this.props;if(e)return null;var h=y(`recharts-area`,r),g=d,{r:_,strokeWidth:v}=xe(t),b=ce(t),x=_*2+v,S=o?`url(#clipPath-${b?``:`dots-`}${g})`:void 0;return q.createElement(_e,{zIndex:m},q.createElement(f,{className:h},o&&q.createElement(`defs`,null,q.createElement(ie,{clipPathId:g,xAxisId:s,yAxisId:c}),!b&&q.createElement(`clipPath`,{id:`clipPath-dots-${g}`},q.createElement(`rect`,{x:a-x/2,y:i-x/2,width:l+x,height:u+x}))),q.createElement(Be,{needClip:o,clipPathId:g,props:this.props})),q.createElement(R,{points:n,mainColor:Q(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}),this.props.isRange&&Array.isArray(p)&&q.createElement(R,{points:p,mainColor:Q(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}))}},He={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,xAxisId:0,yAxisId:0,zIndex:m.area};function Ue(e){var{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,connectNulls:o,dot:s,fill:c,fillOpacity:l,hide:u,isAnimationActive:d,legendType:f,stroke:p,xAxisId:m,yAxisId:h}=e,g=Y(e,Ee),_=a(),v=T(),{needClip:y}=w(m,h),b=I(),{points:x,isRange:S,baseLine:ee}=te(t=>we(t,e.id,b))??{},C=E();if(_!==`horizontal`&&_!==`vertical`||C==null||v!==`AreaChart`&&v!==`ComposedChart`)return null;var{height:D,width:O,x:k,y:A}=C;return!x||!x.length?null:q.createElement(Ve,J({},g,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:ee,connectNulls:o,dot:s,fill:c,fillOpacity:l,height:D,hide:u,layout:_,isAnimationActive:d,isRange:S,legendType:f,needClip:y,points:x,stroke:p,width:O,left:k,top:A,xAxisId:m,yAxisId:h}))}var We=(e,t,n,r,i)=>{var a=n??t;if(M(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function Ge(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:s,yAxis:c,displayedData:l,dataStartIndex:u,xAxisTicks:d,yAxisTicks:f,bandSize:p}=e,m=i&&i.length,h=We(a,o,n,s,c),g=a===`horizontal`,_=!1,v=l.map((e,n)=>{var a;if(m)a=i[u+n];else{var o=A(e,r);Array.isArray(o)?(a=o,_=!0):a=[h,o]}var l=a?.[1]??null,v=l==null||m&&!t&&A(e,r)==null;return g?{x:N({axis:s,ticks:d,bandSize:p,entry:e,index:n}),y:v?null:c.scale.map(l)??null,value:a,payload:e}:{x:v?null:s.scale.map(l)??null,y:N({axis:c,ticks:f,bandSize:p,entry:e,index:n}),value:a,payload:e}});return{points:v,baseLine:(m||_?v.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?c.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:s.scale.map(t)??null,y:e.y,payload:e.payload}}):g?c.scale.map(h):s.scale.map(h))??0,isRange:_}}function Ke(e){var t=_(e,He),n=I();return q.createElement(me,{id:t.id,type:`area`},e=>q.createElement(q.Fragment,null,q.createElement(D,{legendPayload:je(t)}),q.createElement(Me,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),q.createElement(se,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:he(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),q.createElement(Ue,J({},t,{id:e}))))}var qe=q.memo(Ke,de);qe.displayName=`Area`;var Je=[`axis`],Ye=(0,q.forwardRef)((e,t)=>q.createElement(pe,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Je,tooltipPayloadSearcher:ge,categoricalChartProps:e,ref:t})),$=t();function Xe({points:e,metric:t=`sales`}){let n=(0,q.useRef)(null),[a,o]=(0,q.useState)(300);return(0,q.useEffect)(()=>{if(!n.current)return;let e=new ResizeObserver(([e])=>o(Math.max(200,Math.round(e.contentRect.width))));return e.observe(n.current),()=>e.disconnect()},[]),(0,$.jsx)(`div`,{ref:n,className:i.chart,role:`img`,"aria-label":`月度数据趋势`,children:e.some(e=>e[t]!=null)?(0,$.jsxs)(Ye,{width:a,height:260,data:e,margin:{top:15,right:20,left:10,bottom:0},children:[(0,$.jsx)(ue,{stroke:`var(--omni-chart-track,#263e57)`,vertical:!1}),(0,$.jsx)(fe,{dataKey:`month`,tick:{fill:`#93adc5`,fontSize:11}}),(0,$.jsx)(le,{width:76,tickFormatter:e=>r(e),tick:{fill:`#93adc5`,fontSize:11}}),(0,$.jsx)(C,{contentStyle:{background:`#10243b`,border:`1px solid #355978`,color:`#e4f0fc`},formatter:e=>r(Number(e),t===`sales`?`money`:`number`)}),(0,$.jsx)(qe,{dataKey:t,type:`monotone`,fill:`var(--omni-chart-primary,#2aaad4)`,fillOpacity:.15,stroke:`var(--omni-chart-primary,#4dc9f0)`,strokeWidth:2,connectNulls:!1})]}):(0,$.jsx)(`p`,{className:i.empty,children:`当前记录暂无可追踪的月度数据`})})}export{Xe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./index-
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.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`}]]);export{t};
|
package/app/assets/{chart-no-axes-combined-XDy9u9SV.js → chart-no-axes-combined-DVgKs36j.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./index-
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`chart-no-axes-combined`,[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./index-
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),n=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./index-DLSVWUSu.js";var t=e(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),n=864e5;function r(e){let t=String(e??``).trim();if(/^\d{6,20}$/.test(t))return t;try{let e=new URL(t);if(![`https:`,`http:`].includes(e.protocol)||e.username||e.password||e.port||![`taobao.com`,`tmall.com`].some(t=>e.hostname===t||e.hostname.endsWith(`.`+t)))return null;let n=e.searchParams.get(`id`);return/^\d{6,20}$/.test(n||``)?n:null}catch{return null}}function i(e){let t=r(e?.id);return t?`https://item.taobao.com/item.htm?id=${t}`:null}function a(e,t){let n=r(t?.id);if(!n)throw Error(`请输入有效的淘宝/天猫商品 ID 或完整商品链接`);if(e.some(e=>e.id===n))throw Error(`该商品已在分析列表中`);if(e.length>=2)throw Error(`最多同时分析 2 个商品,请先移除一个商品`);return[...e,{...t,id:n,name:String(t.name||`商品 ${n}`).slice(0,300),url:i({id:n})}]}function o(e=Date.now()){return new Date(Number(e)+8*36e5-n).toISOString().slice(0,10)}function s(e,t,r=Date.now()){if(![7,30].includes(e)||!/^\d{4}-\d{2}-\d{2}$/.test(t||``))throw Error(`请选择近 7 天或近 30 天和有效的结束日期`);let i=Date.parse(t+`T00:00:00Z`);if(!Number.isFinite(i)||new Date(i).toISOString().slice(0,10)!==t||t>o(r))throw Error(`结束日期必须是有效日期,且不能晚于昨天`);let a=e=>new Date(i-e*n).toISOString().slice(0,10);return{days:e,startDate:a(e-1),endDate:t,peerBeginDate:a(e*2-1),peerEndDate:a(e)}}export{o as a,s as i,r as n,t as o,i as r,a as t};
|