import { defineComponent, getCurrentInstance, h, createCommentVNode } from 'vue';
import '../../../composables/index.mjs';
import { position, plane, enableMouseEvent } from '../../../utils/cesium-props.mjs';
import { getInstanceListener } from '../../../utils/private/vm.mjs';
import { hSlot } from '../../../utils/private/render.mjs';
import { kebabCase } from '../../../utils/util.mjs';
import useCommon from '../../../composables/use-common/index.mjs';

var Entity = defineComponent({
  name: "VcEntity",
  props: {
    ...position,
    ...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,
    ...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 = getCurrentInstance();
    instance.cesiumClass = "Entity";
    instance.cesiumEvents = ["definitionChanged"];
    const commonState = useCommon(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 = 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 ? h("i", {
        class: kebabCase(((_a = instance.proxy) == null ? void 0 : _a.$options.name) || ""),
        style: { display: "none !important" }
      }, hSlot(ctx.slots.default)) : createCommentVNode(kebabCase(((_b = instance.proxy) == null ? void 0 : _b.$options.name) || ""));
    };
  }
});

export { Entity as default };
//# sourceMappingURL=index.mjs.map
