import { __awaiter } from "tslib";
import { defaultExportExtractor, extensionsExportsExtractor } from '@anglr/dynamic';
/**
 * Extracts layout designer type which is on decorated type exported by module exports as default export
 */
export const layoutDesignerTypeExtractor = (module, logger) => __awaiter(void 0, void 0, void 0, function* () {
    const def = (yield defaultExportExtractor(module, logger));
    const ext = (yield extensionsExportsExtractor(module, logger));
    const localModule = def === null || def === void 0 ? void 0 : def.data;
    const localModuleEditorData = module;
    logger === null || logger === void 0 ? void 0 : logger.debug('layoutDesignerTypeExtractor: trying to extract default dynamic data');
    if (!(localModule === null || localModule === void 0 ? void 0 : localModule.layoutEditorDesignerType)) {
        return null;
    }
    const type = yield (localModule === null || localModule === void 0 ? void 0 : localModule.layoutEditorDesignerType);
    if (type) {
        return {
            data: type,
            displayName: localModuleEditorData === null || localModuleEditorData === void 0 ? void 0 : localModuleEditorData.displayName,
            description: localModuleEditorData === null || localModuleEditorData === void 0 ? void 0 : localModuleEditorData.description,
            group: localModuleEditorData === null || localModuleEditorData === void 0 ? void 0 : localModuleEditorData.group,
            childExtensions: ext === null || ext === void 0 ? void 0 : ext.childExtensions,
            extensions: ext === null || ext === void 0 ? void 0 : ext.extensions
        };
    }
    return null;
});
//# sourceMappingURL=layoutDesignerType.extractor.js.map