import { defineComponent as D, ref as A, watch as q, createBlock as g, openBlock as m, unref as e, withCtx as a, createVNode as t, createTextVNode as T, toDisplayString as h, createElementVNode as k, computed as X, mergeProps as H, createSlots as oe, mergeModels as re, useModel as Z, createElementBlock as N, Fragment as U, renderList as R, onBeforeMount as ue, createCommentVNode as ce, resolveDynamicComponent as de } from "vue";
import { useI18n as O } from "vue-i18n";
import { aG as me, s as J, af as C, a1 as pe, a2 as fe, aH as be, h as ee, i as W, c as M, k as he, e as ge, aI as te, aJ as F, aK as ve, ah as ye, aa as Se, L as Ae, ao as _e, as as Ce, I as P, T as we, Y as L, am as Y, an as j, j as ze, b as Te, d as Me, a as Ve, X as Ie, a3 as ke, a4 as Ee, a6 as Pe, a5 as De, a7 as Le, a8 as Be, aL as Ne } from "./start-CE9SawgU.js";
import { storeToRefs as Ue } from "pinia";
import "./header-Bn1EKnBE.js";
import { p as K } from "./PIM-B4XbTS97.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 "./topBarRoutes-CBd5qLxn.js";
import "./IsActiveStatusCell-xz7XnAYP.js";
import "./VariantToVariantExtension-DUC3WSrH.js";
import "./DatahubDataTypeVariantValueEditor-9WYNJneN.js";
import { u as Oe } from "./dataTypes-DocW2t0g.js";
const xe = me, ae = `${xe}PimChannelsConnection.`, $e = `${ae}Mapping.`, Re = {
  /** getAttributeSetMappingsForProducts */
  async getAttributeSetMappingsForProducts(l) {
    return J.post(
      `${$e}getAttributeSetMappingsForProducts`,
      l
    );
  }
};
var V = /* @__PURE__ */ ((l) => (l.ALL = "all", l.CUSTOM = "custom", l.FILTER = "filter", l))(V || {}), E = /* @__PURE__ */ ((l) => (l.ACTIVE = "active", l.INACTIVE = "inactive", l.NOT_AVAILABLE = "not_available", l))(E || {});
const We = `${ae}Offers.`, Fe = {
  /** getAttributeSetMappingsForProducts */
  async deferBulkCreateOffersFromPim(l) {
    return J.post(
      `${We}deferBulkCreateOffersFromPim`,
      l
    );
  }
}, Ge = "PimChannelsConnection", B = [
  "pim-channels-plugin.channels-from-pim-wizard.selectConnection",
  "pim-channels-plugin.channels-from-pim-wizard.selectProducts",
  "pim-channels-plugin.channels-from-pim-wizard.selectETLMode",
  "pim-channels-plugin.channels-from-pim-wizard.Summary"
], ie = {
  active: {
    icon: "lucide:circle-check-big",
    label: "pim-channels-plugin.channels-from-pim-wizard.statuses.lifecycle.active",
    color: "positive_gradient_1"
  },
  in_archive: {
    icon: "lucide:circle-pause",
    label: "pim-channels-plugin.channels-from-pim-wizard.statuses.lifecycle.archive",
    color: "on_light_64"
  },
  in_recycle_bin: {
    icon: "lucide:circle-x",
    label: "pim-channels-plugin.channels-from-pim-wizard.statuses.lifecycle.recycleBin",
    color: "on_light"
  }
}, ne = {
  master: "pim-channels-plugin.channels-from-pim-wizard.statuses.variant.MASTER",
  child: "pim-channels-plugin.channels-from-pim-wizard.statuses.variant.CHILD",
  single: "pim-channels-plugin.channels-from-pim-wizard.statuses.variant.SINGLE"
}, qe = {
  data: K.listProducts,
  gridId: "pim-products-list",
  dynamicColumnsEndpoint: K.getColumnDefinitions,
  entityTypeClassName: "Actindo\\Modules\\Actindo\\PIM\\Models\\PIMProduct",
  rowSelection: fe.MULTI,
  hideGlobalSearch: !1,
  hideFilters: !1,
  lockedProperty: "frozenByName",
  entityTypeId: 2617111665,
  // ID for PIMProduct entity type
  hideColumnCustomization: !1,
  hidePagination: !1,
  sortType: pe.NONE,
  channels: !0,
  languages: !0,
  columns: [
    {
      id: "id",
      header: "common.id",
      minWidth: 200,
      isVisible: !1,
      filterable: C.NUMERIC,
      sortable: !0,
      properties: { hidden: !0 }
    },
    {
      id: "sku",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.sku",
      minWidth: 200,
      filterable: C.STRING,
      sortable: !0
    },
    {
      id: "lifecycleStatus",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.lifecycleStatus",
      minWidth: 200,
      width: 200,
      filterable: C.LIST,
      filterListValues: Object.entries(ie).map(
        ([l, { label: s }]) => ({ value: l, title: s })
      ),
      sortable: !0
    },
    {
      id: "lifecycleStatusChangedByUsername",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.lifecycleStatusChangedByUsername",
      minWidth: 200,
      isVisible: !1,
      filterable: !1,
      sortable: !1
    },
    {
      id: "lifecycleStatusChangedAt",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.lifecycleStatusChangedAt",
      minWidth: 200,
      isVisible: !1,
      filterable: C.DATE,
      renderer: "CellDateTime",
      sortable: !0
    },
    {
      id: "attributeSetName",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.productType",
      minWidth: 200,
      filterable: C.STRING,
      sortable: !0
    },
    {
      id: "frozenByName",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.frozenByName",
      minWidth: 200,
      filterable: !1,
      sortable: !1
    },
    {
      id: "frozenDate",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.frozenDate",
      minWidth: 200,
      isVisible: !1,
      filterable: C.DATE,
      sortable: !0,
      renderer: "CellDateTime"
    },
    {
      id: "isFrozenByMe",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.frozenDate",
      renderer: "CheckboxCell",
      minWidth: 200,
      isVisible: !1,
      filterable: C.BOOLEAN,
      sortable: !0
    },
    {
      id: "variantStatus",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.variantStatus",
      minWidth: 200,
      isVisible: !1,
      filterable: C.LIST,
      filterListValues: Object.entries(ne).map(
        ([l, s]) => ({ value: l, title: s })
      ),
      sortable: !0
    },
    {
      id: "created",
      header: "common.created",
      minWidth: 200,
      isVisible: !1,
      filterable: C.DATE,
      sortable: !0,
      renderer: "CellDateTime"
    },
    {
      id: "createdByUsername",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.createdByUsername",
      minWidth: 200,
      isVisible: !1,
      filterable: !1,
      sortable: !1
    },
    {
      id: "modified",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.modified",
      minWidth: 200,
      isVisible: !1,
      filterable: C.DATE,
      sortable: !0,
      renderer: "CellDateTime"
    },
    {
      id: "modifiedByUsername",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.modifiedByUsername",
      minWidth: 200,
      isVisible: !1,
      filterable: !1,
      sortable: !1
    }
  ]
}, He = [
  {
    id: "sourceSet.name",
    header: "pim-channels-plugin.channels-from-pim-wizard.table.sourceAttributeSet"
  },
  {
    id: "destination",
    header: "pim-channels-plugin.channels-from-pim-wizard.table.destinationAttributeSet"
  }
], Ye = `${Ge}-rates`, le = /* @__PURE__ */ D({
  __name: "StepSelectConnection",
  props: {
    value: {}
  },
  emits: ["validated"],
  setup(l, { emit: s }) {
    const p = s, { t: n } = O(), i = A({
      connection: void 0,
      noDuplicates: !0,
      productSelection: V.CUSTOM
    }), _ = {
      connection: ve,
      noDuplicates: {},
      productSelection: {}
    }, { v$: f } = be(Ye, { rules: _, form: i });
    return q(
      [() => f.value?.$invalid, i],
      ([S]) => p(
        "validated",
        S ? void 0 : {
          connectionId: i.value.connection.id,
          noDuplicates: i.value.noDuplicates,
          productSelection: i.value.productSelection
        }
      ),
      { immediate: !0, deep: !0 }
    ), (S, o) => (m(), g(e(ee), { fluid: "" }, {
      default: a(() => [
        t(e(W), null, {
          default: a(() => [
            t(e(M), {
              sm: "10",
              md: "8",
              lg: "6",
              xl: "4"
            }, {
              default: a(() => [
                t(e(M), null, {
                  default: a(() => [
                    T(h(e(n)(
                      "pim-channels-plugin.channels-from-pim-wizard.connectionDescription"
                    )), 1)
                  ]),
                  _: 1
                }),
                t(e(M), null, {
                  default: a(() => [
                    t(e(he), {
                      data: "Actindo.Modules.Actindo.Channels.Connections.listConnections?listOnlyActiveSynced=true",
                      label: e(n)("pim-channels-plugin.channels-from-pim-wizard.connection"),
                      "custom-query": { listOnlyActiveSynced: !0 },
                      "item-title": "name",
                      "item-value": "id",
                      text: i.value.connection?.name ?? e(n)("pim-channels-plugin.channels-from-pim-wizard.selectConnection"),
                      "page-size": "",
                      select: "",
                      search: "",
                      block: "",
                      onChange: o[0] || (o[0] = (c) => e(f).connection.$model = c)
                    }, null, 8, ["label", "text"])
                  ]),
                  _: 1
                }),
                t(e(M), null, {
                  default: a(() => [
                    t(e(ge), {
                      modelValue: e(f).noDuplicates.$model,
                      "onUpdate:modelValue": o[1] || (o[1] = (c) => e(f).noDuplicates.$model = c),
                      label: e(n)(
                        "pim-channels-plugin.channels-from-pim-wizard.confirmDuplicates"
                      )
                    }, null, 8, ["modelValue", "label"])
                  ]),
                  _: 1
                }),
                t(e(M), null, {
                  default: a(() => [
                    k("p", null, h(e(n)(
                      "pim-channels-plugin.channels-from-pim-wizard.selectProductsTitle"
                    )), 1),
                    t(e(te), {
                      modelValue: e(f).productSelection.$model,
                      "onUpdate:modelValue": o[2] || (o[2] = (c) => e(f).productSelection.$model = c)
                    }, {
                      default: a(() => [
                        t(e(F), {
                          label: e(n)("pim-channels-plugin.channels-from-pim-wizard.allProducts"),
                          value: e(V).ALL
                        }, null, 8, ["label", "value"]),
                        t(e(F), {
                          label: e(n)("pim-channels-plugin.channels-from-pim-wizard.customProduct"),
                          value: e(V).CUSTOM
                        }, null, 8, ["label", "value"])
                      ]),
                      _: 1
                    }, 8, ["modelValue"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
});
function I(l) {
  const s = l;
  s.__i18n = s.__i18n || [], s.__i18n.push({
    locale: "",
    resource: {
      "en-US": {
        "pim-channels-plugin": {
          "channels-from-pim-wizard": {
            noSetMap: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Attribute set not defined" } },
            etlMode: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Change tracking mode" } },
            initialOfferStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Initial offer status" } },
            statistic: {
              matched: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Matched" } },
              notMatched: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Not matched (unclear)" } },
              impossible: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Not matched (not possible)" } },
              duplicateNo: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Already have offers on this connection and would create duplicates" } },
              duplicateYes: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Already have offers on this connection and will create duplicates" } }
            },
            table: {
              mapAttributeSets: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Map attribute sets" } },
              sourceAttributeSet: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Source attribute set" } },
              destinationAttributeSet: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Destination attribute set" } },
              selectAll: { t: 0, b: { t: 2, i: [{ t: 3, v: "Select all " }, { t: 4, k: "count" }, { t: 3, v: " products" }] } },
              sku: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "SKU" } },
              modified: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Modified on" } },
              modifiedByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Modified by" } },
              createdByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Created by" } },
              frozenByName: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Frozen by" } },
              variantStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Variant status" } },
              frozenDate: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Frozen date" } },
              frozenByMe: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Frozen by me" } },
              productType: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Attribute set" } },
              lifecycleStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life cycle status" } },
              lifecycleStatusChangedAt: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life cycle status changed at" } },
              lifecycleStatusChangedByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life cycle status changed by" } }
            },
            statuses: {
              offer: {
                active: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Active" } },
                inactive: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Inactive" } },
                notAvailable: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Offline" } }
              },
              variant: {
                MASTER: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Master" } },
                CHILD: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Variant" } },
                SINGLE: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Single" } }
              },
              lifecycle: {
                active: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Active" } },
                archive: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Archive" } },
                recycleBin: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Recycle bin" } }
              }
            },
            createOffer: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Create offers" } },
            allProducts: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "All products" } },
            customProduct: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Product selection" } },
            selectProductsTitle: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Please select products which you want to create offers from:" } },
            connection: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Connection" } },
            connectionDescription: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Please select a connection which you want to create offers for. " } },
            confirmDuplicates: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Create only offers for products which do not have an offer on the selected connection yet. This prevents the creation of duplicate offers." } },
            selectConnection: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Select connection" } },
            selectProducts: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Select products" } },
            selectETLMode: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Select change tracking mode and status" } },
            Summary: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Summary" } }
          }
        }
      },
      "de-DE": {
        "pim-channels-plugin": {
          "channels-from-pim-wizard": {
            noSetMap: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Attributsatz nicht definiert" } },
            etlMode: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Datenübernahmemodus" } },
            initialOfferStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Angebotsstatus" } },
            statistic: {
              matched: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Gefunden" } },
              notMatched: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Nicht gefunden (unklar)" } },
              impossible: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Nicht gefunden (nicht möglich)" } },
              duplicateNo: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Haben bereits Angebote für diese Verbindung und würden doppelte Angebote erstellen (werden ignoriert)" } },
              duplicateYes: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Haben bereits Angebote für diese Verbindung und werden doppelte Angebote erstellen" } }
            },
            table: {
              mapAttributeSets: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Attributsätze zuordnen" } },
              sourceAttributeSet: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Quellattributsatz" } },
              destinationAttributeSet: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Zielattributsatz" } },
              selectAll: { t: 0, b: { t: 2, i: [{ t: 3, v: "Alle " }, { t: 4, k: "count" }, { t: 3, v: " Produkte auswählen" }] } },
              sku: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "SKU" } },
              modified: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Geändert am" } },
              modifiedByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Geändert von" } },
              createdByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Erstellt von" } },
              frozenByName: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Gesperrt von" } },
              variantStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Varianten-Status" } },
              frozenDate: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Gesperrt am" } },
              frozenByMe: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Gesperrt von mir" } },
              productType: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Attributsatz" } },
              lifecycleStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life-Cycle-Status" } },
              lifecycleStatusChangedAt: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life-Cycle-Status geändert am" } },
              lifecycleStatusChangedByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life-Cycle-Status geändert von" } }
            },
            statuses: {
              offer: {
                active: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Aktiv" } },
                inactive: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Inaktiv" } },
                notAvailable: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Offline" } }
              },
              variant: {
                MASTER: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Hauptangebot" } },
                CHILD: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Angebotsvariante" } },
                SINGLE: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Einzelangebot" } }
              },
              lifecycle: {
                active: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Aktiv" } },
                archive: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Archiv" } },
                recycleBin: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Papierkorb" } }
              }
            },
            createOffer: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Angebote erstellen" } },
            allProducts: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Alle Produkte" } },
            customProduct: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Produktauswahl" } },
            selectProductsTitle: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Bitte wählen Sie Produkte aus, aus denen Sie Angebote erstellen möchten:" } },
            connection: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Verbindung" } },
            connectionDescription: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Bitte wählen Sie eine Verbindung aus, für die Sie Angebote erstellen möchten. " } },
            confirmDuplicates: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Erstellen Sie nur Angebote für Produkte, die noch kein Angebot für die ausgewählte Verbindung haben. Dies verhindert die Erstellung doppelter Angebote." } },
            selectConnection: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Verbindung auswählen" } },
            selectProducts: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Produkte auswählen" } },
            selectETLMode: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Datenübernahmemodus und Status auswählen" } },
            Summary: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Zusammenfassung" } }
          }
        }
      }
    }
  });
}
typeof I == "function" && I(le);
const se = /* @__PURE__ */ D({
  __name: "StepSelectProducts",
  props: {
    value: {}
  },
  emits: ["next", "validated"],
  setup(l, { emit: s }) {
    const p = s, { t: n } = O({ useScope: "parent" }), i = A(), _ = A({
      filter: [
        {
          property: "variantStatus",
          operator: "!=",
          value: "child",
          active: 1
        }
      ],
      sort: [{ field: "id", order: "DESC" }],
      serializeOptionals: ["_pim_art_name", "_pim_variants", "_pim_images"]
    }), f = X(() => i.value?.table.rowCount.value || 0);
    function S() {
      p("validated", {
        productIds: [],
        productSelection: V.FILTER,
        listProductsRequest: i.value?.prepareDataRequestPayload()
      }), p("next");
    }
    return q(
      () => i.value?.table.selectedRows.value,
      (o) => {
        p(
          "validated",
          o?.length ? {
            productIds: ye(o),
            productSelection: V.CUSTOM,
            listProductsRequest: i.value?.prepareDataRequestPayload()
          } : void 0
        );
      },
      { immediate: !0, deep: !0 }
    ), (o, c) => (m(), g(e(Se), H({
      ref_key: "table",
      ref: i,
      "custom-query": _.value,
      "page-sizes": [5, 10, 25],
      "page-size": 5
    }, e(qe)), oe({
      "cell-lifecycleStatus": a(({ cellValue: u }) => [
        t(e(Ce), {
          options: e(ie)[u]
        }, null, 8, ["options"])
      ]),
      "cell-variantStatus": a(({ cellValue: u }) => [
        T(h(e(n)(e(ne)[u])), 1)
      ]),
      rowDisabled: a(() => [
        t(e(Ae), {
          text: e(n)("pim-tables.productIsLocked")
        }, {
          activator: a(({ props: u }) => [
            t(e(_e), H({
              icon: "lucide:lock",
              class: "ml-3",
              focusable: ""
            }, u), null, 16)
          ]),
          _: 1
        }, 8, ["text"])
      ]),
      _: 2
    }, [
      f.value ? {
        name: "actionButtons",
        fn: a(() => [
          t(e(P), {
            text: e(n)("pim-channels-plugin.channels-from-pim-wizard.table.selectAll", {
              count: f.value
            }),
            size: "x-small",
            onClick: S
          }, null, 8, ["text"])
        ]),
        key: "0"
      } : void 0
    ]), 1040, ["custom-query"]));
  }
});
typeof I == "function" && I(se);
const Q = /* @__PURE__ */ D({
  __name: "RadioButtons",
  props: /* @__PURE__ */ re({
    options: {},
    loading: { type: Boolean },
    readonly: { type: Boolean }
  }, {
    modelValue: {},
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(l) {
    const s = Z(l, "modelValue");
    return (p, n) => (m(), g(e(te), {
      modelValue: s.value,
      "onUpdate:modelValue": n[0] || (n[0] = (i) => s.value = i)
    }, {
      default: a(() => [
        p.loading ? (m(), g(e(we), {
          key: 0,
          type: "list-item-avatar@3"
        })) : (m(!0), N(U, { key: 1 }, R(p.options, ({ id: i, name: _ }) => (m(), g(e(F), {
          key: i,
          label: _,
          value: i,
          readonly: p.readonly
        }, null, 8, ["label", "value", "readonly"]))), 128))
      ]),
      _: 1
    }, 8, ["modelValue"]));
  }
}), G = /* @__PURE__ */ D({
  __name: "StepEtlMode",
  props: {
    value: {},
    readonly: { type: Boolean }
  },
  emits: ["validated"],
  setup(l, { emit: s }) {
    const p = l, n = s, { t: i } = O(), _ = Oe(), {
      changeTrackingModes: f,
      isChangeTrackingModesLoading: S
    } = Ue(_), o = A(!0), c = A({
      attributeSetMap: [],
      clear: 0,
      ambiguous: 0,
      impossible: 0,
      existingOffer: 0
    }), u = A({
      changeTracking: 2,
      initialStatus: E.ACTIVE,
      attributeSetMapping: []
    }), x = X(() => [
      {
        id: E.ACTIVE,
        name: i(
          "pim-channels-plugin.channels-from-pim-wizard.statuses.offer.active"
        )
      },
      {
        id: E.INACTIVE,
        name: i(
          "pim-channels-plugin.channels-from-pim-wizard.statuses.offer.inactive"
        )
      },
      {
        id: E.NOT_AVAILABLE,
        name: i(
          "pim-channels-plugin.channels-from-pim-wizard.statuses.offer.notAvailable"
        )
      }
    ]);
    function w(r, y) {
      const d = r.targetSets.length, z = y.targetSets.length;
      return d >= 2 && z < 2 ? -1 : z >= 2 && d < 2 ? 1 : d === 0 && z !== 0 ? -1 : z === 0 && d > 0 ? 1 : r.productCount > y.productCount ? -1 : 1;
    }
    async function b() {
      try {
        o.value = !0;
        const r = {
          ...p.value,
          attributeSetMapping: u.value.attributeSetMapping
        };
        c.value = await Re.getAttributeSetMappingsForProducts(r), c.value.attributeSetMap.sort(w);
      } finally {
        o.value = !1;
      }
    }
    function v(r, y, d) {
      u.value.attributeSetMapping[d] = { sourceSetId: r, targetSetId: y }, b();
    }
    return ue(async () => {
      b(), _.ensureChangeTrackingModes();
    }), q(
      [o, u],
      ([r]) => {
        const y = c.value.attributeSetMap.some(
          ({ targetSets: z }, $) => z?.length > 1 && !u.value.attributeSetMapping[$]
        ), d = r || y || c.value.clear < 1;
        n("validated", d ? void 0 : u.value);
      },
      { immediate: !0, deep: !0 }
    ), (r, y) => (m(), g(e(ee), {
      fluid: "",
      class: "h-100 d-flex flex-column overflow-y-hidden"
    }, {
      default: a(() => [
        t(e(W), { class: "flex-grow-0" }, {
          default: a(() => [
            t(e(M), {
              sm: "4",
              class: "d-flex flex-column justify-space-between ga-2"
            }, {
              default: a(() => [
                t(e(L), {
                  type: "success",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: a(() => [
                    k("b", null, h(c.value.clear), 1),
                    T(" - " + h(e(i)("pim-channels-plugin.channels-from-pim-wizard.statistic.matched")), 1)
                  ]),
                  _: 1
                }),
                t(e(L), {
                  type: "warning",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: a(() => [
                    k("b", null, h(c.value.ambiguous), 1),
                    T(" - " + h(e(i)(
                      "pim-channels-plugin.channels-from-pim-wizard.statistic.notMatched"
                    )), 1)
                  ]),
                  _: 1
                }),
                t(e(L), {
                  type: "error",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: a(() => [
                    k("b", null, h(c.value.impossible), 1),
                    T(" - " + h(e(i)(
                      "pim-channels-plugin.channels-from-pim-wizard.statistic.impossible"
                    )), 1)
                  ]),
                  _: 1
                }),
                t(e(L), {
                  type: "info",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: a(() => [
                    k("b", null, h(c.value.existingOffer), 1),
                    T(" - " + h(e(i)(
                      r.value.noDuplicates ? "pim-channels-plugin.channels-from-pim-wizard.statistic.duplicateNo" : "pim-channels-plugin.channels-from-pim-wizard.statistic.duplicateYes"
                    )), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            t(e(M), { sm: "4" }, {
              default: a(() => [
                t(e(Y), null, {
                  default: a(() => [
                    t(e(j), { class: "form-title" }, {
                      default: a(() => [
                        T(h(e(i)("pim-channels-plugin.channels-from-pim-wizard.etlMode")), 1)
                      ]),
                      _: 1
                    }),
                    t(Q, {
                      modelValue: u.value.changeTracking,
                      "onUpdate:modelValue": y[0] || (y[0] = (d) => u.value.changeTracking = d),
                      loading: e(S),
                      options: e(f),
                      readonly: r.readonly
                    }, null, 8, ["modelValue", "loading", "options", "readonly"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            t(e(M), { sm: "4" }, {
              default: a(() => [
                t(e(Y), null, {
                  default: a(() => [
                    t(e(j), { class: "form-title" }, {
                      default: a(() => [
                        T(h(e(i)(
                          "pim-channels-plugin.channels-from-pim-wizard.initialOfferStatus"
                        )), 1)
                      ]),
                      _: 1
                    }),
                    t(Q, {
                      modelValue: u.value.initialStatus,
                      "onUpdate:modelValue": y[1] || (y[1] = (d) => u.value.initialStatus = d),
                      options: x.value,
                      readonly: r.readonly
                    }, null, 8, ["modelValue", "options", "readonly"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        t(e(W), { class: "flex-grow-1 overflow-y-hidden my-2" }, {
          default: a(() => [
            t(e(ze), {
              data: c.value.attributeSetMap,
              columns: e(He),
              "table-name": e(i)(
                "pim-channels-plugin.channels-from-pim-wizard.table.mapAttributeSets"
              ),
              "is-loading": o.value,
              readonly: r.readonly,
              "hide-remove": "",
              "hide-global-search": ""
            }, {
              "cell-destination": a(({
                row: d,
                rowIndex: z
              }) => [
                d.targetSets?.length ? d.targetSets.length === 1 ? (m(), g(e(Me), {
                  key: 1,
                  "model-value": d.targetSets[0].name,
                  readonly: ""
                }, null, 8, ["model-value"])) : (m(), g(e(Ve), {
                  key: 2,
                  "model-value": u.value.attributeSetMapping[z]?.targetSetId,
                  items: d.targetSets,
                  "item-title": "name",
                  "item-value": "id",
                  "onUpdate:modelValue": ($) => v(d.sourceSet.id, $, z)
                }, null, 8, ["model-value", "items", "onUpdate:modelValue"])) : (m(), g(e(Te), {
                  key: 0,
                  icon: "lucide:circle-alert",
                  color: "alert"
                }, {
                  default: a(() => [
                    T(h(e(i)("pim-channels-plugin.channels-from-pim-wizard.noSetMap")), 1)
                  ]),
                  _: 1
                }))
              ]),
              _: 1
            }, 8, ["data", "columns", "table-name", "is-loading", "readonly"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
});
typeof I == "function" && I(G);
const je = { class: "flex-grow-1 overflow-auto ma-6" }, Ke = { class: "d-flex pa-4" }, Qe = /* @__PURE__ */ D({
  __name: "PIMChannelsFromPIMWizard",
  props: {
    modelValue: { type: Boolean },
    modelModifiers: {}
  },
  emits: ["update:modelValue"],
  setup(l) {
    const s = Z(l, "modelValue"), { t: p } = O(), n = A(1), i = A({}), _ = [le, se, G, G], f = A(Array(B.length - 1).fill(!1)), S = A(!1), o = A({
      connectionId: 0,
      productSelection: V.CUSTOM,
      noDuplicates: !0,
      productIds: [],
      listProductsRequest: {},
      attributeSetMapping: [],
      changeTracking: 2,
      initialStatus: E.ACTIVE
    });
    function c(w) {
      f.value[n.value - 1] = !!w, w && (o.value = { ...o.value, ...w }, i.value[2] = o.value.productSelection === V.ALL);
    }
    function u(w) {
      for (n.value += w; i.value[n.value]; )
        n.value += w;
    }
    async function x() {
      try {
        S.value = !0, await Fe.deferBulkCreateOffersFromPim(o.value), s.value = !1;
      } finally {
        S.value = !1;
      }
    }
    return (w, b) => (m(), g(e(Ie), {
      modelValue: s.value,
      "onUpdate:modelValue": b[5] || (b[5] = (v) => s.value = v),
      height: "90%",
      "padding-bottom": "",
      "padding-x": "",
      "cancel-caption": "",
      "content-padding-y": "",
      persistent: ""
    }, {
      default: a(() => [
        t(e(ke), {
          modelValue: n.value,
          "onUpdate:modelValue": b[4] || (b[4] = (v) => n.value = v),
          class: "h-100 overflow-hidden d-flex flex-column"
        }, {
          default: a(() => [
            t(e(Ee), { class: "flex-shrink-0" }, {
              default: a(() => [
                (m(!0), N(U, null, R(e(B), (v, r) => (m(), N(U, { key: r }, [
                  t(e(Pe), {
                    value: r + 1,
                    complete: n.value > r + 1,
                    title: e(p)(v)
                  }, null, 8, ["value", "complete", "title"]),
                  r < e(B).length - 1 ? (m(), g(e(De), { key: 0 })) : ce("", !0)
                ], 64))), 128))
              ]),
              _: 1
            }),
            k("div", je, [
              t(e(Le), null, {
                default: a(() => [
                  (m(), N(U, null, R(_, (v, r) => t(e(Be), {
                    key: r,
                    value: r + 1
                  }, {
                    default: a(() => [
                      (m(), g(de(v), {
                        value: o.value,
                        readonly: n.value === 4,
                        onValidated: c,
                        onNext: b[0] || (b[0] = (y) => u(1))
                      }, null, 40, ["value", "readonly"]))
                    ]),
                    _: 2
                  }, 1032, ["value"])), 64))
                ]),
                _: 1
              })
            ]),
            k("div", Ke, [
              t(e(P), {
                variant: "outlined",
                color: "secondary",
                disabled: n.value <= 1,
                text: e(p)("common.back"),
                onClick: b[1] || (b[1] = (v) => u(-1))
              }, null, 8, ["disabled", "text"]),
              t(e(Ne)),
              t(e(P), {
                variant: "outlined",
                color: "secondary",
                text: e(p)("common.cancel"),
                onClick: b[2] || (b[2] = (v) => s.value = !1)
              }, null, 8, ["text"]),
              n.value < e(B).length ? (m(), g(e(P), {
                key: 0,
                loading: S.value,
                disabled: !f.value[n.value - 1],
                text: e(p)("common.continue"),
                color: "primary",
                onClick: b[3] || (b[3] = (v) => u(1))
              }, null, 8, ["loading", "disabled", "text"])) : (m(), g(e(P), {
                key: 1,
                loading: S.value,
                disabled: !f.value[n.value - 1],
                text: e(p)("pim-channels-plugin.channels-from-pim-wizard.createOffer"),
                color: "primary",
                onClick: x
              }, null, 8, ["loading", "disabled", "text"]))
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]),
      _: 1
    }, 8, ["modelValue"]));
  }
});
typeof I == "function" && I(Qe);
export {
  Qe as default
};
