import "../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import { useChartEditStore } from "../../../../../store/modules/chartEditStore/chartEditStore.mjs";
import { EditCanvasTypeEnum } from "../../../../../store/modules/chartEditStore/chartEditStore.d.mjs";
import { useDesignStore } from "../../../../../store/modules/designStore/designStore.mjs";
import { usePointStyle, useSizeStyle } from "../../hooks/useStyle.hook.mjs";
import { useMousePointHandle } from "../../hooks/useDrag.hook.mjs";
import { defineComponent, computed, openBlock, createElementBlock, renderSlot, Fragment, renderList, createCommentVNode, createElementVNode as createBaseVNode } from "../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { useCssVars } from "../../../../../../node_modules/.pnpm/@vue_runtime-dom@3.3.4/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.mjs";
import { normalizeClass, normalizeStyle } from "../../../../../../node_modules/.pnpm/@vue_shared@3.3.4/node_modules/@vue/shared/dist/shared.esm-bundler.mjs";
import { unref } from "../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
const _hoisted_1 = ["onMousedown"];
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    item: {
      type: Object,
      required: true
    },
    hiddenPoint: {
      type: Boolean,
      required: false
    }
  },
  setup(__props) {
    const props = __props;
    useCssVars((_ctx) => ({
      "2d925dfa": themeColor.value
    }));
    const designStore = useDesignStore();
    const chartEditStore = useChartEditStore();
    const pointList = ["t", "r", "b", "l", "lt", "rt", "lb", "rb"];
    const cursorResize = ["n", "e", "s", "w", "nw", "ne", "sw", "se"];
    const themeColor = computed(() => {
      return designStore.getAppTheme;
    });
    const hover = computed(() => {
      const isDrag = chartEditStore.getEditCanvas[EditCanvasTypeEnum.IS_DRAG];
      if (isDrag)
        return false;
      if (props.item.status.lock)
        return false;
      return props.item.id === chartEditStore.getTargetChart.hoverId;
    });
    const select = computed(() => {
      const id = props.item.id;
      if (props.item.status.lock)
        return false;
      return chartEditStore.getTargetChart.selectId.find((e) => e === id);
    });
    const lock = computed(() => {
      return props.item.status.lock;
    });
    const hide = computed(() => {
      return props.item.status.hide;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["go-shape-box", { lock: lock.value, hide: hide.value }])
      }, [
        renderSlot(_ctx.$slots, "default", {}, void 0, true),
        !__props.hiddenPoint ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(select.value ? pointList : [], (point, index) => {
          return openBlock(), createElementBlock("div", {
            class: normalizeClass(`shape-point ${point}`),
            key: index,
            style: normalizeStyle(unref(usePointStyle)(point, index, __props.item.attr, cursorResize)),
            onMousedown: ($event) => unref(useMousePointHandle)($event, point, __props.item.attr)
          }, null, 46, _hoisted_1);
        }), 128)) : createCommentVNode("", true),
        createBaseVNode("div", {
          class: "shape-modal",
          style: normalizeStyle(unref(useSizeStyle)(__props.item.attr))
        }, [
          createBaseVNode("div", {
            class: normalizeClass(["shape-modal-select", { active: select.value }])
          }, null, 2),
          createBaseVNode("div", {
            class: normalizeClass(["shape-modal-change", { selectActive: select.value, hoverActive: hover.value }])
          }, null, 2)
        ], 4)
      ], 2);
    };
  }
});
export {
  _sfc_main as default
};
