@zltquant/zlt-mcp 0.11.0 → 0.11.1
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/package.json +1 -1
- package/zlt-mcp-proxy.bundle.cjs +287 -9
package/package.json
CHANGED
package/zlt-mcp-proxy.bundle.cjs
CHANGED
|
@@ -32644,6 +32644,269 @@ function Z(t) {
|
|
|
32644
32644
|
return t.kind === "stock" ? s(t) : t.kind === "leader" ? r(t) : i(t);
|
|
32645
32645
|
}
|
|
32646
32646
|
|
|
32647
|
+
// src/cli-market-panel-layout.ts
|
|
32648
|
+
init_define_CLIENTLITE_MACOS_NPM_RELEASE();
|
|
32649
|
+
init_define_CLIENTLITE_NPM_RELEASE();
|
|
32650
|
+
var cliSite = "https://www.zltquant.com/";
|
|
32651
|
+
var cliPanelStyles = `
|
|
32652
|
+
html[data-cli-panel] body{max-width:1040px}
|
|
32653
|
+
html[data-cli-panel][data-theme=dark]{color-scheme:dark}
|
|
32654
|
+
[data-cli-panel] .wrap{padding:14px 16px 10px}
|
|
32655
|
+
[data-cli-panel] .head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:3px 12px}
|
|
32656
|
+
[data-cli-panel] .title{font-size:16px;gap:4px 10px}
|
|
32657
|
+
[data-cli-panel] .head-actions{display:flex;gap:8px;align-items:center;margin-left:auto}
|
|
32658
|
+
[data-cli-panel] .head-actions .logo{display:inline-flex;flex:none;margin:0}
|
|
32659
|
+
.cli-snapshot-info{margin-top:12px;color:var(--sub);font-size:11px;line-height:1.4}
|
|
32660
|
+
.cli-snapshot-info.fallback{margin:10px 16px}
|
|
32661
|
+
.cli-snapshot-meta{display:flex;flex-wrap:wrap;align-items:center;gap:3px 8px}
|
|
32662
|
+
.cli-snapshot-badge{padding:2px 7px;border:1px solid var(--line);border-radius:4px;background:var(--panel);color:var(--sub)}
|
|
32663
|
+
[data-cli-panel] .foot{gap:4px 8px}
|
|
32664
|
+
[data-cli-panel] .foot > span:first-child{flex:1 1 0;min-width:0;text-wrap:balance}
|
|
32665
|
+
[data-cli-panel] .foot .cli-site{display:inline-flex;align-items:center;min-height:28px;margin-left:auto;white-space:nowrap;text-decoration:none}
|
|
32666
|
+
.cli-site-intro{color:var(--sub)}
|
|
32667
|
+
.cli-site-label{text-decoration:underline;text-underline-offset:2px}
|
|
32668
|
+
.cli-site svg{flex:none;margin-left:2px}
|
|
32669
|
+
/* Let the tallest tab size the shared space without clipping expanded content. */
|
|
32670
|
+
:is([data-cli-panel=stock],[data-cli-panel=leader]) .stack{display:grid;grid-template-columns:minmax(0,1fr)}
|
|
32671
|
+
:is([data-cli-panel=stock],[data-cli-panel=leader]) .stack>section{display:block}
|
|
32672
|
+
/* SVG crosshairs set their own visibility. Fade the inactive layer as a whole. */
|
|
32673
|
+
:is([data-cli-panel=stock],[data-cli-panel=leader]) .stack>section[aria-hidden=true]{opacity:0;pointer-events:none}
|
|
32674
|
+
[data-cli-panel=stock] .stack>section:has(>.empty:last-child),
|
|
32675
|
+
[data-cli-panel=stock] .stack>section[data-pane="\u5206\u4EF7"],
|
|
32676
|
+
[data-cli-panel=leader] #pane>section{display:flex;flex-direction:column}
|
|
32677
|
+
:is([data-cli-panel=stock],[data-cli-panel=leader]) .stack>section>.empty{flex:1;display:grid;place-items:center}
|
|
32678
|
+
[data-cli-panel=stock] [data-pane="\u5206\u4EF7"]>svg{margin-block:auto}
|
|
32679
|
+
[data-cli-panel=leader] .leader-scroll{flex:1}
|
|
32680
|
+
[data-cli-panel=leader] .leader-scroll .list{height:min(100%,calc(29px + var(--cli-leader-rows,1) * 48px))}
|
|
32681
|
+
[data-cli-panel=leader] .leader-scroll thead tr{height:1px}
|
|
32682
|
+
[data-cli-panel=leader] .leader-scroll tbody tr:not(.temperature-detail-row)>td{vertical-align:middle}
|
|
32683
|
+
[data-cli-panel=market] .idx{gap:8px;margin:10px 0 6px}
|
|
32684
|
+
[data-cli-panel=market] .idx>div{padding:6px 8px;overflow-wrap:normal}
|
|
32685
|
+
[data-cli-panel=market] .idx .p,[data-cli-panel=market] .idx .c{white-space:nowrap}
|
|
32686
|
+
[data-cli-panel=market] #market-coverage,[data-cli-panel=market] #observation-basis{padding-left:0}
|
|
32687
|
+
[data-cli-panel=market] .box{margin-top:10px}
|
|
32688
|
+
[data-cli-panel=market] #navigation-status:empty{min-height:0}
|
|
32689
|
+
[data-cli-panel] .cli-column-sort,[data-cli-panel] .cli-industry-open{border:0;background:none;color:var(--brand);font:inherit;cursor:pointer;padding:3px 0}
|
|
32690
|
+
[data-cli-panel] .cli-column-sort{display:inline-flex;align-items:center;gap:5px;white-space:nowrap;min-width:0;min-height:28px}
|
|
32691
|
+
[data-cli-panel] .cli-column-sort:hover,[data-cli-panel] .cli-industry-open:hover{text-decoration:underline}
|
|
32692
|
+
[data-cli-panel] .cli-industry-open{display:block;text-align:left;min-height:28px;white-space:normal}
|
|
32693
|
+
[data-cli-panel=market] .cli-amount-list :is(th,td):nth-child(2){width:33%}
|
|
32694
|
+
[data-cli-panel=market] .cli-amount-list :is(th,td):nth-child(3){width:18%}
|
|
32695
|
+
[data-cli-panel=market] .cli-amount-list :is(th,td):nth-child(4),[data-cli-panel=market] .cli-amount-list :is(th,td):nth-child(5){width:22%}
|
|
32696
|
+
.cli-stock-name{display:block;min-width:0}
|
|
32697
|
+
.cli-distribution{display:grid;grid-template-columns:repeat(var(--bins),minmax(0,1fr));gap:4px;margin:12px 8px 8px;padding:0;list-style:none;color:var(--sub);font-size:11px;line-height:1.25}
|
|
32698
|
+
.cli-distribution li{display:grid;grid-template-rows:144px auto;gap:5px;min-width:0;text-align:center}
|
|
32699
|
+
.cli-distribution .bucket{display:flex;flex-direction:column;align-items:center;justify-content:end;gap:4px;min-width:0;border-bottom:1px solid var(--line)}
|
|
32700
|
+
.cli-distribution .value{color:var(--text);white-space:nowrap}
|
|
32701
|
+
.cli-distribution .column{width:clamp(8px,65%,44px);height:max(1px,calc(var(--fraction) * 120px));border-radius:2px 2px 0 0;background:var(--bucket-color)}
|
|
32702
|
+
.cli-distribution .bin{white-space:nowrap}
|
|
32703
|
+
@media(max-width:700px){
|
|
32704
|
+
[data-cli-panel=stock] .chart .tip{position:static;min-height:calc(2.9em + 4px);padding:2px 6px}
|
|
32705
|
+
}
|
|
32706
|
+
@media(max-width:700px){[data-cli-panel=market] .idx{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
|
32707
|
+
@media(max-width:640px){
|
|
32708
|
+
.cli-distribution{display:block;margin-top:9px}
|
|
32709
|
+
.cli-distribution li{display:grid;grid-template-columns:4.4em minmax(0,1fr);grid-template-rows:auto;align-items:center;gap:6px;text-align:left;min-height:17px}
|
|
32710
|
+
.cli-distribution .bin{grid-area:1/1}
|
|
32711
|
+
.cli-distribution .bucket{grid-area:1/2;display:grid;grid-template-columns:minmax(0,1fr) 4.4em;align-items:center;gap:8px;border:0}
|
|
32712
|
+
.cli-distribution .value{grid-area:1/2;text-align:right}
|
|
32713
|
+
.cli-distribution .column{grid-area:1/1;width:max(1px,calc(var(--fraction) * 100%));height:7px;border-radius:2px}
|
|
32714
|
+
}
|
|
32715
|
+
@media(max-width:420px){[data-cli-panel] .wrap{padding:10px 12px 8px}[data-cli-panel=market] .idx{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
32716
|
+
`;
|
|
32717
|
+
var cliDistribution = String.raw`
|
|
32718
|
+
distributionChart = function(d){
|
|
32719
|
+
if (!Array.isArray(d) || !d.length) return '';
|
|
32720
|
+
var max = d.reduce(function(top,x){return Math.max(top,x.count);},0) || 1;
|
|
32721
|
+
var middle = Math.floor(d.length / 2);
|
|
32722
|
+
return '<ul class="cli-distribution" aria-label="涨跌分布" style="--bins:' + d.length + '">' + d.map(function(x,i){
|
|
32723
|
+
var color = i < middle ? 'var(--up)' : i === middle ? 'var(--faint)' : 'var(--down)';
|
|
32724
|
+
var count = Math.max(0, Number(x.count) || 0);
|
|
32725
|
+
return '<li style="--fraction:' + (count / max) + ';--bucket-color:' + color + '"><span class="bucket">' +
|
|
32726
|
+
'<span class="num value">' + count + '</span><span class="column" aria-hidden="true"></span></span><span class="bin">' +
|
|
32727
|
+
esc(x.label) + '</span></li>';
|
|
32728
|
+
}).join('') + '</ul>';
|
|
32729
|
+
};
|
|
32730
|
+
`;
|
|
32731
|
+
var mountCliPanelLayout = String.raw`
|
|
32732
|
+
var cliHead = document.querySelector('#root .head');
|
|
32733
|
+
if (cliHead){
|
|
32734
|
+
var cliLogo = cliHead.querySelector('a.logo');
|
|
32735
|
+
if (cliLogo && !cliLogo.closest('.head-actions')){
|
|
32736
|
+
var cliActions = document.createElement('div');
|
|
32737
|
+
cliActions.className = 'head-actions';
|
|
32738
|
+
cliActions.appendChild(cliLogo);
|
|
32739
|
+
cliHead.appendChild(cliActions);
|
|
32740
|
+
}
|
|
32741
|
+
}
|
|
32742
|
+
var cliInfo = document.querySelector('.cli-snapshot-info');
|
|
32743
|
+
var cliFoot = document.querySelector('#root .foot');
|
|
32744
|
+
if (cliFoot){
|
|
32745
|
+
cliInfo.classList.remove('fallback');
|
|
32746
|
+
cliFoot.before(cliInfo);
|
|
32747
|
+
}
|
|
32748
|
+
if (document.documentElement.dataset.cliPanel === 'leader'){
|
|
32749
|
+
var cliStack = document.getElementById('pane');
|
|
32750
|
+
var cliOpened = cliStack && cliStack.querySelector('.opened-watch');
|
|
32751
|
+
if (cliOpened) cliStack.after(cliOpened);
|
|
32752
|
+
if (cliStack) cliStack.querySelectorAll('.leader-scroll .list').forEach(function(table){
|
|
32753
|
+
var rows = table.querySelectorAll('tbody > tr:not(.temperature-detail-row)').length;
|
|
32754
|
+
table.style.setProperty('--cli-leader-rows', rows);
|
|
32755
|
+
});
|
|
32756
|
+
}
|
|
32757
|
+
var cliPreparation = document.getElementById('market-snapshot-status');
|
|
32758
|
+
if (cliPreparation){
|
|
32759
|
+
var preparation = snapshotBoot.panel.preparation;
|
|
32760
|
+
var cliWarnings = [];
|
|
32761
|
+
if (preparation.previous_session) cliWarnings.push('当前展示此前交易日行情');
|
|
32762
|
+
if (preparation.stale) cliWarnings.push('行情已滞后,为最近一次成功获取的数据');
|
|
32763
|
+
if (cliWarnings.length){
|
|
32764
|
+
var cliWarning = document.createElement('span');
|
|
32765
|
+
cliWarning.setAttribute('role', 'status');
|
|
32766
|
+
cliWarning.textContent = cliWarnings.join(';');
|
|
32767
|
+
cliInfo.querySelector('.cli-snapshot-meta').appendChild(cliWarning);
|
|
32768
|
+
}
|
|
32769
|
+
cliPreparation.remove();
|
|
32770
|
+
}
|
|
32771
|
+
Array.prototype.forEach.call(document.querySelectorAll('#root a.logo'), function(link){
|
|
32772
|
+
link.href = '${cliSite}';
|
|
32773
|
+
link.target = '_blank';
|
|
32774
|
+
link.rel = 'noopener noreferrer';
|
|
32775
|
+
});
|
|
32776
|
+
`;
|
|
32777
|
+
|
|
32778
|
+
// src/cli-market-panel-tables.ts
|
|
32779
|
+
init_define_CLIENTLITE_MACOS_NPM_RELEASE();
|
|
32780
|
+
init_define_CLIENTLITE_NPM_RELEASE();
|
|
32781
|
+
function replacePart(script, before, after) {
|
|
32782
|
+
if (!script.includes(before)) throw new Error("Canonical table layout changed; refresh the CLI renderer adapter");
|
|
32783
|
+
return script.replace(before, () => after);
|
|
32784
|
+
}
|
|
32785
|
+
function replaceFunction(script, name, next, replacement) {
|
|
32786
|
+
const start = script.indexOf(" function " + name + "(");
|
|
32787
|
+
const end = script.indexOf(" function " + next + "(", start + 1);
|
|
32788
|
+
if (start < 0 || end < 0) throw new Error("Canonical table functions changed; refresh the CLI renderer adapter");
|
|
32789
|
+
return script.slice(0, start) + replacement + "\n" + script.slice(end);
|
|
32790
|
+
}
|
|
32791
|
+
function adaptCliPanelTables(script, kind) {
|
|
32792
|
+
if (kind === "stock") {
|
|
32793
|
+
script = replaceFunction(script, "fitToCanvas", "watchPaneWidth", String.raw` function fitToCanvas(){
|
|
32794
|
+
var pane = document.getElementById('pane');
|
|
32795
|
+
if (!state || !pane) return;
|
|
32796
|
+
var canvas = pane.clientHeight;
|
|
32797
|
+
fitChartPane('分时', canvas, function(extra){ renderIntradayPane(extra); });
|
|
32798
|
+
fitChartPane('区间', canvas, function(extra){ fillPeriod(extra); });
|
|
32799
|
+
if (paneOf('资金').querySelector('svg')) fitCapitalPane(canvas);
|
|
32800
|
+
if (paneOf('竞价').querySelector('svg')) fitAuctionPane(canvas);
|
|
32801
|
+
fitTradesPane(canvas);
|
|
32802
|
+
fitPriceLevelsPane(canvas);
|
|
32803
|
+
}`);
|
|
32804
|
+
script = replaceFunction(script, "refreshPeriodPane", "fillPeriod", String.raw` function refreshPeriodPane(){
|
|
32805
|
+
var canvas = document.getElementById('pane').clientHeight;
|
|
32806
|
+
fillPeriod(0);
|
|
32807
|
+
fitChartPane('区间', canvas, function(extra){ fillPeriod(extra); });
|
|
32808
|
+
}`);
|
|
32809
|
+
script = replacePart(
|
|
32810
|
+
script,
|
|
32811
|
+
"var rh = Math.min(32, Math.max(20, (targetVB - 4) / rows));",
|
|
32812
|
+
"var rh = Math.min(40 * VBW / w, Math.max(20, (targetVB - 4) / rows));"
|
|
32813
|
+
);
|
|
32814
|
+
return replacePart(
|
|
32815
|
+
script,
|
|
32816
|
+
"bh = Math.min(RH - 4, 12)",
|
|
32817
|
+
"bh = Math.min(RH - 4, Math.max(12, RH * .42), 24)"
|
|
32818
|
+
);
|
|
32819
|
+
}
|
|
32820
|
+
if (kind === "leader") {
|
|
32821
|
+
const withoutRowStatus = replacePart(
|
|
32822
|
+
script,
|
|
32823
|
+
` + '<p class="action-status" id="leader-action-status" role="status" aria-live="polite"></p>'
|
|
32824
|
+
`,
|
|
32825
|
+
""
|
|
32826
|
+
);
|
|
32827
|
+
return replaceFunction(withoutRowStatus, "nameCell", "fact", String.raw` function nameCell(row){
|
|
32828
|
+
return '<span class="cli-stock-name"><span class="stock-identity"><span class="stock-name">' +
|
|
32829
|
+
esc(row.name || row.sec) + '</span>' + tagHtml(row.tag === '总龙头' ? row.tag : null) + '</span>' +
|
|
32830
|
+
(row.name ? '<span class="code num">' + esc(row.sec) + '</span>' : '') + '</span>';
|
|
32831
|
+
}`);
|
|
32832
|
+
}
|
|
32833
|
+
script = replaceFunction(script, "listHead", "rowHtml", String.raw` function listHead(c, history, key){
|
|
32834
|
+
var amountKey = key === 'activity_amount' ? key : null;
|
|
32835
|
+
var metricKey = key === 'activity_volume_ratio' || (!history && amountKey) ? key : null;
|
|
32836
|
+
return '<div class="scroll-clue' + (history ? ' history-scroll-clue' : '') + '">左右滑动查看完整榜单 →</div>' +
|
|
32837
|
+
'<div class="rank-scroll" tabindex="0" aria-label="股票榜单,可横向滚动"><table class="list' +
|
|
32838
|
+
(history ? ' history-list' : !cliHasAmountColumn(c) ? ' cli-amount-list' : '') + '"><tr>' +
|
|
32839
|
+
'<th scope="col">#</th><th scope="col" style="text-align:left">名称</th>' +
|
|
32840
|
+
cliSortHead(history ? '时点价' : '现价') + cliSortHead(c[0], metricKey) +
|
|
32841
|
+
(history ? '' : cliSortHead(c[2])) +
|
|
32842
|
+
(cliHasAmountColumn(c) ? cliSortHead(history ? '累计成交额' : '成交额', amountKey) : '') + '</tr>';
|
|
32843
|
+
}`);
|
|
32844
|
+
const edits = [
|
|
32845
|
+
[`(history ? '<tr>' : '<tr class="go" data-sec="' + esc(r.sec) + '" title="' + (snapshotMode ? '\u590D\u5236\u7EE7\u7EED\u67E5\u8BE2\u6307\u4EE4' : '\u70B9\u51FB\u67E5\u770B\u76D8\u53E3') + '">')`, "'<tr>'"],
|
|
32846
|
+
[`(history ? '<tr>' : '<tr class="ind" data-ind="' + i + '" title="\u67E5\u770B\u6210\u5206\u80A1">')`, "'<tr>'"],
|
|
32847
|
+
[`<span class="nm">' + esc(x.name) + '</span>' + (history`, "' + cliIndustryName(x.name, i, history) + (history"],
|
|
32848
|
+
["document.querySelectorAll('tr.ind')", "document.querySelectorAll('button[data-ind]')"],
|
|
32849
|
+
["(snapshotMode ? '\uFF1B\u70B9\u51FB\u4E00\u884C\u590D\u5236\u7EE7\u7EED\u67E5\u8BE2\u6307\u4EE4</div>' : '\uFF1B\u70B9\u51FB\u4E00\u884C\u53EF\u67E5\u770B\u8BE5\u80A1\u76D8\u53E3</div>')", "'</div>'"],
|
|
32850
|
+
[`h + '</table></div><div class="note">' + sort + (note ? note + '\uFF1B' : '') + (snapshotMode ? '\u70B9\u51FB\u4E00\u884C\u590D\u5236\u7EE7\u7EED\u67E5\u8BE2\u6307\u4EE4</div>' : '\u70B9\u51FB\u4E00\u884C\u53EF\u67E5\u770B\u8BE5\u80A1\u76D8\u53E3</div>')`, `h + '</table></div>' + (note ? '<div class="note">' + note + '</div>' : '')`],
|
|
32851
|
+
["<th>\u4E2D\u4F4D\u6DA8\u8DCC</th><th>\u6DA8/\u8DCC\u5BB6\u6570", "' + cliSortHead('\u4E2D\u4F4D\u6DA8\u8DCC', 'change_industry') + '<th>\u6DA8/\u8DCC\u5BB6\u6570"],
|
|
32852
|
+
[`'<td class="num">' + money(r.amount) + '</td></tr>'`, `(cliHasAmountColumn(c) ? '<td class="num">' + money(r.amount) + '</td>' : '') + '</tr>'`],
|
|
32853
|
+
["var h = listHead(c, history);", "var h = listHead(c, history, key);"],
|
|
32854
|
+
["if (sortAsc[key]) rows.reverse();", "cliSortRows(rows, key);"],
|
|
32855
|
+
["if (sortAsc.change_industry) order.reverse();", "cliSortRows(order, 'change_industry', list);"],
|
|
32856
|
+
["'\u91CF\u6BD4\u7531\u9AD8\u5230\u4F4E\uFF1B\u4EC5\u7EDF\u8BA1\u6210\u4EA4\u989D \u2265 '", "'\u4EC5\u7EDF\u8BA1\u6210\u4EA4\u989D \u2265 '"],
|
|
32857
|
+
["key === 'activity_amount' ? '\u6210\u4EA4\u989D\u7531\u9AD8\u5230\u4F4E' : ", ""],
|
|
32858
|
+
["'\u6309\u622A\u81F3\u8BE5\u65F6\u70B9\u7684\u5F53\u65E5\u7D2F\u8BA1\u6210\u4EA4\u989D\u6392\u5E8F\uFF0C\u4EC5\u542B\u53EF\u7528\u6837\u672C\u3002'", "'\u6210\u4EA4\u989D\u4E3A\u622A\u81F3\u8BE5\u65F6\u70B9\u7684\u5F53\u65E5\u7D2F\u8BA1\uFF0C\u4EC5\u542B\u53EF\u7528\u6837\u672C\u3002'"],
|
|
32859
|
+
[" + (history ? '\u3002' : '\uFF1B\u70B9\u51FB\u4E00\u884C\u67E5\u770B\u6210\u5206\u80A1')", " + '\u3002'"],
|
|
32860
|
+
[`var sort = '<button class="sort" data-sort="change_industry">' + (sortAsc.change_industry ? '\u5F53\u524D\uFF1A\u4ECE\u4F4E\u5230\u9AD8' : '\u5F53\u524D\uFF1A\u4ECE\u9AD8\u5230\u4F4E') + '</button> ';`, ""],
|
|
32861
|
+
[" + sort + '\u901A\u8FBE\u4FE1\u4E8C\u7EA7\u884C\u4E1A", " + '\u901A\u8FBE\u4FE1\u4E8C\u7EA7\u884C\u4E1A"],
|
|
32862
|
+
[`var sort = (key === 'activity_volume_ratio' || key === 'activity_amount') ? '<button class="sort" data-sort="' + key + '">' + (sortAsc[key] ? '\u5F53\u524D\uFF1A\u4ECE\u5C0F\u5230\u5927' : '\u5F53\u524D\uFF1A\u4ECE\u5927\u5230\u5C0F') + '</button> ' : '';`, ""],
|
|
32863
|
+
[" + sort + (key === 'activity_amount'", " + (key === 'activity_amount'"]
|
|
32864
|
+
];
|
|
32865
|
+
for (const [before, after] of edits) script = replacePart(script, before, after);
|
|
32866
|
+
return replacePart(script, " lastArgs = snapshotBoot.args;", tableControls + "\n lastArgs = snapshotBoot.args;");
|
|
32867
|
+
}
|
|
32868
|
+
var tableControls = String.raw`
|
|
32869
|
+
function cliHasAmountColumn(c){ return c[0] !== '成交额'; }
|
|
32870
|
+
function cliSortHead(label, key){
|
|
32871
|
+
if (!key) return '<th scope="col">' + esc(label) + '</th>';
|
|
32872
|
+
var asc = !!sortAsc[key], direction = asc ? '升序' : '降序';
|
|
32873
|
+
return '<th scope="col" aria-sort="' + (asc ? 'ascending' : 'descending') + '"><button type="button" class="cli-column-sort" data-sort="' + key +
|
|
32874
|
+
'" aria-label="' + esc(label + ',当前' + direction + ',切换为' + (asc ? '降序' : '升序')) + '">' + esc(label) +
|
|
32875
|
+
'<span aria-hidden="true">' + (asc ? '↑' : '↓') + '</span></button></th>';
|
|
32876
|
+
}
|
|
32877
|
+
function cliIndustryName(name, index, historical){
|
|
32878
|
+
return historical ? '<span class="nm">' + esc(name) + '</span>' :
|
|
32879
|
+
'<button type="button" class="cli-industry-open" data-ind="' + index +
|
|
32880
|
+
'" aria-label="' + esc('查看' + name + '成分股') + '">' + esc(name) + '</button>';
|
|
32881
|
+
}
|
|
32882
|
+
function cliSortRows(rows, key, industries){
|
|
32883
|
+
var field = {change_industry:'median_pct',activity_amount:'amount',activity_volume_ratio:'volume_ratio'}[key];
|
|
32884
|
+
if (!field) return;
|
|
32885
|
+
var direction = sortAsc[key] ? 1 : -1;
|
|
32886
|
+
rows.sort(function(a,b){
|
|
32887
|
+
var x = (industries ? industries[a] : a)[field], y = (industries ? industries[b] : b)[field];
|
|
32888
|
+
if (!isNum(x)) return isNum(y) ? 1 : 0;
|
|
32889
|
+
if (!isNum(y)) return -1;
|
|
32890
|
+
return (x-y)*direction;
|
|
32891
|
+
});
|
|
32892
|
+
}
|
|
32893
|
+
bindSortButtons = function(){
|
|
32894
|
+
Array.prototype.forEach.call(document.querySelectorAll('th button[data-sort]'), function(button){
|
|
32895
|
+
button.onclick = function(){
|
|
32896
|
+
var key = button.getAttribute('data-sort'), target = button.closest('.sub-list');
|
|
32897
|
+
if (!target) return;
|
|
32898
|
+
var scroll = button.closest('.rank-scroll').scrollLeft;
|
|
32899
|
+
sortAsc[key] = !sortAsc[key];
|
|
32900
|
+
target.innerHTML = listPane(key, state, 9);
|
|
32901
|
+
bindSortButtons();
|
|
32902
|
+
bindRows();
|
|
32903
|
+
target.querySelector('.rank-scroll').scrollLeft = scroll;
|
|
32904
|
+
target.querySelector('th button[data-sort]').focus({preventScroll:true});
|
|
32905
|
+
};
|
|
32906
|
+
});
|
|
32907
|
+
};
|
|
32908
|
+
`;
|
|
32909
|
+
|
|
32647
32910
|
// src/cli-market-panel.ts
|
|
32648
32911
|
var kinds = /* @__PURE__ */ new Map([
|
|
32649
32912
|
["show_stock_panel", "stock"],
|
|
@@ -32652,13 +32915,6 @@ var kinds = /* @__PURE__ */ new Map([
|
|
|
32652
32915
|
]);
|
|
32653
32916
|
var isMarketPanelTool = (tool) => kinds.has(tool) || tool === MARKET_OBSERVATION_TOOL;
|
|
32654
32917
|
var object3 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
32655
|
-
var htmlText = (value) => value.replace(/[&<>"']/g, (char) => ({
|
|
32656
|
-
"&": "&",
|
|
32657
|
-
"<": "<",
|
|
32658
|
-
">": ">",
|
|
32659
|
-
'"': """,
|
|
32660
|
-
"'": "'"
|
|
32661
|
-
})[char]);
|
|
32662
32918
|
var historicalBins = [">7%", "5~7%", "3~5%", "1~3%", "0~1%", "\u5E73", "-1~0%", "-3~-1%", "-5~-3%", "-7~-5%", "<-7%"];
|
|
32663
32919
|
var historicalRow = (row) => ({
|
|
32664
32920
|
name: row.name,
|
|
@@ -32769,8 +33025,30 @@ var CliMarketPanelOutput = class {
|
|
|
32769
33025
|
if (start < 0 || end < start) throw new Error("Canonical snapshot header changed; refresh the renderer adapter");
|
|
32770
33026
|
const boot = canonical2.indexOf("\nvar snapshotBoot = ", end);
|
|
32771
33027
|
const script = canonical2.indexOf("; var snapshotMode = !!snapshotBoot;\n", boot);
|
|
32772
|
-
|
|
32773
|
-
|
|
33028
|
+
const scriptStart = canonical2.lastIndexOf("<script>", boot);
|
|
33029
|
+
if (boot < 0 || script < 0 || scriptStart < end) throw new Error("Canonical snapshot script changed; refresh the renderer adapter");
|
|
33030
|
+
const prefix = canonical2.slice(0, start).replace('data-mode="snapshot"', 'data-mode="snapshot" data-cli-panel="' + kind + '"').replace("<title>\u91D1\u8BC1\u667A\u6295 \xB7 \u5386\u53F2\u884C\u60C5\u5FEB\u7167</title>", "<title>\u672C\u5730\u884C\u60C5\u5FEB\u7167</title>").replace("</style>", cliPanelStyles + "</style>");
|
|
33031
|
+
let renderer = canonical2.slice(script).replace('title="\u8BBF\u95EE\u91D1\u8BC1\u667A\u6295"', 'title="\u6253\u5F00\u7F51\u7AD9"').replace('alt="\u91D1\u8BC1\u667A\u6295"', 'alt="\u667A\u91CF\u901A\u79D1\u6280"').replace(
|
|
33032
|
+
'<a href="#" class="site" data-pos="footer">\u91D1\u8BC1\u667A\u6295\u5DE5\u5177</a>',
|
|
33033
|
+
'<a class="cli-site" href="' + cliSite + '" target="_blank" rel="noopener noreferrer"><span class="cli-site-intro">\u66F4\u591A\u91CF\u5316\u5DE5\u5177\uFF0C</span><span class="cli-site-label">\u67E5\u770B\u667A\u91CF\u901A\u5B98\u7F51</span><svg width="10" height="10" viewBox="0 0 12 12" fill="none" aria-hidden="true"><path d="M2.5 9.5l7-7m-5 0h5v5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg></a>'
|
|
33034
|
+
).replaceAll("\u7528\u91D1\u8BC1\u667A\u6295\u76D8\u53E3\u9762\u677F\u770B\u770B ", "\u67E5\u770B\u4E2A\u80A1\u76D8\u53E3\uFF1A");
|
|
33035
|
+
if (kind === "market") {
|
|
33036
|
+
const toggle = /\(observation \? '' : '<button id="research-toggle"[^\n]+?研究模式<\/button>'\) \+ /;
|
|
33037
|
+
const selection = "(observation ? '' : selectionHtml()) +";
|
|
33038
|
+
const bindSelection = "if (!observation) bindSelection();";
|
|
33039
|
+
if (!toggle.test(renderer) || !renderer.includes(selection) || !renderer.includes(bindSelection) || !renderer.includes(" lastArgs = snapshotBoot.args;")) {
|
|
33040
|
+
throw new Error("Canonical market controls changed; refresh the CLI renderer adapter");
|
|
33041
|
+
}
|
|
33042
|
+
renderer = renderer.replace(toggle, "").replace(selection, "").replace(bindSelection, "").replace(" lastArgs = snapshotBoot.args;", () => cliDistribution + "\n fitOverview = function(){};\n lastArgs = snapshotBoot.args;");
|
|
33043
|
+
}
|
|
33044
|
+
renderer = adaptCliPanelTables(renderer, kind);
|
|
33045
|
+
const manualTheme = /^ document\.getElementById\('theme-toggle'\)\.onclick = [^\n]+\n/m;
|
|
33046
|
+
const renderSnapshot = " render({structuredContent:snapshotBoot.panel});";
|
|
33047
|
+
if (!manualTheme.test(renderer) || !renderer.includes(renderSnapshot)) {
|
|
33048
|
+
throw new Error("Canonical snapshot render changed; refresh the CLI renderer adapter");
|
|
33049
|
+
}
|
|
33050
|
+
renderer = renderer.replace(manualTheme, "").replace(renderSnapshot, () => renderSnapshot + mountCliPanelLayout);
|
|
33051
|
+
const html = prefix + canonical2.slice(end + "</header>".length, scriptStart) + '<div class="cli-snapshot-info fallback"><span class="cli-snapshot-meta"><span class="cli-snapshot-badge">\u672C\u5730\u5FEB\u7167</span>' + (dataAsOf ? "" : "<span>\u6570\u636E\u65F6\u95F4\uFF1A\u672A\u77E5\uFF08\u6E90\u6570\u636E\u672A\u63D0\u4F9B\uFF09</span>") + (historical ? "<span>\u56FA\u5B9A\u5728\u6307\u5B9A\u65F6\u70B9</span>" : "<span>\u83B7\u53D6\u6700\u65B0\u884C\u60C5\u8BF7\u5728\u4F1A\u8BDD\u4E2D\u91CD\u65B0\u67E5\u8BE2</span>") + "</span></div>\n" + canonical2.slice(scriptStart, script) + renderer;
|
|
32774
33052
|
return this.writeHtml(html, dataAsOf, createdAt);
|
|
32775
33053
|
}
|
|
32776
33054
|
writeHtml(html, dataAsOf, createdAt) {
|