@gearbox-protocol/ui-kit 4.4.1 → 4.5.1

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 t={root:"review-button-root",error:"review-button-error",tip:"review-button-tip"};exports.ReviewButtonTest=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={root:"review-button-root",error:"review-button-error",tip:"review-button-tip",solution:"review-button-solution"};exports.ReviewButtonTest=t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("../stack/stack.cjs"),d=require("../../buttons/button/button.cjs"),c=require("../../tip-card/tip-card.cjs"),s=require("../../typed-intl/index.cjs"),e=require("./constants.cjs");function l({disabled:r,error:o,tip:n,onClick:i,label:a="dialogs.common.review"}){return t.jsxs(u.Stack,{gap:"sm",children:[n?t.jsx(c.TipCard,{textColor:"light",attributeColor:"alert",className:"w-full","data-testid":e.ReviewButtonTest.tip,children:t.jsx(s.FormattedMessageTyped,{...n})}):null,t.jsx(d.Button,{disabled:r,onClick:i,"data-testid":e.ReviewButtonTest.root,children:o?t.jsx("span",{"data-testid":e.ReviewButtonTest.error,children:t.jsx(s.FormattedMessageTyped,{messageId:o})}):t.jsx(s.FormattedMessageTyped,{messageId:a})})]})}exports.ReviewButtonTest=e.ReviewButtonTest;exports.ReviewButton=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("../stack/stack.cjs"),r=require("../../buttons/button/button.cjs"),l=require("../../tip-card/tip-card.cjs"),s=require("../../typed-intl/index.cjs"),e=require("./constants.cjs");function m({disabled:d,error:o,tip:a,solution:n,onClick:u,label:c="dialogs.common.review"}){return t.jsxs(i.Stack,{gap:"sm",children:[a?t.jsx(l.TipCard,{textColor:"light",attributeColor:"alert",className:"w-full","data-testid":e.ReviewButtonTest.tip,children:t.jsxs(i.Stack,{gap:"sm",align:"start",children:[t.jsx(s.FormattedMessageTyped,{...a}),n?t.jsx(r.Button,{variant:"outline",size:"sm",onClick:n.onClick,"data-testid":e.ReviewButtonTest.solution,children:t.jsx(s.FormattedMessageTyped,{...n.label})}):null]})}):null,t.jsx(r.Button,{disabled:d,onClick:u,"data-testid":e.ReviewButtonTest.root,children:o?t.jsx("span",{"data-testid":e.ReviewButtonTest.error,children:t.jsx(s.FormattedMessageTyped,{messageId:o})}):t.jsx(s.FormattedMessageTyped,{messageId:c})})]})}exports.ReviewButtonTest=e.ReviewButtonTest;exports.ReviewButton=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),H=require("lightweight-charts"),g=require("react"),Y=require("./colors.cjs"),at=require("../../hooks/use-media-query.cjs"),Q=require("../../utils/cn.cjs"),I=require("./default-config.cjs"),oe=require("./formatters.cjs"),ct=require("./graph-current-value.cjs"),ut=require("./graph-tooltip.cjs"),ft=require("./plugins/vertical-line.cjs"),ht=require("./series-config.cjs"),We=require("./series-palette.cjs"),Ge=require("./y-axis-scale.cjs");function dt(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(r,l,u.get?u:{enumerable:!0,get:()=>e[l]})}}return r.default=e,Object.freeze(r)}const ve=dt(g);function te(e){return e.id??e.label}function Ke({lastIndex:e,width:r,padLeft:l,padRight:u,paddingPx:h=I.AXIS_TIME_EDGE_PADDING_PX}){if(e<0)return null;const f=(l||u)&&r>0?h*Math.max(e,1)/r:0;return{from:l&&f!==0?-f:0,to:u?e+f:e}}function qe(e,r,l){if(!l)return e.values().next().value;const u=e.get(l);if(u)return u;const h=r.find(f=>f.id===l||f.label===l);return h?e.get(te(h)):void 0}class pt{_yTop;_yBottom;_color;constructor(r,l,u){this._yTop=r,this._yBottom=l,this._color=u}draw(r){r.useBitmapCoordinateSpace(l=>{const u=l.context,h=l.verticalPixelRatio,f=this._yTop===null?0:this._yTop*h,x=this._yBottom===null?l.bitmapSize.height:this._yBottom*h,R=Math.min(f,x),D=Math.max(f,x);u.fillStyle=this._color,u.fillRect(0,R,l.bitmapSize.width,D-R)})}}class gt{_source;_yTop=null;_yBottom=null;constructor(r){this._source=r}update(){const r=this._source.series;this._yTop=this._source.priceTop===void 0?null:r.priceToCoordinate(this._source.priceTop),this._yBottom=this._source.priceBottom===void 0?null:r.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(r,l,u,h){this.series=r,this.priceTop=l,this.priceBottom=u,this.color=h,this._paneViews=[new gt(this)]}updateAllViews(){for(const r of this._paneViews)r.update()}paneViews(){return this._paneViews}}function bt(e,r){switch(e){case H.LineStyle.Dotted:return[r,r];case H.LineStyle.Dashed:return[2*r,2*r];case H.LineStyle.LargeDashed:return[6*r,6*r];case H.LineStyle.SparseDotted:return[r,4*r];default:return[]}}class St{_y;_color;_lineWidth;_lineStyle;constructor(r,l,u,h){this._y=r,this._color=l,this._lineWidth=u,this._lineStyle=h}draw(r){r.useBitmapCoordinateSpace(l=>{if(this._y===null)return;const u=l.context,h=l.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(l.bitmapSize.width,x),u.stroke(),u.restore()})}}class Ct{_source;_y=null;constructor(r){this._source=r}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(r,l,u,h,f){this.series=r,this.price=l,this.color=u,this.lineWidth=h,this.lineStyle=f,this._paneViews=[new Ct(this)]}updateAllViews(){for(const r of this._paneViews)r.update()}paneViews(){return this._paneViews}}function $e(e,r,l){const u=e.labelText??"",h=e.value,f=h===void 0?"":typeof h=="number"?r==="$"?`$${oe.formatExactValue(h,void 0,l)}`:r==="%"?`${oe.formatExactValue(h,void 0,l)}%`:oe.formatExactValue(h,r!=="none"&&r!=="%"&&r!=="$"&&!oe.isRatioUnit(r)?r:void 0,l):String(h);return{labelText:u,valueStr:f}}const ye=4;function He(e,r,l){const u={left:e,transform:"translateX(-50%)"};if(r<=0||!l||l<=0)return u;const h=l/2,f=ye+h,x=r-ye-h;return x<f?{left:r/2,transform:"translateX(-50%)"}:{left:Math.min(Math.max(e,f),x),transform:"translateX(-50%)"}}function Oe(e,r){for(let l=e.length-1;l>=0;l--)if(Number(e[l].time)<=r)return e[l].value;return 0}function vt({series:e,className:r,showLegend:l=!1,onUnselectSeries:u,xMeasureUnit:h="time",yMeasureUnit:f="token",optionsOverrides:x,verticalLineOptions:R,priceLineOptions:D,zoneOptions:F,currentValueDecimals:se,useSharedPriceScale:O=!1,dualYAxis:z=!1,defaultVisiblePriceScaleId:_e="right",showCurrentValue:Ye=!0,graphTitle:de,yScaleMin:we,yScaleMinMultiple:Pe,visibleTimeFrom:ie,disableZoom:Re=!1,hideDefaultTooltip:pe=!1}){const A=g.useRef(null),N=g.useRef(new Map),ge=g.useRef(!1),Te=g.useRef(!0),Le=g.useRef([]),le=g.useRef(0),j=g.useRef(null),me=g.useRef(null),Ne=g.useRef(null),T=at.useIsMobile(),ae=ve.useMemo(()=>e.flatMap(t=>t.data),[e]),Qe=ve.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[Ve,be]=g.useState(()=>{if(!Qe)return;const t=new Map;for(const a of e)a.data.length>0&&t.set(a.label,a.data[a.data.length-1]);return t}),[ke,J]=g.useState(null),[Ee,Ie]=g.useState([]),[Je,Me]=g.useState(0),De=g.useRef(new Map),[Ue,et]=g.useState({}),[U,tt]=g.useState(0);g.useEffect(()=>{const t=()=>{try{if(j.current&&Me(j.current.clientWidth),A.current&&j.current){const i=j.current.clientWidth,c=j.current.clientHeight;A.current.resize(i,c);try{le.current=A.current.paneSize().height}catch{}}}catch{}},a=j.current,n=a?new ResizeObserver(t):null;return Ne.current=n,a&&n?.observe(a),()=>{a&&n?.unobserve(a),n?.disconnect(),Ne.current=null}},[]),g.useEffect(()=>{if(!me.current||ge.current)return;const t=I.getDefaultOptions(),a=Y.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)"),n=H.createChart(me.current,{...t,leftPriceScale:{...t.leftPriceScale||{},visible:!1,textColor:a},rightPriceScale:{...t.rightPriceScale||{},visible:!T,textColor:a},...T&&{crosshair:{...t.crosshair,mode:H.CrosshairMode.Magnet}}});A.current=n,ge.current=!0;try{le.current=n.paneSize().height}catch{le.current=0}return tt(i=>i+1),()=>{n.remove(),A.current=null,ge.current=!1,N.current.clear()}},[T]),g.useEffect(()=>{const t=A.current;t&&t.applyOptions(Re?{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}})},[U,Re]),g.useEffect(()=>{const t=A.current;!t||!x||t.applyOptions(x)},[U,x]),g.useEffect(()=>{const t=A.current;if(!t||e.length===0)return;const n=e.filter(s=>s.data.length>0).length<=1?we:Pe,i=h==="time"?oe.getXFormatters(h,ae):oe.getXFormatters(h),c=new Map(ht.resolvePriceScaleSides(e).map(({series:s,side:o})=>[s.label,o])),p=(s,o,d)=>{const{formatter:E,tickmarksFormatter:k,updateVisibleRange:B}=oe.createAdaptiveYAxisFormatter(s,o,{yScaleMin:n});return{formatter:E,tickmarksFormatter:k,updateVisibleRange:B,labels:d}},m=[];if(z)for(const s of["left","right"]){const o=new Set,d=[];let E=f;for(const k of e)if(k.data.length!==0&&c.get(k.label)===s){o.size===0&&k.yMeasureUnit&&(E=k.yMeasureUnit),o.add(k.label);for(const B of k.data)d.push(B.value)}o.size>0&&m.push(p(d,E,o))}else{const s=ae.map(d=>d.value),o=new Set(e.filter(d=>d.data.length>0).map(d=>d.label));m.push(p(s,f,o))}Le.current=m;const _=new Map;for(const s of m)for(const o of s.labels)_.set(o,s);const w=I.getDefaultOptions();t.applyOptions({localization:{...w.localization||{},timeFormatter:s=>i.timeFormatter(parseFloat(s),void 0)},timeScale:{...w.timeScale||{},...x?.timeScale,tickMarkFormatter:i.tickMarkFormatter,minBarSpacing:0}});const v=!z&&e.length>1&&!O,G=z?T:e.length>1&&!O||T,V=Y.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)");t.applyOptions({...z&&{defaultVisiblePriceScaleId:_e},leftPriceScale:{...w.leftPriceScale||{},...x?.leftPriceScale,visible:z&&!T,textColor:V},rightPriceScale:{...w.rightPriceScale||{},...x?.rightPriceScale,visible:z?!T:!G,textColor:V}});const ee=new Set(N.current.keys()),q=new Set(e.map(te));for(const s of ee)if(!q.has(s)){const o=N.current.get(s);o&&(t.removeSeries(o),N.current.delete(s))}const b=I.getDefaultSeries(),M=[];let L=0;const W=e.find(s=>s.data.length>0),y=new Map;if(D&&D.length>0)for(const s of D){if(!Number.isFinite(s.price))continue;const o=s.seriesLabel??W?.label;if(!o)continue;const d=y.get(o)??[];d.push(s.price),y.set(o,d)}if(F&&F.length>0)for(const s of F){const o=s.seriesLabel??W?.label;if(!o)continue;const d=y.get(o)??[];Number.isFinite(s.priceTop)&&d.push(s.priceTop),Number.isFinite(s.priceBottom)&&d.push(s.priceBottom),y.set(o,d)}for(let s=0;s<e.length;s++){const o=e[s],d=te(o),E=We.getSeriesColorPalette(s),k=o.lineColor??o.color??E.line;let B,Z;if(o.lineColor??o.color)if(o.topColor&&o.bottomColor)B=o.topColor,Z=o.bottomColor;else if(o.topColor){const S=Y.generateColorsFromBase(k);B=o.topColor,Z=S.bottomColor}else if(o.bottomColor)B=Y.generateColorsFromBase(k).topColor,Z=o.bottomColor;else{const S=Y.generateColorsFromBase(k);B=S.topColor,Z=S.bottomColor}else B=o.topColor||E.top,Z=o.bottomColor||E.bottom;if(o.data.length===0){const S=N.current.get(d);S&&(t.removeSeries(S),N.current.delete(d));continue}const ce=o.data.length>0?Math.min(...o.data.map(S=>S.value)):0,fe=o.data.length>0?Math.max(...o.data.map(S=>S.value)):0,ot=ce<0,rt=o.data.some(S=>S.value===0),nt=!ot&&rt,je=Ge.pickMinMove(fe-ce),Be=z?o.priceScaleId??(L===0?"left":"right"):O||!v||L===0?"right":`scale-${L}`;v&&M.push({priceScaleId:Be||"right",seriesIndex:L});const Se=(O||!v)&&n!==void 0&&typeof n=="number",st=y.get(o.label)??[],it=S=>{const P=S();if(P?.priceRange){Se&&(P.priceRange.minValue=n);for(const $ of st)$<P.priceRange.minValue&&(P.priceRange.minValue=$),$>P.priceRange.maxValue&&(P.priceRange.maxValue=$);const ne=Se?n:nt&&P.priceRange.minValue>=0?0:void 0,he=le.current>0?le.current:j.current?.clientHeight??0;if(he>0){const $=Ge.niceAxisRange({min:P.priceRange.minValue,max:P.priceRange.maxValue,floor:ne,scaleHeightPx:he,fontSizePx:I.AXIS_FONT_SIZE,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,minMove:je,edgePaddingPx:I.AXIS_EDGE_LABEL_PADDING_PX,edgePaddingTopPx:I.AXIS_TOP_LABEL_PADDING_PX});P.priceRange.minValue=$.min,P.priceRange.maxValue=$.max}P.margins={above:I.AXIS_TOP_LABEL_PADDING_PX,below:I.AXIS_EDGE_LABEL_PADDING_PX}}return P},Fe=_.get(o.label)??m[0],ze=Fe.formatter,lt=Fe.tickmarksFormatter,Ce={lineColor:k,topColor:B,bottomColor:Z,priceScaleId:Be,...o.seriesType==="line"&&{lineStyle:o.lineStyle??H.LineStyle.Solid},priceFormat:{type:"custom",minMove:je,formatter:Se&&typeof n=="number"?S=>ze(S<n?n:S):ze,tickmarksFormatter:lt},autoscaleInfoProvider:it},Xe=o.seriesType==="line";let X=N.current.get(d);const re=o.data.map(S=>({...S,time:S.time}));if(ie!==void 0&&re.length>0&&Number(re[0].time)>ie){const S=Number(re[0].time),P=S-ie,ne=86400,he=P>180*ne?7*ne:P>30*ne?ne:6*3600,$=[];for(let xe=ie;xe<S;xe+=he)$.push({time:xe});re.unshift(...$)}X&&X.seriesType()!==(Xe?"Line":"Area")&&(t.removeSeries(X),N.current.delete(d),X=void 0),X?(X.applyOptions(Ce),X.setData(re)):(Xe?X=t.addSeries(H.LineSeries,{...b,...Ce}):X=t.addSeries(H.AreaSeries,{...b,...Ce}),X.setData(re),N.current.set(d,X)),L++}if(z)try{const s=t.priceScale("left"),o=t.priceScale("right"),d={visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,textColor:V,...x?.rightPriceScale};s?.applyOptions(d),o?.applyOptions(d)}catch{}else if(v&&M.length>0)for(const s of M)try{const o=t.priceScale(s.priceScaleId);o&&o.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,textColor:V})}catch(o){console.warn(`Failed to configure price scale ${s.priceScaleId} for series ${s.seriesIndex}:`,o)}else if(!v)try{const s=t.priceScale("right");s&&s.applyOptions({visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,textColor:V,...x?.rightPriceScale})}catch{}if(n!==void 0&&!T&&(O||!v)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}}),ae.length>0){const s=ae.map(d=>Number(d.time)).filter(d=>Number.isFinite(d)),o=new Set(s).size-1;if(o>=0){const d=()=>{const E=t.timeScale();if(h!=="time"){E.applyOptions({fixLeftEdge:!0,fixRightEdge:!0}),E.setVisibleLogicalRange({from:0,to:o});return}const k=z&&!T,B=z?!T:!G,Z=!k,ce=!B;E.applyOptions({fixLeftEdge:!Z,fixRightEdge:!ce});const fe=Ke({lastIndex:o,width:E.width(),padLeft:Z,padRight:ce});fe&&E.setVisibleLogicalRange(fe)};try{d()}catch{try{t.timeScale().fitContent(),d()}catch{}}}}Te.current&&(Te.current=!1),x&&t.applyOptions(x);const K=new Map;for(const s of e)s.data.length>0&&K.set(s.label,s.data[s.data.length-1]);be(K.size>0?K:void 0)},[U,e,ae,h,f,T,O,z,_e,we,Pe,ie,D,F,x]),g.useEffect(()=>{const t=A.current;if(!t||e.length===0)return;const a=e.length===1;let n;for(const c of e)if(c.data.length>0){n=c.data[c.data.length-1].time;break}if(!n)return;const i=c=>{const{time:p=n,seriesData:m,point:_}=c||{},w=e[0],v=w?N.current.get(te(w)):void 0;if(!_||!p){const q=new Map;for(const b of e)b.data.length>0&&q.set(b.label,b.data[b.data.length-1]);if(be(q.size>0?q:void 0),a||O||pe)J(null);else if(v&&n){const b=e[0];if(b&&b.data.length>0){const L=t.timeScale().timeToCoordinate(n),W=b.data[b.data.length-1].value,y=v.priceToCoordinate(W);L!==null&&y!==null&&J({x:L,y})}}return}const G=new Map;let V,ee=v;for(let q=0;q<e.length;q++){const b=e[q],M=N.current.get(te(b));if(!M)continue;const L=m?.get(M),W=L&&"value"in L?L.value:void 0;let y;if(W!==void 0)y=W;else if(a){const K=Number(p),s=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;K<s?y=Number.NaN:y=b.data[b.data.length-1]?.value??0}else{const K=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;if(Number(p)<K)continue;y=Oe(b.data,Number(p))}Number.isNaN(y)||(V===void 0&&(V=y,ee=M),G.set(b.label,{value:y,time:p}))}if(be(G),V!==void 0&&ee){const b=t.timeScale().timeToCoordinate(p),M=ee.priceToCoordinate(V);if(b!==null&&M!==null){const L=j.current;if(L){const W=L.querySelector(".LightweightChart");if(W){const y=W.getBoundingClientRect(),K=L.getBoundingClientRect(),s=b+(y.left-K.left),o=M+(y.top-K.top);J({x:s,y:o})}else J({x:b,y:M})}else J({x:b,y:M})}else J(null)}else J(null)};return t.subscribeCrosshairMove(i),T&&t.subscribeClick(i),!a&&!O&&!pe&&requestAnimationFrame(()=>{const c=e[0],p=c?N.current.get(te(c)):void 0;if(p&&n&&c.data.length>0){const _=t.timeScale().timeToCoordinate(n),w=c.data[c.data.length-1].value,v=p.priceToCoordinate(w);_!==null&&v!==null&&J({x:_,y:v})}}),()=>{t.unsubscribeCrosshairMove(i),T&&t.unsubscribeClick(i)}},[e,O,T,pe]),g.useEffect(()=>{const t=A.current;if(!t||e.length===0)return;const a=t.timeScale(),n=()=>{const i=Le.current;if(i.length===0)return;const c=a.getVisibleRange();if(!c)return;const p=Number(c.from),m=Number(c.to);for(const _ of i){const w=[];for(const v of e)if(_.labels.has(v.label))for(const G of v.data){const V=Number(G.time);V>=p&&V<=m&&w.push(G.value)}w.length>0&&_.updateVisibleRange(w)}};return a.subscribeVisibleLogicalRangeChange(n),()=>{a.unsubscribeVisibleLogicalRangeChange(n)}},[e]),g.useEffect(()=>{const t=A.current,a=Array.from(N.current.values()),n=[];if(t&&a.length>0&&R){const i=I.getDefaultVerticalLine(),c=a[0];for(const p of R){const m={...i,...p.options||{}};m.color&&(m.color=Y.resolveCSSColor(m.color,m.color));const _=new ft.VertLine(t,c,p.xCoordinate,m);c.attachPrimitive(_),n.push(_)}}return()=>{if(a.length>0){const i=a[0];for(const c of n)try{i.detachPrimitive(c)}catch{}}}},[R,e,U]),g.useEffect(()=>{const t=[],a=[];if(D&&D.length>0){const n=Y.resolveCSSColor("hsl(var(--destructive))","rgb(239, 68, 68)");for(const i of D){if(!Number.isFinite(i.price))continue;const c=qe(N.current,e,i.seriesLabel);if(!c)continue;const p=i.color?Y.resolveCSSColor(i.color,i.color):n,m=i.lineWidth??1,_=i.lineStyle??H.LineStyle.Dashed,w=c.createPriceLine({price:i.price,color:p,lineWidth:m,lineStyle:_,axisLabelVisible:i.axisLabelVisible??!0,title:i.title??""});t.push({series:c,line:w});const v=new xt(c,i.price,p,m,_);c.attachPrimitive(v),a.push({series:c,primitive:v})}}return()=>{for(const{series:n,primitive:i}of a)try{n.detachPrimitive(i)}catch{}for(const{series:n,line:i}of t)try{n.removePriceLine(i)}catch{}}},[D,e,U]),g.useEffect(()=>{const t=[];if(F&&F.length>0){const a="rgba(239, 68, 68, 0.12)";for(const n of F){const i=qe(N.current,e,n.seriesLabel);if(!i)continue;const c=n.color?Y.resolveCSSColor(n.color,a):a,p=new mt(i,n.priceTop,n.priceBottom,c);i.attachPrimitive(p),t.push({series:i,zone:p})}}return()=>{for(const{series:a,zone:n}of t)try{a.detachPrimitive(n)}catch{}}},[F,e,U]),g.useEffect(()=>{const t=A.current;if(!t||!R?.length){Ie([]);return}const a=()=>{const c=t.timeScale(),p=R.map(m=>c.timeToCoordinate(m.xCoordinate)??null);Ie(p),j.current&&Me(j.current.clientWidth)};a();const n=t.timeScale(),i=()=>{a()};return n.subscribeVisibleLogicalRangeChange(i),()=>{n.unsubscribeVisibleLogicalRangeChange(i)}},[R,e,U]),g.useLayoutEffect(()=>{et(t=>{const a={};let n=!1;for(const[i,c]of De.current){if(!c)continue;const p=c.offsetWidth;a[i]=p,t[i]!==p&&(n=!0)}return Object.keys(t).length!==Object.keys(a).length&&(n=!0),n?a:t})});const ue=e.length===1,Ae=ve.useMemo(()=>{if(ue&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[ue,e]);return C.jsxs("div",{ref:j,className:Q.cn("relative z-[1] w-full h-full overflow-hidden p-0",r),children:[de!=null&&de!==!1&&ue?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:de})}):Ye&&ue&&Ae&&C.jsx(ct.GraphCurrentValue,{point:Ae,xMeasureUnit:h,yMeasureUnit:f,decimals:se}),Ve&&ke&&C.jsx(ut.GraphTooltip,{points:Ve,xMeasureUnit:h,yMeasureUnit:f,series:e,position:ke,containerRef:j,decimals:se}),l&&C.jsx(Ze,{series:e,onUnselect:u}),R&&R.length>0&&Ee.length===R.length&&C.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:R.map((t,a)=>{const n=Ee[a],i=t.options??{};if(n===null)return null;const{labelText:c,valueStr:p}=$e(i,f,se),m=i.tooltipText??"";if(!(c||p||m))return null;const w=i.labelBackgroundColor??i.color??"hsl(var(--background))",v=i.labelTextColor??"hsl(var(--foreground))",G=`${String(t.xCoordinate)}-${c}-${m}`,V=He(n,Je,Ue[a]);return C.jsxs("div",{ref:ee=>{De.current.set(a,ee)},className:Q.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:{...V,backgroundColor:w,color:v},children:[c&&C.jsx("span",{className:"block",children:c}),p&&C.jsx("span",{className:Q.cn("block",c&&"mt-0.5"),children:p}),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})]},G)})}),C.jsx("div",{ref:me,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ze({series:e,markers:r,onUnselect:l,inline:u=!1}){const h=e.every(f=>f.data.length===0);return C.jsxs("div",{className:Q.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 R=We.getSeriesColorPalette(x),D=(f.lineColor??f.color)||R.line,F=!h&&f.data.length===0;return C.jsxs("div",{className:Q.cn("flex shrink-0 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:Q.cn("shrink-0",u?"size-2 rounded-full":"h-3 w-3 rounded-sm"),style:{backgroundColor:D}}),C.jsxs("span",{className:Q.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:[f.label,F&&" (no data)"]}),l&&C.jsx("button",{type:"button",onClick:se=>{se.stopPropagation(),l(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)}),r?.map(f=>C.jsxs("div",{className:Q.cn("flex shrink-0 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-3 w-0.5 shrink-0",style:{backgroundColor:f.color}}),C.jsx("span",{className:Q.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:f.label})]},f.id))]})}exports.Graph=vt;exports.GraphLegend=Ze;exports.VERTICAL_LINE_LABEL_EDGE_PADDING=ye;exports.getStepForwardValue=Oe;exports.getVerticalLineLabelStyle=He;exports.getVerticalLineTooltipContent=$e;exports.seriesIdentity=te;exports.visibleLogicalRangeFor=Ke;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),$=require("lightweight-charts"),g=require("react"),Y=require("./colors.cjs"),ct=require("../../hooks/use-media-query.cjs"),Q=require("../../utils/cn.cjs"),I=require("./default-config.cjs"),re=require("./formatters.cjs"),ut=require("./graph-current-value.cjs"),ft=require("./graph-tooltip.cjs"),ht=require("./plugins/vertical-line.cjs"),dt=require("./series-config.cjs"),Ke=require("./series-palette.cjs"),qe=require("./y-axis-scale.cjs");function pt(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(r,l,u.get?u:{enumerable:!0,get:()=>e[l]})}}return r.default=e,Object.freeze(r)}const ye=pt(g);function oe(e){return e.id??e.label}function $e({lastIndex:e,width:r,padLeft:l,padRight:u,paddingPx:h=I.AXIS_TIME_EDGE_PADDING_PX}){if(e<0)return null;const f=(l||u)&&r>0?h*Math.max(e,1)/r:0;return{from:l&&f!==0?-f:0,to:u?e+f:e}}function We(e,r,l){if(!l)return e.values().next().value;const u=e.get(l);if(u)return u;const h=r.find(f=>f.id===l||f.label===l);return h?e.get(oe(h)):void 0}class gt{_yTop;_yBottom;_color;constructor(r,l,u){this._yTop=r,this._yBottom=l,this._color=u}draw(r){r.useBitmapCoordinateSpace(l=>{const u=l.context,h=l.verticalPixelRatio,f=this._yTop===null?0:this._yTop*h,x=this._yBottom===null?l.bitmapSize.height:this._yBottom*h,R=Math.min(f,x),D=Math.max(f,x);u.fillStyle=this._color,u.fillRect(0,R,l.bitmapSize.width,D-R)})}}class mt{_source;_yTop=null;_yBottom=null;constructor(r){this._source=r}update(){const r=this._source.series;this._yTop=this._source.priceTop===void 0?null:r.priceToCoordinate(this._source.priceTop),this._yBottom=this._source.priceBottom===void 0?null:r.priceToCoordinate(this._source.priceBottom)}zOrder(){return"bottom"}renderer(){return new gt(this._yTop,this._yBottom,this._source.color)}}class bt{series;priceTop;priceBottom;color;_paneViews;constructor(r,l,u,h){this.series=r,this.priceTop=l,this.priceBottom=u,this.color=h,this._paneViews=[new mt(this)]}updateAllViews(){for(const r of this._paneViews)r.update()}paneViews(){return this._paneViews}}function St(e,r){switch(e){case $.LineStyle.Dotted:return[r,r];case $.LineStyle.Dashed:return[2*r,2*r];case $.LineStyle.LargeDashed:return[6*r,6*r];case $.LineStyle.SparseDotted:return[r,4*r];default:return[]}}class Ct{_y;_color;_lineWidth;_lineStyle;constructor(r,l,u,h){this._y=r,this._color=l,this._lineWidth=u,this._lineStyle=h}draw(r){r.useBitmapCoordinateSpace(l=>{if(this._y===null)return;const u=l.context,h=l.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(St(this._lineStyle,f)),u.beginPath(),u.moveTo(0,x),u.lineTo(l.bitmapSize.width,x),u.stroke(),u.restore()})}}class xt{_source;_y=null;constructor(r){this._source=r}update(){this._y=this._source.series.priceToCoordinate(this._source.price)}zOrder(){return"top"}renderer(){return new Ct(this._y,this._source.color,this._source.lineWidth,this._source.lineStyle)}}class vt{series;price;color;lineWidth;lineStyle;_paneViews;constructor(r,l,u,h,f){this.series=r,this.price=l,this.color=u,this.lineWidth=h,this.lineStyle=f,this._paneViews=[new xt(this)]}updateAllViews(){for(const r of this._paneViews)r.update()}paneViews(){return this._paneViews}}function He(e,r,l){const u=e.labelText??"",h=e.value,f=h===void 0?"":typeof h=="number"?r==="$"?`$${re.formatExactValue(h,void 0,l)}`:r==="%"?`${re.formatExactValue(h,void 0,l)}%`:re.formatExactValue(h,r!=="none"&&r!=="%"&&r!=="$"&&!re.isRatioUnit(r)?r:void 0,l):String(h);return{labelText:u,valueStr:f}}const _e=4;function Oe(e,r,l){const u={left:e,transform:"translateX(-50%)"};if(r<=0||!l||l<=0)return u;const h=l/2,f=_e+h,x=r-_e-h;return x<f?{left:r/2,transform:"translateX(-50%)"}:{left:Math.min(Math.max(e,f),x),transform:"translateX(-50%)"}}function Ze(e,r){for(let l=e.length-1;l>=0;l--)if(Number(e[l].time)<=r)return e[l].value;return 0}function yt({series:e,className:r,showLegend:l=!1,onUnselectSeries:u,xMeasureUnit:h="time",yMeasureUnit:f="token",optionsOverrides:x,verticalLineOptions:R,priceLineOptions:D,zoneOptions:F,currentValueDecimals:se,useSharedPriceScale:H=!1,dualYAxis:z=!1,defaultVisiblePriceScaleId:we="right",showCurrentValue:Qe=!0,graphTitle:pe,yScaleMin:Pe,yScaleMinMultiple:Re,visibleTimeFrom:le,disableZoom:Te=!1,hideDefaultTooltip:ge=!1}){const A=g.useRef(null),N=g.useRef(new Map),me=g.useRef(!1),Le=g.useRef(!0),Ne=g.useRef([]),ae=g.useRef(0),j=g.useRef(null),be=g.useRef(null),Ve=g.useRef(null),T=ct.useIsMobile(),ce=ye.useMemo(()=>e.flatMap(t=>t.data),[e]),Je=ye.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[ke,Se]=g.useState(()=>{if(!Je)return;const t=new Map;for(const a of e)a.data.length>0&&t.set(a.label,a.data[a.data.length-1]);return t}),[Ee,J]=g.useState(null),[Ie,Me]=g.useState([]),[Ue,De]=g.useState(0),Ae=g.useRef(new Map),[et,tt]=g.useState({}),[U,ot]=g.useState(0);g.useEffect(()=>{const t=()=>{try{if(j.current&&De(j.current.clientWidth),A.current&&j.current){const s=j.current.clientWidth,c=j.current.clientHeight;A.current.resize(s,c);try{ae.current=A.current.paneSize().height}catch{}}}catch{}},a=j.current,n=a?new ResizeObserver(t):null;return Ve.current=n,a&&n?.observe(a),()=>{a&&n?.unobserve(a),n?.disconnect(),Ve.current=null}},[]),g.useEffect(()=>{if(!be.current||me.current)return;const t=I.getDefaultOptions(),a=Y.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)"),n=$.createChart(be.current,{...t,leftPriceScale:{...t.leftPriceScale||{},visible:!1,textColor:a},rightPriceScale:{...t.rightPriceScale||{},visible:!T,textColor:a},...T&&{crosshair:{...t.crosshair,mode:$.CrosshairMode.Magnet}}});A.current=n,me.current=!0;try{ae.current=n.paneSize().height}catch{ae.current=0}return ot(s=>s+1),()=>{n.remove(),A.current=null,me.current=!1,N.current.clear()}},[T]),g.useEffect(()=>{const t=A.current;t&&t.applyOptions(Te?{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}})},[U,Te]),g.useEffect(()=>{const t=A.current;!t||!x||t.applyOptions(x)},[U,x]),g.useEffect(()=>{const t=A.current;if(!t||e.length===0)return;const n=e.filter(i=>i.data.length>0).length<=1?Pe:Re,s=h==="time"?re.getXFormatters(h,ce):re.getXFormatters(h),c=new Map(dt.resolvePriceScaleSides(e).map(({series:i,side:o})=>[i.label,o])),p=(i,o,d)=>{const{formatter:k,tickmarksFormatter:E,updateVisibleRange:B}=re.createAdaptiveYAxisFormatter(i,o,{yScaleMin:n});return{formatter:k,tickmarksFormatter:E,updateVisibleRange:B,labels:d}},m=[];if(z)for(const i of["left","right"]){const o=new Set,d=[];let k=f;for(const E of e)if(E.data.length!==0&&c.get(E.label)===i){o.size===0&&E.yMeasureUnit&&(k=E.yMeasureUnit),o.add(E.label);for(const B of E.data)d.push(B.value)}o.size>0&&m.push(p(d,k,o))}else{const i=ce.map(d=>d.value),o=new Set(e.filter(d=>d.data.length>0).map(d=>d.label));m.push(p(i,f,o))}Ne.current=m;const _=new Map;for(const i of m)for(const o of i.labels)_.set(o,i);const w=I.getDefaultOptions();t.applyOptions({localization:{...w.localization||{},timeFormatter:i=>s.timeFormatter(parseFloat(i),void 0)},timeScale:{...w.timeScale||{},...x?.timeScale,tickMarkFormatter:s.tickMarkFormatter,minBarSpacing:0}});const v=!z&&e.length>1&&!H,G=z?T:e.length>1&&!H||T,V=Y.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)");t.applyOptions({...z&&{defaultVisiblePriceScaleId:we},leftPriceScale:{...w.leftPriceScale||{},...x?.leftPriceScale,visible:z&&!T,textColor:V},rightPriceScale:{...w.rightPriceScale||{},...x?.rightPriceScale,visible:z?!T:!G,textColor:V}});const ee=new Set(N.current.keys()),q=new Set(e.map(oe));for(const i of ee)if(!q.has(i)){const o=N.current.get(i);o&&(t.removeSeries(o),N.current.delete(i))}const b=I.getDefaultSeries(),M=[];let L=0;const W=e.find(i=>i.data.length>0),y=new Map;if(D&&D.length>0)for(const i of D){if(!Number.isFinite(i.price))continue;const o=i.seriesLabel??W?.label;if(!o)continue;const d=y.get(o)??[];d.push(i.price),y.set(o,d)}if(F&&F.length>0)for(const i of F){const o=i.seriesLabel??W?.label;if(!o)continue;const d=y.get(o)??[];Number.isFinite(i.priceTop)&&d.push(i.priceTop),Number.isFinite(i.priceBottom)&&d.push(i.priceBottom),y.set(o,d)}for(let i=0;i<e.length;i++){const o=e[i],d=oe(o),k=Ke.getSeriesColorPalette(i),E=o.lineColor??o.color??k.line;let B,Z;if(o.lineColor??o.color)if(o.topColor&&o.bottomColor)B=o.topColor,Z=o.bottomColor;else if(o.topColor){const S=Y.generateColorsFromBase(E);B=o.topColor,Z=S.bottomColor}else if(o.bottomColor)B=Y.generateColorsFromBase(E).topColor,Z=o.bottomColor;else{const S=Y.generateColorsFromBase(E);B=S.topColor,Z=S.bottomColor}else B=o.topColor||k.top,Z=o.bottomColor||k.bottom;if(o.data.length===0){const S=N.current.get(d);S&&(t.removeSeries(S),N.current.delete(d));continue}const ue=o.data.length>0?Math.min(...o.data.map(S=>S.value)):0,he=o.data.length>0?Math.max(...o.data.map(S=>S.value)):0,rt=ue<0,nt=o.data.some(S=>S.value===0),it=!rt&&nt,Be=qe.pickMinMove(he-ue),Fe=z?o.priceScaleId??(L===0?"left":"right"):H||!v||L===0?"right":`scale-${L}`;v&&M.push({priceScaleId:Fe||"right",seriesIndex:L});const Ce=(H||!v)&&n!==void 0&&typeof n=="number",st=y.get(o.label)??[],lt=S=>{const P=S();if(P?.priceRange){Ce&&(P.priceRange.minValue=n);for(const K of st)K<P.priceRange.minValue&&(P.priceRange.minValue=K),K>P.priceRange.maxValue&&(P.priceRange.maxValue=K);const ie=Ce?n:it&&P.priceRange.minValue>=0?0:void 0,de=ae.current>0?ae.current:j.current?.clientHeight??0;if(de>0){const K=qe.niceAxisRange({min:P.priceRange.minValue,max:P.priceRange.maxValue,floor:ie,scaleHeightPx:de,fontSizePx:I.AXIS_FONT_SIZE,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,minMove:Be,edgePaddingPx:I.AXIS_EDGE_LABEL_PADDING_PX,edgePaddingTopPx:I.AXIS_TOP_LABEL_PADDING_PX});P.priceRange.minValue=K.min,P.priceRange.maxValue=K.max}P.margins={above:I.AXIS_TOP_LABEL_PADDING_PX,below:I.AXIS_EDGE_LABEL_PADDING_PX}}return P},ze=_.get(o.label)??m[0],Xe=ze.formatter,at=ze.tickmarksFormatter,xe={lineColor:E,topColor:B,bottomColor:Z,priceScaleId:Fe,...o.seriesType==="line"&&{lineStyle:o.lineStyle??$.LineStyle.Solid},priceFormat:{type:"custom",minMove:Be,formatter:Ce&&typeof n=="number"?S=>Xe(S<n?n:S):Xe,tickmarksFormatter:at},autoscaleInfoProvider:lt},Ge=o.seriesType==="line";let X=N.current.get(d);const ne=o.data.map(S=>({...S,time:S.time}));if(le!==void 0&&ne.length>0&&Number(ne[0].time)>le){const S=Number(ne[0].time),P=S-le,ie=86400,de=P>180*ie?7*ie:P>30*ie?ie:6*3600,K=[];for(let ve=le;ve<S;ve+=de)K.push({time:ve});ne.unshift(...K)}X&&X.seriesType()!==(Ge?"Line":"Area")&&(t.removeSeries(X),N.current.delete(d),X=void 0),X?(X.applyOptions(xe),X.setData(ne)):(Ge?X=t.addSeries($.LineSeries,{...b,...xe}):X=t.addSeries($.AreaSeries,{...b,...xe}),X.setData(ne),N.current.set(d,X)),L++}if(z)try{const i=t.priceScale("left"),o=t.priceScale("right"),d={visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,textColor:V,...x?.rightPriceScale};i?.applyOptions(d),o?.applyOptions(d)}catch{}else if(v&&M.length>0)for(const i of M)try{const o=t.priceScale(i.priceScaleId);o&&o.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,textColor:V})}catch(o){console.warn(`Failed to configure price scale ${i.priceScaleId} for series ${i.seriesIndex}:`,o)}else if(!v)try{const i=t.priceScale("right");i&&i.applyOptions({visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:I.AXIS_TICK_MARK_DENSITY,textColor:V,...x?.rightPriceScale})}catch{}n!==void 0&&!T&&(H||!v)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}});let O=0;if(ce.length>0){const i=ce.map(d=>Number(d.time)).filter(d=>Number.isFinite(d)),o=new Set(i).size-1;if(o>=0){const d=()=>{const k=t.timeScale();if(h!=="time"){k.applyOptions({fixLeftEdge:!0,fixRightEdge:!0}),k.setVisibleLogicalRange({from:0,to:o});return}const E=z&&!T,B=z?!T:!G,Z=!E,ue=!B;k.applyOptions({fixLeftEdge:!Z,fixRightEdge:!ue}),O=requestAnimationFrame(()=>{const he=$e({lastIndex:o,width:k.width(),padLeft:Z,padRight:ue});try{he&&k.setVisibleLogicalRange(he)}catch{k.fitContent()}})};try{d()}catch{try{t.timeScale().fitContent(),d()}catch{}}}}Le.current&&(Le.current=!1),x&&t.applyOptions(x);const te=new Map;for(const i of e)i.data.length>0&&te.set(i.label,i.data[i.data.length-1]);return Se(te.size>0?te:void 0),()=>cancelAnimationFrame(O)},[U,e,ce,h,f,T,H,z,we,Pe,Re,le,D,F,x]),g.useEffect(()=>{const t=A.current;if(!t||e.length===0)return;const a=e.length===1;let n;for(const c of e)if(c.data.length>0){n=c.data[c.data.length-1].time;break}if(!n)return;const s=c=>{const{time:p=n,seriesData:m,point:_}=c||{},w=e[0],v=w?N.current.get(oe(w)):void 0;if(!_||!p){const q=new Map;for(const b of e)b.data.length>0&&q.set(b.label,b.data[b.data.length-1]);if(Se(q.size>0?q:void 0),a||H||ge)J(null);else if(v&&n){const b=e[0];if(b&&b.data.length>0){const L=t.timeScale().timeToCoordinate(n),W=b.data[b.data.length-1].value,y=v.priceToCoordinate(W);L!==null&&y!==null&&J({x:L,y})}}return}const G=new Map;let V,ee=v;for(let q=0;q<e.length;q++){const b=e[q],M=N.current.get(oe(b));if(!M)continue;const L=m?.get(M),W=L&&"value"in L?L.value:void 0;let y;if(W!==void 0)y=W;else if(a){const O=Number(p),te=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;O<te?y=Number.NaN:y=b.data[b.data.length-1]?.value??0}else{const O=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;if(Number(p)<O)continue;y=Ze(b.data,Number(p))}Number.isNaN(y)||(V===void 0&&(V=y,ee=M),G.set(b.label,{value:y,time:p}))}if(Se(G),V!==void 0&&ee){const b=t.timeScale().timeToCoordinate(p),M=ee.priceToCoordinate(V);if(b!==null&&M!==null){const L=j.current;if(L){const W=L.querySelector(".LightweightChart");if(W){const y=W.getBoundingClientRect(),O=L.getBoundingClientRect(),te=b+(y.left-O.left),i=M+(y.top-O.top);J({x:te,y:i})}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),!a&&!H&&!ge&&requestAnimationFrame(()=>{const c=e[0],p=c?N.current.get(oe(c)):void 0;if(p&&n&&c.data.length>0){const _=t.timeScale().timeToCoordinate(n),w=c.data[c.data.length-1].value,v=p.priceToCoordinate(w);_!==null&&v!==null&&J({x:_,y:v})}}),()=>{t.unsubscribeCrosshairMove(s),T&&t.unsubscribeClick(s)}},[e,H,T,ge]),g.useEffect(()=>{const t=A.current;if(!t||e.length===0)return;const a=t.timeScale(),n=()=>{const s=Ne.current;if(s.length===0)return;const c=a.getVisibleRange();if(!c)return;const p=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 G of v.data){const V=Number(G.time);V>=p&&V<=m&&w.push(G.value)}w.length>0&&_.updateVisibleRange(w)}};return a.subscribeVisibleLogicalRangeChange(n),()=>{a.unsubscribeVisibleLogicalRangeChange(n)}},[e]),g.useEffect(()=>{const t=A.current,a=Array.from(N.current.values()),n=[];if(t&&a.length>0&&R){const s=I.getDefaultVerticalLine(),c=a[0];for(const p of R){const m={...s,...p.options||{}};m.color&&(m.color=Y.resolveCSSColor(m.color,m.color));const _=new ht.VertLine(t,c,p.xCoordinate,m);c.attachPrimitive(_),n.push(_)}}return()=>{if(a.length>0){const s=a[0];for(const c of n)try{s.detachPrimitive(c)}catch{}}}},[R,e,U]),g.useEffect(()=>{const t=[],a=[];if(D&&D.length>0){const n=Y.resolveCSSColor("hsl(var(--destructive))","rgb(239, 68, 68)");for(const s of D){if(!Number.isFinite(s.price))continue;const c=We(N.current,e,s.seriesLabel);if(!c)continue;const p=s.color?Y.resolveCSSColor(s.color,s.color):n,m=s.lineWidth??1,_=s.lineStyle??$.LineStyle.Dashed,w=c.createPriceLine({price:s.price,color:p,lineWidth:m,lineStyle:_,axisLabelVisible:s.axisLabelVisible??!0,title:s.title??""});t.push({series:c,line:w});const v=new vt(c,s.price,p,m,_);c.attachPrimitive(v),a.push({series:c,primitive:v})}}return()=>{for(const{series:n,primitive:s}of a)try{n.detachPrimitive(s)}catch{}for(const{series:n,line:s}of t)try{n.removePriceLine(s)}catch{}}},[D,e,U]),g.useEffect(()=>{const t=[];if(F&&F.length>0){const a="rgba(239, 68, 68, 0.12)";for(const n of F){const s=We(N.current,e,n.seriesLabel);if(!s)continue;const c=n.color?Y.resolveCSSColor(n.color,a):a,p=new bt(s,n.priceTop,n.priceBottom,c);s.attachPrimitive(p),t.push({series:s,zone:p})}}return()=>{for(const{series:a,zone:n}of t)try{a.detachPrimitive(n)}catch{}}},[F,e,U]),g.useEffect(()=>{const t=A.current;if(!t||!R?.length){Me([]);return}const a=()=>{const c=t.timeScale(),p=R.map(m=>c.timeToCoordinate(m.xCoordinate)??null);Me(p),j.current&&De(j.current.clientWidth)};a();const n=t.timeScale(),s=()=>{a()};return n.subscribeVisibleLogicalRangeChange(s),()=>{n.unsubscribeVisibleLogicalRangeChange(s)}},[R,e,U]),g.useLayoutEffect(()=>{tt(t=>{const a={};let n=!1;for(const[s,c]of Ae.current){if(!c)continue;const p=c.offsetWidth;a[s]=p,t[s]!==p&&(n=!0)}return Object.keys(t).length!==Object.keys(a).length&&(n=!0),n?a:t})});const fe=e.length===1,je=ye.useMemo(()=>{if(fe&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[fe,e]);return C.jsxs("div",{ref:j,className:Q.cn("relative z-[1] w-full h-full overflow-hidden p-0",r),children:[pe!=null&&pe!==!1&&fe?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:pe})}):Qe&&fe&&je&&C.jsx(ut.GraphCurrentValue,{point:je,xMeasureUnit:h,yMeasureUnit:f,decimals:se}),ke&&Ee&&C.jsx(ft.GraphTooltip,{points:ke,xMeasureUnit:h,yMeasureUnit:f,series:e,position:Ee,containerRef:j,decimals:se}),l&&C.jsx(Ye,{series:e,onUnselect:u}),R&&R.length>0&&Ie.length===R.length&&C.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:R.map((t,a)=>{const n=Ie[a],s=t.options??{};if(n===null)return null;const{labelText:c,valueStr:p}=He(s,f,se),m=s.tooltipText??"";if(!(c||p||m))return null;const w=s.labelBackgroundColor??s.color??"hsl(var(--background))",v=s.labelTextColor??"hsl(var(--foreground))",G=`${String(t.xCoordinate)}-${c}-${m}`,V=Oe(n,Ue,et[a]);return C.jsxs("div",{ref:ee=>{Ae.current.set(a,ee)},className:Q.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:{...V,backgroundColor:w,color:v},children:[c&&C.jsx("span",{className:"block",children:c}),p&&C.jsx("span",{className:Q.cn("block",c&&"mt-0.5"),children:p}),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})]},G)})}),C.jsx("div",{ref:be,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ye({series:e,markers:r,onUnselect:l,inline:u=!1}){const h=e.every(f=>f.data.length===0);return C.jsxs("div",{className:Q.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 R=Ke.getSeriesColorPalette(x),D=(f.lineColor??f.color)||R.line,F=!h&&f.data.length===0;return C.jsxs("div",{className:Q.cn("flex shrink-0 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:Q.cn("shrink-0",u?"size-2 rounded-full":"h-3 w-3 rounded-sm"),style:{backgroundColor:D}}),C.jsxs("span",{className:Q.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:[f.label,F&&" (no data)"]}),l&&C.jsx("button",{type:"button",onClick:se=>{se.stopPropagation(),l(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)}),r?.map(f=>C.jsxs("div",{className:Q.cn("flex shrink-0 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-3 w-0.5 shrink-0",style:{backgroundColor:f.color}}),C.jsx("span",{className:Q.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:f.label})]},f.id))]})}exports.Graph=yt;exports.GraphLegend=Ye;exports.VERTICAL_LINE_LABEL_EDGE_PADDING=_e;exports.getStepForwardValue=Ze;exports.getVerticalLineLabelStyle=Oe;exports.getVerticalLineTooltipContent=He;exports.seriesIdentity=oe;exports.visibleLogicalRangeFor=$e;
@@ -1 +1 @@
1
- "use strict";const e={"errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no open Positions. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.infiniteScrollWrapper.showMore":"Show more","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.sdkStatus.connecting":"Connecting…","components.sdkStatus.connected":"Connected","components.sdkStatus.disconnected":"Not connected","components.notificationCenter.empty":"No notifications yet","components.notificationCenter.requests":"Requests","components.notificationCenter.recent":"Recent","components.notificationCenter.clear":"Clear all","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.tipWindow.title":"Tip","components.value.accruing":"Averaged data is still being computed and will be available shortly.","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.totalAPY":"Overall APY","components.yieldBreakdown.titleNetAtLeverage":"Net APY at {leverage}× Leverage","components.yieldBreakdown.titleNetAtLeverage7d":"Net APY (7d) at {leverage}× Leverage","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.exposure":"Exposure","components.poolAssetsTable.cap":"Cap","components.poolAssetsTable.capUtilization":"Cap Utilization","components.poolAssetsTable.capBelowExposure.tip":"The curator has lowered the cap below current exposure. Exposure cannot be increased.","components.poolTable.line.rwa.tip":"This is RWA market.","components.strategiesTable.line.name.disabled":"This Leverage Opportunity is currently not available","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This Leverage Opportunity 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 Position '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 Position'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 Position 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":"Lend","components.positionTypeBadge.strategy":"Leverage","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.poolApyBreakdownCard.tokenIncentiveApy":"{symbol} Incentive APY","components.poolApyBreakdownCard.tokenIncentiveApy7d":"{symbol} 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 Position value or Debt amount.","components.transactionConfirm.previewLoading":"Parsing transaction…","components.transactionConfirm.previewErrorTitle":"Preview error"};module.exports=e;
1
+ "use strict";const e={"errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no open Positions. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.infiniteScrollWrapper.showMore":"Show more","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.sdkStatus.connecting":"Connecting…","components.sdkStatus.connected":"Connected","components.sdkStatus.disconnected":"Not connected","components.notificationCenter.empty":"No notifications yet","components.notificationCenter.requests":"Requests","components.notificationCenter.recent":"Recent","components.notificationCenter.clear":"Clear all","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.tipWindow.title":"Tip","components.value.accruing":"Averaged data is still being computed and will be available shortly.","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.totalAPY":"Overall APY","components.yieldBreakdown.titleNetAtLeverage":"Net APY at {leverage}× Leverage","components.yieldBreakdown.titleNetAtLeverage7d":"Net APY (7d) at {leverage}× Leverage","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.exposure":"Exposure","components.poolAssetsTable.cap":"Cap","components.poolAssetsTable.capUtilization":"Cap Utilization","components.poolAssetsTable.capBelowExposure.tip":"The curator has lowered the cap below current exposure. Exposure cannot be increased.","components.poolTable.line.rwa.tip":"This market is exposed to RWA assets.","components.strategiesTable.line.name.disabled":"This Leverage Opportunity is currently not available","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This Leverage Opportunity 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 Position '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 Position'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 Position 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":"Lend","components.positionTypeBadge.strategy":"Leverage","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.poolApyBreakdownCard.tokenIncentiveApy":"{symbol} Incentive APY","components.poolApyBreakdownCard.tokenIncentiveApy7d":"{symbol} 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 Position value or Debt amount.","components.transactionConfirm.previewLoading":"Parsing transaction…","components.transactionConfirm.previewErrorTitle":"Preview error"};module.exports=e;
@@ -1,7 +1,8 @@
1
1
  const t = {
2
2
  root: "review-button-root",
3
3
  error: "review-button-error",
4
- tip: "review-button-tip"
4
+ tip: "review-button-tip",
5
+ solution: "review-button-solution"
5
6
  };
6
7
  export {
7
8
  t as ReviewButtonTest
@@ -1,39 +1,52 @@
1
- import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
- import { Stack as l } from "../stack/stack.js";
3
- import { Button as n } from "../../buttons/button/button.js";
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import { Stack as s } from "../stack/stack.js";
3
+ import { Button as m } from "../../buttons/button/button.js";
4
4
  import { TipCard as p } from "../../tip-card/tip-card.js";
5
5
  import { FormattedMessageTyped as e } from "../../typed-intl/index.js";
6
- import { ReviewButtonTest as o } from "./constants.js";
7
- function x({
8
- disabled: a,
9
- error: r,
10
- tip: i,
11
- onClick: m,
12
- label: s = "dialogs.common.review"
6
+ import { ReviewButtonTest as r } from "./constants.js";
7
+ function w({
8
+ disabled: d,
9
+ error: o,
10
+ tip: a,
11
+ solution: i,
12
+ onClick: n,
13
+ label: c = "dialogs.common.review"
13
14
  }) {
14
- return /* @__PURE__ */ d(l, { gap: "sm", children: [
15
- i ? /* @__PURE__ */ t(
15
+ return /* @__PURE__ */ l(s, { gap: "sm", children: [
16
+ a ? /* @__PURE__ */ t(
16
17
  p,
17
18
  {
18
19
  textColor: "light",
19
20
  attributeColor: "alert",
20
21
  className: "w-full",
21
- "data-testid": o.tip,
22
- children: /* @__PURE__ */ t(e, { ...i })
22
+ "data-testid": r.tip,
23
+ children: /* @__PURE__ */ l(s, { gap: "sm", align: "start", children: [
24
+ /* @__PURE__ */ t(e, { ...a }),
25
+ i ? /* @__PURE__ */ t(
26
+ m,
27
+ {
28
+ variant: "outline",
29
+ size: "sm",
30
+ onClick: i.onClick,
31
+ "data-testid": r.solution,
32
+ children: /* @__PURE__ */ t(e, { ...i.label })
33
+ }
34
+ ) : null
35
+ ] })
23
36
  }
24
37
  ) : null,
25
38
  /* @__PURE__ */ t(
26
- n,
39
+ m,
27
40
  {
28
- disabled: a,
29
- onClick: m,
30
- "data-testid": o.root,
31
- children: r ? /* @__PURE__ */ t("span", { "data-testid": o.error, children: /* @__PURE__ */ t(e, { messageId: r }) }) : /* @__PURE__ */ t(e, { messageId: s })
41
+ disabled: d,
42
+ onClick: n,
43
+ "data-testid": r.root,
44
+ children: o ? /* @__PURE__ */ t("span", { "data-testid": r.error, children: /* @__PURE__ */ t(e, { messageId: o }) }) : /* @__PURE__ */ t(e, { messageId: c })
32
45
  }
33
46
  )
34
47
  ] });
35
48
  }
36
49
  export {
37
- x as ReviewButton,
38
- o as ReviewButtonTest
50
+ w as ReviewButton,
51
+ r as ReviewButtonTest
39
52
  };