"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index = require("../../../../hooks/use-attrs/index.js");
const index$1 = require("../../../../hooks/use-namespace/index.js");
const index$2 = require("../../../../hooks/use-focus-controller/index.js");
const useFormItem = require("../../../form/src/hooks/use-form-item.js");
const props = require("./props.js");
const Vue = require("vue");
const _hoisted_1 = [
  "id",
  "name",
  "placeholder",
  "value",
  "disabled"
];
const _hoisted_2 = [
  "id",
  "name",
  "placeholder",
  "value",
  "disabled"
];
var picker_range_trigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "PickerRangeTrigger",
  inheritAttrs: false,
  __name: "picker-range-trigger",
  props: props.timePickerRangeTriggerProps,
  emits: [
    "mouseenter",
    "mouseleave",
    "click",
    "touchstart",
    "focus",
    "blur",
    "startInput",
    "endInput",
    "startChange",
    "endChange"
  ],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props2 = __props;
    const emit = __emit;
    const { formItem } = useFormItem.useFormItem();
    const { inputId } = useFormItem.useFormItemInputId(Vue.reactive({ id: Vue.computed(() => {
      var _a;
      return (_a = props2.id) == null ? void 0 : _a[0];
    }) }), { formItemContext: formItem });
    const attrs = index.useAttrs();
    const nsDate = index$1.useNamespace("date");
    const nsRange = index$1.useNamespace("range");
    const inputRef = Vue.ref();
    const endInputRef = Vue.ref();
    const { wrapperRef, isFocused } = index$2.useFocusController(inputRef, { disabled: Vue.computed(() => props2.disabled) });
    const handleClick = (evt) => {
      emit("click", evt);
    };
    const handleMouseEnter = (evt) => {
      emit("mouseenter", evt);
    };
    const handleMouseLeave = (evt) => {
      emit("mouseleave", evt);
    };
    const handleTouchStart = (evt) => {
      emit("touchstart", evt);
    };
    const handleStartInput = (evt) => {
      emit("startInput", evt);
    };
    const handleEndInput = (evt) => {
      emit("endInput", evt);
    };
    const handleStartChange = (evt) => {
      emit("startChange", evt);
    };
    const handleEndChange = (evt) => {
      emit("endChange", evt);
    };
    const focus = () => {
      var _a;
      (_a = inputRef.value) == null ? void 0 : _a.focus();
    };
    const blur = () => {
      var _a, _b;
      (_a = inputRef.value) == null ? void 0 : _a.blur();
      (_b = endInputRef.value) == null ? void 0 : _b.blur();
    };
    __expose({
      focus,
      blur
    });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", {
        ref_key: "wrapperRef",
        ref: wrapperRef,
        class: Vue.normalizeClass([Vue.unref(nsDate).is("active", Vue.unref(isFocused)), _ctx.$attrs.class]),
        style: Vue.normalizeStyle(_ctx.$attrs.style),
        onClick: handleClick,
        onMouseenter: handleMouseEnter,
        onMouseleave: handleMouseLeave,
        onTouchstartPassive: handleTouchStart
      }, [
        Vue.renderSlot(_ctx.$slots, "prefix"),
        Vue.createElementVNode("input", Vue.mergeProps(Vue.unref(attrs), {
          id: Vue.unref(inputId),
          ref_key: "inputRef",
          ref: inputRef,
          name: _ctx.name && _ctx.name[0],
          placeholder: _ctx.startPlaceholder,
          value: _ctx.modelValue && _ctx.modelValue[0],
          class: Vue.unref(nsRange).b("input"),
          disabled: _ctx.disabled,
          onInput: handleStartInput,
          onChange: handleStartChange
        }), null, 16, _hoisted_1),
        Vue.renderSlot(_ctx.$slots, "range-separator"),
        Vue.createElementVNode("input", Vue.mergeProps(Vue.unref(attrs), {
          id: _ctx.id && _ctx.id[1],
          ref_key: "endInputRef",
          ref: endInputRef,
          name: _ctx.name && _ctx.name[1],
          placeholder: _ctx.endPlaceholder,
          value: _ctx.modelValue && _ctx.modelValue[1],
          class: Vue.unref(nsRange).b("input"),
          disabled: _ctx.disabled,
          onInput: handleEndInput,
          onChange: handleEndChange
        }), null, 16, _hoisted_2),
        Vue.renderSlot(_ctx.$slots, "suffix")
      ], 38);
    };
  }
});
exports.default = picker_range_trigger_vue_vue_type_script_setup_true_lang_default;
