import { MINIMUM_INPUT_WIDTH } from "../../constants/form.mjs";
import { useResizeObserver } from "../../../node_modules/@vueuse/core/index.mjs";
import { shallowRef, ref, computed } from "vue";
function useCalcInputWidth() {
  const calculatorRef = shallowRef();
  const calculatorWidth = ref(0);
  const inputStyle = computed(() => ({ minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px` }));
  const resetCalculatorWidth = () => {
    var _a;
    calculatorWidth.value = ((_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) ?? 0;
  };
  useResizeObserver(calculatorRef, resetCalculatorWidth);
  return {
    calculatorRef,
    calculatorWidth,
    inputStyle
  };
}
export {
  useCalcInputWidth
};
