1import{a4 as x,k as dt,a as ut,ac as ue,j as e,a7 as Le,c7 as Yt,M as mt,m as xt,a0 as pt,a5 as Ot,B as Ze,s as U,u as Bt,ad as qt,ae as Ht,c8 as Kt,c9 as ze,au as De,r as Ut,W as Gt,d as Qt,i as Jt,ca as Wt,cb as Zt,cc as zt,cd as Xt,ce as es,a6 as Xe,ai as ts}from"./index-BgOx-y6Z.js";import{a as n}from"./echarts-DgtDMHXn.js";import{F as ss}from"./FileSaver.min-CsfSA8fv.js";import{C as ls,a as ns}from"./ConsoleHeader-CPjrsrnl.js";import{C as rs}from"./ConsoleStats-C3UqZ92Z.js";import{C as os}from"./ConsoleToolbar-BbBdHQtA.js";import{I as as}from"./IndexList-BnaYICGV.js";import{D as Ie}from"./DetailPane-Co2tJBoy.js";import{C as W}from"./ConsoleBadge-DCgg_VHp.js";import{D as f}from"./DetailRow-gj5uvQBt.js";import{C as V,M as et}from"./IndexChips-Dr5yOrBM.js";import{c as cs,a as de,b as tt}from"./buttons-B-td5m2n.js";import{T as Ve,S}from"./consoleMotifs-DztxQt8X.js";import{a as is}from"./consoleSplit-DYESYKMN.js";import{m as Me,u as ht,c as st,g as ds,r as us,a as ms,b as xs,A as lt,d as ps,e as hs,f as fs,h as gs}from"./investmentAlerts-C1Ywr9Uv.js";import{u as ft}from"./useMoneyFormatter-nQgPhkeI.js";import{F as bs,u as js}from"./useAutoAdd-BPJdnE0M.js";import{u as ys}from"./useEnterToSubmit-CbWc2UAa.js";import{r as nt}from"./accountColor-BO-lFcba.js";import{S as Cs,c as Ns,r as rt}from"./StrategyFormFields-Uqz2vz4q.js";import{L as gt}from"./LooseDatePicker-CY1-Gb6o.js";import{A as Ye}from"./AttrSwitch-VNlvIg7l.js";import{A as ks}from"./AccountSelector-CWkV2wZd.js";import{D as Ss}from"./index-C99cO1PC.js";import{T as te}from"./index-B22ZqzuR.js";import{S as me}from"./index-DrBcIRVV.js";import{A as Fs}from"./index-DgOHJ2jm.js";import{D as Is}from"./index-Codo6CCy.js";import{e as Ms,a as vs,I as ws}from"./ImportFundModal-Ch6G_ofn.js";import{R as Rs}from"./ReloadOutlined-C0ZR_3Sp.js";import{R as As}from"./DownloadOutlined-9yYWFJzE.js";import{R as $s}from"./ScheduleOutlined-DaOO4bWG.js";import{R as Ps}from"./InfoCircleOutlined-DZC8WRsa.js";import{E as ve}from"./index-CwuBtv0e.js";import{S as Ts}from"./index-BTZEaxC7.js";import{P as ot}from"./index-CgX3Ei35.js";import{R as Es}from"./DeleteOutlined-D2rzDTkW.js";import"./useIsDark-iZe97-MD.js";import"./ArrowLeftOutlined-C0w1fwDH.js";import"./DownOutlined-BQJivuOt.js";import"./UpOutlined-BOTXMvQY.js";import"./index-aVI8qjFB.js";import"./index-fJz-wRm3.js";import"./index-RbzkweVC.js";import"./xlsx-BrcMyRkh.js";import"./papaparse.min-D_ATfZhF.js";import"./papaparse-DHZrpM8D.js";import"./CheckCircleOutlined-B2_VVzJa.js";const bt="jywg.marketLastRefreshAt",jt=()=>{try{return typeof globalThis.localStorage>"u"?null:globalThis.localStorage}catch{return null}},at=()=>jt()?.getItem(bt)??null,_s=i=>{jt()?.setItem(bt,i)},Ls=i=>{if(!i)return null;const u=new Date(i);if(Number.isNaN(u.getTime()))return null;const N=o=>String(o).padStart(2,"0");return`${N(u.getMonth()+1)}-${N(u.getDate())} ${N(u.getHours())}:${N(u.getMinutes())}`},ct=i=>{const u=i.trim().toUpperCase();if(u.includes(".")){const N=u.split(".").pop();return["SZ","SH","BJ","HK","US"].includes(N||"")?N:void 0}if(/^(600|601|603|605|688|689|900)/.test(u))return"SH";if(/^(000|001|002|003|200|300|301)/.test(u))return"SZ";if(/^(4|8|92)/.test(u))return"BJ"},Ds=({open:i,onCancel:u,onSave:N,type:o,initialValues:g,confirmLoading:$=!1,width:Z=600,bare:se=!1,form:E,leading:O})=>{const[ne]=x.useForm(),c=E??ne,{accounts:z}=dt(),{currencies:j,mainCurrency:_}=ut();n.useEffect(()=>{i&&(c.resetFields(),g?(c.setFieldsValue({...g,purchaseDate:ue(g.purchaseDate),maturityDate:g.maturityDate?ue(g.maturityDate):void 0,isSharesMode:!!g.shares||!!g.isMoneyFund||o==="fund"}),g.isMoneyFund&&!g.purchaseAmount&&c.setFieldsValue({purchaseAmount:g.currentValue})):c.setFieldsValue({currency:_.code,purchaseDate:ue(),isSharesMode:!0,isMoneyFund:!1,costPrice:1,currentPrice:1}))},[i,g,c,_]);const xe=d=>{const h={...d,purchaseDate:d.purchaseDate.format("YYYY-MM-DD"),maturityDate:d.maturityDate?.format("YYYY-MM-DD"),type:o},I=d.accountId?z.find(F=>F.id===d.accountId):null;h.memberId=I?.memberId||"self";const M=d.isSharesMode||d.isMoneyFund||o==="fund"||o==="stock";if(d.isMoneyFund){const F=d.purchaseAmount||0;h.currentValue=F,h.purchaseAmount=F,h.shares=F,h.costPrice=1,h.currentPrice
1=1}else if(M){const F=d.shares||0,w=d.currentPrice||0,Re=d.costPrice||0;h.currentValue=Number((F*w).toFixed(2)),h.purchaseAmount=Number((F*Re).toFixed(2))}N(h)},pe=()=>{c.submit()},he=x.useWatch("isSharesMode",c),L=x.useWatch("isMoneyFund",c),p=n.useRef(null),D=n.useRef(0),[ae,G]=n.useState(!1);n.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const Q=async(d,h)=>{G(!0);try{if(o==="fund"){if(L)return;const I=()=>h!==D.current||c.getFieldValue("code")?.trim()!==d;await Promise.all([Me.getFundBasic(d).catch(()=>null).then(M=>{I()||!M?.name||c.setFieldsValue({name:M.name})}),Me.getFundPrice(d).catch(()=>null).then(M=>{const F=M?.nav===void 0||M?.nav===null?void 0:Number(M.nav);I()||F===void 0||!Number.isFinite(F)||c.setFieldsValue({currentPrice:F})})])}else if(o==="stock"){const I=await Me.getStockBasic(d);if(h!==D.current||c.getFieldValue("code")?.trim()!==d)return;const M=I?.exchange||ct(I?.code||d);c.setFieldsValue({...I?.name?{name:I.name}:{},...M?{exchangeCode:M.toUpperCase()}:{}});try{const F=await Me.getStockPrice(I?.code||d);if(h!==D.current||c.getFieldValue("code")?.trim()!==d)return;const w=F?.close===void 0||F?.close===null?void 0:Number(F.close);w!==void 0&&Number.isFinite(w)&&c.setFieldValue("currentPrice",w)}catch{}}}catch{}finally{h===D.current&&G(!1)}},fe=d=>{p.current&&clearTimeout(p.current);const h=d.trim(),I=++D.current;if(G(!1),!h){c.setFieldsValue({name:void 0,exchangeCode:void 0,currentPrice:void 0});return}o==="stock"&&c.setFieldsValue({name:void 0,exchangeCode:ct(h),currentPrice:void 0}),p.current=setTimeout(()=>{Q(h,I)},400)};n.useEffect(()=>{(L||o==="fund"||o==="stock")&&c.setFieldsValue({isSharesMode:!0})},[L,o,c]);const Y=()=>{c.resetFields(),u()},P=e.jsxs(x,{form:c,layout:"vertical",initialValues:{currency:_.code,purchaseDate:ue()},autoComplete:"off",onFinish:xe,children:[e.jsx("button",{type:"submit",style:{display:"none"}}),O||o!=="stock"?e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-x-5 gap-y-2 rounded-console border border-console-border bg-console-surface-tint px-3 py-2",children:[O?e.jsx("div",{className:"flex items-center",children:O}):null,o!=="stock"?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-2",children:[e.jsx(Ye,{form:c,name:"isForRetirement",label:"å½å
¥å
»èé±å
"}),o==="fund"?e.jsx(Ye,{form:c,name:"isMoneyFund",label:"è´§å¸åºé"}):null,o==="bond"?e.jsx(Ye,{form:c,name:"isSharesMode",label:"æä»½é¢è®¡ä»·"}):null]}):null]}):null,e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(x.Item,{name:"code",label:"代ç ",rules:o==="fund"||o==="stock"?[{required:!0,message:`请è¾å
¥${o==="fund"?"åºé":"è¡ç¥¨"}代ç `}]:[],children:e.jsx(Le,{placeholder:o==="fund"?"请è¾å
¥åºé代ç ï¼å¿
å¡«ï¼":o==="stock"?"请è¾å
¥è¡ç¥¨ä»£ç ï¼å¿
å¡«ï¼":"å¯é",autoComplete:"off",onChange:d=>fe(d.target.value),suffix:e.jsx("span",{className:"inline-flex w-4 items-center justify-center",children:ae?e.jsx(Yt,{size:"small"}):null})})}),e.jsx(x.Item,{name:"name",label:"åç§°",rules:[{required:!0,message:"请è¾å
¥åç§°"}],children:e.jsx(Le,{placeholder:o==="stock"?ae?"æ£å¨å¹é
è¡ç¥¨åç§°":"è¾å
¥è¡ç¥¨ä»£ç åèªå¨æ¾ç¤º":L?"å¦ï¼ä½é¢å®ãé¶é±é":"å¦ï¼æ²ªæ·±300ææ°åºé",autoComplete:"off"})})]}),e.jsx(Ss,{className:"my-2"}),L?e.jsx(x.Item,{name:"purchaseAmount",label:"å½åæææ»é¢",rules:[{required:!0,message:"请è¾å
¥å½åéé¢"}],tooltip:"ç±äºè´§å¸åºéåå¼é常åºå®ä¸º1.0ï¼æ¨åªéè¾å
¥å½åè´¦æ·æ¾ç¤ºçèµäº§æ»é¢å³å¯ã",children:e.jsx(te,{className:"w-full",precision:2,autoComplete:"off",placeholder:"请è¾å
¥å½åæ»éé¢",controls:!1})}):!he&&o!=="fund"&&o!=="stock"?e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(x.Item,{name:"purchaseAmount",label:"è´ä¹°éé¢",rules:[{required:!0,message:"请è¾å
¥è´ä¹°éé¢"}],children:e.jsx(te,{className:"w-full",precision:2,autoComplete:"off",controls:!1})}),e.jsx(x.Item,{name:"currentValue",label:"å½åå¸å¼",rules:[{required:!0,message:"请è¾å
¥å½åå¸å¼"}],children:e.jsx(te,{className:"w-full",precision:2,autoComplete:"off",controls:!1})})]}):e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(x.Item,{name:"shares",label:"ææä»½é¢",rules:[{required:!0,message:"请è¾å
¥ä»½é¢"}],children:e.jsx(te,{className:"w-full",precision:o==="stock"?0:2,autoComplete:"off",controls:!1})}),e.jsx(x.Item,{name:"costPrice",label:o==="stock"?"ä¹°å
¥åä»·":"ææ¬ä»· (å
/份)",rules:[{required:!0,message:"请è¾å
¥ææ¬/åä»·"}],children:e.jsx(te,{className:"w-full",precision:4,autoComplete:"off",controls:!1})}),e.jsx(x.Item,{name:"currentPrice",label:o==="stock"?"å½åå¸ä»·":"å½ååå¼ (å
/份)",rules:[{required:!1}],children:e.jsx(te,{className:"w-full",precision:o==="stock"?2:4,placeholder:"ä¸å¡«åç¨åèªå¨åæ¥",autoComplete:"off",controls:!1})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(x.Item,{name:"accountId",label:"å
³èè´¦æ·",rules:[{required:L,message:"è¯·éæ©èµéåæ¾çè´¦æ·ï¼å¦æ¯ä»å®ï¼"}],children:e.jsx(ks,{placeholder:L?"å¿
å¡«":"å¯é (å½±åè´¦æ·ä½é¢)",allowClear:!L})}),L?e.jsx(x.Item,{name:"annualYield7d",label:"䏿¥å¹´åæ¶çç (%)",children:e.jsx(te,{className:"w-full",precision:4,placeholder:"èªå¨æ¾ç¤º",autoComplete:"off",controls:!1})}):o==="stock"?e.jsx(x.Item,{name:"exchangeCode",label:"交ææ",children:e.jsx(me,{disabled:!0,placeholder:ae?"æ£å¨å¹é
交ææ":"è¾å
¥è¡ç¥¨ä»£ç åèªå¨å¹é
",options:[{value:"SZ",label:"深交æï¼SZï¼"},{value:"SH",label:"ä¸äº¤æï¼SHï¼"},{value:"BJ",label:"å交æï¼BJï¼"},{value:"HK",label:"港交æï¼HKï¼"}
1,{value:"US",label:"ç¾å½å¸åºï¼USï¼"}]})}):o==="fund"?e.jsx(x.Item,{name:"liquidityTier",label:"æµå¨æ§å级",tooltip:"è´§å¸åºéèªå¨è®¡å
¥éå¨èµäº§ï¼æ®éåºéé»è®¤ä¸è®¡å
¥ãè¥æåªåºéï¼å¦çåºãåä¸ååï¼ä½ æ³æå®å½éæ¶è½å¨çé±çå¾
ï¼å¯å¨æ¤æ 为ãéæ¶å¯å¨ãããé¿æææã表示ä¸å䏿µå¨æ§ç»è®¡ã",children:e.jsx(me,{allowClear:!0,placeholder:"æªæ 注 ââ ä¸è®¡å
¥éå¨èµäº§",options:[{value:"quick",label:"éæ¶å¯å¨ï¼T+0 å¯èµåï¼"},{value:"liquid",label:"çæææï¼æä¸æç®ç¨ï¼"},{value:"locked",label:"é¿æææï¼ä¸å䏿µå¨æ§ç»è®¡ï¼"}]})}):null,e.jsx(x.Item,{name:"purchaseDate",label:"å»ºä»æ¥æ",rules:[{required:!0,message:"è¯·éæ©æ¥æ"}],children:e.jsx(gt,{className:"w-full"})})]}),e.jsxs(bs,{children:[e.jsx(x.Item,{name:"currency",label:"å¸ç§",rules:[{required:!0,message:"è¯·éæ©å¸ç§"}],children:e.jsx(me,{children:j.map(d=>e.jsxs(me.Option,{value:d.code,children:[d.name," (",d.code,")"]},d.code))})}),e.jsx(x.Item,{name:"notes",label:"夿³¨",className:"sm:col-span-2",children:e.jsx(Le.TextArea,{rows:2,autoSize:!0,placeholder:"å¯é",autoComplete:"off"})})]})]});return se?P:e.jsx(mt,{title:`${g?"ç¼è¾":"æ·»å "}${o==="fund"?"åºé":o==="stock"?"è¡ç¥¨":"åºå¸"}`,open:i,onCancel:Y,onOk:pe,confirmLoading:$,width:Z,destroyOnHidden:!0,children:P})},Vs=({open:i,investment:u,onCancel:N,onConfirm:o,confirmLoading:g=!1})=>{const[$]=x.useForm(),Z=ft();n.useEffect(()=>{i&&u&&$.setFieldsValue({soldDate:ue(),soldValue:u.currentValue})},[i,u,$]);const se=async()=>{try{const E=await $.validateFields();o(E.soldDate.format("YYYY-MM-DD"),E.soldValue)}catch(E){console.error("Validation failed:",E)}};return u?e.jsx(mt,{title:`ååº/èµå - ${u.name}`,open:i,onCancel:N,onOk:se,confirmLoading:g,destroyOnHidden:!0,children:e.jsxs(x,{form:$,layout:"vertical",children:[e.jsx(Fs,{message:"ååºç¡®è®¤",description:`å½åæä»æ¬é: ${Z(u.purchaseAmount,u.currency)}`,type:"info",showIcon:!0,className:"mb-4"}),e.jsx(x.Item,{name:"soldDate",label:"ååºæ¥æ",rules:[{required:!0,message:"è¯·éæ©ååºæ¥æ"}],children:e.jsx(gt,{className:"w-full"})}),e.jsx(x.Item,{name:"soldValue",label:"ååºéé¢",rules:[{required:!0,message:"请è¾å
¥ååºéé¢"}],children:e.jsx(te,{className:"w-full",precision:2,controls:!1})})]})}):null},Ys=({open:i,onClose:u,investmentId:N})=>{const[o]=x.useForm(),[g,$]=n.useState(!1),{getInvestmentById:Z,updateInvestmentStrategy:se}=xt(),{marketSentiment:E}=pt(),{getMarketIndicators:O}=ht(),ne=n.useMemo(()=>O(E?.value),[O,E?.value]),c=N?Z(N):null;n.useEffect(()=>{i&&c?o.setFieldsValue({operationPlan:c.operationPlan||"",alertLines:c.alertLines||[]}):o.resetFields()},[i,c,o]);const z=async()=>{if(N)try{const _=await o.validateFields();$(!0),await se(N,_.operationPlan||"",_.alertLines||[]),U.success("ä¿åæå"),u()}catch(_){_?.errorFields||U.error(_?.message||"ä¿å失败ï¼è¯·ç¨åéè¯")}finally{$(!1)}},j=()=>{g||(o.resetFields(),u())};return e.jsx(Is,{title:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate",children:`çç¥é
ç½® - ${c?.name||""}`}),c?.code?e.jsx("div",{className:"text-[12px] font-normal text-console-muted",children:c.code}):null]}),width:560,onClose:j,open:i,destroyOnHidden:!0,extra:e.jsxs(Ot,{children:[e.jsx(Ze,{onClick:j,disabled:g,children:"åæ¶"}),e.jsx(Ze,{type:"primary",onClick:z,loading:g,children:"ä¿å"})]}),children:c?e.jsx(x,{form:o,layout:"vertical",onValuesChange:Ns(o),className:"console-pane-form",children:e.jsx(Cs,{investment:c,form:o,disabled:g,operationPlanRows:7,market:ne})}):null})},it=["fund","stock","bond"],we={fund:"åºé",stock:"è¡ç¥¨",bond:"åºå¸"},Os=[{value:"value",label:"æå¸å¼"},{value:"profitRate",label:"ææ¶çç"},{value:"name",label:"æåç§°"}],Bs={maturity:"尿䏿¬¡è¿æ¬ä»æ¯",monthly:"ææä»æ¯",quarterly:"æå£ä»æ¯",annually:"æå¹´ä»æ¯"},qs={SZ:"深交æ",SH:"ä¸äº¤æ",BJ:"å交æ",HK:"港交æ",US:"ç¾å½å¸åº"},Hs={quick:"éæ¶å¯å¨",liquid:"çæææ",locked:"é¿æææ"},Ks=i=>{if(i.state==="none")return"å°æªåå°è¡æ
";const u=i.disclosure==="lagged"?" · æ«é²æ»å":"";return`è¡æ
${i.dateText} · è½å ${i.tradeDays} ä¸ªäº¤ææ¥${u}`},Us=i=>{const u=i.slice(0,3).join("ã");return i.length>3?`${u} ç ${i.length} æ¡`:u},Gs=i=>i.type==="fund"||i.type==="stock"||i.type==="bond",Bl=()=>{const i=Bt(),u=qt(),{investments:N,loadInvestments:o,addInvestment:g,updateInvestment:$,deleteInvestment:Z,sellInvestment:se,refreshMarketPrices:E}=xt(),{mainCurrency:O,convertAmount:ne}=ut(),{accounts:c}=dt(),z=Ht(t=>t.members),{globalMoneyFundAlertThreshold:j,marketSentiment:_,fundAccountOrder:xe,setAccountOrder:pe}=pt(),{loadMetalPrices:he,getMarketIndicators:L}=ht(),p=ft(),[D]=x.useForm(),ae=ys(D),[G,Q]=n.useState(null),[fe,Y]=n.useState("view"),[P,d]=n.useState(null),[h,I]=n.useState("fund"),[M,F]=n.useState(""),[w,Re]=n.useState("all"),[ge,yt]=n.useState("value"),[Oe,B]=n.useState(!1),[be,je]=n.useState(null),[Be,ye]=n.useState(null),[J,Ce]=n.useState(null),[Ct,qe]=n.useState(!1),[re,He]=n.useState(!1),[oe,Ae]=n.useState({done:0,total:0}),[Nt,kt]=n.useState(!1),[Ke,St]=n.useState(()=>at()),k=O.code,v=n.useCallback((t,r)=>ne(t??0,r??k,k),[ne,k]);n.useEffect(()=>{o().catch(()=>U.error("æä»æ°æ®å 载失败"))},[o]),n.useEffect(()=>{he().catch(()=>{})},[he]);const y=n.useMemo(()=>N.filter(Gs),[N]),q=n.useMemo(()=>L(_?.value),[L,_?.value]),$e=n.useMemo(()=>st(y,j,q),[y,j,q]),le=n.useMemo(()=>Kt(y),[y]),Ue=n.useMemo(()=>new Set(le.ids),[le.ids]),Ge=n.useMemo(()=>{const t=new Map;
1return y.forEach(r=>t.set(r.id,ze(r))),t},[y]),Qe=n.useMemo(()=>Ls(Ke),[Ke]),H=Nt&&le.total>0,T=n.useMemo(()=>{const t=y.filter(b=>b.status==="holding"),r=t.reduce((b,l)=>b+v(l.currentValue,l.currency),0),a=t.reduce((b,l)=>b+v(l.purchaseAmount,l.currency),0),C=r-a,ee=t.filter(b=>b.isMoneyFund&&b.annualYield7d!==void 0&&b.annualYield7d!==null),m=ee.reduce((b,l)=>b+v(l.currentValue,l.currency),0),R=m>0?ee.reduce((b,l)=>b+l.annualYield7d*v(l.currentValue,l.currency),0)/m:null;return{holdingCount:t.length,soldCount:y.length-t.length,marketValue:r,cost:a,profit:C,profitRate:a>0?C/a*100:null,moneyFundYield:R}},[y,v]),X=n.useMemo(()=>{const t=M.trim().toLowerCase();return[...y.filter(a=>H&&!Ue.has(a.id)?!1:w==="money"?!!a.isMoneyFund:!(w!=="all"&&a.type!==w||t&&!(a.name.toLowerCase().includes(t)||(a.code??"").toLowerCase().includes(t)||(a.notes??"").toLowerCase().includes(t))))].sort((a,C)=>ge==="name"?a.name.localeCompare(C.name,"zh-Hans-CN"):ge==="profitRate"?(C.profitRate??0)-(a.profitRate??0):v(C.currentValue,C.currency)-v(a.currentValue,a.currency))},[y,w,M,ge,v,H,Ue]),Ft=w!=="all"||M.trim().length>0||H,It=n.useMemo(()=>X.filter(t=>t.status==="holding").reduce((t,r)=>t+v(r.currentValue,r.currency),0),[X,v]),s=n.useMemo(()=>y.find(t=>t.id===G)??null,[y,G]),A=n.useMemo(()=>{if(!J)return null;const t=y.filter(m=>(m.accountId??"__none__")===J),r=t.filter(m=>m.status==="holding"),a=r.reduce((m,R)=>m+v(R.currentValue,R.currency),0),C=r.reduce((m,R)=>m+v(R.purchaseAmount,R.currency),0),ee=a-C;return{list:t,holdingCount:r.length,soldCount:t.length-r.length,marketValue:a,cost:C,profit:ee,profitRate:C>0?ee/C*100:null,triggeredCount:st(r,j,q)}},[J,y,v,j,q]),Pe=n.useMemo(()=>J?c.find(t=>t.id===J):void 0,[J,c]),Mt=J==="__none__"?"æªå
³èè´¦æ·":Pe?.name??"è´¦æ·",vt=n.useMemo(()=>{const t=[{key:"all",label:"å
¨é¨",count:y.length,active:w==="all"}];for(const a of it)t.push({key:a,label:we[a],count:y.filter(C=>C.type===a).length,active:w===a,dotColor:Ve.investType[a].color});const r=y.filter(a=>a.isMoneyFund).length;return r>0&&t.push({key:"money",label:"è´§å¸åºé",count:r,active:w==="money"}),t},[y,w]),ce=t=>c.find(r=>r.id===t)?.name,wt=t=>z.find(r=>r.id===t)?.name,ie=t=>t==null||t===0?void 0:t>0?S.gain:S.loss,Te=n.useCallback(t=>{Q(t.id),d(t),I(t.type),Y("form"),B(!0)},[]),Rt=n.useMemo(()=>{const t=(m,R,b=!0)=>m.map(l=>{const K=l.profitRate,Dt=K===void 0||K===0?void 0:K>0?S.gain:S.loss,We=R(l),ke=b?ce(l.accountId):void 0,Se=H?Ge.get(l.id):void 0,Vt=Se&&Se.state!=="synced"?e.jsx(V,{style:{color:Se.state==="delayed"?S.warning:void 0},children:Ks(Se)}):null;return{id:l.id,spineColor:We.color,spineRgb:We.rgb,title:l.name,subtitle:l.isMoneyFund?e.jsxs("span",{className:"flex flex-wrap items-center gap-1",children:[e.jsxs(V,{children:["䏿¥å¹´å ",l.annualYield7d===void 0?"--":`${l.annualYield7d}%`]}),ke?e.jsx(V,{children:ke}):null,l.memberId?e.jsx(et,{ids:[l.memberId],members:z}):null,l.isForRetirement?e.jsx(V,{children:"å
»è"}):null]}):e.jsxs("span",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-1 min-w-0",children:[Vt,l.code?e.jsx(V,{children:l.code}):null,K!==void 0?e.jsxs(V,{style:{color:Dt},children:[K>=0?"+":"",K.toFixed(2),"%"]}):null,ke?e.jsx(V,{children:ke}):null,l.memberId?e.jsx(et,{ids:[l.memberId],members:z}):null,l.costPrice!==void 0?e.jsxs(V,{className:"hidden xl:inline-flex",children:["ææ¬ ",l.costPrice]}):null,l.type==="bond"&&l.maturityDate?e.jsxs(V,{className:"hidden xl:inline-flex",children:[l.maturityDate," å°æ"]}):null,l.type==="bond"&&l.interestRate!==void 0?e.jsxs(V,{className:"hidden xl:inline-flex",children:["ç¥¨é¢ ",l.interestRate,"%"]}):null,l.status==="sold"?e.jsx(V,{className:"hidden xl:inline-flex",children:"å·²æ¸
ä»"}):null,l.isForRetirement?e.jsx(V,{className:"hidden xl:inline-flex",children:"å
»è"}):null]}),e.jsxs("span",{className:"xl:hidden flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[11px] leading-4 min-w-0",children:[l.costPrice!==void 0?e.jsxs("span",{children:["ææ¬ ",l.costPrice]}):null,l.type==="bond"&&l.maturityDate?e.jsxs("span",{children:[l.maturityDate," å°æ"]}):null,l.type==="bond"&&l.interestRate!==void 0?e.jsxs("span",{children:["ç¥¨é¢ ",l.interestRate,"%"]}):null,l.status==="sold"?e.jsx("span",{children:"å·²æ¸
ä»"}):null,l.isForRetirement?e.jsx("span",{children:"å
»è"}):null]})]}),value:l.isMoneyFund?p(l.currentValue,l.currency):e.jsxs("span",{className:"block leading-4",children:[p(l.currentValue,l.currency),l.profit===void 0?null:e.jsxs("span",{className:"mt-0.5 block text-[12px] tabular-nums",style:{color:ie(l.profit)},children:[l.profit>=0?"+":"-",p(Math.abs(l.profit),l.currency)]})]}),states:(()=>{const Fe=[];return l.status==="sold"&&Fe.push("sold"),rt(l,j,q).triggered&&Fe.push("triggered"),Fe.length>0?Fe:void 0})(),quickActions:[{key:"edit",icon:e.jsx(Xe,{}),label:"ç¼è¾",onClick:()=>Te(l)},...l.status==="holding"?[{key:"sell",icon:e.jsx(ts,{}),label:"æ¸
ä»",onClick:()=>je(l)}]:[]]}}),r=m=>p(m.reduce((R,b)=>R+v(b.currentValue,b.currency),0),k),a=xe??[],C=Array.from(new Set(X.map(m=>m.accountId??"__none__")));return[...a.filter(m=>C.includes(m)),...C.filter(m=>!a.includes(m))].map(m=>{const R=X.filter(K=>(K.accountId??"__none__")===m),b=m==="__none__"?void 0:c.find(K=>K.id===m),l=b?nt(b.color).color:S.active;return{key:`account:${m}`,label:b?.name??"æªå
³èè´¦æ·",count:R.length,summary:r(R),rows:t(R,()=>({color:l}),!1)}}).filter(m=>m.rows.length>0)},[X,p,c,ce,z,xe,q,j,Te,v,k,H,Ge]),Ee=n.useCallback(()=>{Q(null),d(null),I("fund"),D.resetFields(),Y("form"),B(!0)},[D]);js(()=>Ee()),n.useEffect(()=>{const t=u.state;!t||!(t.accountId||t.autoAdd||t.highlightId)||(t.accountId&&(t.autoAdd&&Ee(),D.setFieldsValue({accountId:t.accountId})),t.highlightId&&(Q(t.highlightId),Y("view"),B(!0)),i(u.pathname,{replace:!0,state:{}}))},[u.state,i,u.pathname]);const _e=n.useCallback(()=>{Y("view"),d(null),G||B(!1)},[G]),At=n.useCallback(t=>{const r={...t,type:h};!P&&!r.currency&&(r.currency=O.code),P?$(P.id,r):g(r),_e()},[P,h,g,$,O.code,_e]),Je=n.useCallback(t=>{Z(t.id),Q(null),Y("view"),B(!1)}
1,[Z]),$t=n.useCallback(async()=>{if(!re){He(!0),Ae({done:0,total:0});try{const t=await E({onProgress:Ae});_s(new Date().toISOString()),St(at()),t.attempted===0?U.info("没æéè¦æ´æ°çæä»ï¼åºå¸ä¸è´§å¸åºé没æè¡æ
æºï¼"):t.staleNames.length>0?U.warning(`æ ${t.staleNames.length} æ¡ä»æ¯æ§è¡æ
ï¼${Us(t.staleNames)}`):U.success(`è¡æ
å·²æ´æ° ${t.updated} æ¡`)}catch{U.error("è¡æ
æ´æ°å¤±è´¥")}finally{He(!1),Ae({done:0,total:0})}}},[E,re]),Pt=n.useCallback(t=>Re(t),[]),Tt=n.useCallback(t=>{const r=t.replace(/^account:/,"");Ce(r),Q(null),Y("view"),B(!0)},[]),Et=n.useCallback(t=>{const r=t.map(a=>a.replace(/^account:/,"")).filter(a=>a!=="__none__");pe("fund",r).catch(()=>U.error("è´¦æ·æåºä¿å失败"))},[pe]),_t=n.useCallback(()=>{const t=Ms(X,{accountName:a=>ce(a)??void 0}),r=new Blob(["\uFEFF"+t],{type:"text/csv;charset=utf-8;"});ss.saveAs(r,`è¯å¸æ¸
å_${new Date().toISOString().slice(0,10)}.csv`)},[X,ce]),Lt=t=>{$(t.id,{ignoreMoneyFundAlert:!t.ignoreMoneyFundAlert}),U.success(t.ignoreMoneyFundAlert?"å·²åæ¶å¿½ç¥æ¶ççæé":"å·²å¿½ç¥æ¶ççæé")},Ne=t=>{const r=rt(t,j,q);return{hasContent:r.hasContent,triggered:r.triggered,triggeredLines:r.triggeredLines.length,hasPlan:r.hasPlan,alertCount:r.alertCount}};return e.jsxs(ls,{motif:"securities",fill:!0,children:[e.jsx(ns,{backTo:"/assets/invest",title:"è¯å¸æä»",subtitle:`${T.holdingCount} ç¬å¨æ · å¸å¼ ${p(T.marketValue,k)} · 累计çäº ${p(T.profit,k)}`,icon:e.jsx($s,{}),actions:[{key:"refresh",label:re&&oe.total>0?`æ´æ°ä¸ ${oe.done}/${oe.total}`:re?"æ´æ°ä¸â¦":"æ´æ°è¡æ
",icon:e.jsx(Rs,{}),disabled:re,onClick:()=>{$t()}},{key:"strategy",label:$e>0?`çç¥ä¸å¿ · å¾
å¤ç ${$e}`:"çç¥ä¸å¿",icon:e.jsx(Ut,{}),onClick:()=>i($e>0?`${De.strategy}?segment=triggered`:De.strategy)},{key:"import",label:"导å
¥åºé",icon:e.jsx(vs,{}),onClick:()=>qe(!0)},{key:"export",label:"å¯¼åº CSV",icon:e.jsx(As,{}),onClick:_t},{key:"create",label:"æ°å¢æä»",icon:e.jsx(Gt,{}),primary:!0,onClick:Ee}]}),e.jsx(rs,{items:[{key:"value",label:`æä»å¸å¼ (${k})`,value:p(T.marketValue,k),hint:"ææå¨æçåºé / è¡ç¥¨ / åºå¸æå½åæ±çæç®ä¸»å¸æ±åï¼ä¸é䏿¹çéåå"},{key:"profit",label:`累计çäº (${k})`,value:e.jsxs("span",{style:{color:ie(T.profit)},children:[T.profit>=0?"+":"-",p(Math.abs(T.profit),k)]}),hint:"å½åå¸å¼å计 â ä¹°å
¥æ¬éå计"},{key:"rate",label:"æ»æ¶çç",value:T.profitRate===null?"--":`${T.profitRate.toFixed(2)}%`,hint:"ææ¬éå æï¼æ»çäº Ã· æ»æ¬éï¼ï¼ä¸æ¯åç¬æ¶çççç®æ¯å¹³åââç®æ¯å¹³åä¼è¢«å°ä»ä½ç髿¶çç严éæé«"},{key:"count",label:"卿 / å·²æ¸
ä»",value:`${T.holdingCount} / ${T.soldCount}`,hint:"å·²æ¸
ä»çæ¡ç®ä¿çå¨å表ä¸ï¼å¯æ¥çååºè®°å½"},...T.moneyFundYield!==null?[{key:"moneyYield",label:"è´§åºä¸æ¥å¹´å (å æ)",value:`${T.moneyFundYield.toFixed(2)}%`,hint:"è´§å¸åºéæå½åå¸å¼å æï¼ä¸æ¯åç¬ä¸æ¥å¹´åçç®æ¯å¹³åââå°ä½é¢äº§åç髿¶ççä¸ä¼æé«æ´ä½"}]:[]]}),e.jsxs(os,{search:{value:M,onChange:F,placeholder:"æç´¢åç§° / 代ç / 夿³¨"},chips:vt,onChip:Pt,children:[Ft?e.jsxs("span",{className:"text-[13px] tabular-nums text-console-muted",children:["çéåº ",X.length," ç¬ Â· ",p(It,k)]}):null,re&&oe.total>0?e.jsxs("span",{className:"text-[13px] tabular-nums text-console-muted",children:["æ£å¨æ´æ°è¡æ
",oe.done,"/",oe.total]}):Qe?e.jsxs("span",{className:"text-[13px] tabular-nums text-console-muted",children:["è¡æ
æ´æ°äº ",Qe]}):null,e.jsx(Qt,{placement:"bottom",title:"æå¡ç«¯å®æ¶æåï¼åºéå弿¯æ 20:30ï¼21:30 åå
åºä¸æ¬¡ï¼QDII / FOF æ«é²æ´æï¼ï¼è´§å¸åºé䏿¥å¹´å 20:40ï¼å½æ¥æ°æ®è¦çç»è½¬å®æï¼16:00 åæåºï¼ï¼è¡ç¥¨æ¶çå 15:05ãä¸é¢çãæ´æ°è¡æ
ãæ¯æå¨å³æ¶å·æ°ï¼å¹³æ¶ä¸å¿
æ¯å¤©ç¹ã",children:e.jsx("span",{role:"img","aria-label":"è¡æ
èªå¨æ´æ°èå¥ï¼åºéæ¯æ 20:30ã21:30ï¼è´§åºä¸æ¥å¹´å 20:40ï¼è¡ç¥¨ 15:05",className:"inline-flex cursor-help items-center text-console-muted",children:e.jsx(Ps,{})})}),le.total>0?e.jsxs("button",{type:"button",onClick:()=>kt(t=>!t),"aria-pressed":H,title:`å»¶è¿ ${le.delayed} æ¡ï¼è¶
åºè¯¥æ¡æ«é²èå¾ç容å¿åº¦ï¼æ®éåç§ 1 ä¸ªäº¤ææ¥ï¼QDII / FOF 3 ä¸ªäº¤ææ¥ï¼Â· 仿ªåæ¥ ${le.none} æ¡ï¼æä»£ç ä½åä¸å°è¡æ
ï¼ï½ç¹å»${H?"åæ¶çé":"åªçè¿å æ¡"}`,className:H?"inline-flex items-center gap-1 rounded-full bg-console-accent-soft px-2.5 py-1 text-[13px] font-medium text-console-accent-strong transition-colors":"inline-flex items-center gap-1 rounded-full border border-console-border px-2.5 py-1 text-[13px] transition-colors hover:bg-console-surface-tint",style:H?void 0:{color:S.warning},children:["è¡æ
å¾
æ´æ° ",le.total," æ¡",H?e.jsx(Jt,{}):null]}):null,e.jsxs("label",{className:"flex items-center gap-1.5 text-[13px] text-console-muted",children:[e.jsx("span",{children:"æåº"}),e.jsx(me,{size:"small",value:ge,onChange:yt,options:Os,className:"w-28"})]})]}),e.jsxs("div",{className:"flex gap-3 lg:flex-1 lg:min-h-0",children:[e.jsx("aside",{className:`min-w-0 flex-1 rounded-console border border-console-border bg-console-surface transition-opacity ${is} lg:self-start lg:overflow-y-auto lg:max-h-full ${fe==="form"?"pointer-events-none opacity-60":""} ${Oe?"hidden lg:block":""}`,children:e.jsx(as,{groups:Rt,selectedId:G,onSelect:t=>{Q(t),Ce(null),Y("view"),B(!0)},onGroupSelect:Tt,selectedGroupKey:J?`account:${J}`:null,groupDraggable:!0,onGroupReorder:Et,collapsible:!0,empty:e.jsx(ve,{description:y.length===0?"è¿æ²¡ææä»ï¼ç¹å»å³ä¸è§ãæ°å¢æä»ã"
1:"没æå¹é
çæä»",image:ve.PRESENTED_IMAGE_SIMPLE})})}),e.jsx("div",{className:`min-w-0 flex-1 lg:h-full lg:overflow-hidden ${Oe?"":"hidden lg:block"}`,children:fe==="form"?e.jsx(Ie,{accentColor:"var(--console-accent)",title:P?`ç¼è¾${we[h]}`:"æ°å¢æä»",subtitle:P?P.name:"éæ©åç§åå¡«å",actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>D.submit(),className:cs,children:"ä¿å"}),e.jsx("button",{type:"button",onClick:()=>_e(),className:de,children:"åæ¶"}),P?e.jsx(ot,{title:"ç¡®å®å é¤è¿æ¡æä»åï¼",okText:"å é¤",cancelText:"åæ¶",okButtonProps:{danger:!0},onConfirm:()=>Je(P),children:e.jsx("button",{type:"button",className:tt,children:"å é¤"})}):null]}),children:e.jsx("div",{className:"console-pane-form",onKeyDown:ae,children:e.jsx(Ds,{bare:!0,open:!0,form:D,type:h,leading:e.jsx(Ts,{value:h,onChange:t=>I(t),options:it.map(t=>({label:we[t],value:t}))}),initialValues:P??void 0,onSave:At,onCancel:()=>{Y("view"),d(null)}})})}):A?e.jsx(Ie,{accentColor:Pe?nt(Pe.color).color:"var(--console-accent)",title:Mt,subtitle:`该账æ·ä¸ ${A.list.length} ç¬æä»`,onClose:()=>{Ce(null),B(!1)},children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[{label:`æä»å¸å¼ (${k})`,value:p(A.marketValue,k),color:void 0,hint:"ä»
è®¡å¨ææ¡ç®ï¼æå½åæ±çæç®ä¸»å¸"},{label:`累计çäº (${k})`,value:`${A.profit>=0?"+":"-"}${p(Math.abs(A.profit),k)}`,color:ie(A.profit),hint:"卿å¸å¼å计 â ä¹°å
¥æ¬éå计"},{label:"æ»æ¶çç",value:A.profitRate===null?"--":`${A.profitRate.toFixed(2)}%`,color:ie(A.profitRate??void 0),hint:"ææ¬éå æï¼æ»çäº Ã· æ»æ¬éï¼ï¼ä¸æ¯åç¬æ¶çççç®æ¯å¹³å"},{label:"卿 / å·²æ¸
ä»",value:`${A.holdingCount} / ${A.soldCount}`,color:void 0,hint:"å·²æ¸
仿¡ç®ä¿çå¨è¯¥è´¦æ·ä¸"}].map(t=>e.jsxs("div",{className:"rounded-console border border-console-border bg-console-surface-tint px-3 py-2",title:t.hint,children:[e.jsx("div",{className:"text-[12px] text-console-muted",children:t.label}),e.jsx("div",{className:"text-[16px] leading-6 tabular-nums text-console-ink",style:{color:t.color},children:t.value})]},t.label))}),A.triggeredCount>0?e.jsxs("div",{className:"flex items-center gap-1.5 rounded-console border px-3 py-2 text-[13px]",style:{borderColor:S.danger,color:S.danger,backgroundColor:"rgba(220,38,38,0.06)"},children:[e.jsx("span",{className:"h-[6px] w-[6px] animate-pulse rounded-full",style:{backgroundColor:S.danger},"aria-hidden":!0}),e.jsxs("span",{children:[A.triggeredCount," ç¬æä»å·²è§¦åé¢è¦çº¿"]}),e.jsx("button",{type:"button",className:"ml-auto underline underline-offset-2",onClick:()=>i(`${De.strategy}?segment=triggered`),children:"å»å¤ç"})]}):null,e.jsxs("div",{className:"border-t border-console-border pt-2",children:[e.jsx("div",{className:"mb-1 text-[12px] text-console-muted",children:"è¯¥è´¦æ·æä»"}),e.jsx("div",{className:"flex flex-col",children:A.list.map(t=>{const r=Ne(t);return e.jsxs("button",{type:"button",onClick:()=>{Ce(null),Q(t.id),Y("view")},className:"flex items-center gap-2 rounded-console-sm px-2 py-1.5 text-left transition-colors hover:bg-console-surface-tint",children:[e.jsx("span",{className:"h-4 w-[3px] shrink-0 rounded-full",style:{backgroundColor:Ve.investType[t.type].color},"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-console-ink",children:t.name}),r.triggered?e.jsx("span",{className:"h-[6px] w-[6px] shrink-0 animate-pulse rounded-full",style:{backgroundColor:S.danger},"aria-hidden":!0}):null,t.status==="sold"?e.jsx("span",{className:"shrink-0 text-[12px] text-console-muted",children:"å·²æ¸
ä»"}):null,e.jsx("span",{className:"shrink-0 text-[13px] tabular-nums text-console-ink",children:p(t.currentValue,t.currency)})]},t.id)})})]})]})}):s?e.jsx(Ie,{accentColor:Ve.investType[s.type].color,title:s.name,subtitle:`${we[s.type]}${s.code?` · ${s.code}`:""}`,badge:s.status==="sold"?e.jsx(W,{tone:"neutral",children:"å·²æ¸
ä»"}):s.isMoneyFund&&!s.ignoreMoneyFundAlert&&(s.annualYield7d??0)<j?e.jsx(W,{tone:"danger",title:`䏿¥å¹´å ${s.annualYield7d}% ä½äºæééå¼ ${j}%`,children:"æ¶ççåä½"}):e.jsx(W,{tone:"success",children:"æä»ä¸"}),onClose:()=>B(!1),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>Te(s),className:de,children:[e.jsx(Xe,{}),e.jsx("span",{children:"ç¼è¾"})]}),s.status==="holding"?e.jsx("button",{type:"button",onClick:()=>je(s),className:de,children:e.jsx("span",{children:"æ¸
ä»"})}
1):null,s.isMoneyFund?e.jsx("button",{type:"button",onClick:()=>Lt(s),className:Ne(s).triggered&&!s.ignoreMoneyFundAlert?"inline-flex items-center gap-1.5 rounded-console-sm border px-2.5 py-1 text-[13px] transition-colors":de,style:Ne(s).triggered&&!s.ignoreMoneyFundAlert?{borderColor:S.danger,color:S.danger,backgroundColor:"rgba(220,38,38,0.06)"}:void 0,title:s.ignoreMoneyFundAlert?"已忽ç¥å
¨å±æ¶ççæéï¼ç¹æ¤æ¢å¤":`䏿¥å¹´åä½äº ${j}% æ¶æéï¼ç¹æ¤å¿½ç¥è¯¥åºé`,children:s.ignoreMoneyFundAlert?"åæ¶å¿½ç¥":"å¿½ç¥æé"}):(()=>{const t=Ne(s);return t.triggered?e.jsxs("button",{type:"button",onClick:()=>ye(s.id),className:"inline-flex items-center gap-1.5 rounded-console-sm border px-2.5 py-1 text-[13px] transition-colors",style:{borderColor:S.danger,color:S.danger,backgroundColor:"rgba(220,38,38,0.06)"},title:t.triggeredLines>0?`已触å ${t.triggeredLines} æ¡é¢è¦çº¿`:"已触å䏿¥å¹´åæé",children:[e.jsx("span",{className:"h-[6px] w-[6px] animate-pulse rounded-full",style:{backgroundColor:S.danger},"aria-hidden":!0}),e.jsxs("span",{children:["æä½è®¡å",t.triggeredLines>0?` · 触å ${t.triggeredLines}`:" · å¾
å¤ç"]})]}):t.hasContent?e.jsxs("button",{type:"button",onClick:()=>ye(s.id),className:"inline-flex items-center gap-1.5 rounded-console-sm border px-2.5 py-1 text-[13px] transition-colors",style:{borderColor:"var(--console-accent)",color:"var(--console-accent)",backgroundColor:"rgba(79,70,229,0.06)"},title:`å·²é
ç½®${t.hasPlan?"æä½è®¡å":""}${t.hasPlan&&t.alertCount>0?"ä¸":""}${t.alertCount>0?`${t.alertCount} æ¡é¢è¦çº¿`:""}`,children:[e.jsx("span",{className:"h-[6px] w-[6px] rounded-full",style:{backgroundColor:"var(--console-accent)"},"aria-hidden":!0}),e.jsx("span",{children:"æä½è®¡å · å·²é
ç½®"})]}):e.jsx("button",{type:"button",onClick:()=>ye(s.id),className:de,title:"å°æªé
ç½®æä½è®¡åä¸é¢è¦çº¿",children:e.jsx("span",{className:"text-console-muted",children:"æä½è®¡å · æªé
ç½®"})})})(),e.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 self-center bg-console-border","aria-hidden":!0}),e.jsx(ot,{title:"ç¡®å®å é¤è¿æ¡æä»åï¼",okText:"å é¤",cancelText:"åæ¶",okButtonProps:{danger:!0},onConfirm:()=>Je(s),children:e.jsxs("button",{type:"button",className:tt,children:[e.jsx(Es,{}),e.jsx("span",{children:"å é¤"})]})})]}),children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-3",children:[e.jsxs("div",{className:"sm:flex-1",children:[e.jsx("div",{className:"text-[12px] text-console-muted",children:"å½åå¸å¼"}),e.jsx("div",{className:"text-[22px] leading-7 tabular-nums text-console-ink",children:p(s.currentValue,s.currency)}),s.currency!==k?e.jsxs("div",{className:"mt-0.5 text-[12px] text-console-muted",children:["â ",p(v(s.currentValue,s.currency),k)]}):null]}),e.jsxs("div",{className:"rounded-console border border-console-border bg-console-surface-tint px-3 py-2 sm:w-[42%] sm:max-w-[300px] sm:flex-none",children:[e.jsx("div",{className:"text-[12px] text-console-muted",children:"累计çäº"}),e.jsxs("div",{className:"text-[18px] leading-6 tabular-nums",style:{color:ie(s.profit)},children:[s.profit===void 0?"--":`${s.profit>=0?"+":"-"}${p(Math.abs(s.profit),s.currency)}`,s.profitRate===void 0?null:e.jsxs("span",{className:"ml-1.5 text-[13px]",children:[s.profitRate>=0?"+":"",s.profitRate.toFixed(2),"%"]})]})]})]}),e.jsxs("div",{className:"border-t border-console-border pt-1 sm:grid sm:grid-cols-2 sm:gap-x-6",children:[e.jsx(f,{label:"ä¹°å
¥æ¬é",children:p(s.purchaseAmount,s.currency)}),s.costPrice!==void 0?e.jsx(f,{label:"ææ¬ä»·",children:s.costPrice}):null,s.shares!==void 0?e.jsx(f,{label:"æä»ä»½é¢",children:s.shares}
1):null,s.currentPrice!==void 0?e.jsx(f,{label:"ç°ä»· / åå¼",children:s.currentPrice}):null,e.jsx(f,{label:"å»ºä»æ¥æ",children:s.purchaseDate||"--"}),s.type==="stock"&&s.exchangeCode?e.jsx(f,{label:"交ææ",children:qs[s.exchangeCode]??s.exchangeCode}):null,s.type==="fund"&&s.fundType?e.jsx(f,{label:"åºéç±»å",children:s.fundType}):null,s.type==="fund"&&!s.isMoneyFund?e.jsx(f,{label:"æµå¨æ§å级",children:s.liquidityTier?Hs[s.liquidityTier]:e.jsx("span",{className:"text-console-muted",children:"æªæ 注ï¼ä¸è®¡å
¥éå¨èµäº§ï¼"})}):null,s.isMoneyFund?e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"䏿¥å¹´å",children:s.annualYield7d===void 0?"--":e.jsxs("span",{className:"flex flex-wrap items-baseline gap-1.5",children:[e.jsxs("span",{children:[s.annualYield7d,"%"]}),e.jsx("span",{className:"text-[12px] text-console-muted",children:Wt(zt(s),Zt(s))})]})}),e.jsxs(f,{label:"å
¨å±æééå¼",children:[j,"%"]}),e.jsx(f,{label:"æ¶ççæé",children:s.ignoreMoneyFundAlert?e.jsx("span",{className:"text-console-muted",children:"已忽ç¥"}):(s.annualYield7d??0)<j?e.jsx("span",{style:{color:S.danger},children:"ä½äºéå¼ï¼å¾
å¤ç"}):e.jsx("span",{children:"æ£å¸¸"})})]}):null,s.type==="bond"?e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"å°ææ¥",children:s.maturityDate||"--"}),e.jsx(f,{label:"票é¢å©ç",children:s.interestRate===void 0?"--":`${s.interestRate}%`}),e.jsx(f,{label:"仿¯æ¹å¼",children:s.interestPayment?Bs[s.interestPayment]??s.interestPayment:"--"}),e.jsx(f,{label:"åºè®¡å©æ¯",children:s.accruedInterest===void 0?"--":p(s.accruedInterest,s.currency)})]}):null,e.jsx(f,{label:"å
³èè´¦æ·",children:ce(s.accountId)||"--"}),e.jsx(f,{label:"å½å±æå",children:wt(s.memberId)||"--"}),e.jsx(f,{label:"å¸ç§",children:s.currency||k}),Xt(s)?e.jsx(f,{label:"è¡æ
ç¶æ",children:es(ze(s))}):s.currentPriceDate?e.jsx(f,{label:"è¡æ
æ¥æ",children:s.currentPriceDate}):null,e.jsx(f,{label:"å½å
¥å
»èé±å
",children:s.isForRetirement?"æ¯":"å¦"}),s.status==="sold"?e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"æ¸
仿¥æ",children:s.soldDate||"--"}),e.jsx(f,{label:"æ¸
ä»éé¢",children:s.soldValue===void 0?"--":p(s.soldValue,s.currency)})]}):null,e.jsx(f,{label:"夿³¨",className:"sm:col-span-2",children:s.notes||"--"})]}),e.jsxs("div",{className:"border-t border-console-border pt-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-[13px] font-medium text-console-ink",children:"çç¥é
ç½®"}),s.isMoneyFund?s.ignoreMoneyFundAlert?e.jsx(W,{tone:"neutral",children:"å·²å¿½ç¥æé"}):(s.annualYield7d??0)<j?e.jsx(W,{tone:"danger",children:"æ¶ççåä½"}):e.jsx(W,{tone:"success",children:"æ£å¸¸"}):(()=>{const t=ds(s,q).length,r=!!s.operationPlan?.trim()||!!s.alertLines?.length;return t>0?e.jsxs(W,{tone:"danger",children:["触å ",t," æ¡"]}):r?e.jsx(W,{tone:"success",children:"æªè§¦å"}):e.jsx(W,{tone:"neutral",children:"æªé
ç½®"})})()]}),s.isMoneyFund?e.jsxs("p",{className:"text-[12px] leading-5 text-console-muted",children:["è´§å¸åºéä¸å¼æ¾ååªé¢è¦çº¿ï¼ä»
åå
¨å±ä¸æ¥å¹´åéå¼ï¼",j,"%ï¼çº¦æã",s.ignoreMoneyFundAlert?" å½åå·²å¿½ç¥æéã":(s.annualYield7d??0)<j?` å½å䏿¥å¹´å ${s.annualYield7d??"--"}%ï¼ä½äºéå¼ï¼å¾
å¤çã`:` å½å䏿¥å¹´å ${s.annualYield7d??"--"}%ï¼æ£å¸¸ã`]}):!s.operationPlan?.trim()&&!s.alertLines?.length?e.jsx("p",{className:"text-[12px] text-console-muted",children:"å°æªé
ç½®æä½è®¡åä¸é¢è¦çº¿ã"}):e.jsxs("div",{className:"flex flex-col gap-3",children:[s.operationPlan?.trim()?e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-[12px] text-console-muted",children:"æä½è®¡å"}),e.jsx("div",{className:"max-h-[240px] overflow-y-auto whitespace-pre-wrap rounded-console border border-console-border bg-console-surface px-3 py-2 text-[13px] leading-5 text-console-ink",children:s.operationPlan})]}):null,s.alertLines&&s.alertLines.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 text-[12px] text-console-muted",children:["é¢è¦çº¿ï¼",s.alertLines.length,"ï¼"]}),e.jsx("ul",{className:"flex flex-col gap-2",children:s.alertLines.map(t=>{const r=us(t),a=ms(s,t,q),C=xs(s,t,q),ee=C===null?"æ°æ®ä¸è¶³":`${C.toFixed(ps[r])}${lt[r]}`;return e.jsxs("li",{className:`rounded-console border px-3 py-2${a?"":" border-console-border"}`,style:a?{borderColor:S.danger,backgroundColor:"rgba(220,38,38,0.05)",borderLeftWidth:3}:void 0,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-[13px] font-medium text-console-ink",children:[hs[t.type],e.jsxs("span",{className:"ml-1 font-normal text-console-muted",children:[fs[r]," ",gs[t.condition]," ",t.value,lt[r]]})]}),e.jsx("span",{className:"shrink-0 text-[12px] font-medium",style:a?{c
1olor:S.danger}:void 0,children:a?"已触å":"æªè§¦å"})]}),e.jsxs("div",{className:"mt-1 text-[12px] text-console-muted",children:["å½åï¼",e.jsx("span",{className:"tabular-nums text-console-ink",children:ee}),t.actionHint?` · æä½ï¼${t.actionHint}`:""]})]},t.id)})})]}):null]})]})]})}):e.jsx(Ie,{accentColor:"var(--console-accent)",title:"è¯å¸æä»",onClose:()=>B(!1),empty:e.jsx(ve,{description:"ä»å·¦ä¾§éæ©ä¸æ¡æä»æ¥çæç»ï¼æç¹å»ãæ°å¢æä»ã",image:ve.PRESENTED_IMAGE_SIMPLE})})})]}),e.jsx(Vs,{open:!!be,investment:be,onCancel:()=>je(null),onConfirm:(t,r)=>{be&&se(be.id,t,r),je(null)}}),e.jsx(Ys,{open:!!Be,investmentId:Be,onClose:()=>ye(null)}),e.jsx(ws,{open:Ct,onClose:()=>qe(!1),onSuccess:async()=>{U.success("导å
¥å®æï¼æ£å¨å·æ°æ°æ®â¦");try{await o()}catch(t){console.error("导å
¥åå·æ°å¤±è´¥:",t)}}})]})};export{Bl as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.