

class TextModelEditReason {
    static { this._nextMetadataId = 0; }
    static { this._metaDataMap = ( new Map()); }
    static editWithReason(reason, runner) {
        const id = this._nextMetadataId++;
        this._metaDataMap.set(id, reason.metadata);
        try {
            const result = runner();
            return result;
        }
        finally {
            this._metaDataMap.delete(id);
        }
    }
    static _getCurrentMetadata() {
        const result = {};
        for (const metadata of ( this._metaDataMap.values())) {
            Object.assign(result, metadata);
        }
        return result;
    }
    constructor(metadata) {
        this.metadata = metadata;
    }
}

export { TextModelEditReason };
