import { defineComponent, openBlock, createBlock, unref, createElementBlock, normalizeClass, createElementVNode, renderSlot, withDirectives, createVNode, vShow, createTextVNode, toDisplayString, ref, computed, watchEffect, mergeProps, withCtx, createCommentVNode, watch, normalizeStyle } from "vue";
import { Popup, Picker } from "vant";
import WlSvg from "@wltech/svg";
const __default__$3 = {
  name: "WlSvgIcon"
};
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  ...__default__$3,
  props: {
    type: { default: "" },
    color: { default: "var(--wl-text-color-title-1)" },
    width: { default: "16" },
    height: { default: "16" }
  },
  setup(__props) {
    const sub = location.origin;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(WlSvg), {
        type: __props.type,
        width: __props.width,
        height: __props.height,
        color: __props.color,
        sub: unref(sub)
      }, null, 8, ["type", "width", "height", "color", "sub"]);
    };
  }
});
const _hoisted_1$1 = { class: "z-2 flex uno-min-w-44 uno-max-w-88" };
const _hoisted_2$1 = { class: "uno-elli-1 z-1 box-border flex-middle-center absolute text-center uno-l-44 uno-r-44" };
const _hoisted_3 = { class: "relative z-2 flex-middle-center uno-min-w-44" };
const __default__$2 = {
  name: "WlHeader"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__$2,
  props: {
    title: { default: "" },
    showBack: { type: Boolean, default: false },
    showClose: { type: Boolean, default: false },
    needAutoBack: { type: Boolean, default: true },
    needBottomBorder: { type: Boolean, default: false }
  },
  emits: ["onBack", "onClose"],
  setup(__props, { emit }) {
    const props = __props;
    const onBackPage = () => {
      if (props.needAutoBack) {
        history.back();
      } else {
        emit("onBack");
      }
    };
    const onClose = () => {
      emit("onClose");
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(`uno-fs-16 uno-h-44 relative font-medium box-border text-base-color bg-white flex-between ${__props.needBottomBorder ? "border-bottom" : " "}`)
      }, [
        createElementVNode("div", _hoisted_1$1, [
          renderSlot(_ctx.$slots, "header_part_left", {}, () => [
            withDirectives(createElementVNode("div", {
              class: "box-content flex-middle-center cursor-pointer uno-h-44 uno-w-44",
              onClick: onBackPage
            }, [
              createVNode(_sfc_main$3, {
                type: "arrowTipLeft",
                width: "22",
                height: "22",
                color: "#000"
              })
            ], 512), [
              [vShow, __props.showBack]
            ])
          ])
        ]),
        createElementVNode("div", _hoisted_2$1, [
          renderSlot(_ctx.$slots, "default", {}, () => [
            createTextVNode(toDisplayString(__props.title), 1)
          ])
        ]),
        createElementVNode("div", _hoisted_3, [
          renderSlot(_ctx.$slots, "header_part_right", {}, () => [
            withDirectives(createElementVNode("div", {
              class: "box-content flex-middle-center cursor-pointer uno-h-44 uno-w-44",
              onClick: onClose
            }, [
              createVNode(_sfc_main$3, {
                type: "close",
                width: "22",
                height: "22",
                color: "#000"
              })
            ], 512), [
              [vShow, __props.showClose]
            ])
          ])
        ])
      ], 2);
    };
  }
});
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = {
  class: "popup-wrap",
  "data-weiling-mobile-ui-wl-popup": ""
};
const _hoisted_2 = { class: "popup-content" };
const __default__$1 = {
  name: "WlPopup"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  props: {
    modelValue: { type: Boolean, default: false },
    teleport: { default: "body" },
    position: { default: "bottom" },
    headerVisible: { type: Boolean, default: false },
    title: { default: "" },
    showRightClose: { type: Boolean, default: true },
    showBack: { type: Boolean, default: false },
    needAutoBack: { type: Boolean, default: true }
  },
  emits: ["update:modelValue", "onClose", "onBack"],
  setup(__props, { emit }) {
    const props = __props;
    const popUpVisible = ref(false);
    const popupStyle = computed(() => {
      return {
        height: "70%"
      };
    });
    const onClose = () => {
      emit("update:modelValue", false);
      emit("onClose");
    };
    const onOpen = () => {
      emit("update:modelValue", true);
    };
    const onBack = () => {
      emit("onBack");
    };
    watchEffect(() => {
      popUpVisible.value = props.modelValue;
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Popup), mergeProps({
        show: popUpVisible.value,
        "onUpdate:show": _cache[0] || (_cache[0] = ($event) => popUpVisible.value = $event),
        teleport: __props.teleport,
        position: __props.position,
        "close-on-popstate": true,
        style: unref(popupStyle)
      }, _ctx.$attrs, {
        onClose,
        onOpen
      }), {
        default: withCtx(() => [
          createElementVNode("div", _hoisted_1, [
            __props.headerVisible ? (openBlock(), createBlock(_sfc_main$2, {
              key: 0,
              title: __props.title,
              showClose: __props.showRightClose,
              onOnClose: onClose,
              onOnBack: onBack,
              showBack: __props.showBack,
              needAutoBack: __props.needAutoBack
            }, {
              header_part_left: withCtx(() => [
                renderSlot(_ctx.$slots, "header_part_left")
              ]),
              _: 3
            }, 8, ["title", "showClose", "showBack", "needAutoBack"])) : createCommentVNode("", true),
            createElementVNode("div", _hoisted_2, [
              renderSlot(_ctx.$slots, "default")
            ])
          ])
        ]),
        _: 3
      }, 16, ["show", "teleport", "position", "style"]);
    };
  }
});
const __default__ = {
  name: "WlPicker"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    columns: { default: () => [] },
    modelValue: { type: Boolean, default: false },
    pickerDefaultValue: { default: () => [] },
    teleport: { default: "body" },
    contentHeight: { default: "fit-content" }
  },
  emits: ["onConfirm", "onChange", "update:modelValue", "onClose"],
  setup(__props, { emit }) {
    const props = __props;
    const visible = ref(false);
    const pickerRef = ref();
    const defaultValue = ref([]);
    const onConfirm = (item) => {
      emit("onConfirm", item.selectedValues, item.selectedIndexes, item);
      onClose();
    };
    const onClose = () => {
      emit("update:modelValue", false);
      emit("onClose");
    };
    const onChange = (item) => {
      emit("onChange", item.selectedValues, item.selectedIndexes, item);
    };
    watchEffect(() => {
      visible.value = props.modelValue;
    });
    watch(
      () => [props.modelValue, props.pickerDefaultValue],
      () => {
        if (props.modelValue) {
          defaultValue.value = props.pickerDefaultValue;
        }
      },
      {
        immediate: true
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createBlock(_sfc_main$1, {
        modelValue: visible.value,
        "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => visible.value = $event),
        style: normalizeStyle(`height: ${__props.contentHeight}`),
        round: "",
        teleport: __props.teleport,
        position: "bottom",
        onClose
      }, {
        default: withCtx(() => [
          createVNode(unref(Picker), {
            ref_key: "pickerRef",
            ref: pickerRef,
            "show-toolbar": "",
            columns: __props.columns,
            modelValue: defaultValue.value,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => defaultValue.value = $event),
            onCancel: onClose,
            onConfirm,
            onChange
          }, null, 8, ["columns", "modelValue"])
        ]),
        _: 1
      }, 8, ["modelValue", "style", "teleport"]);
    };
  }
});
var __uno = "";
_sfc_main.install = (app) => {
  app.component(_sfc_main.name, _sfc_main);
};
export { _sfc_main as default };
