"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "TPSLTriggerPrice", {
    enumerable: true,
    get: function() {
        return TPSLTriggerPrice;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _text = require("../../text");
const TPSLTriggerPrice = (props)=>{
    const { order, position } = props;
    const pnl = (0, _react.useMemo)(()=>{
        const children = Object.create(null);
        if (!!props.takeProfitPrice) {
            children.TP = /*#__PURE__*/ (0, _jsxruntime.jsx)(_text.Numeral, {
                rule: "price",
                className: "orderly-text-trade-profit",
                children: props.takeProfitPrice
            });
        }
        if (!!props.stopLossPrice) {
            children.SL = /*#__PURE__*/ (0, _jsxruntime.jsx)(_text.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__*/ (0, _jsxruntime.jsx)("span", {
                children: "/"
            }));
        }
        return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
            className: "orderly-text-3xs orderly-text-base-contrast-36 orderly-mt-2",
            children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-gap-1",
                children: [
                    keys.map((key, index)=>{
                        return /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                            children: key
                        }, index);
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        children: ":"
                    }),
                    values.map((child, index)=>{
                        return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, {
                            children: child
                        }, index);
                    })
                ]
            })
        });
    }, [
        props.takeProfitPrice,
        props.stopLossPrice
    ]);
    return pnl;
};

//# sourceMappingURL=tpslTriggerPrice.js.map