export class DocumentEditorDebugTools {
    document;
    operations = [];
    constructor(document) {
        if (document) {
            this.document = document;
        }
    }
    operationsToTableObject(operations) {
        return operations.map((op) => ({
            ...op,
            input: JSON.stringify(op.action.input),
        }));
    }
    setDocument(document) {
        this.document = document;
    }
    getDocument() {
        return this.document;
    }
    getOperations() {
        return this.operations;
    }
    pushOperation(operation) {
        this.operations.push(operation);
    }
    operationsTable() {
        if (!this.document) {
            console.warn("No document");
        }
        const ops = Object.values(this.document?.operations || {})
            .filter((array) => array !== undefined)
            .flatMap((array) => array)
            .sort((a, b) => a.index - b.index);
        console.table(this.operationsToTableObject(ops));
    }
    scopeOperationsTable(scope) {
        if (!this.document) {
            console.warn("No document");
        }
        const ops = this.document?.operations[scope] || [];
        console.table(this.operationsToTableObject(ops));
    }
    operationsLog() {
        console.log(this.operations);
    }
    operationsLogTable() {
        console.table(this.operationsToTableObject(this.operations));
    }
    clear() {
        this.operations = [];
        this.document = undefined;
    }
}
//# sourceMappingURL=document-editor-debug-tools.js.map