import { defineComponent, ref, watchEffect, openBlock, createElementBlock, createElementVNode, withDirectives, unref, vModelText, createVNode, createCommentVNode, toDisplayString, createBlock, isRef, withCtx, renderSlot, watch, withModifiers, normalizeStyle } from "vue";
import { ActionSheet, showConfirmDialog } from "vant";
import { _ as _sfc_main$4, a as _sfc_main$5 } from "./index9.js";
import { _ as _sfc_main$3, o as onDebounce } from "./index4.js";
import "./index7.js";
import "@wltech/svg";
var deleteIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAOiSURBVHgBzZrdceIwFIWvneTd+5iZJAMVZFNBTAdJBZstgQoCFaSEsBUkWwFsB2wFkJ+ZPC7vCbDneGTGFrYl2QL8zRiB/7jHku69khyIZ2azWYSigy06OjpiKcvlcq4OT7vd7kI8EkhDaHAYhnfYroMg+L5erztV5+P4HOdNUf6GsAkEzaUBtQXA8Pj4+PgeX2NpxgRifl1cXIykBs4CPBqegzWDYugqxFrAx8dH5+vr61E8G64DISM0raFt07ISoJ76E75GsgdUbfRRG8+mc0PTCW9vb/cwfix7Mp6gk3ewPfG/jedWHVQ3GMhhGZyfnw/LDpYKaInxKaUiCgW8vr7esAqlXfQgYqLv3BJAbwMvMDYFpAOwgBe80r3TVif+/PwctNB4EsGZPOo7cwLQdO7QdH5Ie4nRN+PsjpwA5DNGt9UCcjZuBPDp12k6DDrYbvHVJctc8BrU9lzcydXCRkCdpkPj0eF7jJi4vid2IhY8l9cg3e7VFLGphcQLqTxnJg6kxme9wvv7O9PpqqidGH92djZNd9T1erD3G8cWSQ3A88TiCP60r7s0GlZRE1vGk9PT0/lqteqLIxyDJKX6fSOO0KXxiev7S0QUGk94Dxx7FEdwTcwyEQA1l+JOxOZiIaLSeEOTqyKxOeCQEE/zn9Sn0kCWOzA+gf0gULn+WJpRKqIIH8YT/OeVcTxgSWlz0vFlPMF9ojCd+vCAUYRP4wldr68aOBhhZtKpKcZ+YIgTzjCKhycnJz5uZt2JfYsIEYXn0oxKN+oQ7JyBG52Gaq7yRephDFKWwc4Z5mKbXAg/rPy3hm2EjXYk4i8/UgETcQTX/HSIsJUieC9x55kfiQBkgyNx5wFRvJPdYfDzhSKYTiMXexBHOLPNMhGg+sHE5QacPUMQHKciLINUTkTdsQDO/5Om8tlANhRHMiJuHCJsIoJzTw2mb0YbG7J7MdakEbG0GHofDEe76W89lXCuhQOQszEnQE3dTaSlcO1AXwDZSuYwNqBL87oQ5wM1ibDVQrYEcJCN4lbaR79o1aYwnVZNqU39YVi2WmNa4BiINpV3AIZ4oIOyg8Y1sgOLqDSeWC3yMegw3O9x2p1O5LZoQUPHakiZzmNyQVp2DNMELmTYGE+cF7o5i81peN+1QcORmgxsDU+p/aoBhaDggsi1NKCu4SmNX/ZgRqkmh9lPLi1q5oUDKI5BmMY3fXulsQAdNVWZpMupGM4eYFtw/O37dZv/XhxunoTWr/gAAAAASUVORK5CYII=";
const _hoisted_1$1 = {
  class: "textarea-wrap bg-white",
  "data-weiling-mobile-ui-wl-textarea": ""
};
const _hoisted_2$1 = { class: "textarea flex-between" };
const _hoisted_3$1 = ["placeholder", "maxlength"];
const _hoisted_4$1 = {
  key: 0,
  class: "fs12 text-right text-base-color"
};
const __default__$2 = {
  name: "WlTextarea"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__$2,
  props: {
    modelValue: { default: "" },
    placeholder: { default: "" },
    clearable: { type: Boolean, default: true },
    needDebounce: { type: Boolean, default: true },
    maxlength: { default: null }
  },
  emits: ["onBlur", "onFocus", "onChange", "update:modelValue"],
  setup(__props, { expose, emit }) {
    const props = __props;
    const formValue = ref("");
    const textareaRef = ref(null);
    const onBlur = emit("onBlur");
    const onFocus = emit("onFocus");
    const onClear = () => emit("update:modelValue", "");
    const onTriggerFocus = () => {
      textareaRef.value.focus();
    };
    const onDebounceSave = onDebounce(() => {
      emit("onChange", formValue.value);
      emit("update:modelValue", formValue.value);
    }, 500);
    const onChange = () => {
      if (props.needDebounce) {
        onDebounceSave();
      } else {
        emit("onChange", formValue.value);
        emit("update:modelValue", formValue.value);
      }
    };
    watchEffect(() => {
      formValue.value = props.modelValue;
    });
    expose({
      onTriggerFocus
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1, [
        createElementVNode("div", _hoisted_2$1, [
          withDirectives(createElementVNode("textarea", {
            type: "text",
            class: "textarea-base",
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formValue.value = $event),
            onInput: onChange,
            placeholder: __props.placeholder,
            ref_key: "textareaRef",
            ref: textareaRef,
            maxlength: __props.maxlength,
            onFocus: _cache[1] || (_cache[1] = (...args) => unref(onFocus) && unref(onFocus)(...args)),
            onBlur: _cache[2] || (_cache[2] = (...args) => unref(onBlur) && unref(onBlur)(...args))
          }, null, 40, _hoisted_3$1), [
            [vModelText, formValue.value]
          ]),
          formValue.value && __props.clearable ? (openBlock(), createElementBlock("p", {
            key: 0,
            class: "pointer uno-w-18 uno-h-18",
            onClick: onClear
          }, [
            createVNode(_sfc_main$3, { src: unref(deleteIcon) }, null, 8, ["src"])
          ])) : createCommentVNode("", true)
        ]),
        __props.maxlength > 0 ? (openBlock(), createElementBlock("p", _hoisted_4$1, toDisplayString(formValue.value.length) + "/" + toDisplayString(__props.maxlength), 1)) : createCommentVNode("", true)
      ]);
    };
  }
});
const __default__$1 = {
  name: "WlActionSheet"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  props: {
    title: { default: "" },
    cancelText: { default: "\u53D6\u6D88" },
    modelValue: { type: Boolean, default: false },
    showClose: { type: Boolean, default: true },
    showBack: { type: Boolean, default: false },
    headerVisible: { type: Boolean, default: false },
    actions: { default: () => [] },
    teleport: { default: "" }
  },
  emits: ["update:modelValue", "onClose", "onSelect"],
  setup(__props, { emit }) {
    const props = __props;
    let actionSheetVisible = ref(false);
    const onClose = () => {
      emit("update:modelValue", false);
      emit("onClose");
    };
    const onSelect = (val) => {
      emit("onSelect", val);
      onClose();
    };
    watchEffect(() => {
      actionSheetVisible.value = props.modelValue;
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(ActionSheet), {
        show: unref(actionSheetVisible),
        "onUpdate:show": _cache[0] || (_cache[0] = ($event) => isRef(actionSheetVisible) ? actionSheetVisible.value = $event : actionSheetVisible = $event),
        "cancel-text": __props.cancelText,
        "close-on-click-action": "",
        "close-on-popstate": "",
        actions: __props.actions,
        teleport: __props.teleport,
        onCancel: onClose,
        onClickOverlay: onClose,
        onSelect
      }, {
        default: withCtx(() => [
          __props.headerVisible ? (openBlock(), createBlock(_sfc_main$4, {
            key: 0,
            title: __props.title,
            showClose: __props.showClose,
            showBack: __props.showBack,
            onOnClose: onClose
          }, null, 8, ["title", "showClose", "showBack"])) : createCommentVNode("", true),
          renderSlot(_ctx.$slots, "default")
        ]),
        _: 3
      }, 8, ["show", "cancel-text", "actions", "teleport"]);
    };
  }
});
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = {
  class: "fail-popup",
  "data-weiling-mobile-ui-bc-business-stage-popup-fail-popup": ""
};
const _hoisted_2 = { class: "header" };
const _hoisted_3 = /* @__PURE__ */ createElementVNode("p", null, "\u5176\u4ED6", -1);
const _hoisted_4 = ["onClick"];
const _hoisted_5 = ["onClick"];
const _hoisted_6 = { class: "wl-textarea-wrap" };
const __default__ = {
  name: "FailPopup"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    modelValue: { type: Boolean, default: false },
    list: { default: null }
  },
  emits: ["onConfirm", "onConfirmField", "update:modelValue"],
  setup(__props, { emit }) {
    const props = __props;
    const message = ref("");
    const fieldVisible = ref(false);
    const fieldItemData = ref(null);
    const popupVisible = ref(false);
    watchEffect(() => {
      popupVisible.value = props.modelValue;
    });
    watch(
      () => popupVisible.value,
      (val) => emit("update:modelValue", val)
    );
    const onSelect = (item) => {
      const { type = "" } = item;
      if (type === "ipt") {
        fieldVisible.value = true;
        fieldItemData.value = item;
      } else {
        showConfirmDialog({
          message: "\u786E\u8BA4\u4E22\u5355",
          title: "",
          confirmButtonColor: "rgba(255, 69, 69, 1)"
        }).then(() => {
          emit("onConfirm", { stage_value: item });
        });
      }
    };
    const onCloseField = () => {
      fieldVisible.value = false;
      popupVisible.value = false;
    };
    const onConfirmField = () => {
      if (!message.value)
        return;
      showConfirmDialog({
        message: "\u786E\u8BA4\u4E22\u5355",
        title: "",
        confirmButtonColor: "rgba(255, 69, 69, 1)"
      }).then(() => {
        emit("onConfirmField", {
          stage_value: {
            fail_reason_desc: message.value,
            ...fieldItemData.value
          }
        });
        fieldVisible.value = false;
        popupVisible.value = false;
      });
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createVNode(_sfc_main$1, {
          modelValue: popupVisible.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => popupVisible.value = $event),
          actions: __props.list,
          "cancel-text": "\u53D6\u6D88",
          selectedClose: false,
          teleport: "body",
          "close-on-click-action": "",
          onCancel: _cache[1] || (_cache[1] = ($event) => popupVisible.value = false),
          onSelect
        }, null, 8, ["modelValue", "actions"]),
        createVNode(_sfc_main$5, {
          position: "bottom",
          round: "",
          modelValue: fieldVisible.value,
          "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => fieldVisible.value = $event),
          style: { "height": "fit-content" },
          onOnClose: onCloseField
        }, {
          default: withCtx(() => [
            createElementVNode("div", _hoisted_1, [
              createElementVNode("div", _hoisted_2, [
                createVNode(_sfc_main$4, { showBack: false }, {
                  header_part_left: withCtx(() => [
                    createElementVNode("p", {
                      class: "canel",
                      onClick: withModifiers(onCloseField, ["stop"])
                    }, "\u53D6\u6D88", 8, _hoisted_4)
                  ]),
                  header_part_right: withCtx(() => [
                    createElementVNode("p", {
                      class: "confirm",
                      style: normalizeStyle(`color: ${message.value ? "" : "var(--wl-text-color-placeholder)"}`),
                      onClick: withModifiers(onConfirmField, ["stop"])
                    }, " \u5B8C\u6210 ", 12, _hoisted_5)
                  ]),
                  default: withCtx(() => [
                    _hoisted_3
                  ]),
                  _: 1
                })
              ]),
              createElementVNode("div", _hoisted_6, [
                createVNode(_sfc_main$2, {
                  class: "wl-textarea",
                  modelValue: message.value,
                  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => message.value = $event),
                  rows: "2",
                  autosize: "",
                  autofocus: "",
                  type: "textarea",
                  maxlength: 50,
                  placeholder: "\u8BF7\u8F93\u5165\u4E22\u5355\u539F\u56E0\uFF08\u5FC5\u586B\uFF09",
                  "show-word-limit": ""
                }, null, 8, ["modelValue"])
              ])
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]);
    };
  }
});
export { _sfc_main as default };
