import { X as K, av as k, aw as x, ax as W, Y as t, Z as j, gZ as z, a2 as O, w as c, S as C, O as g, g_ as I, cV as H, v as h, U as R, F as s, a6 as f, G as A, a7 as y, a8 as d, a9 as B, aa as F, ac as n, ab as N, ad as U, aB as D, g$ as P, cn as Z, h0 as _, h1 as G, at as u } from "./603b75d9.js";
import { useRef as L, useState as m, useEffect as M } from "react";
import "react-dom";
const X = K.div`
  height: 100%;
  width: 100%;
  ${(e) => e.$style && Y(e.$style)}
`, Y = (e) => k`
    margin: ${e.margin};
    padding: ${e.padding};
    border-style: ${e.borderStyle};
    border-width: ${e.borderWidth};
    border-color: ${e.border};
    background: ${e.background};
    border-radius: ${e.radius};
    max-width: ${x(e.margin)};
    max-height: ${W(e.margin)};
  `, q = [{
  key: "1",
  title: t("transfer.content", {
    i: 1
  })
}, {
  key: "2",
  title: t("transfer.content", {
    i: 2
  })
}, {
  key: "3",
  title: t("transfer.content", {
    i: 3
  })
}, {
  key: "4",
  title: t("transfer.content", {
    i: 4
  })
}, {
  key: "5",
  title: t("transfer.content", {
    i: 5
  })
}, {
  key: "6",
  title: t("transfer.content", {
    i: 6
  })
}, {
  key: "7",
  title: t("transfer.content", {
    i: 7
  })
}], J = [Z, _, G], Q = {
  style: j(z, "style"),
  onEvent: O(J),
  sourceTitle: c(C, t("transfer.sourceTitle")),
  targetTitle: c(C, t("transfer.targetTitle")),
  oneWay: g,
  pagination: g,
  showSearch: g.DEFAULT_TRUE,
  pageSize: c(U, 10),
  items: I("items", q),
  targetKeys: H("targetKeys", []),
  selectedKeys: h([[], []]),
  targerObject: h([]),
  searchInfo: h(["", ""])
}, ee = (e) => {
  const i = L(null), [o, S] = m(0), [l, v] = m(0), [E, T] = m([]);
  M(() => {
    l && o && b();
  }, [l, o]);
  const V = (a) => {
    e.targetKeys.onChange(a), e.dispatch(u("targerObject", Array.isArray(e.items.value) ? e.items.value.filter((r) => a.includes(r.key)) : [], !1)), e.onEvent("change");
  }, p = (a, r) => {
    T([...a, ...r]), e.dispatch(u("selectedKeys", [a, r], !1)), e.onEvent("selectedChange");
  }, $ = (a, r) => {
    e.dispatch(u("searchInfo", [a, r], !1)), e.onEvent("search");
  }, b = () => {
    const a = i.current;
    S((a == null ? void 0 : a.clientWidth) ?? 0), v((a == null ? void 0 : a.clientHeight) ?? 0);
  };
  return /* @__PURE__ */ s(D, {
    onResize: b,
    children: /* @__PURE__ */ s(X, {
      ref: i,
      $style: e.style,
      children: /* @__PURE__ */ s(P, {
        listStyle: {
          width: o,
          height: l
        },
        showSearch: e.showSearch,
        dataSource: e.items.value,
        titles: [e.targetTitle, e.sourceTitle],
        targetKeys: e.targetKeys.value,
        selectedKeys: E,
        onChange: V,
        onSelectChange: p,
        render: (a) => a.title,
        oneWay: e.oneWay,
        onSearch: $,
        pagination: e.pagination ? {
          pageSize: e.pageSize || 10
        } : !1
      })
    })
  });
};
let w = function() {
  return new R(Q, (e, i) => /* @__PURE__ */ s(ee, {
    ...e,
    dispatch: i
  })).setPropertyViewFn((e) => /* @__PURE__ */ f(A, {
    children: [/* @__PURE__ */ f(y, {
      name: d.basic,
      children: [e.items.propertyView({
        label: t("transfer.items")
      }), e.targetKeys.propertyView({
        label: t("transfer.targetKeys")
      }), e.sourceTitle.propertyView({
        label: t("transfer.sourceTitle")
      }), e.targetTitle.propertyView({
        label: t("transfer.targetTitle")
      }), e.showSearch.propertyView({
        label: t("transfer.allowSearch")
      }), e.oneWay.propertyView({
        label: t("transfer.oneWay")
      }), e.pagination.propertyView({
        label: t("transfer.pagination")
      }), e.pagination.getView() && e.pageSize.propertyView({
        label: t("transfer.pageSize")
      })]
    }), /* @__PURE__ */ f(y, {
      name: d.layout,
      children: [e.onEvent.propertyView(), B(e)]
    }), /* @__PURE__ */ s(y, {
      name: d.style,
      children: e.style.getPropertyView()
    })]
  })).build();
}();
w = class extends w {
  autoHeight() {
    return !1;
  }
};
const ne = F(w, [new n("items", t("transfer.items")), new n("targetKeys", t("transfer.targetKeys")), new n("targerObject", t("transfer.targerObject")), new n("selectedKeys", t("transfer.selectedKeys")), new n("searchInfo", t("transfer.searchInfo")), N]);
export {
  ne as transferComp
};
