/**
 * vue-cesium - https://github.com/zouyaoji/vue-cesium
 * Vue 2.x components for CesiumJS.
 *
 * @package VueCesium
 * @author zouyaoji <370681295@qq.com>
 * @version 2.2.8
 * @license MIT
 * @homepage https://zouyaoji.top/vue-cesium
 * @copyright (c) 2018-2021, zouyaoji <370681295@qq.com>
 */
import _Object$defineProperties from '@babel/runtime-corejs2/core-js/object/define-properties';
import _regeneratorRuntime from '@babel/runtime-corejs2/regenerator';
import cmp from '../../mixins/virtualCmp';
import { positions, minimumHeights, maximumHeights, outline, show } from '../../mixins/mixinProps';
import { makeColor } from '../../utils/cesiumHelpers';
import PolylineTrailMaterialProperty from '../../exts/materialProperty/PolylineTrailMaterialProperty';
import * as Entity from '../../entity';
import * as WallGraphics from '../../entity/wall';

var script = {
  name: 'vc-trail-wall',
  mixins: [cmp, positions, minimumHeights, maximumHeights, outline, show],
  props: {
    color: {
      type: [Object, String, Array],
      default: 'yellow'
    },
    interval: {
      type: Number,
      default: 3000
    },
    imageUrl: String,
    loop: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      nowaiting: true,
      material: {}
    };
  },
  methods: {
    createCesiumObject: function createCesiumObject() {
      var color, imageUrl, interval, loop, colorCesium;
      return _regeneratorRuntime.async(function createCesiumObject$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              color = this.color, imageUrl = this.imageUrl, interval = this.interval, loop = this.loop;
              colorCesium = makeColor(color);
              this.material = new PolylineTrailMaterialProperty(colorCesium, interval, imageUrl, loop);
              return _context.abrupt("return", this.$refs.entity);

            case 4:
            case "end":
              return _context.stop();
          }
        }
      }, null, this);
    },
    mount: function mount() {
      return _regeneratorRuntime.async(function mount$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              return _context2.abrupt("return", true);

            case 1:
            case "end":
              return _context2.stop();
          }
        }
      });
    },
    unmount: function unmount() {
      return _regeneratorRuntime.async(function unmount$(_context3) {
        while (1) {
          switch (_context3.prev = _context3.next) {
            case 0:
              return _context3.abrupt("return", true);

            case 1:
            case "end":
              return _context3.stop();
          }
        }
      });
    }
  },
  created: function created() {
    var _this = this;

    _Object$defineProperties(this, {
      entity: {
        enumerable: true,
        get: function get() {
          return _this.cesiumObject;
        }
      }
    });
  }
};

/* script */
var __vue_script__ = script;
/* template */

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c('i', {
    class: _vm.$options.name,
    staticStyle: {
      "display": "none !important"
    }
  }, [_c('vc-entity', {
    ref: "entity"
  }, [_c('vc-graphics-wall', {
    attrs: {
      "material": _vm.material,
      "maximumHeights": _vm.maximumHeights,
      "minimumHeights": _vm.minimumHeights,
      "outline": _vm.outline,
      "positions": _vm.positions,
      "show": _vm.show
    }
  })], 1)], 1);
};

var __vue_staticRenderFns__ = [];
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = undefined;
/* functional template */

var __vue_is_functional_template__ = false;
/* component normalizer */

function __vue_normalize__(template, style, script, scope, functional, moduleIdentifier, createInjector, createInjectorSSR) {
  var component = (typeof script === 'function' ? script.options : script) || {}; // For security concerns, we use only base name in production mode.

  component.__file = "VcWallTrail.vue";

  if (!component.render) {
    component.render = template.render;
    component.staticRenderFns = template.staticRenderFns;
    component._compiled = true;
    if (functional) component.functional = true;
  }

  component._scopeId = scope;

  return component;
}
/* style inject */

/* style inject SSR */


var VcWallTrail = __vue_normalize__({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__);

function plugin(Vue) {

  if (plugin.installed) {
    return;
  }

  plugin.installed = true;
  Vue.use(Entity);
  Vue.use(WallGraphics);
  Vue.component(VcWallTrail.name, VcWallTrail);
}

export default plugin;
export { VcWallTrail, plugin as install };
