import * as i0 from '@angular/core';
import { InjectionToken, inject, Injectable, EventEmitter, ElementRef, PLATFORM_ID, Renderer2, NgZone, SecurityContext, forwardRef, booleanAttribute, Input, Output, ViewEncapsulation, Component, NgModule } from '@angular/core';
import { DOCUMENT, isPlatformServer, CommonModule } from '@angular/common';
import { DomSanitizer } from '@angular/platform-browser';
import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
import { Observable } from 'rxjs';

const defaultModules = {
    toolbar: [
        ['bold', 'italic', 'underline', 'strike'], // toggled buttons
        ['blockquote', 'code-block'],
        [{ header: 1 }, { header: 2 }], // custom button values
        [{ list: 'ordered' }, { list: 'bullet' }],
        [{ script: 'sub' }, { script: 'super' }], // superscript/subscript
        [{ indent: '-1' }, { indent: '+1' }], // outdent/indent
        [{ direction: 'rtl' }], // text direction
        [{ size: ['small', false, 'large', 'huge'] }], // custom dropdown
        [{ header: [1, 2, 3, 4, 5, 6, false] }],
        [{ color: [] }, { background: [] }], // dropdown with defaults from theme
        [{ font: [] }],
        [{ align: [] }],
        ['clean'], // remove formatting button
        ['table'], // adds the insert table button
        ['link', 'image', 'video'], // link and image, video
    ],
};

const QUILL_CONFIG_TOKEN = new InjectionToken('config');
const QUILL_DYNAMIC_CONFIG_TOKEN = new InjectionToken('Dynamic loading config');

/**
 * @internal This service is not part of the public API of the component
 */
class LoaderService {
    constructor() {
        this.dynamicConfig = inject(QUILL_DYNAMIC_CONFIG_TOKEN, { optional: true });
    }
    /**
     * Load the Quill.js library
     *
     * @param path Path to the Quill.js library e.g. "assets/quill/dist". The path must contain the "quill.js"
     * and "quillEditor.min.css" files and also the css ones.
     */
    load() {
        let loaded = false;
        return new Observable(observer => {
            // check if window.Quill is defined other load it
            if (window.Quill === undefined) {
                const loadResult = { mainScript: false, style: false, secondaryScript: false, };
                // style
                const quillEditorStyle = document.createElement('link');
                quillEditorStyle.href = `${this.dynamicConfig?.path}/quill.core.css`;
                quillEditorStyle.rel = 'stylesheet';
                const quillEditorStyleOnload = () => {
                    quillEditorStyle.removeEventListener('load', quillEditorStyleOnload);
                    quillEditorStyle.removeEventListener('error', quillEditorOnerror);
                    loadResult.style = true;
                    if (Object.values(loadResult).every(v => v === true)) {
                        observer.next(true);
                        observer.complete();
                        loaded = true;
                    }
                };
                const quillEditorSnowStyle = document.createElement('link');
                quillEditorSnowStyle.href = `${this.dynamicConfig?.path}/quill.snow.css`;
                quillEditorSnowStyle.rel = 'stylesheet';
                // script to inject into page the Quill.js
                let quillEditorScript = document.createElement('script');
                quillEditorScript.src = `${this.dynamicConfig?.path}/quill.js`;
                quillEditorScript.type = 'application/javascript';
                quillEditorScript.async = true;
                const quillEditorScriptOnload = () => {
                    quillEditorScript.removeEventListener('load', quillEditorScriptOnload);
                    quillEditorScript.removeEventListener('error', quillEditorOnerror);
                    loadResult.mainScript = true;
                    document.body.append(quillBetterTableScript);
                    if (Object.values(loadResult).every(v => v === true)) {
                        observer.next(true);
                        observer.complete();
                        loaded = true;
                    }
                };
                // script to inject into page the Quill-better-table"node_modules/quill-better-table/dist/quill-better-table.min.js",
                const quillBetterTableScript = document.createElement('script');
                quillBetterTableScript.src = `${this.dynamicConfig?.path}/quill-better-table.js`;
                quillBetterTableScript.type = 'application/javascript';
                quillBetterTableScript.async = true;
                const quillBetterTableScriptOnload = () => {
                    quillBetterTableScript.removeEventListener('load', quillBetterTableScriptOnload);
                    quillBetterTableScript.removeEventListener('error', quillEditorOnerror);
                    loadResult.secondaryScript = true;
                    if (Object.values(loadResult).every(v => v === true)) {
                        observer.next(true);
                        observer.complete();
                        loaded = true;
                    }
                };
                const quillEditorOnerror = () => {
                    quillEditorStyle.removeEventListener('load', quillEditorStyleOnload);
                    quillEditorStyle.removeEventListener('error', quillEditorOnerror);
                    quillEditorScript.removeEventListener('load', quillEditorScriptOnload);
                    quillEditorScript.removeEventListener('error', quillEditorOnerror);
                    observer.next(false);
                    observer.complete();
                };
                quillEditorStyle.addEventListener('load', quillEditorStyleOnload);
                quillEditorStyle.addEventListener('error', quillEditorOnerror);
                quillEditorSnowStyle.addEventListener('load', quillEditorStyleOnload);
                quillEditorSnowStyle.addEventListener('error', quillEditorOnerror);
                quillEditorScript.addEventListener('load', quillEditorScriptOnload);
                quillEditorScript.addEventListener('error', quillEditorOnerror);
                quillBetterTableScript.addEventListener('load', quillBetterTableScriptOnload);
                quillBetterTableScript.addEventListener('error', quillEditorOnerror);
                // check if the script is already loaded. Take into account the Hostname on to src
                if (document.querySelector(`script[src="${this.dynamicConfig?.path}/quill.js"]`) === null) {
                    document.body.append(quillEditorScript);
                }
                else {
                    // interval timer to check when the script is loaded
                    const interval = setInterval(() => {
                        if (loaded) {
                            clearInterval(interval);
                        }
                        else if (window.Quill !== undefined && window.quillBetterTable !== undefined) {
                            observer.next(true);
                            observer.complete();
                            loaded = true;
                            clearInterval(interval);
                        }
                    }, 100);
                }
                // check if style is already loaded
                if (document.querySelector(`link[href="${this.dynamicConfig?.path}/quill.core.css"]`) === null) {
                    document.body.append(quillEditorStyle);
                }
                // check if style is already loaded
                if (document.querySelector(`link[href="${this.dynamicConfig?.path}/quill.snow.css"]`) === null) {
                    document.body.append(quillEditorSnowStyle);
                }
            }
            else {
                observer.next(true);
                observer.complete();
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LoaderService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LoaderService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

const getFormat = (format, configFormat) => {
    const passedFormat = format || configFormat;
    return passedFormat || 'html';
};
class QuillEditorComponent {
    constructor() {
        this.loaded = false;
        this.customToolbarPosition = 'top';
        this.styles = null;
        this.customOptions = [];
        // eslint-disable-next-line @angular-eslint/no-output-on-prefix
        this.onEditorCreated = new EventEmitter();
        // eslint-disable-next-line @angular-eslint/no-output-on-prefix
        this.onContentChanged = new EventEmitter();
        // eslint-disable-next-line @angular-eslint/no-output-on-prefix
        this.onSelectionChanged = new EventEmitter();
        // eslint-disable-next-line @angular-eslint/no-output-on-prefix
        this.onFocus = new EventEmitter();
        // eslint-disable-next-line @angular-eslint/no-output-on-prefix
        this.onBlur = new EventEmitter();
        this.required = false;
        this.sanitize = false;
        this.strict = true;
        this.preserveWhitespace = false;
        this.disabled = false;
        this.elementRef = inject(ElementRef);
        this.domSanitizer = inject(DomSanitizer);
        this.doc = inject(DOCUMENT);
        this.platformId = inject(PLATFORM_ID);
        this.renderer = inject(Renderer2);
        this.zone = inject(NgZone);
        this.config = inject(QUILL_CONFIG_TOKEN);
        this.loader = inject(LoaderService);
        this.valueGetter = (quillEditor, editorElement) => {
            let html = editorElement.querySelector('.ql-editor')?.innerHTML;
            if (html === '<p><br></p>' || html === '<div><br><div>') {
                html = null;
            }
            let modelValue = html;
            const format = getFormat(this.format, this.config.format);
            if (format === 'text') {
                modelValue = quillEditor.getText();
            }
            else if (format === 'object') {
                modelValue = quillEditor.getContents();
            }
            else if (format === 'json') {
                try {
                    modelValue = JSON.stringify(quillEditor.getContents());
                }
                catch (e) {
                    modelValue = quillEditor.getText();
                }
            }
            return modelValue;
        };
        this.valueSetter = (quillEditor, value) => {
            const format = getFormat(this.format, this.config.format);
            if (format === 'html') {
                if (this.sanitize) {
                    value = this.domSanitizer.sanitize(SecurityContext.HTML, value);
                }
                return quillEditor.clipboard.convert({ html: value });
            }
            else if (format === 'json') {
                try {
                    return JSON.parse(value);
                }
                catch (e) {
                    return [{ insert: value }];
                }
            }
            return value;
        };
        this.selectionChangeHandler = (range, oldRange, source) => {
            this.zone.run(() => {
                if (range === null) {
                    this.onBlur.emit({
                        editor: this.quillEditor,
                        source,
                    });
                }
                else if (oldRange === null) {
                    this.onFocus.emit({
                        editor: this.quillEditor,
                        source,
                    });
                }
                this.onSelectionChanged.emit({
                    editor: this.quillEditor,
                    oldRange,
                    range,
                    source,
                });
                if (!range && this.onModelTouched) {
                    this.onModelTouched();
                }
            });
        };
        this.textChangeHandler = (delta, oldDelta, source) => {
            // only emit changes emitted by user interactions
            const text = this.quillEditor.getText();
            const content = this.quillEditor.getContents();
            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
            let html = this.editorElem.querySelector('.ql-editor').innerHTML;
            if (html === '<p><br></p>' || html === '<div><br><div>') {
                html = null;
            }
            this.zone.run(() => {
                const trackChanges = this.trackChanges || this.config.trackChanges;
                if ((source === Quill.sources.USER || (trackChanges && trackChanges === 'all')) && this.onModelChange) {
                    this.onModelChange(
                    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
                    this.valueGetter(this.quillEditor, this.editorElem));
                }
                this.onContentChanged.emit({
                    content,
                    delta,
                    editor: this.quillEditor,
                    html,
                    oldDelta,
                    source,
                    text,
                });
            });
        };
    }
    // eslint-disable-next-line no-empty,no-empty-function,@typescript-eslint/no-empty-function, @typescript-eslint/explicit-function-return-type
    onModelChange(_modelValue) { }
    // eslint-disable-next-line no-empty, no-empty-function, @typescript-eslint/no-empty-function, @typescript-eslint/explicit-function-return-type
    onModelTouched() { }
    ngAfterViewInit() {
        // const loader = new LoaderService();
        this.loader.load().subscribe({
            complete: () => {
                // setup keyboard bindings from BetterTable if present
                const QuillBetterTable = window['quillBetterTable'];
                if (QuillBetterTable) {
                    // check if already registered
                    if (!window['Quill'].imports.hasOwnProperty('modules/better-table')) {
                        window['Quill'].register({ 'modules/better-table': QuillBetterTable });
                    }
                    if (!this.config.modules.keyboard) {
                        this.config.modules.keyboard = {
                            bindings: QuillBetterTable?.keyboardBindings,
                        };
                    }
                }
                if (isPlatformServer(this.platformId)) {
                    return;
                }
                if (!Quill) {
                    // Quill = require('quill')
                    Quill = window['Quill'];
                }
                // The formats feature has changed since prod version 2.0.0.rc-3 and is now reflecting the allowed formats (white list)
                // We no more need this function. See: https://github.com/slab/quill/releases/tag/v2.0.0-rc.3
                // this.overrideScrollBehavior(Quill);
                this.loaded = true;
                this.elementRef.nativeElement.insertAdjacentHTML(this.customToolbarPosition === 'top' ? 'beforeend' : 'afterbegin', this.preserveWhitespace ? '<pre quill-editor-element></pre>' : '<div quill-editor-element></div>');
                this.editorElem = this.elementRef.nativeElement.querySelector('[quill-editor-element]');
                const toolbarElem = this.elementRef.nativeElement.querySelector('[quill-editor-toolbar]');
                let modules = this.modules || this.config.modules || defaultModules;
                if (modules.toolbar === undefined) {
                    modules.toolbar = defaultModules.toolbar;
                }
                let placeholder = this.placeholder !== undefined ? this.placeholder : this.config.placeholder;
                if (placeholder === undefined) {
                    placeholder = 'Insert text here ...';
                }
                if (toolbarElem) {
                    // eslint-disable-next-line dot-notation,@typescript-eslint/dot-notation
                    modules['toolbar'] = toolbarElem;
                }
                if (!this.hasImageFeature) {
                    modules['uploader'] = { handler: () => false };
                }
                else {
                    modules['uploader'] = { mimetypes: ['image/png', 'image/jpeg'] };
                }
                if (this.styles) {
                    Object.keys(this.styles).forEach((key) => {
                        this.renderer.setStyle(this.editorElem, key, this.styles[key]);
                    });
                }
                this.customOptions.forEach((customOption) => {
                    const newCustomOption = Quill.import(customOption.import);
                    newCustomOption.whitelist = customOption.whitelist;
                    Quill.register(newCustomOption, true);
                });
                let bounds = this.bounds && this.bounds === 'self' ? this.editorElem : this.bounds;
                if (!bounds) {
                    bounds = this.config.bounds ? this.config.bounds : this.doc.body;
                }
                let debug = this.debug;
                if (!debug && debug !== false && this.config.debug) {
                    debug = this.config.debug;
                }
                let readOnly = this.readOnly;
                if (!readOnly && this.readOnly !== false) {
                    readOnly = this.config.readOnly !== undefined ? this.config.readOnly : false;
                }
                let scrollingContainer = this.scrollingContainer;
                if (!scrollingContainer && this.scrollingContainer !== null) {
                    scrollingContainer =
                        this.config.scrollingContainer === null || this.config.scrollingContainer ? this.config.scrollingContainer : null;
                }
                let formats = this.formats;
                if (!formats && formats === undefined) {
                    formats = this.config.formats || this.config.formats === null ? this.config.formats : undefined;
                }
                Quill.formats = { ...Quill.formats, [this.id]: formats };
                if (formats && formats.indexOf('table') !== -1) {
                    modules = {
                        ...modules,
                        'better-table': false,
                    };
                }
                this.quillEditor = new Quill(this.editorElem, {
                    bounds,
                    debug,
                    formats,
                    modules,
                    placeholder,
                    readOnly,
                    scrollingContainer,
                    strict: this.strict,
                    theme: this.theme || (this.config.theme ? this.config.theme : 'snow'),
                });
                this.quillEditor.container.firstChild.id = this.id;
                if (this.content) {
                    const format = getFormat(this.format, this.config.format);
                    if (format === 'object') {
                        this.quillEditor.setContents(this.content, 'silent');
                    }
                    else if (format === 'text') {
                        this.quillEditor.setText(this.content, 'silent');
                    }
                    else if (format === 'json') {
                        try {
                            this.quillEditor.setContents(JSON.parse(this.content), 'silent');
                        }
                        catch (e) {
                            this.quillEditor.setText(this.content, 'silent');
                        }
                    }
                    else {
                        if (this.sanitize) {
                            this.content = this.domSanitizer.sanitize(SecurityContext.HTML, this.content);
                        }
                        const contents = this.quillEditor.clipboard.convert(this.content);
                        this.quillEditor.setContents(contents, 'silent');
                    }
                    this.quillEditor.history.clear();
                }
                // initialize disabled status based on this.disabled as default value
                this.setDisabledState();
                this.onEditorCreated.emit(this.quillEditor);
                // mark model as touched if editor lost focus
                this.quillEditor.on('selection-change', this.selectionChangeHandler);
                // update model if text changes
                this.quillEditor.on('text-change', this.textChangeHandler);
            }
        });
    }
    ngOnDestroy() {
        if (this.quillEditor) {
            this.quillEditor.off('selection-change', this.selectionChangeHandler);
            this.quillEditor.off('text-change', this.textChangeHandler);
        }
    }
    ngOnChanges(changes) {
        if (!this.quillEditor) {
            return;
        }
        if (changes.id) {
            this.quillEditor.container.firstChild.id = changes.id.currentValue;
            Quill.formats = { ...Quill.formats, [this.id]: this.formats };
        }
        if (changes['readOnly']) {
            this.quillEditor.enable(!changes['readOnly'].currentValue);
        }
        if (changes['placeholder']) {
            this.quillEditor.root.dataset.placeholder = changes['placeholder'].currentValue;
        }
        if (changes['styles']) {
            const currentStyling = changes['styles'].currentValue;
            const previousStyling = changes['styles'].previousValue;
            if (previousStyling) {
                Object.keys(previousStyling).forEach((key) => {
                    this.renderer.removeStyle(this.editorElem, key);
                });
            }
            if (currentStyling) {
                Object.keys(currentStyling).forEach((key) => {
                    this.renderer.setStyle(this.editorElem, key, this.styles[key]);
                });
            }
        }
        if (changes['formats']) {
            const currentFormats = changes['formats'].currentValue;
            Quill.formats = { ...Quill.formats, [this.id]: currentFormats };
        }
    }
    writeValue(currentValue) {
        this.content = currentValue;
        const format = getFormat(this.format, this.config.format);
        if (this.quillEditor) {
            if (currentValue) {
                if (format === 'text') {
                    this.quillEditor.setText(currentValue);
                }
                else {
                    this.quillEditor.setContents(this.valueSetter(this.quillEditor, this.content));
                }
                return;
            }
            this.quillEditor.setText('');
        }
    }
    setDisabledState(isDisabled = this.disabled) {
        // store initial value to set appropriate disabled status after ViewInit
        this.disabled = isDisabled;
        if (this.quillEditor) {
            if (isDisabled) {
                this.quillEditor.disable();
                this.renderer.setAttribute(this.elementRef.nativeElement, 'disabled', 'disabled');
            }
            else {
                if (!this.readOnly) {
                    this.quillEditor.enable();
                }
                this.renderer.removeAttribute(this.elementRef.nativeElement, 'disabled');
            }
        }
    }
    registerOnChange(fn) {
        this.onModelChange = fn;
    }
    registerOnTouched(fn) {
        this.onModelTouched = fn;
    }
    validate() {
        if (!this.quillEditor) {
            return null;
        }
        const err = {};
        let valid = true;
        const textLength = this.quillEditor.getText().trim().length;
        if (this.minLength && textLength && textLength < this.minLength) {
            err.minLengthError = {
                given: textLength,
                minLength: this.minLength,
            };
            valid = false;
        }
        if (this.maxLength && textLength > this.maxLength) {
            err.maxLengthError = {
                given: textLength,
                maxLength: this.maxLength,
            };
            valid = false;
        }
        if (this.required && !textLength) {
            err.requiredError = {
                empty: true,
            };
            valid = false;
        }
        return valid ? null : err;
    }
    /**
     * Override the default Quill scroll behavior to take into account the formats array and skip non-found ones. Then
     * registers the plugin to the Quill editor.
     *
     * @param QuillInstance The Quill class (not the instance)
     * @private
     */
    overrideScrollBehavior(QuillInstance) {
        // the Built-in Scroll Class is not exported, so we need to import it
        const BuiltinScroll = QuillInstance.import('blots/scroll');
        /**
         * Override the default Quill scroll behavior to take into account the formats array and skip non-found ones.
         */
        class Scroll extends BuiltinScroll {
            formatAt(index, length, format, value) {
                const elementId = this.domNode.id;
                const instanceFormats = QuillInstance.formats[elementId];
                // checks the formats array to see if the format is blacklisted
                if (instanceFormats && instanceFormats.find((f) => f === format)) {
                    return;
                }
                // continue with default behavior
                super.formatAt(index, length, format, value);
            }
        }
        /** register the Scroll override */
        QuillInstance.register('blots/scroll', Scroll, true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: QuillEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.17", type: QuillEditorComponent, isStandalone: true, selector: "quill-editor", inputs: { id: "id", format: "format", theme: "theme", modules: "modules", debug: "debug", placeholder: "placeholder", maxLength: "maxLength", minLength: "minLength", formats: "formats", customToolbarPosition: "customToolbarPosition", styles: "styles", scrollingContainer: "scrollingContainer", bounds: "bounds", customOptions: "customOptions", trackChanges: "trackChanges", hasImageFeature: "hasImageFeature", readOnly: ["readOnly", "readOnly", booleanAttribute], required: ["required", "required", booleanAttribute], sanitize: ["sanitize", "sanitize", booleanAttribute], strict: ["strict", "strict", booleanAttribute], preserveWhitespace: ["preserveWhitespace", "preserveWhitespace", booleanAttribute], valueGetter: "valueGetter", valueSetter: "valueSetter" }, outputs: { onEditorCreated: "onEditorCreated", onContentChanged: "onContentChanged", onSelectionChanged: "onSelectionChanged", onFocus: "onFocus", onBlur: "onBlur" }, providers: [
            {
                multi: true,
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => QuillEditorComponent),
            },
            {
                multi: true,
                provide: NG_VALIDATORS,
                useExisting: forwardRef(() => QuillEditorComponent),
            },
        ], usesOnChanges: true, ngImport: i0, template: `<ng-content select="[quill-editor-toolbar]" />`, isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: QuillEditorComponent, decorators: [{
            type: Component,
            args: [{
                    encapsulation: ViewEncapsulation.None,
                    providers: [
                        {
                            multi: true,
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => QuillEditorComponent),
                        },
                        {
                            multi: true,
                            provide: NG_VALIDATORS,
                            useExisting: forwardRef(() => QuillEditorComponent),
                        },
                    ],
                    // eslint-disable-next-line @angular-eslint/component-selector
                    selector: 'quill-editor',
                    template: `<ng-content select="[quill-editor-toolbar]" />`,
                }]
        }], propDecorators: { id: [{
                type: Input
            }], format: [{
                type: Input
            }], theme: [{
                type: Input
            }], modules: [{
                type: Input
            }], debug: [{
                type: Input
            }], placeholder: [{
                type: Input
            }], maxLength: [{
                type: Input
            }], minLength: [{
                type: Input
            }], formats: [{
                type: Input
            }], customToolbarPosition: [{
                type: Input
            }], styles: [{
                type: Input
            }], scrollingContainer: [{
                type: Input
            }], bounds: [{
                type: Input
            }], customOptions: [{
                type: Input
            }], trackChanges: [{
                type: Input
            }], hasImageFeature: [{
                type: Input
            }], onEditorCreated: [{
                type: Output
            }], onContentChanged: [{
                type: Output
            }], onSelectionChanged: [{
                type: Output
            }], onFocus: [{
                type: Output
            }], onBlur: [{
                type: Output
            }], readOnly: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], required: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], sanitize: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], strict: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], preserveWhitespace: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], valueGetter: [{
                type: Input
            }], valueSetter: [{
                type: Input
            }] } });

// TODO: integrate that module and all related code with the eui-editor module.
//     Remove this sub-entry and move all the code to the eui-editor.
/**
 * @deprecated please don't use it. It will be removed
 */
class QuillModule {
    static forRoot(config) {
        return {
            ngModule: QuillModule,
            providers: [
                {
                    provide: QUILL_CONFIG_TOKEN,
                    // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
                    useValue: config || { modules: defaultModules },
                },
            ],
        };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: QuillModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: QuillModule, imports: [CommonModule, QuillEditorComponent], exports: [QuillEditorComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: QuillModule, providers: [
            {
                provide: QUILL_CONFIG_TOKEN,
                useValue: { modules: defaultModules },
            },
        ], imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: QuillModule, decorators: [{
            type: NgModule,
            args: [{
                    exports: [QuillEditorComponent],
                    imports: [CommonModule, QuillEditorComponent],
                    providers: [
                        {
                            provide: QUILL_CONFIG_TOKEN,
                            useValue: { modules: defaultModules },
                        },
                    ],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { LoaderService, QUILL_CONFIG_TOKEN, QUILL_DYNAMIC_CONFIG_TOKEN, QuillEditorComponent, QuillModule, defaultModules };
//# sourceMappingURL=eui-components-externals-quill.mjs.map
