import { defineComponent, ref, watchEffect, openBlock, createElementBlock, createElementVNode, createVNode, createBlock, withCtx, unref, createCommentVNode } from "vue";
import { _ as _sfc_main$3, s as select_plat_icon } from "./index13.js";
import { _ as _sfc_main$1 } from "./index4.js";
import { _ as _sfc_main$2 } from "./index18.js";
import "./index5.js";
import "./index6.js";
import "@wltech/svg";
import "vant";
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = { class: "select-input" };
const _hoisted_2 = { class: "input-wrap" };
const _hoisted_3 = { class: "arrow-wrap" };
const __default__ = {
  name: "RfSelectInput"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    modelValue: { default: "" },
    placeholder: { default: "" },
    actions: { default: null }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit }) {
    const props = __props;
    const inputValue = ref("");
    const popoverVisible = ref(false);
    watchEffect(() => {
      inputValue.value = props.modelValue;
    });
    const onChange = (val) => {
      emit("update:modelValue", val);
    };
    const onSelect = (data) => {
      popoverVisible.value = false;
      inputValue.value = data.text;
      emit("update:modelValue", data.text);
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", _hoisted_2, [
          createVNode(_sfc_main$1, {
            paddingLeft: 0,
            modelValue: inputValue.value,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
            onOnChange: onChange,
            placeholder: __props.placeholder,
            onFocus: _cache[1] || (_cache[1] = ($event) => popoverVisible.value = false)
          }, null, 8, ["modelValue", "placeholder"])
        ]),
        __props.actions && __props.actions.length > 0 ? (openBlock(), createBlock(_sfc_main$2, {
          key: 0,
          modelValue: popoverVisible.value,
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => popoverVisible.value = $event),
          trigger: "click",
          actions: __props.actions,
          placement: "bottom-end",
          onSelect
        }, {
          reference: withCtx(() => [
            createElementVNode("div", _hoisted_3, [
              createVNode(_sfc_main$3, { src: unref(select_plat_icon) }, null, 8, ["src"])
            ])
          ]),
          _: 1
        }, 8, ["modelValue", "actions"])) : createCommentVNode("", true)
      ]);
    };
  }
});
export { _sfc_main as default };
