import { defineComponent, computed, ref, watch, createVNode, Transition, withDirectives, vShow } from 'vue';
import { useInjectMenu, MenuContextProvider } from './hooks/useMenuContext.mjs';
import InternalSubMenuList from './SubMenuList.mjs';

var InlineSubMenuList = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "InlineSubMenuList",
  inheritAttrs: false,
  props: {
    id: String,
    open: Boolean,
    keyPath: Array
  },
  setup(props, {
    slots
  }) {
    const fixedMode = computed(() => "inline");
    const {
      motion,
      mode,
      defaultMotions
    } = useInjectMenu();
    const sameModeRef = computed(() => mode.value === fixedMode.value);
    const destroy = ref(!sameModeRef.value);
    const mergedOpen = computed(() => sameModeRef.value ? props.open : false);
    watch(mode, () => {
      if (sameModeRef.value)
        destroy.value = false;
    }, {
      flush: "post"
    });
    const mergedMotion = computed(() => {
      var _a, _b;
      const m = motion.value || ((_a = defaultMotions.value) == null ? void 0 : _a[fixedMode.value]) || ((_b = defaultMotions.value) == null ? void 0 : _b.other);
      const res = typeof m === "function" ? m() : m;
      return {
        ...res,
        appear: props.keyPath.length <= 1
      };
    });
    return () => {
      if (destroy.value)
        return null;
      return createVNode(MenuContextProvider, {
        "mode": fixedMode.value
      }, {
        default: () => [createVNode(Transition, mergedMotion.value, {
          default: () => [withDirectives(createVNode(InternalSubMenuList, {
            "id": props.id
          }, {
            default: () => {
              var _a;
              return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
            }
          }), [[vShow, mergedOpen.value]])]
        })]
      });
    };
  }
});

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