zframes 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -18
- package/dist/index.js +170 -10
- package/package.json +4 -4
- package/runtime/assets/{bitcoin-dominance-DVZsIJ3y.js → bitcoin-dominance-DoQXKqiB.js} +1 -1
- package/runtime/assets/{breakeven-lskbHkqb.js → breakeven-C-RPYpuB.js} +1 -1
- package/runtime/assets/{breathing-BeUkCUAJ.js → breathing-y5-8SC9y.js} +1 -1
- package/runtime/assets/{btc-blocks-fXBgGo4z.js → btc-blocks-Sw7Iyo4-.js} +1 -1
- package/runtime/assets/{btc-difficulty-BwyxgI0e.js → btc-difficulty-BYmWqBxZ.js} +1 -1
- package/runtime/assets/{btc-fees-Bg1rcXtN.js → btc-fees-D8mISVeZ.js} +1 -1
- package/runtime/assets/{btc-hashrate-Xg8QNlTO.js → btc-hashrate-BEJQmdg9.js} +1 -1
- package/runtime/assets/{btc-mempool-8Mfa77fO.js → btc-mempool-1XmL6cRJ.js} +1 -1
- package/runtime/assets/{calculator-CiXyJA9p.js → calculator-DXo_2gkF.js} +1 -1
- package/runtime/assets/{checklist-D0dKSdmf.js → checklist-BdYa9ZOP.js} +1 -1
- package/runtime/assets/{clock-CNQTNh4L.js → clock-D-I4lQmb.js} +1 -1
- package/runtime/assets/{coin-movers-DulAF_oo.js → coin-movers-DOacvI6E.js} +1 -1
- package/runtime/assets/{countdown-BzZ2L6bw.js → countdown-BUHtC8Ve.js} +1 -1
- package/runtime/assets/{daily-analysis-RyI5KL4T.js → daily-analysis-CfKUC2nL.js} +1 -1
- package/runtime/assets/{day-meter-2bAj77Kz.js → day-meter-Bf2cGHVR.js} +1 -1
- package/runtime/assets/dex-volume-chart-61eDevFa.js +1 -0
- package/runtime/assets/dex-volume-treemap-DlwxBY_b.js +1 -0
- package/runtime/assets/{dice-wg979Skm.js → dice-Dl2uLedD.js} +1 -1
- package/runtime/assets/{dino-game-DlACWmE_.js → dino-game-Cx4Nc7AZ.js} +1 -1
- package/runtime/assets/{divider-Chz1UsWJ.js → divider-HYdZwv9D.js} +1 -1
- package/runtime/assets/{drawdy-Ce7P47cx.js → drawdy-C42tJRAO.js} +1 -1
- package/runtime/assets/editor-BMMobjrE.css +1 -0
- package/runtime/assets/editor-COIEaoVd.js +68 -0
- package/runtime/assets/{fear-greed-CENzXdIk.js → fear-greed-BkmVWoHA.js} +1 -1
- package/runtime/assets/{filings-feed-2aIKzUUY.js → filings-feed-ChiZiKYE.js} +1 -1
- package/runtime/assets/{financial-stress--ezsCpfR.js → financial-stress-BQJoviQU.js} +1 -1
- package/runtime/assets/{flappy-bird-DDe-IXt9.js → flappy-bird-DphWPPwp.js} +1 -1
- package/runtime/assets/{fundamentals-v8f81ZNS.js → fundamentals-D20TvQN_.js} +1 -1
- package/runtime/assets/funding-heatmap-DxH9NYjL.js +1 -0
- package/runtime/assets/{funding-rate-chart-CjDA4nj7.js → funding-rate-chart-BJ2jiIb4.js} +1 -1
- package/runtime/assets/fx-board-DXTpvuXF.js +1 -0
- package/runtime/assets/{heading-DMxdj9LK.js → heading-Cr4OaUt7.js} +1 -1
- package/runtime/assets/{holiday-calendar-DxB-fxG5.js → holiday-calendar-DHK0jzQc.js} +1 -1
- package/runtime/assets/{image-DLg33JpH.js → image-DVddTOkv.js} +1 -1
- package/runtime/assets/{index-DRTPEQtR.css → index-BqHx9BjX.css} +1 -1
- package/runtime/assets/index-DK7jWlTL.js +1 -0
- package/runtime/assets/index-DNLPQoS7.js +936 -0
- package/runtime/assets/inflation-pulse-NCyRMTQV.js +1 -0
- package/runtime/assets/{journal-log-BX5Z_yte.js → journal-log-C_W9xs_w.js} +1 -1
- package/runtime/assets/{journal-open-XFQGIRkw.js → journal-open-CVlbbryx.js} +1 -1
- package/runtime/assets/{journal-results-J1WCmyH2.js → journal-results-Bsk6nwKi.js} +1 -1
- package/runtime/assets/{journal-score-CKhBSfYY.js → journal-score-C6Aj9hWs.js} +1 -1
- package/runtime/assets/{journal-ui-Cogk2Wkt.js → journal-ui-DgGd2Foc.js} +1 -1
- package/runtime/assets/{labor-market-BV20Rl-4.js → labor-market-BvFWS_YO.js} +1 -1
- package/runtime/assets/{lightning-stats-h4fquhAg.js → lightning-stats-DyRwU2-5.js} +1 -1
- package/runtime/assets/{link-grid-a6NWj1Hu.js → link-grid-DxPMWWbo.js} +1 -1
- package/runtime/assets/live-tick-9Q3ubPF9.js +1 -0
- package/runtime/assets/liveline-bcaEuskN.js +1 -0
- package/runtime/assets/market-cap-treemap-LEDlsNnm.js +1 -0
- package/runtime/assets/{market-hours-6srwf0-r.js → market-hours-DlTlbyBC.js} +1 -1
- package/runtime/assets/{marquee-DDurk6bj.js → marquee-Ds-0N_-6.js} +1 -1
- package/runtime/assets/mini-line-chart-CHM5UBjJ.js +1 -0
- package/runtime/assets/{mining-pools-BPjCy4ZW.js → mining-pools-Dg55Tg1-.js} +1 -1
- package/runtime/assets/{mover-row-kQ9xt3Sp.js → mover-row-CunANlxa.js} +1 -1
- package/runtime/assets/{national-debt-DkOnmfd1.js → national-debt-G2V6-Lef.js} +1 -1
- package/runtime/assets/news-feed-RKSA0wsz.js +1 -0
- package/runtime/assets/note-CDlwRqhL.js +1 -0
- package/runtime/assets/{open-interest-fxHh_T-V.js → open-interest-Bs6LXeca.js} +1 -1
- package/runtime/assets/{options-iv-CDArg1Op.js → options-iv-BClv6xRB.js} +1 -1
- package/runtime/assets/{options-oi-strike-D_XIgUkk.js → options-oi-strike-DbhE95-7.js} +1 -1
- package/runtime/assets/{options-put-call-DG4RXjzD.js → options-put-call-C7tt191v.js} +1 -1
- package/runtime/assets/{pomodoro-B-Jk-51G.js → pomodoro-DpIO5pex.js} +1 -1
- package/runtime/assets/{portfolio-allocation-BJepNj1X.js → portfolio-allocation-DqSXNMYF.js} +1 -1
- package/runtime/assets/{portfolio-common-D5L06PNC.js → portfolio-common-CCGvaNdA.js} +1 -1
- package/runtime/assets/{portfolio-holdings-DSkAZALG.js → portfolio-holdings-Bxvf91Yo.js} +1 -1
- package/runtime/assets/portfolio-value-C6TFZyPZ.js +1 -0
- package/runtime/assets/price-chart-D4wf9Yju.js +1 -0
- package/runtime/assets/price-compare-B-mjV1jP.js +1 -0
- package/runtime/assets/price-liveline-K4S4XpSX.js +1 -0
- package/runtime/assets/{price-ticker-BXSeNYf9.js → price-ticker-BNDRtpS8.js} +1 -1
- package/runtime/assets/protocol-fees-treemap-vjLiXJ6x.js +1 -0
- package/runtime/assets/{protocol-tvl-chart-CEjUOIY5.js → protocol-tvl-chart-Dz8JtyuD.js} +1 -1
- package/runtime/assets/protocol-tvl-treemap-BrA0oXqV.js +1 -0
- package/runtime/assets/{quote-cehyepdm.js → quote-PcP5IX9V.js} +1 -1
- package/runtime/assets/{rates-board-Du4k0z1i.js → rates-board-BNAw2Iei.js} +1 -1
- package/runtime/assets/{returns-projector-DXnRFAES.js → returns-projector-BSTPBgMR.js} +1 -1
- package/runtime/assets/{risk-reward-DZWyCrbv.js → risk-reward-Dnp2JQr7.js} +1 -1
- package/runtime/assets/{rules-card-BXJjNTqj.js → rules-card-BNInaYxt.js} +1 -1
- package/runtime/assets/{session-progress-bA45Q3wk.js → session-progress-D1mhPWWM.js} +1 -1
- package/runtime/assets/{short-volume-C6cWknyR.js → short-volume-Dsm5jHLL.js} +1 -1
- package/runtime/assets/{snake-DYTa97hl.js → snake-CyxVfmbr.js} +1 -1
- package/runtime/assets/{spotify-embed-BaH6UHeG.js → spotify-embed-DcnZGDEz.js} +1 -1
- package/runtime/assets/{stopwatch-CS6n0bY9.js → stopwatch-ggIRtWfw.js} +1 -1
- package/runtime/assets/top-movers-CanKFls6.js +1 -0
- package/runtime/assets/{treasury-auctions-CGM8hAuU.js → treasury-auctions-BBHz7Mbe.js} +1 -1
- package/runtime/assets/treemap-leaf-DNIoJEK-.js +1 -0
- package/runtime/assets/tvl-treemap-D-LqgfI7.js +1 -0
- package/runtime/assets/{video-WCnvLwQ_.js → video-DqWW_aoH.js} +1 -1
- package/runtime/assets/{yield-curve-CpitTQ9L.js → yield-curve-Dpm8XDwi.js} +1 -1
- package/runtime/index.html +2 -2
- package/runtime/assets/dex-volume-chart-DDPf1YAN.js +0 -1
- package/runtime/assets/dex-volume-treemap-jZCgRREu.js +0 -1
- package/runtime/assets/editor-BlGZ_tel.js +0 -68
- package/runtime/assets/editor-CHAAJRb1.css +0 -1
- package/runtime/assets/funding-heatmap-DUoeFNGr.js +0 -1
- package/runtime/assets/fx-board-CmXYQZi4.js +0 -1
- package/runtime/assets/index-C_O7gp2F.js +0 -822
- package/runtime/assets/index-jnySFpSv.js +0 -1
- package/runtime/assets/inflation-pulse-gcw-84PM.js +0 -1
- package/runtime/assets/liveline-C5zt2WuS.js +0 -1
- package/runtime/assets/market-cap-treemap-CAi49oc_.js +0 -1
- package/runtime/assets/mini-line-chart-D-i1QqSe.js +0 -1
- package/runtime/assets/news-feed-CFWKKqrH.js +0 -1
- package/runtime/assets/note-_cGEXAru.js +0 -1
- package/runtime/assets/portfolio-value-BJw2csWV.js +0 -1
- package/runtime/assets/price-chart-khxI-9vJ.js +0 -1
- package/runtime/assets/price-compare-C-uEckke.js +0 -1
- package/runtime/assets/price-liveline-BDesEIbL.js +0 -1
- package/runtime/assets/protocol-fees-treemap-YtWbL1Kn.js +0 -1
- package/runtime/assets/protocol-tvl-treemap-b31QlpnS.js +0 -1
- package/runtime/assets/top-movers-CQNx9EH5.js +0 -1
- package/runtime/assets/treemap-leaf-DLQawrx4.js +0 -1
- package/runtime/assets/tvl-treemap-C3SUFzdj.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as b,j as a,R as lt}from"./react-qoZPGuNy.js";import{l as ot,s as U,h as dt,c as ut,e as mt,i as it,j as tt,d as pt,f as ft,k as ht,n as Z,q as gt,r as xt,t as vt,u as et,v as yt}from"./d3-xK4fOkBU.js";import{c as D}from"./utils-DaT-yT0k.js";import{c as wt,f as jt}from"./chart-utils-BYIZMM9J.js";const O={top:20,right:110,bottom:40,left:50},Q={sm:640},R={height:400,yAxisPadding:15,fontSize:12},nt={rectHeight:22,paddingX:4},kt={offsetX:80},Y={ticks:6,opacity:.05,color:"#FFFFFF"},$={xTicks:5,xSubTicks:36,yTicks:5,tickSize:10,subTickSize:6,tickColor:"#404146",domainColor:"#FFFFFF",domainOpacity:.05,textOpacity:.5},st=1e12,rt=1e9,K=1e6,X=t=>t==null?"-":t===0?"0":t<.001?St(t):t<1||t<10?parseFloat(t.toPrecision(4)).toString():t<K?t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:2}):t>st?`${(t/st).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}T`:t>rt?`${(t/rt).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}B`:t>K?`${(t/K).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}M`:t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}),bt=t=>{const s=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"];return t.toString().split("").map(e=>s[parseInt(e)]).join("")},St=t=>{const s=t<0,i=Math.abs(t).toFixed(20).replace(/\.?0+$/,""),l=i.match(/^0\.0+/);if(l){const u=l[0].length-2,c=i.slice(l[0].length).slice(0,3).replace(/0+$/,""),d=`0.${bt(u)}${c}`;return s?`-${d}`:d}return Number.isInteger(t)?String(t):String(Math.round(t*100)/100)},Nt=({width:t,height:s=R.height,yDomain:e,formatValue:i,containerRef:l,svgRef:u})=>{const[r,c]=b.useState(t);b.useLayoutEffect(()=>{const v=()=>{if(l.current){const y=l.current.getBoundingClientRect();c(y.width)}};return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[l]);const d=v=>{const y=U(u.current);if(!y.node())return O.left;const k=y.append("text").style("font-size",`${R.fontSize}px`).style("font-family","var(--font-dmsans)").style("font-weight","700").style("visibility","hidden"),[M,F]=v.domain(),A=[],L=5;for(let T=0;T<L;T++){const z=M+(F-M)/(L-1)*T;A.push(z)}let W=0;return A.forEach(T=>{var x;const z=i?i(T):X(T);k.text(z);const G=((x=k.node())==null?void 0:x.getBBox().width)||0;W=Math.max(W,G)}),k.remove(),Math.ceil(W)+R.yAxisPadding};let n=r??null;if(!n&&l.current){const v=l.current.getBoundingClientRect();v.width>0&&(n=v.width)}n=n||t||null;const m=s-O.top-O.bottom,w=ot().domain(e).range([m,0]),f=n&&n>0?d(w):null,j=n&&n>0&&f&&f>0?n-f-(n>640?O.right:20):null;return{width:n,height:s,innerWidth:j,innerHeight:m,dynamicLeftMargin:f}},Ct=t=>{const s=b.useMemo(()=>{const r=new Set;return t.forEach(c=>{c.seriesGroup&&r.add(c.seriesGroup)}),Array.from(r)},[t]),[e,i]=b.useState(()=>new Set(s));b.useEffect(()=>{i(r=>{const c=new Set(r);return s.forEach(d=>{c.has(d)||c.add(d)}),c})},[s]);const l=b.useMemo(()=>t.filter(r=>r.seriesGroup?e.has(r.seriesGroup):!0),[t,e]);return{seriesGroups:s,visibleGroups:e,filteredSeries:l,toggleGroup:r=>{i(c=>{const d=new Set(c);return d.has(r)?d.delete(r):d.add(r),d})}}},Mt=t=>({seriesColors:b.useMemo(()=>t.reduce((e,i)=>(e[i.id]=i.color,e),{}),[t]),isColorLoading:!1}),Tt=({group:t,isVisible:s,onClick:e})=>a.jsxs("button",{onClick:e,className:D("flex cursor-pointer items-center justify-center gap-2 text-xs font-semibold",s?"text-white":"text-white/30"),children:[a.jsx("div",{className:D("h-3 w-3",s?"bg-white/80":"bg-white/30")}),t]}),$t=Tt,Lt=(t,s)=>jt(t,s),at=(t,s)=>{const e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),l=parseInt(t.slice(5,7),16);return`rgba(${e}, ${i}, ${l}, ${s})`},Ft=t=>{const s=t.flatMap(e=>e.data);return wt(s)},Dt=t=>{const s=new Set;return t.forEach(e=>{e.data.forEach(i=>s.add(i.date))}),Array.from(s).sort()},Et=(t,s)=>t.map(e=>{const i={};return s.forEach(l=>{const u=l.data.find(r=>r.date===e);i[l.id]=u?u.value:0}),{date:new Date(e),values:i}}),zt=(t,s,e)=>{const i=s.invert(t),l=dt(d=>d.date).left,u=l(e,i,1),r=e[u-1],c=e[u];return!r||!c?null:i.getTime()-r.date.getTime()>c.date.getTime()-i.getTime()?c:r},J=(t,s)=>{const e=s===t,i=s!==null&&s!==t;return e?1:i?.3:1},At=({legendItems:t,containerWidth:s,hoveredSeriesId:e,onSeriesHover:i,onLabelClick:l,unitPrefix:u,unitSuffix:r,legendRef:c})=>s&&s>Q.sm?a.jsx("div",{className:D("pointer-events-none absolute left-0 top-0 w-full flex-wrap items-center gap-2 max-sm:overflow-hidden"),children:t.map(n=>a.jsx("div",{className:D("pointer-events-auto absolute flex h-[22px] w-fit cursor-pointer items-center justify-center gap-1 rounded-[11px] px-[5px] py-1 transition-opacity duration-200 ease-out"),style:{left:`${n.left}px`,top:`${n.top}px`,backgroundColor:at(n.color,.3),opacity:J(n.id,e)},onClick:()=>l==null?void 0:l(n.id),onPointerEnter:m=>{m.preventDefault(),m.stopPropagation(),i(n.id)},onPointerLeave:m=>{m.preventDefault(),m.stopPropagation(),i(null)},children:a.jsxs("div",{className:"relative flex select-none items-center justify-center gap-1",children:[n.seriesData.iconImageUrl&&a.jsx("div",{className:"size-4 rounded-full",children:a.jsx("img",{src:n.seriesData.iconImageUrl,width:16,height:16,alt:n.seriesData.name,className:"size-4 rounded-full",draggable:!1})}),a.jsxs("div",{className:"text-normal relative flex items-center justify-center whitespace-nowrap text-[11px] font-semibold leading-4",children:[a.jsx("span",{className:D("mr-1 max-w-12 truncate",n.seriesData.iconImageUrl?"max-w-10":"max-w-12"),children:n.displayText}),u&&a.jsx("span",{className:"mr-0.5 [&_svg]:!text-white/70",children:u}),a.jsx("span",{children:n.value}),r&&a.jsx("span",{children:r})]})]})},n.id))}):a.jsx("div",{className:D("pointer-events-none left-0 top-0 flex w-full flex-wrap items-center gap-1 max-sm:overflow-hidden"),ref:c,children:t.map(n=>a.jsx("div",{className:D("pointer-events-auto flex h-[22px] w-fit min-w-[112px] cursor-pointer items-center gap-1 rounded-[11px] px-[5px] py-1 transition-opacity duration-200 ease-out"),style:{backgroundColor:at(n.color,.3),opacity:J(n.id,e)},onClick:()=>l==null?void 0:l(n.id),onPointerEnter:m=>{m.preventDefault(),m.stopPropagation(),i(n.id)},onPointerLeave:m=>{m.preventDefault(),m.stopPropagation(),i(null)},children:a.jsxs("div",{className:"relative flex select-none items-center gap-1",children:[n.seriesData.iconImageUrl&&a.jsx("div",{className:"size-4 rounded-full",children:a.jsx("img",{src:n.seriesData.iconImageUrl,width:16,height:16,alt:n.seriesData.name,className:"size-4 rounded-full",draggable:!1})}),a.jsxs("div",{className:"text-normal relative flex items-center whitespace-nowrap text-[11px] font-semibold leading-none",children:[a.jsx("span",{className:D("mr-1 max-w-12 truncate",n.seriesData.iconImageUrl?"max-w-10":"max-w-12"),children:n.displayText}),a.jsx("span",{"data-legend-value":n.id,children:n.value}),r&&a.jsx("span",{children:r})]})]})},n.id))}),It=At,Gt=({containerWidth:t,tooltipRef:s,series:e,seriesColors:i,unitPrefix:l,unitSuffix:u})=>t&&t>Q.sm?a.jsx("div",{ref:s,className:"pointer-events-none absolute left-0 top-0 z-50 rounded-md bg-slate-700 px-6 py-3 text-xs text-white opacity-0 transition-opacity duration-300",children:a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsx("div",{className:"body-md font-semibold text-white/50","data-tooltip-date":!0}),a.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5",children:e.map(c=>a.jsxs(lt.Fragment,{children:[a.jsxs("span",{className:"text-soft flex max-w-[126px] items-center gap-1",children:[a.jsx("div",{className:"h-full w-0.5 rounded-full",style:{backgroundColor:i[c.id]}}),c.iconImageUrl&&a.jsx("img",{src:c.iconImageUrl,width:20,height:20,alt:c.name,className:"rounded-full"}),a.jsx("span",{className:"text-normal body-sm font-bold capitalize",children:c.name})]}),a.jsxs("div",{className:"font-dmsans text-normal flex flex-row items-center font-bold",children:[a.jsx("div",{className:"mr-1",children:l}),a.jsx("span",{className:"text-normal text-right text-xs font-bold","data-tooltip-value":c.id}),u]})]},c.id))})]})}):a.jsx("div",{ref:s,className:"pointer-events-none absolute left-0 top-0 z-50 min-w-[130px] rounded-md bg-slate-700 px-2 py-1 text-xs text-white opacity-0 transition-opacity duration-300 ease-out",children:a.jsx("div",{className:"flex flex-col items-center justify-center gap-3",children:a.jsx("div",{className:"caption font-semibold text-white/50","data-tooltip-date":!0})})}),Ht=Gt,Ot=(t,s,e,i)=>{const l=ut().domain(mt(t,r=>r.date)).range([0,e]),u=ot().domain(s).range([i,0]);return{xScale:l,yScale:u}},Wt=(t,s,e)=>{const[i,l]=s.domain(),u=[];for(let r=0;r<Y.ticks;r++){const c=i+(l-i)/(Y.ticks-1)*r;u.push(c)}t.append("g").attr("class","grid").call(it(s).tickValues(u).tickSize(-e).tickFormat(()=>"")).call(r=>r.select(".domain").remove()).selectAll("line").attr("stroke",Y.color).attr("stroke-opacity",Y.opacity)},Bt=(t,s,e,i,l,u,r)=>{const c=r!==void 0?Math.max(2,Math.min($.xTicks,Math.floor(r/70))):$.xTicks,d=t.append("g").attr("transform",`translate(0,${i})`).call(tt(s).ticks(c).tickSize($.tickSize).tickFormat(y=>y instanceof Date?Lt(y.toISOString(),l):String(y))).style("font-size","12px").style("font-weight","700").style("font-family","var(--font-manrope)");d.select(".domain").attr("stroke",$.domainColor).attr("stroke-width",1).attr("stroke-opacity",$.domainOpacity),d.selectAll(".tick line").attr("stroke",$.tickColor).attr("transform","translate(0, 4)"),d.selectAll(".tick text").attr("dy","1.2em").style("fill",$.domainColor).style("opacity",$.textOpacity);const n=t.append("g").attr("transform",`translate(0,${i})`).call(tt(s).ticks($.xSubTicks).tickSize($.subTickSize).tickFormat(()=>""));n.select(".domain").remove(),n.selectAll(".tick line").attr("stroke",$.tickColor).attr("transform","translate(0, 4)");const[m,w]=e.domain(),f=[],j=5;for(let y=0;y<j;y++){const k=m+(w-m)/(j-1)*y;f.push(k)}const v=t.append("g").call(it(e).tickValues(f).tickSize($.yTicks).tickFormat(y=>u?u(y):X(y))).style("font-size","12px").style("color",$.domainColor).style("font-family","var(--font-dmsans)").style("opacity",$.textOpacity).style("font-weight","700");v.select(".domain").attr("stroke","none"),v.selectAll(".tick line").attr("stroke","none")},Ut=(t,s,e,i,l)=>{const u=pt().x(r=>i(r.date)).y(r=>l(r.value)).curve(ft);s.forEach(r=>{const c=r.data.map(w=>({date:new Date(w.date),value:w.value})),d=e[r.id],n=t.append("path").datum(c).attr("fill","none").attr("stroke",d).attr("stroke-width",1.2).attr("opacity",1).attr("data-series-id",r.id).attr("d",u),m=n.node().getTotalLength();n.attr("stroke-dasharray",m+" "+m).attr("stroke-dashoffset",m),n.transition("draw").duration(1200).ease(ht).attr("stroke-dashoffset",0).on("end",function(){U(this).attr("stroke-dasharray",null)})})},Pt=({g:t,containerWidth:s,innerWidth:e,innerHeight:i,xScale:l,yScale:u,combinedData:r,filteredSeries:c,tooltipRef:d,containerRef:n,legendRef:m,highestValue:w,formatValue:f})=>{var V;const j=t.append("line").attr("class","hover-line").attr("stroke","white").attr("stroke-width",1).attr("stroke-dasharray","4,4").attr("stroke-opacity",.6).attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",i).attr("opacity",0),v=t.append("g").attr("class","hover-dots");let y=!0,k=((V=n.current)==null?void 0:V.getBoundingClientRect().width)||e,M=0,F=0;const A=o=>{y?(j.attr("x1",o-.75),j.attr("x2",o-.75),j.transition().duration(150).ease(Z).attr("opacity",1),y=!1):j.transition().duration(100).ease(et).attr("x1",o-.75).attr("x2",o-.75).attr("opacity",1)},L=(o,p)=>{const S=v.selectAll("g.hover-circle-group").data(c.filter(g=>o.values[g.id]!==void 0));S.exit().remove();const N=S.enter().append("g").attr("class","hover-circle-group").style("opacity",0);N.append("circle").attr("class","hover-dot-glow").attr("r",9).attr("fill","white").attr("fill-opacity",.18),N.append("circle").attr("class","hover-dot-core").attr("r",4.5).attr("fill","white").attr("stroke","rgba(10, 12, 20, 0.55)").attr("stroke-width",1.5),N.attr("transform",g=>{const C=o.values[g.id];return`translate(${p}, ${u(C)}) scale(0.5)`}).style("opacity",1).transition().duration(200).ease(yt).attr("transform",g=>{const C=o.values[g.id];return`translate(${p}, ${u(C)}) scale(1)`}),S.transition().duration(100).ease(et).attr("transform",g=>{const C=o.values[g.id];return`translate(${p}, ${u(C)})`})},W=(o,p)=>{d.current&&M===0&&F===0&&(M=d.current.getBoundingClientRect().height,F=d.current.getBoundingClientRect().width);let h=o+kt.offsetX;return h+F>k&&(h=o-F),h<0&&(h=0),{x:h,y:p-M/2+20}},T=o=>{let h=o-65+O.left;const S=u(w);return o+130/2>k-O.left&&(h=k-130),h<0&&(h=0),{x:h,y:S}},z=(o,p)=>{if(!d.current)return;const h=d.current.querySelector("[data-tooltip-date]");h&&h.textContent!==o&&(h.textContent=o),c.forEach(S=>{var E;const N=p[S.id];if(N===void 0)return;const g=(E=d.current)==null?void 0:E.querySelector(`[data-tooltip-value="${S.id}"]`),C=f?f(N):X(N);g&&g.textContent!==C&&(g.textContent=C)})},G=o=>{if(!d.current)return;const p=d.current.querySelector("[data-tooltip-date]");p&&p.textContent!==o&&(p.textContent=o)},x=o=>{m.current&&c.forEach(p=>{var N;const h=o[p.id];if(h===void 0)return;const S=(N=m.current)==null?void 0:N.querySelector(`[data-legend-value="${p.id}"]`);if(S){const g=f?f(h):X(h);S.textContent=g}})},P=(o,p)=>{d.current&&(d.current.style.opacity="1",d.current.style.transform=`translate3d(${o}px, ${p}px, 0)`)},B=o=>{const h=window.TouchEvent&&o instanceof TouchEvent?o.touches[0]:o,[S,N]=xt(h,t.node()),g=zt(S,l,r);if(!g)return;const C=l(g.date),E=vt("%b %d, %Y - %H:%M")(g.date);if(s>Q.sm){const H=W(S,N);P(H.x,H.y),z(E,g.values)}else{const H=T(S);P(H.x,H.y),G(E),x(g.values)}A(C),L(g,C)},_=()=>{j.transition().duration(150).ease(Z).attr("opacity",0),y=!0,d.current&&(d.current.style.opacity="0"),v.selectAll("g").transition().duration(150).ease(gt).style("opacity",0).attr("transform",(o,p,h)=>{const N=U(h[p]).attr("transform"),g=N.match(/translate\(([^,]+),\s*([^)]+)\)/);if(g){const C=parseFloat(g[1]),E=parseFloat(g[2]);return`translate(${C}, ${E}) scale(0.3)`}return N}).remove()},I=new ResizeObserver(()=>{n.current&&(k=n.current.getBoundingClientRect().width)});return n.current&&I.observe(n.current),{onMouseMove:B,onMouseLeave:_,destroy:()=>I.disconnect()}},Xt=(t,s,{xScale:e,yScale:i},l,u,r)=>{const c=nt.rectHeight,d=nt.paddingX,n=[];return t.forEach(w=>{const f=w.data.map(j=>({date:new Date(j.date),value:j.value}));if(f.length>0){const j=f[f.length-1],v=e(j.date)+8,y=i(j.value),k=v-d;let M=y-c/2;const F=n.findLast(A=>M+c>=A.top&&M<=A.bottom);F&&(M=F.top+c),n.push({top:M,bottom:M+c,id:w.id,left:k})}}),n.reverse().reduce((w,f)=>{const j=w.find(v=>f.top+c>=v.top&&f.top<=v.bottom&&v.id!==f.id);return j&&(f.top=j.top-c),[f,...w]},[]),n.map(w=>{var y,k;const f=t.find(M=>M.id===w.id);if(!f)return null;const j=s[w.id],v=r?r(((y=f.data.at(-1))==null?void 0:y.value)??0):X(((k=f.data.at(-1))==null?void 0:k.value)??0);return{id:w.id,left:w.left+l,top:w.top+u,seriesData:f,color:j,value:v,displayText:f.name}}).filter(Boolean)},Vt=({className:t})=>a.jsx("div",{className:D("relative size-8",t),children:a.jsx("div",{className:"absolute left-1/2 top-1/2 flex size-12 -translate-x-1/2 -translate-y-1/2 items-center justify-center",children:a.jsxs("div",{className:"relative h-6 w-full",children:[Array.from({length:5}).map((s,e)=>a.jsx("div",{className:"absolute size-1.5 rounded-full will-change-transform",style:{left:`${e/6*100}%`,animation:`dnaStrand1Move 2s infinite ease-in-out ${-e*.2}s, dnaStrand1Scale 2s infinite ease-in-out ${-e*.2}s, dnaStrand1Color 2s infinite ease-in-out ${-e*.2}s`}},`strand1-${e}`)),Array.from({length:5}).map((s,e)=>a.jsx("div",{className:"absolute size-1.5 rounded-full",style:{left:`${e/6*100}%`,animation:`dnaStrand2Move 2s infinite ease-in-out ${-e*.2}s, dnaStrand2Scale 2s infinite ease-in-out ${-e*.2}s, dnaStrand2Color 2s infinite ease-in-out ${-e*.2}s`}},`strand2-${e}`))]})})}),Yt=({series:t,width:s,height:e=400,timeframe:i,className:l,isLoading:u=!1,formatValue:r,unitPrefix:c,unitSuffix:d,onLabelClick:n})=>{const m=b.useRef(null),w=b.useRef(null),f=b.useRef(null),j=b.useRef(null),[v,y]=b.useState(null),k=b.useMemo(()=>[...t].sort((o,p)=>{const h=o.data.length>0?o.data[o.data.length-1].value:0;return(p.data.length>0?p.data[p.data.length-1].value:0)-h}),[t]),M=b.useCallback(o=>{y(o)},[]),{seriesGroups:F,visibleGroups:A,filteredSeries:L,toggleGroup:W}=Ct(k),{seriesColors:T,isColorLoading:z}=Mt(k),G=b.useMemo(()=>Ft(k),[k]),x=Nt({width:s,height:e,yDomain:G,formatValue:r,containerRef:w,svgRef:m}),P=b.useMemo(()=>Dt(k),[k]),B=b.useMemo(()=>Et(P,k),[P,k]),_=b.useMemo(()=>Math.max(...L.map(o=>o.data.map(p=>p.value)).flat().filter(o=>o!==void 0)),[L]),I=b.useMemo(()=>!x.innerWidth||!x.innerHeight?null:Ot(B,G,x.innerWidth,x.innerHeight),[B,G,x.innerWidth,x.innerHeight]),V=b.useMemo(()=>!I||!x.dynamicLeftMargin?[]:Xt(L,T,I,x.dynamicLeftMargin,O.top,r),[I,x.dynamicLeftMargin,L,T,r]);return b.useEffect(()=>{if(!m.current||t.length===0||z||!I||x.width===null||x.innerWidth===null||x.dynamicLeftMargin===null)return;const o=U(m.current),{innerWidth:p,innerHeight:h,dynamicLeftMargin:S}=x;o.selectAll("*").remove();const{xScale:N,yScale:g}=I,C=o.append("g").attr("transform",`translate(${S},${O.top})`);Wt(C,g,p),Bt(C,N,g,h,i,r,p),Ut(C,L,T,N,g);const{onMouseMove:E,onMouseLeave:H,destroy:ct}=Pt({g:C,containerWidth:x.width,innerWidth:p,innerHeight:x.innerHeight,xScale:N,yScale:g,combinedData:B,filteredSeries:L,tooltipRef:f,containerRef:w,legendRef:j,highestValue:_,formatValue:r}),q=C.append("rect").attr("class","overlay").attr("width",p).attr("height",h).attr("fill","transparent").style("cursor","crosshair").style("pointer-events","all");return q.on("mousemove",E).on("mouseleave",H).on("touchstart",E).on("touchmove",E).on("touchend",H),q.raise(),()=>{ct(),q.on("mousemove",null).on("mouseleave",null).on("touchstart",null).on("touchmove",null).on("touchend",null),o.selectAll("*").interrupt(),o.selectAll("*").remove()}},[B,G,t.length,L,I,x.innerWidth,x.innerHeight,x.dynamicLeftMargin,e,i,z,T,r]),b.useEffect(()=>{if(!m.current||t.length===0||z)return;U(m.current).select("g").selectAll("path[data-series-id]").transition().duration(200).ease(Z).attr("opacity",function(){const h=U(this).attr("data-series-id");return J(h,v)})},[v,t,T,z]),!u&&t.length===0?a.jsx("div",{className:D("relative w-full",l),children:a.jsx("div",{className:D("mx-auto flex w-full items-center justify-center text-sm text-gray-400"),style:{height:e},children:"No data available"})}):a.jsx("div",{ref:w,className:D("relative w-full",l),style:{width:s,minHeight:e},children:u?a.jsx(Vt,{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}):a.jsxs(a.Fragment,{children:[F.length>0&&a.jsx("div",{className:"mb-3 flex flex-wrap items-center justify-center gap-2",children:F.map(o=>a.jsx($t,{group:o,isVisible:A.has(o),onClick:()=>W(o)},o))}),x.width!==null&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"relative z-20",children:a.jsx(It,{legendRef:j,legendItems:V,containerWidth:x.width,hoveredSeriesId:v,onSeriesHover:M,onLabelClick:n,unitPrefix:c,unitSuffix:d})}),a.jsxs("div",{className:"relative select-none",children:[a.jsx("svg",{ref:m,width:x.width,height:e,className:"relative z-0",style:{maxWidth:"100%",width:"100%",display:"block",overflow:"visible"}}),a.jsx("div",{className:"z-10",children:a.jsx(Ht,{containerWidth:x.width,tooltipRef:f,series:L,seriesColors:T,unitPrefix:c,unitSuffix:d})})]})]})]})})},Zt=Yt;export{Zt as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as f,j as t}from"./react-qoZPGuNy.js";import{a as p,c as j}from"./format-CfAcS4D8.js";import{f as w,W as y,L as P}from"./index-C_O7gp2F.js";import{F as v}from"./ui-Bq3RQsdJ.js";import{M as S}from"./mini-line-chart-D-i1QqSe.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";y.schema;const F="CUUR0000SA0";function g(a,o){return!o||o<=0?null:(a/o-1)*100}function I({config:a}){const x=new Date().getUTCFullYear(),C=x-2,{series:e,isLoading:N}=P(F,C,x),n=f.useMemo(()=>((e==null?void 0:e.points)??[]).slice(-a.months),[a.months,e==null?void 0:e.points]),s=n.at(-1),r=n.at(-2),c=s?n.find(i=>{const h=new Date(i.time),u=new Date(s.time);return h.getUTCFullYear()===u.getUTCFullYear()-1&&h.getUTCMonth()===u.getUTCMonth()}):void 0,b=f.useMemo(()=>n.map(i=>({date:new Date(i.time).toISOString(),value:i.value})),[n]);if(N)return t.jsx(v,{loading:!0,children:"loading CPI…"});if(!e||!s)return t.jsx(v,{children:"no CPI data yet"});const l=g(s.value,r==null?void 0:r.value),d=g(s.value,c==null?void 0:c.value),m=j(d??l??0);return t.jsxs("div",{className:"flex h-full flex-col justify-center gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("div",{className:"caption text-soft uppercase",children:"BLS CPI-U"}),t.jsx("div",{className:"body-sm text-normal",children:s.date})]}),t.jsx("div",{className:"caption text-soft text-right",children:"monthly"})]}),t.jsxs("div",{className:"flex items-end justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("div",{className:"metric-xl leading-none",style:{color:m,textShadow:`0 0 24px ${m}44`},children:d!==null?p(d):"--"}),t.jsx("div",{className:"caption text-soft mt-1",children:"year over year"})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("div",{className:"caption text-soft",children:"index"}),t.jsx("div",{className:"body-md text-strong font-bold tabular-nums",children:s.value.toFixed(3)}),t.jsx("div",{className:"caption text-soft mt-2",children:"month over month"}),t.jsx("div",{className:"body-md font-bold tabular-nums",style:{color:j(l??0)},children:l!==null?p(l):"--"})]})]}),t.jsx(S,{data:b,width:210,height:46,color:m}),t.jsxs("div",{className:"caption text-soft",children:[e.label," · ",n.length," monthly observations"]})]})}const _=w({...y,component:I});export{_ as inflationPulseFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as w,j as ce}from"./react-qoZPGuNy.js";function rn(e){const r=e.match(/^#([0-9a-f]{3,8})$/i);if(r){let t=r[1];return t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return n?[+n[1],+n[2],+n[3]]:[128,128,128]}function jt(e,r,n,t){return`rgba(${e}, ${r}, ${n}, ${t})`}function on(e,r){const[n,t,l]=rn(e),o=r==="dark";return{line:e,lineWidth:2,fillTop:jt(n,t,l,o?.12:.08),fillBottom:jt(n,t,l,0),gridLine:o?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.06)",gridLabel:o?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.35)",dotUp:"#22c55e",dotDown:"#ef4444",dotFlat:e,glowUp:"rgba(34, 197, 94, 0.18)",glowDown:"rgba(239, 68, 68, 0.18)",glowFlat:jt(n,t,l,.12),badgeOuterBg:o?"rgba(40, 40, 40, 0.95)":"rgba(255, 255, 255, 0.95)",badgeOuterShadow:o?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.15)",badgeBg:e,badgeText:"#ffffff",dashLine:jt(n,t,l,.4),refLine:o?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)",refLabel:o?"rgba(255, 255, 255, 0.45)":"rgba(0, 0, 0, 0.4)",timeLabel:o?"rgba(255, 255, 255, 0.35)":"rgba(0, 0, 0, 0.3)",crosshairLine:o?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.12)",tooltipBg:o?"rgba(30, 30, 30, 0.95)":"rgba(255, 255, 255, 0.95)",tooltipText:o?"#e5e5e5":"#1a1a1a",tooltipBorder:o?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)",bgRgb:o?[10,10,10]:[255,255,255],labelFont:'11px "SF Mono", Menlo, Monaco, "Cascadia Code", monospace',valueFont:'600 11px "SF Mono", Menlo, monospace',badgeFont:'500 11px "SF Mono", Menlo, monospace'}}var Dt=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#f97316"];function gr(e,r){const n=new Map;for(let t=0;t<e.length;t++){const l=e[t],o=l.color||Dt[t%Dt.length];n.set(l.id,on(o,r))}return n}function ee(e,r,n,t=16.67){const l=1-Math.pow(1-n,t/16.67);return e+(r-e)*l}function Jt(e,r,n,t){let l=1/0,o=-1/0;for(const s of e)s.value<l&&(l=s.value),s.value>o&&(o=s.value);r<l&&(l=r),r>o&&(o=r),n!==void 0&&(n<l&&(l=n),n>o&&(o=n));const i=o-l,c=t?.01:.12,a=i*(t?.02:.1)||(t?.04:.4);if(i<a){const s=(l+o)/2;l=s-a/2,o=s+a/2}else{const s=i*c;l-=s,o+=s}return{min:l,max:o}}function Bn(e,r=20){if(e.length<5)return"flat";const n=Math.max(0,e.length-r);let t=1/0,l=-1/0;for(let f=n;f<e.length;f++){const g=e[f].value;g<t&&(t=g),g>l&&(l=g)}const o=l-t;if(o===0)return"flat";const i=Math.max(n,e.length-5),c=e[i].value,s=e[e.length-1].value-c,h=o*.12;return s>h?"up":s<-h?"down":"flat"}function or(e,r){if(e.length===0)return null;if(r<=e[0].time)return e[0].value;if(r>=e[e.length-1].time)return e[e.length-1].value;let n=0,t=e.length-1;for(;t-n>1;){const a=n+t>>1;e[a].time<=r?n=a:t=a}const l=e[n],o=e[t],i=o.time-l.time;if(i===0)return l.value;const c=(r-l.time)/i;return l.value+(o.value-l.value)*c}function mr(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,3)}function br(e,r,n,t){e.setTransform(r,0,0,r,0,0)}function vr(e,r,n,t){if(t>0){const i=t*r;if(i>=n*.5&&i<=n*4)return t}const l=[[2,2.5,2],[2,2,2.5],[2.5,2,2]];let o=1/0;for(const i of l){let c=Math.pow(10,Math.ceil(Math.log10(e))),a=0;for(;c/i[a%3]*r>=n;)c/=i[a%3],a++;c<o&&(o=c)}return o===1/0?e/5:o}function pr(e,r){const n=e/r;return Math.abs(n-Math.round(n))<.01}var Fn=.18,Mr=.12;function sn(e,r,n,t,l,o){const{w:i,h:c,pad:a,valRange:s,minVal:h,maxVal:f,toY:g}=r,M=c-a.top-a.bottom;if(M<=0||s<=0)return;const m=M/s,v=vr(s,m,36,l.interval);l.interval=v;const S=v/2,R=S*m,y=R<40?0:R>=60?1:(R-40)/20,T=32,C=p=>{const A=Math.min(p-a.top,c-a.bottom-p);return A>=T?1:A<=0?0:A/T},P=new Map,E=Math.ceil(h/S)*S;for(let p=E;p<=f;p+=S){const A=g(p);if(A<a.top-2||A>c-a.bottom+2)continue;const k=(pr(p,v)?1:y)*C(A),b=Math.round(p*1e6);P.set(b,k)}for(const[p,A]of l.labels){const W=P.get(p)??0,k=W>=A?Fn:Mr;let b=ee(A,W,k,o);Math.abs(b-W)<.02&&(b=W),b<.01&&W===0?l.labels.delete(p):l.labels.set(p,b)}for(const[p,A]of P)l.labels.has(p)||l.labels.set(p,A*Fn);const I=e.globalAlpha;e.setLineDash([1,3]),e.lineWidth=1,e.font=n.labelFont,e.textAlign="left";for(const[p,A]of l.labels){if(A<.02)continue;const W=p/1e6,k=g(W);k<a.top-10||k>c-a.bottom+10||(e.save(),e.globalAlpha=I*A,e.strokeStyle=n.gridLine,e.beginPath(),e.moveTo(a.left,k),e.lineTo(i-a.right,k),e.stroke(),e.fillStyle=n.gridLabel,e.fillText(t(W),i-a.right+8,k+4),e.restore())}e.setLineDash([])}function Zt(e,r){if(r.length<2)return;if(r.length===2){e.lineTo(r[1][0],r[1][1]);return}const n=r.length,t=new Array(n-1),l=new Array(n-1);for(let i=0;i<n-1;i++)l[i]=r[i+1][0]-r[i][0],t[i]=l[i]===0?0:(r[i+1][1]-r[i][1])/l[i];const o=new Array(n);o[0]=t[0],o[n-1]=t[n-2];for(let i=1;i<n-1;i++)t[i-1]*t[i]<=0?o[i]=0:o[i]=(t[i-1]+t[i])/2;for(let i=0;i<n-1;i++)if(t[i]===0)o[i]=0,o[i+1]=0;else{const c=o[i]/t[i],a=o[i+1]/t[i],s=c*c+a*a;if(s>9){const h=3/Math.sqrt(s);o[i]=h*c*t[i],o[i+1]=h*a*t[i]}}for(let i=0;i<n-1;i++){const c=l[i];e.bezierCurveTo(r[i][0]+c/3,r[i][1]+o[i]*c/3,r[i+1][0]-c/3,r[i+1][1]-o[i+1]*c/3,r[i+1][0],r[i+1][1])}}var cn=.07,un=.001;function fn(e,r,n,t){return r+n*(Math.sin(e*9.4+t)*.55+Math.sin(e*15.7+t*1.3)*.3+Math.sin(e*4.2+t*.7)*.15)}function hn(e){return .22+.08*Math.sin(e/1200*Math.PI)}function $n(e){const r=e.match(/^#([0-9a-f]{3,8})$/i);if(r){let l=r[1];return l.length===3&&(l=l[0]+l[0]+l[1]+l[1]+l[2]+l[2]),[parseInt(l.slice(0,2),16),parseInt(l.slice(2,4),16),parseInt(l.slice(4,6),16),1]}const n=e.match(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)/);if(n)return[+n[1],+n[2],+n[3],+n[4]];const t=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3],1]:[128,128,128,1]}function Sr(e,r,n){if(n<=0)return e;if(n>=1)return r;const[t,l,o,i]=$n(e),[c,a,s,h]=$n(r),f=Math.round(t+(c-t)*n),g=Math.round(l+(a-l)*n),M=Math.round(o+(s-o)*n),m=i+(h-i)*n;return m>=.995?`rgb(${f},${g},${M})`:`rgba(${f},${g},${M},${m.toFixed(3)})`}function Qt(e,r,n,t,l,o=1,i=1,c){const{h:a,pad:s}=r,h=e.globalAlpha;if(l&&i>.01){e.globalAlpha=h*i;const f=e.createLinearGradient(0,s.top,0,a-s.bottom);f.addColorStop(0,n.fillTop),f.addColorStop(1,n.fillBottom),e.beginPath(),e.moveTo(t[0][0],a-s.bottom),e.lineTo(t[0][0],t[0][1]),Zt(e,t),e.lineTo(t[t.length-1][0],a-s.bottom),e.closePath(),e.fillStyle=f,e.fill()}e.globalAlpha=h*o,e.beginPath(),e.moveTo(t[0][0],t[0][1]),Zt(e,t),e.strokeStyle=c??n.line,e.lineWidth=n.lineWidth,e.lineJoin="round",e.lineCap="round",e.stroke(),e.globalAlpha=h}function dn(e,r,n,t,l,o,i,c,a=0,s=1,h=0,f=1,g=!1,M=1){const{h:m,pad:v,toX:S,toY:R,chartW:y,chartH:T}=r,C=e.globalAlpha,P=v.top,E=m-v.bottom,I=ue=>Math.max(P,Math.min(E,ue)),p=v.top+T/2,A=T*cn,W=h*un,k=s<1?(ue,ye)=>{const ve=Math.max(0,Math.min(1,(ye-v.left)/y)),Pe=Math.abs(ve-.5)*2,Re=Math.max(0,Math.min(1,(s-Pe*.4)/.6)),Te=fn(ve,p,A,W);return Te+(ue-Te)*Re}:(ue,ye)=>ue,b=t.map((ue,ye)=>{const ve=S(ue.time),Pe=ye===t.length-1?k(I(R(l)),ve):k(I(R(ue.value)),ve);return[ve,Pe]}),d=S(o),L=v.left+y,K=s<1?d+(L-d)*(1-s):d;if(b.push([K,k(I(R(l)),K)]),b.length<2)return;let Q=1,q=M;if(s<1){const ue=hn(h);Q=ue+(1-ue)*s,q=s*M}const oe=Math.min(1,s*3)*f,x=s<1||f<1?Sr(n.gridLabel,n.line,oe):void 0,ze=c!==null;if(e.save(),e.beginPath(),e.rect(v.left-1,v.top,y+2,T),e.clip(),ze?(e.save(),e.beginPath(),e.rect(0,0,c,m),e.clip(),Qt(e,r,n,b,i,Q,q,x),e.restore(),e.save(),e.beginPath(),e.rect(c,0,r.w-c,m),e.clip(),e.globalAlpha=C*(1-a*.6),Qt(e,r,n,b,i,Q,q,x),e.restore()):Qt(e,r,n,b,i,Q,q,x),e.restore(),!g){const ue=Math.max(v.top,Math.min(m-v.bottom,R(l))),ye=s<1?p+(ue-p)*s:ue;e.setLineDash([4,4]),e.strokeStyle=n.dashLine,e.lineWidth=1;const ve=ze?1-a*.2:1;e.globalAlpha=C*(s<1?ve*s:ve),e.beginPath(),e.moveTo(v.left,ye),e.lineTo(r.w-v.right,ye),e.stroke(),e.setLineDash([])}e.globalAlpha=C;const Ne=b[b.length-1];return Ne[1]=Math.max(10,Math.min(m-10,Ne[1])),b}var lr=1500,ir=900;function wr(e,r,n){const t=Math.round(e[0]+(r[0]-e[0])*n),l=Math.round(e[1]+(r[1]-e[1])*n),o=Math.round(e[2]+(r[2]-e[2])*n);return`rgb(${t},${l},${o})`}function ar(e,r,n,t,l=!0,o=0,i=performance.now()){const c=e.globalAlpha,a=o*.7;if(l&&a<.3){const h=i%lr/ir;if(h<1){const f=9+h*12,g=.35*(1-h)*(1-a*3);e.beginPath(),e.arc(r,n,f,0,Math.PI*2),e.strokeStyle=t.line,e.lineWidth=1.5,e.globalAlpha=c*g,e.stroke()}}const s=rn(t.badgeOuterBg);if(e.save(),e.globalAlpha=c,e.shadowColor=t.badgeOuterShadow,e.shadowBlur=6*(1-a),e.shadowOffsetY=1,e.beginPath(),e.arc(r,n,6.5,0,Math.PI*2),e.fillStyle=t.badgeOuterBg,e.fill(),e.restore(),e.globalAlpha=c,e.beginPath(),e.arc(r,n,3.5,0,Math.PI*2),a>.01){const h=rn(t.line);e.fillStyle=wr(h,s,a)}else e.fillStyle=t.line;e.fill()}function Rr(e,r,n,t,l=!0,o=performance.now(),i=3){const c=e.globalAlpha;if(l){const a=o%lr/ir;if(a<1){const s=9+a*10,h=.3*(1-a);e.beginPath(),e.arc(r,n,s,0,Math.PI*2),e.strokeStyle=t,e.lineWidth=1.5,e.globalAlpha=c*h,e.stroke()}}e.globalAlpha=c,e.beginPath(),e.arc(r,n,i,0,Math.PI*2),e.fillStyle=t,e.fill()}function Tr(e,r,n,t,l=3){e.beginPath(),e.arc(r,n,l,0,Math.PI*2),e.fillStyle=t,e.fill()}function Ar(e,r,n,t,l,o,i,c=performance.now()){const a=e.globalAlpha,s=t==="up"?1:0,h=t==="down"?1:0,f=o.down<.02,g=o.up<.02;o.up=ee(o.up,f?s:0,s>o.up?.08:.04,i),o.down=ee(o.down,g?h:0,h>o.down?.08:.04,i),o.up<.01&&(o.up=0),o.down<.01&&(o.down=0),o.up>.99&&(o.up=1),o.down>.99&&(o.down=1);const M=c%1400/1400,m=(v,S)=>{if(S<.01)return;const R=r+19,y=n;e.save(),e.strokeStyle=l.gridLabel,e.lineWidth=2.5,e.lineCap="round",e.lineJoin="round";for(let T=0;T<2;T++){const C=T*.2,P=.35,E=M-C,p=.3+.7*(E>=0&&E<P?Math.sin(E/P*Math.PI):0);e.globalAlpha=a*S*p;const A=v===-1?-3:3,W=y+v*(T*8-4)+A;e.beginPath(),e.moveTo(R-5,W-v*3.5),e.lineTo(R,W),e.lineTo(R+5,W-v*3.5),e.stroke()}e.restore()};m(-1,o.up),m(1,o.down),e.globalAlpha=a}function Er(e,r,n,t,l,o,i,c,a,s,h,f){if(a<.01)return;const{h:g,pad:M,toY:m}=r,v=m(l);e.save(),e.globalAlpha=a*.5,e.strokeStyle=n.crosshairLine,e.lineWidth=1,e.beginPath(),e.moveTo(t,M.top),e.lineTo(t,g-M.bottom),e.stroke(),e.restore();const S=4*Math.min(a*3,1);if(S>.5&&(e.globalAlpha=1,e.beginPath(),e.arc(t,v,S,0,Math.PI*2),e.fillStyle=n.line,e.fill()),a<.1||r.w<300)return;const R=i(l),y=c(o),T=" · ";e.save(),e.globalAlpha=a,e.font='400 13px "SF Mono", Menlo, monospace';const C=e.measureText(R).width,P=e.measureText(T).width,E=e.measureText(y).width,I=C+P+E;let p=t-I/2;const A=M.left+4,k=(h!=null?h+7:r.w-M.right)-I;p<A&&(p=A),p>k&&(p=k);const b=M.top+(s??14)+10;e.textAlign="left",f&&(e.strokeStyle=n.tooltipBg,e.lineWidth=3,e.lineJoin="round",e.strokeText(R,p,b),e.strokeText(T+y,p+C,b)),e.fillStyle=n.tooltipText,e.fillText(R,p,b),e.fillStyle=n.gridLabel,e.fillText(T+y,p+C,b),e.restore()}function Lr(e,r,n,t,l,o,i,c,a,s,h,f){if(a<.01||o.length===0)return;const{h:g,pad:M,toY:m}=r;e.save(),e.globalAlpha=a*.5,e.strokeStyle=n.crosshairLine,e.lineWidth=1,e.beginPath(),e.moveTo(t,M.top),e.lineTo(t,g-M.bottom),e.stroke(),e.restore();const v=4*Math.min(a*3,1);if(v>.5){e.globalAlpha=1;for(const b of o){const d=m(b.value);e.beginPath(),e.arc(t,d,v,0,Math.PI*2),e.fillStyle=b.color,e.fill()}}if(a<.1||r.w<300)return;e.save(),e.globalAlpha=a,e.font='400 13px "SF Mono", Menlo, monospace',e.textAlign="left";const S=c(l),R=" · ",y=" ",T=[{text:S,color:n.gridLabel}];for(const b of o){T.push({text:R,color:n.gridLabel}),T.push({text:y,color:b.color,isDot:!0});const d=b.label?`${b.label} `:"";d&&T.push({text:d,color:n.gridLabel}),T.push({text:i(b.value),color:n.tooltipText})}let C=0;const P=[];for(const b of T){const d=b.isDot?12:e.measureText(b.text).width;P.push(d),C+=d}let E=t-C/2;const I=M.left+4,A=(f!=null?f+7:r.w-M.right)-C;E<I&&(E=I),E>A&&(E=A);const W=M.top+(s??14)+10;if(h!==!1){e.strokeStyle=n.tooltipBg,e.lineWidth=3,e.lineJoin="round";let b=E;for(let d=0;d<T.length;d++){const L=T[d];L.isDot||e.strokeText(L.text,b,W),b+=P[d]}}let k=E;for(let b=0;b<T.length;b++){const d=T[b];d.isDot?(e.beginPath(),e.arc(k+4,W-4,3.5,0,Math.PI*2),e.fillStyle=d.color,e.fill()):(e.fillStyle=d.color,e.fillText(d.text,k,W)),k+=P[b]}e.restore()}function sr(e,r,n,t){const{w:l,h:o,pad:i,toY:c,chartW:a}=r,s=c(t.value);if(s<i.top-10||s>o-i.bottom+10)return;const h=t.label??"";if(h){e.font="500 11px system-ui, sans-serif";const f=e.measureText(h).width,g=i.left+a/2,M=8;e.strokeStyle=n.refLine,e.lineWidth=1,e.beginPath(),e.moveTo(i.left,s),e.lineTo(g-f/2-M,s),e.stroke(),e.beginPath(),e.moveTo(g+f/2+M,s),e.lineTo(l-i.right,s),e.stroke(),e.fillStyle=n.refLabel,e.textAlign="center",e.fillText(h,g,s+4)}else e.strokeStyle=n.refLine,e.lineWidth=1,e.setLineDash([4,4]),e.beginPath(),e.moveTo(i.left,s),e.lineTo(l-i.right,s),e.stroke(),e.setLineDash([])}function yr(e){return e<=15?2:e<=30?5:e<=60?10:e<=120?15:e<=300?30:e<=600?60:e<=1800?300:e<=3600?600:e<=14400?1800:e<=43200?3600:e<=86400?7200:e<=604800?86400:604800}var Pr=.08;function gn(e,r,n,t,l,o,i,c){const{h:a,pad:s,leftEdge:h,rightEdge:f,toX:g}=r,M=s.left,m=r.w-s.right,v=m-M,S=50,R=b=>{const d=b-M,L=m-b,K=Math.min(d,L);return K>=S?1:K<=0?0:K/S};e.font=n.labelFont;const y=v/l;let T=yr(l);for(;T*y<60&&T<l;)T*=2;const C=T>=86400;let P;if(C){const b=new Date((h-T)*1e3);b.setHours(0,0,0,0),P=b.getTime()/1e3}else P=Math.ceil((h-T)/T)*T;const E=new Set;for(let b=P;b<=f+T&&E.size<30;b+=T)E.add(Math.round(b*100));for(const b of E){const d=o(b/100),L=i.labels.get(b);L?L.text=d:i.labels.set(b,{alpha:0,text:d})}for(const[b,d]of i.labels){const L=g(b/100),Q=E.has(b)?R(L):0;let q=ee(d.alpha,Q,Pr,c);Math.abs(q-Q)<.02&&(q=Q),q<.01&&Q===0?i.labels.delete(b):d.alpha=q}const I=e.globalAlpha,p=a-s.bottom,A=5;e.strokeStyle=n.gridLine,e.lineWidth=1,e.beginPath(),e.moveTo(M,p),e.lineTo(m,p),e.stroke(),e.textAlign="center";const W=[];for(const[b,d]of i.labels){if(d.alpha<.02)continue;const L=g(b/100);if(L<M-20||L>m)continue;const K=e.measureText(d.text).width;W.push({x:L,alpha:d.alpha,text:d.text,w:K})}W.sort((b,d)=>b.x-d.x);const k=[];for(const b of W){const d=b.x-b.w/2;if(k.length>0){const L=k[k.length-1],K=L.x+L.w/2;if(d<K+8){b.alpha>L.alpha&&(k[k.length-1]=b);continue}}k.push(b)}for(const b of k)e.save(),e.globalAlpha=I*b.alpha,e.strokeStyle=n.gridLine,e.lineWidth=1,e.beginPath(),e.moveTo(b.x,p),e.lineTo(b.x,p+A),e.stroke(),e.fillStyle=n.timeLabel,e.fillText(b.text,b.x,p+A+14),e.restore()}var kr=[34,197,94],Cr=[239,68,68];function Wr(){return{labels:[],spawnTimer:0,smoothSpeed:ln,prevBidTotal:0,prevAskTotal:0,churnRate:0}}var Dr=50,Vn=6,On=40,Ir=22,ln=60,_r=160;function Br(e,r,n){const t=Math.round(e[0]+(r[0]-e[0])*n),l=Math.round(e[1]+(r[1]-e[1])*n),o=Math.round(e[2]+(r[2]-e[2])*n);return`rgb(${t},${l},${o})`}function Fr(e,r,n,t,l,o,i){const{pad:c,h:a,chartH:s}=r,h=l/1e3;if(t.bids.length===0&&t.asks.length===0)return;let f=0,g=0,M=0;for(const[,d]of t.bids)g+=d,d>f&&(f=d);for(const[,d]of t.asks)M+=d,d>f&&(f=d);if(f===0)return;const m=o.prevBidTotal+o.prevAskTotal;let v=0;if(m>0){const d=Math.abs(g-o.prevBidTotal)+Math.abs(M-o.prevAskTotal);v=Math.min(d/m,1)}o.prevBidTotal=g,o.prevAskTotal=M;const S=v>o.churnRate?.3:.05;o.churnRate+=(v-o.churnRate)*S;const R=Math.max(Math.min(i*5,1),o.churnRate),y=ln+R*(_r-ln),T=1-Math.pow(.95,l/16.67);o.smoothSpeed+=(y-o.smoothSpeed)*T;const C=o.smoothSpeed,P=c.left+8,E=a-c.bottom-6,I=c.top,p=n.bgRgb;for(o.spawnTimer+=l;o.spawnTimer>=On&&o.labels.length<Dr;){o.spawnTimer-=On;let d=!1;for(let x=0;x<o.labels.length;x++)if(Math.abs(o.labels[x].y-E)<Ir){d=!0;break}if(d)break;const L=[];for(const[,x]of t.bids)L.push({size:x,green:!0});for(const[,x]of t.asks)L.push({size:x,green:!1});let K=0;for(const x of L)K+=x.size;let Q=Math.random()*K,q=L[0];for(const x of L)if(Q-=x.size,Q<=0){q=x;break}const oe=q.size/f;o.labels.push({y:E,text:`+ ${$r(q.size)}`,green:q.green,life:Vn,maxLife:Vn,intensity:.5+oe*.5})}const A=E-I;let W=0;for(let d=0;d<o.labels.length;d++){const L=o.labels[d];if(L.life-=h,L.life<=0)continue;const K=A>0?(L.y-I)/A:1;L.y-=C*(.7+.3*K)*h,!(L.y<I-14)&&(o.labels[W++]=L)}o.labels.length=W;const k=e.globalAlpha;e.save(),e.font='600 13px "SF Mono", Menlo, monospace',e.textAlign="left",e.textBaseline="middle",e.globalAlpha=k;const b=`rgb(${p[0]},${p[1]},${p[2]})`;for(let d=0;d<o.labels.length;d++){const L=o.labels[d],K=L.life/L.maxLife,Q=Math.min((1-K)*10,1),q=(L.y-I)/s,oe=q<.45?q/.45:1,x=L.intensity*Q*oe,ze=L.green?kr:Cr,Ne=Br(ze,p,1-x);e.strokeStyle=b,e.lineWidth=4,e.lineJoin="round",e.strokeText(L.text,P,L.y),e.fillStyle=Ne,e.fillText(L.text,P,L.y)}e.restore()}function $r(e){return e>=10?`$${Math.round(e)}`:e>=1?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`}function Vr(){return{particles:[],cooldown:0,burstCount:0}}var Or=80,Hr=1,Xr=400,Gr=.08,Nr=3;function Yr(e,r,n,t,l,o,i,c){if(e.cooldown=Math.max(0,e.cooldown-i),r==="flat"||e.cooldown>0)return 0;if(l<Gr)return e.burstCount=0,0;if(r==="down"&&(c==null?void 0:c.downMomentum)!==!0||e.burstCount>=Nr)return 0;e.cooldown=Xr;const a=(c==null?void 0:c.scale)??1,s=r==="up",h=Math.min(l*5,1),f=h>.6?1:[1,.6,.35][e.burstCount]??.35;e.burstCount++;const g=Math.round((12+h*20)*a*f),M=1+h*.8;for(let m=0;m<g&&e.particles.length<Or;m++){const v=s?-Math.PI/2:Math.PI/2,S=Math.PI*1.2,R=v+(Math.random()-.5)*S,y=(60+Math.random()*100)*M;e.particles.push({x:n+(Math.random()-.5)*24,y:t+(Math.random()-.5)*8,vx:Math.cos(R)*y,vy:Math.sin(R)*y,life:1,size:(1+Math.random()*1.2)*a*f,color:o})}return f}function Ur(e,r,n){if(r.particles.length===0)return;const t=n/1e3;e.save();let l=0;for(let o=0;o<r.particles.length;o++){const i=r.particles[o];i.life-=t/Hr,!(i.life<=0)&&(i.x+=i.vx*t,i.y+=i.vy*t,i.vx*=.95,i.vy*=.95,e.globalAlpha=i.life*.55,e.fillStyle=i.color,e.beginPath(),e.arc(i.x,i.y,i.size*(.5+i.life*.5),0,Math.PI*2),e.fill(),r.particles[l++]=i)}r.particles.length=l,e.restore()}var mn="#22c55e",bn="#ef4444",xt=[34,197,94],Ct=[239,68,68];function cr(e){const r=Math.round(Ct[0]+(xt[0]-Ct[0])*e),n=Math.round(Ct[1]+(xt[1]-Ct[1])*e),t=Math.round(Ct[2]+(xt[2]-Ct[2])*e);return`rgb(${r},${n},${t})`}function Hn(e){const r=e.match(/^#([0-9a-f]{6})$/i);if(r){const t=r[1];return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const n=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return n?[+n[1],+n[2],+n[3]]:[128,128,128]}function jr(e,r,n){if(n<=0)return e;if(n>=1)return r;const[t,l,o]=Hn(e),[i,c,a]=Hn(r),s=Math.round(t+(i-t)*n),h=Math.round(l+(c-l)*n),f=Math.round(o+(a-o)*n);return`rgb(${s},${h},${f})`}function zr(e,r){const n=e.chartW/(e.rightEdge-e.leftEdge),t=r*n,l=Math.max(1,t*.7),o=Math.max(.8,Math.min(2,l*.15)),i=l>6?1.5:0;return{bodyW:l,wickW:o,radius:i}}function Xn(e,r,n,t,l,o){if(o<=0||l<o*2){e.rect(r,n,t,l);return}e.moveTo(r+o,n),e.lineTo(r+t-o,n),e.arcTo(r+t,n,r+t,n+o,o),e.lineTo(r+t,n+l-o),e.arcTo(r+t,n+l,r+t-o,n+l,o),e.lineTo(r+o,n+l),e.arcTo(r,n+l,r,n+l-o,o),e.lineTo(r,n+o),e.arcTo(r,n,r+o,n,o),e.closePath()}function en(e,r,n,t,l,o,i,c,a=1,s=-1,h,f=0){if(n.length===0)return;const{toX:g,toY:M}=r,{bodyW:m,wickW:v,radius:S}=zr(r,t),R=m/2,y=r.pad.left,T=r.pad.left+r.chartW,C=.12+Math.sin(o*.004)*.08;for(const P of n){const E=g(P.time+t/2);if(E+R<y||E-R>T)continue;const I=P.close>=P.open,p=P.time===l;let A=p&&s>=0?cr(s):I?mn:bn;h&&f>.01&&(A=jr(A,h,f));let W=p?a:1;if(c>.01&&i>0){const q=E-i;if(q>0){const oe=m*1.5,x=Math.min(q/oe,1);W*=1-c*.5*x}}const k=e.globalAlpha;e.globalAlpha=k*W;const b=M(Math.max(P.open,P.close)),d=M(Math.min(P.open,P.close)),L=Math.max(1,d-b),K=M(P.high),Q=M(P.low);e.lineCap="round",e.strokeStyle=A,b-K>.5&&(e.beginPath(),e.moveTo(E,b),e.lineTo(E,K),e.lineWidth=v,e.stroke()),Q-d>.5&&(e.beginPath(),e.moveTo(E,d),e.lineTo(E,Q),e.lineWidth=v,e.stroke()),e.fillStyle=A,e.beginPath(),Xn(e,E-R,b,m,L,S),e.fill(),p&&(e.save(),e.globalAlpha=k*W*C,e.shadowColor=A,e.shadowBlur=8,e.fillStyle=A,e.beginPath(),Xn(e,E-R,b,m,L,S),e.fill(),e.restore()),e.globalAlpha=k}}function qr(e,r,n,t,l,o=-1){const i=r.toY(t.close);if(i<r.pad.top||i>r.h-r.pad.bottom)return;const c=t.close>=t.open,a=o>=0?cr(o):c?mn:bn,s=e.globalAlpha;e.save(),e.setLineDash([4,4]),e.strokeStyle=a,e.lineWidth=1,e.globalAlpha=s*(1-l*.3)*.4,e.beginPath(),e.moveTo(r.pad.left,i),e.lineTo(r.w-r.pad.right,i),e.stroke(),e.setLineDash([]),e.restore()}function Jr(e,r,n,t,l,o,i,c,a){if(a<.01)return;const{h:s,pad:h}=r;if(e.save(),e.globalAlpha=a*.5,e.strokeStyle=n.crosshairLine,e.lineWidth=1,e.beginPath(),e.moveTo(t,h.top),e.lineTo(t,s-h.bottom),e.stroke(),e.restore(),a<.1||r.w<200)return;const g=l.close>=l.open?mn:bn,M=i(l.close),m=c(o);e.save(),e.globalAlpha=a,e.font='400 13px "SF Mono", Menlo, monospace',e.textAlign="left";let v;if(r.w>=400){const I=i(l.open),p=i(l.high),A=i(l.low);v=[{text:"O ",color:n.gridLabel},{text:I,color:g},{text:" H ",color:n.gridLabel},{text:p,color:g},{text:" L ",color:n.gridLabel},{text:A,color:g},{text:" C ",color:n.gridLabel},{text:M,color:g},{text:" · ",color:n.gridLabel},{text:m,color:n.gridLabel}]}else v=[{text:"C ",color:n.gridLabel},{text:M,color:g},{text:" · ",color:n.gridLabel},{text:m,color:n.gridLabel}];let S=0;const R=[];for(const I of v){const p=e.measureText(I.text).width;R.push(p),S+=p}let y=t-S/2;const T=h.left+4,C=r.w-h.right-S;y<T&&(y=T),y>C&&(y=C);const P=h.top+24;e.strokeStyle=n.tooltipBg,e.lineWidth=3,e.lineJoin="round";let E=y;for(let I=0;I<v.length;I++)e.strokeText(v[I].text,E,P),E+=R[I];E=y;for(let I=0;I<v.length;I++)e.fillStyle=v[I].color,e.fillText(v[I].text,E,P),E+=R[I];e.restore()}function Zr(e,r,n,t,l,o,i,c,a){if(a<.01)return;const{h:s,pad:h}=r,f=r.toY(l);if(e.save(),e.globalAlpha=a*.5,e.strokeStyle=n.crosshairLine,e.lineWidth=1,e.beginPath(),e.moveTo(t,h.top),e.lineTo(t,s-h.bottom),e.stroke(),e.globalAlpha=a*.3,e.beginPath(),e.moveTo(h.left,f),e.lineTo(r.w-h.right,f),e.stroke(),e.restore(),a<.1||r.w<200)return;const g=i(l),M=c(o);e.save(),e.globalAlpha=a,e.font='400 13px "SF Mono", Menlo, monospace',e.textAlign="left";const m=[{text:g,color:n.line},{text:" · ",color:n.gridLabel},{text:M,color:n.gridLabel}];let v=0;const S=[];for(const E of m){const I=e.measureText(E.text).width;S.push(I),v+=I}let R=t-v/2;const y=h.left+4,T=r.w-h.right-v;R<y&&(R=y),R>T&&(R=T);const C=h.top+24;e.strokeStyle=n.tooltipBg,e.lineWidth=3,e.lineJoin="round";let P=R;for(let E=0;E<m.length;E++)e.strokeText(m[E].text,P,C),P+=S[E];P=R;for(let E=0;E<m.length;E++)e.fillStyle=m[E].color,e.fillText(m[E].text,P,C),P+=S[E];e.restore()}function Ot(e,r,n,t,l,o=1,i=0,c=!1,a){const s=r-t.left-t.right,h=n-t.top-t.bottom,f=t.top+h/2,g=t.left+s/2,M=a??"No data to display",m=h*cn;e.save(),e.font="400 12px system-ui, -apple-system, sans-serif";const S=e.measureText(M).width/2+20,R=30;if(!c){const E=i*un,I=hn(i),p=32,A=[];for(let W=0;W<=p;W++){const k=W/p,b=t.left+k*s,d=fn(k,f,m,E);A.push([b,d])}e.beginPath(),e.moveTo(A[0][0],A[0][1]),Zt(e,A),e.strokeStyle=l.gridLabel,e.lineWidth=l.lineWidth,e.globalAlpha=I*o,e.lineCap="round",e.lineJoin="round",e.stroke()}e.save(),e.globalCompositeOperation="destination-out";const y=g-S-R,T=g+S+R,C=e.createLinearGradient(y,0,T,0);C.addColorStop(0,"rgba(0,0,0,0)"),C.addColorStop(R/(T-y),"rgba(0,0,0,1)"),C.addColorStop(1-R/(T-y),"rgba(0,0,0,1)"),C.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=C,e.globalAlpha=o;const P=m*2+l.lineWidth+6;e.fillRect(y,f-P/2,T-y,P),e.restore(),e.textAlign="center",e.textBaseline="middle",e.globalAlpha=.35*o,e.fillStyle=l.gridLabel,e.fillText(M,g,f),e.restore()}var Kr=.002,Gn=.2,ut=40,ct=5;function Qr(){return{amplitude:0}}function xr(e,r,n,t){const l=t.shakeState;let o=0,i=0;if(l&&l.amplitude>Gn&&(o=(Math.random()-.5)*2*l.amplitude,i=(Math.random()-.5)*2*l.amplitude,e.save(),e.translate(o,i)),l){const m=Math.pow(Kr,t.dt/1e3);l.amplitude*=m,l.amplitude<Gn&&(l.amplitude=0)}const c=t.chartReveal,a=t.pauseProgress,s=(m,v)=>{const S=Math.max(0,Math.min(1,(c-m)/(v-m)));return S*S*(3-2*S)};if(t.referenceLine&&c>.01&&(e.save(),c<1&&(e.globalAlpha=c),sr(e,r,n,t.referenceLine),e.restore()),t.showGrid){const m=c<1?s(.15,.7):1;m>.01&&(e.save(),m<1&&(e.globalAlpha=m),sn(e,r,n,t.formatValue,t.gridState,t.dt),e.restore())}t.orderbookData&&t.orderbookState&&c>.01&&(e.save(),c<1&&(e.globalAlpha=c),Fr(e,r,n,t.orderbookData,t.dt,t.orderbookState,t.swingMagnitude),e.restore());const h=t.scrubAmount>.05?t.hoverX:null,f=dn(e,r,n,t.visible,t.smoothValue,t.now,t.showFill,h,t.scrubAmount,c,t.now_ms);{const m=c<1?s(.15,.7):1;m>.01&&(e.save(),m<1&&(e.globalAlpha=m),gn(e,r,n,t.windowSecs,t.targetWindowSecs,t.formatTime,t.timeAxisState,t.dt),e.restore())}if(f&&f.length>0){const m=f[f.length-1];let v=t.scrubAmount;if(t.hoverX!==null&&v>0){const y=m[0]-t.hoverX,T=Math.min(80,r.chartW*.3);v=y<ct?0:y>=T?t.scrubAmount:(y-ct)/(T-ct)*t.scrubAmount}const S=c<.3?0:(c-.3)/.7,R=t.showPulse&&c>.6&&a<.5;if(S>.01&&(e.save(),S<1&&(e.globalAlpha=S),ar(e,m[0],m[1],n,R,v,t.now_ms),e.restore()),t.showMomentum){const T=(c<1?s(.6,1):1)*(1-a);T>.01&&(e.save(),T<1&&(e.globalAlpha=T),Ar(e,m[0],m[1],t.momentum,n,t.arrowState,t.dt,t.now_ms),e.restore())}if(t.particleState&&c>.9){const y=Yr(t.particleState,t.momentum,m[0],m[1],t.swingMagnitude,n.line,t.dt,t.particleOptions);y>0&&l&&(l.amplitude=(3+t.swingMagnitude*4)*y),Ur(e,t.particleState,t.dt)}}const g=ut;e.save(),e.globalCompositeOperation="destination-out";const M=e.createLinearGradient(r.pad.left,0,r.pad.left+g,0);if(M.addColorStop(0,"rgba(0, 0, 0, 1)"),M.addColorStop(1,"rgba(0, 0, 0, 0)"),e.fillStyle=M,e.fillRect(0,0,r.pad.left+g,r.h),e.restore(),t.hoverX!==null&&t.hoverValue!==null&&t.hoverTime!==null&&f&&f.length>0){const m=f[f.length-1],v=m[0]-t.hoverX,S=Math.min(80,r.chartW*.3),R=v<ct?0:v>=S?t.scrubAmount:(v-ct)/(S-ct)*t.scrubAmount;R>.01&&Er(e,r,n,t.hoverX,t.hoverValue,t.hoverTime,t.formatValue,t.formatTime,R,t.tooltipY,m[0],t.tooltipOutline)}l&&(o!==0||i!==0)&&e.restore()}function eo(e,r,n){const t=n.primaryPalette,l=n.chartReveal,o=(s,h)=>{const f=Math.max(0,Math.min(1,(l-s)/(h-s)));return f*f*(3-2*f)};if(n.referenceLine&&l>.01&&(e.save(),l<1&&(e.globalAlpha=l),sr(e,r,t,n.referenceLine),e.restore()),n.showGrid){const s=l<1?o(.15,.7):1;s>.01&&(e.save(),s<1&&(e.globalAlpha=s),sn(e,r,t,n.formatValue,n.gridState,n.dt),e.restore())}const i=n.scrubAmount>.05?n.hoverX:null,c=[];for(let s=0;s<n.series.length;s++){const h=n.series[s],f=h.alpha??1,M=(s>0&&l<1?Math.min(1,l*2):1)*f;if(M<.01)continue;e.save(),M<1&&(e.globalAlpha=M);const m=dn(e,r,h.palette,h.visible,h.smoothValue,n.now,!1,i,n.scrubAmount,l,n.now_ms);e.restore(),m&&m.length>0&&c.push({pts:m,palette:h.palette,label:h.label,alpha:f})}{const s=l<1?o(.15,.7):1;s>.01&&(e.save(),s<1&&(e.globalAlpha=s),gn(e,r,t,n.windowSecs,n.targetWindowSecs,n.formatTime,n.timeAxisState,n.dt),e.restore())}if(l>.3&&c.length>0){const s=(l-.3)/.7,h=n.showPulse&&l>.6&&n.pauseProgress<.5;for(const f of c){if(f.alpha<.01)continue;const g=f.pts[f.pts.length-1];e.save(),e.globalAlpha=s*f.alpha,h&&f.alpha>.5?Rr(e,g[0],g[1],f.palette.line,!0,n.now_ms,3):Tr(e,g[0],g[1],f.palette.line,3),f.label&&(e.font='600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif',e.textAlign="left",e.fillStyle=f.palette.line,e.fillText(f.label,g[0]+6,g[1]+3.5)),e.restore()}}e.save(),e.globalCompositeOperation="destination-out";const a=e.createLinearGradient(r.pad.left,0,r.pad.left+ut,0);if(a.addColorStop(0,"rgba(0, 0, 0, 1)"),a.addColorStop(1,"rgba(0, 0, 0, 0)"),e.fillStyle=a,e.fillRect(0,0,r.pad.left+ut,r.h),e.restore(),n.hoverX!==null&&n.hoverTime!==null&&n.hoverEntries.length>0&&c.length>0&&n.scrubAmount>.01){let s=0;for(const M of c){if(M.alpha<.01)continue;const m=M.pts[M.pts.length-1][0];m>s&&(s=m)}const h=s-n.hoverX,f=Math.min(80,r.chartW*.3),g=h<ct?0:h>=f?n.scrubAmount:(h-ct)/(f-ct)*n.scrubAmount;g>.01&&Lr(e,r,t,n.hoverX,n.hoverTime,n.hoverEntries,n.formatValue,n.formatTime,g,n.tooltipY,n.tooltipOutline,s)}}function to(e,r,n,t){var E,I;const{w:l,h:o,pad:i,chartW:c,chartH:a}=r,s=t.chartReveal,h=t.lineModeProg>=.99,f=h?1-s:(1-s)*(1-s)*(1-s),g=Math.max(t.lineModeProg,f),M=g>.001?t.lineModeProg/g:1,m=(p,A)=>{const W=Math.max(0,Math.min(1,(s-p)/(A-p)));return W*W*(3-2*W)},v=m(.25,.6);t.showGrid&&v>.01&&(e.save(),v<1&&(e.globalAlpha=v),sn(e,r,n,t.formatValue,t.gridState,t.dt),e.restore());let S;if(g>.01&&t.lineVisible.length>=2){const p=t.scrubAmount>.05?t.hoverX:null;e.save(),e.globalAlpha=g,S=dn(e,r,n,t.lineVisible,t.lineSmoothValue,t.now,t.lineModeProg>.01,p,t.scrubAmount,t.chartReveal,t.now_ms,M,!h,t.lineModeProg),e.restore()}const R=m(.4,.8),y=t.closePriceCandle??t.liveCandle;if(y&&R>.01&&(g<.99&&(e.save(),e.globalAlpha=R*(1-g),qr(e,r,n,y,t.scrubAmount,t.liveBullBlend),e.restore()),g>.01&&!h)){const p=r.toY(y.close);p>=i.top&&p<=o-i.bottom&&(e.save(),e.setLineDash([4,4]),e.strokeStyle=n.dashLine,e.lineWidth=1,e.globalAlpha=R*g*(1-t.scrubAmount*.2),e.beginPath(),e.moveTo(i.left,p),e.lineTo(l-i.right,p),e.stroke(),e.setLineDash([]),e.restore())}const T=t.chartReveal*(1-g);if(T>.01){const p=s*s*(3-2*s),A=d=>p>=.99?d:{time:d.time,open:d.close+(d.open-d.close)*p,high:d.close+(d.high-d.close)*p,low:d.close+(d.low-d.close)*p,close:d.close},W=p<.99?t.candles.map(A):t.candles,k=p<.99&&t.oldCandles.length>0?t.oldCandles.map(A):t.oldCandles;e.save(),e.beginPath(),e.rect(i.left-1,i.top,c+2,a),e.clip();const b=g>.01?n.line:void 0;t.morphT>=0&&k.length>0?(e.globalAlpha=(1-t.morphT)*T,en(e,r,k,t.oldWidth,-1,t.now_ms,t.hoverX??0,t.scrubAmount,1,-1,b,g),e.globalAlpha=t.morphT*T,en(e,r,W,t.displayCandleWidth,((E=t.liveCandle)==null?void 0:E.time)??-1,t.now_ms,t.hoverX??0,t.scrubAmount,t.liveBirthAlpha,t.liveBullBlend,b,g),e.globalAlpha=1):(T<1&&(e.globalAlpha=T),en(e,r,W,t.displayCandleWidth,((I=t.liveCandle)==null?void 0:I.time)??-1,t.now_ms,t.hoverX??0,t.scrubAmount,t.liveBirthAlpha,t.liveBullBlend,b,g)),e.restore()}if(g>.5&&S&&S.length>0&&s>.3){const p=S[S.length-1],A=(g-.5)*2*((s-.3)/.7),W=g>.8&&s>.6;A>.01&&(e.save(),e.globalAlpha=A,ar(e,p[0],p[1],n,W,t.scrubAmount,t.now_ms),e.restore())}const C=m(.25,.6);C>.01&&(e.save(),C<1&&(e.globalAlpha=C),gn(e,r,n,t.targetWindowSecs,t.targetWindowSecs,t.formatTime,t.timeAxisState,t.dt),e.restore()),e.save(),e.globalCompositeOperation="destination-out";const P=e.createLinearGradient(i.left,0,i.left+ut,0);if(P.addColorStop(0,"rgba(0, 0, 0, 1)"),P.addColorStop(1,"rgba(0, 0, 0, 0)"),e.fillStyle=P,e.fillRect(0,0,i.left+ut,o),e.restore(),t.showEmptyOverlay){const p=1-t.chartReveal;if(p>.01){const A=(1-t.loadingAlpha)*p;A>.01&&Ot(e,l,o,i,n,A,t.now_ms,!0,t.emptyText)}}t.chartReveal>.7&&t.hoveredCandle&&t.hoverX!==null&&t.scrubAmount>.01&&(t.lineModeProg>.5?Zr(e,r,n,t.hoverX,t.hoveredCandle.close,t.hoverTime??0,t.formatValue,t.formatTime,t.scrubAmount):Jr(e,r,n,t.hoverX,t.hoveredCandle,t.hoverTime??0,t.formatValue,t.formatTime,t.scrubAmount))}function Nn(e,r,n,t,l,o,i=1,c){const a=r-t.left-t.right,s=n-t.top-t.bottom,h=t.top+s/2,f=t.left,g=s*cn,M=o*un,m=hn(o),v=32,S=[];for(let R=0;R<=v;R++){const y=R/v,T=f+y*a,C=fn(y,h,g,M);S.push([T,C])}e.save(),e.beginPath(),e.moveTo(S[0][0],S[0][1]),Zt(e,S),e.strokeStyle=c??l.line,e.lineWidth=l.lineWidth,e.globalAlpha=m*i,e.lineCap="round",e.lineJoin="round",e.stroke(),e.restore()}function no(e,r,n,t){const l=r/2;return[`M${n},0`,`L${n+e},0`,`L${n+e},${r}`,`L${n},${r}`,`L0,${l}`,"Z"].join(" ")}function ro(e,r){return["M0,0",`L${e},0`,`L${e},${r}`,`L0,${r}`,"Z"].join(" ")}var zt=10,tn=3,Yn=5,Un=16,jn="http://www.w3.org/2000/svg",oo=50,ur=.12,lo=.15,io=.35,ao=.5,so=.12,fr=750,zn=.05,qn=.015,Jn=.001,hr=.2,nn=[34,197,94],Wt=[239,68,68],co=.14,uo=.09,fo=.12,ho=.08,go=.22,mo=.14,bo=.1,qt=.25,vo=300,po=500,Mo=.25,So=350,Zn=.08,Kn=.2,Qn=.001,wo=.15,Ro=.2,To=.015;function xn(e,r,n,t,l,o){const i=Math.abs(e-r),c=t-n||1,a=Math.min(i/c,1);return o?1:l+(1-a)*hr}function er(e,r,n,t,l,o,i,c,a,s,h){var M;if(r.to!==e.windowSecs){r.from=n,r.to=e.windowSecs,r.startMs=i,r.rangeFromMin=t,r.rangeFromMax=l;const m=c+e.windowSecs*h,v=m-e.windowSecs,S=[];for(const R of a)R.time>=v-2&&R.time<=m&&S.push(R);if(S.length>0){const R=Jt(S,s,(M=e.referenceLine)==null?void 0:M.value,e.exaggerate);r.rangeToMin=R.min,r.rangeToMax=R.max}}let f=0,g;if(o||r.startMs===0)g=e.windowSecs;else{const m=i-r.startMs,S=Math.min(m/fr,1),R=(1-Math.cos(S*Math.PI))/2;f=R;const y=Math.log(r.from),T=Math.log(r.to);g=Math.exp(y+(T-y)*R),S>=1&&(g=e.windowSecs,r.startMs=0,f=0)}return{windowSecs:g,windowTransProgress:f}}function tr(e,r,n,t,l,o,i,c,a,s,h,f){if(!r)return{minVal:e.min,maxVal:e.max,valRange:e.max-e.min||.001,targetMin:e.min,targetMax:e.max,displayMin:e.min,displayMax:e.max,rangeInited:!0};if(i)l=a.rangeFromMin+(a.rangeToMin-a.rangeFromMin)*c,o=a.rangeFromMax+(a.rangeToMax-a.rangeFromMax)*c,n=e.min,t=e.max;else{const g=o-l;n=e.min,t=e.max,l=ee(l,n,s,f),o=ee(o,t,s,f);const M=.5*g/h||.001;Math.abs(l-n)<M&&(l=n),Math.abs(o-t)<M&&(o=t)}return{minVal:l,maxVal:o,valRange:o-l||.001,targetMin:n,targetMax:t,displayMin:l,displayMax:o,rangeInited:!0}}function Ao(e,r,n,t,l,o,i,c,a,s,h,f,g,M){var E;let m=null,v=null,S=null,R=!1;if(e!==null&&e>=r.left&&e<=n-r.right){const I=t.toX(l),p=Math.min(e,I),A=h+(p-r.left)/g*(f-h),W=or(o,A);W!==null&&(m=W,v=A,S=p,R=!0,c={x:p,value:W,time:A},(E=a.onHover)==null||E.call(a,{time:A,value:W,x:p,y:t.toY(W)}))}const y=R?1:0;s?i=y:(i+=(y-i)*ur,i<.01&&(i=0),i>.99&&(i=1));let T=S,C=m,P=v;return!R&&i>0&&c&&(T=c.x,C=c.value,P=c.time),{hoverX:T,hoverValue:C,hoverTime:P,scrubAmount:i,isActiveHover:R,lastHover:c}}function nr(e,r,n,t,l,o,i,c,a,s,h,f=1){if(!r.showBadge||f<.25)return e.container.style.display="none",o;e.container.style.display="";const g=f<.5?(f-.25)/.25:1;e.container.style.opacity=g<1?String(g):"";const{w:M,h:m,pad:v}=t,S=r.formatValue(n);e.text.textContent=S,e.text.style.font=r.palette.labelFont,e.text.style.lineHeight=`${Un}px`;const R=r.badgeTail?Yn:0;e.text.style.padding=`${tn}px ${zt}px ${tn}px ${R+zt}px`,s.font=r.palette.labelFont;const y=S.replace(/[0-9]/g,"8"),T=s.measureText(y).width;e.targetW=T,e.displayW===0&&(e.displayW=T),e.displayW=ee(e.displayW,e.targetW,lo,h),Math.abs(e.displayW-e.targetW)<.3&&(e.displayW=e.targetW);const P=e.displayW+zt*2,E=Un+tn*2,I=R+P;e.svg.setAttribute("width",String(Math.ceil(I))),e.svg.setAttribute("height",String(E)),e.svg.setAttribute("viewBox",`0 0 ${I} ${E}`),e.path.setAttribute("d",r.badgeTail?no(P,E,Yn):ro(P,E));const p=v.top+t.chartH/2,A=Math.max(v.top,Math.min(m-v.bottom,t.toY(n))),W=f<1?p+(A-p)*f:A;o===null||a?o=W:o=ee(o,W,c?ao:io,h);const k=M-v.right-zt-R,b=o-E/2;if(e.container.style.transform=`translate3d(${k}px, ${b}px, 0)`,r.badgeVariant==="minimal")e.path.setAttribute("fill",r.palette.badgeOuterBg),e.text.style.color=r.palette.tooltipText,e.container.style.filter=`drop-shadow(0 1px 4px ${r.palette.badgeOuterShadow})`;else{e.container.style.filter="",e.text.style.color="#fff";const d=i;let L;if(!r.showMomentum)L=r.palette.line;else{const K=l==="up"?1:l==="down"?0:d.green;d.green=a?K:ee(d.green,K,so,h),d.green>.99&&(d.green=1),d.green<.01&&(d.green=0);const Q=d.green,q=Math.round(Wt[0]+(nn[0]-Wt[0])*Q),oe=Math.round(Wt[1]+(nn[1]-Wt[1])*Q),x=Math.round(Wt[2]+(nn[2]-Wt[2])*Q);L=`rgb(${q},${oe},${x})`}e.path.setAttribute("fill",L)}return o}function an(e){let r=1/0,n=-1/0;for(const i of e)i.low<r&&(r=i.low),i.high>n&&(n=i.high);if(!isFinite(r)||!isFinite(n))return{min:99,max:101};const t=n-r,l=t*.12,o=t*.1||.4;if(t<o){const i=(r+n)/2;return{min:i-o/2,max:i+o/2}}return{min:r-l,max:n+l}}function rr(e,r,n,t){const l=t.leftEdge+(r-t.pad.left)/t.chartW*(t.rightEdge-t.leftEdge);let o=0,i=e.length-1;for(;o<=i;){const c=o+i>>1,a=e[c];if(l<a.time)i=c-1;else if(l>=a.time+n)o=c+1;else return a}return null}function Eo(e,r,n,t,l,o,i,c,a){if(!r)return{minVal:e.min,maxVal:e.max,valRange:e.max-e.min||.001,displayMin:e.min,displayMax:e.max,rangeInited:!0};if(l)n=i.rangeFromMin+(i.rangeToMin-i.rangeFromMin)*o,t=i.rangeFromMax+(i.rangeToMax-i.rangeFromMax)*o;else{const s=t-n||1,h=Math.abs(n-e.min),f=Math.abs(t-e.max),g=Math.min((h+f)/s,1),M=wo+(1-g)*Ro;n=ee(n,e.min,M,a),t=ee(t,e.max,M,a);const m=.5*s/c||.001;Math.abs(n-e.min)<m&&(n=e.min),Math.abs(t-e.max)<m&&(t=e.max)}return{minVal:n,maxVal:t,valRange:t-n||.001,displayMin:n,displayMax:t,rangeInited:!0}}function Lo(e,r,n,t,l,o,i,c,a,s,h){if(r.to!==e){r.from=n,r.to=e,r.startMs=o,r.rangeFromMin=t,r.rangeFromMax=l;const M=i+e*h,m=M-e,v=[];for(const S of c)S.time+s>=m&&S.time<=M&&v.push(S);if(a&&a.time+s>=m&&a.time<=M&&v.push(a),v.length>0){const S=an(v);r.rangeToMin=S.min,r.rangeToMax=S.max}}let f=0,g;if(r.startMs===0)g=e;else{const M=o-r.startMs,m=Math.min(M/fr,1),v=(1-Math.cos(m*Math.PI))/2;f=v;const S=Math.log(r.from),R=Math.log(r.to);g=Math.exp(S+(R-S)*v),m>=1&&(g=e,r.startMs=0,f=0)}return{windowSecs:g,windowTransProgress:f}}function yo(e,r,n){const t=w.useRef(n);t.current=n;const l=w.useRef(n.value),o=w.useRef(new Map),i=w.useRef(new Map),c=w.useRef(0),a=w.useRef(0),s=w.useRef(0),h=w.useRef(0),f=w.useRef(!1),g=w.useRef(n.windowSecs),M=w.useRef({from:n.windowSecs,to:n.windowSecs,startMs:0,rangeFromMin:0,rangeFromMax:0,rangeToMin:0,rangeToMax:0}),m=w.useRef({up:0,down:0}),v=w.useRef({interval:0,labels:new Map}),S=w.useRef({labels:new Map}),R=w.useRef(Wr()),y=w.useRef(Vr()),T=w.useRef(Qr()),C=w.useRef({green:1}),P=w.useRef(null),E=w.useRef(!1),I=w.useRef({w:0,h:0}),p=w.useRef(null),A=w.useRef(0),W=w.useRef(0),k=w.useRef(null),b=w.useRef(null),d=w.useRef(0),L=w.useRef(null),K=w.useRef([]),Q=w.useRef(0),q=w.useRef(0),oe=w.useRef(0),x=w.useRef([]),ze=w.useRef([]),Ne=w.useRef(0),ue=w.useRef(null),ye=w.useRef(null),ve=w.useRef(n.loading?1:0),Pe=w.useRef(null),Re=w.useRef(1),Te=w.useRef(.5),Ye=w.useRef(0),Mt=w.useRef(!1),ft=w.useRef(0),St=w.useRef(!1),ht=w.useRef(0),Ht=w.useRef({startMs:0,from:0,to:0}),It=w.useRef(0),_t=w.useRef({startMs:0,from:0,to:0}),et=w.useRef(0),yt=w.useRef(!1),Xt=w.useRef({fromWidth:n.candleWidth??1,toWidth:n.candleWidth??1,startMs:0,rangeFromMin:0,rangeFromMax:0,rangeToMin:0,rangeToMax:0,oldCandles:[],oldWidth:n.candleWidth??1}),it=w.useRef({candles:[],width:n.candleWidth??1}),at=w.useRef(null),Bt=w.useRef(null),Pt=w.useRef(null),Ft=w.useRef(null),wt=w.useRef([]),Gt=w.useRef(null),Ue=w.useRef([]),tt=w.useRef(void 0);w.useEffect(()=>{const F=r.current;if(!F)return;const H=document.createElement("div");H.style.cssText="position:absolute;top:0;left:0;pointer-events:none;will-change:transform;display:none;z-index:1;";const z=document.createElementNS(jn,"svg");z.style.cssText="position:absolute;top:0;left:0;";const u=document.createElementNS(jn,"path");z.appendChild(u);const _e=document.createElement("span");return _e.style.cssText="position:relative;display:block;color:#fff;white-space:nowrap;",H.appendChild(z),H.appendChild(_e),F.appendChild(H),k.current={container:H,svg:z,path:u,text:_e,displayW:0,targetW:0},()=>{F.removeChild(H),k.current=null}},[r]),w.useEffect(()=>{const F=r.current;if(!F)return;const H=new ResizeObserver(u=>{const _e=u[0];if(!_e)return;const{width:Z,height:te}=_e.contentRect;I.current={w:Z,h:te}});H.observe(F);const z=F.getBoundingClientRect();return I.current={w:z.width,h:z.height},()=>H.disconnect()},[r]),w.useEffect(()=>{const F=r.current;if(!F)return;const H=te=>{if(!t.current.scrub)return;const ke=F.getBoundingClientRect();b.current=te.clientX-ke.left},z=()=>{var te,ke;b.current=null,(ke=(te=t.current).onHover)==null||ke.call(te,null)},u=te=>{if(!t.current.scrub||te.touches.length!==1)return;const ke=F.getBoundingClientRect();b.current=te.touches[0].clientX-ke.left},_e=te=>{if(!t.current.scrub||te.touches.length!==1)return;te.preventDefault();const ke=F.getBoundingClientRect();b.current=te.touches[0].clientX-ke.left},Z=()=>{var te,ke;b.current=null,(ke=(te=t.current).onHover)==null||ke.call(te,null)};return F.addEventListener("mousemove",H),F.addEventListener("mouseleave",z),F.addEventListener("touchstart",u,{passive:!0}),F.addEventListener("touchmove",_e,{passive:!1}),F.addEventListener("touchend",Z),F.addEventListener("touchcancel",Z),()=>{F.removeEventListener("mousemove",H),F.removeEventListener("mouseleave",z),F.removeEventListener("touchstart",u),F.removeEventListener("touchmove",_e),F.removeEventListener("touchend",Z),F.removeEventListener("touchcancel",Z)}},[r]),w.useEffect(()=>{const F=window.matchMedia("(prefers-reduced-motion: reduce)");E.current=F.matches;const H=z=>{E.current=z.matches};return F.addEventListener("change",H),()=>F.removeEventListener("change",H)},[]),w.useEffect(()=>{const F=()=>{!document.hidden&&!A.current&&(A.current=requestAnimationFrame(qe))};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[]);const qe=w.useCallback(()=>{var vn,pn,Mn,Sn,wn,Rn,Tn,An,En,Ln,yn,Pn,kn,Cn,Wn,Dn;if(document.hidden){A.current=0;return}const F=e.current,{w:H,h:z}=I.current;if(!F||H===0||z===0){A.current=requestAnimationFrame(qe);return}const u=t.current,_e=mr(),Z=performance.now(),te=W.current?Math.min(Z-W.current,oo):16.67;W.current=Z;const ke=Math.round(H*_e),Rt=Math.round(z*_e);(F.width!==ke||F.height!==Rt)&&(F.width=ke,F.height=Rt,F.style.width=`${H}px`,F.style.height=`${z}px`);let Y=p.current;if((!Y||Y.canvas!==F)&&(Y=F.getContext("2d"),p.current=Y),!Y){A.current=requestAnimationFrame(qe);return}br(Y,_e);const $e=E.current,Ae=u.mode==="candle";if(Ae)u.paused&&at.current===null&&(((vn=u.candles)==null?void 0:vn.length)??0)>0&&(at.current=u.candles.slice(),Bt.current=u.liveCandle??null,Pt.current=((pn=u.lineData)==null?void 0:pn.slice())??null,Ft.current=u.lineValue??null),u.paused||(at.current=null,Bt.current=null,Pt.current=null,Ft.current=null);else if(u.isMultiSeries&&u.multiSeries){if(u.paused&&ye.current===null){const V=new Map;for(const ae of u.multiSeries)ae.data.length>=2&&V.set(ae.id,{data:ae.data.slice(),value:ae.value});V.size>0&&(ye.current=V)}u.paused||(ye.current=null)}else u.paused&&ue.current===null&&u.data.length>=2&&(ue.current=u.data.slice()),u.paused||(ue.current=null);const $t=Ae?[]:ue.current??u.data,U=Ae?at.current??u.candles??[]:[],Nt=u.isMultiSeries&&u.multiSeries?u.multiSeries.some(V=>V.data.length>=2):!1,ge=Ae?U.length>=2:Nt||$t.length>=2,O=u.padding,Je=z-O.top-O.bottom,$=u.paused?1:0;q.current=$e?$:ee(q.current,$,fo,te),q.current<.005&&(q.current=0),q.current>.995&&(q.current=1);const ne=q.current,j=te*(1-ne),nt=te/1e3;if(oe.current+=nt*ne,!u.paused&&oe.current>.001){const V=oe.current>10?go:ho;oe.current=ee(oe.current,0,V,te),oe.current<.01&&(oe.current=0)}const Kt=u.loading?1:0;ve.current=$e?Kt:ee(ve.current,Kt,mo,te),ve.current<.01&&(ve.current=0),ve.current>.99&&(ve.current=1);const Ze=ve.current,Tt=!u.loading&&ge?1:0;Q.current=$e?Tt:ee(Q.current,Tt,Tt===1?uo:co,te),Math.abs(Q.current-Tt)<.005&&(Q.current=Tt);const Ve=Q.current;Ve<.01&&(f.current=!1);let Ke,dt=!1;if(Ae?Ke=!ge&&Ve>.005&&wt.current.length>0:(dt=!ge&&Ve>.005&&ze.current.length>0,Nt&&u.multiSeries&&(ze.current=u.multiSeries.map(V=>({id:V.id,data:V.data.slice(),value:V.value,palette:V.palette,label:V.label}))),ge&&!u.isMultiSeries&&(ze.current=[]),Ke=!dt&&!ge&&Ve>.005&&x.current.length>=2,ge&&!u.isMultiSeries&&(x.current=$t)),Ae){const V=Ht.current,ae=u.lineMode?1:0;if(V.to!==ae&&(V.from=ht.current,V.to=ae,V.startMs=Z),V.startMs>0){const X=Z-V.startMs,se=Math.min(X/po,1);ht.current=V.from+(V.to-V.from)*((1-Math.cos(se*Math.PI))/2),se>=1&&(ht.current=V.to,V.startMs=0)}else ht.current=V.to}if(!ge&&!Ke&&!dt){Y.clearRect(0,0,H,z);const V=Ae||u.isMultiSeries||ze.current.length>0?u.palette.gridLabel:void 0;Ze>.01&&Nn(Y,H,z,O,u.palette,Z,Ze,V),1-Ze>.01&&Ot(Y,H,z,O,u.palette,1-Ze,Z,!1,u.emptyText),Y.save(),Y.globalCompositeOperation="destination-out";const ae=Y.createLinearGradient(O.left,0,O.left+ut,0);ae.addColorStop(0,"rgba(0, 0, 0, 1)"),ae.addColorStop(1,"rgba(0, 0, 0, 0)"),Y.fillStyle=ae,Y.fillRect(0,0,O.left+ut,z),Y.restore(),k.current&&(k.current.container.style.display="none"),A.current=requestAnimationFrame(qe);return}if(Ae){Y.clearRect(0,0,H,z);const V=To;ge&&(Ne.current=Date.now()/1e3-oe.current);const ae=ge||Ve<.005?Date.now()/1e3-oe.current:Ne.current,X=at.current?Bt.current??void 0:u.liveCandle;let se=Pt.current??u.lineData,Ce=Ft.current??u.lineValue;ge&&se&&se.length>0&&(Ue.current=se,tt.current=Ce),Ke&&Ue.current.length>0&&(se=Ue.current,Ce=tt.current);const Oe=u.candleWidth??1,G=Xt.current;let Me=-1,be;if(G.startMs>0){const D=Z-G.startMs,B=Math.min(D/vo,1);Me=(1-Math.cos(B*Math.PI))/2,be=Math.exp(Math.log(G.fromWidth)+(Math.log(G.toWidth)-Math.log(G.fromWidth))*Me),B>=1&&(be=G.toWidth,G.startMs=0,Me=-1)}else be=G.toWidth;if(Oe!==G.toWidth){G.oldCandles=it.current.candles,G.oldWidth=it.current.width,G.fromWidth=be,G.toWidth=Oe,G.startMs=Z,Me=0,G.rangeFromMin=c.current,G.rangeFromMax=a.current;const D=g.current,B=ae+D*V,Le=B-D,J=[];for(const Ie of U)Ie.time+Oe>=Le&&Ie.time<=B&&J.push(Ie);if(X&&J.push(X),J.length>0){const Ie=an(J);G.rangeToMin=Ie.min,G.rangeToMax=Ie.max}else G.rangeToMin=c.current,G.rangeToMax=a.current}it.current={candles:u.candles??[],width:Oe};const Se=ht.current,we=_t.current,gt=se&&se.length>0,je=u.lineMode&&Se>=.3&>?1:0;we.to!==je&&(we.from=It.current,we.to=je,we.startMs=Z);let Be;if(we.startMs>0){const D=Z-we.startMs,B=Math.min(D/So,1);Be=we.from+(we.to-we.from)*(1-(1-B)*(1-B)),B>=1&&(Be=we.to,we.startMs=0)}else Be=we.to;It.current=Be;const At=M.current,fe=Lo(u.windowSecs,At,g.current,c.current,a.current,Z,ae,U,X,Oe,V);g.current=fe.windowSecs;const xe=fe.windowSecs,kt=fe.windowTransProgress,He=At.startMs>0,We=ae+xe*V,Ee=We-xe;let Xe;if(X){const D=Pe.current;if(!D||D.time!==X.time)Pe.current={time:X.time,open:X.open,high:X.open,low:X.open,close:X.open},Re.current=0;else{const J=Pe.current;J.open=ee(J.open,X.open,qt,j),J.high=ee(J.high,X.high,qt,j),J.low=ee(J.low,X.low,qt,j),J.close=ee(J.close,X.close,qt,j)}Re.current=ee(Re.current,1,.2,j),Re.current>.99&&(Re.current=1);const B=Pe.current,Le=B.close>=B.open?1:0;Te.current=ee(Te.current,Le,.12,j),Te.current>.99&&(Te.current=1),Te.current<.01&&(Te.current=0),Xe=B}else Pe.current=null,Re.current=1,Te.current=.5;if(X)if(!St.current)ft.current=X.close,St.current=!0;else{ft.current=ee(ft.current,X.close,Mo,j);const D=Math.abs(ft.current-X.close),B=a.current-c.current||1;D<B*5e-4&&(ft.current=X.close)}else Ke||(St.current=!1);if(X)if(!Mt.current)Ye.current=X.close,Mt.current=!0;else{const D=Math.abs(X.close-Ye.current),B=a.current-c.current||1,Le=Math.min(D/B,1),J=Zn+(1-Le)*Kn;Ye.current=ee(Ye.current,X.close,J,j),D<B*Qn&&(Ye.current=X.close)}else Ke||(Mt.current=!1);if(Ce!==void 0&>)if(!yt.current)et.current=Ce,yt.current=!0;else{const D=Math.abs(Ce-et.current),B=a.current-c.current||1,Le=Math.min(D/B,1),J=Zn+(1-Le)*Kn;et.current=ee(et.current,Ce,J,j),D<B*Qn&&(et.current=Ce)}else Ke||(yt.current=!1);const rt=[];for(const D of U)D.time+Oe>=Ee&&D.time<=We&&rt.push(D);Xe&&Xe.time+be>=Ee&&Xe.time<=We&&rt.push(Xe);let Ge=[];if(Me>=0&&G.oldCandles.length>0)for(const D of G.oldCandles)D.time+G.oldWidth>=Ee&&D.time<=We&&Ge.push(D);ge&&(wt.current=rt,Gt.current=Xe??null);const Qe=Ke?wt.current:rt,mt=Ke?Gt.current??void 0:Xe,bt=H-O.left-O.right,Et=Qe.length>0?an(Qe):{min:c.current,max:a.current},me=Eo(Et,f.current,c.current,a.current,He,kt,At,Je,j);Me>=0&&(me.displayMin=G.rangeFromMin+(G.rangeToMin-G.rangeFromMin)*Me,me.displayMax=G.rangeFromMax+(G.rangeToMax-G.rangeFromMax)*Me,me.minVal=me.displayMin,me.maxVal=me.displayMax,me.valRange=me.displayMax-me.displayMin||.001),f.current=me.rangeInited,c.current=me.displayMin,a.current=me.displayMax;const{minVal:vt,maxVal:Lt,valRange:st}=me,he={w:H,h:z,pad:O,chartW:bt,chartH:Je,leftEdge:Ee,rightEdge:We,minVal:vt,maxVal:Lt,valRange:st,toX:D=>O.left+(D-Ee)/(We-Ee)*bt,toY:D=>O.top+(1-(D-vt)/st)*Je},De=b.current;let re=null,_=!1;De!==null&&De>=O.left&&De<=H-O.right&&(re=rr(Qe,De,be,he),re&&(_=!0));const N=_?1:0;d.current=ee(d.current,N,.12,te),d.current<.01&&(d.current=0),d.current>.99&&(d.current=1);const de=d.current;let pe=De,Fe=0,ot=re;!_&&de>0&&L.current?(pe=L.current.x,Fe=L.current.time,ot=rr(Qe,L.current.x,be,he)):_&&De!==null&&(Fe=he.leftEdge+(De-O.left)/bt*(he.rightEdge-he.leftEdge),L.current={x:De,value:(re==null?void 0:re.close)??0,time:Fe});let le=Qe,pt=Ge,ie=mt;if(Se>.01&&ie&&Mt.current){const D=ie.close+(Ye.current-ie.close)*Se;ie={...ie,close:D};const B=le.length-1;B>=0&&le[B].time===ie.time&&(le=le.slice(),le[B]={...le[B],close:D})}if(Se>.01&&Se<.99){const D=B=>{const Le=1-Se;return{time:B.time,open:B.close+(B.open-B.close)*Le,high:B.close+(B.high-B.close)*Le,low:B.close+(B.low-B.close)*Le,close:B.close}};le=le.map(D),pt.length>0&&(pt=pt.map(D)),ie&&(ie=D(ie))}let lt,Yt;if(se&&se.length>0&&(Be>.01||Se>.05)){const D=[];for(const J of le)D.push({t:J.time+be/2,v:J.close});ie&&D.push({t:ae,v:ie.close}),lt=[];let B=0;for(const J of se){if(J.time<Ee||J.time>We)continue;for(;B<D.length-2&&D[B+1].t<J.time;)B++;let Ie;if(D.length===0)Ie=J.value;else if(D.length===1||J.time<=D[0].t)Ie=D[0].v;else if(B>=D.length-1)Ie=D[D.length-1].v;else{const Ut=D[B],In=D[B+1],_n=In.t-Ut.t,dr=_n>0?Math.max(0,Math.min(1,(J.time-Ut.t)/_n)):0;Ie=Ut.v+(In.v-Ut.v)*dr}const Vt=Ie+(J.value-Ie)*Be;lt.push({time:J.time,value:Vt})}const Le=yt.current?et.current:Ce??se[se.length-1].value;Yt=Ye.current+(Le-Ye.current)*Be}else lt=le.map(D=>({time:D.time+be/2,value:D.close})),Yt=Mt.current?Ye.current:(ie==null?void 0:ie.close)??((Mn=le[le.length-1])==null?void 0:Mn.close)??0;if(Ve<1&<.length>=2){const D=lt[0].time,B=We-Ee;if(D-Ee>B*.05){const Le=lt[0].value,J=B/32,Ie=[];for(let Vt=Ee;Vt<D-J*.5;Vt+=J)Ie.push({time:Vt,value:Le});lt=[...Ie,...lt]}}if(to(Y,he,u.palette,{candles:le,displayCandleWidth:be,oldCandles:pt,oldWidth:G.oldWidth,morphT:Me,liveCandle:ie,closePriceCandle:St.current&&X?{...X,close:ft.current}:X,liveTime:(mt==null?void 0:mt.time)??-1,liveBirthAlpha:Re.current,liveBullBlend:Te.current,lineModeProg:Se,chartReveal:Ve,now_ms:Z,now:ae,showGrid:u.showGrid,scrubAmount:de,hoverX:pe,hoverValue:(ot==null?void 0:ot.close)??null,hoverTime:Fe,hoveredCandle:ot,formatValue:u.formatValue,formatTime:u.formatTime,gridState:v.current,timeAxisState:S.current,dt:j,targetWindowSecs:u.windowSecs,tooltipY:u.tooltipY,tooltipOutline:u.tooltipOutline,lineVisible:lt,lineSmoothValue:Yt,emptyText:u.emptyText,loadingAlpha:Ze,showEmptyOverlay:!(u.loading??!1)&&Ze<.01}),k.current)if(Se>.5&&u.showBadge){const D=Bn(lt);P.current=nr(k.current,u,Yt,he,D,P.current,C.current,He,$e,Y,j,Ve);const B=(Se-.5)*2;if(k.current.container.style.display!=="none"){const Le=k.current.container.style.opacity?parseFloat(k.current.container.style.opacity):1;k.current.container.style.opacity=String(Le*B*(1-ne))}}else k.current.container.style.display="none"}else if(u.isMultiSeries&&u.multiSeries&&u.multiSeries.length>0||dt){Y.clearRect(0,0,H,z);const V=dt?ze.current:u.multiSeries;let ae=0;if(V.some(_=>_.label)){Y.font='600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif';let _=0;for(const N of V)if(N.label){const de=Y.measureText(N.label).width;de>_&&(_=de)}ae=Math.max(0,_-2)*Ve}const X=H-O.left-O.right-ae,se=u.showBadge?zn:qn;if(!dt){const _=new Set(V.map(N=>N.id));for(const N of o.current.keys())_.has(N)||o.current.delete(N)}const Ce=V[0],Oe=M.current;ge&&(Ne.current=Date.now()/1e3-oe.current);const G=dt?Ne.current:Date.now()/1e3-oe.current,Me=new Map;for(const _ of V){let N=o.current.get(_.id);if(N===void 0&&(N=_.value),!dt){const de=xn(_.value,N,c.current,a.current,u.lerpSpeed,$e);N=ee(N,_.value,de,j);const pe=a.current-c.current||1;Math.abs(N-_.value)<pe*Jn&&(N=_.value),o.current.set(_.id,N)}Me.set(_.id,N)}const be=u.hiddenSeriesIds,Se=i.current;for(const _ of V){let N=Se.get(_.id)??1;const de=be!=null&&be.has(_.id)?0:1;N=$e?de:ee(N,de,bo,j),N<.01&&(N=0),N>.99&&(N=1),Se.set(_.id,N)}const we=((wn=(Sn=ye.current)==null?void 0:Sn.get(Ce.id))==null?void 0:wn.data)??Ce.data,gt=er(u,Oe,g.current,c.current,a.current,$e,Z,G,we,Me.get(Ce.id)??Ce.value,se);if(Oe.startMs>0&&V.length>1){const _=G+u.windowSecs*se,N=_-u.windowSecs;let de=1/0,pe=-1/0;for(const Fe of V){const ot=((Tn=(Rn=ye.current)==null?void 0:Rn.get(Fe.id))==null?void 0:Tn.data)??Fe.data,le=Me.get(Fe.id)??Fe.value,pt=[];for(const ie of ot)ie.time>=N-2&&ie.time<=_&&pt.push(ie);if(pt.length>0){const ie=Jt(pt,le,(An=u.referenceLine)==null?void 0:An.value,u.exaggerate);ie.min<de&&(de=ie.min),ie.max>pe&&(pe=ie.max)}}isFinite(de)&&isFinite(pe)&&(Oe.rangeToMin=de,Oe.rangeToMax=pe)}g.current=gt.windowSecs;const je=gt.windowSecs,Be=gt.windowTransProgress,At=Oe.startMs>0,fe=G+je*se,xe=fe-je,kt=fe-(fe-G)*ne,He=[];let We=1/0,Ee=-1/0;for(const _ of V){const N=(En=ye.current)==null?void 0:En.get(_.id),de=(N==null?void 0:N.data)??_.data,pe=[];for(const le of de)le.time>=xe-2&&le.time<=kt&&pe.push(le);const Fe=Me.get(_.id)??_.value,ot=Se.get(_.id)??1;if(pe.length>=2){if(ot>.01){const le=Jt(pe,Fe,(Ln=u.referenceLine)==null?void 0:Ln.value,u.exaggerate);le.min<We&&(We=le.min),le.max>Ee&&(Ee=le.max)}He.push({visible:pe,smoothValue:Fe,palette:_.palette,label:_.label,alpha:ot})}}if(He.length===0){Ze>.01&&Nn(Y,H,z,O,u.palette,Z,Ze,u.palette.gridLabel),1-Ze>.01&&Ot(Y,H,z,O,u.palette,1-Ze,Z,!1,u.emptyText),Y.save(),Y.globalCompositeOperation="destination-out";const _=Y.createLinearGradient(O.left,0,O.left+ut,0);_.addColorStop(0,"rgba(0, 0, 0, 1)"),_.addColorStop(1,"rgba(0, 0, 0, 0)"),Y.fillStyle=_,Y.fillRect(0,0,O.left+ut,z),Y.restore(),k.current&&(k.current.container.style.display="none"),A.current=requestAnimationFrame(qe);return}const Xe={min:isFinite(We)?We:0,max:isFinite(Ee)?Ee:1},rt=u.lerpSpeed+hr*.5,Ge=tr(Xe,f.current,s.current,h.current,c.current,a.current,At,Be,Oe,rt,Je,j);f.current=Ge.rangeInited,s.current=Ge.targetMin,h.current=Ge.targetMax,c.current=Ge.displayMin,a.current=Ge.displayMax;const{minVal:Qe,maxVal:mt,valRange:bt}=Ge,Et={w:H,h:z,pad:O,chartW:X,chartH:Je,leftEdge:xe,rightEdge:fe,minVal:Qe,maxVal:mt,valRange:bt,toX:_=>O.left+(_-xe)/(fe-xe)*X,toY:_=>O.top+(1-(_-Qe)/bt)*Je},me=b.current;let vt=null,Lt=null,st=!1,he=[];if(me!==null&&me>=O.left&&me<=H-O.right){const _=Et.toX(G),N=Math.min(me,_),de=xe+(N-O.left)/X*(fe-xe);vt=N,Lt=de,st=!0;for(const pe of He){if((pe.alpha??1)<.5)continue;const Fe=or(pe.visible,de);Fe!==null&&he.push({color:pe.palette.line,label:pe.label??"",value:Fe})}L.current={x:N,value:((yn=he[0])==null?void 0:yn.value)??0,time:de},K.current=he,(Cn=u.onHover)==null||Cn.call(u,{time:de,value:((Pn=he[0])==null?void 0:Pn.value)??0,x:N,y:Et.toY(((kn=he[0])==null?void 0:kn.value)??0)})}const De=st?1:0;$e?d.current=De:(d.current+=(De-d.current)*ur,d.current<.01&&(d.current=0),d.current>.99&&(d.current=1)),!st&&d.current>0&&L.current&&(vt=L.current.x,Lt=L.current.time,he=K.current),eo(Y,Et,{series:He,now:G,showGrid:u.showGrid,showPulse:u.showPulse,referenceLine:u.referenceLine,hoverX:vt,hoverTime:Lt,hoverEntries:he,scrubAmount:d.current,windowSecs:je,formatValue:u.formatValue,formatTime:u.formatTime,gridState:v.current,timeAxisState:S.current,dt:te,targetWindowSecs:u.windowSecs,tooltipY:u.tooltipY,tooltipOutline:u.tooltipOutline,chartReveal:Ve,pauseProgress:ne,now_ms:Z,primaryPalette:u.palette});const re=1-Ve;if(re>.01&&Tt===0&&!u.loading){const _=(1-Ze)*re;_>.01&&Ot(Y,H,z,O,u.palette,_,Z,!0,u.emptyText)}k.current&&(k.current.container.style.display="none")}else{const V=Ke?x.current:$t,ae=xn(u.value,l.current,c.current,a.current,u.lerpSpeed,$e);if(!Ke&&(l.current=ee(l.current,u.value,ae,j),ne<.5)){const re=a.current-c.current||1;Math.abs(l.current-u.value)<re*Jn&&(l.current=u.value)}const X=l.current,se=H-O.left-O.right,Ce=u.showBadge?zn:qn,G=u.showMomentum&&u.showBadge?Math.max(Ce,52/Math.max(se,1)):Ce,Me=M.current;ge&&(Ne.current=Date.now()/1e3-oe.current);const be=Ke?Ne.current:Date.now()/1e3-oe.current,Se=er(u,Me,g.current,c.current,a.current,$e,Z,be,V,X,G);g.current=Se.windowSecs;const we=Se.windowSecs,gt=Se.windowTransProgress,je=be+we*G,Be=je-we,At=je-(je-be)*ne,fe=[];for(const re of V)re.time>=Be-2&&re.time<=At&&fe.push(re);if(fe.length<2){k.current&&(k.current.container.style.display="none"),A.current=requestAnimationFrame(qe);return}Y.clearRect(0,0,H,z);const xe=Jt(fe,X,(Wn=u.referenceLine)==null?void 0:Wn.value,u.exaggerate),kt=Me.startMs>0,He=tr(xe,f.current,s.current,h.current,c.current,a.current,kt,gt,Me,ae,Je,j);f.current=He.rangeInited,s.current=He.targetMin,h.current=He.targetMax,c.current=He.displayMin,a.current=He.displayMax;const{minVal:We,maxVal:Ee,valRange:Xe}=He,rt={w:H,h:z,pad:O,chartW:se,chartH:Je,leftEdge:Be,rightEdge:je,minVal:We,maxVal:Ee,valRange:Xe,toX:re=>O.left+(re-Be)/(je-Be)*se,toY:re=>O.top+(1-(re-We)/Xe)*Je},Ge=u.momentumOverride??Bn(fe),Qe=Ao(b.current,O,H,rt,be,fe,d.current,L.current,u,$e,Be,je,se);d.current=Qe.scrubAmount,L.current=Qe.lastHover;const{hoverX:mt,hoverValue:bt,hoverTime:Et}=Qe,me=Math.min(5,fe.length-1),vt=me>0?Math.abs(fe[fe.length-1].value-fe[fe.length-1-me].value):0,Lt=Xe>0?Math.min(vt/Xe,1):0;xr(Y,rt,u.palette,{visible:fe,smoothValue:X,now:be,momentum:Ge,arrowState:m.current,showGrid:u.showGrid,showMomentum:u.showMomentum,showPulse:u.showPulse,showFill:u.showFill,referenceLine:u.referenceLine,hoverX:mt,hoverValue:bt,hoverTime:Et,scrubAmount:d.current,windowSecs:we,formatValue:u.formatValue,formatTime:u.formatTime,gridState:v.current,timeAxisState:S.current,dt:te,targetWindowSecs:u.windowSecs,tooltipY:u.tooltipY,tooltipOutline:u.tooltipOutline,orderbookData:u.orderbookData,orderbookState:u.orderbookData?R.current:void 0,particleState:u.degenOptions?y.current:void 0,particleOptions:u.degenOptions,swingMagnitude:Lt,shakeState:u.degenOptions?T.current:void 0,chartReveal:Ve,pauseProgress:ne,now_ms:Z});const st=1-Ve;if(st>.01&&Tt===0&&!u.loading){const re=(1-Ze)*st;re>.01&&Ot(Y,H,z,O,u.palette,re,Z,!0,u.emptyText)}const he=k.current;if(he&&(P.current=nr(he,u,X,rt,Ge,P.current,C.current,kt,$e,Y,j,Ve),ne>.01&&he.container.style.display!=="none")){const re=he.container.style.opacity?parseFloat(he.container.style.opacity):1;he.container.style.opacity=String(re*(1-ne))}const De=(Dn=u.valueDisplayRef)==null?void 0:Dn.current;if(De){const re=u.valueMomentumColor?Math.abs(X):X;if(De.textContent=u.formatValue(re),u.valueMomentumColor){const _=Ge==="up"?"#22c55e":Ge==="down"?"#ef4444":"";_?De.style.color=_:De.style.removeProperty("color")}}}A.current=requestAnimationFrame(qe)},[e]);w.useEffect(()=>(A.current=requestAnimationFrame(qe),()=>cancelAnimationFrame(A.current)),[qe])}var Po=e=>e.toFixed(2),ko=e=>{const r=new Date(e*1e3),n=r.getHours().toString().padStart(2,"0"),t=r.getMinutes().toString().padStart(2,"0"),l=r.getSeconds().toString().padStart(2,"0");return`${n}:${t}:${l}`};function Wo({data:e,value:r,series:n,theme:t="dark",color:l="#3b82f6",window:o=30,grid:i=!0,badge:c=!0,momentum:a=!0,fill:s=!0,scrub:h=!0,loading:f=!1,paused:g=!1,emptyText:M,exaggerate:m=!1,degen:v,badgeTail:S=!0,badgeVariant:R="default",showValue:y=!1,valueMomentumColor:T=!1,windows:C,onWindowChange:P,windowStyle:E,tooltipY:I=14,tooltipOutline:p=!0,orderbook:A,referenceLine:W,formatValue:k=Po,formatTime:b=ko,lerpSpeed:d=.08,padding:L,onHover:K,cursor:Q="crosshair",pulse:q=!0,mode:oe="line",candles:x,candleWidth:ze,liveCandle:Ne,lineMode:ue,lineData:ye,lineValue:ve,onModeChange:Pe,onSeriesToggle:Re,seriesToggleCompact:Te=!1,lineWidth:Ye,className:Mt,style:ft}){var Je;const St=w.useRef(null),ht=w.useRef(null),Ht=w.useRef(null),It=w.useRef(null),_t=w.useRef(new Map),[et,yt]=w.useState(null),Xt=w.useRef(null),it=w.useRef(new Map),[at,Bt]=w.useState(null),[Pt,Ft]=w.useState(new Set),wt=w.useRef(n);n&&n.length>0&&(wt.current=n);const Gt=w.useMemo(()=>{const $=on(l,t);return Ye!=null&&($.lineWidth=Ye),$},[l,t,Ye]),Ue=t==="dark",tt=n!=null&&n.length>0,qe=(((Je=wt.current)==null?void 0:Je.length)??0)>1,F=w.useMemo(()=>!n||n.length===0?null:gr(n,t),[n,t]),H=w.useMemo(()=>{if(!(!n||!F))return n.map(($,ne)=>({id:$.id,data:$.data,value:$.value,palette:F.get($.id)??on($.color||Dt[ne%Dt.length],t),label:$.label}))},[n,F,t]),z=a!==!1,u=typeof a=="string"?a:void 0,_e=c?80:i?54:12,Z={top:(L==null?void 0:L.top)??12,right:(L==null?void 0:L.right)??_e,bottom:(L==null?void 0:L.bottom)??28,left:(L==null?void 0:L.left)??12},ke=(v!=null?v!==!1:!1)?typeof v=="object"?v:{}:void 0,[Rt,Y]=w.useState(C&&C.length>0?C[0].secs:o),$e=C?Rt:o;w.useLayoutEffect(()=>{if(!C||C.length===0)return;const $=_t.current.get(Rt),ne=It.current;if($&&ne){const j=ne.getBoundingClientRect(),nt=$.getBoundingClientRect();yt({left:nt.left-j.left,width:nt.width})}},[Rt,C]);const Ae=ue?"line":"candle";w.useLayoutEffect(()=>{if(!Pe)return;const $=it.current.get(Ae),ne=Xt.current;if($&&ne){const j=ne.getBoundingClientRect(),nt=$.getBoundingClientRect();Bt({left:nt.left-j.left,width:nt.width})}},[Ae,Pe]);const $t=w.useCallback($=>{Ft(ne=>{const j=new Set(ne);if(j.has($))j.delete($),Re==null||Re($,!0);else{if(((n==null?void 0:n.length)??0)-j.size<=1)return ne;j.add($),Re==null||Re($,!1)}return j})},[n==null?void 0:n.length,Re]),U=E??"default";yo(St,ht,{data:e,value:r,palette:Gt,windowSecs:$e,lerpSpeed:d,showGrid:i,showBadge:tt?!1:c,showMomentum:tt?!1:z,momentumOverride:u,showFill:tt?!1:s,referenceLine:W,formatValue:k,formatTime:b,padding:Z,onHover:K,showPulse:q,scrub:h,exaggerate:m,degenOptions:tt?void 0:ke,badgeTail:S,badgeVariant:R,tooltipY:I,tooltipOutline:p,valueMomentumColor:T,valueDisplayRef:y?Ht:void 0,orderbookData:A,loading:f,paused:g,emptyText:M,mode:oe,candles:x,candleWidth:ze,liveCandle:Ne,lineMode:ue,lineData:ye,lineValue:ve,multiSeries:H,isMultiSeries:tt,hiddenSeriesIds:Pt});const Nt=h?Q:"default",ge=Ue?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",O=Ue?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.22)";return ce.jsxs(ce.Fragment,{children:[y&&ce.jsx("span",{ref:Ht,style:{display:"block",fontSize:20,fontWeight:500,fontFamily:'"SF Mono", Menlo, monospace',color:Ue?"rgba(255,255,255,0.85)":"#111",transition:"color 0.3s",letterSpacing:"-0.01em",marginBottom:8,paddingTop:4,paddingLeft:Z.left}}),(C&&C.length>0||Pe||qe)&&ce.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6,marginLeft:Z.left},children:[C&&C.length>0&&ce.jsxs("div",{ref:It,style:{position:"relative",display:"inline-flex",gap:U==="text"?4:2,background:U==="text"?"transparent":Ue?"rgba(255,255,255,0.03)":"rgba(0,0,0,0.02)",borderRadius:U==="rounded"?999:6,padding:U==="text"?0:U==="rounded"?3:2},children:[U!=="text"&&et&&ce.jsx("div",{style:{position:"absolute",top:U==="rounded"?3:2,left:et.left,width:et.width,height:U==="rounded"?"calc(100% - 6px)":"calc(100% - 4px)",background:Ue?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.035)",borderRadius:U==="rounded"?999:4,transition:"left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"none"}}),C.map($=>{const ne=$.secs===Rt;return ce.jsx("button",{ref:j=>{j?_t.current.set($.secs,j):_t.current.delete($.secs)},onClick:()=>{Y($.secs),P==null||P($.secs)},style:{position:"relative",zIndex:1,fontSize:11,padding:U==="text"?"2px 6px":"3px 10px",borderRadius:U==="rounded"?999:4,border:"none",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontWeight:ne?600:400,background:"transparent",color:ne?ge:O,transition:"color 0.2s, background 0.15s",lineHeight:"16px"},children:$.label},$.secs)})]}),Pe&&ce.jsxs("div",{ref:Xt,style:{position:"relative",display:"inline-flex",gap:U==="text"?4:2,background:U==="text"?"transparent":Ue?"rgba(255,255,255,0.03)":"rgba(0,0,0,0.02)",borderRadius:U==="rounded"?999:6,padding:U==="text"?0:U==="rounded"?3:2},children:[U!=="text"&&at&&ce.jsx("div",{style:{position:"absolute",top:U==="rounded"?3:2,left:at.left,width:at.width,height:U==="rounded"?"calc(100% - 6px)":"calc(100% - 4px)",background:Ue?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.035)",borderRadius:U==="rounded"?999:4,transition:"left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"none"}}),ce.jsx("button",{ref:$=>{$?it.current.set("line",$):it.current.delete("line")},onClick:()=>Pe("line"),style:{position:"relative",zIndex:1,padding:"5px 7px",borderRadius:U==="rounded"?999:4,border:"none",cursor:"pointer",background:"transparent",display:"flex",alignItems:"center"},children:ce.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:ce.jsx("path",{d:"M1 8.5C2.5 8.5 3 4 5.5 4S7.5 7 8.5 7C9.5 7 10 3.5 11 3.5",stroke:Ae==="line"?ge:O,strokeWidth:Ae==="line"?1.5:1.2,strokeLinecap:"round",fill:"none"})})}),ce.jsx("button",{ref:$=>{$?it.current.set("candle",$):it.current.delete("candle")},onClick:()=>Pe("candle"),style:{position:"relative",zIndex:1,padding:"5px 7px",borderRadius:U==="rounded"?999:4,border:"none",cursor:"pointer",background:"transparent",display:"flex",alignItems:"center"},children:ce.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[ce.jsx("line",{x1:"3.5",y1:"1",x2:"3.5",y2:"11",stroke:Ae==="candle"?ge:O,strokeWidth:"1"}),ce.jsx("rect",{x:"2",y:"3",width:"3",height:"5",rx:"0.5",fill:Ae==="candle"?ge:O}),ce.jsx("line",{x1:"8.5",y1:"2",x2:"8.5",y2:"10",stroke:Ae==="candle"?ge:O,strokeWidth:"1"}),ce.jsx("rect",{x:"7",y:"4",width:"3",height:"4",rx:"0.5",fill:Ae==="candle"?ge:O})]})})]}),qe&&ce.jsx("div",{style:{display:"inline-flex",gap:U==="text"?4:2,background:U==="text"?"transparent":Ue?"rgba(255,255,255,0.03)":"rgba(0,0,0,0.02)",borderRadius:U==="rounded"?999:6,padding:U==="text"?0:U==="rounded"?3:2,opacity:tt?1:0,transition:"opacity 0.4s",pointerEvents:tt?"auto":"none"},children:(wt.current??[]).map(($,ne)=>{const j=Pt.has($.id),nt=$.color||Dt[ne%Dt.length];return ce.jsxs("button",{onClick:()=>$t($.id),style:{position:"relative",zIndex:1,fontSize:11,padding:Te?U==="text"?"2px 4px":"5px 7px":U==="text"?"2px 6px":"3px 8px",borderRadius:U==="rounded"?999:4,border:"none",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontWeight:500,background:j||U==="text"?"transparent":Ue?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.035)",color:j?O:ge,opacity:j?.4:1,transition:"opacity 0.2s, background 0.15s, color 0.2s",lineHeight:"16px",display:"flex",alignItems:"center",gap:Te?0:4},children:[ce.jsx("span",{style:{width:Te?8:6,height:Te?8:6,borderRadius:"50%",background:nt,flexShrink:0,opacity:j?.4:1,transition:"opacity 0.2s"}}),!Te&&($.label??$.id)]},$.id)})})]}),ce.jsx("div",{ref:ht,className:Mt,style:{width:"100%",height:"100%",position:"relative",...ft},children:ce.jsx("canvas",{ref:St,style:{display:"block",cursor:Nt}})})]})}export{Wo as L};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as p,j as m}from"./react-qoZPGuNy.js";import{f as i,a as c}from"./format-CfAcS4D8.js";import{f,au as n,av as u}from"./index-C_O7gp2F.js";import{T as d,a as h}from"./treemap-leaf-DLQawrx4.js";import{F as s}from"./ui-Bq3RQsdJ.js";import"./utils-DaT-yT0k.js";import"./d3-xK4fOkBU.js";n.schema;function l({width:r,height:o,data:a}){const t=i(a.marketCapUsd);return m.jsx(h,{width:r,height:o,label:a.id,secondary:t,title:`${a.id} · ${t} mcap · ${c(a.changePct24h)}`})}function C({config:r}){const{entries:o,isLoading:a}=u(),t=p.useMemo(()=>o.slice(0,r.topN).map(e=>({id:e.symbol,value:e.marketCapUsd,marketCapUsd:e.marketCapUsd,changePct24h:e.changePct24h??0})),[o,r.topN]);return a?m.jsx(s,{loading:!0,children:"loading market caps…"}):t.length===0?m.jsx(s,{children:"no market data"}):m.jsx(d,{data:t,LeafComponent:l,getColorValue:e=>e.changePct24h})}const F=f({...n,component:C});export{F as marketCapTreemapFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as v,j as $}from"./react-qoZPGuNy.js";import{s as G,c as H,e as j,l as L,d as N,f as V,g as X}from"./d3-xK4fOkBU.js";import{c as q}from"./utils-DaT-yT0k.js";const Q=({data:n,width:l=120,height:g=40,color:d,className:R,variant:b="default"})=>{const h=v.useRef(null),{strokeColor:x,isPositive:y,variantType:p,customColor:m}=v.useMemo(()=>{var r,s;if(d)return{strokeColor:d,isPositive:!0,variantType:"custom",customColor:d};if(b==="auto"&&n.length>0){const f=((r=n[0])==null?void 0:r.value)??0,o=(((s=n[n.length-1])==null?void 0:s.value)??0)>=f;return{strokeColor:o?"var(--color-green-500)":"var(--color-red-500)",isPositive:o,variantType:o?"green":"red",customColor:void 0}}switch(b){case"green":return{strokeColor:"var(--color-green-500)",isPositive:!0,variantType:"green",customColor:void 0};case"red":return{strokeColor:"var(--color-red-500)",isPositive:!1,variantType:"red",customColor:void 0};case"blue":return{strokeColor:"#75A3FF",isPositive:!0,variantType:"blue",customColor:void 0};default:return{strokeColor:"var(--color-blue-600)",isPositive:!0,variantType:"blue",customColor:void 0}}},[d,b,n]),u=v.useMemo(()=>{if(!n||n.length===0)return[];const r=n.map(o=>({...o,date:new Date(o.date)})),s=Math.max(30,Math.floor(l/4));if(r.length<=s)return r;const f=Math.floor(r.length/s),a=[];for(let o=0;o<r.length;o+=f)a.push(r[o]);return a[a.length-1]!==r[r.length-1]&&a.push(r[r.length-1]),a},[n,l]);return v.useEffect(()=>{if(!h.current||!u.length)return;const r=G(h.current),s={top:2,right:0,bottom:2,left:0},f=l-s.left-s.right,a=g-s.top-s.bottom;r.selectAll("*").remove();const o=H().domain(j(u,t=>t.date)).range([0,f]),[C,k]=j(u,t=>t.value),W=(k-C)*.4,P=L().domain([C-W,k]).range([a,0]),E=N().x(t=>o(t.date)).y(t=>P(t.value)).curve(V),M=r.append("g").attr("transform",`translate(${s.left},${s.top})`),F=X().x(t=>o(t.date)).y0(a).y1(t=>P(t.value)).curve(V),T=`mini-chart-gradient-${Math.random().toString(36).slice(2,11)}`,i=r.append("defs").append("linearGradient").attr("id",T).attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%"),I=(t,c)=>{if(t.startsWith("var("))return t.includes("blue")?`rgba(59, 130, 246, ${c})`:t.includes("green")?`rgba(37, 255, 205, ${c})`:t.includes("red")?`rgba(239, 68, 68, ${c})`:`rgba(59, 130, 246, ${c})`;if(t.startsWith("#")){const e=t.slice(1),A=e.length===3?parseInt(e[0]+e[0],16):parseInt(e.slice(0,2),16),D=e.length===3?parseInt(e[1]+e[1],16):parseInt(e.slice(2,4),16),B=e.length===3?parseInt(e[2]+e[2],16):parseInt(e.slice(4,6),16);return`rgba(${A}, ${D}, ${B}, ${c})`}if(t.startsWith("rgb")){const e=t.match(/\d+/g);if(e&&e.length>=3)return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${c})`}return`rgba(59, 130, 246, ${c})`};p==="custom"&&m?(i.append("stop").attr("offset","45.9%").attr("stop-color",I(m,.16)),i.append("stop").attr("offset","96.67%").attr("stop-color",I(m,0))):p==="blue"?(i.append("stop").attr("offset","45.9%").attr("stop-color","rgba(7, 77, 215, 0.3)"),i.append("stop").attr("offset","96.67%").attr("stop-color","rgba(7, 77, 215, 0.3)")):p==="green"||y&&p!=="red"?(i.append("stop").attr("offset","45.9%").attr("stop-color","rgba(63, 194, 167, 0.1)"),i.append("stop").attr("offset","96.67%").attr("stop-color","rgba(63, 194, 167, 0)")):(i.append("stop").attr("offset","0%").attr("stop-color","rgba(255, 93, 127, 0.1)"),i.append("stop").attr("offset","91.8%").attr("stop-color","rgba(255, 63, 105, 0)")),M.append("path").datum(u).attr("fill",`url(#${T})`).attr("d",F),M.append("path").datum(u).attr("fill","none").attr("stroke",x).attr("stroke-width",1).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("d",E)},[u,l,g,x,y,p,m]),!n||n.length===0?$.jsx($.Fragment,{}):$.jsx("svg",{ref:h,width:l,height:g,viewBox:`0 0 ${l} ${g}`,className:q("h-auto max-w-full",R),style:{width:l,height:"auto"}})};export{Q as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,r as u}from"./react-qoZPGuNy.js";import{F as h}from"./feed-row-mVg1d5Zj.js";import{t as f}from"./format-CfAcS4D8.js";import{f as p,Y as i,Z as x}from"./index-C_O7gp2F.js";import{F as t,s as b}from"./ui-Bq3RQsdJ.js";i.schema;const j={coindesk:"CoinDesk",cointelegraph:"Cointelegraph",decrypt:"Decrypt",cnbc:"CNBC Markets",nasdaq:"Nasdaq",stocks:"Google News"};function g({src:e}){const[r,a]=u.useState(!1);return r?null:s.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",onError:()=>a(!0),className:"size-12 shrink-0 rounded-md bg-white/[0.04] object-cover ring-1 ring-white/10"})}function y({item:e}){return s.jsx(h,{href:e.url,leading:e.imageUrl?s.jsx(g,{src:e.imageUrl}):void 0,title:e.title,subtitle:e.summary||void 0,meta:e.publishedAt!==void 0?f(e.publishedAt):void 0})}function w({config:e}){var n;const r=e.source==="stocks",a=r&&e.symbols.length===0,c=a?"":e.source,{items:o,isLoading:d}=x(c,r?e.symbols:void 0,e.count);if(a)return s.jsx(t,{children:"add stock symbols to show company headlines"});if(d)return s.jsx(t,{loading:!0,children:"loading headlines…"});const m=((n=o[0])==null?void 0:n.source)??j[e.source]??"news";return s.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2",children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[s.jsx("span",{className:"caption text-soft truncate",children:m}),s.jsx("span",{className:"caption text-soft shrink-0",children:"headlines"})]}),s.jsx("div",{className:b,children:o.length>0?o.map(l=>s.jsx(y,{item:l},l.url)):s.jsxs(t,{children:["no headlines ",r?"for these symbols":"available"," — the runtime proxy may be offline"]})})]})}const S=p({...i,component:w});export{S as newsFeedFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,j as c}from"./react-qoZPGuNy.js";import{f,_ as m,m as d}from"./index-C_O7gp2F.js";import{s as p}from"./ui-Bq3RQsdJ.js";m.schema;function h({config:e}){const t=d(),[n,o]=a.useState(!1),[r,l]=a.useState(e.text),i=a.useRef(null);a.useEffect(()=>{l(e.text)},[e.text]),a.useEffect(()=>{var s;n&&((s=i.current)==null||s.focus())},[n]);const u=a.useCallback(()=>{r!==e.text&&(t==null||t({text:r})),o(!1)},[t,r,e.text]),x=e.align==="center"?"flex items-center justify-center text-center":"";return n?c.jsx("textarea",{ref:i,className:`body-sm text-normal h-full w-full resize-none bg-transparent outline-none placeholder:text-disabled ${x}`,value:r,onChange:s=>l(s.target.value),onBlur:u,onKeyDown:s=>{s.key==="Escape"&&(l(e.text),o(!1))},placeholder:"Write a note…"}):c.jsx("div",{className:`body-sm text-normal whitespace-pre-wrap ${p} ${x} ${t?"cursor-text":""}`,onClick:()=>t&&o(!0),title:t?"Click to edit":void 0,children:e.text||c.jsx("span",{className:"text-soft italic",children:t?"Click to add a note…":"New note"})})}const b=f({...m,component:h});export{b as noteFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as n}from"./react-qoZPGuNy.js";import{L as y}from"./liveline-C5zt2WuS.js";import{f as j,a as E,c as S}from"./format-CfAcS4D8.js";import{P as C,u as I,a as L}from"./portfolio-common-D5L06PNC.js";import{f as V,p as N}from"./index-C_O7gp2F.js";import"./ui-Bq3RQsdJ.js";const w=720,A=1e3,f=3,D={top:12,right:66,bottom:28,left:8};N.schema;function R(){return typeof document>"u"?"hsl(242 90% 66%)":`hsl(${getComputedStyle(document.documentElement).getPropertyValue("--zf-accent-hue").trim()||"242"} 90% 66%)`}function _({portfolio:a,config:c,windowSec:d}){var b;const{total:t}=I(a.holdings),h=n.useMemo(()=>R(),[]),[s,M]=n.useState([]),x=n.useRef(t);n.useEffect(()=>{x.current=t},[t]);const i=n.useCallback(()=>{const o=x.current;if(!Number.isFinite(o)||o<=0)return;const r=Date.now()/1e3;M(l=>{const m=l[l.length-1];if(m&&Math.abs(r-m.time)<.5&&m.value===o)return l;const u=l.length===0?[{time:r-f,value:o},{time:r,value:o}]:[...l,{time:r,value:o}];return u.length>w?u.slice(-w):u})},[]);n.useEffect(()=>{i()},[i,t]),n.useEffect(()=>{const o=window.setInterval(i,A);return()=>window.clearInterval(o)},[i]);const p=(b=s[0])==null?void 0:b.value,g=p&&t?(t/p-1)*100:0,P=n.useMemo(()=>s.length===0?[]:[{id:"equity",label:"Portfolio",color:h,data:s,value:t}],[s,t,h]),v=n.useMemo(()=>{if(s.length===0)return f;const o=s[s.length-1].time-s[0].time;return Math.min(d,Math.max(f,Math.ceil(o)))},[s,d]);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"flex flex-none items-baseline justify-between border-b border-white/[0.06] pb-2",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(L,{portfolio:a,config:c,className:"caption text-soft"}),e.jsx("span",{className:"metric-md text-strong",children:j(t)})]}),e.jsxs("span",{className:"body-sm font-semibold tabular-nums",style:{color:S(g)},children:[E(g)," ",e.jsx("span",{className:"caption text-soft",children:"session"})]})]}),e.jsx("div",{className:"min-h-0 flex-1 [&>div[style*='align-items']]:!hidden",children:e.jsx(y,{data:[],value:t,series:P,theme:"dark",window:v,grid:!0,loading:s.length<=1,scrub:!1,badge:!1,formatValue:j,padding:D,style:{width:"100%",height:"100%"}})})]})}function F({config:a}){return e.jsx(C,{config:a,loadingLabel:"loading portfolio…",children:c=>e.jsx(_,{portfolio:c,config:a,windowSec:a.windowSec})})}const H=V({...N,component:F});export{H as portfolioValueFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as c,r as i}from"./react-qoZPGuNy.js";import{L as x}from"./liveline-C5zt2WuS.js";import{f as C,$ as f,A as L,a0 as y,k as T}from"./index-C_O7gp2F.js";import{d as b}from"./format-CfAcS4D8.js";import{F as E}from"./ui-Bq3RQsdJ.js";const u={"1m":6e4,"5m":5*6e4,"15m":15*6e4,"1h":60*6e4,"4h":240*6e4,"1d":1440*6e4},p=60,j={top:12,right:56,bottom:28,left:12};f.schema;function A({config:t}){const s=u[t.interval],g=i.useMemo(()=>Date.now()-s*p,[s]),{candles:n,isLoading:h}=y(t.symbol,t.interval,g,Math.min(s,6e4)),a=T([t.symbol])[t.symbol],[m,d]=i.useState([]);i.useEffect(()=>{a!==void 0&&d(e=>{const r=[...e,{time:Date.now()/1e3,value:a}];return r.length>900?r.slice(-600):r})},[a]),i.useEffect(()=>d([]),[t.symbol]);const w=i.useMemo(()=>n.slice(0,-1).map(e=>({time:e.time/1e3,open:e.open,high:e.high,low:e.low,close:e.close})),[n]),o=n[n.length-1],M=i.useMemo(()=>{if(!o)return;const e=a??o.close;return{time:o.time/1e3,open:o.open,high:Math.max(o.high,e),low:Math.min(o.low,e),close:e}},[o,a]),v=a??(o==null?void 0:o.close)??0,D=i.useMemo(()=>s>=u["1d"]?e=>new Date(e*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"}):s>=u["1h"]?e=>{const r=new Date(e*1e3);return`${r.toLocaleDateString("en-US",{month:"short",day:"numeric"})} ${String(r.getHours()).padStart(2,"0")}h`}:e=>new Date(e*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),[s]),S=i.useMemo(()=>{const e=n.map(l=>({time:l.time/1e3,value:l.close}));if(m.length===0)return e;const r=m[0].time;return[...e.filter(l=>l.time<r),...m]},[n,m]);return h&&n.length===0?c.jsx(E,{loading:!0,children:"loading chart…"}):c.jsx("div",{className:"h-full min-h-0",children:c.jsx(x,{mode:t.mode,data:S,value:v,candles:w,candleWidth:s/1e3,liveCandle:M,window:s/1e3*p,color:t.color,theme:"dark",loading:h,formatValue:e=>b(e),formatTime:D,padding:j,showValue:!0,fill:!0,pulse:!0})})}const U=C({...f,component:A,titleIcon:({config:t})=>c.jsx(L,{symbol:t.symbol,size:14})});export{U as priceChartFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as t}from"./react-qoZPGuNy.js";import{f as v,a1 as f,a2 as L,a3 as O,h as j}from"./index-C_O7gp2F.js";import{a as g,d as D}from"./format-CfAcS4D8.js";import{F as h}from"./ui-Bq3RQsdJ.js";import{a as s,C as u}from"./chart-utils-BYIZMM9J.js";import{M as E}from"./index-jnySFpSv.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";const F={"24h":{ms:1440*60*1e3,interval:"15m",timeframe:s["24h"]},"7D":{ms:10080*60*1e3,interval:"1h",timeframe:s["7D"]},"1M":{ms:720*60*60*1e3,interval:"4h",timeframe:s["1M"]}};f.schema;function I({config:a}){const{ms:m,interval:d,timeframe:C}=F[a.lookback],M=c.useMemo(()=>Date.now()-m,[m]),{candles:o,isLoading:S}=L(a.symbols,d,M),i=c.useMemo(()=>a.symbols.map((e,x)=>{var p;const n=o[e]??[],l=(p=n[0])==null?void 0:p.close;return{id:e,name:j(e),iconImageUrl:O(e),color:u[x%u.length],data:n.map(r=>({date:new Date(r.time).toISOString(),value:a.normalize&&l?(r.close/l-1)*100:r.close}))}}),[a.symbols,a.normalize,o]);return S?t.jsx(h,{loading:!0,children:"loading prices…"}):i.every(e=>e.data.length===0)?t.jsx(h,{children:"no price data yet"}):t.jsx(E,{series:i,timeframe:C,height:250,formatValue:a.normalize?e=>g(e):e=>D(e)})}const w=v({...f,component:I});export{w as priceCompareFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,j as l}from"./react-qoZPGuNy.js";import{L as R}from"./liveline-C5zt2WuS.js";import{f as F,a4 as k,k as T,v as H,h as y,A as W}from"./index-C_O7gp2F.js";import{d as P,a as I,c as $}from"./format-CfAcS4D8.js";import{C as M}from"./chart-utils-BYIZMM9J.js";import"./d3-xK4fOkBU.js";const E=720,B=1e3,z=3,V={top:12,right:58,bottom:28,left:8};k.schema;function L(i){return i!==void 0&&Number.isFinite(i)}function G(i,s,w,h){let v=!1;const u={...i};for(const g of s){const d=w[g];if(!L(d))continue;const p=u[g]??[],m=p[p.length-1];if(m&&Math.abs(h-m.time)<.5&&m.value===d)continue;const x=p.length===0?[{time:h-z,value:d},{time:h,value:d}]:[...p,{time:h,value:d}];u[g]=x.length>E?x.slice(-E):x,v=!0}return v?u:i}function _(i,s){return s===0?0:(i/s-1)*100}function K({config:i}){const s=i.symbols,w=s.join("|"),h=T(s),v=H(s),[u,g]=r.useState({}),[d,p]=r.useState(()=>new Set),m=r.useMemo(()=>{var n;const e={};for(const t of s){const a=h[t]??((n=v[t])==null?void 0:n.markPx);L(a)&&(e[t]=a)}return e},[h,v,s]),x=r.useRef(m);r.useEffect(()=>{x.current=m},[m]),r.useEffect(()=>{const e=new Set(s);g(n=>{let t=!1;const a={};for(const[o,f]of Object.entries(n)){if(!e.has(o)){t=!0;continue}a[o]=f}return t?a:n}),p(n=>{const t=new Set([...n].filter(a=>e.has(a)));return t.size===n.size?n:t})},[w,s]);const A=r.useCallback(e=>{p(n=>{const t=new Set(n);return t.has(e)?(t.delete(e),t):s.length-t.size<=1?n:(t.add(e),t)})},[s]),S=r.useCallback(()=>{const e=x.current;if(Object.keys(e).length===0)return;const n=Date.now()/1e3;g(t=>G(t,s,e,n))},[w,s]);r.useEffect(()=>{S()},[S,m]),r.useEffect(()=>{const e=window.setInterval(S,B);return()=>window.clearInterval(e)},[S]);const N=r.useMemo(()=>s.flatMap((e,n)=>{var f,c;if(d.has(e))return[];const t=u[e]??[],a=(f=t[0])==null?void 0:f.value;if(!a||t.length===0)return[];const o=i.normalize?t.map(b=>({time:b.time,value:_(b.value,a)})):t;return[{id:e,label:y(e),color:M[n%M.length],data:o,value:((c=o[o.length-1])==null?void 0:c.value)??0}]}),[u,d,s,i.normalize]),D=r.useMemo(()=>{var a,o;let e=1/0,n=-1/0;for(const f of s){const c=u[f]??[];c.length!==0&&(e=Math.min(e,((a=c[0])==null?void 0:a.time)??1/0),n=Math.max(n,((o=c[c.length-1])==null?void 0:o.time)??-1/0))}const t=Number.isFinite(e)&&Number.isFinite(n)?n-e:0;return Math.min(i.windowSec,Math.max(z,Math.ceil(t)))},[u,s,i.windowSec]),O=N.some(e=>e.data.length>1);return l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[l.jsx("div",{className:"grid flex-none grid-cols-1 gap-x-3 gap-y-1.5 border-b border-white/[0.06] pb-2 sm:grid-cols-2",children:s.map((e,n)=>{var b,C;const t=m[e],a=(C=(b=u[e])==null?void 0:b[0])==null?void 0:C.value,o=t!==void 0&&a?_(t,a):void 0,f=M[n%M.length],c=d.has(e);return l.jsxs("button",{type:"button","aria-pressed":!c,title:`${c?"Show":"Hide"} ${y(e)}`,className:`caption grid min-w-0 grid-cols-[auto_auto_minmax(0,1fr)_auto] items-center gap-1.5 rounded-md px-1.5 py-0.5 text-left transition ${c?"opacity-40 hover:opacity-70":"bg-white/[0.035] opacity-100 hover:bg-white/[0.06]"}`,onClick:j=>{j.stopPropagation(),A(e)},onPointerDown:j=>j.stopPropagation(),children:[l.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:f}}),l.jsx(W,{symbol:e,size:14}),l.jsx("span",{className:"truncate font-bold text-strong",children:y(e)}),l.jsxs("span",{className:"text-normal tabular-nums",children:[t!==void 0?P(t):"…",o!==void 0?l.jsx("span",{className:"ml-1 tabular-nums",style:{color:$(o)},children:I(o)}):null]})]},e)})}),l.jsx("div",{className:"min-h-0 flex-1 [&>div[style*='align-items']]:!hidden",children:l.jsx(R,{data:[],value:0,series:N,theme:"dark",window:D,grid:!0,loading:!O,scrub:!1,badge:!1,formatValue:i.normalize?I:P,padding:V,seriesToggleCompact:s.length>4,style:{width:"100%",height:"100%"}})})]})}const Z=F({...k,component:K});export{Z as priceLivelineFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as s}from"./react-qoZPGuNy.js";import{f as i}from"./format-CfAcS4D8.js";import{f as p,as as n,at as f}from"./index-C_O7gp2F.js";import{T as l,a as u}from"./treemap-leaf-DLQawrx4.js";import{F as m}from"./ui-Bq3RQsdJ.js";import"./utils-DaT-yT0k.js";import"./d3-xK4fOkBU.js";n.schema;function h({width:r,height:a,data:o}){const t=i(o.fees24h);return s.jsx(u,{width:r,height:a,label:o.id,secondary:t,title:`${o.id} · ${t} 24h fees`})}function d({config:r}){const{entries:a,isLoading:o}=f(),t=c.useMemo(()=>a.slice(0,r.topN).map(e=>({id:e.name,value:e.fees24h,fees24h:e.fees24h,changePct:e.changePct??0})),[a,r.topN]);return o?s.jsx(m,{loading:!0,children:"loading protocol fees…"}):t.length===0?s.jsx(m,{children:"no protocol fee data"}):s.jsx(l,{data:t,LeafComponent:h,getColorValue:e=>e.changePct})}const L=p({...n,component:d});export{L as protocolFeesTreemapFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n,j as s}from"./react-qoZPGuNy.js";import{f as c}from"./format-CfAcS4D8.js";import{f as p,ao as l,ap as i}from"./index-C_O7gp2F.js";import{T as f,a as u}from"./treemap-leaf-DLQawrx4.js";import{F as m}from"./ui-Bq3RQsdJ.js";import"./utils-DaT-yT0k.js";import"./d3-xK4fOkBU.js";l.schema;function T({width:r,height:a,data:t}){const e=c(t.tvl);return s.jsx(u,{width:r,height:a,label:t.id,secondary:e,title:`${t.id} · ${e} TVL`})}function d({config:r}){const{entries:a,isLoading:t}=i(),e=n.useMemo(()=>a.slice(0,r.topN).map(o=>({id:o.name,value:o.tvl,tvl:o.tvl,changePct:o.changePct??0})),[a,r.topN]);return t?s.jsx(m,{loading:!0,children:"loading protocol TVL…"}):e.length===0?s.jsx(m,{children:"no protocol TVL data"}):s.jsx(f,{data:e,LeafComponent:T,getColorValue:o=>o.changePct})}const C=p({...l,component:d});export{C as protocolTvlTreemapFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as s}from"./react-qoZPGuNy.js";import{f,af as m,a7 as g,h as l}from"./index-C_O7gp2F.js";import{M as i}from"./mover-row-kQ9xt3Sp.js";import{F as n}from"./ui-Bq3RQsdJ.js";import"./format-CfAcS4D8.js";m.schema;const h=["xyz:*"];function u({config:t}){const{stats:c,isLoading:p}=g(h,6e4),{gainers:o,losers:x}=d.useMemo(()=>{const e=Object.entries(c).map(([a,r])=>({symbol:a,...r})).filter(a=>a.symbol.includes(":")&&a.markPx>0&&a.prevDayPx>0).sort((a,r)=>r.changePct-a.changePct);return{gainers:e.slice(0,t.count),losers:e.slice(-t.count).reverse()}},[c,t.count]);return p?s.jsx(n,{loading:!0,children:"loading movers…"}):o.length===0?s.jsx(n,{children:"no mover data yet"}):s.jsxs("div",{className:"grid h-full grid-cols-2 gap-x-4 overflow-hidden",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("div",{className:"caption text-soft uppercase tracking-wide",children:"gainers"}),o.map(e=>s.jsx(i,{symbol:e.symbol,label:l(e.symbol),price:e.markPx,changePct:e.changePct},e.symbol))]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("div",{className:"caption text-soft uppercase tracking-wide",children:"losers"}),x.map(e=>s.jsx(i,{symbol:e.symbol,label:l(e.symbol),price:e.markPx,changePct:e.changePct},e.symbol))]})]})}const M=f({...m,component:u});export{M as topMoversFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as T}from"./react-qoZPGuNy.js";import{c as P}from"./utils-DaT-yT0k.js";import{w as $,x as z,y as H}from"./d3-xK4fOkBU.js";const E="4px",S="4px",k=2.5,U=(b,v,y,g,B)=>{const R=b.children;if(!R||R.length===0)return;const I=(s,i,n,e,l)=>{if(e===0)return 1/0;const c=i/e*l;if(c===0)return 1/0;let r=0;for(const u of s){const o=(u.value||0)/i*n,x=c/o,h=Math.abs(x-k);r=Math.max(r,h)}return r},L=(s,i,n,e,l,c,r)=>{const u=i/n*l;let a=r;for(const o of s){const h=(o.value||0)/i*e;o.x0=c,o.y0=a,o.x1=c+u,o.y1=a+h,a+=h}return u},_=g-v,p=B-y,C=R.reduce((s,i)=>s+(i.value||0),0);if(C===0)return;let w=[...R],m=v,j=_,M=C;for(;w.length>0;){let s=[],i=0;for(let e=0;e<w.length;e++){const l=w[e],c=l.value||0,r=[...s,l],u=i+c;if(s.length===0)s=r,i=u;else{const a=I(s,i,p,M,j);if(I(r,u,p,M,j)<=a)s=r,i=u;else break}}const n=L(s,i,M,p,j,m,y);w=w.slice(s.length),m+=n,j-=n,M-=i}};function F({data:b,className:v,LeafComponent:y,getColorValue:g,tileMode:B="squarify"}){const R=d.useRef(null),I=d.useRef(null),L=d.useRef(null),_=d.useRef(null),p=d.useRef(null),C=d.useRef(null),[,w]=d.useTransition(),[m,j]=d.useState({width:0,height:0});d.useEffect(()=>{const n=R.current;if(n){const e=new ResizeObserver(()=>{w(()=>{j({width:n.offsetWidth,height:n.offsetHeight})})});return e.observe(n),()=>{e.disconnect()}}},[]),d.useEffect(()=>{const n=I.current;if(n){const e=n.children;let l=e[0],c=e[0],r=e[0],u=e[0];for(let a=0;a<e.length;a++){const o=e[a],{x,y:h}=o.getBoundingClientRect(),N=l.getBoundingClientRect(),W=c.getBoundingClientRect(),t=r.getBoundingClientRect(),f=u.getBoundingClientRect();x<=N.x&&h<=N.y&&(l=o),x<=W.x&&h>=W.y&&(c=o),x>=t.x&&h<=t.y&&(r=o),x>=f.x&&h>=f.y&&(u=o)}L.current&&(L.current.style.borderTopLeftRadius=E),L.current=l,L.current.style.borderTopLeftRadius=S,_.current&&(_.current.style.borderBottomLeftRadius=E),_.current=c,_.current.style.borderBottomLeftRadius=S,p.current&&(p.current.style.borderTopRightRadius=E),p.current=r,p.current.style.borderTopRightRadius=S,C.current&&(C.current.style.borderBottomRightRadius=E),C.current=u,C.current.style.borderBottomRightRadius=S}},[m]);const M=d.useMemo(()=>{switch(B){case"vertical-rectangle":return U;case"squarify":default:return $}},[B]),s=d.useMemo(()=>z().size([m.width,m.height]).tile(M).paddingInner(4)(H({id:"root",value:0,children:b}).sum(n=>n.value).sort((n,e)=>e.data.value-n.data.value)),[b,m.width,m.height,M]),i=d.useMemo(()=>{const n=s.leaves(),e=n.map(t=>g?g(t.data):t.data.value),l=e.filter(t=>t>=0),c=e.filter(t=>t<0),r=l.length>0?Math.min(...l):0,u=l.length>0?Math.max(...l):0,a=c.length>0?Math.min(...c):0,o=c.length>0?Math.max(...c):0,x=t=>t<0?o===a?1:(t-o)/(a-o):u===r?1:(t-r)/(u-r),h=(t,f)=>{if(f>=0){const q=Math.round(34+t*16);return`hsl(152 ${Math.round(42+t*20)}% ${q}%)`}const D=Math.round(36+t*15);return`hsl(350 ${Math.round(48+t*22)}% ${D}%)`},N=[...new Set(n.map(t=>t.x0))].sort((t,f)=>t-f),W=new Map(N.map((t,f)=>[t,f]));return n.map(t=>{const f=t.x1-t.x0,D=t.y1-t.y0,V=g?g(t.data):t.data.value,q=x(V),A=W.get(t.x0)??0,O=h(q,V);return T.jsx("div",{className:"group absolute cursor-pointer rounded-sm border border-transparent hover:bg-[radial-gradient(146.13%_118.42%_at_50%_-15.5%,rgba(255,255,255,0.1)_0%,rgba(255,255,255,0)_99.59%)] hover:bg-gradient-to-t",style:{left:t.x0,top:t.y0,width:f,height:D,borderRadius:E,backgroundColor:O},children:T.jsx(y,{width:f,height:D,data:t.data,columnIndex:A})},`${t.data.id}-box`)})},[s,y,g]);return T.jsx("div",{className:P("h-full w-full",v),ref:R,children:T.jsx("div",{className:"relative overflow-hidden rounded-lg",style:{height:m.height,width:m.width},ref:I,children:i})})}const J=F;function K({width:b,height:v,label:y,secondary:g,title:B}){if(b<48||v<30)return null;const R=b<70||v<44;return T.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-hidden p-1 text-center",title:B,children:[T.jsx("span",{className:"body-sm truncate font-bold text-strong",children:y}),!R&&g&&T.jsx("span",{className:"caption text-soft",children:g})]})}export{J as T,K as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,j as s}from"./react-qoZPGuNy.js";import{f as l}from"./format-CfAcS4D8.js";import{f as p,ag as n,ah as f}from"./index-C_O7gp2F.js";import{T as u,a as c}from"./treemap-leaf-DLQawrx4.js";import{F as m}from"./ui-Bq3RQsdJ.js";import"./utils-DaT-yT0k.js";import"./d3-xK4fOkBU.js";n.schema;function d({width:r,height:o,data:e}){const t=l(e.tvl);return s.jsx(c,{width:r,height:o,label:e.id,secondary:t,title:`${e.id} · ${t}`})}function v({config:r}){const{entries:o,isLoading:e}=f(),t=i.useMemo(()=>o.slice(0,r.topN).map(a=>({id:a.name,value:a.tvl,tvl:a.tvl})),[o,r.topN]);return e?s.jsx(m,{loading:!0,children:"loading TVL…"}):t.length===0?s.jsx(m,{children:"no TVL data"}):s.jsx(u,{data:t,LeafComponent:d,getColorValue:a=>a.tvl})}const F=p({...n,component:v});export{F as tvlTreemapFrame};
|