import '@das-fed/upf-ui/packages/components/map/style.css';
import { ref as S, defineComponent as Ae, shallowRef as H, computed as Se, onMounted as Oe, openBlock as Te, createElementBlock as $e, normalizeStyle as je, createElementVNode as W, withDirectives as Z, createVNode as de, unref as B, withKeys as Le, h as ea, render as ta, isRef as aa, vShow as Fe, withCtx as oa, createTextVNode as ra, toDisplayString as na } from "vue";
import { withInstall as Ee } from "@das-fed/upf-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 la } from "@das-fed/upf-web/packages/i18n/index";
import { vDasTooltip as Re } from "@das-fed/upf-ui/packages/components/text-tooltip/index";
import { DasMessage as D } from "@das-fed/upf-ui/packages/components/message/index";
import { createService as st } from "@das-fed/upf-utils/create-api-service";
import { DasButton as ua } from "@das-fed/upf-ui/packages/components/button/index";
const ia = (e) => /^[+-]?\d+(\.\d+)?(px|em|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|%)$/.test(e), Q = (e) => {
  if (e)
    return typeof e == "string" && ia(e) ? e : e + "px";
}, dt = ({ 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 M;
  const k = (T, g, p, w) => {
    C.value = p, w && (M = 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, D.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, M && M();
    }
  }, 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 x, m;
          if (f === "complete" && (y != null && y.regeocode)) {
            if (g) {
              const { province: O = "", city: N = "", district: z = "", township: ne = "" } = y.regeocode.addressComponent;
              n.value = y.regeocode.formattedAddress ?? "", v.value = {
                district: O + N + z,
                address: ne,
                name: n.value.replace(O, "").replace(N, "").replace(z, "").replace(ne, "")
              };
            }
            s.value = ((m = (x = y.regeocode) == null ? void 0 : x.addressComponent) == null ? void 0 : m.adcode) ?? "", w(y.regeocode);
          } else
            D.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 x = d.geocodes[0].location;
          o.value[0] = x.lng, o.value[1] = x.lat, s.value = ((y = d.geocodes[0]) == null ? void 0 : y.adcode) ?? "", g(d.geocodes[0].location);
        } else
          D.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
        D.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: x = "", address: m = "", name: O = "", location: N = "" } = y;
          return {
            value: x + m + O,
            point: N,
            info: {
              district: x,
              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 D.error(P("thirdPartyMapErrorRetry"));
      if (n.value = l.value[0].value, !((T = l.value[0]) != null && T.point))
        return D.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
  };
}, ft = "v1", ca = st(`/api/tool/map/${ft}`), sa = st(`/api/system-config/${ft}`), da = ca.get("/regeo"), fa = sa.get("/platform/map/list"), Ge = async (e) => {
  var n, o, s, v, b;
  const t = ["", "baidu", "gaode", "google"];
  let a = null, [r, u] = await fa().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((M) => t[M.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];
}, va = { class: "search-input" }, ga = { id: "map" }, pa = /* @__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([]), M = S(""), k = S(), { getLocationByInputSearch: L, handleSelectAddress: c, getLocationParse: i, getMapInfo: h, loadJavascript: A } = dt(
      {
        MapGL: r,
        map: u,
        marker: l,
        mapLoading: n,
        $autocomplete: o,
        searchResultList: s,
        innerInput: b,
        innerPoint: C,
        adCode: M,
        addressInfo: k
      }
    ), R = async () => {
      const _ = {
        akValue: a.akValue ?? "",
        secretKey: a.secretKey ?? ""
      };
      {
        const [$, G] = await Ge("gaode");
        $ && D.error(P("获取地图配置信息失败")), !$ && !G && D.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 Te(), $e(
        "div",
        {
          class: "das-map",
          style: je(v.value)
        },
        [
          W("div", va, [
            Z(de(G, {
              ref_key: "$autocomplete",
              ref: o,
              modelValue: b.value,
              "onUpdate:modelValue": $[0] || ($[0] = (T) => b.value = T),
              "fetch-suggestions": B(L),
              placeholder: B(P)("请输入位置"),
              style: { width: "100%" },
              "trigger-on-focus": !1,
              onSelect: B(c),
              onKeyup: Le(B(i), ["enter", "native"]),
              clearable: ""
            }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
              [B(Re)]
            ])
          ]),
          Z(W(
            "div",
            ga,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              U,
              n.value,
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), ze = (e, t) => {
  const a = e.__vccOpts || e;
  for (const [r, u] of t)
    a[r] = u;
  return a;
}, ha = /* @__PURE__ */ ze(pa, [["__scopeId", "data-v-15845511"]]), vt = ({ 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 M;
  const k = (g, p, w) => {
    C.value = p, w && (M = 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, D.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, M && M();
  }, c = (g) => new Promise((p, w) => {
    new e.value.Geocoder().getPoint(g, (d) => {
      !d || JSON.stringify(d) == "{}" ? (D.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(), x = new e.value.Point(g, p);
    y.getLocation(x, (m) => {
      if (w) {
        n.value = m.address;
        const { province: O = "", city: N = "", district: z = "" } = m.addressComponents;
        v.value = {
          province: O,
          city: N,
          address: N + z,
          name: m.address.replace(O, "").replace(N, "").replace(z, "")
        };
      }
      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(x, { title: n.value }), t.value.addOverlay(a.value), t.value.centerAndZoom(x, 16)), U(g, p), d(m.address)) : (D.error(P("thirdPartyMapErrorRetry")), f());
    });
  }), R = () => {
    new e.value.LocalCity().get((p) => {
      const w = p.center;
      if (!p.center) return D.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: x = "", province: m = "", city: O = "", point: N = {} } = f;
          return {
            value: y == x ? y : y + x,
            point: N,
            info: {
              province: m,
              city: O,
              address: y,
              name: x
            }
          };
        }), 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 D.error(P("thirdPartyMapErrorRetry"));
    if (n.value = l.value[0].value, v.value = l.value[0].info, !((g = l.value[0]) != null && g.point))
      return D.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 da().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
  };
}, ya = { class: "search-input" }, ma = { id: "map" }, ba = /* @__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([]), M = S(""), k = S(), { getLocationByInputSearch: L, handleSelectAddress: c, getLocationParse: i, getMapInfo: h, loadJavascript: A } = vt(
      {
        BMap: r,
        map: u,
        marker: l,
        mapLoading: n,
        $autocomplete: o,
        searchResultList: s,
        innerInput: b,
        innerPoint: C,
        adCode: M,
        addressInfo: k
      }
    ), R = async () => {
      if (a.akValue) return a.akValue;
      const [_, $] = await Ge("baidu");
      return _ ? (D.error(P("获取地图配置信息失败")), "") : !_ && !$ ? (D.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 Te(), $e(
        "div",
        {
          class: "das-map",
          style: je(v.value)
        },
        [
          W("div", ya, [
            Z(de(G, {
              ref_key: "$autocomplete",
              ref: o,
              modelValue: b.value,
              "onUpdate:modelValue": $[0] || ($[0] = (T) => b.value = T),
              "fetch-suggestions": B(L),
              placeholder: B(P)("请输入位置"),
              style: { width: "100%" },
              "trigger-on-focus": !1,
              onSelect: B(c),
              onKeyup: Le(B(i), ["enter", "native"]),
              clearable: ""
            }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
              [B(Re)]
            ])
          ]),
          Z(W(
            "div",
            ma,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              U,
              n.value,
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), _a = /* @__PURE__ */ ze(ba, [["__scopeId", "data-v-42e64d2c"]]);
function wa() {
  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 Ma = Array.prototype, xa = Ma.splice;
function Ca(e) {
  var t = this.__data__, a = pe(t, e);
  if (a < 0)
    return !1;
  var r = t.length - 1;
  return a == r ? t.pop() : xa.call(t, a, 1), --this.size, !0;
}
function Aa(e) {
  var t = this.__data__, a = pe(t, e);
  return a < 0 ? void 0 : t[a][1];
}
function Sa(e) {
  return pe(this.__data__, e) > -1;
}
function Oa(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 = wa;
I.prototype.delete = Ca;
I.prototype.get = Aa;
I.prototype.has = Sa;
I.prototype.set = Oa;
function Ta() {
  this.__data__ = new I(), this.size = 0;
}
function $a(e) {
  var t = this.__data__, a = t.delete(e);
  return this.size = t.size, a;
}
function ja(e) {
  return this.__data__.get(e);
}
function La(e) {
  return this.__data__.has(e);
}
var gt = typeof global == "object" && global && global.Object === Object && global, Ea = typeof self == "object" && self && self.Object === Object && self, te = gt || Ea || Function("return this")(), ee = te.Symbol, pt = Object.prototype, Pa = pt.hasOwnProperty, ka = pt.toString, ue = ee ? ee.toStringTag : void 0;
function Ra(e) {
  var t = Pa.call(e, ue), a = e[ue];
  try {
    e[ue] = void 0;
    var r = !0;
  } catch {
  }
  var u = ka.call(e);
  return r && (t ? e[ue] = a : delete e[ue]), u;
}
var Ga = Object.prototype, za = Ga.toString;
function Ba(e) {
  return za.call(e);
}
var Da = "[object Null]", Na = "[object Undefined]", He = ee ? ee.toStringTag : void 0;
function se(e) {
  return e == null ? e === void 0 ? Na : Da : He && He in Object(e) ? Ra(e) : Ba(e);
}
function Y(e) {
  var t = typeof e;
  return e != null && (t == "object" || t == "function");
}
var Ua = "[object AsyncFunction]", Va = "[object Function]", Ka = "[object GeneratorFunction]", Fa = "[object Proxy]";
function Be(e) {
  if (!Y(e))
    return !1;
  var t = se(e);
  return t == Va || t == Ka || t == Ua || t == Fa;
}
var me = te["__core-js_shared__"], Ie = function() {
  var e = /[^.]+$/.exec(me && me.keys && me.keys.IE_PROTO || "");
  return e ? "Symbol(src)_1." + e : "";
}();
function Ha(e) {
  return !!Ie && Ie in e;
}
var Ia = Function.prototype, Ja = Ia.toString;
function Za(e) {
  if (e != null) {
    try {
      return Ja.call(e);
    } catch {
    }
    try {
      return e + "";
    } catch {
    }
  }
  return "";
}
var Wa = /[\\^$.*+?()[\]{}|]/g, qa = /^\[object .+?Constructor\]$/, Ya = Function.prototype, Xa = Object.prototype, Qa = Ya.toString, eo = Xa.hasOwnProperty, to = RegExp(
  "^" + Qa.call(eo).replace(Wa, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function ao(e) {
  if (!Y(e) || Ha(e))
    return !1;
  var t = Be(e) ? to : qa;
  return t.test(Za(e));
}
function oo(e, t) {
  return e == null ? void 0 : e[t];
}
function De(e, t) {
  var a = oo(e, t);
  return ao(a) ? a : void 0;
}
var ht = De(te, "Map"), ce = De(Object, "create");
function ro() {
  this.__data__ = ce ? ce(null) : {}, this.size = 0;
}
function no(e) {
  var t = this.has(e) && delete this.__data__[e];
  return this.size -= t ? 1 : 0, t;
}
var lo = "__lodash_hash_undefined__", uo = Object.prototype, io = uo.hasOwnProperty;
function co(e) {
  var t = this.__data__;
  if (ce) {
    var a = t[e];
    return a === lo ? void 0 : a;
  }
  return io.call(t, e) ? t[e] : void 0;
}
var so = Object.prototype, fo = so.hasOwnProperty;
function vo(e) {
  var t = this.__data__;
  return ce ? t[e] !== void 0 : fo.call(t, e);
}
var go = "__lodash_hash_undefined__";
function po(e, t) {
  var a = this.__data__;
  return this.size += this.has(e) ? 0 : 1, a[e] = ce && t === void 0 ? go : 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 = ro;
q.prototype.delete = no;
q.prototype.get = co;
q.prototype.has = vo;
q.prototype.set = po;
function ho() {
  this.size = 0, this.__data__ = {
    hash: new q(),
    map: new (ht || I)(),
    string: new q()
  };
}
function yo(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 yo(t) ? a[typeof t == "string" ? "string" : "hash"] : a.map;
}
function mo(e) {
  var t = he(this, e).delete(e);
  return this.size -= t ? 1 : 0, t;
}
function bo(e) {
  return he(this, e).get(e);
}
function _o(e) {
  return he(this, e).has(e);
}
function wo(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 = ho;
ae.prototype.delete = mo;
ae.prototype.get = bo;
ae.prototype.has = _o;
ae.prototype.set = wo;
var Mo = 200;
function xo(e, t) {
  var a = this.__data__;
  if (a instanceof I) {
    var r = a.__data__;
    if (!ht || r.length < Mo - 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 = Ta;
oe.prototype.delete = $a;
oe.prototype.get = ja;
oe.prototype.has = La;
oe.prototype.set = xo;
var fe = function() {
  try {
    var e = De(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 Co(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 Ao = Co(), yt = typeof exports == "object" && exports && !exports.nodeType && exports, Je = yt && typeof module == "object" && module && !module.nodeType && module, So = Je && Je.exports === yt, Ze = So ? te.Buffer : void 0;
Ze && Ze.allocUnsafe;
function Oo(e, t) {
  return e.slice();
}
var We = te.Uint8Array;
function To(e) {
  var t = new e.constructor(e.byteLength);
  return new We(t).set(new We(e)), t;
}
function $o(e, t) {
  var a = To(e.buffer);
  return new e.constructor(a, e.byteOffset, e.length);
}
function jo(e, t) {
  var a = -1, r = e.length;
  for (t || (t = Array(r)); ++a < r; )
    t[a] = e[a];
  return t;
}
var qe = Object.create, Lo = /* @__PURE__ */ function() {
  function e() {
  }
  return function(t) {
    if (!Y(t))
      return {};
    if (qe)
      return qe(t);
    e.prototype = t;
    var a = new e();
    return e.prototype = void 0, a;
  };
}();
function Eo(e, t) {
  return function(a) {
    return e(t(a));
  };
}
var mt = Eo(Object.getPrototypeOf, Object), Po = Object.prototype;
function bt(e) {
  var t = e && e.constructor, a = typeof t == "function" && t.prototype || Po;
  return e === a;
}
function ko(e) {
  return typeof e.constructor == "function" && !bt(e) ? Lo(mt(e)) : {};
}
function re(e) {
  return e != null && typeof e == "object";
}
var Ro = "[object Arguments]";
function Ye(e) {
  return re(e) && se(e) == Ro;
}
var _t = Object.prototype, Go = _t.hasOwnProperty, zo = _t.propertyIsEnumerable, we = Ye(/* @__PURE__ */ function() {
  return arguments;
}()) ? Ye : function(e) {
  return re(e) && Go.call(e, "callee") && !zo.call(e, "callee");
}, ve = Array.isArray, Bo = 9007199254740991;
function wt(e) {
  return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Bo;
}
function Ue(e) {
  return e != null && wt(e.length) && !Be(e);
}
function Do(e) {
  return re(e) && Ue(e);
}
function No() {
  return !1;
}
var Mt = typeof exports == "object" && exports && !exports.nodeType && exports, Xe = Mt && typeof module == "object" && module && !module.nodeType && module, Uo = Xe && Xe.exports === Mt, Qe = Uo ? te.Buffer : void 0, Vo = Qe ? Qe.isBuffer : void 0, xt = Vo || No, Ko = "[object Object]", Fo = Function.prototype, Ho = Object.prototype, Ct = Fo.toString, Io = Ho.hasOwnProperty, Jo = Ct.call(Object);
function Zo(e) {
  if (!re(e) || se(e) != Ko)
    return !1;
  var t = mt(e);
  if (t === null)
    return !0;
  var a = Io.call(t, "constructor") && t.constructor;
  return typeof a == "function" && a instanceof a && Ct.call(a) == Jo;
}
var Wo = "[object Arguments]", qo = "[object Array]", Yo = "[object Boolean]", Xo = "[object Date]", Qo = "[object Error]", er = "[object Function]", tr = "[object Map]", ar = "[object Number]", or = "[object Object]", rr = "[object RegExp]", nr = "[object Set]", lr = "[object String]", ur = "[object WeakMap]", ir = "[object ArrayBuffer]", cr = "[object DataView]", sr = "[object Float32Array]", dr = "[object Float64Array]", fr = "[object Int8Array]", vr = "[object Int16Array]", gr = "[object Int32Array]", pr = "[object Uint8Array]", hr = "[object Uint8ClampedArray]", yr = "[object Uint16Array]", mr = "[object Uint32Array]", E = {};
E[sr] = E[dr] = E[fr] = E[vr] = E[gr] = E[pr] = E[hr] = E[yr] = E[mr] = !0;
E[Wo] = E[qo] = E[ir] = E[Yo] = E[cr] = E[Xo] = E[Qo] = E[er] = E[tr] = E[ar] = E[or] = E[rr] = E[nr] = E[lr] = E[ur] = !1;
function br(e) {
  return re(e) && wt(e.length) && !!E[se(e)];
}
function _r(e) {
  return function(t) {
    return e(t);
  };
}
var At = typeof exports == "object" && exports && !exports.nodeType && exports, ie = At && typeof module == "object" && module && !module.nodeType && module, wr = ie && ie.exports === At, be = wr && gt.process, et = function() {
  try {
    var e = ie && ie.require && ie.require("util").types;
    return e || be && be.binding && be.binding("util");
  } catch {
  }
}(), tt = et && et.isTypedArray, St = tt ? _r(tt) : br;
function Me(e, t) {
  if (!(t === "constructor" && typeof e[t] == "function") && t != "__proto__")
    return e[t];
}
var Mr = Object.prototype, xr = Mr.hasOwnProperty;
function Cr(e, t, a) {
  var r = e[t];
  (!(xr.call(e, t) && ge(r, a)) || a === void 0 && !(t in e)) && Ne(e, t, a);
}
function Ar(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) : Cr(a, o, s);
  }
  return a;
}
function Sr(e, t) {
  for (var a = -1, r = Array(e); ++a < e; )
    r[a] = t(a);
  return r;
}
var Or = 9007199254740991, Tr = /^(?:0|[1-9]\d*)$/;
function Ot(e, t) {
  var a = typeof e;
  return t = t ?? Or, !!t && (a == "number" || a != "symbol" && Tr.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
function $r(e, t) {
  var a = ve(e), r = !a && we(e), u = !a && !r && xt(e), l = !a && !r && !u && St(e), n = a || r || u || l, o = n ? Sr(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.
    Ot(v, s)) || o.push(v);
  return o;
}
function jr(e) {
  var t = [];
  if (e != null)
    for (var a in Object(e))
      t.push(a);
  return t;
}
var Lr = Object.prototype, Er = Lr.hasOwnProperty;
function Pr(e) {
  if (!Y(e))
    return jr(e);
  var t = bt(e), a = [];
  for (var r in e)
    r == "constructor" && (t || !Er.call(e, r)) || a.push(r);
  return a;
}
function Tt(e) {
  return Ue(e) ? $r(e) : Pr(e);
}
function kr(e) {
  return Ar(e, Tt(e));
}
function Rr(e, t, a, r, u, l, n) {
  var o = Me(e, a), s = Me(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 M = ve(s), k = !M && xt(s), L = !M && !k && St(s);
    b = s, M || k || L ? ve(o) ? b = o : Do(o) ? b = jo(o) : k ? (C = !1, b = Oo(s)) : L ? (C = !1, b = $o(s)) : b = [] : Zo(s) || we(s) ? (b = o, we(o) ? b = kr(o) : (!Y(o) || Be(o)) && (b = ko(s))) : C = !1;
  }
  C && (n.set(s, b), u(b, s, r, l, n), n.delete(s)), _e(e, a, b);
}
function $t(e, t, a, r, u) {
  e !== t && Ao(t, function(l, n) {
    if (u || (u = new oe()), Y(l))
      Rr(e, t, n, a, $t, r, u);
    else {
      var o = r ? r(Me(e, n), l, n + "", e, t, u) : void 0;
      o === void 0 && (o = l), _e(e, n, o);
    }
  }, Tt);
}
function jt(e) {
  return e;
}
function Gr(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 at = Math.max;
function zr(e, t, a) {
  return t = at(t === void 0 ? e.length - 1 : t, 0), function() {
    for (var r = arguments, u = -1, l = at(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), Gr(e, this, o);
  };
}
function Br(e) {
  return function() {
    return e;
  };
}
var Dr = fe ? function(e, t) {
  return fe(e, "toString", {
    configurable: !0,
    enumerable: !1,
    value: Br(t),
    writable: !0
  });
} : jt, Nr = 800, Ur = 16, Vr = Date.now;
function Kr(e) {
  var t = 0, a = 0;
  return function() {
    var r = Vr(), u = Ur - (r - a);
    if (a = r, u > 0) {
      if (++t >= Nr)
        return arguments[0];
    } else
      t = 0;
    return e.apply(void 0, arguments);
  };
}
var Fr = Kr(Dr);
function Hr(e, t) {
  return Fr(zr(e, t, jt), e + "");
}
function Ir(e, t, a) {
  if (!Y(a))
    return !1;
  var r = typeof t;
  return (r == "number" ? Ue(a) && Ot(t, a.length) : r == "string" && t in a) ? ge(a[t], e) : !1;
}
function Jr(e) {
  return Hr(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 && Ir(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 Zr = Jr(function(e, t, a, r) {
  $t(e, t, a, r);
}), Wr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function qr(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Lt = { exports: {} };
(function(e) {
  (function(t, a) {
    e.exports ? e.exports = a() : t.coordtransform = a();
  })(Wr, 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
    };
  });
})(Lt);
var Yr = Lt.exports;
const Et = /* @__PURE__ */ qr(Yr), Xr = (e, t, { type: a, MapGL: r, map: u }) => {
  const l = (n, o) => {
    const s = document.createElement("div");
    s.style.cursor = "pointer";
    const v = ea(n, o);
    return ta(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: M = {} } = o, k = typeof v == "function" ? v() : v, L = typeof s == "function" ? s() : s, c = () => l(L, k);
      if (a.value === "baidu") {
        const i = Et.gcj02tobd09(b, C), h = new r.value.CustomOverlay(c, {
          point: { lng: i[0], lat: i[1] },
          ...M
        });
        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], ...M });
        u.value.add(h), r.value.event.addListener(h, "click", function(A) {
          t("click-custom-component", o, A);
        });
      }
    });
  };
}, Qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Xr
}, Symbol.toStringTag, { value: "Module" })), en = (e, t, { type: a, MapGL: r, map: u, innerPoint: l, innerInput: n, adCode: o, addressInfo: s }) => {
  e.getMapInfo = () => {
    if (a.value === "baidu") {
      const v = Et.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
      };
  };
}, tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: en
}, Symbol.toStringTag, { value: "Module" }));
function an(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 on = "[object Symbol]";
function rn(e) {
  return typeof e == "symbol" || re(e) && se(e) == on;
}
var ot = ee ? ee.prototype : void 0, rt = ot ? ot.toString : void 0;
function Pt(e) {
  if (typeof e == "string")
    return e;
  if (ve(e))
    return an(e, Pt) + "";
  if (rn(e))
    return rt ? rt.call(e) : "";
  var t = e + "";
  return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
}
function ye(e) {
  return e == null ? "" : Pt(e);
}
function nn(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 ln(e, t, a) {
  var r = e.length;
  return a = a === void 0 ? r : a, !t && a >= r ? e : nn(e, t, a);
}
var un = "\\ud800-\\udfff", cn = "\\u0300-\\u036f", sn = "\\ufe20-\\ufe2f", dn = "\\u20d0-\\u20ff", fn = cn + sn + dn, vn = "\\ufe0e\\ufe0f", gn = "\\u200d", pn = RegExp("[" + gn + un + fn + vn + "]");
function kt(e) {
  return pn.test(e);
}
function hn(e) {
  return e.split("");
}
var Rt = "\\ud800-\\udfff", yn = "\\u0300-\\u036f", mn = "\\ufe20-\\ufe2f", bn = "\\u20d0-\\u20ff", _n = yn + mn + bn, wn = "\\ufe0e\\ufe0f", Mn = "[" + Rt + "]", xe = "[" + _n + "]", Ce = "\\ud83c[\\udffb-\\udfff]", xn = "(?:" + xe + "|" + Ce + ")", Gt = "[^" + Rt + "]", zt = "(?:\\ud83c[\\udde6-\\uddff]){2}", Bt = "[\\ud800-\\udbff][\\udc00-\\udfff]", Cn = "\\u200d", Dt = xn + "?", Nt = "[" + wn + "]?", An = "(?:" + Cn + "(?:" + [Gt, zt, Bt].join("|") + ")" + Nt + Dt + ")*", Sn = Nt + Dt + An, On = "(?:" + [Gt + xe + "?", xe, zt, Bt, Mn].join("|") + ")", Tn = RegExp(Ce + "(?=" + Ce + ")|" + On + Sn, "g");
function $n(e) {
  return e.match(Tn) || [];
}
function jn(e) {
  return kt(e) ? $n(e) : hn(e);
}
function Ln(e) {
  return function(t) {
    t = ye(t);
    var a = kt(t) ? jn(t) : void 0, r = a ? a[0] : t.charAt(0), u = a ? ln(a, 1).join("") : t.slice(1);
    return r[e]() + u;
  };
}
var En = Ln("toUpperCase");
function Pn(e) {
  return En(ye(e).toLowerCase());
}
function kn(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 Rn(e) {
  return function(t) {
    return e == null ? void 0 : e[t];
  };
}
var Gn = {
  // 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"
}, zn = Rn(Gn), Bn = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Dn = "\\u0300-\\u036f", Nn = "\\ufe20-\\ufe2f", Un = "\\u20d0-\\u20ff", Vn = Dn + Nn + Un, Kn = "[" + Vn + "]", Fn = RegExp(Kn, "g");
function Hn(e) {
  return e = ye(e), e && e.replace(Bn, zn).replace(Fn, "");
}
var In = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function Jn(e) {
  return e.match(In) || [];
}
var Zn = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function Wn(e) {
  return Zn.test(e);
}
var Ut = "\\ud800-\\udfff", qn = "\\u0300-\\u036f", Yn = "\\ufe20-\\ufe2f", Xn = "\\u20d0-\\u20ff", Qn = qn + Yn + Xn, Vt = "\\u2700-\\u27bf", Kt = "a-z\\xdf-\\xf6\\xf8-\\xff", el = "\\xac\\xb1\\xd7\\xf7", tl = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", al = "\\u2000-\\u206f", ol = " \\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", Ft = "A-Z\\xc0-\\xd6\\xd8-\\xde", rl = "\\ufe0e\\ufe0f", Ht = el + tl + al + ol, It = "['’]", nt = "[" + Ht + "]", nl = "[" + Qn + "]", Jt = "\\d+", ll = "[" + Vt + "]", Zt = "[" + Kt + "]", Wt = "[^" + Ut + Ht + Jt + Vt + Kt + Ft + "]", ul = "\\ud83c[\\udffb-\\udfff]", il = "(?:" + nl + "|" + ul + ")", cl = "[^" + Ut + "]", qt = "(?:\\ud83c[\\udde6-\\uddff]){2}", Yt = "[\\ud800-\\udbff][\\udc00-\\udfff]", X = "[" + Ft + "]", sl = "\\u200d", lt = "(?:" + Zt + "|" + Wt + ")", dl = "(?:" + X + "|" + Wt + ")", ut = "(?:" + It + "(?:d|ll|m|re|s|t|ve))?", it = "(?:" + It + "(?:D|LL|M|RE|S|T|VE))?", Xt = il + "?", Qt = "[" + rl + "]?", fl = "(?:" + sl + "(?:" + [cl, qt, Yt].join("|") + ")" + Qt + Xt + ")*", vl = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", gl = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", pl = Qt + Xt + fl, hl = "(?:" + [ll, qt, Yt].join("|") + ")" + pl, yl = RegExp([
  X + "?" + Zt + "+" + ut + "(?=" + [nt, X, "$"].join("|") + ")",
  dl + "+" + it + "(?=" + [nt, X + lt, "$"].join("|") + ")",
  X + "?" + lt + "+" + ut,
  X + "+" + it,
  gl,
  vl,
  Jt,
  hl
].join("|"), "g");
function ml(e) {
  return e.match(yl) || [];
}
function bl(e, t, a) {
  return e = ye(e), t = t, t === void 0 ? Wn(e) ? ml(e) : Jn(e) : e.match(t) || [];
}
var _l = "['’]", wl = RegExp(_l, "g");
function Ml(e) {
  return function(t) {
    return kn(bl(Hn(t).replace(wl, "")), e, "");
  };
}
var xl = Ml(function(e, t, a) {
  return t = t.toLowerCase(), e + (a ? Pn(t) : t);
});
const ct = /* @__PURE__ */ Object.assign({ "./add-custom-dom/index.ts": Qr, "./get-map-info/index.ts": tn }), Cl = Object.keys(ct).reduce((e, t) => {
  const a = xl(t.replace("./", "").split("/")[0]);
  return e[a] = ct[t].default, e;
}, {}), Al = (e, t, a) => {
  const r = S({});
  return { mapElement: r, addPlugins: () => {
    const n = Zr({}, (e == null ? void 0 : e.options) || {}, (o, s) => {
      if (Array.isArray(o)) return o.concat(s);
    });
    Object.values(Cl).forEach((o) => o(r.value, t, a, n.plugins || {}));
  } };
}, Sl = ({ MapGL: e, map: t, marker: a, mapLoading: r, $autocomplete: u, searchResultList: l, innerInput: n, innerPoint: o, adCode: s, addressInfo: v }, b) => {
  const C = S(), M = S(), k = S();
  let L = null;
  const c = S(!1), i = S();
  let h;
  const A = async (d, f, y, x) => {
    if (i.value = y, x && (h = x), 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, z;
    const { Map: d } = await google.maps.importLibrary("maps");
    e.value = d;
    const { Place: f, AutocompleteSessionToken: y, AutocompleteSuggestion: x } = await google.maps.importLibrary("places");
    M.value = new y(), k.value = x, 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 $(), (z = i.value) != null && z.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, x;
      a.value && a.value.setMap(null), o.value = [(y = f == null ? void 0 : f.latLng) == null ? void 0 : y.lng(), (x = f == null ? void 0 : f.latLng) == null ? void 0 : x.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 x = y.find(
          (m) => m.value === n.value || m.info.name === n.value
        );
        x ? v.value = x.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, x) => {
    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])) : (D.error(P("thirdPartyMapErrorRetry")), x());
    });
  })), 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] })) : (D.error(P("thirdPartyMapErrorRetry")), y());
    });
  }), T = async () => {
    var d;
    r.value = !0, navigator.geolocation && ((d = navigator.geolocation) == null || d.getCurrentPosition((f) => {
      var x;
      const y = {
        lat: f.coords.latitude,
        lng: f.coords.longitude
      };
      (x = t.value) == null || x.panTo(y), c.value = !1, r.value = !1;
    }, (f) => {
      D.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: M.value
    };
    const { suggestions: x } = await k.value.fetchAutocompleteSuggestions(y);
    if (l.value = [], !x) return f([]);
    let m = [];
    await Promise.all(
      x.map((O) => (async () => {
        var J, le;
        let z = (O == null ? void 0 : O.placePrediction).toPlace();
        await z.fetchFields({
          fields: [
            "displayName",
            "formattedAddress",
            "location"
          ]
        });
        const ne = (J = z == null ? void 0 : z.location) == null ? void 0 : J.lng(), V = (le = z == null ? void 0 : z.location) == null ? void 0 : le.lat(), K = {
          // value: placePrediction?.text?.toString() || '',
          value: z == null ? void 0 : z.formattedAddress,
          point: { lng: ne, lat: V },
          info: {
            name: z == null ? void 0 : z.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 D.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
  };
}, Ol = (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%"
  })), M = S(""), k = S([]), L = S(""), c = S(), {
    loadJavascript: i,
    getLocationByInputSearch: h,
    handleSelectAddress: A,
    getLocationParse: R
  } = vt({
    BMap: l,
    map: n,
    marker: o,
    mapLoading: s,
    $autocomplete: v,
    searchResultList: b,
    innerInput: M,
    innerPoint: k,
    adCode: L,
    addressInfo: c
  }), {
    loadJavascript: _,
    getLocationByInputSearch: $,
    handleSelectAddress: G,
    getLocationParse: U
  } = dt({
    MapGL: l,
    map: n,
    marker: o,
    mapLoading: s,
    $autocomplete: v,
    searchResultList: b,
    innerInput: M,
    innerPoint: k,
    adCode: L,
    addressInfo: c
  }), {
    loadJavascript: T,
    getLocationByInputSearch: g,
    handleSelectAddress: p,
    getLocationParse: w,
    positionCityLocal: j,
    showGetLocationBtn: d
  } = Sl({
    MapGL: l,
    map: n,
    marker: o,
    mapLoading: s,
    $autocomplete: v,
    searchResultList: b,
    innerInput: M,
    innerPoint: k,
    adCode: L,
    addressInfo: c
  }), { mapElement: f, addPlugins: y } = Al(e, t, {
    type: a,
    MapGL: l,
    map: n,
    innerPoint: k,
    innerInput: M,
    adCode: L,
    addressInfo: c
  }), x = () => {
    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, Ke;
    if (e.defaultLongitude && e.defaultLatitude && (k.value = [e.defaultLongitude, e.defaultLatitude]), M.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) === "google" || (Ke = e == null ? void 0 : e.sdkConfig) == null ? void 0 : Ke.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);
    }
    x();
  });
  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: M,
    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
  };
}, Tl = { class: "search-input" }, $l = { class: "location-icon1" }, jl = { id: "map" }, Ll = /* @__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: M
    } = Ol(a, r);
    return (k, L) => {
      const c = Pe, i = ke;
      return Te(), $e(
        "div",
        {
          class: "das-map",
          style: je(B(u))
        },
        [
          Z(W(
            "div",
            Tl,
            [
              Z(de(c, {
                ref_key: "$autocomplete",
                ref: b,
                modelValue: B(l),
                "onUpdate:modelValue": L[0] || (L[0] = (h) => aa(l) ? l.value = h : null),
                "fetch-suggestions": B(n),
                placeholder: B(P)("请输入位置"),
                style: { width: "100%" },
                "trigger-on-focus": !1,
                onSelect: B(o),
                onKeyup: Le(B(s), ["enter", "native"]),
                clearable: ""
              }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
                [B(Re)]
              ])
            ],
            512
            /* NEED_PATCH */
          ), [
            [Fe, a.showSearch]
          ]),
          Z(W(
            "div",
            $l,
            [
              de(B(ua), {
                block: "",
                size: "large",
                onClick: B(C)
              }, {
                default: oa(() => [
                  ra(
                    na(B(P)("Please-Click-Get-Location")),
                    1
                    /* TEXT */
                  )
                ]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ],
            512
            /* NEED_PATCH */
          ), [
            [Fe, B(M)]
          ]),
          Z(W(
            "div",
            jl,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              i,
              B(v),
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), El = /* @__PURE__ */ ze(Ll, [["__scopeId", "data-v-398b4cef"]]), Pl = {
  请输入位置: { "zh-CN": "请输入位置", en: "Please enter location", "zh-MO": "請輸入位置", _appCode: "framework" },
  获取地图配置信息失败: {
    "zh-CN": "获取地图配置信息失败",
    en: "The map configuration information failed to be obtained",
    "zh-MO": "獲取地圖配寘資訊失敗",
    _appCode: "framework"
  },
  暂未配置地图: { "zh-CN": "暂未配置地图", en: "Map Not Configured", "zh-MO": "暫未配寘地圖", _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",
    "zh-MO": "協力廠商地圖配寘參數錯誤或地址資訊無效，請檢查後再重試",
    _appCode: "framework"
  },
  "Please-Click-Get-Location": {
    "zh-CN": "请点击获取位置",
    en: "Please click get location",
    "zh-MO": "請點擊獲取位置",
    _appCode: "framework"
  },
  获取定位失败: {
    "zh-CN": "获取定位失败",
    en: "The location failed to be obtained",
    "zh-MO": "獲取定位失敗",
    _appCode: "framework"
  }
};
la(Pl);
const Hl = Ee(ha), Il = () => S(null), Jl = Ee(_a), Zl = () => S(null), Wl = Ee(El), ql = () => S(null), Yl = { title: "Map 地图" };
export {
  Jl as DasBaiduMap,
  Zl as DasBaiduMapRef,
  Hl as DasGaodeMap,
  Il as DasGaodeMapRef,
  Wl as DasMap,
  ql as DasMapRef,
  Yl as default
};
