import { TextEditor } from '../textEditor/index.mjs';
import { createInputElementResizer } from '../../utils/autoResize.mjs';
import { empty } from '../../helpers/dom/element.mjs';
import { A11Y_TABINDEX } from '../../helpers/a11y.mjs';
export const EDITOR_TYPE = 'password';
/**
 * @private
 * @class PasswordEditor
 */ export class PasswordEditor extends TextEditor {
    static get EDITOR_TYPE() {
        return EDITOR_TYPE;
    }
    createElements() {
        super.createElements();
        this.TEXTAREA = this.hot.rootDocument.createElement('input');
        this.TEXTAREA.setAttribute('type', 'password');
        this.TEXTAREA.setAttribute('data-hot-input', ''); // Makes the element recognizable by Hot as its own component's element.
        this.TEXTAREA.className = 'handsontableInput';
        this.textareaStyle = this.TEXTAREA.style;
        this.textareaStyle.width = 0;
        this.textareaStyle.height = 0;
        empty(this.TEXTAREA_PARENT);
        this.TEXTAREA.setAttribute(...A11Y_TABINDEX(-1));
        this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
    }
    constructor(...args){
        super(...args), /**
   * Autoresize instance for resizing the editor to the size of the entered text. Its overwrites the default
   * resizer of the TextEditor.
   *
   * @private
   * @type {Function}
   */ this.autoResize = createInputElementResizer(this.hot.rootDocument, {
            textContent: (element)=>'•'.repeat(element.value.length)
        });
    }
}
