marketmyna 0.2.0__py3-none-any.whl
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.
- marketmyna/__init__.py +14 -0
- marketmyna/agent/__init__.py +8 -0
- marketmyna/agent/agents.py +543 -0
- marketmyna/agent/context.py +69 -0
- marketmyna/agent/dashboard.py +55 -0
- marketmyna/agent/orchestrator.py +153 -0
- marketmyna/agent/sentiment.py +150 -0
- marketmyna/agent/skills.py +119 -0
- marketmyna/ai/__init__.py +1 -0
- marketmyna/ai/portfolio_optimizer.py +330 -0
- marketmyna/analysis/__init__.py +6 -0
- marketmyna/analysis/fundamental.py +329 -0
- marketmyna/analysis/sip_optimizer.py +81 -0
- marketmyna/analysis/technical.py +321 -0
- marketmyna/api/__init__.py +1 -0
- marketmyna/api/app.py +209 -0
- marketmyna/api/deps.py +63 -0
- marketmyna/api/middlewares/__init__.py +0 -0
- marketmyna/api/middlewares/auth.py +116 -0
- marketmyna/api/middlewares/csrf.py +66 -0
- marketmyna/api/middlewares/error_handler.py +38 -0
- marketmyna/api/middlewares/slashes.py +27 -0
- marketmyna/api/v1/__init__.py +0 -0
- marketmyna/api/v1/endpoints/__init__.py +0 -0
- marketmyna/api/v1/endpoints/account.py +166 -0
- marketmyna/api/v1/endpoints/agent.py +114 -0
- marketmyna/api/v1/endpoints/bot.py +38 -0
- marketmyna/api/v1/endpoints/calendar.py +269 -0
- marketmyna/api/v1/endpoints/data_sources.py +174 -0
- marketmyna/api/v1/endpoints/health.py +10 -0
- marketmyna/api/v1/endpoints/listings.py +564 -0
- marketmyna/api/v1/endpoints/macro.py +163 -0
- marketmyna/api/v1/endpoints/portfolio.py +530 -0
- marketmyna/api/v1/endpoints/push.py +119 -0
- marketmyna/api/v1/endpoints/reports.py +49 -0
- marketmyna/api/v1/endpoints/scheduler.py +219 -0
- marketmyna/api/v1/endpoints/stocks.py +400 -0
- marketmyna/api/v1/endpoints/system_config.py +157 -0
- marketmyna/api/v1/endpoints/thesis.py +112 -0
- marketmyna/api/v1/endpoints/trade.py +709 -0
- marketmyna/api/v1/endpoints/updates.py +394 -0
- marketmyna/api/v1/endpoints/watchlists.py +179 -0
- marketmyna/api/v1/router.py +43 -0
- marketmyna/bot/__init__.py +14 -0
- marketmyna/bot/commands/__init__.py +0 -0
- marketmyna/bot/commands/analyze.py +40 -0
- marketmyna/bot/commands/ask.py +51 -0
- marketmyna/bot/commands/base.py +35 -0
- marketmyna/bot/commands/batch.py +53 -0
- marketmyna/bot/commands/common.py +84 -0
- marketmyna/bot/commands/help.py +43 -0
- marketmyna/bot/commands/markets.py +153 -0
- marketmyna/bot/commands/portfolio.py +145 -0
- marketmyna/bot/commands/research.py +323 -0
- marketmyna/bot/commands/status.py +48 -0
- marketmyna/bot/commands/trade.py +176 -0
- marketmyna/bot/dispatcher.py +95 -0
- marketmyna/bot/formatting.py +25 -0
- marketmyna/bot/models.py +27 -0
- marketmyna/bot/registry.py +50 -0
- marketmyna/bot/telegram_listener.py +227 -0
- marketmyna/cli/__init__.py +1 -0
- marketmyna/cli/scheduled_run.py +292 -0
- marketmyna/core/__init__.py +6 -0
- marketmyna/core/compliance.py +53 -0
- marketmyna/core/config.py +377 -0
- marketmyna/core/constants.py +69 -0
- marketmyna/core/home.py +22 -0
- marketmyna/core/numbers.py +28 -0
- marketmyna/core/secret_store.py +104 -0
- marketmyna/core/tenant.py +130 -0
- marketmyna/data/__init__.py +8 -0
- marketmyna/data/base.py +36 -0
- marketmyna/data/categories.py +272 -0
- marketmyna/data/china.py +360 -0
- marketmyna/data/crypto.py +200 -0
- marketmyna/data/ecb_fx.py +131 -0
- marketmyna/data/extra_sources.py +569 -0
- marketmyna/data/india.py +241 -0
- marketmyna/data/india_filings.py +343 -0
- marketmyna/data/listings.py +1314 -0
- marketmyna/data/mutual_funds.py +34 -0
- marketmyna/data/news.py +98 -0
- marketmyna/data/news_search.py +346 -0
- marketmyna/data/nse_deals.py +138 -0
- marketmyna/data/resilience.py +173 -0
- marketmyna/data/sec_facts.py +252 -0
- marketmyna/data/shariah.py +283 -0
- marketmyna/data/social/__init__.py +9 -0
- marketmyna/data/social/base.py +100 -0
- marketmyna/data/social/browser.py +92 -0
- marketmyna/data/social/hackernews.py +53 -0
- marketmyna/data/social/reddit.py +397 -0
- marketmyna/data/social/stocktwits.py +63 -0
- marketmyna/data/social/valuepickr.py +53 -0
- marketmyna/data/stocks.py +197 -0
- marketmyna/data/yahoo_price.py +48 -0
- marketmyna/launcher.py +71 -0
- marketmyna/llm/__init__.py +33 -0
- marketmyna/llm/backend_factory.py +51 -0
- marketmyna/llm/backend_registry.py +19 -0
- marketmyna/llm/channels.py +447 -0
- marketmyna/llm/json_reply.py +63 -0
- marketmyna/llm/litellm_backend.py +197 -0
- marketmyna/llm/model_catalog.py +166 -0
- marketmyna/llm/model_health.py +193 -0
- marketmyna/llm/protocol.py +111 -0
- marketmyna/llm/providers.py +128 -0
- marketmyna/llm/store.py +128 -0
- marketmyna/notifiers/__init__.py +35 -0
- marketmyna/notifiers/apprise_sender.py +43 -0
- marketmyna/notifiers/astrbot.py +47 -0
- marketmyna/notifiers/bark.py +24 -0
- marketmyna/notifiers/base.py +80 -0
- marketmyna/notifiers/dingtalk.py +54 -0
- marketmyna/notifiers/discord.py +39 -0
- marketmyna/notifiers/dispatcher.py +153 -0
- marketmyna/notifiers/email.py +99 -0
- marketmyna/notifiers/feishu.py +57 -0
- marketmyna/notifiers/googlechat.py +24 -0
- marketmyna/notifiers/gotify.py +36 -0
- marketmyna/notifiers/matrix.py +28 -0
- marketmyna/notifiers/ntfy.py +36 -0
- marketmyna/notifiers/pushbullet.py +24 -0
- marketmyna/notifiers/pushover.py +41 -0
- marketmyna/notifiers/pushplus.py +41 -0
- marketmyna/notifiers/serverchan3.py +40 -0
- marketmyna/notifiers/settings_schema.py +119 -0
- marketmyna/notifiers/signal_messenger.py +25 -0
- marketmyna/notifiers/slack.py +36 -0
- marketmyna/notifiers/teams.py +37 -0
- marketmyna/notifiers/telegram.py +81 -0
- marketmyna/notifiers/twilio.py +33 -0
- marketmyna/notifiers/webhook.py +44 -0
- marketmyna/notifiers/webpush.py +222 -0
- marketmyna/notifiers/wechat.py +40 -0
- marketmyna/notifiers/whatsapp.py +27 -0
- marketmyna/portfolio/__init__.py +6 -0
- marketmyna/portfolio/analytics.py +336 -0
- marketmyna/portfolio/manager.py +383 -0
- marketmyna/portfolio/models.py +155 -0
- marketmyna/portfolio/optimizers.py +88 -0
- marketmyna/portfolio/review.py +411 -0
- marketmyna/services/__init__.py +1 -0
- marketmyna/services/accounts.py +278 -0
- marketmyna/services/ai_access.py +94 -0
- marketmyna/services/analysis_run.py +491 -0
- marketmyna/services/big_trades.py +335 -0
- marketmyna/services/brokers/__init__.py +0 -0
- marketmyna/services/brokers/angel.py +271 -0
- marketmyna/services/brokers/finnhub.py +209 -0
- marketmyna/services/byok_detect.py +196 -0
- marketmyna/services/calendar.py +748 -0
- marketmyna/services/central_banks.py +202 -0
- marketmyna/services/commodities.py +134 -0
- marketmyna/services/compare.py +307 -0
- marketmyna/services/cot.py +148 -0
- marketmyna/services/country_macro.py +135 -0
- marketmyna/services/crude_sensitivity.py +239 -0
- marketmyna/services/crypto_mood.py +135 -0
- marketmyna/services/crypto_screens.py +226 -0
- marketmyna/services/data_export.py +91 -0
- marketmyna/services/dcf.py +220 -0
- marketmyna/services/dcf_model.py +194 -0
- marketmyna/services/delivery.py +142 -0
- marketmyna/services/discovery.py +146 -0
- marketmyna/services/dividends.py +95 -0
- marketmyna/services/earnings.py +305 -0
- marketmyna/services/econ_calendar.py +495 -0
- marketmyna/services/eia_stocks.py +115 -0
- marketmyna/services/estimates.py +109 -0
- marketmyna/services/etf.py +236 -0
- marketmyna/services/etf_rotation.py +193 -0
- marketmyna/services/etf_screens.py +196 -0
- marketmyna/services/financials.py +639 -0
- marketmyna/services/fund_ai.py +181 -0
- marketmyna/services/fund_analytics.py +371 -0
- marketmyna/services/fund_cost.py +147 -0
- marketmyna/services/fund_holdings.py +664 -0
- marketmyna/services/fund_peers.py +247 -0
- marketmyna/services/fund_rotation.py +206 -0
- marketmyna/services/fund_style.py +179 -0
- marketmyna/services/funds.py +70 -0
- marketmyna/services/hot_stocks.py +358 -0
- marketmyna/services/india_flows.py +263 -0
- marketmyna/services/india_rates.py +258 -0
- marketmyna/services/investor_lenses.py +271 -0
- marketmyna/services/leadership.py +165 -0
- marketmyna/services/live_market.py +497 -0
- marketmyna/services/live_quotes.py +295 -0
- marketmyna/services/macro.py +182 -0
- marketmyna/services/market_calendar.py +399 -0
- marketmyna/services/market_mood.py +168 -0
- marketmyna/services/market_valuation.py +231 -0
- marketmyna/services/mf_holdings.py +199 -0
- marketmyna/services/mf_insights.py +132 -0
- marketmyna/services/mf_lumpsum.py +587 -0
- marketmyna/services/mf_portfolio_ai.py +195 -0
- marketmyna/services/nse_events.py +98 -0
- marketmyna/services/overview.py +366 -0
- marketmyna/services/ownership.py +143 -0
- marketmyna/services/quality_scores.py +199 -0
- marketmyna/services/rates.py +335 -0
- marketmyna/services/reconcile.py +343 -0
- marketmyna/services/report.py +584 -0
- marketmyna/services/report_i18n.py +678 -0
- marketmyna/services/rotation.py +224 -0
- marketmyna/services/runtime_scheduler.py +548 -0
- marketmyna/services/schedule_config.py +251 -0
- marketmyna/services/schedule_time.py +39 -0
- marketmyna/services/screens.py +398 -0
- marketmyna/services/sec_mdna.py +173 -0
- marketmyna/services/shariah.py +246 -0
- marketmyna/services/sip.py +148 -0
- marketmyna/services/sip_days.py +362 -0
- marketmyna/services/smart_file.py +595 -0
- marketmyna/services/smart_pdf.py +425 -0
- marketmyna/services/smart_report.py +370 -0
- marketmyna/services/social_sentiment.py +511 -0
- marketmyna/services/thesis.py +328 -0
- marketmyna/services/translate.py +146 -0
- marketmyna/services/valuation.py +173 -0
- marketmyna/services/worker_pool.py +149 -0
- marketmyna/services/world_markets.py +208 -0
- marketmyna/storage.py +722 -0
- marketmyna/strategies/README.md +51 -0
- marketmyna/strategies/bottom_volume.yaml +49 -0
- marketmyna/strategies/box_oscillation.yaml +69 -0
- marketmyna/strategies/bull_trend.yaml +49 -0
- marketmyna/strategies/chan_theory.yaml +58 -0
- marketmyna/strategies/dragon_head.yaml +44 -0
- marketmyna/strategies/emotion_cycle.yaml +79 -0
- marketmyna/strategies/event_driven.yaml +54 -0
- marketmyna/strategies/expectation_repricing.yaml +54 -0
- marketmyna/strategies/growth_quality.yaml +54 -0
- marketmyna/strategies/hot_theme.yaml +54 -0
- marketmyna/strategies/ma_golden_cross.yaml +46 -0
- marketmyna/strategies/one_yang_three_yin.yaml +37 -0
- marketmyna/strategies/shrink_pullback.yaml +46 -0
- marketmyna/strategies/volume_breakout.yaml +47 -0
- marketmyna/strategies/wave_theory.yaml +64 -0
- marketmyna/trading/__init__.py +2 -0
- marketmyna/trading/alerts.py +356 -0
- marketmyna/trading/backtest.py +317 -0
- marketmyna/trading/charges.py +82 -0
- marketmyna/trading/chart.py +197 -0
- marketmyna/trading/indicators.py +303 -0
- marketmyna/trading/journal.py +74 -0
- marketmyna/trading/knn.py +164 -0
- marketmyna/trading/lots.py +109 -0
- marketmyna/trading/market_hours.py +66 -0
- marketmyna/trading/options.py +554 -0
- marketmyna/trading/pairs.py +94 -0
- marketmyna/trading/risk.py +170 -0
- marketmyna/trading/scanner.py +500 -0
- marketmyna/trading/volatility.py +163 -0
- marketmyna/utils/__init__.py +1 -0
- marketmyna/utils/deadline.py +36 -0
- marketmyna/utils/log_redact.py +52 -0
- marketmyna/utils/yahoo_gate.py +183 -0
- marketmyna/utils/yf_lock.py +12 -0
- marketmyna/web/apple-touch-icon.png +0 -0
- marketmyna/web/assets/Account-CA9NFDKO.js +1 -0
- marketmyna/web/assets/Analyze-uM0srB_U.js +7 -0
- marketmyna/web/assets/AreaChart-2i67V6Jf.js +1 -0
- marketmyna/web/assets/BarChart-_yngarVl.js +3 -0
- marketmyna/web/assets/Bot-E4gpf1qZ.js +1 -0
- marketmyna/web/assets/CandleChart-CioqTqMV.js +1 -0
- marketmyna/web/assets/Compare-D6_2CPl4.js +1 -0
- marketmyna/web/assets/ExportMenu-DaZ1xVmW.js +1 -0
- marketmyna/web/assets/LineChart-BaOkD1Ta.js +57 -0
- marketmyna/web/assets/Markets-BMw_M1sJ.js +1 -0
- marketmyna/web/assets/Portfolio-DQEdHVc2.js +1 -0
- marketmyna/web/assets/ReportView-BzhdcqSh.js +1 -0
- marketmyna/web/assets/Scheduler-I9PDKxTd.js +1 -0
- marketmyna/web/assets/Settings-DpXfHolW.js +3 -0
- marketmyna/web/assets/SipDays-C9q3bNSx.js +1 -0
- marketmyna/web/assets/SymbolSearch-CBOVPEk1.js +1 -0
- marketmyna/web/assets/Trade-_CM7HC4H.js +2 -0
- marketmyna/web/assets/TradeChart-ZjsycacC.js +1 -0
- marketmyna/web/assets/WatchButton-ComYW56_.js +1 -0
- marketmyna/web/assets/Watchlist-DAjLb0jd.js +1 -0
- marketmyna/web/assets/app-BP1o7WZS.js +1 -0
- marketmyna/web/assets/app-BkIUKdld.js +1 -0
- marketmyna/web/assets/app-CKeSYhEt.js +1 -0
- marketmyna/web/assets/app-CN1OERYX.js +1 -0
- marketmyna/web/assets/app-DIQllha5.js +1 -0
- marketmyna/web/assets/app-DeiAW0tX.js +1 -0
- marketmyna/web/assets/br-Cu5YU29T.svg +45 -0
- marketmyna/web/assets/browser-CR-ks2Fp.js +19 -0
- marketmyna/web/assets/browser-D5K_K_gj.js +1 -0
- marketmyna/web/assets/common-0wvpAVpd.js +1 -0
- marketmyna/web/assets/common-3ghy53Us.js +1 -0
- marketmyna/web/assets/common-Bib2unjX.js +1 -0
- marketmyna/web/assets/common-BvSJP0w_.js +1 -0
- marketmyna/web/assets/common-CSfyC0Sp.js +1 -0
- marketmyna/web/assets/common-C_t-iZPf.js +1 -0
- marketmyna/web/assets/compare-DMcsx70H.js +1 -0
- marketmyna/web/assets/es-d5m8M5h8.svg +544 -0
- marketmyna/web/assets/exporter-DiMg2O5d.js +3 -0
- marketmyna/web/assets/files-CpgiZRbN.js +1 -0
- marketmyna/web/assets/format-d8InM0Zw.js +9 -0
- marketmyna/web/assets/html2canvas-Bw0OShmD.js +5 -0
- marketmyna/web/assets/index-CKAnq-Or.js +12 -0
- marketmyna/web/assets/index-D4U8E6LH.css +2 -0
- marketmyna/web/assets/index.es-iBEw7jOv.js +5 -0
- marketmyna/web/assets/ir-cCIgaNf6.svg +219 -0
- marketmyna/web/assets/jspdf.es.min-C4285IdL.js +79 -0
- marketmyna/web/assets/jspdf.plugin.autotable-2eOJeXl-.js +2 -0
- marketmyna/web/assets/lightweight-charts.production-BF2noug5.js +1 -0
- marketmyna/web/assets/listings-BefgXpb1.js +1 -0
- marketmyna/web/assets/liveQuotes-CtSmCUFA.js +1 -0
- marketmyna/web/assets/markets-BI4AhI9W.js +1 -0
- marketmyna/web/assets/markets-BUHUdYpT.js +1 -0
- marketmyna/web/assets/markets-BqvN1Bvf.js +1 -0
- marketmyna/web/assets/markets-DPO40TTe.js +1 -0
- marketmyna/web/assets/markets-bsiPo-Tk.js +1 -0
- marketmyna/web/assets/markets-ff1e792u.js +1 -0
- marketmyna/web/assets/montecarlo-BsNlH2qe.js +1 -0
- marketmyna/web/assets/options-BYAZnwzW.js +1 -0
- marketmyna/web/assets/preload-helper-BLdHbfdN.js +1 -0
- marketmyna/web/assets/purify.es-Dqk5qvad.js +3 -0
- marketmyna/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- marketmyna/web/assets/sa-Dh79zbT9.svg +25 -0
- marketmyna/web/assets/toast-DDradTZw.js +1 -0
- marketmyna/web/assets/trade-fndw1Ql3.js +1 -0
- marketmyna/web/assets/ui-gsFb8B2m.js +1 -0
- marketmyna/web/assets/watchlists-B6YqwUIk.js +1 -0
- marketmyna/web/brand/logo-mark.webp +0 -0
- marketmyna/web/favicon.png +0 -0
- marketmyna/web/icon-192.png +0 -0
- marketmyna/web/icon-512.png +0 -0
- marketmyna/web/index.html +34 -0
- marketmyna/web/manifest.webmanifest +28 -0
- marketmyna/web/robots.txt +2 -0
- marketmyna/web/sw.js +40 -0
- marketmyna/web/theme-init.js +37 -0
- marketmyna-0.2.0.dist-info/METADATA +345 -0
- marketmyna-0.2.0.dist-info/RECORD +344 -0
- marketmyna-0.2.0.dist-info/WHEEL +5 -0
- marketmyna-0.2.0.dist-info/entry_points.txt +2 -0
- marketmyna-0.2.0.dist-info/licenses/LICENSE +202 -0
- marketmyna-0.2.0.dist-info/licenses/NOTICE +22 -0
- marketmyna-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CandleChart-CioqTqMV.js","assets/rolldown-runtime-XKyaHtl9.js","assets/format-d8InM0Zw.js","assets/preload-helper-BLdHbfdN.js","assets/index-CKAnq-Or.js","assets/toast-DDradTZw.js","assets/ui-gsFb8B2m.js","assets/files-CpgiZRbN.js","assets/index-D4U8E6LH.css","assets/lightweight-charts.production-BF2noug5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{b as t,c as n,d as r,f as i,l as a,n as o,o as s,p as c,s as l,t as u}from"./format-d8InM0Zw.js";import{t as d}from"./preload-helper-BLdHbfdN.js";import{t as f}from"./toast-DDradTZw.js";import{D as p,E as m,O as h,T as g,_,a as v,b as y,c as b,d as ee,f as x,g as S,i as C,k as w,l as T,n as E,o as D,p as te,r as O,s as ne,t as re,u as ie,v as k,x as A,y as j}from"./ui-gsFb8B2m.js";import{O as M,j as ae,n as oe,t as se}from"./index-CKAnq-Or.js";import{a as ce,c as le,d as N,f as P,h as ue,i as de,l as F,m as fe,n as pe,r as me,s as he,t as ge,u as _e}from"./AreaChart-2i67V6Jf.js";import{R as I,a as L,d as ve,i as R,pt as ye,r as z,t as be,u as B,yt as V}from"./LineChart-BaOkD1Ta.js";import{n as xe,r as H,s as Se,t as Ce}from"./BarChart-_yngarVl.js";import{i as we,l as Te,n as Ee,r as De,s as Oe,t as ke}from"./WatchButton-ComYW56_.js";import{a as Ae,i as je,n as Me,o as U,r as Ne,t as Pe}from"./montecarlo-BsNlH2qe.js";import{S as Fe,a as Ie,b as Le,c as Re,d as ze,h as Be,l as Ve,m as He,o as Ue,p as We,r as Ge,s as Ke,u as qe,v as Je}from"./listings-BefgXpb1.js";import{b as Ye,d as Xe}from"./trade-fndw1Ql3.js";import{a as Ze,i as Qe,n as $e,r as et}from"./options-BYAZnwzW.js";import{a as tt,c as nt,i as rt,l as it,o as at,r as ot,t as st}from"./compare-DMcsx70H.js";import{i as ct,n as lt}from"./SipDays-C9q3bNSx.js";import{n as ut,t as dt}from"./SymbolSearch-CBOVPEk1.js";var W=e(t(),1);async function ft(e,t,n){let r=await fetch(`/api/v1/agent/analyze/stream`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:n});if(r.status===401&&window.dispatchEvent(new Event(w)),!r.ok||!r.body){let e=await r.json().catch(()=>null);throw Error(e?.message||`Stream request failed: HTTP ${r.status}`)}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:n}=await i.read();if(e)break;o+=a.decode(n,{stream:!0});let r;for(;(r=o.indexOf(`
|
|
3
|
+
|
|
4
|
+
`))!==-1;){let e=o.slice(0,r);o=o.slice(r+2);let n=e.split(`
|
|
5
|
+
`).find(e=>e.startsWith(`data: `));if(n)try{t(JSON.parse(n.slice(6)))}catch{continue}}}}async function pt(){return(await h.get(`/agent/status`)).data}var G=c(),mt=1e3,ht=3e4,gt=6e4;function _t(){let[e,t]=(0,W.useState)(()=>document.visibilityState!==`hidden`);return(0,W.useEffect)(()=>{let e=()=>t(document.visibilityState!==`hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}function vt(e,t,n){let[r,i]=(0,W.useState)(null),[a,o]=(0,W.useState)(null);return(0,W.useEffect)(()=>{i(null),o(null);let t=!1,r,a,s=null,c=()=>{a=new AbortController,e(a.signal).then(e=>{s=e,i(e),o(null)}).catch(e=>{a?.signal.aborted||o(e instanceof Error?e.message:`Could not load`)}).finally(()=>{t||(r=setTimeout(c,n(s)))})};return c(),()=>{t=!0,a?.abort(),clearTimeout(r)}},t),{data:r,error:a}}function yt({levels:e,side:t,max:n}){let r=[...e,...Array(Math.max(0,5-e.length)).fill(null)];return(0,G.jsxs)(`table`,{className:`tabular w-full text-xs`,children:[(0,G.jsx)(`thead`,{className:`text-faint`,children:(0,G.jsx)(`tr`,{children:t===`buy`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`th`,{className:`py-1 text-start font-medium`,children:`Orders`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`Qty`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`Bid`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`th`,{className:`py-1 text-start font-medium`,children:`Offer`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`Qty`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`Orders`})]})})}),(0,G.jsx)(`tbody`,{children:r.map((e,r)=>{let i=e&&n?`${Math.max(4,e.quantity/n*100)}%`:`0%`,a=(0,G.jsx)(`span`,{"aria-hidden":`true`,className:p(`absolute inset-y-0.5 rounded-sm`,t===`buy`?`end-0 bg-up-soft`:`start-0 bg-down-soft`),style:{width:i}});return(0,G.jsx)(`tr`,{className:`relative`,children:t===`buy`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`td`,{className:`py-0.5 text-start text-faint`,children:e?.orders??`—`}),(0,G.jsx)(`td`,{className:`py-0.5 text-end`,children:e?e.quantity.toLocaleString():`—`}),(0,G.jsxs)(`td`,{className:`relative py-0.5 ps-2 text-end font-medium text-up`,children:[a,(0,G.jsx)(`span`,{className:`relative`,children:e?s(e.price):`—`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`td`,{className:`relative py-0.5 pe-2 text-start font-medium text-down`,children:[a,(0,G.jsx)(`span`,{className:`relative`,children:e?s(e.price):`—`})]}),(0,G.jsx)(`td`,{className:`py-0.5 text-end`,children:e?e.quantity.toLocaleString():`—`}),(0,G.jsx)(`td`,{className:`py-0.5 text-end text-faint`,children:e?.orders??`—`})]})},r)})})]})}function bt({label:e,value:t,sub:n}){return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-xs text-muted`,children:e}),(0,G.jsx)(`div`,{className:`tabular truncate text-sm font-semibold`,children:t}),n&&(0,G.jsx)(`div`,{className:`truncate text-[11px] text-faint`,children:n})]})}function xt({symbol:e,market:t}){let n=_t(),r=t===`india`,i=vt(n=>Le(e,t,n),[e,t,n],e=>n&&e?.open?mt:ht),a=vt(async()=>(await Ye(e,t,`5m`,`1d`,[])).bars,[e,t,n],()=>n?gt:5*gt),o=i.data?.quote,c=o?.depth,l=o?.buy_qty!=null&&o?.sell_qty!=null,d=l?o.buy_qty+o.sell_qty:0,f=d>0,m=d?o.buy_qty/d*100:50,h=Math.max(1,...(c?.buy??[]).map(e=>e.quantity),...(c?.sell??[]).map(e=>e.quantity)),g=i.data?.delivery,_=a.data??[],v=_.length?new Date(_[_.length-1].time*1e3).toISOString().slice(0,10):null,y=_.filter(e=>new Date(e.time*1e3).toISOString().slice(0,10)===v);return(0,G.jsxs)(`div`,{className:`mt-5 space-y-4 border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Trading activity`}),i.data&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] text-faint`,children:[(0,G.jsx)(`span`,{className:p(`h-1.5 w-1.5 rounded-full`,i.data.open?`animate-pulse bg-up`:`bg-faint`)}),i.data.open?`Live · ${i.data.source}`:`Market closed · last session`]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-8 gap-y-3 sm:grid-cols-4`,children:[(0,G.jsx)(bt,{label:`Volume today`,value:i.data?u(o?.volume):(0,G.jsx)(j,{className:`mt-1 h-5 w-16`}),sub:o?.last_qty?`last trade ${o.last_qty.toLocaleString()} shares`:`\xA0`}),o?.avg_price!=null&&(0,G.jsx)(bt,{label:`Average traded price`,value:s(o.avg_price),sub:`volume-weighted, today`}),r&&(0,G.jsx)(bt,{label:`Delivery`,value:g?.percent==null?g?.loading?(0,G.jsx)(j,{className:`mt-1 h-5 w-12`}):`—`:`${s(g.percent,1)}%`,sub:g?.percent==null?g?.loading?`loading the exchange file…`:`not published for this share`:`${u(g.delivered)} of ${u(g.traded)} shares kept · ${g.date}`}),o?.lower_circuit!=null&&o?.upper_circuit!=null&&(0,G.jsx)(bt,{label:`Circuit band`,value:`${s(o.lower_circuit)} – ${s(o.upper_circuit)}`,sub:`price can't move outside today`})]}),r&&(f?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 flex justify-between text-xs`,children:[(0,G.jsxs)(`span`,{className:`text-up`,children:[`Buyers waiting `,(0,G.jsx)(`b`,{className:`tabular`,children:u(o.buy_qty)}),` (`,s(m,0),`%)`]}),(0,G.jsxs)(`span`,{className:`text-down`,children:[`(`,s(100-m,0),`%) `,(0,G.jsx)(`b`,{className:`tabular`,children:u(o.sell_qty)}),` sellers waiting`]})]}),(0,G.jsxs)(`div`,{className:`flex h-2.5 overflow-hidden rounded-full bg-raised`,role:`img`,"aria-label":`Buy ${s(m,0)}%, sell ${s(100-m,0)}%`,children:[(0,G.jsx)(`div`,{className:`bg-up transition-[width] duration-500`,style:{width:`${m}%`}}),(0,G.jsx)(`div`,{className:`flex-1 bg-down`})]}),(0,G.jsx)(`p`,{className:`mt-1 text-[11px] text-faint`,children:`Total shares in pending buy and sell orders on the exchange right now.`})]}),c&&(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(yt,{levels:c.buy,side:`buy`,max:h}),(0,G.jsx)(yt,{levels:c.sell,side:`sell`,max:h})]})]}):i.data&&(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:l?`No pending orders right now: the order book fills during market hours (9:15 am – 3:30 pm IST).`:`Pending buy / sell quantity and the order book show when the live broker feed is on for Indian shares.`})),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`font-medium text-muted`,children:`Volume every 5 minutes`}),v&&(0,G.jsxs)(`span`,{className:`text-[11px] text-faint`,children:[v,` · updates every minute`]})]}),(0,G.jsx)(`div`,{className:`h-28`,children:y.length?(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(Ce,{data:y,margin:{top:4,right:4,bottom:0,left:0},children:[(0,G.jsx)(R,{dataKey:`time`,tickFormatter:e=>new Date(e*1e3).toISOString().slice(11,16),tick:{fill:`var(--color-faint)`,fontSize:10},axisLine:!1,tickLine:!1,minTickGap:40}),(0,G.jsx)(z,{width:40,tickFormatter:e=>u(e),tick:{fill:`var(--color-faint)`,fontSize:10},axisLine:!1,tickLine:!1}),(0,G.jsx)(I,{cursor:{fill:`var(--color-raised)`},contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12},labelFormatter:e=>new Date(Number(e)*1e3).toISOString().slice(11,16),formatter:e=>[Number(e).toLocaleString(),`Shares`]}),(0,G.jsx)(xe,{dataKey:`volume`,isAnimationActive:!1,radius:[2,2,0,0],children:y.map(e=>(0,G.jsx)(Se,{fill:e.close>=e.open?`var(--color-up)`:`var(--color-down)`,fillOpacity:.75},e.time))})]})}):a.error?(0,G.jsx)(`div`,{className:`grid h-full place-items-center text-xs text-faint`,children:`Intraday volume unavailable`}):a.data?(0,G.jsx)(`div`,{className:`grid h-full place-items-center text-xs text-faint`,children:`No trades yet this session`}):(0,G.jsx)(j,{className:`h-full w-full`})}),(0,G.jsx)(`p`,{className:`mt-1 text-[11px] text-faint`,children:`Green: the price closed higher in that 5 minutes, red: lower.`})]})]})}var St=(0,W.lazy)(()=>d(()=>import(`./CandleChart-CioqTqMV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Ct=[{value:`line`,label:`Line`},{value:`candles`,label:`Candles`}],wt=[{value:`auto`,label:`Auto`},{value:`1d`,label:`Daily`},{value:`1wk`,label:`Weekly`}],Tt=[20,50,200],Et=`marketmyna.chart`;function Dt(){let e={mode:`line`,interval:`auto`,averages:[20,50]};try{return{...e,...JSON.parse(localStorage.getItem(Et)??`{}`)}}catch{return e}}function Ot(e){try{localStorage.setItem(Et,JSON.stringify(e))}catch{}}function kt(e){if(!e.length)return[];let t=Object.keys(e[0]),n=t.find(e=>/date|time|index/i.test(e)),[r,i,a,o,s]=[`open`,`high`,`low`,`close`,`volume`].map(e=>t.find(t=>t.toLowerCase()===e));if(!n||!o)return[];let c=new Set;return e.map(e=>{let t=Number(e[o]);return{time:Math.floor(new Date(e[n]).getTime()/1e3),open:r?Number(e[r]):t,high:i?Number(e[i]):t,low:a?Number(e[a]):t,close:t,volume:s?Number(e[s]):null}}).filter(e=>Number.isFinite(e.time)&&Number.isFinite(e.close)&&!c.has(e.time)&&c.add(e.time)).sort((e,t)=>e.time-t.time)}function At({symbol:e,market:t}){let[n,r]=(0,W.useState)(`6mo`),[i,a]=(0,W.useState)(Dt),[c,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null),m=i.interval===`auto`?n===`5y`?`1wk`:`1d`:i.interval;(0,W.useEffect)(()=>{let r=!1;return u(null),f(null),F(e,t,n,m).then(e=>!r&&u(e)).catch(e=>!r&&f(o(e))),()=>{r=!0}},[e,t,n,m]);function h(e){a(t=>{let n={...t,...e};return Ot(n),n})}let g=(0,W.useMemo)(()=>c?kt(c):[],[c]),_=(0,W.useMemo)(()=>g.map(e=>({t:e.time*1e3,close:e.close})),[g]),v=(0,W.useMemo)(()=>{if(_.length<2)return null;let e=_[0].close;return(_[_.length-1].close-e)/e*100},[_]),y=(v??0)>=0,b=y?`var(--color-up)`:`var(--color-down)`,ee=n===`1y`||n===`5y`,x=i.mode===`candles`;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(S,{options:Ct,value:i.mode,onChange:e=>h({mode:e}),size:`sm`}),(0,G.jsxs)(`div`,{className:`text-xs text-muted`,children:[`Period change`,` `,(0,G.jsx)(`span`,{className:`tabular font-semibold ${v==null?``:y?`text-up`:`text-down`}`,children:l(v)})]})]}),(0,G.jsx)(S,{options:Qe,value:n,onChange:r,size:`sm`})]}),x&&(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(S,{options:wt,value:i.interval,onChange:e=>h({interval:e}),size:`sm`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted`,children:[(0,G.jsx)(`span`,{children:`Moving averages`}),Tt.map(e=>{let t=i.averages.includes(e);return(0,G.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>h({averages:t?i.averages.filter(t=>t!==e):[...i.averages,e].sort((e,t)=>e-t)}),className:p(`rounded-full border px-2 py-0.5 font-medium`,t?`border-accent bg-accent-soft text-fg`:`border-line hover:text-fg`),children:e},e)})]})]}),(0,G.jsx)(`div`,{className:x?`h-80`:`h-56`,children:d?(0,G.jsxs)(`div`,{className:`grid h-full place-items-center text-xs text-muted`,children:[`History unavailable: `,d]}):c==null?(0,G.jsx)(j,{className:`h-full w-full`}):_.length===0?(0,G.jsx)(`div`,{className:`grid h-full place-items-center text-xs text-muted`,children:`No price history for this range.`}):x?(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(j,{className:`h-full w-full`}),children:(0,G.jsx)(St,{candles:g,averages:i.averages,intraday:!1})}):(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(ge,{data:_,margin:{top:4,right:4,bottom:0,left:0},children:[(0,G.jsx)(`defs`,{children:(0,G.jsxs)(`linearGradient`,{id:`priceFill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:b,stopOpacity:.25}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:b,stopOpacity:0})]})}),(0,G.jsx)(B,{stroke:`var(--color-line)`,vertical:!1}),(0,G.jsx)(R,{dataKey:`t`,type:`number`,domain:[`dataMin`,`dataMax`],scale:`time`,tickFormatter:e=>new Date(e).toLocaleDateString(void 0,ee?{month:`short`,year:`2-digit`}:{month:`short`,day:`numeric`}),tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1,minTickGap:40}),(0,G.jsx)(z,{domain:[`auto`,`auto`],orientation:`right`,width:56,tickFormatter:e=>s(e,e>=1e3?0:2),tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1}),(0,G.jsx)(I,{cursor:{stroke:`var(--color-line-strong)`},contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12},labelFormatter:e=>new Date(Number(e)).toLocaleDateString(),formatter:e=>[s(Number(e)),`Close`]}),(0,G.jsx)(H,{type:`monotone`,dataKey:`close`,stroke:b,strokeWidth:1.75,fill:`url(#priceFill)`})]})})}),x&&(0,G.jsx)(`p`,{className:`mt-1.5 text-[12px] text-faint`,children:`Scroll to zoom, drag to pan, hover a candle for open / high / low / close. A moving average appears once the period has more bars than its length (e.g. pick 1Y for the 200-day line).`})]})}var jt=[{key:`income`,title:`Income statement`,hint:`Revenue, costs and profit over the period`},{key:`balance`,title:`Balance sheet`,hint:`What the company owns and owes at period end`},{key:`cashflow`,title:`Cash flow`,hint:`Cash actually generated and where it went`}],Mt={income:[{key:`revenue_growth`,label:`Revenue growth`,kind:`pct`,hint:`Latest period vs the comparable one`},{key:`revenue_cagr`,label:`Revenue CAGR`,kind:`pct`,hint:`Compound annual growth across the periods shown`},{key:`eps_growth`,label:`EPS growth`,kind:`pct`,hint:`Diluted earnings per share, latest vs comparable period`},{key:`gross_margin`,label:`Gross margin`,kind:`pct`,hint:`Revenue left after direct costs`},{key:`operating_margin`,label:`Operating margin`,kind:`pct`,hint:`Profit from the core business per unit of revenue`},{key:`net_margin`,label:`Net margin`,kind:`pct`,hint:`Bottom-line profit per unit of revenue`},{key:`interest_coverage`,label:`Interest coverage`,kind:`x`,hint:`Operating profit / interest expense`},{key:`effective_tax_rate`,label:`Effective tax rate`,kind:`pct`,hint:`Tax / pre-tax income`}],balance:[{key:`current_ratio`,label:`Current ratio`,kind:`x`,hint:`Current assets / current liabilities`},{key:`quick_ratio`,label:`Quick ratio`,kind:`x`,hint:`Current assets excluding inventory / current liabilities`},{key:`debt_to_equity`,label:`Debt / equity`,kind:`x`,hint:`Total debt / shareholders equity`},{key:`net_debt`,label:`Net debt`,kind:`money`,hint:`Debt minus cash (negative = net cash)`},{key:`working_capital`,label:`Working capital`,kind:`money`,hint:`Current assets minus current liabilities`},{key:`roe`,label:`Return on equity`,kind:`pct`,hint:`Net income / average equity`},{key:`roa`,label:`Return on assets`,kind:`pct`,hint:`Net income / total assets`},{key:`book_value_per_share`,label:`Book value / share`,kind:`num`,hint:`Equity / shares outstanding`},{key:`goodwill_to_assets`,label:`Goodwill / assets`,kind:`pct`,hint:`Share of assets that are acquisition goodwill & intangibles`}],cashflow:[{key:`free_cf`,label:`Free cash flow`,kind:`money`,hint:`Operating cash flow minus capex`},{key:`fcf_margin`,label:`FCF margin`,kind:`pct`,hint:`Free cash flow / revenue`},{key:`cash_conversion`,label:`Cash conversion`,kind:`x`,hint:`Operating cash flow / net income (above 1 is healthy)`},{key:`capex_to_revenue`,label:`Capex / revenue`,kind:`pct`,hint:`Reinvestment intensity`},{key:`shareholder_returns`,label:`Dividends + buybacks`,kind:`money`,hint:`Cash returned to shareholders`},{key:`fcf_payout`,label:`Payout of FCF`,kind:`pct`,hint:`Dividends + buybacks / free cash flow`},{key:`sbc_to_revenue`,label:`Stock comp / revenue`,kind:`pct`,hint:`Stock-based compensation as a share of revenue`}]},Nt={income:[{key:`revenue`,color:`var(--color-accent)`},{key:`operating_income`,color:`var(--color-warn)`},{key:`net_income`,color:`var(--color-up)`}],balance:[{key:`total_assets`,color:`var(--color-accent)`},{key:`total_liabilities`,color:`var(--color-down)`},{key:`equity`,color:`var(--color-up)`}],cashflow:[{key:`operating_cf`,color:`var(--color-accent)`},{key:`capex`,color:`var(--color-down)`},{key:`free_cf`,color:`var(--color-up)`}]},Pt={strong:`up`,mixed:`warn`,weak:`down`,"n/a":`neutral`},Ft={good:`bg-up`,bad:`bg-down`,neutral:`bg-warn`,info:`bg-faint`};function It(e,t){return typeof e!=`number`||!Number.isFinite(e)?`—`:t===`pct`?`${s(e,1)}%`:t===`x`?`${s(e,2)}x`:t===`money`?u(e):s(e,2)}function Lt({verdict:e}){return(0,G.jsxs)(E,{tone:Pt[e.label],children:[e.label,e.score!=null&&(0,G.jsx)(`span`,{className:`font-normal opacity-80`,children:e.score})]})}function Rt({text:e}){let t=e=>e.split(/(\*\*[^*]+\*\*)/g).map((e,t)=>e.startsWith(`**`)&&e.endsWith(`**`)?(0,G.jsx)(`strong`,{children:e.slice(2,-2)},t):e);return(0,G.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-fg/90`,children:e.split(`
|
|
6
|
+
`).map((e,n)=>{let r=e.trim();if(!r)return null;let i=r.match(/^#{1,4}\s+(.*)$/);return i?(0,G.jsx)(`h3`,{className:`pt-2 text-xs font-semibold tracking-wide text-muted uppercase`,children:t(i[1])},n):/^[-*]\s+/.test(r)?(0,G.jsxs)(`p`,{className:`flex gap-2 ps-1`,children:[(0,G.jsx)(`span`,{className:`text-faint`,children:`•`}),(0,G.jsx)(`span`,{children:t(r.replace(/^[-*]\s+/,``))})]},n):(0,G.jsx)(`p`,{children:t(r)},n)})})}function zt({statement:e,periods:t,series:n}){let r=n.map(t=>({...t,row:e.rows.find(e=>e.key===t.key)})).filter(e=>e.row!=null);if(!r.length)return null;let i=t.map((e,t)=>({period:e,...Object.fromEntries(r.map(e=>[e.row.label,e.row.values[t]]))})).filter(e=>r.some(t=>e[t.row.label]!=null)).reverse();return i.length<2?null:(0,G.jsx)(`div`,{className:`h-56`,children:(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(Ce,{data:i,margin:{top:8,right:8,bottom:0,left:0},children:[(0,G.jsx)(B,{stroke:`var(--color-line)`,vertical:!1}),(0,G.jsx)(R,{dataKey:`period`,tick:{fill:`var(--color-faint)`,fontSize:11},tickLine:!1,axisLine:!1}),(0,G.jsx)(z,{tick:{fill:`var(--color-faint)`,fontSize:11},tickLine:!1,axisLine:!1,width:56,tickFormatter:e=>u(e)}),(0,G.jsx)(I,{cursor:{fill:`var(--color-raised)`},contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12},labelStyle:{color:`var(--color-muted)`},formatter:e=>u(typeof e==`number`?e:Number(e))}),(0,G.jsx)(ye,{wrapperStyle:{fontSize:12},itemSorter:null}),r.map(e=>(0,G.jsx)(xe,{dataKey:e.row.label,fill:e.color,radius:[3,3,0,0],maxBarSize:28},e.key))]})})})}function Bt({data:e,which:t}){let n=e[t],r=Mt[t].filter(e=>typeof n.metrics[e.key]==`number`),i=e.periods.map((e,t)=>({p:e,i:t})).filter(({i:e})=>n.rows.filter(t=>t.values[e]!=null).length>=Math.max(1,n.rows.length*.3)),a=t===`income`&&typeof n.metrics.compare_label==`string`?n.metrics.compare_label:null;return n.rows.length?(0,G.jsxs)(`div`,{className:`space-y-5`,children:[r.length>0&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md bg-canvas px-3 py-2`,title:e.hint,children:[(0,G.jsx)(`div`,{className:`text-[12px] text-faint`,children:e.label}),(0,G.jsx)(`div`,{className:`tabular text-sm font-medium`,children:It(n.metrics[e.key],e.kind)})]},e.key))}),a&&(0,G.jsxs)(`p`,{className:`-mt-3 text-[12px] text-faint`,children:[`Growth compares the latest period with the `,a,`.`]}),n.findings.length>0&&(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:n.findings.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5 text-sm`,children:[(0,G.jsx)(`span`,{className:p(`mt-1.5 h-2 w-2 shrink-0 rounded-full`,Ft[e.tone])}),(0,G.jsx)(`span`,{className:p(e.tone===`info`&&`text-muted`),children:e.text})]},t))}),(0,G.jsx)(zt,{statement:n,periods:e.periods,series:Nt[t]}),(0,G.jsx)(`div`,{className:`-mx-5 overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-y border-line text-[12px] text-faint`,children:[(0,G.jsx)(`th`,{className:`sticky start-0 bg-surface px-5 py-2 text-start font-medium`,children:e.currency??``}),i.map(({p:e})=>(0,G.jsx)(`th`,{className:`px-3 py-2 text-end font-medium whitespace-nowrap`,children:e},e))]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:n.rows.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`sticky start-0 bg-surface px-5 py-1.5 whitespace-nowrap text-muted`,children:e.label}),i.map(({i:t})=>{let n=e.values[t];return(0,G.jsx)(`td`,{className:p(`tabular px-3 py-1.5 text-end whitespace-nowrap`,n!=null&&n<0&&`text-down`),children:e.kind===`money`?u(n):s(n,e.key===`eps`?2:0)},t)})]},e.key))})]})})]}):(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Not available: no `,t===`cashflow`?`cash flow`:t,` data published for this period.`]})}function Vt({symbol:e,market:t}){let[n,r]=(0,W.useState)(`annual`),[i,a]=(0,W.useState)(`income`),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)({});return(0,W.useEffect)(()=>{if(t===`crypto`)return;let r=!1;return c(null),u(null),f({}),he(e,t,n).then(e=>!r&&c(e)).catch(e=>!r&&u(o(e))),()=>{r=!0}},[e,t,n]),t===`crypto`?null:(0,G.jsxs)(C,{id:`section-financials`,section:`Financial statements`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Financial statements `,s&&(0,G.jsx)(Lt,{verdict:s.overall})]}),description:s?[`${s.period} filings`,s.currency,s.sector,`source ${s.source}`].filter(Boolean).join(` · `):`Income statement, balance sheet and cash flow`}),(0,G.jsxs)(v,{className:`space-y-6`,children:[(0,G.jsx)(S,{size:`sm`,value:n,onChange:e=>r(e),options:[{value:`annual`,label:`Annual`},{value:`quarterly`,label:`Quarterly`}]}),l?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Not available: `,l]}):s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm leading-relaxed`,children:s.summary}),(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:jt.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(e.key),title:e.hint,className:p(`rounded-lg border px-3 py-2.5 text-start transition-colors`,i===e.key?`border-accent bg-accent-soft`:`border-line hover:border-line-strong`),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,G.jsx)(Lt,{verdict:s[e.key].verdict})]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-faint`,children:[s[e.key].verdict.good,` positive · `,s[e.key].verdict.bad,` negative`,s[e.key].as_of&&` · as of ${s[e.key].as_of}`]})]},e.key))}),d.text?(0,G.jsxs)(`div`,{className:`rounded-lg border border-line bg-canvas p-4`,children:[(0,G.jsx)(`div`,{className:`mb-1 text-xs font-medium text-accent-fg`,children:`AI analyst summary`}),(0,G.jsx)(Rt,{text:d.text})]}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(O,{size:`sm`,variant:`secondary`,icon:`cpu`,loading:d.loading,onClick:()=>{f({loading:!0}),le(e,t,n).then(e=>f({text:e})).catch(e=>f({error:o(e)}))},children:d.loading?`Writing analysis…`:`AI analyst summary`}),(0,G.jsx)(`span`,{className:`text-[12px] text-faint`,children:`Uses your configured AI model to read all three statements.`})]}),d.error&&(0,G.jsx)(re,{title:`AI summary failed`,onDismiss:()=>f({}),children:d.error})]}),s.quality&&(0,G.jsx)(qt,{q:s.quality}),(0,G.jsxs)(`div`,{className:`space-y-4 border-t border-line pt-5`,children:[(0,G.jsx)(S,{value:i,onChange:e=>a(e),options:jt.map(e=>({value:e.key,label:e.title,hint:e.hint})),showHint:!0}),(0,G.jsx)(Bt,{data:s,which:i})]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`Rule-based reading of published filings - facts, not advice. Figures as reported by `,s.source,`; missing rows mean the company or data source doesn't publish them.`]})]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(j,{className:`h-16 w-full`}),(0,G.jsx)(j,{className:`h-48 w-full`})]})]})]})}var Ht={strong:`up`,average:`warn`,weak:`down`},Ut={safe:`up`,grey:`warn`,distress:`down`},Wt={working_capital:`Working capital / assets`,retained_earnings:`Retained earnings / assets`,ebit:`Operating profit / assets`,market_value_to_liabilities:`Market value / liabilities`,book_equity_to_liabilities:`Book equity / liabilities`,sales:`Sales / assets`},Gt={DSRI:`Receivables vs sales`,GMI:`Gross margin slip`,AQI:`Soft assets share`,SGI:`Sales growth`,DEPI:`Depreciation slowdown`,SGAI:`Overheads per sale`,LVGI:`Leverage change`,TATA:`Accruals to assets`};function Kt({title:e,badge:t,children:n}){return(0,G.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-line px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-2 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`whitespace-nowrap text-sm font-medium`,children:e}),(0,G.jsx)(`span`,{className:`shrink-0 whitespace-nowrap`,children:t})]}),(0,G.jsx)(`div`,{className:`mt-1 space-y-1.5 text-[12px] text-muted`,children:n})]})}function qt({q:e}){if(e.note)return(0,G.jsxs)(`div`,{className:`border-t border-line pt-5`,children:[(0,G.jsx)(`div`,{className:`mb-1 text-sm font-medium`,children:`Quality scores`}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:e.note})]});let{piotroski:t,altman:n,beneish:r}=e;return(0,G.jsxs)(`div`,{className:`space-y-3 border-t border-line pt-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:`Quality scores`}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`Classic accounting checks on the last three annual filings. They describe the filings; they are not a rating.`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-3`,children:[t&&(0,G.jsxs)(Kt,{title:`Piotroski F-score`,badge:(0,G.jsxs)(E,{tone:Ht[t.label],children:[t.label,(0,G.jsxs)(`span`,{className:`font-normal opacity-80`,children:[t.score,`/`,t.out_of]})]}),children:[(0,G.jsx)(`p`,{children:`Profitability, balance-sheet and efficiency tests, this year against last. 7-9 strong, 0-3 weak.`}),(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:t.tests.map(e=>(0,G.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[(0,G.jsx)(`span`,{className:p(`mt-0.5 shrink-0 font-semibold`,e.pass===!0?`text-up`:e.pass===!1?`text-down`:`text-faint`),children:e.pass===!0?`✓`:e.pass===!1?`✗`:`–`}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[e.label,` `,(0,G.jsxs)(`span`,{className:`tabular text-faint`,children:[`(`,e.detail,`)`]})]})]},e.key))})]}),n&&(0,G.jsxs)(Kt,{title:`Altman Z-score`,badge:(0,G.jsxs)(E,{tone:Ut[n.zone],children:[n.zone,(0,G.jsx)(`span`,{className:`font-normal opacity-80`,children:s(n.score,2)})]}),children:[(0,G.jsxs)(`p`,{children:[`Financial-distress model, `,n.model,`. Above `,n.safe_above,` safe zone, below `,n.distress_below,` distress zone, in between grey.`]}),(0,G.jsx)(`ul`,{className:`tabular space-y-0.5 text-faint`,children:Object.entries(n.parts).map(([e,t])=>(0,G.jsxs)(`li`,{className:`flex justify-between gap-2`,children:[(0,G.jsx)(`span`,{children:Wt[e]??e}),(0,G.jsx)(`span`,{children:t==null?`—`:s(t,3)})]},e))})]}),r&&(0,G.jsxs)(Kt,{title:`Beneish M-score`,badge:(0,G.jsxs)(E,{tone:r.flag?`down`:`up`,children:[r.flag?`flag`:`no flag`,(0,G.jsx)(`span`,{className:`font-normal opacity-80`,children:s(r.score,2)})]}),children:[(0,G.jsxs)(`p`,{children:[`Earnings-quality model: above `,r.threshold,` the filings look like those of companies later found to have overstated profits. A flag is a reason to read the notes, not proof.`]}),(0,G.jsx)(`ul`,{className:`tabular space-y-0.5 text-faint`,children:Object.entries(r.ratios).map(([e,t])=>(0,G.jsxs)(`li`,{className:`flex justify-between gap-2`,children:[(0,G.jsxs)(`span`,{children:[Gt[e]??e,` `,(0,G.jsx)(`span`,{className:`opacity-70`,children:e})]}),(0,G.jsx)(`span`,{children:t==null?`n/a (taken as 1)`:s(t,3)})]},e))})]})]})]})}var Jt={halal:`up`,doubtful:`warn`,haram:`down`,unknown:`neutral`},Yt={pass:{bar:`bg-up`,text:`text-up`,label:`Pass`},borderline:{bar:`bg-warn`,text:`text-warn`,label:`Fails stricter limit`},fail:{bar:`bg-down`,text:`text-down`,label:`Fail`},unknown:{bar:`bg-faint`,text:`text-faint`,label:`No data`}};function Xt({check:e}){let t=Yt[e.status],n=e.limit*1.5,r=e.value==null?0:Math.min(100,e.value/n*100),i=e.limit/n*100,a=e.strict_limit==null?null:e.strict_limit/n*100;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-3 text-sm`,children:[(0,G.jsxs)(`span`,{className:`text-fg/90`,children:[e.label,` `,(0,G.jsxs)(`span`,{className:`text-xs text-faint`,children:[`/ `,e.basis]})]}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-2`,children:[(0,G.jsx)(`span`,{className:`tabular font-semibold`,children:e.value==null?`—`:`${e.value.toFixed(1)}%`}),(0,G.jsx)(`span`,{className:p(`text-xs font-medium`,t.text),children:t.label})]})]}),(0,G.jsxs)(`div`,{className:`relative h-1.5 rounded-full bg-raised`,children:[(0,G.jsx)(`div`,{className:p(`h-full rounded-full`,t.bar),style:{width:`${r}%`}}),(0,G.jsx)(`div`,{className:`absolute -top-0.5 h-2.5 w-px bg-fg/60`,style:{left:`${i}%`},title:`Limit ${e.limit}%`}),a!=null&&(0,G.jsx)(`div`,{className:`absolute -top-0.5 h-2.5 w-px bg-fg/30`,style:{left:`${a}%`},title:`Stricter limit ${e.strict_limit}%`})]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-faint`,children:[`Limit `,e.limit,`%`,e.strict_limit!=null&&` (stricter ${e.strict_limit}%)`,e.note&&` · ${e.note}`]})]})}function Zt({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null);return(0,W.useEffect)(()=>{if(t===`crypto`)return;let n=!1;return r(null),a(null),ue(e,t).then(e=>!n&&r(e)).catch(e=>!n&&a(o(e))),()=>{n=!0}},[e,t]),t===`crypto`?null:(0,G.jsxs)(C,{id:`section-shariah`,section:`Ethical screen`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Ethical screen `,n&&(0,G.jsx)(E,{tone:Jt[n.verdict],children:n.verdict_label})]}),description:`Ethical check: no interest-based business, no excluded activity, low debt and interest income`}),(0,G.jsx)(v,{className:`space-y-5`,children:i?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Not available: `,i]}):n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:n.reasons.map(e=>(0,G.jsxs)(`li`,{className:`flex gap-2 text-sm leading-relaxed text-fg/90`,children:[(0,G.jsx)(`span`,{className:p(`mt-2 h-1.5 w-1.5 shrink-0 rounded-full`,n.verdict===`halal`?`bg-up`:n.verdict===`haram`?`bg-down`:`bg-warn`)}),(0,G.jsx)(`span`,{children:e})]},e))}),(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas p-4`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-xs font-medium text-muted`,children:[`Business activity `,(0,G.jsx)(E,{tone:Jt[n.business.status],children:n.business.status})]}),(0,G.jsx)(`p`,{className:`text-sm text-fg/90`,children:[n.sector,n.industry].filter(Boolean).join(` · `)||`Sector not published`}),n.business.flags.length>0&&(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-warn`,children:[`Business description mentions: `,n.business.flags.join(`, `)]})]}),n.checks.length>0&&(0,G.jsx)(`div`,{className:`space-y-4`,children:n.checks.map(e=>(0,G.jsx)(Xt,{check:e},e.key))}),n.purification_pct!=null&&n.purification_pct>0&&(0,G.jsxs)(`div`,{className:`rounded-lg border border-line p-3 text-sm`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Give to charity:`}),` about`,` `,(0,G.jsxs)(`span`,{className:`tabular font-semibold`,children:[n.purification_pct.toFixed(2),`%`]}),` of any dividend - the share of revenue that came from interest.`]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`Screen based on `,n.source,n.period&&` statements to ${n.period}`,`. Standard index limits, with the stricter 30% shown as a second tick. A screening aid, not a final ruling - standards differ at the edges; ask a qualified adviser for a firm answer.`]})]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(j,{className:`h-4 w-2/3`}),(0,G.jsx)(j,{className:`h-3 w-full`}),(0,G.jsx)(j,{className:`h-3 w-full`})]})})]})}async function Qt(e,t=`us`,n=!1){return(await h.get(`/stocks/${encodeURIComponent(e)}/social`,{params:{market:t,...n?{refresh:!0}:{}}})).data}async function $t(e,t=`us`){return(await h.post(`/stocks/${encodeURIComponent(e)}/social/ai-summary`,null,{params:{market:t}})).data}var en={"very bullish":`up`,bullish:`up`,neutral:`warn`,bearish:`down`,"very bearish":`down`},tn={bullish:`text-up`,neutral:`text-muted`,bearish:`text-down`},nn={bullish:`bg-up`,neutral:`bg-faint`,bearish:`bg-down`},rn={low:`up`,medium:`warn`,high:`down`},an={ok:``,empty:`no recent posts`,blocked:`blocked / rate-limited`,skipped:`not used`,error:`failed`};function on(e){return e>0?`+${e}`:String(e)}function sn(e){return e==null?`text-muted`:e>=10?`text-up`:e<=-10?`text-down`:`text-muted`}function cn({label:e,value:t,meter:n,caption:r}){return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e}),(0,G.jsx)(`div`,{className:`tabular mt-1 flex h-8 items-baseline text-2xl font-semibold`,children:t}),(0,G.jsx)(`div`,{className:`mt-2 flex h-3.5 items-center`,children:n}),(0,G.jsx)(`div`,{className:`mt-1.5 text-[12px] text-faint`,children:r})]})}function ln({score:e}){let t=`${(Math.max(-100,Math.min(100,e))+100)/2}%`;return(0,G.jsx)(`div`,{className:`relative h-1.5 w-full rounded-full bg-gradient-to-r from-down via-faint to-up opacity-80`,children:(0,G.jsx)(`span`,{className:`absolute top-1/2 h-3.5 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full bg-fg ring-2 ring-surface`,style:{left:t}})})}var un=[`bullish`,`neutral`,`bearish`];function dn({counts:e,total:t}){return(0,G.jsx)(`div`,{className:`flex h-1.5 w-full overflow-hidden rounded-full bg-line`,children:un.map(n=>e[n]?(0,G.jsx)(`div`,{className:nn[n],style:{width:`${e[n]/t*100}%`}},n):null)})}function fn({ratio:e}){return(0,G.jsxs)(`div`,{className:`relative h-1.5 w-full rounded-full bg-line`,children:[e!=null&&(0,G.jsx)(`div`,{className:p(`h-full rounded-full`,e>=2?`bg-warn`:`bg-accent`),style:{width:`${Math.min(e/3,1)*100}%`}}),(0,G.jsx)(`span`,{className:`absolute top-1/2 left-1/3 h-3.5 w-px -translate-y-1/2 bg-line-strong`,title:`normal volume`})]})}function pn({data:e}){let[t,n]=(0,W.useState)(`7d`),r=e.history.length>=3,i=t===`30d`&&r?e.history.map(e=>({day:e.day,score:e.score,posts:e.posts})):e.timeline.map(e=>({day:e.day,score:e.score,posts:e.posts}));return i.some(e=>e.posts>0)?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-xs font-medium text-muted`,children:[`Sentiment (line) and post volume (bars)`,t===`7d`?` · Reddit, forums, HN`:` · daily readings`]}),r&&(0,G.jsx)(`div`,{className:`flex gap-1 text-xs`,children:[`7d`,`30d`].map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:p(`rounded px-1.5 py-0.5`,t===e?`bg-raised text-fg`:`text-faint hover:text-fg`),children:e},e))})]}),(0,G.jsx)(`div`,{className:`h-40`,children:(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(U,{data:i,margin:{top:6,right:4,bottom:0,left:0},children:[(0,G.jsx)(B,{vertical:!1,stroke:`var(--color-line)`}),(0,G.jsx)(R,{dataKey:`day`,tickFormatter:e=>e.slice(5),tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1}),(0,G.jsx)(z,{yAxisId:`s`,domain:[-100,100],ticks:[-100,-50,0,50,100],width:34,tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1}),(0,G.jsx)(z,{yAxisId:`p`,orientation:`right`,hide:!0}),(0,G.jsx)(ve,{yAxisId:`s`,y:0,stroke:`var(--color-line-strong)`}),(0,G.jsx)(I,{cursor:{fill:`var(--color-raised)`},contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12},formatter:(e,t)=>t===`score`?[e==null?`—`:on(Number(e)),`Sentiment`]:[e,`Posts`]}),(0,G.jsx)(xe,{yAxisId:`p`,dataKey:`posts`,fill:`var(--color-accent)`,fillOpacity:.25,radius:[3,3,0,0],isAnimationActive:!1}),(0,G.jsx)(L,{yAxisId:`s`,dataKey:`score`,stroke:`var(--color-accent)`,strokeWidth:2,dot:{r:2.5},connectNulls:!0,isAnimationActive:!1})]})})})]}):null}function mn({sources:e}){return(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.filter(e=>e.status!==`skipped`).map(e=>(0,G.jsxs)(`span`,{title:e.message??(e.via?`via ${e.via}`:void 0),className:p(`inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs`,e.status===`ok`?`border-line text-fg`:`border-dashed border-line text-faint`),children:[(0,G.jsx)(`span`,{className:p(`h-1.5 w-1.5 rounded-full`,e.status===`ok`?`bg-up`:e.status===`empty`?`bg-faint`:`bg-warn`)}),e.label,e.status===`ok`?(0,G.jsx)(`span`,{className:`tabular text-muted`,children:e.posts}):(0,G.jsxs)(`span`,{children:[`· `,an[e.status]]})]},e.source))})}function hn({post:e}){return(0,G.jsxs)(`li`,{className:`flex gap-3 py-3`,children:[(0,G.jsx)(`span`,{className:p(`tabular mt-0.5 w-9 shrink-0 text-end text-xs font-semibold`,tn[e.tone]),children:on(e.sentiment)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`line-clamp-2 text-sm font-medium hover:text-accent-fg hover:underline`,children:e.title}),e.excerpt&&(0,G.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted`,children:e.excerpt}),(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12px] text-faint`,children:[(0,G.jsx)(`span`,{children:e.community}),e.score>0&&(0,G.jsxs)(`span`,{className:`tabular`,children:[`▲ `,u(e.score)]}),e.comments>0&&(0,G.jsxs)(`span`,{className:`tabular`,children:[u(e.comments),` comments`]}),(0,G.jsx)(`span`,{children:a(e.created_at)}),e.label&&(0,G.jsxs)(E,{tone:e.label===`bullish`?`up`:`down`,children:[e.label,` tag`]})]})]})]})}function gn({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)({}),[f,m]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let n=!1;return r(null),s(null),d({}),m(!1),Qt(e,t).then(e=>!n&&r(e)).catch(e=>!n&&s(o(e))),()=>{n=!0}},[e,t]);function h(){l(!0),Qt(e,t,!0).then(e=>{r(e),s(null)}).catch(e=>s(o(e))).finally(()=>l(!1))}function g(){d({loading:!0}),$t(e,t).then(e=>d({data:e})).catch(e=>d({error:o(e)}))}let _=u.data,y=n?f?n.top_posts:n.top_posts.slice(0,6):[];return(0,G.jsxs)(C,{id:`section-social`,section:`Social sentiment`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Social sentiment`,n?.mood&&(0,G.jsxs)(E,{tone:en[n.mood],children:[n.mood,` `,on(n.score)]})]}),description:n?`${n.posts} posts · last ${n.window_days} days · updated ${a(n.fetched_at)}`:`What people are saying on Reddit, StockTwits and investor forums`,icon:`chat`,actions:n&&(0,G.jsx)(O,{size:`sm`,variant:`ghost`,icon:`refresh`,loading:c,onClick:h,children:`Refresh`})}),(0,G.jsx)(v,{className:`space-y-5`,children:i?(0,G.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Social sentiment unavailable: `,i]}):n?n.posts===0?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-muted`,children:[`No recent posts about `,n.query.name||n.symbol,` found in the last `,n.window_days,` days.`]}),(0,G.jsx)(mn,{sources:n.sources})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-3`,children:[(0,G.jsx)(cn,{label:`Sentiment score`,value:(0,G.jsxs)(`span`,{className:sn(n.score),children:[on(n.score),(0,G.jsx)(`span`,{className:`ms-1 text-xs font-normal text-faint`,children:`/ 100`})]}),meter:(0,G.jsx)(ln,{score:n.score}),caption:`${n.confidence} confidence · weighted by engagement and recency`}),(0,G.jsx)(cn,{label:(0,G.jsxs)(G.Fragment,{children:[`Post mood `,(0,G.jsxs)(`span`,{className:`text-faint`,children:[`(`,n.posts,`)`]})]}),value:(()=>{let e=un.reduce((e,t)=>n.counts[t]>n.counts[e]?t:e);return(0,G.jsxs)(`span`,{className:tn[e],children:[Math.round(n.counts[e]/n.posts*100),`%`,(0,G.jsx)(`span`,{className:`ms-1 text-xs font-normal text-faint`,children:e})]})})(),meter:(0,G.jsx)(dn,{counts:n.counts,total:n.posts}),caption:un.map(e=>(0,G.jsxs)(`span`,{className:`me-2`,children:[(0,G.jsxs)(`span`,{className:p(`tabular font-medium`,tn[e]),children:[Math.round(n.counts[e]/n.posts*100),`%`]}),` `,e]},e))}),(0,G.jsx)(cn,{label:`Buzz (last 24h)`,value:n.buzz?(0,G.jsxs)(`span`,{className:n.buzz.ratio>=2?`text-warn`:`text-fg`,children:[n.buzz.ratio.toFixed(1),`×`]}):(0,G.jsx)(`span`,{className:`text-faint`,children:`—`}),meter:(0,G.jsx)(fn,{ratio:n.buzz?.ratio??null}),caption:n.buzz?`${n.buzz.last_24h} posts vs ${n.buzz.daily_avg}/day average`:`Too few posts to compare`})]}),(0,G.jsx)(pn,{data:n}),(0,G.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted`,children:`Sources`}),(0,G.jsx)(mn,{sources:n.sources}),n.by_source.length>1&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:n.by_source.map(e=>(0,G.jsxs)(`span`,{className:`text-muted`,children:[e.label,` `,(0,G.jsx)(`span`,{className:p(`tabular font-semibold`,sn(e.score)),children:on(e.score)})]},e.source))})]}),n.themes.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted`,children:`What people talk about`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.themes.map(e=>(0,G.jsxs)(`span`,{title:`${e.posts} posts, sentiment ${on(e.score)}`,className:`inline-flex items-center gap-1.5 rounded-full bg-raised px-2.5 py-1 text-xs`,children:[(0,G.jsx)(`span`,{className:p(`h-1.5 w-1.5 rounded-full`,nn[e.tone])}),e.theme,(0,G.jsx)(`span`,{className:`tabular text-faint`,children:e.posts})]},e.theme))})]})]}),_?(0,G.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-canvas p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[`AI digest `,(0,G.jsxs)(E,{tone:rn[_.hype_risk],children:[`hype risk `,_.hype_risk]})]}),(0,G.jsx)(`p`,{className:`text-sm leading-relaxed text-fg/90`,children:_.summary})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[_.bull_points.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-semibold tracking-wide text-up uppercase`,children:`Bulls say`}),(0,G.jsx)(`ul`,{className:`space-y-1 text-sm`,children:_.bull_points.map(e=>(0,G.jsxs)(`li`,{className:`flex gap-2`,children:[(0,G.jsx)(`span`,{className:`text-up`,children:`+`}),(0,G.jsx)(`span`,{children:e})]},e))})]}),_.bear_points.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-semibold tracking-wide text-down uppercase`,children:`Bears say`}),(0,G.jsx)(`ul`,{className:`space-y-1 text-sm`,children:_.bear_points.map(e=>(0,G.jsxs)(`li`,{className:`flex gap-2`,children:[(0,G.jsx)(`span`,{className:`text-down`,children:`−`}),(0,G.jsx)(`span`,{children:e})]},e))})]})]}),_.hype_reason&&(0,G.jsx)(`p`,{className:`border-t border-line pt-3 text-xs text-muted`,children:_.hype_reason})]}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(O,{size:`sm`,variant:`secondary`,icon:`cpu`,loading:u.loading,onClick:g,children:u.loading?`Reading the chatter…`:`AI digest`}),(0,G.jsx)(`span`,{className:`text-[12px] text-faint`,children:`Summary, bull and bear arguments, and hype risk from your configured AI model.`})]}),u.error&&(0,G.jsx)(re,{title:`AI digest failed`,onDismiss:()=>d({}),children:u.error}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:`Most-engaged posts`}),n.top_posts.length>6&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`inline-flex items-center gap-1 text-xs text-muted hover:text-fg`,children:[f?`Show fewer`:`Show all ${n.top_posts.length}`,(0,G.jsx)(T,{name:`chevron`,className:p(`h-3 w-3 transition-transform`,f?`-rotate-90`:`rotate-90`)})]})]}),(0,G.jsx)(`ul`,{className:`divide-y divide-line`,children:y.map(e=>(0,G.jsx)(hn,{post:e},e.id))})]}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`Public posts scored by keyword analysis. This is retail chatter, not investment advice. Posts can be wrong, promotional or coordinated.`})]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,G.jsx)(j,{className:`h-16`}),(0,G.jsx)(j,{className:`h-16`}),(0,G.jsx)(j,{className:`h-16`})]}),(0,G.jsx)(j,{className:`h-32 w-full`}),(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:`Reading Reddit, StockTwits and forums - the first load can take up to a minute.`})]})})]})}function _n({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[a,c]=(0,W.useState)(null);if((0,W.useEffect)(()=>{let n=!1;return r(null),c(null),nt(e,t).then(e=>!n&&r(e)).catch(e=>!n&&c(o(e))),()=>{n=!0}},[e,t]),t===`crypto`)return null;let d={symbol:e.toUpperCase(),market:t},f=n?[d,...n.peers.slice(0,4).map(e=>({symbol:e.symbol,market:t}))]:[];return(0,G.jsxs)(C,{id:`section-peers`,section:`Peers`,children:[(0,G.jsx)(D,{title:`Peers`,description:n?.basis??`Same-industry companies of similar size`,icon:`compare`,actions:n&&n.peers.length>0?(0,G.jsxs)(M,{to:st(f),className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-md border border-line px-2.5 py-1 text-xs text-muted hover:border-line-strong hover:text-fg`,children:[(0,G.jsx)(T,{name:`compare`,className:`h-3.5 w-3.5`}),`Compare `,f.length]}):void 0}),(0,G.jsx)(v,{children:a?(0,G.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Peers unavailable: `,a]}):n?n.peers.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted`,children:n.note??`No peers found.`}):(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`tabular w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`text-xs text-muted`,children:(0,G.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,G.jsx)(`th`,{className:`py-2 text-start font-medium`,children:`Company`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-end font-medium`,children:`Mkt cap`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-end font-medium`,children:`P/E`}),(0,G.jsx)(`th`,{className:`hidden px-2 py-2 text-end font-medium sm:table-cell`,children:`Day`}),(0,G.jsx)(`th`,{className:`py-2`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:n.peers.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`max-w-[12rem] py-2`,children:(0,G.jsxs)(M,{to:`/analyze?symbol=${encodeURIComponent(e.symbol)}&market=${t}`,className:`block truncate hover:text-accent-fg`,title:e.name??e.symbol,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium`,children:e.symbol}),` `,(0,G.jsx)(`span`,{className:`hidden text-xs text-muted sm:inline`,children:e.name})]})}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-end`,children:u(e.market_cap)}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-end`,children:s(e.pe,1)}),(0,G.jsx)(`td`,{className:`hidden px-2 py-2 text-end sm:table-cell ${i(e.change_percent)}`,children:l(e.change_percent,1)}),(0,G.jsx)(`td`,{className:`py-2 text-end`,children:(0,G.jsx)(M,{to:st([d,{symbol:e.symbol,market:t}]),className:`text-xs text-muted hover:text-accent-fg`,title:`Compare ${d.symbol} with ${e.symbol}`,children:`vs`})})]},e.symbol))})]})}):(0,G.jsx)(j,{className:`h-40 w-full`})})]})}function vn(e,t){if(!t)return`bg-line-strong`;let n=e/t;return n>=.75?`bg-up`:n>=.4?`bg-warn`:`bg-down`}function yn({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null);return(0,W.useEffect)(()=>{let n=!1;return r(null),a(null),de(e,t).then(e=>!n&&r(e)).catch(e=>!n&&a(o(e))),()=>{n=!0}},[e,t]),t===`crypto`?null:(0,G.jsxs)(C,{id:`section-checklists`,section:`Investor checklists`,children:[(0,G.jsx)(D,{title:`Investor checklists`,description:`Published rules of five investing styles, applied to this company's filings`}),(0,G.jsx)(v,{className:`space-y-4`,children:i?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Not available: `,i]}):n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:n.lenses.map(e=>(0,G.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-line px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-2 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:e.name}),(0,G.jsxs)(`span`,{className:`tabular whitespace-nowrap text-xs text-muted`,children:[(0,G.jsx)(`span`,{className:`font-semibold text-fg`,children:e.passed}),` of `,e.tested,` passed`,e.tested<e.total&&(0,G.jsxs)(`span`,{className:`text-faint`,children:[` · `,e.total-e.tested,` not testable`]})]})]}),(0,G.jsx)(`div`,{className:`mt-1.5 flex h-1.5 overflow-hidden rounded-full bg-line`,"aria-hidden":`true`,children:(0,G.jsx)(`div`,{className:p(`h-full`,vn(e.passed,e.tested)),style:{width:`${e.tested?e.passed/e.tested*100:0}%`}})}),(0,G.jsx)(`ul`,{className:`mt-2 space-y-1 text-[12px]`,children:e.rules.map(e=>(0,G.jsxs)(`li`,{className:`flex items-start gap-1.5`,title:e.why,children:[(0,G.jsx)(`span`,{className:p(`mt-px w-3 shrink-0 font-semibold`,e.pass===!0?`text-up`:e.pass===!1?`text-down`:`text-faint`),children:e.pass===!0?`✓`:e.pass===!1?`✗`:`–`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 text-muted`,children:e.label}),(0,G.jsx)(`span`,{className:`tabular shrink-0 text-end text-faint`,children:e.value})]},e.key))}),(0,G.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[e.source,e.note&&` · ${e.note}`]})]},e.key))}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`Each rule is a published criterion with the threshold its author gave, checked against `,n.source,`. – means the figure is missing or the rule does not apply (`,n.financial_sector?`banks and insurers skip balance-sheet tests`:`e.g. no inventory`,`). Hover a rule for its reason. These are checklists, not what any of these investors would do, and not advice.`]})]}):(0,G.jsx)(j,{className:`h-48 w-full`})})]})}function bn(e){if(e.discount<=e.terminal||e.shares<=0)return null;let t=0,n=e.fcf;for(let r=1;r<=e.totalYears;r++){let i=r<=e.highYears?e.growth:e.growth+(e.terminal-e.growth)*(r-e.highYears)/(e.totalYears-e.highYears);n*=1+i,t+=n/(1+e.discount)**r}let r=n*(1+e.terminal)/(e.discount-e.terminal);return t+=r/(1+e.discount)**e.totalYears,(t+e.netCash)/e.shares}function xn(e,t){let n=n=>{let r=bn({...t,growth:n});return r==null?null:r-e},r=-.5,i=1,a=n(r),o=n(i);if(a==null||o==null||a>0||o<0)return null;for(let e=0;e<80;e++){let e=(r+i)/2;(n(e)??0)<0?r=e:i=e}return(r+i)/2}var K=e=>(e*100).toFixed(1),Sn=e=>{let t=parseFloat(e);return Number.isFinite(t)?t/100:null};function Cn(e,t){if(!e||!t||t<=0)return`No positive model value under these assumptions`;let n=(e/t-1)*100;return Math.abs(n)<.5?`Price is about equal to the model value`:`Price is ${Math.abs(n).toFixed(1)}% ${n>0?`above`:`below`} the model value`}function wn({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[d,p]=(0,W.useState)(!1);async function m(){let n=Sn(c?.growth??``),r=Sn(c?.discount??``),i=Sn(c?.terminal??``);if(n!=null&&r!=null&&i!=null){p(!0);try{await pe(e,t,{growth:n,discount:r,terminal:i})}catch(e){f.error(o(e))}finally{p(!1)}}}(0,W.useEffect)(()=>{let n=!1;return r(null),a(null),l(null),ce(e,t).then(e=>{n||(r(e),e.dcf&&l({growth:K(e.dcf.defaults.growth),discount:K(e.dcf.defaults.discount),terminal:K(e.dcf.defaults.terminal)}))}).catch(e=>!n&&a(o(e))),()=>{n=!0}},[e,t]);let h=(0,W.useMemo)(()=>{let e=n?.dcf;if(!e||!c)return null;let t=Sn(c.growth),r=Sn(c.discount),i=Sn(c.terminal);if(t==null||r==null||i==null)return{invalid:`Enter a number in each box.`};if(r<=i)return{invalid:`The discount rate must be above the terminal growth rate.`};let a={fcf:e.base_fcf,discount:r,terminal:i,netCash:e.net_cash,shares:e.shares,highYears:e.defaults.high_years,totalYears:e.defaults.total_years};return{value:bn({...a,growth:t}),implied:n?.price?xn(n.price,a):null}},[n,c]);if(t===`crypto`)return null;let g=n?.dcf,_=n?.currency?` ${n.currency}`:``,y=g&&c&&(c.growth!==K(g.defaults.growth)||c.discount!==K(g.defaults.discount)||c.terminal!==K(g.defaults.terminal));return(0,G.jsxs)(C,{id:`section-dcf`,section:`DCF & Graham`,children:[(0,G.jsx)(D,{title:`Discounted cash flow`,description:`What the cash flows are worth under your assumptions, and what today's price assumes`}),(0,G.jsx)(v,{className:`space-y-5`,children:i?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Not available: `,i]}):n?(0,G.jsxs)(G.Fragment,{children:[g&&c&&h?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[[`growth`,`Growth, years 1-${g.defaults.high_years}`,`Free cash flow growth a year; fades to the terminal rate by year 10`],[`discount`,`Discount rate`,`Return you require a year`],[`terminal`,`Terminal growth`,`Growth a year after year 10, for ever`]].map(([e,t,n])=>(0,G.jsxs)(`label`,{className:`block min-w-0`,children:[(0,G.jsx)(`span`,{className:`mb-1 block text-xs font-medium text-muted`,children:t}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(x,{type:`number`,inputMode:`decimal`,step:`0.5`,value:c[e],onChange:t=>l({...c,[e]:t.target.value}),className:`w-full`,"aria-label":`${t} (%)`}),(0,G.jsx)(`span`,{className:`text-sm text-muted`,children:`%`})]}),(0,G.jsx)(`span`,{className:`mt-1 block text-[11px] text-faint`,children:n})]},e))}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[y&&(0,G.jsx)(O,{size:`sm`,variant:`ghost`,onClick:()=>l({growth:K(g.defaults.growth),discount:K(g.defaults.discount),terminal:K(g.defaults.terminal)}),children:`Reset to defaults`}),!(`invalid`in h)&&(0,G.jsx)(O,{size:`sm`,variant:`secondary`,icon:`download`,loading:d,onClick:m,children:`Excel model`})]}),`invalid`in h?(0,G.jsx)(`p`,{className:`text-sm text-warn`,children:h.invalid}):(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-4`,children:[(0,G.jsx)(A,{label:`Model value / share`,value:`${s(h.value)}${_}`,sub:Cn(n.price,h.value)}),(0,G.jsx)(A,{label:`Price`,value:`${s(n.price)}${_}`}),(0,G.jsx)(A,{label:`Growth the price implies`,value:h.implied==null?`—`:`${(h.implied*100).toFixed(1)}%`,sub:h.implied==null?`outside -50% to +100% a year`:`a year for ${g.defaults.high_years} years, at these discount and terminal rates`}),(0,G.jsx)(A,{label:`Free cash flow used`,value:`${u(g.base_fcf)}${_}`,sub:`${g.base_label}, after capex${g.sbc?` and ${u(g.sbc)} stock-based pay`:``}; net ${g.net_cash>=0?`cash`:`debt`} ${u(Math.abs(g.net_cash))} (incl. investments)`})]})]}):n.note&&(0,G.jsx)(`p`,{className:`text-sm text-muted`,children:n.note}),n.graham&&(0,G.jsxs)(`div`,{className:`border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-4`,children:[(0,G.jsx)(A,{label:`Graham number`,value:`${s(n.graham.value)}${_}`,sub:n.graham.vs_price_pct==null?void 0:`Price is ${Math.abs(n.graham.vs_price_pct).toFixed(1)}% ${n.graham.vs_price_pct>=0?`above`:`below`} it`}),(0,G.jsx)(A,{label:`EPS (12 months)`,value:s(n.graham.eps)}),(0,G.jsx)(A,{label:`Book value / share`,value:s(n.graham.book_value_per_share)})]}),(0,G.jsx)(`p`,{className:`mt-2 text-[12px] text-faint`,children:`√(22.5 × EPS × book value per share): Benjamin Graham's ceiling for a defensive investor (P/E 15 × P/B 1.5). Suits asset-heavy, steadily profitable companies; it understates firms whose value sits in brands, software or people.`})]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[g&&`Two-stage model: free cash flow (operating cash flow minus capex) grows at your rate for ${g.defaults.high_years} years, fades to the terminal rate by year ${g.defaults.total_years}, then a terminal value; net cash is added and the total divided by shares. Defaults are starting points (growth = recent revenue growth, capped 0-15%), not forecasts. `,`Source: `,n.source,g?.converted_from&&`; cash flows converted from ${g.converted_from} at the ECB rate`,`. Arithmetic on published figures, not advice.`]})]}):(0,G.jsx)(j,{className:`h-40 w-full`})})]})}function Tn(e){return e==null?``:e<=0?`today`:e===1?`tomorrow`:`in ${e} days`}function En(e){return e.surprise==null?null:e.unusual?{text:`data looks off`,tone:`text-faint`}:Math.abs(e.surprise)<.5?{text:`in line`,tone:`text-muted`}:e.surprise>0?{text:`beat ${s(e.surprise,1)}%`,tone:`text-up`}:{text:`missed ${s(-e.surprise,1)}%`,tone:`text-down`}}function Dn({label:e,value:t,sub:n}){return(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:e}),(0,G.jsx)(`div`,{className:`tabular mt-0.5 text-base font-semibold`,children:t}),n&&(0,G.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted`,children:n})]})}function On({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[a,c]=(0,W.useState)(null);if((0,W.useEffect)(()=>{let n=!1;return r(null),c(null),rt(e,t).then(e=>!n&&r(e)).catch(e=>!n&&c(o(e))),()=>{n=!0}},[e,t]),t===`crypto`||n&&!n.available)return null;let u=n?.latest,d=u?En(u):null,f=n?.stats;return(0,G.jsxs)(C,{id:`section-earnings`,section:`Earnings`,children:[(0,G.jsx)(D,{title:`Earnings`,icon:`clock`,description:n?u?`Results are out (${u.date})`:n.next?`Next report ${n.next.date}, ${Tn(n.days_to_next)}`:`No report date announced yet`:`Next report, past reactions and what to watch`}),(0,G.jsx)(v,{className:`space-y-5`,children:a?(0,G.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Earnings data unavailable: `,a]}):n?(0,G.jsxs)(G.Fragment,{children:[u&&u.actual!=null&&(0,G.jsxs)(`div`,{className:`rounded-lg bg-accent-soft/40 px-4 py-3 ring-1 ring-accent/30`,children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold`,children:`Results are out`}),(0,G.jsxs)(`div`,{className:`tabular mt-1 text-sm`,children:[`EPS `,s(u.actual,2),u.estimate!=null&&(0,G.jsxs)(`span`,{className:`text-muted`,children:[` vs `,s(u.estimate,2),` expected`]}),d&&(0,G.jsxs)(`span`,{className:p(`ms-1 font-medium`,d.tone),children:[`(`,d.text,`)`]}),u.reaction&&(0,G.jsxs)(`span`,{className:`ms-2`,children:[`· stock `,(0,G.jsx)(`span`,{className:i(u.reaction.move),children:l(u.reaction.move,1)}),` on the day`]})]}),f&&u.reaction&&(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-muted`,children:[`A typical results-day move for this stock is ±`,s(f.avg_abs_move,1),`%, so this was`,` `,Math.abs(u.reaction.move)>f.avg_abs_move*1.5?`a bigger reaction than usual`:Math.abs(u.reaction.move)<f.avg_abs_move*.5?`a muted reaction`:`about a normal reaction`,`.`]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[n.next&&(0,G.jsx)(Dn,{label:`Next report`,value:new Date(`${n.next.date}T00:00:00`).toLocaleDateString(void 0,{day:`numeric`,month:`short`}),sub:`${Tn(n.days_to_next)}${n.next.estimate==null?``:` · EPS est. ${s(n.next.estimate,2)}`}`}),n.implied&&(0,G.jsx)(Dn,{label:`Options price in`,value:`±${s(n.implied.move,1)}%`,sub:`At-the-money straddle, ${n.implied.expiry} expiry`}),f&&(0,G.jsx)(Dn,{label:`Typical move`,value:`±${s(f.avg_abs_move,1)}%`,sub:`Last ${f.reports} reports · up ${f.up_days} of ${f.reports}`}),f&&f.beats+f.misses>0&&(0,G.jsx)(Dn,{label:`Beat estimates`,value:`${f.beats} of ${f.beats+f.misses}`,sub:`Biggest moves ${l(f.biggest_up,1)} / ${l(f.biggest_down,1)}`})]}),n.implied&&f&&(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[`The options market expects a move of about ±`,s(n.implied.move,1),`% around this report, against a typical ±`,s(f.avg_abs_move,1),`% in the past:`,` `,n.implied.move>f.avg_abs_move*1.25?`traders are bracing for a bigger move than usual.`:n.implied.move<f.avg_abs_move*.75?`a calmer reaction than usual is priced in.`:`roughly what it has done before.`]}),f&&(f.avg_move_on_beat!=null||f.avg_move_on_miss!=null)&&(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[`After a beat the stock moved `,f.avg_move_on_beat==null?`—`:l(f.avg_move_on_beat,1),` on average; after a miss`,` `,f.avg_move_on_miss==null?`—`:l(f.avg_move_on_miss,1),`.`,f.avg_move_on_beat!=null&&f.avg_move_on_beat<0&&` Beating estimates has not been enough to lift it: expectations run high.`]}),n.consensus?.eps.avg!=null&&(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[n.consensus.period,` consensus EPS `,s(n.consensus.eps.avg,2),n.consensus.eps.analysts?` from ${n.consensus.eps.analysts} analysts`:``,n.consensus.trend.change_90d!=null&&`, ${l(n.consensus.trend.change_90d,1)} over 90 days`,`. Full detail in Analyst estimates.`]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 text-xs font-medium text-muted`,children:[`What to watch`,n.sector?` (${n.sector})`:``]}),(0,G.jsx)(`ul`,{className:`grid gap-1.5 text-sm sm:grid-cols-2`,children:n.watch.map(e=>(0,G.jsxs)(`li`,{className:`flex gap-2`,children:[(0,G.jsx)(`span`,{className:`text-accent`,children:`•`}),(0,G.jsx)(`span`,{children:e})]},e))})]}),n.history.length>0&&(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-xs text-faint`,children:[(0,G.jsx)(`th`,{className:`py-1.5 pe-3 text-start font-medium`,children:`Reported`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`EPS est.`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`Actual`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`Result`}),(0,G.jsx)(`th`,{className:`py-1.5 ps-2 text-end font-medium`,title:`Last close before the announcement to the first close after it`,children:`Stock move`})]})}),(0,G.jsx)(`tbody`,{className:`tabular`,children:n.history.slice(0,8).map(e=>{let t=En(e);return(0,G.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,G.jsx)(`td`,{className:`whitespace-nowrap py-2 pe-3 text-start`,children:e.date}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-end text-muted`,children:s(e.estimate,2)}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-end`,children:s(e.actual,2)}),(0,G.jsx)(`td`,{className:p(`whitespace-nowrap px-2 py-2 text-end`,t?.tone),title:e.unusual?`The estimate and actual look like different periods (e.g. yearly vs quarterly): left out of the averages`:void 0,children:t?.text??`—`}),(0,G.jsx)(`td`,{className:p(`py-2 ps-2 text-end`,e.reaction?i(e.reaction.move):`text-faint`),children:e.reaction?l(e.reaction.move,1):`—`})]},e.at)})})]})}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`Source: `,n.source,n.implied?`; options chain from the exchange / market data feed`:``,`. Past reactions don't predict the next one.`]})]}):(0,G.jsx)(j,{className:`h-48 w-full`})})]})}async function kn(e,t){return(await h.get(`/theses/${encodeURIComponent(e)}`,{params:{market:t},timeout:9e4})).data.thesis}async function An(e,t,n){return(await h.put(`/theses`,{symbol:e,market:t,...n},{timeout:9e4})).data.thesis}async function jn(e,t,n,r){return(await h.post(`/theses/${e}/log`,{note:t,impact:n,conviction:r},{timeout:9e4})).data.thesis}async function Mn(e){return(await h.post(`/theses/${e}/reviewed`,{},{timeout:9e4})).data.thesis}async function Nn(e){await h.delete(`/theses/${e}`)}var Pn={on_track:{label:`On track`,className:`bg-up-soft text-up`},watch:{label:`Watch`,className:`bg-warn-soft text-warn`},broken:{label:`Broken`,className:`bg-down-soft text-down`}},Fn={on_track:`watch`,watch:`broken`,broken:`on_track`},In={up:`text-up`,down:`text-down`,warn:`text-warn`,info:`text-muted`},Ln={strengthens:`Strengthens`,weakens:`Weakens`,neutral:`Neutral`},Rn=[{value:`high`,label:`High`},{value:`medium`,label:`Medium`},{value:`low`,label:`Low`}];function zn(e){return{statement:e?.statement??``,pillars:e?.pillars.length?e.pillars:[{text:``,status:`on_track`}],risks:e?.risks.length?e.risks:[``],exit:e?.exit_below==null?``:String(e.exit_below),exitNote:e?.exit_note??``,target:e?.target==null?``:String(e.target),conviction:e?.conviction??`medium`}}function Bn({initial:e,onSave:t,onCancel:n}){let[r,i]=(0,W.useState)(()=>zn(e)),[a,o]=(0,W.useState)(!1),s=e=>i(t=>({...t,...e}));async function c(){let e=r.exit.trim()?Number(r.exit):null,n=r.target.trim()?Number(r.target):null;o(!0);try{await t({statement:r.statement,pillars:r.pillars.filter(e=>e.text.trim()),risks:r.risks.filter(e=>e.trim()),exit_note:r.exitNote,conviction:r.conviction,...e==null?{clear_exit:!0}:{exit_below:e},...n==null?{clear_target:!0}:{target:n}})}finally{o(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(b,{label:`Thesis`,hint:`One or two sentences that could be proved wrong, e.g. “Margins expand as the mix shifts to software”.`,children:(0,G.jsx)(g,{className:`font-sans text-sm`,rows:2,maxLength:2e3,value:r.statement,onChange:e=>s({statement:e.target.value})})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-muted`,children:`Pillars: what has to go right (up to 5)`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[r.pillars.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(x,{value:e.text,maxLength:300,placeholder:`Revenue growth above 20%`,onChange:e=>s({pillars:r.pillars.map((n,r)=>r===t?{...n,text:e.target.value}:n)})}),(0,G.jsx)(_,{className:`w-32`,value:e.status,onChange:e=>s({pillars:r.pillars.map((n,r)=>r===t?{...n,status:e.target.value}:n)}),options:Object.entries(Pn).map(([e,t])=>({value:e,label:t.label}))})]},t)),r.pillars.length<5&&(0,G.jsx)(O,{size:`sm`,variant:`ghost`,icon:`plus`,onClick:()=>s({pillars:[...r.pillars,{text:``,status:`on_track`}]}),children:`Add pillar`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-muted`,children:`Risks: what would prove it wrong (up to 5)`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[r.risks.map((e,t)=>(0,G.jsx)(x,{value:e,maxLength:300,placeholder:`A price war with the market leader`,onChange:e=>s({risks:r.risks.map((n,r)=>r===t?e.target.value:n)})},t)),r.risks.length<5&&(0,G.jsx)(O,{size:`sm`,variant:`ghost`,icon:`plus`,onClick:()=>s({risks:[...r.risks,``]}),children:`Add risk`})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,G.jsx)(b,{label:`Exit if the price falls below`,hint:`Optional: you get a message`,children:(0,G.jsx)(x,{type:`number`,min:`0`,step:`any`,value:r.exit,onChange:e=>s({exit:e.target.value})})}),(0,G.jsx)(b,{label:`Worth if it plays out (target)`,hint:`Optional: you get a message`,children:(0,G.jsx)(x,{type:`number`,min:`0`,step:`any`,value:r.target,onChange:e=>s({target:e.target.value})})}),(0,G.jsx)(b,{label:`Conviction`,children:(0,G.jsx)(S,{size:`sm`,value:r.conviction,onChange:e=>s({conviction:e}),options:Rn})})]}),(0,G.jsx)(b,{label:`Anything else that would make you exit`,hint:`Optional`,children:(0,G.jsx)(x,{value:r.exitNote,maxLength:500,placeholder:`Management change, a dilutive deal, losing the top customer…`,onChange:e=>s({exitNote:e.target.value})})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(O,{icon:`check`,loading:a,disabled:!r.statement.trim(),onClick:c,children:`Save thesis`}),(0,G.jsx)(O,{variant:`ghost`,onClick:n,children:`Cancel`})]})]})}function Vn({symbol:e,market:t}){let[n,r]=(0,W.useState)(void 0),[i,a]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(``),[m,h]=(0,W.useState)(`neutral`),[g,y]=(0,W.useState)(!1),[b,ee]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let n=!0;return r(void 0),a(null),l(!1),kn(e,t).then(e=>n&&r(e)).catch(e=>n&&a(o(e))),()=>{n=!1}},[e,t]);async function S(e,t){y(!0);try{return r(await e()),t&&f.success(t),!0}catch(e){return f.error(o(e)),!1}finally{y(!1)}}async function w(){if(n)try{await Nn(n.id),r(null),ee(!1),f.success(`Thesis deleted`)}catch(e){f.error(o(e))}}let T=n;return(0,G.jsxs)(C,{id:`section-thesis`,section:`My thesis`,children:[(0,G.jsx)(D,{title:`My thesis`,icon:`pencil`,description:T?`Conviction ${T.conviction} · last reviewed ${T.reviewed_at??`—`}`:`Why you own or watch this stock, and what would prove you wrong`}),(0,G.jsx)(v,{className:`space-y-5`,children:i?(0,G.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Thesis unavailable: `,i]}):T===void 0?(0,G.jsx)(j,{className:`h-24 w-full`}):c||T===null?c?(0,G.jsx)(Bn,{initial:T,onCancel:()=>l(!1),onSave:async n=>{await S(()=>An(e,t,n),`Thesis saved`)&&l(!1)}}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`p`,{className:`max-w-xl text-sm text-muted`,children:[`Write down why you own (or are watching) `,e,`: what has to go right, what would prove you wrong, and the price that breaks it. MarketMyna checks it against live data and reminds you to review it every quarter.`]}),(0,G.jsx)(O,{icon:`pencil`,onClick:()=>l(!0),children:`Write a thesis`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:T.statement}),T.signals&&T.signals.length>0&&(0,G.jsx)(`ul`,{className:`space-y-1 rounded-lg bg-canvas p-3 text-sm`,children:T.signals.map(e=>(0,G.jsxs)(`li`,{className:p(`flex gap-2`,In[e.tone]),children:[(0,G.jsx)(`span`,{children:`•`}),(0,G.jsx)(`span`,{children:e.text})]},e.key))}),T.pillars.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted`,children:`Pillars (click a status to change it)`}),(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:T.pillars.map((n,r)=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,G.jsx)(`span`,{children:n.text}),(0,G.jsx)(`button`,{type:`button`,disabled:g,className:p(`shrink-0 rounded px-2 py-0.5 text-xs`,Pn[n.status].className),onClick:()=>S(()=>An(e,t,{pillars:T.pillars.map((e,t)=>t===r?{...e,status:Fn[e.status]}:e)})),children:Pn[n.status].label})]},r))})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[T.risks.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted`,children:`Risks`}),(0,G.jsx)(`ul`,{className:`list-inside list-disc space-y-0.5 text-sm`,children:T.risks.map(e=>(0,G.jsx)(`li`,{children:e},e))})]}),(0,G.jsxs)(`div`,{className:`tabular space-y-0.5 text-sm`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:`Levels`}),T.price!=null&&(0,G.jsxs)(`div`,{children:[`Price now `,s(T.price,2)]}),(0,G.jsxs)(`div`,{children:[`Exit below `,T.exit_below==null?`—`:s(T.exit_below,2)]}),(0,G.jsxs)(`div`,{children:[`Target `,T.target==null?`—`:s(T.target,2)]}),T.exit_note&&(0,G.jsxs)(`div`,{className:`text-xs text-muted`,children:[`Also exit if: `,T.exit_note]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:`Update log`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsx)(x,{value:u,maxLength:1e3,placeholder:`What happened? (results, management change, a competitor move…)`,onChange:e=>d(e.target.value)}),(0,G.jsx)(_,{className:`sm:w-40`,value:m,onChange:e=>h(e.target.value),options:Object.entries(Ln).map(([e,t])=>({value:e,label:t}))}),(0,G.jsx)(O,{disabled:!u.trim(),loading:g,onClick:async()=>{await S(()=>jn(T.id,u,m),`Added to the log`)&&d(``)},children:`Log`})]}),T.log.length>0&&(0,G.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line text-sm`,children:T.log.slice(0,10).map((e,t)=>(0,G.jsxs)(`li`,{className:`flex gap-3 px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`tabular shrink-0 text-xs text-faint`,children:e.date}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.note}),(0,G.jsx)(`span`,{className:p(`shrink-0 text-xs`,e.impact===`strengthens`?`text-up`:e.impact===`weakens`?`text-down`:`text-muted`),children:Ln[e.impact]})]},t))})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(O,{size:`sm`,variant:`secondary`,icon:`pencil`,onClick:()=>l(!0),children:`Edit`}),(0,G.jsx)(O,{size:`sm`,variant:`ghost`,icon:`check`,loading:g,onClick:()=>S(()=>Mn(T.id),`Marked as reviewed`),children:`Reviewed, still holds`}),b?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(O,{size:`sm`,variant:`danger`,icon:`trash`,onClick:w,children:`Delete thesis and log`}),(0,G.jsx)(O,{size:`sm`,variant:`ghost`,onClick:()=>ee(!1),children:`Keep it`})]}):(0,G.jsx)(O,{size:`sm`,variant:`ghost`,icon:`trash`,onClick:()=>ee(!0),children:`Delete`})]}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`Your own view, checked against market data. Not advice.`})]})})]})}var Hn={rising:{text:`Estimates rising`,className:`bg-up-soft text-up`},falling:{text:`Estimates falling`,className:`bg-down-soft text-down`},steady:{text:`Estimates steady`,className:`bg-raised text-muted`}};function Un({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[a,c]=(0,W.useState)(null);if((0,W.useEffect)(()=>{let n=!1;return r(null),c(null),tt(e,t).then(e=>!n&&r(e)).catch(e=>!n&&c(o(e))),()=>{n=!0}},[e,t]),t===`crypto`||n&&!n.available)return null;let d=n?.momentum?Hn[n.momentum.label]:null,f=n?.currency?`${n.currency} `:``;return(0,G.jsxs)(C,{id:`section-estimates`,section:`Estimates`,children:[(0,G.jsx)(D,{title:`Analyst estimates`,description:`Consensus forecasts and how they have moved`,icon:`analyze`}),(0,G.jsx)(v,{className:`space-y-5`,children:a?(0,G.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Estimates unavailable: `,a]}):n?(0,G.jsxs)(G.Fragment,{children:[(d||n?.beats)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[d&&n?.momentum&&(0,G.jsxs)(`span`,{className:p(`rounded-md px-2 py-0.5 text-xs`,d.className),title:`Average change in the current- and next-year EPS consensus over 90 days`,children:[d.text,` `,l(n.momentum.change_90d,1),` / 90d`]}),n?.beats&&(0,G.jsxs)(`span`,{className:`rounded-md bg-raised px-2 py-0.5 text-xs text-muted`,children:[`Beat `,n.beats.beat,` of last `,n.beats.total]})]}),n.periods.length>0&&(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`tabular w-full min-w-[34rem] text-sm`,children:[(0,G.jsx)(`thead`,{className:`text-xs text-muted`,children:(0,G.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,G.jsx)(`th`,{className:`py-2 text-start font-medium`,children:`Period`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-end font-medium`,children:`EPS (range)`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-end font-medium`,children:`vs year ago`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-end font-medium`,title:`Change in the EPS consensus over 90 days`,children:`90d revision`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-end font-medium`,title:`Analysts raising / cutting their EPS estimate in the last 30 days`,children:`Up / down 30d`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-end font-medium`,children:`Revenue`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:n.periods.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`py-2`,children:[e.label,e.eps.analysts!=null&&(0,G.jsxs)(`span`,{className:`text-xs text-faint`,children:[` · `,s(e.eps.analysts,0)]})]}),(0,G.jsxs)(`td`,{className:`px-2 py-2 text-end`,children:[s(e.eps.avg),e.eps.low!=null&&e.eps.high!=null&&(0,G.jsxs)(`span`,{className:`block text-[11px] text-faint`,children:[s(e.eps.low),`–`,s(e.eps.high)]})]}),(0,G.jsx)(`td`,{className:p(`px-2 py-2 text-end`,i(e.eps.growth)),children:l(e.eps.growth,1)}),(0,G.jsx)(`td`,{className:p(`px-2 py-2 text-end`,i(e.trend.change_90d)),children:l(e.trend.change_90d,1)}),(0,G.jsxs)(`td`,{className:`px-2 py-2 text-end`,children:[(0,G.jsx)(`span`,{className:`text-up`,children:s(e.revisions.up_30d,0)}),(0,G.jsx)(`span`,{className:`text-faint`,children:` / `}),(0,G.jsx)(`span`,{className:`text-down`,children:s(e.revisions.down_30d,0)})]}),(0,G.jsxs)(`td`,{className:`px-2 py-2 text-end`,children:[e.revenue.avg==null?`—`:`${f}${u(e.revenue.avg)}`,e.revenue.growth!=null&&(0,G.jsx)(`span`,{className:p(`block text-[11px]`,i(e.revenue.growth)),children:l(e.revenue.growth,1)})]})]},e.key))})]})}),n.history.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted`,children:`Recent quarters: actual vs expected EPS`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:n.history.map(e=>(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas px-3 py-2 text-xs`,children:[(0,G.jsx)(`div`,{className:`text-faint`,children:e.quarter}),(0,G.jsx)(`div`,{className:`tabular mt-0.5 text-sm font-semibold`,children:s(e.actual)}),(0,G.jsxs)(`div`,{className:`tabular text-faint`,children:[`est `,s(e.estimate),` ·`,` `,(0,G.jsx)(`span`,{className:i(e.surprise),children:e.surprise==null?`—`:`${e.surprise>=0?`beat`:`miss`} ${l(e.surprise,1)}`})]})]},e.quarter))})]}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`Source: consensus of third-party analysts. Coverage is thinner for smaller and non-US companies.`})]}):(0,G.jsx)(j,{className:`h-48 w-full`})})]})}var Wn=`#6d8cff`;function Gn({label:e,weight:t,href:n,sub:r}){let i=n?(0,G.jsx)(M,{to:n,className:`truncate hover:text-accent-fg`,children:e}):(0,G.jsx)(`span`,{className:`truncate`,children:e});return(0,G.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_5rem_3.25rem] items-center gap-2 py-1 text-sm`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate`,title:r?`${e} · ${r}`:e,children:i}),(0,G.jsx)(`span`,{className:`h-2 rounded-full bg-raised`,children:(0,G.jsx)(`span`,{className:`block h-2 rounded-full`,style:{width:`${Math.min(t*100*2.5,100)}%`,background:Wn}})}),(0,G.jsxs)(`span`,{className:`tabular text-end text-xs`,children:[s(t*100,1),`%`]})]})}function Kn({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{let n=!1;return r(null),a(!1),at(e,t).then(e=>!n&&r(e)).catch(()=>!n&&a(!0)),()=>{n=!0}},[e,t]),i||t===`crypto`||n&&!n.is_etf)return null;if(!n)return(0,G.jsx)(j,{className:`h-40 w-full`});let o=n.status===`ok`,c=n.index?`Tracks the ${n.index}`:[n.category,n.family].filter(Boolean).join(` · `)||`Exchange-traded fund`;return(0,G.jsxs)(C,{id:`section-etf`,section:`ETF holdings`,children:[(0,G.jsx)(D,{title:`What this ETF holds`,description:c,icon:`portfolio`}),(0,G.jsxs)(v,{className:`space-y-5`,children:[o?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[n.count!=null&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Holdings`}),(0,G.jsx)(`div`,{className:`tabular font-semibold`,children:n.count})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Top 10 weight`}),(0,G.jsxs)(`div`,{className:`tabular font-semibold`,children:[s((n.top10_weight??0)*100,1),`%`]})]}),n.expense_ratio!=null&&(0,G.jsxs)(`div`,{title:n.category_expense_ratio==null?void 0:`Category average ${s(n.category_expense_ratio*100,2)}%`,children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Expense ratio`}),(0,G.jsxs)(`div`,{className:`tabular font-semibold`,children:[s(n.expense_ratio*100,2),`%`,n.category_expense_ratio!=null&&(0,G.jsxs)(`span`,{className:`text-xs font-normal text-faint`,children:[` vs `,s(n.category_expense_ratio*100,2),`%`]})]})]}),n.total_assets!=null&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Fund size`}),(0,G.jsx)(`div`,{className:`tabular font-semibold`,children:u(n.total_assets)})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 text-xs font-medium text-muted`,children:[`Top holdings `,n.weights===`estimated`?`(estimated weights)`:``]}),n.top?.slice(0,12).map(e=>(0,G.jsx)(Gn,{label:e.name||e.symbol,sub:e.sector,weight:e.weight,href:`/analyze?symbol=${encodeURIComponent(e.symbol)}&market=${t}`},e.symbol))]}),n.sectors&&n.sectors.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted`,children:`Sectors`}),n.sectors.slice(0,12).map(e=>(0,G.jsx)(Gn,{label:e.name,weight:e.weight},e.name))]})]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[n.note,` Source: `,n.source,`. Use Compare to check overlap between two ETFs.`]})]}):(0,G.jsx)(`p`,{className:`text-sm text-muted`,children:n.note}),[`india`,`us`,`hong_kong`].includes(t)&&(0,G.jsx)(lt,{market:t,kind:`etf`,symbol:e})]})]})}var qn=10;function Jn({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(!1),[o,c]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{if(t!==`india`)return;let n=new AbortController;return r(null),a(!1),c(!1),Be(e,n.signal).then(r).catch(()=>!n.signal.aborted&&a(!0)),()=>n.abort()},[e,t]),t!==`india`||i)return null;if(!n)return(0,G.jsx)(j,{className:`h-32 w-full`});if(!n.funds.length)return null;let l=n.funds.reduce((e,t)=>e+(t.value_cr??0),0),u=o?n.funds:n.funds.slice(0,qn);return(0,G.jsxs)(C,{help:`Mutual funds holding this`,children:[(0,G.jsx)(D,{title:`Mutual funds holding this`,icon:`portfolio`,description:`${n.count} scheme${n.count===1?``:`s`} across ${n.houses_loaded} fund house${n.houses_loaded===1?``:`s`} loaded · ₹${s(l,0)} Cr in all`}),(0,G.jsxs)(v,{className:`pt-0`,children:[(0,G.jsxs)(`table`,{className:`w-full table-fixed text-sm`,children:[(0,G.jsxs)(`colgroup`,{children:[(0,G.jsx)(`col`,{}),(0,G.jsx)(`col`,{className:`w-24`}),(0,G.jsx)(`col`,{className:`w-20`}),(0,G.jsx)(`col`,{className:`w-20`})]}),(0,G.jsx)(`thead`,{className:`text-xs text-muted`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`py-1 text-start font-medium`,children:`Scheme`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`Value`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`% of fund`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`Last month`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:u.map(e=>{let t=e.prev_weight==null?null:e.weight-e.prev_weight;return(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`truncate py-1.5 pe-2`,title:`${e.scheme} · ${e.amc}`,children:[e.scheme,(0,G.jsx)(`span`,{className:`ms-1 text-xs text-faint`,children:e.amc.replace(/ Mutual Fund$/,``)})]}),(0,G.jsx)(`td`,{className:`tabular py-1.5 text-end`,children:e.value_cr==null?`—`:`₹${s(e.value_cr,0)} Cr`}),(0,G.jsxs)(`td`,{className:`tabular py-1.5 text-end`,children:[s(e.weight,2),`%`]}),(0,G.jsx)(`td`,{className:p(`tabular py-1.5 text-end text-xs`,t==null||t>.01?`text-up`:t<-.01?`text-down`:`text-muted`),children:t==null?`New`:`${t>=0?`+`:``}${s(t,2)}`})]},`${e.amc}-${e.scheme}`)})})]}),n.funds.length>qn&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`mt-2 text-xs text-accent-fg hover:underline`,children:o?`Show fewer`:`Show all ${n.funds.length}`}),(0,G.jsx)(`p`,{className:`mt-2 text-xs text-faint`,children:`From fund houses' official monthly portfolio files; only houses loaded so far are counted.`})]})]})}var Yn={below:`Below sector`,in_line:`In line with sector`,above:`Above sector`},Xn=[`bg-line-strong/40`,`bg-line-strong/70`,`bg-line-strong/40`],Zn=.4,Qn=2.5,$n=e=>Math.log(Math.min(Math.max(e,Zn),Qn)/Zn)/Math.log(Qn/Zn)*100;function er({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null);if((0,W.useEffect)(()=>{let n=!1;return r(null),a(null),it(e,t).then(e=>!n&&r(e)).catch(e=>!n&&a(o(e))),()=>{n=!0}},[e,t]),t===`crypto`)return null;let c=n?.bands?.below??.8,l=n?.bands?.above??1.2,u=n?.zone??null;return(0,G.jsxs)(C,{id:`section-valuation`,section:`Valuation meter`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Valuation meter`,u&&(0,G.jsx)(`span`,{className:`rounded-md bg-raised px-2 py-0.5 text-xs font-semibold text-fg`,children:Yn[u]})]}),description:n?.status===`ok`?`Today's price vs ${n.sector} companies (${n.peers} profitable peers among ${n.universe})`:`Today's price against the company's sector`}),(0,G.jsxs)(v,{className:`space-y-5`,children:[i&&(0,G.jsx)(`p`,{className:`text-sm text-down`,children:i}),!n&&!i&&(0,G.jsx)(ct,{className:`min-h-44`,steps:[`Reading the company’s P/E, book value and sales…`,`Building sector medians from the largest companies…`,`Placing today’s price on the meter…`]}),n?.status===`unavailable`&&(0,G.jsx)(`p`,{className:`text-sm text-muted`,children:n.reason}),n?.status===`ok`&&n.position!=null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`relative h-3 overflow-hidden rounded-full bg-raised`,children:[(0,G.jsx)(`span`,{className:p(`absolute inset-y-0 left-0`,Xn[0]),style:{width:`${$n(c)}%`}}),(0,G.jsx)(`span`,{className:p(`absolute inset-y-0`,Xn[1]),style:{left:`${$n(c)}%`,width:`${$n(l)-$n(c)}%`}}),(0,G.jsx)(`span`,{className:p(`absolute inset-y-0 right-0`,Xn[2]),style:{left:`${$n(l)}%`}})]}),(0,G.jsx)(`div`,{className:`relative h-0`,children:(0,G.jsx)(`span`,{className:`absolute -top-5 h-7 w-1 -translate-x-1/2 rounded-full bg-fg shadow`,style:{left:`${$n(n.position)}%`},"aria-hidden":`true`})}),(0,G.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 text-[12px] text-faint`,children:[(0,G.jsx)(`span`,{children:Yn.below}),(0,G.jsx)(`span`,{className:`text-center`,children:Yn.in_line}),(0,G.jsx)(`span`,{className:`text-end`,children:Yn.above})]}),(0,G.jsxs)(`p`,{className:`mt-2 text-sm`,children:[`Priced at `,(0,G.jsxs)(`span`,{className:`tabular font-semibold`,children:[s(n.position,2),`×`]}),` its sector on average`,` `,(0,G.jsxs)(`span`,{className:`text-muted`,children:[`(below `,c,`× = `,Yn.below.toLowerCase(),`, above `,l,`× = `,Yn.above.toLowerCase(),`)`]})]})]}),(0,G.jsxs)(`table`,{className:`tabular w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`text-xs text-muted`,children:(0,G.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,G.jsx)(`th`,{className:`py-1.5 text-start font-medium`,children:`Measure`}),(0,G.jsx)(`th`,{className:`py-1.5 text-end font-medium`,children:`This stock`}),(0,G.jsxs)(`th`,{className:`py-1.5 text-end font-medium`,children:[`Sector`,(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:` median`})]}),(0,G.jsx)(`th`,{className:`py-1.5 text-end font-medium`,children:`× sector`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:n.multiples?.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`py-1.5`,children:e.label}),(0,G.jsx)(`td`,{className:`py-1.5 text-end`,children:e.value!=null&&e.value>0?s(e.value,1):`—`}),(0,G.jsx)(`td`,{className:`py-1.5 text-end text-muted`,children:e.sector_median==null?`—`:s(e.sector_median,1)}),(0,G.jsx)(`td`,{className:`py-1.5 text-end font-medium`,children:e.ratio==null?`—`:`${s(e.ratio,2)}×`})]},e.key))})]})]}),n?.garp&&n.status===`ok`&&(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas p-4`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`Growth at a reasonable price`}),(0,G.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Meets `,n.garp.passed,` of `,n.garp.total,` rules`,n.garp.missing?` (${n.garp.missing} without data)`:``,` · PEG`,` `,(0,G.jsx)(`span`,{className:`tabular font-semibold text-fg`,children:n.garp.peg==null?`—`:s(n.garp.peg,2)})]})]}),(0,G.jsx)(`ul`,{className:`grid gap-x-10 gap-y-1 text-xs sm:grid-cols-2`,children:n.garp.rules.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:e.pass?`text-fg`:`text-muted`,children:[(0,G.jsx)(`span`,{className:p(`me-1.5 font-semibold`,e.pass?`text-up`:`text-faint`),children:e.pass==null?`–`:e.pass?`✓`:`✗`}),e.rule]}),(0,G.jsx)(`span`,{className:`tabular text-faint`,children:e.value==null?`no data`:s(e.value,1)})]},e.rule))}),(0,G.jsx)(`p`,{className:`mt-2 text-[12px] text-faint`,children:`PEG = P/E ÷ earnings growth %. Around 1 means the price and the growth match; above 2 the price runs ahead of growth.`})]}),n?.status===`ok`&&(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`A comparison with the company’s sector at today’s price, not a fair-value estimate or advice. A company can deserve a higher multiple (faster growth, stronger brand) or be cheap for a reason. Fundamentals from our market data feed, latest reported; sector medians refresh every few hours.`})]})]})}function tr({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null);(0,W.useEffect)(()=>{let n=!1;return r(null),a(null),Xe(e,t).then(e=>!n&&r(e)).catch(e=>!n&&a(o(e))),()=>{n=!0}},[e,t]);let s=new URLSearchParams({symbol:e,market:t});return(0,G.jsxs)(C,{id:`section-setup`,section:`Trade setup`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Trade setup `,n?.trend&&(0,G.jsx)(E,{tone:n.trend===`uptrend`?`up`:n.trend===`downtrend`?`down`:`neutral`,children:n.trend})]}),description:`Daily ranges for the next days to weeks · computed, not AI`}),(0,G.jsxs)(v,{children:[i?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Not available: `,i]}):n?(0,G.jsx)(nr,{row:n}):(0,G.jsx)(j,{className:`h-36 w-full`}),(0,G.jsx)(`div`,{className:`mt-5 flex flex-wrap gap-1.5 border-t border-line pt-4`,children:[[`chart`,`Intraday chart`,`candles`],[`alerts`,`Set alert`,`bell`],[`size`,`Position size`,`shield`]].map(([e,t,n])=>(0,G.jsxs)(M,{to:`/trade?${s}&tab=${e}`,className:`inline-flex items-center gap-1.5 rounded-md border border-line px-2 py-1 text-xs text-muted hover:border-faint hover:text-fg`,children:[(0,G.jsx)(T,{name:n,className:`h-3.5 w-3.5`}),t]},e))})]})]})}function nr({row:e}){let t=e.price;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(rr,{row:e}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-sm sm:grid-cols-4`,children:[(0,G.jsx)(ir,{label:`ATR (14 days)`,value:e.atr!=null&&t?`${s(e.atr)} (${s(e.atr/t*100,1)}%)`:`—`,hint:`Average daily move: size stops in ATRs, not fixed %`}),(0,G.jsx)(ir,{label:`RSI (14)`,value:(0,G.jsx)(ar,{rsi:e.rsi})}),(0,G.jsx)(ir,{label:`Volume vs 20-day`,value:e.volume_ratio==null?`—`:`${s(e.volume_ratio,1)}×`,className:e.volume_ratio!=null&&e.volume_ratio>=1.5?`text-accent-fg`:void 0}),(0,G.jsx)(ir,{label:`1-week range (≈68%)`,value:`${s(e.week_low)} – ${s(e.week_high)}`})]}),e.reasons&&e.reasons.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.reasons.map(e=>(0,G.jsx)(`span`,{className:`rounded-md bg-raised px-2 py-1 text-xs text-muted`,children:e},e))})]})}function rr({row:e}){let t=[e.price,e.normal_low,e.normal_high,e.week_low,e.week_high].filter(e=>e!=null);if(e.price==null||t.length<3)return null;let n=Math.min(...t),r=Math.max(...t);if(r<=n)return null;let i=e=>(e-n)/(r-n)*100,a=e=>`${i(e)}%`;return(0,G.jsxs)(`div`,{className:`px-1 pt-5`,children:[(0,G.jsxs)(`div`,{className:`relative h-1.5 rounded-full bg-line`,children:[e.normal_low!=null&&e.normal_high!=null&&(0,G.jsx)(`div`,{className:`absolute inset-y-0 rounded-full bg-accent/25`,style:{left:a(e.normal_low),width:`calc(${a(e.normal_high)} - ${a(e.normal_low)})`},title:`Normal range (20-day band) ${s(e.normal_low)} – ${s(e.normal_high)}`}),(0,G.jsx)(`div`,{className:`absolute top-1/2 -translate-x-1/2 -translate-y-1/2`,style:{left:a(e.price)},title:`Price ${s(e.price)}`,children:(0,G.jsx)(`span`,{className:`block h-3.5 w-3.5 rounded-full border-2 border-canvas bg-fg`})})]}),(0,G.jsxs)(`div`,{className:`tabular mt-8 flex justify-between text-[11px] text-faint`,children:[(0,G.jsx)(`span`,{children:s(n)}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`me-1 inline-block h-1.5 w-3 rounded-full bg-accent/25 align-middle`}),`normal range (20-day band) `,s(e.normal_low),` – `,s(e.normal_high)]}),(0,G.jsx)(`span`,{children:s(r)})]})]})}function ir({label:e,value:t,hint:n,className:r}){return(0,G.jsxs)(`div`,{title:n,children:[(0,G.jsx)(`dt`,{className:`text-xs text-muted`,children:e}),(0,G.jsx)(`dd`,{className:p(`tabular mt-0.5 font-medium`,r),children:t})]})}function ar({rsi:e}){if(e==null)return(0,G.jsx)(G.Fragment,{children:`—`});let t=e>=70?`overbought`:e<=30?`oversold`:null;return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[s(e,0),t&&(0,G.jsx)(k,{value:t})]})}function or({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{let n=!1;return r(null),a(!1),ot(e,t).then(e=>!n&&r(e)).catch(()=>!n&&a(!0)),()=>{n=!0}},[e,t]),i||t===`crypto`||n&&!n.pays)return null;if(!n)return(0,G.jsx)(j,{className:`h-40 w-full`});let o=n.currency?`${n.currency} `:``,c=[[`Trailing yield`,n.ttm_yield==null?`—`:`${s(n.ttm_yield,2)}%`,`${o}${s(n.ttm)} paid in the last 12 months`],[`Forward yield`,n.forward_yield==null?`—`:`${s(n.forward_yield,2)}%`,n.forward_rate==null?void 0:`${o}${s(n.forward_rate)} a year at the current rate`],[`5-year growth`,n.growth_5y==null?`—`:l(n.growth_5y,1),`Yearly dividend, compound`],[`Years without a cut`,String(n.years_without_cut??`—`),n.first_year?`Paying since ${n.first_year}`:void 0],[`Payout ratio`,n.payout_ratio==null?`—`:`${s(n.payout_ratio,0)}%`,`Share of profit paid out`],[`How often`,n.frequency??`—`,n.next_ex_date?`Next ex-date ${n.next_ex_date}`:n.last?`Last ${n.last.date}`:void 0]];return(0,G.jsxs)(C,{id:`section-dividends`,section:`Dividends`,children:[(0,G.jsx)(D,{title:`Dividends`,description:`Payment history and how the payout has grown`,icon:`portfolio`}),(0,G.jsxs)(v,{className:`space-y-5`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-3`,children:c.map(([e,t,n])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:e}),(0,G.jsx)(`div`,{className:`tabular font-semibold`,children:t}),n&&(0,G.jsx)(`div`,{className:`text-xs text-muted`,children:n})]},e))}),n.years&&n.years.length>1&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 text-xs font-medium text-muted`,children:[`Dividends per share by year (`,n.currency,`)`]}),(0,G.jsx)(`div`,{className:`h-44`,children:(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(Ce,{data:n.years,margin:{top:4,right:4,bottom:0,left:0},children:[(0,G.jsx)(R,{dataKey:`year`,tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1}),(0,G.jsx)(z,{width:40,tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1}),(0,G.jsx)(I,{cursor:{fill:`var(--color-raised)`},contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12},formatter:(e,t,n)=>[`${o}${s(Number(e))}${n?.payload?.partial?` (so far)`:``}`,`Dividends`]}),(0,G.jsx)(xe,{dataKey:`total`,radius:[3,3,0,0],isAnimationActive:!1,children:n.years.map(e=>(0,G.jsx)(Se,{fill:`var(--color-accent)`,fillOpacity:e.partial?.4:.85},e.year))})]})})})]}),n.payments&&n.payments.length>0&&(0,G.jsxs)(`details`,{className:`text-sm`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted`,children:`Recent payments`}),(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-x-6 sm:grid-cols-4`,children:n.payments.map(e=>(0,G.jsxs)(`div`,{className:`flex justify-between border-b border-line py-1 text-xs`,children:[(0,G.jsx)(`span`,{className:`text-muted`,children:e.date}),(0,G.jsx)(`span`,{className:`tabular`,children:s(e.amount,2)})]},e.date))})]}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`Ex-dividend dates, adjusted for splits and bonus issues. Source: market data feed. Faded bar = current year so far.`})]})]})}var sr={strong:`up`,steady:`accent`,uncertain:`warn`,concerning:`down`};function cr(e){return e<=3?`bg-up`:e<=6?`bg-warn`:`bg-down`}function lr(e){let t=e.replace(/^(mr|mrs|ms|dr|shri|smt)\.?\s+/i,``).split(` `).filter(Boolean);return((t[0]?.[0]??``)+(t.length>1?t[t.length-1][0]:``)).toUpperCase()}function ur({items:e,tone:t}){return(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,G.jsxs)(`li`,{className:`flex gap-2 text-sm leading-relaxed text-fg/90`,children:[(0,G.jsx)(`span`,{className:p(`mt-2 h-1.5 w-1.5 shrink-0 rounded-full`,t===`up`?`bg-up`:`bg-down`)}),(0,G.jsx)(`span`,{children:e})]},e))})}function dr({symbol:e,market:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[s,c]=(0,W.useState)({});(0,W.useEffect)(()=>{if(t===`crypto`)return;let n=!1;return r(null),a(null),c({}),_e(e,t).then(e=>!n&&r(e)).catch(e=>!n&&a(o(e))),()=>{n=!0}},[e,t]);let l=()=>{c({loading:!0}),me(e,t).then(e=>c({data:e})).catch(e=>c({error:o(e)}))};if(t===`crypto`)return null;let d=n?.ceo,f=s.data;return(0,G.jsxs)(C,{id:`section-leadership`,section:`CEO & leadership`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`CEO & leadership `,f&&(0,G.jsx)(E,{tone:sr[f.verdict],children:f.verdict})]}),description:`Who runs the company, their track record, and how safe it looks under them`}),(0,G.jsx)(v,{className:`space-y-5`,children:i?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Not available: `,i]}):n?(0,G.jsxs)(G.Fragment,{children:[d&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`grid h-12 w-12 shrink-0 place-items-center rounded-full bg-accent-soft text-sm font-semibold text-accent-fg ring-1 ring-accent/30`,children:lr(d.name)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-base font-semibold`,children:d.name}),(0,G.jsx)(`div`,{className:`text-xs text-muted`,children:[d.title,d.age&&`age ${d.age}`].filter(Boolean).join(` · `)})]}),d.total_pay!=null&&(0,G.jsxs)(`div`,{className:`text-end`,children:[(0,G.jsxs)(`div`,{className:`text-xs font-medium text-muted`,children:[`Total pay`,d.fiscal_year?` (FY${d.fiscal_year})`:``]}),(0,G.jsxs)(`div`,{className:`tabular mt-0.5 text-sm font-semibold`,children:[u(d.total_pay),` `,n.currency]})]})]}),f?(0,G.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-canvas p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-xs font-medium text-accent-fg`,children:`Introduction`}),(0,G.jsx)(`p`,{className:`text-sm leading-relaxed text-fg/90`,children:f.introduction})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[f.achievements.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-semibold tracking-wide text-up uppercase`,children:`Achievements`}),(0,G.jsx)(ur,{items:f.achievements,tone:`up`})]}),f.pitfalls.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-semibold tracking-wide text-down uppercase`,children:`Pitfalls`}),(0,G.jsx)(ur,{items:f.pitfalls,tone:`down`})]})]}),f.verdict_reason&&(0,G.jsxs)(`div`,{className:`border-t border-line pt-3`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-xs font-medium text-muted`,children:[`Company under this CEO `,(0,G.jsx)(E,{tone:sr[f.verdict],children:f.verdict})]}),(0,G.jsx)(`p`,{className:`text-sm leading-relaxed text-fg/90`,children:f.verdict_reason})]}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`AI-written from the model's knowledge and recent headlines - verify key facts.`})]}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(O,{size:`sm`,variant:`secondary`,icon:`cpu`,loading:s.loading,onClick:l,disabled:!d,children:s.loading?`Writing CEO brief…`:`AI CEO brief`}),(0,G.jsx)(`span`,{className:`text-[12px] text-faint`,children:`Introduction, achievements, pitfalls and a verdict from your configured AI model.`})]}),s.error&&(0,G.jsx)(re,{title:`CEO brief failed`,onDismiss:()=>c({}),children:s.error}),n.governance.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:`Governance risk (1 low – 10 high)`}),n.governance_as_of&&(0,G.jsxs)(`span`,{className:`text-[12px] text-faint`,children:[`ISS · `,n.governance_as_of]})]}),(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:n.governance.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-line`,children:(0,G.jsx)(`div`,{className:p(`h-full rounded-full`,cr(e.score)),style:{width:`${e.score*10}%`}})}),(0,G.jsx)(`span`,{className:`tabular w-5 text-end text-xs font-medium`,children:e.score})]},e.key))})]}),n.officers.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-muted`,children:`Other key officers`}),(0,G.jsx)(`dl`,{className:`divide-y divide-line`,children:n.officers.map(e=>(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5`,children:[(0,G.jsx)(`dt`,{className:`min-w-0 truncate text-sm`,children:e.name}),(0,G.jsx)(`dd`,{className:`min-w-0 max-w-[60%] text-end text-xs text-muted`,children:e.title})]},e.name))})]})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(j,{className:`h-12 w-12 rounded-full`}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsx)(j,{className:`h-4 w-48`}),(0,G.jsx)(j,{className:`h-3 w-32`})]})]})})]})}function fr({symbol:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(null),[a,s]=(0,W.useState)(!1);(0,W.useEffect)(()=>{n(null),i(null)},[e]);async function c(){s(!0),i(null);try{n(await N(e))}catch(e){i(o(e))}finally{s(!1)}}return(0,G.jsxs)(C,{id:`section-mdna`,section:`Management discussion`,children:[(0,G.jsx)(D,{title:`What management says`,description:t?`AI summary of MD&A in the ${t.form} for the period to ${t.period} (filed ${t.filed})`:`AI summary of the Management's Discussion & Analysis in the latest SEC 10-K / 10-Q`,actions:(0,G.jsx)(O,{variant:t?`ghost`:`primary`,size:`sm`,icon:`cpu`,loading:a,onClick:c,children:t?`Refresh`:a?`Reading filing…`:`Summarise filing`})}),(0,G.jsxs)(v,{children:[r&&(0,G.jsx)(`p`,{className:`text-sm text-down`,children:r}),!t&&!r&&!a&&(0,G.jsx)(`p`,{className:`text-sm text-muted`,children:`Reads what the company itself says about results, drivers, outlook and risks. Takes about 20-40 seconds.`}),a&&!t&&(0,G.jsx)(`p`,{className:`text-sm text-muted`,children:`Fetching the latest annual or quarterly filing and summarising…`}),t&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`text-sm leading-relaxed`,children:(0,G.jsx)(Rt,{text:t.summary})}),(0,G.jsxs)(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-fg hover:underline`,children:[`Read the full `,t.form,` on SEC.gov ↗`]})]})]})]})}function pr(e){return e.value==null?`—`:e.kind===`pct`?`${s(e.value,1)}%`:e.kind===`money`?u(e.value):s(e.value,2)}function q({text:e}){return(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:e?`Not available: ${e}`:`Not available`})}function J({label:e,value:t,hint:n,className:r}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5`,title:n,children:[(0,G.jsx)(`dt`,{className:`text-xs text-muted`,children:e}),(0,G.jsx)(`dd`,{className:p(`tabular text-sm font-medium`,r),children:t})]})}var mr=[`technical`,`fundamentals`,`risk`,`analysts`,`profile`,`leadership`,`ownership`,`mdna`,`news`],hr=3e5,gr=new Map;function _r(e,t){let n=`${e}:${t}`,r=gr.get(n);if(r&&Date.now()-r.at<hr)return r.promise;let i=P(e,t);return i.catch(()=>gr.delete(n)),gr.set(n,{at:Date.now(),promise:i}),i}function vr({symbol:e,market:t,investor:n=!0,parts:r=mr}){let i=e=>r.includes(e),a=[`technical`,`fundamentals`,`risk`,`analysts`,`profile`,`news`].some(e=>i(e)&&(e!==`fundamentals`||n)),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1);(0,W.useEffect)(()=>{if(!a)return;let n=!1;return c(null),u(null),_r(e,t).then(e=>!n&&c(e)).catch(e=>!n&&u(o(e))),()=>{n=!0}},[e,t,a]);let m=[`technical`,`fundamentals`,`risk`,`analysts`].filter(e=>i(e)&&(e!==`fundamentals`||n));return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[a&&(l?(0,G.jsx)(C,{children:(0,G.jsx)(v,{children:(0,G.jsx)(q,{text:l})})}):s?(0,G.jsx)(yr,{data:s,symbol:e,grid:m,has:i,showFullSummary:d,onToggleSummary:()=>f(e=>!e)}):(0,G.jsx)(`div`,{className:p(`grid gap-6`,m.length>1&&`xl:grid-cols-2`),children:Array.from({length:Math.max(1,m.length)},(e,t)=>(0,G.jsx)(j,{className:`h-56 w-full`},t))})),n&&i(`leadership`)&&(0,G.jsx)(dr,{symbol:e,market:t}),n&&i(`ownership`)&&t!==`crypto`&&(0,G.jsx)(Te,{symbol:e,market:t}),n&&i(`mdna`)&&t===`us`&&(0,G.jsx)(fr,{symbol:e}),i(`news`)&&s&&(0,G.jsx)(br,{news:s.news})]})}function yr({data:e,symbol:t,grid:n,has:r,showFullSummary:a,onToggleSummary:o}){let{technical:c,fundamentals:u,risk:d,analysts:f,events:m,profile:h}=e;return(0,G.jsxs)(G.Fragment,{children:[n.length>0&&(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:`Market data computed by MarketMyna - facts, not AI opinion. Run AI for the AI read.`}),n.length>0&&(0,G.jsxs)(`div`,{className:p(`grid gap-6`,n.length>1&&`xl:grid-cols-2`),children:[n.includes(`technical`)&&(0,G.jsxs)(C,{id:`section-technical`,section:`Technical`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Technical `,c.overall&&(0,G.jsx)(k,{value:c.overall})]}),description:c.error?void 0:c.counts?`${c.trend} · ${c.counts.buy} bullish / ${c.counts.sell} bearish / ${c.counts.neutral} neutral · as of ${c.as_of} · what the indicators read, not a recommendation`:`${c.trend} · indicator values as of ${c.as_of}`}),(0,G.jsx)(v,{children:c.error?(0,G.jsx)(q,{text:c.error}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`table`,{className:`w-full text-sm`,children:(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:c.indicators.map(e=>(0,G.jsxs)(`tr`,{title:e.note,children:[(0,G.jsxs)(`td`,{className:`py-1.5 pe-2`,children:[(0,G.jsx)(`div`,{className:`text-sm`,children:e.name}),(0,G.jsx)(`div`,{className:`text-[12px] text-faint`,children:e.note})]}),(0,G.jsx)(`td`,{className:`tabular py-1.5 pe-2 text-end`,children:s(e.value)}),(0,G.jsx)(`td`,{className:`py-1.5 text-end`,children:e.signal&&(0,G.jsx)(k,{value:e.signal})})]},e.key))})}),c.patterns&&c.patterns.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-muted`,children:`Patterns on the latest bar`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:c.patterns.map(e=>(0,G.jsx)(`span`,{className:p(`rounded-md px-2 py-1 text-xs ring-1 ring-inset`,e.bias===`bullish`?`bg-up-soft text-up ring-up/30`:e.bias===`bearish`?`bg-down-soft text-down ring-down/30`:`bg-canvas text-muted ring-line`),children:e.name},e.key))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-muted`,children:`Price vs moving averages`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:c.averages.map(e=>(0,G.jsxs)(`span`,{className:p(`rounded-md px-2 py-1 text-xs ring-1 ring-inset`,e.above?`bg-up-soft text-up ring-up/30`:`bg-down-soft text-down ring-down/30`),title:`${e.period}-day average ${s(e.value)}`,children:[e.period,`D `,l(e.distance_pct,1)]},e.period))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-muted`,children:`Returns`}),(0,G.jsx)(`div`,{className:`grid grid-cols-5 gap-2 text-center`,children:Object.entries(c.returns).map(([e,t])=>(0,G.jsxs)(`div`,{className:`rounded-md bg-canvas py-1.5`,children:[(0,G.jsx)(`div`,{className:`text-[12px] text-faint`,children:e}),(0,G.jsx)(`div`,{className:p(`tabular text-sm font-medium`,i(t)),children:l(t,1)})]},e))})]}),(0,G.jsxs)(`dl`,{className:`divide-y divide-line`,children:[(0,G.jsx)(J,{label:`52-week range`,value:`${s(c.low_52w)} – ${s(c.high_52w)}`}),(0,G.jsx)(J,{label:`From 52-week high`,value:l(c.from_high_pct,1),className:i(c.from_high_pct)})]})]})})]}),n.includes(`fundamentals`)&&(0,G.jsxs)(C,{id:`section-fundamentals`,section:`Fundamentals`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Fundamentals`,!u.error&&(0,G.jsxs)(E,{tone:u.score>=60?`up`:u.score>=40?`warn`:`down`,children:[u.score,`/100`]})]}),description:u.error?void 0:[u.health_rating&&`financial health ${u.health_rating}`,u.currency].filter(Boolean).join(` · `)}),(0,G.jsx)(v,{children:u.error?(0,G.jsx)(q,{text:u.error}):(0,G.jsx)(`div`,{className:`grid gap-x-6 gap-y-3 sm:grid-cols-2`,children:u.groups.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:e.title}),(0,G.jsx)(`dl`,{className:`divide-y divide-line`,children:e.items.map(e=>(0,G.jsx)(J,{label:e.label,value:pr(e)},e.label))})]},e.title))})})]}),n.includes(`risk`)&&(0,G.jsxs)(C,{id:`section-risk`,section:`Risk`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Risk `,!d.error&&(0,G.jsx)(k,{value:d.level})]}),description:`Measured over the last year of daily prices`}),(0,G.jsxs)(v,{children:[d.error?(0,G.jsx)(q,{text:d.error}):(0,G.jsxs)(`dl`,{className:`divide-y divide-line`,children:[(0,G.jsx)(J,{label:`Volatility (annualised)`,value:`${s(d.volatility_pct,1)}%`,hint:`How much the price typically swings in a year`}),(0,G.jsx)(J,{label:`Max drawdown`,value:`${s(d.max_drawdown_pct,1)}%`,className:`text-down`,hint:`Largest peak-to-trough fall in the period`}),(0,G.jsx)(J,{label:`Beta`,value:s(d.beta),hint:`Sensitivity to the overall market (1 = moves with it)`}),(0,G.jsx)(J,{label:`Best day`,value:l(d.best_day_pct,1),className:`text-up`}),(0,G.jsx)(J,{label:`Worst day`,value:l(d.worst_day_pct,1),className:`text-down`})]}),!d.error&&d.realized&&(0,G.jsx)(Cr,{v:d.realized})]})]}),n.includes(`analysts`)&&(0,G.jsxs)(C,{id:`section-analysts`,section:`Analysts & events`,children:[(0,G.jsx)(D,{title:`Analysts & upcoming events`}),(0,G.jsxs)(v,{className:`space-y-4`,children:[f.error?(0,G.jsx)(q,{text:f.error}):(0,G.jsxs)(`dl`,{className:`divide-y divide-line`,children:[(0,G.jsx)(J,{label:`Broker consensus`,value:(0,G.jsx)(k,{value:f.recommendation})}),(0,G.jsx)(J,{label:`Analysts`,value:f.count??`—`})]}),m.error?(0,G.jsx)(q,{text:m.error}):(0,G.jsxs)(`dl`,{className:`divide-y divide-line`,children:[(0,G.jsx)(J,{label:`Next earnings`,value:m.earnings_date??`—`}),(0,G.jsx)(J,{label:`EPS estimate`,value:s(m.eps_estimate)}),(0,G.jsx)(J,{label:`Ex-dividend date`,value:m.ex_dividend_date??`—`}),(0,G.jsx)(J,{label:`Dividend payment`,value:m.dividend_date??`—`})]})]})]})]}),r(`profile`)&&!h.error&&(h.summary||h.sector)&&(0,G.jsxs)(C,{id:`section-profile`,section:`Company profile`,children:[(0,G.jsx)(D,{title:h.name??t,description:[h.sector,h.industry,h.country,h.exchange].filter(Boolean).join(` · `)}),(0,G.jsxs)(v,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted`,children:[h.employees!=null&&(0,G.jsxs)(`span`,{children:[h.employees.toLocaleString(),` employees`]}),h.website&&(0,G.jsxs)(`a`,{href:h.website,target:`_blank`,rel:`noreferrer`,className:`text-accent-fg hover:underline`,children:[h.website.replace(/^https?:\/\//,``),` ↗`]})]}),h.summary&&(0,G.jsx)(`p`,{className:p(`text-sm leading-relaxed text-fg/90`,!a&&`line-clamp-4`),children:h.summary}),h.summary&&h.summary.length>400&&(0,G.jsx)(`button`,{type:`button`,onClick:o,className:`text-xs text-accent-fg hover:underline`,children:a?`Show less`:`Read more`})]})]})]})}function br({news:e}){return(0,G.jsxs)(C,{id:`section-news`,section:`Latest news`,children:[(0,G.jsx)(D,{title:`Latest news`}),e.error||!e.items?.length?(0,G.jsx)(v,{children:(0,G.jsx)(q,{text:e.error??`no recent headlines found`})}):(0,G.jsx)(`ul`,{className:`divide-y divide-line`,children:e.items.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`a`,{href:e.url||void 0,target:`_blank`,rel:`noreferrer`,className:`block px-5 py-3 hover:bg-raised/40`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.title}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-xs text-muted`,children:[e.source,e.published&&` · ${a(e.published)}`]})]})},e.url||e.title))})]})}var xr={calm:{label:`Calm`,className:`bg-up-soft text-up`,note:`Swings are smaller than usual for this stock`},normal:{label:`Normal`,className:`bg-raised text-muted`,note:`Swings are in their usual range`},stormy:{label:`Stormy`,className:`bg-down-soft text-down`,note:`Swings are larger than usual - size positions smaller`}};function Sr({g:e}){let t=e.forecasts.find(e=>e.days===21)??e.forecasts[e.forecasts.length-1],n=t.volatility>e.current*1.05?`rise`:t.volatility<e.current*.95?`ease`:`hold steady`;return(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas p-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`mb-2 font-medium text-muted`,children:`Forecast (GARCH)`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-faint`,children:`Now`}),(0,G.jsxs)(`div`,{className:`tabular text-sm font-semibold`,children:[s(e.current*100,1),`%`]})]}),e.forecasts.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-faint`,children:[`Next `,e.days===21?`month`:`${e.days} days`]}),(0,G.jsxs)(`div`,{className:`tabular text-sm font-semibold`,children:[s(e.volatility*100,1),`%`]})]},e.days))]}),(0,G.jsxs)(`p`,{className:`mt-2 text-faint`,children:[`Expected to `,n,`, pulling toward its long-run `,s(e.long_run*100,1),`%`,e.half_life_days==null?``:`; shocks fade by half in about ${s(e.half_life_days,0)} trading days`,`.`]})]})}function Cr({v:e}){let t=e.regime?xr[e.regime]:null,n=Math.max(...e.cones.map(e=>Math.max(e.max,e.current))),r=e=>`${e/n*100}%`;return(0,G.jsxs)(`div`,{className:`mt-4 space-y-3 border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:`Volatility now vs its past year`}),t&&(0,G.jsxs)(`span`,{className:p(`rounded-md px-2 py-0.5 text-xs`,t.className),title:t.note,children:[t.label,` · `,s(e.percentile,0),`th percentile`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.cones.map(e=>(0,G.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)_3.5rem] items-center gap-2 text-xs`,title:`${e.window}-day: min ${s(e.min*100,1)}% · typical ${s(e.p25*100,1)}-${s(e.p75*100,1)}% · max ${s(e.max*100,1)}%`,children:[(0,G.jsxs)(`span`,{className:`text-faint`,children:[e.window,`d`]}),(0,G.jsxs)(`span`,{className:`relative h-2.5 rounded-full bg-raised`,children:[(0,G.jsx)(`span`,{className:`absolute top-0 h-2.5 rounded-full bg-line-strong/60`,style:{left:r(e.min),width:`calc(${r(e.max)} - ${r(e.min)})`}}),(0,G.jsx)(`span`,{className:`absolute top-0 h-2.5 rounded-full bg-accent/40`,style:{left:r(e.p25),width:`calc(${r(e.p75)} - ${r(e.p25)})`}}),(0,G.jsx)(`span`,{className:`absolute -top-0.5 h-3.5 w-1 rounded-full bg-fg`,style:{left:`calc(${r(e.current)} - 2px)`}})]}),(0,G.jsxs)(`span`,{className:`tabular text-end`,children:[s(e.current*100,1),`%`]})]},e.window))}),(0,G.jsx)(`p`,{className:`text-[12px] text-faint`,children:`Bar = today's annualised volatility; shaded = its usual range (middle half) over the past year.`}),e.garch&&(0,G.jsx)(Sr,{g:e.garch}),(0,G.jsxs)(`details`,{className:`text-xs`,children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Estimators (`,e.window,`-day)`]}),(0,G.jsx)(`dl`,{className:`mt-1 divide-y divide-line`,children:e.estimators.map(e=>(0,G.jsxs)(`div`,{className:`flex justify-between py-1`,children:[(0,G.jsx)(`dt`,{className:`text-muted`,children:e.name}),(0,G.jsx)(`dd`,{className:`tabular`,children:e.value==null?`—`:`${s(e.value*100,1)}%`})]},e.key))})]})]})}var wr=[`india`,`us`,`china_a`,`hong_kong`,`crypto`];function Tr({symbol:e,market:t}){let[n,r]=(0,W.useState)(null);if((0,W.useEffect)(()=>{let n=!1;if(r(null),!wr.includes(t))return;let i=e.replace(/\.(NS|BO)$/i,``).toUpperCase();return Promise.all([Je(t),Ge(t,500).catch(()=>null),t===`crypto`?Promise.resolve([]):Fe(i,t,`all`,5).catch(()=>[])]).then(([e,t,a])=>{let o=a.find(e=>e.symbol.toUpperCase()===i)?.category,s=e.sectors.find(e=>o&&e.sector===o)??e.sectors.find(e=>e.members.some(e=>e.toUpperCase()===i));n||!s||s.tail.length<2||r({sector:s,today:t?.sectors.find(e=>e.sector===s.sector)??null,bench:e.benchmark.name,asOf:e.as_of})}).catch(()=>void 0),()=>{n=!0}},[e,t]),!n)return null;let{sector:a,today:o,bench:c}=n,u=Oe(c)[a.quadrant],d=a.tail.map(e=>({week:e.week,strength:e.ratio}));return(0,G.jsxs)(`div`,{className:`mb-5 rounded-lg bg-canvas px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1 text-xs`,children:[(0,G.jsxs)(`span`,{className:`text-muted`,children:[`Sector `,(0,G.jsx)(`span`,{className:`font-semibold text-fg`,children:a.sector})]}),(0,G.jsx)(`span`,{className:p(`font-semibold`,u.className),title:u.note,children:u.label}),(0,G.jsxs)(`span`,{className:`text-muted`,children:[`Today`,` `,(0,G.jsx)(`span`,{className:p(`tabular font-semibold`,i(o?.change_percent)),children:o?.change_percent==null?`—`:l(o.change_percent)}),o&&(0,G.jsxs)(`span`,{className:`text-faint`,children:[` · `,o.advancers,` up, `,o.decliners,` down`]})]}),(0,G.jsxs)(`span`,{className:`text-muted`,children:[`4 weeks`,` `,(0,G.jsx)(`span`,{className:p(`tabular font-semibold`,i(a.return_4w)),children:a.return_4w==null?`—`:l(a.return_4w)})]})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`h-12 min-w-0 flex-1`,children:(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(be,{data:d,margin:{top:4,right:4,bottom:4,left:4},children:[(0,G.jsx)(z,{hide:!0,domain:[`auto`,`auto`]}),(0,G.jsx)(ve,{y:100,stroke:`var(--color-line-strong)`,strokeDasharray:`4 4`}),(0,G.jsx)(I,{formatter:e=>[s(Number(e),1),`Strength vs index`],labelFormatter:(e,t)=>t?.[0]?.payload?.week??``,contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12}}),(0,G.jsx)(L,{type:`monotone`,dataKey:`strength`,stroke:`var(--color-accent)`,strokeWidth:2,dot:!1})]})})}),(0,G.jsxs)(`div`,{className:`shrink-0 text-end`,children:[(0,G.jsx)(`div`,{className:p(`tabular text-sm font-semibold`,i(a.ratio-100)),children:s(a.ratio,1)}),(0,G.jsxs)(`div`,{className:`text-[11px] text-faint`,children:[`vs `,c,` (100)`]})]})]}),(0,G.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[`The sector's weekly strength against the `,c,`, up to `,n.asOf,`: above the dashed line it is beating the index. A description of the sector, not advice.`]})]})}var Er=[{key:`returns`,label:`Returns`},{key:`risk`,label:`Risk`},{key:`portfolio`,label:`Portfolio`},{key:`peers`,label:`Against competitors`},{key:`cost`,label:`Cost`}];function Dr({code:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(null),[a,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(e);c!==e&&(l(e),n(null),i(null));let u=(t=!1)=>{s(!0),i(null),Ie(e,t).then(n).catch(e=>i(o(e))).finally(()=>s(!1))};return(0,G.jsxs)(`section`,{id:`fund-ai`,"data-section":`AI review`,className:`scroll-mt-6 space-y-4 border-t border-line pt-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold`,children:`AI fund review`}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:`The AI reads this page's numbers: rolling returns against the benchmark, risk, rank among competitors, holdings and cost.`})]}),t?(0,G.jsx)(O,{variant:`secondary`,size:`sm`,icon:`refresh`,loading:a,onClick:()=>u(!0),children:`Refresh`}):(0,G.jsx)(O,{size:`sm`,icon:`cpu`,loading:a,onClick:()=>u(),children:a?`Reading the fund…`:`Run AI review`})]}),r&&(0,G.jsx)(`p`,{className:`text-xs text-down`,children:r}),a&&!t&&(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:`Gathering returns, risk, holdings and competitors, then asking the AI. This can take up to a minute.`}),t&&(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm leading-relaxed`,children:t.summary}),(t.strengths.length>0||t.concerns.length>0)&&(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(je,{title:`Strengths`,tone:`text-up`,items:t.strengths}),(0,G.jsx)(je,{title:`Watch out for`,tone:`text-warn`,items:t.concerns})]}),Er.some(e=>t.sections[e.key])&&(0,G.jsx)(`dl`,{className:`divide-y divide-line rounded-lg bg-canvas px-4`,children:Er.filter(e=>t.sections[e.key]).map(e=>(0,G.jsxs)(`div`,{className:`grid gap-1 py-2.5 sm:grid-cols-[10rem_minmax(0,1fr)] sm:gap-4`,children:[(0,G.jsx)(`dt`,{className:`text-xs font-medium text-muted`,children:e.label}),(0,G.jsx)(`dd`,{className:`text-sm`,children:t.sections[e.key]})]},e.key))}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`AI-generated from past data on `,t.generated_at,`; it can be wrong.`,` An explanation of the figures, not a recommendation.`]})]})]})}var Or=`var(--color-accent)`,kr=`var(--color-faint)`,Ar={tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1},jr={cursor:{stroke:`var(--color-line-strong)`},contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12}},Mr=e=>new Date(e).toLocaleDateString(void 0,{month:`short`,year:`2-digit`});function Nr(e){if(e==null)return`—`;if(e<45)return`${e} days`;let t=e/30.44;return t<24?`${Math.round(t)} months`:`${s(t/12,1)} years`}function Pr({id:e,label:t,title:n,subtitle:r,children:i}){return(0,G.jsxs)(`section`,{id:e,"data-section":t,className:`scroll-mt-6 space-y-4 border-t border-line pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:n}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:r})]}),i]})}function Y({label:e,value:t,sub:n,hint:r,tone:i}){return(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas p-3`,title:r,children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:e}),(0,G.jsx)(`div`,{className:p(`tabular mt-0.5 text-base font-semibold`,i===`up`&&`text-up`,i===`down`&&`text-down`),children:t}),n&&(0,G.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted`,children:n})]})}function Fr({rows:e,bench:t}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-xs text-faint`,children:[(0,G.jsx)(`th`,{className:`py-1.5 pe-3 text-start font-medium`,children:`Window`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`Typical`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`Worst`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`Best`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,title:`Share of start days that ended with a loss`,children:`Lost money`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,title:`Share of start days that earned more than 12% a year`,children:`Over 12%`}),t&&(0,G.jsxs)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:[t,` typical`]}),t&&(0,G.jsx)(`th`,{className:`py-1.5 ps-2 text-end font-medium`,title:`Share of the same windows where the fund did better`,children:`Beat it`})]})}),(0,G.jsx)(`tbody`,{className:`tabular`,children:e.map(e=>(0,G.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,G.jsxs)(`td`,{className:`whitespace-nowrap py-2 pe-3 text-start`,children:[e.years,` year`,e.years>1?`s`:``,(0,G.jsxs)(`span`,{className:`block text-[11px] text-faint`,children:[e.windows.toLocaleString(),` start days`]})]}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-end font-semibold`,children:l(e.median,1)}),(0,G.jsx)(`td`,{className:p(`px-2 py-2 text-end`,e.min<0?`text-down`:``),title:`Starting ${e.worst_start}`,children:l(e.min,1)}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-end text-up`,title:`Starting ${e.best_start}`,children:l(e.max,1)}),(0,G.jsxs)(`td`,{className:`px-2 py-2 text-end`,children:[s(e.negative_pct,0),`%`]}),(0,G.jsxs)(`td`,{className:`px-2 py-2 text-end`,children:[s(e.above_12_pct,0),`%`]}),t&&(0,G.jsx)(`td`,{className:`px-2 py-2 text-end text-muted`,children:l(e.bench_median,1)}),t&&(0,G.jsx)(`td`,{className:p(`py-2 ps-2 text-end font-semibold`,e.beat_pct==null?``:e.beat_pct>=50?`text-up`:`text-down`),children:e.beat_pct==null?`—`:`${s(e.beat_pct,0)}%`})]},e.years))})]})})}function Ir({r:e,bench:t}){let n=(e,n=1)=>t&&e!=null?`${t}: ${s(e*100,n)}%`:void 0,r=t!=null&&e.beta!=null,i=e.volatility<.01,a=Math.abs(e.max_drawdown)<5e-4?0:e.max_drawdown;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4`,children:[(0,G.jsx)(Y,{label:`Return a year`,value:`${s(e.annual_return*100,1)}%`,sub:n(e.bench_annual_return),hint:`Annualised over the period`}),(0,G.jsx)(Y,{label:`Volatility`,value:`${s(e.volatility*100,1)}%`,sub:n(e.bench_volatility),hint:`How much the NAV swings in a year; lower is steadier`}),(0,G.jsx)(Y,{label:`Worst fall`,value:`${s(a*100,1)}%`,sub:n(e.bench_max_drawdown),hint:`Biggest peak-to-trough fall in the period`,tone:a<0?`down`:void 0}),!i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:`Sharpe`,value:s(e.sharpe,2),hint:`Return above a ${s(e.risk_free,1)}% risk-free rate per unit of volatility; above 1 is strong`}),(0,G.jsx)(Y,{label:`Sortino`,value:s(e.sortino,2),hint:`Like Sharpe, but only counts downside swings`})]}),r&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:`Beta`,value:s(e.beta,2),sub:e.beta==null?void 0:`Moves ${s(e.beta,2)}× the index`,hint:`1 = moves with the index; below 1 = calmer, above 1 = wilder`}),(0,G.jsx)(Y,{label:`Alpha a year`,value:l((e.alpha??0)*100,1),tone:(e.alpha??0)>=0?`up`:`down`,hint:`Return beyond what its beta to the index explains (Jensen's alpha)`}),(0,G.jsx)(Y,{label:`Up capture`,value:`${s((e.up_capture??0)*100,0)}%`,hint:`How much of the index's rising days the fund caught (100% = all of it)`}),(0,G.jsx)(Y,{label:`Down capture`,value:`${s((e.down_capture??0)*100,0)}%`,hint:`How much of the index's falling days the fund took (lower is better)`}),(0,G.jsx)(Y,{label:`Tracking error`,value:`${s((e.tracking_error??0)*100,1)}%`,hint:`How far its returns stray from the index in a year; tiny for index funds`}),(0,G.jsx)(Y,{label:`Information ratio`,value:s(e.information_ratio,2),hint:`Extra return per unit of tracking error; above 0.5 is good`})]})]}),i&&(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[`The NAV barely moves, so Sharpe and Sortino (which divide by those moves) would be meaningless here. For a fund like this, compare its return a year against the `,s(e.risk_free,1),`% risk-free rate.`]}),r&&e.up_capture!=null&&e.down_capture!=null&&(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[`In plain words: on days the `,t,` rose, this fund rose about `,s(e.up_capture*100,0),`% as much; on days it fell, the fund fell about`,` `,s(e.down_capture*100,0),`% as much.`,` `,e.up_capture>e.down_capture?`It kept more of the gains than it took of the losses.`:`It took relatively more of the losses than it kept of the gains.`]})]})}function Lr({code:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(null);if((0,W.useEffect)(()=>{let t=new AbortController;return n(null),i(null),Ue(e,t.signal).then(n).catch(e=>!t.signal.aborted&&i(o(e))),()=>t.abort()},[e]),r)return(0,G.jsx)(Pr,{id:`fund-rolling`,label:`Rolling returns`,title:`Rolling returns`,subtitle:`Returns from every possible start day`,children:(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Unavailable right now: `,r]})});if(!t)return(0,G.jsx)(Pr,{id:`fund-rolling`,label:`Rolling returns`,title:`Rolling returns`,subtitle:`Returns from every possible start day`,children:(0,G.jsx)(ct,{className:`min-h-40`,steps:[`Reading the full NAV history…`,`Fetching the category benchmark…`,`Rolling every 1, 3 and 5-year window…`,`Measuring falls and recoveries…`]})});if(t.status!==`ok`||!t.rolling||!t.drawdowns)return(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:t.note});let a=t.benchmark?.available?t.benchmark.name:null,c=t.rolling,l=t.drawdowns,u=l.chart;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Pr,{id:`fund-rolling`,label:`Rolling returns`,title:`Rolling returns`,subtitle:`The yearly return from every possible start day since ${t.nav_from}: how consistent the fund has been, not just where it stands today.`,children:[t.payout_option&&(0,G.jsx)(re,{tone:`warn`,children:`This is an IDCW (payout) option: each payout lowers the NAV, so every return here understates what investors earned. Compare the Growth option of the same scheme.`}),(0,G.jsx)(Fr,{rows:c.windows,bench:a}),c.chart.length>1&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 text-xs text-muted`,children:[c.chart_years,`-year rolling return, by start date`]}),(0,G.jsx)(`div`,{className:`h-56`,children:(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(be,{data:c.chart,margin:{top:4,right:4,bottom:0,left:0},children:[(0,G.jsx)(B,{stroke:`var(--color-line)`,vertical:!1}),(0,G.jsx)(R,{dataKey:`date`,tickFormatter:Mr,minTickGap:48,...Ar}),(0,G.jsx)(z,{orientation:`right`,width:44,tickFormatter:e=>`${e}%`,...Ar}),(0,G.jsx)(ve,{y:0,stroke:`var(--color-line-strong)`}),(0,G.jsx)(I,{...jr,labelFormatter:e=>`Start ${e}`,formatter:(e,t)=>[`${s(Number(e),1)}% a year`,t]}),(0,G.jsx)(ye,{wrapperStyle:{fontSize:11}}),(0,G.jsx)(L,{type:`monotone`,dataKey:`fund`,name:`This fund`,stroke:Or,strokeWidth:1.75,dot:!1}),a&&(0,G.jsx)(L,{type:`monotone`,dataKey:`bench`,name:a,stroke:kr,strokeWidth:1.25,dot:!1,connectNulls:!0})]})})})]})]}),(0,G.jsx)(Pr,{id:`fund-risk`,label:`Risk vs benchmark`,title:a?`Risk against the ${a}`:`Risk`,subtitle:t.risk?`Last ${t.risk.years} years of daily returns (since ${t.risk.from}).${a?``:` No free index matches this category, so it is measured on its own.`}`:`Not enough history yet.`,children:t.risk&&(0,G.jsx)(Ir,{r:t.risk,bench:a})}),(0,G.jsxs)(Pr,{id:`fund-drawdowns`,label:`Drawdowns & recovery`,title:`Drawdowns & recovery`,subtitle:`How far the NAV has fallen from its highs, and how long it took to get back. Now ${s(Math.abs(l.current),1)}% below its high; worst ever ${s(l.max,1)}%.`,children:[l.crashes.length>0&&(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:l.crashes.map(e=>(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:e.label}),(0,G.jsxs)(`div`,{className:`tabular mt-0.5 text-base font-semibold text-down`,children:[s(e.fund,1),`%`]}),e.bench!=null&&(0,G.jsxs)(`div`,{className:p(`text-[11px]`,e.fund>e.bench?`text-up`:`text-muted`),children:[a,`: `,s(e.bench,1),`%`,e.fund>e.bench?` · fell less`:``]})]},e.label))}),u.length>1&&(0,G.jsx)(`div`,{className:`h-48`,children:(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(ge,{data:u,margin:{top:4,right:4,bottom:0,left:0},children:[(0,G.jsx)(B,{stroke:`var(--color-line)`,vertical:!1}),(0,G.jsx)(R,{dataKey:`date`,tickFormatter:Mr,minTickGap:48,...Ar}),(0,G.jsx)(z,{orientation:`right`,width:44,tickFormatter:e=>`${e}%`,...Ar}),(0,G.jsx)(I,{...jr,formatter:(e,t)=>[`${s(Number(e),1)}% below high`,t]}),(0,G.jsx)(ye,{wrapperStyle:{fontSize:11}}),a&&(0,G.jsx)(H,{type:`monotone`,dataKey:`bench`,name:a,stroke:kr,fill:`none`,strokeWidth:1.25,connectNulls:!0}),(0,G.jsx)(H,{type:`monotone`,dataKey:`fund`,name:`This fund`,stroke:`var(--color-down)`,fill:`var(--color-down)`,fillOpacity:.15,strokeWidth:1.5})]})})}),l.episodes.length>0&&(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-xs text-faint`,children:[(0,G.jsx)(`th`,{className:`py-1.5 pe-3 text-start font-medium`,children:`Fall`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-start font-medium`,children:`From high`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-start font-medium`,children:`To low`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`Falling for`}),(0,G.jsx)(`th`,{className:`py-1.5 ps-2 text-end font-medium`,children:`Back to the high`})]})}),(0,G.jsx)(`tbody`,{className:`tabular`,children:l.episodes.map(e=>(0,G.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,G.jsxs)(`td`,{className:`py-2 pe-3 text-start font-semibold text-down`,children:[s(e.depth,1),`%`]}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-start`,children:e.peak}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-start`,children:e.trough}),(0,G.jsx)(`td`,{className:`px-2 py-2 text-end`,children:Nr(e.days_down)}),(0,G.jsx)(`td`,{className:`py-2 ps-2 text-end`,children:e.recovered?`${Nr(e.days_to_recover)} (${e.recovered})`:(0,G.jsx)(`span`,{className:`text-warn`,children:`Not yet`})})]},e.peak))})]})}),(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[t.note,t.benchmark?.dividend_yield!=null&&` Dividends added to the ${t.benchmark.name}: ${s(t.benchmark.dividend_yield,2)}% a year.`]})]})]})}var X=e=>`₹${Math.round(e).toLocaleString(`en-IN`)}`;function Rr(e,t){let n=new Date(`${e}T00:00:00`);return(t.getFullYear()-n.getFullYear())*12+(t.getMonth()-n.getMonth())-+(t.getDate()<n.getDate())}function zr(e,t,n,r,i,a,o=new Date){if(!(n>0)||!(r>=0)||!i)return null;let s=Rr(i,o);if(s<0)return null;let c=r-n;if(c<=0)return{months:s,gain:c,rate:0,tax:0,taxable:0,basis:`A loss: no tax (it can be set off against other gains).`};let l,u=c,d;t===`equity`?s<=(e.short_months??12)?(l=e.short_rate??20,d=`Held ${s} months (12 or less): short-term, ${l}%.`):(l=e.long_rate??12.5,u=Math.max(0,c-e.exemption),d=`Held ${s} months: long-term, ${l}% on gains above ${X(e.exemption)} (if you have no other equity gains this year).`):t===`debt`?i<`2023-04-01`&&s>24?(l=12.5,d=`Bought before 1 April 2023 and held ${s} months: 12.5%.`):(l=a,d=`Taxed at your slab rate (${a}%) however long you hold.`):s>(e.short_months??24)?(l=e.long_rate??12.5,d=`Held ${s} months (over 24): ${l}%.`):(l=a,d=`Held ${s} months (24 or less): your slab rate (${a}%).`);let f=u*l/100*(1+e.cess/100);return{months:s,gain:c,rate:l,tax:f,taxable:u,basis:d}}function Br({code:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(null),[a,c]=(0,W.useState)(`100000`),[l,u]=(0,W.useState)(`130000`),[d,f]=(0,W.useState)(()=>{let e=new Date;return e.setFullYear(e.getFullYear()-2),e.toISOString().slice(0,10)}),[m,h]=(0,W.useState)(`30`);(0,W.useEffect)(()=>{let t=new AbortController;return n(null),i(null),Ke(e,t.signal).then(n).catch(e=>!t.signal.aborted&&i(o(e))),()=>t.abort()},[e]);let g=(0,W.useMemo)(()=>t?.tax&&t.tax_class?zr(t.tax,t.tax_class,Number(a),Number(l),d,Number(m)):null,[t,a,l,d,m]);return(0,G.jsxs)(`section`,{id:`fund-cost`,"data-section":`Cost & tax`,className:`scroll-mt-6 space-y-5 border-t border-line pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Cost & tax`}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:`What the plan you pick costs over the years, and the tax if you redeem now.`})]}),r?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Unavailable right now: `,r]}):t?t.status===`ok`?(0,G.jsxs)(G.Fragment,{children:[t.plans&&t.cost?(0,G.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-canvas p-4`,children:[(0,G.jsxs)(`div`,{className:`text-sm`,children:[`Over the last `,t.plans.years,` years the `,(0,G.jsx)(`b`,{children:`Direct`}),` plan returned `,s(t.plans.direct,2),`% a year and the `,(0,G.jsx)(`b`,{children:`Regular`}),` `,`plan `,s(t.plans.regular,2),`%: Regular costs about `,(0,G.jsxs)(`b`,{className:p(t.plans.gap>.5&&`text-down`),children:[s(t.plans.gap,2),`% a year`]}),` more (the distributor's commission).`]}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-md border border-line p-3 text-sm`,children:[(0,G.jsxs)(`div`,{className:`text-xs text-faint`,children:[X(t.cost.lumpsum),` invested once, `,t.cost.years,` years`]}),(0,G.jsxs)(`div`,{className:`tabular mt-1`,children:[`Direct `,X(t.cost.lumpsum_direct),` · Regular `,X(t.cost.lumpsum_regular)]}),(0,G.jsxs)(`div`,{className:`tabular text-xs text-down`,children:[`Regular leaves you `,X(t.cost.lumpsum_direct-t.cost.lumpsum_regular),` poorer`]})]}),(0,G.jsxs)(`div`,{className:`rounded-md border border-line p-3 text-sm`,children:[(0,G.jsxs)(`div`,{className:`text-xs text-faint`,children:[X(t.cost.sip),` a month (SIP), `,t.cost.years,` years`]}),(0,G.jsxs)(`div`,{className:`tabular mt-1`,children:[`Direct `,X(t.cost.sip_direct),` · Regular `,X(t.cost.sip_regular)]}),(0,G.jsxs)(`div`,{className:`tabular text-xs text-down`,children:[`Regular leaves you `,X(t.cost.sip_direct-t.cost.sip_regular),` poorer`]})]})]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`Gap measured from both plans' NAVs (`,t.plans.from,` to `,t.plans.to,`); the rupee figures assume `,s(t.cost.assumed_return,0),`% a year, an illustration, not a forecast.`]})]}):(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No matching `,t.plan===`Direct`?`Regular`:`Direct`,` plan with enough history to compare.`]}),t.tax&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`text-xs font-medium text-muted`,children:[`Tax if you redeem now · `,t.tax.label]}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:t.tax.text}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,G.jsx)(b,{label:`Invested (₹)`,children:(0,G.jsx)(x,{type:`number`,min:`0`,step:`any`,value:a,onChange:e=>c(e.target.value)})}),(0,G.jsx)(b,{label:`Worth now (₹)`,children:(0,G.jsx)(x,{type:`number`,min:`0`,step:`any`,value:l,onChange:e=>u(e.target.value)})}),(0,G.jsx)(b,{label:`Bought on`,children:(0,G.jsx)(x,{type:`date`,value:d,onChange:e=>f(e.target.value)})}),(0,G.jsx)(b,{label:`Your slab rate (%)`,children:(0,G.jsx)(x,{type:`number`,min:`0`,max:`45`,step:`any`,value:m,onChange:e=>h(e.target.value)})})]}),g&&(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas p-4 text-sm`,children:[(0,G.jsxs)(`div`,{className:`tabular`,children:[`Gain `,X(g.gain),` · tax about `,(0,G.jsx)(`b`,{children:X(g.tax)}),` · you keep `,X(Number(l)-g.tax)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-muted`,children:[g.basis,` Includes `,t.tax.cess,`% cess; surcharge and other gains of the year are left out.`]})]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`Rules in force from `,t.tax.rules_from,`. A guide, not tax advice: check with a tax professional.`]})]})]}):(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:t.note}):(0,G.jsx)(j,{className:`h-32 w-full`})]})}var Vr={equity:{label:`Indian stocks`,color:`#6d8cff`},foreign_equity:{label:`Foreign stocks`,color:`#22d3ee`},reit:{label:`REITs / InvITs`,color:`#a78bfa`},debt:{label:`Bonds & money market`,color:`#fbbf24`},fund:{label:`Other funds`,color:`#f472b6`},cash:{label:`Cash & other`,color:`#94a3b8`}},Hr=10;function Ur({label:e,weight:t,scale:n,href:r,sub:i}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_5rem_3.25rem] items-center gap-2 py-1 text-sm`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate`,title:i?`${e} · ${i}`:e,children:r?(0,G.jsx)(M,{to:r,className:`hover:text-accent-fg`,children:e}):e}),(0,G.jsx)(`span`,{className:`h-2 rounded-full bg-raised`,children:(0,G.jsx)(`span`,{className:`block h-2 rounded-full bg-accent`,style:{width:`${Math.min(t/n*100,100)}%`}})}),(0,G.jsxs)(`span`,{className:`tabular text-end text-xs`,children:[s(t,2),`%`]})]})}var Wr=e=>e?`/analyze?symbol=${encodeURIComponent(e)}&market=india`:void 0,Gr={large:{label:`Large cap`,color:`var(--color-accent)`,hint:`The 100 largest listed companies (SEBI)`},mid:{label:`Mid cap`,color:`var(--color-up)`,hint:`Companies ranked 101-250 by market cap`},small:{label:`Small cap`,color:`var(--color-warn)`,hint:`Companies ranked 251 and below`},foreign:{label:`Foreign`,color:`var(--color-faint)`,hint:`Shares listed outside India`},other:{label:`Unlisted / other`,color:`var(--color-line-strong)`,hint:`Not matched to a listed Indian company`}};function Kr({code:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(null),[a,c]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{let t=new AbortController;return n(null),i(null),c(!1),Ve(e,t.signal).then(n).catch(e=>!t.signal.aborted&&i(o(e))),()=>t.abort()},[e]),r)return(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Holdings unavailable: `,r]});if(!t)return(0,G.jsx)(j,{className:`h-48 w-full`});if(t.status!==`ok`)return(0,G.jsxs)(`div`,{className:`rounded-lg border border-dashed border-line-strong p-4 text-sm`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:`Stock list not loaded for this fund house yet`}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-muted`,children:[t.note,` Each fund house publishes every scheme's full portfolio once a month; once `,t.amc??`its`,` file is loaded, the stocks, sectors and company sizes show up here. The competitor comparison below works for every fund.`]})]});let l=(t.holdings??[]).filter(e=>e.kind===`equity`||e.kind===`foreign_equity`),u=(t.holdings??[]).filter(e=>e.kind!==`equity`&&e.kind!==`foreign_equity`),d=a?l:l.slice(0,Hr),f=Math.max(...l.map(e=>e.weight),1),p=(t.sectors??[]).slice(0,8),m=Math.max(...p.map(e=>e.weight),1),h=t.changes,g=t.as_of?new Date(t.as_of).toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`}):null;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:`What it holds`}),(0,G.jsx)(`span`,{className:`text-xs text-faint`,children:t.weights===`estimated`?`Estimated from the NSE index list`:`${t.source}${g?` · ${g}`:``}`})]}),t.note&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:t.note})]}),t.mix&&t.mix.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`flex h-3 overflow-hidden rounded-full bg-raised`,children:t.mix.map(e=>(0,G.jsx)(`span`,{style:{width:`${Math.max(e.weight,0)}%`,background:Vr[e.kind]?.color},title:`${Vr[e.kind]?.label}: ${s(e.weight,1)}%`},e.kind))}),(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted`,children:t.mix.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{background:Vr[e.kind]?.color}}),Vr[e.kind]?.label,` `,(0,G.jsxs)(`span`,{className:`tabular text-fg`,children:[s(e.weight,1),`%`]})]},e.kind))})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 rounded-lg bg-canvas p-4 sm:grid-cols-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Stocks`}),(0,G.jsx)(`div`,{className:`tabular text-sm font-semibold`,children:t.count})]}),t.concentration?.effective_stocks!=null&&(0,G.jsxs)(`div`,{title:`1 ÷ the sum of squared weights: how many equal-sized positions the fund behaves like`,children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Behaves like`}),(0,G.jsxs)(`div`,{className:`tabular text-sm font-semibold`,children:[s(t.concentration.effective_stocks,0),` stocks`]})]}),t.churn&&(0,G.jsxs)(`div`,{title:`Last month: bought ₹${s(t.churn.bought_cr,0)} Cr, sold ₹${s(t.churn.sold_cr,0)} Cr of shares. Turnover = the smaller of the two over fund size (SEBI's definition), ×12 for a year.`,children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Turnover, yearly rate`}),(0,G.jsxs)(`div`,{className:`tabular text-sm font-semibold`,children:[s(t.churn.yearly_pct,0),`%`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Top 10 weight`}),(0,G.jsxs)(`div`,{className:`tabular text-sm font-semibold`,children:[s(t.top10_weight??0,1),`%`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Fund size`}),(0,G.jsx)(`div`,{className:`tabular text-sm font-semibold`,children:t.aum_cr?`₹${s(t.aum_cr,0)} Cr`:`—`})]})]}),(t.concentration?.effective_stocks!=null||t.churn)&&(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[t.concentration?.effective_stocks!=null&&`It holds ${t.count} stocks but behaves like ${s(t.concentration.effective_stocks,0)} equal-sized positions${t.concentration.effective_stocks<20?` (concentrated: a few names drive it)`:t.concentration.effective_stocks>50?` (widely spread)`:``}. `,t.churn&&`Last month's trading implies about ${s(t.churn.yearly_pct,0)}% turnover a year: ${t.churn.yearly_pct<20?`low, it mostly holds`:t.churn.yearly_pct<60?`moderate`:`high, it trades a lot (more costs, more short-term bets)`}. One month is a rough guide.`]}),t.cap_split&&t.cap_split.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-muted`,children:`Company size (share of the fund)`}),(0,G.jsx)(`div`,{className:`flex h-3 overflow-hidden rounded-full bg-raised`,children:t.cap_split.map(e=>(0,G.jsx)(`span`,{style:{width:`${Math.max(e.weight,0)}%`,background:Gr[e.kind].color},title:`${Gr[e.kind].label}: ${s(e.weight,1)}%`},e.kind))}),(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted`,children:t.cap_split.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:Gr[e.kind].hint,children:[(0,G.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{background:Gr[e.kind].color}}),Gr[e.kind].label,` `,(0,G.jsxs)(`span`,{className:`tabular text-fg`,children:[s(e.weight,1),`%`]})]},e.kind))})]}),l.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted`,children:`Stocks by weight`}),d.map(e=>(0,G.jsx)(Ur,{label:e.name,weight:e.weight,scale:f,href:e.kind===`equity`?Wr(e.symbol):void 0,sub:[e.kind===`foreign_equity`?`Foreign`:null,e.sector,e.hedged?`${s(e.hedged,2)}% hedged (arbitrage)`:null].filter(Boolean).join(` · `)},`${e.isin??e.name}-${e.kind}`)),l.length>Hr&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`mt-1 text-xs text-accent-fg hover:underline`,children:a?`Show top 10`:`Show all ${l.length} stocks`})]}),p.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted`,children:`Sectors`}),p.map(e=>(0,G.jsx)(Ur,{label:e.name,weight:e.weight,scale:m},e.name))]}),h&&(h.new.length>0||h.exited.length>0||h.moved.length>0)&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 text-xs font-medium text-muted`,children:[`Changes since `,h.since?new Date(h.since).toLocaleDateString(void 0,{month:`short`,year:`numeric`}):`last month`]}),(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,G.jsx)(qr,{title:`New buys`,tone:`text-up`,items:h.new.map(e=>({name:e.name,symbol:e.symbol,text:`${s(e.weight,2)}%`}))}),(0,G.jsx)(qr,{title:`Sold out`,tone:`text-down`,items:h.exited.map(e=>({name:e.name,symbol:null,text:`was ${s(e.weight,2)}%`}))}),(0,G.jsx)(qr,{title:`Biggest changes`,tone:`text-fg`,items:h.moved.map(e=>({name:e.name,symbol:e.symbol,text:`${s(e.from,1)} → ${s(e.to,1)}%`,up:e.to>e.from}))})]})]}),u.length>0&&(0,G.jsxs)(`details`,{className:`text-sm`,children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted`,children:[`Bonds, REITs and other holdings (`,u.length,`)`]}),(0,G.jsx)(`div`,{className:`mt-2`,children:u.slice(0,40).map(e=>(0,G.jsx)(Ur,{label:e.name,weight:e.weight,scale:f,sub:`${Vr[e.kind]?.label}${e.sector?` · ${e.sector}`:``}`},`${e.isin}-${e.kind}`))})]})]})}function qr({title:e,tone:t,items:n}){return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:p(`text-xs font-semibold`,t),children:e}),n.length===0?(0,G.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`None`}):(0,G.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs`,children:n.slice(0,6).map(e=>(0,G.jsxs)(`li`,{className:`flex justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate`,title:e.name,children:e.symbol?(0,G.jsx)(M,{to:Wr(e.symbol),className:`hover:text-accent-fg`,children:e.name}):e.name}),(0,G.jsx)(`span`,{className:p(`tabular shrink-0`,e.up===void 0?`text-muted`:e.up?`text-up`:`text-down`),children:e.text})]},e.name))})]})}function Jr(e){return e>=50?`Heavy overlap: holding both adds little diversification.`:e>=25?`Moderate overlap: a good part of the money sits in the same companies.`:`Low overlap: the two funds mostly own different companies.`}function Yr({code:e,scheme:t}){let[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null);async function f(t,n){a({code:t,name:n}),l(null),d(null);try{l(await qe(e,t))}catch(e){d(o(e))}}return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Overlap with another fund`}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:`Thinking of holding two funds? See how much of the money would sit in the same companies.`})]}),(0,G.jsx)(dt,{value:n,onChange:r,type:`mf`,market:`india`,exclude:[e],placeholder:`Search a fund to compare with, e.g. HDFC Flexi Cap`,onSelect:e=>{r(e.name),f(String(e.symbol),e.name)},className:`max-w-xl`}),u&&(0,G.jsx)(`p`,{className:`text-xs text-down`,children:u}),i&&!c&&!u&&(0,G.jsx)(j,{className:`h-24 w-full`}),c&&c.status!==`ok`&&(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:c.note??`Holdings are not available for one of these funds yet.`}),c&&c.status===`ok`&&c.overlap!=null&&(0,G.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-canvas p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,G.jsxs)(`span`,{className:`tabular text-2xl font-semibold`,children:[s(c.overlap,1),`%`]}),(0,G.jsx)(`span`,{className:`text-sm text-muted`,children:`of the money in the same stocks`})]}),(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[Jr(c.overlap),` `,c.shared_count,` stocks in common; `,c.only_a,` only in `,t,`, `,c.only_b,` only in `,i?.name,`.`,c.note?` ${c.note}`:``]}),c.shared&&c.shared.length>0&&(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-xs text-faint`,children:[(0,G.jsx)(`th`,{className:`py-1.5 pe-3 text-start font-medium`,children:`Shared stock`}),(0,G.jsx)(`th`,{className:`px-2 py-1.5 text-end font-medium`,children:`This fund`}),(0,G.jsx)(`th`,{className:`py-1.5 ps-2 text-end font-medium`,children:`Other fund`})]})}),(0,G.jsx)(`tbody`,{className:`tabular`,children:c.shared.slice(0,10).map(e=>(0,G.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,G.jsx)(`td`,{className:`py-1.5 pe-3 text-start`,children:e.name}),(0,G.jsxs)(`td`,{className:`px-2 py-1.5 text-end`,children:[s(e.weight_a,2),`%`]}),(0,G.jsxs)(`td`,{className:`py-1.5 ps-2 text-end`,children:[s(e.weight_b,2),`%`]})]},e.name))})]})}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`From each fund house's monthly portfolio (`,c.a.as_of,` / `,c.b.as_of,`). Overlap = for every shared stock, the smaller of the two weights, added up.`]})]})]})}var Xr=[`Large`,`Mid`,`Small`],Zr=[`Value`,`Blend`,`Growth`];function Qr({code:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(null);return(0,W.useEffect)(()=>{let t=new AbortController;return n(null),i(null),He(e,t.signal).then(n).catch(e=>!t.signal.aborted&&i(o(e))),()=>t.abort()},[e]),(0,G.jsxs)(`section`,{id:`fund-style`,"data-section":`Style & drift`,className:`scroll-mt-6 space-y-4 border-t border-line pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Style & drift`}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:`What kind of fund it really is, judged by what it holds, and whether it stays inside its category's rules.`})]}),r?(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Unavailable right now: `,r]}):t?t.status===`ok`?(0,G.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-[auto_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[3rem_repeat(3,3.5rem)] gap-1 text-center text-[11px]`,children:[(0,G.jsx)(`span`,{}),Zr.map(e=>(0,G.jsx)(`span`,{className:`text-faint`,children:e},e)),Xr.map(e=>(0,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`span`,{className:`self-center text-end text-faint`,children:e}),Zr.map(n=>{let r=t.style?.label===n&&(t.size===e||t.size===`Multi`);return(0,G.jsx)(`span`,{className:p(`h-10 rounded`,r?t.size===`Multi`?`bg-accent/60`:`bg-accent`:`bg-raised`)},n)})]},e))]}),(0,G.jsxs)(`div`,{className:`mt-2 text-sm font-semibold`,children:[t.size??`—`,t.size===`Multi`?`-cap `:` `,t.style?.label??``]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`table`,{className:`w-full max-w-md text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-xs text-faint`,children:[(0,G.jsx)(`th`,{className:`py-1 text-start font-medium`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`This fund`}),(0,G.jsx)(`th`,{className:`py-1 text-end font-medium`,children:`Top 100 companies`})]})}),(0,G.jsx)(`tbody`,{className:`tabular`,children:[[`P/E`,t.fund?.pe,t.market?.pe,1],[`Price / book`,t.fund?.pb,t.market?.pb,2],[`Return on equity`,t.fund?.roe,t.market?.roe,1]].map(([e,t,n,r])=>(0,G.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,G.jsx)(`td`,{className:`py-1.5 text-start`,children:e}),(0,G.jsxs)(`td`,{className:`py-1.5 text-end`,children:[s(t,r),e===`Return on equity`&&t!=null?`%`:``]}),(0,G.jsxs)(`td`,{className:`py-1.5 text-end text-muted`,children:[s(n,r),e===`Return on equity`&&n!=null?`%`:``]})]},e))})]}),t.checks&&t.checks.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 text-xs font-medium text-muted`,children:[`SEBI rules for a `,t.category]}),(0,G.jsx)(`ul`,{className:`space-y-1 text-sm`,children:t.checks.map(e=>(0,G.jsxs)(`li`,{className:p(`flex items-center gap-2`,e.ok?`text-up`:`text-down`),children:[(0,G.jsx)(T,{name:e.ok?`check`:`alert`,className:`h-4 w-4`}),e.rule,!e.ok&&(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:`: drifting outside its category`})]},e.rule))})]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[s(t.equity_pct,0),`% in shares, `,t.count,` stocks, portfolio of `,t.as_of,`. `,t.note]})]})]}):(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:t.note}):(0,G.jsx)(j,{className:`h-32 w-full`})]})}var $r=[{key:`r1`,label:`1Y`,hint:`Return over the last year`,higher:!0,fmt:e=>l(e,1)},{key:`r3`,label:`3Y`,hint:`Annualised return, last 3 years`,higher:!0,fmt:e=>l(e,1)},{key:`r5`,label:`5Y`,hint:`Annualised return, last 5 years`,higher:!0,fmt:e=>l(e,1)},{key:`volatility`,label:`Volatility`,hint:`How much the NAV swings in a year (lower = steadier)`,higher:!1,fmt:e=>`${s(e,1)}%`},{key:`drawdown`,label:`Worst fall`,hint:`Biggest peak-to-trough fall in 3 years`,higher:!0,fmt:e=>`${s(e,1)}%`},{key:`sharpe`,label:`Sharpe`,hint:`Return above a 6.5% risk-free rate per unit of volatility`,higher:!0,fmt:e=>s(e,2)},{key:`similarity`,label:`Moves like`,hint:`How closely its daily NAV moves with this fund (1 = identical)`,higher:!0,fmt:e=>s(e,2)}],ei={1:{label:`Top quartile`,tone:`up`},2:{label:`2nd quartile`,tone:`accent`},3:{label:`3rd quartile`,tone:`warn`},4:{label:`Bottom quartile`,tone:`down`}},ti=10;function ni({code:e,onOpen:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[c,l]=(0,W.useState)(`r3`),[u,d]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let t=new AbortController;return r(null),a(null),d(!1),ze(e,t.signal).then(r).catch(e=>!t.signal.aborted&&a(o(e))),()=>t.abort()},[e]);let f=$r.find(e=>e.key===c),m=(0,W.useMemo)(()=>n?[...n.rows].sort((e,t)=>{let n=e[c],r=t[c];return n==null?1:r==null?-1:f.higher?r-n:n-r}):[],[n,c,f]);if(i)return(0,G.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Competitors unavailable: `,i]});if(!n)return(0,G.jsx)(ct,{className:`min-h-40`,steps:[`Finding funds in the same category…`,`Reading each fund’s NAV history…`,`Ranking returns and risk…`]});if(n.status!==`ok`||n.rows.length<2)return(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:`No comparable funds found in this category.`});let h=m.findIndex(e=>e.is_self),g=u?m:m.filter((e,t)=>t<ti||t===h);return(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Competitors`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted`,children:[n.count,` `,n.category,` funds (`,n.plan,` plan), one scheme per fund house`]})]}),Object.values(n.ranks).some(Boolean)?(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:$r.filter(e=>e.key!==`similarity`).map(e=>(0,G.jsx)(ii,{label:e.label,hint:e.hint,rank:n.ranks[e.key]??null,fmt:e.fmt},e.key))}):(0,G.jsx)(`p`,{className:`rounded-lg bg-canvas px-3 py-2 text-xs text-muted`,children:`Too few funds with enough history in this category to rank it; the table below still compares them side by side.`}),n.closest.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,G.jsx)(`span`,{className:`text-muted`,children:`Moves most like:`}),n.closest.map(e=>(0,G.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>t?.(e.code,e.name),className:`rounded-md bg-raised px-2 py-1 text-fg enabled:hover:bg-accent-soft`,title:`Daily NAV correlation ${s(e.similarity,2)} over the last year`,children:[ri(e.name),` `,(0,G.jsx)(`span`,{className:`tabular text-faint`,children:s(e.similarity,2)})]},e.code))]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:`Sort by`}),(0,G.jsx)(S,{size:`sm`,value:c,onChange:e=>l(e),options:$r.map(e=>({value:e.key,label:e.label}))})]}),(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full min-w-[640px] text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-start text-[11px] text-faint`,children:[(0,G.jsx)(`th`,{className:`py-1.5 pe-2 font-medium`,children:`#`}),(0,G.jsx)(`th`,{className:`py-1.5 pe-2 font-medium`,children:`Fund`}),$r.map(e=>(0,G.jsx)(`th`,{className:p(`py-1.5 pe-2 text-end font-medium`,e.key===c&&`text-fg`),title:e.hint,children:e.label},e.key)),n.rows.some(e=>e.overlap!=null)&&(0,G.jsx)(`th`,{className:`py-1.5 text-end font-medium`,title:`Share of the portfolio held in common`,children:`Overlap`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:g.map(e=>(0,G.jsx)(ai,{row:e,position:m.indexOf(e)+1,sort:c,overlapCol:n.rows.some(e=>e.overlap!=null),onOpen:t},e.code))})]})}),m.length>ti&&(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-accent-fg hover:underline`,onClick:()=>d(e=>!e),children:u?`Show top ${ti}`:`Show all ${m.length} funds`}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`From each fund's officially published NAV history. 3Y and 5Y are annualised; risk is measured over 3 years. `,n.note]})]})}function ri(e){return e.replace(/\s*-\s*(Direct|Regular)\b.*$/i,``).replace(/\s+Fund$/i,``)}function ii({label:e,hint:t,rank:n,fmt:r}){let i=n?ei[n.quartile]:null;return(0,G.jsxs)(`div`,{className:`rounded-lg bg-canvas px-3 py-2`,title:t,children:[(0,G.jsx)(`div`,{className:`text-xs text-muted`,children:e}),n&&i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`mt-0.5 flex items-baseline gap-2`,children:[(0,G.jsxs)(`span`,{className:`tabular text-sm font-semibold`,children:[`#`,n.rank,(0,G.jsxs)(`span`,{className:`text-xs font-normal text-faint`,children:[` of `,n.of]})]}),(0,G.jsx)(E,{tone:i.tone,children:i.label})]}),(0,G.jsxs)(`div`,{className:`tabular text-[11px] text-faint`,children:[`category median `,r(n.median)]})]}):(0,G.jsx)(`div`,{className:`mt-0.5 text-sm text-faint`,children:`—`})]})}function ai({row:e,position:t,sort:n,overlapCol:r,onOpen:i}){return(0,G.jsxs)(`tr`,{className:p(e.is_self&&`bg-accent-soft/60`),children:[(0,G.jsx)(`td`,{className:`tabular py-1.5 pe-2 text-xs text-faint`,children:t}),(0,G.jsxs)(`td`,{className:`max-w-[16rem] py-1.5 pe-2`,children:[e.is_self||!i?(0,G.jsxs)(`span`,{className:p(`block truncate`,e.is_self&&`font-semibold`),title:e.name,children:[ri(e.name),e.is_self&&(0,G.jsx)(`span`,{className:`ms-1.5 text-[11px] font-normal text-accent-fg`,children:`this fund`})]}):(0,G.jsx)(`button`,{type:`button`,className:`block max-w-full truncate text-start hover:text-accent-fg`,title:e.name,onClick:()=>i(e.code,e.name),children:ri(e.name)}),e.r1==null&&e.since&&(0,G.jsxs)(`span`,{className:`block text-[11px] text-faint`,children:[`new fund · since `,new Date(e.since).toLocaleDateString(void 0,{month:`short`,year:`numeric`})]})]}),$r.map(t=>{let r=e[t.key],i=r==null?`text-faint`:t.key===`r1`||t.key===`r3`||t.key===`r5`?r>=0?`text-up`:`text-down`:``;return(0,G.jsx)(`td`,{className:p(`tabular py-1.5 pe-2 text-end`,i,t.key===n&&`font-semibold`),children:r==null||t.key===`similarity`&&e.is_self?`—`:t.fmt(r)},t.key)}),r&&(0,G.jsx)(`td`,{className:`tabular py-1.5 text-end text-xs`,children:e.overlap==null?`—`:`${s(e.overlap,0)}%`})]})}var Z=e=>`₹${Math.round(e).toLocaleString(`en-IN`)}`,oi=.15;function si({code:e,monthly:t,expected:n}){let[r,i]=(0,W.useState)(25e5),[a,o]=(0,W.useState)(10),[c,l]=(0,W.useState)(0),[u,d]=(0,W.useState)(null);(0,W.useEffect)(()=>{let t=new AbortController;return d(null),Ue(e,t.signal).then(e=>d(e.risk?.volatility&&e.risk.volatility>.005?e.risk.volatility:oi)).catch(()=>!t.signal.aborted&&d(oi)),()=>t.abort()},[e]);let f=(0,W.useMemo)(()=>{if(u==null||!(r>0)||!(a>0))return null;let e={start:c,years:a,expectedReturn:n/100,volatility:u},i=Ne({...e,monthly:t}),o=i.bands[i.bands.length-1];return{need:Me(e,r,.8),odds:Pe(i.finals,r),last:o}},[u,r,a,c,t,n]),p=(e,t,n,r=1)=>(0,G.jsx)(b,{label:e,children:(0,G.jsx)(x,{type:`number`,min:0,step:r,value:t,onChange:e=>n(Math.max(0,Number(e.target.value)||0))})});return(0,G.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-canvas p-4`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:`Reach a goal`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[p(`Goal (₹)`,r,i,1e5),p(`In years`,a,o),p(`Already have (₹)`,c,l,1e4)]}),f?(0,G.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,G.jsxs)(`div`,{children:[`For an 80% chance of `,Z(r),` in `,a,` years you'd need about`,` `,(0,G.jsx)(`b`,{className:`tabular`,children:f.need==null?`more than any SIP can reach`:`${Z(f.need)} a month`}),`.`]}),(0,G.jsxs)(`div`,{children:[`With `,Z(t),` a month the chance is `,(0,G.jsxs)(`b`,{className:`tabular`,children:[s(f.odds*100,0),`%`]}),`. Likely range after `,a,` years:`,` `,(0,G.jsxs)(`span`,{className:`tabular`,children:[Z(f.last.p10),` (bad case) · `,Z(f.last.p50),` (middle) · `,Z(f.last.p90),` (good case)`]}),`, from `,Z(f.last.invested),` put in.`]}),(0,G.jsxs)(`p`,{className:`text-[12px] text-faint`,children:[`2,000 simulated paths at `,s(n,1),`% a year (your assumption above) with this fund's own 3-year volatility of `,s((u??0)*100,1),`%. Bad / good case = 10th / 90th percentile. Not a promise of returns.`]})]}):(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:`Working out the odds…`})]})}var ci=[{value:`1`,label:`1Y`},{value:`3`,label:`3Y`},{value:`5`,label:`5Y`},{value:`10`,label:`10Y`}];function Q(e){return e==null||!Number.isFinite(e)?`—`:e.toLocaleString(`en-IN`,{style:`currency`,currency:`INR`,maximumFractionDigits:0})}function li({label:e,value:t,onChange:n,min:r,max:i,step:a}){let[o,s]=(0,W.useState)(String(t));return(0,W.useEffect)(()=>s(String(t)),[t]),(0,G.jsx)(b,{label:e,children:(0,G.jsx)(x,{type:`number`,inputMode:`decimal`,min:r,max:i,step:a??1,value:o,onChange:e=>{s(e.target.value);let t=Number(e.target.value);e.target.value!==``&&Number.isFinite(t)&&t>=r&&t<=i&&n(t)}})})}function ui({code:e}){let[t,n]=(0,W.useState)({monthly:5e3,years:5,day:5,step_up:10,expected:12,horizon:10}),[r,i]=(0,W.useState)(null),[a,s]=(0,W.useState)(null),[c,u]=(0,W.useState)(!0),d=e=>n(t=>({...t,...e}));(0,W.useEffect)(()=>{let n=!1;u(!0);let r=setTimeout(()=>{We(e,t).then(e=>{n||(i(e),s(null))}).catch(e=>!n&&s(o(e))).finally(()=>!n&&u(!1))},400);return()=>{n=!0,clearTimeout(r)}},[e,t]);let f=r?.backtest,m=r?.step_up;return(0,G.jsxs)(`section`,{className:`space-y-4 border-t border-line pt-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:`SIP planner`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:`What a monthly SIP in this fund would be worth today, from its real NAV history.`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsx)(li,{label:`Monthly SIP (₹)`,value:t.monthly,min:100,max:1e7,step:500,onChange:e=>d({monthly:e})}),(0,G.jsx)(li,{label:`SIP day`,value:t.day,min:1,max:28,onChange:e=>d({day:e})}),(0,G.jsx)(b,{label:`Over the last`,className:`col-span-2`,children:(0,G.jsx)(S,{options:ci,value:String(t.years),onChange:e=>d({years:Number(e)}),size:`sm`})})]}),a?(0,G.jsxs)(`p`,{className:`text-xs text-down`,children:[`SIP backtest unavailable: `,a]}):!f||c&&!r?(0,G.jsx)(j,{className:`h-40 w-full`}):f.error?(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:f.error}):(0,G.jsxs)(`div`,{className:p(`space-y-4 transition-opacity`,c&&`opacity-60`),children:[(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`sip`,`SIP of ${Q(f.monthly)} a month`,f.sip.value,f.sip.gain_pct,`XIRR ${l(f.sip.xirr_pct)}`,`${f.sip.installments} instalments`],[`lumpsum`,`Lumpsum on ${f.lumpsum.date}`,f.lumpsum.value,f.lumpsum.gain_pct,`CAGR ${l(f.lumpsum.cagr_pct)}`,`same total, invested at once`]].map(([e,t,n,r,i,a])=>(0,G.jsxs)(`div`,{className:p(`rounded-lg border p-3`,f.winner===e?`border-up/50 bg-up-soft/40`:`border-line bg-canvas`),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted`,children:[(0,G.jsx)(`span`,{children:t}),f.winner===e&&(0,G.jsx)(`span`,{className:`font-semibold text-up`,children:`Ahead`})]}),(0,G.jsx)(`div`,{className:`tabular mt-1 text-lg font-semibold`,children:Q(n)}),(0,G.jsxs)(`div`,{className:`tabular text-xs`,children:[(0,G.jsx)(`span`,{className:r>=0?`text-up`:`text-down`,children:l(r)}),(0,G.jsxs)(`span`,{className:`text-muted`,children:[` · `,i]})]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-faint`,children:[`Invested `,Q(f.sip.invested),` · `,a]})]},e))}),f.note&&(0,G.jsx)(`p`,{className:`text-xs text-warn`,children:f.note})]}),(0,G.jsx)(lt,{market:`india`,kind:`mf`,symbol:e,highlight:t.day}),(0,G.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-canvas p-4`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:`Step-up projection`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsx)(li,{label:`Step-up %/yr`,value:t.step_up,min:0,max:100,onChange:e=>d({step_up:e})}),(0,G.jsx)(li,{label:`Return %/yr`,value:t.expected,min:-50,max:50,step:.5,onChange:e=>d({expected:e})}),(0,G.jsx)(li,{label:`Years`,value:t.horizon,min:1,max:40,onChange:e=>d({horizon:e})})]}),m?(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-xs text-faint`,children:[`With `,m.step_pct,`% step-up`]}),(0,G.jsx)(`div`,{className:`tabular font-semibold`,children:Q(m.corpus)}),(0,G.jsxs)(`div`,{className:`tabular text-xs text-muted`,children:[`invested `,Q(m.invested)]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Flat SIP`}),(0,G.jsx)(`div`,{className:`tabular font-semibold`,children:Q(m.flat_corpus)}),(0,G.jsxs)(`div`,{className:`tabular text-xs text-muted`,children:[`invested `,Q(m.flat_invested)]})]})]}):(0,G.jsx)(j,{className:`h-10 w-full`}),(0,G.jsx)(`p`,{className:`text-xs text-faint`,children:`Projection assumes a steady return; real returns vary. Not investment advice.`})]}),(0,G.jsx)(si,{code:e,monthly:t.monthly,expected:t.expected})]})}var di=[{value:`30`,label:`1M`},{value:`182`,label:`6M`},{value:`365`,label:`1Y`},{value:`1095`,label:`3Y`},{value:`1825`,label:`5Y`},{value:`all`,label:`Max`}],fi=864e5;function pi(e,t){if(e.length<2)return null;let n=e[e.length-1],r=n.t-t*fi,i=e.find(e=>e.t>=r);if(!i||i===n||n.t-e[0].t<t*fi*.95)return null;let a=n.nav/i.nav;return t>365?(a**(365/t)-1)*100:(a-1)*100}async function mi(e){return(await Fe(e,`india`,`mf`,5)).find(t=>t.symbol===e)??null}function hi({fund:e,onOpenFund:t}){let[r,i]=(0,W.useState)(null),[a,c]=(0,W.useState)(null),[u,d]=(0,W.useState)(`1095`);(0,W.useEffect)(()=>{let t=!1;return i(null),c(null),Re(e.symbol).then(e=>!t&&i(e)).catch(e=>!t&&c(o(e))),()=>{t=!0}},[e.symbol]);let f=(0,W.useMemo)(()=>(r??[]).map(e=>({t:new Date(e.date).getTime(),nav:e.nav})),[r]),m=(0,W.useMemo)(()=>{if(u===`all`||!f.length)return f;let e=f[f.length-1].t-Number(u)*fi;return f.filter(t=>t.t>=e)},[f,u]),h=[{label:`1M`,days:30},{label:`6M`,days:182},{label:`1Y`,days:365},{label:`3Y CAGR`,days:1095},{label:`5Y CAGR`,days:1825}].map(e=>({...e,value:pi(f,e.days)})),g=m.length<2||m[m.length-1].nav>=m[0].nav?`var(--color-up)`:`var(--color-down)`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{id:`fund-overview`,"data-section":`Overview`,className:`scroll-mt-6 space-y-6`,children:[e.shariah&&e.shariah_reason&&(0,G.jsxs)(`div`,{className:p(`rounded-lg px-3 py-2 text-xs`,e.shariah===`halal`?`bg-up-soft text-up`:e.shariah===`doubtful`?`bg-warn-soft text-warn`:`bg-raised text-muted`),children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:e.shariah===`halal`?`Ethical`:e.shariah===`doubtful`?`Ethical: doubtful`:`Not ethical`}),` `,`· `,e.shariah_reason]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-5 sm:grid-cols-3`,children:[(0,G.jsx)(A,{label:`NAV`,value:n(e.price,e.currency),sub:e.nav_date?`as of ${e.nav_date}`:void 0}),(0,G.jsx)(A,{label:`Plan`,value:e.plan??`—`,sub:e.option??void 0}),(0,G.jsx)(A,{label:`Scheme code`,value:(0,G.jsx)(`span`,{className:`font-mono`,children:e.symbol}),sub:e.isin??void 0})]})]}),(0,G.jsxs)(`div`,{id:`fund-returns`,"data-section":`Returns & NAV`,className:`scroll-mt-6 space-y-6`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-3 rounded-lg bg-canvas p-4 sm:grid-cols-5`,children:h.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:e.label}),r==null&&!a?(0,G.jsx)(j,{className:`mt-1 h-4 w-12`}):(0,G.jsx)(`div`,{className:`tabular mt-0.5 text-sm font-semibold ${e.value==null?`text-faint`:e.value>=0?`text-up`:`text-down`}`,children:l(e.value)})]},e.label))}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,G.jsx)(S,{options:di,value:u,onChange:d,size:`sm`})}),(0,G.jsx)(`div`,{className:`h-64`,children:a?(0,G.jsxs)(`div`,{className:`grid h-full place-items-center text-xs text-muted`,children:[`NAV history unavailable: `,a]}):r==null?(0,G.jsx)(j,{className:`h-full w-full`}):m.length<2?(0,G.jsx)(`div`,{className:`grid h-full place-items-center text-xs text-muted`,children:`Not enough NAV history for this range.`}):(0,G.jsx)(V,{width:`100%`,height:`100%`,children:(0,G.jsxs)(ge,{data:m,margin:{top:4,right:4,bottom:0,left:0},children:[(0,G.jsx)(`defs`,{children:(0,G.jsxs)(`linearGradient`,{id:`navFill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:g,stopOpacity:.25}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:g,stopOpacity:0})]})}),(0,G.jsx)(B,{stroke:`var(--color-line)`,vertical:!1}),(0,G.jsx)(R,{dataKey:`t`,type:`number`,domain:[`dataMin`,`dataMax`],scale:`time`,tickFormatter:e=>new Date(e).toLocaleDateString(void 0,{month:`short`,year:`2-digit`}),tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1,minTickGap:40}),(0,G.jsx)(z,{domain:[`auto`,`auto`],orientation:`right`,width:56,tickFormatter:e=>s(e),tick:{fill:`var(--color-faint)`,fontSize:11},axisLine:!1,tickLine:!1}),(0,G.jsx)(I,{cursor:{stroke:`var(--color-line-strong)`},contentStyle:{background:`var(--color-raised)`,border:`1px solid var(--color-line-strong)`,borderRadius:8,fontSize:12},labelFormatter:e=>new Date(Number(e)).toLocaleDateString(),formatter:e=>[s(Number(e),4),`NAV`]}),(0,G.jsx)(H,{type:`monotone`,dataKey:`nav`,stroke:g,strokeWidth:1.75,fill:`url(#navFill)`})]})})}),(0,G.jsx)(`p`,{className:`mt-2 text-xs text-faint`,children:`NAV history from official fund data. Returns are point-to-point; 3Y/5Y annualised.`})]})]}),(0,G.jsx)(Dr,{code:e.symbol}),(0,G.jsx)(Lr,{code:e.symbol}),(0,G.jsxs)(`div`,{id:`fund-holdings`,"data-section":`Holdings & sectors`,className:`scroll-mt-6 border-t border-line pt-6`,children:[(0,G.jsx)(Kr,{code:e.symbol}),(0,G.jsx)(`div`,{className:`mt-6 border-t border-line pt-6`,children:(0,G.jsx)(Yr,{code:e.symbol,scheme:e.name})})]}),(0,G.jsx)(Qr,{code:e.symbol}),(0,G.jsx)(`div`,{id:`fund-competitors`,"data-section":`Competitors`,className:`scroll-mt-6 border-t border-line pt-6`,children:(0,G.jsx)(ni,{code:e.symbol,onOpen:t?e=>t(e):void 0})}),(0,G.jsx)(Br,{code:e.symbol}),(0,G.jsx)(`div`,{id:`fund-sip`,"data-section":`SIP planner`,className:`scroll-mt-6`,children:(0,G.jsx)(ui,{code:e.symbol})})]})}var gi={trader:{description:`Trend, momentum, support and resistance, volatility and news for short-term trades - plus an AI summary with a bullish / neutral / bearish outlook.`,mode:`standard`,emptyTitle:`Pick a symbol to check the setup`,empty:`Open loads the chart and trading range instantly. Run AI adds an AI summary built on the chart, risk and news.`},investor:{description:`Business quality, valuation against peers, analyst estimates, dividends and financials for long-term holding - plus an AI view on the business.`,mode:`full`,emptyTitle:`Pick a business to research`,empty:`Open loads the price, valuation and financials instantly. Run AI adds an AI view on the business, its valuation and long-term risks.`},none:{description:`Live quote, chart, technicals, fundamentals, risk, analyst views and news for any stock - plus an optional multi-agent AI read.`,mode:`standard`,emptyTitle:`Pick a symbol to start`,empty:`Open loads the price and chart instantly. Run AI also runs the AI agent pipeline and streams each stage as it finishes.`}},_i=`marketmyna.recent`;function vi(e){return e===`quick`?[`technical`,`decision`]:e===`standard`?[`technical`,`risk`,`news`,`decision`]:[`technical`,`risk`,`news`,`sentiment`,`fundamentals`,`decision`]}function yi(){try{return JSON.parse(localStorage.getItem(_i)??`[]`).filter(e=>!/\s/.test(e.symbol))}catch{return[]}}function bi(e,t,n){let r=yi(),i=n??r.find(n=>n.symbol===e&&n.market===t)?.name,a=[{symbol:e,market:t,...i?{name:i}:{}},...r.filter(n=>n.symbol!==e||n.market!==t)].slice(0,12);try{localStorage.setItem(_i,JSON.stringify(a))}catch{}return a}function $(e,t){return t===`india`&&/^\d+$/.test(e)}function xi(e){return e.split(/\s+-\s+/)[0]}var Si=[{value:`stocks`,label:`Stocks, ETFs & crypto`},{value:`funds`,label:`Mutual funds`}];function Ci(e){return e.replace(/^skill[:_]/,``).replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function wi(){let[e,t]=ae(),[n,r]=(0,W.useState)(e.get(`symbol`)??``),[i,a]=(0,W.useState)(e.get(`market`)??`us`),[s,c]=(0,W.useState)(()=>e.get(`view`)===`funds`||$(e.get(`symbol`)??``,e.get(`market`)??``)?`funds`:`stocks`),l=oe(),u=gi[l??`none`],[d,m]=(0,W.useState)(u.mode),[h,g]=(0,W.useState)(yi),ee=se(l,`trader`),x=se(l,`investor`),[w,E]=(0,W.useState)(()=>{let t=e.get(`symbol`);return t?{symbol:t.toUpperCase(),market:e.get(`market`)??`us`}:null}),[ie,k]=(0,W.useState)(null),[A,ce]=(0,W.useState)(null),[le,N]=(0,W.useState)([]),[P,ue]=(0,W.useState)(null),[de,F]=(0,W.useState)(null),[pe,me]=(0,W.useState)(!1),[he,ge]=(0,W.useState)(null);(0,W.useEffect)(()=>{let e=!1,t=()=>pt().then(t=>!e&&ge(t.configured)).catch(()=>!e&&ge(null));t();let n=()=>document.visibilityState===`visible`&&t();return document.addEventListener(`visibilitychange`,n),()=>{e=!0,document.removeEventListener(`visibilitychange`,n)}},[]);let _e=he===!1,I=(0,W.useRef)(null),L=(0,W.useRef)(!1),ve=(0,W.useRef)(null),R=w!=null&&$(w.symbol,w.market),ye=h.filter(e=>$(e.symbol,e.market)===(s===`funds`)),[z,be]=(0,W.useState)(null),[B,V]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!w||!$(w.symbol,w.market))return be(null);let e=!1;return be(null),V(null),mi(w.symbol).then(t=>!e&&(t?be(t):V(`No mutual fund with scheme code ${w.symbol}.`))).catch(t=>!e&&V(o(t))),()=>{e=!0}},[w]),(0,W.useEffect)(()=>{if(!w||$(w.symbol,w.market))return;let e=!1;return L.current||k(null),L.current=!1,ce(null),fe(w.symbol,w.market).then(t=>!e&&k(t)).catch(t=>{e||(k(null),ce(o(t)))}),()=>{e=!0}},[w]),(0,W.useEffect)(()=>()=>I.current?.abort(),[]);function xe(e){e!==s&&(I.current?.abort(),c(e),r(``),E(null),ue(null),N([]),F(null),t(e===`funds`?{view:`funds`}:{},{replace:!0}))}function H(e,n,i=!0,o){let l=e.trim().toUpperCase();if(!l)return null;let u=$(l,n);return u!==(s===`funds`)&&c(u?`funds`:`stocks`),(l!==w?.symbol||n!==w?.market)&&(I.current?.abort(),ue(null),N([]),F(null)),r(l),a(n),E({symbol:l,market:n}),t(u?{view:`funds`,symbol:l,market:n}:{symbol:l,market:n},{replace:!0}),i&&g(bi(l,n,o)),l}async function Se(){let e=await ut(n,i,e=>Fe(e,`all`,`all`,10)),t=H(e.symbol,e.market);return t?{symbol:t,market:e.market}:null}function Ce(e){switch(e.event){case`stage_start`:N(t=>{if(t.some(t=>t.agent===e.agent))return t.map(t=>t.agent===e.agent?{...t,status:`running`}:t);let n=t.findIndex(e=>e.agent===`decision`),r={agent:e.agent,status:`running`};return n===-1?[...t,r]:[...t.slice(0,n),r,...t.slice(n)]});break;case`stage_done`:N(t=>t.map(t=>t.agent===e.agent?{...t,status:`done`,opinion:e.opinion}:t));break;case`stage_skipped`:N(t=>t.map(t=>t.agent===e.agent?{...t,status:`skipped`,message:e.message}:t));break;case`done`:ue(e.dashboard);break;case`error`:F(ji(e.message))}}async function Te(e){if(pe)return;let t=e??await Se();if(!t)return;let{symbol:n,market:r}=t;Re(`ai`,t);let i=new AbortController;I.current=i,me(!0),F(null),ue(null),N(vi(d).map(e=>({agent:e,status:`pending`})));try{await ft({symbol:n,market:r,mode:d,area:l},Ce,i.signal)}catch(e){i.signal.aborted?f.info(`Analysis cancelled`):F(ji(o(e)))}finally{me(!1),N(e=>e.map(e=>e.status===`running`||e.status===`pending`?{...e,status:`skipped`}:e)),I.current=null}}let Oe=w?.market===`crypto`,je=Ei.filter(e=>(!e.investor||x)&&!(e.noCrypto&&Oe)),Me=e.get(`tab`)??`summary`,U=je.some(e=>e.id===Me)?Me:`summary`,[Ne,Pe]=(0,W.useState)([]),Ie=w?`${w.symbol}:${w.market}`:``;(0,W.useEffect)(()=>Pe([]),[Ie]),(0,W.useEffect)(()=>{Ne.includes(U)||Pe(e=>[...e,U])},[U,Ne]),(0,W.useEffect)(()=>{w&&!$(w.symbol,w.market)&&_r(w.symbol,w.market).catch(()=>{})},[w]);let Le=(0,W.useRef)(null);function Re(e,n=w){if(!n)return;t(e===`summary`?{symbol:n.symbol,market:n.market}:{symbol:n.symbol,market:n.market,tab:e},{replace:!0});let r=Le.current?.getBoundingClientRect().top;r!=null&&r<0&&Le.current?.scrollIntoView({block:`start`})}function ze(e,t){let{symbol:n,market:r}=t;switch(e){case`summary`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ni,{symbol:n,market:r,quote:ie,error:A,onExchange:e=>{L.current=!0,H(e,r,!1)}}),l===`trader`&&(0,G.jsx)(tr,{symbol:n,market:r}),(0,G.jsx)(Ai,{dashboard:P,running:pe,noAi:_e,onOpen:()=>Re(`ai`),onRun:()=>void Te(t)})]});case`ai`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Fi,{noAi:_e,mode:d,onMode:m,stages:le,running:pe,onRun:()=>void Te(t),onCancel:()=>I.current?.abort()}),de&&(0,G.jsx)(re,{title:`Analysis failed`,onDismiss:()=>F(null),children:de}),P&&(0,G.jsx)(Ri,{dashboard:P}),P&&(0,G.jsx)(Wi,{opinions:P.opinions})]});case`technical`:return(0,G.jsx)(vr,{symbol:n,market:r,investor:x,parts:[`technical`,`risk`]});case`news`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(vr,{symbol:n,market:r,parts:[`news`]}),(ee||x)&&(0,G.jsx)(gn,{symbol:n,market:r})]});case`business`:return(0,G.jsx)(vr,{symbol:n,market:r,parts:[`fundamentals`,`profile`,`leadership`,`ownership`,`mdna`]});case`financials`:return(0,G.jsx)(Vt,{symbol:n,market:r});case`value`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(er,{symbol:n,market:r}),(0,G.jsx)(wn,{symbol:n,market:r}),(0,G.jsx)(_n,{symbol:n,market:r}),(0,G.jsx)(Un,{symbol:n,market:r})]});case`holdings`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Kn,{symbol:n,market:r}),(0,G.jsx)(or,{symbol:n,market:r}),(0,G.jsx)(Jn,{symbol:n,market:r})]});case`events`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(vr,{symbol:n,market:r,investor:x,parts:[`analysts`]}),(0,G.jsx)(On,{symbol:n,market:r})]});case`checks`:return(0,G.jsxs)(G.Fragment,{children:[x&&(0,G.jsx)(yn,{symbol:n,market:r}),(0,G.jsx)(Zt,{symbol:n,market:r})]});case`thesis`:return(0,G.jsx)(Vn,{symbol:n,market:r})}}function Be(e){let t=t=>(0,G.jsx)(we,{rail:e,selected:t.id===U,icon:t.icon,label:t.id===`checks`&&!x?`Ethical screen`:t.label,onClick:()=>Re(t.id),extra:t.id===`ai`?pe?(0,G.jsx)(y,{className:`h-3.5 w-3.5 text-accent-fg`}):P?(0,G.jsx)(T,{name:`check`,className:`h-3.5 w-3.5 text-up`}):void 0:void 0},t.id);return(0,G.jsxs)(G.Fragment,{children:[je.filter(e=>!e.group).map(t),Ti.map(n=>{let r=je.filter(e=>e.group===n.id);return r.length?(0,G.jsx)(De,{rail:e,label:n.label,children:r.map(t)},n.id):null})]})}return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(te,{title:`Analyze`,description:s===`funds`?`Any Indian mutual fund: returns and NAV history, every stock it holds, sectors and company sizes, how it ranks against its competitors, and SIP planning.`:u.description}),(0,G.jsxs)(C,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-line px-5 py-3`,children:[(0,G.jsx)(S,{size:`sm`,options:Si,value:s,onChange:e=>xe(e)}),ye.length>0&&(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`me-1 text-xs text-faint`,children:`Recent`}),ye.slice(0,8).map(e=>s===`funds`?(0,G.jsx)(`button`,{type:`button`,onClick:()=>H(e.symbol,e.market),title:e.name??`Scheme ${e.symbol}`,className:`max-w-[16rem] truncate rounded-md bg-raised px-2 py-0.5 text-xs text-muted hover:text-fg`,children:e.name?xi(e.name):`Scheme ${e.symbol}`},`${e.symbol}:${e.market}`):(0,G.jsxs)(`button`,{type:`button`,onClick:()=>H(e.symbol,e.market),title:e.name,className:p(`rounded-md px-2 py-0.5 font-mono text-xs hover:text-fg`,w?.symbol===e.symbol&&w.market===e.market?`bg-accent-soft text-fg`:`bg-raised text-muted`),children:[e.symbol,e.market!==`us`&&(0,G.jsx)(`span`,{className:`ms-1 text-faint`,children:Ze($e,e.market)})]},`${e.symbol}:${e.market}`))]})]}),s===`funds`?(0,G.jsxs)(`form`,{className:`grid gap-4 p-5 lg:grid-cols-[minmax(0,1fr)_auto]`,onSubmit:e=>{e.preventDefault(),/^\d+$/.test(n.trim())&&H(n,`india`)},children:[(0,G.jsx)(b,{label:`Mutual fund`,children:(0,G.jsx)(dt,{value:n,onChange:r,market:`india`,type:`mf`,onSelect:e=>H(e.symbol,`india`,!0,e.name),onSubmit:()=>/^\d+$/.test(n.trim())&&H(n,`india`),placeholder:`Search by fund name, fund house or scheme code (e.g. Parag Parikh Flexi Cap, HDFC Mid Cap)`,autoFocus:!0})}),(0,G.jsx)(`div`,{className:`flex items-end`,children:(0,G.jsx)(O,{type:`submit`,icon:`search`,disabled:!/^\d+$/.test(n.trim()),title:`Or pick a fund from the list as you type`,children:`Open fund`})})]}):(0,G.jsxs)(`form`,{className:`grid gap-4 p-5 lg:grid-cols-[minmax(0,1fr)_180px_auto]`,onSubmit:e=>{e.preventDefault(),Se()},children:[(0,G.jsx)(b,{label:`Symbol`,children:(0,G.jsx)(dt,{value:n,onChange:r,onSelect:e=>H(e.symbol,e.market,!0,e.name),onSubmit:()=>n.trim()&&void Se(),detect:{current:i,onDetect:a},exclude:[`mf`],placeholder:`Search any stock, ETF or crypto (e.g. Reliance, AAPL, BTC)`,autoFocus:!0})}),(0,G.jsx)(b,{label:`Market`,children:(0,G.jsx)(_,{options:$e,value:i,onChange:e=>a(e.target.value)})}),(0,G.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,G.jsx)(O,{type:`submit`,icon:`search`,disabled:!n.trim(),title:`Load the price, chart and every data card - no AI`,children:`Open`}),pe?(0,G.jsx)(O,{variant:`danger`,icon:`stop`,onClick:()=>I.current?.abort(),children:`Cancel AI`}):(0,G.jsx)(O,{variant:`secondary`,icon:`play`,disabled:_e||!n.trim()||$(n.trim(),i),onClick:()=>void Te(),title:_e?Oi:$(n.trim(),i)?`Mutual funds get their full analysis and an AI fund review below`:`Run the AI on this stock (${Ze(et,d)} depth - change it under AI analysis)`,children:`Run AI`})]})]})]}),w?R?(0,G.jsxs)(`div`,{className:`mt-6 grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,G.jsx)(`div`,{ref:ve,className:`min-w-0`,children:(0,G.jsx)(C,{children:B?(0,G.jsx)(v,{children:(0,G.jsx)(re,{title:`Fund not found`,children:B})}):z?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(D,{title:z.name,description:[z.amc,z.sector,z.plan&&`${z.plan} plan`,z.option].filter(Boolean).join(` · `),actions:(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(ke,{showLabel:!0,item:{symbol:z.symbol,market:z.market,type:`mf`,name:z.name}}),(0,G.jsxs)(M,{to:`/portfolio?add=${encodeURIComponent(z.symbol)}&market=mf`,className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-md border border-line px-2 py-1 text-xs text-muted hover:border-line-strong hover:text-fg`,children:[(0,G.jsx)(T,{name:`portfolio`,className:`h-3.5 w-3.5`}),`Add to portfolio`]})]})}),(0,G.jsx)(v,{children:(0,G.jsx)(hi,{fund:z,onOpenFund:e=>H(e,`india`)})})]}):(0,G.jsx)(v,{children:(0,G.jsx)(j,{className:`h-64 w-full`})})})}),(0,G.jsx)(`aside`,{className:`h-fit space-y-4 lg:sticky lg:top-8 lg:max-h-[calc(100vh-4rem)] lg:overflow-y-auto`,children:(0,G.jsx)(Ae,{root:ve})})]}):(0,G.jsx)(`div`,{ref:Le,className:`mt-6 scroll-mt-4`,children:(0,G.jsxs)(Ee,{label:`Stock views`,nav:Be,children:[U!==`summary`&&(0,G.jsx)(Di,{symbol:w.symbol,market:w.market,quote:ie}),Ei.filter(e=>Ne.includes(e.id)||e.id===U).map(e=>(0,G.jsx)(`div`,{hidden:e.id!==U,className:`space-y-6`,children:ze(e.id,w)},e.id))]})}):(0,G.jsx)(C,{className:`mt-6`,children:s===`funds`?(0,G.jsx)(ne,{icon:`portfolio`,title:`Pick a mutual fund`,description:`Search by name, fund house or scheme code. You'll see its returns, NAV chart, every stock it holds with sectors and company sizes, what it bought and sold last month, where it ranks among its competitors, and a SIP planner.`}):(0,G.jsx)(ne,{icon:`analyze`,title:u.emptyTitle,description:u.empty})})]})}var Ti=[{id:`price`,label:`Price & mood`},{id:`business`,label:`The business`},{id:`checks`,label:`Checks & notes`}],Ei=[{id:`summary`,label:`Summary`,icon:`home`},{id:`ai`,label:`AI analysis`,icon:`cpu`},{id:`technical`,label:`Technical & risk`,icon:`candles`,group:`price`},{id:`news`,label:`News & mood`,icon:`globe`,group:`price`},{id:`business`,label:`Business`,icon:`grid`,group:`business`,investor:!0,noCrypto:!0},{id:`financials`,label:`Financials`,icon:`sort`,group:`business`,investor:!0,noCrypto:!0},{id:`value`,label:`Valuation`,icon:`compare`,group:`business`,investor:!0,noCrypto:!0},{id:`holdings`,label:`Holdings & dividends`,icon:`portfolio`,group:`business`,investor:!0,noCrypto:!0},{id:`events`,label:`Analysts & earnings`,icon:`clock`,group:`checks`,noCrypto:!0},{id:`checks`,label:`Checklists & ethical`,icon:`check`,group:`checks`},{id:`thesis`,label:`My thesis`,icon:`pencil`,group:`checks`}];function Di({symbol:e,market:t,quote:n}){return(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`font-mono text-base font-semibold`,children:e}),(0,G.jsx)(`span`,{className:`rounded bg-raised px-1.5 py-0.5 text-xs text-muted`,children:Ze($e,t)}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`tabular font-semibold`,children:s(n.price)}),(0,G.jsxs)(`span`,{className:p(`tabular text-sm font-medium`,i(n.change)),children:[r(n.change),` (`,l(n.change_percent),`)`]})]})]})}var Oi=`Add an AI key in Settings first - the data cards work without one.`;function ki(){return(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-warn`,children:[`No AI model is set up, so Run AI is off.`,` `,(0,G.jsx)(M,{to:`/settings`,className:`font-medium text-accent hover:underline`,children:`Add an AI key in Settings`}),` `,`(or set LLM_MODEL for a local model). The data cards in the menu work without one.`]})}function Ai({dashboard:e,running:t,noAi:n,onOpen:r,onRun:i}){return(0,G.jsx)(C,{children:(0,G.jsxs)(v,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(T,{name:`cpu`,className:`h-4 w-4 text-accent`}),`AI read`,t&&(0,G.jsx)(y,{className:`h-3.5 w-3.5 text-accent-fg`})]}),(0,G.jsx)(`p`,{className:p(`mt-1 text-sm text-muted`,e&&`line-clamp-2`),children:t?`The agents are working - each stage shows as it finishes.`:e?.analysis_summary??`The data cards in the menu need no AI. Run it for a call built on the chart, risk and news.`}),n&&!t&&!e&&(0,G.jsx)(ki,{})]}),t||e?(0,G.jsx)(O,{variant:`secondary`,size:`sm`,onClick:r,children:t?`Watch it run`:`Full analysis`}):(0,G.jsx)(O,{size:`sm`,icon:`play`,onClick:i,disabled:n,title:n?Oi:void 0,children:`Run AI`})]})})}function ji(e){return/no llm_model configured/i.test(e)?`No AI model is set up on this server yet, so the AI step could not run. The market data on this page works without it; add an AI key under Settings → AI keys.`:/not enough (price )?history/i.test(e)?`Not enough price history for this listing to analyse it. Try the other exchange or a longer-listed stock.`:e}function Mi(e){let t=e.toUpperCase();return t.endsWith(`.BO`)?{base:t.slice(0,-3),exchange:`BSE`}:{base:t.endsWith(`.NS`)?t.slice(0,-3):t,exchange:`NSE`}}function Ni({symbol:e,market:t,quote:n,error:a,onExchange:o}){let c=t===`india`&&!e.startsWith(`^`),d=c?Mi(e).base:e,[f,h]=(0,W.useState)(null);(0,W.useEffect)(()=>{let e=!1;return h(null),Fe(d,t===`global`?`all`:t,`all`,5).then(t=>{e||h(t.find(e=>e.symbol.toUpperCase()===d.toUpperCase())??null)}).catch(()=>{}),()=>{e=!0}},[d,t]);let g=c&&f?.type!==`mf`&&!/^\d+$/.test(d),_=m(`Quote & chart`);return(0,G.jsx)(C,{id:`section-quote`,section:`Quote & chart`,children:(0,G.jsxs)(v,{children:[(0,G.jsxs)(`div`,{className:`mb-5 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h2`,{className:`font-mono text-lg font-semibold`,children:g?d:e}),(0,G.jsx)(`span`,{className:`rounded bg-raised px-1.5 py-0.5 text-xs text-muted`,children:Ze($e,t)}),(0,G.jsx)(ie,{topic:`Quote & chart`,open:_.open,onToggle:_.toggle,panelId:_.panelId}),(0,G.jsx)(ke,{showLabel:!0,item:{symbol:f?.symbol??e,market:f?.market??t,type:f?.type??(t===`crypto`?`crypto`:`stock`),name:f?.name??e}}),(0,G.jsxs)(M,{to:`/trade?symbol=${encodeURIComponent(e)}&market=${encodeURIComponent(t)}`,className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-md border border-line px-2 py-1 text-xs text-muted hover:border-line-strong hover:text-fg`,children:[(0,G.jsx)(T,{name:`candles`,className:`h-3.5 w-3.5`}),`Open in Trade`]}),(0,G.jsxs)(M,{to:`/portfolio?add=${encodeURIComponent(e)}&market=${encodeURIComponent(t)}${n?.price==null?``:`&price=${n.price}`}`,className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-md border border-line px-2 py-1 text-xs text-muted hover:border-line-strong hover:text-fg`,children:[(0,G.jsx)(T,{name:`portfolio`,className:`h-3.5 w-3.5`}),`Add to portfolio`]})]}),(0,G.jsx)(ee,{topic:`Quote & chart`,open:_.open,onClose:_.close,id:_.panelId}),f&&f.name!==e&&(0,G.jsx)(`p`,{className:`text-sm text-muted`,children:f.name}),n?(0,G.jsxs)(`div`,{className:`mt-1 flex items-baseline gap-3`,children:[(0,G.jsx)(`span`,{className:`tabular text-3xl font-semibold tracking-tight`,children:s(n.price)}),(0,G.jsxs)(`span`,{className:p(`tabular text-sm font-medium`,i(n.change)),children:[r(n.change),` (`,l(n.change_percent),`)`]})]}):a?(0,G.jsxs)(`p`,{className:`mt-1 text-sm text-down`,children:[`Quote unavailable: `,a]}):(0,G.jsx)(`div`,{className:`mt-1 flex h-9 items-center`,children:(0,G.jsx)(j,{className:`h-8 w-48`})})]}),g&&(0,G.jsx)(Pi,{symbol:e,quote:n,onPick:o})]}),!a&&(0,G.jsxs)(`div`,{className:`mb-5 grid grid-cols-2 gap-x-8 gap-y-3 sm:grid-cols-4`,children:[(0,G.jsx)(A,{label:`Open`,value:n?s(n.open):(0,G.jsx)(j,{className:`mt-1 h-5 w-20`})}),(0,G.jsx)(A,{label:`Prev close`,value:n?s(n.previous_close):(0,G.jsx)(j,{className:`mt-1 h-5 w-20`})}),(0,G.jsx)(A,{label:`Day range`,value:n?(0,G.jsxs)(`span`,{className:`block whitespace-normal leading-snug`,children:[s(n.day_low),` – `,s(n.day_high)]}):(0,G.jsx)(j,{className:`mt-1 h-5 w-28`})}),(0,G.jsx)(A,{label:`Volume`,value:n?u(n.volume):(0,G.jsx)(j,{className:`mt-1 h-5 w-16`}),sub:n?.market_cap?`Cap ${u(n.market_cap)}`:`\xA0`})]}),!a&&f?.type!==`mf`&&(0,G.jsx)(Tr,{symbol:d,market:t}),(0,G.jsx)(At,{symbol:e,market:t}),(c?g:f?.type!==`mf`&&t!==`global`)&&(0,G.jsx)(xt,{symbol:g?d:e,market:t})]})})}function Pi({symbol:e,quote:t,onPick:n}){let{base:r,exchange:a}=Mi(e),o=a===`NSE`?`BSE`:`NSE`,c=o===`BSE`?`${r}.BO`:r,[u,d]=(0,W.useState)({}),[f,m]=(0,W.useState)(!1);(0,W.useEffect)(()=>d({}),[r]),(0,W.useEffect)(()=>{t&&d(e=>({...e,[a]:t}))},[t,a]),(0,W.useEffect)(()=>{let e=!1;return m(!1),fe(c,`india`).then(t=>!e&&d(e=>({...e,[o]:t}))).catch(()=>!e&&m(!0)),()=>{e=!0}},[c,o]);let h={NSE:(a===`NSE`?t:null)??u.NSE??null,BSE:(a===`BSE`?t:null)??u.BSE??null},g=h[a]&&h[o]?h[a].price-h[o].price:null;return(0,G.jsxs)(`div`,{className:`w-full shrink-0 sm:w-[18rem]`,children:[(0,G.jsx)(`div`,{className:`mb-1.5 text-xs text-muted`,children:`Exchange`}),(0,G.jsx)(`div`,{role:`radiogroup`,"aria-label":`Exchange`,className:`grid grid-cols-2 gap-1 rounded-xl bg-raised p-1`,children:[`NSE`,`BSE`].map(e=>{let t=h[e],c=e===a,u=e===o&&f;return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":c,disabled:c||u,onClick:()=>n(e===`BSE`?`${r}.BO`:r),className:p(`min-w-0 rounded-lg px-2.5 py-1.5 text-start transition-colors`,c?`bg-surface shadow-card ring-1 ring-accent/40`:`hover:bg-surface/60 disabled:opacity-60`),children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-1`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold tracking-wide text-muted`,children:e}),t&&(0,G.jsx)(`span`,{className:p(`tabular text-[11px]`,i(t.change)),children:l(t.change_percent)})]}),(0,G.jsx)(`div`,{className:`flex h-6 items-center`,children:t?(0,G.jsxs)(`span`,{className:`tabular truncate font-semibold`,children:[`₹`,s(t.price)]}):u?(0,G.jsx)(`div`,{className:`text-xs text-faint`,children:`Not listed`}):(0,G.jsx)(j,{className:`h-4 w-20`})})]},e)})}),(0,G.jsx)(`p`,{className:`mt-1.5 h-4 text-xs text-muted`,children:g!=null&&Math.abs(g)>=.01?`${a} is ₹${s(Math.abs(g))} ${g>0?`above`:`below`} ${o}`:g==null?``:`Same price on both`})]})}function Fi({noAi:e,mode:t,onMode:n,stages:r,running:i,onRun:a,onCancel:o}){return(0,G.jsxs)(C,{help:`Agent pipeline`,children:[(0,G.jsx)(D,{title:`AI analysis`,description:i?`Streaming live…`:r.length?`Last run`:`AI agents read the chart, risk and news, then give their view`,actions:i?(0,G.jsx)(O,{variant:`danger`,size:`sm`,icon:`stop`,onClick:o,children:`Cancel`}):(0,G.jsx)(O,{size:`sm`,icon:`play`,onClick:a,disabled:e,title:e?Oi:void 0,children:r.length?`Run again`:`Run AI`})}),e&&!i&&(0,G.jsx)(`div`,{className:`border-b border-line px-5 py-3`,children:(0,G.jsx)(ki,{})}),(0,G.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,G.jsxs)(`span`,{className:`mb-1.5 block text-xs font-medium text-muted`,children:[`Depth `,(0,G.jsx)(`span`,{className:`font-normal text-faint`,children:`· the data cards are the same at every depth`})]}),(0,G.jsx)(S,{options:et,value:t,onChange:n,showHint:!0})]}),r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-xs text-muted`,children:`Run AI to see each agent report in as it completes.`}):(0,G.jsx)(`ol`,{className:`grid gap-x-8 px-5 py-4 md:grid-cols-2`,children:r.map(e=>(0,G.jsxs)(`li`,{className:`flex gap-3 py-2`,children:[(0,G.jsx)(Li,{status:e.status}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:p(`text-sm font-medium`,e.status===`pending`&&`text-faint`),children:Ci(e.agent)}),(0,G.jsx)(Ii,{opinion:e.opinion})]}),e.status===`skipped`&&(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-warn`,children:e.message??`Skipped`}),e.opinion?.summary&&(0,G.jsx)(`p`,{className:`mt-0.5 line-clamp-3 text-xs text-muted`,children:e.opinion.summary})]})]},e.agent))})]})}function Ii({opinion:e}){if(!e)return null;if(e.agent_name===`sentiment`&&e.signal){let t=[`bullish`,`positive`].includes(e.signal)?`up`:[`bearish`,`negative`].includes(e.signal)?`down`:`warn`,n=e.details?.posts;return(0,G.jsx)(`span`,{title:typeof n==`number`?`${n} posts in the last 7 days`:void 0,children:(0,G.jsxs)(E,{tone:t,children:[`chatter `,e.signal]})})}if(e.signal)return(0,G.jsx)(k,{value:e.signal});let t=e.details??{};if(e.agent_name===`risk`&&typeof t.risk_level==`string`)return(0,G.jsx)(k,{value:`${t.risk_level}_risk`});let n=t.financial_statements?.overall?.score;if(e.agent_name===`fundamentals`&&typeof n==`number`){let e=n>=60?`bullish`:n>=40?`neutral`:`bearish`;return(0,G.jsx)(`span`,{title:`Filings score ${n}/100`,children:(0,G.jsx)(k,{value:e})})}return null}function Li({status:e}){let t=`relative z-10 grid h-6 w-6 shrink-0 place-items-center rounded-full ring-1`;return e===`running`?(0,G.jsx)(`span`,{className:p(t,`bg-accent-soft text-accent-fg ring-accent/40`),children:(0,G.jsx)(y,{className:`h-3.5 w-3.5`})}):e===`done`?(0,G.jsx)(`span`,{className:p(t,`bg-up-soft text-up ring-up/40`),children:(0,G.jsx)(T,{name:`check`,className:`h-3.5 w-3.5`})}):e===`skipped`?(0,G.jsx)(`span`,{className:p(t,`bg-warn-soft text-warn ring-warn/40`),children:(0,G.jsx)(T,{name:`x`,className:`h-3 w-3`})}):(0,G.jsx)(`span`,{className:p(t,`bg-canvas ring-line-strong`)})}function Ri({dashboard:e}){function t(){let t=[`${e.symbol} (${e.market}) – AI analysis${e.outlook?` (${e.outlook} outlook)`:``}`,e.analysis_summary??``,`Risk: ${e.risk_level??`-`}`,``,...e.opinions.map(e=>`- ${Ci(e.agent_name)} [${e.signal??`-`}]: ${e.summary}`)];navigator.clipboard.writeText(t.join(`
|
|
7
|
+
`)).then(()=>f.success(`Report copied to clipboard`),()=>f.error(`Clipboard not available`))}return(0,G.jsxs)(C,{id:`section-decision`,section:`AI analysis`,children:[(0,G.jsx)(D,{title:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`AI analysis `,e.outlook&&(0,G.jsx)(k,{value:e.outlook})]}),description:`${Ze(et,e.mode)} mode · generated ${a(e.generated_at)}`,actions:(0,G.jsx)(O,{variant:`ghost`,size:`sm`,onClick:t,children:`Copy report`})}),(0,G.jsxs)(v,{children:[e.analysis_summary&&(0,G.jsx)(`p`,{className:`text-sm leading-relaxed`,children:e.analysis_summary}),(0,G.jsx)(`div`,{className:`mt-5 grid grid-cols-2 gap-5 border-t border-line pt-5`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:`Risk level`}),(0,G.jsx)(`div`,{className:`mt-1.5`,children:(0,G.jsx)(k,{value:e.risk_level})})]})})]})]})}var zi={rsi:`RSI`,macd:`MACD`,ma:`Moving average`,ema:`EMA`,sma:`SMA`,atr:`ATR`,adx:`ADX`,obv:`OBV`,vwap:`VWAP`,eps:`EPS`,pe:`P/E`,pb:`P/B`,ps:`P/S`,roe:`ROE`,roce:`ROCE`,var:`VaR`};function Bi(e){let t=zi[e.toLowerCase()];if(t)return t;let n=e.replace(/_/g,` `);return n.charAt(0).toUpperCase()+n.slice(1)}function Vi(e){return Number.isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:Math.abs(e)>=100||Math.abs(e)>=1?2:4}):String(e)}function Hi(e){return e==null||[`string`,`number`,`boolean`].includes(typeof e)}function Ui({value:e,depth:t=0}){if(e==null||e===``)return(0,G.jsx)(`span`,{className:`text-faint`,children:`—`});if(typeof e==`number`)return(0,G.jsx)(`span`,{className:`tabular`,children:Vi(e)});if(typeof e==`boolean`)return(0,G.jsx)(G.Fragment,{children:e?`Yes`:`No`});if(typeof e==`string`)return(0,G.jsx)(G.Fragment,{children:e});if(Array.isArray(e))return e.length===0?(0,G.jsx)(`span`,{className:`text-faint`,children:`None`}):(0,G.jsx)(`ul`,{className:`list-disc space-y-1 ps-4`,children:e.map((e,n)=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Ui,{value:e,depth:t+1})},n))});if(typeof e==`object`){let n=Object.entries(e).filter(([,e])=>e!=null&&e!==``),r=e;if(`value`in r&&n.length<=2&&n.every(([,e])=>Hi(e))){let e=n.find(([e])=>e!==`value`);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ui,{value:r.value,depth:t+1}),e&&(0,G.jsxs)(`span`,{className:`text-muted`,children:[` · `,String(e[1])]})]})}return t>3?(0,G.jsx)(`span`,{className:`font-mono`,children:JSON.stringify(e)}):(0,G.jsx)(`dl`,{className:`grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-x-4 gap-y-1`,children:n.map(([e,n])=>(0,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`text-muted`,children:Bi(e)}),(0,G.jsx)(`dd`,{className:`min-w-0 break-words`,children:(0,G.jsx)(Ui,{value:n,depth:t+1})})]},e))})}return(0,G.jsx)(G.Fragment,{children:String(e)})}function Wi({opinions:e}){let[t,n]=(0,W.useState)(null);return(0,G.jsxs)(C,{id:`section-opinions`,section:`Agent opinions`,children:[(0,G.jsx)(D,{title:`Agent opinions`,description:`${e.length} agents contributed`}),(0,G.jsx)(`ul`,{className:`divide-y divide-line`,children:e.map(e=>{let r=Object.entries(e.details??{}).filter(([,e])=>e!=null&&e!==``),i=t===e.agent_name;return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(i?null:e.agent_name),className:`flex w-full items-start gap-3 px-5 py-4 text-start hover:bg-raised/40`,children:[(0,G.jsx)(T,{name:`chevron`,className:p(`mt-0.5 h-4 w-4 text-faint transition-transform`,i&&`rotate-90`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:Ci(e.agent_name)}),e.signal&&(0,G.jsx)(k,{value:e.signal})]}),(0,G.jsx)(`p`,{className:p(`mt-1 text-sm text-muted`,!i&&`line-clamp-2`),children:e.summary})]})]}),i&&r.length>0&&(0,G.jsx)(`dl`,{className:`mx-5 mb-4 ms-12 grid gap-x-6 gap-y-3 rounded-lg bg-canvas p-4 text-xs sm:grid-cols-2`,children:r.map(([e,t])=>(0,G.jsxs)(`div`,{className:p(`min-w-0`,typeof t==`object`&&`sm:col-span-2`),children:[(0,G.jsx)(`dt`,{className:`text-faint`,children:Bi(e)}),(0,G.jsx)(`dd`,{className:`mt-0.5 break-words text-fg/90`,children:(0,G.jsx)(Ui,{value:t})})]},e))})]},e.agent_name)})})]})}export{wi as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{b as t}from"./format-d8InM0Zw.js";import{O as n}from"./ui-gsFb8B2m.js";import{t as r}from"./files-CpgiZRbN.js";import{n as i,z as a}from"./LineChart-BaOkD1Ta.js";async function o(e,t=`us`){return(await n.get(`/stocks/${encodeURIComponent(e)}/quote`,{params:{market:t}})).data}async function s(e,t=`us`,r=`1y`,i=`1d`){return(await n.get(`/stocks/${encodeURIComponent(e)}/history`,{params:{market:t,period:r,interval:i}})).data}async function c(e,t=`us`){return(await n.get(`/stocks/${encodeURIComponent(e)}/overview`,{params:{market:t}})).data}async function l(e,t=`us`,r=`annual`){return(await n.get(`/stocks/${encodeURIComponent(e)}/financials`,{params:{market:t,period:r}})).data}async function u(e,t=`us`,r=`annual`){return(await n.post(`/stocks/${encodeURIComponent(e)}/financials/ai-summary`,null,{params:{market:t,period:r},timeout:15e4})).data.summary}async function d(e,t=`us`){return(await n.get(`/stocks/${encodeURIComponent(e)}/leadership`,{params:{market:t}})).data}async function f(e,t=`us`){return(await n.post(`/stocks/${encodeURIComponent(e)}/leadership/ai-brief`,null,{params:{market:t},timeout:15e4})).data}async function p(e,t=`us`){return(await n.get(`/stocks/${encodeURIComponent(e)}/shariah`,{params:{market:t},timeout:9e4})).data}async function m(e=1){return(await n.get(`/listings/deals`,{params:{days:e}})).data}async function h(e,t=`us`){return(await n.get(`/stocks/${encodeURIComponent(e)}/ownership`,{params:{market:t}})).data}async function g(e){return(await n.post(`/stocks/${encodeURIComponent(e)}/mdna/ai-summary`,null,{params:{market:`us`},timeout:15e4})).data}async function _(e,t=`us`){return(await n.get(`/stocks/${encodeURIComponent(e)}/dcf`,{params:{market:t}})).data}async function v(e,t,i){let a=await n.get(`/stocks/${encodeURIComponent(e)}/dcf/model.xlsx`,{params:{market:t,...i},responseType:`blob`,timeout:12e4});r(a.data,`${e}-dcf-model.xlsx`)}async function y(e,t=`us`){return(await n.get(`/stocks/${encodeURIComponent(e)}/checklists`,{params:{market:t}})).data}var b=e(t()),x=[`axis`],S=(0,b.forwardRef)((e,t)=>b.createElement(i,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:x,tooltipPayloadSearcher:a,categoricalChartProps:e,ref:t}));export{_ as a,u as c,g as d,c as f,p as h,y as i,s as l,o as m,v as n,m as o,h as p,f as r,l as s,S as t,d as u};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{b as t}from"./format-d8InM0Zw.js";import{$ as n,$t as r,A as i,At as a,B as o,C as s,D as c,Dt as l,E as u,Et as d,F as f,Ft as p,G as m,Gt as h,H as g,Ht as _,It as v,Jt as y,K as b,Kt as x,Lt as S,M as C,Mt as w,N as T,Nt as E,O as D,Ot as O,P as k,Pt as A,Q as j,Qt as M,Rt as ee,S as te,St as N,T as ne,Tt as re,U as ie,Ut as P,V as ae,W as oe,Wt as se,X as ce,Xt as le,Y as F,Yt as ue,Z as de,Zt as I,_ as fe,_t as pe,at as me,b as he,bt as L,c as ge,ct as _e,dt as ve,en as ye,ft as be,gt as xe,ht as R,it as Se,j as Ce,jt as we,k as Te,kt as z,l as Ee,lt as De,mt as Oe,n as ke,nt as Ae,o as je,ot as Me,rt as B,s as Ne,st as Pe,tn as Fe,tt as Ie,v as Le,w as Re,wt as V,x as ze,xt as Be,y as Ve,z as He}from"./LineChart-BaOkD1Ta.js";var Ue=e=>null;Ue.displayName=`Cell`;var We=(e,t,n)=>{var r=p();return(i,a)=>o=>{e?.(i,a,o),r(b({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},Ge=e=>{var t=p();return(n,r)=>i=>{e?.(n,r,i),t(oe())}},Ke=(e,t,n)=>{var r=p();return(i,a)=>o=>{e?.(i,a,o),r(m({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function qe(e,t){return Qe(e)||Ze(e,t)||Ye(e,t)||Je()}function Je(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ye(e,t){if(e){if(typeof e==`string`)return Xe(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xe(e,t):void 0}}function Xe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ze(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Qe(e){if(Array.isArray(e))return e}var $e=(e,t,n)=>{var r=n??e;if(!x(r))return _(r,t,0)},et=(e,t,n)=>{var r={},i=e.filter(Ie),a=e.filter(e=>e.stackId==null),o=i.reduce((e,t)=>{var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},r),s=Object.entries(o).map(e=>{var r=qe(e,2),i=r[0],a=r[1];return{stackId:i,dataKeys:a.map(e=>e.dataKey),barSize:$e(t,n,a[0]?.barSize)}}),c=a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>e!=null),barSize:$e(t,n,e.barSize)}));return[...s,...c]};function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tt(Object(n),!0).forEach(function(t){nt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nt(e,t,n){return(t=rt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rt(e){var t=it(e,`string`);return typeof t==`symbol`?t:t+``}function it(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function at(e,t,n,r,i){var a=r.length;if(!(a<1)){var o=_(e,n,0,!0),s,c=[];if(E(r[0]?.barSize)){var l=!1,u=n/a,d=r.reduce((e,t)=>e+(t.barSize||0),0);d+=(a-1)*o,d>=n&&(d-=(a-1)*o,o=0),d>=n&&u>0&&(l=!0,u*=.9,d=a*u);var f={offset:Math.round((n-d)/2)-o,size:0};s=r.reduce((e,t)=>{var n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f.offset+f.size+o,size:l?u:t.barSize??0}},r=[...e,n];return f=n.position,r},c)}else{var p=_(t,n,0,!0);n-2*p-(a-1)*o<=0&&(o=0);var m=(n-2*p-(a-1)*o)/a;m>1&&(m=Math.round(m));var h=E(i)?Math.min(m,i):m;s=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+a*(m-h)/2+(h+o)*n,size:h}}],c)}return s}}var ot=(e,t,n,r,i,a,o)=>{var s=x(o)?t:o,c=at(n,r,i===a?a:i,e,s);return i!==a&&c!=null&&(c=c.map(e=>H(H({},e),{},{position:H(H({},e.position),{},{offset:e.position.offset-i/2})}))),c},st=(e,t)=>{var n=Ae(t);if(e&&n!=null&&t!=null){var r=t.stackId;if(r!=null){var i=e[r];if(i){var a=i.stackedData;if(a)return a.find(e=>e.key===n)}}}},ct=(e,t)=>{if(e!=null&&t!=null){var n=e.find(e=>e.stackId===t.stackId&&t.dataKey!=null&&e.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function lt(e,t){return e&&typeof e==`object`&&`zIndex`in e&&typeof e.zIndex==`number`&&E(e.zIndex)?e.zIndex:t}function U(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function W(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var ut=(e,t,n)=>F(e,`xAxis`,U(e,t),n),dt=(e,t,n)=>j(e,`xAxis`,U(e,t),n),ft=(e,t,n)=>F(e,`yAxis`,W(e,t),n),pt=(e,t,n)=>j(e,`yAxis`,W(e,t),n),mt=A([R,ut,ft,dt,pt],(e,t,n,r,i)=>we(e,`xAxis`)?V(t,r,!1):V(n,i,!1)),ht=A([n,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),gt=e=>{var t=R(e);return we(t,`xAxis`)?`yAxis`:`xAxis`},_t=(e,t)=>gt(e)===`yAxis`?W(e,t):U(e,t),vt=(e,t,n)=>de(e,gt(e),_t(e,t),n),yt=A([ht,vt],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=Ae(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),bt=A([ht,vt],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(h)}}),xt=A([R,ut,ft,dt,pt,yt,De,mt,ht,Me,bt],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return Xt({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),G=e(t()),St=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],Ct=[`id`,`baseLine`];function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},K.apply(null,arguments)}function wt(e,t){if(e==null)return{};var n,r,i=Tt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Tt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Et(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.x,o=r[r.length-1]?.x;if(!E(a)||!E(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.y||0));return y(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),y(c)?G.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function Dt(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.y,o=r[r.length-1]?.y;if(!E(a)||!E(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return y(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),y(c)?G.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function Ot(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?G.createElement(Dt,{alpha:t,points:r,baseLine:i,strokeWidth:a}):G.createElement(Et,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function kt(e){var t=e.animationElapsedTime,n=t===void 0?1:t,i=e.isAnimating,a=i!==void 0&&i,o=e.isEntrance,s=o!==void 0&&o,c=e.layout,l=e.isRange,u=e.stroke,d=e.connectNulls,f=wt(e,St),p=c===`vertical`?`vertical`:`horizontal`,m=d??!1,h=te(),g=f.id,_=f.baseLine,v=wt(f,Ct),y=r(v),b=G.createElement(be,K({},f,{id:g,baseLine:_,connectNulls:m,stroke:`none`,className:`recharts-area-area`,layout:p})),x=u!==`none`&&G.createElement(be,K({},y,{className:`recharts-area-curve`,layout:p,type:f.type,connectNulls:m,fill:`none`,stroke:u,points:f.points})),S=u!==`none`&&l&&Array.isArray(_)&&G.createElement(be,K({},y,{className:`recharts-area-curve`,layout:p,type:f.type,connectNulls:m,fill:`none`,stroke:u,points:_}));return s&&(a||n<1)?G.createElement(I,null,G.createElement(`defs`,null,G.createElement(`clipPath`,{id:h},G.createElement(Ot,{alpha:n,points:f.points??[],baseLine:_,layout:p,strokeWidth:f.strokeWidth}))),G.createElement(I,{clipPath:`url(#${h})`},b,x,S)):G.createElement(G.Fragment,null,b,x,S)}var At=[`id`],jt=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(null,arguments)}function Mt(e,t){if(e==null)return{};var n,r,i=Nt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Nt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Pt(Object(n),!0).forEach(function(t){Ft(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ft(e,t,n){return(t=It(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function It(e){var t=Lt(e,`string`);return typeof t==`symbol`?t:t+``}function Lt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Rt={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:D,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[J(J({},e.next),{},{x:P(e.prev.x,e.next.x,t),y:P(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:kt,xAxisId:0,yAxisId:0,zIndex:B.area};function Y(e,t){return e&&e!==`none`?e:t}var zt=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:Y(r,i),value:z(n,t),payload:e}]},Bt=G.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,a=e.strokeWidth,o=e.fill,s=e.name,c=e.hide,l=e.unit,u=e.formatter,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:le,settings:{stroke:r,strokeWidth:a,fill:o,dataKey:t,nameKey:void 0,name:z(s,t),hide:c,type:d,color:Y(r,o),unit:l,formatter:u,graphicalItemId:f}};return G.createElement(i,{tooltipEntrySettings:p})});function Vt(e){var t=e.clipPathId,n=e.points,i=e.props,a=i.needClip,o=i.dot,s=i.dataKey,c=r(i);return G.createElement(Ve,{points:n,dot:o,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:s,baseProps:c,needClip:a,clipPathId:t})}function Ht(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return J(J({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return G.createElement(k,{value:t?r:void 0},n)}function Ut(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,s=e.isAnimating,c=e.isEntrance,l=a.layout,u=a.type,d=a.stroke,f=a.connectNulls,p=a.isRange,m=a.shape,h=a.id,g=Mt(a,At),_=J(J({},M(g)),{},{id:h,points:t,connectNulls:f,type:u,baseLine:n,layout:l,stroke:d,isRange:p,animationElapsedTime:o,isAnimating:s,isEntrance:c});return G.createElement(G.Fragment,null,t?.length>1&&G.createElement(I,{clipPath:r?`url(#clipPath-${i})`:void 0},G.createElement(Ce,{option:m,DefaultShape:Rt.shape,shapeProps:_})),G.createElement(Vt,{points:t,props:g,clipPathId:i}))}function Wt(e,t,n){if(y(e)){var r=y(t)?t:void 0;return P(r,e,n)}if(x(e)||se(e)){var i=y(t)?t:void 0;return P(i,0,n)}return e}function Gt(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,c=r.baseLine,l=r.isAnimationActive,d=r.animationBegin,p=r.animationDuration,m=r.animationEasing,h=r.animationMatchBy,g=r.animationInterpolateFn,_=(0,G.useMemo)(()=>({points:o,baseLine:c}),[o,c]),v=ne(_,a),y=xe(),b=Re(r.onAnimationStart,r.onAnimationEnd),x=b.isAnimating,S=b.handleAnimationStart,C=b.handleAnimationEnd,w=v.startValue;if(y==null)return null;var T=Array.isArray(c)&&Array.isArray(w)?u(w,c,h):Array.isArray(c)?u(null,c,h):null;return G.createElement(s,{animationInput:_,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:d,animationDuration:p,animationEasing:m,onAnimationStart:S,onAnimationEnd:C,animationInterpolateFn:g,animationMatchBy:h,layout:y},(e,i,a)=>{var s=i===1?c:Array.isArray(c)?g(T,i,y):a?c:Wt(c,w,i);return v.syncStepValue(s,i),G.createElement(Ht,{showLabels:!x,points:o},r.children,G.createElement(Ut,{points:e,baseLine:s,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:x||i<1,isEntrance:a}),G.createElement(f,{label:r.label}))})}function Kt(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=(0,G.useRef)(null),a=(0,G.useRef)();return G.createElement(Gt,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var qt=class extends G.PureComponent{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,s=e.left,c=e.needClip,l=e.xAxisId,u=e.yAxisId,d=e.width,f=e.height,p=e.id,m=e.baseLine,h=e.zIndex;if(t)return null;var g=Fe(`recharts-area`,i),_=p,v=je(n),y=v.r,b=v.strokeWidth,x=T(n),S=y*2+b,C=c?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return G.createElement(o,{zIndex:h},G.createElement(I,{className:g},c&&G.createElement(`defs`,null,G.createElement(Ne,{clipPathId:_,xAxisId:l,yAxisId:u}),!x&&G.createElement(`clipPath`,{id:`clipPath-dots-${_}`},G.createElement(`rect`,{x:s-S/2,y:a-S/2,width:d+S,height:f+S}))),G.createElement(Kt,{needClip:c,clipPathId:_,props:this.props})),G.createElement(fe,{points:r,mainColor:Y(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(m)&&G.createElement(fe,{points:m,mainColor:Y(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}};function Jt(e){var t=e.activeDot,n=e.animationBegin,r=e.animationDuration,i=e.animationEasing,a=e.connectNulls,o=e.dot,s=e.fill,c=e.fillOpacity,l=e.hide,u=e.isAnimationActive,d=e.legendType,f=e.stroke,p=e.xAxisId,m=e.yAxisId,h=Mt(e,jt),g=pe(),_=ae(),y=ge(p,m).needClip,b=L(),x=v(t=>xt(t,e.id,b))??{},S=x.points,C=x.isRange,w=x.baseLine,T=Le();if(g!==`horizontal`&&g!==`vertical`||T==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var E=T.height,D=T.width,O=T.x,k=T.y;return!S||!S.length?null:G.createElement(qt,q({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:w,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:E,hide:l,layout:g,isAnimationActive:u,isRange:C,legendType:d,needClip:y,points:S,stroke:f,width:D,left:O,top:k,xAxisId:p,yAxisId:m}))}var Yt=(e,t,n,r,i)=>{var a=n??t;if(y(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function Xt(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,o=e.stackedData,s=e.layout,c=e.chartBaseValue,u=e.xAxis,d=e.yAxis,f=e.displayedData,p=e.dataStartIndex,m=e.xAxisTicks,h=e.yAxisTicks,g=e.bandSize,_=e.stackDataKeys,v=o&&o.length,y=Yt(s,c,r,u,d),b=s===`horizontal`,x=!1,S=f.map((e,t)=>{var r;if(v)r=o[p+t];else{var s=a(e,i);Array.isArray(s)?(r=s,x=!0):r=[y,s]}var c=r?.[1]??null,f=a(e,i),S=v&&f==null&&_!=null&&_.length>0&&_.every(t=>a(e,t)==null),C=c==null||v&&!n&&f==null||S;return b?{x:l({axis:u,ticks:m,bandSize:g,entry:e,index:t}),y:C?null:d.scale.map(c)??null,value:r,payload:e}:{x:C?null:u.scale.map(c)??null,y:l({axis:d,ticks:h,bandSize:g,entry:e,index:t}),value:r,payload:e}});return{points:S,baseLine:(v||x?S.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return b?{x:e.x,y:t!=null&&e.y!=null?d.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:u.scale.map(t)??null,y:e.y,payload:e.payload}}):b?d.scale.map(y):u.scale.map(y))??0,isRange:x}}function Zt(e){var t=S(e,Rt),n=L();return G.createElement(ze,{id:t.id,type:`area`},e=>G.createElement(G.Fragment,null,G.createElement(Te,{legendPayload:zt(t)}),G.createElement(Bt,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),G.createElement(he,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:O(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),G.createElement(Jt,q({},t,{id:e}))))}var Qt=G.memo(Zt,Oe);Qt.displayName=`Area`;var $t=`Invariant failed`;function en(e,t){if(!e)throw Error($t)}var tn=[`option`];function nn(e,t){if(e==null)return{};var n,r,i=rn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function rn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var an=ve;function on(e){var t=e.option,n=nn(e,tn);return G.createElement(Ce,{option:t,DefaultShape:an,shapeProps:n,activeClassName:`recharts-active-bar`,inActiveClassName:`recharts-inactive-bar`})}var sn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(y(e))return e;var i=y(n)||x(n);return i?e(n,r):(!i&&en(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},cn=(e,t,n)=>n,X=A([n,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),ln=A([X],e=>e?.maxBarSize),un=(e,t,n,r)=>r,dn=A([R,n,U,W,cn],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),fn=(e,t,n)=>{var r=R(e),i=U(e,t),a=W(e,t);if(i!=null&&a!=null)return r===`horizontal`?de(e,`yAxis`,a,n):de(e,`xAxis`,i,n)},pn=A([dn,Pe,(e,t)=>{var n=R(e),r=U(e,t),i=W(e,t);if(r!=null&&i!=null)return n===`horizontal`?ce(e,`xAxis`,r):ce(e,`yAxis`,i)}],et),mn=(e,t,n)=>{var r=X(e,t);if(r==null)return 0;var i=U(e,t),a=W(e,t);if(i==null||a==null)return 0;var o=R(e),s=_e(e),c=r.maxBarSize,l=x(c)?s:c,u,d;return o===`horizontal`?(u=F(e,`xAxis`,i,n),d=j(e,`xAxis`,i,n)):(u=F(e,`yAxis`,a,n),d=j(e,`yAxis`,a,n)),V(u,d,!0)??l??0},hn=(e,t,n)=>{var r=R(e),i=U(e,t),a=W(e,t);if(i!=null&&a!=null){var o,s;return r===`horizontal`?(o=F(e,`xAxis`,i,n),s=j(e,`xAxis`,i,n)):(o=F(e,`yAxis`,a,n),s=j(e,`yAxis`,a,n)),V(o,s)}},gn=A([pn,_e,me,Se,mn,hn,ln],ot),_n=(e,t,n)=>{var r=U(e,t);if(r!=null)return F(e,`xAxis`,r,n)},vn=(e,t,n)=>{var r=W(e,t);if(r!=null)return F(e,`yAxis`,r,n)},yn=(e,t,n)=>{var r=U(e,t);if(r!=null)return j(e,`xAxis`,r,n)},bn=(e,t,n)=>{var r=W(e,t);if(r!=null)return j(e,`yAxis`,r,n)},xn=A([gn,X],ct),Sn=A([fn,X],st),Cn=A([N,Be,_n,vn,yn,bn,xn,R,De,hn,Sn,X,un],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var p=c.chartData,m=c.dataStartIndex,h=c.dataEndIndex;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var g=d.data,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return lr({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),wn=[`index`];function Tn(){return Tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tn.apply(null,arguments)}function En(e,t){if(e==null)return{};var n,r,i=Dn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Dn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var On=(0,G.createContext)(void 0),kn=e=>{var t=(0,G.useContext)(On);if(t!=null)return t.stackId;if(e!=null)return O(e)},An=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,jn=e=>{var t=(0,G.useContext)(On);if(t!=null){var n=t.stackId;return`url(#${An(n,e)})`}},Mn=e=>{var t=e.index,n=En(e,wn),r=jn(t);return G.createElement(I,Tn({className:`recharts-bar-stack-layer`,clipPath:r},n))},Nn=[`onMouseEnter`,`onMouseLeave`,`onClick`],Pn=[`value`,`background`,`tooltipPosition`],Fn=[`id`],In=[`onMouseEnter`,`onClick`,`onMouseLeave`];function Ln(e,t){return Hn(e)||Vn(e,t)||zn(e,t)||Rn()}function Rn(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zn(e,t){if(e){if(typeof e==`string`)return Bn(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(e,t):void 0}}function Bn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Vn(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Hn(e){if(Array.isArray(e))return e}function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Z.apply(null,arguments)}function Un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Un(Object(n),!0).forEach(function(t){Wn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Un(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Wn(e,t,n){return(t=Gn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gn(e){var t=Kn(e,`string`);return typeof t==`symbol`?t:t+``}function Kn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function $(e,t){if(e==null)return{};var n,r,i=qn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Jn=e=>{var t=e.dataKey,n=e.name,r=e.fill,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:z(n,t),payload:e}]},Yn=G.memo(e=>{var t=e.dataKey,n=e.stroke,r=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:void 0,getPosition:le,settings:{stroke:n,strokeWidth:r,fill:a,dataKey:t,nameKey:void 0,name:z(o,t),hide:s,type:u,color:a,unit:c,formatter:l,graphicalItemId:d}};return G.createElement(i,{tooltipEntrySettings:f})});function Xn(e){var t=v(ie),n=e.data,r=e.dataKey,i=e.background,a=e.allOtherBarProps,s=a.onMouseEnter,c=a.onMouseLeave,l=a.onClick,u=$(a,Nn),d=We(s,r,a.id),f=Ge(c),p=Ke(l,r,a.id);if(!i||n==null)return null;var m=ye(i);return G.createElement(o,{zIndex:lt(i,B.barBackground)},n.map((e,n)=>{e.value;var a=e.background;e.tooltipPosition;var o=$(e,Pn);if(!a)return null;var s=d(e,e.originalDataIndex),c=f(e,e.originalDataIndex),l=p(e,e.originalDataIndex),h=Q(Q(Q(Q(Q({option:i,isActive:String(e.originalDataIndex)===t},o),{},{fill:`#eee`},a),m),ee(u,e,n)),{},{onMouseEnter:s,onMouseLeave:c,onClick:l,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return G.createElement(on,Z({key:`background-bar-${n}`},h))}))}function Zn(e){var t=e.showLabels,n=e.children,r=e.rects?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return Q(Q({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return G.createElement(k,{value:t?r:void 0},n)}function Qn(e){var t=e.shape,n=e.activeBar,r=e.baseProps,i=e.entry,a=e.index,s=e.dataKey,c=v(ie),l=v(g),u=n&&String(i.originalDataIndex)===c&&(l==null||s===l),d=c!=null&&(String(i.originalDataIndex)!==c||l!=null&&s!==l),f=Ln((0,G.useState)(!1),2),p=f[0],m=f[1],h=Ln((0,G.useState)(!1),2),_=h[0],y=h[1];(0,G.useEffect)(()=>{var e;return u?(m(!0),e=requestAnimationFrame(()=>{y(!0)})):(y(!1),d&&m(!1)),()=>{cancelAnimationFrame(e)}},[u,d]);var b=(0,G.useCallback)(()=>{u||m(!1)},[u]),x=u&&_,S=u||p,C=u?n===!0?t:n:t,w=G.createElement(on,Z({},r,{name:String(r.name)},i,{isActive:x,option:C,index:a,dataKey:s,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance,onTransitionEnd:b}));return S?G.createElement(o,{zIndex:B.activeBar},G.createElement(Mn,{index:i.originalDataIndex},w)):w}function $n(e){var t=e.shape,n=e.baseProps,r=e.entry,i=e.index,a=e.dataKey;return G.createElement(on,Z({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance}))}function er(e){var t=e.data,n=e.props,i=e.animationElapsedTime,a=e.isAnimating,o=e.isEntrance,s=r(n)??{},c=s.id,l=$(s,Fn),u=n.shape,d=n.dataKey,f=n.activeBar,p=n.onMouseEnter,m=n.onClick,h=n.onMouseLeave,g=$(n,In),_=We(p,d,c),v=Ge(h),y=Ke(m,d,c);return t?G.createElement(G.Fragment,null,t.map((e,t)=>G.createElement(Mn,Z({index:e.originalDataIndex,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},ee(g,e,t),{onMouseEnter:_(e,e.originalDataIndex),onMouseLeave:v(e,e.originalDataIndex),onClick:y(e,e.originalDataIndex)}),f?G.createElement(Qn,{shape:u,activeBar:f,baseProps:l,entry:e,index:t,dataKey:d,animationElapsedTime:i,isAnimating:a,isEntrance:o}):G.createElement($n,{shape:u,baseProps:l,entry:e,index:t,dataKey:d,animationElapsedTime:i,isAnimating:a,isEntrance:o})))):null}var tr=(e,t,n)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>{if(e.status===`removed`)return n===`horizontal`?[Q(Q({},e.prev),{},{height:P(e.prev.height,0,t),y:P(e.prev.y,e.prev.y+e.prev.height,t)})]:[Q(Q({},e.prev),{},{width:P(e.prev.width,0,t)})];if(e.status===`matched`)return[Q(Q({},e.next),{},{x:P(e.prev.x,e.next.x,t),y:P(e.prev.y,e.next.y,t),width:P(e.prev.width,e.next.width,t),height:P(e.prev.height,e.next.height,t)})];var r=e.next;return n===`horizontal`?[Q(Q({},r),{},{height:P(0,r.height,t),y:P(r.stackedBarStart,r.y,t)})]:[Q(Q({},r),{},{width:P(0,r.width,t),x:P(r.stackedBarStart,r.x,t)})]});function nr(e){var t=e.props,n=e.previousRectanglesRef,r=t.data,i=t.isAnimationActive,a=t.animationBegin,o=t.animationDuration,c=t.animationEasing,l=t.animationInterpolateFn,u=t.layout,d=Re(t.onAnimationStart,t.onAnimationEnd),p=d.isAnimating,m=d.handleAnimationStart,h=d.handleAnimationEnd;return G.createElement(Zn,{showLabels:!p,rects:r},G.createElement(s,{animationInput:r,animationIdPrefix:`recharts-bar-`,items:r,previousItemsRef:n,isAnimationActive:i,animationBegin:a,animationDuration:o,animationEasing:c,onAnimationStart:m,onAnimationEnd:h,animationInterpolateFn:l,animationMatchBy:t.animationMatchBy,layout:u},(e,n,r)=>G.createElement(I,null,G.createElement(er,{props:t,data:e,animationElapsedTime:n,isAnimating:p||n<1,isEntrance:r}))),G.createElement(f,{label:t.label}),t.children)}function rr(e){var t=(0,G.useRef)(null);return G.createElement(nr,{previousRectanglesRef:t,props:e})}var ir=0,ar=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:a(e,t)}},or=class extends G.PureComponent{render(){var e=this.props,t=e.hide,n=e.data,r=e.dataKey,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.needClip,c=e.background,l=e.id;if(t||n==null)return null;var u=Fe(`recharts-bar`,i),d=l;return G.createElement(I,{className:u,id:l},s&&G.createElement(`defs`,null,G.createElement(Ne,{clipPathId:d,xAxisId:a,yAxisId:o})),G.createElement(I,{className:`recharts-bar-rectangles`,clipPath:s?`url(#clipPath-${d})`:void 0},G.createElement(Xn,{data:n,dataKey:r,background:c,allOtherBarProps:this.props}),G.createElement(rr,this.props)))}},sr={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,animationInterpolateFn:tr,animationMatchBy:c,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:ir,shape:an,xAxisId:0,yAxisId:0,zIndex:B.bar};function cr(e){var t=e.xAxisId,n=e.yAxisId,r=e.hide,i=e.legendType,a=e.minPointSize,o=e.activeBar,s=e.animationBegin,c=e.animationDuration,l=e.animationEasing,u=e.isAnimationActive,d=ge(t,n).needClip,f=pe(),p=L(),m=C(e.children,Ue),h=v(t=>Cn(t,e.id,p,m));if(f!==`vertical`&&f!==`horizontal`)return null;var g,_=h?.[0];return g=_==null||_.height==null||_.width==null?0:f===`vertical`?_.height/2:_.width/2,G.createElement(Ee,{xAxisId:t,yAxisId:n,data:h,dataPointFormatter:ar,errorBarOffset:g},G.createElement(or,Z({},e,{layout:f,needClip:d,data:h,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function lr(e){var t=e.layout,n=e.barSettings,r=n.dataKey,i=n.minPointSize,o=n.hasCustomShape,s=e.pos,c=e.bandSize,l=e.xAxis,u=e.yAxis,f=e.xAxisTicks,p=e.yAxisTicks,m=e.stackedData,h=e.displayedData,g=e.offset,_=e.cells,v=e.parentViewBox,y=e.dataStartIndex,b=t===`horizontal`?u:l,x=m?b.scale.domain():null,S=re({numericAxis:b}),C=b.scale.map(S);return h.map((e,n)=>{var h,b,T,E,D,O;if(m){var k=m[n+y];if(k==null)return null;h=w(k,x)}else h=a(e,r),Array.isArray(h)||(h=[S,h]);var A=sn(i,ir)(h[1],n);if(t===`horizontal`){var j=u.scale.map(h[0]),M=u.scale.map(h[1]);if(j==null||M==null)return null;b=d({axis:l,ticks:f,bandSize:c,offset:s.offset,entry:e,index:n}),T=M??j??void 0,E=s.size;var ee=j-M;if(D=se(ee)?0:ee,O={x:b,y:g.top,width:E,height:g.height},Math.abs(A)>0&&Math.abs(D)<Math.abs(A)){var te=ue(D||A)*(Math.abs(A)-Math.abs(D));T-=te,D+=te}}else{var N=l.scale.map(h[0]),ne=l.scale.map(h[1]);if(N==null||ne==null)return null;if(b=N,T=d({axis:u,ticks:p,bandSize:c,offset:s.offset,entry:e,index:n}),E=ne-N,D=s.size,O={x:g.left,y:T,width:g.width,height:D},Math.abs(A)>0&&Math.abs(E)<Math.abs(A)){var re=ue(E||A)*(Math.abs(A)-Math.abs(E));E+=re}}return b==null||T==null||E==null||D==null||!o&&(E===0||D===0)?null:Q(Q({},e),{},{stackedBarStart:C,x:b,y:T,width:E,height:D,value:m?h:h[1],payload:e,background:O,tooltipPosition:{x:b+E/2,y:T+D/2},parentViewBox:v,originalDataIndex:n},_&&_[n]&&_[n].props)}).filter(Boolean)}function ur(e){var t=S(e,sr),n=kn(t.stackId),r=L();return G.createElement(ze,{id:t.id,type:`bar`},e=>G.createElement(G.Fragment,null,G.createElement(Te,{legendPayload:Jn(t)}),G.createElement(Yn,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),G.createElement(he,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null&&t.shape!==an}),G.createElement(o,{zIndex:t.zIndex},G.createElement(cr,Z({},t,{id:e})))))}var dr=G.memo(ur,Oe);dr.displayName=`Bar`;var fr=[`axis`,`item`],pr=(0,G.forwardRef)((e,t)=>G.createElement(ke,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:fr,tooltipPayloadSearcher:He,categoricalChartProps:e,ref:t}));export{We as a,Ke as i,dr as n,Ge as o,Qt as r,Ue as s,pr as t};
|