import { defineComponent, computed, createBlock, openBlock, unref, withCtx, createVNode } from "vue";
import { OSelect } from "../select/index.mjs";
import _sfc_main$1 from "./OCascaderPanel.vue.mjs";
import { cascaderProps } from "./types.mjs";
import { isUndefined, isString } from "../_utils/is.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "OCascader",
  props: cascaderProps,
  emits: ["change", "update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const handleChange = (val) => {
      emits("change", val);
      emits("update:modelValue", val);
    };
    const wrapClass = computed(() => {
      const classStr = "o-cascader";
      if (isUndefined(props.optionWrapClass)) {
        return classStr;
      } else if (isString(props.optionWrapClass)) {
        return `${classStr} ${props.optionWrapClass}`;
      } else {
        return [classStr, ...props.optionWrapClass].join(" ");
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(OSelect), {
        "model-value": props.modelValue,
        round: props.round,
        variant: props.variant,
        placeholder: props.placeholder,
        triggre: props.trigger,
        "option-position": props.optionPosition,
        "option-width-mode": "auto",
        "unmount-on-hide": props.unmountOnHide,
        transition: props.transition,
        "option-wrap-class": wrapClass.value
      }, {
        default: withCtx(() => [
          createVNode(_sfc_main$1, {
            options: props.options,
            "model-value": props.modelValue,
            "path-mode": props.pathMode,
            onChange: handleChange
          }, null, 8, ["options", "model-value", "path-mode"])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["model-value", "round", "variant", "placeholder", "triggre", "option-position", "unmount-on-hide", "transition", "option-wrap-class"]);
    };
  }
});
export {
  _sfc_main as default
};
