import { defineComponent as R, useSlots as U, shallowRef as V, computed as E, openBlock as t, createBlock as n, unref as e, mergeProps as T, createSlots as _, renderList as I, withCtx as u, renderSlot as M, normalizeProps as S, guardReactiveProps as z, createElementBlock as F, toDisplayString as c, createCommentVNode as N, createVNode as O, createElementVNode as f } from "vue";
import { EyeOutlined as A, EyeInvisibleOutlined as D } from "@ant-design/icons-vue";
import { Input as K, Flex as $ } from "@aplus-frontend/antdv";
import { omit as j } from "lodash-unified";
import "../../render/index.mjs";
import "../../hooks/index.mjs";
import { useDefaultPlaceholder as L } from "../hooks/use-default-placeholder.mjs";
import { useReadModeRender as q } from "../hooks/use-read-mode-render.mjs";
import { useControllableValue as v } from "../../hooks/useControllableValue.mjs";
import G from "../../render/render.mjs";
const H = {
  key: 0
}, re = /* @__PURE__ */ R({
  name: "ApFieldTextPassword",
  __name: "password",
  props: {
    mode: {
      default: "edit"
    },
    class: {},
    style: {},
    emptyText: {
      default: "--"
    },
    customReadMode: {},
    variant: {},
    size: {},
    value: {},
    name: {},
    type: {
      default: "text"
    },
    onCompositionend: {},
    onCompositionstart: {},
    onFocus: {},
    onBlur: {},
    onChange: {},
    onInput: {},
    onKeydown: {},
    onKeyup: {},
    onMousedown: {},
    focused: {
      type: Boolean
    },
    hidden: {
      type: Boolean
    },
    disabled: {
      type: Boolean,
      default: void 0
    },
    prefixCls: {},
    id: {},
    readonly: {
      type: Boolean
    },
    autofocus: {
      type: Boolean
    },
    autocomplete: {},
    placeholder: {},
    lazy: {
      type: Boolean,
      default: !0
    },
    maxlength: {},
    loading: {
      type: Boolean
    },
    bordered: {
      type: Boolean,
      default: !0
    },
    showCount: {
      type: [Boolean, Object]
    },
    htmlSize: {},
    onPressEnter: {},
    onMouseUp: {},
    onRawInput: {},
    "onUpdate:value": {},
    valueModifiers: {},
    status: {},
    defaultValue: {},
    inputElement: {},
    triggerFocus: {},
    handleReset: {},
    addonBefore: {},
    addonAfter: {},
    prefix: {},
    suffix: {},
    clearIcon: {},
    allowClear: {
      type: Boolean,
      default: !0
    },
    inputPrefixCls: {},
    action: {
      default: "click"
    },
    visibilityToggle: {
      type: Boolean,
      default: !0
    },
    visible: {
      type: Boolean,
      default: void 0
    },
    "onUpdate:visible": {}
  },
  emits: ["update:value", "update:visible"],
  setup(r, {
    expose: y,
    emit: b
  }) {
    const B = U(), i = b, o = r, s = V(), {
      value: l,
      updateValue: x
    } = v(o, i), {
      renderer: h
    } = q(o, l), g = L("TextPassword", o), {
      value: a,
      updateValue: d
    } = v(o, i, {
      valuePropName: "visible"
    }), C = E(() => j(o, ["mode", "emptyText", "value", "onUpdate:value", "visible", "onUpdate:visible"]));
    return y({
      focus: () => {
        s.value?.focus();
      },
      blur: () => {
        s.value?.blur();
      }
    }), (k, p) => r.mode === "edit" ? (t(), n(e(K).Password, T({
      key: 0
    }, C.value, {
      ref_key: "inputRef",
      ref: s,
      placeholder: e(g),
      value: e(l),
      visible: e(a),
      "onUpdate:value": e(x),
      "onUpdate:visible": e(d)
    }), _({
      _: 2
    }, [I(B, (w, m) => ({
      name: m,
      fn: u((P) => [M(k.$slots, m, S(z(P || {})))])
    }))]), 1040, ["placeholder", "value", "visible", "onUpdate:value", "onUpdate:visible"])) : (t(), n(e(G), {
      key: 1,
      renderer: e(h)
    }, {
      default: u(() => [e(l) ? N("", !0) : (t(), F("span", H, c(r.emptyText), 1)), O(e($), {
        gap: 8,
        align: "center"
      }, {
        default: u(() => [f("span", null, c(e(a) ? e(l) : "********"), 1), f("span", {
          style: {
            cursor: "pointer"
          },
          onClick: p[0] || (p[0] = (w) => e(d)(!e(a)))
        }, [e(a) ? (t(), n(e(A), {
          key: 0
        })) : (t(), n(e(D), {
          key: 1
        }))])]),
        _: 1
      })]),
      _: 1
    }, 8, ["renderer"]));
  }
});
export {
  re as default
};
