import { U as find, O as map, $ as Tag } from './MapEditView-f6381866.js';
import { observer } from 'mobx-react';
import React__default from 'react';
import { t as thumbListContext, a as i18n, C as ConditionPermissionEnum, b as prefixCls } from './index-0b8bebb4.js';
import 'react-dom';
import 'react-dnd-html5-backend';
import 'classnames';
import 'perfect-scrollbar';
import 'react-virtualized';
import 'maptalks';
import 'lodash';
import 'uuid';
import 'mobx';
import 'lz-string';
import 'dayjs';
import 'react-is';
import '@loadable/component';
import 'js-beautify';
import 'axios';
import 'superstruct';
import '@tanem/react-nprogress';
import 'jquery';
import 'chroma-js';
import 'js-cookie';
import 'is-email';
import 'is-uuid';
import 'is-url';
import 'anymatch';
import '@syncpoint/wkx';
import 'buffer';
import '@turf/turf';
import '@mapbox/polylabel';
import 'turf-multipolygon';
import 'turf-polygon';
import 'gcoord';
import 'eventemitter2';
import 'geobuf';
import 'localforage';
import 'rc-menu';
import 'ahooks';
import 'jszip';
import 'file-saver';
import 'screenfull';
import 'sql-formatter-fork';
import 'array-move';
import 'turf-multilinestring';
import 'copy-to-clipboard';
import 'maptalks.three';
import 'ajv';
import 'spark-md5';
import 'react-draggable';
import 'turf-point';
import 'decamelize';
import 'rbush';
import 'qs';
import 'maptalks.snap';
import 'react-use';
import 'react-rnd';
import 'react-beautiful-dnd';
import 'react-contextmenu';
import 'coordtransform';
import './compact-f89fbdd0.js';
import './useDataValue-6bd3790f.js';
import 'ali-react-table-fork';
import './Transfer-b219601e.js';
import 'ismobilejs';

const CollaborationDetailItem = ({ it }) => {
    return (React__default.createElement("div", { className: `${prefixCls}-detail-item` },
        React__default.createElement("div", { className: `${prefixCls}-detail-item-label` }, it.label),
        React__default.createElement("div", { className: `${prefixCls}-detail-item-value` }, it.value)));
};
const CollaborationDetail = observer(() => {
    const Context = thumbListContext.getContext();
    const value = React__default.useContext(Context);
    const { store } = value;
    const { appUsers, displayTableData, packageItem } = store;
    const menus = React__default.useMemo(() => {
        var _a;
        const adminUser = find(appUsers, (user) => packageItem.userId === user.id);
        return [
            {
                label: i18n.collaboration.dataName,
                value: packageItem.name,
            },
            {
                label: i18n.collaboration.dataType,
                value: i18n.collaboration.collaborationData,
            },
            {
                label: i18n.collaboration.initiatingUser,
                value: (_a = adminUser === null || adminUser === void 0 ? void 0 : adminUser.title) !== null && _a !== void 0 ? _a : '-',
            },
        ];
    }, [appUsers, packageItem.name, packageItem.userId]);
    const menus1 = React__default.useMemo(() => {
        return map(displayTableData, (data) => {
            const { condition, permission } = data;
            const tag = permission === ConditionPermissionEnum.editable
                ? i18n.collaboration.editable
                : i18n.collaboration.onlyView;
            const color = permission === ConditionPermissionEnum.editable ? 'green-900' : 'yellow-900';
            return [
                {
                    label: i18n.collaboration.condition,
                    value: condition,
                },
                {
                    label: i18n.collaboration.dataPermission,
                    value: React__default.createElement(Tag, { tag: tag, color: color }),
                },
            ];
        });
    }, [displayTableData]);
    return (React__default.createElement("div", { className: `${prefixCls}-detail` },
        React__default.createElement("div", { className: `${prefixCls}-detail-items` }, map(menus, (it) => {
            return React__default.createElement(CollaborationDetailItem, { it: it });
        })),
        map(menus1, (arr) => {
            return (React__default.createElement("div", { className: `${prefixCls}-detail-items` }, map(arr, (it) => {
                return React__default.createElement(CollaborationDetailItem, { it: it });
            })));
        })));
});
CollaborationDetail.displayName = 'CollaborationDetail';

export { CollaborationDetail as default };
