import { reactive as he, computed as B, watch as N, toRefs as ke, ref as A, onMounted as Ue, nextTick as Re, resolveComponent as S, openBlock as M, createElementBlock as z, normalizeClass as k, unref as t, createElementVNode as D, createVNode as a, withCtx as c, createTextVNode as P, createBlock as E, toDisplayString as te, createCommentVNode as j, defineComponent as _e, isRef as K, Fragment as se, renderList as be, withDirectives as De, vShow as Ce, renderSlot as Ie } from "vue";
import { b as ne } from "./layer-select-Ba4IEiWY.js";
import { b as Ve, v as ie, _ as ce, u as ae } from "./utils-B4smQbM-.js";
import "./vendor-D4icwOYu.js";
import "ant-design-vue";
import { zondy as Me, LayerType as X, TokenAttachType as ve, RootServer as Ge } from "@mapgis/webclient-common";
const { LayerType: R } = Me.enum, xe = [
  {
    type: R.IGSMapImage,
    label: "MapGIS 地图服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/MapServer",
    protocol: "IGSRestMap",
    originalServiceType: "MapServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.IGSTile,
    label: "MapGIS 瓦片服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/TileServer",
    protocol: "IGSRestTile",
    originalServiceType: "TileServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.IGSVectorTile,
    label: "MapGIS 矢量瓦片服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/VectorTileServer",
    protocol: "IGSRestVectorTile",
    originalServiceType: "VectorTileServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.IGSFeature,
    label: "MapGIS 要素服务(需要指定图层ID)",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/FeatureServer/{layerId}",
    protocol: "IGSRestFeature",
    originalServiceType: "FeatureServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.IGSImage,
    label: "MapGIS 影像服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/ImageServer",
    protocol: "IGSRestImage",
    originalServiceType: "ImageServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.WMS,
    label: "OGC WMS",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/WMSServer或者WMS标准格式",
    protocol: "WMS",
    originalServiceType: "WMSServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.WMTS,
    label: "OGC WMTS",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/WMTSServer或者WMTS标准格式",
    protocol: "WMTS",
    originalServiceType: "WMTSServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.WFS,
    label: "OGC WFS",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/WFSServer或者WFS标准格式",
    protocol: "WFS",
    originalServiceType: "WFSServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.ArcGISMapImage,
    label: "ArcGIS 地图服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/arcgis/MapServer或者ArcGIS MapServer标准格式",
    protocol: "ArcGISRestMapServer",
    originalServiceType: "arcgis/MapServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.ArcGISVectorTile,
    label: "ArcGIS 矢量瓦片服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/arcgis/VectorTileServer或者ArcGIS VectorTileServer标准格式",
    protocol: "ArcGISRestVectorTileServer",
    originalServiceType: "arcgis/VectorTileServer",
    "2D": !0,
    "3D": !0
  },
  {
    type: R.IGSScene,
    label: "MapGIS 场景服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/SceneServer",
    protocol: "IGSRestScene",
    originalServiceType: "SceneServer",
    "2D": !1,
    "3D": !0
  },
  {
    type: R.M3DModelCache,
    label: "M3D 模型缓存服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/M3dServer或M3D根描述文件URL(.mcj)",
    protocol: "IGSRestM3D",
    originalServiceType: "M3dServer",
    "2D": !1,
    "3D": !0
  },
  {
    type: R.cesium3DTilesModelCache,
    label: "3D Tiles 服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/3DTilesServer或者3D Tiles服务标准格式",
    protocol: "IGSRest3DTiles",
    originalServiceType: "3DTilesServer",
    "2D": !1,
    "3D": !0
  },
  {
    type: R.terrain,
    label: "地形缓存服务",
    template: "http(s)://<server>:<port>/igs/rest/services/<serviceName>/TerrainServer或者地形缓存服务标准格式",
    protocol: "IGSRestTerrain",
    originalServiceType: "TerrainServer",
    "2D": !1,
    "3D": !0
  }
], ue = [
  {
    type: R.GeoJSON,
    label: "GeoJSON 服务",
    template: "http(s)://<server>:<port>/<path>/*.geojson或其他返回GeoJSON的URL",
    "2D": !0,
    "3D": !0
  }
], we = {
  /**
   * @description 默认的支持协议的服务类型列表
   */
  defaultSupportedServiceProtocolTypes: {
    type: Array,
    default: () => xe
  },
  /**
   * @description 默认的三方服务类型列表
   */
  defaultThirdPartyServiceTypes: {
    type: Array,
    default: () => ue
  },
  /**
   * @description 服务根地址，形如：http(s)://<server>:<port>/igs/rest/services
   */
  serviceRootUrl: {
    type: String
  },
  /**
   * @description 服务根令牌
   */
  serviceRootToken: {
    type: String
  },
  /**
   * @description 服务类型，来自于@mapgis/webclient-common中LayerType的常量值
   */
  serviceType: {
    type: String
  },
  /**
   * @description 服务地址
   */
  serviceUrl: {
    type: String
  },
  /**
   * @description 令牌字段名
   */
  tokenKey: {
    type: String
  },
  /**
   * @description 令牌值
   */
  tokenValue: {
    type: String
  },
  /**
   * @description 令牌位置，可取值url（查询参数）、header（请求头）
   */
  tokenAttachType: {
    type: String,
    default: "url"
  },
  /**
   * @description 服务类型显示模式，可取值2D、3D、all
   */
  showMode: {
    type: String,
    default: "all",
    validator: (l) => ["2D", "3D", "all"].includes(l)
  },
  /**
   * @description 是否支持第三方服务，第三方服务无法从服务器选择，只能输入
   */
  supportThirdPartyServices: {
    type: Boolean,
    default: !1
  },
  /**
   * @description 服务选择下拉框宽度，单位像素
   */
  dropdownWidth: {
    type: Number
  }
}, Ae = {
  serviceChange: (l) => Ve(l)
}, Ke = (l, H) => {
  var x;
  const e = he({
    // 根目录服务地址
    serviceRootUrl: l.serviceRootUrl,
    // serviceRootTokenKey
    serviceRootTokenKey: "token",
    // serviceRootTokenValue
    serviceRootTokenValue: l.serviceRootToken,
    // 服务类型
    serviceType: l.serviceType,
    // 服务地址
    serviceUrl: l.serviceUrl,
    // 令牌字段名
    serviceTokenKey: l.tokenKey,
    // 令牌值
    serviceTokenValue: l.tokenValue,
    // 令牌位置
    tokenAttachType: l.tokenAttachType,
    // 选择器下拉框宽度
    dropdownWidth: l.dropdownWidth,
    // 目录服务器配置框是否显示
    serverConfigVisible: !1,
    // 目录服务器配置表单数据
    serverConfigFormData: {
      rootUrl: "",
      useToken: !1,
      token: ""
    },
    // 是否需要服务令牌
    needServiceToken: !!((x = l.tokenValue) != null && x.trim()),
    // 服务列表选择框是否显示
    serviceListVisible: !1,
    // 服务地址校验结果
    serviceUrlStatus: "",
    // 服务地址校验结果提示
    serviceUrlHelp: "",
    // 服务根地址校验结果
    serviceRootUrlStatus: "",
    // 服务根地址校验结果提示
    serviceRootUrlHelp: ""
  }), O = B(() => {
    const r = l.defaultSupportedServiceProtocolTypes.filter((v) => {
      if (l.showMode === "all")
        return !0;
      if (l.showMode === "2D")
        return v["2D"];
      if (l.showMode === "3D")
        return v["3D"];
    });
    return l.supportThirdPartyServices && r.push(
      ...l.defaultThirdPartyServiceTypes.filter((v) => {
        if (l.showMode === "all")
          return !0;
        if (l.showMode === "2D")
          return v["2D"];
        if (l.showMode === "3D")
          return v["3D"];
      })
    ), r;
  }), f = B(() => O.value.find((r) => {
    if (r.type === e.serviceType)
      return !0;
  })), G = B(() => ue.some((r) => r.type === e.serviceType)), W = B(() => !!(e.serviceRootUrl && e.serviceRootUrl.trim()));
  N(
    () => [l.serviceRootUrl, l.serviceRootToken],
    () => {
      e.serviceRootUrl = l.serviceRootUrl, e.serviceRootTokenValue = l.serviceRootToken;
    }
  ), N(
    () => [l.serviceType, l.serviceUrl, l.tokenKey, l.tokenValue, l.tokenAttachType],
    () => {
      var r;
      e.serviceType = l.serviceType, e.serviceUrl = l.serviceUrl, e.serviceTokenKey = l.tokenKey, e.serviceTokenValue = l.tokenValue, e.tokenAttachType = l.tokenAttachType, e.needServiceToken = !!((r = l.tokenValue) != null && r.trim());
    }
  ), N(
    () => [
      e.serviceRootUrl,
      e.serviceRootTokenValue,
      e.serviceType,
      e.serviceUrl,
      e.serviceTokenKey,
      e.serviceTokenValue,
      e.tokenAttachType
    ],
    () => {
      H("serviceChange", {
        serviceRootUrl: e.serviceRootUrl,
        serviceRootToken: e.serviceRootTokenValue,
        serviceType: e.serviceType,
        serviceUrl: e.serviceUrl,
        tokenKey: e.serviceTokenKey,
        tokenValue: e.serviceTokenValue,
        tokenAttachType: e.tokenAttachType,
        suggestServiceName: I(e.serviceUrl, e.serviceType),
        isServiceUrlValid: e.serviceUrlStatus === "success"
      });
    }
  ), N(
    () => e.serverConfigVisible,
    (r) => {
      r && (e.serverConfigFormData = {
        rootUrl: e.serviceRootUrl,
        useToken: !!(e.serviceRootTokenValue && e.serviceRootTokenValue.trim()),
        token: e.serviceRootTokenValue
      });
    }
  );
  function h() {
    e.serviceUrl = null;
  }
  function b() {
    e.serverConfigFormData.useToken || (e.serverConfigFormData.token = "");
  }
  function y() {
    var v;
    const r = (v = e.serverConfigFormData.rootUrl) == null ? void 0 : v.trim();
    if (!r) {
      e.serviceRootUrlStatus = "error", e.serviceRootUrlHelp = "服务根地址不能为空";
      return;
    }
    if (!ie(r)) {
      e.serviceRootUrlStatus = "error", e.serviceRootUrlHelp = "无效的服务根地址";
      return;
    }
    try {
      if (!new URL(r).pathname.startsWith("/igs/rest/services")) {
        e.serviceRootUrlStatus = "error", e.serviceRootUrlHelp = "服务根地址的路径部分必须以 /igs/rest/services 开头，例如：http(s)://<server>:<port>/igs/rest/services";
        return;
      }
      e.serviceRootUrlStatus = "success", e.serviceRootUrlHelp = "";
    } catch {
      e.serviceRootUrlStatus = "error", e.serviceRootUrlHelp = "无效的服务根地址格式";
      return;
    }
    e.serviceRootUrl = e.serverConfigFormData.rootUrl, e.serviceRootTokenValue = e.serverConfigFormData.token || "", e.serverConfigVisible = !1;
  }
  function U() {
    e.needServiceToken || (e.serviceTokenKey = "", e.serviceTokenValue = "");
  }
  function C({ url: r, token: v }) {
    var T;
    e.serviceUrl = r, v && v.trim() !== "" ? (e.serviceTokenKey = e.serviceRootTokenKey, e.serviceTokenValue = v) : (e.serviceTokenKey = "", e.serviceTokenValue = ""), e.tokenAttachType = ve.url, e.needServiceToken = !!((T = e.serviceTokenValue) != null && T.trim()), e.serviceListVisible = !1, g();
  }
  function I(r, v) {
    let T = "";
    return r && r.lastIndexOf("/") !== -1 && (v === X.GeoJSON || r.includes("/igs/rest/mrms/docs/") || r.includes("/igs/rest/mrms/tile/") || r.includes("/igs/rest/g3d/") ? T = r.substring(r.lastIndexOf("/") + 1) : (r = r.substring(0, r.lastIndexOf("/")), v === X.IGSFeature || v === X.ArcGISMapImage || v === X.ArcGISVectorTile ? r.lastIndexOf("/") !== -1 && (r = r.substring(0, r.lastIndexOf("/")), T = r.slice(r.lastIndexOf("/") + 1)) : r.lastIndexOf("/") !== -1 && (T = r.slice(r.lastIndexOf("/") + 1)))), T;
  }
  function g() {
    var v;
    const r = (v = e.serviceUrl) == null ? void 0 : v.trim();
    r ? ie(r) ? (e.serviceUrlStatus = "success", e.serviceUrlHelp = "") : (e.serviceUrlStatus = "error", e.serviceUrlHelp = "无效的服务地址") : (e.serviceUrlStatus = "error", e.serviceUrlHelp = "服务地址不能为空");
  }
  return {
    ...ke(e),
    // 计算属性
    showServiceTypes: O,
    currentServiceTypeItem: f,
    isThirdPartyServiceType: G,
    hasServiceRootUrl: W,
    // 方法
    handleServiceTypeChange: h,
    handleServerConfigUseTokenChange: b,
    handleServerConfigSubmit: y,
    handleNeedServiceTokenChange: U,
    handleServiceSelect: C,
    handleValidateServiceUrl: g
  };
}, Ne = ["title"], We = ["title"], Fe = {
  __name: "service-select-list",
  props: {
    serviceRootUrl: {
      type: String,
      required: !0
    },
    serviceRootToken: {
      type: String,
      default: ""
    },
    serviceProtocol: {
      type: String
    },
    originalServiceType: {
      type: String
    },
    currentServiceUrl: {
      type: String,
      default: ""
    },
    visible: {
      type: Boolean
    }
  },
  emits: ["select"],
  setup(l, { emit: H }) {
    const e = l, O = H, f = ne("service-select-list"), G = A(""), W = A(!1), h = A([]), b = A([]), y = A([]), U = A(!0), C = A(), I = A(!1), g = B(() => G.value.trim() ? x(h.value, G.value.toLowerCase()) : h.value);
    N(
      () => [e.serviceRootUrl, e.serviceRootToken, e.serviceProtocol],
      () => {
        $(), I.value = !0;
      }
    ), N(
      () => e.currentServiceUrl,
      (i, s) => {
        h.value.length > 0 && (i && i.trim() ? setTimeout(() => {
          J(i);
        }, 100) : (b.value = [], I.value = !0));
      }
    ), N(G, (i) => {
      if (i && i.trim())
        setTimeout(() => {
          const s = g.value, n = T(s);
          y.value = n, U.value = !0;
        }, 50);
      else if (h.value.length > 0) {
        const s = T(h.value);
        y.value = s, U.value = !0;
      }
    }), N(
      () => e.visible,
      (i, s) => {
        i && !s && I.value && (ee(), I.value = !1);
      }
    ), Ue(() => {
      $();
    });
    const x = (i, s) => i.map((n) => {
      const d = n.title.toLowerCase().includes(s) || n.url && n.url.toLowerCase().includes(s);
      let p = [];
      return n.children && n.children.length > 0 && (p = x(n.children, s)), d || p.length > 0 ? {
        ...n,
        children: p.length > 0 ? p : n.children
      } : null;
    }).filter(Boolean), r = (i, s, n = []) => {
      for (const d of i) {
        if (d.url === s && d.isLeaf)
          return {
            key: d.key,
            parentKeys: n
          };
        if (d.children && d.children.length > 0) {
          const p = r(d.children, s, [...n, d.key]);
          if (p)
            return p;
        }
      }
      return null;
    }, v = (i, s) => {
      const n = [], { services: d, folders: p } = i;
      if (d)
        for (let o = 0; o < d.length; o++) {
          const _ = d[o], V = {
            key: ae(),
            title: _.name,
            protocols: _.protocols,
            url: `${e.serviceRootUrl}/${s ? `${s}/` : ""}${_.name}/${e.originalServiceType}`,
            parentNames: s,
            isLeaf: !0
          };
          n.push(V);
        }
      if (p)
        for (let o = 0; o < p.length; o++) {
          const _ = p[o], { services: V, folders: m } = _;
          if (V && V.length > 0 || m && m.length > 0) {
            const L = {
              value: _.name,
              title: _.name,
              key: ae(),
              parentNames: s,
              children: v(_, `${s ? `${s}/` : ""}${_.name}`)
            };
            n.push(L);
          }
        }
      return n;
    }, T = (i) => {
      const s = [], n = (d) => {
        d.forEach((p) => {
          !p.isLeaf && p.children && p.children.length > 0 && (s.push(p.key), n(p.children));
        });
      };
      return n(i), s;
    }, $ = async () => {
      if (!(!e.serviceRootUrl || !e.serviceProtocol)) {
        W.value = !0;
        try {
          const s = await new Ge({
            url: `${e.serviceRootUrl}?includeServicesInFolder=true`,
            tokenKey: "token",
            tokenValue: e.serviceRootToken,
            tokenAttachType: ve.header
          }).queryRootServiceList({
            includeServicesInFolder: !0,
            protocols: e.serviceProtocol
          }), n = v(s.data);
          h.value = n;
          const d = T(n);
          y.value = d, U.value = !0, e.currentServiceUrl && J(e.currentServiceUrl);
        } catch {
          h.value = [];
        } finally {
          W.value = !1;
        }
      }
    }, J = (i) => {
      const s = r(h.value, i);
      s ? (b.value = [s.key], y.value = [.../* @__PURE__ */ new Set([...y.value, ...s.parentKeys])], U.value = !0) : (b.value = [], I.value = !0);
    }, F = () => {
      if (G.value.trim()) {
        const i = g.value, s = T(i);
        y.value = s, U.value = !0;
      } else {
        const i = T(h.value);
        y.value = i, U.value = !0;
      }
    }, Y = () => {
      if (h.value.length > 0) {
        const i = T(h.value);
        y.value = i, U.value = !0;
      }
    }, q = (i, s) => {
      const { node: n } = s;
      n.isLeaf && n.url ? (b.value = i, O("select", {
        url: n.url,
        token: e.serviceRootToken
      })) : (message.warning("请选择具体的服务（叶子节点）"), b.value = []);
    }, Z = (i) => {
      y.value = i, U.value = !1;
    }, ee = () => {
      e.visible && Re(() => {
        C.value && (C.value.scrollTop = 0), setTimeout(() => {
          C.value && (C.value.scrollTop = 0);
        }, 50);
      });
    };
    return (i, s) => {
      const n = S("a-button"), d = S("a-input"), p = S("a-tree"), o = S("a-empty"), _ = S("a-spin");
      return M(), z("div", {
        class: k([t(f).b()])
      }, [
        D("div", {
          class: k(t(f).e("search-bar"))
        }, [
          a(d, {
            value: G.value,
            "onUpdate:value": s[0] || (s[0] = (V) => G.value = V),
            placeholder: "请输入服务名",
            "allow-clear": "",
            onPressEnter: F,
            onClear: Y
          }, {
            addonAfter: c(() => [
              a(n, {
                type: "primary",
                size: "small",
                onClick: F
              }, {
                default: c(() => [...s[1] || (s[1] = [
                  P(" 搜索 ", -1)
                ])]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ], 2),
        D("div", {
          ref_key: "scrollContainer",
          ref: C,
          class: k(t(f).e("content"))
        }, [
          a(_, { spinning: W.value }, {
            default: c(() => [
              h.value.length > 0 ? (M(), E(p, {
                key: 0,
                "tree-data": g.value,
                "selected-keys": b.value,
                "expanded-keys": y.value,
                "auto-expand-parent": U.value,
                onSelect: q,
                onExpand: Z,
                "block-node": !0
              }, {
                title: c(({ title: V, url: m, isLeaf: L }) => [
                  D("div", {
                    class: k(t(f).e("node"))
                  }, [
                    D("span", {
                      class: k(t(f).em("node", "name")),
                      title: V
                    }, te(V), 11, Ne),
                    m && L ? (M(), z("span", {
                      key: 0,
                      class: k(t(f).em("node", "url")),
                      title: m
                    }, te(m), 11, We)) : j("", !0)
                  ], 2)
                ]),
                _: 1
              }, 8, ["tree-data", "selected-keys", "expanded-keys", "auto-expand-parent"])) : (M(), E(o, {
                key: 1,
                description: "暂无服务"
              }))
            ]),
            _: 1
          }, 8, ["spinning"])
        ], 2)
      ], 2);
    };
  }
}, Le = /* @__PURE__ */ ce(Fe, [["__scopeId", "data-v-24db73ff"]]), Pe = /* @__PURE__ */ _e({
  name: "MapgisServiceSelect",
  __name: "service-select",
  props: we,
  emits: Ae,
  setup(l, { emit: H }) {
    const e = l, O = H, f = ne("service-select"), {
      serviceRootUrl: G,
      serviceRootTokenValue: W,
      serviceRootUrlHelp: h,
      serviceType: b,
      serviceUrl: y,
      serviceTokenKey: U,
      serviceTokenValue: C,
      tokenAttachType: I,
      serverConfigFormData: g,
      serverConfigVisible: x,
      needServiceToken: r,
      serviceListVisible: v,
      serviceUrlStatus: T,
      serviceUrlHelp: $,
      // 计算属性
      showServiceTypes: J,
      currentServiceTypeItem: F,
      isThirdPartyServiceType: Y,
      hasServiceRootUrl: q,
      // 方法
      handleServiceTypeChange: Z,
      handleServerConfigUseTokenChange: ee,
      handleServerConfigSubmit: i,
      handleNeedServiceTokenChange: s,
      handleServiceSelect: n,
      handleValidateServiceUrl: d
    } = Ke(e, O);
    return (p, o) => {
      const _ = S("a-select-option"), V = S("a-select"), m = S("a-form-item"), L = S("mapgis-ui-iconfont"), pe = S("a-tooltip"), Q = S("a-textarea"), re = S("a-checkbox"), de = S("a-button"), Se = S("a-form"), oe = S("a-popover"), fe = S("a-divider"), ye = S("a-input"), le = S("a-radio-button"), Te = S("a-radio-group"), me = S("mapgis-ui-setting-form");
      return M(), z("div", {
        class: k([t(f).b()])
      }, [
        a(me, {
          layout: "horizontal",
          itemLayout: "grid",
          size: "default",
          class: k(t(f).e("form"))
        }, {
          default: c(() => [
            a(m, { label: "服务类型" }, {
              default: c(() => [
                a(V, {
                  value: t(b),
                  "onUpdate:value": o[0] || (o[0] = (u) => K(b) ? b.value = u : null),
                  onChange: t(Z)
                }, {
                  default: c(() => [
                    (M(!0), z(se, null, be(t(J), ({ label: u, type: w }) => (M(), E(_, {
                      key: w,
                      value: w,
                      title: u
                    }, {
                      default: c(() => [
                        P(te(u), 1)
                      ]),
                      _: 2
                    }, 1032, ["value", "title"]))), 128))
                  ]),
                  _: 1
                }, 8, ["value", "onChange"])
              ]),
              _: 1
            }),
            a(m, {
              class: k([t(f).e("server")]),
              labelCol: { span: 24 },
              wrapperCol: { span: 0 }
            }, {
              label: c(() => [
                D("div", {
                  class: k(t(f).e("server-label"))
                }, [
                  D("div", null, [
                    o[12] || (o[12] = D("span", { style: { "padding-right": "4px" } }, "服务地址", -1)),
                    a(pe, { placement: "topLeft" }, {
                      title: c(() => [...o[11] || (o[11] = [
                        D("span", null, "可以通过配置目录服务器来选择对应类型的服务", -1)
                      ])]),
                      default: c(() => [
                        a(L, { type: "mapgis-info" })
                      ]),
                      _: 1
                    })
                  ]),
                  De(D("div", {
                    class: k(t(f).e("server-addon"))
                  }, [
                    a(oe, {
                      open: t(x),
                      "onUpdate:open": o[4] || (o[4] = (u) => K(x) ? x.value = u : null),
                      title: "目录服务器配置",
                      placement: "bottomRight",
                      trigger: "click",
                      "overlay-style": { width: "320px" }
                    }, {
                      content: c(() => [
                        D("div", {
                          class: k([t(f).e("server-form")])
                        }, [
                          a(Se, {
                            model: t(g),
                            layout: "vertical"
                          }, {
                            default: c(() => [
                              a(m, {
                                label: "服务根地址",
                                help: t(h)
                              }, {
                                default: c(() => [
                                  a(Q, {
                                    value: t(g).rootUrl,
                                    "onUpdate:value": o[1] || (o[1] = (u) => t(g).rootUrl = u),
                                    title: t(g).rootUrl || "http(s)://<server>:<port>/igs/rest/services",
                                    placeholder: "http(s)://<server>:<port>/igs/rest/services"
                                  }, null, 8, ["value", "title"])
                                ]),
                                _: 1
                              }, 8, ["help"]),
                              a(m, null, {
                                default: c(() => [
                                  a(re, {
                                    checked: t(g).useToken,
                                    "onUpdate:checked": o[2] || (o[2] = (u) => t(g).useToken = u),
                                    onChange: t(ee)
                                  }, {
                                    default: c(() => [...o[13] || (o[13] = [
                                      P(" 指定令牌 ", -1)
                                    ])]),
                                    _: 1
                                  }, 8, ["checked", "onChange"])
                                ]),
                                _: 1
                              }),
                              t(g).useToken ? (M(), E(m, {
                                key: 0,
                                label: "令牌"
                              }, {
                                default: c(() => [
                                  a(Q, {
                                    value: t(g).token,
                                    "onUpdate:value": o[3] || (o[3] = (u) => t(g).token = u),
                                    placeholder: "请输入令牌",
                                    title: t(g).token
                                  }, null, 8, ["value", "title"])
                                ]),
                                _: 1
                              })) : j("", !0),
                              a(m, null, {
                                default: c(() => [
                                  a(de, {
                                    type: "primary",
                                    block: "",
                                    onClick: t(i)
                                  }, {
                                    default: c(() => [...o[14] || (o[14] = [
                                      P(" 确定 ", -1)
                                    ])]),
                                    _: 1
                                  }, 8, ["onClick"])
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          }, 8, ["model"])
                        ], 2)
                      ]),
                      default: c(() => [
                        D("div", {
                          class: k([t(f).e("server-config")])
                        }, [
                          a(L, {
                            type: "mapgis-setting",
                            title: "配置服务器"
                          })
                        ], 2)
                      ]),
                      _: 1
                    }, 8, ["open"]),
                    t(q) ? (M(), E(fe, {
                      key: 0,
                      type: "vertical"
                    })) : j("", !0),
                    t(q) ? (M(), E(oe, {
                      key: 1,
                      open: t(v),
                      "onUpdate:open": o[5] || (o[5] = (u) => K(v) ? v.value = u : null),
                      title: "选择服务",
                      placement: "bottomRight",
                      trigger: "click",
                      overlayStyle: { width: p.dropdownWidth ? p.dropdownWidth + "px" : "320px" }
                    }, {
                      content: c(() => {
                        var u, w;
                        return [
                          a(Le, {
                            serviceRootUrl: t(G),
                            serviceRootToken: t(W),
                            serviceProtocol: (u = t(F)) == null ? void 0 : u.protocol,
                            originalServiceType: (w = t(F)) == null ? void 0 : w.originalServiceType,
                            currentServiceUrl: t(y),
                            visible: t(v),
                            onSelect: t(n)
                          }, null, 8, ["serviceRootUrl", "serviceRootToken", "serviceProtocol", "originalServiceType", "currentServiceUrl", "visible", "onSelect"])
                        ];
                      }),
                      default: c(() => [
                        D("div", {
                          class: k([t(f).e("server-config")])
                        }, [
                          a(L, {
                            type: "mapgis-down",
                            title: "选择服务"
                          })
                        ], 2)
                      ]),
                      _: 1
                    }, 8, ["open", "overlayStyle"])) : j("", !0)
                  ], 2), [
                    [Ce, !t(Y)]
                  ])
                ], 2)
              ]),
              _: 1
            }, 8, ["class"]),
            a(m, {
              class: k([t(f).e("service-url")]),
              labelCol: { span: 0 },
              wrapperCol: { span: 24 },
              "validate-status": t(T),
              help: t($)
            }, {
              default: c(() => {
                var u, w;
                return [
                  a(Q, {
                    value: t(y),
                    "onUpdate:value": o[6] || (o[6] = (ge) => K(y) ? y.value = ge : null),
                    placeholder: (u = t(F)) == null ? void 0 : u.template,
                    title: t(y) || ((w = t(F)) == null ? void 0 : w.template),
                    onBlur: t(d),
                    onChange: t(d)
                  }, null, 8, ["value", "placeholder", "title", "onBlur", "onChange"])
                ];
              }),
              _: 1
            }, 8, ["class", "validate-status", "help"]),
            a(m, {
              class: k([t(f).e("server")]),
              labelCol: { span: 24 },
              wrapperCol: { span: 0 }
            }, {
              label: c(() => [
                a(re, {
                  checked: t(r),
                  "onUpdate:checked": o[7] || (o[7] = (u) => K(r) ? r.value = u : null),
                  onChange: t(s)
                }, {
                  default: c(() => [...o[15] || (o[15] = [
                    P(" 访问此服务需要令牌 ", -1)
                  ])]),
                  _: 1
                }, 8, ["checked", "onChange"])
              ]),
              _: 1
            }, 8, ["class"]),
            t(r) ? (M(), z(se, { key: 0 }, [
              a(m, { label: "令牌字段名" }, {
                default: c(() => [
                  a(ye, {
                    value: t(U),
                    "onUpdate:value": o[8] || (o[8] = (u) => K(U) ? U.value = u : null),
                    placeholder: "请输入令牌字段名"
                  }, null, 8, ["value"])
                ]),
                _: 1
              }),
              a(m, { label: "令牌值" }, {
                default: c(() => [
                  a(Q, {
                    value: t(C),
                    "onUpdate:value": o[9] || (o[9] = (u) => K(C) ? C.value = u : null),
                    placeholder: "请输入令牌值"
                  }, null, 8, ["value"])
                ]),
                _: 1
              }),
              a(m, { label: "令牌位置" }, {
                default: c(() => [
                  a(Te, {
                    value: t(I),
                    "onUpdate:value": o[10] || (o[10] = (u) => K(I) ? I.value = u : null),
                    style: { width: "100%" }
                  }, {
                    default: c(() => [
                      a(le, { value: "url" }, {
                        default: c(() => [...o[16] || (o[16] = [
                          P("查询参数", -1)
                        ])]),
                        _: 1
                      }),
                      a(le, { value: "header" }, {
                        default: c(() => [...o[17] || (o[17] = [
                          P("请求头", -1)
                        ])]),
                        _: 1
                      })
                    ]),
                    _: 1
                  }, 8, ["value"])
                ]),
                _: 1
              })
            ], 64)) : j("", !0),
            Ie(p.$slots, "default", {}, void 0, !0)
          ]),
          _: 3
        }, 8, ["class"])
      ], 2);
    };
  }
}), ze = /* @__PURE__ */ ce(Pe, [["__scopeId", "data-v-8c36b6c7"]]);
export {
  ze as S,
  ue as T,
  xe as a,
  we as b,
  Ae as s,
  Ke as u
};
