import { v as i18n$1, i as __read, an as DraggableWrap, I as Icon, ap as LinkButton, b6 as InputNumber, ao as LabelSelect, aq as Button, b7 as mapboxs } from './MapEditView-24782753.js';
import * as React from 'react';
import { L as LabelCheckbox } from './LabelCheckbox-b8e930c0.js';
import 'maptalks';
import 'lodash';
import 'uuid';
import 'mobx';
import 'lz-string';
import 'dayjs';
import 'react-dom';
import 'classnames';
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 'perf-request';
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 'perfect-scrollbar';
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 'react-virtualized';
import 'turf-point';
import 'mobx-react';
import 'decamelize';
import 'rbush';
import 'qs';
import 'maptalks.snap';
import 'react-use';
import 'react-rnd';
import 'react-beautiful-dnd';

var i18n = i18n$1.mapEdit.exportImageSettings;
var prefixCls = 'dm-map-export-img-setting';
var useState = React.useState;
var clarityGroup = [
    {
        key: '',
        label: i18n.HD,
        value: i18n.HD,
    },
    {
        key: '',
        label: i18n.ultraHD,
        value: i18n.ultraHD,
    },
    {
        key: '',
        label: i18n.ultraHDLossless,
        value: i18n.ultraHDLossless,
    },
];
var zoomGroup = [];
for (var i = 3; i <= 20; i++) {
    zoomGroup.push({
        key: i,
        label: i,
        value: i,
    });
}
var MapExportImgSetting = React.memo(function (props) {
    var _a, _b;
    var renew = props.renew, _c = props.currentZoom, currentZoom = _c === void 0 ? 8 : _c, onCancel = props.onCancel, legendId = props.legendId, exportHighResolution = props.exportHighResolution, mapStyle = props.mapStyle, changeSize = props.changeSize;
    var inMapboxBase = mapboxs.includes(mapStyle);
    var _d = __read(useState((_a = props === null || props === void 0 ? void 0 : props.width) !== null && _a !== void 0 ? _a : 40), 2), width = _d[0], setWidth = _d[1];
    var _e = __read(useState((_b = props === null || props === void 0 ? void 0 : props.height) !== null && _b !== void 0 ? _b : 30), 2), height = _e[0], setHeight = _e[1];
    var _f = __read(useState(false), 2), exportLayer = _f[0], setExportLayer = _f[1];
    var _g = __read(useState(i18n.HD), 2), clarity = _g[0], setClarity = _g[1]; // 分辨率
    var _h = __read(useState(Math.round(currentZoom)), 2), zoom = _h[0], setZoom = _h[1]; // zoom
    var _onChangeSize = function () {
        changeSize && changeSize(width, height);
    };
    var _onOk = function () {
        _onChangeSize();
        var hiresType = 'hd_ll'; // hd_ll | hd | fhd
        if (clarity === i18n.ultraHD) {
            hiresType = 'hd';
        }
        else if (clarity === i18n.ultraHDLossless) {
            hiresType = 'fhd';
        }
        var exportOptions = {
            exportLayer: exportLayer,
            zoom: zoom,
            hiresType: hiresType,
        };
        exportHighResolution === null || exportHighResolution === void 0 ? void 0 : exportHighResolution(exportOptions);
    };
    var _onCancel = function () {
        onCancel && onCancel();
    };
    var resetSize = function (width, height, zoom) {
        width && setWidth(width);
        height && setHeight(height);
        zoom && setZoom(zoom);
    };
    var _renew = function () {
        renew(resetSize);
    };
    return (React.createElement(DraggableWrap, { bounds: false },
        React.createElement("div", { className: prefixCls },
            React.createElement("div", { id: legendId }),
            React.createElement("div", { className: "".concat(prefixCls, "-item mb20") },
                React.createElement("div", { className: "".concat(prefixCls, "-title") }, i18n.plotOptions),
                React.createElement("div", { className: "".concat(prefixCls, "-renew"), onClick: _renew },
                    React.createElement(Icon, { icon: "renew", size: 14, className: "".concat(prefixCls, "-renew-icon") }),
                    i18n.reselection)),
            React.createElement("div", { className: "".concat(prefixCls, "-item-size") },
                React.createElement("div", { className: "".concat(prefixCls, "-fs14") }, i18n.selectionSize),
                React.createElement("div", { className: "".concat(prefixCls, "-help ml8") }, i18n.selectionUnit)),
            React.createElement("div", { className: "".concat(prefixCls, "-item-refresh-size mb10") },
                i18n.selectionHelp1,
                React.createElement(LinkButton, { className: "".concat(prefixCls, "-fs12 ml4 mr4"), onClick: _onChangeSize }, i18n.selectionHelp2),
                i18n.selectionHelp3),
            React.createElement("div", { className: "".concat(prefixCls, "-item ").concat(prefixCls, "-item-input mb10") },
                i18n.width,
                React.createElement(InputNumber, { visibilityHandler: true, size: "compact", type: "assist-bg", className: "".concat(prefixCls, "-item-input-number mr8 ml8"), value: width, onChange: function (value) { return setWidth(Number(value)); }, onPressEnter: function () {
                        _onChangeSize();
                    } }),
                i18n.height,
                React.createElement(InputNumber, { visibilityHandler: true, size: "compact", type: "assist-bg", className: "".concat(prefixCls, "-item-input-number ml8"), value: height, onChange: function (value) { return setHeight(Number(value)); }, onPressEnter: function () {
                        _onChangeSize();
                    } })),
            React.createElement("div", { className: "".concat(prefixCls, "-gap mb10") }),
            React.createElement(LabelSelect, { options: zoomGroup, value: zoom, onChange: function (value) {
                    console.log(value, 'value');
                    setZoom(Number(value));
                }, text: i18n.zoomLevel, help: React.createElement(React.Fragment, null,
                    i18n.zoomLevelHelp1,
                    React.createElement("br", null),
                    i18n.zoomLevelHelp2,
                    React.createElement("br", null),
                    i18n.zoomLevelHelp3), className: "mb10" }),
            React.createElement(LabelSelect, { options: clarityGroup, value: clarity, onChange: function (value) {
                    console.log(value, 'value');
                    setClarity(value);
                }, text: i18n.clarity, help: i18n.clarityHelp1, className: "mb10" }),
            React.createElement(LabelCheckbox, { text: i18n.plotOptions1, help: React.createElement(React.Fragment, null,
                    i18n.plotOptions1Help1,
                    React.createElement("br", null),
                    i18n.plotOptions1Help2), title: i18n.splitDataLayer, className: "mb20", onChange: setExportLayer, checked: exportLayer }),
            !inMapboxBase && (React.createElement("div", { className: "".concat(prefixCls, "-warning-help mb20") },
                React.createElement(Icon, { icon: "alert", size: 14, className: "".concat(prefixCls, "-warning-icon mr8") }),
                i18n.warningHelp)),
            React.createElement("div", { className: "".concat(prefixCls, "-button") },
                React.createElement(Button, { onClick: _onCancel }, i18n$1.mapEdit.cancelText),
                React.createElement(Button, { type: "primary", onClick: _onOk }, i18n$1.mapEdit.okText)))));
});
var MapExportImgSetting$1 = MapExportImgSetting;

export { MapExportImgSetting$1 as default };
