"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "ShareOption", {
    enumerable: true,
    get: function() {
        return ShareOption;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _utils = require("../../../utils");
const _checkbox = require("../../../checkbox");
const ShareOption = (props)=>{
    const { type, curType, setShareOption } = props;
    const text = (0, _react.useMemo)(()=>{
        switch(type){
            case "openPrice":
                return "Open price";
            case "openTime":
                return "Opened at";
            case "markPrice":
                return "Mark price";
            case "quantity":
                return "Quantity";
            case "leverage":
                return "Leverage";
        }
    }, [
        type
    ]);
    const isSelected = curType.has(type);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
        className: (0, _utils.cn)("orderly-h-[20px] hover:orderly-cursor-pointer orderly-items-center orderly-flex"),
        onClick: ()=>{
            // setPnlFormat(type);
            setShareOption((value)=>{
                const updateSet = new Set(value);
                if (isSelected) {
                    updateSet.delete(type);
                } else {
                    updateSet.add(type);
                }
                return updateSet;
            });
        },
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsx)(_checkbox.Checkbox, {
                checked: isSelected,
                onCheckedChange: (checked)=>{
                    setShareOption((value)=>{
                        const updateSet = new Set(value);
                        if (isSelected) {
                            updateSet.delete(type);
                        } else {
                            updateSet.add(type);
                        }
                        return updateSet;
                    });
                }
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                className: "orderly-text-sm orderly-text-base-contrast-54 orderly-pl-1",
                children: text
            })
        ]
    });
};

//# sourceMappingURL=options.js.map