@v587d/capital-generation 2.24.0 → 2.26.0
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/CHANGELOG.md +49 -0
- package/README.md +9 -4
- package/THIRD_PARTY_NOTICES.md +20 -0
- package/automation/brief.js +21 -24
- package/automation/builtins.js +55 -54
- package/automation/client.js +11 -3
- package/automation/client.src.cjs +70 -8
- package/automation/package.json +1 -1
- package/chart-ui/package.json +1 -1
- package/config/client.js +21 -5
- package/config/client.src.cjs +264 -0
- package/config/package.json +1 -1
- package/cordis.patch.yml +9 -2
- package/lib/agents/role-tool-policy.d.ts +1 -1
- package/lib/agents/root-tool-policy.d.ts +3 -3
- package/lib/agents/root-tool-policy.js +2 -2
- package/lib/data-collector/catalog-taxonomy.js +4 -0
- package/lib/python-runtime/child-env.d.ts +11 -0
- package/lib/python-runtime/child-env.js +39 -0
- package/lib/python-runtime/errors.d.ts +8 -0
- package/lib/python-runtime/errors.js +34 -0
- package/lib/python-runtime/lock.d.ts +11 -0
- package/lib/python-runtime/lock.js +68 -0
- package/lib/python-runtime/manager.d.ts +61 -0
- package/lib/python-runtime/manager.js +517 -0
- package/lib/python-runtime/manifest.d.ts +5 -0
- package/lib/python-runtime/manifest.js +160 -0
- package/lib/python-runtime/paths.d.ts +20 -0
- package/lib/python-runtime/paths.js +156 -0
- package/lib/python-runtime/platform.d.ts +32 -0
- package/lib/python-runtime/platform.js +145 -0
- package/lib/python-runtime/pnpm.d.ts +24 -0
- package/lib/python-runtime/pnpm.js +115 -0
- package/lib/python-runtime/probe.d.ts +13 -0
- package/lib/python-runtime/probe.js +101 -0
- package/lib/python-runtime/routes.d.ts +6 -0
- package/lib/python-runtime/routes.js +152 -0
- package/lib/python-runtime/types.d.ts +105 -0
- package/lib/python-runtime/types.js +3 -0
- package/lib/python-runtime-entry.d.ts +10 -0
- package/lib/python-runtime-entry.js +60 -0
- package/lib/sources/eastmoney-http.js +346 -1
- package/lib/sources/tencent-http.js +248 -2
- package/lib/sources/tencent-public-core.js +1 -1
- package/lib/sources-entry.d.ts +1 -1
- package/lib/time/tools.js +2 -0
- package/lib/web-retriever/local-fetch.d.ts +1 -1
- package/lib/web-retriever/local-fetch.js +1 -1
- package/lib/web-retriever/sources.d.ts +16 -1
- package/lib/web-retriever/sources.js +133 -1
- package/lib/web-retriever/tools.js +41 -1
- package/lib/web-retriever/wind-client.d.ts +1 -1
- package/lib/web-retriever/wind-client.js +1 -1
- package/package.json +13 -1
- package/plugin-page/README.en.md +1 -7
- package/plugin-page/README.zh.md +1 -8
- package/preset/capital-generation/agent.patch.yml +12 -13
- package/preset/capital-generation/skills/capital-web-protocol/SKILL.md +10 -4
- package/python/worker.py +154 -0
- package/runtime/manifest.json +75 -0
- package/scripts/python-runtime.mjs +139 -0
- package/watchlist/client.js +83 -3
- package/watchlist/client.src.cjs +565 -1
- package/watchlist/package.json +1 -1
package/watchlist/client.js
CHANGED
|
@@ -5,7 +5,7 @@ window.__ModuleLoader__.load({
|
|
|
5
5
|
var module = { exports: {} }
|
|
6
6
|
var exports = module.exports
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
|
|
8
|
-
"use strict";var S=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.prototype.hasOwnProperty;var ct=(e,a,t)=>()=>{if(t)throw t[0];try{return e&&(a=e(e=0)),a}catch(r){throw t=[r],r}};var dt=(e,a)=>{for(var t in a)S(e,t,{get:a[t],enumerable:!0})},pt=(e,a,t,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of nt(a))!ot.call(e,i)&&i!==t&&S(e,i,{get:()=>a[i],enumerable:!(r=rt(a,i))||r.enumerable});return e};var ht=e=>pt(S({},"__esModule",{value:!0}),e);var H={};dt(H,{ASSET_TYPES:()=>ut,HOLDABLE_ASSET_TYPES:()=>P,MAX_ROW_WEIGHT_PCT:()=>mt,MAX_TOTAL_WEIGHT_PCT:()=>ft,holdingWeight:()=>R,isHoldable:()=>wt,otherHeldWeightPct:()=>I,weightCeiling:()=>gt});var ut,P,wt,mt,ft,R,I,gt,z=ct(()=>{"use strict";ut=["a-share","a-share-index","fund-etf","hk-stock","hk-index","us-stock","us-index"],P=["a-share","fund-etf","hk-stock","us-stock"],wt=e=>P.includes(e?.asset_type),mt=100,ft=120,R=e=>e?.holding===null||e?.holding===void 0?0:e?.holding?.weight_pct??0,I=(e,a)=>e.reduce((t,r)=>r?.thscode===a?t:t+R(r),0),gt=(e,a)=>Math.max(0,Math.min(100,120-I(e,a)))});var{createElement:l,useEffect:bt,useState:M}=require("react"),{createSnapshotStore:xt}=require("@deepseek-ai/dsh-client-store"),{IconChecklistOutlineRegular:yt,IconCloseOutlineRegular:O,IconDatabaseOutlineRegular:vt,IconEllipsisOutlineRegular:kt,IconGoalOutlineRegular:Nt,IconListPenOutlineRegular:St,IconPinOutlineRegular:_t,IconRefreshOutlineRegular:Ct,IconSearchOutlineRegular:Et,IconTrashOutlineRegular:At,Menu:$t,MenuItemButton:Tt,Modal:Pt,Switch:Rt}=require("@deepseek-ai/dsh-client-ui-primitives"),{isHoldable:F,weightCeiling:Q}=(z(),ht(H)),f="capital-watchlist",_="capital.watchlist",D="conversation.input.overlay",j="/capital-watchlist",It="capital-generation",Ht=300,C=10,L="capital-watchlist-css",zt={"command.label":"\u81EA\u9009\u80A1","command.description":"\u6DFB\u52A0 / \u67E5\u770B / \u5220\u9664\u81EA\u9009\u80A1",title:"\u81EA\u9009\u80A1",close:"\u5173\u95ED",searchPlaceholder:"\u8F93\u5165\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\uFF0C\u652F\u6301A\u80A1/\u6E2F\u80A1/\u7F8E\u80A1",add:"\u6DFB\u52A0",added:"\u5DF2\u6DFB\u52A0",refreshing:"\u5237\u65B0\u4E2D\u2026",refresh:"\u5237\u65B0\u62A5\u4EF7",loading:"\u6B63\u5728\u8BFB\u53D6\u6E05\u5355\u2026",empty:"\u8FD8\u6CA1\u6709\u81EA\u9009\u80A1\uFF0C\u7528\u4E0A\u9762\u7684\u8F93\u5165\u6846\u6DFB\u52A0\u3002",colName:"\u540D\u79F0",colQuote:"\u6700\u65B0\u4EF7 / \u6DA8\u8DCC\u5E45",colAction:"\u64CD\u4F5C",updated:"\u66F4\u65B0\u65F6\u95F4",notRefreshed:"\u672A\u5237\u65B0",stale:"\u4E0A\u4E00\u6B21\u5FEB\u7167",exchangeTime:"\u4EA4\u6613\u6240\u65F6\u95F4",noChangePct:"\u6682\u65E0\u6DA8\u8DCC\u6570\u636E",typeAShare:"A\u80A1",typeHkStock:"\u6E2F\u80A1",typeUsStock:"\u7F8E\u80A1",typeAIndex:"A\u6307",typeHkIndex:"\u6E2F\u6307",typeUsIndex:"\u7F8E\u6307",kindStock:"\u80A1\u7968",kindIndex:"\u6307\u6570",kindEtf:"ETF",remove:"\u79FB\u9664",more:"\u66F4\u591A",pin:"\u7F6E\u9876",holdingWeightLabel:"\u6301\u4ED3\u6BD4\u4F8B",holdingStepper:"\u6301\u4ED3\u6BD4\u4F8B\uFF08\u6BCF\u6863 10 \u4E2A\u767E\u5206\u70B9\uFF09",holdingStepUp:"\u589E\u52A0\u6301\u4ED3\u6BD4\u4F8B",holdingStepDown:"\u51CF\u5C11\u6301\u4ED3\u6BD4\u4F8B",holdingName:"\u6301\u4ED3",predict:"\u9884\u6D4B",predictTip:"AI\u9884\u6D4B",review:"\u590D\u76D8",reviewTip:"AI\u590D\u76D8",predictPromptPrefix:"\u8BF7\u9884\u6D4B ",predictPromptSuffix:"\uFF1A\u672A\u6765 5 \u4E2A\u4EA4\u6613\u65E5\u7684\u8D70\u52BF\u4E0E\u5173\u952E\u70B9\u4F4D\uFF0C\u8BF4\u660E\u4F9D\u636E\uFF0C\u5E76\u7ED9\u51FA\u5224\u65AD\u7684\u4E0D\u786E\u5B9A\u6027\u3002",reviewPromptPrefix:"\u8BF7\u590D\u76D8 ",reviewPromptSuffix:"\uFF1A\u4ECA\u65E5\u8D70\u52BF\u4E0E\u91CF\u4EF7\u3001\u8FD1 20 \u65E5\u8D8B\u52BF\u3001\u57FA\u7840\u9762\u3001\u6D88\u606F\u9762\uFF0C\u7ED9\u51FA\u7ED3\u8BBA\u548C\u5FC5\u8981\u98CE\u9669\u8BC4\u4F30\u3002",searching:"\u641C\u7D22\u4E2D\u2026",composingHint:"\u8F93\u5165\u5B8C\u6210\u540E\u81EA\u52A8\u641C\u7D22",clearInput:"\u6E05\u7A7A\u8F93\u5165",confirmTitle:"\u786E\u8BA4\u79FB\u9664\uFF1F",confirmDescPrefix:"\u786E\u5B9A\u5C06 ",confirmDescSuffix:" \u4ECE\u81EA\u9009\u4E2D\u79FB\u9664\u5417\uFF1F",confirmCancel:"\u53D6\u6D88",confirmOk:"\u786E\u8BA4\u79FB\u9664",truncated:"\u6CA1\u6709\u66F4\u591A\uFF0C\u8BF7\u8F93\u5165\u51C6\u786E\u7684\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\u3002",filterAll:"\u5168\u90E8",filterLabel:"\u6309\u5E02\u573A\u7B5B\u9009\u5019\u9009",filterNoHit:"\u8FD9\u4E2A\u5E02\u573A\u4E0B\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\u3002",noHit:"\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\uFF08A\u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF0C\u542B\u6307\u6570\u4E0E\u573A\u5185\u57FA\u91D1\uFF09\u3002","error.invalid_query":"\u8F93\u5165\u4E0D\u88AB\u63A5\u53D7","error.not_found":"\u6CA1\u6709\u627E\u5230\u8BE5\u6807\u7684","error.ambiguous":"\u547D\u4E2D\u591A\u6761\uFF0C\u8BF7\u4ECE\u5019\u9009\u91CC\u9009\u4E00\u6761","error.list_full":"\u81EA\u9009\u80A1\u6700\u591A {max} \u6761\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.list_full_noMax":"\u81EA\u9009\u80A1\u5DF2\u8FBE\u4E0A\u9650\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.credential_missing":"\u672A\u914D\u7F6E Fuyao \u5BC6\u94A5\uFF1A\u5728\u300C\u63D2\u4EF6\u300D\u9875\u7684 \u81EA\u52A8\u6A21\u5F0F\u5361\u7247\u91CC\u586B API Key\uFF08\u53EA\u5F71\u54CD A \u80A1\u90A3\u4E00\u8DEF\uFF0C\u6E2F\u7F8E\u80A1\u7167\u5E38\u7528\uFF09","error.rate_limited":"\u884C\u60C5\u670D\u52A1\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.fuyao_unavailable":"A \u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.tencent_unavailable":"\u6E2F\u7F8E\u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.quote_unavailable":"\u8BE5\u6807\u7684\u6CA1\u6709\u53EF\u7528\u62A5\u4EF7","error.refresh_timeout":"\u5237\u65B0\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.store_unavailable":"\u81EA\u9009\u80A1\u5B58\u50A8\u4E0D\u53EF\u7528","error.unauthorized":"\u767B\u5F55\u72B6\u6001\u5DF2\u5931\u6548\uFF1A\u8BF7\u5148\u56DE\u5230\u5BBF\u4E3B\u7A97\u53E3\u91CD\u65B0\u767B\u5F55",errorSuffix:"\uFF08\u5176\u4ED6\u6807\u7684\u4ECD\u662F\u4E0A\u4E00\u6B21\u6210\u529F\u5FEB\u7167\uFF09","partial.a-share":"A \u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.hk":"\u6E2F\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.us":"\u7F8E\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A"},Mt={"command.label":"Watchlist","command.description":"Add / view / remove watched symbols",title:"Watchlist",close:"Close",searchPlaceholder:"Symbol code or name \u2014 A-share / HK / US",add:"Add",added:"Added",refreshing:"Refreshing\u2026",refresh:"Refresh quotes",loading:"Loading list\u2026",empty:"No symbols yet \u2014 use the input above to add one.",colName:"Symbol",colQuote:"Last / change",colAction:"Actions",updated:"Updated",notRefreshed:"Not refreshed",stale:"last snapshot",exchangeTime:"exchange time",noChangePct:"No change data yet",typeAShare:"A-Share",typeHkStock:"HK",typeUsStock:"US",typeAIndex:"A-Index",typeHkIndex:"HK-Index",typeUsIndex:"US-Index",kindStock:"stock",kindIndex:"index",kindEtf:"ETF",remove:"Remove",more:"More",pin:"Pin to top",holdingWeightLabel:"Holding weight",holdingStepper:"Holding weight, in steps of 10 percentage points",holdingStepUp:"Increase holding weight",holdingStepDown:"Decrease holding weight",holdingName:"Holding",predict:"Predict",predictTip:"AI prediction",review:"Review",reviewTip:"AI review",predictPromptPrefix:"Predict ",predictPromptSuffix:" over the next 5 sessions: the likely path and key levels, the evidence behind the call, and how uncertain it is.",reviewPromptPrefix:"Review ",reviewPromptSuffix:" with today's trend and volume, the last 20 sessions, fundamental, news, then a conclusion and the necessary risks analysis.",searching:"Searching\u2026",composingHint:"Search runs when you finish typing",clearInput:"Clear input",confirmTitle:"Remove this symbol?",confirmDescPrefix:"Remove ",confirmDescSuffix:" from your watchlist?",confirmCancel:"Cancel",confirmOk:"Remove",truncated:"No more candidates \u2014 enter an accurate code or name.",filterAll:"All",filterLabel:"Filter candidates by market",filterNoHit:"No matching symbol in this market.",noHit:"No matching symbol (A-share / HK / US, including indices and listed funds).","error.invalid_query":"Input not accepted","error.not_found":"Symbol not found","error.ambiguous":"Multiple hits \u2014 pick one candidate","error.list_full":"Watchlist holds at most {max} symbols \u2014 remove one first","error.list_full_noMax":"Watchlist is full \u2014 remove one first","error.credential_missing":"No Fuyao API key: set it on the Capital card in the Plugins page (A-share quotes only \u2014 HK and US keep working)","error.rate_limited":"Quote service is rate limited \u2014 try again later","error.fuyao_unavailable":"A-share quotes unavailable \u2014 try again later","error.tencent_unavailable":"HK / US quotes unavailable \u2014 try again later","error.quote_unavailable":"No quote for this symbol","error.refresh_timeout":"Refresh timed out \u2014 try again later","error.store_unavailable":"Watchlist storage unavailable","error.unauthorized":"Session expired \u2014 sign back in to the host first",errorSuffix:" (other symbols still show their last good snapshot)","partial.a-share":"A-share search unavailable: ","partial.hk":"HK search unavailable: ","partial.us":"US search unavailable: "},Ot={"a-share":"typeAShare","hk-stock":"typeHkStock","us-stock":"typeUsStock","a-share-index":"typeAIndex","hk-index":"typeHkIndex","us-index":"typeUsIndex","fund-etf":"typeAShare"},Ft={"a-share":"kindStock","hk-stock":"kindStock","us-stock":"kindStock","a-share-index":"kindIndex","hk-index":"kindIndex","us-index":"kindIndex","fund-etf":"kindEtf"};function Dt(e,a){let t=Ot[e];return t===void 0?String(e??""):a(t)}function jt(e,a){let t=Ft[e];return t===void 0?String(e??""):a(t)}var Lt=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u2028\u2029\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]/gu;function A(e){return String(e??"").replace(Lt,"")}function y(e){return Array.isArray(e)?e.map(a=>a===null||typeof a!="object"?a:{...a,name:A(a.name)}):e}var Ut={"a-share":"capital-watchlist-tag-cn","a-share-index":"capital-watchlist-tag-cn","fund-etf":"capital-watchlist-tag-cn","hk-stock":"capital-watchlist-tag-hk","hk-index":"capital-watchlist-tag-hk","us-stock":"capital-watchlist-tag-us","us-index":"capital-watchlist-tag-us"},K=[{id:"all"},{id:"cn",label:"CN"},{id:"hk",label:"HK"},{id:"us",label:"US"}],U=e=>e.exchange==="HK"?"hk":e.exchange==="US"?"us":"cn",qt=`
|
|
8
|
+
"use strict";var te=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Ke=Object.getOwnPropertyNames;var Qe=Object.prototype.hasOwnProperty;var Ye=(a,t,i)=>()=>{if(i)throw i[0];try{return a&&(t=a(a=0)),t}catch(n){throw i=[n],n}};var Je=(a,t)=>{for(var i in t)te(a,i,{get:t[i],enumerable:!0})},Ve=(a,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ke(t))!Qe.call(a,s)&&s!==i&&te(a,s,{get:()=>t[s],enumerable:!(n=Be(t,s))||n.enumerable});return a};var Xe=a=>Ve(te({},"__esModule",{value:!0}),a);var ge={};Je(ge,{ASSET_TYPES:()=>Ze,HOLDABLE_ASSET_TYPES:()=>me,MAX_ROW_WEIGHT_PCT:()=>aa,MAX_TOTAL_WEIGHT_PCT:()=>ta,holdingWeight:()=>we,isHoldable:()=>ea,otherHeldWeightPct:()=>fe,weightCeiling:()=>ia});var Ze,me,ea,aa,ta,we,fe,ia,be=Ye(()=>{"use strict";Ze=["a-share","a-share-index","fund-etf","hk-stock","hk-index","us-stock","us-index"],me=["a-share","fund-etf","hk-stock","us-stock"],ea=a=>me.includes(a?.asset_type),aa=100,ta=120,we=a=>a?.holding===null||a?.holding===void 0?0:a?.holding?.weight_pct??0,fe=(a,t)=>a.reduce((i,n)=>n?.thscode===t?i:i+we(n),0),ia=(a,t)=>Math.max(0,Math.min(100,120-fe(a,t)))});var{createElement:e,useEffect:Y,useRef:sa,useState:b}=require("react"),{createSnapshotStore:la}=require("@deepseek-ai/dsh-client-store"),{IconChecklistOutlineRegular:J,IconCloseOutlineRegular:xe,IconDatabaseOutlineRegular:ra,IconEllipsisOutlineRegular:Pe,IconGoalOutlineRegular:Te,IconListPenOutlineRegular:na,IconPinOutlineRegular:Re,IconRefreshOutlineRegular:He,IconSearchOutlineRegular:Ie,IconTrashOutlineRegular:se,Menu:le,MenuItemButton:V,Modal:oa,Switch:ca}=require("@deepseek-ai/dsh-client-ui-primitives"),{isHoldable:ye,weightCeiling:Me}=(be(),Xe(ge)),H="capital-watchlist",D="capital.watchlist",ve="conversation.input.overlay",ke="/capital-watchlist",da="capital-generation",pa=300,ie=10,Ne="capital-watchlist-css",ha={"command.label":"\u81EA\u9009\u80A1","command.description":"\u6DFB\u52A0 / \u67E5\u770B / \u5220\u9664\u81EA\u9009\u80A1",title:"\u81EA\u9009\u80A1",close:"\u5173\u95ED",searchPlaceholder:"\u8F93\u5165\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\uFF0C\u652F\u6301A\u80A1/\u6E2F\u80A1/\u7F8E\u80A1",add:"\u6DFB\u52A0",added:"\u5DF2\u6DFB\u52A0",refreshing:"\u5237\u65B0\u4E2D\u2026",refresh:"\u5237\u65B0\u62A5\u4EF7",loading:"\u6B63\u5728\u8BFB\u53D6\u6E05\u5355\u2026",empty:"\u8FD8\u6CA1\u6709\u81EA\u9009\u80A1\uFF0C\u7528\u4E0A\u9762\u7684\u8F93\u5165\u6846\u6DFB\u52A0\u3002",colName:"\u540D\u79F0",colQuote:"\u6700\u65B0\u4EF7 / \u6DA8\u8DCC\u5E45",colAction:"\u64CD\u4F5C",updated:"\u66F4\u65B0\u65F6\u95F4",notRefreshed:"\u672A\u5237\u65B0",stale:"\u4E0A\u4E00\u6B21\u5FEB\u7167",exchangeTime:"\u4EA4\u6613\u6240\u65F6\u95F4",noChangePct:"\u6682\u65E0\u6DA8\u8DCC\u6570\u636E",typeAShare:"A\u80A1",typeHkStock:"\u6E2F\u80A1",typeUsStock:"\u7F8E\u80A1",typeAIndex:"A\u6307",typeHkIndex:"\u6E2F\u6307",typeUsIndex:"\u7F8E\u6307",kindStock:"\u80A1\u7968",kindIndex:"\u6307\u6570",kindEtf:"ETF",remove:"\u79FB\u9664",more:"\u66F4\u591A",pin:"\u7F6E\u9876",holdingWeightLabel:"\u6301\u4ED3\u6BD4\u4F8B",holdingStepper:"\u6301\u4ED3\u6BD4\u4F8B\uFF08\u6BCF\u6863 10 \u4E2A\u767E\u5206\u70B9\uFF09",holdingStepUp:"\u589E\u52A0\u6301\u4ED3\u6BD4\u4F8B",holdingStepDown:"\u51CF\u5C11\u6301\u4ED3\u6BD4\u4F8B",holdingName:"\u6301\u4ED3",predict:"\u9884\u6D4B",predictTip:"AI\u9884\u6D4B",review:"\u590D\u76D8",reviewTip:"AI\u590D\u76D8",predictPromptPrefix:"\u8BF7\u9884\u6D4B ",predictPromptSuffix:"\uFF1A\u672A\u6765 5 \u4E2A\u4EA4\u6613\u65E5\u7684\u8D70\u52BF\u4E0E\u5173\u952E\u70B9\u4F4D\uFF0C\u8BF4\u660E\u4F9D\u636E\uFF0C\u5E76\u7ED9\u51FA\u5224\u65AD\u7684\u4E0D\u786E\u5B9A\u6027\u3002",reviewPromptPrefix:"\u8BF7\u590D\u76D8 ",reviewPromptSuffix:"\uFF1A\u4ECA\u65E5\u8D70\u52BF\u4E0E\u91CF\u4EF7\u3001\u8FD1 20 \u65E5\u8D8B\u52BF\u3001\u57FA\u7840\u9762\u3001\u6D88\u606F\u9762\uFF0C\u7ED9\u51FA\u7ED3\u8BBA\u548C\u5FC5\u8981\u98CE\u9669\u8BC4\u4F30\u3002",searching:"\u641C\u7D22\u4E2D\u2026",composingHint:"\u8F93\u5165\u5B8C\u6210\u540E\u81EA\u52A8\u641C\u7D22",clearInput:"\u6E05\u7A7A\u8F93\u5165",confirmTitle:"\u786E\u8BA4\u79FB\u9664\uFF1F",confirmDescPrefix:"\u786E\u5B9A\u5C06 ",confirmDescSuffix:" \u4ECE\u81EA\u9009\u4E2D\u79FB\u9664\u5417\uFF1F",confirmCancel:"\u53D6\u6D88",confirmOk:"\u786E\u8BA4\u79FB\u9664",truncated:"\u6CA1\u6709\u66F4\u591A\uFF0C\u8BF7\u8F93\u5165\u51C6\u786E\u7684\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\u3002",filterAll:"\u5168\u90E8",filterLabel:"\u6309\u5E02\u573A\u7B5B\u9009\u5019\u9009",filterNoHit:"\u8FD9\u4E2A\u5E02\u573A\u4E0B\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\u3002",noHit:"\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\uFF08A\u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF0C\u542B\u6307\u6570\u4E0E\u573A\u5185\u57FA\u91D1\uFF09\u3002","error.invalid_query":"\u8F93\u5165\u4E0D\u88AB\u63A5\u53D7","error.not_found":"\u6CA1\u6709\u627E\u5230\u8BE5\u6807\u7684","error.ambiguous":"\u547D\u4E2D\u591A\u6761\uFF0C\u8BF7\u4ECE\u5019\u9009\u91CC\u9009\u4E00\u6761","error.list_full":"\u81EA\u9009\u80A1\u6700\u591A {max} \u6761\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.list_full_noMax":"\u81EA\u9009\u80A1\u5DF2\u8FBE\u4E0A\u9650\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.credential_missing":"\u672A\u914D\u7F6E Fuyao \u5BC6\u94A5\uFF1A\u5728\u300C\u63D2\u4EF6\u300D\u9875\u7684 \u81EA\u52A8\u6A21\u5F0F\u5361\u7247\u91CC\u586B API Key\uFF08\u53EA\u5F71\u54CD A \u80A1\u90A3\u4E00\u8DEF\uFF0C\u6E2F\u7F8E\u80A1\u7167\u5E38\u7528\uFF09","error.rate_limited":"\u884C\u60C5\u670D\u52A1\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.fuyao_unavailable":"A \u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.tencent_unavailable":"\u6E2F\u7F8E\u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.quote_unavailable":"\u8BE5\u6807\u7684\u6CA1\u6709\u53EF\u7528\u62A5\u4EF7","error.refresh_timeout":"\u5237\u65B0\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.store_unavailable":"\u81EA\u9009\u80A1\u5B58\u50A8\u4E0D\u53EF\u7528","error.unauthorized":"\u767B\u5F55\u72B6\u6001\u5DF2\u5931\u6548\uFF1A\u8BF7\u5148\u56DE\u5230\u5BBF\u4E3B\u7A97\u53E3\u91CD\u65B0\u767B\u5F55",errorSuffix:"\uFF08\u5176\u4ED6\u6807\u7684\u4ECD\u662F\u4E0A\u4E00\u6B21\u6210\u529F\u5FEB\u7167\uFF09","partial.a-share":"A \u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.hk":"\u6E2F\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.us":"\u7F8E\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","desk.panel":"\u81EA\u9009\u80A1","desk.title":"\u81EA\u9009\u80A1\u884C\u60C5\u5DE5\u4F5C\u53F0","desk.refresh":"\u5237\u65B0\u884C\u60C5","desk.refreshing":"\u5237\u65B0\u4E2D\u2026","desk.loading":"\u6B63\u5728\u8BFB\u53D6\u81EA\u9009\u80A1\u2026","desk.lastUpdate":"\u6700\u8FD1\u66F4\u65B0","desk.notRefreshed":"\u672A\u5237\u65B0","desk.filter":"\u7B5B\u9009\u6807\u7684","desk.filterPlaceholder":"\u540D\u79F0\u6216\u4EE3\u7801","desk.group":"\u5206\u7EC4","desk.allGroups":"\u5168\u90E8","desk.newGroup":"\u5206\u7EC4\u540D\u79F0","desk.createGroup":"\u65B0\u5EFA","desk.deleteGroup":"\u5220\u9664\u5206\u7EC4","desk.noGroup":"\u672A\u5206\u7EC4","desk.more":"\u66F4\u591A\u64CD\u4F5C","desk.noGroupYet":"\u8FD8\u6CA1\u6709\u5206\u7EC4","desk.pin":"\u7F6E\u9876","desk.remove":"\u79FB\u9664","desk.removeHint":"\u518D\u70B9\u4E00\u6B21\u5220\u9664\u6309\u94AE\u786E\u8BA4\u79FB\u9664","desk.cancel":"\u53D6\u6D88","desk.empty":"\u8FD8\u6CA1\u6709\u81EA\u9009\u80A1","desk.emptyHint":"\u7528\u8F93\u5165\u6846\u7684\u300C\u81EA\u9009\u80A1\u300D\u9762\u677F\u6DFB\u52A0\u6807\u7684\uFF0C\u8FD9\u91CC\u4F1A\u540C\u6B65\u663E\u793A\u3002","desk.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684","desk.noMatchHint":"\u6362\u4E2A\u5173\u952E\u8BCD\uFF0C\u6216\u5207\u56DE\u300C\u5168\u90E8\u300D\u5206\u7EC4\u3002","desk.selectHint":"\u9009\u62E9\u4E00\u53EA\u6807\u7684\u67E5\u770B\u8BE6\u60C5","desk.selectHintBody":"\u5DE6\u4FA7\u5217\u8868\u6309\u5206\u7EC4\u7B5B\u9009\uFF1B\u9009\u4E2D\u540E\u8FD9\u91CC\u663E\u793A\u62A5\u4EF7\u3001\u5206\u65F6\u4E0E\u6210\u4EA4\u91CF\u3002","desk.intraday":"\u5F53\u65E5\u5206\u65F6","desk.intradayEmpty":"\u5F53\u524D\u884C\u60C5\u63A5\u53E3\u53EA\u8FD4\u56DE\u6700\u65B0\u5FEB\u7167","desk.intradayEmptyHint":"\u63A5\u5165\u5206\u65F6\u5E8F\u5217\u540E\uFF0C\u8FD9\u91CC\u76F4\u63A5\u7ED8\u5236\u5F53\u65E5\u8D70\u52BF\u3002","desk.volume":"\u6210\u4EA4\u91CF","desk.volumeEmpty":"\u6682\u65E0\u6210\u4EA4\u91CF\u6570\u636E","desk.capturedAt":"\u5FEB\u7167\u65F6\u95F4","desk.sourceTime":"\u4EA4\u6613\u6240\u65F6\u95F4","desk.groupsOf":"\u6240\u5C5E\u5206\u7EC4","desk.kind":"\u6807\u7684\u7C7B\u578B","desk.colName":"\u540D\u79F0","desk.colPrice":"\u6700\u65B0","desk.colChange":"\u6DA8\u8DCC","desk.colAction":"\u64CD\u4F5C","desk.loadFailed":"\u81EA\u9009\u80A1\u670D\u52A1\u6682\u4E0D\u53EF\u7528"},ua={"command.label":"Watchlist","command.description":"Add / view / remove watched symbols",title:"Watchlist",close:"Close",searchPlaceholder:"Symbol code or name \u2014 A-share / HK / US",add:"Add",added:"Added",refreshing:"Refreshing\u2026",refresh:"Refresh quotes",loading:"Loading list\u2026",empty:"No symbols yet \u2014 use the input above to add one.",colName:"Symbol",colQuote:"Last / change",colAction:"Actions",updated:"Updated",notRefreshed:"Not refreshed",stale:"last snapshot",exchangeTime:"exchange time",noChangePct:"No change data yet",typeAShare:"A-Share",typeHkStock:"HK",typeUsStock:"US",typeAIndex:"A-Index",typeHkIndex:"HK-Index",typeUsIndex:"US-Index",kindStock:"stock",kindIndex:"index",kindEtf:"ETF",remove:"Remove",more:"More",pin:"Pin to top",holdingWeightLabel:"Holding weight",holdingStepper:"Holding weight, in steps of 10 percentage points",holdingStepUp:"Increase holding weight",holdingStepDown:"Decrease holding weight",holdingName:"Holding",predict:"Predict",predictTip:"AI prediction",review:"Review",reviewTip:"AI review",predictPromptPrefix:"Predict ",predictPromptSuffix:" over the next 5 sessions: the likely path and key levels, the evidence behind the call, and how uncertain it is.",reviewPromptPrefix:"Review ",reviewPromptSuffix:" with today's trend and volume, the last 20 sessions, fundamental, news, then a conclusion and the necessary risks analysis.",searching:"Searching\u2026",composingHint:"Search runs when you finish typing",clearInput:"Clear input",confirmTitle:"Remove this symbol?",confirmDescPrefix:"Remove ",confirmDescSuffix:" from your watchlist?",confirmCancel:"Cancel",confirmOk:"Remove",truncated:"No more candidates \u2014 enter an accurate code or name.",filterAll:"All",filterLabel:"Filter candidates by market",filterNoHit:"No matching symbol in this market.",noHit:"No matching symbol (A-share / HK / US, including indices and listed funds).","error.invalid_query":"Input not accepted","error.not_found":"Symbol not found","error.ambiguous":"Multiple hits \u2014 pick one candidate","error.list_full":"Watchlist holds at most {max} symbols \u2014 remove one first","error.list_full_noMax":"Watchlist is full \u2014 remove one first","error.credential_missing":"No Fuyao API key: set it on the Capital card in the Plugins page (A-share quotes only \u2014 HK and US keep working)","error.rate_limited":"Quote service is rate limited \u2014 try again later","error.fuyao_unavailable":"A-share quotes unavailable \u2014 try again later","error.tencent_unavailable":"HK / US quotes unavailable \u2014 try again later","error.quote_unavailable":"No quote for this symbol","error.refresh_timeout":"Refresh timed out \u2014 try again later","error.store_unavailable":"Watchlist storage unavailable","error.unauthorized":"Session expired \u2014 sign back in to the host first",errorSuffix:" (other symbols still show their last good snapshot)","partial.a-share":"A-share search unavailable: ","partial.hk":"HK search unavailable: ","partial.us":"US search unavailable: ","desk.panel":"Watchlist","desk.title":"Watchlist market desk","desk.refresh":"Refresh quotes","desk.refreshing":"Refreshing\u2026","desk.loading":"Loading watchlist\u2026","desk.lastUpdate":"Last update","desk.notRefreshed":"Not refreshed","desk.filter":"Filter symbols","desk.filterPlaceholder":"Name or code","desk.group":"Group","desk.allGroups":"All","desk.newGroup":"Group name","desk.createGroup":"Create","desk.deleteGroup":"Delete group","desk.noGroup":"Ungrouped","desk.more":"More actions","desk.noGroupYet":"No groups yet","desk.pin":"Pin","desk.remove":"Remove","desk.removeHint":"Press remove again to confirm","desk.cancel":"Cancel","desk.empty":"No symbols yet","desk.emptyHint":"Add symbols from the watchlist panel in the composer; they appear here.","desk.noMatch":"No symbols match","desk.noMatchHint":"Try another term, or switch back to All.","desk.selectHint":"Select a symbol","desk.selectHintBody":"The left list filters by group; the quote, intraday and volume panels follow the selection.","desk.intraday":"Intraday","desk.intradayEmpty":"The quote endpoint returns a snapshot only","desk.intradayEmptyHint":"Once an intraday series is available, the same-session trend draws here.","desk.volume":"Volume","desk.volumeEmpty":"No volume data","desk.capturedAt":"Captured","desk.sourceTime":"Exchange time","desk.groupsOf":"Groups","desk.kind":"Instrument","desk.colName":"Symbol","desk.colPrice":"Last","desk.colChange":"Change","desk.colAction":"Actions","desk.loadFailed":"Watchlist service unavailable"},ma={"a-share":"typeAShare","hk-stock":"typeHkStock","us-stock":"typeUsStock","a-share-index":"typeAIndex","hk-index":"typeHkIndex","us-index":"typeUsIndex","fund-etf":"typeAShare"},wa={"a-share":"kindStock","hk-stock":"kindStock","us-stock":"kindStock","a-share-index":"kindIndex","hk-index":"kindIndex","us-index":"kindIndex","fund-etf":"kindEtf"};function Oe(a,t){let i=ma[a];return i===void 0?String(a??""):t(i)}function fa(a,t){let i=wa[a];return i===void 0?String(a??""):t(i)}var ga=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u2028\u2029\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]/gu;function L(a){return String(a??"").replace(ga,"")}function $(a){return Array.isArray(a)?a.map(t=>t===null||typeof t!="object"?t:{...t,name:L(t.name)}):a}var ba={"a-share":"capital-watchlist-tag-cn","a-share-index":"capital-watchlist-tag-cn","fund-etf":"capital-watchlist-tag-cn","hk-stock":"capital-watchlist-tag-hk","hk-index":"capital-watchlist-tag-hk","us-stock":"capital-watchlist-tag-us","us-index":"capital-watchlist-tag-us"},Ge=[{id:"all"},{id:"cn",label:"CN"},{id:"hk",label:"HK"},{id:"us",label:"US"}],_e=a=>a.exchange==="HK"?"hk":a.exchange==="US"?"us":"cn",xa=`
|
|
9
9
|
.capital-watchlist-dialog.capital-watchlist-dialog { width: min(420px, 92vw); max-height: 100%; padding: 0; gap: 0; border-radius: 18px; }
|
|
10
10
|
.capital-watchlist-card { position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-radius: 18px; --capital-watchlist-up: #d1493f; --capital-watchlist-down: #17a063; --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2); --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2); }
|
|
11
11
|
.capital-watchlist-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 20px 14px; }
|
|
@@ -126,8 +126,88 @@ window.__ModuleLoader__.load({
|
|
|
126
126
|
.capital-watchlist-rows { width: 256px; }
|
|
127
127
|
/* Theme has no global border-box reset; the official item padding would overflow the list. */
|
|
128
128
|
.capital-watchlist-rows button { box-sizing: border-box; }
|
|
129
|
-
|
|
130
|
-
`);return await navigator.clipboard.writeText(a),a}dispose(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort()}};function B(e){if(typeof e!="number"||!Number.isFinite(e))return"";let a=new Date(e),t=r=>String(r).padStart(2,"0");return`${t(a.getMonth()+1)}-${t(a.getDate())} ${t(a.getHours())}:${t(a.getMinutes())}`}function W({assetType:e,t:a}){return l("span",{className:`capital-watchlist-tag ${Ut[e]??"capital-watchlist-tag-cn"}`},Dt(e,a))}function Qt(e,a,t){let r=A(e.name);return`${a(`${t}PromptPrefix`)}${r} (${e.thscode} \xB7 ${jt(e.asset_type,a)})${a(`${t}PromptSuffix`)}`}function Kt({quote:e,failureCode:a,refreshing:t,t:r}){let i=a!==void 0;if(e==null)return t===!0?l("div",{className:"capital-watchlist-quote"},l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-price"}),l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-change"})):i?l("div",{className:"capital-watchlist-quote",title:r(`error.${a}`)},l("div",{className:"capital-watchlist-price capital-watchlist-quotefailed"},"\u2014")):l("div",{className:"capital-watchlist-quote"},l("div",{className:"capital-watchlist-price"},r("notRefreshed")));let d=typeof e.change_pct=="number"&&Number.isFinite(e.change_pct),n=d?`${e.change_pct>0?"+":""}${e.change_pct.toFixed(2)}%`:"\u2014",c=i?"capital-watchlist-stale":d?e.change_pct>0?"capital-watchlist-up":e.change_pct<0?"capital-watchlist-down":"capital-watchlist-flat":"capital-watchlist-nodata",o=typeof e.source_time=="string"&&e.source_time.length>0?`${r("exchangeTime")} ${e.source_time}`:"",p=[];return i?p.push(`${r(`error.${a}`)} \xB7 ${r("stale")} ${B(e.captured_at)}`):d||p.push(r("noChangePct")),o.length>0&&p.push(o),l("div",{className:"capital-watchlist-quote",title:p.length===0?void 0:p.join(" \xB7 ")},l("div",{className:i?"capital-watchlist-price capital-watchlist-stale":"capital-watchlist-price"},e.price.toFixed(2)),l("div",{className:`capital-watchlist-change ${c}`},n))}function Bt(e,a){if(a.code!=="list_full")return e(`error.${a.code}`);let t=a.limit;return typeof t!="number"||!Number.isFinite(t)?e("error.list_full_noMax"):e("error.list_full").replace("{max}",String(t))}function Yt(e,a){let t=e?.weight_pct;return t==null?a("holdingName"):`${a("holdingName")} ${t}%`}function Gt(e,a){let t=`${e.name} ${e.ticker}`;return e.holding===null||e.holding===void 0?t:`${t} \xB7 ${Yt(e.holding,a)}`}function Xt({useDialog:e,surface:a,t,inputActions:r}){let i=e(s=>s),[d,n]=M(!1),[c,o]=M(null),p=i.pendingRemove??null;if(bt(()=>()=>a.dispose(),[a]),!i.open)return null;let h=i.dropdownOpen===!0,g=p!==null,Y=s=>{if(s.key==="Escape"){if(g){s.stopPropagation(),a.setPendingRemove(null);return}h&&(s.stopPropagation(),a.hideDropdown())}},G=s=>{if(!h)return;let w=s.relatedTarget;w!=null&&s.currentTarget?.contains?.(w)===!0||a.hideDropdown()},b=i.error,X=b==null?null:l("p",{className:"capital-watchlist-notice",role:"alert","data-code":b.code},`${t(`error.${b.code}`)}${b.partial===!0?t("errorSuffix"):""}`),$=(s,w)=>{r.insertText(Qt(s,t,w),r.captureInsertion())===!0&&a.close()},v=i.marketFilter==="all"?i.candidates:i.candidates.filter(s=>U(s)===i.marketFilter),T={all:i.candidates.length,cn:0,hk:0,us:0};for(let s of i.candidates)T[U(s)]+=1;let J=i.candidates.length===0?null:l("div",{className:"capital-watchlist-filter",role:"group","aria-label":t("filterLabel")},K.map(s=>l("button",{key:s.id,type:"button",className:"capital-watchlist-filterbtn","aria-pressed":i.marketFilter===s.id,onClick:()=>a.setMarketFilter(s.id)},l("span",{className:"capital-watchlist-filterlabel"},s.id==="all"?t("filterAll"):s.label),l("span",{className:"capital-watchlist-filtercount"},String(T[s.id]))))),V=h?l("div",{className:"capital-watchlist-dropdown","aria-label":t("title"),"data-menu-material":"translucent"},J,l("div",{className:"capital-watchlist-options",role:"listbox","aria-label":t("title")},v.map(s=>l("button",{key:s.thscode,type:"button",role:"option",className:"capital-watchlist-option",title:s.name,"aria-disabled":s.in_list===!0||c===s.thscode,onClick:()=>{s.in_list===!0||c===s.thscode||(n(!0),o(s.thscode),a.add(s).finally(()=>{n(!1),o(null)}))}},l("span",{className:"capital-watchlist-optionmain"},l("span",{className:"capital-watchlist-optionname"},s.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-optioncode"},s.thscode),l(W,{assetType:s.asset_type,t}))),l("span",{className:"capital-watchlist-addbtn","data-state":s.in_list===!0?"added":"idle"},s.in_list===!0?t("added"):t("add")))),i.truncated===!0&&v.length>0?l("div",{className:"capital-watchlist-hint capital-watchlist-endhint"},t("truncated")):null),i.composing===!0?l("div",{className:"capital-watchlist-hint"},t("composingHint")):i.searching===!0||i.pendingSearch===!0?l("div",{className:"capital-watchlist-hint"},t("searching")):i.searchError!==null&&i.searchError!==void 0?l("div",{className:"capital-watchlist-hint capital-watchlist-searcherror",role:"alert","data-code":i.searchError.code},t(`error.${i.searchError.code}`)):i.candidates.length===0?l("div",{className:"capital-watchlist-hint"},t("noHit")):v.length===0?l("div",{className:"capital-watchlist-hint","data-filter":i.marketFilter},t("filterNoHit")):null,...(i.searchPartial??[]).map(s=>l("div",{key:`partial-${s.market}`,className:"capital-watchlist-hint capital-watchlist-searcherror",role:"status","data-market":s.market,"data-code":s.code},`${t(`partial.${s.market}`)}${t(`error.${s.code}`)}`))):null,Z=i.items.length===0?null:l("div",{className:"capital-watchlist-grid capital-watchlist-head"},l("span",null,t("colName")),l("span",{className:"capital-watchlist-quote"},t("colQuote")),l("span",{className:"capital-watchlist-headaction"},t("colAction"))),tt=i.loadError!==null&&i.loadError!==void 0?l("p",{className:"capital-watchlist-empty capital-watchlist-loaderror",role:"alert","data-code":i.loadError.code},t(`error.${i.loadError.code}`)):l("p",{className:"capital-watchlist-empty"},t("empty")),at=i.loading?l("p",{className:"capital-watchlist-empty"},t("loading")):i.items.length===0?tt:l("div",{className:h?"capital-watchlist-list capital-watchlist-list-open":"capital-watchlist-list"},i.items.map((s,w)=>{let x=s.holding!==null&&s.holding!==void 0,u=s.holding?.weight_pct,it=F(s)||x,k=Q(i.items,s.thscode),lt=!x||u===null||u===void 0||u<=0,st=(typeof u=="number"?u:0)+C>k;return l("div",{key:s.thscode,className:"capital-watchlist-grid capital-watchlist-row","data-thscode":s.thscode},l("span",{className:"capital-watchlist-namewrap"},l("span",{className:x?"capital-watchlist-name capital-watchlist-name-held":"capital-watchlist-name",title:Gt(s,t)},s.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-code"},s.ticker),l(W,{assetType:s.asset_type,t}))),l(Kt,{quote:s.quote,failureCode:i.failures[s.thscode],refreshing:i.refreshing,t}),l("span",{className:"capital-watchlist-rowactions"},l("button",{type:"button",className:"capital-watchlist-predict",disabled:d,title:t("predictTip"),"aria-label":`${t("predict")} ${s.name}`,onClick:()=>$(s,"predict")},l(Nt,{size:14})),l("button",{type:"button",className:"capital-watchlist-review",disabled:d,title:t("reviewTip"),"aria-label":`${t("review")} ${s.name}`,onClick:()=>$(s,"review")},l(St,{size:14})),l($t,{open:i.rowMenu===s.thscode,anchor:l("button",{type:"button",className:"capital-watchlist-more",disabled:d,title:t("more"),"aria-label":`${t("more")} ${s.name}`,"aria-haspopup":"menu","aria-expanded":i.rowMenu===s.thscode,onClick:()=>a.toggleRowMenu(s.thscode)},l(kt,{size:14})),items:[{id:"pin",label:t("pin"),icon:l(_t,{size:14}),disabled:w===0}],children:[...it?[l("div",{key:"holding-check",role:"group","aria-label":t("holdingName"),className:"capital-watchlist-checkrow"},l("span",{className:"capital-watchlist-checkicon","aria-hidden":"true"},l(vt,{size:14})),l("span",{className:"capital-watchlist-checklabel"},t("holdingName")),l(Rt,{checked:x,disabled:d,label:t("holdingName"),onChange:N=>N?a.markHolding(s.thscode,null):a.clearHolding(s.thscode)}))]:[],...x&&F(s)?[l("div",{key:"holding-step",className:"capital-watchlist-stepper",role:"group","aria-label":t("holdingStepper")},l("span",{className:"capital-watchlist-stepperlabel"},t("holdingWeightLabel")),l("span",{className:"capital-watchlist-stepperline"},l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepDown"),disabled:lt,onClick:()=>a.stepHolding(s.thscode,-C)},"\u2212"),l("span",{className:typeof u=="number"?"capital-watchlist-stepperreadout":"capital-watchlist-stepperreadout capital-watchlist-stepperplaceholder",role:"status"},typeof u=="number"?`${u}%`:`0~${k}`),l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepUp"),title:`0~${k}`,disabled:st,onClick:()=>a.stepHolding(s.thscode,C)},"+")))]:[],l(Tt,{key:"remove",danger:!0,separatorBefore:!0,icon:l(At,{size:14}),onSelect:()=>{a.closeRowMenu(),a.setPendingRemove(s)}},t("remove"))],onSelect:N=>{N==="pin"&&(a.closeRowMenu(),a.pin(s.thscode))},onClose:()=>a.closeRowMenu(),align:"end",portal:!0,listClassName:"capital-watchlist-rows",className:"capital-watchlist-actions"})))})),et=l("div",{className:g?"capital-watchlist-confirm capital-watchlist-confirm-open":"capital-watchlist-confirm","aria-hidden":g?void 0:"true"},l("div",{className:"capital-watchlist-confirmbox",role:g?"alertdialog":void 0,"aria-label":t("confirmTitle")},l("div",{className:"capital-watchlist-confirmtitle"},t("confirmTitle")),g?l("p",{className:"capital-watchlist-confirmdesc"},t("confirmDescPrefix"),l("strong",null,`${p.name} \xB7 ${p.ticker}`),t("confirmDescSuffix")):null,l("div",{className:"capital-watchlist-confirmactions"},l("button",{type:"button",className:"capital-watchlist-confirmbtn",onClick:()=>a.setPendingRemove(null)},t("confirmCancel")),l("button",{type:"button",className:"capital-watchlist-confirmbtn capital-watchlist-confirmdanger",onClick:()=>{let s=p;a.setPendingRemove(null),s!==null&&a.remove(s.thscode)}},t("confirmOk")))));return l(Pt,{open:!0,onClose:()=>a.close(),title:t("title"),headless:!0,shortcutModal:"watchlist",className:"capital-watchlist-dialog"},l("div",{className:"capital-watchlist-card",onKeyDown:Y},l("div",{className:"capital-watchlist-header"},l("h2",{className:"capital-watchlist-title"},t("title")),l("button",{type:"button",className:"capital-watchlist-close","aria-label":t("close"),onClick:()=>a.close()},l(O,{size:14}))),l("div",{className:"capital-watchlist-search",onBlur:G},l("div",{className:"capital-watchlist-field"},l("span",{className:"capital-watchlist-searchicon"},l(Et,{size:16})),l("input",{className:"capital-watchlist-input","data-modal-autofocus":!0,value:i.query,placeholder:t("searchPlaceholder"),onChange:s=>a.onQueryChange(s.target.value,s.isComposing),onCompositionStart:()=>a.beginComposition(),onCompositionEnd:s=>a.endComposition(s.target.value)}),i.query.length>0?l("button",{type:"button",className:"capital-watchlist-clear",title:t("clearInput"),"aria-label":t("clearInput"),onMouseDown:s=>s.preventDefault(),onClick:()=>a.onQueryChange("",!1)},l(O,{size:12})):null),V),i.addError!==null&&i.addError!==void 0?l("p",{className:"capital-watchlist-adderror",role:"status","data-code":i.addError.code},Bt(t,i.addError)):null,Z,at,l("div",{className:"capital-watchlist-footer"},l("div",{className:"capital-watchlist-footcol"},l("button",{type:"button",className:"capital-watchlist-refresh",disabled:i.refreshing||d,onClick:()=>{a.refresh()}},l(Ct,{size:14}),i.refreshing?t("refreshing"):t("refresh")),X),l("span",{className:"capital-watchlist-updated"},`${t("updated")} ${i.refreshed_at===null||i.refreshed_at===void 0?t("notRefreshed"):B(i.refreshed_at)}`)),et))}function Jt(e){e.effect(Wt,`${f}: styles`),e.effect(()=>e.locale.register(_,{zh:zt,en:Mt}),`${f}: dictionaries`);let a=new Map,t=n=>{let c=a.get(n);return c===void 0&&(c=new E,a.set(n,c)),c};e.effect(()=>()=>{for(let n of a.values())n.dispose();a.clear()},`${f}: per-session surfaces`);let r=n=>{let o=e.sessions?.list?.getSnapshot?.().byId?.[n]?.projectionValues?.agentPreset;return typeof o=="string"?o:void 0},i=new Set,d=n=>{let c=r(n);return c!==void 0?c===It:(i.has(n)||(i.add(n),Promise.resolve(e.sessions?.refreshProjections?.(n)).catch(()=>{})),!1)};e.slots.inject(D,()=>e.slots.register({name:D,id:"capital-watchlist-dialog",order:3,locale:_,inject:n=>{let c=t(n);return{hooks:{dialog:c.state},surface:c}}},Xt)),e.inject(["commandUi"],n=>{let c=e.locale.bind(_);n.effect(()=>n.commandUi.register({name:"watchlist",label:()=>c("command.label"),description:()=>c("command.description"),icon:yt,available:o=>d(o.sessionId),ui:{kind:"action",run:o=>{t(o.sessionId).open()}}}),`${f}: /watchlist contribution`)}),e.logger?.info?.(`${f}: \u5BA2\u6237\u7AEF\u534A\u8FB9\u5DF2\u6302\u8F7D\uFF08/watchlist \u83DC\u5355\u884C + \u81EA\u9009\u80A1\u5F39\u7A97\uFF09`)}exports.name=f;exports.inject=["slots","locale","commandUi","sessions"];exports.apply=Jt;
|
|
129
|
+
/* --- \u884C\u60C5\u5DE5\u4F5C\u53F0\uFF1A\u5DE6\u4FA7\u680F\u5165\u53E3 + main \u9762\u677F\u3002\u5361\u7247\u8D70\u53D1\u4E1D\u7EBF\uFF0C\u6D6E\u5C42\u4EA4\u7ED9\u5B98\u65B9 Menu\u3002 --- */
|
|
130
|
+
.cwd-page { height: 100%; min-height: 0; overflow-y: auto; --cwd-body-h: clamp(520px, 78vh, 860px); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); --cwd-card: var(--dsw-alias-bg-layer-2, var(--dsw-alias-bg-layer-1)); --capital-watchlist-up: #d1493f; --capital-watchlist-down: #17a063; }
|
|
131
|
+
.cwd-inner { max-width: 1180px; margin: 0 auto; padding: 28px 32px 44px; }
|
|
132
|
+
.cwd-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
|
|
133
|
+
.cwd-title { margin: 0; font-size: 26px; line-height: 32px; font-weight: 650; letter-spacing: -.2px; }
|
|
134
|
+
.cwd-headactions { display: flex; align-items: center; gap: 14px; flex: none; }
|
|
135
|
+
.cwd-updated { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
136
|
+
.cwd-refresh { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 34px; padding: 0 14px; border: .5px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 25%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent); color: var(--dsw-alias-state-business-primary); font-family: inherit; font-size: 13px; line-height: 20px; font-weight: 500; cursor: pointer; }
|
|
137
|
+
.cwd-refresh:hover:not(:disabled) { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 20%, transparent); }
|
|
138
|
+
.cwd-refresh:disabled { opacity: .45; cursor: not-allowed; }
|
|
139
|
+
.cwd-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(430px, 1.35fr); gap: 22px; align-items: stretch; height: var(--cwd-body-h); }
|
|
140
|
+
.cwd-card { display: flex; flex-direction: column; height: 100%; min-width: 0; min-height: 0; border: .5px solid var(--dsw-alias-border-l1); border-radius: 14px; background: var(--cwd-card); overflow: hidden; }
|
|
141
|
+
.cwd-toolbar { display: flex; flex: none; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: .5px solid var(--dsw-alias-border-l2); }
|
|
142
|
+
.cwd-field { display: flex; align-items: center; gap: 6px; flex: 1 1 170px; min-width: 0; height: 34px; padding: 0 10px; border-radius: 10px; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-tertiary); }
|
|
143
|
+
.cwd-field input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: none; outline: none; background: transparent; color: var(--dsw-alias-label-primary); font-family: inherit; font-size: 13px; }
|
|
144
|
+
.cwd-field input::placeholder { color: var(--dsw-alias-label-tertiary); }
|
|
145
|
+
.cwd-pill { display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 160px; height: 34px; padding: 0 12px; border: none; border-radius: 10px; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); font-family: inherit; font-size: 12.5px; line-height: 20px; cursor: pointer; }
|
|
146
|
+
.cwd-pill:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
|
|
147
|
+
.cwd-pill:disabled { opacity: .45; cursor: not-allowed; }
|
|
148
|
+
.cwd-pill span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
149
|
+
.cwd-groupcreate { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
|
|
150
|
+
.cwd-groupcreate input { width: 104px; height: 34px; padding: 0 10px; border: .5px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-primary); font-family: inherit; font-size: 12.5px; }
|
|
151
|
+
.cwd-thead, .cwd-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 92px 84px 40px; gap: 10px; align-items: center; }
|
|
152
|
+
.cwd-thead { flex: none; padding: 8px 14px; border-bottom: .5px solid var(--dsw-alias-border-l2); font-size: 11px; line-height: 16px; letter-spacing: .2px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; }
|
|
153
|
+
.cwd-right { text-align: right; }
|
|
154
|
+
.cwd-tablebody { flex: 1; min-height: 0; overflow-y: auto; border-bottom: .5px solid var(--dsw-alias-border-l2); }
|
|
155
|
+
.cwd-row { padding: 9px 14px; border-bottom: .5px solid var(--dsw-alias-border-l2); transition: background .15s var(--ds-ease-in-out); }
|
|
156
|
+
.cwd-row:last-of-type { border-bottom: none; }
|
|
157
|
+
.cwd-row:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
158
|
+
.cwd-row[aria-current="true"] { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent); }
|
|
159
|
+
.cwd-nameline { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
160
|
+
.cwd-cellname { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 0; border: none; background: transparent; color: inherit; font-family: inherit; text-align: left; cursor: pointer; }
|
|
161
|
+
.cwd-nametext { flex: 0 1 auto; min-width: 0; font-size: 14px; line-height: 19px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
162
|
+
.cwd-codeline { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 11px; line-height: 15px; color: var(--dsw-alias-label-tertiary); }
|
|
163
|
+
.cwd-code { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
164
|
+
.cwd-price { text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
165
|
+
.cwd-pct { text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
166
|
+
.cwd-up { color: var(--capital-watchlist-up); }
|
|
167
|
+
.cwd-down { color: var(--capital-watchlist-down); }
|
|
168
|
+
.cwd-flat { color: var(--dsw-alias-label-secondary); }
|
|
169
|
+
.cwd-stale { color: var(--dsw-alias-label-secondary); }
|
|
170
|
+
.cwd-rowactions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; }
|
|
171
|
+
.cwd-iconbtn { flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: var(--dsw-radius-sm); background: transparent; color: var(--dsw-alias-label-secondary); cursor: pointer; }
|
|
172
|
+
.cwd-iconbtn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
|
|
173
|
+
.cwd-iconbtn:disabled { opacity: .45; cursor: not-allowed; }
|
|
174
|
+
.cwd-detail { display: flex; flex: 1; flex-direction: column; gap: 14px; min-height: 0; padding: 16px; overflow-y: auto; }
|
|
175
|
+
.cwd-detailhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
|
|
176
|
+
.cwd-detailname { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 16px; line-height: 22px; font-weight: 600; }
|
|
177
|
+
.cwd-detailtext { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
178
|
+
.cwd-detailcode { margin-top: 3px; font-size: 12px; line-height: 17px; color: var(--dsw-alias-label-tertiary); }
|
|
179
|
+
.cwd-bigquote { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
|
|
180
|
+
.cwd-bigprice { font-size: 34px; line-height: 40px; font-weight: 650; font-variant-numeric: tabular-nums; }
|
|
181
|
+
.cwd-bigpct { font-size: 14px; line-height: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
182
|
+
.cwd-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
|
|
183
|
+
.cwd-metaitem { min-width: 0; }
|
|
184
|
+
.cwd-metalabel { font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }
|
|
185
|
+
.cwd-metavalue { font-size: 12.5px; line-height: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
186
|
+
.cwd-block { flex: none; padding-top: 12px; border-top: .5px solid var(--dsw-alias-border-l2); }
|
|
187
|
+
.cwd-block-chart { flex: 1; display: flex; flex-direction: column; min-height: 0; }
|
|
188
|
+
.cwd-blockhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
|
|
189
|
+
.cwd-blocktitle { font-size: 12.5px; line-height: 18px; font-weight: 600; }
|
|
190
|
+
.cwd-blocknote { font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }
|
|
191
|
+
.cwd-chart { flex: 1; min-height: 150px; display: grid; place-items: center; padding: 12px; border: 1px dashed var(--dsw-alias-border-l2); border-radius: 10px; background: repeating-linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-border-l2) 60%, transparent) 0 1px, transparent 1px 36px), var(--dsw-alias-bg-module-platform); text-align: center; }
|
|
192
|
+
.cwd-charttext { font-size: 12.5px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-secondary); }
|
|
193
|
+
.cwd-charthint { margin-top: 4px; font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }
|
|
194
|
+
.cwd-volume { height: 92px; display: grid; place-items: center; border: 1px dashed var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-module-platform); border-radius: 10px; font-size: 12px; color: var(--dsw-alias-label-tertiary); }
|
|
195
|
+
.cwd-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 34px 18px; text-align: center; }
|
|
196
|
+
.cwd-emptytitle { font-size: 14px; line-height: 20px; font-weight: 600; }
|
|
197
|
+
.cwd-emptyhint { margin: 6px 0 0; font-size: 12.5px; line-height: 19px; color: var(--dsw-alias-label-tertiary); }
|
|
198
|
+
.cwd-notice { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; border-bottom: .5px solid var(--dsw-alias-border-l2); font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
|
|
199
|
+
.cwd-notice-danger { color: var(--dsw-alias-state-error-primary); }
|
|
200
|
+
.cwd-error { flex: none; padding: 8px 14px; border-bottom: .5px solid var(--dsw-alias-border-l2); font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }
|
|
201
|
+
.cwd-menuhint { padding: 6px 10px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
|
|
202
|
+
.cwd-menulist { width: 208px; }
|
|
203
|
+
.cwd-menulist button { box-sizing: border-box; }
|
|
204
|
+
.cwd-field:focus-within { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 1px; }
|
|
205
|
+
.cwd-page button:focus-visible, .cwd-groupcreate input:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 1px; }
|
|
206
|
+
.cwd-skeleton { display: block; height: 12px; border-radius: 6px; background: var(--dsw-alias-bg-skeleton); }
|
|
207
|
+
@media (max-width: 1040px) { .cwd-body { grid-template-columns: minmax(0, 1fr); gap: 16px; height: auto; } .cwd-card { height: auto; } .cwd-tablebody { flex: none; max-height: 60vh; } .cwd-chart { flex: none; height: 200px; } }
|
|
208
|
+
@media (max-width: 720px) { .cwd-inner { padding: 20px 16px 32px; } .cwd-thead, .cwd-row { grid-template-columns: minmax(0, 1.5fr) 78px 72px 36px; gap: 8px; } .cwd-thead { padding: 8px 10px; } .cwd-row { padding: 9px 10px; } }
|
|
209
|
+
`;function ya(){let a=globalThis.document;if(!a||typeof a.createElement!="function"||a.querySelector(`style[data-${Ne}]`))return;let t=a.createElement("style");t.setAttribute(`data-${Ne}`,""),t.textContent=xa;let i=a.head??a.body;if(!(i===void 0||typeof i.appendChild!="function"))return i.appendChild(t),()=>t.remove()}async function v(a,{query:t,body:i,signal:n}={}){let s=t!==void 0?`${ke}${a}?${t}`:`${ke}${a}`,d=i===void 0?{method:"GET",cache:"no-store",credentials:"same-origin",signal:n}:{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),credentials:"same-origin",signal:n},u=await fetch(s,d),c=await u.text(),o={};try{o=c.length>0?JSON.parse(c):{}}catch{o={}}if(u.ok===!0&&o.ok===!0)return o;let m=typeof o.code=="string"&&o.code.length>0?o.code:u.status===401||u.status===403?"unauthorized":"fuyao_unavailable",k=new Error(m);throw k.code=m,k.candidates=o.candidates,k.limit=o.limit,k}var Se=()=>({open:!1,loading:!1,refreshing:!1,searching:!1,items:[],candidates:[],truncated:!1,marketFilter:"all",query:"",dropdownOpen:!1,rowMenu:null,pendingRemove:null,refreshed_at:null,error:null,searchError:null,searchPartial:null,addError:null,loadError:null,failures:{},composing:!1,pendingSearch:!1}),re=class{constructor(){this.store=la(Se()),this.searchController=null,this.timer=null,this.pending=null,this.lastQuery=null,this.holdingOps=new Map}get state(){return this.store}get snapshot(){return this.store.getSnapshot()}patch(t){this.store.update(i=>Object.assign(i,t))}open(){this.patch({...Se(),open:!0,loading:!0}),this.load().then(()=>this.refresh(),()=>this.patch({loading:!1}))}close(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort(),this.lastQuery=null,this.patch({open:!1,rowMenu:null,composing:!1,pendingSearch:!1}),this.holdingOps.clear()}async load(){try{let t=await v("/list");this.holdingOps.clear(),this.patch({items:$(t.items)??[],seeded_at:t.seeded_at,loading:!1,loadError:null})}catch(t){throw this.patch({loading:!1,loadError:{code:t.code??"fuyao_unavailable"}}),t}}refresh(){if(this.pending!==null)return this.pending;this.patch({refreshing:!0});let t=v("/refresh",{body:{}}).then(i=>{let n={};for(let u of i.failures??[])n[u.thscode]=u.code;let s=$(i.items),d=s??this.snapshot.items;s!==null&&this.holdingOps.clear(),this.patch({items:d,refreshed_at:i.refreshed_at??this.snapshot.refreshed_at,failures:n,error:i.error?{code:i.error.code,partial:d.length>0&&d.some(u=>n[u.thscode]===void 0)}:null})}).catch(i=>{this.patch({error:{code:i.code??"fuyao_unavailable",partial:this.snapshot.items.some(n=>n.quote!==null)}})}).finally(()=>{this.patch({refreshing:!1}),this.pending=null});return this.pending=t,t}onQueryChange(t,i){let n=t.trim(),s=i===void 0?this.snapshot.composing===!0:i===!0;if(this.patch({query:t,searchError:null,composing:s,dropdownOpen:n.length>0}),this.timer!==null&&clearTimeout(this.timer),n.length===0){this.searchController!==null&&this.searchController.abort(),this.lastQuery=null,this.patch({candidates:[],truncated:!1,searching:!1,pendingSearch:!1});return}n===this.lastQuery&&this.snapshot.pendingSearch===!1||(this.patch({candidates:[],truncated:!1,pendingSearch:!s}),s!==!0&&(this.timer=setTimeout(()=>this.search(n),pa)))}beginComposition(){this.timer!==null&&clearTimeout(this.timer),this.patch({composing:!0})}endComposition(t){this.onQueryChange(t,!1)}hideDropdown(){this.patch({dropdownOpen:!1})}setMarketFilter(t){Ge.some(i=>i.id===t)&&this.patch({marketFilter:t})}toggleRowMenu(t){this.patch({rowMenu:this.snapshot.rowMenu===t?null:t})}closeRowMenu(){this.snapshot.rowMenu!==null&&this.patch({rowMenu:null})}setPendingRemove(t){this.patch({pendingRemove:t??null})}replaceRow(t){let[i]=$([t]);i===void 0||typeof i?.thscode!="string"||this.patch({items:this.snapshot.items.map(n=>n.thscode===i.thscode?i:n)})}async search(t){this.lastQuery=t,this.searchController!==null&&this.searchController.abort();let i=new AbortController;this.searchController=i,this.patch({searching:!0,searchError:null,searchPartial:null});let n=()=>this.snapshot.query.trim()===t;try{let s=await v("/search",{query:`q=${encodeURIComponent(t)}`,signal:i.signal});if(!n()){this.patch({searching:!1});return}this.patch({candidates:$(s.items)??[],truncated:s.truncated===!0,searching:!1,pendingSearch:!1,searchPartial:Array.isArray(s.partial)&&s.partial.length>0?s.partial:null})}catch(s){if(s.name==="AbortError"||(this.lastQuery===t&&(this.lastQuery=null),!n()))return;this.patch({candidates:[],truncated:!1,searching:!1,pendingSearch:!1,searchError:{code:s.code??"fuyao_unavailable"},searchPartial:null})}}async add(t){try{await v("/add",{body:{thscode:t.thscode}})}catch(n){this.patch({addError:{code:n.code??"fuyao_unavailable",candidates:n.candidates,limit:n.limit}}),n.candidates!==void 0&&this.patch({candidates:n.candidates,truncated:!1});return}this.patch({addError:null,candidates:this.snapshot.candidates.map(n=>n.thscode===t.thscode?{...n,in_list:!0}:n)}),await this.load().catch(()=>{}),await this.refresh();let i=this.snapshot.items.find(n=>n.thscode===t.thscode);i!==void 0&&i.quote===null&&this.snapshot.failures[t.thscode]===void 0&&await this.refresh()}async remove(t){let i=this.snapshot.items;this.patch({items:i.filter(n=>n.thscode!==t),rowMenu:null});try{await v("/remove",{body:{thscode:t}}),this.snapshot.addError?.code==="list_full"&&this.patch({addError:null})}catch{this.patch({items:i})}}async pin(t){let i=this.snapshot.items,n=i.find(s=>s.thscode===t);if(n!==void 0){this.patch({items:[n,...i.filter(s=>s.thscode!==t)],rowMenu:null});try{let s=await v("/pin",{body:{thscode:t}});Array.isArray(s.items)&&this.patch({items:$(s.items)})}catch{let s=this.snapshot.items,d=i.map(c=>s.find(o=>o.thscode===c.thscode)).filter(Boolean),u=new Set(d.map(c=>c.thscode));this.patch({items:[...d,...s.filter(c=>!u.has(c.thscode))]})}}}async writeHolding(t,i,n){let s=this.snapshot.items.find(o=>o.thscode===t);if(s===void 0)return;let d=this.holdingOps.get(t)??{seq:0,baseline:s};this.holdingOps.set(t,d);let u=++d.seq;this.patch({items:this.snapshot.items.map(o=>o.thscode===t?n(o):o)});let c=()=>this.holdingOps.get(t)!==d||d.seq!==u;try{let o=await v("/holding",{body:i});if(c())return;this.replaceRow(o.item),d.baseline=o.item??n(s),this.holdingOps.delete(t)}catch{if(c())return;this.replaceRow(d.baseline),this.holdingOps.delete(t)}}markHolding(t,i){return this.writeHolding(t,{thscode:t,weight_pct:i},n=>({...n,holding:{weight_pct:i,marked_at:Date.now()}}))}clearHolding(t){return this.writeHolding(t,{thscode:t,clear:!0},i=>{let n={...i};return delete n.holding,n})}stepHolding(t,i){let n=this.snapshot.items,s=n.find(u=>u.thscode===t)?.holding?.weight_pct;if(typeof s!="number"&&i<0)return;let d=Math.min(Me(n,t),Math.max(0,(typeof s=="number"?s:0)+i));if(d!==s)return this.markHolding(t,d)}async copyToClipboard(){let t=this.snapshot.items.map(i=>[i.thscode,L(i.name),i.asset_type,i.quote?.price??"",i.quote?.change_pct??"",i.quote?.captured_at??""].join(" ")).join(`
|
|
210
|
+
`);return await navigator.clipboard.writeText(t),t}dispose(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort()}};function W(a){if(typeof a!="number"||!Number.isFinite(a))return"";let t=new Date(a),i=n=>String(n).padStart(2,"0");return`${i(t.getMonth()+1)}-${i(t.getDate())} ${i(t.getHours())}:${i(t.getMinutes())}`}function X({assetType:a,t}){return e("span",{className:`capital-watchlist-tag ${ba[a]??"capital-watchlist-tag-cn"}`},Oe(a,t))}function va(a,t,i){let n=L(a.name);return`${t(`${i}PromptPrefix`)}${n} (${a.thscode} \xB7 ${fa(a.asset_type,t)})${t(`${i}PromptSuffix`)}`}function ka({quote:a,failureCode:t,refreshing:i,t:n}){let s=t!==void 0;if(a==null)return i===!0?e("div",{className:"capital-watchlist-quote"},e("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-price"}),e("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-change"})):s?e("div",{className:"capital-watchlist-quote",title:n(`error.${t}`)},e("div",{className:"capital-watchlist-price capital-watchlist-quotefailed"},"\u2014")):e("div",{className:"capital-watchlist-quote"},e("div",{className:"capital-watchlist-price"},n("notRefreshed")));let d=typeof a.change_pct=="number"&&Number.isFinite(a.change_pct),u=d?`${a.change_pct>0?"+":""}${a.change_pct.toFixed(2)}%`:"\u2014",c=s?"capital-watchlist-stale":d?a.change_pct>0?"capital-watchlist-up":a.change_pct<0?"capital-watchlist-down":"capital-watchlist-flat":"capital-watchlist-nodata",o=typeof a.source_time=="string"&&a.source_time.length>0?`${n("exchangeTime")} ${a.source_time}`:"",m=[];return s?m.push(`${n(`error.${t}`)} \xB7 ${n("stale")} ${W(a.captured_at)}`):d||m.push(n("noChangePct")),o.length>0&&m.push(o),e("div",{className:"capital-watchlist-quote",title:m.length===0?void 0:m.join(" \xB7 ")},e("div",{className:s?"capital-watchlist-price capital-watchlist-stale":"capital-watchlist-price"},a.price.toFixed(2)),e("div",{className:`capital-watchlist-change ${c}`},u))}function Na(a,t){if(t.code!=="list_full")return a(`error.${t.code}`);let i=t.limit;return typeof i!="number"||!Number.isFinite(i)?a("error.list_full_noMax"):a("error.list_full").replace("{max}",String(i))}function _a(a,t){let i=a?.weight_pct;return i==null?t("holdingName"):`${t("holdingName")} ${i}%`}function Sa(a,t){let i=`${a.name} ${a.ticker}`;return a.holding===null||a.holding===void 0?i:`${i} \xB7 ${_a(a.holding,t)}`}function Ca({useDialog:a,surface:t,t:i,inputActions:n}){let s=a(l=>l),[d,u]=b(!1),[c,o]=b(null),m=s.pendingRemove??null;if(Y(()=>()=>t.dispose(),[t]),!s.open)return null;let k=s.dropdownOpen===!0,C=m!==null,I=l=>{if(l.key==="Escape"){if(C){l.stopPropagation(),t.setPendingRemove(null);return}k&&(l.stopPropagation(),t.hideDropdown())}},f=l=>{if(!k)return;let y=l.relatedTarget;y!=null&&l.currentTarget?.contains?.(y)===!0||t.hideDropdown()},A=s.error,_=A==null?null:e("p",{className:"capital-watchlist-notice",role:"alert","data-code":A.code},`${i(`error.${A.code}`)}${A.partial===!0?i("errorSuffix"):""}`),M=(l,y)=>{n.insertText(va(l,i,y),n.captureInsertion())===!0&&t.close()},P=s.marketFilter==="all"?s.candidates:s.candidates.filter(l=>_e(l)===s.marketFilter),T={all:s.candidates.length,cn:0,hk:0,us:0};for(let l of s.candidates)T[_e(l)]+=1;let q=s.candidates.length===0?null:e("div",{className:"capital-watchlist-filter",role:"group","aria-label":i("filterLabel")},Ge.map(l=>e("button",{key:l.id,type:"button",className:"capital-watchlist-filterbtn","aria-pressed":s.marketFilter===l.id,onClick:()=>t.setMarketFilter(l.id)},e("span",{className:"capital-watchlist-filterlabel"},l.id==="all"?i("filterAll"):l.label),e("span",{className:"capital-watchlist-filtercount"},String(T[l.id]))))),B=k?e("div",{className:"capital-watchlist-dropdown","aria-label":i("title"),"data-menu-material":"translucent"},q,e("div",{className:"capital-watchlist-options",role:"listbox","aria-label":i("title")},P.map(l=>e("button",{key:l.thscode,type:"button",role:"option",className:"capital-watchlist-option",title:l.name,"aria-disabled":l.in_list===!0||c===l.thscode,onClick:()=>{l.in_list===!0||c===l.thscode||(u(!0),o(l.thscode),t.add(l).finally(()=>{u(!1),o(null)}))}},e("span",{className:"capital-watchlist-optionmain"},e("span",{className:"capital-watchlist-optionname"},l.name),e("span",{className:"capital-watchlist-codeline"},e("span",{className:"capital-watchlist-optioncode"},l.thscode),e(X,{assetType:l.asset_type,t:i}))),e("span",{className:"capital-watchlist-addbtn","data-state":l.in_list===!0?"added":"idle"},l.in_list===!0?i("added"):i("add")))),s.truncated===!0&&P.length>0?e("div",{className:"capital-watchlist-hint capital-watchlist-endhint"},i("truncated")):null),s.composing===!0?e("div",{className:"capital-watchlist-hint"},i("composingHint")):s.searching===!0||s.pendingSearch===!0?e("div",{className:"capital-watchlist-hint"},i("searching")):s.searchError!==null&&s.searchError!==void 0?e("div",{className:"capital-watchlist-hint capital-watchlist-searcherror",role:"alert","data-code":s.searchError.code},i(`error.${s.searchError.code}`)):s.candidates.length===0?e("div",{className:"capital-watchlist-hint"},i("noHit")):P.length===0?e("div",{className:"capital-watchlist-hint","data-filter":s.marketFilter},i("filterNoHit")):null,...(s.searchPartial??[]).map(l=>e("div",{key:`partial-${l.market}`,className:"capital-watchlist-hint capital-watchlist-searcherror",role:"status","data-market":l.market,"data-code":l.code},`${i(`partial.${l.market}`)}${i(`error.${l.code}`)}`))):null,K=s.items.length===0?null:e("div",{className:"capital-watchlist-grid capital-watchlist-head"},e("span",null,i("colName")),e("span",{className:"capital-watchlist-quote"},i("colQuote")),e("span",{className:"capital-watchlist-headaction"},i("colAction"))),Z=s.loadError!==null&&s.loadError!==void 0?e("p",{className:"capital-watchlist-empty capital-watchlist-loaderror",role:"alert","data-code":s.loadError.code},i(`error.${s.loadError.code}`)):e("p",{className:"capital-watchlist-empty"},i("empty")),O=s.loading?e("p",{className:"capital-watchlist-empty"},i("loading")):s.items.length===0?Z:e("div",{className:k?"capital-watchlist-list capital-watchlist-list-open":"capital-watchlist-list"},s.items.map((l,y)=>{let R=l.holding!==null&&l.holding!==void 0,x=l.holding?.weight_pct,S=ye(l)||R,F=Me(s.items,l.thscode),ee=!R||x===null||x===void 0||x<=0,ne=(typeof x=="number"?x:0)+ie>F;return e("div",{key:l.thscode,className:"capital-watchlist-grid capital-watchlist-row","data-thscode":l.thscode},e("span",{className:"capital-watchlist-namewrap"},e("span",{className:R?"capital-watchlist-name capital-watchlist-name-held":"capital-watchlist-name",title:Sa(l,i)},l.name),e("span",{className:"capital-watchlist-codeline"},e("span",{className:"capital-watchlist-code"},l.ticker),e(X,{assetType:l.asset_type,t:i}))),e(ka,{quote:l.quote,failureCode:s.failures[l.thscode],refreshing:s.refreshing,t:i}),e("span",{className:"capital-watchlist-rowactions"},e("button",{type:"button",className:"capital-watchlist-predict",disabled:d,title:i("predictTip"),"aria-label":`${i("predict")} ${l.name}`,onClick:()=>M(l,"predict")},e(Te,{size:14})),e("button",{type:"button",className:"capital-watchlist-review",disabled:d,title:i("reviewTip"),"aria-label":`${i("review")} ${l.name}`,onClick:()=>M(l,"review")},e(na,{size:14})),e(le,{open:s.rowMenu===l.thscode,anchor:e("button",{type:"button",className:"capital-watchlist-more",disabled:d,title:i("more"),"aria-label":`${i("more")} ${l.name}`,"aria-haspopup":"menu","aria-expanded":s.rowMenu===l.thscode,onClick:()=>t.toggleRowMenu(l.thscode)},e(Pe,{size:14})),items:[{id:"pin",label:i("pin"),icon:e(Re,{size:14}),disabled:y===0}],children:[...S?[e("div",{key:"holding-check",role:"group","aria-label":i("holdingName"),className:"capital-watchlist-checkrow"},e("span",{className:"capital-watchlist-checkicon","aria-hidden":"true"},e(ra,{size:14})),e("span",{className:"capital-watchlist-checklabel"},i("holdingName")),e(ca,{checked:R,disabled:d,label:i("holdingName"),onChange:U=>U?t.markHolding(l.thscode,null):t.clearHolding(l.thscode)}))]:[],...R&&ye(l)?[e("div",{key:"holding-step",className:"capital-watchlist-stepper",role:"group","aria-label":i("holdingStepper")},e("span",{className:"capital-watchlist-stepperlabel"},i("holdingWeightLabel")),e("span",{className:"capital-watchlist-stepperline"},e("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":i("holdingStepDown"),disabled:ee,onClick:()=>t.stepHolding(l.thscode,-ie)},"\u2212"),e("span",{className:typeof x=="number"?"capital-watchlist-stepperreadout":"capital-watchlist-stepperreadout capital-watchlist-stepperplaceholder",role:"status"},typeof x=="number"?`${x}%`:`0~${F}`),e("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":i("holdingStepUp"),title:`0~${F}`,disabled:ne,onClick:()=>t.stepHolding(l.thscode,ie)},"+")))]:[],e(V,{key:"remove",danger:!0,separatorBefore:!0,icon:e(se,{size:14}),onSelect:()=>{t.closeRowMenu(),t.setPendingRemove(l)}},i("remove"))],onSelect:U=>{U==="pin"&&(t.closeRowMenu(),t.pin(l.thscode))},onClose:()=>t.closeRowMenu(),align:"end",portal:!0,listClassName:"capital-watchlist-rows",className:"capital-watchlist-actions"})))})),G=e("div",{className:C?"capital-watchlist-confirm capital-watchlist-confirm-open":"capital-watchlist-confirm","aria-hidden":C?void 0:"true"},e("div",{className:"capital-watchlist-confirmbox",role:C?"alertdialog":void 0,"aria-label":i("confirmTitle")},e("div",{className:"capital-watchlist-confirmtitle"},i("confirmTitle")),C?e("p",{className:"capital-watchlist-confirmdesc"},i("confirmDescPrefix"),e("strong",null,`${m.name} \xB7 ${m.ticker}`),i("confirmDescSuffix")):null,e("div",{className:"capital-watchlist-confirmactions"},e("button",{type:"button",className:"capital-watchlist-confirmbtn",onClick:()=>t.setPendingRemove(null)},i("confirmCancel")),e("button",{type:"button",className:"capital-watchlist-confirmbtn capital-watchlist-confirmdanger",onClick:()=>{let l=m;t.setPendingRemove(null),l!==null&&t.remove(l.thscode)}},i("confirmOk")))));return e(oa,{open:!0,onClose:()=>t.close(),title:i("title"),headless:!0,shortcutModal:"watchlist",className:"capital-watchlist-dialog"},e("div",{className:"capital-watchlist-card",onKeyDown:I},e("div",{className:"capital-watchlist-header"},e("h2",{className:"capital-watchlist-title"},i("title")),e("button",{type:"button",className:"capital-watchlist-close","aria-label":i("close"),onClick:()=>t.close()},e(xe,{size:14}))),e("div",{className:"capital-watchlist-search",onBlur:f},e("div",{className:"capital-watchlist-field"},e("span",{className:"capital-watchlist-searchicon"},e(Ie,{size:16})),e("input",{className:"capital-watchlist-input","data-modal-autofocus":!0,value:s.query,placeholder:i("searchPlaceholder"),onChange:l=>t.onQueryChange(l.target.value,l.isComposing),onCompositionStart:()=>t.beginComposition(),onCompositionEnd:l=>t.endComposition(l.target.value)}),s.query.length>0?e("button",{type:"button",className:"capital-watchlist-clear",title:i("clearInput"),"aria-label":i("clearInput"),onMouseDown:l=>l.preventDefault(),onClick:()=>t.onQueryChange("",!1)},e(xe,{size:12})):null),B),s.addError!==null&&s.addError!==void 0?e("p",{className:"capital-watchlist-adderror",role:"status","data-code":s.addError.code},Na(i,s.addError)):null,K,O,e("div",{className:"capital-watchlist-footer"},e("div",{className:"capital-watchlist-footcol"},e("button",{type:"button",className:"capital-watchlist-refresh",disabled:s.refreshing||d,onClick:()=>{t.refresh()}},e(He,{size:14}),s.refreshing?i("refreshing"):i("refresh")),_),e("span",{className:"capital-watchlist-updated"},`${i("updated")} ${s.refreshed_at===null||s.refreshed_at===void 0?i("notRefreshed"):W(s.refreshed_at)}`)),G))}var Ce=`${H}:desk`,Fe="capital.watchlist.desk.groups.v1",E="__all__";function Aa(){let a={names:[],assignments:{}};try{let t=JSON.parse(localStorage.getItem(Fe)??"{}");return t===null||typeof t!="object"||!Array.isArray(t.names)||t.assignments===null||typeof t.assignments!="object"?a:{names:t.names.filter(i=>typeof i=="string"&&i.length>0).slice(0,20),assignments:t.assignments}}catch{return a}}function Ea(a){try{localStorage.setItem(Fe,JSON.stringify(a))}catch{}}var Q=(a,t)=>{let i=a.assignments[t];return Array.isArray(i)?i:[]},Ae=a=>a!=null&&typeof a.change_pct=="number"&&Number.isFinite(a.change_pct)?a.change_pct:null,Ee=a=>a===null?"cwd-flat":a>0?"cwd-up":a<0?"cwd-down":"cwd-flat",ze=a=>a===null?"\u2014":`${a>0?"+":""}${a.toFixed(2)}%`,za=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),$e=a=>a!=null&&typeof a.price=="number"&&Number.isFinite(a.price)?za.format(a.price):"\u2014";function $a({size:a=18}){return e("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e("path",{d:"M4 19V5"}),e("path",{d:"M4 19h16"}),e("path",{d:"m7 15 3-4 3 2 5-7"}),e("circle",{cx:18,cy:6,r:1.4,fill:"currentColor",stroke:"none"}))}function Pa({t:a}){let[t,i]=b([]),[n,s]=b(!0),[d,u]=b(!1),[c,o]=b(null),[m,k]=b({}),[C,I]=b(null),[f,A]=b(Aa),[_,M]=b(E),[P,T]=b(!1),[q,B]=b(""),[K,Z]=b(""),[O,G]=b(null),[l,y]=b(null),[R,x]=b(null),S=sa(!0);Y(()=>(S.current=!0,()=>{S.current=!1}),[]),Y(()=>{Ea(f)},[f]);let F=r=>{let w=$(r.items);Array.isArray(w)&&i(w);let p={};for(let h of r.failures??[])h!==null&&typeof h=="object"&&typeof h.thscode=="string"&&(p[h.thscode]=h.code);k(p),typeof r.refreshed_at=="number"&&o(r.refreshed_at),I(r.error!==void 0&&r.error!==null&&typeof r.error.code=="string"?r.error.code:null)};Y(()=>{let r=!1;return(async()=>{try{let p=await v("/list");if(r)return;let h=$(p.items)??[];i(h),G(N=>N!==null?N:typeof h[0]?.thscode=="string"?h[0].thscode:null)}catch(p){r||I(p.code??"load_failed");return}finally{r||s(!1)}try{let p=await v("/refresh",{body:{}});r||F(p)}catch(p){r||I(p.code??"fuyao_unavailable")}})(),()=>{r=!0}},[]);let ee=async()=>{if(!d){u(!0);try{let r=await v("/refresh",{body:{}});S.current&&F(r)}catch(r){S.current&&I(r.code??"fuyao_unavailable")}finally{S.current&&u(!1)}}},ne=async r=>{let w=t;y(null),i(w.filter(p=>p.thscode!==r)),O===r&&G(null);try{await v("/remove",{body:{thscode:r}})}catch{S.current&&i(w)}},U=async r=>{let w=t,p=w.find(h=>h.thscode===r);if(p!==void 0){i([p,...w.filter(h=>h.thscode!==r)]);try{let h=await v("/pin",{body:{thscode:r}});Array.isArray(h.items)&&S.current&&i($(h.items))}catch{S.current&&i(w)}}},oe=()=>{let r=q.trim();r.length===0||r===E||f.names.includes(r)||(A({names:[...f.names,r],assignments:f.assignments}),B(""),M(r))},je=r=>{if(r===E)return;let w={};for(let[p,h]of Object.entries(f.assignments)){let N=(Array.isArray(h)?h:[]).filter(j=>j!==r);N.length>0&&(w[p]=N)}A({names:f.names.filter(p=>p!==r),assignments:w}),M(E),T(!1)},De=(r,w)=>{let p=Q(f,r),h=p.includes(w)?p.filter(j=>j!==w):[...p,w],N={...f.assignments};h.length===0?delete N[r]:N[r]=h,A({names:f.names,assignments:N})},ce=K.trim().toLowerCase(),de=t.filter(r=>_!==E&&!Q(f,r.thscode).includes(_)?!1:ce.length===0?!0:[r.name,r.thscode,r.ticker].some(w=>typeof w=="string"&&w.toLowerCase().includes(ce))),g=O===null?null:t.find(r=>r.thscode===O)??null,Le=[{id:E,label:a("desk.allGroups"),icon:_===E?e(J,{size:14}):void 0}].concat(f.names.map(r=>({id:r,label:r,icon:_===r?e(J,{size:14}):void 0}))),qe=de.map((r,w)=>{let p=Ae(r.quote),h=m[r.thscode],N=Q(f,r.thscode),j=O===r.thscode,ue=h===void 0?void 0:a(`error.${h}`),ae=R===r.thscode;return e("div",{key:r.thscode,className:"cwd-row",role:"listitem","aria-current":j?"true":void 0,onClick:z=>{z.target.closest(".cwd-rowactions")===null&&G(r.thscode)}},e("button",{type:"button",className:"cwd-cellname","aria-pressed":j,onClick:()=>G(r.thscode)},e("span",{className:"cwd-nameline"},e("span",{className:"cwd-nametext",title:r.name},L(r.name)),e(X,{assetType:r.asset_type,t:a})),e("span",{className:"cwd-codeline"},e("span",{className:"cwd-code"},r.thscode))),e("div",{className:h===void 0?"cwd-price":"cwd-price cwd-stale",title:ue},$e(r.quote)),e("div",{className:`cwd-pct ${Ee(p)}`,title:ue},ze(p)),e("div",{className:"cwd-rowactions"},e(le,{open:ae,anchor:e("button",{type:"button",className:"cwd-iconbtn",title:a("desk.more"),"aria-label":`${a("desk.more")} ${r.name}`,"aria-haspopup":"menu","aria-expanded":ae,onClick:()=>{y(null),x(ae?null:r.thscode)}},e(Pe,{size:16})),items:[{id:"pin",label:a("desk.pin"),icon:e(Re,{size:14}),disabled:w===0}],children:[...f.names.length===0?[e("div",{key:"no-group",className:"cwd-menuhint"},a("desk.noGroupYet"))]:f.names.map(z=>e(V,{key:`group:${z}`,icon:N.includes(z)?e(J,{size:14}):void 0,onSelect:()=>De(r.thscode,z)},z)),e(V,{key:"remove",danger:!0,separatorBefore:!0,icon:e(se,{size:14}),onSelect:()=>{x(null),y(r)}},a("desk.remove"))],onSelect:z=>{z==="pin"&&(x(null),U(r.thscode))},onClose:()=>x(null),align:"end",portal:!0,listClassName:"cwd-menulist"})))}),Ue=n?e("div",{className:"cwd-empty"},e("div",{className:"cwd-emptytitle"},a("desk.loading"))):t.length===0?e("div",{className:"cwd-empty"},e("div",{className:"cwd-emptytitle"},a("desk.empty")),e("p",{className:"cwd-emptyhint"},a("desk.emptyHint"))):de.length===0?e("div",{className:"cwd-empty"},e("div",{className:"cwd-emptytitle"},a("desk.noMatch")),e("p",{className:"cwd-emptyhint"},a("desk.noMatchHint"))):e("div",{className:"cwd-tablebody",role:"list","aria-label":a("desk.title")},qe),pe=g===null?[]:Q(f,g.thscode),he=g===null?null:Ae(g.quote),We=g===null?e("div",{className:"cwd-card"},e("div",{className:"cwd-empty"},e("div",{className:"cwd-emptytitle"},a("desk.selectHint")),e("p",{className:"cwd-emptyhint"},a("desk.selectHintBody")))):e("div",{className:"cwd-card"},e("div",{className:"cwd-detail"},e("div",{className:"cwd-detailhead"},e("div",{style:{minWidth:0}},e("div",{className:"cwd-detailname"},e("span",{className:"cwd-detailtext",title:g.name},L(g.name)),e(X,{assetType:g.asset_type,t:a})),e("div",{className:"cwd-detailcode"},g.thscode))),e("div",{className:"cwd-bigquote"},e("span",{className:"cwd-bigprice"},$e(g.quote)),e("span",{className:`cwd-bigpct ${Ee(he)}`},ze(he))),e("div",{className:"cwd-meta"},e("div",{className:"cwd-metaitem"},e("div",{className:"cwd-metalabel"},a("desk.capturedAt")),e("div",{className:"cwd-metavalue"},g.quote===null||g.quote===void 0?a("desk.notRefreshed"):W(g.quote.captured_at)||a("desk.notRefreshed"))),e("div",{className:"cwd-metaitem"},e("div",{className:"cwd-metalabel"},a("desk.sourceTime")),e("div",{className:"cwd-metavalue"},typeof g.quote?.source_time=="string"&&g.quote.source_time.length>0?g.quote.source_time:"\u2014")),e("div",{className:"cwd-metaitem"},e("div",{className:"cwd-metalabel"},a("desk.groupsOf")),e("div",{className:"cwd-metavalue"},pe.length===0?a("desk.noGroup"):pe.join(" / "))),e("div",{className:"cwd-metaitem"},e("div",{className:"cwd-metalabel"},a("desk.kind")),e("div",{className:"cwd-metavalue"},Oe(g.asset_type,a)))),e("div",{className:"cwd-block cwd-block-chart"},e("div",{className:"cwd-blockhead"},e("span",{className:"cwd-blocktitle"},a("desk.intraday")),e("span",{className:"cwd-blocknote"},c===null?a("desk.notRefreshed"):W(c))),e("div",{className:"cwd-chart"},e("div",null,e("div",{className:"cwd-charttext"},a("desk.intradayEmpty")),e("div",{className:"cwd-charthint"},a("desk.intradayEmptyHint"))))),e("div",{className:"cwd-block"},e("div",{className:"cwd-blockhead"},e("span",{className:"cwd-blocktitle"},a("desk.volume"))),e("div",{className:"cwd-volume"},a("desk.volumeEmpty")))));return e("div",{className:"cwd-page"},e("div",{className:"cwd-inner"},e("header",{className:"cwd-head"},e("h1",{className:"cwd-title"},a("desk.title")),e("div",{className:"cwd-headactions"},e("span",{className:"cwd-updated"},`${a("desk.lastUpdate")} ${c===null?a("desk.notRefreshed"):W(c)}`),e("button",{type:"button",className:"cwd-refresh",disabled:d,onClick:()=>{ee()}},e(He,{size:14}),a(d?"desk.refreshing":"desk.refresh")))),e("div",{className:"cwd-body"},e("section",{className:"cwd-card"},e("div",{className:"cwd-toolbar"},e("label",{className:"cwd-field"},e(Ie,{size:14}),e("input",{type:"text",value:K,placeholder:a("desk.filterPlaceholder"),"aria-label":a("desk.filter"),onChange:r=>Z(r.target.value)})),e(le,{open:P,anchor:e("button",{type:"button",className:"cwd-pill","aria-haspopup":"menu","aria-expanded":P,"aria-label":a("desk.group"),onClick:()=>T(!P)},e(Te,{size:14}),e("span",null,_===E?a("desk.allGroups"):_)),items:Le,children:_===E?[]:[e(V,{key:"delete-group",danger:!0,separatorBefore:!0,icon:e(se,{size:14}),onSelect:()=>je(_)},a("desk.deleteGroup"))],onSelect:r=>{T(!1),M(r)},onClose:()=>T(!1),align:"start",portal:!0,listClassName:"cwd-menulist"}),e("div",{className:"cwd-groupcreate"},e("input",{type:"text",value:q,maxLength:20,placeholder:a("desk.newGroup"),"aria-label":a("desk.newGroup"),onChange:r=>B(r.target.value),onKeyDown:r=>{r.key==="Enter"&&oe()}}),e("button",{type:"button",className:"cwd-pill",disabled:q.trim().length===0,onClick:oe},a("desk.createGroup")))),C===null?null:e("div",{className:"cwd-error",role:"alert"},a(C==="load_failed"?"desk.loadFailed":`error.${C}`)),l===null?null:e("div",{className:"cwd-notice cwd-notice-danger"},e("span",null,`${a("desk.removeHint")} \xB7 ${L(l.name)}`),e("button",{type:"button",className:"cwd-pill",onClick:()=>y(null)},a("desk.cancel"))),e("div",{className:"cwd-thead",role:"row"},e("span",null,a("desk.colName")),e("span",{className:"cwd-right"},a("desk.colPrice")),e("span",{className:"cwd-right"},a("desk.colChange")),e("span",{className:"cwd-right"},a("desk.colAction"))),Ue),e("aside",null,We))))}function Ta(a){a.effect(ya,`${H}: styles`),a.effect(()=>a.locale.register(D,{zh:ha,en:ua}),`${H}: dictionaries`);let t=new Map,i=c=>{let o=t.get(c);return o===void 0&&(o=new re,t.set(c,o)),o};a.effect(()=>()=>{for(let c of t.values())c.dispose();t.clear()},`${H}: per-session surfaces`);let n=c=>{let m=a.sessions?.list?.getSnapshot?.().byId?.[c]?.projectionValues?.agentPreset;return typeof m=="string"?m:void 0},s=new Set,d=c=>{let o=n(c);return o!==void 0?o===da:(s.has(c)||(s.add(c),Promise.resolve(a.sessions?.refreshProjections?.(c)).catch(()=>{})),!1)};a.slots.inject(ve,()=>a.slots.register({name:ve,id:"capital-watchlist-dialog",order:3,locale:D,inject:c=>{let o=i(c);return{hooks:{dialog:o.state},surface:o}}},Ca));let u=a.locale.bind(D);a.slots.inject("main",()=>a.slots.register({name:"main",key:Ce,locale:D},Pa)),a.slots.inject("sidebar.panellist",()=>a.slots.register({name:"sidebar.panellist",id:Ce,order:12,locale:D,label:()=>u("desk.panel")},$a)),a.inject(["commandUi"],c=>{let o=a.locale.bind(D);c.effect(()=>c.commandUi.register({name:"watchlist",label:()=>o("command.label"),description:()=>o("command.description"),icon:J,available:m=>d(m.sessionId),ui:{kind:"action",run:m=>{i(m.sessionId).open()}}}),`${H}: /watchlist contribution`)}),a.logger?.info?.(`${H}: \u5BA2\u6237\u7AEF\u534A\u8FB9\u5DF2\u6302\u8F7D\uFF08/watchlist \u83DC\u5355\u884C + \u81EA\u9009\u80A1\u5F39\u7A97\uFF09`)}exports.name=H;exports.inject=["slots","locale","commandUi","sessions"];exports.apply=Ta;
|
|
131
211
|
return module.exports
|
|
132
212
|
},
|
|
133
213
|
})
|