@orderly.network/ui-share 2.0.1-preview.4 → 2.0.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.
- package/dist/index.d.mts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -28,7 +28,7 @@ type PosterLayoutConfig = {
|
|
|
28
28
|
updateTime?: layoutInfo;
|
|
29
29
|
};
|
|
30
30
|
type SharePnLParams = {
|
|
31
|
-
|
|
31
|
+
entity: ShareEntity;
|
|
32
32
|
leverage?: number;
|
|
33
33
|
refCode?: string;
|
|
34
34
|
refSlogan?: string;
|
|
@@ -36,13 +36,13 @@ type SharePnLParams = {
|
|
|
36
36
|
};
|
|
37
37
|
type SharePnLConfig = {
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* default is Manrope
|
|
40
40
|
*/
|
|
41
41
|
fontFamily?: string;
|
|
42
42
|
/**
|
|
43
43
|
* can not empty
|
|
44
44
|
*/
|
|
45
|
-
backgroundImages
|
|
45
|
+
backgroundImages?: string[];
|
|
46
46
|
/**
|
|
47
47
|
* posterLayoutConfig
|
|
48
48
|
*/
|
|
@@ -69,12 +69,22 @@ type ReferralType = {
|
|
|
69
69
|
link?: string;
|
|
70
70
|
slogan?: string;
|
|
71
71
|
};
|
|
72
|
+
type ShareEntity = {
|
|
73
|
+
symbol: string;
|
|
74
|
+
side: "LONG" | "SHORT";
|
|
75
|
+
pnl?: number;
|
|
76
|
+
roi?: number;
|
|
77
|
+
openPrice?: number;
|
|
78
|
+
openTime?: number;
|
|
79
|
+
markPrice?: number;
|
|
80
|
+
quantity?: number;
|
|
81
|
+
};
|
|
72
82
|
|
|
73
83
|
declare const useSharePnLScript: (props: {
|
|
74
84
|
pnl?: (SharePnLConfig & SharePnLParams) | undefined;
|
|
75
85
|
hide?: () => void;
|
|
76
86
|
}) => {
|
|
77
|
-
|
|
87
|
+
entity: ShareEntity | undefined;
|
|
78
88
|
leverage: number | undefined;
|
|
79
89
|
baseDp: any;
|
|
80
90
|
quoteDp: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ type PosterLayoutConfig = {
|
|
|
28
28
|
updateTime?: layoutInfo;
|
|
29
29
|
};
|
|
30
30
|
type SharePnLParams = {
|
|
31
|
-
|
|
31
|
+
entity: ShareEntity;
|
|
32
32
|
leverage?: number;
|
|
33
33
|
refCode?: string;
|
|
34
34
|
refSlogan?: string;
|
|
@@ -36,13 +36,13 @@ type SharePnLParams = {
|
|
|
36
36
|
};
|
|
37
37
|
type SharePnLConfig = {
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* default is Manrope
|
|
40
40
|
*/
|
|
41
41
|
fontFamily?: string;
|
|
42
42
|
/**
|
|
43
43
|
* can not empty
|
|
44
44
|
*/
|
|
45
|
-
backgroundImages
|
|
45
|
+
backgroundImages?: string[];
|
|
46
46
|
/**
|
|
47
47
|
* posterLayoutConfig
|
|
48
48
|
*/
|
|
@@ -69,12 +69,22 @@ type ReferralType = {
|
|
|
69
69
|
link?: string;
|
|
70
70
|
slogan?: string;
|
|
71
71
|
};
|
|
72
|
+
type ShareEntity = {
|
|
73
|
+
symbol: string;
|
|
74
|
+
side: "LONG" | "SHORT";
|
|
75
|
+
pnl?: number;
|
|
76
|
+
roi?: number;
|
|
77
|
+
openPrice?: number;
|
|
78
|
+
openTime?: number;
|
|
79
|
+
markPrice?: number;
|
|
80
|
+
quantity?: number;
|
|
81
|
+
};
|
|
72
82
|
|
|
73
83
|
declare const useSharePnLScript: (props: {
|
|
74
84
|
pnl?: (SharePnLConfig & SharePnLParams) | undefined;
|
|
75
85
|
hide?: () => void;
|
|
76
86
|
}) => {
|
|
77
|
-
|
|
87
|
+
entity: ShareEntity | undefined;
|
|
78
88
|
leverage: number | undefined;
|
|
79
89
|
baseDp: any;
|
|
80
90
|
quoteDp: any;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var hooks = require('@orderly.network/hooks');
|
|
|
5
5
|
var p = require('react');
|
|
6
6
|
var utils = require('@orderly.network/utils');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
var
|
|
8
|
+
var et = require('embla-carousel-react');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
|
|
@@ -28,14 +28,14 @@ function _interopNamespace(e) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
var p__namespace = /*#__PURE__*/_interopNamespace(p);
|
|
31
|
-
var
|
|
31
|
+
var et__default = /*#__PURE__*/_interopDefault(et);
|
|
32
32
|
|
|
33
|
-
var Z=e=>{let{pnl:t,hide:o}=e,a=t?.position,n=hooks.useSymbolsInfo(),{getFirstRefCode:r}=hooks.useReferralInfo(),i=n[a?.symbol]("base_dp"),l=n[a?.symbol]("quote_dp"),c=p.useMemo(()=>{let s=r()?.code;return {code:t?.refCode??s,slogan:t?.refSlogan,link:t?.refLink}},[r,t]);return {position:a,leverage:t?.leverage,baseDp:i,quoteDp:l,referralInfo:c,shareOptions:t,hide:o}};function G(e,t,o,a,n,r,i,l,c){let{symbol:s,currency:u}=Ke(e.symbol),f={symbol:s,currency:u,side:e.position_qty>0?"LONG":"SHORT"};switch(n){case"pnl":{"unrealized_pnl"in e&&(f.pnl=new utils.Decimal(e.unrealized_pnl).toFixed(2,utils.Decimal.ROUND_DOWN));break}case"roi":{"unrealized_pnl_ROI"in e&&(f.ROI=new utils.Decimal(e.unrealized_pnl_ROI*100).toFixed(2,utils.Decimal.ROUND_DOWN));break}case"roi_pnl":{"unrealized_pnl"in e&&(f.pnl=new utils.Decimal(e.unrealized_pnl).toFixed(2,utils.Decimal.ROUND_DOWN)),"unrealized_pnl_ROI"in e&&(f.ROI=new utils.Decimal(e.unrealized_pnl_ROI*100).toFixed(2,utils.Decimal.ROUND_DOWN));break}}let v=[];r.has("leverage")&&(f.leverage=t),["openPrice","openTime","markPrice","quantity"].forEach(b=>{if(r.has(b))switch(b){case"leverage":break;case"openPrice":{v.push({title:"Open price",value:re(e.average_open_price,l||2)});break}case"openTime":{v.push({title:"Opened at",value:Je(e.timestamp)});break}case"markPrice":{v.push({title:"Mark price",value:re(e.mark_price,l||2)});break}case"quantity":v.push({title:"Quantity",value:re(e.position_qty,i||2)});}}),f.informations=v;let S={position:f,updateTime:Qe(new Date),domain:a};return o.length>0&&(S.message=o),typeof c<"u"&&c.code!==void 0&&(S.referral=c),S}function Ke(e){let t=e.split("_");if(t.length!==3)return {symbol:e,currency:"USDC"};let[o,a,n]=t;return {symbol:`${a}-${o}`,currency:n||"USDC"}}function Qe(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h24"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(u=>u.type==="year"?u.value:"")?.value,i=n.find(u=>u.type==="month"?u.value:"")?.value,l=n.find(u=>u.type==="day"?u.value:"")?.value,c=n.find(u=>u.type==="hour"?u.value:"")?.value,s=n.find(u=>u.type==="minute"?u.value:"")?.value;return `${r}-${i}-${l} ${c}:${s}`}function Je(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(s=>s.type==="month"?s.value:"")?.value,i=n.find(s=>s.type==="day"?s.value:"")?.value,l=n.find(s=>s.type==="hour"?s.value:"")?.value,c=n.find(s=>s.type==="minute"?s.value:"")?.value;return `${r}-${i} ${l}:${c}`}function re(e,t){return new utils.Decimal(e).toFixed(t,utils.Decimal.ROUND_DOWN)}function X(e,t,o,a){localStorage.setItem("pnl_config_key",JSON.stringify({bgIndex:o,pnlFormat:e,options:Array.from(t),message:a}));}function j(){let e=localStorage.getItem("pnl_config_key");if(e&&e.length>0)try{return JSON.parse(e)}catch{}return {bgIndex:0,pnlFormat:"roi_pnl",options:["openPrice","openTime","markPrice","quantity","leverage"],message:""}}var $=p.forwardRef((e,t)=>{let{width:o,height:a,className:n,data:r,style:i}=e,{ref:l,download:c,toDataURL:s,copy:u,toBlob:f}=hooks.usePoster(r,{ratio:e.ratio});return p.useImperativeHandle(t,()=>({download:c,toDataURL:s,toBlob:f,copy:u})),jsxRuntime.jsx("canvas",{ref:l,width:o,height:a,className:n,style:i})});var ye=e=>{let{children:t,...o}=e;return jsxRuntime.jsx("button",{...o,children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsxRuntime.jsx("path",{d:"M11.186 5.348a.67.67 0 0 0-.436.27l-2.657 4a.69.69 0 0 0 0 .75l2.657 4a.68.68 0 0 0 .934.188.685.685 0 0 0 .187-.937L9.463 9.993 11.87 6.37a.685.685 0 0 0-.187-.938.65.65 0 0 0-.498-.083",fill:"#fff",fillOpacity:".54"})]})})},ve=e=>{let{children:t,...o}=e;return jsxRuntime.jsx("button",{...o,children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsxRuntime.jsx("path",{d:"M8.777 5.348a.65.65 0 0 0-.498.083.685.685 0 0 0-.187.938L10.5 9.993 8.092 13.62a.685.685 0 0 0 .187.937.68.68 0 0 0 .934-.187l2.657-4a.69.69 0 0 0 0-.75l-2.657-4a.67.67 0 0 0-.436-.271",fill:"#fff",fillOpacity:".54"})]})})};var Se=e=>{let{backgroundImages:t,selectedSnap:o,setSelectedSnap:a}=e,[n,r]=je__default.default({containScroll:"keepSnaps",dragFree:!0}),i=p.useCallback(()=>{r&&r.scrollPrev();},[r]),l=p.useCallback(()=>{r&&r.scrollNext();},[r]),c=p.useCallback(s=>{a(s.selectedScrollSnap());},[]);return p.useEffect(()=>{r&&(c(r),r.on("reInit",c),r.on("select",c),r?.scrollTo(o));},[r,c]),jsxRuntime.jsxs(ui.Flex,{mt:4,px:2,children:[jsxRuntime.jsx(ye,{onClick:i}),jsxRuntime.jsx("div",{ref:n,className:"oui-w-full oui-overflow oui-overflow-x-auto oui-scrollbar-hidden oui-hide-scrollbar oui-mx-0",children:jsxRuntime.jsx(ui.Flex,{children:t.map((s,u)=>jsxRuntime.jsx(ui.Box,{onClick:()=>{r?.scrollTo(u);},mx:2,my:1,mr:6,r:"base",className:ui.cn("oui-shrink-0 oui-w-[162px]",o===u&&"oui-outline oui-outline-1 oui-outline-primary-darken"),children:jsxRuntime.jsx("img",{src:s,className:"oui-rounded-sm"})},s))})}),jsxRuntime.jsx(ve,{onClick:l})]})};var be=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=p.useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]),r=t===o,i="oui-flex oui-items-center oui-gap-1 oui-cursor-pointer";return r?i+=" oui-text-base-contrast":i+="",jsxRuntime.jsxs("div",{className:i,onClick:()=>{a(t);},children:[jsxRuntime.jsx(it,{sel:r}),jsxRuntime.jsx(ui.Text,{size:"xs",intensity:54,className:ui.cn("oui-ml-2 "),children:n})]})},it=e=>jsxRuntime.jsx("button",{type:"button",children:e.sel===!0?jsxRuntime.jsx(lt,{}):jsxRuntime.jsx(ct,{})}),lt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"oui-fill-primary-darken",children:[jsxRuntime.jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".36"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3.333"})]}),ct=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".54"})});var ee=e=>{let{size:t=16,className:o}=e;return jsxRuntime.jsx("button",{type:"button",onClick:a=>{e.onCheckedChange(!e.checked);},className:o,children:e.checked?jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm6.664 2.922a.8.8 0 0 1 .557-.208c.2 0 .406.063.558.208a.734.734 0 0 1 0 1.063l-5.434 5.179a.826.826 0 0 1-1.115 0l-2.33-2.22a.736.736 0 0 1 0-1.063.827.827 0 0 1 1.117 0l1.77 1.687z",fill:"#fff",fillOpacity:".8"})}):jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm0 1.334h6.667c.737 0 1.334.596 1.334 1.333v6.667c0 .736-.597 1.333-1.334 1.333H4.661a1.333 1.333 0 0 1-1.334-1.333V4.62c0-.737.597-1.333 1.334-1.333",fill:"#fff",fillOpacity:".8"})})})};var Ne=e=>{let{type:t,curType:o,setShareOption:a}=e,n=p.useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxRuntime.jsxs(ui.Flex,{itemAlign:"center",gap:1,className:ui.cn("hover:oui-cursor-pointer"),onClick:()=>{a(i=>{let l=new Set(i);return r?l.delete(t):l.add(t),l});},children:[jsxRuntime.jsx(ee,{size:16,checked:r,className:"oui-pt-[2px]",onCheckedChange:i=>{a(l=>{let c=new Set(l);return r?c.delete(t):c.add(t),c});}}),jsxRuntime.jsx(ui.Text,{size:"xs",intensity:54,children:n})]})};var ke=e=>{let{message:t,setMessage:o,check:a,setCheck:n}=e,[r,i]=p.useState(!1),l=p.useRef(null);return jsxRuntime.jsxs("div",{className:"oui-mt-3 oui-mb-6 oui-flex oui-items-center",children:[jsxRuntime.jsx(ee,{className:"oui-mt-[2px]",checked:a,onCheckedChange:c=>{n(c);}}),jsxRuntime.jsx("div",{className:"oui-text-xs oui-text-base-contrast-54 oui-ml-1 hover:oui-cursor-pointer",onClick:()=>{n(!e.check);},children:"Your message"}),jsxRuntime.jsx("div",{className:"oui-bg-base-900 oui-mx-2 oui-rounded-sm",children:jsxRuntime.jsx(ui.Input,{ref:l,placeholder:"Max 25 characters",classNames:{root:"oui-w-[320px]"},size:"sm",value:t,autoFocus:!1,suffix:r&&jsxRuntime.jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:c=>{o(""),setTimeout(()=>{l.current?.focus();},50),c.stopPropagation();},children:jsxRuntime.jsx(ui.CloseCircleFillIcon,{size:18,color:"white"})}),onFocus:()=>i(!0),onBlur:()=>i(!1),onChange:c=>{if(c.target.value.length>25){ui.toast.error("Maximum support of 25 characters");return}n(c.target.value.length>0),o(c.target.value);}})})]})};var De=e=>{let{onClickDownload:t,onClickCopy:o}=e;return jsxRuntime.jsxs(ui.Flex,{px:8,gap:3,mt:3,itemAlign:"center",children:[jsxRuntime.jsxs(ui.Button,{color:"secondary",className:"oui-flex-1 oui-flex oui-gap-1",onClick:t,children:[jsxRuntime.jsx("span",{children:jsxRuntime.jsx(bt,{})}),"Download"]}),jsxRuntime.jsxs(ui.Button,{className:"oui-flex-1 oui-flex oui-gap-1",onClick:o,children:[jsxRuntime.jsx("span",{children:jsxRuntime.jsx(Pt,{})}),"Copy"]})]})},bt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4.66 1.994A2.667 2.667 0 0 0 1.995 4.66v6.666a2.667 2.667 0 0 0 2.667 2.667h6.666a2.667 2.667 0 0 0 2.667-2.667V4.661a2.667 2.667 0 0 0-2.667-2.667zM7.995 4.66c.368 0 .667.298.667.666V8.66h2l-2.667 2.666L5.328 8.66h2V5.327c0-.368.299-.667.667-.667",fill:"#fff",fillOpacity:".98"})}),Pt=()=>jsxRuntime.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M5.166 1.994A2.667 2.667 0 0 0 2.499 4.66v4a2.667 2.667 0 0 0 2.667 2.667 2.667 2.667 0 0 0 2.666 2.667h4a2.667 2.667 0 0 0 2.667-2.667v-4a2.667 2.667 0 0 0-2.667-2.667 2.667 2.667 0 0 0-2.666-2.666zm6.666 4c.737 0 1.334.596 1.334 1.333v4c0 .737-.597 1.334-1.334 1.334h-4A1.333 1.333 0 0 1 6.5 11.327h2.667a2.667 2.667 0 0 0 2.666-2.667z",fill:"#fff",fillOpacity:".98"})});var Re=e=>{let{shareOptions:t}=e,o=j(),[a,n]=p.useState(o.pnlFormat),[r,i]=p.useState(new Set(o.options)),[l,c]=p.useState(o.bgIndex),[s,u]=p.useState(o.message),[f,v]=p.useState(!1),{backgroundImages:M,...S}=t??{backgroundImages:[]},[b,I]=p.useState(""),C=p.useRef(null);p.useEffect(()=>{let w=window.location.hostname;I(w);},[]);let P=p.useMemo(()=>t?.backgroundImages?.[l],[t?.backgroundImages,l]),O=G(e.position,e.leverage,f?s:"",b,a,r,e.baseDp,e.quoteDp,e.referral),R=()=>{C.current?.copy().then(()=>{e.hide?.(),ui.toast.success("Image copied");}).catch(w=>{ui.toast.error(()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{children:"Copy failed"}),jsxRuntime.jsx("div",{className:"oui-text-2xs oui-max-w-[396px] oui-mt-2 oui-text-base-contrast-54",children:"Browser version outdated, please update in order to copy image to clipboard."})]}));});},z=()=>{C.current?.download("Poster.png"),e.hide?.();},h=["roi_pnl","roi","pnl"],oe=["openPrice","markPrice","openTime","leverage","quantity"];return X(a,r,l,s),jsxRuntime.jsxs("div",{className:"oui-h-full oui-flex oui-flex-col oui-relative oui-w-full",children:[jsxRuntime.jsxs("div",{className:"oui-flex-1 oui-h-full oui-overflow-y-auto",children:[jsxRuntime.jsxs(ui.Box,{mt:9,height:422,children:[jsxRuntime.jsx(ui.Flex,{itemAlign:"center",justify:"center",children:jsxRuntime.jsx($,{width:552,height:310,data:{backgroundImg:P,...S,data:O},ratio:3,ref:C})}),jsxRuntime.jsx(Se,{backgroundImages:t?.backgroundImages??[],selectedSnap:l,setSelectedSnap:c})]}),jsxRuntime.jsxs(ui.Flex,{direction:"column",px:10,mt:6,justify:"start",itemAlign:"start",width:"100%",children:[jsxRuntime.jsx(ui.Text,{size:"sm",intensity:80,children:"PnL display format"}),jsxRuntime.jsx(ui.Flex,{pt:3,gap:3,itemAlign:"center",children:h.map((w,_)=>jsxRuntime.jsx(be,{setPnlFormat:n,type:w,curType:a},_))}),jsxRuntime.jsx(ui.Divider,{className:"oui-w-full oui-pt-6 oui-border-white/10"}),jsxRuntime.jsxs(ui.Flex,{mt:6,direction:"column",justify:"start",itemAlign:"start",children:[jsxRuntime.jsx(ui.Text,{size:"sm",intensity:80,children:"Optional information to share"}),jsxRuntime.jsx(ui.Flex,{mt:3,gap:4,children:oe.map((w,_)=>jsxRuntime.jsx(Ne,{setShareOption:i,type:w,curType:r},_))})]}),jsxRuntime.jsx(ke,{message:s,setMessage:u,check:f,setCheck:v})]})]}),jsxRuntime.jsx(De,{onClickCopy:R,onClickDownload:z})]})};var Te=p__namespace.createContext(null);function T(){let e=p__namespace.useContext(Te);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}var se=p__namespace.forwardRef(({orientation:e="horizontal",opts:t,setApi:o,plugins:a,className:n,children:r,...i},l)=>{let[c,s]=je__default.default({...t,axis:e==="horizontal"?"x":"y"},a),[u,f]=p__namespace.useState(!1),[v,M]=p__namespace.useState(!1),[S,b]=p__namespace.useState(i.initIndex||0),[I,C]=p__namespace.useState([]),P=p__namespace.useCallback(h=>{h&&(I.length===0&&C(h.scrollSnapList()),b(h.selectedScrollSnap()),f(h.canScrollPrev()),M(h.canScrollNext()));},[I]),O=p__namespace.useCallback(()=>{s?.scrollPrev();},[s]),R=p__namespace.useCallback(()=>{s?.scrollNext();},[s]),z=p__namespace.useCallback(h=>{h.key==="ArrowLeft"?(h.preventDefault(),O()):h.key==="ArrowRight"&&(h.preventDefault(),R());},[O,R]);return p__namespace.useEffect(()=>{!s||!o||o(s);},[s,o]),p__namespace.useEffect(()=>{if(s)return P(s),s.on("reInit",P),s.on("select",P),i.initIndex&&s.scrollTo(i.initIndex),()=>{s?.off("select",P);}},[s,P]),jsxRuntime.jsx(Te.Provider,{value:{carouselRef:c,api:s,opts:t,orientation:e||(t?.axis==="y"?"vertical":"horizontal"),scrollPrev:O,scrollNext:R,canScrollPrev:u,canScrollNext:v,selectedIndex:S,scrollSnaps:I},children:jsxRuntime.jsx("div",{ref:l,onKeyDownCapture:z,className:ui.cn("oui-relative",n),role:"region","aria-roledescription":"carousel",...i,children:r})})});se.displayName="Carousel";var Q=p__namespace.forwardRef(({className:e,...t},o)=>{let{carouselRef:a,orientation:n}=T();return jsxRuntime.jsx("div",{ref:a,className:"oui-overflow-hidden",children:jsxRuntime.jsx("div",{ref:o,className:ui.cn("oui-flex",n==="horizontal"?"oui--ml-4":"oui--mt-4 oui-flex-col",e),...t})})});Q.displayName="CarouselContent";var J=p__namespace.forwardRef(({className:e,...t},o)=>{let{orientation:a}=T();return jsxRuntime.jsx("div",{ref:o,role:"group","aria-roledescription":"slide",className:ui.cn("oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full",a==="horizontal"?"oui-pl-4":"oui-pt-4",e),...t})});J.displayName="CarouselItem";var ie=p__namespace.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollPrev:i,canScrollPrev:l}=T();return jsxRuntime.jsxs(ui.Button,{ref:n,variant:t,className:ui.cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--left-12 oui-top-1/2 oui--translate-y-1/2":"oui--top-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!l,onClick:i,...a,children:[jsxRuntime.jsx(ChevronLeft,{size:20}),jsxRuntime.jsx("span",{className:"oui-sr-only",children:"Previous slide"})]})});ie.displayName="CarouselPrevious";var le=p__namespace.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollNext:i,canScrollNext:l}=T();return jsxRuntime.jsxs(ui.Button,{ref:n,variant:t,className:ui.cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--right-12 oui-top-1/2 oui--translate-y-1/2":"oui--bottom-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!l,onClick:i,...a,children:[jsxRuntime.jsx(ChevronRight,{size:20}),jsxRuntime.jsx("span",{className:"oui-sr-only",children:"Next slide"})]})});le.displayName="CarouselNext";var ce=e=>{let{scrollSnaps:t,selectedIndex:o}=T();return jsxRuntime.jsx("div",{className:ui.cn("oui-flex oui-gap-1",e.className),children:t.map((a,n)=>jsxRuntime.jsx(ue,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})};ce.displayName="CarouselIdentifier";var ue=({index:e,active:t,onClick:o,className:a,activeClassName:n})=>jsxRuntime.jsx("button",{onClick:()=>o?.(e),className:ui.cn("oui-w-2 oui-h-2 oui-rounded-full oui-bg-white/30",a,t&&`active ${n||"oui-bg-primary-darken"}`)});var B=se;B.Content=Q;B.Item=J;B.Next=le;B.Previous=ie;B.indentify=ce;var ze=e=>{let{shareOptions:t}=e,o=j(),[a,n]=p.useState(o.pnlFormat),[r,i]=p.useState(new Set(o.options)),[l,c]=p.useState(o.message),[s,u]=p.useState(o.bgIndex),{backgroundImages:f,...v}=t??{backgroundImages:[]},[M,S]=p.useState(""),b=t?.backgroundImages?.map(()=>p.useRef(null));p.useEffect(()=>{let d=window.location.hostname;S(d);},[]);let I=G(e.position,e.leverage,l,M,a,r,e.baseDp,e.quoteDp,e.referral),C=p.useRef(),P=552/310,[O,R]=p.useState(1),[z,h]=p.useState(0),[oe,w]=p.useState(!1),_=p.useRef(null);p.useEffect(()=>{if(C.current){let d=C.current.offsetWidth,A=d/P;h(A),R(d/552);}},[C,M]);let qe=async d=>{if(!d.current)return;let A=d.current?.toDataURL(),Ue=Mt(A);try{navigator.share&&await navigator.share({text:l,files:[new File([Ue],"image.png",{type:"image/png"})]}),e.hide?.();}catch{}};return X(a,r,s,l),jsxRuntime.jsxs("div",{className:"oui-w-full",children:[jsxRuntime.jsx("div",{ref:C,className:"oui-w-full oui-mt-4 oui-overflow-hidden",style:{height:`${z+20}px`},children:jsxRuntime.jsxs(B,{className:"oui-w-full oui-overflow-hidden",opts:{align:"start"},initIndex:s,children:[jsxRuntime.jsx(Q,{style:{height:`${z}px`},children:t?.backgroundImages?.map((d,A)=>jsxRuntime.jsx(J,{children:jsxRuntime.jsx($,{className:"oui-transform oui-origin-top-left",style:{scale:`${O}`},width:552,height:310,data:{backgroundImg:d,...v,data:I},ratio:3,ref:b?.[A]})},A))}),jsxRuntime.jsx("div",{className:"oui-mt-2 oui-mb-1 oui-flex oui-justify-center",children:jsxRuntime.jsx(zt,{dotClassName:"oui-w-[16px] oui-h-[4px] oui-bg-base-300",dotActiveClassName:"!oui-bg-primary-darken oui-w-[20px]",setSelectIndex:u})})]})}),jsxRuntime.jsxs(ui.ScrollArea,{className:"oui-max-h-[200px] oui-overflow-y-auto oui-custom-scrollbar",children:[jsxRuntime.jsxs("div",{className:"oui-mt-4",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54",children:"PnL display format"}),jsxRuntime.jsxs("div",{className:"oui-pt-3 oui-px-1 oui-flex oui-justify-between oui-gap-3",children:[jsxRuntime.jsx(pe,{setPnlFormat:n,type:"roi_pnl",curType:a}),jsxRuntime.jsx(pe,{setPnlFormat:n,type:"roi",curType:a}),jsxRuntime.jsx(pe,{setPnlFormat:n,type:"pnl",curType:a})]})]}),jsxRuntime.jsxs("div",{className:"oui-mt-3",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Optional information to share"}),jsxRuntime.jsxs("div",{className:"oui-flex oui-flex-wrap oui-gap-3 oui-mt-3",children:[jsxRuntime.jsx(Y,{setShareOption:i,type:"openPrice",curType:r}),jsxRuntime.jsx(Y,{setShareOption:i,type:"openTime",curType:r}),jsxRuntime.jsx(Y,{setShareOption:i,type:"leverage",curType:r}),jsxRuntime.jsx(Y,{setShareOption:i,type:"markPrice",curType:r}),jsxRuntime.jsx(Y,{setShareOption:i,type:"quantity",curType:r})]})]}),jsxRuntime.jsxs("div",{className:"oui-mt-3 oui-mb-8",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Your message"}),jsxRuntime.jsx("div",{className:"oui-mt-3 oui-h-[48px] oui-bg-base-600 oui-mx-1",children:jsxRuntime.jsx(ui.Input,{placeholder:"Max 25 characters",containerClassName:"oui-bg-transparent oui-h-[48px]",value:l,autoFocus:!1,onChange:d=>{if(d.target.value.length>25){ui.toast.error("Maximum support of 25 characters");return}c(d.target.value);},ref:_,onFocus:()=>w(!0),onBlur:()=>w(!1),suffix:oe&&jsxRuntime.jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:d=>{c(""),setTimeout(()=>{_.current?.focus();},50),d.stopPropagation();},children:jsxRuntime.jsx(ui.CloseCircleFillIcon,{size:18,color:"white"})})})})]})]}),jsxRuntime.jsx("div",{className:"oui-pt-2",children:jsxRuntime.jsx(ui.Button,{fullWidth:!0,className:"oui-h-[40px] oui-text-[16px]",onClick:()=>{let d=b?.[s];d&&qe(d);},children:"Share"})})]})},pe=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=p.useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]);return jsxRuntime.jsx("div",{className:ui.cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-flex-1 oui-bg-base-4 hover:oui-cursor-pointer oui-flex oui-items-center oui-px-3 oui-referral-shadow",t===o&&"oui-bg-primary-darken oui-dot-sel"),onClick:()=>{a(t);},children:jsxRuntime.jsx("div",{className:"oui-text-sm oui-text-base-contrast",children:n})})},Y=e=>{let{type:t,curType:o,setShareOption:a}=e,n=p.useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxRuntime.jsxs("div",{className:ui.cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-mt-0 oui-w-[calc(50%-6px)] oui-bg-base-4 hover:oui-cursor-pointer oui-items-center oui-flex oui-p-3 oui-referral-shadow"),onClick:()=>{a(i=>{let l=new Set(i);return r?l.delete(t):l.add(t),l});},children:[jsxRuntime.jsx("div",{className:"oui-text-sm oui-flex-1 oui-text-base-contrast",children:n}),r&&jsxRuntime.jsx(_t,{})]})};function Mt(e){let t=atob(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],a=new ArrayBuffer(t.length),n=new Uint8Array(a);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return new Blob([a],{type:o})}var zt=e=>{let{scrollSnaps:t,selectedIndex:o}=T();return p.useEffect(()=>{e.setSelectIndex(o);},[o]),jsxRuntime.jsx("div",{className:ui.cn("oui-flex oui-gap-1"),children:t.map((a,n)=>jsxRuntime.jsx(ue,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})},_t=()=>jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.01416 11.9989C2.01416 6.47589 6.49136 1.9989 12.0142 1.9989C17.5372 1.9989 22.0142 6.47589 22.0142 11.9989C22.0142 17.5219 17.5372 21.9989 12.0142 21.9989C6.49136 21.9989 2.01416 17.5219 2.01416 11.9989ZM16.9853 7.31211C17.2125 7.09537 17.5236 7 17.8218 7C18.1201 7 18.4312 7.09537 18.6583 7.31211C19.1139 7.74546 19.1139 8.47384 18.6583 8.9072L10.5077 16.675C10.0534 17.1083 9.28909 17.1083 8.83472 16.675L5.34077 13.3459C4.88641 12.9126 4.88641 12.1841 5.34077 11.7508C5.79631 11.3175 6.56057 11.3175 7.01493 11.7508L9.67122 14.2822L16.9853 7.31211Z",fill:"white",fillOpacity:"1"})});var _e=e=>{let{leverage:t,position:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:i,hide:l}=e,[c,s]=p.useState(window.innerHeight<900?660:807);return p.useEffect(()=>{let u=()=>{s(window.innerHeight<900?660:807);};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u);}},[]),i==null?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx(Re,{position:o,leverage:`${t}`,hide:l,baseDp:a,quoteDp:n,referral:r,shareOptions:i})},Ae=e=>{let{leverage:t,position:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:i,hide:l}=e;return i==null?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx(ze,{position:o,leverage:t,hide:l,baseDp:a,quoteDp:n,referral:r,shareOptions:i})};var he=e=>{let t=Z({hide:e.hide,pnl:e.pnl});return jsxRuntime.jsx(Ae,{...t})},ge=e=>{let t=Z({hide:e.hide,pnl:e.pnl});return jsxRuntime.jsx(_e,{...t})};var Ut="sharePnLDialog",Wt="sharePnLBottomSheet";ui.registerSimpleDialog(Ut,ge,{contentClassName:"!oui-max-w-[624px] oui-p-0"});ui.registerSimpleSheet(Wt,he,{title:"Share PnL",classNames:{body:"oui-pb-4 oui-pt-0"}});
|
|
33
|
+
var G=e=>{let{pnl:t,hide:o}=e,a=t?.entity,n=hooks.useSymbolsInfo(),{getFirstRefCode:r}=hooks.useReferralInfo(),l=p.useMemo(()=>{let i=r()?.code;return {code:t?.refCode??i,slogan:t?.refSlogan,link:t?.refLink}},[r,t]),s=p.useMemo(()=>{if(a)return n[a?.symbol]("base_dp")},[a,n]),u=p.useMemo(()=>{if(a)return n[a?.symbol]("quote_dp")},[a,n]);return {entity:a,leverage:t?.leverage,baseDp:s,quoteDp:u,referralInfo:l,shareOptions:t,hide:o}};function X(e,t,o,a,n,r,l,s,u){let{symbol:i,currency:c}=Qe(e.symbol),d={symbol:i,currency:c,side:e.side};switch(n){case"pnl":{e.pnl!=null&&(d.pnl=new utils.Decimal(e.pnl).toFixed(2,utils.Decimal.ROUND_DOWN));break}case"roi":{e.roi!=null&&(d.ROI=new utils.Decimal(e.roi).toFixed(2,utils.Decimal.ROUND_DOWN));break}case"roi_pnl":{e.pnl!=null&&(d.pnl=new utils.Decimal(e.pnl).toFixed(2,utils.Decimal.ROUND_DOWN)),e.roi!=null&&(d.ROI=new utils.Decimal(e.roi).toFixed(2,utils.Decimal.ROUND_DOWN));break}}let C=[];r.has("leverage")&&(d.leverage=t),["openPrice","openTime","markPrice","quantity"].forEach(w=>{if(r.has(w))switch(w){case"leverage":break;case"openPrice":{e.openPrice!=null&&C.push({title:"Open price",value:ae(e.openPrice,s||2)});break}case"openTime":{e.openTime!=null&&C.push({title:"Opened at",value:Ye(e.openTime)});break}case"markPrice":{e.markPrice!=null&&C.push({title:"Mark price",value:ae(e.markPrice,s||2)});break}case"quantity":e.quantity!=null&&C.push({title:"Quantity",value:ae(e.quantity,l||2)});}}),d.informations=C;let S={position:d,updateTime:Je(new Date),domain:a};return o.length>0&&(S.message=o),typeof u<"u"&&u.code!==void 0&&(S.referral=u),S}function Qe(e){let t=e.split("_");if(t.length!==3)return {symbol:e,currency:"USDC"};let[o,a,n]=t;return {symbol:`${a}-${o}`,currency:n||"USDC"}}function Je(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h24"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(c=>c.type==="year"?c.value:"")?.value,l=n.find(c=>c.type==="month"?c.value:"")?.value,s=n.find(c=>c.type==="day"?c.value:"")?.value,u=n.find(c=>c.type==="hour"?c.value:"")?.value,i=n.find(c=>c.type==="minute"?c.value:"")?.value;return `${r}-${l}-${s} ${u}:${i}`}function Ye(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(i=>i.type==="month"?i.value:"")?.value,l=n.find(i=>i.type==="day"?i.value:"")?.value,s=n.find(i=>i.type==="hour"?i.value:"")?.value,u=n.find(i=>i.type==="minute"?i.value:"")?.value;return `${r}-${l} ${s}:${u}`}function ae(e,t){return new utils.Decimal(e).toFixed(t,utils.Decimal.ROUND_DOWN)}function j(e,t,o,a){localStorage.setItem("pnl_config_key",JSON.stringify({bgIndex:o,pnlFormat:e,options:Array.from(t),message:a}));}function ee(){let e=localStorage.getItem("pnl_config_key");if(e&&e.length>0)try{return JSON.parse(e)}catch{}return {bgIndex:0,pnlFormat:"roi_pnl",options:["openPrice","openTime","markPrice","quantity","leverage"],message:""}}var $=p.forwardRef((e,t)=>{let{width:o,height:a,className:n,data:r,style:l}=e,{ref:s,download:u,toDataURL:i,copy:c,toBlob:d}=hooks.usePoster(r,{ratio:e.ratio});return p.useImperativeHandle(t,()=>({download:u,toDataURL:i,toBlob:d,copy:c})),jsxRuntime.jsx("canvas",{ref:s,width:o,height:a,className:n,style:l})});var Ce=e=>{let{children:t,...o}=e;return jsxRuntime.jsx("button",{...o,children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsxRuntime.jsx("path",{d:"M11.186 5.348a.67.67 0 0 0-.436.27l-2.657 4a.69.69 0 0 0 0 .75l2.657 4a.68.68 0 0 0 .934.188.685.685 0 0 0 .187-.937L9.463 9.993 11.87 6.37a.685.685 0 0 0-.187-.938.65.65 0 0 0-.498-.083",fill:"#fff",fillOpacity:".54"})]})})},xe=e=>{let{children:t,...o}=e;return jsxRuntime.jsx("button",{...o,children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsxRuntime.jsx("path",{d:"M8.777 5.348a.65.65 0 0 0-.498.083.685.685 0 0 0-.187.938L10.5 9.993 8.092 13.62a.685.685 0 0 0 .187.937.68.68 0 0 0 .934-.187l2.657-4a.69.69 0 0 0 0-.75l-2.657-4a.67.67 0 0 0-.436-.271",fill:"#fff",fillOpacity:".54"})]})})};var be=e=>{let{backgroundImages:t,selectedSnap:o,setSelectedSnap:a}=e,[n,r]=et__default.default({containScroll:"keepSnaps",dragFree:!0}),l=p.useCallback(()=>{r&&r.scrollPrev();},[r]),s=p.useCallback(()=>{r&&r.scrollNext();},[r]),u=p.useCallback(i=>{a(i.selectedScrollSnap());},[]);return p.useEffect(()=>{r&&(u(r),r.on("reInit",u),r.on("select",u),r?.scrollTo(o));},[r,u]),jsxRuntime.jsxs(ui.Flex,{mt:4,px:2,children:[jsxRuntime.jsx(Ce,{onClick:l}),jsxRuntime.jsx("div",{ref:n,className:"oui-w-full oui-overflow oui-overflow-x-auto oui-scrollbar-hidden oui-hide-scrollbar oui-mx-0",children:jsxRuntime.jsx(ui.Flex,{children:t.map((i,c)=>jsxRuntime.jsx(ui.Box,{onClick:()=>{r?.scrollTo(c);},mx:2,my:1,mr:6,r:"base",className:ui.cn("oui-shrink-0 oui-w-[162px]",o===c&&"oui-outline oui-outline-1 oui-outline-primary-darken"),children:jsxRuntime.jsx("img",{src:i,className:"oui-rounded-sm"})},i))})}),jsxRuntime.jsx(xe,{onClick:s})]})};var we=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=p.useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]),r=t===o,l="oui-flex oui-items-center oui-gap-1 oui-cursor-pointer";return r?l+=" oui-text-base-contrast":l+="",jsxRuntime.jsxs("div",{className:l,onClick:()=>{a(t);},children:[jsxRuntime.jsx(lt,{sel:r}),jsxRuntime.jsx(ui.Text,{size:"xs",intensity:54,className:ui.cn("oui-ml-2 "),children:n})]})},lt=e=>jsxRuntime.jsx("button",{type:"button",children:e.sel===!0?jsxRuntime.jsx(ut,{}):jsxRuntime.jsx(ct,{})}),ut=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"oui-fill-primary-darken",children:[jsxRuntime.jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".36"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3.333"})]}),ct=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".54"})});var te=e=>{let{size:t=16,className:o}=e;return jsxRuntime.jsx("button",{type:"button",onClick:a=>{e.onCheckedChange(!e.checked);},className:o,children:e.checked?jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm6.664 2.922a.8.8 0 0 1 .557-.208c.2 0 .406.063.558.208a.734.734 0 0 1 0 1.063l-5.434 5.179a.826.826 0 0 1-1.115 0l-2.33-2.22a.736.736 0 0 1 0-1.063.827.827 0 0 1 1.117 0l1.77 1.687z",fill:"#fff",fillOpacity:".8"})}):jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm0 1.334h6.667c.737 0 1.334.596 1.334 1.333v6.667c0 .736-.597 1.333-1.334 1.333H4.661a1.333 1.333 0 0 1-1.334-1.333V4.62c0-.737.597-1.333 1.334-1.333",fill:"#fff",fillOpacity:".8"})})})};var De=e=>{let{type:t,curType:o,setShareOption:a}=e,n=p.useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxRuntime.jsxs(ui.Flex,{itemAlign:"center",gap:1,className:ui.cn("hover:oui-cursor-pointer"),onClick:()=>{a(l=>{let s=new Set(l);return r?s.delete(t):s.add(t),s});},children:[jsxRuntime.jsx(te,{size:16,checked:r,className:"oui-pt-[2px]",onCheckedChange:l=>{a(s=>{let u=new Set(s);return r?u.delete(t):u.add(t),u});}}),jsxRuntime.jsx(ui.Text,{size:"xs",intensity:54,children:n})]})};var Le=e=>{let{message:t,setMessage:o,check:a,setCheck:n}=e,[r,l]=p.useState(!1),s=p.useRef(null);return jsxRuntime.jsxs("div",{className:"oui-mt-3 oui-mb-6 oui-flex oui-items-center",children:[jsxRuntime.jsx(te,{className:"oui-mt-[2px]",checked:a,onCheckedChange:u=>{n(u);}}),jsxRuntime.jsx("div",{className:"oui-text-xs oui-text-base-contrast-54 oui-ml-1 hover:oui-cursor-pointer",onClick:()=>{n(!e.check);},children:"Your message"}),jsxRuntime.jsx("div",{className:"oui-bg-base-900 oui-mx-2 oui-rounded-sm",children:jsxRuntime.jsx(ui.Input,{ref:s,placeholder:"Max 25 characters",classNames:{root:"oui-w-[320px]"},size:"sm",value:t,autoFocus:!1,suffix:r&&jsxRuntime.jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:u=>{o(""),setTimeout(()=>{s.current?.focus();},50),u.stopPropagation();},children:jsxRuntime.jsx(ui.CloseCircleFillIcon,{size:18,color:"white"})}),onFocus:()=>l(!0),onBlur:()=>l(!1),onChange:u=>{if(u.target.value.length>25){ui.toast.error("Maximum support of 25 characters");return}n(u.target.value.length>0),o(u.target.value);}})})]})};var Ie=e=>{let{onClickDownload:t,onClickCopy:o}=e;return jsxRuntime.jsxs(ui.Flex,{px:8,gap:3,mt:3,itemAlign:"center",children:[jsxRuntime.jsxs(ui.Button,{color:"secondary",className:"oui-flex-1 oui-flex oui-gap-1",onClick:t,children:[jsxRuntime.jsx("span",{children:jsxRuntime.jsx(bt,{})}),"Download"]}),jsxRuntime.jsxs(ui.Button,{className:"oui-flex-1 oui-flex oui-gap-1",onClick:o,children:[jsxRuntime.jsx("span",{children:jsxRuntime.jsx(wt,{})}),"Copy"]})]})},bt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4.66 1.994A2.667 2.667 0 0 0 1.995 4.66v6.666a2.667 2.667 0 0 0 2.667 2.667h6.666a2.667 2.667 0 0 0 2.667-2.667V4.661a2.667 2.667 0 0 0-2.667-2.667zM7.995 4.66c.368 0 .667.298.667.666V8.66h2l-2.667 2.666L5.328 8.66h2V5.327c0-.368.299-.667.667-.667",fill:"#fff",fillOpacity:".98"})}),wt=()=>jsxRuntime.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M5.166 1.994A2.667 2.667 0 0 0 2.499 4.66v4a2.667 2.667 0 0 0 2.667 2.667 2.667 2.667 0 0 0 2.666 2.667h4a2.667 2.667 0 0 0 2.667-2.667v-4a2.667 2.667 0 0 0-2.667-2.667 2.667 2.667 0 0 0-2.666-2.666zm6.666 4c.737 0 1.334.596 1.334 1.333v4c0 .737-.597 1.334-1.334 1.334h-4A1.333 1.333 0 0 1 6.5 11.327h2.667a2.667 2.667 0 0 0 2.666-2.667z",fill:"#fff",fillOpacity:".98"})});var Te=e=>{let{shareOptions:t}=e,o=ee(),n=e.entity.roi!=null&&e.entity.pnl!=null?["roi_pnl","roi","pnl"]:e.entity.roi!=null?["roi"]:e.entity.pnl!=null?["pnl"]:[],[r,l]=p.useState(n.length==1?n[0]:o.pnlFormat),[s,u]=p.useState(new Set(o.options)),[i,c]=p.useState(o.bgIndex),[d,C]=p.useState(o.message),[B,S]=p.useState(!1),{backgroundImages:w,...O}=t??{backgroundImages:[]},[M,P]=p.useState(""),y=p.useRef(null);p.useEffect(()=>{let N=window.location.hostname;P(N);},[]);let I=p.useMemo(()=>t?.backgroundImages?.[i],[t?.backgroundImages,i]),W=X(e.entity,e.leverage,B?d:"",M,r,s,e.baseDp,e.quoteDp,e.referral),h=()=>{y.current?.copy().then(()=>{e.hide?.(),ui.toast.success("Image copied");}).catch(N=>{ui.toast.error(()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{children:"Copy failed"}),jsxRuntime.jsx("div",{className:"oui-text-2xs oui-max-w-[396px] oui-mt-2 oui-text-base-contrast-54",children:"Browser version outdated, please update in order to copy image to clipboard."})]}));});},Z=()=>{y.current?.download("Poster.png"),e.hide?.();},ne=[...e.entity.openPrice?["openPrice"]:[],...e.entity.markPrice?["markPrice"]:[],...e.entity.openTime?["openTime"]:[],...e.leverage?["leverage"]:[],...e.entity.quantity?["quantity"]:[]];return j(r,s,i,d),jsxRuntime.jsxs("div",{className:"oui-h-full oui-flex oui-flex-col oui-relative oui-w-full",children:[jsxRuntime.jsxs("div",{className:"oui-flex-1 oui-h-full oui-overflow-y-auto",children:[jsxRuntime.jsxs(ui.Box,{mt:9,height:422,children:[jsxRuntime.jsx(ui.Flex,{itemAlign:"center",justify:"center",children:jsxRuntime.jsx($,{width:552,height:310,data:{backgroundImg:I,...O,data:W},ratio:3,ref:y})}),jsxRuntime.jsx(be,{backgroundImages:t?.backgroundImages??[],selectedSnap:i,setSelectedSnap:c})]}),jsxRuntime.jsxs(ui.Flex,{direction:"column",px:10,mt:6,justify:"start",itemAlign:"start",width:"100%",children:[jsxRuntime.jsx(ui.Text,{size:"sm",intensity:80,children:"PnL display format"}),jsxRuntime.jsx(ui.Flex,{pt:3,gap:3,itemAlign:"center",children:n.map((N,E)=>jsxRuntime.jsx(we,{setPnlFormat:l,type:N,curType:r},E))}),jsxRuntime.jsx(ui.Divider,{className:"oui-w-full oui-pt-6 oui-border-white/10"}),jsxRuntime.jsxs(ui.Flex,{mt:6,direction:"column",justify:"start",itemAlign:"start",children:[jsxRuntime.jsx(ui.Text,{size:"sm",intensity:80,children:"Optional information to share"}),jsxRuntime.jsx(ui.Flex,{mt:3,gap:4,children:ne.map((N,E)=>jsxRuntime.jsx(De,{setShareOption:u,type:N,curType:s},E))})]}),jsxRuntime.jsx(Le,{message:d,setMessage:C,check:B,setCheck:S})]})]}),jsxRuntime.jsx(Ie,{onClickCopy:h,onClickDownload:Z})]})};var Me=p__namespace.createContext(null);function F(){let e=p__namespace.useContext(Me);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}var le=p__namespace.forwardRef(({orientation:e="horizontal",opts:t,setApi:o,plugins:a,className:n,children:r,...l},s)=>{let[u,i]=et__default.default({...t,axis:e==="horizontal"?"x":"y"},a),[c,d]=p__namespace.useState(!1),[C,B]=p__namespace.useState(!1),[S,w]=p__namespace.useState(l.initIndex||0),[O,M]=p__namespace.useState([]),P=p__namespace.useCallback(h=>{h&&(O.length===0&&M(h.scrollSnapList()),w(h.selectedScrollSnap()),d(h.canScrollPrev()),B(h.canScrollNext()));},[O]),y=p__namespace.useCallback(()=>{i?.scrollPrev();},[i]),I=p__namespace.useCallback(()=>{i?.scrollNext();},[i]),W=p__namespace.useCallback(h=>{h.key==="ArrowLeft"?(h.preventDefault(),y()):h.key==="ArrowRight"&&(h.preventDefault(),I());},[y,I]);return p__namespace.useEffect(()=>{!i||!o||o(i);},[i,o]),p__namespace.useEffect(()=>{if(i)return P(i),i.on("reInit",P),i.on("select",P),l.initIndex&&i.scrollTo(l.initIndex),()=>{i?.off("select",P);}},[i,P]),jsxRuntime.jsx(Me.Provider,{value:{carouselRef:u,api:i,opts:t,orientation:e||(t?.axis==="y"?"vertical":"horizontal"),scrollPrev:y,scrollNext:I,canScrollPrev:c,canScrollNext:C,selectedIndex:S,scrollSnaps:O},children:jsxRuntime.jsx("div",{ref:s,onKeyDownCapture:W,className:ui.cn("oui-relative",n),role:"region","aria-roledescription":"carousel",...l,children:r})})});le.displayName="Carousel";var Q=p__namespace.forwardRef(({className:e,...t},o)=>{let{carouselRef:a,orientation:n}=F();return jsxRuntime.jsx("div",{ref:a,className:"oui-overflow-hidden",children:jsxRuntime.jsx("div",{ref:o,className:ui.cn("oui-flex",n==="horizontal"?"oui--ml-4":"oui--mt-4 oui-flex-col",e),...t})})});Q.displayName="CarouselContent";var J=p__namespace.forwardRef(({className:e,...t},o)=>{let{orientation:a}=F();return jsxRuntime.jsx("div",{ref:o,role:"group","aria-roledescription":"slide",className:ui.cn("oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full",a==="horizontal"?"oui-pl-4":"oui-pt-4",e),...t})});J.displayName="CarouselItem";var ue=p__namespace.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollPrev:l,canScrollPrev:s}=F();return jsxRuntime.jsxs(ui.Button,{ref:n,variant:t,className:ui.cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--left-12 oui-top-1/2 oui--translate-y-1/2":"oui--top-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!s,onClick:l,...a,children:[jsxRuntime.jsx(ChevronLeft,{size:20}),jsxRuntime.jsx("span",{className:"oui-sr-only",children:"Previous slide"})]})});ue.displayName="CarouselPrevious";var ce=p__namespace.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollNext:l,canScrollNext:s}=F();return jsxRuntime.jsxs(ui.Button,{ref:n,variant:t,className:ui.cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--right-12 oui-top-1/2 oui--translate-y-1/2":"oui--bottom-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!s,onClick:l,...a,children:[jsxRuntime.jsx(ChevronRight,{size:20}),jsxRuntime.jsx("span",{className:"oui-sr-only",children:"Next slide"})]})});ce.displayName="CarouselNext";var me=e=>{let{scrollSnaps:t,selectedIndex:o}=F();return jsxRuntime.jsx("div",{className:ui.cn("oui-flex oui-gap-1",e.className),children:t.map((a,n)=>jsxRuntime.jsx(pe,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})};me.displayName="CarouselIdentifier";var pe=({index:e,active:t,onClick:o,className:a,activeClassName:n})=>jsxRuntime.jsx("button",{onClick:()=>o?.(e),className:ui.cn("oui-w-2 oui-h-2 oui-rounded-full oui-bg-white/30",a,t&&`active ${n||"oui-bg-primary-darken"}`)});var T=le;T.Content=Q;T.Item=J;T.Next=ce;T.Previous=ue;T.indentify=me;var ze=e=>{let{shareOptions:t}=e,o=ee(),n=e.entity.roi!=null&&e.entity.pnl!=null?["roi_pnl","roi","pnl"]:e.entity.roi!=null?["roi"]:e.entity.pnl!=null?["pnl"]:[],[r,l]=p.useState(n.length==1?n[0]:o.pnlFormat),[s,u]=p.useState(new Set(o.options)),[i,c]=p.useState(o.message),[d,C]=p.useState(o.bgIndex),{backgroundImages:B,...S}=t??{backgroundImages:[]},[w,O]=p.useState(""),M=t?.backgroundImages?.map(()=>p.useRef(null));p.useEffect(()=>{let f=window.location.hostname;O(f);},[]);let P=X(e.entity,e.leverage,i,w,r,s,e.baseDp,e.quoteDp,e.referral),y=p.useRef(),I=552/310,[W,h]=p.useState(1),[Z,ne]=p.useState(0),[N,E]=p.useState(!1),ve=p.useRef(null);p.useEffect(()=>{if(y.current){let f=y.current.offsetWidth,A=f/I;ne(A),h(f/552);}},[y,w]);let We=async f=>{if(!f.current)return;let A=f.current?.toDataURL(),$e=At(A);try{navigator.share&&await navigator.share({text:i,files:[new File([$e],"image.png",{type:"image/png"})]}),e.hide?.();}catch{}};return j(r,s,d,i),jsxRuntime.jsxs("div",{className:"oui-w-full",children:[jsxRuntime.jsx("div",{ref:y,className:"oui-w-full oui-mt-4 oui-overflow-hidden",style:{height:`${Z+20}px`},children:jsxRuntime.jsxs(T,{className:"oui-w-full oui-overflow-hidden",opts:{align:"start"},initIndex:d,children:[jsxRuntime.jsx(Q,{style:{height:`${Z}px`},children:t?.backgroundImages?.map((f,A)=>jsxRuntime.jsx(J,{children:jsxRuntime.jsx($,{className:"oui-transform oui-origin-top-left",style:{scale:`${W}`},width:552,height:310,data:{backgroundImg:f,...S,data:P},ratio:3,ref:M?.[A]})},A))}),jsxRuntime.jsx("div",{className:"oui-mt-2 oui-mb-1 oui-flex oui-justify-center",children:jsxRuntime.jsx(zt,{dotClassName:"oui-w-[16px] oui-h-[4px] oui-bg-base-300",dotActiveClassName:"!oui-bg-primary-darken oui-w-[20px]",setSelectIndex:C})})]})}),jsxRuntime.jsxs(ui.ScrollArea,{className:"oui-max-h-[200px] oui-overflow-y-auto oui-custom-scrollbar",children:[jsxRuntime.jsxs("div",{className:"oui-mt-4",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54",children:"PnL display format"}),jsxRuntime.jsx("div",{className:"oui-pt-3 oui-px-1 oui-justify-between oui-gap-3 oui-grid oui-grid-cols-3 oui-row-span-1",children:n.map(f=>jsxRuntime.jsx(Et,{setPnlFormat:l,type:f,curType:r}))})]}),jsxRuntime.jsxs("div",{className:"oui-mt-3",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Optional information to share"}),jsxRuntime.jsxs("div",{className:"oui-flex oui-flex-wrap oui-gap-3 oui-mt-3",children:[e.entity.openPrice&&jsxRuntime.jsx(Y,{setShareOption:u,type:"openPrice",curType:s}),e.entity.openTime&&jsxRuntime.jsx(Y,{setShareOption:u,type:"openTime",curType:s}),e.leverage&&jsxRuntime.jsx(Y,{setShareOption:u,type:"leverage",curType:s}),e.entity.markPrice&&jsxRuntime.jsx(Y,{setShareOption:u,type:"markPrice",curType:s}),e.entity.quantity&&jsxRuntime.jsx(Y,{setShareOption:u,type:"quantity",curType:s})]})]}),jsxRuntime.jsxs("div",{className:"oui-mt-3 oui-mb-8",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Your message"}),jsxRuntime.jsx("div",{className:"oui-mt-3 oui-h-[48px] oui-bg-base-600 oui-mx-1",children:jsxRuntime.jsx(ui.Input,{placeholder:"Max 25 characters",containerClassName:"oui-bg-transparent oui-h-[48px]",value:i,autoFocus:!1,onChange:f=>{if(f.target.value.length>25){ui.toast.error("Maximum support of 25 characters");return}c(f.target.value);},ref:ve,onFocus:()=>E(!0),onBlur:()=>E(!1),suffix:N&&jsxRuntime.jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:f=>{c(""),setTimeout(()=>{ve.current?.focus();},50),f.stopPropagation();},children:jsxRuntime.jsx(ui.CloseCircleFillIcon,{size:18,color:"white"})})})})]})]}),jsxRuntime.jsx("div",{className:"oui-pt-2",children:jsxRuntime.jsx(ui.Button,{fullWidth:!0,className:"oui-h-[40px] oui-text-[16px]",onClick:()=>{let f=M?.[d];f&&We(f);},children:"Share"})})]})},Et=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=p.useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]);return jsxRuntime.jsx("div",{className:ui.cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-flex-1 oui-bg-base-4 hover:oui-cursor-pointer oui-flex oui-items-center oui-px-3 oui-referral-shadow",t===o&&"oui-bg-primary-darken oui-dot-sel"),onClick:()=>{a(t);},children:jsxRuntime.jsx("div",{className:"oui-text-sm oui-text-base-contrast",children:n})})},Y=e=>{let{type:t,curType:o,setShareOption:a}=e,n=p.useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxRuntime.jsxs("div",{className:ui.cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-mt-0 oui-w-[calc(50%-6px)] oui-bg-base-4 hover:oui-cursor-pointer oui-items-center oui-flex oui-p-3 oui-referral-shadow"),onClick:()=>{a(l=>{let s=new Set(l);return r?s.delete(t):s.add(t),s});},children:[jsxRuntime.jsx("div",{className:"oui-text-sm oui-flex-1 oui-text-base-contrast",children:n}),r&&jsxRuntime.jsx(Ht,{})]})};function At(e){let t=atob(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],a=new ArrayBuffer(t.length),n=new Uint8Array(a);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return new Blob([a],{type:o})}var zt=e=>{let{scrollSnaps:t,selectedIndex:o}=F();return p.useEffect(()=>{e.setSelectIndex(o);},[o]),jsxRuntime.jsx("div",{className:ui.cn("oui-flex oui-gap-1"),children:t.map((a,n)=>jsxRuntime.jsx(pe,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})},Ht=()=>jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.01416 11.9989C2.01416 6.47589 6.49136 1.9989 12.0142 1.9989C17.5372 1.9989 22.0142 6.47589 22.0142 11.9989C22.0142 17.5219 17.5372 21.9989 12.0142 21.9989C6.49136 21.9989 2.01416 17.5219 2.01416 11.9989ZM16.9853 7.31211C17.2125 7.09537 17.5236 7 17.8218 7C18.1201 7 18.4312 7.09537 18.6583 7.31211C19.1139 7.74546 19.1139 8.47384 18.6583 8.9072L10.5077 16.675C10.0534 17.1083 9.28909 17.1083 8.83472 16.675L5.34077 13.3459C4.88641 12.9126 4.88641 12.1841 5.34077 11.7508C5.79631 11.3175 6.56057 11.3175 7.01493 11.7508L9.67122 14.2822L16.9853 7.31211Z",fill:"white",fillOpacity:"1"})});var He=e=>{let{leverage:t,entity:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:l,hide:s}=e,[u,i]=p.useState(window.innerHeight<900?660:807);return p.useEffect(()=>{let c=()=>{i(window.innerHeight<900?660:807);};return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c);}},[]),l==null||o==null?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx(Te,{entity:o,leverage:`${t}`,hide:s,baseDp:a,quoteDp:n,referral:r,shareOptions:l})},_e=e=>{let{leverage:t,entity:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:l,hide:s}=e;return l==null||o==null?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx(ze,{entity:o,leverage:t,hide:s,baseDp:a,quoteDp:n,referral:r,shareOptions:l})};var ge=e=>{let t=G({hide:e.hide,pnl:e.pnl});return jsxRuntime.jsx(_e,{...t})},ye=e=>{let t=G({hide:e.hide,pnl:e.pnl});return jsxRuntime.jsx(He,{...t})};var $t="sharePnLDialog",Vt="sharePnLBottomSheet";ui.registerSimpleDialog($t,ye,{contentClassName:"!oui-max-w-[624px] oui-p-0"});ui.registerSimpleSheet(Vt,ge,{title:"Share PnL",classNames:{body:"oui-pb-4 oui-pt-0"}});
|
|
34
34
|
|
|
35
|
-
exports.SharePnLBottomSheetId =
|
|
36
|
-
exports.SharePnLBottomSheetWidget =
|
|
37
|
-
exports.SharePnLDialogId =
|
|
38
|
-
exports.SharePnLDialogWidget =
|
|
39
|
-
exports.useSharePnLScript =
|
|
35
|
+
exports.SharePnLBottomSheetId = Vt;
|
|
36
|
+
exports.SharePnLBottomSheetWidget = ge;
|
|
37
|
+
exports.SharePnLDialogId = $t;
|
|
38
|
+
exports.SharePnLDialogWidget = ye;
|
|
39
|
+
exports.useSharePnLScript = G;
|
|
40
40
|
//# sourceMappingURL=out.js.map
|
|
41
41
|
//# sourceMappingURL=index.js.map
|