"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.weakMerge = weakMerge;
function weakMerge(a, b) {
    return new Proxy(b, {
        get(_, p) {
            var _a;
            return (_a = b[p]) !== null && _a !== void 0 ? _a : a[p];
        },
        set(_, p, v) {
            b[p] = v;
            return true;
        },
        has(_, p) {
            return p in b || p in a;
        },
        deleteProperty(target, property) {
            if (b[property] !== undefined) {
                delete b[property];
                return true;
            }
            else if (a[property] !== undefined) {
                delete a[property];
                return true;
            }
            return false;
        },
        ownKeys() {
            return [
                ...new Set([
                    ...Object.getOwnPropertyNames(a),
                    ...Object.getOwnPropertyNames(b),
                ]),
            ];
        },
        getOwnPropertyDescriptor() {
            return {
                enumerable: true,
                configurable: true,
                writable: true,
            };
        },
    });
}
//# sourceMappingURL=weakMerge.js.map