module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "lib/mapboxgl/";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 694);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/interopRequireDefault");

/***/ }),

/***/ 1:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent(
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier /* server only */,
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options =
    typeof scriptExports === 'function' ? scriptExports.options : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
          injectStyles.call(
            this,
            (options.functional ? this.parent : this).$root.$options.shadowRoot
          )
        }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}


/***/ }),

/***/ 111:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/table-popup");

/***/ }),

/***/ 12:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_utils/util.js");

/***/ }),

/***/ 15:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js");

/***/ }),

/***/ 16:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_lang/index.js");

/***/ }),

/***/ 17:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_mixin/control.js");

/***/ }),

/***/ 18:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/extends");

/***/ }),

/***/ 19:
/***/ (function(module, exports) {

module.exports = require("lodash.clonedeep");

/***/ }),

/***/ 2:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/init.js");

/***/ }),

/***/ 23:
/***/ (function(module, exports) {

module.exports = require("lodash.isequal");

/***/ }),

/***/ 26:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/message");

/***/ }),

/***/ 284:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(285);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
 /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

/***/ 285:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(__webpack_require__(18));
var _Theme = _interopRequireDefault(__webpack_require__(4));
var _mapGetter = _interopRequireDefault(__webpack_require__(7));
var _control = _interopRequireDefault(__webpack_require__(17));
var _SearchViewModel = _interopRequireDefault(__webpack_require__(696));
var _Icon = _interopRequireDefault(__webpack_require__(53));
var _Input = _interopRequireDefault(__webpack_require__(52));
var _Message = _interopRequireDefault(__webpack_require__(26));
var _TablePopup = _interopRequireDefault(__webpack_require__(111));
var _util = __webpack_require__(12);
var _lodash = _interopRequireDefault(__webpack_require__(23));
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _default2 = exports.default = {
  name: 'SmSearch',
  components: {
    SmIcon: _Icon.default,
    SmInput: _Input.default,
    TablePopup: _TablePopup.default
  },
  mixins: [_control.default, _mapGetter.default, _Theme.default],
  props: {
    maxFeatures: {
      type: [Number, String],
      default: 8
    },
    layerNames: {
      type: Array
    },
    onlineLocalSearch: {
      type: Object,
      default: function _default() {
        return {
          enable: true,
          city: '北京市'
        };
      }
    },
    restMap: {
      type: Array
    },
    restData: {
      type: Array
    },
    iportalData: {
      type: Array
    },
    addressMatch: {
      type: Array
    },
    mode: {
      type: String,
      default: 'control',
      validator: function validator(mode) {
        return ['control', 'toolBar'].includes(mode);
      }
    },
    openSearchSuggestion: {
      type: Boolean,
      default: false
    },
    alwaysCenter: {
      type: Boolean,
      default: true
    },
    showTitle: {
      type: Boolean,
      default: true
    },
    showResult: {
      type: Boolean,
      default: true
    },
    resultRender: {
      type: Function
    },
    collapsed: {
      // 是否折叠组件
      type: Boolean,
      default: false
    },
    splitLine: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      searchKey: null,
      searchResult: [],
      prefixType: 'search',
      isActive: false,
      tablePopupProps: {},
      showSearch: true,
      showIcon: false,
      isInputing: false,
      isSuggestion: false,
      keyupHoverInfo: {
        groupIndex: undefined,
        hoverIndex: undefined
      }
    };
  },
  computed: {
    resultSuggestions: function resultSuggestions() {
      if (!this.isSuggestion && !this.showResult) {
        return false;
      }
      return this.searchResult.length > 0;
    }
  },
  watch: {
    iportalData: function iportalData(newVal, oldVal) {
      if (this.searchKey && !(0, _lodash.default)(newVal, oldVal)) {
        this.search();
      }
    },
    restData: function restData(newVal, oldVal) {
      if (this.searchKey && !(0, _lodash.default)(newVal, oldVal)) {
        this.search();
      }
    },
    restMap: function restMap(newVal, oldVal) {
      if (this.searchKey && !(0, _lodash.default)(newVal, oldVal)) {
        this.search();
      }
    },
    addressMatch: function addressMatch(newVal, oldVal) {
      if (this.searchKey && !(0, _lodash.default)(newVal, oldVal)) {
        this.search();
      }
    }
  },
  created: function created() {
    this.showSearch = !this.collapsed;
    this.showIcon = this.collapsed;
    this.viewModel = new _SearchViewModel.default(this.$props);
  },
  removed: function removed() {
    this.clearResult(true);
  },
  beforeDestroy: function beforeDestroy() {
    // @ts-ignore
    _Message.default.destroy();
  },
  methods: {
    clearResult: function clearResult(isClear) {
      // @ts-ignore
      _Message.default.destroy();
      isClear && (this.searchKey = null);
      isClear && this.resetLastEvent();
      this.searchResult = [];
      this.prefixType = 'search';
      this.keyupHoverInfo = {
        groupIndex: undefined,
        hoverIndex: undefined
      };
      this.viewModel && this.viewModel.removed();
    },
    searchInput: function searchInput() {
      if (this.openSearchSuggestion && !this.isInputing) {
        if (this.searchKey) {
          this.isSuggestion = true;
          this.search();
        } else {
          this.inputValueCleared(false);
        }
      }
    },
    searchButtonClicked: function searchButtonClicked() {
      this.isSuggestion = false;
      this.search();
    },
    search: function search() {
      this.clearResult();
      var mapNotLoaded = this.mapNotLoadedTip();
      if (mapNotLoaded) return;
      var _this$$props = this.$props,
        layerNames = _this$$props.layerNames,
        onlineLocalSearch = _this$$props.onlineLocalSearch,
        restMap = _this$$props.restMap,
        restData = _this$$props.restData,
        iportalData = _this$$props.iportalData,
        addressMatch = _this$$props.addressMatch;
      if (layerNames && layerNames.length > 0 || onlineLocalSearch.enable || restMap && restMap.length > 0 || restData && restData.length > 0 || iportalData && iportalData.length > 0 || addressMatch && addressMatch.length > 0) {
        if (this.searchKey) {
          this.searchTaskId = this.viewModel.search(this.searchKey);
          this.regiterEvents();
          this.prefixType = 'loading';
        } else {
          // @ts-ignore
          _Message.default.warning(this.$t('search.noKey'));
        }
      } else {
        // @ts-ignore
        _Message.default.warning(this.$t('search.setSearchSource'));
      }
    },
    inputValueCleared: function inputValueCleared(emitEvent) {
      if (emitEvent === void 0) {
        emitEvent = true;
      }
      this.clearResult(true);
      this.viewModel && this.viewModel.removed();
      emitEvent && this.$emit('clear-search-result');
    },
    searchResultListClicked: function searchResultListClicked(data, event) {
      var searchKey = event.target.innerHTML;
      this.isSuggestion = false;
      this.viewModel.getFeatureInfo(searchKey, data);
    },
    resetLastEvent: function resetLastEvent() {
      if (/\d/.test(this.searchTaskId)) {
        this.viewModel.off('searchsucceeded' + this.searchTaskId);
        this.viewModel.off('searchfailed' + this.searchTaskId);
        this.viewModel.off('set-popup-content' + this.searchTaskId);
        this.viewModel.off('addfeaturefailed' + this.illegalFeatureTip);
        this.viewModel.off('search-selected-info' + this.searchTaskId);
        this.searchTaskId = undefined;
      }
    },
    registerSuccessEvent: function registerSuccessEvent(searchTaskId) {
      this.viewModel.on('searchsucceeded' + searchTaskId, this.searchSucceeded);
    },
    registerFailedEvent: function registerFailedEvent(searchTaskId) {
      this.viewModel.on('searchfailed' + searchTaskId, this.searchFailed);
    },
    regiterEvents: function regiterEvents() {
      if (this.isNumber(this.searchTaskId)) {
        this.viewModel.off('searchsucceeded' + (this.searchTaskId - 1), this.searchSucceeded);
        this.viewModel.off('searchsucceeded' + (this.searchTaskId - 1), this.searchFailed);
        this.viewModel.off('set-popup-content' + (this.searchTaskId - 1), this.setPopupContent);
        this.viewModel.off('addfeaturefailed' + (this.searchTaskId - 1), this.illegalFeatureTip);
        this.viewModel.off('search-selected-info' + (this.searchTaskId - 1), this.searchSelectedInfo);
      }
      var onTaskId = this.searchTaskId || 0;
      this.registerSuccessEvent(onTaskId);
      this.registerFailedEvent(onTaskId);
      this.viewModel.on('set-popup-content' + onTaskId, this.setPopupContent);
      this.viewModel.on('addfeaturefailed' + onTaskId, this.illegalFeatureTip);
      this.viewModel.on('search-selected-info' + onTaskId, this.searchSelectedInfo);
    },
    searchSucceeded: function searchSucceeded(_ref) {
      var result = _ref.result;
      /**
       * @event searchSucceeded
       * @desc 搜索成功后触发。
       * @property {Object} e  - 事件对象。
       */
      // @ts-ignore
      _Message.default.destroy();
      this.searchResult = result;
      this.$emit('search-succeeded', {
        searchResult: this.searchResult
      });
      this.prefixType = 'search';
      // this.searchResult.length < 1 && Message.warning(this.$t('search.noResult'));
      if (this.isNumber(this.searchTaskId)) {
        this.searchTaskId += 1;
        this.regiterEvents();
      }
    },
    searchFailed: function searchFailed(e) {
      /**
       * @event searchFailed
       * @desc 搜索失败后触发。
       * @property {Object} e  - 事件对象。
       */
      this.clearResult();
      this.prefixType = 'search';
      // Message.warning(this.$t('search.noResult'));
      this.$emit('search-failed', e);
      if (this.isNumber(this.searchTaskId)) {
        this.searchTaskId += 1;
        this.regiterEvents();
      }
    },
    setPopupContent: function setPopupContent(_ref2) {
      var _this = this;
      var popupData = _ref2.popupData;
      if (popupData && popupData.info.length) {
        var state = {
          columns: [{
            title: this.$t('search.attribute'),
            dataIndex: 'attribute',
            width: 80
          }, {
            title: this.$t('search.attributeValue'),
            dataIndex: 'attributeValue',
            width: 150
          }],
          data: popupData.info
        };
        this.tablePopupProps = (0, _extends2.default)({}, state);
      }
      this.$nextTick(function () {
        _this.viewModel.setPopupContent(popupData.coordinates, _this.$refs.searchTablePopup.$el, function () {
          return (0, _util.setPopupArrowStyle)(_this.tablePopupBgData);
        });
      });
    },
    illegalFeatureTip: function illegalFeatureTip(_ref3) {
      var error = _ref3.error;
      // @ts-ignore
      _Message.default.destroy();
      // @ts-ignore
      _Message.default.error(error);
    },
    searchSelectedInfo: function searchSelectedInfo(_ref4) {
      var data = _ref4.data;
      this.prefixType = 'search';
      this.resultRender && this.resultRender(data);
      this.$emit('search-selected-info', data);
    },
    isNumber: function isNumber(num) {
      return /\d/.test(num);
    },
    downChoose: function downChoose() {
      var len = this.searchResult.filter(function (item) {
        return item.result.length;
      }).length;
      var _this$keyupHoverInfo = this.keyupHoverInfo,
        _this$keyupHoverInfo$ = _this$keyupHoverInfo.groupIndex,
        groupIndex = _this$keyupHoverInfo$ === void 0 ? 0 : _this$keyupHoverInfo$,
        hoverIndex = _this$keyupHoverInfo.hoverIndex;
      var groupResult = groupIndex ? this.searchResult[groupIndex].result : this.searchResult[0].result;
      var subLen = groupResult.length;
      groupIndex = groupIndex < len - 1 && hoverIndex >= subLen - 1 ? Math.min(len - 1, groupIndex + 1) : groupIndex === len - 1 && hoverIndex === subLen - 1 ? 0 : groupIndex;
      if (this.isNumber(hoverIndex) && hoverIndex < subLen - 1) {
        this.keyupHoverInfo.hoverIndex = hoverIndex + 1;
      } else {
        this.keyupHoverInfo.groupIndex = groupIndex;
        this.keyupHoverInfo.hoverIndex = 0;
      }
      var selectedItem = this.searchResult[groupIndex].result[this.keyupHoverInfo.hoverIndex];
      this.searchKey = (selectedItem.filterVal || selectedItem.name || selectedItem.address).split('：')[0];
    },
    upChoose: function upChoose() {
      var len = this.searchResult.filter(function (item) {
        return item.result.length;
      }).length;
      var _this$keyupHoverInfo2 = this.keyupHoverInfo,
        _this$keyupHoverInfo3 = _this$keyupHoverInfo2.groupIndex,
        groupIndex = _this$keyupHoverInfo3 === void 0 ? 0 : _this$keyupHoverInfo3,
        hoverIndex = _this$keyupHoverInfo2.hoverIndex;
      groupIndex = groupIndex > 0 && !hoverIndex ? Math.max(0, groupIndex - 1) : !groupIndex && !hoverIndex ? len - 1 : groupIndex;
      if (this.isNumber(hoverIndex) && hoverIndex > 0) {
        this.keyupHoverInfo.hoverIndex = hoverIndex - 1;
      } else {
        this.keyupHoverInfo.groupIndex = groupIndex;
        this.keyupHoverInfo.hoverIndex = Math.max(this.searchResult[groupIndex].result.length - 1, 0);
      }
      var selectedItem = this.searchResult[groupIndex].result[this.keyupHoverInfo.hoverIndex];
      this.searchKey = (selectedItem.filterVal || selectedItem.name || selectedItem.address).split('：')[0];
    },
    changeResultHover: function changeResultHover(e) {
      var keyCode = e.keyCode;
      if (keyCode === 38) {
        this.upChoose();
      } else if (keyCode === 40) {
        this.downChoose();
      }
    }
  }
};

/***/ }),

/***/ 3:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/inheritsLoose");

/***/ }),

/***/ 38:
/***/ (function(module, exports) {

module.exports = require("@turf/center");

/***/ }),

/***/ 4:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_mixin/Theme.js");

/***/ }),

/***/ 447:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ render; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ staticRenderFns; });

// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/mapboxgl/search/Search.vue?vue&type=template&id=36c0a980&
var render = function () {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    {
      staticClass: "sm-component-search",
      style: _vm.headingTextColorStyle,
      attrs: { id: "sm-component-search" },
    },
    [
      _vm.showIcon && _vm.mode === "control"
        ? _c(
            "div",
            {
              staticClass: "sm-component-search__toggle-icon",
              style: _vm.collapseCardHeaderBgStyle,
              on: {
                click: function ($event) {
                  _vm.showSearch = !_vm.showSearch
                  _vm.showIcon = !_vm.showIcon
                },
              },
            },
            [_c("i", { staticClass: "sm-components-icon-search" })]
          )
        : _vm._e(),
      _c(
        "transition",
        {
          attrs: { name: "sm-component-zoom-in" },
          on: {
            "after-leave": function ($event) {
              _vm.showIcon = !_vm.showIcon
            },
          },
        },
        [
          _c(
            "div",
            {
              directives: [
                {
                  name: "show",
                  rawName: "v-show",
                  value: _vm.showSearch || _vm.mode === "toolBar",
                  expression: "showSearch || mode === 'toolBar'",
                },
              ],
              staticClass: "sm-component-search__content",
              style: [
                {
                  "transform-origin": _vm.position.includes("left")
                    ? "top left"
                    : "top right",
                },
                _vm.collapseCardHeaderBgStyle,
              ],
            },
            [
              _c(
                "div",
                {
                  class: {
                    "sm-component-search__input": true,
                    "with-split-line": _vm.splitLine,
                  },
                  style: _vm.collapseCardHeaderBgStyle,
                  attrs: {
                    "aria-orientation": _vm.position.includes("left")
                      ? "left"
                      : "right",
                  },
                },
                [
                  _vm.mode === "control"
                    ? _c(
                        "div",
                        {
                          staticClass: "sm-component-search__arrow-icon",
                          on: {
                            click: function ($event) {
                              _vm.showSearch = !_vm.showSearch
                            },
                          },
                        },
                        [
                          _c("i", {
                            class: _vm.position.includes("left")
                              ? "sm-components-icon-double-left"
                              : "sm-components-icon-double-right",
                          }),
                        ]
                      )
                    : _vm._e(),
                  _c(
                    "div",
                    {
                      staticClass: "sm-component-search__search-icon",
                      on: { click: _vm.searchButtonClicked },
                    },
                    [_c("sm-icon", { attrs: { type: _vm.prefixType } })],
                    1
                  ),
                  _c("sm-input", {
                    class: [
                      "sm-component-search__a-input",
                      { "toolBar-input": _vm.mode === "toolBar" },
                    ],
                    attrs: {
                      placeholder: _vm.$t("search.inputPlaceHolder"),
                      allowClear: "",
                    },
                    on: {
                      input: _vm.searchInput,
                      compositionstart: function ($event) {
                        _vm.isInputing = true
                      },
                      compositionend: function ($event) {
                        _vm.isInputing = false
                      },
                      pressEnter: _vm.searchButtonClicked,
                      focus: function ($event) {
                        _vm.isActive = !_vm.isActive
                      },
                      blur: function ($event) {
                        _vm.isActive = !_vm.isActive
                      },
                      keyup: _vm.changeResultHover,
                      change: function (e) {
                        return !e.target.value && _vm.inputValueCleared()
                      },
                    },
                    model: {
                      value: _vm.searchKey,
                      callback: function ($$v) {
                        _vm.searchKey = $$v
                      },
                      expression: "searchKey",
                    },
                  }),
                ],
                1
              ),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.resultSuggestions,
                      expression: "resultSuggestions",
                    },
                  ],
                  staticClass: "sm-component-search__result",
                  style: _vm.collapseCardBackgroundStyle,
                },
                _vm._l(_vm.searchResult, function (result, index) {
                  return _c(
                    "div",
                    { key: index, staticClass: "sm-component-search__panel" },
                    [
                      result.source && _vm.showTitle && result.result.length
                        ? _c(
                            "div",
                            {
                              staticClass:
                                "sm-component-search__panel-header-wrapper",
                            },
                            [
                              _c(
                                "div",
                                {
                                  staticClass:
                                    "sm-component-search__panel-header",
                                },
                                [
                                  _c("i", {
                                    staticClass: "sm-components-icon-list",
                                  }),
                                  _c("span", { staticClass: "add-ellipsis" }, [
                                    _vm._v(_vm._s(result.source)),
                                  ]),
                                ]
                              ),
                            ]
                          )
                        : _vm._e(),
                      result.result
                        ? _c(
                            "div",
                            {
                              staticClass: "sm-component-search__panel-body",
                              style: _vm.getTextColorStyle,
                            },
                            [
                              _c(
                                "ul",
                                { class: { noMarginBottom: !_vm.showTitle } },
                                _vm._l(result.result, function (item, i) {
                                  return _c(
                                    "li",
                                    {
                                      key: i,
                                      class: {
                                        active:
                                          _vm.keyupHoverInfo.groupIndex ===
                                            index &&
                                          _vm.keyupHoverInfo.hoverIndex === i,
                                        "add-ellipsis": true,
                                      },
                                      attrs: {
                                        title:
                                          item.filterVal ||
                                          item.name ||
                                          item.address,
                                      },
                                      on: {
                                        click: function ($event) {
                                          return _vm.searchResultListClicked(
                                            item,
                                            $event
                                          )
                                        },
                                      },
                                    },
                                    [
                                      _vm._v(
                                        _vm._s(
                                          item.filterVal ||
                                            item.name ||
                                            item.address
                                        )
                                      ),
                                    ]
                                  )
                                }),
                                0
                              ),
                            ]
                          )
                        : _vm._e(),
                    ]
                  )
                }),
                0
              ),
            ]
          ),
        ]
      ),
      _c(
        "TablePopup",
        _vm._b(
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: false,
                expression: "false",
              },
            ],
            ref: "searchTablePopup",
            attrs: {
              "split-line": _vm.splitLine,
              "text-color": _vm.textColor,
              background: _vm.background,
            },
          },
          "TablePopup",
          _vm.tablePopupProps,
          false
        )
      ),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true


// CONCATENATED MODULE: ./src/mapboxgl/search/Search.vue?vue&type=template&id=36c0a980&


/***/ }),

/***/ 5:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/static/libs/mapboxgl/mapbox-gl-enhance.js");

/***/ }),

/***/ 52:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/input");

/***/ }),

/***/ 53:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/icon");

/***/ }),

/***/ 54:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_utils/iServerRestService.js");

/***/ }),

/***/ 694:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _Search = _interopRequireDefault(__webpack_require__(695));
var _init = _interopRequireDefault(__webpack_require__(2));
_Search.default.install = function (Vue, opts) {
  (0, _init.default)(Vue, opts);
  Vue.component(_Search.default.options ? _Search.default.options.name : _Search.default.name, _Search.default);
};
var _default = exports.default = _Search.default;

/***/ }),

/***/ 695:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Search_vue_vue_type_template_id_36c0a980___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(447);
/* harmony import */ var _Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(284);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);





/* normalize component */

var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(
  _Search_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  _Search_vue_vue_type_template_id_36c0a980___WEBPACK_IMPORTED_MODULE_0__[/* render */ "a"],
  _Search_vue_vue_type_template_id_36c0a980___WEBPACK_IMPORTED_MODULE_0__[/* staticRenderFns */ "b"],
  false,
  null,
  null,
  null
  
)

/* harmony default export */ __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ 696:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(__webpack_require__(18));
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(3));
var _mapboxGlEnhance = _interopRequireDefault(__webpack_require__(5));
var _lodash = _interopRequireDefault(__webpack_require__(19));
var _center = _interopRequireDefault(__webpack_require__(38));
__webpack_require__(15);
var _iPortalDataService = _interopRequireDefault(__webpack_require__(85));
var _iServerRestService = _interopRequireDefault(__webpack_require__(54));
var _index = __webpack_require__(16);
var _util = __webpack_require__(12);
/**
 * @class SearchViewModel
 * @classdesc 数据搜索功能类。
 * @category  ViewModel
 * @param {mapboxgl.Map} map - mapboxgl map 对象。
 * @param {Object} [options] - 可选参数。
 * @param {Object} [options.maxFeatures=8] - 最多可返回的要素数量，最大值为 100。
 * @param {Array.<string>} [options.layerNames] - 地图图层搜索配置，如：'['UNIQUE-民航数']'。
 * @param {Array.<string>} [options.restMap] - iServer 地图服务搜索配置。
 * @param {string} options.restMap.url - 地图服务地址。
 * @param {string} options.restMap.layerName - 搜索图层名。
 * @param {string} [options.restMap.name] - 搜索结果名称。
 * @param {Array.<string>} [options.restData] - iServer 数据服务搜索配置。
 * @param {string} options.restData.url - 数据服务地址。
 * @param {Array} options.restData.dataName - 搜索数据集名数组。
 * @param {string} [options.restData.name] - 搜索结果名称。
 * @param {Array.<string>} [options.iportalData] - iPortal 数据搜索配置。
 * @param {string} options.iportalData.url - 数据地址。
 * @param {string} [options.iportalData.name] - 搜索结果名称。
 * @param {Array.<string>} [options.addressMatch] - iServer 地址匹配服务搜索配置。
 * @param {string} options.addressMatch.url - 地址匹配服务地址。
 * @param {string} [options.addressMatch.name] - 搜索结果名称。
 * @param {Object} [options.onlineLocalSearch] - online 本地搜索配置。
 * @param {Boolean} [options.onlineLocalSearch.enable=true] - 是否开启 online 本地搜索。
 * @fires SearchViewModel#searchsucceeded
 * @fires SearchViewModel#searchfailed
 */
var SearchViewModel = exports.default = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(SearchViewModel, _mapboxgl$Evented);
  function SearchViewModel(options) {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    _this.options = options || {};
    _this.searchTaskId = 0;
    _this.options.cityGeoCodingConfig = {
      addressUrl: 'https://www.supermapol.com/iserver/services/localsearch/rest/searchdatas/China/poiinfos',
      key: options.onlineLocalSearch.key || 'fvV2osxwuZWlY0wJb8FEb2i5'
    };
    _this.searchtType = ['layerNames', 'onlineLocalSearch', 'restMap', 'restData', 'iportalData', 'addressMatch'];
    _this.markerList = [];
    _this.popupList = [];
    _this.errorSourceList = {};
    return _this;
  }
  var _proto = SearchViewModel.prototype;
  _proto.setMap = function setMap(mapInfo) {
    var map = mapInfo.map;
    this.map = map;
  }

  /**
   * @function SearchViewModel.prototype.search
   * @description 开始搜索。
   * @param {String} keyWord - 搜索关键字。
   */;
  _proto.search = function search(keyWord) {
    var _this2 = this;
    this.searchCount = 0;
    this.searchResult = {};
    this.errorSourceList = {};
    this.keyWord = keyWord;
    this.maxFeatures = parseInt(this.options.maxFeatures) >= 100 ? 100 : parseInt(this.options.maxFeatures) || 8;
    this.searchtType.forEach(function (item) {
      if (_this2.options[item]) {
        if (item === 'onlineLocalSearch' && _this2.options[item].enable) {
          _this2.searchCount += 1;
        } else if (item !== 'onlineLocalSearch') {
          var len = _this2.options[item].length;
          _this2.searchCount += len;
        }
      }
    }, this);
    var _this$options = (0, _extends2.default)({}, this.options),
      layerNames = _this$options.layerNames,
      onlineLocalSearch = _this$options.onlineLocalSearch,
      restMap = _this$options.restMap,
      restData = _this$options.restData,
      iportalData = _this$options.iportalData,
      addressMatch = _this$options.addressMatch;
    layerNames && this._searchFromLayer(layerNames);
    onlineLocalSearch.enable && this._searchFromPOI(onlineLocalSearch);
    restMap && this._searchFromRestMap(restMap);
    restData && this._searchFromRestData(restData);
    iportalData && this._searchFromIportal(iportalData);
    addressMatch && this._searchFromAddressMatch(addressMatch);
    return this.searchTaskId;
  }

  /**
   * @function SearchViewModel.prototype.getFeatureInfo
   * @description 获取搜索结果的要素信息。
   * @param {String} searchKey - 搜索关键字。
   * @param {String} data - 过滤数据。
   */;
  _proto.getFeatureInfo = function getFeatureInfo(searchKey, data) {
    var resultRender = this.options.resultRender;
    this.keyWord = searchKey;
    this._reset();
    this.fire('search-selected-info' + this.searchTaskId, {
      data: data
    });
    if (resultRender) {
      return;
    }
    this._showResultToMap(data);
  };
  _proto._showResultToMap = function _showResultToMap(feature) {
    var geometry = feature.geometry || {};
    if (!this.options.alwaysCenter && (geometry.type === 'MultiPolygon' || geometry.type === 'Polygon')) {
      this._addPolygon(feature);
    } else if (!this.options.alwaysCenter && geometry.type === 'LineString') {
      this._addLine(feature);
    } else {
      this._addPoint(feature);
    }
  };
  _proto._addPoint = function _addPoint(feature) {
    var properties = feature.properties || feature;
    var geometry = feature.geometry || [feature.location.x, feature.location.y];
    var pointData = {
      coordinates: null,
      info: []
    };
    var propertiesValue = properties.address || feature.filterAttribute.filterAttributeValue || properties.name;
    if (geometry.type === 'MultiPolygon' || geometry.type === 'Polygon' || geometry.type === 'LineString') {
      pointData.coordinates = (0, _util.getFeatureCenter)(feature);
    } else {
      pointData.coordinates = geometry.coordinates || geometry;
    }
    if (!pointData.coordinates || !pointData.coordinates.length || pointData.coordinates.find(function (item) {
      return isNaN(+item);
    })) {
      this.fire('addfeaturefailed' + this.searchTaskId, {
        error: (0, _index.geti18n)().t('search.illegalFeature')
      });
      return;
    }
    if (this.keyWord.indexOf('：') < 0) {
      pointData.info.push({
        attribute: (0, _index.geti18n)().t('search.address'),
        attributeValue: propertiesValue
      });
    } else {
      for (var key in properties) {
        properties[key] && pointData.info.push({
          attribute: key,
          attributeValue: properties[key]
        });
      }
    }
    this.fire('set-popup-content' + this.searchTaskId, {
      popupData: pointData
    });
  };
  _proto._addLine = function _addLine() {
    console.log('draw line here');
  };
  _proto._addPolygon = function _addPolygon(feature) {
    if (feature && this.map) {
      var center = (0, _center.default)(feature).geometry.coordinates;
      var source = this.map.getSource('searchResultLayer');
      var sourceData = feature;
      if (source) {
        source.setData(sourceData);
      } else {
        this.map.addLayer({
          id: 'searchResultLayer',
          type: 'fill',
          source: {
            type: 'geojson',
            data: sourceData
          },
          layout: {},
          paint: {
            'fill-color': 'rgb(255, 0, 0)',
            'fill-opacity': 0.8
          }
        });
      }
      this.map.easeTo({
        center: center
      });
    }
  }

  /**
   * @function SearchViewModel.prototype.addMarker
   * @description 向地图上添加 Marker。
   * @param {Array} coordinates - 坐标数组。
   * @param {HTMLElement} popupContainer - 弹窗 DOM 对象。
   * @param {Function} callback - 弹窗生成后的回调事件。
   */;
  _proto.setPopupContent = function setPopupContent(coordinates, popupContainer, callback) {
    popupContainer.style.display = 'block';
    var popup = new _mapboxGlEnhance.default.Popup({
      className: 'sm-mapboxgl-tabel-popup sm-component-search-result-popup',
      closeOnClick: true,
      closeButton: false,
      maxWidth: 'none',
      anchor: 'bottom'
    });
    var marker = new _mapboxGlEnhance.default.Marker();
    this.popupList.push(popup);
    this.markerList.push(marker);
    popup.setLngLat(coordinates).setDOMContent(popupContainer).addTo(this.map);
    popup.on('open', function () {
      callback && callback();
    });
    marker.setLngLat(coordinates).setPopup(popup).addTo(this.map);
    this.map.flyTo({
      center: coordinates
    });
  };
  _proto._searchFromLayer = function _searchFromLayer(layerNames) {
    var _this3 = this;
    setTimeout(function () {
      layerNames.forEach(function (sourceName) {
        var source = _this3.map.getSource(sourceName);
        if (source) {
          var features = (0, _lodash.default)(source._data.features);
          var resultFeature = _this3._getFeaturesByKeyWord(_this3.keyWord, features);
          var results = resultFeature.slice(0, _this3.maxFeatures);
          _this3._searchFeaturesSucceed(results, sourceName);
        } else {
          _this3._searchFeaturesFailed("The " + sourceName + " does not exist", sourceName);
        }
      }, _this3);
    }, 0);
  };
  _proto._searchFeaturesFailed = function _searchFeaturesFailed(error, sourceName) {
    error && console.log(error);
    if (this.errorSourceList[sourceName]) return;
    this.searchCount--;
    this.errorSourceList[sourceName] = sourceName;
    /**
     * @event SearchViewModel#searchfailed
     * @description 搜索失败后触发。
     * @property {Object} e  - 事件对象。
     */
    this.searchCount === 0 && this.fire('searchfailed' + this.searchTaskId, {
      error: error,
      sourceName: sourceName
    }) && (this.searchTaskId += 1);
  };
  _proto._searchFeaturesSucceed = function _searchFeaturesSucceed(resultFeature, sourceName) {
    if (this.errorSourceList[sourceName]) {
      delete this.errorSourceList[sourceName];
    }
    if (resultFeature.length > 0) {
      var result = {
        source: sourceName,
        result: resultFeature
      };
      this.searchResult[sourceName] = result;
    }
    var resultList = [];
    for (var key in this.searchResult) {
      resultList.push(this.searchResult[key]);
    }
    /**
     * @event SearchViewModel#searchsucceeded
     * @description 搜索成功后触发。
     * @property {Object} e  - 事件对象。
     */
    this.fire('searchsucceeded' + this.searchTaskId, {
      result: resultList
    }) && (this.searchTaskId += 1);
  };
  _proto._searchFromPOI = function _searchFromPOI(onlineLocalSearch) {
    var _this4 = this;
    var sourceName = 'Online 本地搜索';
    this.geoCodeParam = {
      pageSize: this.options.pageSize || 10,
      pageNum: this.options.pageNum || 1,
      city: onlineLocalSearch.city
    };
    this.geoCodeParam.keyWords = this.keyWord;
    var url = this._getSearchUrl(this.geoCodeParam);
    SuperMap.FetchRequest.get(url).then(function (response) {
      return response.json();
    }).then(function (geocodingResult) {
      if (geocodingResult.error) {
        _this4._searchFeaturesFailed(geocodingResult.error, sourceName);
        return;
      }
      if (geocodingResult.poiInfos && geocodingResult.poiInfos.length === 0) {
        _this4._searchFeaturesSucceed([], sourceName);
        return;
      }
      if (geocodingResult.poiInfos) {
        var geoJsonResult = _this4._dataToGeoJson(geocodingResult.poiInfos, _this4.geoCodeParam);
        _this4._searchFeaturesSucceed(geoJsonResult.slice(0, _this4.maxFeatures), sourceName);
      }
    }).catch(function (error) {
      _this4._searchFeaturesFailed(error, sourceName);
    });
  };
  _proto._searchFromRestMap = function _searchFromRestMap(restMaps) {
    var _this5 = this;
    var sourceName = 'Rest Map Search';
    restMaps.forEach(function (restMap) {
      var options = {};
      if (restMap.proxy) {
        options.proxy = restMap.proxy;
      }
      restMap.epsgCode && (options.epsgCode = restMap.epsgCode);
      var iserverService = new _iServerRestService.default(restMap.url, options);
      iserverService.on({
        getdatafailed: function getdatafailed() {
          _this5._searchFeaturesFailed('', restMap.name || sourceName);
        },
        featureisempty: function featureisempty() {
          _this5._searchFeaturesSucceed([], restMap.name || sourceName);
        },
        getdatasucceeded: function getdatasucceeded(e) {
          if (e.features) {
            var resultFeatures = _this5._getFeaturesByKeyWord(_this5.keyWord, e.features);
            _this5._searchFeaturesSucceed(resultFeatures, restMap.name || sourceName);
          }
        }
      });
      iserverService.getMapFeatures({
        dataUrl: restMap.url,
        mapName: restMap.layerName
      }, {
        maxFeatures: _this5.maxFeatures,
        keyWord: _this5.keyWord
      });
    }, this);
  };
  _proto._searchFromRestData = function _searchFromRestData(restDatas) {
    var _this6 = this;
    var sourceName = 'Rest Data Search';
    restDatas.forEach(function (restData) {
      var options = {};
      if (restData.proxy) {
        options.proxy = restData.proxy;
      }
      restData.epsgCode && (options.epsgCode = restData.epsgCode);
      var iserverService = new _iServerRestService.default(restData.url, options);
      iserverService.on({
        getdatafailed: function getdatafailed() {
          _this6._searchFeaturesFailed('', restData.name || sourceName);
        },
        featureisempty: function featureisempty() {
          _this6._searchFeaturesSucceed([], restData.name || sourceName);
        },
        getdatasucceeded: function getdatasucceeded(e) {
          if (e.features && e.features.length > 0) {
            var resultFeatures = _this6._getFeaturesByKeyWord(_this6.keyWord, e.features);
            _this6._searchFeaturesSucceed(resultFeatures, restData.name || sourceName);
          }
        }
      });
      var dataSourceName = restData.dataName[0].split(':')[0];
      var datasetName = restData.dataName[0].split(':')[1];
      iserverService.getDataFeatures({
        datasetName: datasetName,
        dataSourceName: dataSourceName,
        dataUrl: restData.url
      }, {
        maxFeatures: _this6.maxFeatures,
        keyWord: _this6.keyWord
      });
    }, this);
  };
  _proto._searchFromIportal = function _searchFromIportal(iportalDatas) {
    var _this7 = this;
    var sourceName = 'Iportal Search';
    iportalDatas.forEach(function (iportal) {
      var iPortalService = new _iPortalDataService.default(iportal.url, iportal.withCredentials || false, {
        epsgCode: iportal.epsgCode
      });
      iPortalService.on({
        getdatafailed: function getdatafailed() {
          _this7._searchFeaturesFailed('', iportal.name || sourceName);
        },
        featureisempty: function featureisempty() {
          _this7._searchFeaturesSucceed([], iportal.name || sourceName);
        },
        getdatasucceeded: function getdatasucceeded(e) {
          if (e.features) {
            var resultFeatures = _this7._getFeaturesByKeyWord(_this7.keyWord, e.features);
            _this7._searchFeaturesSucceed(resultFeatures, iportal.name || sourceName);
          }
        }
      });
      iPortalService.getData({
        keyWord: _this7.keyWord
      });
    }, this);
  };
  _proto._searchFromAddressMatch = function _searchFromAddressMatch(addressMatches) {
    var _this8 = this;
    var sourceName = 'Address Match Search';
    addressMatches.forEach(function (addressMatch) {
      var options = {};
      if (addressMatch.proxy) {
        options.proxy = addressMatch.proxy;
      }
      _this8.addressMatchService = new _mapboxGlEnhance.default.supermap.AddressMatchService(addressMatch.url, options);
      var parm = {
        address: _this8.keyWord,
        fromIndex: 0,
        toIndex: _this8.maxFeatures,
        maxReturn: _this8.maxFeatures,
        prjCoordSys: '{epsgcode:4326}'
      };
      var geoCodeParam = new SuperMap.GeoCodingParameter(parm);
      _this8.addressMatchService.code(geoCodeParam, function (e) {
        if (e.result) {
          _this8._searchFeaturesSucceed(e.result, addressMatch.name || sourceName);
        } else {
          _this8._searchFeaturesFailed('', addressMatch.name || sourceName);
        }
      });
    }, this);
  };
  _proto._dataToGeoJson = function _dataToGeoJson(data, geoCodeParam) {
    var features = [];
    for (var i = 0; i < data.length; i++) {
      var feature = {
        type: 'Feature',
        geometry: {
          type: 'Point',
          coordinates: [data[i].location.x, data[i].location.y]
        },
        properties: {
          name: data[i].name || geoCodeParam.keyWords,
          address: data[i].formatedAddress || data[i].address
        },
        filterAttribute: {
          filterAttributeName: data[i].name || geoCodeParam.keyWords,
          filterAttributeValue: data[i].formatedAddress || data[i].address || (0, _index.geti18n)().t('search.null')
        },
        filterVal: (data[i].name || geoCodeParam.keyWords) + "\uFF1A" + (data[i].formatedAddress || data[i].address || (0, _index.geti18n)().t('search.null'))
      };
      features.push(feature);
    }
    return features;
  };
  _proto._getSearchUrl = function _getSearchUrl(geoCodeParam) {
    var url = this.options.cityGeoCodingConfig.addressUrl + (".json?keywords=" + geoCodeParam.keyWords + "&city=" + (geoCodeParam.city || '北京市') + "&pageSize=" + geoCodeParam.pageSize + "&pageNum=" + geoCodeParam.pageNum + "&key=" + this.options.cityGeoCodingConfig.key);
    return url;
  };
  _proto._getFeaturesByKeyWord = function _getFeaturesByKeyWord(keyWord, features) {
    var _this9 = this;
    var resultFeatures = [];
    var keyReg = new RegExp(keyWord.toLowerCase());
    var operatingAttributeNames = this._getAttributeNames(features);
    features.forEach(function (feature) {
      if (!feature.properties) {
        return null;
      }
      var fAttr = feature.properties;
      operatingAttributeNames.forEach(function (attributeName) {
        if (fAttr[attributeName] && keyReg.test(fAttr[attributeName].toString().toLowerCase())) {
          var filterAttributeName = attributeName;
          var filterAttributeValue = fAttr[attributeName] || (0, _index.geti18n)().t('search.null');
          if (!feature.filterAttribute) {
            feature.filterAttribute = {
              filterAttributeName: filterAttributeName,
              filterAttributeValue: filterAttributeValue
            };
            feature.filterVal = filterAttributeName + "\uFF1A" + filterAttributeValue;
            resultFeatures.push(feature);
          }
        }
      }, _this9);
    });
    return resultFeatures;
  };
  _proto._getAttributeNames = function _getAttributeNames(features) {
    var attributeNames = [];
    var properties = features[0].properties;
    properties && Object.keys(properties).forEach(function (field) {
      attributeNames.push(field);
    }, this);
    return attributeNames;
  };
  _proto._clearMarkers = function _clearMarkers() {
    if (this.markerList.length) {
      this.markerList.forEach(function (marker) {
        marker && marker.remove();
      });
      this.markerList = [];
    }
  };
  _proto._clearPopups = function _clearPopups() {
    if (this.popupList.length) {
      this.popupList.forEach(function (popup) {
        popup && popup.remove();
      });
      this.popupList = [];
    }
  };
  _proto._clearSearchResultLayer = function _clearSearchResultLayer() {
    if (this.map && this.map.getLayer('searchResultLayer')) {
      this.map.removeLayer('searchResultLayer');
      this.map.removeSource('searchResultLayer');
    }
  };
  _proto._resetSearchSourceData = function _resetSearchSourceData() {
    if (this.map && this.map.getSource('searchResultLayer')) {
      this.map.getSource('searchResultLayer').setData({
        type: 'FeatureCollection',
        features: []
      });
    }
  };
  _proto._reset = function _reset() {
    this._resetSearchSourceData();
    this._clearMarkers();
    this._clearPopups();
  };
  _proto.removed = function removed() {
    this.searchTaskId = 0;
    this.searchResult = {};
    this.errorSourceList = {};
    if (!this.options.resultRender) {
      this._clearSearchResultLayer();
      this._clearMarkers();
      this._clearPopups();
    }
  };
  return SearchViewModel;
}(_mapboxGlEnhance.default.Evented);

/***/ }),

/***/ 7:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_mixin/map-getter.js");

/***/ }),

/***/ 85:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_utils/iPortalDataService.js");

/***/ })

/******/ });