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

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


/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

/***/ }),

/***/ 318:
/***/ (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_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(319);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_TrackLayer_vue_vue_type_script_lang_ts___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_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
 /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

/***/ 319:
/***/ (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 _vuePropertyDecorator = __webpack_require__(9);
var _mapGetter = _interopRequireDefault(__webpack_require__(7));
var _VmUpdater = _interopRequireDefault(__webpack_require__(30));
var _TrackLayerViewModel = _interopRequireDefault(__webpack_require__(755));
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
  var c = arguments.length,
    r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
    d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var TrackLayer = /*#__PURE__*/function (_Mixins) {
  (0, _inheritsLoose2.default)(TrackLayer, _Mixins);
  function TrackLayer() {
    return _Mixins.apply(this, arguments) || this;
  }
  var _proto = TrackLayer.prototype;
  _proto.created = function created() {
    this.viewModel = new _TrackLayerViewModel.default(this.$props);
  };
  _proto.reset = function reset() {
    this.viewModel && this.viewModel.reset();
  };
  _proto.render = function render() {};
  return TrackLayer;
}((0, _vuePropertyDecorator.Mixins)(_mapGetter.default, _VmUpdater.default));
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "layerId", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "loaderType", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "url", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "displayLine", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "layerStyle", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "trackPoints", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "position", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "direction", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "unit", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)({
  default: 1
})], TrackLayer.prototype, "scale", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "fitBounds", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], TrackLayer.prototype, "followCamera", void 0);
TrackLayer = __decorate([(0, _vuePropertyDecorator.Component)({
  name: 'SmTrackLayer',
  viewModelProps: ['loaderType', 'url', 'displayLine', 'trackPoints', 'position', 'layerStyle', 'direction', 'unit', 'scale', 'fitBounds', 'followCamera']
})], TrackLayer);
var _default = exports.default = TrackLayer;

/***/ }),

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

module.exports = require("three");

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

"use strict";


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

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(318);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _TrackLayer_vue_vue_type_script_lang_ts___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"])(
  _TrackLayer_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__["default"],
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

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

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(24));
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(3));
var _mapboxGlEnhance = _interopRequireDefault(__webpack_require__(5));
var THREE = _interopRequireWildcard(__webpack_require__(403));
var _GLTFLoader = __webpack_require__(756);
var _wwobjloader = __webpack_require__(757);
var _pointGeometry = _interopRequireDefault(__webpack_require__(758));
var _rhumbBearing = _interopRequireDefault(__webpack_require__(759));
var _lodash = _interopRequireDefault(__webpack_require__(21));
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 TrackLayerViewModel = exports.default = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(TrackLayerViewModel, _mapboxgl$Evented);
  function TrackLayerViewModel(options) {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    _this.lineData = [];
    _this.layerStyle = {};
    _this.imageName = 'custom-image';
    _this.animateTime = 0;
    _this.animateRemaining = 0;
    _this.rotateFactor = 0;
    _this.layerId = options.layerId || (0, _lodash.default)("tracklayer-");
    _this.lineLayerId = _this.layerId + "-line";
    _this.layerStyle = options.layerStyle || {};
    _this.trackPoints = options.trackPoints;
    _this.position = options.position;
    _this.options = {
      loaderType: options.loaderType,
      url: options.url,
      displayLine: options.displayLine,
      direction: options.direction,
      unit: options.unit,
      scale: options.scale,
      fitBounds: options.fitBounds,
      followCamera: options.followCamera
    };
    _this._initPosition();
    _this._animateLayerFn = _this._animateLayer.bind((0, _assertThisInitialized2.default)(_this));
    return _this;
  }
  var _proto = TrackLayerViewModel.prototype;
  _proto.setMap = function setMap(mapInfo) {
    var map = mapInfo.map;
    if (!map) {
      throw new Error('map is requierd');
    }
    this.map = map;
    this._init(true);
  };
  _proto.setLoaderType = function setLoaderType(loaderType) {
    var _this2 = this;
    this.options.loaderType = loaderType;
    if (!loaderType) {
      this.removeSourceAndLayer();
      return;
    }
    if (!this.map) {
      return;
    }
    setTimeout(function () {
      _this2._init(true);
    }, 0);
  };
  _proto.setUrl = function setUrl(url) {
    var _this3 = this;
    this.options.url = url;
    if (!url) {
      this.removeSourceAndLayer();
      return;
    }
    if (!this.map || !this.options.loaderType) {
      return;
    }
    if (this.options.loaderType === 'IMAGE') {
      this.map.loadImage(url, function (error, image) {
        if (error) {
          console.error(error);
          return;
        }
        if (_this3.map.hasImage(_this3.imageName)) {
          _this3.map.removeImage(_this3.imageName);
          _this3.imageName = 'custom-image-' + new Date().getTime();
          _this3.map.addImage(_this3.imageName, image);
          _this3.map.setLayoutProperty(_this3.layerId, 'icon-image', _this3.imageName);
        } else {
          _this3._init();
        }
      });
    } else {
      this._init(true);
    }
  };
  _proto.setDisplayLine = function setDisplayLine(displayLine) {
    this.options.displayLine = displayLine;
    var lineSource = this.map && this.map.getSource(this.lineLayerId);
    if (!lineSource) {
      return;
    }
    this._addTrackLineLayer();
  };
  _proto.setTrackPoints = function setTrackPoints(trackPoints) {
    this.trackPoints = trackPoints;
    if (!this.map) {
      return;
    }
    if (!trackPoints) {
      this.removeSourceAndLayer();
      return;
    }
    this.lineData = (this.trackPoints || []).map(function (item) {
      return item.geometry.coordinates;
    });
    this._init(true);
  };
  _proto.setPosition = function setPosition(timestampInfo) {
    if (!this.trackPoints) {
      return;
    }
    this.animationFrameId && cancelAnimationFrame(this.animationFrameId);
    this.originStartTimestamp = this.position && this.position.prevTimestamp;
    this.originNextTimestamp = this.position && this.position.nextTimestamp;
    this.position = timestampInfo;
    var destCoordinates, matchNextPosition, matchStartPosition, animateStep;
    var matchNextPositionIndex = this.trackPoints.findIndex(function (item) {
      return item.properties.timestamp > timestampInfo.currentTimestamp;
    });
    if (matchNextPositionIndex > -1) {
      matchNextPosition = this.trackPoints[matchNextPositionIndex];
      matchStartPosition = this.trackPoints[matchNextPositionIndex - 1];
      destCoordinates = matchNextPosition.geometry.coordinates;
      this.destPosition = destCoordinates;
      this.destTimestamp = matchNextPosition.properties.timestamp;
      this.startTimestamp = matchStartPosition.properties.timestamp;
    }
    if (this.originStartTimestamp !== timestampInfo.prevTimestamp) {
      this.animateRemaining = 0;
      var matchCurrentPosition = this.trackPoints.find(function (item) {
        return item.properties.timestamp === timestampInfo.currentTimestamp;
      });
      if (matchCurrentPosition) {
        this.startPosition = matchCurrentPosition.geometry.coordinates;
      } else if (destCoordinates) {
        var totalTime = matchNextPosition.properties.timestamp - this.startTimestamp;
        var diff = timestampInfo.currentTimestamp - this.startTimestamp;
        var percent = diff / totalTime;
        this.startPosition = this._getWayPoint(percent, matchStartPosition.geometry.coordinates, destCoordinates);
      }
      this.lineData = this.trackPoints.slice(0, matchNextPositionIndex).map(function (item) {
        return item.geometry.coordinates;
      });
      this._setRotateFactor();
      this._initLayer(this.startPosition);
    } else if (!timestampInfo.nextTimestamp && this.animateRemaining > 0) {
      animateStep = this.animateRemaining;
    }
    if (timestampInfo.nextTimestamp && destCoordinates) {
      if (timestampInfo.currentTimestamp === timestampInfo.prevTimestamp) {
        var stepBetweenNearPoints = timestampInfo.nextTimestamp - timestampInfo.currentTimestamp;
        var _totalTime = this.destTimestamp - timestampInfo.currentTimestamp;
        var intervals = _totalTime / stepBetweenNearPoints;
        animateStep = animateStep || intervals * timestampInfo.step;
      } else {
        animateStep = animateStep || this.destTimestamp - this.startTimestamp;
      }
      this.animateStep = animateStep;
      this.animateTime = performance.now() + animateStep;
      this._setRotateFactor();
      this._animateLayer();
    } else if (this.destPosition && this.originNextTimestamp) {
      this.destPosition = null;
    }
  };
  _proto.setLayerStyle = function setLayerStyle(layerStyle) {
    this.layerStyle = layerStyle;
    if (!layerStyle || !this.map.getSource(this.lineLayerId)) {
      return;
    }
    var _layerStyle$line = layerStyle.line,
      paint = _layerStyle$line.paint,
      layout = _layerStyle$line.layout;
    if (paint) {
      for (var _i = 0, _Object$keys = Object.keys(paint); _i < _Object$keys.length; _i++) {
        var prop = _Object$keys[_i];
        this.map.setPaintProperty(this.lineLayerId, prop, paint[prop]);
      }
    }
    if (layout) {
      for (var _i2 = 0, _Object$keys2 = Object.keys(layout); _i2 < _Object$keys2.length; _i2++) {
        var _prop = _Object$keys2[_i2];
        this.map.setLayoutProperty(this.lineLayerId, _prop, layout[_prop]);
      }
    }
  };
  _proto.setDirection = function setDirection(direction) {
    this.options.direction = direction;
    this._init();
  };
  _proto.setUnit = function setUnit(unit) {
    this.options.unit = unit;
    this._init(true);
  };
  _proto.setScale = function setScale(scale) {
    this.options.scale = isNaN(+scale) ? 0 : +scale;
    this._init(true);
  };
  _proto.setFitBounds = function setFitBounds(fitBounds) {
    this.options.fitBounds = fitBounds;
    this._init(true);
  };
  _proto.setFollowCamera = function setFollowCamera(followCamera) {
    this.options.followCamera = followCamera;
  };
  _proto._initPosition = function _initPosition() {
    var _this4 = this;
    if (this.position && this.trackPoints) {
      var matchStartPositionIndex = this.trackPoints.findIndex(function (item) {
        return item.properties.timestamp >= _this4.position.currentTimestamp;
      });
      var matchStartPosition = matchStartPositionIndex > -1 ? this.trackPoints[matchStartPositionIndex] : this.trackPoints[0];
      if (matchStartPosition) {
        this.startPosition = matchStartPosition.geometry.coordinates;
        var nextPosition;
        if (this.position.nextTimestamp) {
          var matchNextPosition = this.trackPoints.find(function (item) {
            return item.properties.timestamp > _this4.position.nextTimestamp;
          });
          matchNextPosition && (nextPosition = matchNextPosition.geometry.coordinates);
        }
        if (!nextPosition && this.trackPoints[matchStartPositionIndex + 1]) {
          this.destPosition = this.trackPoints[matchStartPositionIndex + 1].geometry.coordinates;
        }
      }
    }
  };
  _proto._setRotateFactor = function _setRotateFactor() {
    var pointInfo = this._getPointInfo();
    this.rotateFactor = 0;
    if (pointInfo) {
      var startPoint = pointInfo.startPoint;
      var endPoint = pointInfo.endPoint;
      var rad = Math.atan((endPoint.y - startPoint.y) / (endPoint.x - startPoint.x));
      if (endPoint.x - startPoint.x < 0) {
        rad = Math.PI + rad;
      }
      this.rotateFactor = isNaN(rad) ? 0 : -rad;
    }
    if (this.map) {
      var bearing = this.map.getBearing() * Math.PI / 180;
      this.rotateFactor -= bearing;
    }
  };
  _proto._init = function _init(removedLayer) {
    if (removedLayer) {
      this.removeSourceAndLayer();
      this._initPosition();
    }
    this._setRotateFactor();
    this._initLayer();
  };
  _proto._getWayPoint = function _getWayPoint(percent, startPosition, destPosition) {
    var pointInfo = this._getPointInfo(startPosition, destPosition);
    if (pointInfo) {
      var startPoint = pointInfo.startPoint;
      var endPoint = pointInfo.endPoint;
      var nextPoint = endPoint.sub(startPoint).mult(percent).add(startPoint);
      var nextPosition = this.map.unproject(nextPoint).toArray();
      return nextPosition;
    }
  };
  _proto._animateLayer = function _animateLayer() {
    var remaining, gone, percent;
    if (this.position.currentTimestamp === this.position.prevTimestamp) {
      var now = performance.now();
      remaining = this.animateTime - now;
      gone = this.animateStep - remaining;
      percent = gone / this.animateStep;
    } else {
      remaining = this.destTimestamp - this.position.currentTimestamp;
      gone = this.position.currentTimestamp - this.position.prevTimestamp;
      percent = gone / this.animateStep;
    }
    if (this.animateRemaining !== remaining && remaining > 0) {
      this.animateRemaining = remaining;
      var nextPosition = this._getWayPoint(percent);
      if (nextPosition) {
        this.lineData.push(nextPosition);
        this._initLayer(nextPosition);
      }
      this.animationFrameId = requestAnimationFrame(this._animateLayerFn);
    } else {
      cancelAnimationFrame(this.animationFrameId);
    }
  };
  _proto._initLayer = function _initLayer(positionCoordinate) {
    if (positionCoordinate === void 0) {
      positionCoordinate = this.currentPosition;
    }
    var position = positionCoordinate || this.startPosition;
    if (!this.map) {
      return;
    }
    if (position && this.options.url && this.options.loaderType) {
      if (this.options.followCamera) {
        var options = {
          center: position,
          pitch: 60
        };
        if (this.startPosition && this.destPosition) {
          options.bearing = (0, _rhumbBearing.default)(this.startPosition, this.destPosition);
        }
        this.map.easeTo(options);
      }
      switch (this.options.loaderType) {
        case 'GLTF':
        case 'OBJ2':
          this._addCustomLayer(position);
          break;
        case 'IMAGE':
          this._addImageLayer(position);
      }
    }
    this._addTrackLineLayer();
  };
  _proto._addCustomLayer = function _addCustomLayer(positionCoordinate) {
    var _this5 = this;
    this.currentPosition = positionCoordinate;
    this.modelTransform = this._getModelTransform(positionCoordinate);
    if (!this.map.getLayer(this.layerId)) {
      var customLayer = {
        id: this.layerId,
        type: 'custom',
        renderingMode: '3d',
        onAdd: function onAdd(map, gl) {
          _this5.camera = new THREE.Camera();
          _this5.scene = new THREE.Scene();
          var directionalLight = new THREE.DirectionalLight(0xffffff);
          directionalLight.position.set(0, -70, 100).normalize();
          _this5.scene.add(directionalLight);
          var directionalLight2 = new THREE.DirectionalLight(0xfffffff);
          directionalLight2.position.set(0, 70, 100).normalize();
          _this5.scene.add(directionalLight2);
          _this5._dealWithLoader();
          _this5.map = map;
          _this5.renderer = new THREE.WebGLRenderer({
            canvas: map.getCanvas(),
            context: gl,
            antialias: true
          });
          _this5.renderer.autoClear = false;
        },
        render: function render(gl, matrix) {
          var modelTransform = _this5.modelTransform;
          var rotationX = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(1, 0, 0), modelTransform.rotateX);
          var rotationY = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0, 1, 0), modelTransform.rotateY);
          var rotationZ = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0, 0, 1), modelTransform.rotateZ);
          var m = new THREE.Matrix4().fromArray(matrix);
          var l = new THREE.Matrix4().makeTranslation(modelTransform.translateX, modelTransform.translateY, modelTransform.translateZ).scale(new THREE.Vector3(modelTransform.scale, -modelTransform.scale, modelTransform.scale)).multiply(rotationX).multiply(rotationY).multiply(rotationZ);
          _this5.camera.projectionMatrix = m.multiply(l);
          _this5.renderer.resetState();
          _this5.renderer.render(_this5.scene, _this5.camera);
          _this5.map.triggerRepaint();
        }
      };
      this.map.addLayer(customLayer);
    }
  };
  _proto._addImageLayer = function _addImageLayer(positionCoordinate) {
    var _this6 = this;
    var url = this.options.url;
    var imageSource = this.map.getSource(this.layerId);
    var sourceData = {
      type: 'FeatureCollection',
      features: [{
        type: 'Feature',
        geometry: {
          type: 'Point',
          coordinates: positionCoordinate
        },
        properties: {}
      }]
    };
    if (imageSource) {
      imageSource.setData(sourceData);
    } else {
      if (!this.map.hasImage(this.imageName)) {
        this.map.loadImage(url, function (error, image) {
          if (error) {
            console.error(error);
            return;
          }
          _this6.map.addImage(_this6.imageName, image);
          _this6.map.addSource(_this6.layerId, {
            type: 'geojson',
            data: sourceData
          });
          _this6.map.addLayer({
            type: 'symbol',
            id: _this6.layerId,
            source: _this6.layerId,
            layout: {
              'icon-image': _this6.imageName,
              'icon-size': _this6.options.scale || 1,
              'icon-allow-overlap': true,
              'icon-ignore-placement': true
            }
          });
        });
      } else {
        this.map.addSource(this.layerId, {
          type: 'geojson',
          data: sourceData
        });
        this.map.addLayer({
          type: 'symbol',
          id: this.layerId,
          source: this.layerId,
          layout: {
            'icon-image': this.imageName,
            'icon-size': this.options.scale || 1
          }
        });
      }
    }
  };
  _proto._addTrackLineLayer = function _addTrackLineLayer() {
    var imageSource = this.map.getSource(this.lineLayerId);
    var features;
    if (!this.options.displayLine) {
      features = [];
    } else {
      var coordinates = this.lineData;
      if (this.options.displayLine === 'All') {
        coordinates = (this.trackPoints || []).map(function (item) {
          return item.geometry.coordinates;
        });
      }
      features = [{
        type: 'Feature',
        geometry: {
          type: 'LineString',
          coordinates: coordinates
        },
        properties: {}
      }];
    }
    var sourceData = {
      type: 'FeatureCollection',
      features: features
    };
    if (imageSource) {
      imageSource.setData(sourceData);
    } else {
      var lineStyle = this.layerStyle && this.layerStyle.line || {};
      this.map.addSource(this.lineLayerId, {
        type: 'geojson',
        data: sourceData
      });
      this.map.addLayer({
        type: 'line',
        id: this.lineLayerId,
        source: this.lineLayerId,
        layout: lineStyle.layout || {
          'line-cap': 'round',
          'line-join': 'round'
        },
        paint: lineStyle.paint || {
          'line-color': '#065726',
          'line-width': 5,
          'line-opacity': 0.8
        }
      }, this.map.getLayer(this.layerId) ? this.layerId : null);
    }
  };
  _proto._getFrontRotate = function _getFrontRotate(front) {
    var rotateInfo = {
      rotateAxisIndex: void 0,
      rotate: void 0
    };
    switch (front) {
      case '-x':
        rotateInfo.rotateAxisIndex = 2;
        rotateInfo.rotate = 180;
        break;
      case 'y':
        rotateInfo.rotateAxisIndex = 2;
        rotateInfo.rotate = -90;
        break;
      case '-y':
        rotateInfo.rotateAxisIndex = 2;
        rotateInfo.rotate = 90;
        break;
      case 'z':
        rotateInfo.rotateAxisIndex = 1;
        rotateInfo.rotate = 90;
        break;
      case '-z':
        rotateInfo.rotateAxisIndex = 1;
        rotateInfo.rotate = -90;
        break;
    }
    return rotateInfo;
  };
  _proto._getBottomRotate = function _getBottomRotate(bottom) {
    var rotateInfo = {
      originAxisIndex: void 0,
      rotateAxisIndex: void 0,
      rotate: void 0
    };
    switch (bottom) {
      case 'x':
        rotateInfo.originAxisIndex = 0;
        rotateInfo.rotateAxisIndex = 1;
        rotateInfo.rotate = 90;
        break;
      case '-x':
        rotateInfo.originAxisIndex = 0;
        rotateInfo.rotateAxisIndex = 1;
        rotateInfo.rotate = -90;
        break;
      case 'y':
        rotateInfo.originAxisIndex = 1;
        rotateInfo.rotateAxisIndex = 0;
        rotateInfo.rotate = -90;
        break;
      case '-y':
        rotateInfo.originAxisIndex = 1;
        rotateInfo.rotateAxisIndex = 0;
        rotateInfo.rotate = 90;
        break;
      case 'z':
        rotateInfo.originAxisIndex = 2;
        rotateInfo.rotateAxisIndex = 1;
        rotateInfo.rotate = 180;
        break;
    }
    return rotateInfo;
  };
  _proto._getModelTransform = function _getModelTransform(positionCoordinate) {
    var modelOrigin = positionCoordinate;
    var modelAltitude = 0;
    var modelRotate = [0, 0, 0];
    var _ref = this.options.direction || {
        front: null,
        bottom: null
      },
      front = _ref.front,
      bottom = _ref.bottom;
    var bottomAxisIndex = 2;
    if (front) {
      var rotateInfo = this._getFrontRotate(front);
      if (rotateInfo.rotateAxisIndex !== void 0) {
        modelRotate[rotateInfo.rotateAxisIndex] += rotateInfo.rotate * Math.PI / 180;
      }
    }
    if (bottom) {
      var _rotateInfo = this._getBottomRotate(bottom);
      if (_rotateInfo.rotateAxisIndex !== void 0) {
        modelRotate[_rotateInfo.rotateAxisIndex] += _rotateInfo.rotate * Math.PI / 180;
        bottomAxisIndex = _rotateInfo.originAxisIndex;
      }
    }
    modelRotate[bottomAxisIndex] += this.rotateFactor;
    var modelAsMercatorCoordinate = _mapboxGlEnhance.default.MercatorCoordinate.fromLngLat(modelOrigin, modelAltitude);
    var modelTransform = {
      translateX: modelAsMercatorCoordinate.x,
      translateY: modelAsMercatorCoordinate.y,
      translateZ: modelAsMercatorCoordinate.z,
      rotateX: modelRotate[0],
      rotateY: modelRotate[1],
      rotateZ: modelRotate[2],
      scale: modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()
    };
    return modelTransform;
  };
  _proto._getUnitFactor = function _getUnitFactor() {
    switch (this.options.unit) {
      case 'millimeter':
        return 1000;
      case 'centimeter':
        return 100;
      default:
        return 1;
    }
  };
  _proto._getMeterFactor = function _getMeterFactor() {
    var modelScale = this.options.scale;
    var scaleFactor;
    if (this.options.fitBounds) {
      scaleFactor = 1;
    } else {
      scaleFactor = modelScale || 1;
    }
    var unitFactor = this._getUnitFactor();
    var result = scaleFactor / unitFactor;
    return result;
  };
  _proto._getFitBoundsFactor = function _getFitBoundsFactor(scene, scaleFactor) {
    var bbox = new THREE.Box3().setFromObject(scene);
    var size = bbox.getSize(new THREE.Vector3());
    var maxSize = Math.max(size.x, size.y, size.z);
    var extent = this.map.getCRS().extent;
    var resolution = Math.max(extent[2] - extent[0], extent[3] - extent[2]) / 512 / Math.pow(2, this.map.getZoom());
    var canvasWidthDistance = resolution * this.map.getCanvas().width;
    var unitFactor = this._getUnitFactor();
    var result = scaleFactor * canvasWidthDistance / (maxSize / unitFactor) * 0.5;
    return result;
  };
  _proto._setMapZoom = function _setMapZoom(scene, scaleFactor) {
    var bbox = new THREE.Box3().setFromObject(scene);
    var size = bbox.getSize(new THREE.Vector3());
    var maxSize = Math.max(size.x, size.y, size.z);
    var extent = this.map.getCRS().extent;
    var maxExtent = Math.max(extent[2] - extent[0], extent[3] - extent[2]) / 512;
    var unitFactor = this._getUnitFactor();
    var resolution = maxSize / unitFactor * scaleFactor * 8 / this.map.getCanvas().width;
    var zoom = Math.log2(maxExtent / resolution);
    this.map.setZoom(zoom);
    this.map.setCenter(this.currentPosition);
  };
  _proto._getScaleFactor = function _getScaleFactor(scene) {
    var meterFactor = this._getMeterFactor();
    if (this.options.fitBounds) {
      return this._getFitBoundsFactor(scene, meterFactor);
    }
    this._setMapZoom(scene, this.options.scale);
    return meterFactor;
  };
  _proto._dealWithLoader = function _dealWithLoader() {
    var _this7 = this;
    var loader;
    switch (this.options.loaderType) {
      case 'GLTF':
        loader = new _GLTFLoader.GLTFLoader();
        loader.load(this.options.url, function (gltf) {
          var scaleFactor = _this7._getScaleFactor(gltf.scene);
          gltf.scene.scale.multiplyScalar(scaleFactor);
          _this7.scene.add(gltf.scene);
        }, function (xhr) {
          console.log(xhr.loaded / xhr.total * 100 + "% loaded");
        }, function (error) {
          console.error('An error happened', error);
        });
        break;
      case 'OBJ2':
        loader = new _wwobjloader.OBJLoader2();
        var material = new THREE.MeshBasicMaterial({
          color: 'red',
          wireframe: true
        });
        loader.load(this.options.url, function (object3d) {
          object3d = object3d.detail ? object3d.detail.loaderRootNode : object3d;
          var scaleFactor = _this7._getScaleFactor(object3d);
          object3d.scale.multiplyScalar(scaleFactor);
          if (loader.addMaterials) {
            loader.addMaterials({
              tester: material
            }, true);
          } else if (loader.setMaterials) {
            loader.setMaterials({
              tester: material
            }, true);
          }
          _this7.scene.add(object3d);
        }, function (xhr) {
          console.log(xhr.loaded / xhr.total * 100 + "% loaded");
        }, function (error) {
          console.error('An error happened', error);
        });
        break;
    }
  };
  _proto._getPointInfo = function _getPointInfo(startPosition, destPosition) {
    if (startPosition === void 0) {
      startPosition = this.startPosition;
    }
    if (destPosition === void 0) {
      destPosition = this.destPosition;
    }
    if (!startPosition || !destPosition || !this.map) {
      return;
    }
    var startPixelPoint = this.map.project(startPosition);
    var endPixelPoint = this.map.project(destPosition);
    var startPoint = new _pointGeometry.default(startPixelPoint.x, startPixelPoint.y);
    var endPoint = new _pointGeometry.default(endPixelPoint.x, endPixelPoint.y);
    return {
      startPoint: startPoint,
      endPoint: endPoint
    };
  };
  _proto.removeSourceAndLayer = function removeSourceAndLayer() {
    var map = this.map,
      layerId = this.layerId,
      lineLayerId = this.lineLayerId;
    if (map) {
      if (layerId) {
        map.getLayer(layerId) && map.removeLayer(layerId);
        map.getSource(layerId) && map.removeSource(layerId);
      }
      if (lineLayerId) {
        map.getLayer(lineLayerId) && map.removeLayer(lineLayerId);
        map.getSource(lineLayerId) && map.removeSource(lineLayerId);
        this.lineData = [];
      }
    }
  };
  _proto.removed = function removed() {
    this.removeSourceAndLayer();
    this.map = null;
  };
  _proto.reset = function reset() {
    this.lineData = [];
  };
  return TrackLayerViewModel;
}(_mapboxGlEnhance.default.Evented);

/***/ }),

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

module.exports = require("three/examples/jsm/loaders/GLTFLoader");

/***/ }),

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

module.exports = require("wwobjloader2");

/***/ }),

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

module.exports = require("@mapbox/point-geometry");

/***/ }),

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

module.exports = require("@turf/rhumb-bearing");

/***/ }),

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

module.exports = require("vue-property-decorator");

/***/ })

/******/ });