import { defineComponent, ref, watch, openBlock, createElementBlock, withDirectives, createElementVNode, vModelCheckbox, renderSlot } from "vue";
const _hoisted_1 = { class: "tui-checkbox" };
const _hoisted_2 = ["disabled"];
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "CheckboxPC",
  props: {
    modelValue: { type: Boolean, default: false },
    disabled: { type: Boolean, default: false }
  },
  emits: ["input"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const checked = ref(props.modelValue);
    const emit = __emit;
    watch(
      () => props.modelValue,
      (value) => {
        checked.value = props.disabled ? true : value;
      },
      { immediate: true }
    );
    function handleCheckBoxClick() {
      checked.value = !checked.value;
      emit("input", checked.value);
    }
    function handleValueChange(event) {
      checked.value = event.target.checked;
      emit("input", event.target.checked);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        withDirectives(createElementVNode("input", {
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => checked.value = $event),
          type: "checkbox",
          disabled: props.disabled,
          onChange: handleValueChange
        }, null, 40, _hoisted_2), [
          [vModelCheckbox, checked.value]
        ]),
        createElementVNode("span", {
          class: "tui-checkbox-slot-container",
          onClick: handleCheckBoxClick
        }, [
          renderSlot(_ctx.$slots, "default", {}, void 0, true)
        ])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
