import { defineComponent as h, computed as b, watch as k, createBlock as l, unref as t, openBlock as s, createSlots as E, withCtx as S, createVNode as _ } from "vue";
import { useI18n as N } from "vue-i18n";
import { storeToRefs as V } from "pinia";
import { T as v, I as A } from "./start-CE9SawgU.js";
import { a as C } from "./header-Bn1EKnBE.js";
import "@vuelidate/validators";
import "./TreeView.vue_vue_type_style_index_0_scoped_0bd14ef7_lang-CZieIjgg.js";
import "./DatahubDataTypeCompletenessRenderer.vue_vue_type_script_setup_true_lang-5buor0oX.js";
import { u as I } from "./topBarRoutes-CBd5qLxn.js";
import "./IsActiveStatusCell-xz7XnAYP.js";
import "./VariantToVariantExtension-DUC3WSrH.js";
import T from "./DatahubDataTypeVariantValueEditor-9WYNJneN.js";
import "./dataTypes-DocW2t0g.js";
import { C as x } from "./routeNames-EkLxv0O7.js";
import { b as u } from "./link-value.json_vue_type_i18n_index_0_src_true_lang-Dr1AN4WJ.js";
const B = /* @__PURE__ */ h({
  __name: "ChannelsDataTypeVariantValueEditor",
  props: {
    modelValue: {},
    readOnly: { type: Boolean },
    attribute: {},
    massEditing: { type: Boolean },
    label: {},
    fieldName: {},
    dataTypeInstance: {},
    loading: { type: Boolean },
    succeeded: { type: Boolean },
    pluginName: {}
  },
  setup(m) {
    const d = m, { t: p } = N(), r = I(
      d.pluginName || C
    ), {
      entity: e,
      variantKey: a,
      masterEntityId: c
    } = V(r), f = [
      {
        id: "sku",
        header: "datahub-ui.dh-shared.sku"
      }
    ], n = b(
      () => e.value?.sku ? p("channels-ui.offers.childOfferOf", { sku: e.value?.sku }) : ""
    );
    return k(
      () => null,
      async (o) => {
        o && r.fetchEntity(o);
      },
      { immediate: !0 }
    ), (o, i) => !t(e) || !t(a) ? (s(), l(t(v), {
      key: 0,
      type: "table"
    })) : (s(), l(t(T), {
      key: 1,
      modelValue: t(e)[t(a)],
      "onUpdate:modelValue": i[0] || (i[0] = (y) => t(e)[t(a)] = y),
      attribute: t(e),
      "attribute-set-id": t(e).attributeSetId,
      "variant-set-controller": "Actindo.Modules.Actindo.Channels.VariantSets.",
      "variant-controller": "Actindo.Modules.Actindo.Channels.Variants.",
      "additional-columns": f
    }, E({ _: 2 }, [
      n.value ? {
        name: "child-redirect",
        fn: S(() => [
          _(t(A), {
            to: {
              name: t(x).OFFERS_LIST,
              params: { offerId: t(c) }
            },
            text: n.value,
            variant: "text",
            color: "primary"
          }, null, 8, ["to", "text"])
        ]),
        key: "0"
      } : void 0
    ]), 1032, ["modelValue", "attribute", "attribute-set-id"]));
  }
});
typeof u == "function" && u(B);
export {
  B as default
};
