'use strict';

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

var vue = require('vue');
var useViewer = require('./useViewer.js');
var defaultProps = require('./defaultProps.js');
var config = require('../../../utils/config.js');
var events = require('./events.js');
var index = require('../../ui/index.js');
var render = require('../../../utils/private/render.js');
var util = require('../../../utils/util.js');
var shared = require('@vue/shared');

var Viewer = vue.defineComponent({
  name: "VcViewer",
  props: defaultProps["default"],
  emits: events.emits,
  setup(props, ctx) {
    const instance = vue.getCurrentInstance();
    instance.cesiumEvents = ["selectedEntityChanged", "trackedEntityChanged"];
    instance.cesiumMembersEvents = events.viewerEvents;
    const viewerStates = useViewer["default"](props, ctx, instance);
    vue.provide(config.vcKey, viewerStates.getServices());
    Object.assign(instance.proxy, {
      createPromise: viewerStates.createPromise,
      load: viewerStates.load,
      unload: viewerStates.unload,
      reload: viewerStates.reload,
      cesiumObject: instance.cesiumObject,
      getCesiumObject: () => instance.cesiumObject
    });
    return () => {
      var _a;
      const children = [];
      if (shared.isPlainObject(props.skeleton) && !viewerStates.isReady.value) {
        children.push(vue.h(index.VcSkeleton, {
          ...props.skeleton,
          style: { background: props.skeleton.color, width: "100%", height: "100%" }
        }));
      } else {
        children.push(vue.createCommentVNode("v-if"));
      }
      children.push(vue.createCommentVNode("vc-viewer"), vue.h("div", {
        ref: viewerStates.viewerRef,
        class: util.kebabCase(((_a = instance.proxy) == null ? void 0 : _a.$options.name) || ""),
        id: ctx.attrs.id || "cesiumContainer",
        style: ctx.attrs.style || { width: "100%", height: "100%" }
      }, render.hSlot(ctx.slots.default)));
      return children;
    };
  }
});

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