@gearbox-protocol/permissionless-ui 1.26.6 → 1.26.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/liquidation/liquidation-assets-table/liquidation-assets-table.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/esm/components/graph/formatters.js +3 -3
- package/dist/esm/components/liquidation/liquidation-assets-table/liquidation-assets-table.js +1 -1
- package/dist/esm/components/trading-view/trading-view.js +122 -122
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("lightweight-charts"),D=require("luxon"),u=require("../../utils/format-number.cjs"),{MIN_DISPLAY_THRESHOLD:g,MAX_EXPONENTIAL_THRESHOLD:b}=u.FORMAT_CONSTANTS,O=(t,e,a="full")=>{if(u.isBelowDisplayThreshold(t))return e?`<${g}${e}`:`<${g}`;if(t===0)return e?`0${e}`:"0";const n=u.formatNumberWithSuffix(t,{maxExponentialThreshold:b,minimumFractionDigits:0,maximumFractionDigits:a==="short"?1:0,format:a,adaptiveDecimals:a==="short"});return e?`${n}${e}`:n},X=2,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("lightweight-charts"),D=require("luxon"),u=require("../../utils/format-number.cjs"),{MIN_DISPLAY_THRESHOLD:g,MAX_EXPONENTIAL_THRESHOLD:b}=u.FORMAT_CONSTANTS,O=(t,e,a="full")=>{if(u.isBelowDisplayThreshold(t))return e?`<${g}${e}`:`<${g}`;if(t===0)return e?`0${e}`:"0";const n=u.formatNumberWithSuffix(t,{maxExponentialThreshold:b,minimumFractionDigits:0,maximumFractionDigits:a==="short"?1:0,format:a,adaptiveDecimals:a==="short"});return e?`${n}${e}`:n},X=2,H=(t,e)=>{if(u.isBelowDisplayThreshold(t))return e?`<${g}${e}`:`<${g}`;if(t===0)return e?`0${e}`:"0";const a=u.toSignificantDigits(t,X);return e?`${a}${e}`:a},w=4,V=t=>{if(u.isBelowDisplayThreshold(t))return`<${g}`;if(t===0)return"0";const e=Math.round(t),a=Math.abs(t-e);return a>0&&a<.01?t.toFixed(12).replace(/0+$/,"").replace(/\.$/,""):u.toSignificantDigits(t,w)},G=(t,e)=>{if(u.isBelowDisplayThreshold(t))return e?`<${g} ${e}`:`<${g}`;if(t===0)return e?`0 ${e}`:"0";const a=Number.isInteger(t),n=Math.abs(t),c=a&&n>=1e3,s=Math.round(t),o=Math.abs(t-s);if(o>0&&o<.01&&!c){const $=t.toFixed(12).replace(/0+$/,"").replace(/\.$/,"");return e?`${$} ${e}`:$}const F=u.formatNumberWithSuffix(t,{maxExponentialThreshold:b,minimumFractionDigits:a?0:2,maximumFractionDigits:c?1:a?0:2,format:c?"short":"full",adaptiveDecimals:c});return e?`${F} ${e}`:F},N={"%":H,$:O,token:G,none:V},P=t=>N[t]||N.token;function U(t,e,a=4){if(t===0)return e?`0 ${e}`:"0";const n=e&&Math.abs(t)>=1e3?0:a,c=t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:n});return e?`${c} ${e}`:c}function C(t,e,a){const n=a?.yScaleMin;let c=t.length>0?Math.min(...t):0,s=t.length>0?Math.max(...t):0,o=[];const d=()=>{const r=s-c,i=(c+s)/2;let f=1,m="";i>=1e9?(f=1e9,m="B"):i>=1e6?(f=1e6,m="M"):i>=1e3&&(f=1e3,m="K");const x=r/10/f;let l=1;if(x>0){const k=Math.floor(Math.log10(x));l=Math.max(1,-k),l=Math.min(l,4)}return{scale:f,suffix:m,decimals:l}},F=(r,i,f)=>{const m=i>1?r/i:r,h=Math.abs(m)>=1?1:4;return i>1?`${(r/i).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:h,useGrouping:!1})}${f}`:r.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:h,useGrouping:!1})},$=.02,L=r=>{if(n!==void 0&&r<n)return"";if(r===0)return"0";const{scale:i,suffix:f,decimals:m}=d(),h=s-c,S=h>0?o.filter(M=>Math.abs(M)>=h*$):o,l=(h>0?h/10:0)*.05,k=Math.abs(r)*1e-10||1e-10;if(S.some(M=>Math.abs(M-r)<k))return F(r,i,f);if(S.length>0&&l>0){const M=S.reduce((p,E)=>Math.abs(E-r)<Math.abs(p-r)?E:p);if(Math.abs(r-M)<l)return F(M,i,f)}const R=i>1?r/i:r,A=Math.abs(R)>=1?Math.min(1,m):m;return i>1?`${(r/i).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:A,useGrouping:!1})}${f}`:r.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:A,useGrouping:!1})};return{formatter:r=>L(r),tickmarksFormatter:r=>{const i=new Set;return r.map(f=>{const m=L(f);return!m||i.has(m)?"":(i.add(m),m)})},updateVisibleRange:r=>{r.length>0&&(c=Math.min(...r),s=Math.max(...r))},updateLastValues:r=>{o=[...r]}}}const I=t=>D.DateTime.fromSeconds(Number(t)).toFormat("dd/LL/yyyy HH:mm"),Y=t=>D.DateTime.fromSeconds(Number(t)).toFormat("HH:mm"),B=(t,e)=>H(Number(t),e),_={time:I,"%":B};function W(t){const e=new Map;return(a,n,c)=>{const s=D.DateTime.fromSeconds(Number(a));let o;if(t===0)o=s.toFormat("HH:mm");else switch(n){case T.TickMarkType.Year:o=s.toFormat("yyyy");break;case T.TickMarkType.Month:o=s.toFormat("MMM yy");break;case T.TickMarkType.DayOfMonth:o=t>365?s.toFormat("dd MMM yy"):s.toFormat("dd MMM");break;case T.TickMarkType.Time:case T.TickMarkType.TimeWithSeconds:o=s.toFormat("HH:mm");break;default:o=s.toFormat("dd MMM")}let d=e.get(n);return d||(d=new Set,e.set(n,d)),d.has(o)?" ":(d.add(o),o)}}const y=(t,e)=>{if(t==="time"&&e&&e.length>0){const n=D.DateTime.fromSeconds(Number(e[0].time)),c=D.DateTime.fromSeconds(Number(e[e.length-1].time)),s=n.hasSame(c,"day"),o=s?0:Math.ceil(c.diff(n,"days").days);return{timeFormatter:s?Y:I,tickMarkFormatter:W(o)}}const a=_[t]||_.time;return{timeFormatter:a,tickMarkFormatter:n=>a(n,void 0)}},q=(t,e)=>y(t,e).timeFormatter;exports.createAdaptiveYAxisFormatter=C;exports.formatExactValue=U;exports.getXFormatter=q;exports.getXFormatters=y;exports.getYFormatter=P;
|
package/dist/cjs/components/liquidation/liquidation-assets-table/liquidation-assets-table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@gearbox-protocol/sdk"),p=require("react"),b=require("../../token-symbol/token-symbol.cjs"),s=require("../../typed-intl/index.cjs"),j=require("../../../hooks/use-media-query.cjs"),o=require("../../../utils/cn.cjs");function y({tokensList:r,graphParams:l,data:a,prices:n,editedPrices:c}){const{fixedBalances:i}=l,u=p.useMemo(()=>m.AssetUtils.constructAssetRecord(i),[i]),x=j.useIsMobile();return!a||!a.length?e.jsx("div",{className:"w-full flex items-center justify-center py-8 text-sm text-muted-foreground",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.noData",defaultMessage:"No data"})}):e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center","h-7 sm:h-8 md:h-[30px]","relative after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.asset"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.currentPrice"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.modelPrice"})})]}),a.map((t,f,g)=>{const h=g.length-1===f;return e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center relative","h-12 sm:h-14 md:h-[51px]",!h&&"after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left min-w-0",children:e.jsx(b.TokenSymbol,{size:x?18:24,token:r[t.token],showSymbol:!0,maxLength:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@gearbox-protocol/sdk"),p=require("react"),b=require("../../token-symbol/token-symbol.cjs"),s=require("../../typed-intl/index.cjs"),j=require("../../../hooks/use-media-query.cjs"),o=require("../../../utils/cn.cjs");function y({tokensList:r,graphParams:l,data:a,prices:n,editedPrices:c}){const{fixedBalances:i}=l,u=p.useMemo(()=>m.AssetUtils.constructAssetRecord(i),[i]),x=j.useIsMobile();return!a||!a.length?e.jsx("div",{className:"w-full flex items-center justify-center py-8 text-sm text-muted-foreground",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.noData",defaultMessage:"No data"})}):e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center","h-7 sm:h-8 md:h-[30px]","relative after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.asset"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.currentPrice"})}),e.jsx("div",{className:"text-right text-xs sm:text-sm font-medium text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.modelPrice"})})]}),a.map((t,f,g)=>{const h=g.length-1===f;return e.jsxs("div",{className:o.cn("grid w-full px-3 sm:px-4 gap-1 sm:gap-2 items-center relative","h-12 sm:h-14 md:h-[51px]",!h&&"after:absolute after:bottom-0 after:left-2 sm:after:left-3 after:right-2 sm:after:right-3 after:h-px after:border-b after:border-border"),style:{gridTemplateColumns:"1fr 1fr 1fr"},children:[e.jsx("div",{className:"text-left min-w-0",children:e.jsx(b.TokenSymbol,{size:x?18:24,token:r[t.token],showSymbol:!0,maxLength:12,className:"gap-1.5 sm:gap-2"})}),e.jsxs("div",{className:"text-right text-xs sm:text-sm md:text-base truncate",children:["$",d(n[t.token])]}),e.jsx("div",{className:"text-right min-w-0",children:u[t.token]?e.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:e.jsx(s.FormattedMessageTyped,{messageId:"components.creditSessionDetailedLiquidation.table.seeGraph"})}):e.jsxs("span",{className:"text-xs sm:text-sm md:text-base text-muted-foreground truncate",children:["$",d(c[t.token]||n[t.token])]})})]},t.token)})]})}function d(r){return(Number(r||0n)/Number(m.PRICE_DECIMALS)).toFixed(2)}exports.LiquidationModellingAssetsTable=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),re=require("sonner"),ne=require("../../hooks/use-media-query.cjs");require("@gearbox-protocol/sdk");const oe=require("../../utils/cn.cjs");require("luxon");require("../../utils/z-index.cjs");const ie=require("../buttons/range-buttons/range-buttons.cjs"),j=require("../graph/graph.cjs"),se=require("../graph/graph-view.cjs"),le=require("./graph-dropdown.cjs"),ce=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Expand fullscreen",children:[o.jsx("title",{children:"Expand fullscreen"}),o.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"})]}),ue=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Exit fullscreen",children:[o.jsx("title",{children:"Exit fullscreen"}),o.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"})]}),q="permissionless-ui:tradingview-series-colors:";function E(e){if(typeof window>"u"||!window.localStorage)return new Map;try{const t=window.localStorage.getItem(q+e);if(!t)return new Map;const c=JSON.parse(t);return c==null||typeof c!="object"?new Map:new Map(Object.entries(c).filter(([,r])=>typeof r=="number"&&r>=0&&r<j.DEFAULT_SERIES_COLORS.length))}catch{return new Map}}function ae(e,t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(q+e,JSON.stringify(Object.fromEntries(t)))}catch{}}function k(e,t){if(t.size===0)return;const c=E(e);for(const[r,b]of t)c.set(r,b);ae(e,c)}function de({data:e,yMeasureUnit:t,height:c=306,defaultGraph:r,onGraphSelected:b,graphs:m,isMultipleSelect:N,range:T,rangeList:M,setRange:V,onGraphExpanded:y,isGraphExpanded:F,onUnselectSeries:B,graphsWithNoData:D,loadingGraphs:z,noDataMessage:I="No data available for this graph",currentValueDecimals:W,containerClassName:H,useSharedPriceScale:J,showCurrentValue:$,yScaleMin:Q,yScaleMinMultiple:X,seriesColorPersistenceKey:u,...Y}){const v=x.useMemo(()=>Array.isArray(e)?e:e?[e]:[],[e]),R=x.useMemo(()=>Array.isArray(e)&&e.length>1,[e]),C=ne.useIsMobile(),Z=x.useCallback((w,p)=>{re.toast.error(I)},[I]),U=x.useMemo(()=>{if(t)return Array.isArray(t)?t[0]:t},[t]),P=(!C&&y||M.length>0||b&&m&&r)&&o.jsxs("div",{className:"z-10 w-full flex flex-row flex-wrap sm:flex-nowrap items-center gap-2",children:[o.jsx("div",{children:b&&m&&r&&o.jsx(le.GraphDropdown,{onSelected:b,items:m,defaultItem:r,multiple:N,graphsWithNoData:D,loadingGraphs:z,onNoDataSelected:Z})}),o.jsxs("div",{className:"flex flex-row flex-nowrap justify-start sm:justify-end items-center flex-1",children:[o.jsx(ie.RangeButtons,{range:T,rangeList:M,setRange:V}),!C&&y&&o.jsx("button",{type:"button",className:"px-2.5 py-1.5 flex min-w-[44px] min-h-[26px] justify-center items-center text-xs leading-[14px] font-medium text-center rounded-md border cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring bg-muted border-muted text-muted-foreground hover:border-secondary ml-1.5",onClick:y,children:F?o.jsx(ue,{size:16}):o.jsx(ce,{size:16})})]})]}),s=x.useRef(new Map),f=x.useRef(0),L=x.useRef(!1);if(m&&m.length>0&&!L.current){L.current=!0;const w=u?E(u):new Map,p=String(m[0].value);s.current.set(p,0),f.current=1;for(let n=1;n<m.length;n++){const a=String(m[n].value);if(s.current.has(a))continue;const h=w.get(a)??n;s.current.set(a,h),f.current=Math.max(f.current,h+1)}u&&k(u,s.current)}const K=x.useMemo(()=>{const w=Array.isArray(t)?t:void 0;if(u){const n=E(u);for(const[a,g]of n)s.current.has(a)||(s.current.set(a,g),f.current=Math.max(f.current,g+1))}const p=v.map((n,a)=>{const g=n?.title||`Series ${a+1}`,h=r!=null?Array.isArray(r)?r[0]?.value??r[0]:typeof r=="object"&&"value"in r?r.value:r:null,A=v.length===1?h!=null?String(h):"single":n?.id||g;if(!s.current.has(A)){const i=new Set(Array.from(s.current.values()));let l=f.current;for(let d=0;d<j.DEFAULT_SERIES_COLORS.length;d++){const S=(f.current+d)%j.DEFAULT_SERIES_COLORS.length;if(!i.has(S)){l=S;break}}s.current.set(A,l),f.current=l+1}const ee=s.current.get(A)??0,_=j.getSeriesColorPalette(ee),te=[...n?.data||[]].sort((i,l)=>{const d=typeof i.time=="number"?i.time:Number(i.time),S=typeof l.time=="number"?l.time:Number(l.time);return d-S}).reduce((i,l)=>{const d=l.time;return i.length===0||i[i.length-1].time!==d?i.push({time:d,value:l.value}):i[i.length-1]={time:d,value:l.value},i},[]),O=n?.lineColor??n?.color??void 0;return{data:te,label:g,yMeasureUnit:w?.[a]??(Array.isArray(t)?void 0:t),...O!=null?{lineColor:O,...n?.topColor!=null&&{topColor:n.topColor},...n?.bottomColor!=null&&{bottomColor:n.bottomColor}}:{color:_.line,topColor:_.top,bottomColor:_.bottom}}});return u&&s.current.size>0&&k(u,s.current),p},[v,r,t,u]),G=R&&v.length>0?v.some(w=>!w):!e;return o.jsx("div",{style:{width:"100%",height:c?`${c}px`:void 0},className:"w-full",children:o.jsx(se.GraphViewWithData,{series:K,loading:G,toolbar:P,size:c?"full":"default",containerClassName:oe.cn("h-full",H),showLegend:R,onUnselectSeries:B,yMeasureUnit:U,currentValueDecimals:W,useSharedPriceScale:J,showCurrentValue:$,yScaleMin:Q,yScaleMinMultiple:X,...Y})})}exports.TradingView=de;
|
|
@@ -55,11 +55,11 @@ const { MIN_DISPLAY_THRESHOLD: g, MAX_EXPONENTIAL_THRESHOLD: R } = U, V = (t, e,
|
|
|
55
55
|
function et(t, e, n = 4) {
|
|
56
56
|
if (t === 0)
|
|
57
57
|
return e ? `0 ${e}` : "0";
|
|
58
|
-
const a = t.toLocaleString("en-US", {
|
|
58
|
+
const a = e && Math.abs(t) >= 1e3 ? 0 : n, c = t.toLocaleString("en-US", {
|
|
59
59
|
minimumFractionDigits: 0,
|
|
60
|
-
maximumFractionDigits:
|
|
60
|
+
maximumFractionDigits: a
|
|
61
61
|
});
|
|
62
|
-
return e ? `${
|
|
62
|
+
return e ? `${c} ${e}` : c;
|
|
63
63
|
}
|
|
64
64
|
function rt(t, e, n) {
|
|
65
65
|
const a = n?.yScaleMin;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { toast as
|
|
4
|
-
import { useIsMobile as
|
|
1
|
+
import { jsxs as S, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as y, useCallback as ne, useRef as M } from "react";
|
|
3
|
+
import { toast as ie } from "sonner";
|
|
4
|
+
import { useIsMobile as le } from "../../hooks/use-media-query.js";
|
|
5
5
|
import "@gearbox-protocol/sdk";
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as se } from "../../utils/cn.js";
|
|
7
7
|
import "luxon";
|
|
8
8
|
import "../../utils/z-index.js";
|
|
9
|
-
import { RangeButtons as
|
|
10
|
-
import { DEFAULT_SERIES_COLORS as
|
|
11
|
-
import { GraphViewWithData as
|
|
12
|
-
import { GraphDropdown as
|
|
13
|
-
const
|
|
9
|
+
import { RangeButtons as ce } from "../buttons/range-buttons/range-buttons.js";
|
|
10
|
+
import { DEFAULT_SERIES_COLORS as E, getSeriesColorPalette as ue } from "../graph/graph.js";
|
|
11
|
+
import { GraphViewWithData as me } from "../graph/graph-view.js";
|
|
12
|
+
import { GraphDropdown as fe } from "./graph-dropdown.js";
|
|
13
|
+
const de = ({ size: e = 16 }) => /* @__PURE__ */ S(
|
|
14
14
|
"svg",
|
|
15
15
|
{
|
|
16
16
|
width: e,
|
|
@@ -23,11 +23,11 @@ const ae = ({ size: e = 16 }) => /* @__PURE__ */ y(
|
|
|
23
23
|
strokeLinejoin: "round",
|
|
24
24
|
"aria-label": "Expand fullscreen",
|
|
25
25
|
children: [
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ l("title", { children: "Expand fullscreen" }),
|
|
27
|
+
/* @__PURE__ */ l("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" })
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
|
-
),
|
|
30
|
+
), ae = ({ size: e = 16 }) => /* @__PURE__ */ S(
|
|
31
31
|
"svg",
|
|
32
32
|
{
|
|
33
33
|
width: e,
|
|
@@ -40,158 +40,158 @@ const ae = ({ size: e = 16 }) => /* @__PURE__ */ y(
|
|
|
40
40
|
strokeLinejoin: "round",
|
|
41
41
|
"aria-label": "Exit fullscreen",
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ l("title", { children: "Exit fullscreen" }),
|
|
44
|
+
/* @__PURE__ */ l("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" })
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
|
-
),
|
|
48
|
-
function
|
|
47
|
+
), F = "permissionless-ui:tradingview-series-colors:";
|
|
48
|
+
function j(e) {
|
|
49
49
|
if (typeof window > "u" || !window.localStorage)
|
|
50
50
|
return /* @__PURE__ */ new Map();
|
|
51
51
|
try {
|
|
52
|
-
const t = window.localStorage.getItem(
|
|
52
|
+
const t = window.localStorage.getItem(F + e);
|
|
53
53
|
if (!t) return /* @__PURE__ */ new Map();
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
Object.entries(
|
|
57
|
-
([,
|
|
54
|
+
const c = JSON.parse(t);
|
|
55
|
+
return c == null || typeof c != "object" ? /* @__PURE__ */ new Map() : new Map(
|
|
56
|
+
Object.entries(c).filter(
|
|
57
|
+
([, o]) => typeof o == "number" && o >= 0 && o < E.length
|
|
58
58
|
)
|
|
59
59
|
);
|
|
60
60
|
} catch {
|
|
61
61
|
return /* @__PURE__ */ new Map();
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function we(e, t) {
|
|
65
65
|
if (!(typeof window > "u" || !window.localStorage))
|
|
66
66
|
try {
|
|
67
67
|
window.localStorage.setItem(
|
|
68
|
-
|
|
68
|
+
F + e,
|
|
69
69
|
JSON.stringify(Object.fromEntries(t))
|
|
70
70
|
);
|
|
71
71
|
} catch {
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function z(e, t) {
|
|
75
75
|
if (t.size === 0) return;
|
|
76
|
-
const
|
|
77
|
-
for (const [
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
const c = j(e);
|
|
77
|
+
for (const [o, p] of t)
|
|
78
|
+
c.set(o, p);
|
|
79
|
+
we(e, c);
|
|
80
80
|
}
|
|
81
81
|
function Ne({
|
|
82
82
|
data: e,
|
|
83
83
|
yMeasureUnit: t,
|
|
84
|
-
height:
|
|
85
|
-
defaultGraph:
|
|
86
|
-
onGraphSelected:
|
|
84
|
+
height: c = 306,
|
|
85
|
+
defaultGraph: o,
|
|
86
|
+
onGraphSelected: p,
|
|
87
87
|
graphs: d,
|
|
88
88
|
isMultipleSelect: V,
|
|
89
89
|
range: B,
|
|
90
90
|
rangeList: k,
|
|
91
|
-
setRange:
|
|
91
|
+
setRange: T,
|
|
92
92
|
onGraphExpanded: A,
|
|
93
|
-
isGraphExpanded:
|
|
93
|
+
isGraphExpanded: D,
|
|
94
94
|
onUnselectSeries: W,
|
|
95
|
-
graphsWithNoData:
|
|
96
|
-
loadingGraphs:
|
|
95
|
+
graphsWithNoData: H,
|
|
96
|
+
loadingGraphs: J,
|
|
97
97
|
noDataMessage: N = "No data available for this graph",
|
|
98
|
-
currentValueDecimals:
|
|
99
|
-
containerClassName:
|
|
100
|
-
useSharedPriceScale:
|
|
101
|
-
showCurrentValue:
|
|
102
|
-
yScaleMin:
|
|
103
|
-
yScaleMinMultiple:
|
|
98
|
+
currentValueDecimals: $,
|
|
99
|
+
containerClassName: X,
|
|
100
|
+
useSharedPriceScale: q,
|
|
101
|
+
showCurrentValue: Q,
|
|
102
|
+
yScaleMin: Y,
|
|
103
|
+
yScaleMinMultiple: Z,
|
|
104
104
|
seriesColorPersistenceKey: u,
|
|
105
|
-
...
|
|
105
|
+
...U
|
|
106
106
|
}) {
|
|
107
|
-
const
|
|
108
|
-
(
|
|
109
|
-
|
|
107
|
+
const v = y(() => Array.isArray(e) ? e : e ? [e] : [], [e]), R = y(() => Array.isArray(e) && e.length > 1, [e]), L = le(), K = ne(
|
|
108
|
+
(w, g) => {
|
|
109
|
+
ie.error(N);
|
|
110
110
|
},
|
|
111
111
|
[N]
|
|
112
|
-
),
|
|
112
|
+
), P = y(() => {
|
|
113
113
|
if (t)
|
|
114
114
|
return Array.isArray(t) ? t[0] : t;
|
|
115
|
-
}, [t]),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
|
|
115
|
+
}, [t]), G = (!L && A || k.length > 0 || p && d && o) && /* @__PURE__ */ S("div", { className: "z-10 w-full flex flex-row flex-wrap sm:flex-nowrap items-center gap-2", children: [
|
|
116
|
+
/* @__PURE__ */ l("div", { children: p && d && o && /* @__PURE__ */ l(
|
|
117
|
+
fe,
|
|
118
118
|
{
|
|
119
|
-
onSelected:
|
|
119
|
+
onSelected: p,
|
|
120
120
|
items: d,
|
|
121
|
-
defaultItem:
|
|
121
|
+
defaultItem: o,
|
|
122
122
|
multiple: V,
|
|
123
|
-
graphsWithNoData:
|
|
124
|
-
loadingGraphs:
|
|
125
|
-
onNoDataSelected:
|
|
123
|
+
graphsWithNoData: H,
|
|
124
|
+
loadingGraphs: J,
|
|
125
|
+
onNoDataSelected: K
|
|
126
126
|
}
|
|
127
127
|
) }),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
!
|
|
128
|
+
/* @__PURE__ */ S("div", { className: "flex flex-row flex-nowrap justify-start sm:justify-end items-center flex-1", children: [
|
|
129
|
+
/* @__PURE__ */ l(ce, { range: B, rangeList: k, setRange: T }),
|
|
130
|
+
!L && A && /* @__PURE__ */ l(
|
|
131
131
|
"button",
|
|
132
132
|
{
|
|
133
133
|
type: "button",
|
|
134
134
|
className: "px-2.5 py-1.5 flex min-w-[44px] min-h-[26px] justify-center items-center text-xs leading-[14px] font-medium text-center rounded-md border cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring bg-muted border-muted text-muted-foreground hover:border-secondary ml-1.5",
|
|
135
135
|
onClick: A,
|
|
136
|
-
children:
|
|
136
|
+
children: D ? /* @__PURE__ */ l(ae, { size: 16 }) : /* @__PURE__ */ l(de, { size: 16 })
|
|
137
137
|
}
|
|
138
138
|
)
|
|
139
139
|
] })
|
|
140
|
-
] }),
|
|
141
|
-
if (d && d.length > 0 && !
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
140
|
+
] }), i = M(/* @__PURE__ */ new Map()), a = M(0), O = M(!1);
|
|
141
|
+
if (d && d.length > 0 && !O.current) {
|
|
142
|
+
O.current = !0;
|
|
143
|
+
const w = u ? j(u) : /* @__PURE__ */ new Map(), g = String(d[0].value);
|
|
144
|
+
i.current.set(g, 0), a.current = 1;
|
|
145
145
|
for (let r = 1; r < d.length; r++) {
|
|
146
146
|
const m = String(d[r].value);
|
|
147
|
-
if (
|
|
148
|
-
const
|
|
149
|
-
|
|
147
|
+
if (i.current.has(m)) continue;
|
|
148
|
+
const b = w.get(m) ?? r;
|
|
149
|
+
i.current.set(m, b), a.current = Math.max(a.current, b + 1);
|
|
150
150
|
}
|
|
151
|
-
u &&
|
|
151
|
+
u && z(
|
|
152
152
|
u,
|
|
153
|
-
|
|
153
|
+
i.current
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
const
|
|
156
|
+
const ee = y(() => {
|
|
157
|
+
const w = Array.isArray(t) ? t : void 0;
|
|
158
158
|
if (u) {
|
|
159
|
-
const r =
|
|
160
|
-
for (const [m,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
const r = j(u);
|
|
160
|
+
for (const [m, x] of r)
|
|
161
|
+
i.current.has(m) || (i.current.set(m, x), a.current = Math.max(
|
|
162
|
+
a.current,
|
|
163
|
+
x + 1
|
|
164
164
|
));
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
if (!
|
|
169
|
-
const
|
|
170
|
-
Array.from(
|
|
166
|
+
const g = v.map((r, m) => {
|
|
167
|
+
const x = r?.title || `Series ${m + 1}`, b = o != null ? Array.isArray(o) ? o[0]?.value ?? o[0] : typeof o == "object" && "value" in o ? o.value : o : null, I = v.length === 1 ? b != null ? String(b) : "single" : r?.id || x;
|
|
168
|
+
if (!i.current.has(I)) {
|
|
169
|
+
const n = new Set(
|
|
170
|
+
Array.from(i.current.values())
|
|
171
171
|
);
|
|
172
|
-
let
|
|
173
|
-
for (let
|
|
174
|
-
const
|
|
175
|
-
if (!
|
|
176
|
-
|
|
172
|
+
let s = a.current;
|
|
173
|
+
for (let f = 0; f < E.length; f++) {
|
|
174
|
+
const h = (a.current + f) % E.length;
|
|
175
|
+
if (!n.has(h)) {
|
|
176
|
+
s = h;
|
|
177
177
|
break;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
i.current.set(I, s), a.current = s + 1;
|
|
181
181
|
}
|
|
182
|
-
const
|
|
183
|
-
const
|
|
184
|
-
return
|
|
185
|
-
}).reduce((
|
|
186
|
-
const
|
|
187
|
-
return
|
|
188
|
-
}, []),
|
|
182
|
+
const oe = i.current.get(I) ?? 0, C = ue(oe), re = [...r?.data || []].sort((n, s) => {
|
|
183
|
+
const f = typeof n.time == "number" ? n.time : Number(n.time), h = typeof s.time == "number" ? s.time : Number(s.time);
|
|
184
|
+
return f - h;
|
|
185
|
+
}).reduce((n, s) => {
|
|
186
|
+
const f = s.time;
|
|
187
|
+
return n.length === 0 || n[n.length - 1].time !== f ? n.push({ time: f, value: s.value }) : n[n.length - 1] = { time: f, value: s.value }, n;
|
|
188
|
+
}, []), _ = r?.lineColor ?? r?.color ?? void 0;
|
|
189
189
|
return {
|
|
190
190
|
data: re,
|
|
191
|
-
label:
|
|
192
|
-
yMeasureUnit:
|
|
193
|
-
...
|
|
194
|
-
lineColor:
|
|
191
|
+
label: x,
|
|
192
|
+
yMeasureUnit: w?.[m] ?? (Array.isArray(t) ? void 0 : t),
|
|
193
|
+
..._ != null ? {
|
|
194
|
+
lineColor: _,
|
|
195
195
|
...r?.topColor != null && {
|
|
196
196
|
topColor: r.topColor
|
|
197
197
|
},
|
|
@@ -199,42 +199,42 @@ function Ne({
|
|
|
199
199
|
bottomColor: r.bottomColor
|
|
200
200
|
}
|
|
201
201
|
} : {
|
|
202
|
-
color:
|
|
203
|
-
topColor:
|
|
204
|
-
bottomColor:
|
|
202
|
+
color: C.line,
|
|
203
|
+
topColor: C.top,
|
|
204
|
+
bottomColor: C.bottom
|
|
205
205
|
}
|
|
206
206
|
};
|
|
207
207
|
});
|
|
208
|
-
return u &&
|
|
208
|
+
return u && i.current.size > 0 && z(
|
|
209
209
|
u,
|
|
210
|
-
|
|
211
|
-
),
|
|
212
|
-
}, [
|
|
213
|
-
return /* @__PURE__ */
|
|
210
|
+
i.current
|
|
211
|
+
), g;
|
|
212
|
+
}, [v, o, t, u]), te = R && v.length > 0 ? v.some((w) => !w) : !e;
|
|
213
|
+
return /* @__PURE__ */ l(
|
|
214
214
|
"div",
|
|
215
215
|
{
|
|
216
216
|
style: {
|
|
217
217
|
width: "100%",
|
|
218
|
-
height:
|
|
218
|
+
height: c ? `${c}px` : void 0
|
|
219
219
|
},
|
|
220
220
|
className: "w-full",
|
|
221
|
-
children: /* @__PURE__ */
|
|
222
|
-
|
|
221
|
+
children: /* @__PURE__ */ l(
|
|
222
|
+
me,
|
|
223
223
|
{
|
|
224
|
-
series:
|
|
225
|
-
loading:
|
|
226
|
-
toolbar:
|
|
227
|
-
size:
|
|
228
|
-
containerClassName:
|
|
229
|
-
showLegend:
|
|
224
|
+
series: ee,
|
|
225
|
+
loading: te,
|
|
226
|
+
toolbar: G,
|
|
227
|
+
size: c ? "full" : "default",
|
|
228
|
+
containerClassName: se("h-full", X),
|
|
229
|
+
showLegend: R,
|
|
230
230
|
onUnselectSeries: W,
|
|
231
|
-
yMeasureUnit:
|
|
232
|
-
currentValueDecimals:
|
|
233
|
-
useSharedPriceScale:
|
|
234
|
-
showCurrentValue:
|
|
235
|
-
yScaleMin:
|
|
236
|
-
yScaleMinMultiple:
|
|
237
|
-
...
|
|
231
|
+
yMeasureUnit: P,
|
|
232
|
+
currentValueDecimals: $,
|
|
233
|
+
useSharedPriceScale: q,
|
|
234
|
+
showCurrentValue: Q,
|
|
235
|
+
yScaleMin: Y,
|
|
236
|
+
yScaleMinMultiple: Z,
|
|
237
|
+
...U
|
|
238
238
|
}
|
|
239
239
|
)
|
|
240
240
|
}
|