/**
 * DevExtreme (cjs/__internal/ui/html_editor/converters/m_delta.js)
 * Version: 23.2.9 (build 24294-0112)
 * Build date: Sun Oct 20 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = void 0;
var _m_converterController = _interopRequireDefault(require("../m_converterController"));

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
let DeltaConverter = function() {
    function DeltaConverter() {}
    var _proto = DeltaConverter.prototype;
    _proto.setQuillInstance = function(quillInstance) {
        this.quillInstance = quillInstance
    };
    _proto.toHtml = function() {
        if (!this.quillInstance) {
            return
        }
        return this._isQuillEmpty() ? "" : this.quillInstance.getSemanticHTML(0, this.quillInstance.getLength() + 1)
    };
    _proto._isQuillEmpty = function() {
        const delta = this.quillInstance.getContents();
        return 1 === delta.length() && this._isDeltaEmpty(delta)
    };
    _proto._isDeltaEmpty = function(delta) {
        return delta.reduce((__, _ref) => {
            let {
                insert: insert
            } = _ref;
            return -1 !== insert.indexOf("\n")
        })
    };
    return DeltaConverter
}();
_m_converterController.default.addConverter("delta", DeltaConverter);
var _default = DeltaConverter;
exports.default = _default;
