import { defineComponent as g, mergeModels as i, useModel as b, ref as V, watch as s, createBlock as y, openBlock as v, unref as E } from "vue";
import { useI18n as B } from "vue-i18n";
import { u as D, d as I } from "./start-CE9SawgU.js";
import "pinia";
import "./header-Bn1EKnBE.js";
import { V as M } from "./constants-CwfsvyFM.js";
import { u as k, b as d } from "./Numbers.json_vue_type_i18n_index_0_src_true_lang-BXJk4msR.js";
const T = /* @__PURE__ */ g({
  __name: "DatahubDataTypeIntegerValueEditor",
  props: /* @__PURE__ */ i({
    modelValue: {},
    readOnly: { type: Boolean },
    attribute: {},
    massEditing: { type: Boolean },
    label: {},
    fieldName: {},
    dataTypeInstance: {},
    loading: { type: Boolean },
    succeeded: { type: Boolean }
  }, {
    modelValue: {},
    modelModifiers: {}
  }),
  emits: /* @__PURE__ */ i(["validated", "update:model-value", "initialized"], ["update:modelValue"]),
  setup(r, { emit: u }) {
    const a = r, m = u, n = b(r, "modelValue"), { t: p } = B(), { root: f, dispatchEvent: c } = D(M), l = V("");
    return s(
      () => a.modelValue,
      (e) => {
        const o = parseInt(e), t = k(o, a.attribute?.configuration);
        l.value = t ? p(t, {
          min: a.attribute?.configuration?.min,
          max: a.attribute?.configuration?.max
        }) : "";
      }
    ), s(
      () => !l.value,
      (e) => {
        c({ data: e }), m("validated", e);
      }
    ), (e, o) => (v(), y(E(I), {
      ref_key: "root",
      ref: f,
      modelValue: n.value,
      "onUpdate:modelValue": o[0] || (o[0] = (t) => n.value = t),
      modelModifiers: { number: !0 },
      readonly: e.attribute?.configuration?.readOnly || e.readOnly,
      loading: e.loading,
      label: e.massEditing ? void 0 : e.label,
      "error-messages": l.value,
      "persistent-placeholder": ""
    }, null, 8, ["modelValue", "readonly", "loading", "label", "error-messages"]));
  }
});
typeof d == "function" && d(T);
export {
  T as default
};
