"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.merge = exports.diff = void 0;
const JsonCrdtDiff_1 = require("./JsonCrdtDiff");
const diff = (src, dst) => {
    const diff = new JsonCrdtDiff_1.JsonCrdtDiff(src.api.model);
    const patch = diff.diff(src.node, dst);
    return patch.ops.length ? patch : void 0;
};
exports.diff = diff;
const merge = (src, dst) => {
    const patch = (0, exports.diff)(src, dst);
    if (patch)
        src.api.model.applyPatch(patch);
    return patch;
};
exports.merge = merge;
//# sourceMappingURL=index.js.map