"use strict";
// Proxy the dom ref with `{ nativeElement, otherFn }` type
// ref: https://github.com/ant-design/ant-design/discussions/45242
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = useProxyImperativeHandle;
const react_1 = require("react");
function useProxyImperativeHandle(ref, init) {
    return (0, react_1.useImperativeHandle)(ref, () => {
        const refObj = init();
        const { nativeElement } = refObj;
        return new Proxy(nativeElement, {
            get(obj, prop) {
                if (refObj[prop]) {
                    return refObj[prop];
                }
                return Reflect.get(obj, prop);
            },
        });
    });
}
