import { getConfigOptions } from "@boldpenguin/sdk-redux";
import { COVERAGE_REFERENCES, FIELD_TYPES, QuestionFieldType, } from "@boldpenguin/sdk-types";
import { getValidators, hasAnswerChanged, hasValueChanged, updateAnswerValue, validateAnswer } from "@boldpenguin/sdk-utility";
import { h } from "@stencil/core";
import debounce from "lodash/debounce";
import isEqual from "lodash/isEqual";
import xorWith from "lodash/xorWith";
import store from "../../services/redux-store.service";
export class BpSdkDynamicInputEventContainer {
    constructor() {
        this.SAVE_ANSWER_DEBOUNCE_MS = 500;
        this.handleSubscriptions = () => {
            this.storeUnsubscribe && this.storeUnsubscribe();
            this.storeUnsubscribe = store.mapStateToProps(this, this.mapStateToProps);
        };
        this.mapStateToProps = (state) => {
            return {
                configOptions: getConfigOptions(state),
            };
        };
        this.debouncedEmit = debounce(this.emitSaveAnswer, this.SAVE_ANSWER_DEBOUNCE_MS);
        this.onFocusIn = () => {
            var _a, _b, _c;
            if (this.inputComponentType === QuestionFieldType.DropDown && !((_b = (_a = this.answer) === null || _a === void 0 ? void 0 : _a.question) === null || _b === void 0 ? void 0 : _b.multiple)) {
                this.removeActiveAnswer.emit();
            }
            else {
                this.updateActiveAnswerId((_c = this.answer) === null || _c === void 0 ? void 0 : _c.id);
            }
        };
        this.onFocusOut = () => {
            this.touched = true;
            if (this.hasPendingUpdate) {
                this.emitSaveAnswer(this.lastAnswer);
            }
            this.determineErrors(this.errors, this.touched, this.pristine);
        };
        this.answer = undefined;
        this.shouldHideLabel = false;
        this.useSelectAlias = false;
        this.showBusinessClassificationSelector = false;
        this.errors = undefined;
        this.label = undefined;
        this.disableAddressAutocomplete = false;
        this.labelledBy = undefined;
        this.updateActiveAnswerId = undefined;
        this.updateErrors = undefined;
        this.referenceTypes = COVERAGE_REFERENCES;
        this.configOptions = undefined;
        this.fieldType = '';
        this.isCoverageType = true;
        this.labelId = 'a11y-';
        this.isLabelledField = false;
        this.inputComponentType = undefined;
        this._label = '';
        this.lastAnswer = undefined;
        this.touched = false;
        this.pristine = true;
        this.useExternal = false;
        this.isDropdown = true;
        this.isNumeric = false;
        this._errors = [];
        this.hasPendingUpdate = false;
        this.debounceTime = undefined;
    }
    resetState() {
        var _a;
        this.lastAnswer = undefined;
        this.touched = false;
        this.pristine = true;
        this.answerId = (_a = this.answer) === null || _a === void 0 ? void 0 : _a.id;
        this.debouncedEmit.cancel();
        this.debounceTime = undefined;
    }
    connectedCallback() {
        this.resetState();
        this.handleSubscriptions();
    }
    onAnswerChange(answer) {
        var _a, _b, _c, _d, _e, _f, _g, _h;
        const code = (_b = (_a = answer === null || answer === void 0 ? void 0 : answer.question) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '';
        const id = (_c = answer === null || answer === void 0 ? void 0 : answer.id) !== null && _c !== void 0 ? _c : '';
        const fieldType = (_e = (_d = answer === null || answer === void 0 ? void 0 : answer.question) === null || _d === void 0 ? void 0 : _d.field_type) !== null && _e !== void 0 ? _e : '';
        const referenceType = (_g = (_f = answer === null || answer === void 0 ? void 0 : answer.question) === null || _f === void 0 ? void 0 : _f.reference_type) !== null && _g !== void 0 ? _g : '';
        this.fieldType = fieldType;
        this.isCoverageType = COVERAGE_REFERENCES.includes(referenceType);
        this.labelId = `a11y-${code}-${id}`;
        this.isLabelledField = FIELD_TYPES.labelledFields.includes(fieldType) && !this.isCoverageType;
        this.inputComponentType = this.getComponentType(fieldType);
        this.isDropdown = FIELD_TYPES.dropdownFields.includes(this.inputComponentType);
        this.isNumeric = FIELD_TYPES.numberFields.includes(fieldType);
        this.updateLabel(answer === null || answer === void 0 ? void 0 : answer.question, this.label, this.shouldHideLabel);
        // Sometimes components are reused without being disconnected,
        // so we need to reset state if the answer id is different
        if (((_h = this.answer) === null || _h === void 0 ? void 0 : _h.id) !== this.answerId) {
            this.resetState();
        }
    }
    onHideLabelChange(shouldHideLabel) {
        var _a;
        this.updateLabel((_a = this.answer) === null || _a === void 0 ? void 0 : _a.question, this.label, shouldHideLabel);
    }
    onLabelChange(label) {
        var _a;
        this.updateLabel((_a = this.answer) === null || _a === void 0 ? void 0 : _a.question, label, this.shouldHideLabel);
    }
    onConfigOptionsChange(options) {
        if (options.debounceTime !== this.debounceTime) {
            this.debounceTime = options.debounceTime;
        }
    }
    setDebounceTime(fieldType) {
        var _a, _b;
        this.SAVE_ANSWER_DEBOUNCE_MS = ['dropdown', 'radio', 'checkbox', 'dialog', 'selector'].includes(fieldType)
            ? 50
            : (_b = (_a = this.configOptions) === null || _a === void 0 ? void 0 : _a.debounceTime) !== null && _b !== void 0 ? _b : 500;
        this.debouncedEmit.cancel();
        this.debouncedEmit = debounce(this.emitSaveAnswer, this.SAVE_ANSWER_DEBOUNCE_MS);
    }
    updateLabel(question, label, shouldHideLabel) {
        var _a;
        if (!shouldHideLabel) {
            this._label = (_a = (label || (question === null || question === void 0 ? void 0 : question.text))) !== null && _a !== void 0 ? _a : '';
        }
        else {
            this._label = '';
        }
    }
    onErrorsChange(errors, oldErrors) {
        if (JSON.stringify(errors) !== JSON.stringify(oldErrors)) {
            this.determineErrors(errors, this.touched, this.pristine);
        }
    }
    onTouchedChange(touched, oldValue) {
        if (touched !== oldValue) {
            this.determineErrors(this.errors, touched, this.pristine);
        }
    }
    onPristineChange(pristine, oldValue) {
        if (pristine !== oldValue) {
            this.determineErrors(this.errors, this.touched, pristine);
        }
    }
    determineErrors(errors, touched, pristine) {
        this._errors = touched && !pristine ? errors : [];
    }
    updateErrorState(answer) {
        var _a;
        this.pristine = false;
        const errors = validateAnswer(answer, getValidators(answer));
        if (xorWith((_a = this.errors) !== null && _a !== void 0 ? _a : [], errors, isEqual).length > 0) {
            this.updateErrors({ answer, errors });
        }
        this.errors = errors;
        this.determineErrors(this.errors, this.touched, this.pristine);
    }
    onMakeDirty() {
        this.touched = true;
        this.pristine = false;
    }
    makeDirty() {
        this.pristine = false;
    }
    onValueUpdate(event) {
        if (this.useExternal) {
            return;
        }
        const { detail } = event;
        if (hasValueChanged(this.lastAnswer, detail)) {
            if (hasAnswerChanged(this.answer, detail)) {
                const answer = updateAnswerValue(Object.assign({}, this.answer), detail);
                this.updateErrorState(answer);
                if (this.isDropdown) {
                    this.removeActiveAnswer.emit();
                }
            }
            this.lastAnswer = detail;
            this.updateValue(detail);
        }
    }
    emitSaveAnswer(newValue) {
        if (this.hasPendingUpdate) {
            this.saveAnswer.emit({
                answer: Object.assign({}, this.answer),
                new_value: newValue,
            });
            this.hasPendingUpdate = false;
        }
    }
    unique(keys) {
        return Object.keys(keys
            .filter((key) => key != null)
            .reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: key })), {}));
    }
    cleanValue(value) {
        if (value == null) {
            return value;
        }
        else if (typeof value !== 'string' && Array.isArray(value)) {
            return this.unique(value);
        }
        else if (value &&
            (this.fieldType === QuestionFieldType.SocialSecurityNumber || this.fieldType === QuestionFieldType.FederalEmployeeIdentification)) {
            // NOTE: This is a very targeted fix for a bug with FEIN / SSN where the asterisk characters were getting stripped on
            // question set reload.
            // This regex will basically remove all characters that are not one of the following:
            //   a number (\d)
            //   a . character
            //   a - character
            //   a * character
            //
            // If we remove the star characters, then since the backend sends sensitive fields with * characters, the fields
            // will not be "valid" and can cause the user to not be able to edit and save previous question sets without re-entering
            // FEIN / SSN data.
            return value.replace(/[^\d.\*-]/g, '');
        }
        else if (value && this.isNumeric) {
            return value.replace(/[^\d.-]/g, '');
        }
        else if (typeof value === 'string' && !this.isCoverageType && !this.isDropdown) {
            const curlySingleQuoteRegex = /[\u2018\u2019]/g;
            const curlyDoubleQuoteRegex = /[\u201C\u201D]/g;
            return value.replace(curlySingleQuoteRegex, "'").replace(curlyDoubleQuoteRegex, '"');
        }
        else {
            return value;
        }
    }
    save(data) {
        this.hasPendingUpdate = true;
        this.debouncedEmit(data);
    }
    updateValue(data) {
        const sanitizedData = this.cleanValue(data);
        this.save(sanitizedData);
    }
    onUseExternalChange(useExternal) {
        if (!useExternal) {
            this.unloadFocusEvents();
        }
    }
    loadFocusEvents() {
        if (!this.useExternal) {
            this.el.addEventListener('focusin', this.onFocusIn);
            this.el.addEventListener('focusout', this.onFocusOut);
        }
    }
    unloadFocusEvents() {
        var _a, _b;
        (_a = this.el) === null || _a === void 0 ? void 0 : _a.removeEventListener('focusin', this.onFocusIn);
        (_b = this.el) === null || _b === void 0 ? void 0 : _b.removeEventListener('focusout', this.onFocusOut);
    }
    getComponentType(fieldType) {
        let componentType = fieldType;
        if (FIELD_TYPES.textFields.includes(fieldType)) {
            componentType = 'text';
        }
        else if (FIELD_TYPES.maskedFields.includes(fieldType)) {
            componentType = 'masked';
        }
        if (this.isCoverageType) {
            componentType = 'coverage_type';
        }
        return componentType;
    }
    componentWillLoad() {
        var _a;
        this.useExternal = !!customElements.get('bp-sdk-external-dynamic-input-event-container');
        customElements.whenDefined('bp-sdk-external-dynamic-input-event-container').then(() => {
            this.useExternal = true;
            this.unloadFocusEvents();
        });
        this.onAnswerChange(this.answer);
        this.updateLabel((_a = this.answer) === null || _a === void 0 ? void 0 : _a.question, this.label, this.shouldHideLabel);
        this.handleSubscriptions();
    }
    componentWillUpdate() {
        this.handleSubscriptions();
    }
    componentDidLoad() {
        this.loadFocusEvents();
    }
    disconnectedCallback() {
        this.unloadFocusEvents();
        this.storeUnsubscribe && this.storeUnsubscribe();
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return (h("bp-sdk-external-dynamic-input-event-container", { answer: this.answer, configOptions: this.configOptions, disableAddressAutocomplete: this.disableAddressAutocomplete, errors: this.errors, shouldHideLabel: this.shouldHideLabel, labelId: this.labelId, label: this.label, labelledBy: this.labelledBy, referenceTypes: this.referenceTypes, showBusinessClassificationSelector: this.showBusinessClassificationSelector, updateActiveAnswerId: this.updateActiveAnswerId, updateErrors: this.updateErrors, useSelectAlias: this.useSelectAlias }));
    }
    renderInternal() {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31;
        return (h("bp-sdk-dynamic-input", { answerId: (_a = this.answer) === null || _a === void 0 ? void 0 : _a.id, answerPoolId: (_b = this.answer) === null || _b === void 0 ? void 0 : _b.answer_pool_id, applicationFormId: (_c = this.answer) === null || _c === void 0 ? void 0 : _c.application_form_id, choiceId: (_d = this.answer) === null || _d === void 0 ? void 0 : _d.choice_id, choiceIds: (_e = this.answer) === null || _e === void 0 ? void 0 : _e.choice_ids, choices: (_g = (_f = this.answer) === null || _f === void 0 ? void 0 : _f.question) === null || _g === void 0 ? void 0 : _g.choices, code: (_j = (_h = this.answer) === null || _h === void 0 ? void 0 : _h.question) === null || _j === void 0 ? void 0 : _j.code, disableAddressAutocomplete: this.disableAddressAutocomplete, displayType: (_k = this.answer) === null || _k === void 0 ? void 0 : _k.display_type, errors: this.errors, errorText: (_m = (_l = this.answer) === null || _l === void 0 ? void 0 : _l.question) === null || _m === void 0 ? void 0 : _m.error_text, fieldType: (_p = (_o = this.answer) === null || _o === void 0 ? void 0 : _o.question) === null || _p === void 0 ? void 0 : _p.field_type, helpText: (_r = (_q = this.answer) === null || _q === void 0 ? void 0 : _q.question) === null || _r === void 0 ? void 0 : _r.help_text, answeredBySource: this.answeredBySource(), inputComponentType: this.inputComponentType, isAutocomplete: !!((_t = (_s = this.answer) === null || _s === void 0 ? void 0 : _s.question) === null || _t === void 0 ? void 0 : _t.autocomplete), isCompleted: !!((_u = this.answer) === null || _u === void 0 ? void 0 : _u.is_completed), isCoverageType: this.isCoverageType, isHidden: !!((_w = (_v = this.answer) === null || _v === void 0 ? void 0 : _v.question) === null || _w === void 0 ? void 0 : _w.is_hidden), isLabelledField: !!this.isLabelledField, isMultiple: !!((_y = (_x = this.answer) === null || _x === void 0 ? void 0 : _x.question) === null || _y === void 0 ? void 0 : _y.multiple), isReadOnly: !!((_z = this.answer) === null || _z === void 0 ? void 0 : _z.is_readonly), isRequired: !!(((_0 = this.answer) === null || _0 === void 0 ? void 0 : _0.required) || ((_2 = (_1 = this.answer) === null || _1 === void 0 ? void 0 : _1.question) === null || _2 === void 0 ? void 0 : _2.required)), isSensitive: !!((_4 = (_3 = this.answer) === null || _3 === void 0 ? void 0 : _3.question) === null || _4 === void 0 ? void 0 : _4.is_sensitive), isTrackable: !!((_6 = (_5 = this.answer) === null || _5 === void 0 ? void 0 : _5.question) === null || _6 === void 0 ? void 0 : _6.trackable), label: this._label, labelId: this.labelId, labelledBy: this.labelledBy, maxDate: (_8 = (_7 = this.answer) === null || _7 === void 0 ? void 0 : _7.question) === null || _8 === void 0 ? void 0 : _8.max_date, maxValue: (_10 = (_9 = this.answer) === null || _9 === void 0 ? void 0 : _9.question) === null || _10 === void 0 ? void 0 : _10.max_value, minDate: (_12 = (_11 = this.answer) === null || _11 === void 0 ? void 0 : _11.question) === null || _12 === void 0 ? void 0 : _12.min_date, minValue: (_14 = (_13 = this.answer) === null || _13 === void 0 ? void 0 : _13.question) === null || _14 === void 0 ? void 0 : _14.min_value, order: (_16 = (_15 = this.answer) === null || _15 === void 0 ? void 0 : _15.question) === null || _16 === void 0 ? void 0 : _16.order, pattern: (_18 = (_17 = this.answer) === null || _17 === void 0 ? void 0 : _17.question) === null || _18 === void 0 ? void 0 : _18.pattern, placeholder: (_20 = (_19 = this.answer) === null || _19 === void 0 ? void 0 : _19.question) === null || _20 === void 0 ? void 0 : _20.placeholder, pristine: this.pristine, questionId: (_22 = (_21 = this.answer) === null || _21 === void 0 ? void 0 : _21.question) === null || _22 === void 0 ? void 0 : _22.id, questionGroupId: (_24 = (_23 = this.answer) === null || _23 === void 0 ? void 0 : _23.question) === null || _24 === void 0 ? void 0 : _24.question_group_id, questionSetId: (_26 = (_25 = this.answer) === null || _25 === void 0 ? void 0 : _25.question) === null || _26 === void 0 ? void 0 : _26.question_set_id, referenceType: (_28 = (_27 = this.answer) === null || _27 === void 0 ? void 0 : _27.question) === null || _28 === void 0 ? void 0 : _28.reference_type, showBusinessClassificationSelector: this.showBusinessClassificationSelector, shouldShowInput: !!(this.answer && this.answer.active && this.answer.display_type === 'public' && this.answer.question), text: (_30 = (_29 = this.answer) === null || _29 === void 0 ? void 0 : _29.question) === null || _30 === void 0 ? void 0 : _30.text, touched: this.touched, useSelectAlias: this.useSelectAlias, value: (_31 = this.answer) === null || _31 === void 0 ? void 0 : _31.value }));
    }
    answeredBySource() {
        var _a, _b;
        if ((_a = this.answer) === null || _a === void 0 ? void 0 : _a.answered_by_consumer) {
            return 'Consumer';
        }
        return (_b = this.answer) === null || _b === void 0 ? void 0 : _b.answered_by_source;
    }
    static get is() { return "bp-sdk-dynamic-input-event-container"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-dynamic-input-event-container.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-dynamic-input-event-container.css"]
        };
    }
    static get properties() {
        return {
            "answer": {
                "type": "unknown",
                "mutable": true,
                "complexType": {
                    "original": "IAnswer",
                    "resolved": "IAnswer",
                    "references": {
                        "IAnswer": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IAnswer"
                        }
                    }
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Answer"
                }
            },
            "shouldHideLabel": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Should hide label"
                },
                "attribute": "should-hide-label",
                "reflect": false,
                "defaultValue": "false"
            },
            "useSelectAlias": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Use select alias"
                },
                "attribute": "use-select-alias",
                "reflect": false,
                "defaultValue": "false"
            },
            "showBusinessClassificationSelector": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Show business class selector"
                },
                "attribute": "show-business-classification-selector",
                "reflect": false,
                "defaultValue": "false"
            },
            "errors": {
                "type": "unknown",
                "mutable": true,
                "complexType": {
                    "original": "string[] | undefined",
                    "resolved": "string[]",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Error messages"
                }
            },
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Label to use"
                },
                "attribute": "label",
                "reflect": false
            },
            "disableAddressAutocomplete": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Disables Google Autocomplete for address groups when true"
                },
                "attribute": "disable-address-autocomplete",
                "reflect": false,
                "defaultValue": "false"
            },
            "labelledBy": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Labels that describe group"
                },
                "attribute": "labelled-by",
                "reflect": false
            },
            "updateActiveAnswerId": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(params: string) => void",
                    "resolved": "(params: string) => void",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                }
            },
            "updateErrors": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(params: { answer: IAnswer; errors: string[] }) => void",
                    "resolved": "(params: { answer: IAnswer; errors: string[]; }) => void",
                    "references": {
                        "IAnswer": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IAnswer"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                }
            },
            "referenceTypes": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "string[]",
                    "resolved": "string[]",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "*Deprecated* Use COVERAGE_REFERENCES from sdk-types\nReference types for coverage selection"
                },
                "defaultValue": "COVERAGE_REFERENCES"
            },
            "configOptions": {
                "type": "unknown",
                "mutable": true,
                "complexType": {
                    "original": "IConfigOptions",
                    "resolved": "IConfigOptions",
                    "references": {
                        "IConfigOptions": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IConfigOptions"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Web component config options injected from redux"
                }
            }
        };
    }
    static get states() {
        return {
            "fieldType": {},
            "isCoverageType": {},
            "labelId": {},
            "isLabelledField": {},
            "inputComponentType": {},
            "_label": {},
            "lastAnswer": {},
            "touched": {},
            "pristine": {},
            "useExternal": {},
            "isDropdown": {},
            "isNumeric": {},
            "_errors": {},
            "hasPendingUpdate": {},
            "debounceTime": {}
        };
    }
    static get events() {
        return [{
                "method": "saveAnswer",
                "name": "saveAnswer",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Passes information needed to update answer"
                },
                "complexType": {
                    "original": "IAnswerUpdatedEvent",
                    "resolved": "IAnswerUpdatedEvent",
                    "references": {
                        "IAnswerUpdatedEvent": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IAnswerUpdatedEvent"
                        }
                    }
                }
            }, {
                "method": "removeActiveAnswer",
                "name": "removeActiveAnswer",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Remove active answer"
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }];
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "answer",
                "methodName": "onAnswerChange"
            }, {
                "propName": "shouldHideLabel",
                "methodName": "onHideLabelChange"
            }, {
                "propName": "label",
                "methodName": "onLabelChange"
            }, {
                "propName": "configOptions",
                "methodName": "onConfigOptionsChange"
            }, {
                "propName": "fieldType",
                "methodName": "setDebounceTime"
            }, {
                "propName": "debounceTime",
                "methodName": "setDebounceTime"
            }, {
                "propName": "errors",
                "methodName": "onErrorsChange"
            }, {
                "propName": "touched",
                "methodName": "onTouchedChange"
            }, {
                "propName": "pristine",
                "methodName": "onPristineChange"
            }, {
                "propName": "useExternal",
                "methodName": "onUseExternalChange"
            }];
    }
    static get listeners() {
        return [{
                "name": "makeDirty",
                "method": "onMakeDirty",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "fakeValueUpdate",
                "method": "makeDirty",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "valueUpdate",
                "method": "onValueUpdate",
                "target": undefined,
                "capture": false,
                "passive": false
            }];
    }
}
