import { get, find } from 'lodash';
import { p as i18n, bD as PTD_VISUAL, bE as LTD_VISUAL, bF as POITD_VISUAL, bj as BY_COUNT, G as GEO_TYPES, w as GeometryType, bA as HEAT_VISUAL, bB as GRID_HEAT_VISUAL, bC as HEXAGON_HEAT_VISUAL, bp as TYPE_VISUAL, bq as NUMBER_VISUAL, bG as FLOW_VISUAL } from './MapEditView-f6381866.js';

const i18nCards = i18n.mapEdit.cards;
const getCurrentVisualConfig = (props) => {
    var _a, _b, _c;
    const { currentVisual, card, packageInfo } = props;
    const { getCol, geometryType } = packageInfo;
    const { id, fieldId } = currentVisual || {};
    const { uuid } = card;
    let field = getCol({ uuid, fieldId });
    const visual = get(card, id);
    let current = find(visual, { fieldId });
    if (id === null || id === void 0 ? void 0 : id.startsWith(PTD_VISUAL)) {
        current = (_a = card.polygon3DVisual) === null || _a === void 0 ? void 0 : _a.find((i) => i.id === id);
    }
    if (id === null || id === void 0 ? void 0 : id.startsWith(LTD_VISUAL)) {
        current = (_b = card.line3DVisual) === null || _b === void 0 ? void 0 : _b.find((i) => i.id === id);
    }
    if (id === null || id === void 0 ? void 0 : id.startsWith(POITD_VISUAL)) {
        current = (_c = card.point3DVisual) === null || _c === void 0 ? void 0 : _c.find((i) => i.id === id);
    }
    if (fieldId === BY_COUNT) {
        field = i18nCards.point;
    }
    const isHeat = id === HEAT_VISUAL || id === GRID_HEAT_VISUAL || id === HEXAGON_HEAT_VISUAL;
    const isCurrentHeatVisual = id === HEAT_VISUAL;
    const isCurrentGridHeatVisual = id === GRID_HEAT_VISUAL;
    const isCurrentHexagonHeatVisual = id === HEXAGON_HEAT_VISUAL;
    const isCurrentTypeVisual = id === TYPE_VISUAL;
    const isCurrentNumberVisual = id === NUMBER_VISUAL;
    const isFlow = id === FLOW_VISUAL;
    const isPolygon3DVisual = id === null || id === void 0 ? void 0 : id.startsWith(PTD_VISUAL);
    const isLine3DVisual = id === null || id === void 0 ? void 0 : id.startsWith(LTD_VISUAL);
    const isPoint3DVisual = id === null || id === void 0 ? void 0 : id.startsWith(POITD_VISUAL);
    const isPointToPoint = geometryType === GEO_TYPES[GeometryType.pointToPoint];
    const isPoint = geometryType === GEO_TYPES[GeometryType.point];
    const isPolygon = geometryType === GEO_TYPES[GeometryType.polygon];
    const isLine = geometryType === GEO_TYPES[GeometryType.line];
    const type = {
        isHeat,
        isCurrentHeatVisual,
        isCurrentGridHeatVisual,
        isCurrentHexagonHeatVisual,
        isCurrentTypeVisual,
        isCurrentNumberVisual,
        isFlow,
        isPolygon3DVisual,
        isLine3DVisual,
        isPoint3DVisual,
        isPointToPoint,
        isPoint,
        isPolygon,
        isLine,
    };
    return [current, id, field, fieldId, type];
};

const getCardIconInfo = (props) => {
    const { getIconColorPref, getIconUrl, iconCache, customIconPrefInfo, defaultIcon } = props;
    return {
        defaultIcon,
        iconList: [
            ...iconCache.customIconList.map((i) => ({
                // label: getIconLabel(i),
                name: i,
                url: getIconUrl(i),
                originalColor: getIconColorPref(i),
            })),
            ...iconCache.defaultIconList.map((i) => ({
                // label: getIconLabel(i),
                name: i,
                url: getIconUrl(i),
                originalColor: getIconColorPref(i),
            })),
        ],
        customIconPrefInfo,
    };
};

export { getCurrentVisualConfig as a, getCardIconInfo as g };
