@gearbox-protocol/permissionless-ui 1.26.3 → 1.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../utils/colors.cjs"),e={topColor:"rgba(76, 175, 80, 0.56)",bottomColor:"rgba(76, 175, 80, 0.04)",lineColor:"#02c39a",lineWidth:2},l={showLabel:!0,color:"#02c39a",labelBackgroundColor:"#02c39a",width:2};function t(){const r=o.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");return{timeScale:{borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",visible:!0},rightPriceScale:{visible:!0,autoScale:!0,alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:r},layout:{background:{color:"transparent"},textColor:r,fontSize:14},crosshair:{horzLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1},vertLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1}},grid:{vertLines:{visible:!1},horzLines:{visible:!1}}}}function i(){return{topColor:"rgba(76, 175, 80, 0.56)",bottomColor:"rgba(76, 175, 80, 0.04)",lineColor:e.lineColor,lineWidth:2}}function a(){return{showLabel:!0,color:e.lineColor,labelBackgroundColor:e.lineColor,width:2}}const s={timeScale:{borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",visible:!0},rightPriceScale:{visible:!0,autoScale:!0,alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1},layout:{background:{color:"transparent"},textColor:"rgb(0, 0, 0)",fontSize:14},crosshair:{horzLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1},vertLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1}},grid:{vertLines:{visible:!1},horzLines:{visible:!1}}};exports.DEFAULT_AREA_SERIES=e;exports.DEFAULT_OPTIONS=s;exports.DEFAULT_VERTICAL_LINE=l;exports.getDefaultOptions=t;exports.getDefaultSeries=i;exports.getDefaultVerticalLine=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../utils/colors.cjs"),e={topColor:"rgba(76, 175, 80, 0.56)",bottomColor:"rgba(76, 175, 80, 0.04)",lineColor:"#02c39a",lineWidth:2},l={showLabel:!0,color:"#02c39a",labelBackgroundColor:"#02c39a",width:2};function t(){const r=o.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");return{timeScale:{borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",visible:!0,fixLeftEdge:!0,fixRightEdge:!0},rightPriceScale:{visible:!0,autoScale:!0,alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:r},layout:{background:{color:"transparent"},textColor:r,fontSize:14},crosshair:{horzLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1},vertLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1}},grid:{vertLines:{visible:!1},horzLines:{visible:!1}}}}function i(){return{topColor:"rgba(76, 175, 80, 0.56)",bottomColor:"rgba(76, 175, 80, 0.04)",lineColor:e.lineColor,lineWidth:2}}function a(){return{showLabel:!0,color:e.lineColor,labelBackgroundColor:e.lineColor,width:2}}const s={timeScale:{borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",visible:!0,fixLeftEdge:!0,fixRightEdge:!0},rightPriceScale:{visible:!0,autoScale:!0,alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1},layout:{background:{color:"transparent"},textColor:"rgb(0, 0, 0)",fontSize:14},crosshair:{horzLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1},vertLine:{width:2,color:"rgba(224, 227, 235, 0.1)",style:0,labelVisible:!1}},grid:{vertLines:{visible:!1},horzLines:{visible:!1}}};exports.DEFAULT_AREA_SERIES=e;exports.DEFAULT_OPTIONS=s;exports.DEFAULT_VERTICAL_LINE=l;exports.getDefaultOptions=t;exports.getDefaultSeries=i;exports.getDefaultVerticalLine=a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),ut=require("lightweight-charts"),u=require("react"),At=require("../../hooks/use-media-query.cjs"),gt=require("../../utils/cn.cjs"),I=require("../../utils/colors.cjs"),X=require("./default-config.cjs"),D=require("./formatters.cjs"),It=require("./graph-current-value.cjs"),yt=require("./graph-tooltip.cjs"),Ot=require("./plugins/vertical-line.cjs");function zt(t){const C=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const g in t)if(g!=="default"){const L=Object.getOwnPropertyDescriptor(t,g);Object.defineProperty(C,g,L.get?L:{enumerable:!0,get:()=>t[g]})}}return C.default=t,Object.freeze(C)}const ft=zt(u);function Vt(t,C,g){const L=t.labelText??"",b=t.value,w=b===void 0?"":typeof b=="number"?C==="$"?`$${D.formatExactValue(b,void 0,g)}`:C==="%"?`${D.formatExactValue(b,void 0,g)}%`:D.formatExactValue(b,C!=="none"&&C!=="%"&&C!=="$"?C:void 0,g):String(b);return{labelText:L,valueStr:w}}const Z=[{line:"#02c39a",top:"rgba(2, 195, 154, 0.56)",bottom:"rgba(2, 195, 154, 0.04)"},{line:"#3b82f6",top:"rgba(59, 130, 246, 0.56)",bottom:"rgba(59, 130, 246, 0.04)"},{line:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 0.04)"},{line:"#8b5cf6",top:"rgba(139, 92, 246, 0.56)",bottom:"rgba(139, 92, 246, 0.04)"},{line:"#ec4899",top:"rgba(236, 72, 153, 0.56)",bottom:"rgba(236, 72, 153, 0.04)"},{line:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],qt=137.5;function dt(t){if(t<Z.length)return Z[t];const g=(t-Z.length)*qt%360,L=I.hslToHex(g,70,50),{topColor:b,bottomColor:w}=I.generateColorsFromBase(L);return{line:L,top:b,bottom:w}}function Dt({series:t,className:C,showLegend:g=!1,onUnselectSeries:L,xMeasureUnit:b="time",yMeasureUnit:w="token",optionsOverrides:$,verticalLineOptions:y,currentValueDecimals:G,useSharedPriceScale:N=!1,showCurrentValue:Lt=!0,graphTitle:K,yScaleMin:bt,yScaleMinMultiple:mt}){const k=u.useRef(null),j=u.useRef(new Map),Q=u.useRef(!1),J=u.useRef(new Set),ht=u.useRef(0),pt=u.useRef(!0),U=u.useRef(null),jt=u.useRef(null),M=u.useRef(null),tt=u.useRef(null),V=At.useIsMobile(),_=ft.useMemo(()=>t.flatMap(e=>e.data),[t]),kt=ft.useMemo(()=>{if(t.length>0){const e=t[t.length-1];if(e.data.length>0)return e.data[e.data.length-1]}},[t]),[Y,et]=u.useState(()=>{if(!kt)return;const e=new Map;for(const a of t)a.data.length>0&&e.set(a.label,a.data[a.data.length-1]);return e}),[ot,A]=u.useState(null),[Ct,vt]=u.useState([]);u.useEffect(()=>{const e=()=>{if(k.current&&M.current){const s=M.current.clientWidth,l=M.current.clientHeight;k.current.resize(s,l),k.current.timeScale().fitContent()}},a=M.current,n=a?new ResizeObserver(e):null;return a&&n?.observe(a),()=>{a&&n?.unobserve(a)}},[]),u.useEffect(()=>{if(!tt.current||Q.current)return;const e=X.getDefaultOptions(),a=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),n=ut.createChart(tt.current,{...e,rightPriceScale:{...e.rightPriceScale||{},visible:!V,textColor:a},...V&&{crosshair:{...e.crosshair,mode:ut.CrosshairMode.Magnet}},...$});return k.current=n,Q.current=!0,()=>{n.remove(),k.current=null,Q.current=!1,j.current.clear()}},[V,$]),u.useEffect(()=>{const e=k.current;if(!e||t.length===0)return;const n=t.filter(o=>o.data.length>0).length<=1?bt:mt,s=b==="time"?D.getXFormatters(b,_):D.getXFormatters(b),l=_.map(o=>o.value),{formatter:c,tickmarksFormatter:m,updateVisibleRange:P,updateLastValues:v}=D.createAdaptiveYAxisFormatter(l,w,{yScaleMin:n});U.current=P,jt.current=v;const T=t.filter(o=>o.data.length>0).map(o=>o.data[o.data.length-1].value);v(T);const S=X.getDefaultOptions();e.applyOptions({localization:{...S.localization||{},timeFormatter:o=>s.timeFormatter(parseFloat(o),void 0)},timeScale:{...S.timeScale||{},tickMarkFormatter:s.tickMarkFormatter,minBarSpacing:0}});const h=(_.length>0?Math.min(..._.map(o=>o.value)):0)<0,x=_.some(o=>o.value===0),p=!h&&x,d=t.length>1&&!N,F=t.length>1&&!N||V,E=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");e.applyOptions({rightPriceScale:{...S.rightPriceScale||{},visible:!F,textColor:E,...p&&{scaleMargins:{top:.3,bottom:0}}}});const nt=new Set(j.current.keys()),rt=new Set(t.map(o=>o.label));for(const o of nt)if(!rt.has(o)){const r=j.current.get(o);r&&(e.removeSeries(r),j.current.delete(o))}const Pt=X.getDefaultSeries(),at=[];let H=0;for(let o=0;o<t.length;o++){const r=t[o],it=dt(o),W=r.lineColor??r.color??it.line;let O,z;if(r.lineColor??r.color)if(r.topColor&&r.bottomColor)O=r.topColor,z=r.bottomColor;else if(r.topColor){const i=I.generateColorsFromBase(W);O=r.topColor,z=i.bottomColor}else if(r.bottomColor)O=I.generateColorsFromBase(W).topColor,z=r.bottomColor;else{const i=I.generateColorsFromBase(W);O=i.topColor,z=i.bottomColor}else O=r.topColor||it.top,z=r.bottomColor||it.bottom;if(r.data.length===0){const i=j.current.get(r.label);i&&(e.removeSeries(i),j.current.delete(r.label));continue}const Ft=(r.data.length>0?Math.min(...r.data.map(i=>i.value)):0)<0,Et=r.data.some(i=>i.value===0),Mt=!Ft&&Et,St=N||!d||H===0?"right":`scale-${H}`;d&&at.push({priceScaleId:St||"right",shouldPreventNegativeAxis:Mt,seriesIndex:H});const Rt=(N||!d)&&n!==void 0&&typeof n=="number",wt={lineColor:W,topColor:O,bottomColor:z,priceScaleId:St,priceFormat:{type:"custom",minMove:.01,formatter:Rt&&typeof n=="number"?i=>c(i<n?n:i):c,tickmarksFormatter:m},autoscaleInfoProvider:i=>{if(!Rt)return i();const ct=i();if(ct?.priceRange){const _t=n;ct.priceRange.minValue=_t}return ct}};let q=j.current.get(r.label);q?(q.applyOptions(wt),q.setData(r.data.map(i=>({...i,time:i.time})))):(q=e.addSeries(ut.AreaSeries,{...Pt,...wt}),q.setData(r.data.map(i=>({...i,time:i.time}))),j.current.set(r.label,q)),H++}if(d&&at.length>0)for(const o of at)try{const r=e.priceScale(o.priceScaleId);r&&r.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:.1,bottom:.1,...o.shouldPreventNegativeAxis&&{top:.3,bottom:0}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:E})}catch(r){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,r)}else if(!d)try{const o=e.priceScale("right");o&&o.applyOptions({visible:!V,autoScale:!0,scaleMargins:{top:.1,bottom:n!==void 0||p?0:.1,...p&&{top:.3}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:E})}catch{}n!==void 0&&!V&&(N||!d)&&e.applyOptions({handleScroll:{vertTouchDrag:!1}});const lt=new Set(t.map(o=>o.label)),Tt=lt.size!==J.current.size||[...lt].some(o=>!J.current.has(o)),Nt=_.length!==ht.current;(pt.current||Tt||Nt||V)&&(e.timeScale().fitContent(),pt.current=!1),J.current=lt,ht.current=_.length;const st=new Map;for(const o of t)o.data.length>0&&st.set(o.label,o.data[o.data.length-1]);et(st.size>0?st:void 0)},[t,_,b,w,V,N,bt,mt]),u.useEffect(()=>{const e=k.current;if(!e||t.length===0)return;const a=t.length===1;let n;for(const l of t)if(l.data.length>0){n=l.data[l.data.length-1].time;break}if(!n)return;const s=l=>{const{time:c=n,seriesData:m,point:P}=l||{},v=Array.from(j.current.values());if(!P||!c){const R=new Map;for(const h of t)h.data.length>0&&R.set(h.label,h.data[h.data.length-1]);if(et(R.size>0?R:void 0),a||N)A(null);else if(v[0]&&n){const x=e.timeScale().timeToCoordinate(n),p=t[0];if(p.data.length>0){const d=p.data[p.data.length-1].value,F=v[0].priceToCoordinate(d);x!==null&&F!==null&&A({x,y:F})}}return}const T=new Map;let S;for(let R=0;R<t.length;R++){const h=t[R],x=v[R];if(!x)continue;const p=m?.get(x),d=p&&"value"in p?p.value:void 0,F=h.data[h.data.length-1],E=d!==void 0?d:F?.value??0;R===0&&(S=E),T.set(h.label,{value:E,time:c})}if(et(T),S!==void 0&&v[0]){const h=e.timeScale().timeToCoordinate(c),x=v[0].priceToCoordinate(S);if(h!==null&&x!==null){const p=M.current;if(p){const d=p.querySelector(".LightweightChart");if(d){const F=d.getBoundingClientRect(),E=p.getBoundingClientRect(),nt=h+(F.left-E.left),rt=x+(F.top-E.top);A({x:nt,y:rt})}else A({x:h,y:x})}else A({x:h,y:x})}else A(null)}else A(null)};return e.subscribeCrosshairMove(s),V&&e.subscribeClick(s),!a&&!N&&requestAnimationFrame(()=>{const l=Array.from(j.current.values());if(l[0]&&n&&t[0]?.data.length>0){const m=e.timeScale().timeToCoordinate(n),P=t[0].data[t[0].data.length-1].value,v=l[0].priceToCoordinate(P);m!==null&&v!==null&&A({x:m,y:v})}}),()=>{e.unsubscribeCrosshairMove(s),V&&e.unsubscribeClick(s)}},[t,N,V]),u.useEffect(()=>{const e=k.current;if(!e||t.length===0)return;const a=e.timeScale(),n=Math.max(...t.map(l=>l.data.length)),s=()=>{if(n===0)return;const l=a.getVisibleLogicalRange();if(!l)return;const c={from:0,to:n-1},m=typeof l.from=="number"?l.from:0,P=typeof l.to=="number"?l.to:n-1;if(U.current){const R=Math.max(0,Math.floor(m)),h=Math.min(n-1,Math.ceil(P)),x=[];for(const p of t)for(let d=R;d<=h&&d<p.data.length;d++)x.push(p.data[d].value);x.length>0&&U.current(x)}const v=.01;let T=!1;const S={...l};m<c.from-v&&(S.from=c.from,T=!0),P>c.to+v&&(S.to=c.to,T=!0),T&&a.setVisibleLogicalRange(S)};return a.subscribeVisibleLogicalRangeChange(s),()=>{a.unsubscribeVisibleLogicalRangeChange(s)}},[t]),u.useEffect(()=>{const e=k.current,a=Array.from(j.current.values()),n=[];if(e&&a.length>0&&y){const s=X.getDefaultVerticalLine(),l=a[0];for(const c of y){const m=new Ot.VertLine(e,l,c.xCoordinate,{...s,...c.options||{}});l.attachPrimitive(m),n.push(m)}}return()=>{if(a.length>0){const s=a[0];for(const l of n)s.detachPrimitive(l)}}},[y]),u.useEffect(()=>{const e=k.current;if(!e||!y?.length){vt([]);return}const a=()=>{const l=e.timeScale(),c=y.map(m=>l.timeToCoordinate(m.xCoordinate)??null);vt(c)};a();const n=e.timeScale(),s=()=>{a()};return n.subscribeVisibleLogicalRangeChange(s),()=>{n.unsubscribeVisibleLogicalRangeChange(s)}},[y]);const B=t.length===1,xt=ft.useMemo(()=>{if(B&&t.length>0){const e=t[0];if(e.data.length>0)return e.data[e.data.length-1]}},[B,t]);return f.jsxs("div",{ref:M,className:gt.cn("relative z-[1] w-full h-full overflow-hidden p-0",C),children:[K!=null&&K!==!1&&B?f.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:f.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:K})}):Lt&&B&&xt&&f.jsx(It.GraphCurrentValue,{point:xt,xMeasureUnit:b,yMeasureUnit:w,decimals:G}),Y&&ot&&f.jsx(yt.GraphTooltip,{points:Y,xMeasureUnit:b,yMeasureUnit:w,series:t,position:ot,containerRef:M,decimals:G}),Y&&!ot&&!B&&V&&f.jsx(yt.GraphTooltip,{points:Y,xMeasureUnit:b,yMeasureUnit:w,series:t,containerRef:M,decimals:G,className:"top-2 left-2"}),g&&f.jsx($t,{series:t,onUnselect:L}),y&&y.length>0&&Ct.length===y.length&&f.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:y.map((e,a)=>{const n=Ct[a],s=e.options??{},l=s.showLabel!==!1;if(n===null||!l)return null;const{labelText:c,valueStr:m}=Vt(s,w,G);if(!(c||m))return null;const v=s.labelBackgroundColor??s.color??"hsl(var(--background))",T=s.labelTextColor??"hsl(var(--foreground))",S=`${String(e.xCoordinate)}-${c}`;return f.jsxs("div",{className:"absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",style:{left:n,transform:"translateX(-50%)",backgroundColor:v,color:T},children:[c&&f.jsx("span",{className:"block",children:c}),m&&f.jsx("span",{className:gt.cn("block",c&&"mt-0.5"),children:m})]},S)})}),f.jsx("div",{ref:tt,className:"LightweightChart w-full h-full overflow-hidden"})]})}function $t({series:t,onUnselect:C}){return f.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:t.map((g,L)=>{const b=dt(L),w=(g.lineColor??g.color)||b.line,$=g.data.length===0;return f.jsxs("div",{className:gt.cn("flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",$&&"opacity-50"),children:[f.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:w}}),f.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[g.label,$&&" (no data)"]}),C&&f.jsx("button",{type:"button",onClick:y=>{y.stopPropagation(),C(g.label)},className:"ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer","aria-label":`Remove ${g.label}`,children:f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground hover:text-foreground","aria-hidden":"true",children:[f.jsx("title",{children:"Close"}),f.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),f.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.label)})})}exports.DEFAULT_SERIES_COLORS=Z;exports.Graph=Dt;exports.getSeriesColorPalette=dt;exports.getVerticalLineTooltipContent=Vt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),ue=require("lightweight-charts"),c=require("react"),Ae=require("../../hooks/use-media-query.cjs"),ge=require("../../utils/cn.cjs"),I=require("../../utils/colors.cjs"),X=require("./default-config.cjs"),D=require("./formatters.cjs"),Ie=require("./graph-current-value.cjs"),ye=require("./graph-tooltip.cjs"),Oe=require("./plugins/vertical-line.cjs");function ze(e){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const f in e)if(f!=="default"){const y=Object.getOwnPropertyDescriptor(e,f);Object.defineProperty(m,f,y.get?y:{enumerable:!0,get:()=>e[f]})}}return m.default=e,Object.freeze(m)}const fe=ze(c);function Ve(e,m,f){const y=e.labelText??"",b=e.value,x=b===void 0?"":typeof b=="number"?m==="$"?`$${D.formatExactValue(b,void 0,f)}`:m==="%"?`${D.formatExactValue(b,void 0,f)}%`:D.formatExactValue(b,m!=="none"&&m!=="%"&&m!=="$"?m:void 0,f):String(b);return{labelText:y,valueStr:x}}const Z=[{line:"#02c39a",top:"rgba(2, 195, 154, 0.56)",bottom:"rgba(2, 195, 154, 0.04)"},{line:"#3b82f6",top:"rgba(59, 130, 246, 0.56)",bottom:"rgba(59, 130, 246, 0.04)"},{line:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 0.04)"},{line:"#8b5cf6",top:"rgba(139, 92, 246, 0.56)",bottom:"rgba(139, 92, 246, 0.04)"},{line:"#ec4899",top:"rgba(236, 72, 153, 0.56)",bottom:"rgba(236, 72, 153, 0.04)"},{line:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],qe=137.5;function de(e){if(e<Z.length)return Z[e];const f=(e-Z.length)*qe%360,y=I.hslToHex(f,70,50),{topColor:b,bottomColor:x}=I.generateColorsFromBase(y);return{line:y,top:b,bottom:x}}function De({series:e,className:m,showLegend:f=!1,onUnselectSeries:y,xMeasureUnit:b="time",yMeasureUnit:x="token",optionsOverrides:$,verticalLineOptions:S,currentValueDecimals:G,useSharedPriceScale:L=!1,showCurrentValue:ke=!0,graphTitle:K,yScaleMin:be,yScaleMinMultiple:me}){const j=c.useRef(null),V=c.useRef(new Map),Q=c.useRef(!1),J=c.useRef(new Set),he=c.useRef(0),pe=c.useRef(!0),U=c.useRef(null),je=c.useRef(null),_=c.useRef(null),ee=c.useRef(null),R=Ae.useIsMobile(),M=fe.useMemo(()=>e.flatMap(t=>t.data),[e]),Le=fe.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[Y,te]=c.useState(()=>{if(!Le)return;const t=new Map;for(const a of e)a.data.length>0&&t.set(a.label,a.data[a.data.length-1]);return t}),[oe,A]=c.useState(null),[Ce,ve]=c.useState([]);c.useEffect(()=>{const t=()=>{if(j.current&&_.current){const l=_.current.clientWidth,i=_.current.clientHeight;j.current.resize(l,i),j.current.timeScale().fitContent()}},a=_.current,n=a?new ResizeObserver(t):null;return a&&n?.observe(a),()=>{a&&n?.unobserve(a)}},[]),c.useEffect(()=>{if(!ee.current||Q.current)return;const t=X.getDefaultOptions(),a=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),n=ue.createChart(ee.current,{...t,rightPriceScale:{...t.rightPriceScale||{},visible:!R,textColor:a},...R&&{crosshair:{...t.crosshair,mode:ue.CrosshairMode.Magnet}},...$});return j.current=n,Q.current=!0,()=>{n.remove(),j.current=null,Q.current=!1,V.current.clear()}},[R,$]),c.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const n=e.filter(o=>o.data.length>0).length<=1?be:me,l=b==="time"?D.getXFormatters(b,M):D.getXFormatters(b),i=M.map(o=>o.value),{formatter:g,tickmarksFormatter:d,updateVisibleRange:N,updateLastValues:h}=D.createAdaptiveYAxisFormatter(i,x,{yScaleMin:n});U.current=N,je.current=h;const P=e.filter(o=>o.data.length>0).map(o=>o.data[o.data.length-1].value);h(P);const T=X.getDefaultOptions();t.applyOptions({localization:{...T.localization||{},timeFormatter:o=>l.timeFormatter(parseFloat(o),void 0)},timeScale:{...T.timeScale||{},tickMarkFormatter:l.tickMarkFormatter,minBarSpacing:0}});const p=(M.length>0?Math.min(...M.map(o=>o.value)):0)<0,w=M.some(o=>o.value===0),C=!p&&w,v=e.length>1&&!L,F=e.length>1&&!L||R,E=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");t.applyOptions({rightPriceScale:{...T.rightPriceScale||{},visible:!F,textColor:E,...C&&{scaleMargins:{top:.3,bottom:0}}}});const ne=new Set(V.current.keys()),re=new Set(e.map(o=>o.label));for(const o of ne)if(!re.has(o)){const r=V.current.get(o);r&&(t.removeSeries(r),V.current.delete(o))}const Ne=X.getDefaultSeries(),ae=[];let H=0;for(let o=0;o<e.length;o++){const r=e[o],ie=de(o),W=r.lineColor??r.color??ie.line;let O,z;if(r.lineColor??r.color)if(r.topColor&&r.bottomColor)O=r.topColor,z=r.bottomColor;else if(r.topColor){const s=I.generateColorsFromBase(W);O=r.topColor,z=s.bottomColor}else if(r.bottomColor)O=I.generateColorsFromBase(W).topColor,z=r.bottomColor;else{const s=I.generateColorsFromBase(W);O=s.topColor,z=s.bottomColor}else O=r.topColor||ie.top,z=r.bottomColor||ie.bottom;if(r.data.length===0){const s=V.current.get(r.label);s&&(t.removeSeries(s),V.current.delete(r.label));continue}const Fe=(r.data.length>0?Math.min(...r.data.map(s=>s.value)):0)<0,Ee=r.data.some(s=>s.value===0),_e=!Fe&&Ee,Se=L||!v||H===0?"right":`scale-${H}`;v&&ae.push({priceScaleId:Se||"right",shouldPreventNegativeAxis:_e,seriesIndex:H});const Re=(L||!v)&&n!==void 0&&typeof n=="number",we={lineColor:W,topColor:O,bottomColor:z,priceScaleId:Se,priceFormat:{type:"custom",minMove:.01,formatter:Re&&typeof n=="number"?s=>g(s<n?n:s):g,tickmarksFormatter:d},autoscaleInfoProvider:s=>{if(!Re)return s();const ce=s();if(ce?.priceRange){const Me=n;ce.priceRange.minValue=Me}return ce}};let q=V.current.get(r.label);q?(q.applyOptions(we),q.setData(r.data.map(s=>({...s,time:s.time})))):(q=t.addSeries(ue.AreaSeries,{...Ne,...we}),q.setData(r.data.map(s=>({...s,time:s.time}))),V.current.set(r.label,q)),H++}if(v&&ae.length>0)for(const o of ae)try{const r=t.priceScale(o.priceScaleId);r&&r.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:.1,bottom:.1,...o.shouldPreventNegativeAxis&&{top:.3,bottom:0}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:E})}catch(r){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,r)}else if(!v)try{const o=t.priceScale("right");o&&o.applyOptions({visible:!R,autoScale:!0,scaleMargins:{top:.1,bottom:n!==void 0||C?0:.1,...C&&{top:.3}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:E})}catch{}n!==void 0&&!R&&(L||!v)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}});const le=new Set(e.map(o=>o.label)),Pe=le.size!==J.current.size||[...le].some(o=>!J.current.has(o)),Te=M.length!==he.current;(pe.current||Pe||Te||R)&&(t.timeScale().fitContent(),pe.current=!1),J.current=le,he.current=M.length;const se=new Map;for(const o of e)o.data.length>0&&se.set(o.label,o.data[o.data.length-1]);te(se.size>0?se:void 0)},[e,M,b,x,R,L,be,me]),c.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const a=e.length===1;let n;for(const i of e)if(i.data.length>0){n=i.data[i.data.length-1].time;break}if(!n)return;const l=i=>{const{time:g=n,seriesData:d,point:N}=i||{},h=Array.from(V.current.values());if(!N||!g){const k=new Map;for(const p of e)p.data.length>0&&k.set(p.label,p.data[p.data.length-1]);if(te(k.size>0?k:void 0),a||L)A(null);else if(h[0]&&n){const w=t.timeScale().timeToCoordinate(n),C=e[0];if(C.data.length>0){const v=C.data[C.data.length-1].value,F=h[0].priceToCoordinate(v);w!==null&&F!==null&&A({x:w,y:F})}}return}const P=new Map;let T;for(let k=0;k<e.length;k++){const p=e[k],w=h[k];if(!w)continue;const C=d?.get(w),v=C&&"value"in C?C.value:void 0,F=p.data[p.data.length-1],E=v!==void 0?v:F?.value??0;k===0&&(T=E),P.set(p.label,{value:E,time:g})}if(te(P),T!==void 0&&h[0]){const p=t.timeScale().timeToCoordinate(g),w=h[0].priceToCoordinate(T);if(p!==null&&w!==null){const C=_.current;if(C){const v=C.querySelector(".LightweightChart");if(v){const F=v.getBoundingClientRect(),E=C.getBoundingClientRect(),ne=p+(F.left-E.left),re=w+(F.top-E.top);A({x:ne,y:re})}else A({x:p,y:w})}else A({x:p,y:w})}else A(null)}else A(null)};return t.subscribeCrosshairMove(l),R&&t.subscribeClick(l),!a&&!L&&requestAnimationFrame(()=>{const i=Array.from(V.current.values());if(i[0]&&n&&e[0]?.data.length>0){const d=t.timeScale().timeToCoordinate(n),N=e[0].data[e[0].data.length-1].value,h=i[0].priceToCoordinate(N);d!==null&&h!==null&&A({x:d,y:h})}}),()=>{t.unsubscribeCrosshairMove(l),R&&t.unsubscribeClick(l)}},[e,L,R]),c.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const a=t.timeScale(),n=()=>{if(!U.current)return;const l=a.getVisibleRange();if(!l)return;const i=Number(l.from),g=Number(l.to),d=[];for(const N of e)for(const h of N.data){const P=Number(h.time);P>=i&&P<=g&&d.push(h.value)}d.length>0&&U.current(d)};return a.subscribeVisibleLogicalRangeChange(n),()=>{a.unsubscribeVisibleLogicalRangeChange(n)}},[e]),c.useEffect(()=>{const t=j.current,a=Array.from(V.current.values()),n=[];if(t&&a.length>0&&S){const l=X.getDefaultVerticalLine(),i=a[0];for(const g of S){const d=new Oe.VertLine(t,i,g.xCoordinate,{...l,...g.options||{}});i.attachPrimitive(d),n.push(d)}}return()=>{if(a.length>0){const l=a[0];for(const i of n)l.detachPrimitive(i)}}},[S]),c.useEffect(()=>{const t=j.current;if(!t||!S?.length){ve([]);return}const a=()=>{const i=t.timeScale(),g=S.map(d=>i.timeToCoordinate(d.xCoordinate)??null);ve(g)};a();const n=t.timeScale(),l=()=>{a()};return n.subscribeVisibleLogicalRangeChange(l),()=>{n.unsubscribeVisibleLogicalRangeChange(l)}},[S]);const B=e.length===1,xe=fe.useMemo(()=>{if(B&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[B,e]);return u.jsxs("div",{ref:_,className:ge.cn("relative z-[1] w-full h-full overflow-hidden p-0",m),children:[K!=null&&K!==!1&&B?u.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:u.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:K})}):ke&&B&&xe&&u.jsx(Ie.GraphCurrentValue,{point:xe,xMeasureUnit:b,yMeasureUnit:x,decimals:G}),Y&&oe&&u.jsx(ye.GraphTooltip,{points:Y,xMeasureUnit:b,yMeasureUnit:x,series:e,position:oe,containerRef:_,decimals:G}),Y&&!oe&&!B&&R&&u.jsx(ye.GraphTooltip,{points:Y,xMeasureUnit:b,yMeasureUnit:x,series:e,containerRef:_,decimals:G,className:"top-2 left-2"}),f&&u.jsx($e,{series:e,onUnselect:y}),S&&S.length>0&&Ce.length===S.length&&u.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:S.map((t,a)=>{const n=Ce[a],l=t.options??{},i=l.showLabel!==!1;if(n===null||!i)return null;const{labelText:g,valueStr:d}=Ve(l,x,G);if(!(g||d))return null;const h=l.labelBackgroundColor??l.color??"hsl(var(--background))",P=l.labelTextColor??"hsl(var(--foreground))",T=`${String(t.xCoordinate)}-${g}`;return u.jsxs("div",{className:"absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",style:{left:n,transform:"translateX(-50%)",backgroundColor:h,color:P},children:[g&&u.jsx("span",{className:"block",children:g}),d&&u.jsx("span",{className:ge.cn("block",g&&"mt-0.5"),children:d})]},T)})}),u.jsx("div",{ref:ee,className:"LightweightChart w-full h-full overflow-hidden"})]})}function $e({series:e,onUnselect:m}){return u.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:e.map((f,y)=>{const b=de(y),x=(f.lineColor??f.color)||b.line,$=f.data.length===0;return u.jsxs("div",{className:ge.cn("flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",$&&"opacity-50"),children:[u.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:x}}),u.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[f.label,$&&" (no data)"]}),m&&u.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),m(f.label)},className:"ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer","aria-label":`Remove ${f.label}`,children:u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground hover:text-foreground","aria-hidden":"true",children:[u.jsx("title",{children:"Close"}),u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},f.label)})})}exports.DEFAULT_SERIES_COLORS=Z;exports.Graph=De;exports.getSeriesColorPalette=de;exports.getVerticalLineTooltipContent=Ve;
@@ -19,7 +19,9 @@ function i() {
19
19
  timeScale: {
20
20
  borderVisible: !0,
21
21
  borderColor: "rgba(224, 227, 235, 0.1)",
22
- visible: !0
22
+ visible: !0,
23
+ fixLeftEdge: !0,
24
+ fixRightEdge: !0
23
25
  },
24
26
  rightPriceScale: {
25
27
  visible: !0,
@@ -81,7 +83,9 @@ const s = {
81
83
  timeScale: {
82
84
  borderVisible: !0,
83
85
  borderColor: "rgba(224, 227, 235, 0.1)",
84
- visible: !0
86
+ visible: !0,
87
+ fixLeftEdge: !0,
88
+ fixRightEdge: !0
85
89
  },
86
90
  rightPriceScale: {
87
91
  visible: !0,
@@ -1,22 +1,22 @@
1
- import { jsxs as j, jsx as p } from "react/jsx-runtime";
2
- import { createChart as Gt, CrosshairMode as Ot, AreaSeries as Bt } from "lightweight-charts";
1
+ import { jsxs as H, jsx as m } from "react/jsx-runtime";
2
+ import { createChart as Gt, CrosshairMode as Bt, AreaSeries as Ot } from "lightweight-charts";
3
3
  import * as ct from "react";
4
- import { useRef as P, useState as ut, useEffect as $ } from "react";
4
+ import { useRef as k, useState as ut, useEffect as D } from "react";
5
5
  import { useIsMobile as Yt } from "../../hooks/use-media-query.js";
6
6
  import { cn as dt } from "../../utils/cn.js";
7
- import { resolveCSSColor as Vt, generateColorsFromBase as q, hslToHex as jt } from "../../utils/colors.js";
8
- import { getDefaultOptions as yt, getDefaultSeries as Ht, getDefaultVerticalLine as Wt } from "./default-config.js";
7
+ import { resolveCSSColor as yt, generateColorsFromBase as q, hslToHex as Ht } from "../../utils/colors.js";
8
+ import { getDefaultOptions as Vt, getDefaultSeries as jt, getDefaultVerticalLine as Wt } from "./default-config.js";
9
9
  import { getXFormatters as kt, createAdaptiveYAxisFormatter as _t, formatExactValue as ft } from "./formatters.js";
10
10
  import { GraphCurrentValue as Xt } from "./graph-current-value.js";
11
- import { GraphTooltip as Lt } from "./graph-tooltip.js";
11
+ import { GraphTooltip as Nt } from "./graph-tooltip.js";
12
12
  import { VertLine as qt } from "./plugins/vertical-line.js";
13
- function Zt(e, S, C) {
14
- const A = e.labelText ?? "", f = e.value, w = f === void 0 ? "" : typeof f == "number" ? S === "$" ? `$${ft(f, void 0, C)}` : S === "%" ? `${ft(f, void 0, C)}%` : ft(
13
+ function Zt(e, C, b) {
14
+ const I = e.labelText ?? "", f = e.value, v = f === void 0 ? "" : typeof f == "number" ? C === "$" ? `$${ft(f, void 0, b)}` : C === "%" ? `${ft(f, void 0, b)}%` : ft(
15
15
  f,
16
- S !== "none" && S !== "%" && S !== "$" ? S : void 0,
17
- C
16
+ C !== "none" && C !== "%" && C !== "$" ? C : void 0,
17
+ b
18
18
  ) : String(f);
19
- return { labelText: A, valueStr: w };
19
+ return { labelText: I, valueStr: v };
20
20
  }
21
21
  const gt = [
22
22
  // 0 green (emerald)
@@ -134,31 +134,31 @@ const gt = [
134
134
  bottom: "rgba(71, 85, 105, 0.04)"
135
135
  }
136
136
  ], Kt = 137.5;
137
- function Nt(e) {
137
+ function Lt(e) {
138
138
  if (e < gt.length)
139
139
  return gt[e];
140
- const C = (e - gt.length) * Kt % 360, A = jt(C, 70, 50), { topColor: f, bottomColor: w } = q(A);
141
- return { line: A, top: f, bottom: w };
140
+ const b = (e - gt.length) * Kt % 360, I = Ht(b, 70, 50), { topColor: f, bottomColor: v } = q(I);
141
+ return { line: I, top: f, bottom: v };
142
142
  }
143
143
  function ge({
144
144
  series: e,
145
- className: S,
146
- showLegend: C = !1,
147
- onUnselectSeries: A,
145
+ className: C,
146
+ showLegend: b = !1,
147
+ onUnselectSeries: I,
148
148
  xMeasureUnit: f = "time",
149
- yMeasureUnit: w = "token",
150
- optionsOverrides: B,
151
- verticalLineOptions: R,
152
- currentValueDecimals: H,
153
- useSharedPriceScale: T = !1,
149
+ yMeasureUnit: v = "token",
150
+ optionsOverrides: O,
151
+ verticalLineOptions: x,
152
+ currentValueDecimals: j,
153
+ useSharedPriceScale: N = !1,
154
154
  showCurrentValue: Pt = !0,
155
155
  graphTitle: Z,
156
156
  yScaleMin: mt,
157
157
  yScaleMinMultiple: bt
158
158
  }) {
159
- const k = P(null), y = P(/* @__PURE__ */ new Map()), K = P(!1), J = P(/* @__PURE__ */ new Set()), ht = P(0), pt = P(!0), Q = P(
159
+ const V = k(null), R = k(/* @__PURE__ */ new Map()), K = k(!1), J = k(/* @__PURE__ */ new Set()), pt = k(0), ht = k(!0), Q = k(
160
160
  null
161
- ), Tt = P(null), I = P(null), U = P(null), V = Yt(), z = ct.useMemo(() => e.flatMap((t) => t.data), [e]), Ft = ct.useMemo(() => {
161
+ ), Tt = k(null), M = k(null), U = k(null), S = Yt(), z = ct.useMemo(() => e.flatMap((t) => t.data), [e]), Ft = ct.useMemo(() => {
162
162
  if (e.length > 0) {
163
163
  const t = e[e.length - 1];
164
164
  if (t.data.length > 0)
@@ -170,81 +170,81 @@ function ge({
170
170
  for (const a of e)
171
171
  a.data.length > 0 && t.set(a.label, a.data[a.data.length - 1]);
172
172
  return t;
173
- }), [et, E] = ut(null), [Ct, vt] = ut([]);
174
- $(() => {
173
+ }), [et, $] = ut(null), [Ct, vt] = ut([]);
174
+ D(() => {
175
175
  const t = () => {
176
- if (k.current && I.current) {
177
- const i = I.current.clientWidth, l = I.current.clientHeight;
178
- k.current.resize(i, l), k.current.timeScale().fitContent();
176
+ if (V.current && M.current) {
177
+ const l = M.current.clientWidth, s = M.current.clientHeight;
178
+ V.current.resize(l, s), V.current.timeScale().fitContent();
179
179
  }
180
- }, a = I.current, n = a ? new ResizeObserver(t) : null;
180
+ }, a = M.current, n = a ? new ResizeObserver(t) : null;
181
181
  return a && n?.observe(a), () => {
182
182
  a && n?.unobserve(a);
183
183
  };
184
- }, []), $(() => {
184
+ }, []), D(() => {
185
185
  if (!U.current || K.current) return;
186
- const t = yt(), a = Vt(
186
+ const t = Vt(), a = yt(
187
187
  "hsl(var(--foreground))",
188
188
  "rgb(0, 0, 0)"
189
189
  ), n = Gt(U.current, {
190
190
  ...t,
191
191
  rightPriceScale: {
192
192
  ...t.rightPriceScale || {},
193
- visible: !V,
193
+ visible: !S,
194
194
  textColor: a
195
195
  },
196
- ...V && {
196
+ ...S && {
197
197
  crosshair: {
198
198
  ...t.crosshair,
199
- mode: Ot.Magnet
199
+ mode: Bt.Magnet
200
200
  }
201
201
  },
202
- ...B
202
+ ...O
203
203
  });
204
- return k.current = n, K.current = !0, () => {
205
- n.remove(), k.current = null, K.current = !1, y.current.clear();
204
+ return V.current = n, K.current = !0, () => {
205
+ n.remove(), V.current = null, K.current = !1, R.current.clear();
206
206
  };
207
- }, [V, B]), $(() => {
208
- const t = k.current;
207
+ }, [S, O]), D(() => {
208
+ const t = V.current;
209
209
  if (!t || e.length === 0) return;
210
- const n = e.filter((o) => o.data.length > 0).length <= 1 ? mt : bt, i = f === "time" ? kt(f, z) : kt(f), l = z.map((o) => o.value), {
210
+ const n = e.filter((o) => o.data.length > 0).length <= 1 ? mt : bt, l = f === "time" ? kt(f, z) : kt(f), s = z.map((o) => o.value), {
211
211
  formatter: c,
212
- tickmarksFormatter: g,
212
+ tickmarksFormatter: u,
213
213
  updateVisibleRange: L,
214
- updateLastValues: b
215
- } = _t(l, w, {
214
+ updateLastValues: g
215
+ } = _t(s, v, {
216
216
  yScaleMin: n
217
217
  });
218
- Q.current = L, Tt.current = b;
219
- const N = e.filter((o) => o.data.length > 0).map((o) => o.data[o.data.length - 1].value);
220
- b(N);
221
- const v = yt();
218
+ Q.current = L, Tt.current = g;
219
+ const P = e.filter((o) => o.data.length > 0).map((o) => o.data[o.data.length - 1].value);
220
+ g(P);
221
+ const T = Vt();
222
222
  t.applyOptions({
223
223
  localization: {
224
- ...v.localization || {},
224
+ ...T.localization || {},
225
225
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
226
226
  timeFormatter: (o) => (
227
227
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
228
- i.timeFormatter(parseFloat(o), void 0)
228
+ l.timeFormatter(parseFloat(o), void 0)
229
229
  )
230
230
  },
231
231
  timeScale: {
232
- ...v.timeScale || {},
232
+ ...T.timeScale || {},
233
233
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
234
- tickMarkFormatter: i.tickMarkFormatter,
234
+ tickMarkFormatter: l.tickMarkFormatter,
235
235
  minBarSpacing: 0
236
236
  }
237
237
  });
238
- const d = (z.length > 0 ? Math.min(...z.map((o) => o.value)) : 0) < 0, h = z.some((o) => o.value === 0), m = !d && h, u = e.length > 1 && !T, F = e.length > 1 && !T || V, M = Vt(
238
+ const d = (z.length > 0 ? Math.min(...z.map((o) => o.value)) : 0) < 0, w = z.some((o) => o.value === 0), p = !d && w, h = e.length > 1 && !N, F = e.length > 1 && !N || S, A = yt(
239
239
  "hsl(var(--foreground))",
240
240
  "rgb(0, 0, 0)"
241
241
  );
242
242
  t.applyOptions({
243
243
  rightPriceScale: {
244
- ...v.rightPriceScale || {},
244
+ ...T.rightPriceScale || {},
245
245
  visible: !F,
246
- textColor: M,
247
- ...m && {
246
+ textColor: A,
247
+ ...p && {
248
248
  scaleMargins: {
249
249
  top: 0.3,
250
250
  bottom: 0
@@ -252,82 +252,82 @@ function ge({
252
252
  }
253
253
  }
254
254
  });
255
- const ot = new Set(y.current.keys()), nt = new Set(e.map((o) => o.label));
255
+ const ot = new Set(R.current.keys()), nt = new Set(e.map((o) => o.label));
256
256
  for (const o of ot)
257
257
  if (!nt.has(o)) {
258
- const r = y.current.get(o);
259
- r && (t.removeSeries(r), y.current.delete(o));
258
+ const r = R.current.get(o);
259
+ r && (t.removeSeries(r), R.current.delete(o));
260
260
  }
261
- const Mt = Ht(), rt = [];
261
+ const At = jt(), rt = [];
262
262
  let _ = 0;
263
263
  for (let o = 0; o < e.length; o++) {
264
- const r = e[o], it = Nt(o), X = r.lineColor ?? r.color ?? it.line;
265
- let D, G;
264
+ const r = e[o], it = Lt(o), X = r.lineColor ?? r.color ?? it.line;
265
+ let E, G;
266
266
  if (r.lineColor ?? r.color)
267
267
  if (r.topColor && r.bottomColor)
268
- D = r.topColor, G = r.bottomColor;
268
+ E = r.topColor, G = r.bottomColor;
269
269
  else if (r.topColor) {
270
- const s = q(X);
271
- D = r.topColor, G = s.bottomColor;
270
+ const i = q(X);
271
+ E = r.topColor, G = i.bottomColor;
272
272
  } else if (r.bottomColor)
273
- D = q(X).topColor, G = r.bottomColor;
273
+ E = q(X).topColor, G = r.bottomColor;
274
274
  else {
275
- const s = q(X);
276
- D = s.topColor, G = s.bottomColor;
275
+ const i = q(X);
276
+ E = i.topColor, G = i.bottomColor;
277
277
  }
278
278
  else
279
- D = r.topColor || it.top, G = r.bottomColor || it.bottom;
279
+ E = r.topColor || it.top, G = r.bottomColor || it.bottom;
280
280
  if (r.data.length === 0) {
281
- const s = y.current.get(r.label);
282
- s && (t.removeSeries(s), y.current.delete(r.label));
281
+ const i = R.current.get(r.label);
282
+ i && (t.removeSeries(i), R.current.delete(r.label));
283
283
  continue;
284
284
  }
285
- const zt = (r.data.length > 0 ? Math.min(...r.data.map((s) => s.value)) : 0) < 0, Et = r.data.some((s) => s.value === 0), $t = !zt && Et, St = T || !u || _ === 0 ? "right" : `scale-${_}`;
286
- u && rt.push({
285
+ const zt = (r.data.length > 0 ? Math.min(...r.data.map((i) => i.value)) : 0) < 0, $t = r.data.some((i) => i.value === 0), Dt = !zt && $t, St = N || !h || _ === 0 ? "right" : `scale-${_}`;
286
+ h && rt.push({
287
287
  priceScaleId: St || "right",
288
- shouldPreventNegativeAxis: $t,
288
+ shouldPreventNegativeAxis: Dt,
289
289
  seriesIndex: _
290
290
  });
291
- const wt = (T || !u) && n !== void 0 && typeof n == "number", Rt = {
291
+ const wt = (N || !h) && n !== void 0 && typeof n == "number", Rt = {
292
292
  lineColor: X,
293
- topColor: D,
293
+ topColor: E,
294
294
  bottomColor: G,
295
295
  priceScaleId: St,
296
296
  priceFormat: {
297
297
  type: "custom",
298
298
  minMove: 0.01,
299
- formatter: wt && typeof n == "number" ? (s) => c(
300
- s < n ? n : s
299
+ formatter: wt && typeof n == "number" ? (i) => c(
300
+ i < n ? n : i
301
301
  ) : c,
302
- tickmarksFormatter: g
302
+ tickmarksFormatter: u
303
303
  },
304
- autoscaleInfoProvider: (s) => {
305
- if (!wt) return s();
306
- const st = s();
304
+ autoscaleInfoProvider: (i) => {
305
+ if (!wt) return i();
306
+ const st = i();
307
307
  if (st?.priceRange) {
308
- const Dt = n;
309
- st.priceRange.minValue = Dt;
308
+ const Et = n;
309
+ st.priceRange.minValue = Et;
310
310
  }
311
311
  return st;
312
312
  }
313
313
  };
314
- let O = y.current.get(r.label);
315
- O ? (O.applyOptions(Rt), O.setData(
316
- r.data.map((s) => ({
317
- ...s,
318
- time: s.time
314
+ let B = R.current.get(r.label);
315
+ B ? (B.applyOptions(Rt), B.setData(
316
+ r.data.map((i) => ({
317
+ ...i,
318
+ time: i.time
319
319
  }))
320
- )) : (O = t.addSeries(Bt, {
321
- ...Mt,
320
+ )) : (B = t.addSeries(Ot, {
321
+ ...At,
322
322
  ...Rt
323
- }), O.setData(
324
- r.data.map((s) => ({
325
- ...s,
326
- time: s.time
323
+ }), B.setData(
324
+ r.data.map((i) => ({
325
+ ...i,
326
+ time: i.time
327
327
  }))
328
- ), y.current.set(r.label, O)), _++;
328
+ ), R.current.set(r.label, B)), _++;
329
329
  }
330
- if (u && rt.length > 0)
330
+ if (h && rt.length > 0)
331
331
  for (const o of rt)
332
332
  try {
333
333
  const r = t.priceScale(o.priceScaleId);
@@ -346,7 +346,7 @@ function ge({
346
346
  borderVisible: !0,
347
347
  borderColor: "rgba(224, 227, 235, 0.1)",
348
348
  entireTextOnly: !1,
349
- textColor: M
349
+ textColor: A
350
350
  });
351
351
  } catch (r) {
352
352
  console.warn(
@@ -354,17 +354,17 @@ function ge({
354
354
  r
355
355
  );
356
356
  }
357
- else if (!u)
357
+ else if (!h)
358
358
  try {
359
359
  const o = t.priceScale("right");
360
360
  o && o.applyOptions({
361
- visible: !V,
361
+ visible: !S,
362
362
  autoScale: !0,
363
363
  scaleMargins: {
364
364
  top: 0.1,
365
365
  // No bottom margin when yScaleMin is set so the scale doesn't extend below the minimum (avoids negative labels like -10M)
366
- bottom: n !== void 0 || m ? 0 : 0.1,
367
- ...m && {
366
+ bottom: n !== void 0 || p ? 0 : 0.1,
367
+ ...p && {
368
368
  top: 0.3
369
369
  }
370
370
  },
@@ -372,17 +372,17 @@ function ge({
372
372
  borderVisible: !0,
373
373
  borderColor: "rgba(224, 227, 235, 0.1)",
374
374
  entireTextOnly: !1,
375
- textColor: M
375
+ textColor: A
376
376
  });
377
377
  } catch {
378
378
  }
379
- n !== void 0 && !V && (T || !u) && t.applyOptions({
379
+ n !== void 0 && !S && (N || !h) && t.applyOptions({
380
380
  handleScroll: {
381
381
  vertTouchDrag: !1
382
382
  }
383
383
  });
384
- const at = new Set(e.map((o) => o.label)), At = at.size !== J.current.size || [...at].some((o) => !J.current.has(o)), It = z.length !== ht.current;
385
- (pt.current || At || It || V) && (t.timeScale().fitContent(), pt.current = !1), J.current = at, ht.current = z.length;
384
+ const at = new Set(e.map((o) => o.label)), It = at.size !== J.current.size || [...at].some((o) => !J.current.has(o)), Mt = z.length !== pt.current;
385
+ (ht.current || It || Mt || S) && (t.timeScale().fitContent(), ht.current = !1), J.current = at, pt.current = z.length;
386
386
  const lt = /* @__PURE__ */ new Map();
387
387
  for (const o of e)
388
388
  o.data.length > 0 && lt.set(o.label, o.data[o.data.length - 1]);
@@ -391,141 +391,133 @@ function ge({
391
391
  e,
392
392
  z,
393
393
  f,
394
- w,
395
- V,
396
- T,
394
+ v,
395
+ S,
396
+ N,
397
397
  mt,
398
398
  bt
399
- ]), $(() => {
400
- const t = k.current;
399
+ ]), D(() => {
400
+ const t = V.current;
401
401
  if (!t || e.length === 0) return;
402
402
  const a = e.length === 1;
403
403
  let n;
404
- for (const l of e)
405
- if (l.data.length > 0) {
406
- n = l.data[l.data.length - 1].time;
404
+ for (const s of e)
405
+ if (s.data.length > 0) {
406
+ n = s.data[s.data.length - 1].time;
407
407
  break;
408
408
  }
409
409
  if (!n) return;
410
- const i = (l) => {
411
- const { time: c = n, seriesData: g, point: L } = l || {}, b = Array.from(y.current.values());
410
+ const l = (s) => {
411
+ const { time: c = n, seriesData: u, point: L } = s || {}, g = Array.from(R.current.values());
412
412
  if (!L || !c) {
413
- const x = /* @__PURE__ */ new Map();
413
+ const y = /* @__PURE__ */ new Map();
414
414
  for (const d of e)
415
- d.data.length > 0 && x.set(d.label, d.data[d.data.length - 1]);
416
- if (tt(x.size > 0 ? x : void 0), a || T)
417
- E(null);
418
- else if (b[0] && n) {
419
- const h = t.timeScale().timeToCoordinate(n), m = e[0];
420
- if (m.data.length > 0) {
421
- const u = m.data[m.data.length - 1].value, F = b[0].priceToCoordinate(u);
422
- h !== null && F !== null && E({ x: h, y: F });
415
+ d.data.length > 0 && y.set(d.label, d.data[d.data.length - 1]);
416
+ if (tt(y.size > 0 ? y : void 0), a || N)
417
+ $(null);
418
+ else if (g[0] && n) {
419
+ const w = t.timeScale().timeToCoordinate(n), p = e[0];
420
+ if (p.data.length > 0) {
421
+ const h = p.data[p.data.length - 1].value, F = g[0].priceToCoordinate(h);
422
+ w !== null && F !== null && $({ x: w, y: F });
423
423
  }
424
424
  }
425
425
  return;
426
426
  }
427
- const N = /* @__PURE__ */ new Map();
428
- let v;
429
- for (let x = 0; x < e.length; x++) {
430
- const d = e[x], h = b[x];
431
- if (!h) continue;
432
- const m = g?.get(h), u = m && "value" in m ? m.value : void 0, F = d.data[d.data.length - 1], M = u !== void 0 ? u : F?.value ?? 0;
433
- x === 0 && (v = M), N.set(d.label, { value: M, time: c });
427
+ const P = /* @__PURE__ */ new Map();
428
+ let T;
429
+ for (let y = 0; y < e.length; y++) {
430
+ const d = e[y], w = g[y];
431
+ if (!w) continue;
432
+ const p = u?.get(w), h = p && "value" in p ? p.value : void 0, F = d.data[d.data.length - 1], A = h !== void 0 ? h : F?.value ?? 0;
433
+ y === 0 && (T = A), P.set(d.label, { value: A, time: c });
434
434
  }
435
- if (tt(N), v !== void 0 && b[0]) {
436
- const d = t.timeScale().timeToCoordinate(c), h = b[0].priceToCoordinate(v);
437
- if (d !== null && h !== null) {
438
- const m = I.current;
439
- if (m) {
440
- const u = m.querySelector(
435
+ if (tt(P), T !== void 0 && g[0]) {
436
+ const d = t.timeScale().timeToCoordinate(c), w = g[0].priceToCoordinate(T);
437
+ if (d !== null && w !== null) {
438
+ const p = M.current;
439
+ if (p) {
440
+ const h = p.querySelector(
441
441
  ".LightweightChart"
442
442
  );
443
- if (u) {
444
- const F = u.getBoundingClientRect(), M = m.getBoundingClientRect(), ot = d + (F.left - M.left), nt = h + (F.top - M.top);
445
- E({ x: ot, y: nt });
443
+ if (h) {
444
+ const F = h.getBoundingClientRect(), A = p.getBoundingClientRect(), ot = d + (F.left - A.left), nt = w + (F.top - A.top);
445
+ $({ x: ot, y: nt });
446
446
  } else
447
- E({ x: d, y: h });
447
+ $({ x: d, y: w });
448
448
  } else
449
- E({ x: d, y: h });
449
+ $({ x: d, y: w });
450
450
  } else
451
- E(null);
451
+ $(null);
452
452
  } else
453
- E(null);
453
+ $(null);
454
454
  };
455
- return t.subscribeCrosshairMove(i), V && t.subscribeClick(i), !a && !T && requestAnimationFrame(() => {
456
- const l = Array.from(y.current.values());
457
- if (l[0] && n && e[0]?.data.length > 0) {
458
- const g = t.timeScale().timeToCoordinate(n), L = e[0].data[e[0].data.length - 1].value, b = l[0].priceToCoordinate(L);
459
- g !== null && b !== null && E({ x: g, y: b });
455
+ return t.subscribeCrosshairMove(l), S && t.subscribeClick(l), !a && !N && requestAnimationFrame(() => {
456
+ const s = Array.from(R.current.values());
457
+ if (s[0] && n && e[0]?.data.length > 0) {
458
+ const u = t.timeScale().timeToCoordinate(n), L = e[0].data[e[0].data.length - 1].value, g = s[0].priceToCoordinate(L);
459
+ u !== null && g !== null && $({ x: u, y: g });
460
460
  }
461
461
  }), () => {
462
- t.unsubscribeCrosshairMove(i), V && t.unsubscribeClick(i);
462
+ t.unsubscribeCrosshairMove(l), S && t.unsubscribeClick(l);
463
463
  };
464
- }, [e, T, V]), $(() => {
465
- const t = k.current;
464
+ }, [e, N, S]), D(() => {
465
+ const t = V.current;
466
466
  if (!t || e.length === 0) return;
467
- const a = t.timeScale(), n = Math.max(...e.map((l) => l.data.length)), i = () => {
468
- if (n === 0) return;
469
- const l = a.getVisibleLogicalRange();
467
+ const a = t.timeScale(), n = () => {
468
+ if (!Q.current) return;
469
+ const l = a.getVisibleRange();
470
470
  if (!l) return;
471
- const c = {
472
- from: 0,
473
- to: n - 1
474
- }, g = typeof l.from == "number" ? l.from : 0, L = typeof l.to == "number" ? l.to : n - 1;
475
- if (Q.current) {
476
- const x = Math.max(0, Math.floor(g)), d = Math.min(n - 1, Math.ceil(L)), h = [];
477
- for (const m of e)
478
- for (let u = x; u <= d && u < m.data.length; u++)
479
- h.push(m.data[u].value);
480
- h.length > 0 && Q.current(h);
481
- }
482
- const b = 0.01;
483
- let N = !1;
484
- const v = { ...l };
485
- g < c.from - b && (v.from = c.from, N = !0), L > c.to + b && (v.to = c.to, N = !0), N && a.setVisibleLogicalRange(v);
471
+ const s = Number(l.from), c = Number(l.to), u = [];
472
+ for (const L of e)
473
+ for (const g of L.data) {
474
+ const P = Number(g.time);
475
+ P >= s && P <= c && u.push(g.value);
476
+ }
477
+ u.length > 0 && Q.current(u);
486
478
  };
487
- return a.subscribeVisibleLogicalRangeChange(i), () => {
479
+ return a.subscribeVisibleLogicalRangeChange(n), () => {
488
480
  a.unsubscribeVisibleLogicalRangeChange(
489
- i
481
+ n
490
482
  );
491
483
  };
492
- }, [e]), $(() => {
493
- const t = k.current, a = Array.from(y.current.values()), n = [];
494
- if (t && a.length > 0 && R) {
495
- const i = Wt(), l = a[0];
496
- for (const c of R) {
497
- const g = new qt(t, l, c.xCoordinate, {
498
- ...i,
484
+ }, [e]), D(() => {
485
+ const t = V.current, a = Array.from(R.current.values()), n = [];
486
+ if (t && a.length > 0 && x) {
487
+ const l = Wt(), s = a[0];
488
+ for (const c of x) {
489
+ const u = new qt(t, s, c.xCoordinate, {
490
+ ...l,
499
491
  ...c.options || {}
500
492
  });
501
- l.attachPrimitive(g), n.push(g);
493
+ s.attachPrimitive(u), n.push(u);
502
494
  }
503
495
  }
504
496
  return () => {
505
497
  if (a.length > 0) {
506
- const i = a[0];
507
- for (const l of n)
508
- i.detachPrimitive(l);
498
+ const l = a[0];
499
+ for (const s of n)
500
+ l.detachPrimitive(s);
509
501
  }
510
502
  };
511
- }, [R]), $(() => {
512
- const t = k.current;
513
- if (!t || !R?.length) {
503
+ }, [x]), D(() => {
504
+ const t = V.current;
505
+ if (!t || !x?.length) {
514
506
  vt([]);
515
507
  return;
516
508
  }
517
509
  const a = () => {
518
- const l = t.timeScale(), c = R.map((g) => l.timeToCoordinate(g.xCoordinate) ?? null);
510
+ const s = t.timeScale(), c = x.map((u) => s.timeToCoordinate(u.xCoordinate) ?? null);
519
511
  vt(c);
520
512
  };
521
513
  a();
522
- const n = t.timeScale(), i = () => {
514
+ const n = t.timeScale(), l = () => {
523
515
  a();
524
516
  };
525
- return n.subscribeVisibleLogicalRangeChange(i), () => {
526
- n.unsubscribeVisibleLogicalRangeChange(i);
517
+ return n.subscribeVisibleLogicalRangeChange(l), () => {
518
+ n.unsubscribeVisibleLogicalRangeChange(l);
527
519
  };
528
- }, [R]);
520
+ }, [x]);
529
521
  const Y = e.length === 1, xt = ct.useMemo(() => {
530
522
  if (Y && e.length > 0) {
531
523
  const t = e[0];
@@ -533,85 +525,85 @@ function ge({
533
525
  return t.data[t.data.length - 1];
534
526
  }
535
527
  }, [Y, e]);
536
- return /* @__PURE__ */ j(
528
+ return /* @__PURE__ */ H(
537
529
  "div",
538
530
  {
539
- ref: I,
531
+ ref: M,
540
532
  className: dt(
541
533
  "relative z-[1] w-full h-full overflow-hidden p-0",
542
- S
534
+ C
543
535
  ),
544
536
  children: [
545
- Z != null && Z !== !1 && Y ? /* @__PURE__ */ p("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ p("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: Z }) }) : Pt && Y && xt && /* @__PURE__ */ p(
537
+ Z != null && Z !== !1 && Y ? /* @__PURE__ */ m("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ m("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: Z }) }) : Pt && Y && xt && /* @__PURE__ */ m(
546
538
  Xt,
547
539
  {
548
540
  point: xt,
549
541
  xMeasureUnit: f,
550
- yMeasureUnit: w,
551
- decimals: H
542
+ yMeasureUnit: v,
543
+ decimals: j
552
544
  }
553
545
  ),
554
- W && et && /* @__PURE__ */ p(
555
- Lt,
546
+ W && et && /* @__PURE__ */ m(
547
+ Nt,
556
548
  {
557
549
  points: W,
558
550
  xMeasureUnit: f,
559
- yMeasureUnit: w,
551
+ yMeasureUnit: v,
560
552
  series: e,
561
553
  position: et,
562
- containerRef: I,
563
- decimals: H
554
+ containerRef: M,
555
+ decimals: j
564
556
  }
565
557
  ),
566
- W && !et && !Y && V && /* @__PURE__ */ p(
567
- Lt,
558
+ W && !et && !Y && S && /* @__PURE__ */ m(
559
+ Nt,
568
560
  {
569
561
  points: W,
570
562
  xMeasureUnit: f,
571
- yMeasureUnit: w,
563
+ yMeasureUnit: v,
572
564
  series: e,
573
- containerRef: I,
574
- decimals: H,
565
+ containerRef: M,
566
+ decimals: j,
575
567
  className: "top-2 left-2"
576
568
  }
577
569
  ),
578
- C && /* @__PURE__ */ p(Jt, { series: e, onUnselect: A }),
579
- R && R.length > 0 && Ct.length === R.length && /* @__PURE__ */ p(
570
+ b && /* @__PURE__ */ m(Jt, { series: e, onUnselect: I }),
571
+ x && x.length > 0 && Ct.length === x.length && /* @__PURE__ */ m(
580
572
  "div",
581
573
  {
582
574
  className: "absolute inset-0 z-[5] pointer-events-none",
583
575
  "aria-hidden": !0,
584
- children: R.map((t, a) => {
585
- const n = Ct[a], i = t.options ?? {}, l = i.showLabel !== !1;
586
- if (n === null || !l) return null;
587
- const { labelText: c, valueStr: g } = Zt(
588
- i,
589
- w,
590
- H
576
+ children: x.map((t, a) => {
577
+ const n = Ct[a], l = t.options ?? {}, s = l.showLabel !== !1;
578
+ if (n === null || !s) return null;
579
+ const { labelText: c, valueStr: u } = Zt(
580
+ l,
581
+ v,
582
+ j
591
583
  );
592
- if (!(c || g)) return null;
593
- const b = i.labelBackgroundColor ?? i.color ?? "hsl(var(--background))", N = i.labelTextColor ?? "hsl(var(--foreground))", v = `${String(t.xCoordinate)}-${c}`;
594
- return /* @__PURE__ */ j(
584
+ if (!(c || u)) return null;
585
+ const g = l.labelBackgroundColor ?? l.color ?? "hsl(var(--background))", P = l.labelTextColor ?? "hsl(var(--foreground))", T = `${String(t.xCoordinate)}-${c}`;
586
+ return /* @__PURE__ */ H(
595
587
  "div",
596
588
  {
597
589
  className: "absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
598
590
  style: {
599
591
  left: n,
600
592
  transform: "translateX(-50%)",
601
- backgroundColor: b,
602
- color: N
593
+ backgroundColor: g,
594
+ color: P
603
595
  },
604
596
  children: [
605
- c && /* @__PURE__ */ p("span", { className: "block", children: c }),
606
- g && /* @__PURE__ */ p("span", { className: dt("block", c && "mt-0.5"), children: g })
597
+ c && /* @__PURE__ */ m("span", { className: "block", children: c }),
598
+ u && /* @__PURE__ */ m("span", { className: dt("block", c && "mt-0.5"), children: u })
607
599
  ]
608
600
  },
609
- v
601
+ T
610
602
  );
611
603
  })
612
604
  }
613
605
  ),
614
- /* @__PURE__ */ p(
606
+ /* @__PURE__ */ m(
615
607
  "div",
616
608
  {
617
609
  ref: U,
@@ -624,39 +616,39 @@ function ge({
624
616
  }
625
617
  function Jt({
626
618
  series: e,
627
- onUnselect: S
619
+ onUnselect: C
628
620
  }) {
629
- return /* @__PURE__ */ p("div", { className: "absolute top-0 left-2 z-[10] flex flex-wrap gap-2", children: e.map((C, A) => {
630
- const f = Nt(A), w = (C.lineColor ?? C.color) || f.line, B = C.data.length === 0;
631
- return /* @__PURE__ */ j(
621
+ return /* @__PURE__ */ m("div", { className: "absolute top-0 left-2 z-[10] flex flex-wrap gap-2", children: e.map((b, I) => {
622
+ const f = Lt(I), v = (b.lineColor ?? b.color) || f.line, O = b.data.length === 0;
623
+ return /* @__PURE__ */ H(
632
624
  "div",
633
625
  {
634
626
  className: dt(
635
627
  "flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
636
- B && "opacity-50"
628
+ O && "opacity-50"
637
629
  ),
638
630
  children: [
639
- /* @__PURE__ */ p(
631
+ /* @__PURE__ */ m(
640
632
  "div",
641
633
  {
642
634
  className: "w-3 h-3 rounded-sm",
643
- style: { backgroundColor: w }
635
+ style: { backgroundColor: v }
644
636
  }
645
637
  ),
646
- /* @__PURE__ */ j("span", { className: "text-[10px] sm:text-xs font-medium text-foreground", children: [
647
- C.label,
648
- B && " (no data)"
638
+ /* @__PURE__ */ H("span", { className: "text-[10px] sm:text-xs font-medium text-foreground", children: [
639
+ b.label,
640
+ O && " (no data)"
649
641
  ] }),
650
- S && /* @__PURE__ */ p(
642
+ C && /* @__PURE__ */ m(
651
643
  "button",
652
644
  {
653
645
  type: "button",
654
- onClick: (R) => {
655
- R.stopPropagation(), S(C.label);
646
+ onClick: (x) => {
647
+ x.stopPropagation(), C(b.label);
656
648
  },
657
649
  className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
658
- "aria-label": `Remove ${C.label}`,
659
- children: /* @__PURE__ */ j(
650
+ "aria-label": `Remove ${b.label}`,
651
+ children: /* @__PURE__ */ H(
660
652
  "svg",
661
653
  {
662
654
  xmlns: "http://www.w3.org/2000/svg",
@@ -671,9 +663,9 @@ function Jt({
671
663
  className: "text-muted-foreground hover:text-foreground",
672
664
  "aria-hidden": "true",
673
665
  children: [
674
- /* @__PURE__ */ p("title", { children: "Close" }),
675
- /* @__PURE__ */ p("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
676
- /* @__PURE__ */ p("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
666
+ /* @__PURE__ */ m("title", { children: "Close" }),
667
+ /* @__PURE__ */ m("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
668
+ /* @__PURE__ */ m("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
677
669
  ]
678
670
  }
679
671
  )
@@ -681,13 +673,13 @@ function Jt({
681
673
  )
682
674
  ]
683
675
  },
684
- C.label
676
+ b.label
685
677
  );
686
678
  }) });
687
679
  }
688
680
  export {
689
681
  gt as DEFAULT_SERIES_COLORS,
690
682
  ge as Graph,
691
- Nt as getSeriesColorPalette,
683
+ Lt as getSeriesColorPalette,
692
684
  Zt as getVerticalLineTooltipContent
693
685
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/permissionless-ui",
3
- "version": "1.26.3",
3
+ "version": "1.26.4",
4
4
  "description": "Internal UI components",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/index.js",