/**
 * DevExtreme (cjs/ui/validation/default_adapter.js)
 * Version: 23.2.4 (build 24056-0112)
 * Build date: Sun Feb 25 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.default = void 0;
var _class = _interopRequireDefault(require("../../core/class"));

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
const DefaultAdapter = _class.default.inherit({
    ctor(editor, validator) {
        this.editor = editor;
        this.validator = validator;
        this.validationRequestsCallbacks = [];
        const handler = args => {
            this.validationRequestsCallbacks.forEach(item => item(args))
        };
        editor.validationRequest.add(handler);
        editor.on("disposing", (function() {
            editor.validationRequest.remove(handler)
        }))
    },
    getValue() {
        return this.editor.option("value")
    },
    getCurrentValidationError() {
        return this.editor.option("validationError")
    },
    bypass() {
        return this.editor.option("disabled")
    },
    applyValidationResults(params) {
        this.editor.option({
            validationErrors: params.brokenRules,
            validationStatus: params.status
        })
    },
    reset() {
        this.editor.clear()
    },
    focus() {
        this.editor.focus()
    }
});
var _default = DefaultAdapter;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;
