import { defineComponent as F, watch as M, createElementBlock as de, openBlock as ve, normalizeClass as ye, unref as J, shallowRef as I, ref as c, onMounted as fe, onUnmounted as be, createElementVNode as ge, pushScopeId as he, popScopeId as Me } from "vue";
import Le from "@amap/amap-jsapi-loader";
import "axios";
import { nanoid as ke } from "nanoid";
import { heatMapData as we, hideHeatMap as ze } from "./heatMap.mjs";
import { navigatorDot as Se, loadDotMap as N, showAndHideDotLabelMap as T, clearRipplesScatter as Ce, clearLoadLocaDotLayers as Ee, clearLabelsLayer as xe, clearMarkerLayer as Oe, showRoadMap as De, hideRoadMap as Ae, loadLineMap as Ie, hideLineMap as Te, showSmallMap as Be, hideSmallMap as _e } from "./dotMap.mjs";
import "../../text-text-basic/index.mjs";
import "../../text-table-basic/index.mjs";
import "../../chart-other-gauge/index.mjs";
import "../../chart-other-gauge-stage/index.mjs";
import "../../chart-other-gauge-grade/index.mjs";
import "../../chart-other-word-cloud/index.mjs";
import "../../chart-other-liquidfill/index.mjs";
import "../../chart-other-funnel/index.mjs";
import "../../chart-other-force/index.mjs";
import "../../chart-other-radar/index.mjs";
import "../../chart-other-funnel-split/index.mjs";
import "../../chart-other-funnel-contrast/index.mjs";
import "../../chart-other-candlestick-basic/index.mjs";
import "../../chart-other-candlestick-shanghai/index.mjs";
import "../../chart-other-candlestick-demo/index.mjs";
import "../../chart-other-heatmap/index.mjs";
import "../../chart-other-force2/index.mjs";
import "../../chart-other-graph-basic/index.mjs";
import "../../chart-other-graph-basic2/index.mjs";
import "../../chart-other-graph-calendar/index.mjs";
import "../../chart-other-tree-line/index.mjs";
import "../../chart-other-treemap-basic/index.mjs";
import "../../chart-other-sunburst-basic/index.mjs";
import "../../chart-other-sunburst-basic2/index.mjs";
import "../../chart-other-sunburst-basic3/index.mjs";
import "../../chart-other-sunburst-basic4/index.mjs";
import "../../chart-other-sunburst-book/index.mjs";
import "../../chart-other-sunburst-radius/index.mjs";
import "../../chart-other-sunburst-flavors/index.mjs";
import "../../chart-other-parallel-basic/index.mjs";
import "../../chart-other-parallel-mul/index.mjs";
import "../../chart-other-circular-graph/index.mjs";
import "../../map-earth-basic/index.mjs";
import "../../map-earth-cool-tech/index.mjs";
import "../../map-earth-particle/index.mjs";
import "../../map-earth-hacker/index.mjs";
import "../../map-earth-fly-line/index.mjs";
import "../../chart-other-grid-percentage/index.mjs";
import "../../chart-other-radar-stack/index.mjs";
import "../../chart-other-funnel2/index.mjs";
import "../../chart-other-label-gauge/index.mjs";
import "../../chart-other-theme-river/index.mjs";
import "../../chart-other-tree/index.mjs";
import "../../chart-other-treemap/index.mjs";
import "../../commons-product-model/index.mjs";
import "../../commons-vr-photo/index.mjs";
import "../../commons-vr-video/index.mjs";
import "../../commons-three-loader/index.mjs";
import "../../commons-three-loader3/index.mjs";
import "../../commons-loop-iterator/index.mjs";
import "../../commons-gaussian-splatting-view/index.mjs";
import "../../commons-babylon/index.mjs";
import "../../commons-svg/index.mjs";
import "../../commons-weather/index.mjs";
import "../../commons-weather-dynamic/index.mjs";
import "../../media-wavesurfer/index.mjs";
import "../../interaction-tabs/index.mjs";
import "../../interaction-tabs2/index.mjs";
import "../../interaction-button/index.mjs";
import "../../interaction-button-image/index.mjs";
import "../../interaction-select/index.mjs";
import "../../interaction-input/index.mjs";
import "../../interaction-radio/index.mjs";
import "../../interaction-slider/index.mjs";
import "../../interaction-switch/index.mjs";
import "../../interaction-data-picker/index.mjs";
import "../../interaction-button-refresh/index.mjs";
import "../../media-image/index.mjs";
import "../../text-title/index.mjs";
import "../../commons-qrcode/index.mjs";
import "../../media-video/index.mjs";
import "../../media-audio/index.mjs";
import "../../text-real-time/index.mjs";
import "../../media-carousel/index.mjs";
import "../../media-carousel-slides/index.mjs";
import "../../media-iframe-carousel/index.mjs";
import "../../media-iframe/index.mjs";
import "../../media-m3u8/index.mjs";
import "../../media-m3u8-dynamic/index.mjs";
import "../../media-audio-dynamic/index.mjs";
import "../../media-video-dynamic/index.mjs";
import "../../media-image-dynamic/index.mjs";
import "../../media-iframe-dynamic/index.mjs";
import "../../media-flv/index.mjs";
import "../../commons-echarts/index.mjs";
import "../../text-over-number/index.mjs";
import "../../text-table-scroll/index.mjs";
import "../../text-carousel/index.mjs";
import "../../text-row-scroll/index.mjs";
import "../../text-text-dynamic/index.mjs";
import "../../text-count-down/index.mjs";
import "../../graphical-circle/index.mjs";
import "../../graphical-diamond/index.mjs";
import "../../graphical-hexagon/index.mjs";
import "../../graphical-isosceles-triangle/index.mjs";
import "../../graphical-pentagon/index.mjs";
import "../../graphical-rect/index.mjs";
import "../../graphical-right-triangle/index.mjs";
import "../../scene-map3d/index.mjs";
import "../../scene-amap2d/index.mjs";
import "../../scene-amap3d/index.mjs";
import "../../scene-vr/index.mjs";
import "../../scene-unity-iframe/index.mjs";
import "../../scene-unity-webgl/index.mjs";
import "../../scene-ue-iframe/index.mjs";
import "../../scene-ue-shj/index.mjs";
import "../../scene-default/index.mjs";
import "../../interaction/tabs/index.mjs";
import "../../interaction/tabs-icon/index.mjs";
import "../../interaction/button/index.mjs";
import "../../interaction/date-picker/src/date-picker/index.mjs";
import "../../interaction/date-picker/src/date-picker-range/index.mjs";
import "../../text/list/index.mjs";
import "../../chart/src/bar/basic/index.mjs";
import "../../chart/src/bar/animation/index.mjs";
import "../../chart/src/bar/contrast/index.mjs";
import "../../chart/src/bar/contrast2/index.mjs";
import "../../chart/src/bar/contrast3/index.mjs";
import "../../chart/src/bar/gradient-column-chart/index.mjs";
import "../../chart/src/bar/horizontal/index.mjs";
import "../../chart/src/bar/horizontal-stack/index.mjs";
import "../../chart/src/bar/line-bar/index.mjs";
import "../../chart/src/bar/line-bar2/index.mjs";
import "../../chart/src/bar/loop/index.mjs";
import "../../chart/src/bar/mini/index.mjs";
import "../../chart/src/bar/polar/index.mjs";
import "../../chart/src/bar/polar-stack/index.mjs";
import "../../chart/src/bar/polar2/index.mjs";
import "../../chart/src/bar/radius-circle/index.mjs";
import "../../chart/src/bar/rank/index.mjs";
import "../../chart/src/bar/segmented-progress/index.mjs";
import "../../chart/src/bar/spire/index.mjs";
import "../../chart/src/bar/stack/index.mjs";
import "../../chart/src/bar/stack-line/index.mjs";
import "../../chart/src/bar/stack2/index.mjs";
import "../../chart/src/bar/stack3/index.mjs";
import "../../chart/src/bar/staggered/index.mjs";
import "../../chart/src/bar/three/index.mjs";
import "../../chart/src/bar/waterfall/index.mjs";
import "../../chart/src/bar/zebra/index.mjs";
import "../../chart/src/line/area-gradient/index.mjs";
import "../../chart/src/line/area-highlight/index.mjs";
import "../../chart/src/line/area-highlight2/index.mjs";
import "../../chart/src/line/basic/index.mjs";
import "../../chart/src/line/bump/index.mjs";
import "../../chart/src/line/dashed/index.mjs";
import "../../chart/src/line/ladder/index.mjs";
import "../../chart/src/line/logarithm/index.mjs";
import "../../chart/src/line/multix/index.mjs";
import "../../chart/src/line/polar-double/index.mjs";
import "../../chart/src/line/rain-flow/index.mjs";
import "../../chart/src/line/scale/index.mjs";
import "../../chart/src/line/smooth/index.mjs";
import "../../chart/src/line/smooth-area/index.mjs";
import "../../chart/src/line/stack/index.mjs";
import "../../chart/src/line/stack-area/index.mjs";
import "../../chart/src/line/temp/index.mjs";
import "../../chart/src/line/vertical/index.mjs";
import "../../chart/src/map/basic/index.mjs";
import "../../chart/src/map/bmap-basic/index.mjs";
import "../../chart/src/map/bmap-heatmap/index.mjs";
import "../../chart/src/map/bmap-rich/index.mjs";
import "../../chart/src/map/customize/index.mjs";
import "../../chart/src/map/lines/index.mjs";
import "../../chart/src/map/scatter/index.mjs";
import "../../chart/src/pie/3d/index.mjs";
import "../../chart/src/pie/basic/index.mjs";
import "../../chart/src/pie/basic2/index.mjs";
import "../../chart/src/pie/customized/index.mjs";
import "../../chart/src/pie/index/index.mjs";
import "../../chart/src/pie/interval/index.mjs";
import "../../chart/src/pie/legend-scroll/index.mjs";
import "../../chart/src/pie/radius/index.mjs";
import "../../chart/src/pie/rose/index.mjs";
import "../../chart/src/pie/round/index.mjs";
import "../../chart/src/pie/sunburst/index.mjs";
import "../../chart/src/scatter/basic/index.mjs";
import "../../chart/src/scatter/basic2/index.mjs";
import "../../chart/src/scatter/bubble/index.mjs";
import "../../chart/src/scatter/ripples/index.mjs";
import "../zv-hj-tree-list/index.mjs";
import "../zv-hj-model-resource/index.mjs";
import "../zv-hj-one-map-config/index.mjs";
import "../zv-hj-video-control/index.mjs";
import "../zv-hj-video-page/index.mjs";
import "../zv-hj-password-input/index.mjs";
import "../zv-hj-carousel/index.mjs";
import "../zv-hj-video-monitor/index.mjs";
import "./index.mjs";
import "../zv-hj-scene-amap3d/index.mjs";
import "../zv-hj-person-face/index.mjs";
import "../zv-hj-resource-type-phone/index.mjs";
import "../zv-hj-tree-list-phone/index.mjs";
import "../zv-hj-video-page-phone/index.mjs";
import "../zv-hj-model-resource-phone/index.mjs";
import "../zv-hj-bottom-suspend/index.mjs";
import "../zv-hj-pagination/index.mjs";
import "../zv-hj-password-input-phone/index.mjs";
/* empty css                           */
/* empty css                                  */
import { SHJDatasourceV2 as He } from "../../../plugins/datasource/index.mjs";
import { SHJParseEvent as v } from "../../../plugins/event/index.mjs";
import "lodash";
import { HJLYDatasourceApi as Pe } from "../../../plugins/datasource/hjly/index.mjs";
const Re = (w) => (he("data-v-63d52a91"), w = w(), Me(), w), We = /* @__PURE__ */ Re(() => /* @__PURE__ */ ge("div", {
  id: "zerov-amap-2d",
  class: "zerov-amap-container"
}, null, -1)), Je = [
  We
], Ne = F({ name: "zv-hj-scene-amap2d" }), Pr = /* @__PURE__ */ F({
  ...Ne,
  props: {
    basicOption: {},
    sources: {},
    useEvents: {},
    uuid: {}
  },
  emits: [
    "amap2d-scene-success",
    "amap2d-scene-zoomstart",
    "amap2d-scene-zoomend",
    "amap2d-scene-mapclick",
    "amap2d-scene-dragstart",
    "amap2d-scene-dragging",
    "amap2d-scene-dragend",
    "amap2d-label-click",
    "amap2d-scene-label-layer-click",
    "amap2d-scene-label-layer-mouseover",
    "amap2d-scene-label-layer-mouseout"
  ],
  setup(w, { expose: V, emit: Z }) {
    const o = w, y = Z;
    v.parseEvents(o.useEvents, "on-page-loaded", null);
    const G = () => {
      const e = I(), m = I(), _ = c(!1), L = c(!0), b = I([]), C = c([]), E = c(), x = c(), O = c(), g = c(), H = c(), h = c(), z = c(), k = c(), p = c(), D = c(), P = (t) => {
        o.sources && o.sources.length > 0 && He.parse({
          tId: o.uuid,
          sources: o.sources,
          callback: (a) => {
            try {
              p.value = a.data[0].data[0].data[0], t(a);
            } catch {
            }
          }
        });
      }, Q = (t) => {
        window._AMapSecurityConfig = {
          securityJsCode: t.basic.securityJsCode
        }, Le.load({
          key: t.basic.key,
          // 申请好的Web端开发者Key，首次调用 load 时必填
          version: "2.0",
          // 指定要加载的 JSAPI 的版本，缺省时默认为 1.4.15
          Loca: {
            version: "2.0.0"
          },
          plugins: [
            "AMap.ControlBar",
            "AMap.ToolBar",
            "AMap.Scale",
            "AMap.HeatMap",
            "AMap.GeoJSON",
            "AMap.ImageLayer",
            "AMap.TileLayer",
            "AMap.Polyline"
          ]
        }).then((a) => {
          g.value = a;
          const l = new g.value.createDefaultLayer({
            visible: !0,
            // 是否可见
            opacity: 1,
            // 透明度
            zIndex: 0
            // 叠加层级
          });
          e.value = new a.Map("zerov-amap-2d", {
            rotateEnable: t.config.rotateEnable,
            // 是否开启地图旋转交互 鼠标右键 + 鼠标画圈移动 或 键盘Ctrl + 鼠标画圈移动
            pitchEnable: t.config.pitchEnable,
            // 是否开启地图倾斜交互 鼠标右键 + 鼠标上下移动或键盘Ctrl + 鼠标上下移动
            zoomEnable: t.config.zoomEnable,
            dragEnable: t.config.dragEnable,
            zoom: t.config.zoom,
            // 初始化地图层级
            viewMode: "2D",
            // 开启3D视图,默认为关闭
            zooms: t.config.zooms,
            // 地图显示的缩放级别范围
            center: t.config.center,
            // 初始地图中心经纬度
            mapStyle: t.config.mapStyle,
            features: t.config.features,
            layers: [l]
          }), m.value = new window.Loca.Container({
            map: e.value
          }), O.value = new g.value.Scale({
            visible: t.config.plugin.scale.visible,
            position: {
              left: t.config.plugin.scale.position.left + "px",
              bottom: t.config.plugin.scale.position.bottom + "px"
            }
          }), e.value.addControl(O.value), E.value = new a.ControlBar({
            visible: t.config.plugin.controlBar.visible,
            showControlButton: t.config.plugin.controlBar.showControlButton,
            position: {
              right: t.config.plugin.controlBar.position.right + "px",
              top: t.config.plugin.controlBar.position.top + "px"
            }
          }), e.value.addControl(E.value), x.value = new a.ToolBar({
            visible: t.config.plugin.toolBar.visible,
            position: {
              left: t.config.plugin.toolBar.position.left + "px",
              top: t.config.plugin.toolBar.position.top + "px"
            }
          }), e.value.addControl(x.value);
          const i = e.value.getLayers();
          for (let r = 0; r < i.length; r++)
            (i[r].type === "sketchTileLayer" || i[r]._opts.type === "sketchImageLayer") && e.value.removeLayer(i[r]);
          if (t.sketchTile) {
            const r = ae(t.sketchTile);
            r && e.value.addLayer(r);
          }
          if (t.sketchImage) {
            const r = te(t.sketchImage);
            r && e.value.addLayer(r);
          }
          e.value.on("complete", () => {
            setTimeout(() => {
              var d;
              _.value = !0, y("amap2d-scene-success"), v.parseEvents(
                o.useEvents,
                "amap2d-scene-success",
                null
              );
              const r = c({
                clickCallback: (s) => {
                  y("amap2d-scene-label-layer-click", s), v.parseEvents(o.useEvents, "amap2d-scene-label-layer-click", s);
                },
                mouseoverCallback: (s) => {
                  y("amap2d-scene-label-layer-mouseover", s), v.parseEvents(o.useEvents, "amap2d-scene-label-layer-mouseover", s);
                },
                mouseoutCallback: (s) => {
                  y("amap2d-scene-label-layer-mouseout", s), v.parseEvents(o.useEvents, "amap2d-scene-label-layer-mouseout", s);
                }
              });
              (d = C.value) != null && d.length && (k.value = N(a, e.value, C.value, r, null), b.value.push({
                type: "markerLayer",
                value: k
              }));
            }, 666);
          }), e.value.on("zoomstart", () => {
            y("amap2d-scene-zoomstart"), v.parseEvents(
              o.useEvents,
              "amap2d-scene-zoomstart",
              null
            );
          }), e.value.on("zoomend", () => {
            y("amap2d-scene-zoomend"), v.parseEvents(
              o.useEvents,
              "amap2d-scene-zoomend",
              null
            );
          }), e.value.on("click", (r) => {
            y("amap2d-scene-mapclick", r.lnglat), v.parseEvents(
              o.useEvents,
              "amap2d-scene-mapclick",
              r.lnglat
            );
          }), e.value.on("dragstart", (r) => {
            y("amap2d-scene-dragstart", r.lnglat), v.parseEvents(
              o.useEvents,
              "amap2d-scene-dragstart",
              r.lnglat
            );
          }), e.value.on("dragend", (r) => {
            y("amap2d-scene-dragend", r.lnglat), v.parseEvents(
              o.useEvents,
              "amap2d-scene-dragend",
              r.lnglat
            );
          });
        }).catch((a) => {
        });
      }, R = (t) => {
        W(), t.config.apiTag && P(function(a) {
          const l = c({ ...t });
          if (l.value.basic.securityJsCode = p.value.mapSecurityJsCode, l.value.basic.key = p.value.mapKey, l.value.config.zoom = p.value.bestMapZoom, l.value.config.zooms = [p.value.minMapLevel, p.value.maxMapLevel], l.value.config.center = [p.value.centerLng, p.value.centerLat], p.value.layerName) {
            const i = c();
            i.value = "https://zgdev.fxo2opt.com", l.value.sketchTile.url = `${i.value}/hjly/map/${p.value.layerName}/{z}/{x}/{y}.png`, l.value.sketchTile.bounds = [
              [p.value.leftBottomLng, p.value.leftBottomLat],
              [p.value.rightTopLng, p.value.rightTopLat]
            ], l.value.sketchTile.zooms = l.value.config.zooms;
          } else p.value.mapUrl ? (l.value.sketchImage.url = p.value.mapUrl, l.value.sketchImage.bounds = [
            [p.value.leftBottomLng, p.value.leftBottomLat],
            [p.value.rightTopLng, p.value.rightTopLat]
          ], l.value.sketchImage.zooms = l.value.config.zooms, l.value.sketchTile = null) : (l.value.sketchImage = null, l.value.sketchTile = null);
          (!D.value || !D.value.basic) && (D.value = l.value, Q(l.value));
        });
      }, X = (t, a) => {
        const l = g.value, i = c(), r = c({
          clickCallback: (n) => {
            y("amap2d-scene-label-layer-click", n), v.parseEvents(o.useEvents, "amap2d-scene-label-layer-click", n);
          },
          mouseoverCallback: (n) => {
            y("amap2d-scene-label-layer-mouseover", n), v.parseEvents(o.useEvents, "amap2d-scene-label-layer-mouseover", n);
          },
          mouseoutCallback: (n) => {
            y("amap2d-scene-label-layer-mouseout", n), v.parseEvents(o.useEvents, "amap2d-scene-label-layer-mouseout", n);
          }
        }), d = t && t.data || we(), s = t.type;
        if (s === "navigatorDot" && Se(e, t), s === "loadHeatMap" ? (i.value = a.heatmap, oe(l, i.value, d)) : s === "hideHeatMap" && ze(H.value), s === "loadDotMap" ? (i.value = a.labelslayer, Pe.loadHomeResourceMap({
          pointType: p.value.pointType || "0",
          typeId: [p.value.typeId || 1],
          homeMapId: p.value.homeMapId || "1",
          mapPositionShowType: p.value.mapPositionShowType
        }).then((n) => {
          let f = n.data;
          if (p.value.resourceListFilter && (f = f == null ? void 0 : f.filter((ue) => ue.resourceName.indexOf(p.value.resourceListFilter) > -1)), f && !k.value) {
            if (e.value)
              C.value = null;
            else {
              C.value = f;
              return;
            }
            k.value = N(l, e.value, f, i, r.value), b.value.push({
              type: "markerLayer",
              value: k
            });
          }
        })) : s === "dotlayers" ? (i.value = a.dotlayers, re(window.Loca, i.value, A(d))) : s === "scatter" ? (i.value = a.scatter, le(window.Loca, i.value, A(d))) : s === "labelsLayer" ? (i.value = a.labelslayer, ie(window.Loca, i.value, A(d)), T(m, b, L)) : s === "clearDotMap" && (Ce(m, b), Ee(m, b), xe(m, b), Oe(e, b), k.value = null), s === "showDotLabelMap" ? (L.value = !0, T(m, b, L)) : s === "hideDotLabelMap" && (L.value = !1, T(m, b, L)), s === "showRoadMap" ? h.value ? h.value.show() : (h.value = new l.TileLayer.Traffic({
          autoRefresh: !0,
          // 是否自动刷新，默认为false
          interval: 180,
          // 刷新间隔，默认180s
          zIndex: 210
        }), De(l, e, h.value)) : s === "hideRoadMap" && Ae(l, e, h.value), s === "loadLineMap") {
          const n = [];
          d.forEach((f) => {
            f.lng && f.lat && n.push([f.lng, f.lat]);
          }), !z.value && n.length > 0 ? (z.value = new l.Polyline({
            path: n,
            strokeWeight: 3,
            strokeOpacity: 1,
            strokeColor: "yellow"
          }), Ie(l, e, z.value)) : z.value.show();
        } else s === "hideLineMap" && Te(l, e, z.value);
        s === "showSmallMap" ? Be(l, e.value, h.value) : s === "hideSmallMap" && _e(l, e.value, h.value);
      }, ee = (t) => {
        const l = t.slice(
          t.indexOf("(") + 1,
          t.lastIndexOf(")")
        ).split(",").map((r) => r.trim()), i = {};
        for (let r = 1; r < l.length; r++) {
          const d = l[r].split(" "), s = d[0], n = parseFloat(d[1]) / 100, f = Math.round(n * 100) / 100;
          i[f] = s;
        }
        return i;
      }, ae = (t) => {
        try {
          return new g.value.TileLayer({
            bounds: new g.value.Bounds(
              t.bounds[0],
              t.bounds[1]
            ),
            getTileUrl: function(l, i, r) {
              try {
                return t.url.replace("{z}", r).replace("{x}", l).replace("{y}", i);
              } catch {
              }
            },
            type: "sketchTileLayer",
            tileSize: t.tileSize,
            opacity: t.opacity,
            zIndex: t.zIndex,
            zooms: t.zooms
          });
        } catch {
        }
        return null;
      }, te = (t) => {
        try {
          return new g.value.ImageLayer({
            bounds: new g.value.Bounds(
              t.bounds[0],
              // 左下  手绘图左下相对于地图的经纬度
              t.bounds[1]
              // 右上  手绘图右上相对于地图的经纬度
            ),
            type: "sketchImageLayer",
            opacity: t.opacity,
            url: t.url,
            zIndex: t.zIndex,
            zooms: t.zooms
            // 设置可见级别，[最小级别，最大级别]
          });
        } catch {
        }
        return null;
      }, oe = (t, a, l) => {
        try {
          const i = new t.HeatMap(e.value, {
            radius: a.radius,
            // 给定半径
            opacity: a.opacity,
            gradient: ee(a.gradient)
          });
          H.value = i, setTimeout(() => {
            i.setDataSet({
              data: l,
              max: a.max
            });
          }, 0);
        } catch {
        }
      }, re = (t, a, l) => {
        try {
          const i = new t.GeoJSONSource({
            data: l
          }), r = new t.PointLayer({
            zIndex: a.zIndex,
            blend: a.blend,
            visible: a.visible,
            opacity: a.opacity
          }), d = {
            radius: a.style.radius,
            unit: a.style.unit,
            color: a.style.color,
            borderWidth: a.style.borderWidth,
            blurWidth: a.style.blurWidth,
            borderColor: a.style.borderColor
          };
          r.setSource(i), r.setStyle(d), m.value.add(r), b.value.push({
            type: "locaPointLayer",
            value: r
          }), r.addAnimate({
            key: a.animate.key,
            value: a.animate.value,
            duration: a.animate.duration,
            easing: a.animate.easing,
            transform: a.animate.transform,
            random: a.animate.random,
            delay: a.animate.delay,
            yoyo: a.animate.yoyo,
            repeat: a.animate.repeat
          });
        } catch {
        }
      }, le = (t, a, l) => {
        try {
          const i = new t.GeoJSONSource({
            data: l
          }), r = new t.ScatterLayer({
            loca: m.value,
            zIndex: a.zIndex,
            opacity: a.opacity,
            visible: a.visible,
            zooms: a.zooms
          });
          r.setSource(i), r.setStyle({
            unit: a.style.unit,
            size: a.style.size,
            borderWidth: a.style.borderWidth,
            texture: a.style.texture,
            duration: a.style.duration,
            animate: a.style.animate
          }), m.value.animate.start(), b.value.push({
            type: "breathRed",
            value: r
          });
        } catch {
        }
      }, ie = (t, a, l) => {
        try {
          const i = new t.GeoJSONSource({
            data: l
          }), r = new t.LabelsLayer({
            eventSupport: !0,
            visible: a.visible,
            zooms: a.zooms,
            opacity: a.opacity,
            collision: a.collision,
            allowCollision: a.allowCollision,
            zIndex: a.zIndex
          });
          r.setSource(i), r.setStyle({
            icon: {
              image: a.icon.image,
              size: a.icon.size,
              clipOrigin: a.icon.clipOrigin,
              offset: a.icon.offset,
              anchor: a.icon.anchor
            },
            text: {
              // 每项配置都可使用回调函数来动态配置
              content: (d, s) => s.properties[a.text.content],
              zooms: a.text.zooms,
              offset: a.text.offset,
              direction: a.text.direction,
              style: {
                fontSize: a.text.style.fontSize,
                fillColor: a.text.style.fillColor,
                strokeColor: a.text.style.strokeColor,
                strokeWidth: a.text.style.strokeWidth,
                padding: a.text.style.padding,
                backgroundColor: a.text.style.backgroundColor,
                borderColor: a.text.style.borderColor,
                borderWidth: a.text.style.borderWidth,
                fold: a.text.style.fold,
                fontWeight: a.text.style.fontWeight
              }
            }
          }), r.on("complete", () => {
            const d = r.getLabelsLayer().getAllOverlays();
            for (const s of d)
              s.on("click", (n) => {
                y("amap2d-scene-label-layer-click", n), v.parseEvents(
                  o.useEvents,
                  "amap2d-scene-label-layer-click",
                  n
                );
              }), s.on("mouseover", (n) => {
                y("amap2d-scene-label-layer-mouseover", n), v.parseEvents(
                  o.useEvents,
                  "amap2d-scene-label-layer-mouseover",
                  n
                );
              }), s.on("mouseout", (n) => {
                y("amap2d-scene-label-layer-mouseout", n), v.parseEvents(
                  o.useEvents,
                  "amap2d-scene-label-layer-mouseout",
                  n
                );
              });
          }), m.value.add(r), b.value.push({
            type: "labelsLayer",
            value: r
          });
        } catch {
        }
      }, A = (t) => {
        const a = {
          type: "FeatureCollection",
          features: []
        };
        return t.forEach((l, i) => {
          const r = {
            type: "Feature",
            id: ke(),
            properties: {
              name: l.name || "",
              _draw_type: "point"
            },
            geometry: {
              type: "Point",
              coordinates: l.value
            }
          };
          a.features.push(r);
        }), a;
      }, se = (t) => {
        e.value && (e.value.setFeatures(t.config.features), e.value.setStatus({
          dragEnable: t.config.dragEnable,
          zoomEnable: t.config.zoomEnable,
          rotateEnable: t.config.rotateEnable
        }), t.config.plugin.scale.visible ? O.value.show() : O.value.hide(), t.config.plugin.toolBar.visible ? x.value.show() : x.value.hide(), t.config.plugin.controlBar.visible ? E.value.show() : E.value.hide());
      }, pe = () => {
        e.value && (e.value.clearMap(), m.value.clear(), P(g.value));
      }, ne = (t) => {
        e.value && e.value.setMapStyle(t.config.mapStyle);
      }, me = (t) => {
        e.value && e.value.setZoom(t.config.zoom, !1, 200);
      }, ce = (t) => {
        e.value && e.value.setCenter(t.config.center, !1, 200);
      }, W = () => {
        e.value && (e.value.clearMap(), e.value.destroy(), e.value = null, m.value && (m.value.clear(), m.value.destroy(), m.value = null));
      };
      return fe(() => {
        setTimeout(() => {
          R(o.basicOption);
        }, 0);
      }), be(() => W()), {
        initAMap2d: R,
        updateAMapStyle: ne,
        updateAMapConfig: se,
        updateAMapComponents: pe,
        updateAMapZoom: me,
        updateAMapCenter: ce,
        amap2d: e,
        loading: _,
        AMapPrototype: g,
        showLable: L,
        renderComponentsV2: X
      };
    }, {
      initAMap2d: S,
      updateAMapStyle: U,
      updateAMapConfig: B,
      updateAMapComponents: j,
      updateAMapZoom: $,
      updateAMapCenter: K,
      loading: Y,
      showLable: q,
      renderComponentsV2: u
    } = G();
    return M(
      () => o.basicOption.config,
      () => {
        B(o.basicOption);
      },
      { deep: !0 }
    ), M(
      () => o.basicOption.config.zoom,
      () => {
        $(o.basicOption);
      },
      { deep: !0 }
    ), M(
      () => o.basicOption.config.center,
      () => {
        K(o.basicOption);
      },
      { deep: !0 }
    ), M(
      () => o.basicOption.widgets,
      () => {
        j();
      },
      { deep: !0 }
    ), M(
      () => o.basicOption.config.mapStyle,
      () => {
        U(o.basicOption);
      },
      { deep: !0 }
    ), M(
      () => o.basicOption.basic,
      () => {
        S(o.basicOption);
      },
      { deep: !0 }
    ), M(
      () => o.sources,
      () => {
        S(o.basicOption);
      },
      { deep: !0 }
    ), V({
      refresh: () => S(o.basicOption),
      refreshView: () => B(o.basicOption),
      refreshData: () => S(o.basicOption),
      refreshMapLayer: (e, m) => u(e, o.basicOption),
      // 定位点位
      navigatorDot: (e) => {
        e.type = "navigatorDot", u(e, o.basicOption);
      },
      // 清除点位
      clearDotMap: (e) => {
        (!e || e === 1 || e === 2) && (e = {}), e.type = "clearDotMap", u(e, o.basicOption);
      },
      // 打点热力图
      loadHeatMap: (e) => {
        e.type = "loadHeatMap", u(e, o.basicOption);
      },
      // 隐藏热力图点位
      hideHeatMap: (e) => {
        e.type = "hideHeatMap", u(e, o.basicOption);
      },
      // 打点方法1
      loadDotlayers: (e) => {
        e.type = "dotlayers", u(e, o.basicOption);
      },
      // 打点方法2
      loadScatter: (e) => {
        e.type = "scatter", u(e, o.basicOption);
      },
      // 打点方法3
      loadLabelsLayer: (e) => {
        e.type = "labelsLayer", u(e, o.basicOption);
      },
      // 打点方法4
      loadDotMap: (e) => {
        (!e || e === 1 || e === 2) && (e = {}), e.type = "loadDotMap", u(e, o.basicOption);
      },
      // 行走路线
      loadLineMap: (e) => {
        e.type = "loadLineMap", u(e, o.basicOption);
      },
      hideLineMap: (e) => {
        e.type = "hideLineMap", u(e, o.basicOption);
      },
      // 显示资源名称
      showDotLabelMap: (e) => {
        e.type = "showDotLabelMap", u(e, o.basicOption);
      },
      // 隐藏资源名称
      hideDotLabelMap: (e) => {
        e.type = "hideDotLabelMap", u(e, o.basicOption);
      },
      // 开启实时路况
      showRoadMap: (e) => {
        e.type = "openRoadMap", u(e, o.basicOption);
      },
      // 隐藏实时路况
      hideRoadMap: (e) => {
        e.type = "hideRoadMap", u(e, o.basicOption);
      },
      // 打开小地图
      showSmallMap: (e) => {
        e.type = "showSmallMap", u(e, o.basicOption);
      },
      // 隐藏小地图
      hideSmallMap: (e) => {
        e.type = "hideSmallMap", u(e, o.basicOption);
      }
    }), (e, m) => (ve(), de("div", {
      class: ye(["amap-2d-wrap", { show: J(Y), "amap-2d-show": J(q) }])
    }, Je, 2));
  }
});
export {
  Pr as default
};
