@gearbox-protocol/ui-kit 4.0.0-next.37 → 4.0.0-next.39

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 v=require("react/jsx-runtime"),H=require("lightweight-charts"),p=require("react"),ct=require("../../hooks/use-media-query.cjs"),re=require("../../utils/cn.cjs"),G=require("../../utils/colors.cjs"),D=require("./default-config.cjs"),ne=require("./formatters.cjs"),ut=require("./graph-current-value.cjs"),ft=require("./graph-tooltip.cjs"),ht=require("./plugins/vertical-line.cjs"),He=require("./y-axis-scale.cjs");function gt(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const f=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,f.get?f:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const Te=gt(p);function oe(e){return e.id??e.label}function Ze(e,n,a){if(!a)return e.values().next().value;const f=e.get(a);if(f)return f;const c=n.find(b=>b.id===a||b.label===a);return c?e.get(oe(c)):void 0}class pt{_yTop;_yBottom;_color;constructor(n,a,f){this._yTop=n,this._yBottom=a,this._color=f}draw(n){n.useBitmapCoordinateSpace(a=>{const f=a.context,c=a.verticalPixelRatio,b=this._yTop===null?0:this._yTop*c,C=this._yBottom===null?a.bitmapSize.height:this._yBottom*c,P=Math.min(b,C),M=Math.max(b,C);f.fillStyle=this._color,f.fillRect(0,P,a.bitmapSize.width,M-P)})}}class dt{_source;_yTop=null;_yBottom=null;constructor(n){this._source=n}update(){const n=this._source.series;this._yTop=this._source.priceTop===void 0?null:n.priceToCoordinate(this._source.priceTop),this._yBottom=this._source.priceBottom===void 0?null:n.priceToCoordinate(this._source.priceBottom)}zOrder(){return"bottom"}renderer(){return new pt(this._yTop,this._yBottom,this._source.color)}}class mt{series;priceTop;priceBottom;color;_paneViews;constructor(n,a,f,c){this.series=n,this.priceTop=a,this.priceBottom=f,this.color=c,this._paneViews=[new dt(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function bt(e,n){switch(e){case H.LineStyle.Dotted:return[n,n];case H.LineStyle.Dashed:return[2*n,2*n];case H.LineStyle.LargeDashed:return[6*n,6*n];case H.LineStyle.SparseDotted:return[n,4*n];default:return[]}}class St{_y;_color;_lineWidth;_lineStyle;constructor(n,a,f,c){this._y=n,this._color=a,this._lineWidth=f,this._lineStyle=c}draw(n){n.useBitmapCoordinateSpace(a=>{if(this._y===null)return;const f=a.context,c=a.verticalPixelRatio,b=Math.max(1,Math.round(this._lineWidth*c)),C=Math.round(this._y*c);f.save(),f.strokeStyle=this._color,f.lineWidth=b,f.setLineDash(bt(this._lineStyle,b)),f.beginPath(),f.moveTo(0,C),f.lineTo(a.bitmapSize.width,C),f.stroke(),f.restore()})}}class Ct{_source;_y=null;constructor(n){this._source=n}update(){this._y=this._source.series.priceToCoordinate(this._source.price)}zOrder(){return"top"}renderer(){return new St(this._y,this._source.color,this._source.lineWidth,this._source.lineStyle)}}class xt{series;price;color;lineWidth;lineStyle;_paneViews;constructor(n,a,f,c,b){this.series=n,this.price=a,this.color=f,this.lineWidth=c,this.lineStyle=b,this._paneViews=[new Ct(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function Qe(e,n,a){const f=e.labelText??"",c=e.value,b=c===void 0?"":typeof c=="number"?n==="$"?`$${ne.formatExactValue(c,void 0,a)}`:n==="%"?`${ne.formatExactValue(c,void 0,a)}%`:ne.formatExactValue(c,n!=="none"&&n!=="%"&&n!=="$"&&!ne.isRatioUnit(n)?n:void 0,a):String(c);return{labelText:f,valueStr:b}}const Le=4;function Ye(e,n,a){const f={left:e,transform:"translateX(-50%)"};if(n<=0||!a||a<=0)return f;const c=a/2,b=Le+c,C=n-Le-c;return C<b?{left:n/2,transform:"translateX(-50%)"}:{left:Math.min(Math.max(e,b),C),transform:"translateX(-50%)"}}function Je(e,n){for(let a=e.length-1;a>=0;a--)if(Number(e[a].time)<=n)return e[a].value;return 0}const be=[{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)"}],vt=137.5;function Ne(e){if(e<be.length)return be[e];const a=(e-be.length)*vt%360,f=G.hslToHex(a,70,50),{topColor:c,bottomColor:b}=G.generateColorsFromBase(f);return{line:f,top:c,bottom:b}}function _t({series:e,className:n,showLegend:a=!1,onUnselectSeries:f,xMeasureUnit:c="time",yMeasureUnit:b="token",optionsOverrides:C,verticalLineOptions:P,priceLineOptions:M,zoneOptions:X,currentValueDecimals:Se,useSharedPriceScale:Z=!1,dualYAxis:A=!1,defaultVisiblePriceScaleId:Ve="right",leftPriceScaleTitle:Ee,rightPriceScaleTitle:yt,showCurrentValue:et=!0,graphTitle:Ce,yScaleMin:Ie,yScaleMinMultiple:De,visibleTimeFrom:U,disableZoom:Me=!1,hideDefaultTooltip:xe=!1}){const B=p.useRef(null),E=p.useRef(new Map),ve=p.useRef(!1),ke=p.useRef(!0),Ae=p.useRef([]),ae=p.useRef(0),j=p.useRef(null),_e=p.useRef(null),Be=p.useRef(null),T=ct.useIsMobile(),le=Te.useMemo(()=>e.flatMap(t=>t.data),[e]),tt=Te.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[je,ye]=p.useState(()=>{if(!tt)return;const t=new Map;for(const l of e)l.data.length>0&&t.set(l.label,l.data[l.data.length-1]);return t}),[Fe,Y]=p.useState(null),[ze,Ge]=p.useState([]),[ot,Xe]=p.useState(0),qe=p.useRef(new Map),[rt,nt]=p.useState({}),[ee,it]=p.useState(0);p.useEffect(()=>{const t=()=>{try{if(j.current&&Xe(j.current.clientWidth),B.current&&j.current){const s=j.current.clientWidth,u=j.current.clientHeight;B.current.resize(s,u);try{ae.current=B.current.paneSize().height}catch{}}}catch{}},l=j.current,i=l?new ResizeObserver(t):null;return Be.current=i,l&&i?.observe(l),()=>{l&&i?.unobserve(l),i?.disconnect(),Be.current=null}},[]),p.useEffect(()=>{if(!_e.current||ve.current)return;const t=D.getDefaultOptions(),l=G.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)"),i=H.createChart(_e.current,{...t,leftPriceScale:{...t.leftPriceScale||{},visible:!1,textColor:l},rightPriceScale:{...t.rightPriceScale||{},visible:!T,textColor:l},...T&&{crosshair:{...t.crosshair,mode:H.CrosshairMode.Magnet}}});B.current=i,ve.current=!0;try{ae.current=i.paneSize().height}catch{ae.current=0}return it(s=>s+1),()=>{i.remove(),B.current=null,ve.current=!1,E.current.clear()}},[T]),p.useEffect(()=>{const t=B.current;t&&t.applyOptions(Me?{handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:!1,axisDoubleClickReset:!1},handleScroll:{mouseWheel:!1,pressedMouseMove:!1,horzTouchDrag:!1,vertTouchDrag:!1}}:{handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:!0,axisDoubleClickReset:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}})},[ee,Me]),p.useEffect(()=>{const t=B.current;!t||!C||t.applyOptions(C)},[ee,C]),p.useEffect(()=>{const t=B.current;if(!t||e.length===0)return;const i=e.filter(r=>r.data.length>0).length<=1?Ie:De,s=c==="time"?ne.getXFormatters(c,le):ne.getXFormatters(c),u=new Map;{let r=0;for(const o of e)o.data.length!==0&&(u.set(o.label,o.priceScaleId??(r===0?"left":"right")),r++)}const h=(r,o,g)=>{const{formatter:F,tickmarksFormatter:N,updateVisibleRange:V}=ne.createAdaptiveYAxisFormatter(r,o,{yScaleMin:i});return{formatter:F,tickmarksFormatter:N,updateVisibleRange:V,labels:g}},d=[];if(A)for(const r of["left","right"]){const o=new Set,g=[];let F=b;for(const N of e)if(N.data.length!==0&&u.get(N.label)===r){o.size===0&&N.yMeasureUnit&&(F=N.yMeasureUnit),o.add(N.label);for(const V of N.data)g.push(V.value)}o.size>0&&d.push(h(g,F,o))}else{const r=le.map(g=>g.value),o=new Set(e.filter(g=>g.data.length>0).map(g=>g.label));d.push(h(r,b,o))}Ae.current=d;const y=new Map;for(const r of d)for(const o of r.labels)y.set(o,r);const w=D.getDefaultOptions();t.applyOptions({localization:{...w.localization||{},timeFormatter:r=>s.timeFormatter(parseFloat(r),void 0)},timeScale:{...w.timeScale||{},...C?.timeScale,tickMarkFormatter:s.tickMarkFormatter,minBarSpacing:0}});const x=!A&&e.length>1&&!Z,q=A?T:e.length>1&&!Z||T,I=G.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)");t.applyOptions({...A&&{defaultVisiblePriceScaleId:Ve},leftPriceScale:{...w.leftPriceScale||{},...C?.leftPriceScale,visible:A&&!T,textColor:I,...A&&Ee&&{}},rightPriceScale:{...w.rightPriceScale||{},...C?.rightPriceScale,visible:A?!T:!q,textColor:I}});const te=new Set(E.current.keys()),W=new Set(e.map(oe));for(const r of te)if(!W.has(r)){const o=E.current.get(r);o&&(t.removeSeries(o),E.current.delete(r))}const m=D.getDefaultSeries(),k=[];let L=0;const K=e.find(r=>r.data.length>0),_=new Map;if(M&&M.length>0)for(const r of M){if(!Number.isFinite(r.price))continue;const o=r.seriesLabel??K?.label;if(!o)continue;const g=_.get(o)??[];g.push(r.price),_.set(o,g)}if(X&&X.length>0)for(const r of X){const o=r.seriesLabel??K?.label;if(!o)continue;const g=_.get(o)??[];Number.isFinite(r.priceTop)&&g.push(r.priceTop),Number.isFinite(r.priceBottom)&&g.push(r.priceBottom),_.set(o,g)}for(let r=0;r<e.length;r++){const o=e[r],g=oe(o),F=Ne(r),N=o.lineColor??o.color??F.line;let V,J;if(o.lineColor??o.color)if(o.topColor&&o.bottomColor)V=o.topColor,J=o.bottomColor;else if(o.topColor){const S=G.generateColorsFromBase(N);V=o.topColor,J=S.bottomColor}else if(o.bottomColor)V=G.generateColorsFromBase(N).topColor,J=o.bottomColor;else{const S=G.generateColorsFromBase(N);V=S.topColor,J=S.bottomColor}else V=o.topColor||F.top,J=o.bottomColor||F.bottom;if(o.data.length===0){const S=E.current.get(g);S&&(t.removeSeries(S),E.current.delete(g));continue}const pe=o.data.length>0?Math.min(...o.data.map(S=>S.value)):0,ce=o.data.length>0?Math.max(...o.data.map(S=>S.value)):0,ue=pe<0,Q=o.data.some(S=>S.value===0),de=!ue&&Q,fe=He.pickMinMove(ce-pe),he=A?o.priceScaleId??(L===0?"left":"right"):Z||!x||L===0?"right":`scale-${L}`;x&&k.push({priceScaleId:he||"right",seriesIndex:L});const we=(Z||!x)&&i!==void 0&&typeof i=="number",st=_.get(o.label)??[],at=S=>{const R=S();if(R?.priceRange){we&&(R.priceRange.minValue=i);for(const O of st)O<R.priceRange.minValue&&(R.priceRange.minValue=O),O>R.priceRange.maxValue&&(R.priceRange.maxValue=O);const se=we?i:de&&R.priceRange.minValue>=0?0:void 0,me=ae.current>0?ae.current:j.current?.clientHeight??0;if(me>0){const O=He.niceAxisRange({min:R.priceRange.minValue,max:R.priceRange.maxValue,floor:se,scaleHeightPx:me,fontSizePx:D.AXIS_FONT_SIZE,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,minMove:fe,edgePaddingPx:D.AXIS_EDGE_LABEL_PADDING_PX,edgePaddingTopPx:D.AXIS_TOP_LABEL_PADDING_PX});R.priceRange.minValue=O.min,R.priceRange.maxValue=O.max}R.margins={above:D.AXIS_TOP_LABEL_PADDING_PX,below:D.AXIS_EDGE_LABEL_PADDING_PX}}return R},Ke=y.get(o.label)??d[0],$e=Ke.formatter,lt=Ke.tickmarksFormatter,Re={lineColor:N,topColor:V,bottomColor:J,priceScaleId:he,...o.seriesType==="line"&&{lineStyle:o.lineStyle??H.LineStyle.Solid},priceFormat:{type:"custom",minMove:fe,formatter:we&&typeof i=="number"?S=>$e(S<i?i:S):$e,tickmarksFormatter:lt},autoscaleInfoProvider:at},Oe=o.seriesType==="line";let z=E.current.get(g);const ie=o.data.map(S=>({...S,time:S.time}));if(U!==void 0&&ie.length>0&&Number(ie[0].time)>U){const S=Number(ie[0].time),R=S-U,se=86400,me=R>180*se?7*se:R>30*se?se:6*3600,O=[];for(let Pe=U;Pe<S;Pe+=me)O.push({time:Pe});ie.unshift(...O)}z&&z.seriesType()!==(Oe?"Line":"Area")&&(t.removeSeries(z),E.current.delete(g),z=void 0),z?(z.applyOptions(Re),z.setData(ie)):(Oe?z=t.addSeries(H.LineSeries,{...m,...Re}):z=t.addSeries(H.AreaSeries,{...m,...Re}),z.setData(ie),E.current.set(g,z)),L++}if(A)try{const r=t.priceScale("left"),o=t.priceScale("right"),g={visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...C?.rightPriceScale};r?.applyOptions(g),o?.applyOptions(g)}catch{}else if(x&&k.length>0)for(const r of k)try{const o=t.priceScale(r.priceScaleId);o&&o.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I})}catch(o){console.warn(`Failed to configure price scale ${r.priceScaleId} for series ${r.seriesIndex}:`,o)}else if(!x)try{const r=t.priceScale("right");r&&r.applyOptions({visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...C?.rightPriceScale})}catch{}if(i!==void 0&&!T&&(Z||!x)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}}),le.length>0){const r=le.map(o=>Number(o.time)).filter(o=>Number.isFinite(o));if(r.length>0){const o=Math.min(...r),g=U!==void 0?Math.min(U,o):o,F=Math.max(...r);if(Number(g)<=Number(F)){const N=()=>{const V=t.timeScale();if(c!=="time"){V.applyOptions({fixLeftEdge:!0,fixRightEdge:!0});return}const J=A&&!T,pe=A?!T:!q,ce=!J,ue=!pe;if(V.applyOptions({fixLeftEdge:!ce,fixRightEdge:!ue}),!ce&&!ue)return;const Q=V.getVisibleLogicalRange(),de=V.width();if(!Q||!(de>0))return;const fe=Q.to-Q.from;if(!(fe>0))return;const he=D.AXIS_TIME_EDGE_PADDING_PX*fe/de;V.setVisibleLogicalRange({from:ce?Q.from-he:Q.from,to:ue?Q.to+he:Q.to})};try{t.timeScale().setVisibleRange({from:g,to:F}),N()}catch{try{t.timeScale().fitContent(),N()}catch{}}}}}ke.current&&(ke.current=!1),C&&t.applyOptions(C);const $=new Map;for(const r of e)r.data.length>0&&$.set(r.label,r.data[r.data.length-1]);ye($.size>0?$:void 0)},[ee,e,le,c,b,T,Z,A,Ve,Ee,Ie,De,U,M,X,C]),p.useEffect(()=>{const t=B.current;if(!t||e.length===0)return;const l=e.length===1;let i;for(const u of e)if(u.data.length>0){i=u.data[u.data.length-1].time;break}if(!i)return;const s=u=>{const{time:h=i,seriesData:d,point:y}=u||{},w=e[0],x=w?E.current.get(oe(w)):void 0;if(!y||!h){const W=new Map;for(const m of e)m.data.length>0&&W.set(m.label,m.data[m.data.length-1]);if(ye(W.size>0?W:void 0),l||Z||xe)Y(null);else if(x&&i){const m=e[0];if(m&&m.data.length>0){const L=t.timeScale().timeToCoordinate(i),K=m.data[m.data.length-1].value,_=x.priceToCoordinate(K);L!==null&&_!==null&&Y({x:L,y:_})}}return}const q=new Map;let I,te=x;for(let W=0;W<e.length;W++){const m=e[W],k=E.current.get(oe(m));if(!k)continue;const L=d?.get(k),K=L&&"value"in L?L.value:void 0;let _;if(K!==void 0)_=K;else if(l){const $=Number(h),r=m.data.length>0?Number(m.data[0].time):Number.POSITIVE_INFINITY;$<r?_=Number.NaN:_=m.data[m.data.length-1]?.value??0}else{const $=m.data.length>0?Number(m.data[0].time):Number.POSITIVE_INFINITY;if(Number(h)<$)continue;_=Je(m.data,Number(h))}Number.isNaN(_)||(I===void 0&&(I=_,te=k),q.set(m.label,{value:_,time:h}))}if(ye(q),I!==void 0&&te){const m=t.timeScale().timeToCoordinate(h),k=te.priceToCoordinate(I);if(m!==null&&k!==null){const L=j.current;if(L){const K=L.querySelector(".LightweightChart");if(K){const _=K.getBoundingClientRect(),$=L.getBoundingClientRect(),r=m+(_.left-$.left),o=k+(_.top-$.top);Y({x:r,y:o})}else Y({x:m,y:k})}else Y({x:m,y:k})}else Y(null)}else Y(null)};return t.subscribeCrosshairMove(s),T&&t.subscribeClick(s),!l&&!Z&&!xe&&requestAnimationFrame(()=>{const u=e[0],h=u?E.current.get(oe(u)):void 0;if(h&&i&&u.data.length>0){const y=t.timeScale().timeToCoordinate(i),w=u.data[u.data.length-1].value,x=h.priceToCoordinate(w);y!==null&&x!==null&&Y({x:y,y:x})}}),()=>{t.unsubscribeCrosshairMove(s),T&&t.unsubscribeClick(s)}},[e,Z,T,xe]),p.useEffect(()=>{const t=B.current;if(!t||e.length===0)return;const l=t.timeScale(),i=()=>{const s=Ae.current;if(s.length===0)return;const u=l.getVisibleRange();if(!u)return;const h=Number(u.from),d=Number(u.to);for(const y of s){const w=[];for(const x of e)if(y.labels.has(x.label))for(const q of x.data){const I=Number(q.time);I>=h&&I<=d&&w.push(q.value)}w.length>0&&y.updateVisibleRange(w)}};return l.subscribeVisibleLogicalRangeChange(i),()=>{l.unsubscribeVisibleLogicalRangeChange(i)}},[e]),p.useEffect(()=>{const t=B.current,l=Array.from(E.current.values()),i=[];if(t&&l.length>0&&P){const s=D.getDefaultVerticalLine(),u=l[0];for(const h of P){const d={...s,...h.options||{}};d.color&&(d.color=G.resolveCSSColor(d.color,d.color));const y=new ht.VertLine(t,u,h.xCoordinate,d);u.attachPrimitive(y),i.push(y)}}return()=>{if(l.length>0){const s=l[0];for(const u of i)try{s.detachPrimitive(u)}catch{}}}},[P,e,ee]),p.useEffect(()=>{const t=[],l=[];if(M&&M.length>0){const i=G.resolveCSSColor("hsl(var(--destructive))","rgb(239, 68, 68)");for(const s of M){if(!Number.isFinite(s.price))continue;const u=Ze(E.current,e,s.seriesLabel);if(!u)continue;const h=s.color?G.resolveCSSColor(s.color,s.color):i,d=s.lineWidth??1,y=s.lineStyle??H.LineStyle.Dashed,w=u.createPriceLine({price:s.price,color:h,lineWidth:d,lineStyle:y,axisLabelVisible:s.axisLabelVisible??!0,title:s.title??""});t.push({series:u,line:w});const x=new xt(u,s.price,h,d,y);u.attachPrimitive(x),l.push({series:u,primitive:x})}}return()=>{for(const{series:i,primitive:s}of l)try{i.detachPrimitive(s)}catch{}for(const{series:i,line:s}of t)try{i.removePriceLine(s)}catch{}}},[M,e,ee]),p.useEffect(()=>{const t=[];if(X&&X.length>0){const l="rgba(239, 68, 68, 0.12)";for(const i of X){const s=Ze(E.current,e,i.seriesLabel);if(!s)continue;const u=i.color?G.resolveCSSColor(i.color,l):l,h=new mt(s,i.priceTop,i.priceBottom,u);s.attachPrimitive(h),t.push({series:s,zone:h})}}return()=>{for(const{series:l,zone:i}of t)try{l.detachPrimitive(i)}catch{}}},[X,e,ee]),p.useEffect(()=>{const t=B.current;if(!t||!P?.length){Ge([]);return}const l=()=>{const u=t.timeScale(),h=P.map(d=>u.timeToCoordinate(d.xCoordinate)??null);Ge(h),j.current&&Xe(j.current.clientWidth)};l();const i=t.timeScale(),s=()=>{l()};return i.subscribeVisibleLogicalRangeChange(s),()=>{i.unsubscribeVisibleLogicalRangeChange(s)}},[P,e,ee]),p.useLayoutEffect(()=>{nt(t=>{const l={};let i=!1;for(const[s,u]of qe.current){if(!u)continue;const h=u.offsetWidth;l[s]=h,t[s]!==h&&(i=!0)}return Object.keys(t).length!==Object.keys(l).length&&(i=!0),i?l:t})});const ge=e.length===1,We=Te.useMemo(()=>{if(ge&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[ge,e]);return v.jsxs("div",{ref:j,className:re.cn("relative z-[1] w-full h-full overflow-hidden p-0",n),children:[Ce!=null&&Ce!==!1&&ge?v.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:v.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:Ce})}):et&&ge&&We&&v.jsx(ut.GraphCurrentValue,{point:We,xMeasureUnit:c,yMeasureUnit:b,decimals:Se}),je&&Fe&&v.jsx(ft.GraphTooltip,{points:je,xMeasureUnit:c,yMeasureUnit:b,series:e,position:Fe,containerRef:j,decimals:Se}),a&&v.jsx(Ue,{series:e,onUnselect:f}),P&&P.length>0&&ze.length===P.length&&v.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:P.map((t,l)=>{const i=ze[l],s=t.options??{};if(i===null)return null;const{labelText:u,valueStr:h}=Qe(s,b,Se),d=s.tooltipText??"";if(!(u||h||d))return null;const w=s.labelBackgroundColor??s.color??"hsl(var(--background))",x=s.labelTextColor??"hsl(var(--foreground))",q=`${String(t.xCoordinate)}-${u}-${d}`,I=Ye(i,ot,rt[l]);return v.jsxs("div",{ref:te=>{qe.current.set(l,te)},className:re.cn("group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",d&&"pointer-events-auto cursor-default"),style:{...I,backgroundColor:w,color:x},children:[u&&v.jsx("span",{className:"block",children:u}),h&&v.jsx("span",{className:re.cn("block",u&&"mt-0.5"),children:h}),d&&v.jsx("span",{className:"pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",role:"tooltip",children:d})]},q)})}),v.jsx("div",{ref:_e,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ue({series:e,onUnselect:n,inline:a=!1}){const f=e.every(c=>c.data.length===0);return v.jsx("div",{className:re.cn("flex flex-wrap",a?"items-center justify-center gap-6":"absolute top-0 left-2 z-[10] gap-2"),children:e.map((c,b)=>{const C=Ne(b),P=(c.lineColor??c.color)||C.line,M=!f&&c.data.length===0;return v.jsxs("div",{className:re.cn("flex items-center gap-1.5",!a&&"px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",M&&"opacity-50"),children:[v.jsx("div",{className:re.cn(a?"size-2 rounded-full":"h-3 w-3 rounded-sm"),style:{backgroundColor:P}}),v.jsxs("span",{className:re.cn("font-medium text-foreground",a?"text-sm":"text-[10px] sm:text-xs"),children:[c.label,M&&" (no data)"]}),n&&v.jsx("button",{type:"button",onClick:X=>{X.stopPropagation(),n(c.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 ${c.label}`,children:v.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:[v.jsx("title",{children:"Close"}),v.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),v.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},c.id??c.label)})})}exports.DEFAULT_SERIES_COLORS=be;exports.Graph=_t;exports.GraphLegend=Ue;exports.VERTICAL_LINE_LABEL_EDGE_PADDING=Le;exports.getSeriesColorPalette=Ne;exports.getStepForwardValue=Je;exports.getVerticalLineLabelStyle=Ye;exports.getVerticalLineTooltipContent=Qe;exports.seriesIdentity=oe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),Z=require("lightweight-charts"),p=require("react"),ct=require("../../hooks/use-media-query.cjs"),H=require("../../utils/cn.cjs"),X=require("../../utils/colors.cjs"),D=require("./default-config.cjs"),ne=require("./formatters.cjs"),ut=require("./graph-current-value.cjs"),ft=require("./graph-tooltip.cjs"),ht=require("./plugins/vertical-line.cjs"),He=require("./y-axis-scale.cjs");function gt(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,u.get?u:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const Te=gt(p);function re(e){return e.id??e.label}function Ze(e,n,a){if(!a)return e.values().next().value;const u=e.get(a);if(u)return u;const h=n.find(f=>f.id===a||f.label===a);return h?e.get(re(h)):void 0}class dt{_yTop;_yBottom;_color;constructor(n,a,u){this._yTop=n,this._yBottom=a,this._color=u}draw(n){n.useBitmapCoordinateSpace(a=>{const u=a.context,h=a.verticalPixelRatio,f=this._yTop===null?0:this._yTop*h,x=this._yBottom===null?a.bitmapSize.height:this._yBottom*h,P=Math.min(f,x),k=Math.max(f,x);u.fillStyle=this._color,u.fillRect(0,P,a.bitmapSize.width,k-P)})}}class pt{_source;_yTop=null;_yBottom=null;constructor(n){this._source=n}update(){const n=this._source.series;this._yTop=this._source.priceTop===void 0?null:n.priceToCoordinate(this._source.priceTop),this._yBottom=this._source.priceBottom===void 0?null:n.priceToCoordinate(this._source.priceBottom)}zOrder(){return"bottom"}renderer(){return new dt(this._yTop,this._yBottom,this._source.color)}}class mt{series;priceTop;priceBottom;color;_paneViews;constructor(n,a,u,h){this.series=n,this.priceTop=a,this.priceBottom=u,this.color=h,this._paneViews=[new pt(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function bt(e,n){switch(e){case Z.LineStyle.Dotted:return[n,n];case Z.LineStyle.Dashed:return[2*n,2*n];case Z.LineStyle.LargeDashed:return[6*n,6*n];case Z.LineStyle.SparseDotted:return[n,4*n];default:return[]}}class St{_y;_color;_lineWidth;_lineStyle;constructor(n,a,u,h){this._y=n,this._color=a,this._lineWidth=u,this._lineStyle=h}draw(n){n.useBitmapCoordinateSpace(a=>{if(this._y===null)return;const u=a.context,h=a.verticalPixelRatio,f=Math.max(1,Math.round(this._lineWidth*h)),x=Math.round(this._y*h);u.save(),u.strokeStyle=this._color,u.lineWidth=f,u.setLineDash(bt(this._lineStyle,f)),u.beginPath(),u.moveTo(0,x),u.lineTo(a.bitmapSize.width,x),u.stroke(),u.restore()})}}class Ct{_source;_y=null;constructor(n){this._source=n}update(){this._y=this._source.series.priceToCoordinate(this._source.price)}zOrder(){return"top"}renderer(){return new St(this._y,this._source.color,this._source.lineWidth,this._source.lineStyle)}}class xt{series;price;color;lineWidth;lineStyle;_paneViews;constructor(n,a,u,h,f){this.series=n,this.price=a,this.color=u,this.lineWidth=h,this.lineStyle=f,this._paneViews=[new Ct(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function Qe(e,n,a){const u=e.labelText??"",h=e.value,f=h===void 0?"":typeof h=="number"?n==="$"?`$${ne.formatExactValue(h,void 0,a)}`:n==="%"?`${ne.formatExactValue(h,void 0,a)}%`:ne.formatExactValue(h,n!=="none"&&n!=="%"&&n!=="$"&&!ne.isRatioUnit(n)?n:void 0,a):String(h);return{labelText:u,valueStr:f}}const Le=4;function Ye(e,n,a){const u={left:e,transform:"translateX(-50%)"};if(n<=0||!a||a<=0)return u;const h=a/2,f=Le+h,x=n-Le-h;return x<f?{left:n/2,transform:"translateX(-50%)"}:{left:Math.min(Math.max(e,f),x),transform:"translateX(-50%)"}}function Je(e,n){for(let a=e.length-1;a>=0;a--)if(Number(e[a].time)<=n)return e[a].value;return 0}const Se=[{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)"}],vt=137.5;function Ne(e){if(e<Se.length)return Se[e];const a=(e-Se.length)*vt%360,u=X.hslToHex(a,70,50),{topColor:h,bottomColor:f}=X.generateColorsFromBase(u);return{line:u,top:h,bottom:f}}function yt({series:e,className:n,showLegend:a=!1,onUnselectSeries:u,xMeasureUnit:h="time",yMeasureUnit:f="token",optionsOverrides:x,verticalLineOptions:P,priceLineOptions:k,zoneOptions:F,currentValueDecimals:ae,useSharedPriceScale:Q=!1,dualYAxis:A=!1,defaultVisiblePriceScaleId:Ve="right",leftPriceScaleTitle:Ee,rightPriceScaleTitle:_t,showCurrentValue:et=!0,graphTitle:Ce,yScaleMin:Ie,yScaleMinMultiple:De,visibleTimeFrom:ee,disableZoom:Me=!1,hideDefaultTooltip:xe=!1}){const j=p.useRef(null),E=p.useRef(new Map),ve=p.useRef(!1),ke=p.useRef(!0),Ae=p.useRef([]),le=p.useRef(0),B=p.useRef(null),ye=p.useRef(null),je=p.useRef(null),T=ct.useIsMobile(),ce=Te.useMemo(()=>e.flatMap(t=>t.data),[e]),tt=Te.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[Be,_e]=p.useState(()=>{if(!tt)return;const t=new Map;for(const l of e)l.data.length>0&&t.set(l.label,l.data[l.data.length-1]);return t}),[Fe,J]=p.useState(null),[ze,Ge]=p.useState([]),[ot,Xe]=p.useState(0),qe=p.useRef(new Map),[rt,nt]=p.useState({}),[te,it]=p.useState(0);p.useEffect(()=>{const t=()=>{try{if(B.current&&Xe(B.current.clientWidth),j.current&&B.current){const s=B.current.clientWidth,c=B.current.clientHeight;j.current.resize(s,c);try{le.current=j.current.paneSize().height}catch{}}}catch{}},l=B.current,i=l?new ResizeObserver(t):null;return je.current=i,l&&i?.observe(l),()=>{l&&i?.unobserve(l),i?.disconnect(),je.current=null}},[]),p.useEffect(()=>{if(!ye.current||ve.current)return;const t=D.getDefaultOptions(),l=X.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)"),i=Z.createChart(ye.current,{...t,leftPriceScale:{...t.leftPriceScale||{},visible:!1,textColor:l},rightPriceScale:{...t.rightPriceScale||{},visible:!T,textColor:l},...T&&{crosshair:{...t.crosshair,mode:Z.CrosshairMode.Magnet}}});j.current=i,ve.current=!0;try{le.current=i.paneSize().height}catch{le.current=0}return it(s=>s+1),()=>{i.remove(),j.current=null,ve.current=!1,E.current.clear()}},[T]),p.useEffect(()=>{const t=j.current;t&&t.applyOptions(Me?{handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:!1,axisDoubleClickReset:!1},handleScroll:{mouseWheel:!1,pressedMouseMove:!1,horzTouchDrag:!1,vertTouchDrag:!1}}:{handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:!0,axisDoubleClickReset:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}})},[te,Me]),p.useEffect(()=>{const t=j.current;!t||!x||t.applyOptions(x)},[te,x]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const i=e.filter(r=>r.data.length>0).length<=1?Ie:De,s=h==="time"?ne.getXFormatters(h,ce):ne.getXFormatters(h),c=new Map;{let r=0;for(const o of e)o.data.length!==0&&(c.set(o.label,o.priceScaleId??(r===0?"left":"right")),r++)}const g=(r,o,d)=>{const{formatter:z,tickmarksFormatter:N,updateVisibleRange:V}=ne.createAdaptiveYAxisFormatter(r,o,{yScaleMin:i});return{formatter:z,tickmarksFormatter:N,updateVisibleRange:V,labels:d}},m=[];if(A)for(const r of["left","right"]){const o=new Set,d=[];let z=f;for(const N of e)if(N.data.length!==0&&c.get(N.label)===r){o.size===0&&N.yMeasureUnit&&(z=N.yMeasureUnit),o.add(N.label);for(const V of N.data)d.push(V.value)}o.size>0&&m.push(g(d,z,o))}else{const r=ce.map(d=>d.value),o=new Set(e.filter(d=>d.data.length>0).map(d=>d.label));m.push(g(r,f,o))}Ae.current=m;const _=new Map;for(const r of m)for(const o of r.labels)_.set(o,r);const w=D.getDefaultOptions();t.applyOptions({localization:{...w.localization||{},timeFormatter:r=>s.timeFormatter(parseFloat(r),void 0)},timeScale:{...w.timeScale||{},...x?.timeScale,tickMarkFormatter:s.tickMarkFormatter,minBarSpacing:0}});const v=!A&&e.length>1&&!Q,q=A?T:e.length>1&&!Q||T,I=X.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)");t.applyOptions({...A&&{defaultVisiblePriceScaleId:Ve},leftPriceScale:{...w.leftPriceScale||{},...x?.leftPriceScale,visible:A&&!T,textColor:I,...A&&Ee&&{}},rightPriceScale:{...w.rightPriceScale||{},...x?.rightPriceScale,visible:A?!T:!q,textColor:I}});const oe=new Set(E.current.keys()),W=new Set(e.map(re));for(const r of oe)if(!W.has(r)){const o=E.current.get(r);o&&(t.removeSeries(o),E.current.delete(r))}const b=D.getDefaultSeries(),M=[];let L=0;const K=e.find(r=>r.data.length>0),y=new Map;if(k&&k.length>0)for(const r of k){if(!Number.isFinite(r.price))continue;const o=r.seriesLabel??K?.label;if(!o)continue;const d=y.get(o)??[];d.push(r.price),y.set(o,d)}if(F&&F.length>0)for(const r of F){const o=r.seriesLabel??K?.label;if(!o)continue;const d=y.get(o)??[];Number.isFinite(r.priceTop)&&d.push(r.priceTop),Number.isFinite(r.priceBottom)&&d.push(r.priceBottom),y.set(o,d)}for(let r=0;r<e.length;r++){const o=e[r],d=re(o),z=Ne(r),N=o.lineColor??o.color??z.line;let V,U;if(o.lineColor??o.color)if(o.topColor&&o.bottomColor)V=o.topColor,U=o.bottomColor;else if(o.topColor){const S=X.generateColorsFromBase(N);V=o.topColor,U=S.bottomColor}else if(o.bottomColor)V=X.generateColorsFromBase(N).topColor,U=o.bottomColor;else{const S=X.generateColorsFromBase(N);V=S.topColor,U=S.bottomColor}else V=o.topColor||z.top,U=o.bottomColor||z.bottom;if(o.data.length===0){const S=E.current.get(d);S&&(t.removeSeries(S),E.current.delete(d));continue}const pe=o.data.length>0?Math.min(...o.data.map(S=>S.value)):0,ue=o.data.length>0?Math.max(...o.data.map(S=>S.value)):0,fe=pe<0,Y=o.data.some(S=>S.value===0),me=!fe&&Y,he=He.pickMinMove(ue-pe),ge=A?o.priceScaleId??(L===0?"left":"right"):Q||!v||L===0?"right":`scale-${L}`;v&&M.push({priceScaleId:ge||"right",seriesIndex:L});const we=(Q||!v)&&i!==void 0&&typeof i=="number",st=y.get(o.label)??[],at=S=>{const R=S();if(R?.priceRange){we&&(R.priceRange.minValue=i);for(const O of st)O<R.priceRange.minValue&&(R.priceRange.minValue=O),O>R.priceRange.maxValue&&(R.priceRange.maxValue=O);const se=we?i:me&&R.priceRange.minValue>=0?0:void 0,be=le.current>0?le.current:B.current?.clientHeight??0;if(be>0){const O=He.niceAxisRange({min:R.priceRange.minValue,max:R.priceRange.maxValue,floor:se,scaleHeightPx:be,fontSizePx:D.AXIS_FONT_SIZE,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,minMove:he,edgePaddingPx:D.AXIS_EDGE_LABEL_PADDING_PX,edgePaddingTopPx:D.AXIS_TOP_LABEL_PADDING_PX});R.priceRange.minValue=O.min,R.priceRange.maxValue=O.max}R.margins={above:D.AXIS_TOP_LABEL_PADDING_PX,below:D.AXIS_EDGE_LABEL_PADDING_PX}}return R},Ke=_.get(o.label)??m[0],$e=Ke.formatter,lt=Ke.tickmarksFormatter,Re={lineColor:N,topColor:V,bottomColor:U,priceScaleId:ge,...o.seriesType==="line"&&{lineStyle:o.lineStyle??Z.LineStyle.Solid},priceFormat:{type:"custom",minMove:he,formatter:we&&typeof i=="number"?S=>$e(S<i?i:S):$e,tickmarksFormatter:lt},autoscaleInfoProvider:at},Oe=o.seriesType==="line";let G=E.current.get(d);const ie=o.data.map(S=>({...S,time:S.time}));if(ee!==void 0&&ie.length>0&&Number(ie[0].time)>ee){const S=Number(ie[0].time),R=S-ee,se=86400,be=R>180*se?7*se:R>30*se?se:6*3600,O=[];for(let Pe=ee;Pe<S;Pe+=be)O.push({time:Pe});ie.unshift(...O)}G&&G.seriesType()!==(Oe?"Line":"Area")&&(t.removeSeries(G),E.current.delete(d),G=void 0),G?(G.applyOptions(Re),G.setData(ie)):(Oe?G=t.addSeries(Z.LineSeries,{...b,...Re}):G=t.addSeries(Z.AreaSeries,{...b,...Re}),G.setData(ie),E.current.set(d,G)),L++}if(A)try{const r=t.priceScale("left"),o=t.priceScale("right"),d={visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...x?.rightPriceScale};r?.applyOptions(d),o?.applyOptions(d)}catch{}else if(v&&M.length>0)for(const r of M)try{const o=t.priceScale(r.priceScaleId);o&&o.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I})}catch(o){console.warn(`Failed to configure price scale ${r.priceScaleId} for series ${r.seriesIndex}:`,o)}else if(!v)try{const r=t.priceScale("right");r&&r.applyOptions({visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...x?.rightPriceScale})}catch{}if(i!==void 0&&!T&&(Q||!v)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}}),ce.length>0){const r=ce.map(o=>Number(o.time)).filter(o=>Number.isFinite(o));if(r.length>0){const o=Math.min(...r),d=ee!==void 0?Math.min(ee,o):o,z=Math.max(...r);if(Number(d)<=Number(z)){const N=()=>{const V=t.timeScale();if(h!=="time"){V.applyOptions({fixLeftEdge:!0,fixRightEdge:!0});return}const U=A&&!T,pe=A?!T:!q,ue=!U,fe=!pe;if(V.applyOptions({fixLeftEdge:!ue,fixRightEdge:!fe}),!ue&&!fe)return;const Y=V.getVisibleLogicalRange(),me=V.width();if(!Y||!(me>0))return;const he=Y.to-Y.from;if(!(he>0))return;const ge=D.AXIS_TIME_EDGE_PADDING_PX*he/me;V.setVisibleLogicalRange({from:ue?Y.from-ge:Y.from,to:fe?Y.to+ge:Y.to})};try{t.timeScale().setVisibleRange({from:d,to:z}),N()}catch{try{t.timeScale().fitContent(),N()}catch{}}}}}ke.current&&(ke.current=!1),x&&t.applyOptions(x);const $=new Map;for(const r of e)r.data.length>0&&$.set(r.label,r.data[r.data.length-1]);_e($.size>0?$:void 0)},[te,e,ce,h,f,T,Q,A,Ve,Ee,Ie,De,ee,k,F,x]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const l=e.length===1;let i;for(const c of e)if(c.data.length>0){i=c.data[c.data.length-1].time;break}if(!i)return;const s=c=>{const{time:g=i,seriesData:m,point:_}=c||{},w=e[0],v=w?E.current.get(re(w)):void 0;if(!_||!g){const W=new Map;for(const b of e)b.data.length>0&&W.set(b.label,b.data[b.data.length-1]);if(_e(W.size>0?W:void 0),l||Q||xe)J(null);else if(v&&i){const b=e[0];if(b&&b.data.length>0){const L=t.timeScale().timeToCoordinate(i),K=b.data[b.data.length-1].value,y=v.priceToCoordinate(K);L!==null&&y!==null&&J({x:L,y})}}return}const q=new Map;let I,oe=v;for(let W=0;W<e.length;W++){const b=e[W],M=E.current.get(re(b));if(!M)continue;const L=m?.get(M),K=L&&"value"in L?L.value:void 0;let y;if(K!==void 0)y=K;else if(l){const $=Number(g),r=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;$<r?y=Number.NaN:y=b.data[b.data.length-1]?.value??0}else{const $=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;if(Number(g)<$)continue;y=Je(b.data,Number(g))}Number.isNaN(y)||(I===void 0&&(I=y,oe=M),q.set(b.label,{value:y,time:g}))}if(_e(q),I!==void 0&&oe){const b=t.timeScale().timeToCoordinate(g),M=oe.priceToCoordinate(I);if(b!==null&&M!==null){const L=B.current;if(L){const K=L.querySelector(".LightweightChart");if(K){const y=K.getBoundingClientRect(),$=L.getBoundingClientRect(),r=b+(y.left-$.left),o=M+(y.top-$.top);J({x:r,y:o})}else J({x:b,y:M})}else J({x:b,y:M})}else J(null)}else J(null)};return t.subscribeCrosshairMove(s),T&&t.subscribeClick(s),!l&&!Q&&!xe&&requestAnimationFrame(()=>{const c=e[0],g=c?E.current.get(re(c)):void 0;if(g&&i&&c.data.length>0){const _=t.timeScale().timeToCoordinate(i),w=c.data[c.data.length-1].value,v=g.priceToCoordinate(w);_!==null&&v!==null&&J({x:_,y:v})}}),()=>{t.unsubscribeCrosshairMove(s),T&&t.unsubscribeClick(s)}},[e,Q,T,xe]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const l=t.timeScale(),i=()=>{const s=Ae.current;if(s.length===0)return;const c=l.getVisibleRange();if(!c)return;const g=Number(c.from),m=Number(c.to);for(const _ of s){const w=[];for(const v of e)if(_.labels.has(v.label))for(const q of v.data){const I=Number(q.time);I>=g&&I<=m&&w.push(q.value)}w.length>0&&_.updateVisibleRange(w)}};return l.subscribeVisibleLogicalRangeChange(i),()=>{l.unsubscribeVisibleLogicalRangeChange(i)}},[e]),p.useEffect(()=>{const t=j.current,l=Array.from(E.current.values()),i=[];if(t&&l.length>0&&P){const s=D.getDefaultVerticalLine(),c=l[0];for(const g of P){const m={...s,...g.options||{}};m.color&&(m.color=X.resolveCSSColor(m.color,m.color));const _=new ht.VertLine(t,c,g.xCoordinate,m);c.attachPrimitive(_),i.push(_)}}return()=>{if(l.length>0){const s=l[0];for(const c of i)try{s.detachPrimitive(c)}catch{}}}},[P,e,te]),p.useEffect(()=>{const t=[],l=[];if(k&&k.length>0){const i=X.resolveCSSColor("hsl(var(--destructive))","rgb(239, 68, 68)");for(const s of k){if(!Number.isFinite(s.price))continue;const c=Ze(E.current,e,s.seriesLabel);if(!c)continue;const g=s.color?X.resolveCSSColor(s.color,s.color):i,m=s.lineWidth??1,_=s.lineStyle??Z.LineStyle.Dashed,w=c.createPriceLine({price:s.price,color:g,lineWidth:m,lineStyle:_,axisLabelVisible:s.axisLabelVisible??!0,title:s.title??""});t.push({series:c,line:w});const v=new xt(c,s.price,g,m,_);c.attachPrimitive(v),l.push({series:c,primitive:v})}}return()=>{for(const{series:i,primitive:s}of l)try{i.detachPrimitive(s)}catch{}for(const{series:i,line:s}of t)try{i.removePriceLine(s)}catch{}}},[k,e,te]),p.useEffect(()=>{const t=[];if(F&&F.length>0){const l="rgba(239, 68, 68, 0.12)";for(const i of F){const s=Ze(E.current,e,i.seriesLabel);if(!s)continue;const c=i.color?X.resolveCSSColor(i.color,l):l,g=new mt(s,i.priceTop,i.priceBottom,c);s.attachPrimitive(g),t.push({series:s,zone:g})}}return()=>{for(const{series:l,zone:i}of t)try{l.detachPrimitive(i)}catch{}}},[F,e,te]),p.useEffect(()=>{const t=j.current;if(!t||!P?.length){Ge([]);return}const l=()=>{const c=t.timeScale(),g=P.map(m=>c.timeToCoordinate(m.xCoordinate)??null);Ge(g),B.current&&Xe(B.current.clientWidth)};l();const i=t.timeScale(),s=()=>{l()};return i.subscribeVisibleLogicalRangeChange(s),()=>{i.unsubscribeVisibleLogicalRangeChange(s)}},[P,e,te]),p.useLayoutEffect(()=>{nt(t=>{const l={};let i=!1;for(const[s,c]of qe.current){if(!c)continue;const g=c.offsetWidth;l[s]=g,t[s]!==g&&(i=!0)}return Object.keys(t).length!==Object.keys(l).length&&(i=!0),i?l:t})});const de=e.length===1,We=Te.useMemo(()=>{if(de&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[de,e]);return C.jsxs("div",{ref:B,className:H.cn("relative z-[1] w-full h-full overflow-hidden p-0",n),children:[Ce!=null&&Ce!==!1&&de?C.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:C.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:Ce})}):et&&de&&We&&C.jsx(ut.GraphCurrentValue,{point:We,xMeasureUnit:h,yMeasureUnit:f,decimals:ae}),Be&&Fe&&C.jsx(ft.GraphTooltip,{points:Be,xMeasureUnit:h,yMeasureUnit:f,series:e,position:Fe,containerRef:B,decimals:ae}),a&&C.jsx(Ue,{series:e,onUnselect:u}),P&&P.length>0&&ze.length===P.length&&C.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:P.map((t,l)=>{const i=ze[l],s=t.options??{};if(i===null)return null;const{labelText:c,valueStr:g}=Qe(s,f,ae),m=s.tooltipText??"";if(!(c||g||m))return null;const w=s.labelBackgroundColor??s.color??"hsl(var(--background))",v=s.labelTextColor??"hsl(var(--foreground))",q=`${String(t.xCoordinate)}-${c}-${m}`,I=Ye(i,ot,rt[l]);return C.jsxs("div",{ref:oe=>{qe.current.set(l,oe)},className:H.cn("group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",m&&"pointer-events-auto cursor-default"),style:{...I,backgroundColor:w,color:v},children:[c&&C.jsx("span",{className:"block",children:c}),g&&C.jsx("span",{className:H.cn("block",c&&"mt-0.5"),children:g}),m&&C.jsx("span",{className:"pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",role:"tooltip",children:m})]},q)})}),C.jsx("div",{ref:ye,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ue({series:e,markers:n,onUnselect:a,inline:u=!1}){const h=e.every(f=>f.data.length===0);return C.jsxs("div",{className:H.cn("flex flex-wrap",u?"items-center justify-center gap-6":"absolute top-0 left-2 z-[10] gap-2"),children:[e.map((f,x)=>{const P=Ne(x),k=(f.lineColor??f.color)||P.line,F=!h&&f.data.length===0;return C.jsxs("div",{className:H.cn("flex items-center gap-1.5",!u&&"px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",F&&"opacity-50"),children:[C.jsx("div",{className:H.cn(u?"size-2 rounded-full":"h-3 w-3 rounded-sm"),style:{backgroundColor:k}}),C.jsxs("span",{className:H.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:[f.label,F&&" (no data)"]}),a&&C.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),a(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:C.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:[C.jsx("title",{children:"Close"}),C.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},f.id??f.label)}),n?.map(f=>C.jsxs("div",{className:H.cn("flex items-center gap-1.5",!u&&"px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border"),children:[C.jsx("div",{className:H.cn("w-0.5","h-3"),style:{backgroundColor:f.color}}),C.jsx("span",{className:H.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:f.label})]},f.id))]})}exports.DEFAULT_SERIES_COLORS=Se;exports.Graph=yt;exports.GraphLegend=Ue;exports.VERTICAL_LINE_LABEL_EDGE_PADDING=Le;exports.getSeriesColorPalette=Ne;exports.getStepForwardValue=Je;exports.getVerticalLineLabelStyle=Ye;exports.getVerticalLineTooltipContent=Qe;exports.seriesIdentity=re;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),i=require("react"),p=require("../navigation-context/navigation-context.cjs");require("@gearbox-protocol/sdk/onchain");const x=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");function w(n){if(!n)return null;const{width:r=0,height:o=0}=n?.getBoundingClientRect()||{},a=n?.offsetTop||0,s=n?.offsetLeft||0;return{width:r,height:o,left:s,top:a}}function C(n,r,o){const a=i.useRef(null),[s,h]=i.useState(null),l=i.useRef(null),d=i.useCallback(e=>{h(e),l.current=e},[]);return i.useEffect(()=>{const e=o.current[n],c=()=>{const u=w(e),b=u?.height!==l.current?.height,g=u?.width!==l.current?.width,m=u?.left!==l.current?.left,v=u?.top!==l.current?.top;(b||g||m||v)&&d(u)};a.current=c,c();const t=e?new ResizeObserver(c):null;return e&&t?.observe(e),()=>{e&&t?.unobserve(e)}},[n,o,d]),i.useEffect(()=>{const e=r?new ResizeObserver(()=>{a.current?.()}):null;return r&&e?.observe(r),()=>{r&&e?.unobserve(r)}},[r]),s}function T({className:n,tabs:r,state:o,showBorder:a=!0,tabItemWrapPadding:s,variant:h="auto"}){const l=i.useRef(null),d=i.useRef({}),e=C(o.id,l.current,d),c=(t,u)=>()=>o.handleTabChange(t,u);return f.jsx("div",{className:x.cn("relative w-full flex flex-col flex-wrap",n),children:f.jsxs("div",{ref:l,className:x.cn("relative w-full max-w-full grow-0 shrink-0 basis-full flex items-stretch overflow-x-auto overflow-y-hidden","scrollbar-hidden",a&&"after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"),children:[e&&f.jsx("div",{className:"absolute left-0 h-[3px] bg-accent transition-[transform] duration-200 ease-in-out pointer-events-none bottom-[-1px]",style:{width:`${e.width}px`,transform:`translate(${e.left}px)`}}),r.map((t,u,b)=>{const g=u===b.length-1;return f.jsx("button",{ref:m=>{d.current[t.id]=m},type:"button",onClick:t.disabled?void 0:c(t.id,u),disabled:t.disabled,className:x.cn("flex items-center bg-transparent border-none shrink-0 text-foreground outline-none",s?"":"p-0 pb-3.5",h==="equal"?"grow shrink-0 basis-[0%] justify-center min-w-0":!g&&"mr-10 max-[500px]:mr-8",t.disabled&&"cursor-not-allowed",!t.disabled&&"cursor-pointer",!t.disabled&&"hover:text-foreground hover:[&>*]:text-foreground"),style:s?{padding:s}:void 0,children:t.item},`tab-item-${t.id}`)})]})})}function j({icon:n,label:r,selected:o,textSize:a="default",amount:s}){return f.jsxs(f.Fragment,{children:[n&&f.jsx("div",{className:x.cn("mr-3",o?"text-foreground":"text-secondary-foreground"),children:n}),f.jsx("div",{className:x.cn("m-0 p-0 whitespace-nowrap",a==="default"&&"text-sm leading-[17px] font-normal",a==="unset"&&"text-[unset] leading-[unset] font-[unset]",o?"text-foreground":"text-secondary-foreground"),children:r}),!!s&&f.jsx("div",{className:"ml-1.5",children:f.jsx("div",{className:"py-0.5 px-[9px] text-[11px] leading-[150%] font-normal bg-gray-50 rounded-[19px]",children:s})})]})}function N(n,r=0){const[o,a]=i.useState(n),[s,h]=i.useState(r),l=i.useCallback((d,e)=>{a(d),h(e)},[]);return{id:o,index:s,handleTabChange:l}}function y(n){const{useLocation:r,useNavigate:o}=p.useNavigationAdapter(),{hash:a}=r(),s=o(),h=i.useMemo(()=>n.reduce((t,u,b)=>(t[u.id]={id:u.id,index:b},t),{}),[n]),l=i.useMemo(()=>a.slice(1).toLowerCase(),[a]),{id:d,index:e}=h[l]||{},c=i.useCallback(t=>{s(`#${t}`)},[s]);return{id:d,index:e,handleTabChange:c}}function S({defaultTabs:n,pathRoot:r,selectedSection:o}){const{useNavigate:a}=p.useNavigationAdapter(),s=a(),h=i.useMemo(()=>n.reduce((c,t,u)=>(c[t.id]={id:t.id,index:u},c),{}),[n]),l=i.useCallback(c=>{s(`${r}/${c}`)},[s,r]),{id:d,index:e}=h[o]||{};return{id:d,index:e,handleTabChange:l}}exports.TabControl=T;exports.TabItem=j;exports.useHashTabs=y;exports.useSectionTab=S;exports.useTabControl=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),a=require("react"),m=require("../navigation-context/navigation-context.cjs");require("@gearbox-protocol/sdk/onchain");const g=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");function w(n){if(!n)return null;const{width:s=0,height:o=0}=n?.getBoundingClientRect()||{},i=n?.offsetTop||0,r=n?.offsetLeft||0;return{width:s,height:o,left:r,top:i}}function C(n,s,o){const i=a.useRef(null),[r,b]=a.useState(null),l=a.useRef(null),d=a.useCallback(e=>{b(e),l.current=e},[]);return a.useEffect(()=>{const e=o.current[n],c=()=>{const u=w(e),h=u?.height!==l.current?.height,x=u?.width!==l.current?.width,v=u?.left!==l.current?.left,p=u?.top!==l.current?.top;(h||x||v||p)&&d(u)};i.current=c,c();const t=e?new ResizeObserver(c):null;return e&&t?.observe(e),()=>{e&&t?.unobserve(e)}},[n,o,d]),a.useEffect(()=>{const e=s?new ResizeObserver(()=>{i.current?.()}):null;return s&&e?.observe(s),()=>{s&&e?.unobserve(s)}},[s]),r}function T({className:n,tabs:s,state:o,showBorder:i=!0,tabItemWrapPadding:r,variant:b="auto"}){const l=a.useRef(null),d=a.useRef({}),e=C(o.id,l.current,d),c=(t,u)=>()=>o.handleTabChange(t,u);return f.jsx("div",{className:g.cn("relative w-full flex flex-col flex-wrap",n),children:f.jsxs("div",{ref:l,className:g.cn("relative w-full max-w-full grow-0 shrink-0 basis-full flex items-stretch overflow-x-auto overflow-y-hidden","scrollbar-hidden",i&&"after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"),children:[e&&f.jsx("div",{className:"absolute left-0 h-[3px] bg-accent transition-[transform] duration-200 ease-in-out pointer-events-none bottom-[-1px]",style:{width:`${e.width}px`,transform:`translate(${e.left}px)`}}),s.map((t,u,h)=>{const x=u===h.length-1;return f.jsx("button",{ref:v=>{d.current[t.id]=v},type:"button",onClick:t.disabled?void 0:c(t.id,u),disabled:t.disabled,className:g.cn("flex items-center bg-transparent border-none shrink-0 text-foreground","outline-none ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r?"":"p-0 pb-3.5",b==="equal"?"grow shrink-0 basis-[0%] justify-center min-w-0":!x&&"mr-10 max-[500px]:mr-8",t.disabled&&"cursor-not-allowed",!t.disabled&&"cursor-pointer",!t.disabled&&"hover:text-foreground hover:[&>*]:text-foreground"),style:r?{padding:r}:void 0,children:t.item},`tab-item-${t.id}`)})]})})}function j({icon:n,label:s,selected:o,textSize:i="default",amount:r}){return f.jsxs(f.Fragment,{children:[n&&f.jsx("div",{className:g.cn("mr-3",o?"text-foreground":"text-secondary-foreground"),children:n}),f.jsx("div",{className:g.cn("m-0 p-0 whitespace-nowrap",i==="default"&&"text-sm leading-[17px] font-normal",i==="unset"&&"text-[unset] leading-[unset] font-[unset]",o?"text-foreground":"text-secondary-foreground"),children:s}),!!r&&f.jsx("div",{className:"ml-1.5",children:f.jsx("div",{className:"py-0.5 px-[9px] text-[11px] leading-[150%] font-normal bg-gray-50 rounded-[19px]",children:r})})]})}function N(n,s=0){const[o,i]=a.useState(n),[r,b]=a.useState(s),l=a.useCallback((d,e)=>{i(d),b(e)},[]);return{id:o,index:r,handleTabChange:l}}function y(n){const{useLocation:s,useNavigate:o}=m.useNavigationAdapter(),{hash:i}=s(),r=o(),b=a.useMemo(()=>n.reduce((t,u,h)=>(t[u.id]={id:u.id,index:h},t),{}),[n]),l=a.useMemo(()=>i.slice(1).toLowerCase(),[i]),{id:d,index:e}=b[l]||{},c=a.useCallback(t=>{r(`#${t}`)},[r]);return{id:d,index:e,handleTabChange:c}}function S({defaultTabs:n,pathRoot:s,selectedSection:o}){const{useNavigate:i}=m.useNavigationAdapter(),r=i(),b=a.useMemo(()=>n.reduce((c,t,u)=>(c[t.id]={id:t.id,index:u},c),{}),[n]),l=a.useCallback(c=>{r(`${s}/${c}`)},[r,s]),{id:d,index:e}=b[o]||{};return{id:d,index:e,handleTabChange:l}}exports.TabControl=T;exports.TabItem=j;exports.useHashTabs=y;exports.useSectionTab=S;exports.useTabControl=N;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),f=require("react"),me=require("sonner"),fe=require("../base/section-heading/section-heading.cjs"),xe=require("../../hooks/use-media-query.cjs");require("@gearbox-protocol/sdk/onchain");const be=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const j=require("../graph/graph.cjs"),we=require("../graph/graph-view.cjs"),p=require("../select/select.cjs"),he=require("./graph-dropdown.cjs"),ge=({size:r=16})=>n.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Expand fullscreen",children:[n.jsx("title",{children:"Expand fullscreen"}),n.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})]}),Se=({size:r=16})=>n.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Exit fullscreen",children:[n.jsx("title",{children:"Exit fullscreen"}),n.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})]}),ve={timeScale:{borderVisible:!1},rightPriceScale:{borderVisible:!1},leftPriceScale:{borderVisible:!1}},J="ui-kit:tradingview-series-colors:";function O(r){if(typeof window>"u"||!window.localStorage)return new Map;try{const t=window.localStorage.getItem(J+r);if(!t)return new Map;const c=JSON.parse(t);return c==null||typeof c!="object"?new Map:new Map(Object.entries(c).filter(([,o])=>typeof o=="number"&&o>=0&&o<j.DEFAULT_SERIES_COLORS.length))}catch{return new Map}}function pe(r,t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(J+r,JSON.stringify(Object.fromEntries(t)))}catch{}}function W(r,t){if(t.size===0)return;const c=O(r);for(const[o,g]of t)c.set(o,g);pe(r,c)}function je({data:r,yMeasureUnit:t,height:c=306,defaultGraph:o,onGraphSelected:g,graphs:x,isMultipleSelect:$,range:Q,rangeList:y,setRange:X,onGraphExpanded:I,isGraphExpanded:D,onUnselectSeries:k,graphsWithNoData:Y,loadingGraphs:R,isLoading:T,noDataMessage:L="No data available for this graph",currentValueDecimals:Z,containerClassName:P,useSharedPriceScale:U,showCurrentValue:K,yScaleMin:G,yScaleMinMultiple:ee,seriesColorPersistenceKey:d,title:ne,trailing:C,...re}){const S=f.useMemo(()=>Array.isArray(r)?r:r?[r]:[],[r]),te=f.useMemo(()=>Array.isArray(r)&&r.length>1,[r]),q=xe.useIsMobile(),oe=f.useCallback((u,_)=>{me.toast.error(L)},[L]),le=f.useMemo(()=>{if(t)return Array.isArray(t)?t[0]:t},[t]),ie=!!(g&&x&&o),i=f.useRef(new Map),b=f.useRef(0),V=f.useRef(!1);if(x&&x.length>0&&!V.current){V.current=!0;const u=d?O(d):new Map,_=String(x[0].value);i.current.set(_,0),b.current=1;for(let e=1;e<x.length;e++){const a=String(x[e].value);if(i.current.has(a))continue;const v=u.get(a)??e;i.current.set(a,v),b.current=Math.max(b.current,v+1)}d&&W(d,i.current)}const w=f.useMemo(()=>{const u=Array.isArray(t)?t:void 0;if(d){const e=O(d);for(const[a,h]of e)i.current.has(a)||(i.current.set(a,h),b.current=Math.max(b.current,h+1))}const _=S.map((e,a)=>{const h=e?.title||`Series ${a+1}`,v=o!=null?Array.isArray(o)?o[0]?.value??o[0]:typeof o=="object"&&"value"in o?o.value:o:null,M=S.length===1?v!=null?String(v):"single":e?.id||h;if(!i.current.has(M)){const l=new Set(Array.from(i.current.values()));let s=b.current;for(let m=0;m<j.DEFAULT_SERIES_COLORS.length;m++){const A=(b.current+m)%j.DEFAULT_SERIES_COLORS.length;if(!l.has(A)){s=A;break}}i.current.set(M,s),b.current=s+1}const de=i.current.get(M)??0,N=j.getSeriesColorPalette(de),ae=[...e?.data||[]].sort((l,s)=>{const m=typeof l.time=="number"?l.time:Number(l.time),A=typeof s.time=="number"?s.time:Number(s.time);return m-A}).reduce((l,s)=>{const m=s.time;return l.length===0||l[l.length-1].time!==m?l.push({time:m,value:s.value}):l[l.length-1]={time:m,value:s.value},l},[]),B=e?.lineColor??e?.color??void 0;return{data:ae,label:h,...e?.id!=null&&{id:e.id},yMeasureUnit:u?.[a]??(Array.isArray(t)?void 0:t),...e?.priceScaleId!=null&&{priceScaleId:e.priceScaleId},...e?.seriesType!=null&&{seriesType:e.seriesType},...e?.lineStyle!=null&&{lineStyle:e.lineStyle},...B!=null?{lineColor:B,...e?.topColor!=null&&{topColor:e.topColor},...e?.bottomColor!=null&&{bottomColor:e.bottomColor}}:{color:N.line,topColor:N.top,bottomColor:N.bottom}}});return d&&i.current.size>0&&W(d,i.current),_},[S,o,t,d]),F=T!==void 0?T:R!==void 0?R.size>0:te&&S.length>0?S.some(u=>!u):!r,H=f.useRef(w);w.length>0&&(H.current=w);const z=w.length>0?w:F?H.current:w,E=ne,se=!q&&I?!0:y.length>0||ie||E!=null||C!=null,ce=g&&x&&o?n.jsx(he.GraphDropdown,{onSelected:g,items:x,defaultItem:o,multiple:$,graphsWithNoData:Y,loadingGraphs:R,onNoDataSelected:oe}):E!=null?n.jsx(fe.SectionHeading,{className:"min-w-0 truncate",children:E}):null,ue=se&&n.jsxs("div",{className:"flex w-full flex-row flex-wrap items-center justify-between gap-3",children:[n.jsx("div",{className:"min-w-0 flex-1",children:ce}),n.jsxs("div",{className:"flex shrink-0 flex-row flex-nowrap items-center gap-3",children:[C,C!=null&&y.length>0?n.jsx("div",{className:"h-4 w-px shrink-0 bg-border"}):null,y.length>0?n.jsxs(p.Select,{value:Q,onValueChange:X,children:[n.jsx(p.SelectTrigger,{size:"sm",className:"h-8 w-auto min-w-[4.5rem] gap-1.5 border-border bg-muted shadow-none",children:n.jsx(p.SelectValue,{})}),n.jsx(p.SelectContent,{align:"end",children:y.map(u=>n.jsx(p.SelectItem,{value:u.value,children:u.label},u.value))})]}):null,!q&&I&&n.jsx("button",{type:"button",className:"flex min-h-[26px] min-w-[44px] cursor-pointer items-center justify-center rounded-md border border-muted bg-muted px-2.5 py-1.5 text-center text-xs font-medium leading-[14px] text-muted-foreground transition-colors hover:border-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:I,children:D?n.jsx(Se,{size:16}):n.jsx(ge,{size:16})})]})]});return n.jsxs("div",{className:be.cn("flex w-full flex-col gap-3 rounded-lg border border-border bg-card p-4 shadow-none",P),children:[ue,n.jsx("div",{style:{width:"100%",height:c?`${c}px`:void 0},className:"w-full",children:n.jsx(we.GraphViewWithData,{...re,series:w,loading:F,size:c?"full":"default",padding:"none",variant:"ghost",className:"rounded-md border border-border bg-card",containerClassName:"h-full overflow-hidden rounded-none border-0 bg-transparent shadow-none",showLegend:!1,onUnselectSeries:k,yMeasureUnit:le,currentValueDecimals:Z,useSharedPriceScale:U,showCurrentValue:K,yScaleMin:G,yScaleMinMultiple:ee,hideDefaultTooltip:!0,optionsOverrides:ve})}),z.length>0?n.jsx(j.GraphLegend,{series:z,onUnselect:k,inline:!0}):null]})}exports.TradingView=je;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),f=require("react"),fe=require("sonner"),xe=require("../base/section-heading/section-heading.cjs"),be=require("../../hooks/use-media-query.cjs");require("@gearbox-protocol/sdk/onchain");const we=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const j=require("../graph/graph.cjs"),he=require("../graph/graph-view.cjs"),p=require("../select/select.cjs"),ge=require("./graph-dropdown.cjs"),Se=({size:r=16})=>n.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Expand fullscreen",children:[n.jsx("title",{children:"Expand fullscreen"}),n.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})]}),ve=({size:r=16})=>n.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Exit fullscreen",children:[n.jsx("title",{children:"Exit fullscreen"}),n.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})]}),pe={timeScale:{borderVisible:!1},rightPriceScale:{borderVisible:!1},leftPriceScale:{borderVisible:!1}},$="ui-kit:tradingview-series-colors:";function O(r){if(typeof window>"u"||!window.localStorage)return new Map;try{const t=window.localStorage.getItem($+r);if(!t)return new Map;const c=JSON.parse(t);return c==null||typeof c!="object"?new Map:new Map(Object.entries(c).filter(([,o])=>typeof o=="number"&&o>=0&&o<j.DEFAULT_SERIES_COLORS.length))}catch{return new Map}}function je(r,t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem($+r,JSON.stringify(Object.fromEntries(t)))}catch{}}function J(r,t){if(t.size===0)return;const c=O(r);for(const[o,g]of t)c.set(o,g);je(r,c)}function ye({data:r,yMeasureUnit:t,height:c=306,defaultGraph:o,onGraphSelected:g,graphs:x,isMultipleSelect:Q,range:X,rangeList:y,setRange:D,onGraphExpanded:I,isGraphExpanded:Y,onUnselectSeries:k,legendMarkers:T,graphsWithNoData:Z,loadingGraphs:R,isLoading:L,noDataMessage:q="No data available for this graph",currentValueDecimals:P,containerClassName:U,useSharedPriceScale:K,showCurrentValue:G,yScaleMin:ee,yScaleMinMultiple:ne,seriesColorPersistenceKey:d,title:re,trailing:C,...te}){const S=f.useMemo(()=>Array.isArray(r)?r:r?[r]:[],[r]),oe=f.useMemo(()=>Array.isArray(r)&&r.length>1,[r]),V=be.useIsMobile(),le=f.useCallback((u,_)=>{fe.toast.error(q)},[q]),ie=f.useMemo(()=>{if(t)return Array.isArray(t)?t[0]:t},[t]),se=!!(g&&x&&o),i=f.useRef(new Map),b=f.useRef(0),F=f.useRef(!1);if(x&&x.length>0&&!F.current){F.current=!0;const u=d?O(d):new Map,_=String(x[0].value);i.current.set(_,0),b.current=1;for(let e=1;e<x.length;e++){const a=String(x[e].value);if(i.current.has(a))continue;const v=u.get(a)??e;i.current.set(a,v),b.current=Math.max(b.current,v+1)}d&&J(d,i.current)}const w=f.useMemo(()=>{const u=Array.isArray(t)?t:void 0;if(d){const e=O(d);for(const[a,h]of e)i.current.has(a)||(i.current.set(a,h),b.current=Math.max(b.current,h+1))}const _=S.map((e,a)=>{const h=e?.title||`Series ${a+1}`,v=o!=null?Array.isArray(o)?o[0]?.value??o[0]:typeof o=="object"&&"value"in o?o.value:o:null,M=S.length===1?v!=null?String(v):"single":e?.id||h;if(!i.current.has(M)){const l=new Set(Array.from(i.current.values()));let s=b.current;for(let m=0;m<j.DEFAULT_SERIES_COLORS.length;m++){const A=(b.current+m)%j.DEFAULT_SERIES_COLORS.length;if(!l.has(A)){s=A;break}}i.current.set(M,s),b.current=s+1}const ae=i.current.get(M)??0,N=j.getSeriesColorPalette(ae),me=[...e?.data||[]].sort((l,s)=>{const m=typeof l.time=="number"?l.time:Number(l.time),A=typeof s.time=="number"?s.time:Number(s.time);return m-A}).reduce((l,s)=>{const m=s.time;return l.length===0||l[l.length-1].time!==m?l.push({time:m,value:s.value}):l[l.length-1]={time:m,value:s.value},l},[]),W=e?.lineColor??e?.color??void 0;return{data:me,label:h,...e?.id!=null&&{id:e.id},yMeasureUnit:u?.[a]??(Array.isArray(t)?void 0:t),...e?.priceScaleId!=null&&{priceScaleId:e.priceScaleId},...e?.seriesType!=null&&{seriesType:e.seriesType},...e?.lineStyle!=null&&{lineStyle:e.lineStyle},...W!=null?{lineColor:W,...e?.topColor!=null&&{topColor:e.topColor},...e?.bottomColor!=null&&{bottomColor:e.bottomColor}}:{color:N.line,topColor:N.top,bottomColor:N.bottom}}});return d&&i.current.size>0&&J(d,i.current),_},[S,o,t,d]),H=L!==void 0?L:R!==void 0?R.size>0:oe&&S.length>0?S.some(u=>!u):!r,z=f.useRef(w);w.length>0&&(z.current=w);const B=w.length>0?w:H?z.current:w,E=re,ce=!V&&I?!0:y.length>0||se||E!=null||C!=null,ue=g&&x&&o?n.jsx(ge.GraphDropdown,{onSelected:g,items:x,defaultItem:o,multiple:Q,graphsWithNoData:Z,loadingGraphs:R,onNoDataSelected:le}):E!=null?n.jsx(xe.SectionHeading,{className:"min-w-0 truncate",children:E}):null,de=ce&&n.jsxs("div",{className:"flex w-full flex-row flex-wrap items-center justify-between gap-3",children:[n.jsx("div",{className:"min-w-0 flex-1",children:ue}),n.jsxs("div",{className:"flex shrink-0 flex-row flex-nowrap items-center gap-3",children:[C,C!=null&&y.length>0?n.jsx("div",{className:"h-4 w-px shrink-0 bg-border"}):null,y.length>0?n.jsxs(p.Select,{value:X,onValueChange:D,children:[n.jsx(p.SelectTrigger,{size:"sm",className:"h-8 w-auto min-w-[4.5rem] gap-1.5 border-border bg-muted shadow-none",children:n.jsx(p.SelectValue,{})}),n.jsx(p.SelectContent,{align:"end",children:y.map(u=>n.jsx(p.SelectItem,{value:u.value,children:u.label},u.value))})]}):null,!V&&I&&n.jsx("button",{type:"button",className:"flex min-h-[26px] min-w-[44px] cursor-pointer items-center justify-center rounded-md border border-muted bg-muted px-2.5 py-1.5 text-center text-xs font-medium leading-[14px] text-muted-foreground transition-colors hover:border-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:I,children:Y?n.jsx(ve,{size:16}):n.jsx(Se,{size:16})})]})]});return n.jsxs("div",{className:we.cn("flex w-full flex-col gap-3 rounded-lg border border-border bg-card p-4 shadow-none",U),children:[de,n.jsx("div",{style:{width:"100%",height:c?`${c}px`:void 0},className:"w-full",children:n.jsx(he.GraphViewWithData,{...te,series:w,loading:H,size:c?"full":"default",padding:"none",variant:"ghost",className:"rounded-md border border-border bg-card",containerClassName:"h-full overflow-hidden rounded-none border-0 bg-transparent shadow-none",showLegend:!1,onUnselectSeries:k,yMeasureUnit:ie,currentValueDecimals:P,useSharedPriceScale:K,showCurrentValue:G,yScaleMin:ee,yScaleMinMultiple:ne,hideDefaultTooltip:!0,optionsOverrides:pe})}),B.length>0||(T?.length??0)>0?n.jsx(j.GraphLegend,{series:B,markers:T,onUnselect:k,inline:!0}):null]})}exports.TradingView=ye;
@@ -1 +1 @@
1
- "use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.networkIndicator.title":"Network","components.infiniteScrollWrapper.showMore":"Show more","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.sdkStatus.connecting":"Connecting…","components.sdkStatus.connected":"Connected","components.sdkStatus.disconnected":"Not connected","components.creditAccountHistory.table.protocol":"Protocol","components.creditAccountHistory.table.operation":"Operation","components.creditAccountHistory.table.details":"Details","components.notificationCenter.empty":"No notifications yet","components.notificationCenter.requests":"Requests","components.notificationCenter.recent":"Recent","components.notificationCenter.clear":"Clear all","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.amountLabel":"Amount","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.smartNumberInput.selectToken":"Select token","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.filterModal.searchPlaceholder":"Search options...","components.filterModal.noOptionsAvailable":"No options available","components.filterModal.noOptionsMatchSearch":"No options match your search","components.filterModal.reset":"Reset","components.filterModal.apply":"Apply","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.noData":"No data","components.creditSessionDetailedLiquidation.graph.legend.point":"Current price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.noData":"No data","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.yieldBreakdown.titleNetAtLeverage":"Net APY at {leverage}× Leverage","components.yieldBreakdown.titleNetAtLeverage7d":"Net APY at {leverage}× Leverage (7d)","components.yieldBreakdown.titleNet":"Net APY","components.yieldBreakdown.titleNet7d":"Net APY (7d)","components.yieldBreakdown.collateralApy":"Collateral APY","components.yieldBreakdown.collateralApy7d":"Collateral APY (7d)","components.yieldBreakdown.baseApy":"Base APY","components.yieldBreakdown.baseApy7d":"Base APY (7d)","components.yieldBreakdown.incentive":"Incentive","components.yieldBreakdown.incentiveApy":"Incentive APY","components.yieldBreakdown.incentiveApy7d":"Incentive APY (7d)","components.yieldBreakdown.borrowRate":"Borrow Rate","components.yieldBreakdown.borrowRate7d":"Borrow Rate (7d)","components.yieldBreakdown.programPoints":"{name} Points","components.yieldBreakdown.points":"Points","components.openCopyButtons.copy":"Copy to clipboard","components.openCopyButtons.explorer":"View in explorer","components.poolAssetsTable.asset":"Name","components.poolAssetsTable.rate":"Effective rate","components.poolAssetsTable.exposure":"Exposure","components.poolAssetsTable.cap":"Cap","components.poolAssetsTable.capUtilization":"Cap utilization","components.poolAssetsTable.usage":"{amount} of {total}","components.poolAssetsTable.head.name":"Credit Manager","components.poolAssetsTable.head.currentDebt":"Current Debt","components.poolAssetsTable.head.assets":"Asset LT","components.poolCreditManagersTable.assets":"{amount} assets","components.creditManagerInfo.title":"Assets and LT’s","components.creditManagerInfo.info.title":"Credit Managers","components.creditManagerInfo.info.copy.tip":"Copy Credit Manager address","components.creditManagerInfo.info.minDebt":"Min debt","components.creditManagerInfo.info.maxDebt":"Max debt","components.creditManagerInfo.info.liquidationFee":"Liquid. fee","components.creditManagerInfo.info.liquidationPremium":"Liquid. premium","components.creditManagerInfo.info.interestFee":"Interest fee","components.creditManagerInfo.info.debtLimit":"Debt limit","components.creditManagerInfo.info.maxEnabledTokens":"Max tokens","dialogs.oraclesAndLTInfo.filter.hide0Quota":"Hide 0-Quota","components.oraclesAndLTInfo.title":"Oracles and LTs","components.oraclesAndLTTable.head.token":"Token","components.oraclesAndLTTable.head.oracles":"Oracles","components.oraclesAndLTTable.head.lt":"LT","components.poolTable.pool":"Market","components.poolTable.market":"Market","components.poolTable.description.universal":"Universal","components.poolTable.supply":"Supply","components.poolTable.borrowed":"Borrowed","components.poolTable.supplyApy":"Supply APY","components.poolTable.supplyApy.tip":"Annual percentage yield that you earn for supplying capital. This number constantly changes as the utilization of the Markets goes up and down","components.poolTable.depositApy":"Deposit APY","components.poolTable.depositApy.tip":"Deposit APY breakdown: base rate, extra rewards, and points","components.poolTable.borrowApy":"Borrow APY","components.poolTable.utilizationApy":"Utilization APY","components.poolTable.borrowApy.tip":"On top of the utilization borrow APY, there is a borrow quota APY for different assets","components.poolTable.utilization":"Utilization","components.poolTable.collateral":"Collateral","components.poolTable.collateral.showAll":"Show All","components.poolTable.balance":"Your Balance","components.poolTable.balance.tip":`You don't earn token rewards, only organic yield. Please migrate liquidity by using "Migrate" flow above.`,"components.poolTable.emptyList":"No Pools found","components.poolTable.notFound.dashboard":"You currently have no open Market positions.","components.poolTable.notFound.list":"No Markets found","components.poolTable.notFound.description.dashboard":"Choose earn above.","components.poolTable.notFound.description.list":"Choose another chain or toggle Show All Markets","components.poolTable.externalApy.tooltipShort":"{value} APY boost when depositing via {name}","components.poolTable.line.rwa.tip":"This is RWA market.","components.rewardsTooltip.without.title":"Without Leverage","components.rewardsTooltip.without.extra":"Extra APY","components.rewardsTooltip.without.extra.tip":"Any deposit through Gearbox","components.rewardsTooltip.with.title":"With {leverage} Leverage","components.rewardsTooltip.with.borrowRate":"{symbol} borrow rate","components.rewardsTooltip.with.quotaRate":"Quota rate","components.rewardsTooltip.with.extra":"+ Extra APR","components.rewardsTooltip.button":"Click to show rewards details","components.strategiesTable.head.name":"Strategy","components.strategiesTable.head.rewards":"Rewards","components.strategiesTable.head.leverage":"Max Leverage","components.strategiesTable.head.earn":"You Can Earn","components.strategiesTable.body.notFound":"No strategy found","components.strategiesTable.line.disabled":"This strategy is currently not available, cause of lack or quota or liquidity. Please contact us on Discord, and we’ll assist you.","components.strategiesTable.line.name.disabled":"This strategy is currently not available","components.strategiesTable.line.points.tip":"For debt nominated in {symbol}","components.strategiesTable.line.points.tipAny":"For debt","components.strategiesTable.line.0slippage":"0-slippage","components.strategiesTable.line.0slippage.tip":"Wrapping/unwrapping happens directly through smart-contracts, so {symbol} deposits and withdrawals don't incur slippage.","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This strategy is available on RWA market.","dialogs.common.review":"Review","components.amountInput.max":"Max","components.amountInput.label":"Amount","components.amountInput.balance":"Balance","components.amountInput.selectToken":"Select token","components.amountInput.inputTitle":"Token Amount","components.leverageInput.label":"Leverage","components.leverageInput.reset":"Reset","components.leverageInput.available":"Available leverage","components.healthFactorBlock.label":"Health factor","components.healthFactorBlock.tip":"Health Factor is a numeric representation of your account 'health'. If your health factor drops below 1 or close to it, you might be liquidated.","components.liquidationPriceBlock.label":"Liquidation Price","components.liquidationPriceBlock.tip":"The asset price at which the account's health factor would reach 1 and become eligible for liquidation.","components.timeToLiquidationBlock.label":"Time to liquidation","components.timeToLiquidationBlock.tip":"Time to liquidation estimates how long the account can stay open if prices remain constant and no yield is earned—only accounting for borrow interest accrual.","components.historyChart.error":"Couldn't load chart data","components.historyChart.empty":"No data","components.positionTypeBadge.pool":"LP","components.positionTypeBadge.strategy":"Strategy","components.positionTypeBadge.liquidation":"Liquidation","components.positionStatusBadge.active":"Active","components.positionStatusBadge.repaid":"Repaid","components.titleMeta.unknownCurator":"Curator","components.moreAccordion.more":"More details","components.moreAccordion.less":"Less details","components.poolApyBreakdownCard.title":"Net APY","components.poolApyBreakdownCard.title7d":"Net APY (7d)","components.poolApyBreakdownCard.organicApy":"Base APY","components.poolApyBreakdownCard.organicApy7d":"Base APY (7d)","components.poolApyBreakdownCard.incentiveApy":"Incentive APY","components.poolApyBreakdownCard.incentiveApy7d":"Incentive APY (7d)","components.strategyApyBreakdownCard.formula":"{leverage} × {base}","components.strategyApyBreakdownCard.borrowFormula":"{leverage} × {totalRate} − {borrowRate}","components.leveragePresetChips.label":"Leverage:","components.liquidationParamsTable.lt":"Liquidation threshold","components.liquidationParamsTable.penalty":"Liquidation discount","components.liquidationParamsTable.premium":"Liquidation premium","components.liquidationParamsTable.fee":"Liquidation fee","components.borrowRateBlock.label":"Borrow rate","components.borrowRateBlock.tip":"Borrow rate is displayed for your entire position size in total. You can reduce it in quota management.","components.borrowRateBlock.description":"Your borrow rate consists of the Base Rate plus the Quota Rates for every asset separately.","components.borrowRateBlock.baseRate":"Base Rate for Debt","components.borrowRateBlock.normalization":"Rates normalization","components.borrowRateBlock.normalization.tip":"Borrowers pay {quota} and {utilization}, which have a different base. Therefore, the total borrow rate value is normalized by Account value or Debt amount.","components.transactionConfirm.previewLoading":"Parsing transaction…","components.transactionConfirm.previewErrorTitle":"Preview error"};module.exports=e;
1
+ "use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.networkIndicator.title":"Network","components.infiniteScrollWrapper.showMore":"Show more","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.sdkStatus.connecting":"Connecting…","components.sdkStatus.connected":"Connected","components.sdkStatus.disconnected":"Not connected","components.creditAccountHistory.table.protocol":"Protocol","components.creditAccountHistory.table.operation":"Operation","components.creditAccountHistory.table.details":"Details","components.notificationCenter.empty":"No notifications yet","components.notificationCenter.requests":"Requests","components.notificationCenter.recent":"Recent","components.notificationCenter.clear":"Clear all","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.amountLabel":"Amount","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.smartNumberInput.selectToken":"Select token","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.filterModal.searchPlaceholder":"Search options...","components.filterModal.noOptionsAvailable":"No options available","components.filterModal.noOptionsMatchSearch":"No options match your search","components.filterModal.reset":"Reset","components.filterModal.apply":"Apply","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.noData":"No data","components.creditSessionDetailedLiquidation.graph.legend.point":"Current Price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.noData":"No data","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current Price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model Price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY Type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.yieldBreakdown.titleNetAtLeverage":"Net APY at {leverage}× Leverage","components.yieldBreakdown.titleNetAtLeverage7d":"Net APY at {leverage}× Leverage (7d)","components.yieldBreakdown.titleNet":"Net APY","components.yieldBreakdown.titleNet7d":"Net APY (7d)","components.yieldBreakdown.collateralApy":"Collateral APY","components.yieldBreakdown.collateralApy7d":"Collateral APY (7d)","components.yieldBreakdown.baseApy":"Base APY","components.yieldBreakdown.baseApy7d":"Base APY (7d)","components.yieldBreakdown.incentive":"Incentive","components.yieldBreakdown.incentiveApy":"Incentive APY","components.yieldBreakdown.incentiveApy7d":"Incentive APY (7d)","components.yieldBreakdown.borrowRate":"Borrow Rate","components.yieldBreakdown.borrowRate7d":"Borrow Rate (7d)","components.yieldBreakdown.programPoints":"{name} Points","components.yieldBreakdown.points":"Points","components.openCopyButtons.copy":"Copy to clipboard","components.openCopyButtons.explorer":"View in explorer","components.poolAssetsTable.asset":"Name","components.poolAssetsTable.rate":"Effective Rate","components.poolAssetsTable.exposure":"Exposure","components.poolAssetsTable.cap":"Cap","components.poolAssetsTable.capUtilization":"Cap Utilization","components.poolAssetsTable.usage":"{amount} of {total}","components.poolAssetsTable.head.name":"Credit Manager","components.poolAssetsTable.head.currentDebt":"Current Debt","components.poolAssetsTable.head.assets":"Asset LT","components.poolCreditManagersTable.assets":"{amount} assets","components.creditManagerInfo.title":"Assets and LT’s","components.creditManagerInfo.info.title":"Credit Managers","components.creditManagerInfo.info.copy.tip":"Copy Credit Manager address","components.creditManagerInfo.info.minDebt":"Min Debt","components.creditManagerInfo.info.maxDebt":"Max Debt","components.creditManagerInfo.info.liquidationFee":"Liquid. Fee","components.creditManagerInfo.info.liquidationPremium":"Liquid. Premium","components.creditManagerInfo.info.interestFee":"Interest Fee","components.creditManagerInfo.info.debtLimit":"Debt Limit","components.creditManagerInfo.info.maxEnabledTokens":"Max Tokens","dialogs.oraclesAndLTInfo.filter.hide0Quota":"Hide 0-Quota","components.oraclesAndLTInfo.title":"Oracles and LTs","components.oraclesAndLTTable.head.token":"Token","components.oraclesAndLTTable.head.oracles":"Oracles","components.oraclesAndLTTable.head.lt":"LT","components.poolTable.pool":"Market","components.poolTable.market":"Market","components.poolTable.description.universal":"Universal","components.poolTable.supply":"Supply","components.poolTable.borrowed":"Borrowed","components.poolTable.supplyApy":"Supply APY","components.poolTable.supplyApy.tip":"Annual percentage yield that you earn for supplying capital. This number constantly changes as the utilization of the Markets goes up and down","components.poolTable.depositApy":"Deposit APY","components.poolTable.depositApy.tip":"Deposit APY breakdown: base rate, extra rewards, and points","components.poolTable.borrowApy":"Borrow Rate","components.poolTable.utilizationApy":"Utilization APY","components.poolTable.borrowApy.tip":"On top of the utilization borrow rate, there is a borrow quota rate for different assets","components.poolTable.utilization":"Utilization","components.poolTable.collateral":"Collateral","components.poolTable.collateral.showAll":"Show All","components.poolTable.balance":"Your Balance","components.poolTable.balance.tip":`You don't earn token rewards, only organic yield. Please migrate liquidity by using "Migrate" flow above.`,"components.poolTable.emptyList":"No Pools found","components.poolTable.notFound.dashboard":"You currently have no open Market positions.","components.poolTable.notFound.list":"No Markets found","components.poolTable.notFound.description.dashboard":"Choose earn above.","components.poolTable.notFound.description.list":"Choose another chain or toggle Show All Markets","components.poolTable.externalApy.tooltipShort":"{value} APY boost when depositing via {name}","components.poolTable.line.rwa.tip":"This is RWA market.","components.rewardsTooltip.without.title":"Without Leverage","components.rewardsTooltip.without.extra":"Extra APY","components.rewardsTooltip.without.extra.tip":"Any deposit through Gearbox","components.rewardsTooltip.with.title":"With {leverage} Leverage","components.rewardsTooltip.with.borrowRate":"{symbol} borrow rate","components.rewardsTooltip.with.quotaRate":"Quota Rate","components.rewardsTooltip.with.extra":"+ Extra APR","components.rewardsTooltip.button":"Click to show rewards details","components.strategiesTable.head.name":"Strategy","components.strategiesTable.head.rewards":"Rewards","components.strategiesTable.head.leverage":"Max Leverage","components.strategiesTable.head.earn":"You Can Earn","components.strategiesTable.body.notFound":"No strategy found","components.strategiesTable.line.disabled":"This strategy is currently not available, cause of lack or quota or liquidity. Please contact us on Discord, and we’ll assist you.","components.strategiesTable.line.name.disabled":"This strategy is currently not available","components.strategiesTable.line.points.tip":"For debt nominated in {symbol}","components.strategiesTable.line.points.tipAny":"For debt","components.strategiesTable.line.0slippage":"0-slippage","components.strategiesTable.line.0slippage.tip":"Wrapping/unwrapping happens directly through smart-contracts, so {symbol} deposits and withdrawals don't incur slippage.","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This strategy is available on RWA market.","dialogs.common.review":"Review","components.amountInput.max":"Max","components.amountInput.label":"Amount","components.amountInput.balance":"Balance","components.amountInput.selectToken":"Select token","components.amountInput.inputTitle":"Token Amount","components.leverageInput.label":"Leverage","components.leverageInput.reset":"Reset","components.leverageInput.available":"Available Leverage","components.healthFactorBlock.label":"Health Factor","components.healthFactorBlock.tip":"Health Factor is a numeric representation of your account 'health'. If your health factor drops below 1 or close to it, you might be liquidated.","components.liquidationPriceBlock.label":"Liquidation Price","components.liquidationPriceBlock.tip":"The asset price at which the account's health factor would reach 1 and become eligible for liquidation.","components.timeToLiquidationBlock.label":"Time to Liquidation","components.timeToLiquidationBlock.tip":"Time to liquidation estimates how long the account can stay open if prices remain constant and no yield is earned—only accounting for borrow interest accrual.","components.historyChart.error":"Couldn't load chart data","components.historyChart.empty":"No data","components.positionTypeBadge.pool":"LP","components.positionTypeBadge.strategy":"Strategy","components.positionTypeBadge.liquidation":"Liquidation","components.positionStatusBadge.active":"Active","components.positionStatusBadge.repaid":"Repaid","components.titleMeta.unknownCurator":"Curator","components.moreAccordion.more":"More details","components.moreAccordion.less":"Less details","components.poolApyBreakdownCard.title":"Net APY","components.poolApyBreakdownCard.title7d":"Net APY (7d)","components.poolApyBreakdownCard.organicApy":"Base APY","components.poolApyBreakdownCard.organicApy7d":"Base APY (7d)","components.poolApyBreakdownCard.incentiveApy":"Incentive APY","components.poolApyBreakdownCard.incentiveApy7d":"Incentive APY (7d)","components.strategyApyBreakdownCard.formula":"{leverage} × {base}","components.strategyApyBreakdownCard.borrowFormula":"{leverage} × {totalRate} − {borrowRate}","components.leveragePresetChips.label":"Leverage:","components.liquidationParamsTable.lt":"Liquidation Threshold","components.liquidationParamsTable.penalty":"Liquidation Discount","components.liquidationParamsTable.premium":"Liquidation Premium","components.liquidationParamsTable.fee":"Liquidation Fee","components.borrowRateBlock.label":"Borrow Rate","components.borrowRateBlock.tip":"Borrow rate is displayed for your entire position size in total. You can reduce it in quota management.","components.borrowRateBlock.description":"Your borrow rate consists of the Base Rate plus the Quota Rates for every asset separately.","components.borrowRateBlock.baseRate":"Base Rate for Debt","components.borrowRateBlock.normalization":"Rates Normalization","components.borrowRateBlock.normalization.tip":"Borrowers pay {quota} and {utilization}, which have a different base. Therefore, the total borrow rate value is normalized by Account value or Debt amount.","components.transactionConfirm.previewLoading":"Parsing transaction…","components.transactionConfirm.previewErrorTitle":"Preview error"};module.exports=e;