zframes 0.1.1 → 0.3.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/NOTICE +2 -0
- package/dist/index.js +1727 -217
- package/package.json +7 -6
- package/runtime/assets/d3-B3esOK0k.js +1 -0
- package/runtime/assets/editor-DVTcqJo4.js +68 -0
- package/runtime/assets/editor-DnV0I9s-.css +1 -0
- package/runtime/assets/gridstack-BxxvPIFU.js +9 -0
- package/runtime/assets/gridstack-FIb_WQSt.css +1 -0
- package/runtime/assets/index-DEGnog6Q.css +1 -0
- package/runtime/assets/{index-A5M9erCx.js → index-DPlG_EDx.js} +1 -1
- package/runtime/assets/index-KRy1feFG.js +761 -0
- package/runtime/assets/liveline-C5zt2WuS.js +1 -0
- package/runtime/assets/react-qoZPGuNy.js +49 -0
- package/runtime/index.html +6 -3
- package/runtime/widget-icons/breakeven.png +0 -0
- package/runtime/widget-icons/breathing.png +0 -0
- package/runtime/widget-icons/btc-blocks.png +0 -0
- package/runtime/widget-icons/btc-difficulty.png +0 -0
- package/runtime/widget-icons/btc-fees.png +0 -0
- package/runtime/widget-icons/btc-hashrate.png +0 -0
- package/runtime/widget-icons/btc-mempool.png +0 -0
- package/runtime/widget-icons/calculator.png +0 -0
- package/runtime/widget-icons/checklist.png +0 -0
- package/runtime/widget-icons/coin-movers.png +0 -0
- package/runtime/widget-icons/countdown.png +0 -0
- package/runtime/widget-icons/day-meter.png +0 -0
- package/runtime/widget-icons/dex-volume-chart.png +0 -0
- package/runtime/widget-icons/dex-volume-treemap.png +0 -0
- package/runtime/widget-icons/dice.png +0 -0
- package/runtime/widget-icons/divider.png +0 -0
- package/runtime/widget-icons/drawdy.png +0 -0
- package/runtime/widget-icons/filings-feed.png +0 -0
- package/runtime/widget-icons/financial-stress.png +0 -0
- package/runtime/widget-icons/flappy-bird.png +0 -0
- package/runtime/widget-icons/fundamentals.png +0 -0
- package/runtime/widget-icons/holiday-calendar.png +0 -0
- package/runtime/widget-icons/journal-log.png +0 -0
- package/runtime/widget-icons/journal-open.png +0 -0
- package/runtime/widget-icons/journal-results.png +0 -0
- package/runtime/widget-icons/journal-score.png +0 -0
- package/runtime/widget-icons/labor-market.png +0 -0
- package/runtime/widget-icons/lightning-stats.png +0 -0
- package/runtime/widget-icons/link-grid.png +0 -0
- package/runtime/widget-icons/market-cap-treemap.png +0 -0
- package/runtime/widget-icons/marquee.png +0 -0
- package/runtime/widget-icons/mining-pools.png +0 -0
- package/runtime/widget-icons/national-debt.png +0 -0
- package/runtime/widget-icons/news-feed.png +0 -0
- package/runtime/widget-icons/open-interest.png +0 -0
- package/runtime/widget-icons/options-iv.png +0 -0
- package/runtime/widget-icons/options-oi-strike.png +0 -0
- package/runtime/widget-icons/options-put-call.png +0 -0
- package/runtime/widget-icons/pomodoro.png +0 -0
- package/runtime/widget-icons/portfolio-allocation.png +0 -0
- package/runtime/widget-icons/portfolio-holdings.png +0 -0
- package/runtime/widget-icons/portfolio-value.png +0 -0
- package/runtime/widget-icons/protocol-fees-treemap.png +0 -0
- package/runtime/widget-icons/protocol-tvl-chart.png +0 -0
- package/runtime/widget-icons/protocol-tvl-treemap.png +0 -0
- package/runtime/widget-icons/quote.png +0 -0
- package/runtime/widget-icons/returns-projector.png +0 -0
- package/runtime/widget-icons/risk-reward.png +0 -0
- package/runtime/widget-icons/rules-card.png +0 -0
- package/runtime/widget-icons/session-progress.png +0 -0
- package/runtime/widget-icons/short-volume.png +0 -0
- package/runtime/widget-icons/snake.png +0 -0
- package/runtime/widget-icons/spotify-embed.png +0 -0
- package/runtime/widget-icons/stopwatch.png +0 -0
- package/runtime/widget-icons/treasury-auctions.png +0 -0
- package/runtime/widget-icons/video.png +0 -0
- package/runtime/widget-icons/yield-curve.png +0 -0
- package/runtime/assets/index-6CnH3oHt.js +0 -719
- package/runtime/assets/index-CgpsbUVX.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
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};
|