stock-sdk 2.0.0-beta.1 → 2.1.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.
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkPMERLSCUcjs = require('./chunk-PMERLSCU.cjs');var _chunk3NSUE34Fcjs = require('./chunk-3NSUE34F.cjs');var _chunkTVIEKKDQcjs = require('./chunk-TVIEKKDQ.cjs');var _chunk4Q7UQ5Q3cjs = require('./chunk-4Q7UQ5Q3.cjs');var _chunk4VDLQK6Fcjs = require('./chunk-4VDLQK6F.cjs');function dt(t){return new TextDecoder("gbk").decode(t)}function pt(t){let e=t.split(";").map(r=>r.trim()).filter(Boolean),n=[];for(let r of e){let o=r.indexOf("=");if(o<0)continue;let i=r.slice(0,o).trim();i.startsWith("v_")&&(i=i.slice(2));let a=r.slice(o+1).trim();a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1));let u=a.split("~");n.push({key:i,fields:u})}return n}function mt(t){let e=t.trim();return e===""||e==="-"||e==="--"}function f(t){if(!t||t==="")return 0;let e=parseFloat(t);return Number.isNaN(e)?0:e}function _(t){if(!t||mt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function m(t){if(!t||mt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function s(t){return t==null?null:m(String(t))}function j(t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;if(mt(t))return null;let e=Number(t);return Number.isFinite(e)?e:null}var Fo=new Set(["daily","weekly","monthly"]),wo=new Set(["1","5","15","30","60"]),Uo=new Set(["","qfq","hfq"]);function Q(t,e){if(!Number.isFinite(t)||!Number.isInteger(t)||t<=0)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`${e} must be a positive integer`,{argument:e,value:t})}function H(t){if(!Fo.has(t))throw new (0, _chunk4Q7UQ5Q3cjs.e)("period must be one of: daily, weekly, monthly",{argument:"period",value:t})}function gt(t){if(!wo.has(t))throw new (0, _chunk4Q7UQ5Q3cjs.e)("period must be one of: 1, 5, 15, 30, 60",{argument:"period",value:t})}function G(t){if(!Uo.has(t))throw new (0, _chunk4Q7UQ5Q3cjs.e)("adjust must be one of: '', 'qfq', 'hfq'",{argument:"adjust",value:t})}function Ke(t){if(t!=="north"&&t!=="south")throw new (0, _chunk4Q7UQ5Q3cjs.e)("direction must be one of: 'north', 'south'",{argument:"direction",value:t})}function se(t,e){Q(e,"chunkSize");let n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}async function ae(t,e,n=!1){if(Q(e,"concurrency"),t.length===0)return[];let r=n?new Array(t.length):[],o=0,i=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let a=o++;if(a>=t.length)return;let u=await t[a]();n?r[a]=u:r.push(u)}});return await Promise.all(i),r}function q(t){return{daily:"101",weekly:"102",monthly:"103"}[t]}function Y(t){return{"":"0",qfq:"1",hfq:"2"}[t]}var xo=typeof document<"u"&&typeof window<"u",vo=0;function In(){return`__stock_sdk_jsonp_${Date.now()}_${vo++}`}function Be(t){let e=t,n=e.indexOf("*/");n!==-1&&(e=e.slice(n+2).trim());let r=e.indexOf("(");if(r===-1)throw new (0, _chunk4Q7UQ5Q3cjs.a)({code:"PARSE_ERROR",message:"Invalid JSONP response: no opening parenthesis found"});let o=e.lastIndexOf(")");if(o===-1||o<=r)throw new (0, _chunk4Q7UQ5Q3cjs.a)({code:"PARSE_ERROR",message:"Invalid JSONP response: no closing parenthesis found"});let i=e.slice(r+1,o);try{return JSON.parse(i)}catch(a){throw new (0, _chunk4Q7UQ5Q3cjs.a)({code:"PARSE_ERROR",message:"Invalid JSONP response: payload is not valid JSON",cause:a})}}function Ko(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e;return new Promise((i,a)=>{let u=In(),l;if(o==="path")l=t.replace("{callback}",u);else{let R=t.includes("?")?"&":"?";l=`${t}${R}${r}=${u}`}let c=document.createElement("script"),d=!1,T=window,p=()=>{c.parentNode&&c.parentNode.removeChild(c),delete T[u]},y=setTimeout(()=>{d||(d=!0,p(),a(new (0, _chunk4Q7UQ5Q3cjs.a)({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);T[u]=R=>{d||(d=!0,clearTimeout(y),p(),i(R))},c.onerror=()=>{d||(d=!0,clearTimeout(y),p(),a(new (0, _chunk4Q7UQ5Q3cjs.a)({code:"NETWORK_ERROR",message:`JSONP script load failed: ${t}`,url:t})))},c.src=l,document.head.appendChild(c)})}async function Bo(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e,i=In(),a;if(o==="path")a=t.replace("{callback}",i);else{let c=t.includes("?")?"&":"?";a=`${t}${c}${r}=${i}`}let u=new AbortController,l=setTimeout(()=>u.abort(),n);try{let c=await fetch(a,{signal:u.signal});if(!c.ok)throw new (0, _chunk4Q7UQ5Q3cjs.b)(c.status,c.statusText,t);let d=await c.text();return Be(d)}catch(c){throw c instanceof DOMException&&c.name==="AbortError"?new (0, _chunk4Q7UQ5Q3cjs.a)({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):c instanceof _chunk4Q7UQ5Q3cjs.a?c:new (0, _chunk4Q7UQ5Q3cjs.a)({code:"NETWORK_ERROR",message:`JSONP request failed: ${c instanceof Error?c.message:String(c)}`,url:t,cause:c})}finally{clearTimeout(l)}}function F(t,e={}){return xo?Ko(t,e):Bo(t,e)}var bn=new Map;async function ue(t,e){let r=(_nullishCoalesce(bn.get(t), () => (Promise.resolve()))).then(e,e);return bn.set(t,r.then(()=>{},()=>{})),r}function Ho(){return typeof document<"u"&&typeof window<"u"}var qo=15e3,zo= exports.j ="jsVars";async function le(t,e,n={}){let r=_nullishCoalesce(n.timeout, () => (qo));return Ho()?ue(zo,()=>$o(t,e,r)):Qo(t,e,r,n.headers,n.client)}function ft(t,e){let n={};for(let r of e){let o=jo(t,r);o!==void 0&&(n[r]=o)}return n}function $o(t,e,n){return new Promise((r,o)=>{let i=document.createElement("script"),a=!1,u=()=>{i.parentNode&&i.parentNode.removeChild(i)},l=setTimeout(()=>{a||(a=!0,u(),o(new (0, _chunk4Q7UQ5Q3cjs.a)({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);i.onload=()=>{if(a)return;a=!0,clearTimeout(l);let c=window,d={};for(let T of e)if(T in c){d[T]=c[T];try{delete c[T]}catch (e2){}}u(),r(d)},i.onerror=()=>{a||(a=!0,clearTimeout(l),u(),o(new (0, _chunk4Q7UQ5Q3cjs.a)({code:"NETWORK_ERROR",message:`fetchJsVars script load failed: ${t}`,url:t})))},i.src=t,document.head.appendChild(i)})}async function Qo(t,e,n,r,o){if(o){let u=await o.get(t,{responseType:"text"});return ft(u,e)}let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let u=await fetch(t,{signal:i.signal,headers:r});if(!u.ok)throw new (0, _chunk4Q7UQ5Q3cjs.b)(u.status,u.statusText,t);let l=await u.text();return ft(l,e)}catch(u){throw u instanceof DOMException&&u.name==="AbortError"?new (0, _chunk4Q7UQ5Q3cjs.a)({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):u instanceof _chunk4Q7UQ5Q3cjs.a?u:new (0, _chunk4Q7UQ5Q3cjs.a)({code:"NETWORK_ERROR",message:`fetchJsVars failed: ${u instanceof Error?u.message:String(u)}`,url:t,cause:u})}finally{clearTimeout(a)}}function jo(t,e){let r=new RegExp(`(?:^|[^\\w$])(?:var|let|const)\\s+${Go(e)}\\s*=\\s*`,"m").exec(t);if(!r)return;let o=r.index+r[0].length,i=Yo(t,o),a=t.slice(o,i).trim();try{return JSON.parse(a)}catch (e3){return}}function Go(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yo(t,e){let n=0,r=null;for(let o=e;o<t.length;o++){let i=t[o];if(r){if(i==="\\"){o++;continue}i===r&&(r=null);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="["||i==="{"||i==="("){n++;continue}if(i==="]"||i==="}"||i===")"){n--;continue}if(i===";"&&n===0)return o}return t.length}var E={CN:"Asia/Shanghai",HK:"Asia/Hong_Kong",US:"America/New_York"};function Wo(t){if(!t)return null;let e=t.trim();if(!e)return null;let n=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/.exec(e);if(n)return{year:+n[1],month:+n[2],day:+n[3],hour:+n[4],minute:+n[5],second:n[6]?+n[6]:0};let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return r?{year:+r[1],month:+r[2],day:+r[3],hour:0,minute:0,second:0}:/^\d{14}$/.test(e)?{year:+e.slice(0,4),month:+e.slice(4,6),day:+e.slice(6,8),hour:+e.slice(8,10),minute:+e.slice(10,12),second:+e.slice(12,14)}:/^\d{8}$/.test(e)?{year:+e.slice(0,4),month:+e.slice(4,6),day:+e.slice(6,8),hour:0,minute:0,second:0}:null}var Vo={wallParts:{locale:"en-US",keyPrefix:"en-US|",options:{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}},svDisplay:{locale:"sv-SE",keyPrefix:"sv-SE|",options:{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}},dateOnly:{locale:"en-CA",keyPrefix:"en-CA|",options:{year:"numeric",month:"2-digit",day:"2-digit"}}},Mn=new Map;function Tt(t,e){let n=Vo[t],r=n.keyPrefix+e,o=Mn.get(r);return o||(o=new Intl.DateTimeFormat(n.locale,{timeZone:e,...n.options}),Mn.set(r,o)),o}function ce(t,e){let r=Tt("wallParts",e).formatToParts(new Date(t)),o={};for(let a of r)a.type!=="literal"&&(o[a.type]=a.value);let i=parseInt(_nullishCoalesce(o.hour, () => ("0")),10);return i===24&&(i=0),Date.UTC(parseInt(_nullishCoalesce(o.year, () => ("0")),10),parseInt(_nullishCoalesce(o.month, () => ("1")),10)-1,parseInt(_nullishCoalesce(o.day, () => ("1")),10),i,parseInt(_nullishCoalesce(o.minute, () => ("0")),10),parseInt(_nullishCoalesce(o.second, () => ("0")),10))}var Nn=new Map;function kn(t,e){return ce(t,e)-t}function Xo(t,e){let n=`${t}|${e}`,r=Nn.get(n);if(r===void 0){let o=kn(Date.UTC(e,0,1,12),t);for(let i=1;i<12;i++)if(kn(Date.UTC(e,i,1,12),t)!==o){o=null;break}r=o,Nn.set(n,r)}return r}function Ln(t,e){if(!(t.month===1&&t.day<=2||t.month===12&&t.day>=30)){let a=Xo(e,t.year);if(a!==null)return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)-a}let r=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second),o=2*r-ce(r,e);if(ce(o,e)===r)return o;let i=r-ce(o,e)+o;return ce(i,e)===r?i:o}function Zo(t,e){let n=(t||"").trim(),r=_nullishCoalesce(/^(\d{4})-(\d{2})-(\d{2})$/.exec(n), () => (/^(\d{4})(\d{2})(\d{2})$/.exec(n)));if(!r)return null;let o=/^(\d{2}):(\d{2})(?::(\d{2}))?$/.exec((e||"").trim());return o?{year:+r[1],month:+r[2],day:+r[3],hour:+o[1],minute:+o[2],second:o[3]?+o[3]:0}:null}function He(t,e){let n=Wo(t);return n?Ln(n,e):NaN}function de(t){return Number.isNaN(t)?null:t}function N(t,e){return{timestamp:de(He(t,e)),tz:e}}function pe(t,e){let[n,r,o]=t.split("-").map(Number);return new Date(Date.UTC(n,r-1,o+e)).toISOString().slice(0,10)}function yt(t,e,n){let r=Zo(t,e);return r?{timestamp:de(Ln(r,n)),tz:n}:{timestamp:null,tz:n}}function ht(t,e){if(t==null||!Number.isFinite(t))return"";let n=Tt("svDisplay",e).format(new Date(t)),r=n.match(/^(\d{4}-\d{2}-\d{2})[ T](\d{2}):(\d{2})/);if(!r)return n;let o=r[2]==="24"?"00":r[2];return`${r[1]} ${o}:${r[3]}`}function W(t,e=Date.now()){return Tt("dateOnly",t).format(new Date(e))}var St="https://qt.gtimg.cn",Et="https://web.ifzq.gtimg.cn/appstock/app/minute/query",Rt="https://assets.linkdiary.cn/shares/zh_a_list.json",_t="https://assets.linkdiary.cn/shares/us_list.json",Ct="https://assets.linkdiary.cn/shares/hk_list.json",qe="https://assets.linkdiary.cn/shares/fund_list",At="https://assets.linkdiary.cn/shares/trade-data-list.txt",ze="https://push2his.eastmoney.com/api/qt/stock/kline/get",Ot="https://push2his.eastmoney.com/api/qt/stock/trends2/get",$e="https://33.push2his.eastmoney.com/api/qt/stock/kline/get",Qe="https://63.push2his.eastmoney.com/api/qt/stock/kline/get",Pt="https://33.push2his.eastmoney.com/api/qt/stock/trends2/get",Dt="https://63.push2his.eastmoney.com/api/qt/stock/trends2/get",It="https://17.push2.eastmoney.com/api/qt/clist/get",bt="https://91.push2.eastmoney.com/api/qt/stock/get",Mt="https://29.push2.eastmoney.com/api/qt/clist/get",Nt="https://7.push2his.eastmoney.com/api/qt/stock/kline/get",kt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",Lt="https://79.push2.eastmoney.com/api/qt/clist/get",Ft="https://91.push2.eastmoney.com/api/qt/stock/get",wt="https://29.push2.eastmoney.com/api/qt/clist/get",Ut="https://91.push2his.eastmoney.com/api/qt/stock/kline/get",xt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",vt="https://datacenter-web.eastmoney.com/api/data/v1/get",me="https://push2his.eastmoney.com/api/qt/stock/fflow/daykline/get",Kt="https://push2.eastmoney.com/api/qt/clist/get",Bt="https://push2.eastmoney.com/api/qt/kamtbs.rtmin/get",ge="https://push2ex.eastmoney.com",k="7eea3edcaed734bea9cbfc24409ed989",z="b2884a393a59ad64002292a3e90d46a5",fe="https://push2his.eastmoney.com/api/qt/stock/kline/get",Ht="https://futsseapi.eastmoney.com/list/COMEX,NYMEX,COBOT,SGX,NYBOT,LME,MDEX,TOCOM,IPE",Te="58b2fa8f54638b60b87d69b31969089c",qt={SHFE:113,DCE:114,CZCE:115,INE:142,CFFEX:220,GFEX:225},oe={cu:"SHFE",al:"SHFE",zn:"SHFE",pb:"SHFE",au:"SHFE",ag:"SHFE",rb:"SHFE",wr:"SHFE",fu:"SHFE",ru:"SHFE",bu:"SHFE",hc:"SHFE",ni:"SHFE",sn:"SHFE",sp:"SHFE",ss:"SHFE",ao:"SHFE",br:"SHFE",c:"DCE",a:"DCE",b:"DCE",m:"DCE",y:"DCE",p:"DCE",l:"DCE",v:"DCE",j:"DCE",jm:"DCE",i:"DCE",jd:"DCE",pp:"DCE",cs:"DCE",eg:"DCE",eb:"DCE",pg:"DCE",lh:"DCE",WH:"CZCE",CF:"CZCE",SR:"CZCE",TA:"CZCE",OI:"CZCE",MA:"CZCE",FG:"CZCE",RM:"CZCE",SF:"CZCE",SM:"CZCE",ZC:"CZCE",AP:"CZCE",CJ:"CZCE",UR:"CZCE",SA:"CZCE",PF:"CZCE",PK:"CZCE",PX:"CZCE",SH:"CZCE",sc:"INE",nr:"INE",lu:"INE",bc:"INE",ec:"INE",IF:"CFFEX",IC:"CFFEX",IH:"CFFEX",IM:"CFFEX",TS:"CFFEX",TF:"CFFEX",T:"CFFEX",TL:"CFFEX",si:"GFEX",lc:"GFEX",ps:"GFEX",pt:"GFEX",pd:"GFEX"},je={HG:101,GC:101,SI:101,QI:101,QO:101,MGC:101,CL:102,NG:102,RB:102,HO:102,PA:102,PL:102,ZW:103,ZM:103,ZS:103,ZC:103,ZL:103,ZR:103,YM:103,NQ:103,ES:103,SB:108,CT:108,LCPT:109,LZNT:109,LALT:109},ye="https://stock.finance.sina.com.cn/futures/api/openapi.php/OptionService.getOptionData",he="https://stock.finance.sina.com.cn/futures/api/jsonp.php/{callback}/FutureOptionAllService.getOptionDayline",zt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getStockName",Ge="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getRemainderDay",$t="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getOptionMinline",Qt="https://stock.finance.sina.com.cn/futures/api/jsonp_v2.php/{callback}/StockOptionDaylineService.getSymbolInfo",jt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getFiveDayLine",Gt="https://futsseapi.eastmoney.com/list/option/221",Yt="https://datacenter-web.eastmoney.com/api/data/get";var Ye={au:{product:"au_o",exchange:"shfe"},ag:{product:"ag_o",exchange:"shfe"},cu:{product:"cu_o",exchange:"shfe"},al:{product:"al_o",exchange:"shfe"},zn:{product:"zn_o",exchange:"shfe"},ru:{product:"ru_o",exchange:"shfe"},sc:{product:"sc_o",exchange:"ine"},m:{product:"m_o",exchange:"dce"},c:{product:"c_o",exchange:"dce"},i:{product:"i_o",exchange:"dce"},p:{product:"p_o",exchange:"dce"},pp:{product:"pp_o",exchange:"dce"},l:{product:"l_o",exchange:"dce"},v:{product:"v_o",exchange:"dce"},pg:{product:"pg_o",exchange:"dce"},y:{product:"y_o",exchange:"dce"},a:{product:"a_o",exchange:"dce"},b:{product:"b_o",exchange:"dce"},eg:{product:"eg_o",exchange:"dce"},eb:{product:"eb_o",exchange:"dce"},SR:{product:"SR_o",exchange:"czce"},CF:{product:"CF_o",exchange:"czce"},TA:{product:"TA_o",exchange:"czce"},MA:{product:"MA_o",exchange:"czce"},RM:{product:"RM_o",exchange:"czce"},OI:{product:"OI_o",exchange:"czce"},PK:{product:"PK_o",exchange:"czce"},PF:{product:"PF_o",exchange:"czce"},SA:{product:"SA_o",exchange:"czce"},UR:{product:"UR_o",exchange:"czce"}},Wt=3e4,Se=500,Ee=500,Re=7,Vt=3,Xt=1e3,Zt=3e4,Jt=2,en=[408,429,500,502,503,504];var We=class{constructor(e={}){this.acquireChain=Promise.resolve();let n=_nullishCoalesce(e.requestsPerSecond, () => (5));this.maxTokens=_nullishCoalesce(e.maxBurst, () => (n)),this.tokens=this.maxTokens,this.refillRate=n/1e3,this.lastRefillTime=Date.now()}refill(){let e=Date.now(),r=(e-this.lastRefillTime)*this.refillRate;this.tokens=Math.min(this.maxTokens,this.tokens+r),this.lastRefillTime=e}tryAcquire(){return this.refill(),this.tokens>=1?(this.tokens-=1,!0):!1}getWaitTime(){if(this.refill(),this.tokens>=1)return 0;let e=1-this.tokens;return Math.ceil(e/this.refillRate)}async acquire(){let e=this.acquireChain,n;this.acquireChain=new Promise(r=>{n=r});try{await e;let r=this.getWaitTime();r>0&&await this.sleep(r),this.refill(),this.tokens-=1}finally{n()}}sleep(e){return new Promise(n=>setTimeout(n,e))}getAvailableTokens(){return this.refill(),this.tokens}};var Fn=["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"],tn=0;function Jo(){return typeof window<"u"&&typeof window.document<"u"}function wn(){if(Jo())return;let t=Fn[tn];return tn=(tn+1)%Fn.length,t}var ie=class extends _chunk4Q7UQ5Q3cjs.a{constructor(e="Circuit breaker is OPEN"){super({code:"CIRCUIT_OPEN",message:e}),this.name="CircuitBreakerError"}},Ve=class{constructor(e={}){this.state="CLOSED";this.failureCount=0;this.lastFailureTime=0;this.halfOpenSuccessCount=0;this.halfOpenProbeStartedAt=[];this.failureThreshold=_nullishCoalesce(e.failureThreshold, () => (5)),this.resetTimeout=_nullishCoalesce(e.resetTimeout, () => (3e4)),this.halfOpenRequests=_nullishCoalesce(e.halfOpenRequests, () => (1)),this.probeRecycleTimeout=_nullishCoalesce(e.probeRecycleTimeout, () => (Math.max(this.resetTimeout*4,12e4))),this.onStateChange=e.onStateChange}getState(){return this.checkStateTransition(),this.state}canRequest(){switch(this.checkStateTransition(),this.state){case"CLOSED":return!0;case"OPEN":return!1;case"HALF_OPEN":{let e=Date.now();for(;this.halfOpenProbeStartedAt.length>0&&e-this.halfOpenProbeStartedAt[0]>=this.probeRecycleTimeout;)this.halfOpenProbeStartedAt.shift();return this.halfOpenProbeStartedAt.length+this.halfOpenSuccessCount>=this.halfOpenRequests?!1:(this.halfOpenProbeStartedAt.push(e),!0)}}}releaseProbe(){this.state==="HALF_OPEN"&&this.halfOpenProbeStartedAt.shift()}recordSuccess(){this.checkStateTransition(),this.state==="HALF_OPEN"?(this.halfOpenProbeStartedAt.shift(),this.halfOpenSuccessCount++,this.halfOpenSuccessCount>=this.halfOpenRequests&&this.transitionTo("CLOSED")):this.state==="CLOSED"&&(this.failureCount=0)}recordFailure(){this.lastFailureTime=Date.now(),this.state==="HALF_OPEN"?(this.halfOpenProbeStartedAt.shift(),this.transitionTo("OPEN")):this.state==="CLOSED"&&(this.failureCount++,this.failureCount>=this.failureThreshold&&this.transitionTo("OPEN"))}checkStateTransition(){this.state==="OPEN"&&Date.now()-this.lastFailureTime>=this.resetTimeout&&this.transitionTo("HALF_OPEN")}transitionTo(e){if(this.state===e)return;let n=this.state;this.state=e,e==="CLOSED"?(this.failureCount=0,this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[]):e==="HALF_OPEN"&&(this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[]),_optionalChain([this, 'access', _2 => _2.onStateChange, 'optionalCall', _3 => _3(n,e)])}reset(){this.transitionTo("CLOSED"),this.failureCount=0,this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[],this.lastFailureTime=0}async execute(e){if(!this.canRequest())throw new ie;try{let n=await e();return this.recordSuccess(),n}catch(n){throw this.recordFailure(),n}}getStats(){return{state:this.getState(),failureCount:this.failureCount,lastFailureTime:this.lastFailureTime,halfOpenSuccessCount:this.halfOpenSuccessCount}}};var ei=3e4,ti=1,Un=["push2his.eastmoney.com","7.push2his.eastmoney.com","33.push2his.eastmoney.com","63.push2his.eastmoney.com","91.push2his.eastmoney.com"],xn=["17.push2.eastmoney.com","29.push2.eastmoney.com","79.push2.eastmoney.com","91.push2.eastmoney.com"];function ni(t,e){return e!=="eastmoney"?[t]:t.includes("push2his.eastmoney.com")?Un:t.includes("push2.eastmoney.com")?xn:[t]}function ri(t){return Array.from(new Set(t))}var Xe=class{constructor(e=ei,n=ti){this.cooldownMs=e;this.failureThreshold=n;this.states=new Map}getCandidateUrls(e,n){let r;try{r=new URL(e)}catch (e4){return[e]}let o=Date.now(),i=ni(r.hostname,n);if(i.length<=1)return[e];let a=i.filter(c=>{let d=this.states.get(c);return!d||d.cooldownUntil<=o}),u=i.filter(c=>{let d=this.states.get(c);return d&&d.cooldownUntil>o});return ri([...a.includes(r.hostname)?[r.hostname]:[],...a.filter(c=>c!==r.hostname),...u.includes(r.hostname)?[r.hostname]:[],...u.filter(c=>c!==r.hostname)]).map(c=>{let d=new URL(e);return d.hostname=c,d.toString()})}recordSuccess(e){let n=this.safeGetHost(e);if(!n)return;let r=this.getState(n);r.failureCount=0,r.cooldownUntil=0,r.successCount++,r.lastErrorCode=void 0}recordFailure(e,n){let r=this.safeGetHost(e);if(!r)return;let o=this.getState(r);o.failureCount++,o.lastFailureAt=Date.now(),o.lastErrorCode=_chunk4Q7UQ5Q3cjs.k.call(void 0, n),o.failureCount>=this.failureThreshold&&(o.cooldownUntil=Date.now()+this.cooldownMs)}shouldFallback(e){let n=_chunk4Q7UQ5Q3cjs.k.call(void 0, e);return n==="NETWORK_ERROR"||n==="TIMEOUT"||n==="PARSE_ERROR"?!0:e instanceof _chunk4Q7UQ5Q3cjs.b?e.status===408||e.status===429||e.status>=500:!1}getStats(e){let n=Array.from(this.states.values()).map(o=>({...o}));if(!e)return n;if(e!=="eastmoney")return[];let r=new Set([...Un,...xn]);return n.filter(o=>r.has(o.host))}safeGetHost(e){try{return new URL(e).hostname}catch (e5){return null}}getState(e){let n=this.states.get(e);if(n)return n;let r={host:e,failureCount:0,successCount:0,cooldownUntil:0,lastFailureAt:0};return this.states.set(e,r),r}};function oi(t){return{maxRetries:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _4 => _4.maxRetries]), () => (Vt)),baseDelay:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _5 => _5.baseDelay]), () => (Xt)),maxDelay:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _6 => _6.maxDelay]), () => (Zt)),backoffMultiplier:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _7 => _7.backoffMultiplier]), () => (Jt)),retryableStatusCodes:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _8 => _8.retryableStatusCodes]), () => (en)),retryOnNetworkError:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _9 => _9.retryOnNetworkError]), () => (!0)),retryOnTimeout:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _10 => _10.retryOnTimeout]), () => (!0)),onRetry:_optionalChain([t, 'optionalAccess', _11 => _11.onRetry])}}function ii(t,e){let n={..._nullishCoalesce(t, () => ({}))};return e&&(Object.keys(n).some(o=>o.toLowerCase()==="user-agent")||(n["User-Agent"]=e)),n}function vn(t,e){return e?{timeout:_nullishCoalesce(e.timeout, () => (t.timeout)),retry:e.retry?{..._nullishCoalesce(t.retry, () => ({})),...e.retry}:t.retry?{...t.retry}:void 0,headers:{..._nullishCoalesce(t.headers, () => ({})),..._nullishCoalesce(e.headers, () => ({}))},userAgent:_nullishCoalesce(e.userAgent, () => (t.userAgent)),rateLimit:e.rateLimit?{..._nullishCoalesce(t.rateLimit, () => ({})),...e.rateLimit}:t.rateLimit?{...t.rateLimit}:void 0,rotateUserAgent:_nullishCoalesce(e.rotateUserAgent, () => (t.rotateUserAgent)),circuitBreaker:e.circuitBreaker?{..._nullishCoalesce(t.circuitBreaker, () => ({})),...e.circuitBreaker}:t.circuitBreaker?{...t.circuitBreaker}:void 0}:{...t,headers:{..._nullishCoalesce(t.headers, () => ({}))},retry:t.retry?{...t.retry}:void 0,rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function nn(t={}){return{timeout:_nullishCoalesce(t.timeout, () => (Wt)),retry:oi(t.retry),headers:ii(t.headers,t.userAgent),rotateUserAgent:_nullishCoalesce(t.rotateUserAgent, () => (!1)),rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function Kn(t,e){if(e)return e;try{let n=new URL(t).hostname;if(n.includes("eastmoney.com"))return"eastmoney";if(n.includes("gtimg.cn"))return"tencent";if(n.includes("sina.com.cn"))return"sina";if(n.includes("linkdiary.cn"))return"linkdiary"}catch (e6){return"unknown"}return"unknown"}function Bn(t){if(t instanceof DOMException&&t.name==="AbortError")return!0;if(t instanceof Error){if(t.name==="AbortError")return!0;let e=t.cause;if((e instanceof Error||e instanceof DOMException)&&e.name==="AbortError")return!0}return!1}var rn=()=>{};function si(t){let e=t.filter(u=>!!u);if(e.length===0)return{signal:void 0,cleanup:rn};if(e.length===1)return{signal:e[0],cleanup:rn};let n=AbortSignal.any;if(typeof n=="function")return{signal:n(e),cleanup:rn};let r=new AbortController,o=u=>{r.signal.aborted||r.abort(u)},i=[];for(let u of e){if(u.aborted){o(u.reason);break}let l=()=>o(u.reason);u.addEventListener("abort",l,{once:!0}),i.push({s:u,handler:l})}let a=()=>{for(let{s:u,handler:l}of i)u.removeEventListener("abort",l)};return{signal:r.signal,cleanup:a}}async function ai(t,e){if(!t)return e;if(Promise.resolve(e).catch(()=>{}),t.aborted)return Promise.race([e,Promise.reject(t.reason)]);let n,r=new Promise((o,i)=>{n=()=>i(t.reason),t.addEventListener("abort",n,{once:!0})});try{return await Promise.race([e,r])}finally{t.removeEventListener("abort",n)}}var _e=class{constructor(e={}){this.baseUrl=_nullishCoalesce(e.baseUrl, () => (St));let n={timeout:e.timeout,retry:e.retry,headers:e.headers,userAgent:e.userAgent,rateLimit:e.rateLimit,rotateUserAgent:e.rotateUserAgent,circuitBreaker:e.circuitBreaker};this.defaultPolicy=nn(n),this.providerPolicies={},this.runtimeStates=new Map,this.fallbackManager=new Xe,this.fetchImpl=e.fetchImpl,this.clientSignal=e.signal,this.hooks=e.hooks;for(let[r,o]of Object.entries(_nullishCoalesce(e.providerPolicies, () => ({})))){let i=vn(n,o);this.providerPolicies[r]=nn(i)}}getProviderState(e){let n=this.runtimeStates.get(e);if(n)return n;let r=_nullishCoalesce(this.providerPolicies[e], () => (this.defaultPolicy)),o={policy:r,rateLimiter:r.rateLimit?new We(r.rateLimit):null,circuitBreaker:r.circuitBreaker?new Ve(r.circuitBreaker):null};return this.runtimeStates.set(e,o),o}getTimeout(){return this.defaultPolicy.timeout}getHostHealth(e){return this.fallbackManager.getStats(e)}safe(e){try{e()}catch (e7){}}toSdkError(e){return e instanceof _chunk4Q7UQ5Q3cjs.a?e:new (0, _chunk4Q7UQ5Q3cjs.a)({code:_nullishCoalesce(_chunk4Q7UQ5Q3cjs.k.call(void 0, e), () => ("NETWORK_ERROR")),message:e.message,provider:e.provider,url:e.url,status:e.status,details:e.details,cause:e})}calculateDelay(e,n){return Math.min(n.baseDelay*Math.pow(n.backoffMultiplier,e),n.maxDelay)+Math.random()*100}sleep(e){return new Promise(n=>setTimeout(n,e))}shouldRetry(e,n,r){if(n>=r.maxRetries)return!1;let o=_chunk4Q7UQ5Q3cjs.k.call(void 0, e);return o==="ABORTED"?!1:o==="TIMEOUT"?r.retryOnTimeout:o==="NETWORK_ERROR"?r.retryOnNetworkError:e instanceof _chunk4Q7UQ5Q3cjs.b?r.retryableStatusCodes.includes(e.status):!1}async executeWithRetry(e,n,r,o=0){try{return await e(o)}catch(i){let a=_chunk4Q7UQ5Q3cjs.l.call(void 0, i,r),u={provider:r.provider,url:r.url,timeout:r.timeout,attempt:o,responseType:r.responseType};if(this.safe(()=>_optionalChain([this, 'access', _12 => _12.hooks, 'optionalAccess', _13 => _13.onError, 'optionalCall', _14 => _14(u,this.toSdkError(a))])),this.safe(()=>_optionalChain([this, 'access', _15 => _15.hooks, 'optionalAccess', _16 => _16.trace, 'optionalCall', _17 => _17("error",u)])),this.shouldRetry(a,o,n)){let l=this.calculateDelay(o,n);return n.onRetry&&n.onRetry(o+1,a,l),this.safe(()=>_optionalChain([this, 'access', _18 => _18.hooks, 'optionalAccess', _19 => _19.onRetry, 'optionalCall', _20 => _20(u,this.toSdkError(a),l)])),this.safe(()=>_optionalChain([this, 'access', _21 => _21.hooks, 'optionalAccess', _22 => _22.trace, 'optionalCall', _23 => _23("retry",u)])),await this.sleep(l),this.executeWithRetry(e,n,r,o+1)}throw a}}async performRequest(e,n,r,o="text",i={},a=0){n.rateLimiter&&await n.rateLimiter.acquire();let u=new AbortController,l=new DOMException(`Request timed out after ${n.policy.timeout}ms`,"AbortError"),c=setTimeout(()=>u.abort(l),n.policy.timeout),{signal:d,cleanup:T}=si([u.signal,i.signal,this.clientSignal]),p=_nullishCoalesce(_nullishCoalesce(i.fetchImpl, () => (this.fetchImpl)), () => (globalThis.fetch)),y={...n.policy.headers};if(n.policy.rotateUserAgent){let S=wn();if(S){for(let O of Object.keys(y))O.toLowerCase()==="user-agent"&&delete y[O];y["User-Agent"]=S}}let R={provider:r,url:e,timeout:n.policy.timeout,attempt:a,responseType:o};this.safe(()=>_optionalChain([this, 'access', _24 => _24.hooks, 'optionalAccess', _25 => _25.onRequest, 'optionalCall', _26 => _26(R)])),this.safe(()=>_optionalChain([this, 'access', _27 => _27.hooks, 'optionalAccess', _28 => _28.trace, 'optionalCall', _29 => _29("request",R)]));let P=Date.now();try{let S=await ai(d,p(e,{signal:d,headers:y}));if(this.safe(()=>_optionalChain([this, 'access', _30 => _30.hooks, 'optionalAccess', _31 => _31.onResponse, 'optionalCall', _32 => _32(R,{status:S.status,durationMs:Date.now()-P})])),this.safe(()=>_optionalChain([this, 'access', _33 => _33.hooks, 'optionalAccess', _34 => _34.trace, 'optionalCall', _35 => _35("response",R)])),!S.ok)throw new (0, _chunk4Q7UQ5Q3cjs.b)(S.status,S.statusText,e,r);switch(o){case"json":try{return await S.json()}catch(O){throw new (0, _chunk4Q7UQ5Q3cjs.a)({code:"PARSE_ERROR",message:`Failed to parse JSON response from ${e}`,provider:r,url:e,cause:O})}case"arraybuffer":return await S.arrayBuffer();default:return await S.text()}}catch(S){let O=M=>_optionalChain([M, 'optionalAccess', _36 => _36.aborted])?S===M.reason?!0:S instanceof Error&&S.cause===M.reason:!1;if(!O(u.signal)){let M=_optionalChain([i, 'access', _37 => _37.signal, 'optionalAccess', _38 => _38.aborted])||_optionalChain([this, 'access', _39 => _39.clientSignal, 'optionalAccess', _40 => _40.aborted]);if(O(i.signal)||O(this.clientSignal)||M&&Bn(S))throw new (0, _chunk4Q7UQ5Q3cjs.h)("Request aborted by external signal",r,e);if(u.signal.aborted&&Bn(S))throw l}throw S}finally{clearTimeout(c),T()}}async get(e,n={}){let r=Kn(e,n.provider),o=this.getProviderState(r);if(o.circuitBreaker&&!o.circuitBreaker.canRequest())throw new ie("Circuit breaker is OPEN, request rejected");let i={fetchImpl:n.fetchImpl,signal:n.signal},a=this.fallbackManager.getCandidateUrls(e,r),u;for(let l=0;l<a.length;l++){let c=a[l],d=l===0?o.policy.retry:{...o.policy.retry,maxRetries:0};try{let T=await this.executeWithRetry(p=>this.performRequest(c,o,r,n.responseType,i,p),d,{provider:r,url:c,timeout:o.policy.timeout,responseType:n.responseType});return _optionalChain([o, 'access', _41 => _41.circuitBreaker, 'optionalAccess', _42 => _42.recordSuccess, 'call', _43 => _43()]),this.fallbackManager.recordSuccess(c),T}catch(T){let p=_chunk4Q7UQ5Q3cjs.l.call(void 0, T,{provider:r,url:c,timeout:o.policy.timeout});u=p;let y=_chunk4Q7UQ5Q3cjs.k.call(void 0, p)==="ABORTED";if(y?_optionalChain([o, 'access', _44 => _44.circuitBreaker, 'optionalAccess', _45 => _45.releaseProbe, 'call', _46 => _46()]):this.fallbackManager.recordFailure(c,p),l<a.length-1&&this.fallbackManager.shouldFallback(p)){this.safe(()=>_optionalChain([this, 'access', _47 => _47.hooks, 'optionalAccess', _48 => _48.trace, 'optionalCall', _49 => _49("fallback",{provider:r,url:c,timeout:o.policy.timeout,attempt:0,responseType:n.responseType})]));continue}throw y||_optionalChain([o, 'access', _50 => _50.circuitBreaker, 'optionalAccess', _51 => _51.recordFailure, 'call', _52 => _52()]),this.toSdkError(p)}}throw _optionalChain([o, 'access', _53 => _53.circuitBreaker, 'optionalAccess', _54 => _54.recordFailure, 'call', _55 => _55()]),u?this.toSdkError(u):new ie("Request failed without a concrete error")}async getTencentQuote(e){let n=`${this.baseUrl}/?q=${encodeURIComponent(e)}`,r=await this.get(n,{responseType:"arraybuffer",provider:"tencent"}),o=dt(r);return pt(o)}};var w=(t,e)=>t*60+e,ui={A:{tz:E.CN,open:[[w(9,30),w(11,30)],[w(13,0),w(15,0)]],lunchBreak:[w(11,30),w(13,0)],tradingWeekdays:[1,2,3,4,5]},HK:{tz:E.HK,open:[[w(9,30),w(12,0)],[w(13,0),w(16,0)]],lunchBreak:[w(12,0),w(13,0)],tradingWeekdays:[1,2,3,4,5]},US:{tz:E.US,open:[[w(9,30),w(16,0)]],tradingWeekdays:[1,2,3,4,5]}};function on(t,e){if(t==null)return W(e);if(t instanceof Date)return W(e,t.getTime());let n=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n;if(/^\d{8}$/.test(n))return`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)}`;let r=new Date(n);if(!Number.isNaN(r.getTime()))return W(e,r.getTime());throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Unsupported date input: ${JSON.stringify(t)}. Expected 'YYYY-MM-DD', 'YYYYMMDD', or Date.`)}function li(t,e){let n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,weekday:"short",hour:"2-digit",minute:"2-digit"}),r={};for(let l of n.formatToParts(t))l.type!=="literal"&&(r[l.type]=l.value);let o=parseInt(_nullishCoalesce(r.hour, () => ("0")),10);o===24&&(o=0);let i=parseInt(_nullishCoalesce(r.minute, () => ("0")),10),u=_nullishCoalesce({Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6,Sun:7}[_nullishCoalesce(r.weekday, () => (""))], () => (0));return{minutes:o*60+i,weekday:u}}function sn(t,e){let n=0,r=t.length;for(;n<r;){let o=n+r>>>1;t[o]<e?n=o+1:r=o}return n}var Ce=class{constructor(e){this.quoteService=e}async isTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),o=sn(r,n);return o<r.length&&r[o]===n}async nextTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),o=sn(r,n);if(o<r.length&&r[o]===n&&(o+=1),o>=r.length)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`nextTradingDay: ${n} \u4E4B\u540E\u6CA1\u6709\u53EF\u7528\u4EA4\u6613\u65E5 (\u65E5\u5386\u6700\u5927\u65E5\u671F ${_nullishCoalesce(r[r.length-1], () => ("N/A"))})`);return r[o]}async prevTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),i=sn(r,n)-1;if(i<0)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`prevTradingDay: ${n} \u4E4B\u524D\u6CA1\u6709\u53EF\u7528\u4EA4\u6613\u65E5 (\u65E5\u5386\u6700\u5C0F\u65E5\u671F ${_nullishCoalesce(r[0], () => ("N/A"))})`);return r[i]}getMarketStatus(e="A",n=new Date){let r=ui[e],{minutes:o,weekday:i}=li(n,r.tz);if(!r.tradingWeekdays.includes(i))return"closed";let a=r.open[0][0],u=r.open[r.open.length-1][1];if(o<a)return"pre_market";if(o>=u)return"after_hours";for(let[l,c]of r.open)if(o>=l&&o<c)return"open";return r.lunchBreak&&o>=r.lunchBreak[0]&&o<r.lunchBreak[1]?"lunch_break":"closed"}};var I={};_chunk4VDLQK6Fcjs.a.call(void 0, I,{getAShareCodeList:()=>Gn,getAllHKQuotesByCodes:()=>Xn,getAllQuotesByCodes:()=>Vn,getAllUSQuotesByCodes:()=>Zn,getFullQuotes:()=>Ze,getFundCodeList:()=>Jn,getFundFlow:()=>qn,getFundQuotes:()=>$n,getHKCodeList:()=>Wn,getHKQuotes:()=>Je,getPanelLargeOrder:()=>zn,getSimpleQuotes:()=>Hn,getTodayTimeline:()=>Qn,getTradingCalendar:()=>er,getUSCodeList:()=>Yn,getUSQuotes:()=>et,parseFullQuote:()=>an,parseFundFlow:()=>ln,parseFundQuote:()=>mn,parseHKQuote:()=>dn,parsePanelLargeOrder:()=>cn,parseSimpleQuote:()=>un,parseUSQuote:()=>pn,search:()=>nr});function an(t){let e=[];for(let i=0;i<5;i++)e.push({price:f(t[9+i*2]),volume:f(t[10+i*2])});let n=[];for(let i=0;i<5;i++)n.push({price:f(t[19+i*2]),volume:f(t[20+i*2])});let r=_nullishCoalesce(t[30], () => ("")),o=N(r,E.CN);return{marketId:_nullishCoalesce(t[0], () => ("")),name:_nullishCoalesce(t[1], () => ("")),code:_nullishCoalesce(t[2], () => ("")),price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),outerVolume:f(t[7]),innerVolume:f(t[8]),bid:e,ask:n,time:r,timestamp:o.timestamp,tz:o.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),volume2:f(t[36]),amount:f(t[37]),turnoverRate:_(t[38]),pe:_(t[39]),amplitude:_(t[43]),circulatingMarketCap:_(t[44]),totalMarketCap:_(t[45]),pb:_(t[46]),limitUp:_(t[47]),limitDown:_(t[48]),volumeRatio:_(t[49]),avgPrice:_(t[51]),peStatic:_(t[52]),peDynamic:_(t[53]),high52w:_(t[67]),low52w:_(t[68]),circulatingShares:_(t[72]),totalShares:_(t[73]),market:"CN",assetType:"stock",source:"tencent"}}function un(t){return{marketId:_nullishCoalesce(t[0], () => ("")),name:_nullishCoalesce(t[1], () => ("")),code:_nullishCoalesce(t[2], () => ("")),price:f(t[3]),change:f(t[4]),changePercent:f(t[5]),volume:f(t[6]),amount:f(t[7]),marketCap:_(t[9]),marketType:_nullishCoalesce(t[10], () => ("")),market:"CN",assetType:"stock",source:"tencent"}}function ln(t){let e=_nullishCoalesce(t[13], () => ("")),n=N(e,E.CN);return{code:_nullishCoalesce(t[0], () => ("")),mainInflow:f(t[1]),mainOutflow:f(t[2]),mainNet:f(t[3]),mainNetRatio:f(t[4]),retailInflow:f(t[5]),retailOutflow:f(t[6]),retailNet:f(t[7]),retailNetRatio:f(t[8]),totalFlow:f(t[9]),name:_nullishCoalesce(t[12], () => ("")),date:e,timestamp:n.timestamp,tz:n.tz}}function cn(t){return{buyLargeRatio:f(t[0]),buySmallRatio:f(t[1]),sellLargeRatio:f(t[2]),sellSmallRatio:f(t[3])}}function dn(t){let e=_nullishCoalesce(t[30], () => ("")),n=N(e,E.HK);return{marketId:_nullishCoalesce(t[0], () => ("")),name:_nullishCoalesce(t[1], () => ("")),code:_nullishCoalesce(t[2], () => ("")),price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),amount:f(t[37]),lotSize:_(t[40]),circulatingMarketCap:_(t[44]),totalMarketCap:_(t[45]),currency:_nullishCoalesce(t[t.length-3], () => ("")),market:"HK",assetType:"stock",source:"tencent"}}function pn(t){let e=_nullishCoalesce(t[30], () => ("")),n=N(e,E.US);return{marketId:_nullishCoalesce(t[0], () => ("")),name:_nullishCoalesce(t[1], () => ("")),code:_nullishCoalesce(t[2], () => ("")),price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),amount:f(t[37]),turnoverRate:_(t[38]),pe:_(t[39]),amplitude:_(t[43]),totalMarketCap:_(t[45]),pb:_(t[47]),high52w:_(t[48]),low52w:_(t[49]),market:"US",assetType:"stock",source:"tencent"}}function mn(t){let e=_nullishCoalesce(t[8], () => ("")),n=N(e,E.CN);return{code:_nullishCoalesce(t[0], () => ("")),name:_nullishCoalesce(t[1], () => ("")),nav:f(t[5]),accNav:f(t[6]),change:f(t[7]),navDate:e,timestamp:n.timestamp,tz:n.tz,market:"CN",assetType:"fund",source:"tencent"}}async function Ze(t,e){if(!e||e.length===0)return[];let n=await t.getTencentQuote(e.join(",")),r=new Set(e);return n.filter(o=>r.has(o.key)&&o.fields&&o.fields.length>5&&o.fields[0]!=="").map(o=>an(o.fields))}async function Hn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`s_${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>un(i.fields))}async function qn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`ff_${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=14&&i.fields[0]!=="").map(i=>ln(i.fields))}async function zn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`s_pk${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=4&&i.fields[0]!=="").map(i=>cn(i.fields))}async function Je(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`hk${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>dn(i.fields))}async function et(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`us${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>pn(i.fields))}async function $n(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`jj${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=9&&i.fields[0]!=="").map(i=>mn(i.fields))}async function Qn(t,e){let n=`${Et}?code=${encodeURIComponent(e)}`,r=await t.get(n,{responseType:"json",provider:"tencent"});if(r.code!==0)throw new (0, _chunk4Q7UQ5Q3cjs.g)(r.msg||"API error","tencent",n);let o=_optionalChain([r, 'access', _56 => _56.data, 'optionalAccess', _57 => _57[e]]);if(!o){let p=N("",E.CN);return{code:e,date:"",timestamp:p.timestamp,tz:p.tz,preClose:0,data:[]}}let i=_nullishCoalesce(_optionalChain([o, 'access', _58 => _58.data, 'optionalAccess', _59 => _59.data]), () => ([])),a=_nullishCoalesce(_optionalChain([o, 'access', _60 => _60.data, 'optionalAccess', _61 => _61.date]), () => ("")),u=_nullishCoalesce(_optionalChain([o, 'access', _62 => _62.qt, 'optionalAccess', _63 => _63[e]]), () => ([])),l=parseFloat(_nullishCoalesce(u[4], () => ("")))||0,c=!1;for(let p of i){let y=p.split(" "),R=parseFloat(y[1])||0,P=parseInt(y[2],10)||0,S=parseFloat(y[3])||0;if(P>0&&R>0){S/P>R*50&&(c=!0);break}}let d=i.map(p=>{let y=p.split(" "),R=y[0],P=`${R.slice(0,2)}:${R.slice(2,4)}`,S=parseInt(y[2],10)||0,O=parseFloat(y[3])||0,M=c?S*100:S,B=M>0?O/M:0,U=yt(a,P,E.CN);return{time:P,timestamp:U.timestamp,tz:U.tz,price:parseFloat(y[1])||0,volume:M,amount:O,avgPrice:Math.round(B*100)/100}}),T=N(a,E.CN);return{code:e,date:a,timestamp:T.timestamp,tz:T.tz,preClose:l,data:d}}var jn=_chunkTVIEKKDQcjs.b.call(void 0, "tencent:code-lists",{defaultTTL:360*60*1e3,maxSize:16});async function gn(t,e,n){return jn.getOrFetch(e,async()=>{let r=await t.get(n,{responseType:"json"}),o=_optionalChain([r, 'optionalAccess', _64 => _64.list]);if(_optionalChain([r, 'optionalAccess', _65 => _65.success])===!1||!Array.isArray(o)||o.length===0)throw new (0, _chunk4Q7UQ5Q3cjs.c)(`\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E: ${e}`,"tencent",n);return o})}function ci(t,e){let n=t.replace(/^(sh|sz|bj)/,"");switch(e){case"sh":return n.startsWith("6");case"sz":return n.startsWith("0")||n.startsWith("3");case"bj":return n.startsWith("4")||n.startsWith("8")||n.startsWith("92");case"kc":return n.startsWith("688");case"cy":return n.startsWith("30");default:return!0}}async function Gn(t,e){let n=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _66 => _66.simple]), () => (!1)),r=_optionalChain([e, 'optionalAccess', _67 => _67.market]),i=await gn(t,"a-share:full",Rt);return r&&(i=i.filter(a=>ci(a,r))),n?i.map(a=>a.replace(/^(sh|sz|bj)/,"")):i.slice()}async function Yn(t,e){let n=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _68 => _68.simple]), () => (!1)),r=_optionalChain([e, 'optionalAccess', _69 => _69.market]),i=(await gn(t,"us:full",_t)).slice();if(r){let a=`${_chunk3NSUE34Fcjs.f[r]}.`;i=i.filter(u=>u.startsWith(a))}return n?i.map(a=>a.replace(/^\d{3}\./,"")):i}async function Wn(t){return(await gn(t,"hk:full",Ct)).slice()}async function Vn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await Ze(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Xn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await Je(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Zn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await et(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Jn(t){return(await jn.getOrFetch("fund:full",async()=>{let o=(await _asyncNullishCoalesce(await t.get(qe,{responseType:"text"}), async () => (""))).split(",").slice(1).filter(i=>i.trim());if(o.length===0)throw new (0, _chunk4Q7UQ5Q3cjs.c)("\u57FA\u91D1\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",qe);return o})).slice()}var di=_chunkTVIEKKDQcjs.b.call(void 0, "tencent:trade-calendar",{defaultTTL:720*60*1e3,maxSize:4});async function er(t){return(await di.getOrFetch("a-share",async()=>{let r=(await _asyncNullishCoalesce(await t.get(At), async () => (""))).trim().split(",").map(o=>o.trim()).filter(o=>o.length>0);if(r.length===0)throw new (0, _chunk4Q7UQ5Q3cjs.c)("\u4EA4\u6613\u65E5\u5386\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",At);return r})).slice()}var tr="https://smartbox.gtimg.cn/s3/";function pi(t){return t.replace(/\\u([0-9a-fA-F]{4})/g,(e,n)=>String.fromCharCode(parseInt(n,16)))}function mi(t){let e=t.toUpperCase();return e.startsWith("QDII")||e.startsWith("ETF")||e.startsWith("LOF")||e.startsWith("KJ")||e.startsWith("JJ")||e.includes("FUND")?"fund":e.startsWith("GP")||e.includes("STOCK")?"stock":e==="ZS"||e.includes("INDEX")?"index":e.startsWith("ZQ")||e.includes("BOND")?"bond":e.startsWith("QH")||e.includes("FUTURE")?"futures":e.startsWith("QZ")||e.includes("OPTION")?"option":"other"}function gi(t){return!t||t==="N"?[]:t.split("^").filter(Boolean).map(n=>{let r=n.split("~"),o=r[0]||"",i=r[1]||"",a=pi(r[2]||""),u=r[4]||"";return{code:o+i,name:a,market:o,type:u,category:mi(u)}})}function fi(t){return new Promise((e,n)=>{let r=`${tr}?v=2&t=all&q=${encodeURIComponent(t)}`;window.v_hint="";let o=document.createElement("script");o.src=r,o.charset="utf-8",o.onload=()=>{let i=window.v_hint||"";document.body.removeChild(o),e(i)},o.onerror=()=>{document.body.removeChild(o),n(new (0, _chunk4Q7UQ5Q3cjs.a)({code:"NETWORK_ERROR",message:"Network error calling Smartbox",url:r}))},document.body.appendChild(o)})}async function Ti(t,e){let n=`${tr}?v=2&t=all&q=${encodeURIComponent(e)}`,o=(await t.get(n)).match(/v_hint="([^"]*)"/);return o?o[1]:""}function yi(){return typeof window<"u"&&typeof document<"u"}async function nr(t,e){if(!e||!e.trim())return[];let n;return yi()?n=await fi(e):n=await Ti(t,e),gi(n)}var g={};_chunk4VDLQK6Fcjs.a.call(void 0, g,{extractVariety:()=>Sn,fetchDatacenter:()=>Tn,fetchDatacenterList:()=>A,getBlockTradeDailyStat:()=>So,getBlockTradeDetail:()=>ho,getBlockTradeMarketStat:()=>yo,getBoardChanges:()=>uo,getCFFEXOptionQuotes:()=>Kr,getComexInventory:()=>$r,getConceptConstituents:()=>Or,getConceptKline:()=>Pr,getConceptList:()=>Cr,getConceptMinuteKline:()=>Dr,getConceptSpot:()=>Ar,getDividendDetail:()=>Ir,getDragonTigerBranchRank:()=>go,getDragonTigerDetail:()=>co,getDragonTigerInstitution:()=>mo,getDragonTigerStockSeatDetail:()=>fo,getDragonTigerStockStats:()=>po,getFundDividendList:()=>Mr,getFundEstimate:()=>Lr,getFundFlowRank:()=>Xr,getFundNavHistory:()=>kr,getFundRankHistory:()=>Fr,getFuturesHistoryKline:()=>Ur,getFuturesInventory:()=>zr,getFuturesInventorySymbols:()=>qr,getFuturesMarketCode:()=>En,getGlobalFuturesKline:()=>vr,getGlobalFuturesSpot:()=>xr,getHKHistoryKline:()=>ar,getHKMinuteKline:()=>ur,getHistoryKline:()=>ir,getIndividualFundFlow:()=>Wr,getIndustryConstituents:()=>Er,getIndustryKline:()=>Rr,getIndustryList:()=>hr,getIndustryMinuteKline:()=>_r,getIndustrySpot:()=>Sr,getMarginAccountInfo:()=>Eo,getMarginTargetList:()=>Ro,getMarketFundFlow:()=>Vr,getMinuteKline:()=>sr,getNorthboundFlowSummary:()=>no,getNorthboundHistory:()=>oo,getNorthboundHoldingRank:()=>ro,getNorthboundIndividual:()=>io,getNorthboundMinute:()=>to,getOptionLHB:()=>Br,getSectorFundFlowHistory:()=>Jr,getSectorFundFlowRank:()=>Zr,getStockChanges:()=>ao,getUSHistoryKline:()=>lr,getUSMinuteKline:()=>cr,getZTPool:()=>so});function b(t){return/^\d{8}$/.test(t)?`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6,8)}`:t}function rr(t,e){let n=i=>b(i.replace("T"," ").trim()).slice(0,16),r=n(t),o=n(e);return o.length===10&&(o+=" 23:59"),{start:r,end:o}}function or(t,e,n=0){let r=a=>{if(!a)return;let u=/^(\d{4})-?(\d{2})-?(\d{2})/.exec(a.trim());return u?`${u[1]}${u[2]}${u[3]}`:void 0},o=_nullishCoalesce(r(t), () => ("0")),i=r(e);return i!==void 0&&n>0&&(i=pe(`${i.slice(0,4)}-${i.slice(4,6)}-${i.slice(6,8)}`,n).replace(/-/g,"")),{beg:o,end:_nullishCoalesce(i, () => ("20500000"))}}async function fn(t,e,n,r,o=100,i){let a=[],u=1,l=0;do{let c=new URLSearchParams({...n,pn:String(u),pz:String(o),fields:r}),d=`${e}?${c.toString()}`,p=await _asyncOptionalChain([(await t.get(d,{responseType:"json"})), 'optionalAccess', async _70 => _70.data]);if(!p||!Array.isArray(p.diff))break;u===1&&(l=_nullishCoalesce(p.total, () => (0)));let y=p.diff.map((R,P)=>i(R,a.length+P+1));if(a.push(...y),y.length===0)break;u++}while(a.length<l);return a}function x(t){let[e,n,r,o,i,a,u,l,c,d,T]=t.split(",");return{date:e,open:m(n),close:m(r),high:m(o),low:m(i),volume:m(a),amount:m(u),amplitude:m(l),changePercent:m(c),change:m(d),turnoverRate:m(T)}}async function v(t,e,n){let r=`${e}?${n.toString()}`,o=await t.get(r,{responseType:"json"});return{klines:_optionalChain([o, 'optionalAccess', _71 => _71.data, 'optionalAccess', _72 => _72.klines])||[],name:_optionalChain([o, 'optionalAccess', _73 => _73.data, 'optionalAccess', _74 => _74.name]),code:_optionalChain([o, 'optionalAccess', _75 => _75.data, 'optionalAccess', _76 => _76.code])}}function hi(t){let[e,n,r,o,i,a,u,l]=t.split(",");return{time:e,open:m(n),close:m(r),high:m(o),low:m(i),volume:m(a),amount:m(u),avgPrice:m(l)}}function tt(t,e){let n=r=>{let o=He(r,E.CN);return{time:ht(o,t)||r,timestamp:de(o)}};return{mapTrendRow:({time:r,...o},i)=>({...n(r),tz:t,...o,currency:e,code:i.code}),mapKlineRow:({date:r,...o},i)=>({...n(r),tz:t,...o,currency:e,code:i.code})}}function ee(t){return async function(n,r,o={}){let i=_nullishCoalesce(o.period, () => (t.defaultPeriod));gt(i),t.fqt==="option"&&G(_nullishCoalesce(o.adjust, () => ("qfq")));let a=t.resolveTarget(r),u=t.window,l=p=>{if(u.mode==="full")return p;let{start:y,end:R}=rr(_nullishCoalesce(o.startDate, () => ("1979-09-01 09:32:00")),_nullishCoalesce(o.endDate, () => ("2222-01-01 09:32:00")));return p.filter(P=>P.time>=y&&P.time<=R)};if(i==="1"){let p=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",fields2:"f51,f52,f53,f54,f55,f56,f57,f58",...t.includeUt?{ut:k}:{},ndays:t.ndays==="option"?String(_nullishCoalesce(o.ndays, () => (1))):t.ndays.fixed,iscr:"0",secid:a.secid}),y=`${t.trendsUrl}?${p.toString()}`,P=await _asyncOptionalChain([(await n.get(y,{responseType:"json"})), 'optionalAccess', async _77 => _77.data, 'optionalAccess', async _78 => _78.trends]);return!Array.isArray(P)||P.length===0?[]:l(P.map(S=>t.mapTrendRow(hi(S),a)))}let c=u.mode==="filter"?or(o.startDate,o.endDate,_nullishCoalesce(u.endExtraDays, () => (0))):{beg:u.beg,end:u.end},d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",...t.includeUt?{ut:k}:{},klt:i,fqt:t.fqt==="option"?Y(_nullishCoalesce(o.adjust, () => ("qfq"))):t.fqt.fixed,secid:a.secid,beg:c.beg,end:c.end,..._nullishCoalesce(t.extraKlineParams, () => ({}))}),{klines:T}=await v(n,t.klineUrl,d);return!Array.isArray(T)||T.length===0?[]:l(T.map(p=>t.mapKlineRow(x(p),a)))}}async function ir(t,e,n={}){let{period:r="daily",adjust:o="qfq",startDate:i="19700101",endDate:a="20500101"}=n;H(r),G(o);let u=_chunk3NSUE34Fcjs.d.call(void 0, e,{market:"CN"}),l=_chunk3NSUE34Fcjs.h.call(void 0, u),c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",ut:k,klt:q(r),fqt:Y(o),secid:l,beg:i,end:a}),d=ze,{klines:T}=await v(t,d,c);return T.length===0?[]:T.map(p=>{let y=x(p),R=N(y.date,E.CN);return{...y,timestamp:R.timestamp,tz:R.tz,code:u.code}})}var Si=ee({trendsUrl:Ot,klineUrl:ze,resolveTarget:t=>{let e=_chunk3NSUE34Fcjs.d.call(void 0, t,{market:"CN"});return{secid:_chunk3NSUE34Fcjs.h.call(void 0, e),code:e.code}},defaultPeriod:"1",ndays:{fixed:"5"},fqt:"option",includeUt:!0,window:{mode:"filter"},mapTrendRow:({time:t,...e})=>{let n=N(t,E.CN);return{time:t,timestamp:n.timestamp,tz:n.tz,...e}},mapKlineRow:t=>{let e=N(t.date,E.CN);return{...t,time:t.date,timestamp:e.timestamp,tz:e.tz}}});async function sr(t,e,n={}){return Si(t,e,n)}function nt(t){return async function(n,r,o={}){let{period:i="daily",adjust:a="qfq",startDate:u="19700101",endDate:l="20500101"}=o;H(i),G(a);let c=t.normalizeSymbol(r),d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",ut:k,klt:q(i),fqt:Y(a),secid:c.secid,beg:u,end:l,lmt:"1000000"}),{klines:T,name:p,code:y}=await v(n,t.url,d);if(T.length===0)return[];let R=t.resolveResultMeta?t.resolveResultMeta(r,c,{code:y,name:p}):{code:y||c.fallbackCode,name:p||""};return T.map(P=>{let S=x(P),O=N(S.date,t.tz),M={...S,timestamp:O.timestamp,tz:O.tz,code:R.code,name:R.name};return t.enrichItem(M)})}}var Ei=nt({url:$e,tz:E.HK,normalizeSymbol:t=>{let e=_chunk3NSUE34Fcjs.d.call(void 0, t,{market:"HK"});return{secid:_chunk3NSUE34Fcjs.h.call(void 0, e),fallbackCode:e.code}},enrichItem:t=>({...t,currency:"HKD",lotSize:null})});async function ar(t,e,n={}){return Ei(t,e,n)}var Ri=ee({trendsUrl:Pt,klineUrl:$e,resolveTarget:t=>{let e=_chunk3NSUE34Fcjs.d.call(void 0, t,{market:"HK"});return{secid:_chunk3NSUE34Fcjs.h.call(void 0, e),code:e.code}},defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter"},...tt(E.HK,"HKD")});async function ur(t,e,n={}){return Ri(t,e,n)}var _i=nt({url:Qe,tz:E.US,normalizeSymbol:t=>({secid:t,fallbackCode:t.split(".")[1]||t}),resolveResultMeta:(t,e,n)=>({code:n.code||e.fallbackCode,name:n.name||""}),enrichItem:t=>({...t,currency:"USD"})});async function lr(t,e,n={}){return _i(t,e,n)}var Ci=ee({trendsUrl:Dt,klineUrl:Qe,resolveTarget:t=>({secid:t,code:t.split(".")[1]||t}),defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter",endExtraDays:1},...tt(E.US,"USD")});async function cr(t,e,n={}){return Ci(t,e,n)}function pr(t){let e=_chunkTVIEKKDQcjs.b.call(void 0, `eastmoney:board-code-map:${t.type}`,{defaultTTL:36e5,maxSize:4});return{async getCode(n,r,o){if(r.startsWith("BK"))return r;let a=(await e.getOrFetch("name-code-map",async()=>{let u=await o(n);if(u.length===0)throw new (0, _chunk4Q7UQ5Q3cjs.c)(`${t.errorPrefix}: \u677F\u5757\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E`,"eastmoney");return Object.fromEntries(u.map(l=>[l.name,l.code]))}))[r];if(!a)throw new (0, _chunk4Q7UQ5Q3cjs.d)(`${t.errorPrefix}: ${r}`,"eastmoney");return a}}}async function mr(t,e){let n={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:e.type==="concept"?"f12":"f3",fs:e.fsFilter},r=e.type==="concept"?"f2,f3,f4,f8,f12,f14,f15,f16,f17,f18,f20,f21,f24,f25,f22,f33,f11,f62,f128,f124,f107,f104,f105,f136":"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152,f124,f107,f104,f105,f140,f141,f207,f208,f209,f222",o=await fn(t,e.listUrl,n,r,100,(i,a)=>({rank:a,name:String(_nullishCoalesce(i.f14, () => (""))),code:String(_nullishCoalesce(i.f12, () => (""))),price:s(i.f2),change:s(i.f4),changePercent:s(i.f3),totalMarketCap:s(i.f20),turnoverRate:s(i.f8),riseCount:s(i.f104),fallCount:s(i.f105),leadingStock:i.f128?String(i.f128):null,leadingStockChangePercent:s(i.f136)}));return o.sort((i,a)=>(_nullishCoalesce(a.changePercent, () => (0)))-(_nullishCoalesce(i.changePercent, () => (0)))),o.forEach((i,a)=>{i.rank=a+1}),o}async function gr(t,e,n){let r=new URLSearchParams({fields:"f43,f44,f45,f46,f47,f48,f170,f171,f168,f169",mpi:"1000",invt:"2",fltt:"1",secid:`90.${e}`}),o=`${n}?${r.toString()}`,a=await _asyncOptionalChain([(await t.get(o,{responseType:"json"})), 'optionalAccess', async _79 => _79.data]);return a?[{key:"f43",name:"\u6700\u65B0",divide:!0},{key:"f44",name:"\u6700\u9AD8",divide:!0},{key:"f45",name:"\u6700\u4F4E",divide:!0},{key:"f46",name:"\u5F00\u76D8",divide:!0},{key:"f47",name:"\u6210\u4EA4\u91CF",divide:!1},{key:"f48",name:"\u6210\u4EA4\u989D",divide:!1},{key:"f170",name:"\u6DA8\u8DCC\u5E45",divide:!0},{key:"f171",name:"\u632F\u5E45",divide:!0},{key:"f168",name:"\u6362\u624B\u7387",divide:!0},{key:"f169",name:"\u6DA8\u8DCC\u989D",divide:!0}].map(({key:l,name:c,divide:d})=>{let T=a[l],p=null;return typeof T=="number"&&!isNaN(T)&&(p=d?T/100:T),{item:c,value:p}}):[]}async function fr(t,e,n){let r={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:"f3",fs:`b:${e} f:!50`};return fn(t,n,r,"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152,f45",100,(i,a)=>({rank:a,code:String(_nullishCoalesce(i.f12, () => (""))),name:String(_nullishCoalesce(i.f14, () => (""))),price:s(i.f2),changePercent:s(i.f3),change:s(i.f4),volume:s(i.f5),amount:s(i.f6),amplitude:s(i.f7),high:s(i.f15),low:s(i.f16),open:s(i.f17),prevClose:s(i.f18),turnoverRate:s(i.f8),pe:s(i.f9),pb:s(i.f23)}))}async function Tr(t,e,n,r={}){let{period:o="daily",adjust:i="",startDate:a="19700101",endDate:u="20500101"}=r;H(o),G(i);let l=new URLSearchParams({secid:`90.${e}`,fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",klt:q(o),fqt:Y(i),beg:a,end:u,smplmt:"10000",lmt:"1000000"}),{klines:c}=await v(t,n,l);return c.length===0?[]:c.map(d=>x(d))}var dr=new Map;async function yr(t,e,n,r,o={}){let i=`${n}|${r}`,a=dr.get(i);return a||(a=ee({trendsUrl:r,klineUrl:n,resolveTarget:u=>({secid:`90.${u}`,code:u}),defaultPeriod:"5",ndays:{fixed:"1"},fqt:{fixed:"1"},includeUt:!1,window:{mode:"full",beg:"0",end:"20500101"},extraKlineParams:{smplmt:"10000",lmt:"1000000"},mapTrendRow:({avgPrice:u,...l})=>({...l,price:u}),mapKlineRow:u=>({time:u.date,open:u.open,close:u.close,high:u.high,low:u.low,changePercent:u.changePercent,change:u.change,volume:u.volume,amount:u.amount,amplitude:u.amplitude,turnoverRate:u.turnoverRate})}),dr.set(i,a)),a(t,e,o)}function rt(t){let e=pr(t);async function n(o){return mr(o,t)}async function r(o,i){return e.getCode(o,i,n)}return{async getList(o){return n(o)},async getSpot(o,i){let a=await r(o,i);return gr(o,a,t.spotUrl)},async getConstituents(o,i){let a=await r(o,i);return fr(o,a,t.consUrl)},async getKline(o,i,a={}){let u=await r(o,i);return Tr(o,u,t.klineUrl,a)},async getMinuteKline(o,i,a={}){let u=await r(o,i);return yr(o,u,t.klineUrl,t.trendsUrl,a)}}}var Ai={type:"industry",fsFilter:"m:90 t:2 f:!50",listUrl:It,spotUrl:bt,consUrl:Mt,klineUrl:Nt,trendsUrl:kt,errorPrefix:"\u672A\u627E\u5230\u884C\u4E1A\u677F\u5757"},Ae=rt(Ai);async function hr(t){return Ae.getList(t)}async function Sr(t,e){return Ae.getSpot(t,e)}async function Er(t,e){return Ae.getConstituents(t,e)}async function Rr(t,e,n={}){return Ae.getKline(t,e,n)}async function _r(t,e,n={}){return Ae.getMinuteKline(t,e,n)}var Oi={type:"concept",fsFilter:"m:90 t:3 f:!50",listUrl:Lt,spotUrl:Ft,consUrl:wt,klineUrl:Ut,trendsUrl:xt,errorPrefix:"\u672A\u627E\u5230\u6982\u5FF5\u677F\u5757"},Oe=rt(Oi);async function Cr(t){return Oe.getList(t)}async function Ar(t,e){return Oe.getSpot(t,e)}async function Or(t,e){return Oe.getConstituents(t,e)}async function Pr(t,e,n={}){return Oe.getKline(t,e,n)}async function Dr(t,e,n={}){return Oe.getMinuteKline(t,e,n)}async function Tn(t,e,n){let{reportName:r,columns:o="ALL",filter:i,sortColumns:a,sortTypes:u,pageSize:l=500,startPage:c=1,fetchAllPages:d=!0,maxPages:T=1e3,quoteColumns:p,quoteType:y,extraParams:R}=e,P=[],S=c,O=1,M=0,B=0;do{let U=new URLSearchParams({reportName:r,columns:o,pageSize:String(l),pageNumber:String(S),source:"WEB",client:"WEB"});if(i&&U.set("filter",i),a&&U.set("sortColumns",a),u&&U.set("sortTypes",u),p&&U.set("quoteColumns",p),y&&U.set("quoteType",y),R)for(let[ot,it]of Object.entries(R))U.set(ot,it);let ko=`${vt}?${U.toString()}`,re=await _asyncOptionalChain([(await t.get(ko,{responseType:"json"})), 'optionalAccess', async _80 => _80.result]);if(!re||!Array.isArray(re.data))break;S===c&&(O=_nullishCoalesce(re.pages, () => (1)),M=_nullishCoalesce(re.count, () => (re.data.length)));let Lo=re.data.map((ot,it)=>n(ot,P.length+it));if(P.push(...Lo),S++,B++,!d)break}while(S<=O&&B<T);return d&&B>=T&&S<=O&&console.warn(`[stock-sdk] fetchDatacenter("${r}") truncated at maxPages=${T} (server reports ${O} pages). Pass a larger \`maxPages\` to fetch the full dataset.`),{data:P,total:M,pages:O}}async function A(t,e,n){return(await Tn(t,e,n)).data}function L(t){if(t==null)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}function ne(t){if(!t)return null;let e=t.match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Pi(t){return{code:_nullishCoalesce(t.SECURITY_CODE, () => ("")),name:_nullishCoalesce(t.SECURITY_NAME_ABBR, () => ("")),reportDate:ne(t.REPORT_DATE),planNoticeDate:ne(t.PLAN_NOTICE_DATE),disclosureDate:ne(_nullishCoalesce(t.PUBLISH_DATE, () => (t.PLAN_NOTICE_DATE))),assignTransferRatio:_nullishCoalesce(t.BONUS_IT_RATIO, () => (null)),bonusRatio:_nullishCoalesce(t.BONUS_RATIO, () => (null)),transferRatio:_nullishCoalesce(t.IT_RATIO, () => (null)),dividendPretax:_nullishCoalesce(t.PRETAX_BONUS_RMB, () => (null)),dividendDesc:_nullishCoalesce(t.IMPL_PLAN_PROFILE, () => (null)),dividendYield:_nullishCoalesce(t.DIVIDENT_RATIO, () => (null)),eps:_nullishCoalesce(t.BASIC_EPS, () => (null)),bps:_nullishCoalesce(t.BVPS, () => (null)),capitalReserve:_nullishCoalesce(t.PER_CAPITAL_RESERVE, () => (null)),unassignedProfit:_nullishCoalesce(t.PER_UNASSIGN_PROFIT, () => (null)),netProfitYoy:_nullishCoalesce(t.PNP_YOY_RATIO, () => (null)),totalShares:_nullishCoalesce(t.TOTAL_SHARES, () => (null)),equityRecordDate:ne(t.EQUITY_RECORD_DATE),exDividendDate:ne(t.EX_DIVIDEND_DATE),payDate:ne(t.PAY_DATE),assignProgress:_nullishCoalesce(t.ASSIGN_PROGRESS, () => (null)),noticeDate:ne(t.NOTICE_DATE)}}async function Ir(t,e){let n=e.replace(/^(sh|sz|bj)/,"");return A(t,{reportName:"RPT_SHAREBONUS_DET",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:500,filter:`(SECURITY_CODE="${n}")`},r=>Pi(r))}var Di="https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx",br="https://fund.eastmoney.com/pingzhongdata",Ii="https://fundgz.1234567.com.cn/js";function bi(){return typeof document<"u"&&typeof window<"u"}var Mi=1e4;function Ni(){return Number(W(E.CN).slice(0,4))}function ki(t,e){let n=new URLSearchParams({dt:"8",page:String(e),rank:_nullishCoalesce(t.rank, () => ("FSRQ")),sort:_nullishCoalesce(t.sort, () => ("desc")),gs:"",ftype:_nullishCoalesce(t.fundType, () => ("")),year:String(_nullishCoalesce(t.year, () => (Ni())))});return`${Di}?${n.toString()}`}function yn(t){if(!t)return null;let e=t.trim().match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Li(t){return{code:_nullishCoalesce(t[0], () => ("")),name:_nullishCoalesce(t[1], () => ("")),equityRecordDate:yn(t[2]),exDividendDate:yn(t[3]),dividendPerShare:j(t[4]),payDate:yn(t[5]),dividendType:_optionalChain([t, 'access', _81 => _81[6], 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()])?t[6].trim():null}}async function hn(t,e,n){let r=ki(e,n),o=await le(r,["pageinfo","jjfh_data"],{client:t}),i=_nullishCoalesce(o.pageinfo, () => ([0,0,n])),[a=0,u=0,l=n]=i;return{items:(_nullishCoalesce(o.jjfh_data, () => ([]))).map(Li),totalPages:a,pageSize:u,currentPage:l}}async function Mr(t,e={}){if(e.page==="all"){let o=await hn(t,e,1),i=o.items;for(let a=2;a<=o.totalPages;a++){let u=await hn(t,e,a);i=i.concat(u.items)}return e.code&&(i=i.filter(a=>a.code===e.code)),{items:i,totalPages:o.totalPages,pageSize:o.pageSize,currentPage:-1}}let n=_nullishCoalesce(e.page, () => (1)),r=await hn(t,e,n);return e.code?{...r,items:r.items.filter(o=>o.code===e.code)}:r}function Nr(t){return new Date(t).toISOString().slice(0,10)}async function kr(t,e){let n=`${br}/${encodeURIComponent(e)}.js`,r=await le(n,["fS_code","fS_name","Data_netWorthTrend","Data_ACWorthTrend"],{client:t}),o=_nullishCoalesce(r.Data_netWorthTrend, () => ([])),i=new Map;for(let u of _nullishCoalesce(r.Data_ACWorthTrend, () => ([])))Array.isArray(u)&&u.length>=2&&i.set(u[0],u[1]);let a=o.map(u=>({date:Nr(u.x),timestamp:u.x,nav:u.y,accNav:i.has(u.x)?i.get(u.x):null,dailyReturn:j(u.equityReturn),unitMoney:_nullishCoalesce(u.unitMoney, () => (""))}));return{code:_nullishCoalesce(r.fS_code, () => (e)),name:_nullishCoalesce(r.fS_name, () => (null)),items:a}}function Fi(t,e,n=Mi){let r=`${Ii}/${encodeURIComponent(e)}.js?rt=${Date.now()}`;return bi()?ue("fundgz:jsonpgz",()=>wi(r,n)):Ui(t,r)}function wi(t,e){return new Promise((n,r)=>{let o=document.createElement("script"),i=window,a=i.jsonpgz,u=!1,l=()=>{if(o.parentNode&&o.parentNode.removeChild(o),a===void 0)try{delete i.jsonpgz}catch (e8){}else i.jsonpgz=a},c=setTimeout(()=>{u||(u=!0,l(),r(new (0, _chunk4Q7UQ5Q3cjs.a)({code:"TIMEOUT",message:`fundgz JSONP timed out after ${e}ms: ${t}`,url:t,details:{timeout:e}})))},e);i.jsonpgz=d=>{u||(u=!0,clearTimeout(c),l(),n(_nullishCoalesce(d, () => ({}))))},o.onerror=()=>{u||(u=!0,clearTimeout(c),l(),r(new (0, _chunk4Q7UQ5Q3cjs.a)({code:"NETWORK_ERROR",message:`fundgz JSONP script load failed: ${t}`,url:t})))},o.src=t,document.head.appendChild(o)})}async function Ui(t,e){let r=(await t.get(e,{responseType:"text",provider:"eastmoney"})).trim();if(!r)return{};try{return Be(r)}catch (e9){return{}}}async function Lr(t,e){let n=await Fi(t,e);return{code:_nullishCoalesce(n.fundcode, () => (e)),name:_nullishCoalesce(n.name, () => (null)),navDate:_optionalChain([n, 'access', _84 => _84.jzrq, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()])?n.jzrq.trim():null,nav:j(n.dwjz),estimatedNav:j(n.gsz),estimatedChangePercent:j(n.gszzl),estimateTime:_optionalChain([n, 'access', _87 => _87.gztime, 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()])?n.gztime.trim():null}}async function Fr(t,e){let n=`${br}/${encodeURIComponent(e)}.js`,r=await le(n,["fS_code","fS_name","Data_rateInSimilarType","Data_rateInSimilarPersent"],{client:t}),o=_nullishCoalesce(r.Data_rateInSimilarType, () => ([])),i=new Map;for(let u of _nullishCoalesce(r.Data_rateInSimilarPersent, () => ([])))Array.isArray(u)&&u.length>=2&&i.set(u[0],u[1]);let a=o.map(u=>({date:Nr(u.x),timestamp:u.x,rank:j(u.y),total:j(u.sc),percentile:i.has(u.x)?i.get(u.x):null}));return{code:_nullishCoalesce(r.fS_code, () => (e)),name:_nullishCoalesce(r.fS_name, () => (null)),items:a}}function Sn(t){let e=t.match(/^([a-zA-Z]+)/);if(!e)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid futures symbol: "${t}". Expected format: variety + contract (e.g., rb2605, RBM, IF2604)`);return e[1]}function wr(t){return _nullishCoalesce(_nullishCoalesce(oe[t], () => (oe[t.toLowerCase()])), () => (oe[t.toUpperCase()]))}function En(t){let e=wr(t);if(!e&&t.length>1&&t.endsWith("M")&&(e=wr(t.slice(0,-1))),!e){let r=Object.keys(oe).join(", ");throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Unknown futures variety: "${t}". Supported varieties: ${r}`)}let n=qt[e];if(n===void 0)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`No market code found for exchange: ${e}`);return n}function xi(t){let e=x(t),n=t.split(",");return{...e,openInterest:n.length>12?m(n[12]):null}}async function Ur(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;H(r);let a=Sn(e),l=`${En(a)}.${e}`,c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",ut:k,klt:q(r),fqt:"0",secid:l,beg:o,end:i}),{klines:d,name:T,code:p}=await v(t,fe,c);return d.length===0?[]:d.map(y=>({...xi(y),code:p||e,name:T||""}))}async function xr(t,e={}){let n=_nullishCoalesce(e.pageSize, () => (20)),r=[],o=0,i=0,a=1e3;do{let u=new URLSearchParams({orderBy:"dm",sort:"desc",pageSize:String(n),pageIndex:String(o),token:Te,field:"dm,sc,name,p,zsjd,zde,zdf,f152,o,h,l,zjsj,vol,wp,np,ccl",blockName:"callback"}),l=`${Ht}?${u.toString()}`,c=await t.get(l,{responseType:"json"});if(!c||!Array.isArray(c.list))break;o===0&&(i=_nullishCoalesce(c.total, () => (0)));let d=c.list.map(vi);if(r.push(...d),d.length===0)break;o++}while(r.length<i&&o<a);return r}function vi(t){return{code:t.dm||"",name:t.name||"",price:m(String(t.p)),change:m(String(t.zde)),changePercent:m(String(t.zdf)),open:m(String(t.o)),high:m(String(t.h)),low:m(String(t.l)),prevSettle:m(String(t.zjsj)),volume:m(String(t.vol)),buyVolume:m(String(t.wp)),sellVolume:m(String(t.np)),openInterest:m(String(t.ccl))}}function Ki(t){let e=x(t),n=t.split(",");return{...e,openInterest:n.length>12?m(n[12]):null}}function Bi(t){let e=t.match(/^([A-Z]+)/);if(!e)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid global futures symbol: "${t}". Expected format like HG00Y, CL2507`);return e[1]}async function vr(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;H(r);let a=n.marketCode;if(a===void 0){let p=Bi(e);if(a=je[p],a===void 0){let y=Object.keys(je).join(", ");throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Unknown global futures variety: "${p}". Supported: ${y}. Or specify marketCode manually via options.`)}}let u=`${a}.${e}`,l=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",ut:k,klt:q(r),fqt:"0",secid:u,beg:o,end:i}),{klines:c,name:d,code:T}=await v(t,fe,l);return c.length===0?[]:c.map(p=>({...Ki(p),code:T||e,name:d||""}))}async function Kr(t,e={}){let{pageSize:n=2e4}=e,r=new URLSearchParams({orderBy:"zdf",sort:"desc",pageSize:String(n),pageIndex:"0",token:Te,field:"dm,sc,name,p,zsjd,zde,zdf,f152,vol,cje,ccl,xqj,syr,rz,zjsj,o"}),o=`${Gt}?${r.toString()}`,a=await _asyncOptionalChain([(await t.get(o,{responseType:"json"})), 'optionalAccess', async _90 => _90.list]);return Array.isArray(a)?a.map(u=>({code:String(_nullishCoalesce(u.dm, () => (""))),name:String(_nullishCoalesce(u.name, () => (""))),price:s(u.p),change:s(u.zde),changePercent:s(u.zdf),volume:s(u.vol),amount:s(u.cje),openInterest:s(u.ccl),strikePrice:s(u.xqj),remainDays:s(u.syr),dailyChange:s(u.rz),prevSettle:s(u.zjsj),open:s(u.o)})):[]}async function Br(t,e,n){let r=new URLSearchParams({type:"RPT_IF_BILLBOARD_TD",sty:"ALL",p:"1",ps:"200",source:"IFBILLBOARD",client:"WEB",ut:z,filter:`(SECURITY_CODE="${e}")(TRADE_DATE='${n}')`}),o=`${Yt}?${r.toString()}`,a=await _asyncOptionalChain([(await t.get(o,{responseType:"json"})), 'optionalAccess', async _91 => _91.result, 'optionalAccess', async _92 => _92.data]);if(!Array.isArray(a))return[];function u(l){if(!l)return"";let c=String(l),d=c.match(/^(\d{4}-\d{2}-\d{2})/);return d?d[1]:c}return a.map(l=>({tradeType:String(_nullishCoalesce(l.TRADE_TYPE, () => (""))),date:u(l.TRADE_DATE),symbol:String(_nullishCoalesce(l.SECURITY_CODE, () => (""))),targetName:String(_nullishCoalesce(l.TARGET_NAME, () => (""))),memberName:String(_nullishCoalesce(l.MEMBER_NAME_ABBR, () => (""))),rank:_nullishCoalesce(s(l.MEMBER_RANK), () => (0)),sellVolume:s(l.SELL_VOLUME),sellVolumeChange:s(l.SELL_VOLUME_CHANGE),netSellVolume:s(l.NET_SELL_VOLUME),sellVolumeRatio:s(l.SELL_VOLUME_RATIO),buyVolume:s(l.BUY_VOLUME),buyVolumeChange:s(l.BUY_VOLUME_CHANGE),netBuyVolume:s(l.NET_BUY_VOLUME),buyVolumeRatio:s(l.BUY_VOLUME_RATIO),sellPosition:s(l.SELL_POSITION),sellPositionChange:s(l.SELL_POSITION_CHANGE),netSellPosition:s(l.NET_SELL_POSITION),sellPositionRatio:s(l.SELL_POSITION_RATIO),buyPosition:s(l.BUY_POSITION),buyPositionChange:s(l.BUY_POSITION_CHANGE),netBuyPosition:s(l.NET_BUY_POSITION),buyPositionRatio:s(l.BUY_POSITION_RATIO)}))}var Hi={gold:"EMI00069026",silver:"EMI00069027"};function Hr(t){if(!t)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}async function qr(t){return A(t,{reportName:"RPT_FUTU_POSITIONCODE",columns:"TRADE_MARKET_CODE,TRADE_CODE,TRADE_TYPE",filter:'(IS_MAINCODE="1")',pageSize:500,fetchAllPages:!1},e=>({code:String(_nullishCoalesce(e.TRADE_CODE, () => (""))),name:String(_nullishCoalesce(e.TRADE_TYPE, () => (""))),marketCode:String(_nullishCoalesce(e.TRADE_MARKET_CODE, () => ("")))}))}async function zr(t,e,n={}){let{startDate:r="2020-10-28",pageSize:o=500}=n,i=e.toUpperCase();return A(t,{reportName:"RPT_FUTU_STOCKDATA",columns:"SECURITY_CODE,TRADE_DATE,ON_WARRANT_NUM,ADDCHANGE",filter:`(SECURITY_CODE="${i}")(TRADE_DATE>='${b(r)}')`,pageSize:o,sortColumns:"TRADE_DATE",sortTypes:"-1"},a=>({code:String(_nullishCoalesce(a.SECURITY_CODE, () => (e))),date:Hr(a.TRADE_DATE),inventory:s(a.ON_WARRANT_NUM),change:s(a.ADDCHANGE)}))}async function $r(t,e,n={}){let r=Hi[e];if(!r)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid COMEX symbol: "${e}". Must be "gold" or "silver".`);let{pageSize:o=500}=n,i={gold:"\u9EC4\u91D1",silver:"\u767D\u94F6"};return A(t,{reportName:"RPT_FUTUOPT_GOLDSIL",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:o,filter:`(INDICATOR_ID1="${r}")(@STORAGE_TON<>"NULL")`},a=>({date:Hr(a.REPORT_DATE),name:_nullishCoalesce(i[e], () => (e)),storageTon:s(a.STORAGE_TON),storageOunce:s(a.STORAGE_OUNCE)}))}var Qr={daily:"101",weekly:"102",monthly:"103"},Rn="f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65";function jr(t){let e=t.split(",");return{date:_nullishCoalesce(e[0], () => ("")),mainNetInflow:m(e[1]),smallNetInflow:m(e[2]),mediumNetInflow:m(e[3]),largeNetInflow:m(e[4]),superLargeNetInflow:m(e[5]),mainNetInflowPercent:m(e[6]),smallNetInflowPercent:m(e[7]),mediumNetInflowPercent:m(e[8]),largeNetInflowPercent:m(e[9]),superLargeNetInflowPercent:m(e[10]),close:m(e[11]),changePercent:m(e[12])}}function qi(t){let e=t.split(",");return{date:_nullishCoalesce(e[0], () => ("")),mainNetInflow:m(e[1]),smallNetInflow:m(e[2]),mediumNetInflow:m(e[3]),largeNetInflow:m(e[4]),superLargeNetInflow:m(e[5]),mainNetInflowPercent:m(e[6]),smallNetInflowPercent:m(e[7]),mediumNetInflowPercent:m(e[8]),largeNetInflowPercent:m(e[9]),superLargeNetInflowPercent:m(e[10]),shClose:m(e[11]),shChangePercent:m(e[12]),szClose:m(e[13]),szChangePercent:m(e[14])}}var Gr={today:{fid:"f62",fields:"f12,f14,f2,f3,f62,f184,f66,f69,f72,f75,f78,f81,f84,f87,f124",changePercentField:"f3",mainNet:"f62",mainPct:"f184",superLargeNet:"f66",superLargePct:"f69",largeNet:"f72",largePct:"f75",mediumNet:"f78",mediumPct:"f81",smallNet:"f84",smallPct:"f87"},"3day":{fid:"f267",fields:"f12,f14,f2,f127,f267,f268,f269,f270,f271,f272,f273,f274,f275,f276,f124",changePercentField:"f127",mainNet:"f267",mainPct:"f268",superLargeNet:"f269",superLargePct:"f270",largeNet:"f271",largePct:"f272",mediumNet:"f273",mediumPct:"f274",smallNet:"f275",smallPct:"f276"},"5day":{fid:"f164",fields:"f12,f14,f2,f109,f164,f165,f166,f167,f168,f169,f170,f171,f172,f173,f124",changePercentField:"f109",mainNet:"f164",mainPct:"f165",superLargeNet:"f166",superLargePct:"f167",largeNet:"f168",largePct:"f169",mediumNet:"f170",mediumPct:"f171",smallNet:"f172",smallPct:"f173"},"10day":{fid:"f174",fields:"f12,f14,f2,f160,f174,f175,f176,f177,f178,f179,f180,f181,f182,f183,f124",changePercentField:"f160",mainNet:"f174",mainPct:"f175",superLargeNet:"f176",superLargePct:"f177",largeNet:"f178",largePct:"f179",mediumNet:"f180",mediumPct:"f181",smallNet:"f182",smallPct:"f183"}},zi={industry:"m:90+t:2",concept:"m:90+t:3",region:"m:90+t:1"},$i="m:0+t:6+f:!2,m:0+t:13+f:!2,m:0+t:80+f:!2,m:1+t:2+f:!2,m:1+t:23+f:!2,m:0+t:7+f:!2,m:1+t:3+f:!2";async function Yr(t,e,n=100,r=1e3){let o=[],i=1,a=0;do{let u=new URLSearchParams({...e,pn:String(i),pz:String(n)}),l=`${Kt}?${u.toString()}`,d=await _asyncOptionalChain([(await t.get(l,{responseType:"json"})), 'optionalAccess', async _93 => _93.data]);if(!d||!Array.isArray(d.diff)||(i===1&&(a=_nullishCoalesce(d.total, () => (0))),o.push(...d.diff),o.length>=a||d.diff.length<n))break;i++}while(o.length<a&&i<=r);return i>r&&o.length<a&&console.warn(`[stock-sdk] fetchClistAllPages truncated at maxPages=${r} (server reports total=${a}, fetched=${o.length}). Pass a larger \`maxPages\` to fetch the full dataset.`),o}async function Wr(t,e,n={}){let{period:r="daily"}=n,o=Qr[r];if(!o)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=_chunk3NSUE34Fcjs.h.call(void 0, _chunk3NSUE34Fcjs.d.call(void 0, e,{market:"CN"})),a=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),u=`${me}?${a.toString()}`,c=await _asyncOptionalChain([(await t.get(u,{responseType:"json"})), 'optionalAccess', async _94 => _94.data, 'optionalAccess', async _95 => _95.klines]);return!Array.isArray(c)||c.length===0?[]:c.map(jr)}async function Vr(t){let e=new URLSearchParams({lmt:"0",klt:"101",secid:"1.000001",secid2:"0.399001",fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),n=`${me}?${e.toString()}`,o=await _asyncOptionalChain([(await t.get(n,{responseType:"json"})), 'optionalAccess', async _96 => _96.data, 'optionalAccess', async _97 => _97.klines]);return!Array.isArray(o)||o.length===0?[]:o.map(qi)}async function Xr(t,e={}){let{indicator:n="today"}=e,r=Gr[n];if(!r)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid indicator: ${n}.`);let o={fid:r.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:z,fs:$i,fields:r.fields};return(await Yr(t,o,100)).map(a=>({code:String(_nullishCoalesce(a.f12, () => (""))),name:String(_nullishCoalesce(a.f14, () => (""))),price:s(a.f2),changePercent:s(a[r.changePercentField]),mainNetInflow:s(a[r.mainNet]),mainNetInflowPercent:s(a[r.mainPct]),superLargeNetInflow:s(a[r.superLargeNet]),superLargeNetInflowPercent:s(a[r.superLargePct]),largeNetInflow:s(a[r.largeNet]),largeNetInflowPercent:s(a[r.largePct]),mediumNetInflow:s(a[r.mediumNet]),mediumNetInflowPercent:s(a[r.mediumPct]),smallNetInflow:s(a[r.smallNet]),smallNetInflowPercent:s(a[r.smallPct])}))}async function Zr(t,e={}){let{indicator:n="today",sectorType:r="industry"}=e,o=Gr[n];if(!o)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid indicator: ${n}.`);let i=zi[r];if(!i)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid sectorType: ${r}.`);let a=`${o.fields},f204,f205`,u={fid:o.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:z,fs:i,fields:a};return(await Yr(t,u,100)).map(c=>({code:String(_nullishCoalesce(c.f12, () => (""))),name:String(_nullishCoalesce(c.f14, () => (""))),changePercent:s(c[o.changePercentField]),mainNetInflow:s(c[o.mainNet]),mainNetInflowPercent:s(c[o.mainPct]),superLargeNetInflow:s(c[o.superLargeNet]),largeNetInflow:s(c[o.largeNet]),mediumNetInflow:s(c[o.mediumNet]),smallNetInflow:s(c[o.smallNet]),topStockCode:c.f204?String(c.f204):void 0,topStockName:c.f205?String(c.f205):void 0}))}async function Jr(t,e,n={}){let{period:r="daily"}=n,o=Qr[r];if(!o)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=e.includes(".")?e:`90.${e}`,a=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),u=`${me}?${a.toString()}`,c=await _asyncOptionalChain([(await t.get(u,{responseType:"json"})), 'optionalAccess', async _98 => _98.data, 'optionalAccess', async _99 => _99.klines]);return!Array.isArray(c)||c.length===0?[]:c.map(jr)}var Qi={today:"1","3day":"3","5day":"5","10day":"10",month:"M",quarter:"Q",year:"Y"},ji={shanghai:"001",shenzhen:"003"};function eo(t,e){let n=t.split(",");return{date:e,time:_nullishCoalesce(n[0], () => ("")),shanghaiNetInflow:m(n[1]),shenzhenNetInflow:m(n[3]),totalNetInflow:m(n[5])}}async function to(t,e="north"){Ke(e);let n=new URLSearchParams({fields1:"f1,f2,f3,f4",fields2:"f51,f54,f52,f58,f53,f62,f56,f57,f60,f61",ut:z}),r=`${Bt}?${n.toString()}`,i=await _asyncOptionalChain([(await t.get(r,{responseType:"json"})), 'optionalAccess', async _100 => _100.data]);if(!i)return[];if(e==="south"){let l=_nullishCoalesce(i.n2s, () => ([])),c=_nullishCoalesce(i.n2sDate, () => (""));return l.map(d=>eo(d,b(c)))}let a=_nullishCoalesce(i.s2n, () => ([])),u=_nullishCoalesce(i.s2nDate, () => (""));return a.map(l=>eo(l,b(u)))}async function no(t){return A(t,{reportName:"RPT_MUTUAL_QUOTA",columns:"TRADE_DATE,MUTUAL_TYPE,BOARD_TYPE,MUTUAL_TYPE_NAME,FUNDS_DIRECTION,INDEX_CODE,INDEX_NAME,BOARD_CODE",quoteColumns:"status~07~BOARD_CODE,dayNetAmtIn~07~BOARD_CODE,dayAmtRemain~07~BOARD_CODE,dayAmtThreshold~07~BOARD_CODE,f104~07~BOARD_CODE,f105~07~BOARD_CODE,f106~07~BOARD_CODE,f3~03~INDEX_CODE~INDEX_f3,netBuyAmt~07~BOARD_CODE",quoteType:"0",sortColumns:"MUTUAL_TYPE",sortTypes:"1",pageSize:2e3,fetchAllPages:!1},e=>({date:L(e.TRADE_DATE),type:String(_nullishCoalesce(e.MUTUAL_TYPE, () => (""))),boardName:String(_nullishCoalesce(e.MUTUAL_TYPE_NAME, () => (""))),direction:String(_nullishCoalesce(e.FUNDS_DIRECTION, () => (""))),status:String(_nullishCoalesce(e.status, () => (""))),netBuyAmount:s(e.netBuyAmt),netInflow:s(e.dayNetAmtIn),remainAmount:s(e.dayAmtRemain),upCount:s(e.f104),flatCount:s(e.f106),downCount:s(e.f105),indexCode:String(_nullishCoalesce(e.INDEX_CODE, () => (""))),indexName:String(_nullishCoalesce(e.INDEX_NAME, () => (""))),indexChangePercent:s(e.INDEX_f3)}))}async function ro(t,e={}){let{market:n="all",period:r="5day",date:o}=e,i=Qi[r];if(!i)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid period: ${r}.`);let a=[`(INTERVAL_TYPE="${i}")`];return o&&a.push(`(TRADE_DATE='${o}')`),n!=="all"&&a.push(`(MUTUAL_TYPE="${ji[n]}")`),A(t,{reportName:"RPT_MUTUAL_STOCK_NORTHSTA",columns:"ALL",sortColumns:"ADD_MARKET_CAP",sortTypes:"-1",pageSize:500,filter:a.join("")},u=>({date:L(u.TRADE_DATE),code:String(_nullishCoalesce(u.SECURITY_CODE, () => (""))),name:String(_nullishCoalesce(_nullishCoalesce(u.SECURITY_NAME, () => (u.SECURITY_NAME_ABBR)), () => (""))),close:s(u.CLOSE_PRICE),changePercent:s(u.CHANGE_RATE),holdShares:s(u.HOLD_SHARES),holdMarketValue:s(u.HOLD_MARKET_CAP),holdRatioFloat:s(u.HOLD_RATIO),holdRatioTotal:s(u.A_SHARES_RATIO),addShares:s(u.ADD_SHARES),addMarketValue:s(u.ADD_MARKET_CAP),addMarketValuePercent:s(u.ADD_MARKET_CAP_PROPORTION),sector:String(_nullishCoalesce(u.BOARD_NAME, () => ("")))}))}async function oo(t,e="north",n={}){Ke(e);let{startDate:r,endDate:o}=n,i=[e==="north"?'(BOARD_TYPE="1")':'(BOARD_TYPE="0")'];return r&&i.push(`(TRADE_DATE>='${b(r)}')`),o&&i.push(`(TRADE_DATE<='${b(o)}')`),A(t,{reportName:"RPT_MUTUAL_DEAL_HISTORY",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:i.join("")},a=>({date:L(a.TRADE_DATE),netBuyAmount:s(a.NET_DEAL_AMT),buyAmount:s(a.BUY_AMT),sellAmount:s(a.SELL_AMT),accNetBuyAmount:s(a.ACCUM_DEAL_AMT),netInflow:s(a.FUND_INFLOW),remainAmount:s(a.QUOTA_BALANCE),topStockCode:a.LEAD_STOCKS_CODE?String(a.LEAD_STOCKS_CODE):null,topStockName:a.LEAD_STOCKS_NAME?String(a.LEAD_STOCKS_NAME):null,topStockChangePercent:s(a.LS_CHANGE_RATE)}))}async function io(t,e,n={}){let r=e.replace(/^(sh|sz|bj)/i,""),{startDate:o,endDate:i}=n,a=[`(SECURITY_CODE="${r}")`];return o&&a.push(`(TRADE_DATE>='${b(o)}')`),i&&a.push(`(TRADE_DATE<='${b(i)}')`),A(t,{reportName:"RPT_MUTUAL_HOLDSTOCKNORTH_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:a.join("")},u=>({date:L(u.TRADE_DATE),holdShares:s(u.HOLD_SHARES),holdMarketValue:s(u.HOLD_MARKET_CAP),holdRatioFloat:s(u.HOLD_RATIO),holdRatioTotal:s(u.A_SHARES_RATIO),close:s(u.CLOSE_PRICE),changePercent:s(u.CHANGE_RATE)}))}var Gi={zt:{path:"/getTopicZTPool",sort:"fbt:asc"},yesterday:{path:"/getYesterdayZTPool",sort:"zs:desc"},strong:{path:"/getTopicQSPool",sort:"zdp:desc"},sub_new:{path:"/getTopicCXPool",sort:"ods:asc"},broken:{path:"/getTopicZBPool",sort:"fbt:asc"},dt:{path:"/getTopicDTPool",sort:"fund:asc"}},Yi={rocket_launch:"8201",quick_rebound:"8202",large_buy:"8193",limit_up_seal:"4",limit_down_open:"32",big_buy_order:"64",auction_up:"8207",high_open_5d:"8209",gap_up:"8211",high_60d:"8213",surge_60d:"8215",accelerate_down:"8204",high_dive:"8203",large_sell:"8194",limit_down_seal:"8",limit_up_open:"16",big_sell_order:"128",auction_down:"8208",low_open_5d:"8210",gap_down:"8212",low_60d:"8214",drop_60d:"8216"},Wi={8201:"\u706B\u7BAD\u53D1\u5C04",8202:"\u5FEB\u901F\u53CD\u5F39",8193:"\u5927\u7B14\u4E70\u5165",4:"\u5C01\u6DA8\u505C\u677F",32:"\u6253\u5F00\u8DCC\u505C\u677F",64:"\u6709\u5927\u4E70\u76D8",8207:"\u7ADE\u4EF7\u4E0A\u6DA8",8209:"\u9AD8\u5F005\u65E5\u7EBF",8211:"\u5411\u4E0A\u7F3A\u53E3",8213:"60\u65E5\u65B0\u9AD8",8215:"60\u65E5\u5927\u5E45\u4E0A\u6DA8",8204:"\u52A0\u901F\u4E0B\u8DCC",8203:"\u9AD8\u53F0\u8DF3\u6C34",8194:"\u5927\u7B14\u5356\u51FA",8:"\u5C01\u8DCC\u505C\u677F",16:"\u6253\u5F00\u6DA8\u505C\u677F",128:"\u6709\u5927\u5356\u76D8",8208:"\u7ADE\u4EF7\u4E0B\u8DCC",8210:"\u4F4E\u5F005\u65E5\u7EBF",8212:"\u5411\u4E0B\u7F3A\u53E3",8214:"60\u65E5\u65B0\u4F4E",8216:"60\u65E5\u5927\u5E45\u4E0B\u8DCC"};function _n(t){if(t==null)return"";let e=String(t).padStart(6,"0");return`${e.slice(0,2)}:${e.slice(2,4)}:${e.slice(4,6)}`}function Vi(t){if(!t||typeof t!="object")return"";let e=t;return`${_nullishCoalesce(e.days, () => (""))}/${_nullishCoalesce(e.ct, () => (""))}`}function Xi(t){let e=s(t.p),n=s(t.tp);return{code:String(_nullishCoalesce(_nullishCoalesce(t.c, () => (t.m)), () => (""))),name:String(_nullishCoalesce(t.n, () => (""))),price:e!==null?e/1e3:null,changePercent:s(t.zdp),limitPrice:n!==null?n/1e3:null,amount:s(_nullishCoalesce(t.amount, () => (t.zb))),floatMarketValue:s(t.ltsz),totalMarketValue:s(t.tshare),turnoverRate:s(t.hs),continuousBoardCount:s(t.lbc),firstBoardTime:t.fbt!==void 0&&t.fbt!==null?_n(t.fbt):null,lastBoardTime:t.lbt!==void 0&&t.lbt!==null?_n(t.lbt):null,boardAmount:s(t.fund),sealAmount:s(t.fund),failedCount:s(t.zbc),industry:String(_nullishCoalesce(t.hybk, () => (""))),ztStatistics:Vi(t.zttj),amplitude:s(t.zf),speed:s(t.zs)}}function Zi(t){if(t)return/^\d{8}$/.test(t)?t:t.replace(/-/g,"")}function Ji(){return W(E.CN).replace(/-/g,"")}async function so(t,e="zt",n){let r=Gi[e];if(!r)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid ZTPool type: ${e}.`);let o=_nullishCoalesce(Zi(n), () => (Ji())),i=new URLSearchParams({ut:k,dpt:"wz.ztzt",Pageindex:"0",pagesize:"10000",sort:r.sort,date:o}),a=`${ge}${r.path}?${i.toString()}`,l=await _asyncOptionalChain([(await t.get(a,{responseType:"json"})), 'optionalAccess', async _101 => _101.data, 'optionalAccess', async _102 => _102.pool]);return!Array.isArray(l)||l.length===0?[]:l.map(Xi)}async function ao(t,e="large_buy"){let n=Yi[e];if(!n)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid StockChangeType: ${e}.`);let r=new URLSearchParams({type:n,pageindex:"0",pagesize:"5000",ut:k,dpt:"wzchanges"}),o=`${ge}/getAllStockChanges?${r.toString()}`,a=await _asyncOptionalChain([(await t.get(o,{responseType:"json"})), 'optionalAccess', async _103 => _103.data, 'optionalAccess', async _104 => _104.allstock]);return!Array.isArray(a)||a.length===0?[]:a.map(u=>{let l=String(_nullishCoalesce(u.t, () => (n)));return{time:_n(u.tm),code:String(_nullishCoalesce(u.c, () => (""))),name:String(_nullishCoalesce(u.n, () => (""))),changeType:e,changeTypeLabel:_nullishCoalesce(Wi[l], () => ("")),info:String(_nullishCoalesce(u.i, () => ("")))}})}async function uo(t){let e=new URLSearchParams({ut:k,dpt:"wzchanges",pageindex:"0",pagesize:"5000"}),n=`${ge}/getAllBKChanges?${e.toString()}`,o=await _asyncOptionalChain([(await t.get(n,{responseType:"json"})), 'optionalAccess', async _105 => _105.data, 'optionalAccess', async _106 => _106.allbk]);return!Array.isArray(o)||o.length===0?[]:o.map(i=>{let a=_nullishCoalesce(i.ms, () => ({})),u=a.m===0?"\u5927\u7B14\u4E70\u5165":a.m===1?"\u5927\u7B14\u5356\u51FA":"",l={},c=_nullishCoalesce(i.bkdf, () => (i.bkdfdis));if(c&&typeof c=="object")for(let[d,T]of Object.entries(c))l[d]=Number(T)||0;return{name:String(_nullishCoalesce(i.bkn, () => (""))),changePercent:s(i.bkz),mainNetInflow:s(i.bkj),totalChangeCount:s(i.bkc),topStockCode:String(_nullishCoalesce(a.c, () => (""))),topStockName:String(_nullishCoalesce(a.n, () => (""))),topStockDirection:u,changeTypeDistribution:l}})}var lo={"1month":"01","3month":"02","6month":"03","1year":"04"};async function co(t,e){let n=b(e.startDate),r=b(e.endDate);return A(t,{reportName:"RPT_DAILYBILLBOARD_DETAILSNEW",columns:"SECURITY_CODE,SECUCODE,SECURITY_NAME_ABBR,TRADE_DATE,EXPLAIN,CLOSE_PRICE,CHANGE_RATE,BILLBOARD_NET_AMT,BILLBOARD_BUY_AMT,BILLBOARD_SELL_AMT,BILLBOARD_DEAL_AMT,ACCUM_AMOUNT,DEAL_NET_RATIO,DEAL_AMOUNT_RATIO,TURNOVERRATE,FREE_MARKET_CAP,EXPLANATION,D1_CLOSE_ADJCHRATE,D2_CLOSE_ADJCHRATE,D5_CLOSE_ADJCHRATE,D10_CLOSE_ADJCHRATE",sortColumns:"SECURITY_CODE,TRADE_DATE",sortTypes:"1,-1",pageSize:5e3,filter:`(TRADE_DATE<='${r}')(TRADE_DATE>='${n}')`},o=>({code:String(_nullishCoalesce(o.SECURITY_CODE, () => (""))),name:String(_nullishCoalesce(o.SECURITY_NAME_ABBR, () => (""))),date:L(o.TRADE_DATE),close:s(o.CLOSE_PRICE),changePercent:s(o.CHANGE_RATE),netBuyAmount:s(o.BILLBOARD_NET_AMT),buyAmount:s(o.BILLBOARD_BUY_AMT),sellAmount:s(o.BILLBOARD_SELL_AMT),dealAmount:s(o.BILLBOARD_DEAL_AMT),totalAmount:s(o.ACCUM_AMOUNT),netBuyRatio:s(o.DEAL_NET_RATIO),dealAmountRatio:s(o.DEAL_AMOUNT_RATIO),turnoverRate:s(o.TURNOVERRATE),floatMarketValue:s(o.FREE_MARKET_CAP),reason:String(_nullishCoalesce(_nullishCoalesce(o.EXPLANATION, () => (o.EXPLAIN)), () => (""))),afterChange1d:s(o.D1_CLOSE_ADJCHRATE),afterChange2d:s(o.D2_CLOSE_ADJCHRATE),afterChange5d:s(o.D5_CLOSE_ADJCHRATE),afterChange10d:s(o.D10_CLOSE_ADJCHRATE)}))}async function po(t,e="1month"){let n=lo[e];if(!n)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid period: ${e}.`);return A(t,{reportName:"RPT_BILLBOARD_TRADEALL",columns:"ALL",sortColumns:"BILLBOARD_TIMES,LATEST_TDATE,SECURITY_CODE",sortTypes:"-1,-1,1",pageSize:5e3,filter:`(STATISTICS_CYCLE="${n}")`},r=>({code:String(_nullishCoalesce(r.SECURITY_CODE, () => (""))),name:String(_nullishCoalesce(r.SECURITY_NAME_ABBR, () => (""))),latestDate:L(r.LATEST_TDATE),close:s(r.CLOSE_PRICE),changePercent:s(r.CHANGE_RATE),count:s(r.BILLBOARD_TIMES),totalBuyAmount:s(r.BILLBOARD_BUY_AMT),totalSellAmount:s(r.BILLBOARD_SELL_AMT),totalNetAmount:s(r.BILLBOARD_NET_AMT),totalDealAmount:s(r.BILLBOARD_DEAL_AMT),buyOrgCount:s(r.ORG_BUY_TIMES),sellOrgCount:s(r.ORG_SELL_TIMES)}))}async function mo(t,e){let n=b(e.startDate),r=b(e.endDate);return A(t,{reportName:"RPT_ORGANIZATION_TRADE_DETAILS",columns:"ALL",sortColumns:"TRADE_DATE,SECURITY_CODE",sortTypes:"-1,1",pageSize:5e3,filter:`(TRADE_DATE<='${r}')(TRADE_DATE>='${n}')`},o=>({code:String(_nullishCoalesce(o.SECURITY_CODE, () => (""))),name:String(_nullishCoalesce(o.SECURITY_NAME_ABBR, () => (""))),date:L(o.TRADE_DATE),close:s(o.CLOSE_PRICE),changePercent:s(o.CHANGE_RATE),buyOrgCount:s(o.BUY_TIMES),sellOrgCount:s(o.SELL_TIMES),orgBuyAmount:s(o.BUY_AMT),orgSellAmount:s(o.SELL_AMT),orgNetAmount:s(o.NET_AMT)}))}async function go(t,e="1month"){let n=lo[e];if(!n)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Invalid period: ${e}.`);return A(t,{reportName:"RPT_BILLBOARD_TRADEDETAILS",columns:"ALL",sortColumns:"TOTAL_BUYER_SALESTIMES",sortTypes:"-1",pageSize:5e3,filter:`(STATISTICS_CYCLE="${n}")`},r=>({code:String(_nullishCoalesce(r.OPERATEDEPT_CODE, () => (""))),name:String(_nullishCoalesce(r.OPERATEDEPT_NAME, () => (""))),totalBuyAmount:s(_nullishCoalesce(r.TOTAL_BUYAMT, () => (r.BUY_AMT))),totalSellAmount:s(_nullishCoalesce(r.TOTAL_SELLAMT, () => (r.SELL_AMT))),buyCount:s(_nullishCoalesce(r.TOTAL_BUYER_SALESTIMES, () => (r.BUY_TIMES))),sellCount:s(_nullishCoalesce(r.TOTAL_SELLER_SALESTIMES, () => (r.SELL_TIMES))),totalCount:s(r.TOTAL_TIMES)}))}async function fo(t,e,n){let r=e.replace(/^(sh|sz|bj)/i,""),o=b(n),i=`(SECURITY_CODE="${r}")(TRADE_DATE='${o}')`,[a,u]=await Promise.all([A(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSBUY",columns:"ALL",sortColumns:"BUY_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:_nullishCoalesce(s(l.RANK), () => (c+1)),branchName:String(_nullishCoalesce(l.OPERATEDEPT_NAME, () => (""))),buyAmount:s(_nullishCoalesce(l.BUY_AMT_REAL, () => (l.BUY_AMT))),buyAmountRatio:s(_nullishCoalesce(l.BUY_RATIO_TOTAL, () => (l.BUY_AMT_RATIO))),sellAmount:s(_nullishCoalesce(l.SELL_AMT_REAL, () => (l.SELL_AMT))),sellAmountRatio:s(_nullishCoalesce(l.SELL_RATIO_TOTAL, () => (l.SELL_AMT_RATIO))),netAmount:s(l.NET_AMT),side:"buy"})),A(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSSELL",columns:"ALL",sortColumns:"SELL_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:_nullishCoalesce(s(l.RANK), () => (c+1)),branchName:String(_nullishCoalesce(l.OPERATEDEPT_NAME, () => (""))),buyAmount:s(_nullishCoalesce(l.BUY_AMT_REAL, () => (l.BUY_AMT))),buyAmountRatio:s(_nullishCoalesce(l.BUY_RATIO_TOTAL, () => (l.BUY_AMT_RATIO))),sellAmount:s(_nullishCoalesce(l.SELL_AMT_REAL, () => (l.SELL_AMT))),sellAmountRatio:s(_nullishCoalesce(l.SELL_RATIO_TOTAL, () => (l.SELL_AMT_RATIO))),netAmount:s(l.NET_AMT),side:"sell"}))]);return[...a,...u]}function To(t){if(!t)return"";let e=t.startDate?b(t.startDate):void 0,n=t.endDate?b(t.endDate):void 0,r=[];return e&&r.push(`(TRADE_DATE>='${e}')`),n&&r.push(`(TRADE_DATE<='${n}')`),r.join("")}async function yo(t){return A(t,{reportName:"PRT_BLOCKTRADE_MARKET_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500},e=>({date:L(e.TRADE_DATE),shClose:s(_nullishCoalesce(e.CLOSE_PRICE, () => (e.SH_CLOSE_PRICE))),shChangePercent:s(_nullishCoalesce(e.CHANGE_RATE, () => (e.SH_CHANGE_RATE))),totalAmount:s(_nullishCoalesce(e.TURNOVER, () => (e.TOTAL_AMOUNT))),premiumAmount:s(_nullishCoalesce(e.PREMIUM_TURNOVER, () => (e.PREMIUM_AMOUNT))),premiumRatio:s(e.PREMIUM_RATIO),discountAmount:s(_nullishCoalesce(e.DISCOUNT_TURNOVER, () => (e.DISCOUNT_AMOUNT))),discountRatio:s(e.DISCOUNT_RATIO)}))}async function ho(t,e={}){let n=To(e);return A(t,{reportName:"RPT_BLOCK_TRADE_DETAIL",columns:"ALL",sortColumns:"TRADE_DATE,SECURITY_CODE",sortTypes:"-1,1",pageSize:5e3,filter:n||void 0},r=>({code:String(_nullishCoalesce(r.SECURITY_CODE, () => (""))),name:String(_nullishCoalesce(r.SECURITY_NAME_ABBR, () => (""))),date:L(r.TRADE_DATE),close:s(r.CLOSE_PRICE),changePercent:s(r.CHANGE_RATE),dealPrice:s(_nullishCoalesce(r.DEAL_PRICE, () => (r.PRICE))),dealVolume:s(_nullishCoalesce(r.DEAL_VOLUME, () => (r.VOLUME))),dealAmount:s(_nullishCoalesce(r.DEAL_AMT, () => (r.TURNOVER))),premiumRate:s(_nullishCoalesce(r.PREMIUM_RATIO, () => (r.PREMIUM_RATE))),buyBranch:String(_nullishCoalesce(_nullishCoalesce(r.BUYER_DEPT, () => (r.BUYER_OPERATEDEPT_NAME)), () => (""))),sellBranch:String(_nullishCoalesce(_nullishCoalesce(r.SELLER_DEPT, () => (r.SELLER_OPERATEDEPT_NAME)), () => ("")))}))}async function So(t,e={}){let n=To(e);return A(t,{reportName:"RPT_BLOCK_TRADE_STA",columns:"ALL",sortColumns:"TRADE_DATE,DEAL_AMT",sortTypes:"-1,-1",pageSize:5e3,filter:n||void 0},r=>({code:String(_nullishCoalesce(r.SECURITY_CODE, () => (""))),name:String(_nullishCoalesce(r.SECURITY_NAME_ABBR, () => (""))),date:L(r.TRADE_DATE),changePercent:s(r.CHANGE_RATE),close:s(r.CLOSE_PRICE),dealCount:s(_nullishCoalesce(r.DEAL_NUM, () => (r.DEAL_COUNT))),dealTotalAmount:s(_nullishCoalesce(r.DEAL_AMT, () => (r.TOTAL_AMOUNT))),dealTotalVolume:s(_nullishCoalesce(r.DEAL_VOLUME, () => (r.TOTAL_VOLUME))),premiumAmount:s(_nullishCoalesce(r.PREMIUM_AMT, () => (r.PREMIUM_AMOUNT))),discountAmount:s(_nullishCoalesce(r.DISCOUNT_AMT, () => (r.DISCOUNT_AMOUNT)))}))}async function Eo(t){return A(t,{reportName:"RPTA_WEB_MARGIN_DAILYTRADE",columns:"ALL",sortColumns:"STATISTICS_DATE",sortTypes:"-1",pageSize:500},e=>({date:L(_nullishCoalesce(e.STATISTICS_DATE, () => (e.TRADE_DATE))),finBalance:s(e.FIN_BALANCE),loanBalance:s(e.LOAN_BALANCE),finBuyAmount:s(e.FIN_BUY_AMT),loanSellAmount:s(e.LOAN_SELL_AMT),investorCount:s(_nullishCoalesce(e.OPERATE_INVESTOR_NUM, () => (e.INVESTOR_NUM))),liabilityInvestorCount:s(e.MARGIN_INVESTOR_NUM),totalGuarantee:s(e.TOTAL_GUARANTEE),avgGuaranteeRatio:s(e.AVG_GUARANTEE_RATIO)}))}async function Ro(t,e){let n=e?`(TRADE_DATE='${e}')`:void 0;return A(t,{reportName:"RPT_MARGIN_TRADE_DETAIL",columns:"ALL",sortColumns:"FIN_BALANCE",sortTypes:"-1",pageSize:5e3,filter:n},r=>({code:String(_nullishCoalesce(r.SECURITY_CODE, () => (""))),name:String(_nullishCoalesce(r.SECURITY_NAME_ABBR, () => (""))),date:L(r.TRADE_DATE),finBalance:s(r.FIN_BALANCE),finBuyAmount:s(r.FIN_BUY_AMT),finRepayAmount:s(r.FIN_REPAY_AMT),loanBalance:s(r.LOAN_BALANCE),loanSellVolume:s(r.LOAN_SELL_VOLUME),loanRepayVolume:s(r.LOAN_REPAY_VOLUME)}))}var K={};_chunk4VDLQK6Fcjs.a.call(void 0, K,{getCommodityOptionKline:()=>No,getCommodityOptionSpot:()=>Mo,getETFOption5DayMinute:()=>bo,getETFOptionDailyKline:()=>Io,getETFOptionExpireDay:()=>Oo,getETFOptionMinute:()=>Do,getETFOptionMonths:()=>Ao,getIndexOptionKline:()=>Co,getIndexOptionSpot:()=>_o});function es(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:s(t[7]),symbol:_nullishCoalesce(t[8], () => (""))}}function ts(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:null,symbol:_nullishCoalesce(t[7], () => (""))}}async function _o(t,e){let n=`${ye}?type=futures&product=${t}&exchange=cffex&pinzhong=${e}`,r=await F(n),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _107 => _107.result, 'optionalAccess', _108 => _108.data, 'optionalAccess', _109 => _109.up]), () => ([])),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _110 => _110.result, 'optionalAccess', _111 => _111.data, 'optionalAccess', _112 => _112.down]), () => ([]));return{calls:o.map(es),puts:i.map(ts)}}async function Co(t){let e=`${he}?symbol=${t}`,n=await F(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:s(r.o),high:s(r.h),low:s(r.l),close:s(r.c),volume:s(r.v)})):[]}async function Ao(t){let e=`${zt}?exchange=null&cate=${encodeURIComponent(t)}`,r=await _asyncOptionalChain([(await F(e)), 'optionalAccess', async _113 => _113.result, 'optionalAccess', async _114 => _114.data]),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _115 => _115.contractMonth]), () => ([]));return{months:o.length>1?o.slice(1):o,stockId:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _116 => _116.stockId]), () => ("")),cateId:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _117 => _117.cateId]), () => ("")),cateList:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _118 => _118.cateList]), () => ([]))}}async function Oo(t,e){let n=`${Ge}?exchange=null&cate=${encodeURIComponent(t)}&date=${e}`,r=await F(n),o=_optionalChain([r, 'optionalAccess', _119 => _119.result, 'optionalAccess', _120 => _120.data, 'optionalAccess', _121 => _121.remainderDays]);if(typeof o=="number"&&o<0){let a=`${Ge}?exchange=null&cate=${encodeURIComponent("XD"+t)}&date=${e}`;r=await F(a)}let i=_optionalChain([r, 'optionalAccess', _122 => _122.result, 'optionalAccess', _123 => _123.data]);return{expireDay:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _124 => _124.expireDay]), () => ("")),remainderDays:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _125 => _125.remainderDays]), () => (0)),stockId:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _126 => _126.stockId]), () => ("")),name:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _127 => _127.other, 'optionalAccess', _128 => _128.name]), () => (""))}}function Po(t){let e="";return t.map(n=>(n.d&&(e=n.d),{time:n.i,date:e,price:s(n.p),volume:s(n.v),openInterest:s(n.t),avgPrice:s(n.a)}))}async function Do(t){let e=`CON_OP_${t}`,n=`${$t}?symbol=${e}`,o=await _asyncOptionalChain([(await F(n)), 'optionalAccess', async _129 => _129.result, 'optionalAccess', async _130 => _130.data]);return Array.isArray(o)?Po(o):[]}async function Io(t){let e=`CON_OP_${t}`,n=`${Qt}?symbol=${e}`,r=await F(n,{callbackMode:"path"});return Array.isArray(r)?r.map(o=>({date:o.d,open:s(o.o),high:s(o.h),low:s(o.l),close:s(o.c),volume:s(o.v)})):[]}async function bo(t){let e=`CON_OP_${t}`,n=`${jt}?symbol=${e}`,o=await _asyncOptionalChain([(await F(n)), 'optionalAccess', async _131 => _131.result, 'optionalAccess', async _132 => _132.data]);if(!Array.isArray(o))return[];let i=[];for(let a of o)Array.isArray(a)&&i.push(...Po(a));return i}function ns(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:s(t[7]),symbol:_nullishCoalesce(t[8], () => (""))}}function rs(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:null,symbol:_nullishCoalesce(t[7], () => (""))}}async function Mo(t,e){let n=Ye[t];if(!n)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`Unknown commodity option variety: "${t}". Available: ${Object.keys(Ye).join(", ")}`);let r=`${ye}?type=futures&product=${n.product}&exchange=${n.exchange}&pinzhong=${e}`,o=await F(r),i=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _133 => _133.result, 'optionalAccess', _134 => _134.data, 'optionalAccess', _135 => _135.up]), () => ([])),a=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _136 => _136.result, 'optionalAccess', _137 => _137.data, 'optionalAccess', _138 => _138.down]), () => ([]));return{calls:i.map(ns),puts:a.map(rs)}}async function No(t){let e=`${he}?symbol=${t}`,n=await F(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:s(r.o),high:s(r.h),low:s(r.l),close:s(r.c),volume:s(r.v)})):[]}var D=class{constructor(e){this.client=e}};var Pe=class extends D{constructor(e){super(e)}getFundDividendList(e){return g.getFundDividendList(this.client,e)}getFundNavHistory(e){return g.getFundNavHistory(this.client,e)}getFundEstimate(e){return g.getFundEstimate(this.client,e)}getFundRankHistory(e){return g.getFundRankHistory(this.client,e)}};var De=class extends D{constructor(e){super(e)}getFullQuotes(e){return I.getFullQuotes(this.client,e)}getSimpleQuotes(e){return I.getSimpleQuotes(this.client,e)}getHKQuotes(e){return I.getHKQuotes(this.client,e)}getUSQuotes(e){return I.getUSQuotes(this.client,e)}getFundQuotes(e){return I.getFundQuotes(this.client,e)}getFundFlow(e){return I.getFundFlow(this.client,e)}getPanelLargeOrder(e){return I.getPanelLargeOrder(this.client,e)}getTodayTimeline(e){return I.getTodayTimeline(this.client,e)}search(e){return I.search(this.client,e)}getAShareCodeList(e){return I.getAShareCodeList(this.client,e)}getUSCodeList(e){return I.getUSCodeList(this.client,e)}getHKCodeList(){return I.getHKCodeList(this.client)}getFundCodeList(){return I.getFundCodeList(this.client)}async getAllAShareQuotes(e={}){let{market:n,...r}=e,o=await this.getAShareCodeList({market:n});return I.getAllQuotesByCodes(this.client,o,r)}async getAllHKShareQuotes(e={}){let n=await this.getHKCodeList();return I.getAllHKQuotesByCodes(this.client,n,e)}async getAllUSShareQuotes(e={}){let{market:n,...r}=e,o=await this.getUSCodeList({simple:!0,market:n});return I.getAllUSQuotesByCodes(this.client,o,r)}getAllQuotesByCodes(e,n={}){return I.getAllQuotesByCodes(this.client,e,n)}batchRaw(e){return this.client.getTencentQuote(e)}getTradingCalendar(){return I.getTradingCalendar(this.client)}getDividendDetail(e){return g.getDividendDetail(this.client,e)}};var Ie=class extends D{constructor(e){super(e)}getIndustryList(){return g.getIndustryList(this.client)}getIndustrySpot(e){return g.getIndustrySpot(this.client,e)}getIndustryConstituents(e){return g.getIndustryConstituents(this.client,e)}getIndustryKline(e,n){return g.getIndustryKline(this.client,e,n)}getIndustryMinuteKline(e,n){return g.getIndustryMinuteKline(this.client,e,n)}getConceptList(){return g.getConceptList(this.client)}getConceptSpot(e){return g.getConceptSpot(this.client,e)}getConceptConstituents(e){return g.getConceptConstituents(this.client,e)}getConceptKline(e,n){return g.getConceptKline(this.client,e,n)}getConceptMinuteKline(e,n){return g.getConceptMinuteKline(this.client,e,n)}};var be=class extends D{constructor(e){super(e)}getHistoryKline(e,n){return g.getHistoryKline(this.client,e,n)}getMinuteKline(e,n){return g.getMinuteKline(this.client,e,n)}getHKHistoryKline(e,n){return g.getHKHistoryKline(this.client,e,n)}getHKMinuteKline(e,n){return g.getHKMinuteKline(this.client,e,n)}getUSHistoryKline(e,n){return g.getUSHistoryKline(this.client,e,n)}getUSMinuteKline(e,n){return g.getUSMinuteKline(this.client,e,n)}};var Me=class extends D{constructor(e){super(e)}getFuturesKline(e,n){return g.getFuturesHistoryKline(this.client,e,n)}getGlobalFuturesSpot(e){return g.getGlobalFuturesSpot(this.client,e)}getGlobalFuturesKline(e,n){return g.getGlobalFuturesKline(this.client,e,n)}getFuturesInventorySymbols(){return g.getFuturesInventorySymbols(this.client)}getFuturesInventory(e,n){return g.getFuturesInventory(this.client,e,n)}getComexInventory(e,n){return g.getComexInventory(this.client,e,n)}};var Ne=class extends D{constructor(e){super(e)}getIndexOptionSpot(e,n){return K.getIndexOptionSpot(e,n)}getIndexOptionKline(e){return K.getIndexOptionKline(e)}getCFFEXOptionQuotes(e){return g.getCFFEXOptionQuotes(this.client,e)}getETFOptionMonths(e){return K.getETFOptionMonths(e)}getETFOptionExpireDay(e,n){return K.getETFOptionExpireDay(e,n)}getETFOptionMinute(e){return K.getETFOptionMinute(e)}getETFOptionDailyKline(e){return K.getETFOptionDailyKline(e)}getETFOption5DayMinute(e){return K.getETFOption5DayMinute(e)}getCommodityOptionSpot(e,n){return K.getCommodityOptionSpot(e,n)}getCommodityOptionKline(e){return K.getCommodityOptionKline(e)}getOptionLHB(e,n){return g.getOptionLHB(this.client,e,n)}};var os=500,is=15,ke=class{constructor(e,n){this.klineService=e;this.quoteService=n}detectMarket(e){let n=_chunk3NSUE34Fcjs.e.call(void 0, e);return n==="HK"?"HK":n==="US"?"US":"A"}calcActualStartDate(e,n,r=1.5){let o=this.toCompactDate(e),i=Math.ceil(n*r),a=new Date(parseInt(o.slice(0,4)),parseInt(o.slice(4,6))-1,parseInt(o.slice(6,8)));a.setDate(a.getDate()-i);let u=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),c=String(a.getDate()).padStart(2,"0");return`${u}${l}${c}`}calcActualStartDateByCalendar(e,n,r){if(!r||r.length===0)return;let o=r.findIndex(a=>a>=e);o===-1&&(o=r.length-1);let i=Math.max(0,o-n);return this.toCompactDate(r[i])}tryNormalizeDate(e){let n=e.trim();return/^\d{4}-\d{2}-\d{2}/.test(n)?n.slice(0,10):/^\d{8}$/.test(n)?`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)}`:null}normalizeUserDate(e){let n=this.tryNormalizeDate(e);if(n===null)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`\u65E5\u671F\u683C\u5F0F\u5E94\u4E3A 'YYYY-MM-DD' \u6216 'YYYYMMDD',\u5F97\u5230 '${e}'`,{argument:"date",value:e});return n}normalizeRowDate(e){return _nullishCoalesce(this.tryNormalizeDate(e), () => (e))}toCompactDate(e){return e.replace(/-/g,"")}async getKlineWithIndicators(e,n={}){let{indicators:r={}}=n,o=n.startDate?this.normalizeUserDate(n.startDate):void 0,i=n.endDate?this.normalizeUserDate(n.endDate):void 0,a=_nullishCoalesce(n.market, () => (this.detectMarket(e))),{requiredBars:u,maxRecursiveLookback:l}=_chunkPMERLSCUcjs.v.call(void 0, r),c={A:1.5,HK:1.46,US:1.45},d;if(o)if(a==="A")try{let O=await this.quoteService.getTradingCalendar();d=_nullishCoalesce(this.calcActualStartDateByCalendar(o,u,O), () => (this.calcActualStartDate(o,u,c[a])))}catch (e10){d=this.calcActualStartDate(o,u,c[a])}else d=this.calcActualStartDate(o,u,c[a]);let T={period:n.period,adjust:n.adjust,startDate:d,endDate:i?this.toCompactDate(i):void 0},p;switch(a){case"HK":p=await this.klineService.getHKHistoryKline(e,T);break;case"US":p=await this.klineService.getUSHistoryKline(e,T);break;default:p=await this.klineService.getHistoryKline(e,T)}let y=_nullishCoalesce(n.period, () => ("daily")),R=30+(y==="weekly"?7:y==="monthly"?31:0),P=p.length===0||d===void 0||this.normalizeRowDate(p[0].date)<=pe(this.normalizeRowDate(d),R),S=!1;if(o&&p.length<u&&P)switch(S=!0,a){case"HK":p=await this.klineService.getHKHistoryKline(e,{...T,startDate:void 0});break;case"US":p=await this.klineService.getUSHistoryKline(e,{...T,startDate:void 0});break;default:p=await this.klineService.getHistoryKline(e,{...T,startDate:void 0})}if(o){let O=p.findIndex(B=>this.normalizeRowDate(B.date)>=o);if(O===-1)return[];let M=p;if(S&&!_chunkPMERLSCUcjs.t.call(void 0, r)){let B=l>0?Math.max(u,os,is*l):u;M=p.slice(Math.max(0,O-B))}return _chunkPMERLSCUcjs.w.call(void 0, M,r).filter(B=>{let U=this.normalizeRowDate(B.date);return U>=o&&(i===void 0||U<=i)})}return _chunkPMERLSCUcjs.w.call(void 0, p,r)}};var Le=class extends D{constructor(e){super(e)}getIndividualFundFlow(e,n){return g.getIndividualFundFlow(this.client,e,n)}getMarketFundFlow(){return g.getMarketFundFlow(this.client)}getFundFlowRank(e){return g.getFundFlowRank(this.client,e)}getSectorFundFlowRank(e){return g.getSectorFundFlowRank(this.client,e)}getSectorFundFlowHistory(e,n){return g.getSectorFundFlowHistory(this.client,e,n)}};var Fe=class extends D{constructor(e){super(e)}getNorthboundMinute(e){return g.getNorthboundMinute(this.client,e)}getNorthboundFlowSummary(){return g.getNorthboundFlowSummary(this.client)}getNorthboundHoldingRank(e){return g.getNorthboundHoldingRank(this.client,e)}getNorthboundHistory(e,n){return g.getNorthboundHistory(this.client,e,n)}getNorthboundIndividual(e,n){return g.getNorthboundIndividual(this.client,e,n)}};var we=class extends D{constructor(e){super(e)}getZTPool(e,n){return g.getZTPool(this.client,e,n)}getStockChanges(e){return g.getStockChanges(this.client,e)}getBoardChanges(){return g.getBoardChanges(this.client)}};var Ue=class extends D{constructor(e){super(e)}getDragonTigerDetail(e){return g.getDragonTigerDetail(this.client,e)}getDragonTigerStockStats(e){return g.getDragonTigerStockStats(this.client,e)}getDragonTigerInstitution(e){return g.getDragonTigerInstitution(this.client,e)}getDragonTigerBranchRank(e){return g.getDragonTigerBranchRank(this.client,e)}getDragonTigerStockSeatDetail(e,n){return g.getDragonTigerStockSeatDetail(this.client,e,n)}};var xe=class extends D{constructor(e){super(e)}getBlockTradeMarketStat(){return g.getBlockTradeMarketStat(this.client)}getBlockTradeDetail(e){return g.getBlockTradeDetail(this.client,e)}getBlockTradeDailyStat(e){return g.getBlockTradeDailyStat(this.client,e)}getMarginAccountInfo(){return g.getMarginAccountInfo(this.client)}getMarginTargetList(e){return g.getMarginTargetList(this.client,e)}};var Cn=class{constructor(e={}){this._ns={};this.client=new _e(e),this.quoteService=new De(this.client),this.boardService=new Ie(this.client),this.klineService=new be(this.client),this.futuresService=new Me(this.client),this.optionsService=new Ne(this.client),this.indicatorService=new ke(this.klineService,this.quoteService),this.fundFlowService=new Le(this.client),this.northboundService=new Fe(this.client),this.marketEventService=new we(this.client),this.dragonTigerService=new Ue(this.client),this.dataService=new xe(this.client),this.tradingCalendarService=new Ce(this.quoteService),this.fundService=new Pe(this.client)}memoNs(e,n){let r=this._ns[e];return r===void 0&&(r=n(),this._ns[e]=r),r}get quotes(){return this.memoNs("quotes",()=>{let e=this.quoteService;return{cn:e.getFullQuotes.bind(e),cnSimple:e.getSimpleQuotes.bind(e),hk:e.getHKQuotes.bind(e),us:e.getUSQuotes.bind(e),fund:e.getFundQuotes.bind(e),fundFlow:e.getFundFlow.bind(e),largeOrder:e.getPanelLargeOrder.bind(e),timeline:e.getTodayTimeline.bind(e)}})}get codes(){return this.memoNs("codes",()=>{let e=this.quoteService;return{cn:e.getAShareCodeList.bind(e),us:e.getUSCodeList.bind(e),hk:e.getHKCodeList.bind(e),fund:e.getFundCodeList.bind(e)}})}get batch(){return this.memoNs("batch",()=>{let e=this.quoteService;return{cn:e.getAllAShareQuotes.bind(e),hk:e.getAllHKShareQuotes.bind(e),us:e.getAllUSShareQuotes.bind(e),byCodes:e.getAllQuotesByCodes.bind(e),raw:e.batchRaw.bind(e)}})}get kline(){return this.memoNs("kline",()=>{let e=this.klineService,n=this.indicatorService;return{cn:e.getHistoryKline.bind(e),cnMinute:e.getMinuteKline.bind(e),hk:e.getHKHistoryKline.bind(e),hkMinute:e.getHKMinuteKline.bind(e),us:e.getUSHistoryKline.bind(e),usMinute:e.getUSMinuteKline.bind(e),withIndicators:n.getKlineWithIndicators.bind(n)}})}get board(){return this.memoNs("board",()=>{let e=this.boardService;return{industry:{list:e.getIndustryList.bind(e),spot:e.getIndustrySpot.bind(e),constituents:e.getIndustryConstituents.bind(e),kline:e.getIndustryKline.bind(e),minuteKline:e.getIndustryMinuteKline.bind(e)},concept:{list:e.getConceptList.bind(e),spot:e.getConceptSpot.bind(e),constituents:e.getConceptConstituents.bind(e),kline:e.getConceptKline.bind(e),minuteKline:e.getConceptMinuteKline.bind(e)}}})}get options(){return this.memoNs("options",()=>{let e=this.optionsService;return{index:{spot:e.getIndexOptionSpot.bind(e),kline:e.getIndexOptionKline.bind(e)},etf:{months:e.getETFOptionMonths.bind(e),expireDay:e.getETFOptionExpireDay.bind(e),minute:e.getETFOptionMinute.bind(e),dailyKline:e.getETFOptionDailyKline.bind(e),fiveDayMinute:e.getETFOption5DayMinute.bind(e)},commodity:{spot:e.getCommodityOptionSpot.bind(e),kline:e.getCommodityOptionKline.bind(e)},cffex:{quotes:e.getCFFEXOptionQuotes.bind(e)},lhb:e.getOptionLHB.bind(e)}})}get futures(){return this.memoNs("futures",()=>{let e=this.futuresService;return{kline:e.getFuturesKline.bind(e),globalSpot:e.getGlobalFuturesSpot.bind(e),globalKline:e.getGlobalFuturesKline.bind(e),inventorySymbols:e.getFuturesInventorySymbols.bind(e),inventory:e.getFuturesInventory.bind(e),comexInventory:e.getComexInventory.bind(e)}})}get fundFlow(){return this.memoNs("fundFlow",()=>{let e=this.fundFlowService;return{individual:e.getIndividualFundFlow.bind(e),market:e.getMarketFundFlow.bind(e),rank:e.getFundFlowRank.bind(e),sectorRank:e.getSectorFundFlowRank.bind(e),sectorHistory:e.getSectorFundFlowHistory.bind(e)}})}get northbound(){return this.memoNs("northbound",()=>{let e=this.northboundService;return{minute:e.getNorthboundMinute.bind(e),summary:e.getNorthboundFlowSummary.bind(e),holdingRank:e.getNorthboundHoldingRank.bind(e),history:e.getNorthboundHistory.bind(e),individual:e.getNorthboundIndividual.bind(e)}})}get marketEvent(){return this.memoNs("marketEvent",()=>{let e=this.marketEventService;return{ztPool:e.getZTPool.bind(e),stockChanges:e.getStockChanges.bind(e),boardChanges:e.getBoardChanges.bind(e)}})}get dragonTiger(){return this.memoNs("dragonTiger",()=>{let e=this.dragonTigerService;return{detail:e.getDragonTigerDetail.bind(e),stockStats:e.getDragonTigerStockStats.bind(e),institution:e.getDragonTigerInstitution.bind(e),branchRank:e.getDragonTigerBranchRank.bind(e),seatDetail:e.getDragonTigerStockSeatDetail.bind(e)}})}get blockTrade(){return this.memoNs("blockTrade",()=>{let e=this.dataService;return{marketStat:e.getBlockTradeMarketStat.bind(e),detail:e.getBlockTradeDetail.bind(e),dailyStat:e.getBlockTradeDailyStat.bind(e)}})}get margin(){return this.memoNs("margin",()=>{let e=this.dataService;return{accountInfo:e.getMarginAccountInfo.bind(e),targetList:e.getMarginTargetList.bind(e)}})}get fund(){return this.memoNs("fund",()=>{let e=this.fundService;return{dividendList:e.getFundDividendList.bind(e),navHistory:e.getFundNavHistory.bind(e),estimate:e.getFundEstimate.bind(e),rankHistory:e.getFundRankHistory.bind(e)}})}get calendar(){return this.memoNs("calendar",()=>{let e=this.tradingCalendarService;return{isTradingDay:e.isTradingDay.bind(e),nextTradingDay:e.nextTradingDay.bind(e),prevTradingDay:e.prevTradingDay.bind(e),marketStatus:e.getMarketStatus.bind(e)}})}get reference(){return this.memoNs("reference",()=>{let e=this.quoteService;return{dividendDetail:e.getDividendDetail.bind(e),tradingCalendar:e.getTradingCalendar.bind(e)}})}search(e){return this.quoteService.search(e)}},cd= exports.u =Cn;exports.a = dt; exports.b = pt; exports.c = f; exports.d = _; exports.e = se; exports.f = ae; exports.g = Be; exports.h = F; exports.i = ue; exports.j = zo; exports.k = le; exports.l = ft; exports.m = E; exports.n = He; exports.o = N; exports.p = yt; exports.q = ht; exports.r = Ce; exports.s = Pe; exports.t = Cn; exports.u = cd;
@@ -1 +0,0 @@
1
- import{t as Pn,v as Dn,w as ct}from"./chunk-G5KF73BW.js";import{d as Z,e as An,f as On,h as J}from"./chunk-D2MGPO3R.js";import{b as te}from"./chunk-DU7MCVLJ.js";import{a as C,b as $,c as V,d as at,e as h,g as ut,h as lt,k as X,l as ve}from"./chunk-UBIQBXQ7.js";import{a as st}from"./chunk-WOT6VMZA.js";function dt(t){return new TextDecoder("gbk").decode(t)}function pt(t){let e=t.split(";").map(r=>r.trim()).filter(Boolean),n=[];for(let r of e){let o=r.indexOf("=");if(o<0)continue;let i=r.slice(0,o).trim();i.startsWith("v_")&&(i=i.slice(2));let a=r.slice(o+1).trim();a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1));let u=a.split("~");n.push({key:i,fields:u})}return n}function mt(t){let e=t.trim();return e===""||e==="-"||e==="--"}function f(t){if(!t||t==="")return 0;let e=parseFloat(t);return Number.isNaN(e)?0:e}function _(t){if(!t||mt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function m(t){if(!t||mt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function s(t){return t==null?null:m(String(t))}function j(t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;if(mt(t))return null;let e=Number(t);return Number.isFinite(e)?e:null}var Fo=new Set(["daily","weekly","monthly"]),wo=new Set(["1","5","15","30","60"]),Uo=new Set(["","qfq","hfq"]);function Q(t,e){if(!Number.isFinite(t)||!Number.isInteger(t)||t<=0)throw new h(`${e} must be a positive integer`,{argument:e,value:t})}function H(t){if(!Fo.has(t))throw new h("period must be one of: daily, weekly, monthly",{argument:"period",value:t})}function gt(t){if(!wo.has(t))throw new h("period must be one of: 1, 5, 15, 30, 60",{argument:"period",value:t})}function G(t){if(!Uo.has(t))throw new h("adjust must be one of: '', 'qfq', 'hfq'",{argument:"adjust",value:t})}function Ke(t){if(t!=="north"&&t!=="south")throw new h("direction must be one of: 'north', 'south'",{argument:"direction",value:t})}function se(t,e){Q(e,"chunkSize");let n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}async function ae(t,e,n=!1){if(Q(e,"concurrency"),t.length===0)return[];let r=n?new Array(t.length):[],o=0,i=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let a=o++;if(a>=t.length)return;let u=await t[a]();n?r[a]=u:r.push(u)}});return await Promise.all(i),r}function q(t){return{daily:"101",weekly:"102",monthly:"103"}[t]}function Y(t){return{"":"0",qfq:"1",hfq:"2"}[t]}var xo=typeof document<"u"&&typeof window<"u",vo=0;function In(){return`__stock_sdk_jsonp_${Date.now()}_${vo++}`}function Be(t){let e=t,n=e.indexOf("*/");n!==-1&&(e=e.slice(n+2).trim());let r=e.indexOf("(");if(r===-1)throw new C({code:"PARSE_ERROR",message:"Invalid JSONP response: no opening parenthesis found"});let o=e.lastIndexOf(")");if(o===-1||o<=r)throw new C({code:"PARSE_ERROR",message:"Invalid JSONP response: no closing parenthesis found"});let i=e.slice(r+1,o);try{return JSON.parse(i)}catch(a){throw new C({code:"PARSE_ERROR",message:"Invalid JSONP response: payload is not valid JSON",cause:a})}}function Ko(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e;return new Promise((i,a)=>{let u=In(),l;if(o==="path")l=t.replace("{callback}",u);else{let R=t.includes("?")?"&":"?";l=`${t}${R}${r}=${u}`}let c=document.createElement("script"),d=!1,T=window,p=()=>{c.parentNode&&c.parentNode.removeChild(c),delete T[u]},y=setTimeout(()=>{d||(d=!0,p(),a(new C({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);T[u]=R=>{d||(d=!0,clearTimeout(y),p(),i(R))},c.onerror=()=>{d||(d=!0,clearTimeout(y),p(),a(new C({code:"NETWORK_ERROR",message:`JSONP script load failed: ${t}`,url:t})))},c.src=l,document.head.appendChild(c)})}async function Bo(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e,i=In(),a;if(o==="path")a=t.replace("{callback}",i);else{let c=t.includes("?")?"&":"?";a=`${t}${c}${r}=${i}`}let u=new AbortController,l=setTimeout(()=>u.abort(),n);try{let c=await fetch(a,{signal:u.signal});if(!c.ok)throw new $(c.status,c.statusText,t);let d=await c.text();return Be(d)}catch(c){throw c instanceof DOMException&&c.name==="AbortError"?new C({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):c instanceof C?c:new C({code:"NETWORK_ERROR",message:`JSONP request failed: ${c instanceof Error?c.message:String(c)}`,url:t,cause:c})}finally{clearTimeout(l)}}function F(t,e={}){return xo?Ko(t,e):Bo(t,e)}var bn=new Map;async function ue(t,e){let r=(bn.get(t)??Promise.resolve()).then(e,e);return bn.set(t,r.then(()=>{},()=>{})),r}function Ho(){return typeof document<"u"&&typeof window<"u"}var qo=15e3,zo="jsVars";async function le(t,e,n={}){let r=n.timeout??qo;return Ho()?ue(zo,()=>$o(t,e,r)):Qo(t,e,r,n.headers,n.client)}function ft(t,e){let n={};for(let r of e){let o=jo(t,r);o!==void 0&&(n[r]=o)}return n}function $o(t,e,n){return new Promise((r,o)=>{let i=document.createElement("script"),a=!1,u=()=>{i.parentNode&&i.parentNode.removeChild(i)},l=setTimeout(()=>{a||(a=!0,u(),o(new C({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);i.onload=()=>{if(a)return;a=!0,clearTimeout(l);let c=window,d={};for(let T of e)if(T in c){d[T]=c[T];try{delete c[T]}catch{}}u(),r(d)},i.onerror=()=>{a||(a=!0,clearTimeout(l),u(),o(new C({code:"NETWORK_ERROR",message:`fetchJsVars script load failed: ${t}`,url:t})))},i.src=t,document.head.appendChild(i)})}async function Qo(t,e,n,r,o){if(o){let u=await o.get(t,{responseType:"text"});return ft(u,e)}let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let u=await fetch(t,{signal:i.signal,headers:r});if(!u.ok)throw new $(u.status,u.statusText,t);let l=await u.text();return ft(l,e)}catch(u){throw u instanceof DOMException&&u.name==="AbortError"?new C({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):u instanceof C?u:new C({code:"NETWORK_ERROR",message:`fetchJsVars failed: ${u instanceof Error?u.message:String(u)}`,url:t,cause:u})}finally{clearTimeout(a)}}function jo(t,e){let r=new RegExp(`(?:^|[^\\w$])(?:var|let|const)\\s+${Go(e)}\\s*=\\s*`,"m").exec(t);if(!r)return;let o=r.index+r[0].length,i=Yo(t,o),a=t.slice(o,i).trim();try{return JSON.parse(a)}catch{return}}function Go(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yo(t,e){let n=0,r=null;for(let o=e;o<t.length;o++){let i=t[o];if(r){if(i==="\\"){o++;continue}i===r&&(r=null);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="["||i==="{"||i==="("){n++;continue}if(i==="]"||i==="}"||i===")"){n--;continue}if(i===";"&&n===0)return o}return t.length}var E={CN:"Asia/Shanghai",HK:"Asia/Hong_Kong",US:"America/New_York"};function Wo(t){if(!t)return null;let e=t.trim();if(!e)return null;let n=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/.exec(e);if(n)return{year:+n[1],month:+n[2],day:+n[3],hour:+n[4],minute:+n[5],second:n[6]?+n[6]:0};let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return r?{year:+r[1],month:+r[2],day:+r[3],hour:0,minute:0,second:0}:/^\d{14}$/.test(e)?{year:+e.slice(0,4),month:+e.slice(4,6),day:+e.slice(6,8),hour:+e.slice(8,10),minute:+e.slice(10,12),second:+e.slice(12,14)}:/^\d{8}$/.test(e)?{year:+e.slice(0,4),month:+e.slice(4,6),day:+e.slice(6,8),hour:0,minute:0,second:0}:null}var Vo={wallParts:{locale:"en-US",keyPrefix:"en-US|",options:{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}},svDisplay:{locale:"sv-SE",keyPrefix:"sv-SE|",options:{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}},dateOnly:{locale:"en-CA",keyPrefix:"en-CA|",options:{year:"numeric",month:"2-digit",day:"2-digit"}}},Mn=new Map;function Tt(t,e){let n=Vo[t],r=n.keyPrefix+e,o=Mn.get(r);return o||(o=new Intl.DateTimeFormat(n.locale,{timeZone:e,...n.options}),Mn.set(r,o)),o}function ce(t,e){let r=Tt("wallParts",e).formatToParts(new Date(t)),o={};for(let a of r)a.type!=="literal"&&(o[a.type]=a.value);let i=parseInt(o.hour??"0",10);return i===24&&(i=0),Date.UTC(parseInt(o.year??"0",10),parseInt(o.month??"1",10)-1,parseInt(o.day??"1",10),i,parseInt(o.minute??"0",10),parseInt(o.second??"0",10))}var Nn=new Map;function kn(t,e){return ce(t,e)-t}function Xo(t,e){let n=`${t}|${e}`,r=Nn.get(n);if(r===void 0){let o=kn(Date.UTC(e,0,1,12),t);for(let i=1;i<12;i++)if(kn(Date.UTC(e,i,1,12),t)!==o){o=null;break}r=o,Nn.set(n,r)}return r}function Ln(t,e){if(!(t.month===1&&t.day<=2||t.month===12&&t.day>=30)){let a=Xo(e,t.year);if(a!==null)return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)-a}let r=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second),o=2*r-ce(r,e);if(ce(o,e)===r)return o;let i=r-ce(o,e)+o;return ce(i,e)===r?i:o}function Zo(t,e){let n=(t||"").trim(),r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n)??/^(\d{4})(\d{2})(\d{2})$/.exec(n);if(!r)return null;let o=/^(\d{2}):(\d{2})(?::(\d{2}))?$/.exec((e||"").trim());return o?{year:+r[1],month:+r[2],day:+r[3],hour:+o[1],minute:+o[2],second:o[3]?+o[3]:0}:null}function He(t,e){let n=Wo(t);return n?Ln(n,e):NaN}function de(t){return Number.isNaN(t)?null:t}function N(t,e){return{timestamp:de(He(t,e)),tz:e}}function pe(t,e){let[n,r,o]=t.split("-").map(Number);return new Date(Date.UTC(n,r-1,o+e)).toISOString().slice(0,10)}function yt(t,e,n){let r=Zo(t,e);return r?{timestamp:de(Ln(r,n)),tz:n}:{timestamp:null,tz:n}}function ht(t,e){if(t==null||!Number.isFinite(t))return"";let n=Tt("svDisplay",e).format(new Date(t)),r=n.match(/^(\d{4}-\d{2}-\d{2})[ T](\d{2}):(\d{2})/);if(!r)return n;let o=r[2]==="24"?"00":r[2];return`${r[1]} ${o}:${r[3]}`}function W(t,e=Date.now()){return Tt("dateOnly",t).format(new Date(e))}var St="https://qt.gtimg.cn",Et="https://web.ifzq.gtimg.cn/appstock/app/minute/query",Rt="https://assets.linkdiary.cn/shares/zh_a_list.json",_t="https://assets.linkdiary.cn/shares/us_list.json",Ct="https://assets.linkdiary.cn/shares/hk_list.json",qe="https://assets.linkdiary.cn/shares/fund_list",At="https://assets.linkdiary.cn/shares/trade-data-list.txt",ze="https://push2his.eastmoney.com/api/qt/stock/kline/get",Ot="https://push2his.eastmoney.com/api/qt/stock/trends2/get",$e="https://33.push2his.eastmoney.com/api/qt/stock/kline/get",Qe="https://63.push2his.eastmoney.com/api/qt/stock/kline/get",Pt="https://33.push2his.eastmoney.com/api/qt/stock/trends2/get",Dt="https://63.push2his.eastmoney.com/api/qt/stock/trends2/get",It="https://17.push2.eastmoney.com/api/qt/clist/get",bt="https://91.push2.eastmoney.com/api/qt/stock/get",Mt="https://29.push2.eastmoney.com/api/qt/clist/get",Nt="https://7.push2his.eastmoney.com/api/qt/stock/kline/get",kt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",Lt="https://79.push2.eastmoney.com/api/qt/clist/get",Ft="https://91.push2.eastmoney.com/api/qt/stock/get",wt="https://29.push2.eastmoney.com/api/qt/clist/get",Ut="https://91.push2his.eastmoney.com/api/qt/stock/kline/get",xt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",vt="https://datacenter-web.eastmoney.com/api/data/v1/get",me="https://push2his.eastmoney.com/api/qt/stock/fflow/daykline/get",Kt="https://push2.eastmoney.com/api/qt/clist/get",Bt="https://push2.eastmoney.com/api/qt/kamtbs.rtmin/get",ge="https://push2ex.eastmoney.com",k="7eea3edcaed734bea9cbfc24409ed989",z="b2884a393a59ad64002292a3e90d46a5",fe="https://push2his.eastmoney.com/api/qt/stock/kline/get",Ht="https://futsseapi.eastmoney.com/list/COMEX,NYMEX,COBOT,SGX,NYBOT,LME,MDEX,TOCOM,IPE",Te="58b2fa8f54638b60b87d69b31969089c",qt={SHFE:113,DCE:114,CZCE:115,INE:142,CFFEX:220,GFEX:225},oe={cu:"SHFE",al:"SHFE",zn:"SHFE",pb:"SHFE",au:"SHFE",ag:"SHFE",rb:"SHFE",wr:"SHFE",fu:"SHFE",ru:"SHFE",bu:"SHFE",hc:"SHFE",ni:"SHFE",sn:"SHFE",sp:"SHFE",ss:"SHFE",ao:"SHFE",br:"SHFE",c:"DCE",a:"DCE",b:"DCE",m:"DCE",y:"DCE",p:"DCE",l:"DCE",v:"DCE",j:"DCE",jm:"DCE",i:"DCE",jd:"DCE",pp:"DCE",cs:"DCE",eg:"DCE",eb:"DCE",pg:"DCE",lh:"DCE",WH:"CZCE",CF:"CZCE",SR:"CZCE",TA:"CZCE",OI:"CZCE",MA:"CZCE",FG:"CZCE",RM:"CZCE",SF:"CZCE",SM:"CZCE",ZC:"CZCE",AP:"CZCE",CJ:"CZCE",UR:"CZCE",SA:"CZCE",PF:"CZCE",PK:"CZCE",PX:"CZCE",SH:"CZCE",sc:"INE",nr:"INE",lu:"INE",bc:"INE",ec:"INE",IF:"CFFEX",IC:"CFFEX",IH:"CFFEX",IM:"CFFEX",TS:"CFFEX",TF:"CFFEX",T:"CFFEX",TL:"CFFEX",si:"GFEX",lc:"GFEX",ps:"GFEX",pt:"GFEX",pd:"GFEX"},je={HG:101,GC:101,SI:101,QI:101,QO:101,MGC:101,CL:102,NG:102,RB:102,HO:102,PA:102,PL:102,ZW:103,ZM:103,ZS:103,ZC:103,ZL:103,ZR:103,YM:103,NQ:103,ES:103,SB:108,CT:108,LCPT:109,LZNT:109,LALT:109},ye="https://stock.finance.sina.com.cn/futures/api/openapi.php/OptionService.getOptionData",he="https://stock.finance.sina.com.cn/futures/api/jsonp.php/{callback}/FutureOptionAllService.getOptionDayline",zt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getStockName",Ge="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getRemainderDay",$t="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getOptionMinline",Qt="https://stock.finance.sina.com.cn/futures/api/jsonp_v2.php/{callback}/StockOptionDaylineService.getSymbolInfo",jt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getFiveDayLine",Gt="https://futsseapi.eastmoney.com/list/option/221",Yt="https://datacenter-web.eastmoney.com/api/data/get";var Ye={au:{product:"au_o",exchange:"shfe"},ag:{product:"ag_o",exchange:"shfe"},cu:{product:"cu_o",exchange:"shfe"},al:{product:"al_o",exchange:"shfe"},zn:{product:"zn_o",exchange:"shfe"},ru:{product:"ru_o",exchange:"shfe"},sc:{product:"sc_o",exchange:"ine"},m:{product:"m_o",exchange:"dce"},c:{product:"c_o",exchange:"dce"},i:{product:"i_o",exchange:"dce"},p:{product:"p_o",exchange:"dce"},pp:{product:"pp_o",exchange:"dce"},l:{product:"l_o",exchange:"dce"},v:{product:"v_o",exchange:"dce"},pg:{product:"pg_o",exchange:"dce"},y:{product:"y_o",exchange:"dce"},a:{product:"a_o",exchange:"dce"},b:{product:"b_o",exchange:"dce"},eg:{product:"eg_o",exchange:"dce"},eb:{product:"eb_o",exchange:"dce"},SR:{product:"SR_o",exchange:"czce"},CF:{product:"CF_o",exchange:"czce"},TA:{product:"TA_o",exchange:"czce"},MA:{product:"MA_o",exchange:"czce"},RM:{product:"RM_o",exchange:"czce"},OI:{product:"OI_o",exchange:"czce"},PK:{product:"PK_o",exchange:"czce"},PF:{product:"PF_o",exchange:"czce"},SA:{product:"SA_o",exchange:"czce"},UR:{product:"UR_o",exchange:"czce"}},Wt=3e4,Se=500,Ee=500,Re=7,Vt=3,Xt=1e3,Zt=3e4,Jt=2,en=[408,429,500,502,503,504];var We=class{constructor(e={}){this.acquireChain=Promise.resolve();let n=e.requestsPerSecond??5;this.maxTokens=e.maxBurst??n,this.tokens=this.maxTokens,this.refillRate=n/1e3,this.lastRefillTime=Date.now()}refill(){let e=Date.now(),r=(e-this.lastRefillTime)*this.refillRate;this.tokens=Math.min(this.maxTokens,this.tokens+r),this.lastRefillTime=e}tryAcquire(){return this.refill(),this.tokens>=1?(this.tokens-=1,!0):!1}getWaitTime(){if(this.refill(),this.tokens>=1)return 0;let e=1-this.tokens;return Math.ceil(e/this.refillRate)}async acquire(){let e=this.acquireChain,n;this.acquireChain=new Promise(r=>{n=r});try{await e;let r=this.getWaitTime();r>0&&await this.sleep(r),this.refill(),this.tokens-=1}finally{n()}}sleep(e){return new Promise(n=>setTimeout(n,e))}getAvailableTokens(){return this.refill(),this.tokens}};var Fn=["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"],tn=0;function Jo(){return typeof window<"u"&&typeof window.document<"u"}function wn(){if(Jo())return;let t=Fn[tn];return tn=(tn+1)%Fn.length,t}var ie=class extends C{constructor(e="Circuit breaker is OPEN"){super({code:"CIRCUIT_OPEN",message:e}),this.name="CircuitBreakerError"}},Ve=class{constructor(e={}){this.state="CLOSED";this.failureCount=0;this.lastFailureTime=0;this.halfOpenSuccessCount=0;this.halfOpenProbeStartedAt=[];this.failureThreshold=e.failureThreshold??5,this.resetTimeout=e.resetTimeout??3e4,this.halfOpenRequests=e.halfOpenRequests??1,this.probeRecycleTimeout=e.probeRecycleTimeout??Math.max(this.resetTimeout*4,12e4),this.onStateChange=e.onStateChange}getState(){return this.checkStateTransition(),this.state}canRequest(){switch(this.checkStateTransition(),this.state){case"CLOSED":return!0;case"OPEN":return!1;case"HALF_OPEN":{let e=Date.now();for(;this.halfOpenProbeStartedAt.length>0&&e-this.halfOpenProbeStartedAt[0]>=this.probeRecycleTimeout;)this.halfOpenProbeStartedAt.shift();return this.halfOpenProbeStartedAt.length+this.halfOpenSuccessCount>=this.halfOpenRequests?!1:(this.halfOpenProbeStartedAt.push(e),!0)}}}releaseProbe(){this.state==="HALF_OPEN"&&this.halfOpenProbeStartedAt.shift()}recordSuccess(){this.checkStateTransition(),this.state==="HALF_OPEN"?(this.halfOpenProbeStartedAt.shift(),this.halfOpenSuccessCount++,this.halfOpenSuccessCount>=this.halfOpenRequests&&this.transitionTo("CLOSED")):this.state==="CLOSED"&&(this.failureCount=0)}recordFailure(){this.lastFailureTime=Date.now(),this.state==="HALF_OPEN"?(this.halfOpenProbeStartedAt.shift(),this.transitionTo("OPEN")):this.state==="CLOSED"&&(this.failureCount++,this.failureCount>=this.failureThreshold&&this.transitionTo("OPEN"))}checkStateTransition(){this.state==="OPEN"&&Date.now()-this.lastFailureTime>=this.resetTimeout&&this.transitionTo("HALF_OPEN")}transitionTo(e){if(this.state===e)return;let n=this.state;this.state=e,e==="CLOSED"?(this.failureCount=0,this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[]):e==="HALF_OPEN"&&(this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[]),this.onStateChange?.(n,e)}reset(){this.transitionTo("CLOSED"),this.failureCount=0,this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[],this.lastFailureTime=0}async execute(e){if(!this.canRequest())throw new ie;try{let n=await e();return this.recordSuccess(),n}catch(n){throw this.recordFailure(),n}}getStats(){return{state:this.getState(),failureCount:this.failureCount,lastFailureTime:this.lastFailureTime,halfOpenSuccessCount:this.halfOpenSuccessCount}}};var ei=3e4,ti=1,Un=["push2his.eastmoney.com","7.push2his.eastmoney.com","33.push2his.eastmoney.com","63.push2his.eastmoney.com","91.push2his.eastmoney.com"],xn=["17.push2.eastmoney.com","29.push2.eastmoney.com","79.push2.eastmoney.com","91.push2.eastmoney.com"];function ni(t,e){return e!=="eastmoney"?[t]:t.includes("push2his.eastmoney.com")?Un:t.includes("push2.eastmoney.com")?xn:[t]}function ri(t){return Array.from(new Set(t))}var Xe=class{constructor(e=ei,n=ti){this.cooldownMs=e;this.failureThreshold=n;this.states=new Map}getCandidateUrls(e,n){let r;try{r=new URL(e)}catch{return[e]}let o=Date.now(),i=ni(r.hostname,n);if(i.length<=1)return[e];let a=i.filter(c=>{let d=this.states.get(c);return!d||d.cooldownUntil<=o}),u=i.filter(c=>{let d=this.states.get(c);return d&&d.cooldownUntil>o});return ri([...a.includes(r.hostname)?[r.hostname]:[],...a.filter(c=>c!==r.hostname),...u.includes(r.hostname)?[r.hostname]:[],...u.filter(c=>c!==r.hostname)]).map(c=>{let d=new URL(e);return d.hostname=c,d.toString()})}recordSuccess(e){let n=this.safeGetHost(e);if(!n)return;let r=this.getState(n);r.failureCount=0,r.cooldownUntil=0,r.successCount++,r.lastErrorCode=void 0}recordFailure(e,n){let r=this.safeGetHost(e);if(!r)return;let o=this.getState(r);o.failureCount++,o.lastFailureAt=Date.now(),o.lastErrorCode=X(n),o.failureCount>=this.failureThreshold&&(o.cooldownUntil=Date.now()+this.cooldownMs)}shouldFallback(e){let n=X(e);return n==="NETWORK_ERROR"||n==="TIMEOUT"||n==="PARSE_ERROR"?!0:e instanceof $?e.status===408||e.status===429||e.status>=500:!1}getStats(e){let n=Array.from(this.states.values()).map(o=>({...o}));if(!e)return n;if(e!=="eastmoney")return[];let r=new Set([...Un,...xn]);return n.filter(o=>r.has(o.host))}safeGetHost(e){try{return new URL(e).hostname}catch{return null}}getState(e){let n=this.states.get(e);if(n)return n;let r={host:e,failureCount:0,successCount:0,cooldownUntil:0,lastFailureAt:0};return this.states.set(e,r),r}};function oi(t){return{maxRetries:t?.maxRetries??Vt,baseDelay:t?.baseDelay??Xt,maxDelay:t?.maxDelay??Zt,backoffMultiplier:t?.backoffMultiplier??Jt,retryableStatusCodes:t?.retryableStatusCodes??en,retryOnNetworkError:t?.retryOnNetworkError??!0,retryOnTimeout:t?.retryOnTimeout??!0,onRetry:t?.onRetry}}function ii(t,e){let n={...t??{}};return e&&(Object.keys(n).some(o=>o.toLowerCase()==="user-agent")||(n["User-Agent"]=e)),n}function vn(t,e){return e?{timeout:e.timeout??t.timeout,retry:e.retry?{...t.retry??{},...e.retry}:t.retry?{...t.retry}:void 0,headers:{...t.headers??{},...e.headers??{}},userAgent:e.userAgent??t.userAgent,rateLimit:e.rateLimit?{...t.rateLimit??{},...e.rateLimit}:t.rateLimit?{...t.rateLimit}:void 0,rotateUserAgent:e.rotateUserAgent??t.rotateUserAgent,circuitBreaker:e.circuitBreaker?{...t.circuitBreaker??{},...e.circuitBreaker}:t.circuitBreaker?{...t.circuitBreaker}:void 0}:{...t,headers:{...t.headers??{}},retry:t.retry?{...t.retry}:void 0,rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function nn(t={}){return{timeout:t.timeout??Wt,retry:oi(t.retry),headers:ii(t.headers,t.userAgent),rotateUserAgent:t.rotateUserAgent??!1,rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function Kn(t,e){if(e)return e;try{let n=new URL(t).hostname;if(n.includes("eastmoney.com"))return"eastmoney";if(n.includes("gtimg.cn"))return"tencent";if(n.includes("sina.com.cn"))return"sina";if(n.includes("linkdiary.cn"))return"linkdiary"}catch{return"unknown"}return"unknown"}function Bn(t){if(t instanceof DOMException&&t.name==="AbortError")return!0;if(t instanceof Error){if(t.name==="AbortError")return!0;let e=t.cause;if((e instanceof Error||e instanceof DOMException)&&e.name==="AbortError")return!0}return!1}var rn=()=>{};function si(t){let e=t.filter(u=>!!u);if(e.length===0)return{signal:void 0,cleanup:rn};if(e.length===1)return{signal:e[0],cleanup:rn};let n=AbortSignal.any;if(typeof n=="function")return{signal:n(e),cleanup:rn};let r=new AbortController,o=u=>{r.signal.aborted||r.abort(u)},i=[];for(let u of e){if(u.aborted){o(u.reason);break}let l=()=>o(u.reason);u.addEventListener("abort",l,{once:!0}),i.push({s:u,handler:l})}let a=()=>{for(let{s:u,handler:l}of i)u.removeEventListener("abort",l)};return{signal:r.signal,cleanup:a}}async function ai(t,e){if(!t)return e;if(Promise.resolve(e).catch(()=>{}),t.aborted)return Promise.race([e,Promise.reject(t.reason)]);let n,r=new Promise((o,i)=>{n=()=>i(t.reason),t.addEventListener("abort",n,{once:!0})});try{return await Promise.race([e,r])}finally{t.removeEventListener("abort",n)}}var _e=class{constructor(e={}){this.baseUrl=e.baseUrl??St;let n={timeout:e.timeout,retry:e.retry,headers:e.headers,userAgent:e.userAgent,rateLimit:e.rateLimit,rotateUserAgent:e.rotateUserAgent,circuitBreaker:e.circuitBreaker};this.defaultPolicy=nn(n),this.providerPolicies={},this.runtimeStates=new Map,this.fallbackManager=new Xe,this.fetchImpl=e.fetchImpl,this.clientSignal=e.signal,this.hooks=e.hooks;for(let[r,o]of Object.entries(e.providerPolicies??{})){let i=vn(n,o);this.providerPolicies[r]=nn(i)}}getProviderState(e){let n=this.runtimeStates.get(e);if(n)return n;let r=this.providerPolicies[e]??this.defaultPolicy,o={policy:r,rateLimiter:r.rateLimit?new We(r.rateLimit):null,circuitBreaker:r.circuitBreaker?new Ve(r.circuitBreaker):null};return this.runtimeStates.set(e,o),o}getTimeout(){return this.defaultPolicy.timeout}getHostHealth(e){return this.fallbackManager.getStats(e)}safe(e){try{e()}catch{}}toSdkError(e){return e instanceof C?e:new C({code:X(e)??"NETWORK_ERROR",message:e.message,provider:e.provider,url:e.url,status:e.status,details:e.details,cause:e})}calculateDelay(e,n){return Math.min(n.baseDelay*Math.pow(n.backoffMultiplier,e),n.maxDelay)+Math.random()*100}sleep(e){return new Promise(n=>setTimeout(n,e))}shouldRetry(e,n,r){if(n>=r.maxRetries)return!1;let o=X(e);return o==="ABORTED"?!1:o==="TIMEOUT"?r.retryOnTimeout:o==="NETWORK_ERROR"?r.retryOnNetworkError:e instanceof $?r.retryableStatusCodes.includes(e.status):!1}async executeWithRetry(e,n,r,o=0){try{return await e(o)}catch(i){let a=ve(i,r),u={provider:r.provider,url:r.url,timeout:r.timeout,attempt:o,responseType:r.responseType};if(this.safe(()=>this.hooks?.onError?.(u,this.toSdkError(a))),this.safe(()=>this.hooks?.trace?.("error",u)),this.shouldRetry(a,o,n)){let l=this.calculateDelay(o,n);return n.onRetry&&n.onRetry(o+1,a,l),this.safe(()=>this.hooks?.onRetry?.(u,this.toSdkError(a),l)),this.safe(()=>this.hooks?.trace?.("retry",u)),await this.sleep(l),this.executeWithRetry(e,n,r,o+1)}throw a}}async performRequest(e,n,r,o="text",i={},a=0){n.rateLimiter&&await n.rateLimiter.acquire();let u=new AbortController,l=new DOMException(`Request timed out after ${n.policy.timeout}ms`,"AbortError"),c=setTimeout(()=>u.abort(l),n.policy.timeout),{signal:d,cleanup:T}=si([u.signal,i.signal,this.clientSignal]),p=i.fetchImpl??this.fetchImpl??globalThis.fetch,y={...n.policy.headers};if(n.policy.rotateUserAgent){let S=wn();if(S){for(let O of Object.keys(y))O.toLowerCase()==="user-agent"&&delete y[O];y["User-Agent"]=S}}let R={provider:r,url:e,timeout:n.policy.timeout,attempt:a,responseType:o};this.safe(()=>this.hooks?.onRequest?.(R)),this.safe(()=>this.hooks?.trace?.("request",R));let P=Date.now();try{let S=await ai(d,p(e,{signal:d,headers:y}));if(this.safe(()=>this.hooks?.onResponse?.(R,{status:S.status,durationMs:Date.now()-P})),this.safe(()=>this.hooks?.trace?.("response",R)),!S.ok)throw new $(S.status,S.statusText,e,r);switch(o){case"json":try{return await S.json()}catch(O){throw new C({code:"PARSE_ERROR",message:`Failed to parse JSON response from ${e}`,provider:r,url:e,cause:O})}case"arraybuffer":return await S.arrayBuffer();default:return await S.text()}}catch(S){let O=M=>M?.aborted?S===M.reason?!0:S instanceof Error&&S.cause===M.reason:!1;if(!O(u.signal)){let M=i.signal?.aborted||this.clientSignal?.aborted;if(O(i.signal)||O(this.clientSignal)||M&&Bn(S))throw new lt("Request aborted by external signal",r,e);if(u.signal.aborted&&Bn(S))throw l}throw S}finally{clearTimeout(c),T()}}async get(e,n={}){let r=Kn(e,n.provider),o=this.getProviderState(r);if(o.circuitBreaker&&!o.circuitBreaker.canRequest())throw new ie("Circuit breaker is OPEN, request rejected");let i={fetchImpl:n.fetchImpl,signal:n.signal},a=this.fallbackManager.getCandidateUrls(e,r),u;for(let l=0;l<a.length;l++){let c=a[l],d=l===0?o.policy.retry:{...o.policy.retry,maxRetries:0};try{let T=await this.executeWithRetry(p=>this.performRequest(c,o,r,n.responseType,i,p),d,{provider:r,url:c,timeout:o.policy.timeout,responseType:n.responseType});return o.circuitBreaker?.recordSuccess(),this.fallbackManager.recordSuccess(c),T}catch(T){let p=ve(T,{provider:r,url:c,timeout:o.policy.timeout});u=p;let y=X(p)==="ABORTED";if(y?o.circuitBreaker?.releaseProbe():this.fallbackManager.recordFailure(c,p),l<a.length-1&&this.fallbackManager.shouldFallback(p)){this.safe(()=>this.hooks?.trace?.("fallback",{provider:r,url:c,timeout:o.policy.timeout,attempt:0,responseType:n.responseType}));continue}throw y||o.circuitBreaker?.recordFailure(),this.toSdkError(p)}}throw o.circuitBreaker?.recordFailure(),u?this.toSdkError(u):new ie("Request failed without a concrete error")}async getTencentQuote(e){let n=`${this.baseUrl}/?q=${encodeURIComponent(e)}`,r=await this.get(n,{responseType:"arraybuffer",provider:"tencent"}),o=dt(r);return pt(o)}};var w=(t,e)=>t*60+e,ui={A:{tz:E.CN,open:[[w(9,30),w(11,30)],[w(13,0),w(15,0)]],lunchBreak:[w(11,30),w(13,0)],tradingWeekdays:[1,2,3,4,5]},HK:{tz:E.HK,open:[[w(9,30),w(12,0)],[w(13,0),w(16,0)]],lunchBreak:[w(12,0),w(13,0)],tradingWeekdays:[1,2,3,4,5]},US:{tz:E.US,open:[[w(9,30),w(16,0)]],tradingWeekdays:[1,2,3,4,5]}};function on(t,e){if(t==null)return W(e);if(t instanceof Date)return W(e,t.getTime());let n=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n;if(/^\d{8}$/.test(n))return`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)}`;let r=new Date(n);if(!Number.isNaN(r.getTime()))return W(e,r.getTime());throw new h(`Unsupported date input: ${JSON.stringify(t)}. Expected 'YYYY-MM-DD', 'YYYYMMDD', or Date.`)}function li(t,e){let n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,weekday:"short",hour:"2-digit",minute:"2-digit"}),r={};for(let l of n.formatToParts(t))l.type!=="literal"&&(r[l.type]=l.value);let o=parseInt(r.hour??"0",10);o===24&&(o=0);let i=parseInt(r.minute??"0",10),u={Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6,Sun:7}[r.weekday??""]??0;return{minutes:o*60+i,weekday:u}}function sn(t,e){let n=0,r=t.length;for(;n<r;){let o=n+r>>>1;t[o]<e?n=o+1:r=o}return n}var Ce=class{constructor(e){this.quoteService=e}async isTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),o=sn(r,n);return o<r.length&&r[o]===n}async nextTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),o=sn(r,n);if(o<r.length&&r[o]===n&&(o+=1),o>=r.length)throw new h(`nextTradingDay: ${n} \u4E4B\u540E\u6CA1\u6709\u53EF\u7528\u4EA4\u6613\u65E5 (\u65E5\u5386\u6700\u5927\u65E5\u671F ${r[r.length-1]??"N/A"})`);return r[o]}async prevTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),i=sn(r,n)-1;if(i<0)throw new h(`prevTradingDay: ${n} \u4E4B\u524D\u6CA1\u6709\u53EF\u7528\u4EA4\u6613\u65E5 (\u65E5\u5386\u6700\u5C0F\u65E5\u671F ${r[0]??"N/A"})`);return r[i]}getMarketStatus(e="A",n=new Date){let r=ui[e],{minutes:o,weekday:i}=li(n,r.tz);if(!r.tradingWeekdays.includes(i))return"closed";let a=r.open[0][0],u=r.open[r.open.length-1][1];if(o<a)return"pre_market";if(o>=u)return"after_hours";for(let[l,c]of r.open)if(o>=l&&o<c)return"open";return r.lunchBreak&&o>=r.lunchBreak[0]&&o<r.lunchBreak[1]?"lunch_break":"closed"}};var I={};st(I,{getAShareCodeList:()=>Gn,getAllHKQuotesByCodes:()=>Xn,getAllQuotesByCodes:()=>Vn,getAllUSQuotesByCodes:()=>Zn,getFullQuotes:()=>Ze,getFundCodeList:()=>Jn,getFundFlow:()=>qn,getFundQuotes:()=>$n,getHKCodeList:()=>Wn,getHKQuotes:()=>Je,getPanelLargeOrder:()=>zn,getSimpleQuotes:()=>Hn,getTodayTimeline:()=>Qn,getTradingCalendar:()=>er,getUSCodeList:()=>Yn,getUSQuotes:()=>et,parseFullQuote:()=>an,parseFundFlow:()=>ln,parseFundQuote:()=>mn,parseHKQuote:()=>dn,parsePanelLargeOrder:()=>cn,parseSimpleQuote:()=>un,parseUSQuote:()=>pn,search:()=>nr});function an(t){let e=[];for(let i=0;i<5;i++)e.push({price:f(t[9+i*2]),volume:f(t[10+i*2])});let n=[];for(let i=0;i<5;i++)n.push({price:f(t[19+i*2]),volume:f(t[20+i*2])});let r=t[30]??"",o=N(r,E.CN);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),outerVolume:f(t[7]),innerVolume:f(t[8]),bid:e,ask:n,time:r,timestamp:o.timestamp,tz:o.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),volume2:f(t[36]),amount:f(t[37]),turnoverRate:_(t[38]),pe:_(t[39]),amplitude:_(t[43]),circulatingMarketCap:_(t[44]),totalMarketCap:_(t[45]),pb:_(t[46]),limitUp:_(t[47]),limitDown:_(t[48]),volumeRatio:_(t[49]),avgPrice:_(t[51]),peStatic:_(t[52]),peDynamic:_(t[53]),high52w:_(t[67]),low52w:_(t[68]),circulatingShares:_(t[72]),totalShares:_(t[73]),market:"CN",assetType:"stock",source:"tencent"}}function un(t){return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),change:f(t[4]),changePercent:f(t[5]),volume:f(t[6]),amount:f(t[7]),marketCap:_(t[9]),marketType:t[10]??"",market:"CN",assetType:"stock",source:"tencent"}}function ln(t){let e=t[13]??"",n=N(e,E.CN);return{code:t[0]??"",mainInflow:f(t[1]),mainOutflow:f(t[2]),mainNet:f(t[3]),mainNetRatio:f(t[4]),retailInflow:f(t[5]),retailOutflow:f(t[6]),retailNet:f(t[7]),retailNetRatio:f(t[8]),totalFlow:f(t[9]),name:t[12]??"",date:e,timestamp:n.timestamp,tz:n.tz}}function cn(t){return{buyLargeRatio:f(t[0]),buySmallRatio:f(t[1]),sellLargeRatio:f(t[2]),sellSmallRatio:f(t[3])}}function dn(t){let e=t[30]??"",n=N(e,E.HK);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),amount:f(t[37]),lotSize:_(t[40]),circulatingMarketCap:_(t[44]),totalMarketCap:_(t[45]),currency:t[t.length-3]??"",market:"HK",assetType:"stock",source:"tencent"}}function pn(t){let e=t[30]??"",n=N(e,E.US);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),amount:f(t[37]),turnoverRate:_(t[38]),pe:_(t[39]),amplitude:_(t[43]),totalMarketCap:_(t[45]),pb:_(t[47]),high52w:_(t[48]),low52w:_(t[49]),market:"US",assetType:"stock",source:"tencent"}}function mn(t){let e=t[8]??"",n=N(e,E.CN);return{code:t[0]??"",name:t[1]??"",nav:f(t[5]),accNav:f(t[6]),change:f(t[7]),navDate:e,timestamp:n.timestamp,tz:n.tz,market:"CN",assetType:"fund",source:"tencent"}}async function Ze(t,e){if(!e||e.length===0)return[];let n=await t.getTencentQuote(e.join(",")),r=new Set(e);return n.filter(o=>r.has(o.key)&&o.fields&&o.fields.length>5&&o.fields[0]!=="").map(o=>an(o.fields))}async function Hn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`s_${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>un(i.fields))}async function qn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`ff_${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=14&&i.fields[0]!=="").map(i=>ln(i.fields))}async function zn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`s_pk${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=4&&i.fields[0]!=="").map(i=>cn(i.fields))}async function Je(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`hk${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>dn(i.fields))}async function et(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`us${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>pn(i.fields))}async function $n(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`jj${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=9&&i.fields[0]!=="").map(i=>mn(i.fields))}async function Qn(t,e){let n=`${Et}?code=${encodeURIComponent(e)}`,r=await t.get(n,{responseType:"json",provider:"tencent"});if(r.code!==0)throw new ut(r.msg||"API error","tencent",n);let o=r.data?.[e];if(!o){let p=N("",E.CN);return{code:e,date:"",timestamp:p.timestamp,tz:p.tz,preClose:0,data:[]}}let i=o.data?.data??[],a=o.data?.date??"",u=o.qt?.[e]??[],l=parseFloat(u[4]??"")||0,c=!1;for(let p of i){let y=p.split(" "),R=parseFloat(y[1])||0,P=parseInt(y[2],10)||0,S=parseFloat(y[3])||0;if(P>0&&R>0){S/P>R*50&&(c=!0);break}}let d=i.map(p=>{let y=p.split(" "),R=y[0],P=`${R.slice(0,2)}:${R.slice(2,4)}`,S=parseInt(y[2],10)||0,O=parseFloat(y[3])||0,M=c?S*100:S,B=M>0?O/M:0,U=yt(a,P,E.CN);return{time:P,timestamp:U.timestamp,tz:U.tz,price:parseFloat(y[1])||0,volume:M,amount:O,avgPrice:Math.round(B*100)/100}}),T=N(a,E.CN);return{code:e,date:a,timestamp:T.timestamp,tz:T.tz,preClose:l,data:d}}var jn=te("tencent:code-lists",{defaultTTL:360*60*1e3,maxSize:16});async function gn(t,e,n){return jn.getOrFetch(e,async()=>{let r=await t.get(n,{responseType:"json"}),o=r?.list;if(r?.success===!1||!Array.isArray(o)||o.length===0)throw new V(`\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E: ${e}`,"tencent",n);return o})}function ci(t,e){let n=t.replace(/^(sh|sz|bj)/,"");switch(e){case"sh":return n.startsWith("6");case"sz":return n.startsWith("0")||n.startsWith("3");case"bj":return n.startsWith("4")||n.startsWith("8")||n.startsWith("92");case"kc":return n.startsWith("688");case"cy":return n.startsWith("30");default:return!0}}async function Gn(t,e){let n=e?.simple??!1,r=e?.market,i=await gn(t,"a-share:full",Rt);return r&&(i=i.filter(a=>ci(a,r))),n?i.map(a=>a.replace(/^(sh|sz|bj)/,"")):i.slice()}async function Yn(t,e){let n=e?.simple??!1,r=e?.market,i=(await gn(t,"us:full",_t)).slice();if(r){let a=`${On[r]}.`;i=i.filter(u=>u.startsWith(a))}return n?i.map(a=>a.replace(/^\d{3}\./,"")):i}async function Wn(t){return(await gn(t,"hk:full",Ct)).slice()}async function Vn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await Ze(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Xn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await Je(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Zn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await et(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Jn(t){return(await jn.getOrFetch("fund:full",async()=>{let o=(await t.get(qe,{responseType:"text"})??"").split(",").slice(1).filter(i=>i.trim());if(o.length===0)throw new V("\u57FA\u91D1\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",qe);return o})).slice()}var di=te("tencent:trade-calendar",{defaultTTL:720*60*1e3,maxSize:4});async function er(t){return(await di.getOrFetch("a-share",async()=>{let r=(await t.get(At)??"").trim().split(",").map(o=>o.trim()).filter(o=>o.length>0);if(r.length===0)throw new V("\u4EA4\u6613\u65E5\u5386\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",At);return r})).slice()}var tr="https://smartbox.gtimg.cn/s3/";function pi(t){return t.replace(/\\u([0-9a-fA-F]{4})/g,(e,n)=>String.fromCharCode(parseInt(n,16)))}function mi(t){let e=t.toUpperCase();return e.startsWith("QDII")||e.startsWith("ETF")||e.startsWith("LOF")||e.startsWith("KJ")||e.startsWith("JJ")||e.includes("FUND")?"fund":e.startsWith("GP")||e.includes("STOCK")?"stock":e==="ZS"||e.includes("INDEX")?"index":e.startsWith("ZQ")||e.includes("BOND")?"bond":e.startsWith("QH")||e.includes("FUTURE")?"futures":e.startsWith("QZ")||e.includes("OPTION")?"option":"other"}function gi(t){return!t||t==="N"?[]:t.split("^").filter(Boolean).map(n=>{let r=n.split("~"),o=r[0]||"",i=r[1]||"",a=pi(r[2]||""),u=r[4]||"";return{code:o+i,name:a,market:o,type:u,category:mi(u)}})}function fi(t){return new Promise((e,n)=>{let r=`${tr}?v=2&t=all&q=${encodeURIComponent(t)}`;window.v_hint="";let o=document.createElement("script");o.src=r,o.charset="utf-8",o.onload=()=>{let i=window.v_hint||"";document.body.removeChild(o),e(i)},o.onerror=()=>{document.body.removeChild(o),n(new C({code:"NETWORK_ERROR",message:"Network error calling Smartbox",url:r}))},document.body.appendChild(o)})}async function Ti(t,e){let n=`${tr}?v=2&t=all&q=${encodeURIComponent(e)}`,o=(await t.get(n)).match(/v_hint="([^"]*)"/);return o?o[1]:""}function yi(){return typeof window<"u"&&typeof document<"u"}async function nr(t,e){if(!e||!e.trim())return[];let n;return yi()?n=await fi(e):n=await Ti(t,e),gi(n)}var g={};st(g,{extractVariety:()=>Sn,fetchDatacenter:()=>Tn,fetchDatacenterList:()=>A,getBlockTradeDailyStat:()=>So,getBlockTradeDetail:()=>ho,getBlockTradeMarketStat:()=>yo,getBoardChanges:()=>uo,getCFFEXOptionQuotes:()=>Kr,getComexInventory:()=>$r,getConceptConstituents:()=>Or,getConceptKline:()=>Pr,getConceptList:()=>Cr,getConceptMinuteKline:()=>Dr,getConceptSpot:()=>Ar,getDividendDetail:()=>Ir,getDragonTigerBranchRank:()=>go,getDragonTigerDetail:()=>co,getDragonTigerInstitution:()=>mo,getDragonTigerStockSeatDetail:()=>fo,getDragonTigerStockStats:()=>po,getFundDividendList:()=>Mr,getFundEstimate:()=>Lr,getFundFlowRank:()=>Xr,getFundNavHistory:()=>kr,getFundRankHistory:()=>Fr,getFuturesHistoryKline:()=>Ur,getFuturesInventory:()=>zr,getFuturesInventorySymbols:()=>qr,getFuturesMarketCode:()=>En,getGlobalFuturesKline:()=>vr,getGlobalFuturesSpot:()=>xr,getHKHistoryKline:()=>ar,getHKMinuteKline:()=>ur,getHistoryKline:()=>ir,getIndividualFundFlow:()=>Wr,getIndustryConstituents:()=>Er,getIndustryKline:()=>Rr,getIndustryList:()=>hr,getIndustryMinuteKline:()=>_r,getIndustrySpot:()=>Sr,getMarginAccountInfo:()=>Eo,getMarginTargetList:()=>Ro,getMarketFundFlow:()=>Vr,getMinuteKline:()=>sr,getNorthboundFlowSummary:()=>no,getNorthboundHistory:()=>oo,getNorthboundHoldingRank:()=>ro,getNorthboundIndividual:()=>io,getNorthboundMinute:()=>to,getOptionLHB:()=>Br,getSectorFundFlowHistory:()=>Jr,getSectorFundFlowRank:()=>Zr,getStockChanges:()=>ao,getUSHistoryKline:()=>lr,getUSMinuteKline:()=>cr,getZTPool:()=>so});function b(t){return/^\d{8}$/.test(t)?`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6,8)}`:t}function rr(t,e){let n=i=>b(i.replace("T"," ").trim()).slice(0,16),r=n(t),o=n(e);return o.length===10&&(o+=" 23:59"),{start:r,end:o}}function or(t,e,n=0){let r=a=>{if(!a)return;let u=/^(\d{4})-?(\d{2})-?(\d{2})/.exec(a.trim());return u?`${u[1]}${u[2]}${u[3]}`:void 0},o=r(t)??"0",i=r(e);return i!==void 0&&n>0&&(i=pe(`${i.slice(0,4)}-${i.slice(4,6)}-${i.slice(6,8)}`,n).replace(/-/g,"")),{beg:o,end:i??"20500000"}}async function fn(t,e,n,r,o=100,i){let a=[],u=1,l=0;do{let c=new URLSearchParams({...n,pn:String(u),pz:String(o),fields:r}),d=`${e}?${c.toString()}`,p=(await t.get(d,{responseType:"json"}))?.data;if(!p||!Array.isArray(p.diff))break;u===1&&(l=p.total??0);let y=p.diff.map((R,P)=>i(R,a.length+P+1));if(a.push(...y),y.length===0)break;u++}while(a.length<l);return a}function x(t){let[e,n,r,o,i,a,u,l,c,d,T]=t.split(",");return{date:e,open:m(n),close:m(r),high:m(o),low:m(i),volume:m(a),amount:m(u),amplitude:m(l),changePercent:m(c),change:m(d),turnoverRate:m(T)}}async function v(t,e,n){let r=`${e}?${n.toString()}`,o=await t.get(r,{responseType:"json"});return{klines:o?.data?.klines||[],name:o?.data?.name,code:o?.data?.code}}function hi(t){let[e,n,r,o,i,a,u,l]=t.split(",");return{time:e,open:m(n),close:m(r),high:m(o),low:m(i),volume:m(a),amount:m(u),avgPrice:m(l)}}function tt(t,e){let n=r=>{let o=He(r,E.CN);return{time:ht(o,t)||r,timestamp:de(o)}};return{mapTrendRow:({time:r,...o},i)=>({...n(r),tz:t,...o,currency:e,code:i.code}),mapKlineRow:({date:r,...o},i)=>({...n(r),tz:t,...o,currency:e,code:i.code})}}function ee(t){return async function(n,r,o={}){let i=o.period??t.defaultPeriod;gt(i),t.fqt==="option"&&G(o.adjust??"qfq");let a=t.resolveTarget(r),u=t.window,l=p=>{if(u.mode==="full")return p;let{start:y,end:R}=rr(o.startDate??"1979-09-01 09:32:00",o.endDate??"2222-01-01 09:32:00");return p.filter(P=>P.time>=y&&P.time<=R)};if(i==="1"){let p=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",fields2:"f51,f52,f53,f54,f55,f56,f57,f58",...t.includeUt?{ut:k}:{},ndays:t.ndays==="option"?String(o.ndays??1):t.ndays.fixed,iscr:"0",secid:a.secid}),y=`${t.trendsUrl}?${p.toString()}`,P=(await n.get(y,{responseType:"json"}))?.data?.trends;return!Array.isArray(P)||P.length===0?[]:l(P.map(S=>t.mapTrendRow(hi(S),a)))}let c=u.mode==="filter"?or(o.startDate,o.endDate,u.endExtraDays??0):{beg:u.beg,end:u.end},d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",...t.includeUt?{ut:k}:{},klt:i,fqt:t.fqt==="option"?Y(o.adjust??"qfq"):t.fqt.fixed,secid:a.secid,beg:c.beg,end:c.end,...t.extraKlineParams??{}}),{klines:T}=await v(n,t.klineUrl,d);return!Array.isArray(T)||T.length===0?[]:l(T.map(p=>t.mapKlineRow(x(p),a)))}}async function ir(t,e,n={}){let{period:r="daily",adjust:o="qfq",startDate:i="19700101",endDate:a="20500101"}=n;H(r),G(o);let u=Z(e,{market:"CN"}),l=J(u),c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",ut:k,klt:q(r),fqt:Y(o),secid:l,beg:i,end:a}),d=ze,{klines:T}=await v(t,d,c);return T.length===0?[]:T.map(p=>{let y=x(p),R=N(y.date,E.CN);return{...y,timestamp:R.timestamp,tz:R.tz,code:u.code}})}var Si=ee({trendsUrl:Ot,klineUrl:ze,resolveTarget:t=>{let e=Z(t,{market:"CN"});return{secid:J(e),code:e.code}},defaultPeriod:"1",ndays:{fixed:"5"},fqt:"option",includeUt:!0,window:{mode:"filter"},mapTrendRow:({time:t,...e})=>{let n=N(t,E.CN);return{time:t,timestamp:n.timestamp,tz:n.tz,...e}},mapKlineRow:t=>{let e=N(t.date,E.CN);return{...t,time:t.date,timestamp:e.timestamp,tz:e.tz}}});async function sr(t,e,n={}){return Si(t,e,n)}function nt(t){return async function(n,r,o={}){let{period:i="daily",adjust:a="qfq",startDate:u="19700101",endDate:l="20500101"}=o;H(i),G(a);let c=t.normalizeSymbol(r),d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",ut:k,klt:q(i),fqt:Y(a),secid:c.secid,beg:u,end:l,lmt:"1000000"}),{klines:T,name:p,code:y}=await v(n,t.url,d);if(T.length===0)return[];let R=t.resolveResultMeta?t.resolveResultMeta(r,c,{code:y,name:p}):{code:y||c.fallbackCode,name:p||""};return T.map(P=>{let S=x(P),O=N(S.date,t.tz),M={...S,timestamp:O.timestamp,tz:O.tz,code:R.code,name:R.name};return t.enrichItem(M)})}}var Ei=nt({url:$e,tz:E.HK,normalizeSymbol:t=>{let e=Z(t,{market:"HK"});return{secid:J(e),fallbackCode:e.code}},enrichItem:t=>({...t,currency:"HKD",lotSize:null})});async function ar(t,e,n={}){return Ei(t,e,n)}var Ri=ee({trendsUrl:Pt,klineUrl:$e,resolveTarget:t=>{let e=Z(t,{market:"HK"});return{secid:J(e),code:e.code}},defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter"},...tt(E.HK,"HKD")});async function ur(t,e,n={}){return Ri(t,e,n)}var _i=nt({url:Qe,tz:E.US,normalizeSymbol:t=>({secid:t,fallbackCode:t.split(".")[1]||t}),resolveResultMeta:(t,e,n)=>({code:n.code||e.fallbackCode,name:n.name||""}),enrichItem:t=>({...t,currency:"USD"})});async function lr(t,e,n={}){return _i(t,e,n)}var Ci=ee({trendsUrl:Dt,klineUrl:Qe,resolveTarget:t=>({secid:t,code:t.split(".")[1]||t}),defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter",endExtraDays:1},...tt(E.US,"USD")});async function cr(t,e,n={}){return Ci(t,e,n)}function pr(t){let e=te(`eastmoney:board-code-map:${t.type}`,{defaultTTL:36e5,maxSize:4});return{async getCode(n,r,o){if(r.startsWith("BK"))return r;let a=(await e.getOrFetch("name-code-map",async()=>{let u=await o(n);if(u.length===0)throw new V(`${t.errorPrefix}: \u677F\u5757\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E`,"eastmoney");return Object.fromEntries(u.map(l=>[l.name,l.code]))}))[r];if(!a)throw new at(`${t.errorPrefix}: ${r}`,"eastmoney");return a}}}async function mr(t,e){let n={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:e.type==="concept"?"f12":"f3",fs:e.fsFilter},r=e.type==="concept"?"f2,f3,f4,f8,f12,f14,f15,f16,f17,f18,f20,f21,f24,f25,f22,f33,f11,f62,f128,f124,f107,f104,f105,f136":"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152,f124,f107,f104,f105,f140,f141,f207,f208,f209,f222",o=await fn(t,e.listUrl,n,r,100,(i,a)=>({rank:a,name:String(i.f14??""),code:String(i.f12??""),price:s(i.f2),change:s(i.f4),changePercent:s(i.f3),totalMarketCap:s(i.f20),turnoverRate:s(i.f8),riseCount:s(i.f104),fallCount:s(i.f105),leadingStock:i.f128?String(i.f128):null,leadingStockChangePercent:s(i.f136)}));return o.sort((i,a)=>(a.changePercent??0)-(i.changePercent??0)),o.forEach((i,a)=>{i.rank=a+1}),o}async function gr(t,e,n){let r=new URLSearchParams({fields:"f43,f44,f45,f46,f47,f48,f170,f171,f168,f169",mpi:"1000",invt:"2",fltt:"1",secid:`90.${e}`}),o=`${n}?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.data;return a?[{key:"f43",name:"\u6700\u65B0",divide:!0},{key:"f44",name:"\u6700\u9AD8",divide:!0},{key:"f45",name:"\u6700\u4F4E",divide:!0},{key:"f46",name:"\u5F00\u76D8",divide:!0},{key:"f47",name:"\u6210\u4EA4\u91CF",divide:!1},{key:"f48",name:"\u6210\u4EA4\u989D",divide:!1},{key:"f170",name:"\u6DA8\u8DCC\u5E45",divide:!0},{key:"f171",name:"\u632F\u5E45",divide:!0},{key:"f168",name:"\u6362\u624B\u7387",divide:!0},{key:"f169",name:"\u6DA8\u8DCC\u989D",divide:!0}].map(({key:l,name:c,divide:d})=>{let T=a[l],p=null;return typeof T=="number"&&!isNaN(T)&&(p=d?T/100:T),{item:c,value:p}}):[]}async function fr(t,e,n){let r={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:"f3",fs:`b:${e} f:!50`};return fn(t,n,r,"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152,f45",100,(i,a)=>({rank:a,code:String(i.f12??""),name:String(i.f14??""),price:s(i.f2),changePercent:s(i.f3),change:s(i.f4),volume:s(i.f5),amount:s(i.f6),amplitude:s(i.f7),high:s(i.f15),low:s(i.f16),open:s(i.f17),prevClose:s(i.f18),turnoverRate:s(i.f8),pe:s(i.f9),pb:s(i.f23)}))}async function Tr(t,e,n,r={}){let{period:o="daily",adjust:i="",startDate:a="19700101",endDate:u="20500101"}=r;H(o),G(i);let l=new URLSearchParams({secid:`90.${e}`,fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",klt:q(o),fqt:Y(i),beg:a,end:u,smplmt:"10000",lmt:"1000000"}),{klines:c}=await v(t,n,l);return c.length===0?[]:c.map(d=>x(d))}var dr=new Map;async function yr(t,e,n,r,o={}){let i=`${n}|${r}`,a=dr.get(i);return a||(a=ee({trendsUrl:r,klineUrl:n,resolveTarget:u=>({secid:`90.${u}`,code:u}),defaultPeriod:"5",ndays:{fixed:"1"},fqt:{fixed:"1"},includeUt:!1,window:{mode:"full",beg:"0",end:"20500101"},extraKlineParams:{smplmt:"10000",lmt:"1000000"},mapTrendRow:({avgPrice:u,...l})=>({...l,price:u}),mapKlineRow:u=>({time:u.date,open:u.open,close:u.close,high:u.high,low:u.low,changePercent:u.changePercent,change:u.change,volume:u.volume,amount:u.amount,amplitude:u.amplitude,turnoverRate:u.turnoverRate})}),dr.set(i,a)),a(t,e,o)}function rt(t){let e=pr(t);async function n(o){return mr(o,t)}async function r(o,i){return e.getCode(o,i,n)}return{async getList(o){return n(o)},async getSpot(o,i){let a=await r(o,i);return gr(o,a,t.spotUrl)},async getConstituents(o,i){let a=await r(o,i);return fr(o,a,t.consUrl)},async getKline(o,i,a={}){let u=await r(o,i);return Tr(o,u,t.klineUrl,a)},async getMinuteKline(o,i,a={}){let u=await r(o,i);return yr(o,u,t.klineUrl,t.trendsUrl,a)}}}var Ai={type:"industry",fsFilter:"m:90 t:2 f:!50",listUrl:It,spotUrl:bt,consUrl:Mt,klineUrl:Nt,trendsUrl:kt,errorPrefix:"\u672A\u627E\u5230\u884C\u4E1A\u677F\u5757"},Ae=rt(Ai);async function hr(t){return Ae.getList(t)}async function Sr(t,e){return Ae.getSpot(t,e)}async function Er(t,e){return Ae.getConstituents(t,e)}async function Rr(t,e,n={}){return Ae.getKline(t,e,n)}async function _r(t,e,n={}){return Ae.getMinuteKline(t,e,n)}var Oi={type:"concept",fsFilter:"m:90 t:3 f:!50",listUrl:Lt,spotUrl:Ft,consUrl:wt,klineUrl:Ut,trendsUrl:xt,errorPrefix:"\u672A\u627E\u5230\u6982\u5FF5\u677F\u5757"},Oe=rt(Oi);async function Cr(t){return Oe.getList(t)}async function Ar(t,e){return Oe.getSpot(t,e)}async function Or(t,e){return Oe.getConstituents(t,e)}async function Pr(t,e,n={}){return Oe.getKline(t,e,n)}async function Dr(t,e,n={}){return Oe.getMinuteKline(t,e,n)}async function Tn(t,e,n){let{reportName:r,columns:o="ALL",filter:i,sortColumns:a,sortTypes:u,pageSize:l=500,startPage:c=1,fetchAllPages:d=!0,maxPages:T=1e3,quoteColumns:p,quoteType:y,extraParams:R}=e,P=[],S=c,O=1,M=0,B=0;do{let U=new URLSearchParams({reportName:r,columns:o,pageSize:String(l),pageNumber:String(S),source:"WEB",client:"WEB"});if(i&&U.set("filter",i),a&&U.set("sortColumns",a),u&&U.set("sortTypes",u),p&&U.set("quoteColumns",p),y&&U.set("quoteType",y),R)for(let[ot,it]of Object.entries(R))U.set(ot,it);let ko=`${vt}?${U.toString()}`,re=(await t.get(ko,{responseType:"json"}))?.result;if(!re||!Array.isArray(re.data))break;S===c&&(O=re.pages??1,M=re.count??re.data.length);let Lo=re.data.map((ot,it)=>n(ot,P.length+it));if(P.push(...Lo),S++,B++,!d)break}while(S<=O&&B<T);return d&&B>=T&&S<=O&&console.warn(`[stock-sdk] fetchDatacenter("${r}") truncated at maxPages=${T} (server reports ${O} pages). Pass a larger \`maxPages\` to fetch the full dataset.`),{data:P,total:M,pages:O}}async function A(t,e,n){return(await Tn(t,e,n)).data}function L(t){if(t==null)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}function ne(t){if(!t)return null;let e=t.match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Pi(t){return{code:t.SECURITY_CODE??"",name:t.SECURITY_NAME_ABBR??"",reportDate:ne(t.REPORT_DATE),planNoticeDate:ne(t.PLAN_NOTICE_DATE),disclosureDate:ne(t.PUBLISH_DATE??t.PLAN_NOTICE_DATE),assignTransferRatio:t.BONUS_IT_RATIO??null,bonusRatio:t.BONUS_RATIO??null,transferRatio:t.IT_RATIO??null,dividendPretax:t.PRETAX_BONUS_RMB??null,dividendDesc:t.IMPL_PLAN_PROFILE??null,dividendYield:t.DIVIDENT_RATIO??null,eps:t.BASIC_EPS??null,bps:t.BVPS??null,capitalReserve:t.PER_CAPITAL_RESERVE??null,unassignedProfit:t.PER_UNASSIGN_PROFIT??null,netProfitYoy:t.PNP_YOY_RATIO??null,totalShares:t.TOTAL_SHARES??null,equityRecordDate:ne(t.EQUITY_RECORD_DATE),exDividendDate:ne(t.EX_DIVIDEND_DATE),payDate:ne(t.PAY_DATE),assignProgress:t.ASSIGN_PROGRESS??null,noticeDate:ne(t.NOTICE_DATE)}}async function Ir(t,e){let n=e.replace(/^(sh|sz|bj)/,"");return A(t,{reportName:"RPT_SHAREBONUS_DET",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:500,filter:`(SECURITY_CODE="${n}")`},r=>Pi(r))}var Di="https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx",br="https://fund.eastmoney.com/pingzhongdata",Ii="https://fundgz.1234567.com.cn/js";function bi(){return typeof document<"u"&&typeof window<"u"}var Mi=1e4;function Ni(){return Number(W(E.CN).slice(0,4))}function ki(t,e){let n=new URLSearchParams({dt:"8",page:String(e),rank:t.rank??"FSRQ",sort:t.sort??"desc",gs:"",ftype:t.fundType??"",year:String(t.year??Ni())});return`${Di}?${n.toString()}`}function yn(t){if(!t)return null;let e=t.trim().match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Li(t){return{code:t[0]??"",name:t[1]??"",equityRecordDate:yn(t[2]),exDividendDate:yn(t[3]),dividendPerShare:j(t[4]),payDate:yn(t[5]),dividendType:t[6]?.trim()?t[6].trim():null}}async function hn(t,e,n){let r=ki(e,n),o=await le(r,["pageinfo","jjfh_data"],{client:t}),i=o.pageinfo??[0,0,n],[a=0,u=0,l=n]=i;return{items:(o.jjfh_data??[]).map(Li),totalPages:a,pageSize:u,currentPage:l}}async function Mr(t,e={}){if(e.page==="all"){let o=await hn(t,e,1),i=o.items;for(let a=2;a<=o.totalPages;a++){let u=await hn(t,e,a);i=i.concat(u.items)}return e.code&&(i=i.filter(a=>a.code===e.code)),{items:i,totalPages:o.totalPages,pageSize:o.pageSize,currentPage:-1}}let n=e.page??1,r=await hn(t,e,n);return e.code?{...r,items:r.items.filter(o=>o.code===e.code)}:r}function Nr(t){return new Date(t).toISOString().slice(0,10)}async function kr(t,e){let n=`${br}/${encodeURIComponent(e)}.js`,r=await le(n,["fS_code","fS_name","Data_netWorthTrend","Data_ACWorthTrend"],{client:t}),o=r.Data_netWorthTrend??[],i=new Map;for(let u of r.Data_ACWorthTrend??[])Array.isArray(u)&&u.length>=2&&i.set(u[0],u[1]);let a=o.map(u=>({date:Nr(u.x),timestamp:u.x,nav:u.y,accNav:i.has(u.x)?i.get(u.x):null,dailyReturn:j(u.equityReturn),unitMoney:u.unitMoney??""}));return{code:r.fS_code??e,name:r.fS_name??null,items:a}}function Fi(t,e,n=Mi){let r=`${Ii}/${encodeURIComponent(e)}.js?rt=${Date.now()}`;return bi()?ue("fundgz:jsonpgz",()=>wi(r,n)):Ui(t,r)}function wi(t,e){return new Promise((n,r)=>{let o=document.createElement("script"),i=window,a=i.jsonpgz,u=!1,l=()=>{if(o.parentNode&&o.parentNode.removeChild(o),a===void 0)try{delete i.jsonpgz}catch{}else i.jsonpgz=a},c=setTimeout(()=>{u||(u=!0,l(),r(new C({code:"TIMEOUT",message:`fundgz JSONP timed out after ${e}ms: ${t}`,url:t,details:{timeout:e}})))},e);i.jsonpgz=d=>{u||(u=!0,clearTimeout(c),l(),n(d??{}))},o.onerror=()=>{u||(u=!0,clearTimeout(c),l(),r(new C({code:"NETWORK_ERROR",message:`fundgz JSONP script load failed: ${t}`,url:t})))},o.src=t,document.head.appendChild(o)})}async function Ui(t,e){let r=(await t.get(e,{responseType:"text",provider:"eastmoney"})).trim();if(!r)return{};try{return Be(r)}catch{return{}}}async function Lr(t,e){let n=await Fi(t,e);return{code:n.fundcode??e,name:n.name??null,navDate:n.jzrq?.trim()?n.jzrq.trim():null,nav:j(n.dwjz),estimatedNav:j(n.gsz),estimatedChangePercent:j(n.gszzl),estimateTime:n.gztime?.trim()?n.gztime.trim():null}}async function Fr(t,e){let n=`${br}/${encodeURIComponent(e)}.js`,r=await le(n,["fS_code","fS_name","Data_rateInSimilarType","Data_rateInSimilarPersent"],{client:t}),o=r.Data_rateInSimilarType??[],i=new Map;for(let u of r.Data_rateInSimilarPersent??[])Array.isArray(u)&&u.length>=2&&i.set(u[0],u[1]);let a=o.map(u=>({date:Nr(u.x),timestamp:u.x,rank:j(u.y),total:j(u.sc),percentile:i.has(u.x)?i.get(u.x):null}));return{code:r.fS_code??e,name:r.fS_name??null,items:a}}function Sn(t){let e=t.match(/^([a-zA-Z]+)/);if(!e)throw new h(`Invalid futures symbol: "${t}". Expected format: variety + contract (e.g., rb2605, RBM, IF2604)`);return e[1]}function wr(t){return oe[t]??oe[t.toLowerCase()]??oe[t.toUpperCase()]}function En(t){let e=wr(t);if(!e&&t.length>1&&t.endsWith("M")&&(e=wr(t.slice(0,-1))),!e){let r=Object.keys(oe).join(", ");throw new h(`Unknown futures variety: "${t}". Supported varieties: ${r}`)}let n=qt[e];if(n===void 0)throw new h(`No market code found for exchange: ${e}`);return n}function xi(t){let e=x(t),n=t.split(",");return{...e,openInterest:n.length>12?m(n[12]):null}}async function Ur(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;H(r);let a=Sn(e),l=`${En(a)}.${e}`,c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",ut:k,klt:q(r),fqt:"0",secid:l,beg:o,end:i}),{klines:d,name:T,code:p}=await v(t,fe,c);return d.length===0?[]:d.map(y=>({...xi(y),code:p||e,name:T||""}))}async function xr(t,e={}){let n=e.pageSize??20,r=[],o=0,i=0,a=1e3;do{let u=new URLSearchParams({orderBy:"dm",sort:"desc",pageSize:String(n),pageIndex:String(o),token:Te,field:"dm,sc,name,p,zsjd,zde,zdf,f152,o,h,l,zjsj,vol,wp,np,ccl",blockName:"callback"}),l=`${Ht}?${u.toString()}`,c=await t.get(l,{responseType:"json"});if(!c||!Array.isArray(c.list))break;o===0&&(i=c.total??0);let d=c.list.map(vi);if(r.push(...d),d.length===0)break;o++}while(r.length<i&&o<a);return r}function vi(t){return{code:t.dm||"",name:t.name||"",price:m(String(t.p)),change:m(String(t.zde)),changePercent:m(String(t.zdf)),open:m(String(t.o)),high:m(String(t.h)),low:m(String(t.l)),prevSettle:m(String(t.zjsj)),volume:m(String(t.vol)),buyVolume:m(String(t.wp)),sellVolume:m(String(t.np)),openInterest:m(String(t.ccl))}}function Ki(t){let e=x(t),n=t.split(",");return{...e,openInterest:n.length>12?m(n[12]):null}}function Bi(t){let e=t.match(/^([A-Z]+)/);if(!e)throw new h(`Invalid global futures symbol: "${t}". Expected format like HG00Y, CL2507`);return e[1]}async function vr(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;H(r);let a=n.marketCode;if(a===void 0){let p=Bi(e);if(a=je[p],a===void 0){let y=Object.keys(je).join(", ");throw new h(`Unknown global futures variety: "${p}". Supported: ${y}. Or specify marketCode manually via options.`)}}let u=`${a}.${e}`,l=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",ut:k,klt:q(r),fqt:"0",secid:u,beg:o,end:i}),{klines:c,name:d,code:T}=await v(t,fe,l);return c.length===0?[]:c.map(p=>({...Ki(p),code:T||e,name:d||""}))}async function Kr(t,e={}){let{pageSize:n=2e4}=e,r=new URLSearchParams({orderBy:"zdf",sort:"desc",pageSize:String(n),pageIndex:"0",token:Te,field:"dm,sc,name,p,zsjd,zde,zdf,f152,vol,cje,ccl,xqj,syr,rz,zjsj,o"}),o=`${Gt}?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.list;return Array.isArray(a)?a.map(u=>({code:String(u.dm??""),name:String(u.name??""),price:s(u.p),change:s(u.zde),changePercent:s(u.zdf),volume:s(u.vol),amount:s(u.cje),openInterest:s(u.ccl),strikePrice:s(u.xqj),remainDays:s(u.syr),dailyChange:s(u.rz),prevSettle:s(u.zjsj),open:s(u.o)})):[]}async function Br(t,e,n){let r=new URLSearchParams({type:"RPT_IF_BILLBOARD_TD",sty:"ALL",p:"1",ps:"200",source:"IFBILLBOARD",client:"WEB",ut:z,filter:`(SECURITY_CODE="${e}")(TRADE_DATE='${n}')`}),o=`${Yt}?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.result?.data;if(!Array.isArray(a))return[];function u(l){if(!l)return"";let c=String(l),d=c.match(/^(\d{4}-\d{2}-\d{2})/);return d?d[1]:c}return a.map(l=>({tradeType:String(l.TRADE_TYPE??""),date:u(l.TRADE_DATE),symbol:String(l.SECURITY_CODE??""),targetName:String(l.TARGET_NAME??""),memberName:String(l.MEMBER_NAME_ABBR??""),rank:s(l.MEMBER_RANK)??0,sellVolume:s(l.SELL_VOLUME),sellVolumeChange:s(l.SELL_VOLUME_CHANGE),netSellVolume:s(l.NET_SELL_VOLUME),sellVolumeRatio:s(l.SELL_VOLUME_RATIO),buyVolume:s(l.BUY_VOLUME),buyVolumeChange:s(l.BUY_VOLUME_CHANGE),netBuyVolume:s(l.NET_BUY_VOLUME),buyVolumeRatio:s(l.BUY_VOLUME_RATIO),sellPosition:s(l.SELL_POSITION),sellPositionChange:s(l.SELL_POSITION_CHANGE),netSellPosition:s(l.NET_SELL_POSITION),sellPositionRatio:s(l.SELL_POSITION_RATIO),buyPosition:s(l.BUY_POSITION),buyPositionChange:s(l.BUY_POSITION_CHANGE),netBuyPosition:s(l.NET_BUY_POSITION),buyPositionRatio:s(l.BUY_POSITION_RATIO)}))}var Hi={gold:"EMI00069026",silver:"EMI00069027"};function Hr(t){if(!t)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}async function qr(t){return A(t,{reportName:"RPT_FUTU_POSITIONCODE",columns:"TRADE_MARKET_CODE,TRADE_CODE,TRADE_TYPE",filter:'(IS_MAINCODE="1")',pageSize:500,fetchAllPages:!1},e=>({code:String(e.TRADE_CODE??""),name:String(e.TRADE_TYPE??""),marketCode:String(e.TRADE_MARKET_CODE??"")}))}async function zr(t,e,n={}){let{startDate:r="2020-10-28",pageSize:o=500}=n,i=e.toUpperCase();return A(t,{reportName:"RPT_FUTU_STOCKDATA",columns:"SECURITY_CODE,TRADE_DATE,ON_WARRANT_NUM,ADDCHANGE",filter:`(SECURITY_CODE="${i}")(TRADE_DATE>='${b(r)}')`,pageSize:o,sortColumns:"TRADE_DATE",sortTypes:"-1"},a=>({code:String(a.SECURITY_CODE??e),date:Hr(a.TRADE_DATE),inventory:s(a.ON_WARRANT_NUM),change:s(a.ADDCHANGE)}))}async function $r(t,e,n={}){let r=Hi[e];if(!r)throw new h(`Invalid COMEX symbol: "${e}". Must be "gold" or "silver".`);let{pageSize:o=500}=n,i={gold:"\u9EC4\u91D1",silver:"\u767D\u94F6"};return A(t,{reportName:"RPT_FUTUOPT_GOLDSIL",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:o,filter:`(INDICATOR_ID1="${r}")(@STORAGE_TON<>"NULL")`},a=>({date:Hr(a.REPORT_DATE),name:i[e]??e,storageTon:s(a.STORAGE_TON),storageOunce:s(a.STORAGE_OUNCE)}))}var Qr={daily:"101",weekly:"102",monthly:"103"},Rn="f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65";function jr(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:m(e[1]),smallNetInflow:m(e[2]),mediumNetInflow:m(e[3]),largeNetInflow:m(e[4]),superLargeNetInflow:m(e[5]),mainNetInflowPercent:m(e[6]),smallNetInflowPercent:m(e[7]),mediumNetInflowPercent:m(e[8]),largeNetInflowPercent:m(e[9]),superLargeNetInflowPercent:m(e[10]),close:m(e[11]),changePercent:m(e[12])}}function qi(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:m(e[1]),smallNetInflow:m(e[2]),mediumNetInflow:m(e[3]),largeNetInflow:m(e[4]),superLargeNetInflow:m(e[5]),mainNetInflowPercent:m(e[6]),smallNetInflowPercent:m(e[7]),mediumNetInflowPercent:m(e[8]),largeNetInflowPercent:m(e[9]),superLargeNetInflowPercent:m(e[10]),shClose:m(e[11]),shChangePercent:m(e[12]),szClose:m(e[13]),szChangePercent:m(e[14])}}var Gr={today:{fid:"f62",fields:"f12,f14,f2,f3,f62,f184,f66,f69,f72,f75,f78,f81,f84,f87,f124",changePercentField:"f3",mainNet:"f62",mainPct:"f184",superLargeNet:"f66",superLargePct:"f69",largeNet:"f72",largePct:"f75",mediumNet:"f78",mediumPct:"f81",smallNet:"f84",smallPct:"f87"},"3day":{fid:"f267",fields:"f12,f14,f2,f127,f267,f268,f269,f270,f271,f272,f273,f274,f275,f276,f124",changePercentField:"f127",mainNet:"f267",mainPct:"f268",superLargeNet:"f269",superLargePct:"f270",largeNet:"f271",largePct:"f272",mediumNet:"f273",mediumPct:"f274",smallNet:"f275",smallPct:"f276"},"5day":{fid:"f164",fields:"f12,f14,f2,f109,f164,f165,f166,f167,f168,f169,f170,f171,f172,f173,f124",changePercentField:"f109",mainNet:"f164",mainPct:"f165",superLargeNet:"f166",superLargePct:"f167",largeNet:"f168",largePct:"f169",mediumNet:"f170",mediumPct:"f171",smallNet:"f172",smallPct:"f173"},"10day":{fid:"f174",fields:"f12,f14,f2,f160,f174,f175,f176,f177,f178,f179,f180,f181,f182,f183,f124",changePercentField:"f160",mainNet:"f174",mainPct:"f175",superLargeNet:"f176",superLargePct:"f177",largeNet:"f178",largePct:"f179",mediumNet:"f180",mediumPct:"f181",smallNet:"f182",smallPct:"f183"}},zi={industry:"m:90+t:2",concept:"m:90+t:3",region:"m:90+t:1"},$i="m:0+t:6+f:!2,m:0+t:13+f:!2,m:0+t:80+f:!2,m:1+t:2+f:!2,m:1+t:23+f:!2,m:0+t:7+f:!2,m:1+t:3+f:!2";async function Yr(t,e,n=100,r=1e3){let o=[],i=1,a=0;do{let u=new URLSearchParams({...e,pn:String(i),pz:String(n)}),l=`${Kt}?${u.toString()}`,d=(await t.get(l,{responseType:"json"}))?.data;if(!d||!Array.isArray(d.diff)||(i===1&&(a=d.total??0),o.push(...d.diff),o.length>=a||d.diff.length<n))break;i++}while(o.length<a&&i<=r);return i>r&&o.length<a&&console.warn(`[stock-sdk] fetchClistAllPages truncated at maxPages=${r} (server reports total=${a}, fetched=${o.length}). Pass a larger \`maxPages\` to fetch the full dataset.`),o}async function Wr(t,e,n={}){let{period:r="daily"}=n,o=Qr[r];if(!o)throw new h(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=J(Z(e,{market:"CN"})),a=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),u=`${me}?${a.toString()}`,c=(await t.get(u,{responseType:"json"}))?.data?.klines;return!Array.isArray(c)||c.length===0?[]:c.map(jr)}async function Vr(t){let e=new URLSearchParams({lmt:"0",klt:"101",secid:"1.000001",secid2:"0.399001",fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),n=`${me}?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.klines;return!Array.isArray(o)||o.length===0?[]:o.map(qi)}async function Xr(t,e={}){let{indicator:n="today"}=e,r=Gr[n];if(!r)throw new h(`Invalid indicator: ${n}.`);let o={fid:r.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:z,fs:$i,fields:r.fields};return(await Yr(t,o,100)).map(a=>({code:String(a.f12??""),name:String(a.f14??""),price:s(a.f2),changePercent:s(a[r.changePercentField]),mainNetInflow:s(a[r.mainNet]),mainNetInflowPercent:s(a[r.mainPct]),superLargeNetInflow:s(a[r.superLargeNet]),superLargeNetInflowPercent:s(a[r.superLargePct]),largeNetInflow:s(a[r.largeNet]),largeNetInflowPercent:s(a[r.largePct]),mediumNetInflow:s(a[r.mediumNet]),mediumNetInflowPercent:s(a[r.mediumPct]),smallNetInflow:s(a[r.smallNet]),smallNetInflowPercent:s(a[r.smallPct])}))}async function Zr(t,e={}){let{indicator:n="today",sectorType:r="industry"}=e,o=Gr[n];if(!o)throw new h(`Invalid indicator: ${n}.`);let i=zi[r];if(!i)throw new h(`Invalid sectorType: ${r}.`);let a=`${o.fields},f204,f205`,u={fid:o.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:z,fs:i,fields:a};return(await Yr(t,u,100)).map(c=>({code:String(c.f12??""),name:String(c.f14??""),changePercent:s(c[o.changePercentField]),mainNetInflow:s(c[o.mainNet]),mainNetInflowPercent:s(c[o.mainPct]),superLargeNetInflow:s(c[o.superLargeNet]),largeNetInflow:s(c[o.largeNet]),mediumNetInflow:s(c[o.mediumNet]),smallNetInflow:s(c[o.smallNet]),topStockCode:c.f204?String(c.f204):void 0,topStockName:c.f205?String(c.f205):void 0}))}async function Jr(t,e,n={}){let{period:r="daily"}=n,o=Qr[r];if(!o)throw new h(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=e.includes(".")?e:`90.${e}`,a=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),u=`${me}?${a.toString()}`,c=(await t.get(u,{responseType:"json"}))?.data?.klines;return!Array.isArray(c)||c.length===0?[]:c.map(jr)}var Qi={today:"1","3day":"3","5day":"5","10day":"10",month:"M",quarter:"Q",year:"Y"},ji={shanghai:"001",shenzhen:"003"};function eo(t,e){let n=t.split(",");return{date:e,time:n[0]??"",shanghaiNetInflow:m(n[1]),shenzhenNetInflow:m(n[3]),totalNetInflow:m(n[5])}}async function to(t,e="north"){Ke(e);let n=new URLSearchParams({fields1:"f1,f2,f3,f4",fields2:"f51,f54,f52,f58,f53,f62,f56,f57,f60,f61",ut:z}),r=`${Bt}?${n.toString()}`,i=(await t.get(r,{responseType:"json"}))?.data;if(!i)return[];if(e==="south"){let l=i.n2s??[],c=i.n2sDate??"";return l.map(d=>eo(d,b(c)))}let a=i.s2n??[],u=i.s2nDate??"";return a.map(l=>eo(l,b(u)))}async function no(t){return A(t,{reportName:"RPT_MUTUAL_QUOTA",columns:"TRADE_DATE,MUTUAL_TYPE,BOARD_TYPE,MUTUAL_TYPE_NAME,FUNDS_DIRECTION,INDEX_CODE,INDEX_NAME,BOARD_CODE",quoteColumns:"status~07~BOARD_CODE,dayNetAmtIn~07~BOARD_CODE,dayAmtRemain~07~BOARD_CODE,dayAmtThreshold~07~BOARD_CODE,f104~07~BOARD_CODE,f105~07~BOARD_CODE,f106~07~BOARD_CODE,f3~03~INDEX_CODE~INDEX_f3,netBuyAmt~07~BOARD_CODE",quoteType:"0",sortColumns:"MUTUAL_TYPE",sortTypes:"1",pageSize:2e3,fetchAllPages:!1},e=>({date:L(e.TRADE_DATE),type:String(e.MUTUAL_TYPE??""),boardName:String(e.MUTUAL_TYPE_NAME??""),direction:String(e.FUNDS_DIRECTION??""),status:String(e.status??""),netBuyAmount:s(e.netBuyAmt),netInflow:s(e.dayNetAmtIn),remainAmount:s(e.dayAmtRemain),upCount:s(e.f104),flatCount:s(e.f106),downCount:s(e.f105),indexCode:String(e.INDEX_CODE??""),indexName:String(e.INDEX_NAME??""),indexChangePercent:s(e.INDEX_f3)}))}async function ro(t,e={}){let{market:n="all",period:r="5day",date:o}=e,i=Qi[r];if(!i)throw new h(`Invalid period: ${r}.`);let a=[`(INTERVAL_TYPE="${i}")`];return o&&a.push(`(TRADE_DATE='${o}')`),n!=="all"&&a.push(`(MUTUAL_TYPE="${ji[n]}")`),A(t,{reportName:"RPT_MUTUAL_STOCK_NORTHSTA",columns:"ALL",sortColumns:"ADD_MARKET_CAP",sortTypes:"-1",pageSize:500,filter:a.join("")},u=>({date:L(u.TRADE_DATE),code:String(u.SECURITY_CODE??""),name:String(u.SECURITY_NAME??u.SECURITY_NAME_ABBR??""),close:s(u.CLOSE_PRICE),changePercent:s(u.CHANGE_RATE),holdShares:s(u.HOLD_SHARES),holdMarketValue:s(u.HOLD_MARKET_CAP),holdRatioFloat:s(u.HOLD_RATIO),holdRatioTotal:s(u.A_SHARES_RATIO),addShares:s(u.ADD_SHARES),addMarketValue:s(u.ADD_MARKET_CAP),addMarketValuePercent:s(u.ADD_MARKET_CAP_PROPORTION),sector:String(u.BOARD_NAME??"")}))}async function oo(t,e="north",n={}){Ke(e);let{startDate:r,endDate:o}=n,i=[e==="north"?'(BOARD_TYPE="1")':'(BOARD_TYPE="0")'];return r&&i.push(`(TRADE_DATE>='${b(r)}')`),o&&i.push(`(TRADE_DATE<='${b(o)}')`),A(t,{reportName:"RPT_MUTUAL_DEAL_HISTORY",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:i.join("")},a=>({date:L(a.TRADE_DATE),netBuyAmount:s(a.NET_DEAL_AMT),buyAmount:s(a.BUY_AMT),sellAmount:s(a.SELL_AMT),accNetBuyAmount:s(a.ACCUM_DEAL_AMT),netInflow:s(a.FUND_INFLOW),remainAmount:s(a.QUOTA_BALANCE),topStockCode:a.LEAD_STOCKS_CODE?String(a.LEAD_STOCKS_CODE):null,topStockName:a.LEAD_STOCKS_NAME?String(a.LEAD_STOCKS_NAME):null,topStockChangePercent:s(a.LS_CHANGE_RATE)}))}async function io(t,e,n={}){let r=e.replace(/^(sh|sz|bj)/i,""),{startDate:o,endDate:i}=n,a=[`(SECURITY_CODE="${r}")`];return o&&a.push(`(TRADE_DATE>='${b(o)}')`),i&&a.push(`(TRADE_DATE<='${b(i)}')`),A(t,{reportName:"RPT_MUTUAL_HOLDSTOCKNORTH_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:a.join("")},u=>({date:L(u.TRADE_DATE),holdShares:s(u.HOLD_SHARES),holdMarketValue:s(u.HOLD_MARKET_CAP),holdRatioFloat:s(u.HOLD_RATIO),holdRatioTotal:s(u.A_SHARES_RATIO),close:s(u.CLOSE_PRICE),changePercent:s(u.CHANGE_RATE)}))}var Gi={zt:{path:"/getTopicZTPool",sort:"fbt:asc"},yesterday:{path:"/getYesterdayZTPool",sort:"zs:desc"},strong:{path:"/getTopicQSPool",sort:"zdp:desc"},sub_new:{path:"/getTopicCXPool",sort:"ods:asc"},broken:{path:"/getTopicZBPool",sort:"fbt:asc"},dt:{path:"/getTopicDTPool",sort:"fund:asc"}},Yi={rocket_launch:"8201",quick_rebound:"8202",large_buy:"8193",limit_up_seal:"4",limit_down_open:"32",big_buy_order:"64",auction_up:"8207",high_open_5d:"8209",gap_up:"8211",high_60d:"8213",surge_60d:"8215",accelerate_down:"8204",high_dive:"8203",large_sell:"8194",limit_down_seal:"8",limit_up_open:"16",big_sell_order:"128",auction_down:"8208",low_open_5d:"8210",gap_down:"8212",low_60d:"8214",drop_60d:"8216"},Wi={8201:"\u706B\u7BAD\u53D1\u5C04",8202:"\u5FEB\u901F\u53CD\u5F39",8193:"\u5927\u7B14\u4E70\u5165",4:"\u5C01\u6DA8\u505C\u677F",32:"\u6253\u5F00\u8DCC\u505C\u677F",64:"\u6709\u5927\u4E70\u76D8",8207:"\u7ADE\u4EF7\u4E0A\u6DA8",8209:"\u9AD8\u5F005\u65E5\u7EBF",8211:"\u5411\u4E0A\u7F3A\u53E3",8213:"60\u65E5\u65B0\u9AD8",8215:"60\u65E5\u5927\u5E45\u4E0A\u6DA8",8204:"\u52A0\u901F\u4E0B\u8DCC",8203:"\u9AD8\u53F0\u8DF3\u6C34",8194:"\u5927\u7B14\u5356\u51FA",8:"\u5C01\u8DCC\u505C\u677F",16:"\u6253\u5F00\u6DA8\u505C\u677F",128:"\u6709\u5927\u5356\u76D8",8208:"\u7ADE\u4EF7\u4E0B\u8DCC",8210:"\u4F4E\u5F005\u65E5\u7EBF",8212:"\u5411\u4E0B\u7F3A\u53E3",8214:"60\u65E5\u65B0\u4F4E",8216:"60\u65E5\u5927\u5E45\u4E0B\u8DCC"};function _n(t){if(t==null)return"";let e=String(t).padStart(6,"0");return`${e.slice(0,2)}:${e.slice(2,4)}:${e.slice(4,6)}`}function Vi(t){if(!t||typeof t!="object")return"";let e=t;return`${e.days??""}/${e.ct??""}`}function Xi(t){let e=s(t.p),n=s(t.tp);return{code:String(t.c??t.m??""),name:String(t.n??""),price:e!==null?e/1e3:null,changePercent:s(t.zdp),limitPrice:n!==null?n/1e3:null,amount:s(t.amount??t.zb),floatMarketValue:s(t.ltsz),totalMarketValue:s(t.tshare),turnoverRate:s(t.hs),continuousBoardCount:s(t.lbc),firstBoardTime:t.fbt!==void 0&&t.fbt!==null?_n(t.fbt):null,lastBoardTime:t.lbt!==void 0&&t.lbt!==null?_n(t.lbt):null,boardAmount:s(t.fund),sealAmount:s(t.fund),failedCount:s(t.zbc),industry:String(t.hybk??""),ztStatistics:Vi(t.zttj),amplitude:s(t.zf),speed:s(t.zs)}}function Zi(t){if(t)return/^\d{8}$/.test(t)?t:t.replace(/-/g,"")}function Ji(){return W(E.CN).replace(/-/g,"")}async function so(t,e="zt",n){let r=Gi[e];if(!r)throw new h(`Invalid ZTPool type: ${e}.`);let o=Zi(n)??Ji(),i=new URLSearchParams({ut:k,dpt:"wz.ztzt",Pageindex:"0",pagesize:"10000",sort:r.sort,date:o}),a=`${ge}${r.path}?${i.toString()}`,l=(await t.get(a,{responseType:"json"}))?.data?.pool;return!Array.isArray(l)||l.length===0?[]:l.map(Xi)}async function ao(t,e="large_buy"){let n=Yi[e];if(!n)throw new h(`Invalid StockChangeType: ${e}.`);let r=new URLSearchParams({type:n,pageindex:"0",pagesize:"5000",ut:k,dpt:"wzchanges"}),o=`${ge}/getAllStockChanges?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.data?.allstock;return!Array.isArray(a)||a.length===0?[]:a.map(u=>{let l=String(u.t??n);return{time:_n(u.tm),code:String(u.c??""),name:String(u.n??""),changeType:e,changeTypeLabel:Wi[l]??"",info:String(u.i??"")}})}async function uo(t){let e=new URLSearchParams({ut:k,dpt:"wzchanges",pageindex:"0",pagesize:"5000"}),n=`${ge}/getAllBKChanges?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.allbk;return!Array.isArray(o)||o.length===0?[]:o.map(i=>{let a=i.ms??{},u=a.m===0?"\u5927\u7B14\u4E70\u5165":a.m===1?"\u5927\u7B14\u5356\u51FA":"",l={},c=i.bkdf??i.bkdfdis;if(c&&typeof c=="object")for(let[d,T]of Object.entries(c))l[d]=Number(T)||0;return{name:String(i.bkn??""),changePercent:s(i.bkz),mainNetInflow:s(i.bkj),totalChangeCount:s(i.bkc),topStockCode:String(a.c??""),topStockName:String(a.n??""),topStockDirection:u,changeTypeDistribution:l}})}var lo={"1month":"01","3month":"02","6month":"03","1year":"04"};async function co(t,e){let n=b(e.startDate),r=b(e.endDate);return A(t,{reportName:"RPT_DAILYBILLBOARD_DETAILSNEW",columns:"SECURITY_CODE,SECUCODE,SECURITY_NAME_ABBR,TRADE_DATE,EXPLAIN,CLOSE_PRICE,CHANGE_RATE,BILLBOARD_NET_AMT,BILLBOARD_BUY_AMT,BILLBOARD_SELL_AMT,BILLBOARD_DEAL_AMT,ACCUM_AMOUNT,DEAL_NET_RATIO,DEAL_AMOUNT_RATIO,TURNOVERRATE,FREE_MARKET_CAP,EXPLANATION,D1_CLOSE_ADJCHRATE,D2_CLOSE_ADJCHRATE,D5_CLOSE_ADJCHRATE,D10_CLOSE_ADJCHRATE",sortColumns:"SECURITY_CODE,TRADE_DATE",sortTypes:"1,-1",pageSize:5e3,filter:`(TRADE_DATE<='${r}')(TRADE_DATE>='${n}')`},o=>({code:String(o.SECURITY_CODE??""),name:String(o.SECURITY_NAME_ABBR??""),date:L(o.TRADE_DATE),close:s(o.CLOSE_PRICE),changePercent:s(o.CHANGE_RATE),netBuyAmount:s(o.BILLBOARD_NET_AMT),buyAmount:s(o.BILLBOARD_BUY_AMT),sellAmount:s(o.BILLBOARD_SELL_AMT),dealAmount:s(o.BILLBOARD_DEAL_AMT),totalAmount:s(o.ACCUM_AMOUNT),netBuyRatio:s(o.DEAL_NET_RATIO),dealAmountRatio:s(o.DEAL_AMOUNT_RATIO),turnoverRate:s(o.TURNOVERRATE),floatMarketValue:s(o.FREE_MARKET_CAP),reason:String(o.EXPLANATION??o.EXPLAIN??""),afterChange1d:s(o.D1_CLOSE_ADJCHRATE),afterChange2d:s(o.D2_CLOSE_ADJCHRATE),afterChange5d:s(o.D5_CLOSE_ADJCHRATE),afterChange10d:s(o.D10_CLOSE_ADJCHRATE)}))}async function po(t,e="1month"){let n=lo[e];if(!n)throw new h(`Invalid period: ${e}.`);return A(t,{reportName:"RPT_BILLBOARD_TRADEALL",columns:"ALL",sortColumns:"BILLBOARD_TIMES,LATEST_TDATE,SECURITY_CODE",sortTypes:"-1,-1,1",pageSize:5e3,filter:`(STATISTICS_CYCLE="${n}")`},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),latestDate:L(r.LATEST_TDATE),close:s(r.CLOSE_PRICE),changePercent:s(r.CHANGE_RATE),count:s(r.BILLBOARD_TIMES),totalBuyAmount:s(r.BILLBOARD_BUY_AMT),totalSellAmount:s(r.BILLBOARD_SELL_AMT),totalNetAmount:s(r.BILLBOARD_NET_AMT),totalDealAmount:s(r.BILLBOARD_DEAL_AMT),buyOrgCount:s(r.ORG_BUY_TIMES),sellOrgCount:s(r.ORG_SELL_TIMES)}))}async function mo(t,e){let n=b(e.startDate),r=b(e.endDate);return A(t,{reportName:"RPT_ORGANIZATION_TRADE_DETAILS",columns:"ALL",sortColumns:"TRADE_DATE,SECURITY_CODE",sortTypes:"-1,1",pageSize:5e3,filter:`(TRADE_DATE<='${r}')(TRADE_DATE>='${n}')`},o=>({code:String(o.SECURITY_CODE??""),name:String(o.SECURITY_NAME_ABBR??""),date:L(o.TRADE_DATE),close:s(o.CLOSE_PRICE),changePercent:s(o.CHANGE_RATE),buyOrgCount:s(o.BUY_TIMES),sellOrgCount:s(o.SELL_TIMES),orgBuyAmount:s(o.BUY_AMT),orgSellAmount:s(o.SELL_AMT),orgNetAmount:s(o.NET_AMT)}))}async function go(t,e="1month"){let n=lo[e];if(!n)throw new h(`Invalid period: ${e}.`);return A(t,{reportName:"RPT_BILLBOARD_TRADEDETAILS",columns:"ALL",sortColumns:"TOTAL_BUYER_SALESTIMES",sortTypes:"-1",pageSize:5e3,filter:`(STATISTICS_CYCLE="${n}")`},r=>({code:String(r.OPERATEDEPT_CODE??""),name:String(r.OPERATEDEPT_NAME??""),totalBuyAmount:s(r.TOTAL_BUYAMT??r.BUY_AMT),totalSellAmount:s(r.TOTAL_SELLAMT??r.SELL_AMT),buyCount:s(r.TOTAL_BUYER_SALESTIMES??r.BUY_TIMES),sellCount:s(r.TOTAL_SELLER_SALESTIMES??r.SELL_TIMES),totalCount:s(r.TOTAL_TIMES)}))}async function fo(t,e,n){let r=e.replace(/^(sh|sz|bj)/i,""),o=b(n),i=`(SECURITY_CODE="${r}")(TRADE_DATE='${o}')`,[a,u]=await Promise.all([A(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSBUY",columns:"ALL",sortColumns:"BUY_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:s(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:s(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:s(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:s(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:s(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:s(l.NET_AMT),side:"buy"})),A(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSSELL",columns:"ALL",sortColumns:"SELL_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:s(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:s(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:s(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:s(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:s(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:s(l.NET_AMT),side:"sell"}))]);return[...a,...u]}function To(t){if(!t)return"";let e=t.startDate?b(t.startDate):void 0,n=t.endDate?b(t.endDate):void 0,r=[];return e&&r.push(`(TRADE_DATE>='${e}')`),n&&r.push(`(TRADE_DATE<='${n}')`),r.join("")}async function yo(t){return A(t,{reportName:"PRT_BLOCKTRADE_MARKET_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500},e=>({date:L(e.TRADE_DATE),shClose:s(e.CLOSE_PRICE??e.SH_CLOSE_PRICE),shChangePercent:s(e.CHANGE_RATE??e.SH_CHANGE_RATE),totalAmount:s(e.TURNOVER??e.TOTAL_AMOUNT),premiumAmount:s(e.PREMIUM_TURNOVER??e.PREMIUM_AMOUNT),premiumRatio:s(e.PREMIUM_RATIO),discountAmount:s(e.DISCOUNT_TURNOVER??e.DISCOUNT_AMOUNT),discountRatio:s(e.DISCOUNT_RATIO)}))}async function ho(t,e={}){let n=To(e);return A(t,{reportName:"RPT_BLOCK_TRADE_DETAIL",columns:"ALL",sortColumns:"TRADE_DATE,SECURITY_CODE",sortTypes:"-1,1",pageSize:5e3,filter:n||void 0},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),date:L(r.TRADE_DATE),close:s(r.CLOSE_PRICE),changePercent:s(r.CHANGE_RATE),dealPrice:s(r.DEAL_PRICE??r.PRICE),dealVolume:s(r.DEAL_VOLUME??r.VOLUME),dealAmount:s(r.DEAL_AMT??r.TURNOVER),premiumRate:s(r.PREMIUM_RATIO??r.PREMIUM_RATE),buyBranch:String(r.BUYER_DEPT??r.BUYER_OPERATEDEPT_NAME??""),sellBranch:String(r.SELLER_DEPT??r.SELLER_OPERATEDEPT_NAME??"")}))}async function So(t,e={}){let n=To(e);return A(t,{reportName:"RPT_BLOCK_TRADE_STA",columns:"ALL",sortColumns:"TRADE_DATE,DEAL_AMT",sortTypes:"-1,-1",pageSize:5e3,filter:n||void 0},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),date:L(r.TRADE_DATE),changePercent:s(r.CHANGE_RATE),close:s(r.CLOSE_PRICE),dealCount:s(r.DEAL_NUM??r.DEAL_COUNT),dealTotalAmount:s(r.DEAL_AMT??r.TOTAL_AMOUNT),dealTotalVolume:s(r.DEAL_VOLUME??r.TOTAL_VOLUME),premiumAmount:s(r.PREMIUM_AMT??r.PREMIUM_AMOUNT),discountAmount:s(r.DISCOUNT_AMT??r.DISCOUNT_AMOUNT)}))}async function Eo(t){return A(t,{reportName:"RPTA_WEB_MARGIN_DAILYTRADE",columns:"ALL",sortColumns:"STATISTICS_DATE",sortTypes:"-1",pageSize:500},e=>({date:L(e.STATISTICS_DATE??e.TRADE_DATE),finBalance:s(e.FIN_BALANCE),loanBalance:s(e.LOAN_BALANCE),finBuyAmount:s(e.FIN_BUY_AMT),loanSellAmount:s(e.LOAN_SELL_AMT),investorCount:s(e.OPERATE_INVESTOR_NUM??e.INVESTOR_NUM),liabilityInvestorCount:s(e.MARGIN_INVESTOR_NUM),totalGuarantee:s(e.TOTAL_GUARANTEE),avgGuaranteeRatio:s(e.AVG_GUARANTEE_RATIO)}))}async function Ro(t,e){let n=e?`(TRADE_DATE='${e}')`:void 0;return A(t,{reportName:"RPT_MARGIN_TRADE_DETAIL",columns:"ALL",sortColumns:"FIN_BALANCE",sortTypes:"-1",pageSize:5e3,filter:n},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),date:L(r.TRADE_DATE),finBalance:s(r.FIN_BALANCE),finBuyAmount:s(r.FIN_BUY_AMT),finRepayAmount:s(r.FIN_REPAY_AMT),loanBalance:s(r.LOAN_BALANCE),loanSellVolume:s(r.LOAN_SELL_VOLUME),loanRepayVolume:s(r.LOAN_REPAY_VOLUME)}))}var K={};st(K,{getCommodityOptionKline:()=>No,getCommodityOptionSpot:()=>Mo,getETFOption5DayMinute:()=>bo,getETFOptionDailyKline:()=>Io,getETFOptionExpireDay:()=>Oo,getETFOptionMinute:()=>Do,getETFOptionMonths:()=>Ao,getIndexOptionKline:()=>Co,getIndexOptionSpot:()=>_o});function es(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:s(t[7]),symbol:t[8]??""}}function ts(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:null,symbol:t[7]??""}}async function _o(t,e){let n=`${ye}?type=futures&product=${t}&exchange=cffex&pinzhong=${e}`,r=await F(n),o=r?.result?.data?.up??[],i=r?.result?.data?.down??[];return{calls:o.map(es),puts:i.map(ts)}}async function Co(t){let e=`${he}?symbol=${t}`,n=await F(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:s(r.o),high:s(r.h),low:s(r.l),close:s(r.c),volume:s(r.v)})):[]}async function Ao(t){let e=`${zt}?exchange=null&cate=${encodeURIComponent(t)}`,r=(await F(e))?.result?.data,o=r?.contractMonth??[];return{months:o.length>1?o.slice(1):o,stockId:r?.stockId??"",cateId:r?.cateId??"",cateList:r?.cateList??[]}}async function Oo(t,e){let n=`${Ge}?exchange=null&cate=${encodeURIComponent(t)}&date=${e}`,r=await F(n),o=r?.result?.data?.remainderDays;if(typeof o=="number"&&o<0){let a=`${Ge}?exchange=null&cate=${encodeURIComponent("XD"+t)}&date=${e}`;r=await F(a)}let i=r?.result?.data;return{expireDay:i?.expireDay??"",remainderDays:i?.remainderDays??0,stockId:i?.stockId??"",name:i?.other?.name??""}}function Po(t){let e="";return t.map(n=>(n.d&&(e=n.d),{time:n.i,date:e,price:s(n.p),volume:s(n.v),openInterest:s(n.t),avgPrice:s(n.a)}))}async function Do(t){let e=`CON_OP_${t}`,n=`${$t}?symbol=${e}`,o=(await F(n))?.result?.data;return Array.isArray(o)?Po(o):[]}async function Io(t){let e=`CON_OP_${t}`,n=`${Qt}?symbol=${e}`,r=await F(n,{callbackMode:"path"});return Array.isArray(r)?r.map(o=>({date:o.d,open:s(o.o),high:s(o.h),low:s(o.l),close:s(o.c),volume:s(o.v)})):[]}async function bo(t){let e=`CON_OP_${t}`,n=`${jt}?symbol=${e}`,o=(await F(n))?.result?.data;if(!Array.isArray(o))return[];let i=[];for(let a of o)Array.isArray(a)&&i.push(...Po(a));return i}function ns(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:s(t[7]),symbol:t[8]??""}}function rs(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:null,symbol:t[7]??""}}async function Mo(t,e){let n=Ye[t];if(!n)throw new h(`Unknown commodity option variety: "${t}". Available: ${Object.keys(Ye).join(", ")}`);let r=`${ye}?type=futures&product=${n.product}&exchange=${n.exchange}&pinzhong=${e}`,o=await F(r),i=o?.result?.data?.up??[],a=o?.result?.data?.down??[];return{calls:i.map(ns),puts:a.map(rs)}}async function No(t){let e=`${he}?symbol=${t}`,n=await F(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:s(r.o),high:s(r.h),low:s(r.l),close:s(r.c),volume:s(r.v)})):[]}var D=class{constructor(e){this.client=e}};var Pe=class extends D{constructor(e){super(e)}getFundDividendList(e){return g.getFundDividendList(this.client,e)}getFundNavHistory(e){return g.getFundNavHistory(this.client,e)}getFundEstimate(e){return g.getFundEstimate(this.client,e)}getFundRankHistory(e){return g.getFundRankHistory(this.client,e)}};var De=class extends D{constructor(e){super(e)}getFullQuotes(e){return I.getFullQuotes(this.client,e)}getSimpleQuotes(e){return I.getSimpleQuotes(this.client,e)}getHKQuotes(e){return I.getHKQuotes(this.client,e)}getUSQuotes(e){return I.getUSQuotes(this.client,e)}getFundQuotes(e){return I.getFundQuotes(this.client,e)}getFundFlow(e){return I.getFundFlow(this.client,e)}getPanelLargeOrder(e){return I.getPanelLargeOrder(this.client,e)}getTodayTimeline(e){return I.getTodayTimeline(this.client,e)}search(e){return I.search(this.client,e)}getAShareCodeList(e){return I.getAShareCodeList(this.client,e)}getUSCodeList(e){return I.getUSCodeList(this.client,e)}getHKCodeList(){return I.getHKCodeList(this.client)}getFundCodeList(){return I.getFundCodeList(this.client)}async getAllAShareQuotes(e={}){let{market:n,...r}=e,o=await this.getAShareCodeList({market:n});return I.getAllQuotesByCodes(this.client,o,r)}async getAllHKShareQuotes(e={}){let n=await this.getHKCodeList();return I.getAllHKQuotesByCodes(this.client,n,e)}async getAllUSShareQuotes(e={}){let{market:n,...r}=e,o=await this.getUSCodeList({simple:!0,market:n});return I.getAllUSQuotesByCodes(this.client,o,r)}getAllQuotesByCodes(e,n={}){return I.getAllQuotesByCodes(this.client,e,n)}batchRaw(e){return this.client.getTencentQuote(e)}getTradingCalendar(){return I.getTradingCalendar(this.client)}getDividendDetail(e){return g.getDividendDetail(this.client,e)}};var Ie=class extends D{constructor(e){super(e)}getIndustryList(){return g.getIndustryList(this.client)}getIndustrySpot(e){return g.getIndustrySpot(this.client,e)}getIndustryConstituents(e){return g.getIndustryConstituents(this.client,e)}getIndustryKline(e,n){return g.getIndustryKline(this.client,e,n)}getIndustryMinuteKline(e,n){return g.getIndustryMinuteKline(this.client,e,n)}getConceptList(){return g.getConceptList(this.client)}getConceptSpot(e){return g.getConceptSpot(this.client,e)}getConceptConstituents(e){return g.getConceptConstituents(this.client,e)}getConceptKline(e,n){return g.getConceptKline(this.client,e,n)}getConceptMinuteKline(e,n){return g.getConceptMinuteKline(this.client,e,n)}};var be=class extends D{constructor(e){super(e)}getHistoryKline(e,n){return g.getHistoryKline(this.client,e,n)}getMinuteKline(e,n){return g.getMinuteKline(this.client,e,n)}getHKHistoryKline(e,n){return g.getHKHistoryKline(this.client,e,n)}getHKMinuteKline(e,n){return g.getHKMinuteKline(this.client,e,n)}getUSHistoryKline(e,n){return g.getUSHistoryKline(this.client,e,n)}getUSMinuteKline(e,n){return g.getUSMinuteKline(this.client,e,n)}};var Me=class extends D{constructor(e){super(e)}getFuturesKline(e,n){return g.getFuturesHistoryKline(this.client,e,n)}getGlobalFuturesSpot(e){return g.getGlobalFuturesSpot(this.client,e)}getGlobalFuturesKline(e,n){return g.getGlobalFuturesKline(this.client,e,n)}getFuturesInventorySymbols(){return g.getFuturesInventorySymbols(this.client)}getFuturesInventory(e,n){return g.getFuturesInventory(this.client,e,n)}getComexInventory(e,n){return g.getComexInventory(this.client,e,n)}};var Ne=class extends D{constructor(e){super(e)}getIndexOptionSpot(e,n){return K.getIndexOptionSpot(e,n)}getIndexOptionKline(e){return K.getIndexOptionKline(e)}getCFFEXOptionQuotes(e){return g.getCFFEXOptionQuotes(this.client,e)}getETFOptionMonths(e){return K.getETFOptionMonths(e)}getETFOptionExpireDay(e,n){return K.getETFOptionExpireDay(e,n)}getETFOptionMinute(e){return K.getETFOptionMinute(e)}getETFOptionDailyKline(e){return K.getETFOptionDailyKline(e)}getETFOption5DayMinute(e){return K.getETFOption5DayMinute(e)}getCommodityOptionSpot(e,n){return K.getCommodityOptionSpot(e,n)}getCommodityOptionKline(e){return K.getCommodityOptionKline(e)}getOptionLHB(e,n){return g.getOptionLHB(this.client,e,n)}};var os=500,is=15,ke=class{constructor(e,n){this.klineService=e;this.quoteService=n}detectMarket(e){let n=An(e);return n==="HK"?"HK":n==="US"?"US":"A"}calcActualStartDate(e,n,r=1.5){let o=this.toCompactDate(e),i=Math.ceil(n*r),a=new Date(parseInt(o.slice(0,4)),parseInt(o.slice(4,6))-1,parseInt(o.slice(6,8)));a.setDate(a.getDate()-i);let u=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),c=String(a.getDate()).padStart(2,"0");return`${u}${l}${c}`}calcActualStartDateByCalendar(e,n,r){if(!r||r.length===0)return;let o=r.findIndex(a=>a>=e);o===-1&&(o=r.length-1);let i=Math.max(0,o-n);return this.toCompactDate(r[i])}tryNormalizeDate(e){let n=e.trim();return/^\d{4}-\d{2}-\d{2}/.test(n)?n.slice(0,10):/^\d{8}$/.test(n)?`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)}`:null}normalizeUserDate(e){let n=this.tryNormalizeDate(e);if(n===null)throw new h(`\u65E5\u671F\u683C\u5F0F\u5E94\u4E3A 'YYYY-MM-DD' \u6216 'YYYYMMDD',\u5F97\u5230 '${e}'`,{argument:"date",value:e});return n}normalizeRowDate(e){return this.tryNormalizeDate(e)??e}toCompactDate(e){return e.replace(/-/g,"")}async getKlineWithIndicators(e,n={}){let{indicators:r={}}=n,o=n.startDate?this.normalizeUserDate(n.startDate):void 0,i=n.endDate?this.normalizeUserDate(n.endDate):void 0,a=n.market??this.detectMarket(e),{requiredBars:u,maxRecursiveLookback:l}=Dn(r),c={A:1.5,HK:1.46,US:1.45},d;if(o)if(a==="A")try{let O=await this.quoteService.getTradingCalendar();d=this.calcActualStartDateByCalendar(o,u,O)??this.calcActualStartDate(o,u,c[a])}catch{d=this.calcActualStartDate(o,u,c[a])}else d=this.calcActualStartDate(o,u,c[a]);let T={period:n.period,adjust:n.adjust,startDate:d,endDate:i?this.toCompactDate(i):void 0},p;switch(a){case"HK":p=await this.klineService.getHKHistoryKline(e,T);break;case"US":p=await this.klineService.getUSHistoryKline(e,T);break;default:p=await this.klineService.getHistoryKline(e,T)}let y=n.period??"daily",R=30+(y==="weekly"?7:y==="monthly"?31:0),P=p.length===0||d===void 0||this.normalizeRowDate(p[0].date)<=pe(this.normalizeRowDate(d),R),S=!1;if(o&&p.length<u&&P)switch(S=!0,a){case"HK":p=await this.klineService.getHKHistoryKline(e,{...T,startDate:void 0});break;case"US":p=await this.klineService.getUSHistoryKline(e,{...T,startDate:void 0});break;default:p=await this.klineService.getHistoryKline(e,{...T,startDate:void 0})}if(o){let O=p.findIndex(B=>this.normalizeRowDate(B.date)>=o);if(O===-1)return[];let M=p;if(S&&!Pn(r)){let B=l>0?Math.max(u,os,is*l):u;M=p.slice(Math.max(0,O-B))}return ct(M,r).filter(B=>{let U=this.normalizeRowDate(B.date);return U>=o&&(i===void 0||U<=i)})}return ct(p,r)}};var Le=class extends D{constructor(e){super(e)}getIndividualFundFlow(e,n){return g.getIndividualFundFlow(this.client,e,n)}getMarketFundFlow(){return g.getMarketFundFlow(this.client)}getFundFlowRank(e){return g.getFundFlowRank(this.client,e)}getSectorFundFlowRank(e){return g.getSectorFundFlowRank(this.client,e)}getSectorFundFlowHistory(e,n){return g.getSectorFundFlowHistory(this.client,e,n)}};var Fe=class extends D{constructor(e){super(e)}getNorthboundMinute(e){return g.getNorthboundMinute(this.client,e)}getNorthboundFlowSummary(){return g.getNorthboundFlowSummary(this.client)}getNorthboundHoldingRank(e){return g.getNorthboundHoldingRank(this.client,e)}getNorthboundHistory(e,n){return g.getNorthboundHistory(this.client,e,n)}getNorthboundIndividual(e,n){return g.getNorthboundIndividual(this.client,e,n)}};var we=class extends D{constructor(e){super(e)}getZTPool(e,n){return g.getZTPool(this.client,e,n)}getStockChanges(e){return g.getStockChanges(this.client,e)}getBoardChanges(){return g.getBoardChanges(this.client)}};var Ue=class extends D{constructor(e){super(e)}getDragonTigerDetail(e){return g.getDragonTigerDetail(this.client,e)}getDragonTigerStockStats(e){return g.getDragonTigerStockStats(this.client,e)}getDragonTigerInstitution(e){return g.getDragonTigerInstitution(this.client,e)}getDragonTigerBranchRank(e){return g.getDragonTigerBranchRank(this.client,e)}getDragonTigerStockSeatDetail(e,n){return g.getDragonTigerStockSeatDetail(this.client,e,n)}};var xe=class extends D{constructor(e){super(e)}getBlockTradeMarketStat(){return g.getBlockTradeMarketStat(this.client)}getBlockTradeDetail(e){return g.getBlockTradeDetail(this.client,e)}getBlockTradeDailyStat(e){return g.getBlockTradeDailyStat(this.client,e)}getMarginAccountInfo(){return g.getMarginAccountInfo(this.client)}getMarginTargetList(e){return g.getMarginTargetList(this.client,e)}};var Cn=class{constructor(e={}){this._ns={};this.client=new _e(e),this.quoteService=new De(this.client),this.boardService=new Ie(this.client),this.klineService=new be(this.client),this.futuresService=new Me(this.client),this.optionsService=new Ne(this.client),this.indicatorService=new ke(this.klineService,this.quoteService),this.fundFlowService=new Le(this.client),this.northboundService=new Fe(this.client),this.marketEventService=new we(this.client),this.dragonTigerService=new Ue(this.client),this.dataService=new xe(this.client),this.tradingCalendarService=new Ce(this.quoteService),this.fundService=new Pe(this.client)}memoNs(e,n){let r=this._ns[e];return r===void 0&&(r=n(),this._ns[e]=r),r}get quotes(){return this.memoNs("quotes",()=>{let e=this.quoteService;return{cn:e.getFullQuotes.bind(e),cnSimple:e.getSimpleQuotes.bind(e),hk:e.getHKQuotes.bind(e),us:e.getUSQuotes.bind(e),fund:e.getFundQuotes.bind(e),fundFlow:e.getFundFlow.bind(e),largeOrder:e.getPanelLargeOrder.bind(e),timeline:e.getTodayTimeline.bind(e)}})}get codes(){return this.memoNs("codes",()=>{let e=this.quoteService;return{cn:e.getAShareCodeList.bind(e),us:e.getUSCodeList.bind(e),hk:e.getHKCodeList.bind(e),fund:e.getFundCodeList.bind(e)}})}get batch(){return this.memoNs("batch",()=>{let e=this.quoteService;return{cn:e.getAllAShareQuotes.bind(e),hk:e.getAllHKShareQuotes.bind(e),us:e.getAllUSShareQuotes.bind(e),byCodes:e.getAllQuotesByCodes.bind(e),raw:e.batchRaw.bind(e)}})}get kline(){return this.memoNs("kline",()=>{let e=this.klineService,n=this.indicatorService;return{cn:e.getHistoryKline.bind(e),cnMinute:e.getMinuteKline.bind(e),hk:e.getHKHistoryKline.bind(e),hkMinute:e.getHKMinuteKline.bind(e),us:e.getUSHistoryKline.bind(e),usMinute:e.getUSMinuteKline.bind(e),withIndicators:n.getKlineWithIndicators.bind(n)}})}get board(){return this.memoNs("board",()=>{let e=this.boardService;return{industry:{list:e.getIndustryList.bind(e),spot:e.getIndustrySpot.bind(e),constituents:e.getIndustryConstituents.bind(e),kline:e.getIndustryKline.bind(e),minuteKline:e.getIndustryMinuteKline.bind(e)},concept:{list:e.getConceptList.bind(e),spot:e.getConceptSpot.bind(e),constituents:e.getConceptConstituents.bind(e),kline:e.getConceptKline.bind(e),minuteKline:e.getConceptMinuteKline.bind(e)}}})}get options(){return this.memoNs("options",()=>{let e=this.optionsService;return{index:{spot:e.getIndexOptionSpot.bind(e),kline:e.getIndexOptionKline.bind(e)},etf:{months:e.getETFOptionMonths.bind(e),expireDay:e.getETFOptionExpireDay.bind(e),minute:e.getETFOptionMinute.bind(e),dailyKline:e.getETFOptionDailyKline.bind(e),fiveDayMinute:e.getETFOption5DayMinute.bind(e)},commodity:{spot:e.getCommodityOptionSpot.bind(e),kline:e.getCommodityOptionKline.bind(e)},cffex:{quotes:e.getCFFEXOptionQuotes.bind(e)},lhb:e.getOptionLHB.bind(e)}})}get futures(){return this.memoNs("futures",()=>{let e=this.futuresService;return{kline:e.getFuturesKline.bind(e),globalSpot:e.getGlobalFuturesSpot.bind(e),globalKline:e.getGlobalFuturesKline.bind(e),inventorySymbols:e.getFuturesInventorySymbols.bind(e),inventory:e.getFuturesInventory.bind(e),comexInventory:e.getComexInventory.bind(e)}})}get fundFlow(){return this.memoNs("fundFlow",()=>{let e=this.fundFlowService;return{individual:e.getIndividualFundFlow.bind(e),market:e.getMarketFundFlow.bind(e),rank:e.getFundFlowRank.bind(e),sectorRank:e.getSectorFundFlowRank.bind(e),sectorHistory:e.getSectorFundFlowHistory.bind(e)}})}get northbound(){return this.memoNs("northbound",()=>{let e=this.northboundService;return{minute:e.getNorthboundMinute.bind(e),summary:e.getNorthboundFlowSummary.bind(e),holdingRank:e.getNorthboundHoldingRank.bind(e),history:e.getNorthboundHistory.bind(e),individual:e.getNorthboundIndividual.bind(e)}})}get marketEvent(){return this.memoNs("marketEvent",()=>{let e=this.marketEventService;return{ztPool:e.getZTPool.bind(e),stockChanges:e.getStockChanges.bind(e),boardChanges:e.getBoardChanges.bind(e)}})}get dragonTiger(){return this.memoNs("dragonTiger",()=>{let e=this.dragonTigerService;return{detail:e.getDragonTigerDetail.bind(e),stockStats:e.getDragonTigerStockStats.bind(e),institution:e.getDragonTigerInstitution.bind(e),branchRank:e.getDragonTigerBranchRank.bind(e),seatDetail:e.getDragonTigerStockSeatDetail.bind(e)}})}get blockTrade(){return this.memoNs("blockTrade",()=>{let e=this.dataService;return{marketStat:e.getBlockTradeMarketStat.bind(e),detail:e.getBlockTradeDetail.bind(e),dailyStat:e.getBlockTradeDailyStat.bind(e)}})}get margin(){return this.memoNs("margin",()=>{let e=this.dataService;return{accountInfo:e.getMarginAccountInfo.bind(e),targetList:e.getMarginTargetList.bind(e)}})}get fund(){return this.memoNs("fund",()=>{let e=this.fundService;return{dividendList:e.getFundDividendList.bind(e),navHistory:e.getFundNavHistory.bind(e),estimate:e.getFundEstimate.bind(e),rankHistory:e.getFundRankHistory.bind(e)}})}get calendar(){return this.memoNs("calendar",()=>{let e=this.tradingCalendarService;return{isTradingDay:e.isTradingDay.bind(e),nextTradingDay:e.nextTradingDay.bind(e),prevTradingDay:e.prevTradingDay.bind(e),marketStatus:e.getMarketStatus.bind(e)}})}get reference(){return this.memoNs("reference",()=>{let e=this.quoteService;return{dividendDetail:e.getDividendDetail.bind(e),tradingCalendar:e.getTradingCalendar.bind(e)}})}search(e){return this.quoteService.search(e)}},cd=Cn;export{dt as a,pt as b,f as c,_ as d,se as e,ae as f,Be as g,F as h,ue as i,zo as j,le as k,ft as l,E as m,He as n,N as o,yt as p,ht as q,Ce as r,Pe as s,Cn as t,cd as u};