stock-sdk 2.2.1 → 2.2.2

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 +1 @@
1
- import{t as wn,v as xn,w as mt}from"./chunk-G5KF73BW.js";import{d as pt,e as J,f as kn,g as Fn,i as ee}from"./chunk-ZZ2IBUMV.js";import{b as ne}from"./chunk-DU7MCVLJ.js";import{a as A,b as j,c as Z,d as ut,e as S,f as lt,g as ct,h as dt,k as X,l as Be}from"./chunk-UBIQBXQ7.js";import{a as at}from"./chunk-WOT6VMZA.js";function gt(t){return new TextDecoder("gbk").decode(t)}function ft(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 s=r.slice(o+1).trim();s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1));let u=s.split("~");n.push({key:i,fields:u})}return n}function yt(t){let e=t.trim();return e===""||e==="-"||e==="--"}function h(t){if(!t||t==="")return 0;let e=parseFloat(t);return Number.isNaN(e)?0:e}function C(t){if(!t||yt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function g(t){if(!t||yt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function a(t){return t==null?null:g(String(t))}function R(t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;if(yt(t))return null;let e=Number(t);return Number.isFinite(e)?e:null}var Go=new Set(["daily","weekly","monthly"]),Qo=new Set(["1","5","15","30","60"]),Wo=new Set(["","qfq","hfq"]);function G(t,e){if(!Number.isFinite(t)||!Number.isInteger(t)||t<=0)throw new S(`${e} must be a positive integer`,{argument:e,value:t})}function q(t){if(!Go.has(t))throw new S("period must be one of: daily, weekly, monthly",{argument:"period",value:t})}function ht(t){if(!Qo.has(t))throw new S("period must be one of: 1, 5, 15, 30, 60",{argument:"period",value:t})}function W(t){if(!Wo.has(t))throw new S("adjust must be one of: '', 'qfq', 'hfq'",{argument:"adjust",value:t})}function He(t){if(t!=="north"&&t!=="south")throw new S("direction must be one of: 'north', 'south'",{argument:"direction",value:t})}function ce(t,e){G(e,"chunkSize");let n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}async function de(t,e,n=!1){if(G(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 s=o++;if(s>=t.length)return;let u=await t[s]();n?r[s]=u:r.push(u)}});return await Promise.all(i),r}function z(t){return{daily:"101",weekly:"102",monthly:"103"}[t]}function V(t){return{"":"0",qfq:"1",hfq:"2"}[t]}var Vo=typeof document<"u"&&typeof window<"u",Zo=0;function Un(){return`__stock_sdk_jsonp_${Date.now()}_${Zo++}`}function qe(t){let e=t,n=e.indexOf("*/");n!==-1&&(e=e.slice(n+2).trim());let r=e.indexOf("(");if(r===-1)throw new A({code:"PARSE_ERROR",message:"Invalid JSONP response: no opening parenthesis found"});let o=e.lastIndexOf(")");if(o===-1||o<=r)throw new 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(s){throw new A({code:"PARSE_ERROR",message:"Invalid JSONP response: payload is not valid JSON",cause:s})}}function Xo(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e;return new Promise((i,s)=>{let u=Un(),l;if(o==="path")l=t.replace("{callback}",u);else{let T=t.includes("?")?"&":"?";l=`${t}${T}${r}=${u}`}let c=document.createElement("script"),d=!1,f=window,p=()=>{c.parentNode&&c.parentNode.removeChild(c),delete f[u]},y=setTimeout(()=>{d||(d=!0,p(),s(new A({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);f[u]=T=>{d||(d=!0,clearTimeout(y),p(),i(T))},c.onerror=()=>{d||(d=!0,clearTimeout(y),p(),s(new A({code:"NETWORK_ERROR",message:`JSONP script load failed: ${t}`,url:t})))},c.src=l,document.head.appendChild(c)})}async function Jo(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e,i=Un(),s;if(o==="path")s=t.replace("{callback}",i);else{let c=t.includes("?")?"&":"?";s=`${t}${c}${r}=${i}`}let u=new AbortController,l=setTimeout(()=>u.abort(),n);try{let c=await fetch(s,{signal:u.signal});if(!c.ok)throw new j(c.status,c.statusText,t);let d=await c.text();return qe(d)}catch(c){throw c instanceof DOMException&&c.name==="AbortError"?new A({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):c instanceof A?c:new A({code:"NETWORK_ERROR",message:`JSONP request failed: ${c instanceof Error?c.message:String(c)}`,url:t,cause:c})}finally{clearTimeout(l)}}function w(t,e={}){return Vo?Xo(t,e):Jo(t,e)}var vn=new Map;async function pe(t,e){let r=(vn.get(t)??Promise.resolve()).then(e,e);return vn.set(t,r.then(()=>{},()=>{})),r}function ei(){return typeof document<"u"&&typeof window<"u"}var ti=15e3,ni="jsVars";async function se(t,e,n={}){let r=n.timeout??ti;return ei()?pe(ni,()=>ri(t,e,r)):oi(t,e,r,n.headers,n.client)}function Tt(t,e){let n={};for(let r of e){let o=ii(t,r);o!==void 0&&(n[r]=o)}return n}function ri(t,e,n){return new Promise((r,o)=>{let i=document.createElement("script"),s=!1,u=()=>{i.parentNode&&i.parentNode.removeChild(i)},l=setTimeout(()=>{s||(s=!0,u(),o(new A({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);i.onload=()=>{if(s)return;s=!0,clearTimeout(l);let c=window,d={};for(let f of e)if(f in c){d[f]=c[f];try{delete c[f]}catch{}}u(),r(d)},i.onerror=()=>{s||(s=!0,clearTimeout(l),u(),o(new A({code:"NETWORK_ERROR",message:`fetchJsVars script load failed: ${t}`,url:t})))},i.src=t,document.head.appendChild(i)})}async function oi(t,e,n,r,o){if(o){let u=await o.get(t,{responseType:"text"});return Tt(u,e)}let i=new AbortController,s=setTimeout(()=>i.abort(),n);try{let u=await fetch(t,{signal:i.signal,headers:r});if(!u.ok)throw new j(u.status,u.statusText,t);let l=await u.text();return Tt(l,e)}catch(u){throw u instanceof DOMException&&u.name==="AbortError"?new A({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):u instanceof A?u:new A({code:"NETWORK_ERROR",message:`fetchJsVars failed: ${u instanceof Error?u.message:String(u)}`,url:t,cause:u})}finally{clearTimeout(s)}}function ii(t,e){let r=new RegExp(`(?:^|[^\\w$])(?:var|let|const)\\s+${ai(e)}\\s*=\\s*`,"m").exec(t);if(!r)return;let o=r.index+r[0].length,i=ui(t,o),s=t.slice(o,i).trim();try{return JSON.parse(s)}catch{try{return JSON.parse(si(s))}catch{return}}}function si(t){let e="",n=null;for(let r=0;r<t.length;r++){let o=t[r];if(n==='"'){e+=o,o==="\\"&&r+1<t.length?e+=t[++r]:o==='"'&&(n=null);continue}if(n==="'"){if(o==="\\"&&r+1<t.length){let i=t[++r];e+=i==="'"?"'":"\\"+i;continue}if(o==="'"){e+='"',n=null;continue}e+=o==='"'?'\\"':o;continue}if(o==='"'){n='"',e+=o;continue}if(o==="'"){n="'",e+='"';continue}e+=o}return e}function ai(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ui(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 _={CN:"Asia/Shanghai",HK:"Asia/Hong_Kong",US:"America/New_York"};function li(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 ci={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"}}},Kn=new Map;function St(t,e){let n=ci[t],r=n.keyPrefix+e,o=Kn.get(r);return o||(o=new Intl.DateTimeFormat(n.locale,{timeZone:e,...n.options}),Kn.set(r,o)),o}function me(t,e){let r=St("wallParts",e).formatToParts(new Date(t)),o={};for(let s of r)s.type!=="literal"&&(o[s.type]=s.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 Bn=new Map;function Hn(t,e){return me(t,e)-t}function di(t,e){let n=`${t}|${e}`,r=Bn.get(n);if(r===void 0){let o=Hn(Date.UTC(e,0,1,12),t);for(let i=1;i<12;i++)if(Hn(Date.UTC(e,i,1,12),t)!==o){o=null;break}r=o,Bn.set(n,r)}return r}function qn(t,e){if(!(t.month===1&&t.day<=2||t.month===12&&t.day>=30)){let s=di(e,t.year);if(s!==null)return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)-s}let r=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second),o=2*r-me(r,e);if(me(o,e)===r)return o;let i=r-me(o,e)+o;return me(i,e)===r?i:o}function pi(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 ae(t,e){let n=li(t);return n?qn(n,e):NaN}function re(t){return Number.isNaN(t)?null:t}function N(t,e){return{timestamp:re(ae(t,e)),tz:e}}function ge(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 Rt(t,e,n){let r=pi(t,e);return r?{timestamp:re(qn(r,n)),tz:n}:{timestamp:null,tz:n}}function Et(t,e){if(t==null||!Number.isFinite(t))return"";let n=St("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 Q(t,e=Date.now()){return St("dateOnly",t).format(new Date(e))}var _t="https://qt.gtimg.cn",Ct="https://web.ifzq.gtimg.cn/appstock/app/minute/query",At="https://assets.linkdiary.cn/shares/zh_a_list.json",Ot="https://assets.linkdiary.cn/shares/us_list.json",Pt="https://assets.linkdiary.cn/shares/hk_list.json",ze="https://assets.linkdiary.cn/shares/fund_list",Dt="https://assets.linkdiary.cn/shares/trade-data-list.txt",$e="https://push2his.eastmoney.com/api/qt/stock/kline/get",It="https://push2his.eastmoney.com/api/qt/stock/trends2/get",Ye="https://33.push2his.eastmoney.com/api/qt/stock/kline/get",je="https://63.push2his.eastmoney.com/api/qt/stock/kline/get",bt="https://33.push2his.eastmoney.com/api/qt/stock/trends2/get",Mt="https://63.push2his.eastmoney.com/api/qt/stock/trends2/get",Lt="https://17.push2.eastmoney.com/api/qt/clist/get",Nt="https://91.push2.eastmoney.com/api/qt/stock/get",kt="https://29.push2.eastmoney.com/api/qt/clist/get",Ft="https://7.push2his.eastmoney.com/api/qt/stock/kline/get",wt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",xt="https://79.push2.eastmoney.com/api/qt/clist/get",Ut="https://91.push2.eastmoney.com/api/qt/stock/get",vt="https://29.push2.eastmoney.com/api/qt/clist/get",Kt="https://91.push2his.eastmoney.com/api/qt/stock/kline/get",Bt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",Ht="https://datacenter-web.eastmoney.com/api/data/v1/get",fe="https://push2his.eastmoney.com/api/qt/stock/fflow/daykline/get",qt="https://push2.eastmoney.com/api/qt/clist/get",zt="https://push2.eastmoney.com/api/qt/kamtbs.rtmin/get",ye="https://push2ex.eastmoney.com",k="7eea3edcaed734bea9cbfc24409ed989",$="b2884a393a59ad64002292a3e90d46a5",he="https://push2his.eastmoney.com/api/qt/stock/kline/get",$t="https://futsseapi.eastmoney.com/list/COMEX,NYMEX,COBOT,SGX,NYBOT,LME,MDEX,TOCOM,IPE",Te="58b2fa8f54638b60b87d69b31969089c",Yt={SHFE:113,DCE:114,CZCE:115,INE:142,CFFEX:220,GFEX:225},ue={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"},Ge={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},Se="https://stock.finance.sina.com.cn/futures/api/openapi.php/OptionService.getOptionData",Re="https://stock.finance.sina.com.cn/futures/api/jsonp.php/{callback}/FutureOptionAllService.getOptionDayline",jt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getStockName",Qe="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getRemainderDay",Gt="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",Wt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getFiveDayLine",Vt="https://futsseapi.eastmoney.com/list/option/221",Zt="https://datacenter-web.eastmoney.com/api/data/get";var We={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"}},Xt=3e4,Ee=500,_e=500,Ce=7,Jt=3,en=1e3,tn=3e4,nn=2,rn=[408,429,500,502,503,504];var Ve=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 zn=["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"],on=0;function mi(){return typeof window<"u"&&typeof window.document<"u"}function $n(){if(mi())return;let t=zn[on];return on=(on+1)%zn.length,t}var le=class extends A{constructor(e="Circuit breaker is OPEN"){super({code:"CIRCUIT_OPEN",message:e}),this.name="CircuitBreakerError"}},Ze=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 le;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 gi=3e4,fi=1,Yn=["push2his.eastmoney.com","7.push2his.eastmoney.com","33.push2his.eastmoney.com","63.push2his.eastmoney.com","91.push2his.eastmoney.com"],jn=["17.push2.eastmoney.com","29.push2.eastmoney.com","79.push2.eastmoney.com","91.push2.eastmoney.com"];function yi(t,e){return e!=="eastmoney"?[t]:t.includes("push2his.eastmoney.com")?Yn:t.includes("push2.eastmoney.com")?jn:[t]}function hi(t){return Array.from(new Set(t))}var Xe=class{constructor(e=gi,n=fi){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=yi(r.hostname,n);if(i.length<=1)return[e];let s=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 hi([...s.includes(r.hostname)?[r.hostname]:[],...s.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 j?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([...Yn,...jn]);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 Ti(t){return{maxRetries:t?.maxRetries??Jt,baseDelay:t?.baseDelay??en,maxDelay:t?.maxDelay??tn,backoffMultiplier:t?.backoffMultiplier??nn,retryableStatusCodes:t?.retryableStatusCodes??rn,retryOnNetworkError:t?.retryOnNetworkError??!0,retryOnTimeout:t?.retryOnTimeout??!0,onRetry:t?.onRetry}}function Si(t,e){let n={...t??{}};return e&&(Object.keys(n).some(o=>o.toLowerCase()==="user-agent")||(n["User-Agent"]=e)),n}function Gn(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 sn(t={}){return{timeout:t.timeout??Xt,retry:Ti(t.retry),headers:Si(t.headers,t.userAgent),rotateUserAgent:t.rotateUserAgent??!1,rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function Qn(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 Wn(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 an=()=>{};function Ri(t){let e=t.filter(u=>!!u);if(e.length===0)return{signal:void 0,cleanup:an};if(e.length===1)return{signal:e[0],cleanup:an};let n=AbortSignal.any;if(typeof n=="function")return{signal:n(e),cleanup:an};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 s=()=>{for(let{s:u,handler:l}of i)u.removeEventListener("abort",l)};return{signal:r.signal,cleanup:s}}async function Ei(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 Ae=class{constructor(e={}){this.baseUrl=e.baseUrl??_t;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=sn(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=Gn(n,o);this.providerPolicies[r]=sn(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 Ve(r.rateLimit):null,circuitBreaker:r.circuitBreaker?new Ze(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 A?e:new A({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 j?r.retryableStatusCodes.includes(e.status):!1}async executeWithRetry(e,n,r,o=0){try{return await e(o)}catch(i){let s=Be(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(s))),this.safe(()=>this.hooks?.trace?.("error",u)),this.shouldRetry(s,o,n)){let l=this.calculateDelay(o,n);return n.onRetry&&n.onRetry(o+1,s,l),this.safe(()=>this.hooks?.onRetry?.(u,this.toSdkError(s),l)),this.safe(()=>this.hooks?.trace?.("retry",u)),await this.sleep(l),this.executeWithRetry(e,n,r,o+1)}throw s}}async performRequest(e,n,r,o="text",i={},s=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:f}=Ri([u.signal,i.signal,this.clientSignal]),p=i.fetchImpl??this.fetchImpl??globalThis.fetch,y={...n.policy.headers};if(n.policy.rotateUserAgent){let E=$n();if(E){for(let P of Object.keys(y))P.toLowerCase()==="user-agent"&&delete y[P];y["User-Agent"]=E}}let T={provider:r,url:e,timeout:n.policy.timeout,attempt:s,responseType:o};this.safe(()=>this.hooks?.onRequest?.(T)),this.safe(()=>this.hooks?.trace?.("request",T));let D=Date.now();try{let E=await Ei(d,p(e,{signal:d,headers:y}));if(this.safe(()=>this.hooks?.onResponse?.(T,{status:E.status,durationMs:Date.now()-D})),this.safe(()=>this.hooks?.trace?.("response",T)),!E.ok)throw new j(E.status,E.statusText,e,r);switch(o){case"json":try{return await E.json()}catch(P){throw new A({code:"PARSE_ERROR",message:`Failed to parse JSON response from ${e}`,provider:r,url:e,cause:P})}case"arraybuffer":return await E.arrayBuffer();default:return await E.text()}}catch(E){let P=L=>L?.aborted?E===L.reason?!0:E instanceof Error&&E.cause===L.reason:!1;if(!P(u.signal)){let L=i.signal?.aborted||this.clientSignal?.aborted;if(P(i.signal)||P(this.clientSignal)||L&&Wn(E))throw new dt("Request aborted by external signal",r,e);if(u.signal.aborted&&Wn(E))throw l}throw E}finally{clearTimeout(c),f()}}async get(e,n={}){let r=Qn(e,n.provider),o=this.getProviderState(r);if(o.circuitBreaker&&!o.circuitBreaker.canRequest())throw new le("Circuit breaker is OPEN, request rejected");let i={fetchImpl:n.fetchImpl,signal:n.signal},s=this.fallbackManager.getCandidateUrls(e,r),u;for(let l=0;l<s.length;l++){let c=s[l],d=l===0?o.policy.retry:{...o.policy.retry,maxRetries:0};try{let f=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),f}catch(f){let p=Be(f,{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<s.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 le("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=gt(r);return ft(o)}};var x=(t,e)=>t*60+e,_i={A:{tz:_.CN,open:[[x(9,30),x(11,30)],[x(13,0),x(15,0)]],lunchBreak:[x(11,30),x(13,0)],tradingWeekdays:[1,2,3,4,5]},HK:{tz:_.HK,open:[[x(9,30),x(12,0)],[x(13,0),x(16,0)]],lunchBreak:[x(12,0),x(13,0)],tradingWeekdays:[1,2,3,4,5]},US:{tz:_.US,open:[[x(9,30),x(16,0)]],tradingWeekdays:[1,2,3,4,5]}};function un(t,e){if(t==null)return Q(e);if(t instanceof Date)return Q(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 Q(e,r.getTime());throw new S(`Unsupported date input: ${JSON.stringify(t)}. Expected 'YYYY-MM-DD', 'YYYYMMDD', or Date.`)}function Ci(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 ln(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 Oe=class{constructor(e){this.quoteService=e}async isTradingDay(e){let n=un(e,_.CN),r=await this.quoteService.getTradingCalendar(),o=ln(r,n);return o<r.length&&r[o]===n}async nextTradingDay(e){let n=un(e,_.CN),r=await this.quoteService.getTradingCalendar(),o=ln(r,n);if(o<r.length&&r[o]===n&&(o+=1),o>=r.length)throw new S(`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=un(e,_.CN),r=await this.quoteService.getTradingCalendar(),i=ln(r,n)-1;if(i<0)throw new S(`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=_i[e],{minutes:o,weekday:i}=Ci(n,r.tz);if(!r.tradingWeekdays.includes(i))return"closed";let s=r.open[0][0],u=r.open[r.open.length-1][1];if(o<s)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 b={};at(b,{getAShareCodeList:()=>nr,getAllHKQuotesByCodes:()=>sr,getAllQuotesByCodes:()=>ir,getAllUSQuotesByCodes:()=>ar,getFullQuotes:()=>Je,getFundCodeList:()=>ur,getFundFlow:()=>Zn,getFundQuotes:()=>Jn,getHKCodeList:()=>or,getHKQuotes:()=>et,getPanelLargeOrder:()=>Xn,getSimpleQuotes:()=>Vn,getTodayTimeline:()=>er,getTradingCalendar:()=>lr,getUSCodeList:()=>rr,getUSQuotes:()=>tt,parseFullQuote:()=>cn,parseFundFlow:()=>pn,parseFundQuote:()=>yn,parseHKQuote:()=>gn,parsePanelLargeOrder:()=>mn,parseSimpleQuote:()=>dn,parseUSQuote:()=>fn,search:()=>dr});function cn(t){let e=[];for(let i=0;i<5;i++)e.push({price:h(t[9+i*2]),volume:h(t[10+i*2])});let n=[];for(let i=0;i<5;i++)n.push({price:h(t[19+i*2]),volume:h(t[20+i*2])});let r=t[30]??"",o=N(r,_.CN);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),prevClose:h(t[4]),open:h(t[5]),volume:h(t[6]),outerVolume:h(t[7]),innerVolume:h(t[8]),bid:e,ask:n,time:r,timestamp:o.timestamp,tz:o.tz,change:h(t[31]),changePercent:h(t[32]),high:h(t[33]),low:h(t[34]),volume2:h(t[36]),amount:h(t[37]),turnoverRate:C(t[38]),pe:C(t[39]),amplitude:C(t[43]),circulatingMarketCap:C(t[44]),totalMarketCap:C(t[45]),pb:C(t[46]),limitUp:C(t[47]),limitDown:C(t[48]),volumeRatio:C(t[49]),avgPrice:C(t[51]),peStatic:C(t[52]),peDynamic:C(t[53]),high52w:C(t[67]),low52w:C(t[68]),circulatingShares:C(t[72]),totalShares:C(t[73]),market:"CN",assetType:"stock",source:"tencent"}}function dn(t){return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),change:h(t[4]),changePercent:h(t[5]),volume:h(t[6]),amount:h(t[7]),marketCap:C(t[9]),marketType:t[10]??"",market:"CN",assetType:"stock",source:"tencent"}}function pn(t){let e=t[13]??"",n=N(e,_.CN);return{code:t[0]??"",mainInflow:h(t[1]),mainOutflow:h(t[2]),mainNet:h(t[3]),mainNetRatio:h(t[4]),retailInflow:h(t[5]),retailOutflow:h(t[6]),retailNet:h(t[7]),retailNetRatio:h(t[8]),totalFlow:h(t[9]),name:t[12]??"",date:e,timestamp:n.timestamp,tz:n.tz}}function mn(t){return{buyLargeRatio:h(t[0]),buySmallRatio:h(t[1]),sellLargeRatio:h(t[2]),sellSmallRatio:h(t[3])}}function gn(t){let e=t[30]??"",n=N(e,_.HK);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),prevClose:h(t[4]),open:h(t[5]),volume:h(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:h(t[31]),changePercent:h(t[32]),high:h(t[33]),low:h(t[34]),amount:h(t[37]),lotSize:C(t[40]),circulatingMarketCap:C(t[44]),totalMarketCap:C(t[45]),currency:t[t.length-3]??"",market:"HK",assetType:"stock",source:"tencent"}}function fn(t){let e=t[30]??"",n=N(e,_.US);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),prevClose:h(t[4]),open:h(t[5]),volume:h(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:h(t[31]),changePercent:h(t[32]),high:h(t[33]),low:h(t[34]),amount:h(t[37]),turnoverRate:C(t[38]),pe:C(t[39]),amplitude:C(t[43]),totalMarketCap:C(t[45]),pb:C(t[47]),high52w:C(t[48]),low52w:C(t[49]),market:"US",assetType:"stock",source:"tencent"}}function yn(t){let e=t[8]??"",n=N(e,_.CN);return{code:t[0]??"",name:t[1]??"",nav:h(t[5]),accNav:h(t[6]),change:h(t[7]),navDate:e,timestamp:n.timestamp,tz:n.tz,market:"CN",assetType:"fund",source:"tencent"}}async function Je(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=>cn(o.fields))}async function Vn(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=>dn(i.fields))}async function Zn(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=>pn(i.fields))}async function Xn(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=>mn(i.fields))}async function et(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=>gn(i.fields))}async function tt(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=>fn(i.fields))}async function Jn(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=>yn(i.fields))}async function er(t,e){let n=`${Ct}?code=${encodeURIComponent(e)}`,r=await t.get(n,{responseType:"json",provider:"tencent"});if(r.code!==0)throw new ct(r.msg||"API error","tencent",n);let o=r.data?.[e];if(!o){let p=N("",_.CN);return{code:e,date:"",timestamp:p.timestamp,tz:p.tz,preClose:0,data:[]}}let i=o.data?.data??[],s=o.data?.date??"",u=o.qt?.[e]??[],l=parseFloat(u[4]??"")||0,c=!1;for(let p of i){let y=p.split(" "),T=parseFloat(y[1])||0,D=parseInt(y[2],10)||0,E=parseFloat(y[3])||0;if(D>0&&T>0){E/D>T*50&&(c=!0);break}}let d=i.map(p=>{let y=p.split(" "),T=y[0],D=`${T.slice(0,2)}:${T.slice(2,4)}`,E=parseInt(y[2],10)||0,P=parseFloat(y[3])||0,L=c?E*100:E,H=L>0?P/L:0,U=Rt(s,D,_.CN);return{time:D,timestamp:U.timestamp,tz:U.tz,price:parseFloat(y[1])||0,volume:L,amount:P,avgPrice:Math.round(H*100)/100}}),f=N(s,_.CN);return{code:e,date:s,timestamp:f.timestamp,tz:f.tz,preClose:l,data:d}}var tr=ne("tencent:code-lists",{defaultTTL:360*60*1e3,maxSize:16});async function hn(t,e,n){return tr.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 Z(`\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E: ${e}`,"tencent",n);return o})}function Ai(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 nr(t,e){let n=e?.simple??!1,r=e?.market,i=await hn(t,"a-share:full",At);return r&&(i=i.filter(s=>Ai(s,r))),n?i.map(s=>s.replace(/^(sh|sz|bj)/,"")):i.slice()}async function rr(t,e){let n=e?.simple??!1,r=e?.market,i=(await hn(t,"us:full",Ot)).slice();if(r){let s=`${Fn[r]}.`;i=i.filter(u=>u.startsWith(s))}return n?i.map(s=>s.replace(/^\d{3}\./,"")):i}async function or(t){return(await hn(t,"hk:full",Pt)).slice()}async function ir(t,e,n={}){let{batchSize:r=Ee,concurrency:o=Ce,onProgress:i}=n;G(r,"batchSize"),G(o,"concurrency");let s=Math.min(r,_e),u=ce(e,s),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 de(d,o,!0)).flat()}async function sr(t,e,n={}){let{batchSize:r=Ee,concurrency:o=Ce,onProgress:i}=n;G(r,"batchSize"),G(o,"concurrency");let s=Math.min(r,_e),u=ce(e,s),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 de(d,o,!0)).flat()}async function ar(t,e,n={}){let{batchSize:r=Ee,concurrency:o=Ce,onProgress:i}=n;G(r,"batchSize"),G(o,"concurrency");let s=Math.min(r,_e),u=ce(e,s),l=u.length,c=0,d=u.map(p=>async()=>{let y=await tt(t,p);return c++,i&&i(c,l),y});return(await de(d,o,!0)).flat()}async function ur(t){return(await tr.getOrFetch("fund:full",async()=>{let o=(await t.get(ze,{responseType:"text"})??"").split(",").slice(1).filter(i=>i.trim());if(o.length===0)throw new Z("\u57FA\u91D1\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",ze);return o})).slice()}var Oi=ne("tencent:trade-calendar",{defaultTTL:720*60*1e3,maxSize:4});async function lr(t){return(await Oi.getOrFetch("a-share",async()=>{let r=(await t.get(Dt)??"").trim().split(",").map(o=>o.trim()).filter(o=>o.length>0);if(r.length===0)throw new Z("\u4EA4\u6613\u65E5\u5386\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",Dt);return r})).slice()}var cr="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 Di(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 Ii(t){return!t||t==="N"?[]:t.split("^").filter(Boolean).map(n=>{let r=n.split("~"),o=r[0]||"",i=r[1]||"",s=Pi(r[2]||""),u=r[4]||"";return{code:o+i,name:s,market:o,type:u,category:Di(u)}})}function bi(t){return new Promise((e,n)=>{let r=`${cr}?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 A({code:"NETWORK_ERROR",message:"Network error calling Smartbox",url:r}))},document.body.appendChild(o)})}async function Mi(t,e){let n=`${cr}?v=2&t=all&q=${encodeURIComponent(e)}`,o=(await t.get(n)).match(/v_hint="([^"]*)"/);return o?o[1]:""}function Li(){return typeof window<"u"&&typeof document<"u"}async function dr(t,e){if(!e||!e.trim())return[];let n;return Li()?n=await bi(e):n=await Mi(t,e),Ii(n)}var m={};at(m,{extractVariety:()=>On,fetchDatacenter:()=>Sn,fetchDatacenterList:()=>O,getBlockTradeDailyStat:()=>bo,getBlockTradeDetail:()=>Io,getBlockTradeMarketStat:()=>Do,getBoardChanges:()=>So,getCFFEXOptionQuotes:()=>Wr,getComexInventory:()=>eo,getConceptConstituents:()=>Fr,getConceptKline:()=>wr,getConceptList:()=>Nr,getConceptMinuteKline:()=>xr,getConceptSpot:()=>kr,getDividendDetail:()=>Ur,getDragonTigerBranchRank:()=>Ao,getDragonTigerDetail:()=>Eo,getDragonTigerInstitution:()=>Co,getDragonTigerStockSeatDetail:()=>Oo,getDragonTigerStockStats:()=>_o,getFundDividendList:()=>vr,getFundEstimate:()=>Br,getFundFlowRank:()=>ao,getFundNavHistory:()=>Kr,getFundProfile:()=>$r,getFundRankHistory:()=>Hr,getFuturesHistoryKline:()=>jr,getFuturesInventory:()=>Jr,getFuturesInventorySymbols:()=>Xr,getFuturesMarketCode:()=>Pn,getGlobalFuturesKline:()=>Qr,getGlobalFuturesSpot:()=>Gr,getHKHistoryKline:()=>yr,getHKMinuteKline:()=>hr,getHistoryKline:()=>gr,getHotThemes:()=>ko,getIndividualFundFlow:()=>io,getIndustryConstituents:()=>br,getIndustryKline:()=>Mr,getIndustryList:()=>Dr,getIndustryMinuteKline:()=>Lr,getIndustrySpot:()=>Ir,getMarginAccountInfo:()=>Mo,getMarginTargetList:()=>Lo,getMarketFundFlow:()=>so,getMinuteKline:()=>fr,getNorthboundFlowSummary:()=>mo,getNorthboundHistory:()=>fo,getNorthboundHoldingRank:()=>go,getNorthboundIndividual:()=>yo,getNorthboundMinute:()=>po,getOptionLHB:()=>Vr,getSectorFundFlowHistory:()=>lo,getSectorFundFlowRank:()=>uo,getStockChanges:()=>To,getThemeFunds:()=>Fo,getThemeList:()=>No,getUSHistoryKline:()=>Tr,getUSMinuteKline:()=>Sr,getZTPool:()=>ho});function M(t){return/^\d{8}$/.test(t)?`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6,8)}`:t}function pr(t,e){let n=i=>M(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 mr(t,e,n=0){let r=s=>{if(!s)return;let u=/^(\d{4})-?(\d{2})-?(\d{2})/.exec(s.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=ge(`${i.slice(0,4)}-${i.slice(4,6)}-${i.slice(6,8)}`,n).replace(/-/g,"")),{beg:o,end:i??"20500000"}}async function Tn(t,e,n,r,o=100,i){let s=[],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((T,D)=>i(T,s.length+D+1));if(s.push(...y),y.length===0)break;u++}while(s.length<l);return s}function v(t){let[e,n,r,o,i,s,u,l,c,d,f]=t.split(",");return{date:e,open:g(n),close:g(r),high:g(o),low:g(i),volume:g(s),amount:g(u),amplitude:g(l),changePercent:g(c),change:g(d),turnoverRate:g(f)}}async function K(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 Ni(t){let[e,n,r,o,i,s,u,l]=t.split(",");return{time:e,open:g(n),close:g(r),high:g(o),low:g(i),volume:g(s),amount:g(u),avgPrice:g(l)}}function nt(t,e){let n=r=>{let o=ae(r,_.CN);return{time:Et(o,t)||r,timestamp:re(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 te(t){return async function(n,r,o={}){let i=o.period??t.defaultPeriod;ht(i),t.fqt==="option"&&W(o.adjust??"qfq");let s=t.resolveTarget(r),u=t.window,l=p=>{if(u.mode==="full")return p;let{start:y,end:T}=pr(o.startDate??"1979-09-01 09:32:00",o.endDate??"2222-01-01 09:32:00");return p.filter(D=>D.time>=y&&D.time<=T)};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:s.secid}),y=`${t.trendsUrl}?${p.toString()}`,D=(await n.get(y,{responseType:"json"}))?.data?.trends;return!Array.isArray(D)||D.length===0?[]:l(D.map(E=>t.mapTrendRow(Ni(E),s)))}let c=u.mode==="filter"?mr(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"?V(o.adjust??"qfq"):t.fqt.fixed,secid:s.secid,beg:c.beg,end:c.end,...t.extraKlineParams??{}}),{klines:f}=await K(n,t.klineUrl,d);return!Array.isArray(f)||f.length===0?[]:l(f.map(p=>t.mapKlineRow(v(p),s)))}}async function gr(t,e,n={}){let{period:r="daily",adjust:o="qfq",startDate:i="19700101",endDate:s="20500101"}=n;q(r),W(o);let u=J(e,{market:"CN"}),l=ee(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:z(r),fqt:V(o),secid:l,beg:i,end:s}),d=$e,{klines:f}=await K(t,d,c);return f.length===0?[]:f.map(p=>{let y=v(p),T=N(y.date,_.CN);return{...y,timestamp:T.timestamp,tz:T.tz,code:u.code}})}var ki=te({trendsUrl:It,klineUrl:$e,resolveTarget:t=>{let e=J(t,{market:"CN"});return{secid:ee(e),code:e.code}},defaultPeriod:"1",ndays:{fixed:"5"},fqt:"option",includeUt:!0,window:{mode:"filter"},mapTrendRow:({time:t,...e})=>{let n=N(t,_.CN);return{time:t,timestamp:n.timestamp,tz:n.tz,...e}},mapKlineRow:t=>{let e=N(t.date,_.CN);return{...t,time:t.date,timestamp:e.timestamp,tz:e.tz}}});async function fr(t,e,n={}){return ki(t,e,n)}function rt(t){return async function(n,r,o={}){let{period:i="daily",adjust:s="qfq",startDate:u="19700101",endDate:l="20500101"}=o;q(i),W(s);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:z(i),fqt:V(s),secid:c.secid,beg:u,end:l,lmt:"1000000"}),{klines:f,name:p,code:y}=await K(n,t.url,d);if(f.length===0)return[];let T=t.resolveResultMeta?t.resolveResultMeta(r,c,{code:y,name:p}):{code:y||c.fallbackCode,name:p||""};return f.map(D=>{let E=v(D),P=N(E.date,t.tz),L={...E,timestamp:P.timestamp,tz:P.tz,code:T.code,name:T.name};return t.enrichItem(L)})}}var Fi=rt({url:Ye,tz:_.HK,normalizeSymbol:t=>{let e=J(t,{market:"HK"});return{secid:ee(e),fallbackCode:e.code}},enrichItem:t=>({...t,currency:"HKD",lotSize:null})});async function yr(t,e,n={}){return Fi(t,e,n)}var wi=te({trendsUrl:bt,klineUrl:Ye,resolveTarget:t=>{let e=J(t,{market:"HK"});return{secid:ee(e),code:e.code}},defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter"},...nt(_.HK,"HKD")});async function hr(t,e,n={}){return wi(t,e,n)}var xi=rt({url:je,tz:_.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 Tr(t,e,n={}){return xi(t,e,n)}var Ui=te({trendsUrl:Mt,klineUrl:je,resolveTarget:t=>({secid:t,code:t.split(".")[1]||t}),defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter",endExtraDays:1},...nt(_.US,"USD")});async function Sr(t,e,n={}){return Ui(t,e,n)}function Er(t){let e=ne(`eastmoney:board-code-map:${t.type}`,{defaultTTL:36e5,maxSize:4});return{async getCode(n,r,o){if(r.startsWith("BK"))return r;let s=(await e.getOrFetch("name-code-map",async()=>{let u=await o(n);if(u.length===0)throw new Z(`${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(!s)throw new ut(`${t.errorPrefix}: ${r}`,"eastmoney");return s}}}async function _r(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 Tn(t,e.listUrl,n,r,100,(i,s)=>({rank:s,name:String(i.f14??""),code:String(i.f12??""),price:a(i.f2),change:a(i.f4),changePercent:a(i.f3),totalMarketCap:a(i.f20),turnoverRate:a(i.f8),riseCount:a(i.f104),fallCount:a(i.f105),leadingStock:i.f128?String(i.f128):null,leadingStockChangePercent:a(i.f136)}));return o.sort((i,s)=>(s.changePercent??0)-(i.changePercent??0)),o.forEach((i,s)=>{i.rank=s+1}),o}async function Cr(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()}`,s=(await t.get(o,{responseType:"json"}))?.data;return s?[{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 f=s[l],p=null;return typeof f=="number"&&!isNaN(f)&&(p=d?f/100:f),{item:c,value:p}}):[]}async function Ar(t,e,n){let r={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:"f3",fs:`b:${e} f:!50`};return Tn(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,s)=>({rank:s,code:String(i.f12??""),name:String(i.f14??""),price:a(i.f2),changePercent:a(i.f3),change:a(i.f4),volume:a(i.f5),amount:a(i.f6),amplitude:a(i.f7),high:a(i.f15),low:a(i.f16),open:a(i.f17),prevClose:a(i.f18),turnoverRate:a(i.f8),pe:a(i.f9),pb:a(i.f23)}))}async function Or(t,e,n,r={}){let{period:o="daily",adjust:i="",startDate:s="19700101",endDate:u="20500101"}=r;q(o),W(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:z(o),fqt:V(i),beg:s,end:u,smplmt:"10000",lmt:"1000000"}),{klines:c}=await K(t,n,l);return c.length===0?[]:c.map(d=>v(d))}var Rr=new Map;async function Pr(t,e,n,r,o={}){let i=`${n}|${r}`,s=Rr.get(i);return s||(s=te({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})}),Rr.set(i,s)),s(t,e,o)}function ot(t){let e=Er(t);async function n(o){return _r(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 s=await r(o,i);return Cr(o,s,t.spotUrl)},async getConstituents(o,i){let s=await r(o,i);return Ar(o,s,t.consUrl)},async getKline(o,i,s={}){let u=await r(o,i);return Or(o,u,t.klineUrl,s)},async getMinuteKline(o,i,s={}){let u=await r(o,i);return Pr(o,u,t.klineUrl,t.trendsUrl,s)}}}var vi={type:"industry",fsFilter:"m:90 t:2 f:!50",listUrl:Lt,spotUrl:Nt,consUrl:kt,klineUrl:Ft,trendsUrl:wt,errorPrefix:"\u672A\u627E\u5230\u884C\u4E1A\u677F\u5757"},Pe=ot(vi);async function Dr(t){return Pe.getList(t)}async function Ir(t,e){return Pe.getSpot(t,e)}async function br(t,e){return Pe.getConstituents(t,e)}async function Mr(t,e,n={}){return Pe.getKline(t,e,n)}async function Lr(t,e,n={}){return Pe.getMinuteKline(t,e,n)}var Ki={type:"concept",fsFilter:"m:90 t:3 f:!50",listUrl:xt,spotUrl:Ut,consUrl:vt,klineUrl:Kt,trendsUrl:Bt,errorPrefix:"\u672A\u627E\u5230\u6982\u5FF5\u677F\u5757"},De=ot(Ki);async function Nr(t){return De.getList(t)}async function kr(t,e){return De.getSpot(t,e)}async function Fr(t,e){return De.getConstituents(t,e)}async function wr(t,e,n={}){return De.getKline(t,e,n)}async function xr(t,e,n={}){return De.getMinuteKline(t,e,n)}async function Sn(t,e,n){let{reportName:r,columns:o="ALL",filter:i,sortColumns:s,sortTypes:u,pageSize:l=500,startPage:c=1,fetchAllPages:d=!0,maxPages:f=1e3,quoteColumns:p,quoteType:y,extraParams:T}=e,D=[],E=c,P=1,L=0,H=0;do{let U=new URLSearchParams({reportName:r,columns:o,pageSize:String(l),pageNumber:String(E),source:"WEB",client:"WEB"});if(i&&U.set("filter",i),s&&U.set("sortColumns",s),u&&U.set("sortTypes",u),p&&U.set("quoteColumns",p),y&&U.set("quoteType",y),T)for(let[it,st]of Object.entries(T))U.set(it,st);let Yo=`${Ht}?${U.toString()}`,ie=(await t.get(Yo,{responseType:"json"}))?.result;if(!ie||!Array.isArray(ie.data))break;E===c&&(P=ie.pages??1,L=ie.count??ie.data.length);let jo=ie.data.map((it,st)=>n(it,D.length+st));if(D.push(...jo),E++,H++,!d)break}while(E<=P&&H<f);return d&&H>=f&&E<=P&&console.warn(`[stock-sdk] fetchDatacenter("${r}") truncated at maxPages=${f} (server reports ${P} pages). Pass a larger \`maxPages\` to fetch the full dataset.`),{data:D,total:L,pages:P}}async function O(t,e,n){return(await Sn(t,e,n)).data}function F(t){if(t==null)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}function oe(t){if(!t)return null;let e=t.match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Bi(t){return{code:t.SECURITY_CODE??"",name:t.SECURITY_NAME_ABBR??"",reportDate:oe(t.REPORT_DATE),planNoticeDate:oe(t.PLAN_NOTICE_DATE),disclosureDate:oe(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:oe(t.EQUITY_RECORD_DATE),exDividendDate:oe(t.EX_DIVIDEND_DATE),payDate:oe(t.PAY_DATE),assignProgress:t.ASSIGN_PROGRESS??null,noticeDate:oe(t.NOTICE_DATE)}}async function Ur(t,e){let n=e.replace(/^(sh|sz|bj)/,"");return O(t,{reportName:"RPT_SHAREBONUS_DET",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:500,filter:`(SECURITY_CODE="${n}")`},r=>Bi(r))}var Hi="https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx",_n="https://fund.eastmoney.com/pingzhongdata",qi="https://fundgz.1234567.com.cn/js";function zi(){return typeof document<"u"&&typeof window<"u"}var $i=1e4;function Yi(){return Number(Q(_.CN).slice(0,4))}function ji(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??Yi())});return`${Hi}?${n.toString()}`}function Rn(t){if(!t)return null;let e=t.trim().match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Gi(t){return{code:t[0]??"",name:t[1]??"",equityRecordDate:Rn(t[2]),exDividendDate:Rn(t[3]),dividendPerShare:R(t[4]),payDate:Rn(t[5]),dividendType:t[6]?.trim()?t[6].trim():null}}async function En(t,e,n){let r=ji(e,n),o=await se(r,["pageinfo","jjfh_data"],{client:t}),i=o.pageinfo??[0,0,n],[s=0,u=0,l=n]=i;return{items:(o.jjfh_data??[]).map(Gi),totalPages:s,pageSize:u,currentPage:l}}async function vr(t,e={}){if(e.page==="all"){let o=await En(t,e,1),i=o.items;for(let s=2;s<=o.totalPages;s++){let u=await En(t,e,s);i=i.concat(u.items)}return e.code&&(i=i.filter(s=>s.code===e.code)),{items:i,totalPages:o.totalPages,pageSize:o.pageSize,currentPage:-1}}let n=e.page??1,r=await En(t,e,n);return e.code?{...r,items:r.items.filter(o=>o.code===e.code)}:r}function Cn(t){return Q(_.CN,t)}function An(t){return re(ae(t,_.CN))}function Y(t,e){return t?.find(n=>n.name===e)?.data??[]}async function Kr(t,e){let n=`${_n}/${encodeURIComponent(e)}.js`,r=await se(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 s=o.map(u=>({date:Cn(u.x),timestamp:u.x,nav:u.y,accNav:i.has(u.x)?i.get(u.x):null,dailyReturn:R(u.equityReturn),unitMoney:u.unitMoney??""}));return{code:r.fS_code??e,name:r.fS_name??null,items:s}}function Qi(t,e,n=$i){let r=`${qi}/${encodeURIComponent(e)}.js?rt=${Date.now()}`;return zi()?pe("fundgz:jsonpgz",()=>Wi(r,n)):Vi(t,r)}function Wi(t,e){return new Promise((n,r)=>{let o=document.createElement("script"),i=window,s=i.jsonpgz,u=!1,l=()=>{if(o.parentNode&&o.parentNode.removeChild(o),s===void 0)try{delete i.jsonpgz}catch{}else i.jsonpgz=s},c=setTimeout(()=>{u||(u=!0,l(),r(new 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(d??{}))},o.onerror=()=>{u||(u=!0,clearTimeout(c),l(),r(new A({code:"NETWORK_ERROR",message:`fundgz JSONP script load failed: ${t}`,url:t})))},o.src=t,document.head.appendChild(o)})}async function Vi(t,e){let r=(await t.get(e,{responseType:"text",provider:"eastmoney"})).trim();if(!r)return{};try{return qe(r)}catch{return{}}}async function Br(t,e){let n=await Qi(t,e);return{code:n.fundcode??e,name:n.name??null,navDate:n.jzrq?.trim()?n.jzrq.trim():null,nav:R(n.dwjz),estimatedNav:R(n.gsz),estimatedChangePercent:R(n.gszzl),estimateTime:n.gztime?.trim()?n.gztime.trim():null}}async function Hr(t,e){let n=`${_n}/${encodeURIComponent(e)}.js`,r=await se(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 s=o.map(u=>({date:Cn(u.x),timestamp:u.x,rank:R(u.y),total:R(u.sc),percentile:i.has(u.x)?i.get(u.x):null}));return{code:r.fS_code??e,name:r.fS_name??null,items:s}}function qr(t){let e=t.indexOf(".");return e<0?{code:t,marketId:""}:{marketId:t.slice(0,e),code:t.slice(e+1)}}function Zi(t){return t?t.map(e=>e.trim()).filter(Boolean).map(qr):[]}function Xi(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean).map(qr):[]}function Ji(t){if(!t?.categories?.length||!t?.series)return[];let e=Y(t.series,"\u80A1\u7968\u5360\u51C0\u6BD4"),n=Y(t.series,"\u503A\u5238\u5360\u51C0\u6BD4"),r=Y(t.series,"\u73B0\u91D1\u5360\u51C0\u6BD4"),o=Y(t.series,"\u5176\u4ED6\u5360\u51C0\u6BD4"),i=Y(t.series,"\u51C0\u8D44\u4EA7");return t.categories.map((s,u)=>({date:s,timestamp:An(s),stockRatio:e[u]??0,bondRatio:n[u]??0,cashRatio:r[u]??0,otherRatio:o[u]??0,netAsset:i[u]??0}))}function es(t){return t?t.filter(([e])=>typeof e=="number"&&Number.isFinite(e)).map(([e,n])=>({date:Cn(e),timestamp:e,position:n})):[]}function ts(t){return t?t.map(e=>{let n=e?.star;return{id:e?.id??"",name:e?.name??"",avatarUrl:e?.pic?.trim()||null,star:typeof n=="number"&&Number.isFinite(n)?n:null,workTime:e?.workTime?.trim()||null,fundSize:e?.fundSize?.trim()||null,power:zr(e?.power)}}):[]}function zr(t){return t?.categories?.length?{overall:R(t.avr)??0,categories:t.categories,scores:t.data??[],descriptions:t.dsc??[]}:null}function ns(t){if(!t?.categories?.length||!t?.series)return[];let e=Y(t.series,"\u673A\u6784\u6301\u6709\u6BD4\u4F8B"),n=Y(t.series,"\u4E2A\u4EBA\u6301\u6709\u6BD4\u4F8B"),r=Y(t.series,"\u5185\u90E8\u6301\u6709\u6BD4\u4F8B");return t.categories.map((o,i)=>({date:o,timestamp:An(o),institutionRatio:e[i]??0,individualRatio:n[i]??0,internalRatio:r[i]??0}))}function rs(t){return!t?.categories?.length||!t?.series?[]:t.categories.map((e,n)=>({date:e,scale:t.series?.[n]?.y??0,mom:t.series?.[n]?.mom??""}))}function os(t){if(!t?.categories?.length||!t?.series)return[];let e=Y(t.series,"\u671F\u95F4\u7533\u8D2D"),n=Y(t.series,"\u671F\u95F4\u8D4E\u56DE"),r=Y(t.series,"\u603B\u4EFD\u989D");return t.categories.map((o,i)=>({date:o,timestamp:An(o),buy:e[i]??0,sell:n[i]??0,total:r[i]??0}))}function is(t){return{oneMonth:R(t.syl_1y),threeMonth:R(t.syl_3y),sixMonth:R(t.syl_6y),oneYear:R(t.syl_1n)}}function ss(t){if(typeof t!="string")return null;let e=t.indexOf("_");if(e<0)return null;let n=t.slice(0,e);if(!n)return null;let r=t.lastIndexOf("_");return r>e?{code:n,name:t.slice(e+1,r),value:R(t.slice(r+1))}:{code:n,name:t.slice(e+1),value:null}}function as(t){if(!t?.length)return null;let e=t.map(n=>(Array.isArray(n)?n:[]).map(ss).filter(r=>r!==null)).filter(n=>n.length>0);return e.length?{groups:e}:null}async function $r(t,e){let n=`${_n}/${encodeURIComponent(e)}.js`,r=await se(n,["fS_code","fS_name","fund_sourceRate","fund_Rate","fund_minsg","stockCodesNew","zqCodesNew","Data_assetAllocation","Data_fundSharesPositions","Data_currentFundManager","Data_performanceEvaluation","Data_holderStructure","Data_fluctuationScale","Data_buySedemption","syl_1y","syl_3y","syl_6y","syl_1n","swithSameType"],{client:t});return{code:r.fS_code??e,name:r.fS_name??null,sourceRate:R(r.fund_sourceRate),rate:R(r.fund_Rate),minSubscription:R(r.fund_minsg),holdings:Zi(r.stockCodesNew),bondHoldings:Xi(r.zqCodesNew),assetAllocation:Ji(r.Data_assetAllocation),positions:es(r.Data_fundSharesPositions),managers:ts(r.Data_currentFundManager),performance:zr(r.Data_performanceEvaluation),holderStructure:ns(r.Data_holderStructure),scaleChanges:rs(r.Data_fluctuationScale),buySedemption:os(r.Data_buySedemption),stageReturns:is(r),sameType:as(r.swithSameType)}}function On(t){let e=t.match(/^([a-zA-Z]+)/);if(!e)throw new S(`Invalid futures symbol: "${t}". Expected format: variety + contract (e.g., rb2605, RBM, IF2604)`);return e[1]}function Yr(t){return ue[t]??ue[t.toLowerCase()]??ue[t.toUpperCase()]}function Pn(t){let e=Yr(t);if(!e&&t.length>1&&t.endsWith("M")&&(e=Yr(t.slice(0,-1))),!e){let r=Object.keys(ue).join(", ");throw new S(`Unknown futures variety: "${t}". Supported varieties: ${r}`)}let n=Yt[e];if(n===void 0)throw new S(`No market code found for exchange: ${e}`);return n}function us(t){let e=v(t),n=t.split(",");return{...e,openInterest:n.length>12?g(n[12]):null}}async function jr(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;q(r);let s=On(e),l=`${Pn(s)}.${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:z(r),fqt:"0",secid:l,beg:o,end:i}),{klines:d,name:f,code:p}=await K(t,he,c);return d.length===0?[]:d.map(y=>({...us(y),code:p||e,name:f||""}))}async function Gr(t,e={}){let n=e.pageSize??20,r=[],o=0,i=0,s=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=`${$t}?${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(ls);if(r.push(...d),d.length===0)break;o++}while(r.length<i&&o<s);return r}function ls(t){return{code:t.dm||"",name:t.name||"",price:g(String(t.p)),change:g(String(t.zde)),changePercent:g(String(t.zdf)),open:g(String(t.o)),high:g(String(t.h)),low:g(String(t.l)),prevSettle:g(String(t.zjsj)),volume:g(String(t.vol)),buyVolume:g(String(t.wp)),sellVolume:g(String(t.np)),openInterest:g(String(t.ccl))}}function cs(t){let e=v(t),n=t.split(",");return{...e,openInterest:n.length>12?g(n[12]):null}}function ds(t){let e=t.match(/^([A-Z]+)/);if(!e)throw new S(`Invalid global futures symbol: "${t}". Expected format like HG00Y, CL2507`);return e[1]}async function Qr(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;q(r);let s=n.marketCode;if(s===void 0){let p=ds(e);if(s=Ge[p],s===void 0){let y=Object.keys(Ge).join(", ");throw new S(`Unknown global futures variety: "${p}". Supported: ${y}. Or specify marketCode manually via options.`)}}let u=`${s}.${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:z(r),fqt:"0",secid:u,beg:o,end:i}),{klines:c,name:d,code:f}=await K(t,he,l);return c.length===0?[]:c.map(p=>({...cs(p),code:f||e,name:d||""}))}async function Wr(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=`${Vt}?${r.toString()}`,s=(await t.get(o,{responseType:"json"}))?.list;return Array.isArray(s)?s.map(u=>({code:String(u.dm??""),name:String(u.name??""),price:a(u.p),change:a(u.zde),changePercent:a(u.zdf),volume:a(u.vol),amount:a(u.cje),openInterest:a(u.ccl),strikePrice:a(u.xqj),remainDays:a(u.syr),dailyChange:a(u.rz),prevSettle:a(u.zjsj),open:a(u.o)})):[]}async function Vr(t,e,n){let r=new URLSearchParams({type:"RPT_IF_BILLBOARD_TD",sty:"ALL",p:"1",ps:"200",source:"IFBILLBOARD",client:"WEB",ut:$,filter:`(SECURITY_CODE="${e}")(TRADE_DATE='${n}')`}),o=`${Zt}?${r.toString()}`,s=(await t.get(o,{responseType:"json"}))?.result?.data;if(!Array.isArray(s))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 s.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:a(l.MEMBER_RANK)??0,sellVolume:a(l.SELL_VOLUME),sellVolumeChange:a(l.SELL_VOLUME_CHANGE),netSellVolume:a(l.NET_SELL_VOLUME),sellVolumeRatio:a(l.SELL_VOLUME_RATIO),buyVolume:a(l.BUY_VOLUME),buyVolumeChange:a(l.BUY_VOLUME_CHANGE),netBuyVolume:a(l.NET_BUY_VOLUME),buyVolumeRatio:a(l.BUY_VOLUME_RATIO),sellPosition:a(l.SELL_POSITION),sellPositionChange:a(l.SELL_POSITION_CHANGE),netSellPosition:a(l.NET_SELL_POSITION),sellPositionRatio:a(l.SELL_POSITION_RATIO),buyPosition:a(l.BUY_POSITION),buyPositionChange:a(l.BUY_POSITION_CHANGE),netBuyPosition:a(l.NET_BUY_POSITION),buyPositionRatio:a(l.BUY_POSITION_RATIO)}))}var ps={gold:"EMI00069026",silver:"EMI00069027"};function Zr(t){if(!t)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}async function Xr(t){return O(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 Jr(t,e,n={}){let{startDate:r="2020-10-28",pageSize:o=500}=n,i=e.toUpperCase();return O(t,{reportName:"RPT_FUTU_STOCKDATA",columns:"SECURITY_CODE,TRADE_DATE,ON_WARRANT_NUM,ADDCHANGE",filter:`(SECURITY_CODE="${i}")(TRADE_DATE>='${M(r)}')`,pageSize:o,sortColumns:"TRADE_DATE",sortTypes:"-1"},s=>({code:String(s.SECURITY_CODE??e),date:Zr(s.TRADE_DATE),inventory:a(s.ON_WARRANT_NUM),change:a(s.ADDCHANGE)}))}async function eo(t,e,n={}){let r=ps[e];if(!r)throw new S(`Invalid COMEX symbol: "${e}". Must be "gold" or "silver".`);let{pageSize:o=500}=n,i={gold:"\u9EC4\u91D1",silver:"\u767D\u94F6"};return O(t,{reportName:"RPT_FUTUOPT_GOLDSIL",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:o,filter:`(INDICATOR_ID1="${r}")(@STORAGE_TON<>"NULL")`},s=>({date:Zr(s.REPORT_DATE),name:i[e]??e,storageTon:a(s.STORAGE_TON),storageOunce:a(s.STORAGE_OUNCE)}))}var to={daily:"101",weekly:"102",monthly:"103"},Dn="f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65";function no(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:g(e[1]),smallNetInflow:g(e[2]),mediumNetInflow:g(e[3]),largeNetInflow:g(e[4]),superLargeNetInflow:g(e[5]),mainNetInflowPercent:g(e[6]),smallNetInflowPercent:g(e[7]),mediumNetInflowPercent:g(e[8]),largeNetInflowPercent:g(e[9]),superLargeNetInflowPercent:g(e[10]),close:g(e[11]),changePercent:g(e[12])}}function ms(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:g(e[1]),smallNetInflow:g(e[2]),mediumNetInflow:g(e[3]),largeNetInflow:g(e[4]),superLargeNetInflow:g(e[5]),mainNetInflowPercent:g(e[6]),smallNetInflowPercent:g(e[7]),mediumNetInflowPercent:g(e[8]),largeNetInflowPercent:g(e[9]),superLargeNetInflowPercent:g(e[10]),shClose:g(e[11]),shChangePercent:g(e[12]),szClose:g(e[13]),szChangePercent:g(e[14])}}var ro={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"}},gs={industry:"m:90+t:2",concept:"m:90+t:3",region:"m:90+t:1"},fs="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 oo(t,e,n=100,r=1e3){let o=[],i=1,s=0;do{let u=new URLSearchParams({...e,pn:String(i),pz:String(n)}),l=`${qt}?${u.toString()}`,d=(await t.get(l,{responseType:"json"}))?.data;if(!d||!Array.isArray(d.diff)||(i===1&&(s=d.total??0),o.push(...d.diff),o.length>=s||d.diff.length<n))break;i++}while(o.length<s&&i<=r);return i>r&&o.length<s&&console.warn(`[stock-sdk] fetchClistAllPages truncated at maxPages=${r} (server reports total=${s}, fetched=${o.length}). Pass a larger \`maxPages\` to fetch the full dataset.`),o}async function io(t,e,n={}){let{period:r="daily"}=n,o=to[r];if(!o)throw new S(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i;try{i=J(e,{market:"CN"})}catch(f){let p=e.includes(".")?e.slice(e.indexOf(".")+1):e;throw f instanceof lt&&pt(p)?new S(`Individual fund flow is not available for index symbols: ${e}`):f}if(i.assetType==="index"&&pt(i.code))throw new S(`Individual fund flow is not available for index symbols: ${e}`);let s=ee(i),u=new URLSearchParams({lmt:"0",klt:o,secid:s,fields1:"f1,f2,f3,f7",fields2:Dn,ut:$}),l=`${fe}?${u.toString()}`,d=(await t.get(l,{responseType:"json"}))?.data?.klines;return!Array.isArray(d)||d.length===0?[]:d.map(no)}async function so(t){let e=new URLSearchParams({lmt:"0",klt:"101",secid:"1.000001",secid2:"0.399001",fields1:"f1,f2,f3,f7",fields2:Dn,ut:$}),n=`${fe}?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.klines;return!Array.isArray(o)||o.length===0?[]:o.map(ms)}async function ao(t,e={}){let{indicator:n="today"}=e,r=ro[n];if(!r)throw new S(`Invalid indicator: ${n}.`);let o={fid:r.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:$,fs,fields:r.fields};return(await oo(t,o,100)).map(s=>({code:String(s.f12??""),name:String(s.f14??""),price:a(s.f2),changePercent:a(s[r.changePercentField]),mainNetInflow:a(s[r.mainNet]),mainNetInflowPercent:a(s[r.mainPct]),superLargeNetInflow:a(s[r.superLargeNet]),superLargeNetInflowPercent:a(s[r.superLargePct]),largeNetInflow:a(s[r.largeNet]),largeNetInflowPercent:a(s[r.largePct]),mediumNetInflow:a(s[r.mediumNet]),mediumNetInflowPercent:a(s[r.mediumPct]),smallNetInflow:a(s[r.smallNet]),smallNetInflowPercent:a(s[r.smallPct])}))}async function uo(t,e={}){let{indicator:n="today",sectorType:r="industry"}=e,o=ro[n];if(!o)throw new S(`Invalid indicator: ${n}.`);let i=gs[r];if(!i)throw new S(`Invalid sectorType: ${r}.`);let s=`${o.fields},f204,f205`,u={fid:o.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:$,fs:i,fields:s};return(await oo(t,u,100)).map(c=>({code:String(c.f12??""),name:String(c.f14??""),changePercent:a(c[o.changePercentField]),mainNetInflow:a(c[o.mainNet]),mainNetInflowPercent:a(c[o.mainPct]),superLargeNetInflow:a(c[o.superLargeNet]),largeNetInflow:a(c[o.largeNet]),mediumNetInflow:a(c[o.mediumNet]),smallNetInflow:a(c[o.smallNet]),topStockCode:c.f204?String(c.f204):void 0,topStockName:c.f205?String(c.f205):void 0}))}async function lo(t,e,n={}){let{period:r="daily"}=n,o=to[r];if(!o)throw new S(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=e.includes(".")?e:`90.${e}`,s=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Dn,ut:$}),u=`${fe}?${s.toString()}`,c=(await t.get(u,{responseType:"json"}))?.data?.klines;return!Array.isArray(c)||c.length===0?[]:c.map(no)}var ys={today:"1","3day":"3","5day":"5","10day":"10",month:"M",quarter:"Q",year:"Y"},hs={shanghai:"001",shenzhen:"003"};function co(t,e){let n=t.split(",");return{date:e,time:n[0]??"",shanghaiNetInflow:g(n[1]),shenzhenNetInflow:g(n[3]),totalNetInflow:g(n[5])}}async function po(t,e="north"){He(e);let n=new URLSearchParams({fields1:"f1,f2,f3,f4",fields2:"f51,f54,f52,f58,f53,f62,f56,f57,f60,f61",ut:$}),r=`${zt}?${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=>co(d,M(c)))}let s=i.s2n??[],u=i.s2nDate??"";return s.map(l=>co(l,M(u)))}async function mo(t){return O(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:F(e.TRADE_DATE),type:String(e.MUTUAL_TYPE??""),boardName:String(e.MUTUAL_TYPE_NAME??""),direction:String(e.FUNDS_DIRECTION??""),status:String(e.status??""),netBuyAmount:a(e.netBuyAmt),netInflow:a(e.dayNetAmtIn),remainAmount:a(e.dayAmtRemain),upCount:a(e.f104),flatCount:a(e.f106),downCount:a(e.f105),indexCode:String(e.INDEX_CODE??""),indexName:String(e.INDEX_NAME??""),indexChangePercent:a(e.INDEX_f3)}))}async function go(t,e={}){let{market:n="all",period:r="5day",date:o}=e,i=ys[r];if(!i)throw new S(`Invalid period: ${r}.`);let s=[`(INTERVAL_TYPE="${i}")`];return o&&s.push(`(TRADE_DATE='${o}')`),n!=="all"&&s.push(`(MUTUAL_TYPE="${hs[n]}")`),O(t,{reportName:"RPT_MUTUAL_STOCK_NORTHSTA",columns:"ALL",sortColumns:"ADD_MARKET_CAP",sortTypes:"-1",pageSize:500,filter:s.join("")},u=>({date:F(u.TRADE_DATE),code:String(u.SECURITY_CODE??""),name:String(u.SECURITY_NAME??u.SECURITY_NAME_ABBR??""),close:a(u.CLOSE_PRICE),changePercent:a(u.CHANGE_RATE),holdShares:a(u.HOLD_SHARES),holdMarketValue:a(u.HOLD_MARKET_CAP),holdRatioFloat:a(u.HOLD_RATIO),holdRatioTotal:a(u.A_SHARES_RATIO),addShares:a(u.ADD_SHARES),addMarketValue:a(u.ADD_MARKET_CAP),addMarketValuePercent:a(u.ADD_MARKET_CAP_PROPORTION),sector:String(u.BOARD_NAME??"")}))}async function fo(t,e="north",n={}){He(e);let{startDate:r,endDate:o}=n,i=[e==="north"?'(BOARD_TYPE="1")':'(BOARD_TYPE="0")'];return r&&i.push(`(TRADE_DATE>='${M(r)}')`),o&&i.push(`(TRADE_DATE<='${M(o)}')`),O(t,{reportName:"RPT_MUTUAL_DEAL_HISTORY",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:i.join("")},s=>({date:F(s.TRADE_DATE),netBuyAmount:a(s.NET_DEAL_AMT),buyAmount:a(s.BUY_AMT),sellAmount:a(s.SELL_AMT),accNetBuyAmount:a(s.ACCUM_DEAL_AMT),netInflow:a(s.FUND_INFLOW),remainAmount:a(s.QUOTA_BALANCE),topStockCode:s.LEAD_STOCKS_CODE?String(s.LEAD_STOCKS_CODE):null,topStockName:s.LEAD_STOCKS_NAME?String(s.LEAD_STOCKS_NAME):null,topStockChangePercent:a(s.LS_CHANGE_RATE)}))}async function yo(t,e,n={}){let r=e.replace(/^(sh|sz|bj)/i,""),{startDate:o,endDate:i}=n,s=[`(SECURITY_CODE="${r}")`];return o&&s.push(`(TRADE_DATE>='${M(o)}')`),i&&s.push(`(TRADE_DATE<='${M(i)}')`),O(t,{reportName:"RPT_MUTUAL_HOLDSTOCKNORTH_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:s.join("")},u=>({date:F(u.TRADE_DATE),holdShares:a(u.HOLD_SHARES),holdMarketValue:a(u.HOLD_MARKET_CAP),holdRatioFloat:a(u.HOLD_RATIO),holdRatioTotal:a(u.A_SHARES_RATIO),close:a(u.CLOSE_PRICE),changePercent:a(u.CHANGE_RATE)}))}var Ts={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"}},Ss={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"},Rs={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 In(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 Es(t){if(!t||typeof t!="object")return"";let e=t;return`${e.days??""}/${e.ct??""}`}function _s(t){let e=a(t.p),n=a(t.tp);return{code:String(t.c??t.m??""),name:String(t.n??""),price:e!==null?e/1e3:null,changePercent:a(t.zdp),limitPrice:n!==null?n/1e3:null,amount:a(t.amount??t.zb),floatMarketValue:a(t.ltsz),totalMarketValue:a(t.tshare),turnoverRate:a(t.hs),continuousBoardCount:a(t.lbc),firstBoardTime:t.fbt!==void 0&&t.fbt!==null?In(t.fbt):null,lastBoardTime:t.lbt!==void 0&&t.lbt!==null?In(t.lbt):null,boardAmount:a(t.fund),sealAmount:a(t.fund),failedCount:a(t.zbc),industry:String(t.hybk??""),ztStatistics:Es(t.zttj),amplitude:a(t.zf),speed:a(t.zs)}}function Cs(t){if(t)return/^\d{8}$/.test(t)?t:t.replace(/-/g,"")}function As(){return Q(_.CN).replace(/-/g,"")}async function ho(t,e="zt",n){let r=Ts[e];if(!r)throw new S(`Invalid ZTPool type: ${e}.`);let o=Cs(n)??As(),i=new URLSearchParams({ut:k,dpt:"wz.ztzt",Pageindex:"0",pagesize:"10000",sort:r.sort,date:o}),s=`${ye}${r.path}?${i.toString()}`,l=(await t.get(s,{responseType:"json"}))?.data?.pool;return!Array.isArray(l)||l.length===0?[]:l.map(_s)}async function To(t,e="large_buy"){let n=Ss[e];if(!n)throw new S(`Invalid StockChangeType: ${e}.`);let r=new URLSearchParams({type:n,pageindex:"0",pagesize:"5000",ut:k,dpt:"wzchanges"}),o=`${ye}/getAllStockChanges?${r.toString()}`,s=(await t.get(o,{responseType:"json"}))?.data?.allstock;return!Array.isArray(s)||s.length===0?[]:s.map(u=>{let l=String(u.t??n);return{time:In(u.tm),code:String(u.c??""),name:String(u.n??""),changeType:e,changeTypeLabel:Rs[l]??"",info:String(u.i??"")}})}async function So(t){let e=new URLSearchParams({ut:k,dpt:"wzchanges",pageindex:"0",pagesize:"5000"}),n=`${ye}/getAllBKChanges?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.allbk;return!Array.isArray(o)||o.length===0?[]:o.map(i=>{let s=i.ms??{},u=s.m===0?"\u5927\u7B14\u4E70\u5165":s.m===1?"\u5927\u7B14\u5356\u51FA":"",l={},c=i.bkdf??i.bkdfdis;if(c&&typeof c=="object")for(let[d,f]of Object.entries(c))l[d]=Number(f)||0;return{name:String(i.bkn??""),changePercent:a(i.bkz),mainNetInflow:a(i.bkj),totalChangeCount:a(i.bkc),topStockCode:String(s.c??""),topStockName:String(s.n??""),topStockDirection:u,changeTypeDistribution:l}})}var Ro={"1month":"01","3month":"02","6month":"03","1year":"04"};async function Eo(t,e){let n=M(e.startDate),r=M(e.endDate);return O(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:F(o.TRADE_DATE),close:a(o.CLOSE_PRICE),changePercent:a(o.CHANGE_RATE),netBuyAmount:a(o.BILLBOARD_NET_AMT),buyAmount:a(o.BILLBOARD_BUY_AMT),sellAmount:a(o.BILLBOARD_SELL_AMT),dealAmount:a(o.BILLBOARD_DEAL_AMT),totalAmount:a(o.ACCUM_AMOUNT),netBuyRatio:a(o.DEAL_NET_RATIO),dealAmountRatio:a(o.DEAL_AMOUNT_RATIO),turnoverRate:a(o.TURNOVERRATE),floatMarketValue:a(o.FREE_MARKET_CAP),reason:String(o.EXPLANATION??o.EXPLAIN??""),afterChange1d:a(o.D1_CLOSE_ADJCHRATE),afterChange2d:a(o.D2_CLOSE_ADJCHRATE),afterChange5d:a(o.D5_CLOSE_ADJCHRATE),afterChange10d:a(o.D10_CLOSE_ADJCHRATE)}))}async function _o(t,e="1month"){let n=Ro[e];if(!n)throw new S(`Invalid period: ${e}.`);return O(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:F(r.LATEST_TDATE),close:a(r.CLOSE_PRICE),changePercent:a(r.CHANGE_RATE),count:a(r.BILLBOARD_TIMES),totalBuyAmount:a(r.BILLBOARD_BUY_AMT),totalSellAmount:a(r.BILLBOARD_SELL_AMT),totalNetAmount:a(r.BILLBOARD_NET_AMT),totalDealAmount:a(r.BILLBOARD_DEAL_AMT),buyOrgCount:a(r.ORG_BUY_TIMES),sellOrgCount:a(r.ORG_SELL_TIMES)}))}async function Co(t,e){let n=M(e.startDate),r=M(e.endDate);return O(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:F(o.TRADE_DATE),close:a(o.CLOSE_PRICE),changePercent:a(o.CHANGE_RATE),buyOrgCount:a(o.BUY_TIMES),sellOrgCount:a(o.SELL_TIMES),orgBuyAmount:a(o.BUY_AMT),orgSellAmount:a(o.SELL_AMT),orgNetAmount:a(o.NET_AMT)}))}async function Ao(t,e="1month"){let n=Ro[e];if(!n)throw new S(`Invalid period: ${e}.`);return O(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:a(r.TOTAL_BUYAMT??r.BUY_AMT),totalSellAmount:a(r.TOTAL_SELLAMT??r.SELL_AMT),buyCount:a(r.TOTAL_BUYER_SALESTIMES??r.BUY_TIMES),sellCount:a(r.TOTAL_SELLER_SALESTIMES??r.SELL_TIMES),totalCount:a(r.TOTAL_TIMES)}))}async function Oo(t,e,n){let r=e.replace(/^(sh|sz|bj)/i,""),o=M(n),i=`(SECURITY_CODE="${r}")(TRADE_DATE='${o}')`,[s,u]=await Promise.all([O(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSBUY",columns:"ALL",sortColumns:"BUY_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:a(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:a(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:a(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:a(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:a(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:a(l.NET_AMT),side:"buy"})),O(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSSELL",columns:"ALL",sortColumns:"SELL_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:a(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:a(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:a(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:a(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:a(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:a(l.NET_AMT),side:"sell"}))]);return[...s,...u]}function Po(t){if(!t)return"";let e=t.startDate?M(t.startDate):void 0,n=t.endDate?M(t.endDate):void 0,r=[];return e&&r.push(`(TRADE_DATE>='${e}')`),n&&r.push(`(TRADE_DATE<='${n}')`),r.join("")}async function Do(t){return O(t,{reportName:"PRT_BLOCKTRADE_MARKET_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500},e=>({date:F(e.TRADE_DATE),shClose:a(e.CLOSE_PRICE??e.SH_CLOSE_PRICE),shChangePercent:a(e.CHANGE_RATE??e.SH_CHANGE_RATE),totalAmount:a(e.TURNOVER??e.TOTAL_AMOUNT),premiumAmount:a(e.PREMIUM_TURNOVER??e.PREMIUM_AMOUNT),premiumRatio:a(e.PREMIUM_RATIO),discountAmount:a(e.DISCOUNT_TURNOVER??e.DISCOUNT_AMOUNT),discountRatio:a(e.DISCOUNT_RATIO)}))}async function Io(t,e={}){let n=Po(e);return O(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:F(r.TRADE_DATE),close:a(r.CLOSE_PRICE),changePercent:a(r.CHANGE_RATE),dealPrice:a(r.DEAL_PRICE??r.PRICE),dealVolume:a(r.DEAL_VOLUME??r.VOLUME),dealAmount:a(r.DEAL_AMT??r.TURNOVER),premiumRate:a(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 bo(t,e={}){let n=Po(e);return O(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:F(r.TRADE_DATE),changePercent:a(r.CHANGE_RATE),close:a(r.CLOSE_PRICE),dealCount:a(r.DEAL_NUM??r.DEAL_COUNT),dealTotalAmount:a(r.DEAL_AMT??r.TOTAL_AMOUNT),dealTotalVolume:a(r.DEAL_VOLUME??r.TOTAL_VOLUME),premiumAmount:a(r.PREMIUM_AMT??r.PREMIUM_AMOUNT),discountAmount:a(r.DISCOUNT_AMT??r.DISCOUNT_AMOUNT)}))}async function Mo(t){return O(t,{reportName:"RPTA_WEB_MARGIN_DAILYTRADE",columns:"ALL",sortColumns:"STATISTICS_DATE",sortTypes:"-1",pageSize:500},e=>({date:F(e.STATISTICS_DATE??e.TRADE_DATE),finBalance:a(e.FIN_BALANCE),loanBalance:a(e.LOAN_BALANCE),finBuyAmount:a(e.FIN_BUY_AMT),loanSellAmount:a(e.LOAN_SELL_AMT),investorCount:a(e.OPERATE_INVESTOR_NUM??e.INVESTOR_NUM),liabilityInvestorCount:a(e.MARGIN_INVESTOR_NUM),totalGuarantee:a(e.TOTAL_GUARANTEE),avgGuaranteeRatio:a(e.AVG_GUARANTEE_RATIO)}))}async function Lo(t,e){let n=e?`(TRADE_DATE='${e}')`:void 0;return O(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:F(r.TRADE_DATE),finBalance:a(r.FIN_BALANCE),finBuyAmount:a(r.FIN_BUY_AMT),finRepayAmount:a(r.FIN_REPAY_AMT),loanBalance:a(r.LOAN_BALANCE),loanSellVolume:a(r.LOAN_SELL_VOLUME),loanRepayVolume:a(r.LOAN_REPAY_VOLUME)}))}var bn="https://fundmobapi.eastmoney.com/FundMNewApi",Mn={plat:"Android",appType:"ttjj",product:"EFund",Version:"1",deviceid:"stock-sdk"};async function No(t,e={}){let n=e.sort??"ZDF",r=e.order??"desc",o=e.category??"2",i=e.pageSize??20,s=e.page??1,u=new URLSearchParams({...Mn,RankItems:n,RankVectors:r,category:o,pageSize:String(i),page:String(s)}),l=`${bn}/FundMNSubjectList?${u.toString()}`,c=await t.get(l,{provider:"eastmoney",responseType:"json"}),d=c.Data??[],f=c.pageinfo??{totalPages:0,pageSize:i,page:s};return{items:d.map(y=>({code:y.code??"",name:y.name??"",dailyChange:R(y.ZDF),weeklyReturn:R(y.SYL_W),monthlyReturn:R(y.SYL_M),quarterlyReturn:R(y.SYL_3M),halfYearReturn:R(y.SYL_6M),yearlyReturn:R(y.SYL_Y),threeYearReturn:R(y.SYL_3Y),fiveYearReturn:R(y.SYL_5Y),type:y.isIndustry===1?"\u884C\u4E1A":y.isIndustry===0?"\u6982\u5FF5":"\u884C\u4E1A"})),totalPages:f.totalPages??0,pageSize:f.pageSize??i,currentPage:f.page??s}}async function ko(t,e={}){let n=e.sort??"ZDF",r=e.order??"desc",o=e.category??"2",i=e.limit??20,s=new URLSearchParams({...Mn,RankItems:n,RankVectors:r,category:o,limit:String(i)}),u=`${bn}/FundThemeList?${s.toString()}`;return((await t.get(u,{provider:"eastmoney",responseType:"json"})).Data??[]).map(d=>({code:d.code??"",name:d.name??"",dailyChange:R(d.ZDF),weeklyReturn:R(d.SYL_W),monthlyReturn:R(d.SYL_M),quarterlyReturn:R(d.SYL_3M),halfYearReturn:R(d.SYL_6M),yearlyReturn:R(d.SYL_Y),threeYearReturn:R(d.SYL_3Y),fiveYearReturn:R(d.SYL_5Y),type:d.isIndustry===1?"\u884C\u4E1A":d.isIndustry===0?"\u6982\u5FF5":"\u884C\u4E1A"}))}async function Fo(t,e,n={}){let r=n.sortColumn??"SYL_1N",o=n.sort??"desc",i=n.page??1,s=n.pageSize??20,u=n.fundType??"",l=new URLSearchParams({...Mn,TOPICAL:e,SortColumn:r,Sort:o,pageIndex:String(i),pageSize:String(s),FundType:u}),c=`${bn}/FundMNRank?${l.toString()}`,d=await t.get(c,{provider:"eastmoney",responseType:"json"}),f=d.Data??[],p=d.fundinfo??{total:0,pagesize:s,pageindex:i};return{items:f.map(T=>({code:T.fscode??"",name:T.abname??"",fundType:T.ftype??"",dailyChange:R(T.ZDF),weeklyReturn:R(T.SYL_Z),monthlyReturn:R(T.SYL_Y),quarterlyReturn:R(T.SYL_3Y),yearlyReturn:R(T.SYL_1N),nav:R(T.dwjz),themeCode:e})),total:p.total??0,pageIndex:p.pageindex??i,pageSize:p.pagesize??s}}var B={};at(B,{getCommodityOptionKline:()=>$o,getCommodityOptionSpot:()=>zo,getETFOption5DayMinute:()=>qo,getETFOptionDailyKline:()=>Ho,getETFOptionExpireDay:()=>vo,getETFOptionMinute:()=>Bo,getETFOptionMonths:()=>Uo,getIndexOptionKline:()=>xo,getIndexOptionSpot:()=>wo});function Os(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:a(t[7]),symbol:t[8]??""}}function Ps(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:null,symbol:t[7]??""}}async function wo(t,e){let n=`${Se}?type=futures&product=${t}&exchange=cffex&pinzhong=${e}`,r=await w(n),o=r?.result?.data?.up??[],i=r?.result?.data?.down??[];return{calls:o.map(Os),puts:i.map(Ps)}}async function xo(t){let e=`${Re}?symbol=${t}`,n=await w(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:a(r.o),high:a(r.h),low:a(r.l),close:a(r.c),volume:a(r.v)})):[]}async function Uo(t){let e=`${jt}?exchange=null&cate=${encodeURIComponent(t)}`,r=(await w(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 vo(t,e){let n=`${Qe}?exchange=null&cate=${encodeURIComponent(t)}&date=${e}`,r=await w(n),o=r?.result?.data?.remainderDays;if(typeof o=="number"&&o<0){let s=`${Qe}?exchange=null&cate=${encodeURIComponent("XD"+t)}&date=${e}`;r=await w(s)}let i=r?.result?.data;return{expireDay:i?.expireDay??"",remainderDays:i?.remainderDays??0,stockId:i?.stockId??"",name:i?.other?.name??""}}function Ko(t){let e="";return t.map(n=>(n.d&&(e=n.d),{time:n.i,date:e,price:a(n.p),volume:a(n.v),openInterest:a(n.t),avgPrice:a(n.a)}))}async function Bo(t){let e=`CON_OP_${t}`,n=`${Gt}?symbol=${e}`,o=(await w(n))?.result?.data;return Array.isArray(o)?Ko(o):[]}async function Ho(t){let e=`CON_OP_${t}`,n=`${Qt}?symbol=${e}`,r=await w(n,{callbackMode:"path"});return Array.isArray(r)?r.map(o=>({date:o.d,open:a(o.o),high:a(o.h),low:a(o.l),close:a(o.c),volume:a(o.v)})):[]}async function qo(t){let e=`CON_OP_${t}`,n=`${Wt}?symbol=${e}`,o=(await w(n))?.result?.data;if(!Array.isArray(o))return[];let i=[];for(let s of o)Array.isArray(s)&&i.push(...Ko(s));return i}function Ds(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:a(t[7]),symbol:t[8]??""}}function Is(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:null,symbol:t[7]??""}}async function zo(t,e){let n=We[t];if(!n)throw new S(`Unknown commodity option variety: "${t}". Available: ${Object.keys(We).join(", ")}`);let r=`${Se}?type=futures&product=${n.product}&exchange=${n.exchange}&pinzhong=${e}`,o=await w(r),i=o?.result?.data?.up??[],s=o?.result?.data?.down??[];return{calls:i.map(Ds),puts:s.map(Is)}}async function $o(t){let e=`${Re}?symbol=${t}`,n=await w(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:a(r.o),high:a(r.h),low:a(r.l),close:a(r.c),volume:a(r.v)})):[]}var I=class{constructor(e){this.client=e}};var Ie=class extends I{constructor(n){super(n);this.theme=new Ln(this.client)}getFundDividendList(n){return m.getFundDividendList(this.client,n)}getFundNavHistory(n){return m.getFundNavHistory(this.client,n)}getFundEstimate(n){return m.getFundEstimate(this.client,n)}getFundRankHistory(n){return m.getFundRankHistory(this.client,n)}getFundProfile(n){return m.getFundProfile(this.client,n)}},Ln=class{constructor(e){this.client=e}getThemeList(e){return m.getThemeList(this.client,e)}getThemeFunds(e,n){return m.getThemeFunds(this.client,e,n)}};var be=class extends I{constructor(e){super(e)}getFullQuotes(e){return b.getFullQuotes(this.client,e)}getSimpleQuotes(e){return b.getSimpleQuotes(this.client,e)}getHKQuotes(e){return b.getHKQuotes(this.client,e)}getUSQuotes(e){return b.getUSQuotes(this.client,e)}getFundQuotes(e){return b.getFundQuotes(this.client,e)}getFundFlow(e){return b.getFundFlow(this.client,e)}getPanelLargeOrder(e){return b.getPanelLargeOrder(this.client,e)}getTodayTimeline(e){return b.getTodayTimeline(this.client,e)}search(e){return b.search(this.client,e)}getAShareCodeList(e){return b.getAShareCodeList(this.client,e)}getUSCodeList(e){return b.getUSCodeList(this.client,e)}getHKCodeList(){return b.getHKCodeList(this.client)}getFundCodeList(){return b.getFundCodeList(this.client)}async getAllAShareQuotes(e={}){let{market:n,...r}=e,o=await this.getAShareCodeList({market:n});return b.getAllQuotesByCodes(this.client,o,r)}async getAllHKShareQuotes(e={}){let n=await this.getHKCodeList();return b.getAllHKQuotesByCodes(this.client,n,e)}async getAllUSShareQuotes(e={}){let{market:n,...r}=e,o=await this.getUSCodeList({simple:!0,market:n});return b.getAllUSQuotesByCodes(this.client,o,r)}getAllQuotesByCodes(e,n={}){return b.getAllQuotesByCodes(this.client,e,n)}batchRaw(e){return this.client.getTencentQuote(e)}getTradingCalendar(){return b.getTradingCalendar(this.client)}getDividendDetail(e){return m.getDividendDetail(this.client,e)}};var Me=class extends I{constructor(e){super(e)}getIndustryList(){return m.getIndustryList(this.client)}getIndustrySpot(e){return m.getIndustrySpot(this.client,e)}getIndustryConstituents(e){return m.getIndustryConstituents(this.client,e)}getIndustryKline(e,n){return m.getIndustryKline(this.client,e,n)}getIndustryMinuteKline(e,n){return m.getIndustryMinuteKline(this.client,e,n)}getConceptList(){return m.getConceptList(this.client)}getConceptSpot(e){return m.getConceptSpot(this.client,e)}getConceptConstituents(e){return m.getConceptConstituents(this.client,e)}getConceptKline(e,n){return m.getConceptKline(this.client,e,n)}getConceptMinuteKline(e,n){return m.getConceptMinuteKline(this.client,e,n)}};var Le=class extends I{constructor(e){super(e)}getHistoryKline(e,n){return m.getHistoryKline(this.client,e,n)}getMinuteKline(e,n){return m.getMinuteKline(this.client,e,n)}getHKHistoryKline(e,n){return m.getHKHistoryKline(this.client,e,n)}getHKMinuteKline(e,n){return m.getHKMinuteKline(this.client,e,n)}getUSHistoryKline(e,n){return m.getUSHistoryKline(this.client,e,n)}getUSMinuteKline(e,n){return m.getUSMinuteKline(this.client,e,n)}};var Ne=class extends I{constructor(e){super(e)}getFuturesKline(e,n){return m.getFuturesHistoryKline(this.client,e,n)}getGlobalFuturesSpot(e){return m.getGlobalFuturesSpot(this.client,e)}getGlobalFuturesKline(e,n){return m.getGlobalFuturesKline(this.client,e,n)}getFuturesInventorySymbols(){return m.getFuturesInventorySymbols(this.client)}getFuturesInventory(e,n){return m.getFuturesInventory(this.client,e,n)}getComexInventory(e,n){return m.getComexInventory(this.client,e,n)}};var ke=class extends I{constructor(e){super(e)}getIndexOptionSpot(e,n){return B.getIndexOptionSpot(e,n)}getIndexOptionKline(e){return B.getIndexOptionKline(e)}getCFFEXOptionQuotes(e){return m.getCFFEXOptionQuotes(this.client,e)}getETFOptionMonths(e){return B.getETFOptionMonths(e)}getETFOptionExpireDay(e,n){return B.getETFOptionExpireDay(e,n)}getETFOptionMinute(e){return B.getETFOptionMinute(e)}getETFOptionDailyKline(e){return B.getETFOptionDailyKline(e)}getETFOption5DayMinute(e){return B.getETFOption5DayMinute(e)}getCommodityOptionSpot(e,n){return B.getCommodityOptionSpot(e,n)}getCommodityOptionKline(e){return B.getCommodityOptionKline(e)}getOptionLHB(e,n){return m.getOptionLHB(this.client,e,n)}};var bs=500,Ms=15,Fe=class{constructor(e,n){this.klineService=e;this.quoteService=n}detectMarket(e){let n=kn(e);if(n==="GLOBAL")throw new S(`No kline route for GLOBAL-market symbol '${e}'; use the US kline API with a raw secid instead (e.g. kline.us('100.GDAXI'))`);return n==="HK"?"HK":n==="US"?"US":"A"}calcActualStartDate(e,n,r=1.5){let o=this.toCompactDate(e),i=Math.ceil(n*r),s=new Date(parseInt(o.slice(0,4)),parseInt(o.slice(4,6))-1,parseInt(o.slice(6,8)));s.setDate(s.getDate()-i);let u=s.getFullYear(),l=String(s.getMonth()+1).padStart(2,"0"),c=String(s.getDate()).padStart(2,"0");return`${u}${l}${c}`}calcActualStartDateByCalendar(e,n,r){if(!r||r.length===0)return;let o=r.findIndex(s=>s>=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 S(`\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,s=n.market??this.detectMarket(e),{requiredBars:u,maxRecursiveLookback:l}=xn(r),c={A:1.5,HK:1.46,US:1.45},d;if(o)if(s==="A")try{let P=await this.quoteService.getTradingCalendar();d=this.calcActualStartDateByCalendar(o,u,P)??this.calcActualStartDate(o,u,c[s])}catch{d=this.calcActualStartDate(o,u,c[s])}else d=this.calcActualStartDate(o,u,c[s]);let f={period:n.period,adjust:n.adjust,startDate:d,endDate:i?this.toCompactDate(i):void 0},p;switch(s){case"HK":p=await this.klineService.getHKHistoryKline(e,f);break;case"US":p=await this.klineService.getUSHistoryKline(e,f);break;default:p=await this.klineService.getHistoryKline(e,f)}let y=n.period??"daily",T=30+(y==="weekly"?7:y==="monthly"?31:0),D=p.length===0||d===void 0||this.normalizeRowDate(p[0].date)<=ge(this.normalizeRowDate(d),T),E=!1;if(o&&p.length<u&&D)switch(E=!0,s){case"HK":p=await this.klineService.getHKHistoryKline(e,{...f,startDate:void 0});break;case"US":p=await this.klineService.getUSHistoryKline(e,{...f,startDate:void 0});break;default:p=await this.klineService.getHistoryKline(e,{...f,startDate:void 0})}if(o){let P=p.findIndex(H=>this.normalizeRowDate(H.date)>=o);if(P===-1)return[];let L=p;if(E&&!wn(r)){let H=l>0?Math.max(u,bs,Ms*l):u;L=p.slice(Math.max(0,P-H))}return mt(L,r).filter(H=>{let U=this.normalizeRowDate(H.date);return U>=o&&(i===void 0||U<=i)})}return mt(p,r)}};var we=class extends I{constructor(e){super(e)}getIndividualFundFlow(e,n){return m.getIndividualFundFlow(this.client,e,n)}getMarketFundFlow(){return m.getMarketFundFlow(this.client)}getFundFlowRank(e){return m.getFundFlowRank(this.client,e)}getSectorFundFlowRank(e){return m.getSectorFundFlowRank(this.client,e)}getSectorFundFlowHistory(e,n){return m.getSectorFundFlowHistory(this.client,e,n)}};var xe=class extends I{constructor(e){super(e)}getNorthboundMinute(e){return m.getNorthboundMinute(this.client,e)}getNorthboundFlowSummary(){return m.getNorthboundFlowSummary(this.client)}getNorthboundHoldingRank(e){return m.getNorthboundHoldingRank(this.client,e)}getNorthboundHistory(e,n){return m.getNorthboundHistory(this.client,e,n)}getNorthboundIndividual(e,n){return m.getNorthboundIndividual(this.client,e,n)}};var Ue=class extends I{constructor(e){super(e)}getZTPool(e,n){return m.getZTPool(this.client,e,n)}getStockChanges(e){return m.getStockChanges(this.client,e)}getBoardChanges(){return m.getBoardChanges(this.client)}};var ve=class extends I{constructor(e){super(e)}getDragonTigerDetail(e){return m.getDragonTigerDetail(this.client,e)}getDragonTigerStockStats(e){return m.getDragonTigerStockStats(this.client,e)}getDragonTigerInstitution(e){return m.getDragonTigerInstitution(this.client,e)}getDragonTigerBranchRank(e){return m.getDragonTigerBranchRank(this.client,e)}getDragonTigerStockSeatDetail(e,n){return m.getDragonTigerStockSeatDetail(this.client,e,n)}};var Ke=class extends I{constructor(e){super(e)}getBlockTradeMarketStat(){return m.getBlockTradeMarketStat(this.client)}getBlockTradeDetail(e){return m.getBlockTradeDetail(this.client,e)}getBlockTradeDailyStat(e){return m.getBlockTradeDailyStat(this.client,e)}getMarginAccountInfo(){return m.getMarginAccountInfo(this.client)}getMarginTargetList(e){return m.getMarginTargetList(this.client,e)}};var Nn=class{constructor(e={}){this._ns={};this.client=new Ae(e),this.quoteService=new be(this.client),this.boardService=new Me(this.client),this.klineService=new Le(this.client),this.futuresService=new Ne(this.client),this.optionsService=new ke(this.client),this.indicatorService=new Fe(this.klineService,this.quoteService),this.fundFlowService=new we(this.client),this.northboundService=new xe(this.client),this.marketEventService=new Ue(this.client),this.dragonTigerService=new ve(this.client),this.dataService=new Ke(this.client),this.tradingCalendarService=new Oe(this.quoteService),this.fundService=new Ie(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),profile:e.getFundProfile.bind(e),theme:e.theme}})}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)}},Kd=Nn;export{gt as a,ft as b,h as c,C as d,ce as e,de as f,qe as g,w as h,pe as i,ni as j,se as k,Tt as l,_ as m,ae as n,N as o,Rt as p,Et as q,Oe as r,Ie as s,Nn as t,Kd as u};
1
+ import{t as wn,v as xn,w as mt}from"./chunk-6ZSZEHZW.js";import{d as pt,e as J,f as kn,g as Fn,i as ee}from"./chunk-ZZ2IBUMV.js";import{b as ne}from"./chunk-DU7MCVLJ.js";import{a as A,b as j,c as Z,d as ut,e as S,f as lt,g as ct,h as dt,k as X,l as Be}from"./chunk-UBIQBXQ7.js";import{a as at}from"./chunk-WOT6VMZA.js";function gt(t){return new TextDecoder("gbk").decode(t)}function ft(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 s=r.slice(o+1).trim();s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1));let u=s.split("~");n.push({key:i,fields:u})}return n}function yt(t){let e=t.trim();return e===""||e==="-"||e==="--"}function h(t){if(!t||t==="")return 0;let e=parseFloat(t);return Number.isNaN(e)?0:e}function C(t){if(!t||yt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function g(t){if(!t||yt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function a(t){return t==null?null:g(String(t))}function R(t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;if(yt(t))return null;let e=Number(t);return Number.isFinite(e)?e:null}var Go=new Set(["daily","weekly","monthly"]),Qo=new Set(["1","5","15","30","60"]),Wo=new Set(["","qfq","hfq"]);function G(t,e){if(!Number.isFinite(t)||!Number.isInteger(t)||t<=0)throw new S(`${e} must be a positive integer`,{argument:e,value:t})}function q(t){if(!Go.has(t))throw new S("period must be one of: daily, weekly, monthly",{argument:"period",value:t})}function ht(t){if(!Qo.has(t))throw new S("period must be one of: 1, 5, 15, 30, 60",{argument:"period",value:t})}function W(t){if(!Wo.has(t))throw new S("adjust must be one of: '', 'qfq', 'hfq'",{argument:"adjust",value:t})}function He(t){if(t!=="north"&&t!=="south")throw new S("direction must be one of: 'north', 'south'",{argument:"direction",value:t})}function ce(t,e){G(e,"chunkSize");let n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}async function de(t,e,n=!1){if(G(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 s=o++;if(s>=t.length)return;let u=await t[s]();n?r[s]=u:r.push(u)}});return await Promise.all(i),r}function z(t){return{daily:"101",weekly:"102",monthly:"103"}[t]}function V(t){return{"":"0",qfq:"1",hfq:"2"}[t]}var Vo=typeof document<"u"&&typeof window<"u",Zo=0;function Un(){return`__stock_sdk_jsonp_${Date.now()}_${Zo++}`}function qe(t){let e=t,n=e.indexOf("*/");n!==-1&&(e=e.slice(n+2).trim());let r=e.indexOf("(");if(r===-1)throw new A({code:"PARSE_ERROR",message:"Invalid JSONP response: no opening parenthesis found"});let o=e.lastIndexOf(")");if(o===-1||o<=r)throw new 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(s){throw new A({code:"PARSE_ERROR",message:"Invalid JSONP response: payload is not valid JSON",cause:s})}}function Xo(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e;return new Promise((i,s)=>{let u=Un(),l;if(o==="path")l=t.replace("{callback}",u);else{let T=t.includes("?")?"&":"?";l=`${t}${T}${r}=${u}`}let c=document.createElement("script"),d=!1,f=window,p=()=>{c.parentNode&&c.parentNode.removeChild(c),delete f[u]},y=setTimeout(()=>{d||(d=!0,p(),s(new A({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);f[u]=T=>{d||(d=!0,clearTimeout(y),p(),i(T))},c.onerror=()=>{d||(d=!0,clearTimeout(y),p(),s(new A({code:"NETWORK_ERROR",message:`JSONP script load failed: ${t}`,url:t})))},c.src=l,document.head.appendChild(c)})}async function Jo(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e,i=Un(),s;if(o==="path")s=t.replace("{callback}",i);else{let c=t.includes("?")?"&":"?";s=`${t}${c}${r}=${i}`}let u=new AbortController,l=setTimeout(()=>u.abort(),n);try{let c=await fetch(s,{signal:u.signal});if(!c.ok)throw new j(c.status,c.statusText,t);let d=await c.text();return qe(d)}catch(c){throw c instanceof DOMException&&c.name==="AbortError"?new A({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):c instanceof A?c:new A({code:"NETWORK_ERROR",message:`JSONP request failed: ${c instanceof Error?c.message:String(c)}`,url:t,cause:c})}finally{clearTimeout(l)}}function w(t,e={}){return Vo?Xo(t,e):Jo(t,e)}var vn=new Map;async function pe(t,e){let r=(vn.get(t)??Promise.resolve()).then(e,e);return vn.set(t,r.then(()=>{},()=>{})),r}function ei(){return typeof document<"u"&&typeof window<"u"}var ti=15e3,ni="jsVars";async function se(t,e,n={}){let r=n.timeout??ti;return ei()?pe(ni,()=>ri(t,e,r)):oi(t,e,r,n.headers,n.client)}function Tt(t,e){let n={};for(let r of e){let o=ii(t,r);o!==void 0&&(n[r]=o)}return n}function ri(t,e,n){return new Promise((r,o)=>{let i=document.createElement("script"),s=!1,u=()=>{i.parentNode&&i.parentNode.removeChild(i)},l=setTimeout(()=>{s||(s=!0,u(),o(new A({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);i.onload=()=>{if(s)return;s=!0,clearTimeout(l);let c=window,d={};for(let f of e)if(f in c){d[f]=c[f];try{delete c[f]}catch{}}u(),r(d)},i.onerror=()=>{s||(s=!0,clearTimeout(l),u(),o(new A({code:"NETWORK_ERROR",message:`fetchJsVars script load failed: ${t}`,url:t})))},i.src=t,document.head.appendChild(i)})}async function oi(t,e,n,r,o){if(o){let u=await o.get(t,{responseType:"text"});return Tt(u,e)}let i=new AbortController,s=setTimeout(()=>i.abort(),n);try{let u=await fetch(t,{signal:i.signal,headers:r});if(!u.ok)throw new j(u.status,u.statusText,t);let l=await u.text();return Tt(l,e)}catch(u){throw u instanceof DOMException&&u.name==="AbortError"?new A({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):u instanceof A?u:new A({code:"NETWORK_ERROR",message:`fetchJsVars failed: ${u instanceof Error?u.message:String(u)}`,url:t,cause:u})}finally{clearTimeout(s)}}function ii(t,e){let r=new RegExp(`(?:^|[^\\w$])(?:var|let|const)\\s+${ai(e)}\\s*=\\s*`,"m").exec(t);if(!r)return;let o=r.index+r[0].length,i=ui(t,o),s=t.slice(o,i).trim();try{return JSON.parse(s)}catch{try{return JSON.parse(si(s))}catch{return}}}function si(t){let e="",n=null;for(let r=0;r<t.length;r++){let o=t[r];if(n==='"'){e+=o,o==="\\"&&r+1<t.length?e+=t[++r]:o==='"'&&(n=null);continue}if(n==="'"){if(o==="\\"&&r+1<t.length){let i=t[++r];e+=i==="'"?"'":"\\"+i;continue}if(o==="'"){e+='"',n=null;continue}e+=o==='"'?'\\"':o;continue}if(o==='"'){n='"',e+=o;continue}if(o==="'"){n="'",e+='"';continue}e+=o}return e}function ai(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ui(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 _={CN:"Asia/Shanghai",HK:"Asia/Hong_Kong",US:"America/New_York"};function li(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 ci={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"}}},Kn=new Map;function St(t,e){let n=ci[t],r=n.keyPrefix+e,o=Kn.get(r);return o||(o=new Intl.DateTimeFormat(n.locale,{timeZone:e,...n.options}),Kn.set(r,o)),o}function me(t,e){let r=St("wallParts",e).formatToParts(new Date(t)),o={};for(let s of r)s.type!=="literal"&&(o[s.type]=s.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 Bn=new Map;function Hn(t,e){return me(t,e)-t}function di(t,e){let n=`${t}|${e}`,r=Bn.get(n);if(r===void 0){let o=Hn(Date.UTC(e,0,1,12),t);for(let i=1;i<12;i++)if(Hn(Date.UTC(e,i,1,12),t)!==o){o=null;break}r=o,Bn.set(n,r)}return r}function qn(t,e){if(!(t.month===1&&t.day<=2||t.month===12&&t.day>=30)){let s=di(e,t.year);if(s!==null)return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)-s}let r=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second),o=2*r-me(r,e);if(me(o,e)===r)return o;let i=r-me(o,e)+o;return me(i,e)===r?i:o}function pi(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 ae(t,e){let n=li(t);return n?qn(n,e):NaN}function re(t){return Number.isNaN(t)?null:t}function N(t,e){return{timestamp:re(ae(t,e)),tz:e}}function ge(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 Rt(t,e,n){let r=pi(t,e);return r?{timestamp:re(qn(r,n)),tz:n}:{timestamp:null,tz:n}}function Et(t,e){if(t==null||!Number.isFinite(t))return"";let n=St("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 Q(t,e=Date.now()){return St("dateOnly",t).format(new Date(e))}var _t="https://qt.gtimg.cn",Ct="https://web.ifzq.gtimg.cn/appstock/app/minute/query",At="https://assets.linkdiary.cn/shares/zh_a_list.json",Ot="https://assets.linkdiary.cn/shares/us_list.json",Pt="https://assets.linkdiary.cn/shares/hk_list.json",ze="https://assets.linkdiary.cn/shares/fund_list",Dt="https://assets.linkdiary.cn/shares/trade-data-list.txt",$e="https://push2his.eastmoney.com/api/qt/stock/kline/get",It="https://push2his.eastmoney.com/api/qt/stock/trends2/get",Ye="https://33.push2his.eastmoney.com/api/qt/stock/kline/get",je="https://63.push2his.eastmoney.com/api/qt/stock/kline/get",bt="https://33.push2his.eastmoney.com/api/qt/stock/trends2/get",Mt="https://63.push2his.eastmoney.com/api/qt/stock/trends2/get",Lt="https://17.push2.eastmoney.com/api/qt/clist/get",Nt="https://91.push2.eastmoney.com/api/qt/stock/get",kt="https://29.push2.eastmoney.com/api/qt/clist/get",Ft="https://7.push2his.eastmoney.com/api/qt/stock/kline/get",wt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",xt="https://79.push2.eastmoney.com/api/qt/clist/get",Ut="https://91.push2.eastmoney.com/api/qt/stock/get",vt="https://29.push2.eastmoney.com/api/qt/clist/get",Kt="https://91.push2his.eastmoney.com/api/qt/stock/kline/get",Bt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",Ht="https://datacenter-web.eastmoney.com/api/data/v1/get",fe="https://push2his.eastmoney.com/api/qt/stock/fflow/daykline/get",qt="https://push2.eastmoney.com/api/qt/clist/get",zt="https://push2.eastmoney.com/api/qt/kamtbs.rtmin/get",ye="https://push2ex.eastmoney.com",k="7eea3edcaed734bea9cbfc24409ed989",$="b2884a393a59ad64002292a3e90d46a5",he="https://push2his.eastmoney.com/api/qt/stock/kline/get",$t="https://futsseapi.eastmoney.com/list/COMEX,NYMEX,COBOT,SGX,NYBOT,LME,MDEX,TOCOM,IPE",Te="58b2fa8f54638b60b87d69b31969089c",Yt={SHFE:113,DCE:114,CZCE:115,INE:142,CFFEX:220,GFEX:225},ue={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"},Ge={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},Se="https://stock.finance.sina.com.cn/futures/api/openapi.php/OptionService.getOptionData",Re="https://stock.finance.sina.com.cn/futures/api/jsonp.php/{callback}/FutureOptionAllService.getOptionDayline",jt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getStockName",Qe="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getRemainderDay",Gt="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",Wt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getFiveDayLine",Vt="https://futsseapi.eastmoney.com/list/option/221",Zt="https://datacenter-web.eastmoney.com/api/data/get";var We={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"}},Xt=3e4,Ee=500,_e=500,Ce=7,Jt=3,en=1e3,tn=3e4,nn=2,rn=[408,429,500,502,503,504];var Ve=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 zn=["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"],on=0;function mi(){return typeof window<"u"&&typeof window.document<"u"}function $n(){if(mi())return;let t=zn[on];return on=(on+1)%zn.length,t}var le=class extends A{constructor(e="Circuit breaker is OPEN"){super({code:"CIRCUIT_OPEN",message:e}),this.name="CircuitBreakerError"}},Ze=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 le;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 gi=3e4,fi=1,Yn=["push2his.eastmoney.com","7.push2his.eastmoney.com","33.push2his.eastmoney.com","63.push2his.eastmoney.com","91.push2his.eastmoney.com"],jn=["17.push2.eastmoney.com","29.push2.eastmoney.com","79.push2.eastmoney.com","91.push2.eastmoney.com"];function yi(t,e){return e!=="eastmoney"?[t]:t.includes("push2his.eastmoney.com")?Yn:t.includes("push2.eastmoney.com")?jn:[t]}function hi(t){return Array.from(new Set(t))}var Xe=class{constructor(e=gi,n=fi){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=yi(r.hostname,n);if(i.length<=1)return[e];let s=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 hi([...s.includes(r.hostname)?[r.hostname]:[],...s.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 j?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([...Yn,...jn]);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 Ti(t){return{maxRetries:t?.maxRetries??Jt,baseDelay:t?.baseDelay??en,maxDelay:t?.maxDelay??tn,backoffMultiplier:t?.backoffMultiplier??nn,retryableStatusCodes:t?.retryableStatusCodes??rn,retryOnNetworkError:t?.retryOnNetworkError??!0,retryOnTimeout:t?.retryOnTimeout??!0,onRetry:t?.onRetry}}function Si(t,e){let n={...t??{}};return e&&(Object.keys(n).some(o=>o.toLowerCase()==="user-agent")||(n["User-Agent"]=e)),n}function Gn(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 sn(t={}){return{timeout:t.timeout??Xt,retry:Ti(t.retry),headers:Si(t.headers,t.userAgent),rotateUserAgent:t.rotateUserAgent??!1,rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function Qn(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 Wn(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 an=()=>{};function Ri(t){let e=t.filter(u=>!!u);if(e.length===0)return{signal:void 0,cleanup:an};if(e.length===1)return{signal:e[0],cleanup:an};let n=AbortSignal.any;if(typeof n=="function")return{signal:n(e),cleanup:an};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 s=()=>{for(let{s:u,handler:l}of i)u.removeEventListener("abort",l)};return{signal:r.signal,cleanup:s}}async function Ei(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 Ae=class{constructor(e={}){this.baseUrl=e.baseUrl??_t;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=sn(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=Gn(n,o);this.providerPolicies[r]=sn(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 Ve(r.rateLimit):null,circuitBreaker:r.circuitBreaker?new Ze(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 A?e:new A({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 j?r.retryableStatusCodes.includes(e.status):!1}async executeWithRetry(e,n,r,o=0){try{return await e(o)}catch(i){let s=Be(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(s))),this.safe(()=>this.hooks?.trace?.("error",u)),this.shouldRetry(s,o,n)){let l=this.calculateDelay(o,n);return n.onRetry&&n.onRetry(o+1,s,l),this.safe(()=>this.hooks?.onRetry?.(u,this.toSdkError(s),l)),this.safe(()=>this.hooks?.trace?.("retry",u)),await this.sleep(l),this.executeWithRetry(e,n,r,o+1)}throw s}}async performRequest(e,n,r,o="text",i={},s=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:f}=Ri([u.signal,i.signal,this.clientSignal]),p=i.fetchImpl??this.fetchImpl??globalThis.fetch,y={...n.policy.headers};if(n.policy.rotateUserAgent){let E=$n();if(E){for(let P of Object.keys(y))P.toLowerCase()==="user-agent"&&delete y[P];y["User-Agent"]=E}}let T={provider:r,url:e,timeout:n.policy.timeout,attempt:s,responseType:o};this.safe(()=>this.hooks?.onRequest?.(T)),this.safe(()=>this.hooks?.trace?.("request",T));let D=Date.now();try{let E=await Ei(d,p(e,{signal:d,headers:y}));if(this.safe(()=>this.hooks?.onResponse?.(T,{status:E.status,durationMs:Date.now()-D})),this.safe(()=>this.hooks?.trace?.("response",T)),!E.ok)throw new j(E.status,E.statusText,e,r);switch(o){case"json":try{return await E.json()}catch(P){throw new A({code:"PARSE_ERROR",message:`Failed to parse JSON response from ${e}`,provider:r,url:e,cause:P})}case"arraybuffer":return await E.arrayBuffer();default:return await E.text()}}catch(E){let P=L=>L?.aborted?E===L.reason?!0:E instanceof Error&&E.cause===L.reason:!1;if(!P(u.signal)){let L=i.signal?.aborted||this.clientSignal?.aborted;if(P(i.signal)||P(this.clientSignal)||L&&Wn(E))throw new dt("Request aborted by external signal",r,e);if(u.signal.aborted&&Wn(E))throw l}throw E}finally{clearTimeout(c),f()}}async get(e,n={}){let r=Qn(e,n.provider),o=this.getProviderState(r);if(o.circuitBreaker&&!o.circuitBreaker.canRequest())throw new le("Circuit breaker is OPEN, request rejected");let i={fetchImpl:n.fetchImpl,signal:n.signal},s=this.fallbackManager.getCandidateUrls(e,r),u;for(let l=0;l<s.length;l++){let c=s[l],d=l===0?o.policy.retry:{...o.policy.retry,maxRetries:0};try{let f=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),f}catch(f){let p=Be(f,{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<s.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 le("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=gt(r);return ft(o)}};var x=(t,e)=>t*60+e,_i={A:{tz:_.CN,open:[[x(9,30),x(11,30)],[x(13,0),x(15,0)]],lunchBreak:[x(11,30),x(13,0)],tradingWeekdays:[1,2,3,4,5]},HK:{tz:_.HK,open:[[x(9,30),x(12,0)],[x(13,0),x(16,0)]],lunchBreak:[x(12,0),x(13,0)],tradingWeekdays:[1,2,3,4,5]},US:{tz:_.US,open:[[x(9,30),x(16,0)]],tradingWeekdays:[1,2,3,4,5]}};function un(t,e){if(t==null)return Q(e);if(t instanceof Date)return Q(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 Q(e,r.getTime());throw new S(`Unsupported date input: ${JSON.stringify(t)}. Expected 'YYYY-MM-DD', 'YYYYMMDD', or Date.`)}function Ci(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 ln(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 Oe=class{constructor(e){this.quoteService=e}async isTradingDay(e){let n=un(e,_.CN),r=await this.quoteService.getTradingCalendar(),o=ln(r,n);return o<r.length&&r[o]===n}async nextTradingDay(e){let n=un(e,_.CN),r=await this.quoteService.getTradingCalendar(),o=ln(r,n);if(o<r.length&&r[o]===n&&(o+=1),o>=r.length)throw new S(`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=un(e,_.CN),r=await this.quoteService.getTradingCalendar(),i=ln(r,n)-1;if(i<0)throw new S(`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=_i[e],{minutes:o,weekday:i}=Ci(n,r.tz);if(!r.tradingWeekdays.includes(i))return"closed";let s=r.open[0][0],u=r.open[r.open.length-1][1];if(o<s)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 b={};at(b,{getAShareCodeList:()=>nr,getAllHKQuotesByCodes:()=>sr,getAllQuotesByCodes:()=>ir,getAllUSQuotesByCodes:()=>ar,getFullQuotes:()=>Je,getFundCodeList:()=>ur,getFundFlow:()=>Zn,getFundQuotes:()=>Jn,getHKCodeList:()=>or,getHKQuotes:()=>et,getPanelLargeOrder:()=>Xn,getSimpleQuotes:()=>Vn,getTodayTimeline:()=>er,getTradingCalendar:()=>lr,getUSCodeList:()=>rr,getUSQuotes:()=>tt,parseFullQuote:()=>cn,parseFundFlow:()=>pn,parseFundQuote:()=>yn,parseHKQuote:()=>gn,parsePanelLargeOrder:()=>mn,parseSimpleQuote:()=>dn,parseUSQuote:()=>fn,search:()=>dr});function cn(t){let e=[];for(let i=0;i<5;i++)e.push({price:h(t[9+i*2]),volume:h(t[10+i*2])});let n=[];for(let i=0;i<5;i++)n.push({price:h(t[19+i*2]),volume:h(t[20+i*2])});let r=t[30]??"",o=N(r,_.CN);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),prevClose:h(t[4]),open:h(t[5]),volume:h(t[6]),outerVolume:h(t[7]),innerVolume:h(t[8]),bid:e,ask:n,time:r,timestamp:o.timestamp,tz:o.tz,change:h(t[31]),changePercent:h(t[32]),high:h(t[33]),low:h(t[34]),volume2:h(t[36]),amount:h(t[37]),turnoverRate:C(t[38]),pe:C(t[39]),amplitude:C(t[43]),circulatingMarketCap:C(t[44]),totalMarketCap:C(t[45]),pb:C(t[46]),limitUp:C(t[47]),limitDown:C(t[48]),volumeRatio:C(t[49]),avgPrice:C(t[51]),peStatic:C(t[52]),peDynamic:C(t[53]),high52w:C(t[67]),low52w:C(t[68]),circulatingShares:C(t[72]),totalShares:C(t[73]),market:"CN",assetType:"stock",source:"tencent"}}function dn(t){return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),change:h(t[4]),changePercent:h(t[5]),volume:h(t[6]),amount:h(t[7]),marketCap:C(t[9]),marketType:t[10]??"",market:"CN",assetType:"stock",source:"tencent"}}function pn(t){let e=t[13]??"",n=N(e,_.CN);return{code:t[0]??"",mainInflow:h(t[1]),mainOutflow:h(t[2]),mainNet:h(t[3]),mainNetRatio:h(t[4]),retailInflow:h(t[5]),retailOutflow:h(t[6]),retailNet:h(t[7]),retailNetRatio:h(t[8]),totalFlow:h(t[9]),name:t[12]??"",date:e,timestamp:n.timestamp,tz:n.tz}}function mn(t){return{buyLargeRatio:h(t[0]),buySmallRatio:h(t[1]),sellLargeRatio:h(t[2]),sellSmallRatio:h(t[3])}}function gn(t){let e=t[30]??"",n=N(e,_.HK);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),prevClose:h(t[4]),open:h(t[5]),volume:h(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:h(t[31]),changePercent:h(t[32]),high:h(t[33]),low:h(t[34]),amount:h(t[37]),lotSize:C(t[40]),circulatingMarketCap:C(t[44]),totalMarketCap:C(t[45]),currency:t[t.length-3]??"",market:"HK",assetType:"stock",source:"tencent"}}function fn(t){let e=t[30]??"",n=N(e,_.US);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:h(t[3]),prevClose:h(t[4]),open:h(t[5]),volume:h(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:h(t[31]),changePercent:h(t[32]),high:h(t[33]),low:h(t[34]),amount:h(t[37]),turnoverRate:C(t[38]),pe:C(t[39]),amplitude:C(t[43]),totalMarketCap:C(t[45]),pb:C(t[47]),high52w:C(t[48]),low52w:C(t[49]),market:"US",assetType:"stock",source:"tencent"}}function yn(t){let e=t[8]??"",n=N(e,_.CN);return{code:t[0]??"",name:t[1]??"",nav:h(t[5]),accNav:h(t[6]),change:h(t[7]),navDate:e,timestamp:n.timestamp,tz:n.tz,market:"CN",assetType:"fund",source:"tencent"}}async function Je(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=>cn(o.fields))}async function Vn(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=>dn(i.fields))}async function Zn(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=>pn(i.fields))}async function Xn(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=>mn(i.fields))}async function et(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=>gn(i.fields))}async function tt(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=>fn(i.fields))}async function Jn(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=>yn(i.fields))}async function er(t,e){let n=`${Ct}?code=${encodeURIComponent(e)}`,r=await t.get(n,{responseType:"json",provider:"tencent"});if(r.code!==0)throw new ct(r.msg||"API error","tencent",n);let o=r.data?.[e];if(!o){let p=N("",_.CN);return{code:e,date:"",timestamp:p.timestamp,tz:p.tz,preClose:0,data:[]}}let i=o.data?.data??[],s=o.data?.date??"",u=o.qt?.[e]??[],l=parseFloat(u[4]??"")||0,c=!1;for(let p of i){let y=p.split(" "),T=parseFloat(y[1])||0,D=parseInt(y[2],10)||0,E=parseFloat(y[3])||0;if(D>0&&T>0){E/D>T*50&&(c=!0);break}}let d=i.map(p=>{let y=p.split(" "),T=y[0],D=`${T.slice(0,2)}:${T.slice(2,4)}`,E=parseInt(y[2],10)||0,P=parseFloat(y[3])||0,L=c?E*100:E,H=L>0?P/L:0,U=Rt(s,D,_.CN);return{time:D,timestamp:U.timestamp,tz:U.tz,price:parseFloat(y[1])||0,volume:L,amount:P,avgPrice:Math.round(H*100)/100}}),f=N(s,_.CN);return{code:e,date:s,timestamp:f.timestamp,tz:f.tz,preClose:l,data:d}}var tr=ne("tencent:code-lists",{defaultTTL:360*60*1e3,maxSize:16});async function hn(t,e,n){return tr.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 Z(`\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E: ${e}`,"tencent",n);return o})}function Ai(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 nr(t,e){let n=e?.simple??!1,r=e?.market,i=await hn(t,"a-share:full",At);return r&&(i=i.filter(s=>Ai(s,r))),n?i.map(s=>s.replace(/^(sh|sz|bj)/,"")):i.slice()}async function rr(t,e){let n=e?.simple??!1,r=e?.market,i=(await hn(t,"us:full",Ot)).slice();if(r){let s=`${Fn[r]}.`;i=i.filter(u=>u.startsWith(s))}return n?i.map(s=>s.replace(/^\d{3}\./,"")):i}async function or(t){return(await hn(t,"hk:full",Pt)).slice()}async function ir(t,e,n={}){let{batchSize:r=Ee,concurrency:o=Ce,onProgress:i}=n;G(r,"batchSize"),G(o,"concurrency");let s=Math.min(r,_e),u=ce(e,s),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 de(d,o,!0)).flat()}async function sr(t,e,n={}){let{batchSize:r=Ee,concurrency:o=Ce,onProgress:i}=n;G(r,"batchSize"),G(o,"concurrency");let s=Math.min(r,_e),u=ce(e,s),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 de(d,o,!0)).flat()}async function ar(t,e,n={}){let{batchSize:r=Ee,concurrency:o=Ce,onProgress:i}=n;G(r,"batchSize"),G(o,"concurrency");let s=Math.min(r,_e),u=ce(e,s),l=u.length,c=0,d=u.map(p=>async()=>{let y=await tt(t,p);return c++,i&&i(c,l),y});return(await de(d,o,!0)).flat()}async function ur(t){return(await tr.getOrFetch("fund:full",async()=>{let o=(await t.get(ze,{responseType:"text"})??"").split(",").slice(1).filter(i=>i.trim());if(o.length===0)throw new Z("\u57FA\u91D1\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",ze);return o})).slice()}var Oi=ne("tencent:trade-calendar",{defaultTTL:720*60*1e3,maxSize:4});async function lr(t){return(await Oi.getOrFetch("a-share",async()=>{let r=(await t.get(Dt)??"").trim().split(",").map(o=>o.trim()).filter(o=>o.length>0);if(r.length===0)throw new Z("\u4EA4\u6613\u65E5\u5386\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",Dt);return r})).slice()}var cr="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 Di(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 Ii(t){return!t||t==="N"?[]:t.split("^").filter(Boolean).map(n=>{let r=n.split("~"),o=r[0]||"",i=r[1]||"",s=Pi(r[2]||""),u=r[4]||"";return{code:o+i,name:s,market:o,type:u,category:Di(u)}})}function bi(t){return new Promise((e,n)=>{let r=`${cr}?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 A({code:"NETWORK_ERROR",message:"Network error calling Smartbox",url:r}))},document.body.appendChild(o)})}async function Mi(t,e){let n=`${cr}?v=2&t=all&q=${encodeURIComponent(e)}`,o=(await t.get(n)).match(/v_hint="([^"]*)"/);return o?o[1]:""}function Li(){return typeof window<"u"&&typeof document<"u"}async function dr(t,e){if(!e||!e.trim())return[];let n;return Li()?n=await bi(e):n=await Mi(t,e),Ii(n)}var m={};at(m,{extractVariety:()=>On,fetchDatacenter:()=>Sn,fetchDatacenterList:()=>O,getBlockTradeDailyStat:()=>bo,getBlockTradeDetail:()=>Io,getBlockTradeMarketStat:()=>Do,getBoardChanges:()=>So,getCFFEXOptionQuotes:()=>Wr,getComexInventory:()=>eo,getConceptConstituents:()=>Fr,getConceptKline:()=>wr,getConceptList:()=>Nr,getConceptMinuteKline:()=>xr,getConceptSpot:()=>kr,getDividendDetail:()=>Ur,getDragonTigerBranchRank:()=>Ao,getDragonTigerDetail:()=>Eo,getDragonTigerInstitution:()=>Co,getDragonTigerStockSeatDetail:()=>Oo,getDragonTigerStockStats:()=>_o,getFundDividendList:()=>vr,getFundEstimate:()=>Br,getFundFlowRank:()=>ao,getFundNavHistory:()=>Kr,getFundProfile:()=>$r,getFundRankHistory:()=>Hr,getFuturesHistoryKline:()=>jr,getFuturesInventory:()=>Jr,getFuturesInventorySymbols:()=>Xr,getFuturesMarketCode:()=>Pn,getGlobalFuturesKline:()=>Qr,getGlobalFuturesSpot:()=>Gr,getHKHistoryKline:()=>yr,getHKMinuteKline:()=>hr,getHistoryKline:()=>gr,getHotThemes:()=>ko,getIndividualFundFlow:()=>io,getIndustryConstituents:()=>br,getIndustryKline:()=>Mr,getIndustryList:()=>Dr,getIndustryMinuteKline:()=>Lr,getIndustrySpot:()=>Ir,getMarginAccountInfo:()=>Mo,getMarginTargetList:()=>Lo,getMarketFundFlow:()=>so,getMinuteKline:()=>fr,getNorthboundFlowSummary:()=>mo,getNorthboundHistory:()=>fo,getNorthboundHoldingRank:()=>go,getNorthboundIndividual:()=>yo,getNorthboundMinute:()=>po,getOptionLHB:()=>Vr,getSectorFundFlowHistory:()=>lo,getSectorFundFlowRank:()=>uo,getStockChanges:()=>To,getThemeFunds:()=>Fo,getThemeList:()=>No,getUSHistoryKline:()=>Tr,getUSMinuteKline:()=>Sr,getZTPool:()=>ho});function M(t){return/^\d{8}$/.test(t)?`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6,8)}`:t}function pr(t,e){let n=i=>M(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 mr(t,e,n=0){let r=s=>{if(!s)return;let u=/^(\d{4})-?(\d{2})-?(\d{2})/.exec(s.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=ge(`${i.slice(0,4)}-${i.slice(4,6)}-${i.slice(6,8)}`,n).replace(/-/g,"")),{beg:o,end:i??"20500000"}}async function Tn(t,e,n,r,o=100,i){let s=[],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((T,D)=>i(T,s.length+D+1));if(s.push(...y),y.length===0)break;u++}while(s.length<l);return s}function v(t){let[e,n,r,o,i,s,u,l,c,d,f]=t.split(",");return{date:e,open:g(n),close:g(r),high:g(o),low:g(i),volume:g(s),amount:g(u),amplitude:g(l),changePercent:g(c),change:g(d),turnoverRate:g(f)}}async function K(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 Ni(t){let[e,n,r,o,i,s,u,l]=t.split(",");return{time:e,open:g(n),close:g(r),high:g(o),low:g(i),volume:g(s),amount:g(u),avgPrice:g(l)}}function nt(t,e){let n=r=>{let o=ae(r,_.CN);return{time:Et(o,t)||r,timestamp:re(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 te(t){return async function(n,r,o={}){let i=o.period??t.defaultPeriod;ht(i),t.fqt==="option"&&W(o.adjust??"qfq");let s=t.resolveTarget(r),u=t.window,l=p=>{if(u.mode==="full")return p;let{start:y,end:T}=pr(o.startDate??"1979-09-01 09:32:00",o.endDate??"2222-01-01 09:32:00");return p.filter(D=>D.time>=y&&D.time<=T)};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:s.secid}),y=`${t.trendsUrl}?${p.toString()}`,D=(await n.get(y,{responseType:"json"}))?.data?.trends;return!Array.isArray(D)||D.length===0?[]:l(D.map(E=>t.mapTrendRow(Ni(E),s)))}let c=u.mode==="filter"?mr(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"?V(o.adjust??"qfq"):t.fqt.fixed,secid:s.secid,beg:c.beg,end:c.end,...t.extraKlineParams??{}}),{klines:f}=await K(n,t.klineUrl,d);return!Array.isArray(f)||f.length===0?[]:l(f.map(p=>t.mapKlineRow(v(p),s)))}}async function gr(t,e,n={}){let{period:r="daily",adjust:o="qfq",startDate:i="19700101",endDate:s="20500101"}=n;q(r),W(o);let u=J(e,{market:"CN"}),l=ee(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:z(r),fqt:V(o),secid:l,beg:i,end:s}),d=$e,{klines:f}=await K(t,d,c);return f.length===0?[]:f.map(p=>{let y=v(p),T=N(y.date,_.CN);return{...y,timestamp:T.timestamp,tz:T.tz,code:u.code}})}var ki=te({trendsUrl:It,klineUrl:$e,resolveTarget:t=>{let e=J(t,{market:"CN"});return{secid:ee(e),code:e.code}},defaultPeriod:"1",ndays:{fixed:"5"},fqt:"option",includeUt:!0,window:{mode:"filter"},mapTrendRow:({time:t,...e})=>{let n=N(t,_.CN);return{time:t,timestamp:n.timestamp,tz:n.tz,...e}},mapKlineRow:t=>{let e=N(t.date,_.CN);return{...t,time:t.date,timestamp:e.timestamp,tz:e.tz}}});async function fr(t,e,n={}){return ki(t,e,n)}function rt(t){return async function(n,r,o={}){let{period:i="daily",adjust:s="qfq",startDate:u="19700101",endDate:l="20500101"}=o;q(i),W(s);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:z(i),fqt:V(s),secid:c.secid,beg:u,end:l,lmt:"1000000"}),{klines:f,name:p,code:y}=await K(n,t.url,d);if(f.length===0)return[];let T=t.resolveResultMeta?t.resolveResultMeta(r,c,{code:y,name:p}):{code:y||c.fallbackCode,name:p||""};return f.map(D=>{let E=v(D),P=N(E.date,t.tz),L={...E,timestamp:P.timestamp,tz:P.tz,code:T.code,name:T.name};return t.enrichItem(L)})}}var Fi=rt({url:Ye,tz:_.HK,normalizeSymbol:t=>{let e=J(t,{market:"HK"});return{secid:ee(e),fallbackCode:e.code}},enrichItem:t=>({...t,currency:"HKD",lotSize:null})});async function yr(t,e,n={}){return Fi(t,e,n)}var wi=te({trendsUrl:bt,klineUrl:Ye,resolveTarget:t=>{let e=J(t,{market:"HK"});return{secid:ee(e),code:e.code}},defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter"},...nt(_.HK,"HKD")});async function hr(t,e,n={}){return wi(t,e,n)}var xi=rt({url:je,tz:_.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 Tr(t,e,n={}){return xi(t,e,n)}var Ui=te({trendsUrl:Mt,klineUrl:je,resolveTarget:t=>({secid:t,code:t.split(".")[1]||t}),defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter",endExtraDays:1},...nt(_.US,"USD")});async function Sr(t,e,n={}){return Ui(t,e,n)}function Er(t){let e=ne(`eastmoney:board-code-map:${t.type}`,{defaultTTL:36e5,maxSize:4});return{async getCode(n,r,o){if(r.startsWith("BK"))return r;let s=(await e.getOrFetch("name-code-map",async()=>{let u=await o(n);if(u.length===0)throw new Z(`${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(!s)throw new ut(`${t.errorPrefix}: ${r}`,"eastmoney");return s}}}async function _r(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 Tn(t,e.listUrl,n,r,100,(i,s)=>({rank:s,name:String(i.f14??""),code:String(i.f12??""),price:a(i.f2),change:a(i.f4),changePercent:a(i.f3),totalMarketCap:a(i.f20),turnoverRate:a(i.f8),riseCount:a(i.f104),fallCount:a(i.f105),leadingStock:i.f128?String(i.f128):null,leadingStockChangePercent:a(i.f136)}));return o.sort((i,s)=>(s.changePercent??0)-(i.changePercent??0)),o.forEach((i,s)=>{i.rank=s+1}),o}async function Cr(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()}`,s=(await t.get(o,{responseType:"json"}))?.data;return s?[{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 f=s[l],p=null;return typeof f=="number"&&!isNaN(f)&&(p=d?f/100:f),{item:c,value:p}}):[]}async function Ar(t,e,n){let r={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:"f3",fs:`b:${e} f:!50`};return Tn(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,s)=>({rank:s,code:String(i.f12??""),name:String(i.f14??""),price:a(i.f2),changePercent:a(i.f3),change:a(i.f4),volume:a(i.f5),amount:a(i.f6),amplitude:a(i.f7),high:a(i.f15),low:a(i.f16),open:a(i.f17),prevClose:a(i.f18),turnoverRate:a(i.f8),pe:a(i.f9),pb:a(i.f23)}))}async function Or(t,e,n,r={}){let{period:o="daily",adjust:i="",startDate:s="19700101",endDate:u="20500101"}=r;q(o),W(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:z(o),fqt:V(i),beg:s,end:u,smplmt:"10000",lmt:"1000000"}),{klines:c}=await K(t,n,l);return c.length===0?[]:c.map(d=>v(d))}var Rr=new Map;async function Pr(t,e,n,r,o={}){let i=`${n}|${r}`,s=Rr.get(i);return s||(s=te({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})}),Rr.set(i,s)),s(t,e,o)}function ot(t){let e=Er(t);async function n(o){return _r(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 s=await r(o,i);return Cr(o,s,t.spotUrl)},async getConstituents(o,i){let s=await r(o,i);return Ar(o,s,t.consUrl)},async getKline(o,i,s={}){let u=await r(o,i);return Or(o,u,t.klineUrl,s)},async getMinuteKline(o,i,s={}){let u=await r(o,i);return Pr(o,u,t.klineUrl,t.trendsUrl,s)}}}var vi={type:"industry",fsFilter:"m:90 t:2 f:!50",listUrl:Lt,spotUrl:Nt,consUrl:kt,klineUrl:Ft,trendsUrl:wt,errorPrefix:"\u672A\u627E\u5230\u884C\u4E1A\u677F\u5757"},Pe=ot(vi);async function Dr(t){return Pe.getList(t)}async function Ir(t,e){return Pe.getSpot(t,e)}async function br(t,e){return Pe.getConstituents(t,e)}async function Mr(t,e,n={}){return Pe.getKline(t,e,n)}async function Lr(t,e,n={}){return Pe.getMinuteKline(t,e,n)}var Ki={type:"concept",fsFilter:"m:90 t:3 f:!50",listUrl:xt,spotUrl:Ut,consUrl:vt,klineUrl:Kt,trendsUrl:Bt,errorPrefix:"\u672A\u627E\u5230\u6982\u5FF5\u677F\u5757"},De=ot(Ki);async function Nr(t){return De.getList(t)}async function kr(t,e){return De.getSpot(t,e)}async function Fr(t,e){return De.getConstituents(t,e)}async function wr(t,e,n={}){return De.getKline(t,e,n)}async function xr(t,e,n={}){return De.getMinuteKline(t,e,n)}async function Sn(t,e,n){let{reportName:r,columns:o="ALL",filter:i,sortColumns:s,sortTypes:u,pageSize:l=500,startPage:c=1,fetchAllPages:d=!0,maxPages:f=1e3,quoteColumns:p,quoteType:y,extraParams:T}=e,D=[],E=c,P=1,L=0,H=0;do{let U=new URLSearchParams({reportName:r,columns:o,pageSize:String(l),pageNumber:String(E),source:"WEB",client:"WEB"});if(i&&U.set("filter",i),s&&U.set("sortColumns",s),u&&U.set("sortTypes",u),p&&U.set("quoteColumns",p),y&&U.set("quoteType",y),T)for(let[it,st]of Object.entries(T))U.set(it,st);let Yo=`${Ht}?${U.toString()}`,ie=(await t.get(Yo,{responseType:"json"}))?.result;if(!ie||!Array.isArray(ie.data))break;E===c&&(P=ie.pages??1,L=ie.count??ie.data.length);let jo=ie.data.map((it,st)=>n(it,D.length+st));if(D.push(...jo),E++,H++,!d)break}while(E<=P&&H<f);return d&&H>=f&&E<=P&&console.warn(`[stock-sdk] fetchDatacenter("${r}") truncated at maxPages=${f} (server reports ${P} pages). Pass a larger \`maxPages\` to fetch the full dataset.`),{data:D,total:L,pages:P}}async function O(t,e,n){return(await Sn(t,e,n)).data}function F(t){if(t==null)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}function oe(t){if(!t)return null;let e=t.match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Bi(t){return{code:t.SECURITY_CODE??"",name:t.SECURITY_NAME_ABBR??"",reportDate:oe(t.REPORT_DATE),planNoticeDate:oe(t.PLAN_NOTICE_DATE),disclosureDate:oe(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:oe(t.EQUITY_RECORD_DATE),exDividendDate:oe(t.EX_DIVIDEND_DATE),payDate:oe(t.PAY_DATE),assignProgress:t.ASSIGN_PROGRESS??null,noticeDate:oe(t.NOTICE_DATE)}}async function Ur(t,e){let n=e.replace(/^(sh|sz|bj)/,"");return O(t,{reportName:"RPT_SHAREBONUS_DET",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:500,filter:`(SECURITY_CODE="${n}")`},r=>Bi(r))}var Hi="https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx",_n="https://fund.eastmoney.com/pingzhongdata",qi="https://fundgz.1234567.com.cn/js";function zi(){return typeof document<"u"&&typeof window<"u"}var $i=1e4;function Yi(){return Number(Q(_.CN).slice(0,4))}function ji(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??Yi())});return`${Hi}?${n.toString()}`}function Rn(t){if(!t)return null;let e=t.trim().match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Gi(t){return{code:t[0]??"",name:t[1]??"",equityRecordDate:Rn(t[2]),exDividendDate:Rn(t[3]),dividendPerShare:R(t[4]),payDate:Rn(t[5]),dividendType:t[6]?.trim()?t[6].trim():null}}async function En(t,e,n){let r=ji(e,n),o=await se(r,["pageinfo","jjfh_data"],{client:t}),i=o.pageinfo??[0,0,n],[s=0,u=0,l=n]=i;return{items:(o.jjfh_data??[]).map(Gi),totalPages:s,pageSize:u,currentPage:l}}async function vr(t,e={}){if(e.page==="all"){let o=await En(t,e,1),i=o.items;for(let s=2;s<=o.totalPages;s++){let u=await En(t,e,s);i=i.concat(u.items)}return e.code&&(i=i.filter(s=>s.code===e.code)),{items:i,totalPages:o.totalPages,pageSize:o.pageSize,currentPage:-1}}let n=e.page??1,r=await En(t,e,n);return e.code?{...r,items:r.items.filter(o=>o.code===e.code)}:r}function Cn(t){return Q(_.CN,t)}function An(t){return re(ae(t,_.CN))}function Y(t,e){return t?.find(n=>n.name===e)?.data??[]}async function Kr(t,e){let n=`${_n}/${encodeURIComponent(e)}.js`,r=await se(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 s=o.map(u=>({date:Cn(u.x),timestamp:u.x,nav:u.y,accNav:i.has(u.x)?i.get(u.x):null,dailyReturn:R(u.equityReturn),unitMoney:u.unitMoney??""}));return{code:r.fS_code??e,name:r.fS_name??null,items:s}}function Qi(t,e,n=$i){let r=`${qi}/${encodeURIComponent(e)}.js?rt=${Date.now()}`;return zi()?pe("fundgz:jsonpgz",()=>Wi(r,n)):Vi(t,r)}function Wi(t,e){return new Promise((n,r)=>{let o=document.createElement("script"),i=window,s=i.jsonpgz,u=!1,l=()=>{if(o.parentNode&&o.parentNode.removeChild(o),s===void 0)try{delete i.jsonpgz}catch{}else i.jsonpgz=s},c=setTimeout(()=>{u||(u=!0,l(),r(new 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(d??{}))},o.onerror=()=>{u||(u=!0,clearTimeout(c),l(),r(new A({code:"NETWORK_ERROR",message:`fundgz JSONP script load failed: ${t}`,url:t})))},o.src=t,document.head.appendChild(o)})}async function Vi(t,e){let r=(await t.get(e,{responseType:"text",provider:"eastmoney"})).trim();if(!r)return{};try{return qe(r)}catch{return{}}}async function Br(t,e){let n=await Qi(t,e);return{code:n.fundcode??e,name:n.name??null,navDate:n.jzrq?.trim()?n.jzrq.trim():null,nav:R(n.dwjz),estimatedNav:R(n.gsz),estimatedChangePercent:R(n.gszzl),estimateTime:n.gztime?.trim()?n.gztime.trim():null}}async function Hr(t,e){let n=`${_n}/${encodeURIComponent(e)}.js`,r=await se(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 s=o.map(u=>({date:Cn(u.x),timestamp:u.x,rank:R(u.y),total:R(u.sc),percentile:i.has(u.x)?i.get(u.x):null}));return{code:r.fS_code??e,name:r.fS_name??null,items:s}}function qr(t){let e=t.indexOf(".");return e<0?{code:t,marketId:""}:{marketId:t.slice(0,e),code:t.slice(e+1)}}function Zi(t){return t?t.map(e=>e.trim()).filter(Boolean).map(qr):[]}function Xi(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean).map(qr):[]}function Ji(t){if(!t?.categories?.length||!t?.series)return[];let e=Y(t.series,"\u80A1\u7968\u5360\u51C0\u6BD4"),n=Y(t.series,"\u503A\u5238\u5360\u51C0\u6BD4"),r=Y(t.series,"\u73B0\u91D1\u5360\u51C0\u6BD4"),o=Y(t.series,"\u5176\u4ED6\u5360\u51C0\u6BD4"),i=Y(t.series,"\u51C0\u8D44\u4EA7");return t.categories.map((s,u)=>({date:s,timestamp:An(s),stockRatio:e[u]??0,bondRatio:n[u]??0,cashRatio:r[u]??0,otherRatio:o[u]??0,netAsset:i[u]??0}))}function es(t){return t?t.filter(([e])=>typeof e=="number"&&Number.isFinite(e)).map(([e,n])=>({date:Cn(e),timestamp:e,position:n})):[]}function ts(t){return t?t.map(e=>{let n=e?.star;return{id:e?.id??"",name:e?.name??"",avatarUrl:e?.pic?.trim()||null,star:typeof n=="number"&&Number.isFinite(n)?n:null,workTime:e?.workTime?.trim()||null,fundSize:e?.fundSize?.trim()||null,power:zr(e?.power)}}):[]}function zr(t){return t?.categories?.length?{overall:R(t.avr)??0,categories:t.categories,scores:t.data??[],descriptions:t.dsc??[]}:null}function ns(t){if(!t?.categories?.length||!t?.series)return[];let e=Y(t.series,"\u673A\u6784\u6301\u6709\u6BD4\u4F8B"),n=Y(t.series,"\u4E2A\u4EBA\u6301\u6709\u6BD4\u4F8B"),r=Y(t.series,"\u5185\u90E8\u6301\u6709\u6BD4\u4F8B");return t.categories.map((o,i)=>({date:o,timestamp:An(o),institutionRatio:e[i]??0,individualRatio:n[i]??0,internalRatio:r[i]??0}))}function rs(t){return!t?.categories?.length||!t?.series?[]:t.categories.map((e,n)=>({date:e,scale:t.series?.[n]?.y??0,mom:t.series?.[n]?.mom??""}))}function os(t){if(!t?.categories?.length||!t?.series)return[];let e=Y(t.series,"\u671F\u95F4\u7533\u8D2D"),n=Y(t.series,"\u671F\u95F4\u8D4E\u56DE"),r=Y(t.series,"\u603B\u4EFD\u989D");return t.categories.map((o,i)=>({date:o,timestamp:An(o),buy:e[i]??0,sell:n[i]??0,total:r[i]??0}))}function is(t){return{oneMonth:R(t.syl_1y),threeMonth:R(t.syl_3y),sixMonth:R(t.syl_6y),oneYear:R(t.syl_1n)}}function ss(t){if(typeof t!="string")return null;let e=t.indexOf("_");if(e<0)return null;let n=t.slice(0,e);if(!n)return null;let r=t.lastIndexOf("_");return r>e?{code:n,name:t.slice(e+1,r),value:R(t.slice(r+1))}:{code:n,name:t.slice(e+1),value:null}}function as(t){if(!t?.length)return null;let e=t.map(n=>(Array.isArray(n)?n:[]).map(ss).filter(r=>r!==null)).filter(n=>n.length>0);return e.length?{groups:e}:null}async function $r(t,e){let n=`${_n}/${encodeURIComponent(e)}.js`,r=await se(n,["fS_code","fS_name","fund_sourceRate","fund_Rate","fund_minsg","stockCodesNew","zqCodesNew","Data_assetAllocation","Data_fundSharesPositions","Data_currentFundManager","Data_performanceEvaluation","Data_holderStructure","Data_fluctuationScale","Data_buySedemption","syl_1y","syl_3y","syl_6y","syl_1n","swithSameType"],{client:t});return{code:r.fS_code??e,name:r.fS_name??null,sourceRate:R(r.fund_sourceRate),rate:R(r.fund_Rate),minSubscription:R(r.fund_minsg),holdings:Zi(r.stockCodesNew),bondHoldings:Xi(r.zqCodesNew),assetAllocation:Ji(r.Data_assetAllocation),positions:es(r.Data_fundSharesPositions),managers:ts(r.Data_currentFundManager),performance:zr(r.Data_performanceEvaluation),holderStructure:ns(r.Data_holderStructure),scaleChanges:rs(r.Data_fluctuationScale),buySedemption:os(r.Data_buySedemption),stageReturns:is(r),sameType:as(r.swithSameType)}}function On(t){let e=t.match(/^([a-zA-Z]+)/);if(!e)throw new S(`Invalid futures symbol: "${t}". Expected format: variety + contract (e.g., rb2605, RBM, IF2604)`);return e[1]}function Yr(t){return ue[t]??ue[t.toLowerCase()]??ue[t.toUpperCase()]}function Pn(t){let e=Yr(t);if(!e&&t.length>1&&t.endsWith("M")&&(e=Yr(t.slice(0,-1))),!e){let r=Object.keys(ue).join(", ");throw new S(`Unknown futures variety: "${t}". Supported varieties: ${r}`)}let n=Yt[e];if(n===void 0)throw new S(`No market code found for exchange: ${e}`);return n}function us(t){let e=v(t),n=t.split(",");return{...e,openInterest:n.length>12?g(n[12]):null}}async function jr(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;q(r);let s=On(e),l=`${Pn(s)}.${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:z(r),fqt:"0",secid:l,beg:o,end:i}),{klines:d,name:f,code:p}=await K(t,he,c);return d.length===0?[]:d.map(y=>({...us(y),code:p||e,name:f||""}))}async function Gr(t,e={}){let n=e.pageSize??20,r=[],o=0,i=0,s=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=`${$t}?${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(ls);if(r.push(...d),d.length===0)break;o++}while(r.length<i&&o<s);return r}function ls(t){return{code:t.dm||"",name:t.name||"",price:g(String(t.p)),change:g(String(t.zde)),changePercent:g(String(t.zdf)),open:g(String(t.o)),high:g(String(t.h)),low:g(String(t.l)),prevSettle:g(String(t.zjsj)),volume:g(String(t.vol)),buyVolume:g(String(t.wp)),sellVolume:g(String(t.np)),openInterest:g(String(t.ccl))}}function cs(t){let e=v(t),n=t.split(",");return{...e,openInterest:n.length>12?g(n[12]):null}}function ds(t){let e=t.match(/^([A-Z]+)/);if(!e)throw new S(`Invalid global futures symbol: "${t}". Expected format like HG00Y, CL2507`);return e[1]}async function Qr(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;q(r);let s=n.marketCode;if(s===void 0){let p=ds(e);if(s=Ge[p],s===void 0){let y=Object.keys(Ge).join(", ");throw new S(`Unknown global futures variety: "${p}". Supported: ${y}. Or specify marketCode manually via options.`)}}let u=`${s}.${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:z(r),fqt:"0",secid:u,beg:o,end:i}),{klines:c,name:d,code:f}=await K(t,he,l);return c.length===0?[]:c.map(p=>({...cs(p),code:f||e,name:d||""}))}async function Wr(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=`${Vt}?${r.toString()}`,s=(await t.get(o,{responseType:"json"}))?.list;return Array.isArray(s)?s.map(u=>({code:String(u.dm??""),name:String(u.name??""),price:a(u.p),change:a(u.zde),changePercent:a(u.zdf),volume:a(u.vol),amount:a(u.cje),openInterest:a(u.ccl),strikePrice:a(u.xqj),remainDays:a(u.syr),dailyChange:a(u.rz),prevSettle:a(u.zjsj),open:a(u.o)})):[]}async function Vr(t,e,n){let r=new URLSearchParams({type:"RPT_IF_BILLBOARD_TD",sty:"ALL",p:"1",ps:"200",source:"IFBILLBOARD",client:"WEB",ut:$,filter:`(SECURITY_CODE="${e}")(TRADE_DATE='${n}')`}),o=`${Zt}?${r.toString()}`,s=(await t.get(o,{responseType:"json"}))?.result?.data;if(!Array.isArray(s))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 s.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:a(l.MEMBER_RANK)??0,sellVolume:a(l.SELL_VOLUME),sellVolumeChange:a(l.SELL_VOLUME_CHANGE),netSellVolume:a(l.NET_SELL_VOLUME),sellVolumeRatio:a(l.SELL_VOLUME_RATIO),buyVolume:a(l.BUY_VOLUME),buyVolumeChange:a(l.BUY_VOLUME_CHANGE),netBuyVolume:a(l.NET_BUY_VOLUME),buyVolumeRatio:a(l.BUY_VOLUME_RATIO),sellPosition:a(l.SELL_POSITION),sellPositionChange:a(l.SELL_POSITION_CHANGE),netSellPosition:a(l.NET_SELL_POSITION),sellPositionRatio:a(l.SELL_POSITION_RATIO),buyPosition:a(l.BUY_POSITION),buyPositionChange:a(l.BUY_POSITION_CHANGE),netBuyPosition:a(l.NET_BUY_POSITION),buyPositionRatio:a(l.BUY_POSITION_RATIO)}))}var ps={gold:"EMI00069026",silver:"EMI00069027"};function Zr(t){if(!t)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}async function Xr(t){return O(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 Jr(t,e,n={}){let{startDate:r="2020-10-28",pageSize:o=500}=n,i=e.toUpperCase();return O(t,{reportName:"RPT_FUTU_STOCKDATA",columns:"SECURITY_CODE,TRADE_DATE,ON_WARRANT_NUM,ADDCHANGE",filter:`(SECURITY_CODE="${i}")(TRADE_DATE>='${M(r)}')`,pageSize:o,sortColumns:"TRADE_DATE",sortTypes:"-1"},s=>({code:String(s.SECURITY_CODE??e),date:Zr(s.TRADE_DATE),inventory:a(s.ON_WARRANT_NUM),change:a(s.ADDCHANGE)}))}async function eo(t,e,n={}){let r=ps[e];if(!r)throw new S(`Invalid COMEX symbol: "${e}". Must be "gold" or "silver".`);let{pageSize:o=500}=n,i={gold:"\u9EC4\u91D1",silver:"\u767D\u94F6"};return O(t,{reportName:"RPT_FUTUOPT_GOLDSIL",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:o,filter:`(INDICATOR_ID1="${r}")(@STORAGE_TON<>"NULL")`},s=>({date:Zr(s.REPORT_DATE),name:i[e]??e,storageTon:a(s.STORAGE_TON),storageOunce:a(s.STORAGE_OUNCE)}))}var to={daily:"101",weekly:"102",monthly:"103"},Dn="f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65";function no(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:g(e[1]),smallNetInflow:g(e[2]),mediumNetInflow:g(e[3]),largeNetInflow:g(e[4]),superLargeNetInflow:g(e[5]),mainNetInflowPercent:g(e[6]),smallNetInflowPercent:g(e[7]),mediumNetInflowPercent:g(e[8]),largeNetInflowPercent:g(e[9]),superLargeNetInflowPercent:g(e[10]),close:g(e[11]),changePercent:g(e[12])}}function ms(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:g(e[1]),smallNetInflow:g(e[2]),mediumNetInflow:g(e[3]),largeNetInflow:g(e[4]),superLargeNetInflow:g(e[5]),mainNetInflowPercent:g(e[6]),smallNetInflowPercent:g(e[7]),mediumNetInflowPercent:g(e[8]),largeNetInflowPercent:g(e[9]),superLargeNetInflowPercent:g(e[10]),shClose:g(e[11]),shChangePercent:g(e[12]),szClose:g(e[13]),szChangePercent:g(e[14])}}var ro={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"}},gs={industry:"m:90+t:2",concept:"m:90+t:3",region:"m:90+t:1"},fs="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 oo(t,e,n=100,r=1e3){let o=[],i=1,s=0;do{let u=new URLSearchParams({...e,pn:String(i),pz:String(n)}),l=`${qt}?${u.toString()}`,d=(await t.get(l,{responseType:"json"}))?.data;if(!d||!Array.isArray(d.diff)||(i===1&&(s=d.total??0),o.push(...d.diff),o.length>=s||d.diff.length<n))break;i++}while(o.length<s&&i<=r);return i>r&&o.length<s&&console.warn(`[stock-sdk] fetchClistAllPages truncated at maxPages=${r} (server reports total=${s}, fetched=${o.length}). Pass a larger \`maxPages\` to fetch the full dataset.`),o}async function io(t,e,n={}){let{period:r="daily"}=n,o=to[r];if(!o)throw new S(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i;try{i=J(e,{market:"CN"})}catch(f){let p=e.includes(".")?e.slice(e.indexOf(".")+1):e;throw f instanceof lt&&pt(p)?new S(`Individual fund flow is not available for index symbols: ${e}`):f}if(i.assetType==="index"&&pt(i.code))throw new S(`Individual fund flow is not available for index symbols: ${e}`);let s=ee(i),u=new URLSearchParams({lmt:"0",klt:o,secid:s,fields1:"f1,f2,f3,f7",fields2:Dn,ut:$}),l=`${fe}?${u.toString()}`,d=(await t.get(l,{responseType:"json"}))?.data?.klines;return!Array.isArray(d)||d.length===0?[]:d.map(no)}async function so(t){let e=new URLSearchParams({lmt:"0",klt:"101",secid:"1.000001",secid2:"0.399001",fields1:"f1,f2,f3,f7",fields2:Dn,ut:$}),n=`${fe}?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.klines;return!Array.isArray(o)||o.length===0?[]:o.map(ms)}async function ao(t,e={}){let{indicator:n="today"}=e,r=ro[n];if(!r)throw new S(`Invalid indicator: ${n}.`);let o={fid:r.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:$,fs,fields:r.fields};return(await oo(t,o,100)).map(s=>({code:String(s.f12??""),name:String(s.f14??""),price:a(s.f2),changePercent:a(s[r.changePercentField]),mainNetInflow:a(s[r.mainNet]),mainNetInflowPercent:a(s[r.mainPct]),superLargeNetInflow:a(s[r.superLargeNet]),superLargeNetInflowPercent:a(s[r.superLargePct]),largeNetInflow:a(s[r.largeNet]),largeNetInflowPercent:a(s[r.largePct]),mediumNetInflow:a(s[r.mediumNet]),mediumNetInflowPercent:a(s[r.mediumPct]),smallNetInflow:a(s[r.smallNet]),smallNetInflowPercent:a(s[r.smallPct])}))}async function uo(t,e={}){let{indicator:n="today",sectorType:r="industry"}=e,o=ro[n];if(!o)throw new S(`Invalid indicator: ${n}.`);let i=gs[r];if(!i)throw new S(`Invalid sectorType: ${r}.`);let s=`${o.fields},f204,f205`,u={fid:o.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:$,fs:i,fields:s};return(await oo(t,u,100)).map(c=>({code:String(c.f12??""),name:String(c.f14??""),changePercent:a(c[o.changePercentField]),mainNetInflow:a(c[o.mainNet]),mainNetInflowPercent:a(c[o.mainPct]),superLargeNetInflow:a(c[o.superLargeNet]),largeNetInflow:a(c[o.largeNet]),mediumNetInflow:a(c[o.mediumNet]),smallNetInflow:a(c[o.smallNet]),topStockCode:c.f204?String(c.f204):void 0,topStockName:c.f205?String(c.f205):void 0}))}async function lo(t,e,n={}){let{period:r="daily"}=n,o=to[r];if(!o)throw new S(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=e.includes(".")?e:`90.${e}`,s=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Dn,ut:$}),u=`${fe}?${s.toString()}`,c=(await t.get(u,{responseType:"json"}))?.data?.klines;return!Array.isArray(c)||c.length===0?[]:c.map(no)}var ys={today:"1","3day":"3","5day":"5","10day":"10",month:"M",quarter:"Q",year:"Y"},hs={shanghai:"001",shenzhen:"003"};function co(t,e){let n=t.split(",");return{date:e,time:n[0]??"",shanghaiNetInflow:g(n[1]),shenzhenNetInflow:g(n[3]),totalNetInflow:g(n[5])}}async function po(t,e="north"){He(e);let n=new URLSearchParams({fields1:"f1,f2,f3,f4",fields2:"f51,f54,f52,f58,f53,f62,f56,f57,f60,f61",ut:$}),r=`${zt}?${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=>co(d,M(c)))}let s=i.s2n??[],u=i.s2nDate??"";return s.map(l=>co(l,M(u)))}async function mo(t){return O(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:F(e.TRADE_DATE),type:String(e.MUTUAL_TYPE??""),boardName:String(e.MUTUAL_TYPE_NAME??""),direction:String(e.FUNDS_DIRECTION??""),status:String(e.status??""),netBuyAmount:a(e.netBuyAmt),netInflow:a(e.dayNetAmtIn),remainAmount:a(e.dayAmtRemain),upCount:a(e.f104),flatCount:a(e.f106),downCount:a(e.f105),indexCode:String(e.INDEX_CODE??""),indexName:String(e.INDEX_NAME??""),indexChangePercent:a(e.INDEX_f3)}))}async function go(t,e={}){let{market:n="all",period:r="5day",date:o}=e,i=ys[r];if(!i)throw new S(`Invalid period: ${r}.`);let s=[`(INTERVAL_TYPE="${i}")`];return o&&s.push(`(TRADE_DATE='${o}')`),n!=="all"&&s.push(`(MUTUAL_TYPE="${hs[n]}")`),O(t,{reportName:"RPT_MUTUAL_STOCK_NORTHSTA",columns:"ALL",sortColumns:"ADD_MARKET_CAP",sortTypes:"-1",pageSize:500,filter:s.join("")},u=>({date:F(u.TRADE_DATE),code:String(u.SECURITY_CODE??""),name:String(u.SECURITY_NAME??u.SECURITY_NAME_ABBR??""),close:a(u.CLOSE_PRICE),changePercent:a(u.CHANGE_RATE),holdShares:a(u.HOLD_SHARES),holdMarketValue:a(u.HOLD_MARKET_CAP),holdRatioFloat:a(u.HOLD_RATIO),holdRatioTotal:a(u.A_SHARES_RATIO),addShares:a(u.ADD_SHARES),addMarketValue:a(u.ADD_MARKET_CAP),addMarketValuePercent:a(u.ADD_MARKET_CAP_PROPORTION),sector:String(u.BOARD_NAME??"")}))}async function fo(t,e="north",n={}){He(e);let{startDate:r,endDate:o}=n,i=[e==="north"?'(BOARD_TYPE="1")':'(BOARD_TYPE="0")'];return r&&i.push(`(TRADE_DATE>='${M(r)}')`),o&&i.push(`(TRADE_DATE<='${M(o)}')`),O(t,{reportName:"RPT_MUTUAL_DEAL_HISTORY",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:i.join("")},s=>({date:F(s.TRADE_DATE),netBuyAmount:a(s.NET_DEAL_AMT),buyAmount:a(s.BUY_AMT),sellAmount:a(s.SELL_AMT),accNetBuyAmount:a(s.ACCUM_DEAL_AMT),netInflow:a(s.FUND_INFLOW),remainAmount:a(s.QUOTA_BALANCE),topStockCode:s.LEAD_STOCKS_CODE?String(s.LEAD_STOCKS_CODE):null,topStockName:s.LEAD_STOCKS_NAME?String(s.LEAD_STOCKS_NAME):null,topStockChangePercent:a(s.LS_CHANGE_RATE)}))}async function yo(t,e,n={}){let r=e.replace(/^(sh|sz|bj)/i,""),{startDate:o,endDate:i}=n,s=[`(SECURITY_CODE="${r}")`];return o&&s.push(`(TRADE_DATE>='${M(o)}')`),i&&s.push(`(TRADE_DATE<='${M(i)}')`),O(t,{reportName:"RPT_MUTUAL_HOLDSTOCKNORTH_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:s.join("")},u=>({date:F(u.TRADE_DATE),holdShares:a(u.HOLD_SHARES),holdMarketValue:a(u.HOLD_MARKET_CAP),holdRatioFloat:a(u.HOLD_RATIO),holdRatioTotal:a(u.A_SHARES_RATIO),close:a(u.CLOSE_PRICE),changePercent:a(u.CHANGE_RATE)}))}var Ts={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"}},Ss={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"},Rs={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 In(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 Es(t){if(!t||typeof t!="object")return"";let e=t;return`${e.days??""}/${e.ct??""}`}function _s(t){let e=a(t.p),n=a(t.tp);return{code:String(t.c??t.m??""),name:String(t.n??""),price:e!==null?e/1e3:null,changePercent:a(t.zdp),limitPrice:n!==null?n/1e3:null,amount:a(t.amount??t.zb),floatMarketValue:a(t.ltsz),totalMarketValue:a(t.tshare),turnoverRate:a(t.hs),continuousBoardCount:a(t.lbc),firstBoardTime:t.fbt!==void 0&&t.fbt!==null?In(t.fbt):null,lastBoardTime:t.lbt!==void 0&&t.lbt!==null?In(t.lbt):null,boardAmount:a(t.fund),sealAmount:a(t.fund),failedCount:a(t.zbc),industry:String(t.hybk??""),ztStatistics:Es(t.zttj),amplitude:a(t.zf),speed:a(t.zs)}}function Cs(t){if(t)return/^\d{8}$/.test(t)?t:t.replace(/-/g,"")}function As(){return Q(_.CN).replace(/-/g,"")}async function ho(t,e="zt",n){let r=Ts[e];if(!r)throw new S(`Invalid ZTPool type: ${e}.`);let o=Cs(n)??As(),i=new URLSearchParams({ut:k,dpt:"wz.ztzt",Pageindex:"0",pagesize:"10000",sort:r.sort,date:o}),s=`${ye}${r.path}?${i.toString()}`,l=(await t.get(s,{responseType:"json"}))?.data?.pool;return!Array.isArray(l)||l.length===0?[]:l.map(_s)}async function To(t,e="large_buy"){let n=Ss[e];if(!n)throw new S(`Invalid StockChangeType: ${e}.`);let r=new URLSearchParams({type:n,pageindex:"0",pagesize:"5000",ut:k,dpt:"wzchanges"}),o=`${ye}/getAllStockChanges?${r.toString()}`,s=(await t.get(o,{responseType:"json"}))?.data?.allstock;return!Array.isArray(s)||s.length===0?[]:s.map(u=>{let l=String(u.t??n);return{time:In(u.tm),code:String(u.c??""),name:String(u.n??""),changeType:e,changeTypeLabel:Rs[l]??"",info:String(u.i??"")}})}async function So(t){let e=new URLSearchParams({ut:k,dpt:"wzchanges",pageindex:"0",pagesize:"5000"}),n=`${ye}/getAllBKChanges?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.allbk;return!Array.isArray(o)||o.length===0?[]:o.map(i=>{let s=i.ms??{},u=s.m===0?"\u5927\u7B14\u4E70\u5165":s.m===1?"\u5927\u7B14\u5356\u51FA":"",l={},c=i.bkdf??i.bkdfdis;if(c&&typeof c=="object")for(let[d,f]of Object.entries(c))l[d]=Number(f)||0;return{name:String(i.bkn??""),changePercent:a(i.bkz),mainNetInflow:a(i.bkj),totalChangeCount:a(i.bkc),topStockCode:String(s.c??""),topStockName:String(s.n??""),topStockDirection:u,changeTypeDistribution:l}})}var Ro={"1month":"01","3month":"02","6month":"03","1year":"04"};async function Eo(t,e){let n=M(e.startDate),r=M(e.endDate);return O(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:F(o.TRADE_DATE),close:a(o.CLOSE_PRICE),changePercent:a(o.CHANGE_RATE),netBuyAmount:a(o.BILLBOARD_NET_AMT),buyAmount:a(o.BILLBOARD_BUY_AMT),sellAmount:a(o.BILLBOARD_SELL_AMT),dealAmount:a(o.BILLBOARD_DEAL_AMT),totalAmount:a(o.ACCUM_AMOUNT),netBuyRatio:a(o.DEAL_NET_RATIO),dealAmountRatio:a(o.DEAL_AMOUNT_RATIO),turnoverRate:a(o.TURNOVERRATE),floatMarketValue:a(o.FREE_MARKET_CAP),reason:String(o.EXPLANATION??o.EXPLAIN??""),afterChange1d:a(o.D1_CLOSE_ADJCHRATE),afterChange2d:a(o.D2_CLOSE_ADJCHRATE),afterChange5d:a(o.D5_CLOSE_ADJCHRATE),afterChange10d:a(o.D10_CLOSE_ADJCHRATE)}))}async function _o(t,e="1month"){let n=Ro[e];if(!n)throw new S(`Invalid period: ${e}.`);return O(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:F(r.LATEST_TDATE),close:a(r.CLOSE_PRICE),changePercent:a(r.CHANGE_RATE),count:a(r.BILLBOARD_TIMES),totalBuyAmount:a(r.BILLBOARD_BUY_AMT),totalSellAmount:a(r.BILLBOARD_SELL_AMT),totalNetAmount:a(r.BILLBOARD_NET_AMT),totalDealAmount:a(r.BILLBOARD_DEAL_AMT),buyOrgCount:a(r.ORG_BUY_TIMES),sellOrgCount:a(r.ORG_SELL_TIMES)}))}async function Co(t,e){let n=M(e.startDate),r=M(e.endDate);return O(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:F(o.TRADE_DATE),close:a(o.CLOSE_PRICE),changePercent:a(o.CHANGE_RATE),buyOrgCount:a(o.BUY_TIMES),sellOrgCount:a(o.SELL_TIMES),orgBuyAmount:a(o.BUY_AMT),orgSellAmount:a(o.SELL_AMT),orgNetAmount:a(o.NET_AMT)}))}async function Ao(t,e="1month"){let n=Ro[e];if(!n)throw new S(`Invalid period: ${e}.`);return O(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:a(r.TOTAL_BUYAMT??r.BUY_AMT),totalSellAmount:a(r.TOTAL_SELLAMT??r.SELL_AMT),buyCount:a(r.TOTAL_BUYER_SALESTIMES??r.BUY_TIMES),sellCount:a(r.TOTAL_SELLER_SALESTIMES??r.SELL_TIMES),totalCount:a(r.TOTAL_TIMES)}))}async function Oo(t,e,n){let r=e.replace(/^(sh|sz|bj)/i,""),o=M(n),i=`(SECURITY_CODE="${r}")(TRADE_DATE='${o}')`,[s,u]=await Promise.all([O(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSBUY",columns:"ALL",sortColumns:"BUY_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:a(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:a(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:a(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:a(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:a(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:a(l.NET_AMT),side:"buy"})),O(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSSELL",columns:"ALL",sortColumns:"SELL_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:a(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:a(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:a(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:a(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:a(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:a(l.NET_AMT),side:"sell"}))]);return[...s,...u]}function Po(t){if(!t)return"";let e=t.startDate?M(t.startDate):void 0,n=t.endDate?M(t.endDate):void 0,r=[];return e&&r.push(`(TRADE_DATE>='${e}')`),n&&r.push(`(TRADE_DATE<='${n}')`),r.join("")}async function Do(t){return O(t,{reportName:"PRT_BLOCKTRADE_MARKET_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500},e=>({date:F(e.TRADE_DATE),shClose:a(e.CLOSE_PRICE??e.SH_CLOSE_PRICE),shChangePercent:a(e.CHANGE_RATE??e.SH_CHANGE_RATE),totalAmount:a(e.TURNOVER??e.TOTAL_AMOUNT),premiumAmount:a(e.PREMIUM_TURNOVER??e.PREMIUM_AMOUNT),premiumRatio:a(e.PREMIUM_RATIO),discountAmount:a(e.DISCOUNT_TURNOVER??e.DISCOUNT_AMOUNT),discountRatio:a(e.DISCOUNT_RATIO)}))}async function Io(t,e={}){let n=Po(e);return O(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:F(r.TRADE_DATE),close:a(r.CLOSE_PRICE),changePercent:a(r.CHANGE_RATE),dealPrice:a(r.DEAL_PRICE??r.PRICE),dealVolume:a(r.DEAL_VOLUME??r.VOLUME),dealAmount:a(r.DEAL_AMT??r.TURNOVER),premiumRate:a(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 bo(t,e={}){let n=Po(e);return O(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:F(r.TRADE_DATE),changePercent:a(r.CHANGE_RATE),close:a(r.CLOSE_PRICE),dealCount:a(r.DEAL_NUM??r.DEAL_COUNT),dealTotalAmount:a(r.DEAL_AMT??r.TOTAL_AMOUNT),dealTotalVolume:a(r.DEAL_VOLUME??r.TOTAL_VOLUME),premiumAmount:a(r.PREMIUM_AMT??r.PREMIUM_AMOUNT),discountAmount:a(r.DISCOUNT_AMT??r.DISCOUNT_AMOUNT)}))}async function Mo(t){return O(t,{reportName:"RPTA_WEB_MARGIN_DAILYTRADE",columns:"ALL",sortColumns:"STATISTICS_DATE",sortTypes:"-1",pageSize:500},e=>({date:F(e.STATISTICS_DATE??e.TRADE_DATE),finBalance:a(e.FIN_BALANCE),loanBalance:a(e.LOAN_BALANCE),finBuyAmount:a(e.FIN_BUY_AMT),loanSellAmount:a(e.LOAN_SELL_AMT),investorCount:a(e.OPERATE_INVESTOR_NUM??e.INVESTOR_NUM),liabilityInvestorCount:a(e.MARGIN_INVESTOR_NUM),totalGuarantee:a(e.TOTAL_GUARANTEE),avgGuaranteeRatio:a(e.AVG_GUARANTEE_RATIO)}))}async function Lo(t,e){let n=e?`(TRADE_DATE='${e}')`:void 0;return O(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:F(r.TRADE_DATE),finBalance:a(r.FIN_BALANCE),finBuyAmount:a(r.FIN_BUY_AMT),finRepayAmount:a(r.FIN_REPAY_AMT),loanBalance:a(r.LOAN_BALANCE),loanSellVolume:a(r.LOAN_SELL_VOLUME),loanRepayVolume:a(r.LOAN_REPAY_VOLUME)}))}var bn="https://fundmobapi.eastmoney.com/FundMNewApi",Mn={plat:"Android",appType:"ttjj",product:"EFund",Version:"1",deviceid:"stock-sdk"};async function No(t,e={}){let n=e.sort??"ZDF",r=e.order??"desc",o=e.category??"2",i=e.pageSize??20,s=e.page??1,u=new URLSearchParams({...Mn,RankItems:n,RankVectors:r,category:o,pageSize:String(i),page:String(s)}),l=`${bn}/FundMNSubjectList?${u.toString()}`,c=await t.get(l,{provider:"eastmoney",responseType:"json"}),d=c.Data??[],f=c.pageinfo??{totalPages:0,pageSize:i,page:s};return{items:d.map(y=>({code:y.code??"",name:y.name??"",dailyChange:R(y.ZDF),weeklyReturn:R(y.SYL_W),monthlyReturn:R(y.SYL_M),quarterlyReturn:R(y.SYL_3M),halfYearReturn:R(y.SYL_6M),yearlyReturn:R(y.SYL_Y),threeYearReturn:R(y.SYL_3Y),fiveYearReturn:R(y.SYL_5Y),type:y.isIndustry===1?"\u884C\u4E1A":y.isIndustry===0?"\u6982\u5FF5":"\u884C\u4E1A"})),totalPages:f.totalPages??0,pageSize:f.pageSize??i,currentPage:f.page??s}}async function ko(t,e={}){let n=e.sort??"ZDF",r=e.order??"desc",o=e.category??"2",i=e.limit??20,s=new URLSearchParams({...Mn,RankItems:n,RankVectors:r,category:o,limit:String(i)}),u=`${bn}/FundThemeList?${s.toString()}`;return((await t.get(u,{provider:"eastmoney",responseType:"json"})).Data??[]).map(d=>({code:d.code??"",name:d.name??"",dailyChange:R(d.ZDF),weeklyReturn:R(d.SYL_W),monthlyReturn:R(d.SYL_M),quarterlyReturn:R(d.SYL_3M),halfYearReturn:R(d.SYL_6M),yearlyReturn:R(d.SYL_Y),threeYearReturn:R(d.SYL_3Y),fiveYearReturn:R(d.SYL_5Y),type:d.isIndustry===1?"\u884C\u4E1A":d.isIndustry===0?"\u6982\u5FF5":"\u884C\u4E1A"}))}async function Fo(t,e,n={}){let r=n.sortColumn??"SYL_1N",o=n.sort??"desc",i=n.page??1,s=n.pageSize??20,u=n.fundType??"",l=new URLSearchParams({...Mn,TOPICAL:e,SortColumn:r,Sort:o,pageIndex:String(i),pageSize:String(s),FundType:u}),c=`${bn}/FundMNRank?${l.toString()}`,d=await t.get(c,{provider:"eastmoney",responseType:"json"}),f=d.Data??[],p=d.fundinfo??{total:0,pagesize:s,pageindex:i};return{items:f.map(T=>({code:T.fscode??"",name:T.abname??"",fundType:T.ftype??"",dailyChange:R(T.ZDF),weeklyReturn:R(T.SYL_Z),monthlyReturn:R(T.SYL_Y),quarterlyReturn:R(T.SYL_3Y),yearlyReturn:R(T.SYL_1N),nav:R(T.dwjz),themeCode:e})),total:p.total??0,pageIndex:p.pageindex??i,pageSize:p.pagesize??s}}var B={};at(B,{getCommodityOptionKline:()=>$o,getCommodityOptionSpot:()=>zo,getETFOption5DayMinute:()=>qo,getETFOptionDailyKline:()=>Ho,getETFOptionExpireDay:()=>vo,getETFOptionMinute:()=>Bo,getETFOptionMonths:()=>Uo,getIndexOptionKline:()=>xo,getIndexOptionSpot:()=>wo});function Os(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:a(t[7]),symbol:t[8]??""}}function Ps(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:null,symbol:t[7]??""}}async function wo(t,e){let n=`${Se}?type=futures&product=${t}&exchange=cffex&pinzhong=${e}`,r=await w(n),o=r?.result?.data?.up??[],i=r?.result?.data?.down??[];return{calls:o.map(Os),puts:i.map(Ps)}}async function xo(t){let e=`${Re}?symbol=${t}`,n=await w(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:a(r.o),high:a(r.h),low:a(r.l),close:a(r.c),volume:a(r.v)})):[]}async function Uo(t){let e=`${jt}?exchange=null&cate=${encodeURIComponent(t)}`,r=(await w(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 vo(t,e){let n=`${Qe}?exchange=null&cate=${encodeURIComponent(t)}&date=${e}`,r=await w(n),o=r?.result?.data?.remainderDays;if(typeof o=="number"&&o<0){let s=`${Qe}?exchange=null&cate=${encodeURIComponent("XD"+t)}&date=${e}`;r=await w(s)}let i=r?.result?.data;return{expireDay:i?.expireDay??"",remainderDays:i?.remainderDays??0,stockId:i?.stockId??"",name:i?.other?.name??""}}function Ko(t){let e="";return t.map(n=>(n.d&&(e=n.d),{time:n.i,date:e,price:a(n.p),volume:a(n.v),openInterest:a(n.t),avgPrice:a(n.a)}))}async function Bo(t){let e=`CON_OP_${t}`,n=`${Gt}?symbol=${e}`,o=(await w(n))?.result?.data;return Array.isArray(o)?Ko(o):[]}async function Ho(t){let e=`CON_OP_${t}`,n=`${Qt}?symbol=${e}`,r=await w(n,{callbackMode:"path"});return Array.isArray(r)?r.map(o=>({date:o.d,open:a(o.o),high:a(o.h),low:a(o.l),close:a(o.c),volume:a(o.v)})):[]}async function qo(t){let e=`CON_OP_${t}`,n=`${Wt}?symbol=${e}`,o=(await w(n))?.result?.data;if(!Array.isArray(o))return[];let i=[];for(let s of o)Array.isArray(s)&&i.push(...Ko(s));return i}function Ds(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:a(t[7]),symbol:t[8]??""}}function Is(t){return{buyVolume:a(t[0]),buyPrice:a(t[1]),price:a(t[2]),askPrice:a(t[3]),askVolume:a(t[4]),openInterest:a(t[5]),change:a(t[6]),strikePrice:null,symbol:t[7]??""}}async function zo(t,e){let n=We[t];if(!n)throw new S(`Unknown commodity option variety: "${t}". Available: ${Object.keys(We).join(", ")}`);let r=`${Se}?type=futures&product=${n.product}&exchange=${n.exchange}&pinzhong=${e}`,o=await w(r),i=o?.result?.data?.up??[],s=o?.result?.data?.down??[];return{calls:i.map(Ds),puts:s.map(Is)}}async function $o(t){let e=`${Re}?symbol=${t}`,n=await w(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:a(r.o),high:a(r.h),low:a(r.l),close:a(r.c),volume:a(r.v)})):[]}var I=class{constructor(e){this.client=e}};var Ie=class extends I{constructor(n){super(n);this.theme=new Ln(this.client)}getFundDividendList(n){return m.getFundDividendList(this.client,n)}getFundNavHistory(n){return m.getFundNavHistory(this.client,n)}getFundEstimate(n){return m.getFundEstimate(this.client,n)}getFundRankHistory(n){return m.getFundRankHistory(this.client,n)}getFundProfile(n){return m.getFundProfile(this.client,n)}},Ln=class{constructor(e){this.client=e}getThemeList(e){return m.getThemeList(this.client,e)}getThemeFunds(e,n){return m.getThemeFunds(this.client,e,n)}};var be=class extends I{constructor(e){super(e)}getFullQuotes(e){return b.getFullQuotes(this.client,e)}getSimpleQuotes(e){return b.getSimpleQuotes(this.client,e)}getHKQuotes(e){return b.getHKQuotes(this.client,e)}getUSQuotes(e){return b.getUSQuotes(this.client,e)}getFundQuotes(e){return b.getFundQuotes(this.client,e)}getFundFlow(e){return b.getFundFlow(this.client,e)}getPanelLargeOrder(e){return b.getPanelLargeOrder(this.client,e)}getTodayTimeline(e){return b.getTodayTimeline(this.client,e)}search(e){return b.search(this.client,e)}getAShareCodeList(e){return b.getAShareCodeList(this.client,e)}getUSCodeList(e){return b.getUSCodeList(this.client,e)}getHKCodeList(){return b.getHKCodeList(this.client)}getFundCodeList(){return b.getFundCodeList(this.client)}async getAllAShareQuotes(e={}){let{market:n,...r}=e,o=await this.getAShareCodeList({market:n});return b.getAllQuotesByCodes(this.client,o,r)}async getAllHKShareQuotes(e={}){let n=await this.getHKCodeList();return b.getAllHKQuotesByCodes(this.client,n,e)}async getAllUSShareQuotes(e={}){let{market:n,...r}=e,o=await this.getUSCodeList({simple:!0,market:n});return b.getAllUSQuotesByCodes(this.client,o,r)}getAllQuotesByCodes(e,n={}){return b.getAllQuotesByCodes(this.client,e,n)}batchRaw(e){return this.client.getTencentQuote(e)}getTradingCalendar(){return b.getTradingCalendar(this.client)}getDividendDetail(e){return m.getDividendDetail(this.client,e)}};var Me=class extends I{constructor(e){super(e)}getIndustryList(){return m.getIndustryList(this.client)}getIndustrySpot(e){return m.getIndustrySpot(this.client,e)}getIndustryConstituents(e){return m.getIndustryConstituents(this.client,e)}getIndustryKline(e,n){return m.getIndustryKline(this.client,e,n)}getIndustryMinuteKline(e,n){return m.getIndustryMinuteKline(this.client,e,n)}getConceptList(){return m.getConceptList(this.client)}getConceptSpot(e){return m.getConceptSpot(this.client,e)}getConceptConstituents(e){return m.getConceptConstituents(this.client,e)}getConceptKline(e,n){return m.getConceptKline(this.client,e,n)}getConceptMinuteKline(e,n){return m.getConceptMinuteKline(this.client,e,n)}};var Le=class extends I{constructor(e){super(e)}getHistoryKline(e,n){return m.getHistoryKline(this.client,e,n)}getMinuteKline(e,n){return m.getMinuteKline(this.client,e,n)}getHKHistoryKline(e,n){return m.getHKHistoryKline(this.client,e,n)}getHKMinuteKline(e,n){return m.getHKMinuteKline(this.client,e,n)}getUSHistoryKline(e,n){return m.getUSHistoryKline(this.client,e,n)}getUSMinuteKline(e,n){return m.getUSMinuteKline(this.client,e,n)}};var Ne=class extends I{constructor(e){super(e)}getFuturesKline(e,n){return m.getFuturesHistoryKline(this.client,e,n)}getGlobalFuturesSpot(e){return m.getGlobalFuturesSpot(this.client,e)}getGlobalFuturesKline(e,n){return m.getGlobalFuturesKline(this.client,e,n)}getFuturesInventorySymbols(){return m.getFuturesInventorySymbols(this.client)}getFuturesInventory(e,n){return m.getFuturesInventory(this.client,e,n)}getComexInventory(e,n){return m.getComexInventory(this.client,e,n)}};var ke=class extends I{constructor(e){super(e)}getIndexOptionSpot(e,n){return B.getIndexOptionSpot(e,n)}getIndexOptionKline(e){return B.getIndexOptionKline(e)}getCFFEXOptionQuotes(e){return m.getCFFEXOptionQuotes(this.client,e)}getETFOptionMonths(e){return B.getETFOptionMonths(e)}getETFOptionExpireDay(e,n){return B.getETFOptionExpireDay(e,n)}getETFOptionMinute(e){return B.getETFOptionMinute(e)}getETFOptionDailyKline(e){return B.getETFOptionDailyKline(e)}getETFOption5DayMinute(e){return B.getETFOption5DayMinute(e)}getCommodityOptionSpot(e,n){return B.getCommodityOptionSpot(e,n)}getCommodityOptionKline(e){return B.getCommodityOptionKline(e)}getOptionLHB(e,n){return m.getOptionLHB(this.client,e,n)}};var bs=500,Ms=15,Fe=class{constructor(e,n){this.klineService=e;this.quoteService=n}detectMarket(e){let n=kn(e);if(n==="GLOBAL")throw new S(`No kline route for GLOBAL-market symbol '${e}'; use the US kline API with a raw secid instead (e.g. kline.us('100.GDAXI'))`);return n==="HK"?"HK":n==="US"?"US":"A"}calcActualStartDate(e,n,r=1.5){let o=this.toCompactDate(e),i=Math.ceil(n*r),s=new Date(parseInt(o.slice(0,4)),parseInt(o.slice(4,6))-1,parseInt(o.slice(6,8)));s.setDate(s.getDate()-i);let u=s.getFullYear(),l=String(s.getMonth()+1).padStart(2,"0"),c=String(s.getDate()).padStart(2,"0");return`${u}${l}${c}`}calcActualStartDateByCalendar(e,n,r){if(!r||r.length===0)return;let o=r.findIndex(s=>s>=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 S(`\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,s=n.market??this.detectMarket(e),{requiredBars:u,maxRecursiveLookback:l}=xn(r),c={A:1.5,HK:1.46,US:1.45},d;if(o)if(s==="A")try{let P=await this.quoteService.getTradingCalendar();d=this.calcActualStartDateByCalendar(o,u,P)??this.calcActualStartDate(o,u,c[s])}catch{d=this.calcActualStartDate(o,u,c[s])}else d=this.calcActualStartDate(o,u,c[s]);let f={period:n.period,adjust:n.adjust,startDate:d,endDate:i?this.toCompactDate(i):void 0},p;switch(s){case"HK":p=await this.klineService.getHKHistoryKline(e,f);break;case"US":p=await this.klineService.getUSHistoryKline(e,f);break;default:p=await this.klineService.getHistoryKline(e,f)}let y=n.period??"daily",T=30+(y==="weekly"?7:y==="monthly"?31:0),D=p.length===0||d===void 0||this.normalizeRowDate(p[0].date)<=ge(this.normalizeRowDate(d),T),E=!1;if(o&&p.length<u&&D)switch(E=!0,s){case"HK":p=await this.klineService.getHKHistoryKline(e,{...f,startDate:void 0});break;case"US":p=await this.klineService.getUSHistoryKline(e,{...f,startDate:void 0});break;default:p=await this.klineService.getHistoryKline(e,{...f,startDate:void 0})}if(o){let P=p.findIndex(H=>this.normalizeRowDate(H.date)>=o);if(P===-1)return[];let L=p;if(E&&!wn(r)){let H=l>0?Math.max(u,bs,Ms*l):u;L=p.slice(Math.max(0,P-H))}return mt(L,r).filter(H=>{let U=this.normalizeRowDate(H.date);return U>=o&&(i===void 0||U<=i)})}return mt(p,r)}};var we=class extends I{constructor(e){super(e)}getIndividualFundFlow(e,n){return m.getIndividualFundFlow(this.client,e,n)}getMarketFundFlow(){return m.getMarketFundFlow(this.client)}getFundFlowRank(e){return m.getFundFlowRank(this.client,e)}getSectorFundFlowRank(e){return m.getSectorFundFlowRank(this.client,e)}getSectorFundFlowHistory(e,n){return m.getSectorFundFlowHistory(this.client,e,n)}};var xe=class extends I{constructor(e){super(e)}getNorthboundMinute(e){return m.getNorthboundMinute(this.client,e)}getNorthboundFlowSummary(){return m.getNorthboundFlowSummary(this.client)}getNorthboundHoldingRank(e){return m.getNorthboundHoldingRank(this.client,e)}getNorthboundHistory(e,n){return m.getNorthboundHistory(this.client,e,n)}getNorthboundIndividual(e,n){return m.getNorthboundIndividual(this.client,e,n)}};var Ue=class extends I{constructor(e){super(e)}getZTPool(e,n){return m.getZTPool(this.client,e,n)}getStockChanges(e){return m.getStockChanges(this.client,e)}getBoardChanges(){return m.getBoardChanges(this.client)}};var ve=class extends I{constructor(e){super(e)}getDragonTigerDetail(e){return m.getDragonTigerDetail(this.client,e)}getDragonTigerStockStats(e){return m.getDragonTigerStockStats(this.client,e)}getDragonTigerInstitution(e){return m.getDragonTigerInstitution(this.client,e)}getDragonTigerBranchRank(e){return m.getDragonTigerBranchRank(this.client,e)}getDragonTigerStockSeatDetail(e,n){return m.getDragonTigerStockSeatDetail(this.client,e,n)}};var Ke=class extends I{constructor(e){super(e)}getBlockTradeMarketStat(){return m.getBlockTradeMarketStat(this.client)}getBlockTradeDetail(e){return m.getBlockTradeDetail(this.client,e)}getBlockTradeDailyStat(e){return m.getBlockTradeDailyStat(this.client,e)}getMarginAccountInfo(){return m.getMarginAccountInfo(this.client)}getMarginTargetList(e){return m.getMarginTargetList(this.client,e)}};var Nn=class{constructor(e={}){this._ns={};this.client=new Ae(e),this.quoteService=new be(this.client),this.boardService=new Me(this.client),this.klineService=new Le(this.client),this.futuresService=new Ne(this.client),this.optionsService=new ke(this.client),this.indicatorService=new Fe(this.klineService,this.quoteService),this.fundFlowService=new we(this.client),this.northboundService=new xe(this.client),this.marketEventService=new Ue(this.client),this.dragonTigerService=new ve(this.client),this.dataService=new Ke(this.client),this.tradingCalendarService=new Oe(this.quoteService),this.fundService=new Ie(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),profile:e.getFundProfile.bind(e),theme:e.theme}})}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)}},Kd=Nn;export{gt as a,ft as b,h as c,C as d,ce as e,de as f,qe as g,w as h,pe as i,ni as j,se as k,Tt as l,_ as m,ae as n,N as o,Rt as p,Et as q,Oe as r,Ie as s,Nn as t,Kd as u};