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

/***/ 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
  }
}


/***/ }),

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

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

/***/ }),

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

module.exports = require("vue");

/***/ }),

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

/***/ 280:
/***/ (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_OpenFile_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(281);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_OpenFile_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_OpenFile_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_OpenFile_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_OpenFile_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_OpenFile_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _Theme = _interopRequireDefault(__webpack_require__(4));
var _control = _interopRequireDefault(__webpack_require__(17));
var _mapGetter = _interopRequireDefault(__webpack_require__(7));
var _OpenFileViewModel = _interopRequireDefault(__webpack_require__(686));
var _GeojsonLayer = _interopRequireDefault(__webpack_require__(396));
var _CircleStyle = _interopRequireDefault(__webpack_require__(33));
var _FillStyle = _interopRequireDefault(__webpack_require__(40));
var _LineStyle = _interopRequireDefault(__webpack_require__(41));
var _Message = _interopRequireDefault(__webpack_require__(26));
var _VmUpdater = _interopRequireDefault(__webpack_require__(30));
var _vue = _interopRequireDefault(__webpack_require__(13));
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _default2 = exports.default = {
  name: 'SmOpenFile',
  viewModelProps: ['fitBounds', 'clearLastLayer', 'addToMap'],
  mixins: [_Theme.default, _control.default, _mapGetter.default, _VmUpdater.default],
  props: {
    fitBounds: {
      type: Boolean,
      default: true
    },
    addToMap: {
      type: Boolean,
      default: true
    },
    text: {
      type: String,
      default: function _default() {
        return this.$t('openFile.openFile');
      }
    },
    notify: {
      type: Boolean,
      default: true
    },
    layerStyle: {
      type: Object,
      default: function _default() {
        return {
          line: new _LineStyle.default(),
          circle: new _CircleStyle.default(),
          fill: new _FillStyle.default()
        };
      }
    },
    clearLastLayer: {
      type: Boolean,
      default: false
    },
    accept: {
      type: Array,
      default: function _default() {
        return ['.json', '.geojson', '.csv', '.xlsx', '.xls', '.shp', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel'];
      }
    },
    fontStyle: {
      type: Object
    }
  },
  data: function data() {
    return {
      transformType: {
        Point: 'circle',
        Polygon: 'fill',
        LineString: 'line',
        MultiPolygon: 'fill'
      },
      cacheGeojsonLayer: [],
      mapboxglClass: ''
    };
  },
  created: function created() {
    this.viewModel = new _OpenFileViewModel.default();
    // 打开失败
    this.viewModel.on('openfilefailed', this.openfilefailedFn);
    this.viewModel.on('errorfileformat', this.errorfileformatFn);
    this.viewModel.on('openfilesucceeded', this.openfilesucceededFn);
  },
  beforeDestroy: function beforeDestroy() {
    this.viewModel.off('openfilefailed', this.openfilefailedFn);
    this.viewModel.off('errorfileformat', this.errorfileformatFn);
    this.viewModel.off('openfilesucceeded', this.openfilesucceededFn);
  },
  methods: {
    fileSelect: function fileSelect(e) {
      this.viewModel && this.viewModel.readFile(e);
    },
    preventDefault: function preventDefault(e) {
      var mapNotLoaded = this.mapNotLoadedTip();
      mapNotLoaded && e.preventDefault();
    },
    openfilefailedFn: function openfilefailedFn(e) {
      // @ts-ignore
      this.notify && _Message.default.error(e.message);
      this.$emit('open-file-failed', e);
    },
    errorfileformatFn: function errorfileformatFn(e) {
      // @ts-ignore
      this.notify && _Message.default.error(e.message);
      this.$emit('error-file-format', e);
    },
    openfilesucceededFn: function openfilesucceededFn(e) {
      var result = e.result;
      if (!result) {
        return;
      }
      if (!e.result.features.length) {
        (0, _Message.default)({
          message: this.$t('openFile.openEmptyFile'),
          type: 'error'
        });
        this.$emit('open-empty-file', result);
        return;
      }
      if (this.clearLastLayer) {
        var geojsonLayerInstance = this.cacheGeojsonLayer.pop();
        geojsonLayerInstance && geojsonLayerInstance.$destroy();
      }
      if (this.addToMap) {
        var type = this.transformType[result.features[0].geometry.type];
        var GeojsonLayerExtend = _vue.default.extend(_GeojsonLayer.default);
        var GeojsonLayerInstance = new GeojsonLayerExtend({
          propsData: {
            data: result,
            layerStyle: this.layerStyle[type],
            layerId: e.layerId
          }
        });
        var component = GeojsonLayerInstance.$mount();
        this.cacheGeojsonLayer.push(component);
        var mapTarget = this.getTargetName();
        var mapEle = document.querySelector("#" + mapTarget);
        if (mapEle) {
          mapEle.appendChild(component.$el);
        }
      }
      if (this.fitBounds && this.addToMap) {
        this.viewModel.fitBoundsToData();
      }
      // @ts-ignore
      this.notify && _Message.default.success(this.$t('openFile.openFileSuccess'));
      this.$emit('open-file-succeeded', result);
    }
  },
  loaded: function loaded() {
    this.parentIsWebMapOrMap && (this.mapboxglClass = 'mapboxgl-ctrl');
  },
  removed: function removed() {
    if (this.cacheGeojsonLayer && this.cacheGeojsonLayer.length) {
      this.cacheGeojsonLayer.forEach(function (component) {
        component.$destroy();
      });
      this.cacheGeojsonLayer = [];
    }
  }
};

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FileTypes = exports.FileConfig = void 0;
exports.getFileType = getFileType;
var FileTypes = exports.FileTypes = {
  EXCEL: 'EXCEL',
  CSV: 'CSV',
  ISERVER: 'ISERVER',
  GEOJSON: 'GEOJSON',
  JSON: 'JSON',
  SHP: 'SHP',
  ZIP: 'ZIP'
};
var FileConfig = exports.FileConfig = {
  fileMaxSize: 10 * 1024 * 1024
};
function getFileType(fileName) {
  var regCSV = /^.*\.(?:csv)$/i;
  var regExcel = /^.*\.(?:xls|xlsx)$/i; // 文件名可以带空格
  var regGeojson = /^.*\.(?:geojson|json)$/i;
  var regSHP = /^.*\.(?:shp)$/i;
  if (regExcel.test(fileName)) {
    // 校验不通过
    return FileTypes.EXCEL;
  } else if (regCSV.test(fileName)) {
    return FileTypes.CSV;
  } else if (regGeojson.test(fileName)) {
    return FileTypes.GEOJSON;
  } else if (regSHP.test(fileName)) {
    return FileTypes.SHP;
  }
  return null;
}

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _GeojsonLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _GeojsonLayer_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 _GeojsonLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
var render, staticRenderFns




/* normalize component */

var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(
  _GeojsonLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"],
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

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

/***/ }),

/***/ 397:
/***/ (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));
var _mapboxGlEnhance = _interopRequireDefault(__webpack_require__(5));
var GeojsonLayerViewModel = exports.default = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(GeojsonLayerViewModel, _mapboxgl$Evented);
  function GeojsonLayerViewModel(GeojsonLayerOptions) {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    var layerStyle = GeojsonLayerOptions.layerStyle,
      data = GeojsonLayerOptions.data,
      layerId = GeojsonLayerOptions.layerId;
    _this.data = data;
    _this.layerStyle = layerStyle;
    _this.layerId = layerId;
    return _this;
  }
  var _proto = GeojsonLayerViewModel.prototype;
  _proto.setMap = function setMap(mapInfo) {
    var map = mapInfo.map;
    if (!map) {
      throw new Error('map is requierd');
    }
    this.map = map;
    this._addLayer();
  };
  _proto.setData = function setData(data) {
    if (!data || !this.map.getSource(this.layerId)) {
      return;
    }
    this.data = data;
    if (this.layerId && !this.map.getSource(this.layerId)) {
      this._addLayer();
    } else {
      this.map.getSource(this.layerId).setData(data);
    }
  };
  _proto.setLayerStyle = function setLayerStyle(layerStyle) {
    if (!layerStyle || !this.map.getSource(this.layerId)) {
      return;
    }
    var paint = layerStyle.paint,
      layout = layerStyle.layout;
    for (var _i = 0, _Object$keys = Object.keys(paint); _i < _Object$keys.length; _i++) {
      var prop = _Object$keys[_i];
      this.map.setPaintProperty(this.layerId, prop, paint[prop]);
    }
    for (var _i2 = 0, _Object$keys2 = Object.keys(layout); _i2 < _Object$keys2.length; _i2++) {
      var _prop = _Object$keys2[_i2];
      this.map.setLayoutProperty(this.layerId, _prop, layout[_prop]);
    }
    this.layerStyle = layerStyle;
  };
  _proto._addLayer = function _addLayer() {
    if (!(this.layerStyle instanceof Object)) throw new Error('layerStyle 不能为空');
    var _this$layerStyle = this.layerStyle,
      paint = _this$layerStyle.paint,
      layout = _this$layerStyle.layout;
    this.map.addLayer({
      id: this.layerId,
      type: this._getLayerType(paint),
      source: {
        type: 'geojson',
        data: this.data
      },
      layout: layout || {},
      paint: paint || {}
    });
  };
  _proto._getLayerType = function _getLayerType(paint) {
    if (paint === void 0) {
      paint = {};
    }
    var keys = Object.keys(paint).join(' ');
    var reg = /circle-|line-|fill-extrusion-|fill-+/i;
    var matchType = keys.match(reg);
    var type = matchType ? matchType[0] : '';
    return type.substr(0, type.length - 1);
  };
  _proto.removed = function removed() {
    var map = this.map,
      layerId = this.layerId;
    if (map && layerId && map.getLayer(layerId)) {
      map.removeLayer(layerId);
    }
  };
  return GeojsonLayerViewModel;
}(_mapboxGlEnhance.default.Evented);

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

/***/ 445:
/***/ (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/open-file/OpenFile.vue?vue&type=template&id=a1dd1ffe&
var render = function () {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    {
      class: ["sm-component-open-file", _vm.mapboxglClass],
      style: [_vm.fontStyle],
    },
    [
      _c(
        "label",
        {
          staticClass: "sm-component-open-file__title",
          attrs: { for: "input_file" },
        },
        [_c("span", [_vm._v(_vm._s(_vm.text))])]
      ),
      _c("input", {
        staticClass: "sm-component-open-file__input",
        attrs: { id: "input_file", type: "file", accept: _vm.accept },
        on: {
          change: function ($event) {
            return _vm.fileSelect($event)
          },
          click: _vm.preventDefault,
        },
      }),
    ]
  )
}
var staticRenderFns = []
render._withStripped = true


// CONCATENATED MODULE: ./src/mapboxgl/open-file/OpenFile.vue?vue&type=template&id=a1dd1ffe&


/***/ }),

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

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

/***/ }),

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

"use strict";


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

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _OpenFile_vue_vue_type_template_id_a1dd1ffe___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(445);
/* harmony import */ var _OpenFile_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(280);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _OpenFile_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 _OpenFile_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"])(
  _OpenFile_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  _OpenFile_vue_vue_type_template_id_a1dd1ffe___WEBPACK_IMPORTED_MODULE_0__[/* render */ "a"],
  _OpenFile_vue_vue_type_template_id_a1dd1ffe___WEBPACK_IMPORTED_MODULE_0__[/* staticRenderFns */ "b"],
  false,
  null,
  null,
  null
  
)

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

/***/ }),

/***/ 686:
/***/ (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));
var _mapboxGlEnhance = _interopRequireDefault(__webpack_require__(5));
var _FileModel = _interopRequireDefault(__webpack_require__(687));
var _FileTypes = __webpack_require__(395);
var _FileReaderUtil = _interopRequireDefault(__webpack_require__(688));
var _index = __webpack_require__(16);
var _bbox = _interopRequireDefault(__webpack_require__(34));
var _lodash = _interopRequireDefault(__webpack_require__(21));
/**
 * @class OpenFileViewModel
 * @param {mapboxgl.map} map - mapboxgl map 对象。
 * @description OpenFile viewModel.
 * @extends mapboxgl.Evented
 */
var OpenFileViewModel = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(OpenFileViewModel, _mapboxgl$Evented);
  function OpenFileViewModel() {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    _this.prevLayerId = '';
    _this.geojson = null;
    _this.fileModel = new _FileModel.default();
    return _this;
  }
  var _proto = OpenFileViewModel.prototype;
  _proto.setMap = function setMap(mapInfo) {
    var map = mapInfo.map;
    this.map = map;
  };
  _proto.setClearLastLayer = function setClearLastLayer(clearLastLayer) {
    this.clearLastLayer = clearLastLayer;
  };
  _proto.setFitBounds = function setFitBounds(fitBounds) {
    this.fitBounds = fitBounds;
  };
  _proto.setAddToMap = function setAddToMap(addToMap) {
    this.addToMap = addToMap;
  };
  _proto.readFile = function readFile(fileEventObject) {
    var inputDom = fileEventObject.target;
    var file = inputDom.files[0];
    var filePath = inputDom.value;
    var fileName = file && file.name;
    var fileType = (0, _FileTypes.getFileType)(fileName);
    if (!filePath) {
      return;
    }

    // 文件格式不支持
    if (!fileType) {
      /**
       * @event errorfileformat
       * @description 文件格式不支持时触发。
       * @property {string} messageType - 警告类型。
       * @property {string} message - 警告内容。
       */
      this.fire('errorfileformat', {
        messageType: 'failure',
        message: (0, _index.geti18n)().t("openFile.fileTypeUnsupported")
      });
      return false;
    }
    // 文件类型限制
    if (fileName !== '') {
      // 给control 一份数据
      // todo MVVM模式 应该是数据变化触发数据变化的事件
      this.fileModel.set('loadFileObject', {
        file: file,
        filePath: filePath,
        fileName: fileName,
        fileType: fileType
      });
      // 响应选中文件添加到地图
      this._readData();
    }
  };
  _proto.getUniqueId = function getUniqueId() {
    return (0, _lodash.default)("layer-smopenfile-");
  };
  _proto.fitBoundsToData = function fitBoundsToData() {
    this.map.fitBounds((0, _bbox.default)(this.geojson), {
      maxZoom: 12
    });
  };
  _proto._readData = function _readData() {
    var _this2 = this;
    // todo 需要测试另外两个
    var me = this;
    var type = this.fileModel.loadFileObject.fileType;
    _FileReaderUtil.default.readFile(type, {
      file: this.fileModel.loadFileObject.file,
      path: this.fileModel.loadFileObject.filePath
    }, function (data) {
      // 将数据统一转换为 geoJson 格式加载到底图
      _FileReaderUtil.default.processDataToGeoJson(type, data, function (geojson) {
        if (geojson) {
          /**
           * @event openfilesucceeded
           * @description 打开文件成功。
           * @property {GeoJSONObject} result - GeoJSON 格式数据。
           * @property {string} layerName - 图层名。
           */
          _this2.geojson = geojson;
          var layerId = _this2.getUniqueId();
          if (_this2.clearLastLayer) {
            if (_this2.prevLayerId && _this2.map.getLayer(_this2.prevLayerId)) {
              _this2.map.removeLayer(_this2.prevLayerId);
            }
          }
          _this2.prevLayerId = layerId;
          // bounds
          _this2.fire('openfilesucceeded', {
            result: geojson,
            layerId: layerId,
            layerName: _this2.fileModel.loadFileObject.fileName.split('.')[0]
          });
        }
      }, function (e) {
        /**
         * @event openfilefailed
         * @description 打开文件失败。
         * @property {String} messageType - 信息类型。
         * @property {Object} message - e。
         */
        me.fire('openfilefailed', {
          messageType: 'failure',
          message: e
        });
      }, _this2);
    }, function (e) {
      /**
       * @event openfilefailed
       * @description 打开文件失败。
       * @property {String} messageType - 信息类型。
       * @property {String} message - 失败信息。
       */
      me.fire('openfilefailed', {
        messageType: 'failure',
        message: (0, _index.geti18n)().t("openFile.openFileFail") + " " + e.message
      });
    }, this);
  };
  return OpenFileViewModel;
}(_mapboxGlEnhance.default.Evented);
var _default = exports.default = OpenFileViewModel;

/***/ }),

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

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _FileTypes = __webpack_require__(395);
/**
 * @class FileModel
 * @description 文件数据组件数据模型，用于存储一些文件数据或状态，todo 结构待完善
 * @category Components OpenFile
 * @private
 */
var FileModel = exports.default = /*#__PURE__*/function () {
  function FileModel(options) {
    this.fileTypes = _FileTypes.FileTypes;
    this.fileConfig = _FileTypes.FileConfig;
    this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  }

  /**
     * @function FileModel.prototype.set
     * @description 设置属性值
     * @param {string} key - 属性名称
     * @param {string|Object} value - 属性值
     */
  var _proto = FileModel.prototype;
  _proto.set = function set(key, value) {
    this[key] = value;
  }

  /**
     * @function FileModel.prototype.get
     * @description 获取数据值
     * @param {string} key - 属性名称
     * @returns {string|Object} value - 返回属性值
     */;
  _proto.get = function get(key) {
    return this[key];
  };
  return FileModel;
}();

/***/ }),

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

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var XLSX = _interopRequireWildcard(__webpack_require__(689));
var _FileTypes = __webpack_require__(395);
var _shapefile = __webpack_require__(690);
var _geometryUtil = __webpack_require__(86);
var _util = __webpack_require__(12);
var _index = __webpack_require__(16);
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; }
var FileReaderUtil = {
  rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  /**
   * @function SuperMap.Components.FileReaderUtil.prototype.readFile
   * @description 读取文件
   * @param {string} fileType - 当前读取的文件类型
   *
   * @param {Object} file - 读取回来的文件内容对象
   * @param {function} success - 读取文件成功回调函数
   * @param {function} failed - 读取文件失败回调函数
   * @param {Object} context - 回调重定向对象
   */
  readFile: function readFile(fileType, file, success, failed, context) {
    if (_FileTypes.FileTypes.JSON === fileType || _FileTypes.FileTypes.GEOJSON === fileType) {
      this.readTextFile(file, success, failed, context);
    } else if (_FileTypes.FileTypes.EXCEL === fileType || _FileTypes.FileTypes.CSV === fileType) {
      this.readXLSXFile(file, success, failed, context);
    } else if (_FileTypes.FileTypes.SHP === fileType) {
      this.readShpFile(file, success, failed, context);
    }
  },
  /**
   * 读取文本文件
   * @param file
   * @param success
   * @param failed
   * @param {Object} context - 回调重定向对象
   */
  readTextFile: function readTextFile(file, success, failed, context) {
    var reader = new FileReader();
    reader.onloadend = function (evt) {
      success && success.call(context, evt.target.result);
    };
    reader.onerror = function (error) {
      failed && failed.call(context, error);
    };
    this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  },
  /**
   * 读取excel或csv文件
   * @param file
   * @param success
   * @param failed
   * @param {Object} context - 回调重定向对象
   */
  readXLSXFile: function readXLSXFile(file, success, failed, context) {
    var reader = new FileReader();
    reader.onloadend = function (evt) {
      var xLSXData = new Uint8Array(evt.target.result);
      var workbook = XLSX.read(xLSXData, {
        type: 'array'
      });
      try {
        if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
          // 暂时只读取第一个sheets的内容
          var sheetName = workbook.SheetNames[0];
          var xLSXCSVString = XLSX.utils.sheet_to_csv(workbook.Sheets[sheetName]);
          success && success.call(context, xLSXCSVString);
        }
      } catch (error) {
        failed && failed.call(context, error);
      }
    };
    reader.onerror = function (error) {
      failed && failed.call(context, error);
    };
    this.rABF && reader.readAsArrayBuffer(file.file);
  },
  readShpFile: function readShpFile(file, success, failed, context) {
    var reader = new FileReader();
    reader.onloadend = function (evt) {
      var geojson = [];
      (0, _shapefile.open)(evt.target.result).then(function (source) {
        source.read().then(function log(result) {
          if (result.done) return;
          geojson.push(result.value);
          return source.read().then(log);
        }).then(function () {
          success.call(context, geojson);
        });
      }).catch(function (error) {
        return console.error(error.stack);
      });
    };
    reader.onerror = function (error) {
      failed && failed.call(context, error);
    };
    this.rABF && reader.readAsArrayBuffer(file.file);
  },
  /**
   * @function SuperMap.Components.FileReaderUtil.prototype.processDataToGeoJson
   * @description 将读取回来得数据统一处理为 GeoJSON 格式
   * @param {string} type - 文件类型
   * @param {Object} data - 读取返回的数据对象
   * @param {function} success - 数据处理成功的回调
   * @param {function} failed - 数据处理失败的回调
   * @param {Object} context - 回调重定向对象
   * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
   * @private
   */
  processDataToGeoJson: function processDataToGeoJson(type, data, success, failed, context) {
    var geojson = null;
    if (type === 'EXCEL' || type === 'CSV') {
      geojson = this.processExcelDataToGeoJson(data);
      geojson = Array.isArray(geojson) ? this.toGeoJSON(geojson) : geojson;
    } else if (type === 'JSON' || type === 'GEOJSON' || type === 'SHP' || type === 'ZIP') {
      var result = data;
      result = Array.isArray(result) ? this.toGeoJSON(result) : result;
      // geojson、json未知，通过类容来判断
      if (typeof result === 'string') {
        result = JSON.parse(result);
      }
      if (result.type === 'ISERVER') {
        geojson = result.data.recordsets[0].features;
      } else if (result.type === 'FeatureCollection') {
        // geojson
        geojson = result;
      } else {
        // 不支持数据
        failed && failed.call(context, (0, _index.geti18n)().t("openFile.fileTypeUnsupported"));
        return;
      }
    } else {
      failed && failed.call(context, '数据格式化错误');
      return;
    }
    if (geojson.features[0]) {
      var geometryType = geojson.features[0].geometry.type;
      if (geometryType === 'Polygon' || geometryType === 'MultiPolygon') {
        geojson.features = (0, _geometryUtil.handleMultyPolygon)(geojson.features);
      }
    }
    success && success.call(context, geojson);
  },
  toGeoJSON: function toGeoJSON(features) {
    return {
      type: 'FeatureCollection',
      features: features
    };
  },
  /**
   * @function SuperMap.Components.FileReaderUtil.prototype.processExcelDataToGeoJson
   * @description 表格文件数据处理
   * @param {Object} data - 读取的表格文件数据
   * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
   * @private
   */
  processExcelDataToGeoJson: function processExcelDataToGeoJson(data) {
    // 处理为对象格式转化
    var dataContent = this.string2Csv(data);
    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 = [];
    for (var _i = 0, _len = dataContent.rows.length; _i < _len; _i++) {
      var row = dataContent.rows[_i];
      // if (featureFrom === "LonLat") {
      var x = Number(row[xfieldIndex]);
      var y = Number(row[yfieldIndex]);

      // 属性信息
      var attributes = {};
      for (var index in dataContent.colTitles) {
        var key = dataContent.colTitles[index];
        attributes[key] = dataContent.rows[_i][index];
      }

      // 目前csv 只支持处理点，所以先生成点类型的 geojson
      var feature = {
        type: 'Feature',
        geometry: {
          type: 'Point',
          coordinates: [x, y]
        },
        properties: attributes
      };
      features.push(feature);
    }
    return features;
  },
  /**
   * 字符串转为dataEditor 支持的csv格式数据
   * @param string
   * @param withoutTitle
   */
  string2Csv: function string2Csv(string, withoutTitle) {
    // let rows = string.split('\r\n');
    var rows = string.split('\n');
    var result = {};
    if (!withoutTitle) {
      result.colTitles = rows[0].split(',');
    } else {
      result.colTitles = [];
    }
    result.rows = [];
    for (var i = withoutTitle ? 0 : 1; i < rows.length; i++) {
      rows[i] && result.rows.push(rows[i].split(','));
    }
    return result;
  }
};
var _default = exports.default = FileReaderUtil;

/***/ }),

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

module.exports = require("xlsx");

/***/ }),

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

module.exports = require("shapefile");

/***/ }),

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

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

/***/ }),

/***/ 70:
/***/ (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_GeojsonLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_GeojsonLayer_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_GeojsonLayer_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_GeojsonLayer_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_GeojsonLayer_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_GeojsonLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _mapGetter = _interopRequireDefault(__webpack_require__(7));
var _layer = _interopRequireDefault(__webpack_require__(20));
var _GeojsonLayerViewModel = _interopRequireDefault(__webpack_require__(397));
var _default = exports.default = {
  name: 'SmGeojsonLayer',
  mixins: [_mapGetter.default, _layer.default],
  props: {
    layerStyle: {
      type: Object
    },
    data: {
      type: [Object, String]
    }
  },
  watch: {
    layerStyle: {
      handler: function handler() {
        this.viewModel && this.viewModel.setLayerStyle(this.layerStyle);
      },
      deep: true
    },
    data: {
      handler: function handler() {
        this.viewModel && this.viewModel.setData(this.data);
      },
      deep: true
    }
  },
  created: function created() {
    this.viewModel = new _GeojsonLayerViewModel.default(this.$props);
  },
  render: function render() {}
};

/***/ }),

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

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

/***/ })

/******/ });