import '@das-fed/ui/packages/components/map/style.css';
import { ref as S, defineComponent as Ae, shallowRef as H, computed as Se, onMounted as Oe, createElementBlock as Te, openBlock as $e, normalizeStyle as je, createElementVNode as W, withDirectives as Z, createVNode as de, withKeys as Le, unref as D, h as Qt, render as ea, isRef as ta, vShow as Ke, withCtx as aa, createTextVNode as oa, toDisplayString as ra } from "vue";
import { withInstall as Ee } from "@das-fed/utils/with-install/index";
import { ElAutocomplete as Pe, ElLoadingDirective as ke } from "element-plus/es";
import "element-plus/es/components/base/style/css";
import "element-plus/es/components/loading/style/css";
import "element-plus/es/components/autocomplete/style/css";
import { t as P, setI18nRule as na } from "@das-fed/web/packages/i18n/index";
import { vDasTooltip as Re } from "@das-fed/ui/packages/components/text-tooltip/index";
import { DasMessage as z } from "@das-fed/ui/packages/components/message/index";
import { createService as ct } from "@das-fed/utils/create-api-service";
import { DasButton as la } from "@das-fed/ui/packages/components/button/index";
const Q = (e) => {
  if (e)
    return typeof e == "string" && hasCssUnit(e) ? e : e + "px";
}, st = ({ MapGL: e, map: t, marker: a, mapLoading: r, $autocomplete: u, searchResultList: l, innerInput: n, innerPoint: o, adCode: s, addressInfo: v }, b) => {
  const C = S();
  let x;
  const k = (T, g, p, w) => {
    C.value = p, w && (x = w);
    const j = document.createElement("script");
    if (j.src = `${location.protocol}//webapi.amap.com/maps?v=1.4.15&key=${T}&plugin=AMap.CitySearch&callback=onLoad`, g) {
      const d = document.createElement("script");
      d.innerHTML = `window._AMapSecurityConfig = {
        securityJsCode: "${g}",
      }`, document.head.appendChild(d);
    }
    document.head.appendChild(j), window.onLoad = () => {
      L();
    };
  }, L = () => {
    var T, g;
    if (e.value = AMap, !(typeof e.value > "u")) {
      try {
        const p = ((T = C.value) == null ? void 0 : T.mapOpt) ?? {};
        t.value = new AMap.Map("map", {
          zoom: 15,
          ...p
        });
      } catch {
        r.value = !1, z.error(P("thirdPartyMapErrorRetry"));
      }
      AMap.plugin(["AMap.ToolBar"], () => {
        t.value.addControl(
          // @ts-ignore
          new AMap.ToolBar({
            // 简易缩放模式，默认为 false
            liteStyle: !0
          })
        );
      }), i(), (g = C.value) != null && g.clickStream || c(), r.value = !1, x && x();
    }
  }, c = () => {
    t.value.on("click", (T) => {
      a.value && t.value.remove(a.value), o.value = [T.lnglat.getLng(), T.lnglat.getLat()], h(o.value, !0).then(() => {
        a.value = new AMap.Marker({
          position: o.value,
          title: n.value
        }), t.value.add(a.value), t.value.setCenter(o.value);
      });
    });
  }, i = async () => {
    !n.value && !o.value.length && R(), n.value && o.value.length > 0 ? await h(o.value) : n.value ? await A(n.value) : o.value.length > 0 && await h(o.value, !0), n.value && _(n.value, (T, g) => {
      if (g && g.length) {
        const p = g.find(
          (w) => w.value === n.value || w.info.name === n.value
        );
        p ? v.value = p.info : v.value = {
          district: "",
          address: "",
          name: n.value
        };
      }
    }), a.value = new AMap.Marker({
      position: o.value,
      title: n.value
    }), t.value.add(a.value), o.value.length && t.value.setCenter(o.value);
  }, h = (T, g = !1) => {
    const p = T.join(",");
    return new Promise((w, j) => {
      AMap.service("AMap.Geocoder", () => {
        new AMap.Geocoder({
          city: "全国"
        }).getAddress(p, (f, y) => {
          var M, m;
          if (f === "complete" && (y != null && y.regeocode)) {
            if (g) {
              const { province: O = "", city: N = "", district: B = "", township: ne = "" } = y.regeocode.addressComponent;
              n.value = y.regeocode.formattedAddress ?? "", v.value = {
                district: O + N + B,
                address: ne,
                name: n.value.replace(O, "").replace(N, "").replace(B, "").replace(ne, "")
              };
            }
            s.value = ((m = (M = y.regeocode) == null ? void 0 : M.addressComponent) == null ? void 0 : m.adcode) ?? "", w(y.regeocode);
          } else
            z.error(P("thirdPartyMapErrorRetry")), j();
        });
      });
    });
  }, A = (T) => new Promise((g, p) => {
    AMap.service("AMap.Geocoder", () => {
      new AMap.Geocoder({
        city: "全国"
      }).getLocation(T, (j, d) => {
        var f, y;
        if (j === "complete" && ((f = d.geocodes) != null && f.length)) {
          const M = d.geocodes[0].location;
          o.value[0] = M.lng, o.value[1] = M.lat, s.value = ((y = d.geocodes[0]) == null ? void 0 : y.adcode) ?? "", g(d.geocodes[0].location);
        } else
          z.error(P("thirdPartyMapErrorRetry")), p();
      });
    });
  }), R = () => {
    new AMap.CitySearch().getLocalCity((g, p) => {
      if (g === "complete" && p.info === "OK") {
        if (p && p.city && p.bounds) {
          const w = p.bounds;
          t.value.setBounds(w);
        }
      } else
        z.error(P("thirdPartyMapErrorRetry"));
    });
  }, _ = (T, g) => {
    if (u.value.activated = !0, !T) {
      l.value = [], g([]);
      return;
    }
    AMap.plugin("AMap.Autocomplete", function() {
      var p = {
        city: "全国"
      }, w = new AMap.Autocomplete(p);
      w.search(T, function(j, d) {
        if (l.value = [], !d || !d.tips) return g([]);
        let f = d.tips;
        if (!f || !f.length) return g([]);
        f = f.map((y) => {
          const { district: M = "", address: m = "", name: O = "", location: N = "" } = y;
          return {
            value: M + m + O,
            point: N,
            info: {
              district: M,
              address: m,
              name: O
            }
          };
        }), l.value = f.length > 5 ? f.slice(0, 5) : f, g(l.value, f);
      });
    });
  };
  return {
    getLocationByInputSearch: _,
    handleSelectAddress: (T) => {
      n.value = T.value, v.value = T.info, A(T.value).then((g) => {
        o.value = [g.lng, g.lat], a.value && t.value.remove(a.value), a.value = new AMap.Marker({
          position: o.value,
          title: n.value
          // 鼠标移上去时显示的内容
        }), t.value.add(a.value), t.value.setCenter(o.value);
      });
    },
    getLocationParse: async () => {
      var T;
      if (!l.value.length) return z.error(P("thirdPartyMapErrorRetry"));
      if (n.value = l.value[0].value, !((T = l.value[0]) != null && T.point))
        return z.error(P("thirdPartyMapErrorRetry"));
      o.value = [l.value[0].point.lng, l.value[0].point.lat], v.value = l.value[0].info, await h(o.value), a.value = new AMap.Marker({
        position: o.value,
        title: n.value
        // 鼠标移上去时显示的内容
      }), t.value.add(a.value), t.value.setCenter(o.value), u.value.activated = !1;
    },
    getMapInfo: () => ({
      longitude: o.value[0],
      latitude: o.value[1],
      adCode: s.value,
      address: n.value,
      addressInfo: v.value
    }),
    loadJavascript: k
  };
}, dt = "v1", ua = ct(`/api/tool/map/${dt}`), ia = ct(`/api/system-config/${dt}`), ca = ua.get("/regeo"), sa = ia.get("/platform/map/list"), Ge = async (e) => {
  var n, o, s, v, b;
  const t = ["", "baidu", "gaode", "google"];
  let a = null, [r, u] = await sa().run();
  if (r)
    return [r, a];
  const l = u.filter((C) => C.enable) || [];
  if ((l == null ? void 0 : l.length) == 0) return [null, a];
  if ((l == null ? void 0 : l.length) > 1) {
    const C = l.filter((x) => t[x.serviceProvider] == e);
    a = {
      mapType: e,
      akVal: (n = C[0]) == null ? void 0 : n.akValue,
      secretK: (o = C[0]) == null ? void 0 : o.securityKey
    };
  } else (l == null ? void 0 : l.length) == 1 && (a = {
    mapType: t[(s = l[0]) == null ? void 0 : s.serviceProvider],
    akVal: (v = l[0]) == null ? void 0 : v.akValue,
    secretK: (b = l[0]) == null ? void 0 : b.securityKey
  });
  return [null, a];
}, da = { class: "search-input" }, fa = { id: "map" }, va = /* @__PURE__ */ Ae({
  __name: "gaodeMap",
  props: {
    akValue: {},
    secretKey: {},
    defaultAddress: {},
    defaultLongitude: {},
    defaultLatitude: {},
    width: {},
    height: {},
    dev: { type: Boolean }
  },
  setup(e, { expose: t }) {
    const a = e, r = H(null), u = H(null), l = H(null), n = S(!0), o = S(null), s = S([]), v = Se(() => ({
      width: a.width ? Q(a.width) : "100%",
      height: a.height ? Q(a.height) : "100%"
    })), b = S(""), C = S([]), x = S(""), k = S(), { getLocationByInputSearch: L, handleSelectAddress: c, getLocationParse: i, getMapInfo: h, loadJavascript: A } = st(
      {
        MapGL: r,
        map: u,
        marker: l,
        mapLoading: n,
        $autocomplete: o,
        searchResultList: s,
        innerInput: b,
        innerPoint: C,
        adCode: x,
        addressInfo: k
      }
    ), R = async () => {
      const _ = {
        akValue: a.akValue ?? "",
        secretKey: a.secretKey ?? ""
      };
      {
        const [$, G] = await Ge("gaode");
        $ && z.error(P("获取地图配置信息失败")), !$ && !G && z.error(P("暂未配置地图")), G && (_.akValue || (_.akValue = G.akVal), _.secretKey || (_.secretKey = G.secretK));
      }
      return _;
    };
    return Oe(async () => {
      a.defaultLongitude && a.defaultLatitude && (C.value = [a.defaultLongitude, a.defaultLatitude]), b.value = a.defaultAddress ?? "";
      const { akValue: _, secretKey: $ } = await R();
      A(_, $);
    }), t({
      /** 获取经纬度、地址、行政区划编码 */
      getMapInfo: h
    }), (_, $) => {
      const G = Pe, U = ke;
      return $e(), Te(
        "div",
        {
          class: "das-map",
          style: je(v.value)
        },
        [
          W("div", da, [
            Z(de(G, {
              ref_key: "$autocomplete",
              ref: o,
              modelValue: b.value,
              "onUpdate:modelValue": $[0] || ($[0] = (T) => b.value = T),
              "fetch-suggestions": D(L),
              placeholder: D(P)("请输入位置"),
              style: { width: "100%" },
              "trigger-on-focus": !1,
              onSelect: D(c),
              onKeyup: Le(D(i), ["enter", "native"]),
              clearable: ""
            }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
              [D(Re)]
            ])
          ]),
          Z(W(
            "div",
            fa,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              U,
              n.value,
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), Be = (e, t) => {
  const a = e.__vccOpts || e;
  for (const [r, u] of t)
    a[r] = u;
  return a;
}, ga = /* @__PURE__ */ Be(va, [["__scopeId", "data-v-95b9bcca"]]), ft = ({ BMap: e, map: t, marker: a, mapLoading: r, $autocomplete: u, searchResultList: l, innerInput: n, innerPoint: o, adCode: s, addressInfo: v }, b) => {
  const C = S();
  let x;
  const k = (g, p, w) => {
    C.value = p, w && (x = w);
    const j = document.createElement("script");
    j.src = `${location.protocol}//api.map.baidu.com/getscript?type=webgl&v=3.0&ak=${g}&services=&t=20200109192240`, j.onload = () => {
      L();
    }, document.body.append(j);
  }, L = () => {
    var p, w;
    e.value = window.BMapGL;
    try {
      t.value = new e.value.Map("map", ((p = C.value) == null ? void 0 : p.mapOpt) ?? {});
    } catch {
      r.value = !1, z.error(P("thirdPartyMapErrorRetry"));
    }
    const g = new e.value.NavigationControl({
      // @ts-ignore
      anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
      // @ts-ignore
      type: BMAP_NAVIGATION_CONTROL_ZOOM
    });
    t.value.addControl(g), t.value.enableScrollWheelZoom(!0), i(), (w = C.value) != null && w.clickStream || h(), r.value = !1, x && x();
  }, c = (g) => new Promise((p, w) => {
    new e.value.Geocoder().getPoint(g, (d) => {
      !d || JSON.stringify(d) == "{}" ? (z.error(P("thirdPartyMapErrorRetry")), w()) : (o.value[0] = d.lng, o.value[1] = d.lat, p(d));
    });
  }), i = async () => {
    !n.value && !o.value.length && R(), n.value && o.value.length > 0 ? await A(o.value[0], o.value[1]) : n.value ? await c(n.value) : o.value.length > 0 && await A(o.value[0], o.value[1], !0), n.value && _(n.value, (g, p) => {
      if (p && p.length) {
        const w = p.find(
          (j) => j.value === n.value || j.info.name === n.value
        );
        w ? v.value = w.info : v.value = {
          province: "",
          city: "",
          address: "",
          name: n.value
        };
      }
    });
  }, h = () => {
    t.value.addEventListener("click", (g) => {
      a.value && t.value.clearOverlays();
      const p = g.latlng.lng, w = g.latlng.lat;
      o.value = [p, w], A(p, w, !0);
    });
  }, A = (g, p, w = !1, j = "default") => new Promise((d, f) => {
    const y = new e.value.Geocoder(), M = new e.value.Point(g, p);
    y.getLocation(M, (m) => {
      if (w) {
        n.value = m.address;
        const { province: O = "", city: N = "", district: B = "" } = m.addressComponents;
        v.value = {
          province: O,
          city: N,
          address: N + B,
          name: m.address.replace(O, "").replace(N, "").replace(B, "")
        };
      }
      m && m.address ? (j == "default" && (o.value[0] = m.point.lng, o.value[1] = m.point.lat, a.value && t.value.clearOverlays(), a.value = new e.value.Marker(M, { title: n.value }), t.value.addOverlay(a.value), t.value.centerAndZoom(M, 16)), U(g, p), d(m.address)) : (z.error(P("thirdPartyMapErrorRetry")), f());
    });
  }), R = () => {
    new e.value.LocalCity().get((p) => {
      const w = p.center;
      if (!p.center) return z.error(P("thirdPartyMapErrorRetry"));
      a.value && t.value.clearOverlays();
      const j = new e.value.Point(w.lng, w.lat);
      t.value.centerAndZoom(j, 13);
    });
  }, _ = (g, p) => {
    if (u.value.activated = !0, l.value = [], !g) {
      p([]);
      return;
    }
    new e.value.LocalSearch(t.value, {
      onSearchComplete: (j) => {
        let d = [];
        for (let f = 0; f < j.getCurrentNumPois(); f++)
          d.push(j.getPoi(f));
        if (!d.length) return p([]);
        d = d.map((f) => {
          const { address: y = "", title: M = "", province: m = "", city: O = "", point: N = {} } = f;
          return {
            value: y == M ? y : y + M,
            point: N,
            info: {
              province: m,
              city: O,
              address: y,
              name: M
            }
          };
        }), l.value = d.length > 5 ? d.slice(0, 5) : d, p(l.value, d);
      }
    }).search(g);
  }, $ = (g) => {
    var p, w;
    n.value = g.value, v.value = g.info, A((p = g.point) == null ? void 0 : p.lng, (w = g.point) == null ? void 0 : w.lat);
  }, G = () => {
    var g;
    if (!l.value.length) return z.error(P("thirdPartyMapErrorRetry"));
    if (n.value = l.value[0].value, v.value = l.value[0].info, !((g = l.value[0]) != null && g.point))
      return z.error(P("thirdPartyMapErrorRetry"));
    o.value = [l.value[0].point.lng, l.value[0].point.lat], A(o.value[0], o.value[1]), u.value.activated = !1;
  }, U = async (g, p) => {
    const [w, j] = await ca().run({ longitude: g, latitude: p });
    w || (s.value = j.areaCode);
  };
  return {
    getLocationByInputSearch: _,
    handleSelectAddress: $,
    getLocationParse: G,
    getMapInfo: () => ({
      longitude: o.value[0],
      latitude: o.value[1],
      adCode: s.value,
      address: n.value,
      addressInfo: v.value
    }),
    loadJavascript: k
  };
}, pa = { class: "search-input" }, ha = { id: "map" }, ya = /* @__PURE__ */ Ae({
  __name: "baiduMap",
  props: {
    akValue: {},
    secretKey: {},
    defaultAddress: {},
    defaultLongitude: {},
    defaultLatitude: {},
    width: {},
    height: {},
    dev: { type: Boolean }
  },
  setup(e, { expose: t }) {
    const a = e, r = H(null), u = H(null), l = H(null), n = S(!0), o = S(null), s = S([]), v = Se(() => ({
      width: a.width ? Q(a.width) : "100%",
      height: a.height ? Q(a.height) : "100%"
    })), b = S(""), C = S([]), x = S(""), k = S(), { getLocationByInputSearch: L, handleSelectAddress: c, getLocationParse: i, getMapInfo: h, loadJavascript: A } = ft(
      {
        BMap: r,
        map: u,
        marker: l,
        mapLoading: n,
        $autocomplete: o,
        searchResultList: s,
        innerInput: b,
        innerPoint: C,
        adCode: x,
        addressInfo: k
      }
    ), R = async () => {
      if (a.akValue) return a.akValue;
      const [_, $] = await Ge("baidu");
      return _ ? (z.error(P("获取地图配置信息失败")), "") : !_ && !$ ? (z.error(P("暂未配置地图")), "") : $.akVal;
    };
    return Oe(async () => {
      a.defaultLongitude && a.defaultLatitude && (C.value = [a.defaultLongitude, a.defaultLatitude]), b.value = a.defaultAddress ?? "";
      const _ = await R();
      A(_);
    }), t({
      // 获取经纬度、地址、行政区划信息
      getMapInfo: h
    }), (_, $) => {
      const G = Pe, U = ke;
      return $e(), Te(
        "div",
        {
          class: "das-map",
          style: je(v.value)
        },
        [
          W("div", pa, [
            Z(de(G, {
              ref_key: "$autocomplete",
              ref: o,
              modelValue: b.value,
              "onUpdate:modelValue": $[0] || ($[0] = (T) => b.value = T),
              "fetch-suggestions": D(L),
              placeholder: D(P)("请输入位置"),
              style: { width: "100%" },
              "trigger-on-focus": !1,
              onSelect: D(c),
              onKeyup: Le(D(i), ["enter", "native"]),
              clearable: ""
            }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
              [D(Re)]
            ])
          ]),
          Z(W(
            "div",
            ha,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              U,
              n.value,
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), ma = /* @__PURE__ */ Be(ya, [["__scopeId", "data-v-5444de43"]]);
function ba() {
  this.__data__ = [], this.size = 0;
}
function ge(e, t) {
  return e === t || e !== e && t !== t;
}
function pe(e, t) {
  for (var a = e.length; a--; )
    if (ge(e[a][0], t))
      return a;
  return -1;
}
var _a = Array.prototype, wa = _a.splice;
function xa(e) {
  var t = this.__data__, a = pe(t, e);
  if (a < 0)
    return !1;
  var r = t.length - 1;
  return a == r ? t.pop() : wa.call(t, a, 1), --this.size, !0;
}
function Ma(e) {
  var t = this.__data__, a = pe(t, e);
  return a < 0 ? void 0 : t[a][1];
}
function Ca(e) {
  return pe(this.__data__, e) > -1;
}
function Aa(e, t) {
  var a = this.__data__, r = pe(a, e);
  return r < 0 ? (++this.size, a.push([e, t])) : a[r][1] = t, this;
}
function I(e) {
  var t = -1, a = e == null ? 0 : e.length;
  for (this.clear(); ++t < a; ) {
    var r = e[t];
    this.set(r[0], r[1]);
  }
}
I.prototype.clear = ba;
I.prototype.delete = xa;
I.prototype.get = Ma;
I.prototype.has = Ca;
I.prototype.set = Aa;
function Sa() {
  this.__data__ = new I(), this.size = 0;
}
function Oa(e) {
  var t = this.__data__, a = t.delete(e);
  return this.size = t.size, a;
}
function Ta(e) {
  return this.__data__.get(e);
}
function $a(e) {
  return this.__data__.has(e);
}
var vt = typeof global == "object" && global && global.Object === Object && global, ja = typeof self == "object" && self && self.Object === Object && self, te = vt || ja || Function("return this")(), ee = te.Symbol, gt = Object.prototype, La = gt.hasOwnProperty, Ea = gt.toString, ue = ee ? ee.toStringTag : void 0;
function Pa(e) {
  var t = La.call(e, ue), a = e[ue];
  try {
    e[ue] = void 0;
    var r = !0;
  } catch {
  }
  var u = Ea.call(e);
  return r && (t ? e[ue] = a : delete e[ue]), u;
}
var ka = Object.prototype, Ra = ka.toString;
function Ga(e) {
  return Ra.call(e);
}
var Ba = "[object Null]", Da = "[object Undefined]", Fe = ee ? ee.toStringTag : void 0;
function se(e) {
  return e == null ? e === void 0 ? Da : Ba : Fe && Fe in Object(e) ? Pa(e) : Ga(e);
}
function Y(e) {
  var t = typeof e;
  return e != null && (t == "object" || t == "function");
}
var za = "[object AsyncFunction]", Na = "[object Function]", Ua = "[object GeneratorFunction]", Va = "[object Proxy]";
function De(e) {
  if (!Y(e))
    return !1;
  var t = se(e);
  return t == Na || t == Ua || t == za || t == Va;
}
var me = te["__core-js_shared__"], He = function() {
  var e = /[^.]+$/.exec(me && me.keys && me.keys.IE_PROTO || "");
  return e ? "Symbol(src)_1." + e : "";
}();
function Ka(e) {
  return !!He && He in e;
}
var Fa = Function.prototype, Ha = Fa.toString;
function Ia(e) {
  if (e != null) {
    try {
      return Ha.call(e);
    } catch {
    }
    try {
      return e + "";
    } catch {
    }
  }
  return "";
}
var Ja = /[\\^$.*+?()[\]{}|]/g, Za = /^\[object .+?Constructor\]$/, Wa = Function.prototype, qa = Object.prototype, Ya = Wa.toString, Xa = qa.hasOwnProperty, Qa = RegExp(
  "^" + Ya.call(Xa).replace(Ja, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function eo(e) {
  if (!Y(e) || Ka(e))
    return !1;
  var t = De(e) ? Qa : Za;
  return t.test(Ia(e));
}
function to(e, t) {
  return e == null ? void 0 : e[t];
}
function ze(e, t) {
  var a = to(e, t);
  return eo(a) ? a : void 0;
}
var pt = ze(te, "Map"), ce = ze(Object, "create");
function ao() {
  this.__data__ = ce ? ce(null) : {}, this.size = 0;
}
function oo(e) {
  var t = this.has(e) && delete this.__data__[e];
  return this.size -= t ? 1 : 0, t;
}
var ro = "__lodash_hash_undefined__", no = Object.prototype, lo = no.hasOwnProperty;
function uo(e) {
  var t = this.__data__;
  if (ce) {
    var a = t[e];
    return a === ro ? void 0 : a;
  }
  return lo.call(t, e) ? t[e] : void 0;
}
var io = Object.prototype, co = io.hasOwnProperty;
function so(e) {
  var t = this.__data__;
  return ce ? t[e] !== void 0 : co.call(t, e);
}
var fo = "__lodash_hash_undefined__";
function vo(e, t) {
  var a = this.__data__;
  return this.size += this.has(e) ? 0 : 1, a[e] = ce && t === void 0 ? fo : t, this;
}
function q(e) {
  var t = -1, a = e == null ? 0 : e.length;
  for (this.clear(); ++t < a; ) {
    var r = e[t];
    this.set(r[0], r[1]);
  }
}
q.prototype.clear = ao;
q.prototype.delete = oo;
q.prototype.get = uo;
q.prototype.has = so;
q.prototype.set = vo;
function go() {
  this.size = 0, this.__data__ = {
    hash: new q(),
    map: new (pt || I)(),
    string: new q()
  };
}
function po(e) {
  var t = typeof e;
  return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
}
function he(e, t) {
  var a = e.__data__;
  return po(t) ? a[typeof t == "string" ? "string" : "hash"] : a.map;
}
function ho(e) {
  var t = he(this, e).delete(e);
  return this.size -= t ? 1 : 0, t;
}
function yo(e) {
  return he(this, e).get(e);
}
function mo(e) {
  return he(this, e).has(e);
}
function bo(e, t) {
  var a = he(this, e), r = a.size;
  return a.set(e, t), this.size += a.size == r ? 0 : 1, this;
}
function ae(e) {
  var t = -1, a = e == null ? 0 : e.length;
  for (this.clear(); ++t < a; ) {
    var r = e[t];
    this.set(r[0], r[1]);
  }
}
ae.prototype.clear = go;
ae.prototype.delete = ho;
ae.prototype.get = yo;
ae.prototype.has = mo;
ae.prototype.set = bo;
var _o = 200;
function wo(e, t) {
  var a = this.__data__;
  if (a instanceof I) {
    var r = a.__data__;
    if (!pt || r.length < _o - 1)
      return r.push([e, t]), this.size = ++a.size, this;
    a = this.__data__ = new ae(r);
  }
  return a.set(e, t), this.size = a.size, this;
}
function oe(e) {
  var t = this.__data__ = new I(e);
  this.size = t.size;
}
oe.prototype.clear = Sa;
oe.prototype.delete = Oa;
oe.prototype.get = Ta;
oe.prototype.has = $a;
oe.prototype.set = wo;
var fe = function() {
  try {
    var e = ze(Object, "defineProperty");
    return e({}, "", {}), e;
  } catch {
  }
}();
function Ne(e, t, a) {
  t == "__proto__" && fe ? fe(e, t, {
    configurable: !0,
    enumerable: !0,
    value: a,
    writable: !0
  }) : e[t] = a;
}
function _e(e, t, a) {
  (a !== void 0 && !ge(e[t], a) || a === void 0 && !(t in e)) && Ne(e, t, a);
}
function xo(e) {
  return function(t, a, r) {
    for (var u = -1, l = Object(t), n = r(t), o = n.length; o--; ) {
      var s = n[++u];
      if (a(l[s], s, l) === !1)
        break;
    }
    return t;
  };
}
var Mo = xo(), ht = typeof exports == "object" && exports && !exports.nodeType && exports, Ie = ht && typeof module == "object" && module && !module.nodeType && module, Co = Ie && Ie.exports === ht, Je = Co ? te.Buffer : void 0;
Je && Je.allocUnsafe;
function Ao(e, t) {
  return e.slice();
}
var Ze = te.Uint8Array;
function So(e) {
  var t = new e.constructor(e.byteLength);
  return new Ze(t).set(new Ze(e)), t;
}
function Oo(e, t) {
  var a = So(e.buffer);
  return new e.constructor(a, e.byteOffset, e.length);
}
function To(e, t) {
  var a = -1, r = e.length;
  for (t || (t = Array(r)); ++a < r; )
    t[a] = e[a];
  return t;
}
var We = Object.create, $o = /* @__PURE__ */ function() {
  function e() {
  }
  return function(t) {
    if (!Y(t))
      return {};
    if (We)
      return We(t);
    e.prototype = t;
    var a = new e();
    return e.prototype = void 0, a;
  };
}();
function jo(e, t) {
  return function(a) {
    return e(t(a));
  };
}
var yt = jo(Object.getPrototypeOf, Object), Lo = Object.prototype;
function mt(e) {
  var t = e && e.constructor, a = typeof t == "function" && t.prototype || Lo;
  return e === a;
}
function Eo(e) {
  return typeof e.constructor == "function" && !mt(e) ? $o(yt(e)) : {};
}
function re(e) {
  return e != null && typeof e == "object";
}
var Po = "[object Arguments]";
function qe(e) {
  return re(e) && se(e) == Po;
}
var bt = Object.prototype, ko = bt.hasOwnProperty, Ro = bt.propertyIsEnumerable, we = qe(/* @__PURE__ */ function() {
  return arguments;
}()) ? qe : function(e) {
  return re(e) && ko.call(e, "callee") && !Ro.call(e, "callee");
}, ve = Array.isArray, Go = 9007199254740991;
function _t(e) {
  return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Go;
}
function Ue(e) {
  return e != null && _t(e.length) && !De(e);
}
function Bo(e) {
  return re(e) && Ue(e);
}
function Do() {
  return !1;
}
var wt = typeof exports == "object" && exports && !exports.nodeType && exports, Ye = wt && typeof module == "object" && module && !module.nodeType && module, zo = Ye && Ye.exports === wt, Xe = zo ? te.Buffer : void 0, No = Xe ? Xe.isBuffer : void 0, xt = No || Do, Uo = "[object Object]", Vo = Function.prototype, Ko = Object.prototype, Mt = Vo.toString, Fo = Ko.hasOwnProperty, Ho = Mt.call(Object);
function Io(e) {
  if (!re(e) || se(e) != Uo)
    return !1;
  var t = yt(e);
  if (t === null)
    return !0;
  var a = Fo.call(t, "constructor") && t.constructor;
  return typeof a == "function" && a instanceof a && Mt.call(a) == Ho;
}
var Jo = "[object Arguments]", Zo = "[object Array]", Wo = "[object Boolean]", qo = "[object Date]", Yo = "[object Error]", Xo = "[object Function]", Qo = "[object Map]", er = "[object Number]", tr = "[object Object]", ar = "[object RegExp]", or = "[object Set]", rr = "[object String]", nr = "[object WeakMap]", lr = "[object ArrayBuffer]", ur = "[object DataView]", ir = "[object Float32Array]", cr = "[object Float64Array]", sr = "[object Int8Array]", dr = "[object Int16Array]", fr = "[object Int32Array]", vr = "[object Uint8Array]", gr = "[object Uint8ClampedArray]", pr = "[object Uint16Array]", hr = "[object Uint32Array]", E = {};
E[ir] = E[cr] = E[sr] = E[dr] = E[fr] = E[vr] = E[gr] = E[pr] = E[hr] = !0;
E[Jo] = E[Zo] = E[lr] = E[Wo] = E[ur] = E[qo] = E[Yo] = E[Xo] = E[Qo] = E[er] = E[tr] = E[ar] = E[or] = E[rr] = E[nr] = !1;
function yr(e) {
  return re(e) && _t(e.length) && !!E[se(e)];
}
function mr(e) {
  return function(t) {
    return e(t);
  };
}
var Ct = typeof exports == "object" && exports && !exports.nodeType && exports, ie = Ct && typeof module == "object" && module && !module.nodeType && module, br = ie && ie.exports === Ct, be = br && vt.process, Qe = function() {
  try {
    var e = ie && ie.require && ie.require("util").types;
    return e || be && be.binding && be.binding("util");
  } catch {
  }
}(), et = Qe && Qe.isTypedArray, At = et ? mr(et) : yr;
function xe(e, t) {
  if (!(t === "constructor" && typeof e[t] == "function") && t != "__proto__")
    return e[t];
}
var _r = Object.prototype, wr = _r.hasOwnProperty;
function xr(e, t, a) {
  var r = e[t];
  (!(wr.call(e, t) && ge(r, a)) || a === void 0 && !(t in e)) && Ne(e, t, a);
}
function Mr(e, t, a, r) {
  var u = !a;
  a || (a = {});
  for (var l = -1, n = t.length; ++l < n; ) {
    var o = t[l], s = void 0;
    s === void 0 && (s = e[o]), u ? Ne(a, o, s) : xr(a, o, s);
  }
  return a;
}
function Cr(e, t) {
  for (var a = -1, r = Array(e); ++a < e; )
    r[a] = t(a);
  return r;
}
var Ar = 9007199254740991, Sr = /^(?:0|[1-9]\d*)$/;
function St(e, t) {
  var a = typeof e;
  return t = t ?? Ar, !!t && (a == "number" || a != "symbol" && Sr.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
function Or(e, t) {
  var a = ve(e), r = !a && we(e), u = !a && !r && xt(e), l = !a && !r && !u && At(e), n = a || r || u || l, o = n ? Cr(e.length, String) : [], s = o.length;
  for (var v in e)
    n && // Safari 9 has enumerable `arguments.length` in strict mode.
    (v == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    u && (v == "offset" || v == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    l && (v == "buffer" || v == "byteLength" || v == "byteOffset") || // Skip index properties.
    St(v, s)) || o.push(v);
  return o;
}
function Tr(e) {
  var t = [];
  if (e != null)
    for (var a in Object(e))
      t.push(a);
  return t;
}
var $r = Object.prototype, jr = $r.hasOwnProperty;
function Lr(e) {
  if (!Y(e))
    return Tr(e);
  var t = mt(e), a = [];
  for (var r in e)
    r == "constructor" && (t || !jr.call(e, r)) || a.push(r);
  return a;
}
function Ot(e) {
  return Ue(e) ? Or(e) : Lr(e);
}
function Er(e) {
  return Mr(e, Ot(e));
}
function Pr(e, t, a, r, u, l, n) {
  var o = xe(e, a), s = xe(t, a), v = n.get(s);
  if (v) {
    _e(e, a, v);
    return;
  }
  var b = l ? l(o, s, a + "", e, t, n) : void 0, C = b === void 0;
  if (C) {
    var x = ve(s), k = !x && xt(s), L = !x && !k && At(s);
    b = s, x || k || L ? ve(o) ? b = o : Bo(o) ? b = To(o) : k ? (C = !1, b = Ao(s)) : L ? (C = !1, b = Oo(s)) : b = [] : Io(s) || we(s) ? (b = o, we(o) ? b = Er(o) : (!Y(o) || De(o)) && (b = Eo(s))) : C = !1;
  }
  C && (n.set(s, b), u(b, s, r, l, n), n.delete(s)), _e(e, a, b);
}
function Tt(e, t, a, r, u) {
  e !== t && Mo(t, function(l, n) {
    if (u || (u = new oe()), Y(l))
      Pr(e, t, n, a, Tt, r, u);
    else {
      var o = r ? r(xe(e, n), l, n + "", e, t, u) : void 0;
      o === void 0 && (o = l), _e(e, n, o);
    }
  }, Ot);
}
function $t(e) {
  return e;
}
function kr(e, t, a) {
  switch (a.length) {
    case 0:
      return e.call(t);
    case 1:
      return e.call(t, a[0]);
    case 2:
      return e.call(t, a[0], a[1]);
    case 3:
      return e.call(t, a[0], a[1], a[2]);
  }
  return e.apply(t, a);
}
var tt = Math.max;
function Rr(e, t, a) {
  return t = tt(t === void 0 ? e.length - 1 : t, 0), function() {
    for (var r = arguments, u = -1, l = tt(r.length - t, 0), n = Array(l); ++u < l; )
      n[u] = r[t + u];
    u = -1;
    for (var o = Array(t + 1); ++u < t; )
      o[u] = r[u];
    return o[t] = a(n), kr(e, this, o);
  };
}
function Gr(e) {
  return function() {
    return e;
  };
}
var Br = fe ? function(e, t) {
  return fe(e, "toString", {
    configurable: !0,
    enumerable: !1,
    value: Gr(t),
    writable: !0
  });
} : $t, Dr = 800, zr = 16, Nr = Date.now;
function Ur(e) {
  var t = 0, a = 0;
  return function() {
    var r = Nr(), u = zr - (r - a);
    if (a = r, u > 0) {
      if (++t >= Dr)
        return arguments[0];
    } else
      t = 0;
    return e.apply(void 0, arguments);
  };
}
var Vr = Ur(Br);
function Kr(e, t) {
  return Vr(Rr(e, t, $t), e + "");
}
function Fr(e, t, a) {
  if (!Y(a))
    return !1;
  var r = typeof t;
  return (r == "number" ? Ue(a) && St(t, a.length) : r == "string" && t in a) ? ge(a[t], e) : !1;
}
function Hr(e) {
  return Kr(function(t, a) {
    var r = -1, u = a.length, l = u > 1 ? a[u - 1] : void 0, n = u > 2 ? a[2] : void 0;
    for (l = e.length > 3 && typeof l == "function" ? (u--, l) : void 0, n && Fr(a[0], a[1], n) && (l = u < 3 ? void 0 : l, u = 1), t = Object(t); ++r < u; ) {
      var o = a[r];
      o && e(t, o, r, l);
    }
    return t;
  });
}
var Ir = Hr(function(e, t, a, r) {
  Tt(e, t, a, r);
}), Jr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Zr(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var jt = { exports: {} };
(function(e) {
  (function(t, a) {
    e.exports ? e.exports = a() : t.coordtransform = a();
  })(Jr, function() {
    var t = 52.35987755982988, a = 3.141592653589793, r = 6378245, u = 0.006693421622965943, l = function(c, i) {
      var c = +c, i = +i, h = c - 65e-4, A = i - 6e-3, R = Math.sqrt(h * h + A * A) - 2e-5 * Math.sin(A * t), _ = Math.atan2(A, h) - 3e-6 * Math.cos(h * t), $ = R * Math.cos(_), G = R * Math.sin(_);
      return [$, G];
    }, n = function(i, c) {
      var c = +c, i = +i, h = Math.sqrt(i * i + c * c) + 2e-5 * Math.sin(c * t), A = Math.atan2(c, i) + 3e-6 * Math.cos(i * t), R = h * Math.cos(A) + 65e-4, _ = h * Math.sin(A) + 6e-3;
      return [R, _];
    }, o = function(i, c) {
      var c = +c, i = +i;
      if (C(i, c))
        return [i, c];
      var h = v(i - 105, c - 35), A = b(i - 105, c - 35), R = c / 180 * a, _ = Math.sin(R);
      _ = 1 - u * _ * _;
      var $ = Math.sqrt(_);
      h = h * 180 / (r * (1 - u) / (_ * $) * a), A = A * 180 / (r / $ * Math.cos(R) * a);
      var G = c + h, U = i + A;
      return [U, G];
    }, s = function(i, c) {
      var c = +c, i = +i;
      if (C(i, c))
        return [i, c];
      var h = v(i - 105, c - 35), A = b(i - 105, c - 35), R = c / 180 * a, _ = Math.sin(R);
      _ = 1 - u * _ * _;
      var $ = Math.sqrt(_);
      h = h * 180 / (r * (1 - u) / (_ * $) * a), A = A * 180 / (r / $ * Math.cos(R) * a);
      var G = c + h, U = i + A;
      return [i * 2 - U, c * 2 - G];
    }, v = function(i, c) {
      var c = +c, i = +i, h = -100 + 2 * i + 3 * c + 0.2 * c * c + 0.1 * i * c + 0.2 * Math.sqrt(Math.abs(i));
      return h += (20 * Math.sin(6 * i * a) + 20 * Math.sin(2 * i * a)) * 2 / 3, h += (20 * Math.sin(c * a) + 40 * Math.sin(c / 3 * a)) * 2 / 3, h += (160 * Math.sin(c / 12 * a) + 320 * Math.sin(c * a / 30)) * 2 / 3, h;
    }, b = function(i, c) {
      var c = +c, i = +i, h = 300 + i + 2 * c + 0.1 * i * i + 0.1 * i * c + 0.1 * Math.sqrt(Math.abs(i));
      return h += (20 * Math.sin(6 * i * a) + 20 * Math.sin(2 * i * a)) * 2 / 3, h += (20 * Math.sin(i * a) + 40 * Math.sin(i / 3 * a)) * 2 / 3, h += (150 * Math.sin(i / 12 * a) + 300 * Math.sin(i / 30 * a)) * 2 / 3, h;
    }, C = function(i, c) {
      var c = +c, i = +i;
      return !(i > 73.66 && i < 135.05 && c > 3.86 && c < 53.55);
    };
    return {
      bd09togcj02: l,
      gcj02tobd09: n,
      wgs84togcj02: o,
      gcj02towgs84: s
    };
  });
})(jt);
var Wr = jt.exports;
const Lt = /* @__PURE__ */ Zr(Wr), qr = (e, t, { type: a, MapGL: r, map: u }) => {
  const l = (n, o) => {
    const s = document.createElement("div");
    s.style.cursor = "pointer";
    const v = Qt(n, o);
    return ea(v, s), s;
  };
  e.addCustomComponent = (n) => {
    !Array.isArray(n) || (n == null ? void 0 : n.length) === 0 || n.forEach((o) => {
      const { component: s, componentProps: v, lng: b, lat: C, markerOptions: x = {} } = o, k = typeof v == "function" ? v() : v, L = typeof s == "function" ? s() : s, c = () => l(L, k);
      if (a.value === "baidu") {
        const i = Lt.gcj02tobd09(b, C), h = new r.value.CustomOverlay(c, {
          point: { lng: i[0], lat: i[1] },
          ...x
        });
        u.value.addOverlay(h), h.addEventListener("click", function(A) {
          t("click-custom-component", o, A);
        });
      }
      if (a.value === "gaode") {
        const i = l(L, k), h = new r.value.Marker({ content: i, position: [b, C], ...x });
        u.value.add(h), r.value.event.addListener(h, "click", function(A) {
          t("click-custom-component", o, A);
        });
      }
    });
  };
}, Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: qr
}, Symbol.toStringTag, { value: "Module" })), Xr = (e, t, { type: a, MapGL: r, map: u, innerPoint: l, innerInput: n, adCode: o, addressInfo: s }) => {
  e.getMapInfo = () => {
    if (a.value === "baidu") {
      const v = Lt.bd09togcj02(l.value[0], l.value[1]);
      return {
        longitude: v[0],
        latitude: v[1],
        address: n.value,
        adCode: o.value,
        addressInfo: s.value
      };
    }
    if (a.value === "gaode")
      return {
        longitude: l.value[0],
        latitude: l.value[1],
        address: n.value,
        adCode: o.value,
        addressInfo: s.value
      };
    if (a.value === "google")
      return {
        longitude: l.value[0],
        latitude: l.value[1],
        address: n.value,
        adCode: o.value,
        addressInfo: s.value
      };
  };
}, Qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Xr
}, Symbol.toStringTag, { value: "Module" }));
function en(e, t) {
  for (var a = -1, r = e == null ? 0 : e.length, u = Array(r); ++a < r; )
    u[a] = t(e[a], a, e);
  return u;
}
var tn = "[object Symbol]";
function an(e) {
  return typeof e == "symbol" || re(e) && se(e) == tn;
}
var at = ee ? ee.prototype : void 0, ot = at ? at.toString : void 0;
function Et(e) {
  if (typeof e == "string")
    return e;
  if (ve(e))
    return en(e, Et) + "";
  if (an(e))
    return ot ? ot.call(e) : "";
  var t = e + "";
  return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
}
function ye(e) {
  return e == null ? "" : Et(e);
}
function on(e, t, a) {
  var r = -1, u = e.length;
  t < 0 && (t = -t > u ? 0 : u + t), a = a > u ? u : a, a < 0 && (a += u), u = t > a ? 0 : a - t >>> 0, t >>>= 0;
  for (var l = Array(u); ++r < u; )
    l[r] = e[r + t];
  return l;
}
function rn(e, t, a) {
  var r = e.length;
  return a = a === void 0 ? r : a, on(e, t, a);
}
var nn = "\\ud800-\\udfff", ln = "\\u0300-\\u036f", un = "\\ufe20-\\ufe2f", cn = "\\u20d0-\\u20ff", sn = ln + un + cn, dn = "\\ufe0e\\ufe0f", fn = "\\u200d", vn = RegExp("[" + fn + nn + sn + dn + "]");
function Pt(e) {
  return vn.test(e);
}
function gn(e) {
  return e.split("");
}
var kt = "\\ud800-\\udfff", pn = "\\u0300-\\u036f", hn = "\\ufe20-\\ufe2f", yn = "\\u20d0-\\u20ff", mn = pn + hn + yn, bn = "\\ufe0e\\ufe0f", _n = "[" + kt + "]", Me = "[" + mn + "]", Ce = "\\ud83c[\\udffb-\\udfff]", wn = "(?:" + Me + "|" + Ce + ")", Rt = "[^" + kt + "]", Gt = "(?:\\ud83c[\\udde6-\\uddff]){2}", Bt = "[\\ud800-\\udbff][\\udc00-\\udfff]", xn = "\\u200d", Dt = wn + "?", zt = "[" + bn + "]?", Mn = "(?:" + xn + "(?:" + [Rt, Gt, Bt].join("|") + ")" + zt + Dt + ")*", Cn = zt + Dt + Mn, An = "(?:" + [Rt + Me + "?", Me, Gt, Bt, _n].join("|") + ")", Sn = RegExp(Ce + "(?=" + Ce + ")|" + An + Cn, "g");
function On(e) {
  return e.match(Sn) || [];
}
function Tn(e) {
  return Pt(e) ? On(e) : gn(e);
}
function $n(e) {
  return function(t) {
    t = ye(t);
    var a = Pt(t) ? Tn(t) : void 0, r = a ? a[0] : t.charAt(0), u = a ? rn(a, 1).join("") : t.slice(1);
    return r[e]() + u;
  };
}
var jn = $n("toUpperCase");
function Ln(e) {
  return jn(ye(e).toLowerCase());
}
function En(e, t, a, r) {
  for (var u = -1, l = e == null ? 0 : e.length; ++u < l; )
    a = t(a, e[u], u, e);
  return a;
}
function Pn(e) {
  return function(t) {
    return e == null ? void 0 : e[t];
  };
}
var kn = {
  // Latin-1 Supplement block.
  À: "A",
  Á: "A",
  Â: "A",
  Ã: "A",
  Ä: "A",
  Å: "A",
  à: "a",
  á: "a",
  â: "a",
  ã: "a",
  ä: "a",
  å: "a",
  Ç: "C",
  ç: "c",
  Ð: "D",
  ð: "d",
  È: "E",
  É: "E",
  Ê: "E",
  Ë: "E",
  è: "e",
  é: "e",
  ê: "e",
  ë: "e",
  Ì: "I",
  Í: "I",
  Î: "I",
  Ï: "I",
  ì: "i",
  í: "i",
  î: "i",
  ï: "i",
  Ñ: "N",
  ñ: "n",
  Ò: "O",
  Ó: "O",
  Ô: "O",
  Õ: "O",
  Ö: "O",
  Ø: "O",
  ò: "o",
  ó: "o",
  ô: "o",
  õ: "o",
  ö: "o",
  ø: "o",
  Ù: "U",
  Ú: "U",
  Û: "U",
  Ü: "U",
  ù: "u",
  ú: "u",
  û: "u",
  ü: "u",
  Ý: "Y",
  ý: "y",
  ÿ: "y",
  Æ: "Ae",
  æ: "ae",
  Þ: "Th",
  þ: "th",
  ß: "ss",
  // Latin Extended-A block.
  Ā: "A",
  Ă: "A",
  Ą: "A",
  ā: "a",
  ă: "a",
  ą: "a",
  Ć: "C",
  Ĉ: "C",
  Ċ: "C",
  Č: "C",
  ć: "c",
  ĉ: "c",
  ċ: "c",
  č: "c",
  Ď: "D",
  Đ: "D",
  ď: "d",
  đ: "d",
  Ē: "E",
  Ĕ: "E",
  Ė: "E",
  Ę: "E",
  Ě: "E",
  ē: "e",
  ĕ: "e",
  ė: "e",
  ę: "e",
  ě: "e",
  Ĝ: "G",
  Ğ: "G",
  Ġ: "G",
  Ģ: "G",
  ĝ: "g",
  ğ: "g",
  ġ: "g",
  ģ: "g",
  Ĥ: "H",
  Ħ: "H",
  ĥ: "h",
  ħ: "h",
  Ĩ: "I",
  Ī: "I",
  Ĭ: "I",
  Į: "I",
  İ: "I",
  ĩ: "i",
  ī: "i",
  ĭ: "i",
  į: "i",
  ı: "i",
  Ĵ: "J",
  ĵ: "j",
  Ķ: "K",
  ķ: "k",
  ĸ: "k",
  Ĺ: "L",
  Ļ: "L",
  Ľ: "L",
  Ŀ: "L",
  Ł: "L",
  ĺ: "l",
  ļ: "l",
  ľ: "l",
  ŀ: "l",
  ł: "l",
  Ń: "N",
  Ņ: "N",
  Ň: "N",
  Ŋ: "N",
  ń: "n",
  ņ: "n",
  ň: "n",
  ŋ: "n",
  Ō: "O",
  Ŏ: "O",
  Ő: "O",
  ō: "o",
  ŏ: "o",
  ő: "o",
  Ŕ: "R",
  Ŗ: "R",
  Ř: "R",
  ŕ: "r",
  ŗ: "r",
  ř: "r",
  Ś: "S",
  Ŝ: "S",
  Ş: "S",
  Š: "S",
  ś: "s",
  ŝ: "s",
  ş: "s",
  š: "s",
  Ţ: "T",
  Ť: "T",
  Ŧ: "T",
  ţ: "t",
  ť: "t",
  ŧ: "t",
  Ũ: "U",
  Ū: "U",
  Ŭ: "U",
  Ů: "U",
  Ű: "U",
  Ų: "U",
  ũ: "u",
  ū: "u",
  ŭ: "u",
  ů: "u",
  ű: "u",
  ų: "u",
  Ŵ: "W",
  ŵ: "w",
  Ŷ: "Y",
  ŷ: "y",
  Ÿ: "Y",
  Ź: "Z",
  Ż: "Z",
  Ž: "Z",
  ź: "z",
  ż: "z",
  ž: "z",
  Ĳ: "IJ",
  ĳ: "ij",
  Œ: "Oe",
  œ: "oe",
  ŉ: "'n",
  ſ: "s"
}, Rn = Pn(kn), Gn = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Bn = "\\u0300-\\u036f", Dn = "\\ufe20-\\ufe2f", zn = "\\u20d0-\\u20ff", Nn = Bn + Dn + zn, Un = "[" + Nn + "]", Vn = RegExp(Un, "g");
function Kn(e) {
  return e = ye(e), e && e.replace(Gn, Rn).replace(Vn, "");
}
var Fn = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function Hn(e) {
  return e.match(Fn) || [];
}
var In = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function Jn(e) {
  return In.test(e);
}
var Nt = "\\ud800-\\udfff", Zn = "\\u0300-\\u036f", Wn = "\\ufe20-\\ufe2f", qn = "\\u20d0-\\u20ff", Yn = Zn + Wn + qn, Ut = "\\u2700-\\u27bf", Vt = "a-z\\xdf-\\xf6\\xf8-\\xff", Xn = "\\xac\\xb1\\xd7\\xf7", Qn = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", el = "\\u2000-\\u206f", tl = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Kt = "A-Z\\xc0-\\xd6\\xd8-\\xde", al = "\\ufe0e\\ufe0f", Ft = Xn + Qn + el + tl, Ht = "['’]", rt = "[" + Ft + "]", ol = "[" + Yn + "]", It = "\\d+", rl = "[" + Ut + "]", Jt = "[" + Vt + "]", Zt = "[^" + Nt + Ft + It + Ut + Vt + Kt + "]", nl = "\\ud83c[\\udffb-\\udfff]", ll = "(?:" + ol + "|" + nl + ")", ul = "[^" + Nt + "]", Wt = "(?:\\ud83c[\\udde6-\\uddff]){2}", qt = "[\\ud800-\\udbff][\\udc00-\\udfff]", X = "[" + Kt + "]", il = "\\u200d", nt = "(?:" + Jt + "|" + Zt + ")", cl = "(?:" + X + "|" + Zt + ")", lt = "(?:" + Ht + "(?:d|ll|m|re|s|t|ve))?", ut = "(?:" + Ht + "(?:D|LL|M|RE|S|T|VE))?", Yt = ll + "?", Xt = "[" + al + "]?", sl = "(?:" + il + "(?:" + [ul, Wt, qt].join("|") + ")" + Xt + Yt + ")*", dl = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", fl = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", vl = Xt + Yt + sl, gl = "(?:" + [rl, Wt, qt].join("|") + ")" + vl, pl = RegExp([
  X + "?" + Jt + "+" + lt + "(?=" + [rt, X, "$"].join("|") + ")",
  cl + "+" + ut + "(?=" + [rt, X + nt, "$"].join("|") + ")",
  X + "?" + nt + "+" + lt,
  X + "+" + ut,
  fl,
  dl,
  It,
  gl
].join("|"), "g");
function hl(e) {
  return e.match(pl) || [];
}
function yl(e, t, a) {
  return e = ye(e), t = t, t === void 0 ? Jn(e) ? hl(e) : Hn(e) : e.match(t) || [];
}
var ml = "['’]", bl = RegExp(ml, "g");
function _l(e) {
  return function(t) {
    return En(yl(Kn(t).replace(bl, "")), e, "");
  };
}
var wl = _l(function(e, t, a) {
  return t = t.toLowerCase(), e + (a ? Ln(t) : t);
});
const it = /* @__PURE__ */ Object.assign({ "./add-custom-dom/index.ts": Yr, "./get-map-info/index.ts": Qr }), xl = Object.keys(it).reduce((e, t) => {
  const a = wl(t.replace("./", "").split("/")[0]);
  return e[a] = it[t].default, e;
}, {}), Ml = (e, t, a) => {
  const r = S({});
  return { mapElement: r, addPlugins: () => {
    const n = Ir({}, (e == null ? void 0 : e.options) || {}, (o, s) => {
      if (Array.isArray(o)) return o.concat(s);
    });
    Object.values(xl).forEach((o) => o(r.value, t, a, n.plugins || {}));
  } };
}, Cl = ({ MapGL: e, map: t, marker: a, mapLoading: r, $autocomplete: u, searchResultList: l, innerInput: n, innerPoint: o, adCode: s, addressInfo: v }, b) => {
  const C = S(), x = S(), k = S();
  let L = null;
  const c = S(!1), i = S();
  let h;
  const A = async (d, f, y, M) => {
    if (i.value = y, M && (h = M), document.getElementById(d)) return R();
    const m = document.createElement("script"), O = `mapLoad${(/* @__PURE__ */ new Date()).getTime()}`, N = `https://maps.googleapis.com/maps/api/js?key=${d}&loading=async&callback=${O}`;
    m.setAttribute("id", d), m.setAttribute("src", N), document.body.appendChild(m), window[O] = () => {
      R();
    };
  }, R = async () => {
    var N, B;
    const { Map: d } = await google.maps.importLibrary("maps");
    e.value = d;
    const { Place: f, AutocompleteSessionToken: y, AutocompleteSuggestion: M } = await google.maps.importLibrary("places");
    x.value = new y(), k.value = M, C.value = f;
    const { AdvancedMarkerElement: m } = await google.maps.importLibrary("marker");
    L = m;
    const O = ((N = i.value) == null ? void 0 : N.mapOpt) ?? {};
    t.value = new d(document.getElementById("map"), {
      zoom: 11,
      mapId: "DEMO_MAP_ID",
      fullscreenControl: !1,
      // 全屏
      streetViewControl: !1,
      // 街景
      mapTypeControl: !1,
      // 左上角地图类型
      gestureHandling: "greedy",
      // 谷歌地图api缩放去掉ctrl+滚轮缩放，直接鼠标缩放
      ...O
    }), await $(), (B = i.value) != null && B.clickStream || _(), r.value = !1, c.value = !n.value && !o.value.length, h && h();
  }, _ = () => {
    var d;
    (d = t.value) == null || d.addListener("click", (f) => {
      var y, M;
      a.value && a.value.setMap(null), o.value = [(y = f == null ? void 0 : f.latLng) == null ? void 0 : y.lng(), (M = f == null ? void 0 : f.latLng) == null ? void 0 : M.lat()], G(o.value, !0).then(() => {
        var O;
        const m = {
          lng: parseFloat(o.value[0]),
          lat: parseFloat(o.value[1])
        };
        a.value = new L({
          map: t.value,
          position: m,
          title: n.value
          // 鼠标移上去时显示的内容
        }), (O = t.value) == null || O.panTo(m);
      });
    });
  }, $ = async () => {
    var d;
    if (!n.value && o.value.length, n.value && o.value.length > 0 ? await G(o.value) : n.value ? await U(n.value) : o.value.length > 0 && await G(o.value, !0), n.value && g(n.value, (f, y) => {
      if (y && y.length) {
        const M = y.find(
          (m) => m.value === n.value || m.info.name === n.value
        );
        M ? v.value = M.info : v.value = {
          district: "",
          address: "",
          name: n.value
        };
      }
    }), o.value.length) {
      const f = {
        lng: parseFloat(o.value[0]),
        lat: parseFloat(o.value[1])
      };
      a.value = new L({
        map: t.value,
        position: f,
        title: n.value
        // 鼠标移上去时显示的内容
      }), o.value.length && ((d = t.value) == null || d.setCenter(f));
    }
  }, G = (d, f = !1) => (d.join(","), new Promise((y, M) => {
    new google.maps.Geocoder().geocode({
      location: {
        lng: parseFloat(d[0]),
        lat: parseFloat(d[1])
      }
    }, (O, N) => {
      N === "OK" && (O != null && O.length) ? (f && (n.value = O[0].formatted_address ?? "", v.value = {
        district: "",
        address: "",
        name: n.value
      }), y(O[0])) : (z.error(P("thirdPartyMapErrorRetry")), M());
    });
  })), U = (d) => new Promise((f, y) => {
    new google.maps.Geocoder().geocode({
      address: n.value
    }, (m, O) => {
      O === "OK" && (m != null && m.length) ? (o.value[0] = m[0].geometry.location.lng(), o.value[1] = m[0].geometry.location.lat(), f({ lng: o.value[0], lat: o.value[1] })) : (z.error(P("thirdPartyMapErrorRetry")), y());
    });
  }), T = async () => {
    var d;
    r.value = !0, navigator.geolocation && ((d = navigator.geolocation) == null || d.getCurrentPosition((f) => {
      var M;
      const y = {
        lat: f.coords.latitude,
        lng: f.coords.longitude
      };
      (M = t.value) == null || M.panTo(y), c.value = !1, r.value = !1;
    }, (f) => {
      z.error(P("获取定位失败")), r.value = !1;
    }, {
      // enableHighAccuracy: true,
      // timeout: 5000,
      // maximumAge: 0,
      // enableHighAccuracy: true
      enableHighAccuracy: !0,
      timeout: 1e4
    }));
  }, g = async (d, f) => {
    if (u.value.activated = !0, !d) {
      l.value = [], f([]);
      return;
    }
    let y = {
      input: d,
      origin: { lng: parseFloat(o.value[0]), lat: parseFloat(o.value[1]) },
      sessionToken: x.value
    };
    const { suggestions: M } = await k.value.fetchAutocompleteSuggestions(y);
    if (l.value = [], !M) return f([]);
    let m = [];
    await Promise.all(
      M.map((O) => (async () => {
        var J, le;
        let B = (O == null ? void 0 : O.placePrediction).toPlace();
        await B.fetchFields({
          fields: [
            "displayName",
            "formattedAddress",
            "location"
          ]
        });
        const ne = (J = B == null ? void 0 : B.location) == null ? void 0 : J.lng(), V = (le = B == null ? void 0 : B.location) == null ? void 0 : le.lat(), K = {
          // value: placePrediction?.text?.toString() || '',
          value: B == null ? void 0 : B.formattedAddress,
          point: { lng: ne, lat: V },
          info: {
            name: B == null ? void 0 : B.displayName
          }
        };
        m.push(K);
      })())
    ), l.value = m.length > 5 ? m.slice(0, 5) : m, f(l.value, m);
  };
  return {
    getLocationByInputSearch: g,
    handleSelectAddress: (d) => {
      n.value = d.value, v.value = d.info, U(d.value).then((f) => {
        var y;
        o.value = [f.lng, f.lat], a.value && a.value.setMap(null), a.value = new L({
          map: t.value,
          position: f,
          title: n.value
          // 鼠标移上去时显示的内容
        }), (y = t.value) == null || y.panTo(f), c.value = !1;
      });
    },
    getLocationParse: async () => {
      var d, f;
      if (l.value.length) {
        if (n.value = l.value[0].value, !((d = l.value[0]) != null && d.point))
          return z.error(P("thirdPartyMapErrorRetry"));
        o.value = [l.value[0].point.lng, l.value[0].point.lat], v.value = l.value[0].info, a.value = new L({
          map: t.value,
          position: l.value[0].point,
          title: n.value
          // 鼠标移上去时显示的内容
        }), (f = t.value) == null || f.panTo(l.value[0].point), c.value = !1, u.value.activated = !1;
      }
    },
    getMapInfo: () => ({
      longitude: o.value[0],
      latitude: o.value[1],
      adCode: s.value,
      address: n.value,
      addressInfo: v.value
    }),
    loadJavascript: A,
    positionCityLocal: T,
    showGetLocationBtn: c
  };
}, Al = (e, t) => {
  const a = S("gaode"), r = S(), u = S(), l = H(null), n = H(null), o = H(null), s = S(!0), v = S(null), b = S([]), C = Se(() => ({
    width: e.width ? Q(e.width) : "100%",
    height: e.height ? Q(e.height) : "100%"
  })), x = S(""), k = S([]), L = S(""), c = S(), {
    loadJavascript: i,
    getLocationByInputSearch: h,
    handleSelectAddress: A,
    getLocationParse: R
  } = ft({
    BMap: l,
    map: n,
    marker: o,
    mapLoading: s,
    $autocomplete: v,
    searchResultList: b,
    innerInput: x,
    innerPoint: k,
    adCode: L,
    addressInfo: c
  }), {
    loadJavascript: _,
    getLocationByInputSearch: $,
    handleSelectAddress: G,
    getLocationParse: U
  } = st({
    MapGL: l,
    map: n,
    marker: o,
    mapLoading: s,
    $autocomplete: v,
    searchResultList: b,
    innerInput: x,
    innerPoint: k,
    adCode: L,
    addressInfo: c
  }), {
    loadJavascript: T,
    getLocationByInputSearch: g,
    handleSelectAddress: p,
    getLocationParse: w,
    positionCityLocal: j,
    showGetLocationBtn: d
  } = Cl({
    MapGL: l,
    map: n,
    marker: o,
    mapLoading: s,
    $autocomplete: v,
    searchResultList: b,
    innerInput: x,
    innerPoint: k,
    adCode: L,
    addressInfo: c
  }), { mapElement: f, addPlugins: y } = Ml(e, t, {
    type: a,
    MapGL: l,
    map: n,
    innerPoint: k,
    innerInput: x,
    adCode: L,
    addressInfo: c
  }), M = () => {
    a.value === "baidu" && i(r.value, { clickStream: !e.clickStream, mapOpt: e.mapOpt }, O), a.value === "gaode" && _(
      r.value,
      u.value,
      { clickStream: !e.clickStream, mapOpt: e.mapOpt },
      O
    ), a.value === "google" && T(
      r.value,
      u.value,
      { clickStream: !e.clickStream, mapOpt: e.mapOpt },
      O
    );
  }, m = async (V) => {
    const [K, J] = await Ge(V);
    if (K) {
      s.value = !1;
      return;
    }
    if (!K && !J) {
      t("no-config-map", P("暂未配置地图")), s.value = !1;
      return;
    }
    return J;
  };
  Oe(async () => {
    var V, K, J, le, Ve;
    if (e.defaultLongitude && e.defaultLatitude && (k.value = [e.defaultLongitude, e.defaultLatitude]), x.value = e.defaultAddress ?? "", e != null && e.sdkConfig && ((V = e == null ? void 0 : e.sdkConfig) != null && V.akValue))
      a.value = ((K = e.sdkConfig) == null ? void 0 : K.mapType) ?? "gaode", r.value = (J = e.sdkConfig) == null ? void 0 : J.akValue, u.value = (le = e.sdkConfig) == null ? void 0 : le.secretKey;
    else {
      const F = await m((Ve = e == null ? void 0 : e.sdkConfig) == null ? void 0 : Ve.mapType);
      F && (a.value = (F == null ? void 0 : F.mapType) ?? "gaode", r.value = F == null ? void 0 : F.akVal, u.value = F == null ? void 0 : F.secretK);
    }
    M();
  });
  const O = () => {
    f.value = n.value, y(), a.value === "baidu" && n.value.addEventListener("tilesloaded", () => {
      t("update:mapElement", f.value);
    }), a.value === "gaode" && n.value.on("complete", () => {
      t("update:mapElement", f.value);
    }), a.value === "google" && t("update:mapElement", f.value);
  };
  return {
    mapStyle: C,
    innerInput: x,
    getLocationByInputSearch: (V, K) => {
      a.value === "baidu" && h(V, K), a.value === "gaode" && $(V, K), a.value === "google" && g(V, K);
    },
    handleSelectAddress: (V) => {
      a.value === "baidu" && A(V), a.value === "gaode" && G(V), a.value === "google" && p(V);
    },
    getLocationParse: () => {
      a.value === "baidu" && R(), a.value === "gaode" && U(), a.value === "google" && w();
    },
    mapLoading: s,
    $autocomplete: v,
    googlePositionCityLocal: j,
    showGetLocationBtn: d
  };
}, Sl = { class: "search-input" }, Ol = { class: "location-icon1" }, Tl = { id: "map" }, $l = /* @__PURE__ */ Ae({
  __name: "mixMap",
  props: {
    defaultAddress: {},
    showSearch: { type: Boolean },
    clickStream: { type: Boolean },
    defaultLongitude: {},
    defaultLatitude: {},
    width: {},
    height: {},
    mapElement: {},
    sdkConfig: {},
    dev: { type: Boolean },
    mapOpt: {}
  },
  emits: ["update:mapElement", "no-config-map", "click-custom-component"],
  setup(e, { emit: t }) {
    const a = e, r = t, {
      mapStyle: u,
      innerInput: l,
      getLocationByInputSearch: n,
      handleSelectAddress: o,
      getLocationParse: s,
      mapLoading: v,
      $autocomplete: b,
      googlePositionCityLocal: C,
      showGetLocationBtn: x
    } = Al(a, r);
    return (k, L) => {
      const c = Pe, i = ke;
      return $e(), Te(
        "div",
        {
          class: "das-map",
          style: je(D(u))
        },
        [
          Z(W(
            "div",
            Sl,
            [
              Z(de(c, {
                ref_key: "$autocomplete",
                ref: b,
                modelValue: D(l),
                "onUpdate:modelValue": L[0] || (L[0] = (h) => ta(l) ? l.value = h : null),
                "fetch-suggestions": D(n),
                placeholder: D(P)("请输入位置"),
                style: { width: "100%" },
                "trigger-on-focus": !1,
                onSelect: D(o),
                onKeyup: Le(D(s), ["enter", "native"]),
                clearable: ""
              }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
                [D(Re)]
              ])
            ],
            512
            /* NEED_PATCH */
          ), [
            [Ke, a.showSearch]
          ]),
          Z(W(
            "div",
            Ol,
            [
              de(D(la), {
                block: "",
                size: "large",
                onClick: D(C)
              }, {
                default: aa(() => [
                  oa(
                    ra(D(P)("Please-Click-Get-Location")),
                    1
                    /* TEXT */
                  )
                ]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ],
            512
            /* NEED_PATCH */
          ), [
            [Ke, D(x)]
          ]),
          Z(W(
            "div",
            Tl,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              i,
              D(v),
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), jl = /* @__PURE__ */ Be($l, [["__scopeId", "data-v-9c0f471e"]]), Ll = {
  请输入位置: { "zh-CN": "请输入位置", en: "Please enter location", _appCode: "framework" },
  获取地图配置信息失败: {
    "zh-CN": "获取地图配置信息失败",
    en: "The map configuration information failed to be obtained",
    _appCode: "framework"
  },
  暂未配置地图: { "zh-CN": "暂未配置地图", en: "Map Not Configured", _appCode: "framework" },
  thirdPartyMapErrorRetry: {
    "zh-CN": "第三方地图配置参数错误或地址信息无效，请检查后再重试",
    en: "The configuration parameters of the third-party map are incorrect or the address information is invalid. please check and try again",
    _appCode: "framework"
  },
  "Please-Click-Get-Location": {
    "zh-CN": "请点击获取位置",
    en: "Please click get location",
    _appCode: "framework"
  },
  获取定位失败: {
    "zh-CN": "获取定位失败",
    en: "The location failed to be obtained",
    _appCode: "framework"
  }
};
na(Ll);
const Kl = Ee(ga), Fl = () => S(null), Hl = Ee(ma), Il = () => S(null), Jl = Ee(jl), Zl = () => S(null), Wl = { title: "Map 地图" };
export {
  Hl as DasBaiduMap,
  Il as DasBaiduMapRef,
  Kl as DasGaodeMap,
  Fl as DasGaodeMapRef,
  Jl as DasMap,
  Zl as DasMapRef,
  Wl as default
};
