/**
 * vue-cesium - https://github.com/zouyaoji/vue-cesium
 * Vue 2.x components for CesiumJS.
 *
 * @package VueCesium
 * @author zouyaoji <370681295@qq.com>
 * @version 2.3.12
 * @license MIT
 * @homepage https://zouyaoji.top/vue-cesium
 * @copyright (c) 2018-2022, zouyaoji <370681295@qq.com>
 */
import _asyncToGenerator from '@babel/runtime-corejs2/helpers/esm/asyncToGenerator';
import _regeneratorRuntime from '@babel/runtime-corejs2/regenerator';
import { ellipsoid, credit, minimumLevel, maximumLevel, rectangle, tilingScheme, projectionTransforms } from '../../mixins/mixinProps';
import mixinImageryProvider from '../../mixins/providers/mixinImageryProvider';
import AMapImageryProvider$1 from '../../exts/imageryProvider/AMapImageryProvider';

var script = {
  name: 'vc-provider-imagery-amap',
  mixins: [ellipsoid, credit, minimumLevel, maximumLevel, rectangle, tilingScheme, projectionTransforms, mixinImageryProvider],
  props: {
    url: {
      type: String,
      default: 'https://{domain}{s}.is.autonavi.com/appmaptile?lang={lang}&size=1&style={style}&scl={scl}&ltype={ltype}&x={x}&y={y}&z={z}'
    },
    subdomains: {
      type: Array,
      default: function _default() {
        return ['01', '02', '03', '04'];
      }
    },
    domain: {
      type: String,
      default: 'webst'
    },
    lang: {
      type: String,
      default: 'zh_cn'
    },
    mapStyle: {
      // 地图类型控制，6卫星图（st），7简图（st rd），8详图（不透明rd，透明图st）
      type: String,
      default: '6'
    },
    scl: {
      // 尺寸控制，1=256,2=512
      type: String,
      default: '1'
    },
    ltype: {
      // 线性控制，只对地图要素进行控制，没有文字注记，要素多少，是否透明
      // 纯道路 ltype=11 mapStyle=8
      // 纯地标  ltype=4 mapStyle=8
      // 道路标注 ltype=0 mapStyle=8
      type: String,
      default: '0'
    }
  },
  methods: {
    createCesiumObject: function createCesiumObject() {
      var _this = this;

      return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
        var $props, transformProps, setPropWatchers, unwatchFns, options;
        return _regeneratorRuntime.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                $props = _this.$props, transformProps = _this.transformProps, setPropWatchers = _this.setPropWatchers, unwatchFns = _this.unwatchFns;
                options = transformProps($props);
                Cesium.AMapImageryProvider = AMapImageryProvider$1;

                if (unwatchFns.length === 0) {
                  setPropWatchers(true);
                }

                return _context.abrupt("return", new Cesium.AMapImageryProvider(options));

              case 5:
              case "end":
                return _context.stop();
            }
          }
        }, _callee);
      }))();
    }
  }
};

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

/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = undefined;
/* functional template */

var __vue_is_functional_template__ = undefined;
/* 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 = "AMapImageryProvider.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 AMapImageryProvider = __vue_normalize__({}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__);

/*
 * @Author: zouyaoji@https://github.com/zouyaoji
 * @Date: 2022-04-06 16:57:05
 * @LastEditTime: 2022-04-06 17:01:19
 * @LastEditors: zouyaoji
 * @Description:
 * @FilePath: \vue-cesium-v2\src\components\imageryLayer\amap\index.js
 */

function plugin(Vue) {

  if (plugin.installed) {
    return;
  }

  plugin.installed = true;
  Vue.component(AMapImageryProvider.name, AMapImageryProvider);
}

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