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 = 906);
/******/ })
/************************************************************************/
/******/ ({

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

/***/ 906:
/***/ (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));
__webpack_require__(5);
__webpack_require__(15);
var _Events2 = __webpack_require__(47);
var _util = __webpack_require__(12);
var _statistics = __webpack_require__(120);
var RestService = exports.default = /*#__PURE__*/function (_Events) {
  (0, _inheritsLoose2.default)(RestService, _Events);
  function RestService(options) {
    var _this;
    _this = _Events.call(this) || this;
    _this.eventTypes = ['getdatafailed', 'getdatasucceeded'];
    _this.options = options || {};
    return _this;
  }
  var _proto = RestService.prototype;
  _proto.setProxy = function setProxy(proxy) {
    this.options.proxy = proxy;
  }

  /**
   * @function RestService.prototype.getData
   * @description 请求数据。
   */;
  _proto.getData = function getData(data, queryInfo) {
    var _this2 = this;
    if (!data) {
      return;
    }
    // 如果是geojson
    if (typeof data === 'object') {
      this.transfromGeoJSON((0, _extends2.default)({}, data), queryInfo);
      return;
    }
    // 如果是url， 就发送请求
    var url = data;
    SuperMap.FetchRequest.get(url, null, {
      withoutFormatSuffix: true,
      proxy: this.options.proxy
    }).then(function (response) {
      return response.json();
    }).then(function (data) {
      if (!data) {
        // 请求失败
        _this2.triggerEvent('getdatafailed', {
          data: data
        });
      } else {
        var resData = Object.prototype.hasOwnProperty.call(data, 'data') ? data.data : data;
        _this2.transfromGeoJSON(resData, queryInfo);
      }
    }).catch(function (error) {
      console.log(error);
      _this2.triggerEvent('getdatafailed', {
        error: error
      });
    });
  };
  _proto.transfromGeoJSON = function transfromGeoJSON(resData, queryInfo) {
    var generateData = {
      type: 'FeatureCollection',
      features: []
    };
    var dataType = (0, _util.getDataType)(resData);
    var limitLen = (queryInfo || {}).maxFeatures;
    if (dataType !== '[object Object]' || !resData.type || resData.type !== 'FeatureCollection' || (0, _util.getDataType)(resData.features) !== '[object Array]') {
      generateData.features = this._generateData(resData, limitLen);
    } else {
      generateData = resData;
      generateData.features = this._generateData(resData.features, limitLen, false);
    }
    if (this.transformed) {
      generateData.transformed = this.transformed;
    }
    generateData.totalCount = generateData.features.length;
    var triggerData = Object.assign({}, generateData, (0, _statistics.statisticsFeatures)(generateData.features));
    this.triggerEvent('getdatasucceeded', triggerData);
  };
  _proto._generateData = function _generateData(data, limitLen, generateTransformed) {
    if (generateTransformed === void 0) {
      generateTransformed = true;
    }
    var dataType = (0, _util.getDataType)(data);
    var features = [];
    var subData;
    switch (dataType) {
      case '[object Number]':
      case '[object String]':
        var feature = {
          properties: {
            value: data
          }
        };
        features.push(feature);
        break;
      case '[object Array]':
        subData = limitLen && !isNaN(+limitLen) && limitLen < data.length ? data.slice(0, limitLen) : data;
        features = subData.map(function (item) {
          if ((0, _util.getDataType)(item) === '[object Object]' && Object.prototype.hasOwnProperty.call(item, 'properties') && (0, _util.getDataType)(item.properties) === '[object Object]') {
            return item;
          } else {
            var _feature = {
              properties: (0, _util.getDataType)(item) === '[object Object]' ? item : {
                value: item
              }
            };
            return _feature;
          }
        });
        break;
      case '[object Object]':
        subData = data;
        if (limitLen && !isNaN(+limitLen) && limitLen < Object.keys(data).length) {
          subData = Object.fromEntries(Object.entries(data).slice(0, limitLen));
        }
        if (!Object.prototype.hasOwnProperty.call(subData, 'properties') || (0, _util.getDataType)(subData.properties) !== '[object Object]') {
          if (generateTransformed) {
            this.transformed = true;
          }
          subData = {
            properties: subData
          };
        }
        features.push(subData);
        break;
    }
    return features;
  };
  return RestService;
}(_Events2.Events);

/***/ })

/******/ });