/**
 * Shared property mutation, snapshot, and diff helpers used by
 * NodePropSet, EdgePropSet, and PropSet op classes.
 *
 * @module domain/types/ops/propHelpers
 */
/** LWW property mutation — sets or updates a prop register. */
export function mutateProp(state, propKey, eventId, value) {
    state.mutatePropLWW(propKey, eventId, value);
}
/** Pre-op snapshot for a property register. */
export function snapshotProp(state, propKey) {
    const reg = state.getEncodedProp(propKey);
    return { prevPropValue: reg !== undefined ? reg.value : undefined, propKey };
}
/** Post-op diff accumulation for a property register. */
export function accumulatePropDiff(diff, state, nodeId, key, before) {
    const reg = before.propKey !== undefined ? state.getEncodedProp(before.propKey) : undefined;
    const newVal = reg !== undefined ? reg.value : undefined;
    if (newVal !== before.prevPropValue) {
        diff.propsChanged.push({
            nodeId,
            key,
            value: newVal,
            prevValue: before.prevPropValue,
        });
    }
}
