import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Fragment, useMemo } from "react";
import { Numeral } from "../../text";
export const TPSLTriggerPrice = (props)=>{
    const { order, position } = props;
    const pnl = useMemo(()=>{
        const children = Object.create(null);
        if (!!props.takeProfitPrice) {
            children.TP = /*#__PURE__*/ _jsx(Numeral, {
                rule: "price",
                className: "orderly-text-trade-profit",
                children: props.takeProfitPrice
            });
        }
        if (!!props.stopLossPrice) {
            children.SL = /*#__PURE__*/ _jsx(Numeral, {
                rule: "price",
                className: "orderly-text-trade-loss",
                children: props.stopLossPrice
            });
        }
        const keys = Object.keys(children);
        const values = Object.values(children);
        if (keys.length === 0) return null;
        if (keys.length === 2) {
            keys.splice(1, 0, "/");
        }
        if (values.length === 2) {
            values.splice(1, 0, /*#__PURE__*/ _jsx("span", {
                children: "/"
            }));
        }
        return /*#__PURE__*/ _jsx("div", {
            className: "orderly-text-3xs orderly-text-base-contrast-36 orderly-mt-2",
            children: /*#__PURE__*/ _jsxs("div", {
                className: "orderly-flex orderly-gap-1",
                children: [
                    keys.map((key, index)=>{
                        return /*#__PURE__*/ _jsx("span", {
                            children: key
                        }, index);
                    }),
                    /*#__PURE__*/ _jsx("span", {
                        children: ":"
                    }),
                    values.map((child, index)=>{
                        return /*#__PURE__*/ _jsx(Fragment, {
                            children: child
                        }, index);
                    })
                ]
            })
        });
    }, [
        props.takeProfitPrice,
        props.stopLossPrice
    ]);
    return pnl;
};

//# sourceMappingURL=tpslTriggerPrice.js.map