"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "useAccountStatus", {
    enumerable: true,
    get: function() {
        return useAccountStatus;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
const _modal = require("../../modal");
function _getRequireWildcardCache(nodeInterop) {
    if (typeof WeakMap !== "function") return null;
    var cacheBabelInterop = new WeakMap();
    var cacheNodeInterop = new WeakMap();
    return (_getRequireWildcardCache = function(nodeInterop) {
        return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
    })(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
    if (!nodeInterop && obj && obj.__esModule) {
        return obj;
    }
    if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
        return {
            default: obj
        };
    }
    var cache = _getRequireWildcardCache(nodeInterop);
    if (cache && cache.has(obj)) {
        return cache.get(obj);
    }
    var newObj = {
        __proto__: null
    };
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for(var key in obj){
        if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
            var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
            if (desc && (desc.get || desc.set)) {
                Object.defineProperty(newObj, key, desc);
            } else {
                newObj[key] = obj[key];
            }
        }
    }
    newObj.default = obj;
    if (cache) {
        cache.set(obj, newObj);
    }
    return newObj;
}
const useAccountStatus = ()=>{
    const onSettle = (0, _react.useCallback)(()=>{
        return _modal.modal.confirm({
            title: "Settle PnL",
            content: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                className: "orderly-text-base-contrast-54 orderly-text-2xs",
                children: "Are you sure you want to settle your PnL? Settlement will take up to 1 minute before you can withdraw your available balance."
            }),
            onCancel: ()=>{
                return Promise.reject();
            },
            onOk: ()=>{
                // @ts-ignore
                if (typeof props.onSettle !== "function") return Promise.resolve();
                // @ts-ignore
                return props.onSettle().catch((e)=>{});
            }
        });
    }, []);
    return {
        onSettle
    };
};

//# sourceMappingURL=useAccountStatus.js.map