import { defineComponent as S, mergeModels as _, useModel as k, ref as b, computed as v, watch as U, createBlock as p, openBlock as i, unref as a, withCtx as m, createVNode as c, createElementVNode as C, createCommentVNode as f, toDisplayString as y, createElementBlock as D, Fragment as N, createTextVNode as E, mergeProps as I } from "vue";
import { useI18n as M } from "vue-i18n";
import { f as T, g as $, a as V, h, i as z, b as F } from "./start-BYfL32Oe.mjs";
import "pinia";
import "vue-router";
import "./header-Droxy2Kd.mjs";
import "./moment-h96o7c8I.mjs";
import { D as K } from "./constants--S2sBPny.mjs";
const P = { class: "mr-2" }, R = /* @__PURE__ */ S({
  __name: "DatahubBadWordFilter",
  props: /* @__PURE__ */ _({
    modelValue: {},
    scopable: { type: Boolean },
    remoteScopes: { default: () => [] },
    multiLanguage: { type: Boolean },
    remoteLanguages: { default: () => [] },
    readonly: { type: Boolean }
  }, {
    modelValue: {
      default: () => ({})
    },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(g) {
    const r = g, { t: s } = M(), l = k(g, "modelValue"), t = b(0), o = b(0), B = v(
      () => r.multiLanguage && !o.value || r.scopable && !t.value
    ), L = v(
      () => {
        var e, n;
        return ((n = (e = l.value) == null ? void 0 : e[t.value]) == null ? void 0 : n[o.value]) ?? [""];
      }
    );
    U(
      [t, o],
      ([e, n]) => {
        const d = l.value instanceof Array && l.value.length === 1 && l.value[0].length === 1 ? { 0: { 0: l.value[0][0] } } : l.value;
        d[e] || (d[e] = {}), d[e][n] || (d[e][n] = [""]), l.value = d;
      },
      { immediate: !0 }
    );
    function w({ rowIndex: e }) {
      l.value[t.value][o.value].length > 1 ? l.value[t.value][o.value].splice(
        e,
        1
      ) : l.value[t.value][o.value] = [""];
    }
    function A() {
      l.value[t.value][o.value].push("");
    }
    return (e, n) => (i(), p(a(T), { fluid: "" }, {
      default: m(() => [
        c(a($), null, {
          default: m(() => [
            c(a(V), {
              cols: "12",
              class: "d-flex align-center"
            }, {
              default: m(() => [
                C("strong", P, y(a(s)("datahub-plugin.stringValue.badWords")), 1),
                e.scopable && e.remoteScopes.length ? (i(), p(a(h), {
                  key: 0,
                  modelValue: t.value,
                  "onUpdate:modelValue": n[0] || (n[0] = (u) => t.value = u),
                  items: e.remoteScopes,
                  label: a(s)("datahub-plugin.stringValue.scope"),
                  readonly: e.readonly,
                  disabled: e.readonly,
                  "item-title": "name",
                  "item-value": "id",
                  class: "mr-2"
                }, null, 8, ["modelValue", "items", "label", "readonly", "disabled"])) : f("", !0),
                e.multiLanguage && e.remoteLanguages.length ? (i(), p(a(h), {
                  key: 1,
                  modelValue: o.value,
                  "onUpdate:modelValue": n[1] || (n[1] = (u) => o.value = u),
                  items: e.remoteLanguages,
                  label: a(s)("datahub-plugin.stringValue.language"),
                  readonly: e.readonly,
                  disabled: e.readonly,
                  "item-title": "description",
                  "item-value": "id",
                  class: "mr-2"
                }, null, 8, ["modelValue", "items", "label", "readonly", "disabled"])) : f("", !0)
              ]),
              _: 1
            }),
            c(a(V), null, {
              default: m(() => [
                B.value ? (i(), D(N, { key: 0 }, [
                  E(y(a(s)("datahub-plugin.stringValue.wrongScopeLanguage")), 1)
                ], 64)) : (i(), p(a(z), I({
                  key: 1,
                  data: L.value,
                  "create-actions": e.readonly || [
                    {
                      title: a(s)("datahub-plugin.stringValue.addWord"),
                      icon: "add_circle"
                    }
                  ],
                  readonly: e.readonly
                }, a(K), {
                  onCreate: A,
                  onRemove: w
                }), {
                  "cell-text": m(({ rowIndex: u }) => [
                    c(a(F), {
                      modelValue: l.value[t.value][o.value][u],
                      "onUpdate:modelValue": (d) => l.value[t.value][o.value][u] = d,
                      readonly: e.readonly
                    }, null, 8, ["modelValue", "onUpdate:modelValue", "readonly"])
                  ]),
                  _: 1
                }, 16, ["data", "create-actions", "readonly"]))
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
});
function W(g) {
  const r = g;
  r.__i18n = r.__i18n || [], r.__i18n.push({
    locale: "",
    resource: {
      "en-US": {
        "datahub-plugin": {
          stringValue: {
            badWords: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Bad Words" } },
            scope: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Scope" } },
            language: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Language" } },
            wrongScopeLanguage: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Please select a valid scope and language combination to edit bad words" } },
            addWord: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Add word" } }
          }
        }
      },
      "de-DE": {
        "datahub-plugin": {
          stringValue: {
            badWords: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Unerwünschte Wörter" } },
            scope: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Kanal" } },
            language: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Sprache" } },
            wrongScopeLanguage: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Bitte wählen Sie eine gültige Kanal- und Sprachkombination aus, um unerwünschte Wörter zu bearbeiten" } },
            addWord: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Wort hinzufügen" } }
          }
        }
      }
    }
  });
}
typeof W == "function" && W(R);
export {
  R as _
};
