var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m")
        throw new TypeError("Private method is not writable");
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _GxIdeNewObject_instances, _GxIdeNewObject_componentLocale, _GxIdeNewObject_shortcutsSrc, _GxIdeNewObject_categoriesActionListEl, _GxIdeNewObject_chShortcutsEl, _GxIdeNewObject_descriptionEl, _GxIdeNewObject_descriptionModifiedByUser, _GxIdeNewObject_moduleFolderEl, _GxIdeNewObject_nameEl, _GxIdeNewObject_nameModifiedByUser, _GxIdeNewObject_cancelCallbackHandler, _GxIdeNewObject_categoryOnSelectionChangedHandler, _GxIdeNewObject_createCallbackHandler, _GxIdeNewObject_descriptionValueHandler, _GxIdeNewObject_resolveNameSuggestion, _GxIdeNewObject_resolveDescriptionSuggestion, _GxIdeNewObject_updateSuggestions, _GxIdeNewObject_init, _GxIdeNewObject_initializeSelectedTypeMap, _GxIdeNewObject_onBlurNameHandler, _GxIdeNewObject_onInputDescriptionHandler, _GxIdeNewObject_onInputNameHandler, _GxIdeNewObject_onNameValueChangedHandler, _GxIdeNewObject_renderModuleFolder, _GxIdeNewObject_setDefaultType, _GxIdeNewObject_setSelectedCategoryOnActionList, _GxIdeNewObject_typeChangedHandler, _GxIdeNewObject_validateNameHandler;
/* STENCIL IMPORTS */
import { Host, h, getAssetPath } from "@stencil/core";
import { config } from "../../common/config";
/* CUSTOM IMPORTS */
import { Locale } from "../../common/locale";
import { mapTypeCategoryDataToActionListModel, mapTypeDataToActionListModel } from "./helpers";
import { sortActionListDefault } from "../../common/chameleon-helpers";
const CSS_BUNDLES = [
    "resets/box-sizing",
    "components/button",
    "components/edit",
    "components/icon",
    "components/tooltip",
    "components/list-box",
    "utils/form",
    "utils/layout",
    "utils/spacing",
    "utils/typography"
];
export class GxIdeNewObject {
    constructor() {
        _GxIdeNewObject_instances.add(this);
        /**
         * The component hard-coded strings translations.
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewObject_componentLocale.set(this, void 0);
        _GxIdeNewObject_shortcutsSrc.set(this, getAssetPath(`./gx-ide-assets/new-object/shortcuts.json`));
        /* References needed to collect data on "Create" button submit */
        _GxIdeNewObject_categoriesActionListEl.set(this, void 0);
        _GxIdeNewObject_chShortcutsEl.set(this, void 0);
        _GxIdeNewObject_descriptionEl.set(this, void 0);
        _GxIdeNewObject_descriptionModifiedByUser.set(this, false);
        _GxIdeNewObject_moduleFolderEl.set(this, void 0);
        _GxIdeNewObject_nameEl.set(this, void 0);
        _GxIdeNewObject_nameModifiedByUser.set(this, false);
        // - - - - - - - - - - -
        _GxIdeNewObject_cancelCallbackHandler.set(this, async () => {
            await this.cancelCallback();
        });
        _GxIdeNewObject_categoryOnSelectionChangedHandler.set(this, (selectionEvent) => {
            const selection = selectionEvent.detail;
            if (selection.length > 0) {
                const selectedCategory = this.typeCategories.find(category => category.id === selection[0].item.id);
                if (selectedCategory) {
                    this.selectedCategory = selectedCategory;
                    if (selectedCategory.types.length > 0) {
                        this.selectedType = selectedCategory.types.find(type => type.id === this.selectedTypeMap.get(selectedCategory.id));
                    }
                }
            }
        });
        _GxIdeNewObject_createCallbackHandler.set(this, async () => {
            var _a, _b, _c;
            // validate name first
            const nameValidation = await this.validateNameCallback(__classPrivateFieldGet(this, _GxIdeNewObject_nameEl, "f").value);
            if (!!nameValidation) {
                // name is invalid
                __classPrivateFieldGet(this, _GxIdeNewObject_validateNameHandler, "f").call(this, nameValidation);
                return;
            }
            const data = {
                typeId: (_a = this.selectedType) === null || _a === void 0 ? void 0 : _a.id,
                name: __classPrivateFieldGet(this, _GxIdeNewObject_nameEl, "f").value,
                description: !__classPrivateFieldGet(this, _GxIdeNewObject_descriptionModifiedByUser, "f")
                    ? undefined
                    : __classPrivateFieldGet(this, _GxIdeNewObject_descriptionEl, "f").value,
                moduleId: (_c = (_b = __classPrivateFieldGet(this, _GxIdeNewObject_moduleFolderEl, "f")) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.id
            };
            const result = await this.createCallback(data);
            __classPrivateFieldGet(this, _GxIdeNewObject_validateNameHandler, "f").call(this, result);
        });
        _GxIdeNewObject_descriptionValueHandler.set(this, () => {
            var _a;
            if (__classPrivateFieldGet(this, _GxIdeNewObject_nameModifiedByUser, "f") || __classPrivateFieldGet(this, _GxIdeNewObject_descriptionModifiedByUser, "f")) {
                return __classPrivateFieldGet(this, _GxIdeNewObject_descriptionEl, "f").value;
            }
            else {
                // First try to get suggested description if callback exists
                if (this.suggestCallback) {
                    return (_a = this.description) !== null && _a !== void 0 ? _a : this.selectedType.name;
                }
                return this.selectedType.name;
            }
        });
        /**
         * Resolves the suggested name based on the context
         * @param selectedType The currently selected type
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewObject_resolveNameSuggestion.set(this, async (selectedType, suggestedName) => {
            if (suggestedName) {
                return suggestedName.replace(/\s/g, "");
            }
            return selectedType.name.replace(/\s/g, "");
        });
        /**
         * Gets the suggested description based on the context
         * @param selectedType The currently selected type
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewObject_resolveDescriptionSuggestion.set(this, async (selectedType, suggestedDescription) => {
            if (suggestedDescription) {
                return suggestedDescription;
            }
            return selectedType.name;
        });
        /**
         * Updates both name and description suggestions
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewObject_updateSuggestions.set(this, async () => {
            if (!this.selectedType) {
                return;
            }
            if (__classPrivateFieldGet(this, _GxIdeNewObject_nameModifiedByUser, "f") && __classPrivateFieldGet(this, _GxIdeNewObject_descriptionModifiedByUser, "f"))
                return;
            const suggestions = await this.suggestCallback(this.selectedType.id);
            if (!__classPrivateFieldGet(this, _GxIdeNewObject_nameModifiedByUser, "f")) {
                this.name = await __classPrivateFieldGet(this, _GxIdeNewObject_resolveNameSuggestion, "f").call(this, this.selectedType, suggestions.name);
            }
            if (!__classPrivateFieldGet(this, _GxIdeNewObject_descriptionModifiedByUser, "f")) {
                this.description = await __classPrivateFieldGet(this, _GxIdeNewObject_resolveDescriptionSuggestion, "f").call(this, this.selectedType, suggestions.description);
            }
        });
        /**
         * This method defines the initial selected category and type, and it then
         * initializes the name and description values.
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewObject_init.set(this, async () => {
            const defaultTypeFound = __classPrivateFieldGet(this, _GxIdeNewObject_setDefaultType, "f").call(this, this.defaultTypeId);
            if (!defaultTypeFound) {
                this.selectedCategory = this.typeCategories[0];
                this.selectedType = this.selectedCategory.types[0];
            }
            await __classPrivateFieldGet(this, _GxIdeNewObject_updateSuggestions, "f").call(this);
        });
        _GxIdeNewObject_onBlurNameHandler.set(this, async () => {
            if (__classPrivateFieldGet(this, _GxIdeNewObject_nameEl, "f").value) {
                const result = await this.validateNameCallback(__classPrivateFieldGet(this, _GxIdeNewObject_nameEl, "f").value);
                __classPrivateFieldGet(this, _GxIdeNewObject_validateNameHandler, "f").call(this, result);
            }
        });
        _GxIdeNewObject_onInputDescriptionHandler.set(this, (e) => {
            this.description = e.detail;
            __classPrivateFieldSet(this, _GxIdeNewObject_descriptionModifiedByUser, true, "f");
        });
        _GxIdeNewObject_onInputNameHandler.set(this, async (e) => {
            const name = e.detail;
            if (!__classPrivateFieldGet(this, _GxIdeNewObject_descriptionModifiedByUser, "f")) {
                // Description should be equal to name, unless the description was already
                // modified by the user.
                __classPrivateFieldGet(this, _GxIdeNewObject_descriptionEl, "f").value = name;
            }
            __classPrivateFieldSet(this, _GxIdeNewObject_nameModifiedByUser, true, "f");
        });
        _GxIdeNewObject_onNameValueChangedHandler.set(this, async (e) => {
            const name = e.detail;
            if (name) {
                const result = await this.validateNameCallback(name);
                __classPrivateFieldGet(this, _GxIdeNewObject_validateNameHandler, "f").call(this, result);
            }
        });
        _GxIdeNewObject_renderModuleFolder.set(this, () => {
            if (this.selectedType.hasModule || this.selectedType.hasFolder) {
                let labelDescription = __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").moduleFolder;
                if (!this.selectedType.hasFolder) {
                    labelDescription = __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").moduleOnly;
                }
                else if (!this.selectedType.hasModule) {
                    labelDescription = __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").folderOnly;
                }
                return [
                    h("label", {
                        // Module/folder
                        class: "label api-module-label", htmlFor: "module"
                    }, labelDescription),
                    h("gx-ide-entity-selector", { id: "module", class: "api-module-control", part: "module", labelPosition: "none", value: this.parent, defaultValue: this.defaultParent, selectEntityCallback: this.selectModuleCallback, ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewObject_moduleFolderEl, el, "f")) })
                ];
            }
            return null;
        });
        _GxIdeNewObject_setDefaultType.set(this, (typeId) => {
            if (!typeId) {
                return false;
            }
            let found = false;
            outerLoop: for (let i = 0; i < this.typeCategories.length; i++) {
                for (let j = 0; j < this.typeCategories[i].types.length; j++) {
                    const loopTypeId = this.typeCategories[i].types[j].id;
                    if (loopTypeId === typeId) {
                        this.selectedCategory = this.typeCategories[i];
                        this.selectedType = this.typeCategories[i].types[j];
                        found = true;
                        break outerLoop;
                    }
                }
            }
            return found;
        });
        _GxIdeNewObject_setSelectedCategoryOnActionList.set(this, () => {
            if (this.selectedCategory) {
                // update model by setting the selected category
                __classPrivateFieldGet(this, _GxIdeNewObject_categoriesActionListEl, "f").updateItemProperties(this.selectedCategory.id, {
                    selected: true,
                    type: "actionable"
                });
            }
        });
        _GxIdeNewObject_typeChangedHandler.set(this, async (selectionEvent) => {
            const selection = selectionEvent.detail;
            if (selection.length > 0) {
                this.selectedType = this.selectedCategory.types.find(type => type.id === selection[0].item.id);
                this.selectedTypeMap.set(this.selectedCategory.id, this.selectedType.id);
                await __classPrivateFieldGet(this, _GxIdeNewObject_updateSuggestions, "f").call(this);
            }
        });
        /**
         * If the parameter is undefined, it means the name is valid. Otherwise, if it
         * receives a string, it indicates that the name is not valid. The string is the
         * error message to display.
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewObject_validateNameHandler.set(this, (result) => {
            this.nameValidationErrorMessage = result;
        });
        this.description = undefined;
        this.name = undefined;
        this.nameValidationErrorMessage = undefined;
        this.selectedCategory = undefined;
        this.selectedType = undefined;
        this.typeCategoriesActionListModel = [];
        this.typesActionListModel = [];
        this.selectedTypeMap = new Map();
        this.defaultTypeId = undefined;
        this.defaultParent = undefined;
        this.displayTitle = false;
        this.cancelCallback = undefined;
        this.createCallback = undefined;
        this.shadow = false;
        this.typeCategories = undefined;
        this.parent = undefined;
        this.selectModuleCallback = undefined;
        this.validateNameCallback = undefined;
        this.suggestCallback = undefined;
    }
    typeCategoriesChanged(newValue) {
        if (newValue === null || newValue === void 0 ? void 0 : newValue.length) {
            this.typeCategoriesActionListModel = mapTypeCategoryDataToActionListModel(this.typeCategories);
        }
    }
    connectedCallback() {
        // this.#validateInitialName();
    }
    async componentWillLoad() {
        await __classPrivateFieldGet(this, _GxIdeNewObject_init, "f").call(this);
        __classPrivateFieldSet(this, _GxIdeNewObject_componentLocale, await Locale.getComponentStrings(this.el), "f");
        this.typeCategoriesChanged(this.typeCategories);
        __classPrivateFieldGet(this, _GxIdeNewObject_instances, "m", _GxIdeNewObject_initializeSelectedTypeMap).call(this);
    }
    componentDidLoad() {
        __classPrivateFieldGet(this, _GxIdeNewObject_setSelectedCategoryOnActionList, "f").call(this);
    }
    /**
     * Suspends or reactivates the shortcuts
     */
    async suspendShortcuts(suspendShortcuts) {
        if (suspendShortcuts) {
            __classPrivateFieldGet(this, _GxIdeNewObject_chShortcutsEl, "f").suspend = true;
        }
        else {
            __classPrivateFieldGet(this, _GxIdeNewObject_chShortcutsEl, "f").suspend = false;
        }
    }
    render() {
        var _a;
        return (h(Host, { class: "widget" }, h("ch-theme", { model: CSS_BUNDLES }), h("ch-shortcuts", { src: __classPrivateFieldGet(this, _GxIdeNewObject_shortcutsSrc, "f"), ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewObject_chShortcutsEl, el, "f")) }), h("section", { class: "main" }, h("section", { class: "field-group categories-types-layout spacing-body-inline spacing-body-block-start" }, h("div", { class: "field field-block" }, h("label", { class: "label" }, __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").categorySelectionTitle), h("ch-action-list-render", {
            // #select a category
            // TODO: The "scrollable" class is a WA since the action-list currently does not support scrollbar customization
            class: "list-box", selection: "single", model: this.typeCategoriesActionListModel, sortItemsCallback: sortActionListDefault, onSelectedItemsChange: __classPrivateFieldGet(this, _GxIdeNewObject_categoryOnSelectionChangedHandler, "f"), ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewObject_categoriesActionListEl, el, "f"))
        })), h("div", { class: "field field-block" }, h("label", { class: "label" }, this.selectedCategory.name
            ? `${this.selectedCategory.name} ${__classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").typeSelectionTitleSuffix}`
            : __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").typeSelectionTitle), h("ch-action-list-render", {
            // #data management types
            // TODO: The "scrollable" class is a WA since the action-list currently does not support scrollbar customization
            class: "list-box", selection: "single", sortItemsCallback: sortActionListDefault, model: mapTypeDataToActionListModel(this.selectedCategory.types, this.selectedCategory.id, this.selectedType.id), onSelectedItemsChange: __classPrivateFieldGet(this, _GxIdeNewObject_typeChangedHandler, "f")
        }))), h("section", { class: "api-description-layout field-group-justified-start spacing-body-inline" }, h("h2", {
            // API Description
            class: "text-align-center api-description-title subtitle-regular-xs\t"
        }, (_a = this.selectedType) === null || _a === void 0 ? void 0 : _a.description), h("label", {
            // Name
            class: "label api-name-label", htmlFor: "name"
        }, __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").objectName), h("div", null, h("ch-edit", { autoFocus: true, class: {
                "input": true,
                "api-name-control": true,
                "input-error": !!this.nameValidationErrorMessage
            }, placeholder: "Name", value: this.name, ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewObject_nameEl, el, "f")), onChange: __classPrivateFieldGet(this, _GxIdeNewObject_onNameValueChangedHandler, "f"), onInput: __classPrivateFieldGet(this, _GxIdeNewObject_onInputNameHandler, "f"), onBlur: __classPrivateFieldGet(this, _GxIdeNewObject_onBlurNameHandler, "f"), part: "name" }), this.nameValidationErrorMessage && (h("ch-tooltip", { class: "tooltip", actionElement: __classPrivateFieldGet(this, _GxIdeNewObject_nameEl, "f"), blockAlign: config.tooltipSettings.blockAlign, inlineAlign: config.tooltipSettings.inlineAlign, delay: config.tooltipSettings.delay }, this.nameValidationErrorMessage))), h("label", {
            // Description
            class: "label api-description-label", htmlFor: "description"
        }, __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").objectDescription), h("ch-edit", { autoFocus: true, class: "input api-description-control", placeholder: "Description", value: __classPrivateFieldGet(this, _GxIdeNewObject_descriptionValueHandler, "f").call(this),
            // TODO: toolTip={config.tooltip}
            ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewObject_descriptionEl, el, "f")), onInput: __classPrivateFieldGet(this, _GxIdeNewObject_onInputDescriptionHandler, "f"), part: "description" }), __classPrivateFieldGet(this, _GxIdeNewObject_renderModuleFolder, "f").call(this)), h("footer", { class: "footer dialog-footer-with-border spacing-body-inline spacing-body-block-end " }, h("div", { class: "buttons-spacer" }, h("button", {
            // cancel
            class: "button-secondary", onClick: __classPrivateFieldGet(this, _GxIdeNewObject_cancelCallbackHandler, "f"), part: "button button-cancel"
        }, __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").footer.btnCancel), h("button", {
            // create
            class: "button-primary", onClick: __classPrivateFieldGet(this, _GxIdeNewObject_createCallbackHandler, "f"), disabled: !!this.nameValidationErrorMessage, part: "button button-create"
        }, __classPrivateFieldGet(this, _GxIdeNewObject_componentLocale, "f").footer.btnCreate))))));
    }
    static get is() { return "gx-ide-new-object"; }
    static get encapsulation() { return "shadow"; }
    static get delegatesFocus() { return true; }
    static get originalStyleUrls() {
        return {
            "$": ["new-object.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["new-object.css"]
        };
    }
    static get assetsDirs() { return ["gx-ide-assets/new-object"]; }
    static get properties() {
        return {
            "defaultTypeId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Allows you to define the type selected by default when instantiating the dialog.\nRepresented by the type identifier."
                },
                "attribute": "default-type-id",
                "reflect": false
            },
            "defaultParent": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "EntityData",
                    "resolved": "{ id: string; name: string; iconSrc?: string; }",
                    "references": {
                        "EntityData": {
                            "location": "import",
                            "path": "../../common/types",
                            "id": "src/common/types.ts::EntityData"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Default value for the Module/Folder field."
                }
            },
            "displayTitle": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "false",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If true it displays the component title on the header"
                },
                "attribute": "display-title",
                "reflect": false,
                "defaultValue": "false"
            },
            "cancelCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "CancelCallback",
                    "resolved": "() => Promise<void>",
                    "references": {
                        "CancelCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/new-object/new-object.tsx",
                            "id": "src/components/new-object/new-object.tsx::CancelCallback"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Callback invoked when user wants to cancel object creation"
                }
            },
            "createCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "CreateCallback",
                    "resolved": "(data: NewObjectData) => Promise<string>",
                    "references": {
                        "CreateCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/new-object/new-object.tsx",
                            "id": "src/components/new-object/new-object.tsx::CreateCallback"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Callback invoked when user wants to confirm object creation"
                }
            },
            "shadow": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "false",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Applies a shadow all around"
                },
                "attribute": "shadow",
                "reflect": false,
                "defaultValue": "false"
            },
            "typeCategories": {
                "type": "unknown",
                "mutable": true,
                "complexType": {
                    "original": "TypeCategoryData[]",
                    "resolved": "TypeCategoryData[]",
                    "references": {
                        "TypeCategoryData": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/new-object/new-object.tsx",
                            "id": "src/components/new-object/new-object.tsx::TypeCategoryData"
                        }
                    }
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Array containing category list and its corresponding types"
                }
            },
            "parent": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "EntityData",
                    "resolved": "{ id: string; name: string; iconSrc?: string; }",
                    "references": {
                        "EntityData": {
                            "location": "import",
                            "path": "../../common/types",
                            "id": "src/common/types.ts::EntityData"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Current value for Module/Folder"
                }
            },
            "selectModuleCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "SelectModuleCallback",
                    "resolved": "() => Promise<EntityData>",
                    "references": {
                        "SelectModuleCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/new-object/new-object.tsx",
                            "id": "src/components/new-object/new-object.tsx::SelectModuleCallback"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Callback invoked when the action is executed on the Module/Folder filter\n(button '...'). It returns the information of the selected object (id and\nname) or 'undefined' if it was canceled."
                }
            },
            "validateNameCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "ValidateNameCallback",
                    "resolved": "(name: string) => Promise<string>",
                    "references": {
                        "ValidateNameCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/new-object/new-object.tsx",
                            "id": "src/components/new-object/new-object.tsx::ValidateNameCallback"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Callback invoked when you must validate a name. Returns an error message or\n'undefined' if the name is not valid."
                }
            },
            "suggestCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "SuggestCallback",
                    "resolved": "(typeId: string) => Promise<SuggestData>",
                    "references": {
                        "SuggestCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/new-object/new-object.tsx",
                            "id": "src/components/new-object/new-object.tsx::SuggestCallback"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Callback to suggest name and description based on the given type.\nReturns the suggested data or undefined if not applicable."
                }
            }
        };
    }
    static get states() {
        return {
            "description": {},
            "name": {},
            "nameValidationErrorMessage": {},
            "selectedCategory": {},
            "selectedType": {},
            "typeCategoriesActionListModel": {},
            "typesActionListModel": {},
            "selectedTypeMap": {}
        };
    }
    static get events() {
        return [{
                "method": "cancel",
                "name": "cancel",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "This event emits the 'cancel' event"
                },
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                }
            }, {
                "method": "create",
                "name": "create",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "This event emm=its the data needed to create a new object"
                },
                "complexType": {
                    "original": "NewObjectData",
                    "resolved": "NewObjectData",
                    "references": {
                        "NewObjectData": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/new-object/new-object.tsx",
                            "id": "src/components/new-object/new-object.tsx::NewObjectData"
                        }
                    }
                }
            }, {
                "method": "validateName",
                "name": "validateName",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "This event is triggered after a validation of the object name is made.\nReturns 'undefined' if it's valid, otherwise an error message."
                },
                "complexType": {
                    "original": "string | undefined",
                    "resolved": "string",
                    "references": {}
                }
            }];
    }
    static get methods() {
        return {
            "suspendShortcuts": {
                "complexType": {
                    "signature": "(suspendShortcuts: boolean) => Promise<void>",
                    "parameters": [{
                            "name": "suspendShortcuts",
                            "type": "boolean",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Suspends or reactivates the shortcuts",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "typeCategories",
                "methodName": "typeCategoriesChanged"
            }];
    }
}
_GxIdeNewObject_componentLocale = new WeakMap(), _GxIdeNewObject_shortcutsSrc = new WeakMap(), _GxIdeNewObject_categoriesActionListEl = new WeakMap(), _GxIdeNewObject_chShortcutsEl = new WeakMap(), _GxIdeNewObject_descriptionEl = new WeakMap(), _GxIdeNewObject_descriptionModifiedByUser = new WeakMap(), _GxIdeNewObject_moduleFolderEl = new WeakMap(), _GxIdeNewObject_nameEl = new WeakMap(), _GxIdeNewObject_nameModifiedByUser = new WeakMap(), _GxIdeNewObject_cancelCallbackHandler = new WeakMap(), _GxIdeNewObject_categoryOnSelectionChangedHandler = new WeakMap(), _GxIdeNewObject_createCallbackHandler = new WeakMap(), _GxIdeNewObject_descriptionValueHandler = new WeakMap(), _GxIdeNewObject_resolveNameSuggestion = new WeakMap(), _GxIdeNewObject_resolveDescriptionSuggestion = new WeakMap(), _GxIdeNewObject_updateSuggestions = new WeakMap(), _GxIdeNewObject_init = new WeakMap(), _GxIdeNewObject_onBlurNameHandler = new WeakMap(), _GxIdeNewObject_onInputDescriptionHandler = new WeakMap(), _GxIdeNewObject_onInputNameHandler = new WeakMap(), _GxIdeNewObject_onNameValueChangedHandler = new WeakMap(), _GxIdeNewObject_renderModuleFolder = new WeakMap(), _GxIdeNewObject_setDefaultType = new WeakMap(), _GxIdeNewObject_setSelectedCategoryOnActionList = new WeakMap(), _GxIdeNewObject_typeChangedHandler = new WeakMap(), _GxIdeNewObject_validateNameHandler = new WeakMap(), _GxIdeNewObject_instances = new WeakSet(), _GxIdeNewObject_initializeSelectedTypeMap = function _GxIdeNewObject_initializeSelectedTypeMap() {
    this.typeCategories.forEach(category => {
        if (this.defaultTypeId && category.id === this.selectedCategory.id) {
            this.selectedTypeMap.set(category.id, this.selectedType.id);
        }
        else {
            this.selectedTypeMap.set(category.id, category.types[0].id);
        }
    });
};
//# sourceMappingURL=new-object.js.map
