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

/***/ 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");

/***/ }),

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

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

/***/ }),

/***/ 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");

/***/ }),

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

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

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(3));
__webpack_require__(5);
__webpack_require__(15);
var _iServerRestService = _interopRequireWildcard(__webpack_require__(54));
var _util = __webpack_require__(12);
var _Events2 = __webpack_require__(47);
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/**
 * @class iPortalDataService
 * @classdesc iPortal 数据请求类。
 * @category  BaseTypes Util
 * @param {string} url - iPortal 数据地址。
 * @param {Boolean} [withCredentials=false] - 请求是否携带 cookie。
 * @fires iPortalDataService#getdatasucceeded
 * @fires iPortalDataService#getdatafailed
 * @fires iPortalDataService#featureisempty
 */
var iPortalDataService = exports.default = /*#__PURE__*/function (_Events) {
  (0, _inheritsLoose2.default)(iPortalDataService, _Events);
  function iPortalDataService(url, withCredentials, options) {
    var _this;
    if (options === void 0) {
      options = {};
    }
    _this = _Events.call(this) || this;
    _this.url = url;
    _this.withCredentials = withCredentials || false;
    _this.epsgCode = options.epsgCode;
    _this.iportalServiceProxyUrl = options.iportalServiceProxyUrl;
    _this.eventTypes = ['getdatasucceeded', 'getdatafailed', 'featureisempty'];
    _this.resourceId = options.resourceId;
    if (_this.resourceId) {
      _this.url = (0, _util.handleDataParentRes)(url, _this.resourceId, 'DATA');
    }
    _this.initSerivce(_this.url);
    return _this;
  }
  var _proto = iPortalDataService.prototype;
  _proto.initSerivce = function initSerivce(url) {
    var _this2 = this;
    this.iserverService = new _iServerRestService.default(url, {
      epsgCode: this.epsgCode
    });
    this.iserverService.on({
      getdatasucceeded: function getdatasucceeded(e) {
        /**
         * @event iPortalDataService#getdatasucceeded
         * @description 请求数据成功后触发。
         * @property {Object} e  - 事件对象。
         */
        _this2.triggerEvent('getdatasucceeded', e);
      },
      getdatafailed: function getdatafailed(e) {
        /**
         * @event iPortalDataService#getdatafailed
         * @description 请求数据失败后触发。
         * @property {Object} e  - 事件对象。
         */
        _this2.triggerEvent('getdatafailed', e);
      },
      featureisempty: function featureisempty(e) {
        /**
         * @event iPortalDataService#featureisempty
         * @description 请求数据为空后触发。
         * @property {Object} e  - 事件对象。
         */
        _this2.triggerEvent('featureisempty', e);
      }
    });
  }

  /**
   * @function iPortalDataService.prototype.getData
   * @description 请求数据。
   * @param {Object} queryInfo - 可选参数。
   * @param {Object} [queryInfo.maxFeatures] - 最多可返回的要素数量。
   * @param {Object} [queryInfo.attributeFilter] - 属性过滤条件。
   * @param {Object} [queryInfo.keyWord] - 筛选关键字。
   */;
  _proto.getData = function getData(queryInfo, preferContent) {
    var _this3 = this;
    if (preferContent === void 0) {
      preferContent = false;
    }
    if (!this.url) {
      return;
    }
    var datasetUrl = this.url;
    if (preferContent) {
      this._getDatafromContent(datasetUrl, queryInfo);
      return;
    }
    SuperMap.FetchRequest.get(datasetUrl, null, {
      withCredentials: this.withCredentials
    }).then(function (response) {
      return response.json();
    }).then(function (data) {
      if (data.succeed === false) {
        // 请求失败
        _this3.triggerEvent('getdatafailed', {
          data: data
        });
        return;
      }
      // 是否有rest服务
      if (data.dataItemServices && data.dataItemServices.length > 0) {
        var dataItemServices = data.dataItemServices;
        var resultData = dataItemServices.find(function (item) {
          return (item.serviceType === 'RESTDATA' || item.serviceType === 'RESTMAP') && item.serviceStatus === 'PUBLISHED';
        });
        // 有rest服务并且address不为空（online的address服务为''）
        if (resultData && resultData.address) {
          // 如果有服务，获取数据源和数据集, 然后请求rest服务
          var serviceUrl = resultData.address;
          if (_this3.resourceId) {
            serviceUrl = (0, _util.handleDataParentRes)(serviceUrl, _this3.resourceId, 'DATA');
          }
          _this3._getDatafromRest(resultData.serviceType, serviceUrl, queryInfo);
        } else {
          _this3._getDatafromContent(datasetUrl, queryInfo);
        }
      } else {
        _this3._getDatafromContent(datasetUrl, queryInfo);
      }
    }).catch(function (error) {
      console.log(error);
      _this3.triggerEvent('getdatafailed', {
        error: error
      });
    });
  };
  _proto._getDatafromRest = function _getDatafromRest(serviceType, address, queryInfo) {
    var _this4 = this;
    if (serviceType === 'RESTDATA') {
      var url = SuperMap.Util.urlPathAppend(address, 'data/datasources');
      var dataSourceName;
      var datasetName; // 请求获取数据源名
      SuperMap.FetchRequest.get(url, null, {
        withCredentials: (0, _util.handleWithCredentials)(url, this.iportalServiceProxyUrl, this.withCredentials)
      }).then(function (response) {
        return response.json();
      }).then(function (data) {
        dataSourceName = data.datasourceNames && data.datasourceNames[0];
        url = SuperMap.Util.urlPathAppend(address, "data/datasources/" + dataSourceName + "/datasets");
        // 请求获取数据集名
        SuperMap.FetchRequest.get(url, null, {
          withCredentials: (0, _util.handleWithCredentials)(url, _this4.iportalServiceProxyUrl, _this4.withCredentials)
        }).then(function (response) {
          return response.json();
        }).then(function (data) {
          datasetName = data.datasetNames[0];
          // 请求restdata服务
          _this4.iserverService.getDataFeatures({
            datasetName: datasetName,
            dataSourceName: dataSourceName,
            dataUrl: SuperMap.Util.urlPathAppend(address, 'data')
          }, Object.assign({}, queryInfo, {
            withCredentials: (0, _util.handleWithCredentials)(url, _this4.iportalServiceProxyUrl, _this4.withCredentials)
          }));
        }).catch(function (error) {
          console.log(error);
          _this4.triggerEvent('getdatafailed', {
            error: error
          });
        });
      });
    } else {
      // 如果是地图服务
      var _url = SuperMap.Util.urlPathAppend(address, 'maps');
      var mapName;
      var layerName;
      var path; // 请求获取地图名
      SuperMap.FetchRequest.get(_url, null, {
        withCredentials: (0, _util.handleWithCredentials)(_url, this.iportalServiceProxyUrl, this.withCredentials)
      }).then(function (response) {
        return response.json();
      }).then(function (data) {
        if (data[0]) {
          mapName = data[0].name;
          path = data[0].path;
          if (_this4.resourceId) {
            path = (0, _util.handleDataParentRes)(path, _this4.resourceId, 'DATA');
          }
        }
        _url = SuperMap.Util.urlPathAppend(address, "maps/" + mapName + "/layers");
        // 请求获取图层名
        SuperMap.FetchRequest.get(_url, null, {
          withCredentials: (0, _util.handleWithCredentials)(_url, _this4.iportalServiceProxyUrl, _this4.withCredentials)
        }).then(function (response) {
          return response.json();
        }).then(function (data) {
          layerName = data[0].subLayers.layers[0].caption;
          // 请求restmap服务
          _this4.iserverService.getMapFeatures({
            mapName: layerName,
            dataUrl: path
          }, Object.assign({}, queryInfo, {
            withCredentials: (0, _util.handleWithCredentials)(_url, _this4.iportalServiceProxyUrl, _this4.withCredentials)
          }));
          return layerName;
        }).catch(function (error) {
          console.log(error);
          _this4.triggerEvent('getdatafailed', {
            error: error
          });
        });
      }).catch(function (error) {
        console.log(error);
        _this4.triggerEvent('getdatafailed', {
          error: error
        });
      });
    }
  };
  _proto._getDatafromContent = function _getDatafromContent(datasetUrl, queryInfo) {
    var _this5 = this;
    var result = {};
    datasetUrl = SuperMap.Util.urlPathAppend(datasetUrl, 'content.json');
    datasetUrl = SuperMap.Util.urlAppend(datasetUrl, 'pageSize=9999999&currentPage=1');
    // 获取图层数据
    SuperMap.FetchRequest.get(datasetUrl, null, {
      withCredentials: this.withCredentials
    }).then(function (response) {
      return response.json();
    }).then(function (data) {
      if (data.succeed === false) {
        // 请求失败
        _this5.triggerEvent('getdatafailed', {
          data: data
        });
        return;
      }
      if (data.type) {
        var features;
        var type = 'FeatureCollection';
        if (data.type === 'JSON' || data.type === 'GEOJSON') {
          data.content = JSON.parse(data.content.trim());
          // 如果是json文件 data.content = {type:'fco', features},格式不固定
          if (!data.content.features) {
            features = _this5._json2Feature(data.content, queryInfo);
          }
          features = _this5._formatGeoJSON(features || data.content, queryInfo);
          type = data.content.type;
        } else if (data.type === 'EXCEL' || data.type === 'CSV') {
          features = _this5._excelData2Feature(data.content, queryInfo);
        } else if (data.type === 'SHP') {
          data.content = JSON.parse(data.content.trim());
          features = _this5._formatGeoJSON(data.content.layers[0]);
        }
        features = _this5._transformContentFeatures(features);
        result.features = {
          type: type,
          features: features
        };
        _this5.vertified && (result.vertified = _this5.vertified);
        _this5.iserverService._getFeaturesSucceed({
          result: result
        });
      }
    }).catch(function (error) {
      console.log(error);
      _this5.triggerEvent('getdatafailed', {
        error: error
      });
    });
  };
  _proto._formatGeoJSON = function _formatGeoJSON(data, queryInfo) {
    var features = data.features;
    if (queryInfo && queryInfo.maxFeatures > 0) {
      features = features.slice(0, queryInfo.maxFeatures);
    }
    features.forEach(function (row, index) {
      row.properties.index = index;
    });
    return features;
  };
  _proto._excelData2Feature = function _excelData2Feature(dataContent, queryInfo) {
    var fieldCaptions = dataContent.colTitles;
    // 位置属性处理
    var xfieldIndex = -1;
    var yfieldIndex = -1;
    for (var i = 0, _len = fieldCaptions.length; i < _len; i++) {
      if ((0, _util.isXField)(fieldCaptions[i])) {
        xfieldIndex = i;
      }
      if ((0, _util.isYField)(fieldCaptions[i])) {
        yfieldIndex = i;
      }
    }

    // feature 构建后期支持坐标系 4326/3857
    var features = [];
    var len = dataContent.rows.length;
    if (queryInfo && queryInfo.maxFeatures > 0 && len > queryInfo.maxFeatures) {
      len = queryInfo.maxFeatures;
    }
    for (var _i = 0; _i < len; _i++) {
      var row = dataContent.rows[_i];
      var x = xfieldIndex !== -1 && Number(row[xfieldIndex]);
      var y = yfieldIndex !== -1 && Number(row[yfieldIndex]);
      // 属性信息
      var attributes = {};
      for (var index in dataContent.colTitles) {
        var key = dataContent.colTitles[index];
        attributes[key] = dataContent.rows[_i][index];
      }
      var feature = {
        type: 'Feature',
        properties: attributes
      };
      if (x && y) {
        attributes.index = _i + '';
        feature.geometry = {
          type: 'Point',
          coordinates: [x, y]
        };
      }
      // 目前csv 只支持处理点，所以先生成点类型的 geojson
      features.push(feature);
    }
    return features;
  };
  _proto._json2Feature = function _json2Feature(dataContent) {
    var content = typeof dataContent === 'string' ? JSON.parse(dataContent) : dataContent;
    var features = [];
    if (content instanceof Array) {
      content.forEach(function (val) {
        if (Object.prototype.hasOwnProperty.call(val, 'geometry')) {
          features.push({
            properties: val.properties || val,
            geometry: val.geometry
          });
        } else {
          features.push({
            properties: val
          });
        }
      });
    } else if (content) {
      features = [{
        properties: content
      }];
    }
    return {
      features: features
    };
  }

  // 转坐标系
  ;
  _proto._transformContentFeatures = function _transformContentFeatures(features) {
    var transformedFeatures = features;
    if (features && !!features.length) {
      var epsgCode = (0, _iServerRestService.vertifyEpsgCode)(features[0]);
      transformedFeatures = (0, _iServerRestService.transformFeatures)(epsgCode, features);
      this.vertified = true;
    }
    return transformedFeatures;
  };
  return iPortalDataService;
}(_Events2.Events);

/***/ })

/******/ });