'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../composables/index.js');
var cesiumProps = require('../../../utils/cesium-props.js');
var vm = require('../../../utils/private/vm.js');
var render = require('../../../utils/private/render.js');
var util = require('../../../utils/util.js');
var index = require('../../../composables/use-common/index.js');

var Entity = vue.defineComponent({
  name: "VcEntity",
  props: {
    ...cesiumProps.position,
    ...cesiumProps.plane,
    id: String,
    name: String,
    availability: Object,
    show: {
      type: Boolean,
      default: true
    },
    description: [String, Object],
    orientation: Object,
    viewFrom: Object,
    parent: Object,
    billboard: Object,
    corridor: Object,
    cylinder: Object,
    ellipse: Object,
    ellipsoid: Object,
    box: Object,
    label: Object,
    model: Object,
    tileset: Object,
    path: Object,
    point: Object,
    polygon: Object,
    polyline: Object,
    properties: Object,
    polylineVolume: Object,
    rectangle: Object,
    wall: Object,
    ...cesiumProps.enableMouseEvent
  },
  emits: [
    "beforeLoad",
    "ready",
    "destroyed",
    "update:billboard",
    "update:box",
    "update:corridor",
    "update:cylinder",
    "update:ellipse",
    "update:ellipsoid",
    "update:ellipse",
    "update:label",
    "update:model",
    "update:path",
    "update:plane",
    "update:point",
    "update:polygon",
    "update:polyline",
    "update:polylineVolume",
    "update:rectangle",
    "update:tileset",
    "update:wall"
  ],
  setup(props, ctx) {
    const instance = vue.getCurrentInstance();
    instance.cesiumClass = "Entity";
    instance.cesiumEvents = ["definitionChanged"];
    const commonState = index["default"](props, ctx, instance);
    if (commonState === void 0) {
      return;
    }
    const { $services } = commonState;
    const { emit } = ctx;
    instance.mount = async () => {
      var _a;
      const entity = (_a = $services == null ? void 0 : $services.entities) == null ? void 0 : _a.add(instance.cesiumObject);
      return $services == null ? void 0 : $services.entities.contains(entity);
    };
    instance.unmount = async () => {
      var _a;
      return (_a = $services == null ? void 0 : $services.entities) == null ? void 0 : _a.remove(instance.cesiumObject);
    };
    const updateGraphics = (graphics, emitType) => {
      const listener = vm.getInstanceListener(instance, emitType);
      if (listener) {
        emit(emitType, graphics);
      } else {
        instance.cesiumObject && (instance.cesiumObject[emitType.substr(7)] = graphics);
      }
      graphics && (graphics._vcParent = instance.cesiumObject);
      return true;
    };
    Object.assign(instance.proxy, {
      __updateGraphics: updateGraphics
    });
    return () => {
      var _a, _b;
      return ctx.slots.default ? vue.h("i", {
        class: util.kebabCase(((_a = instance.proxy) == null ? void 0 : _a.$options.name) || ""),
        style: { display: "none !important" }
      }, render.hSlot(ctx.slots.default)) : vue.createCommentVNode(util.kebabCase(((_b = instance.proxy) == null ? void 0 : _b.$options.name) || ""));
    };
  }
});

exports["default"] = Entity;
//# sourceMappingURL=index.js.map
