import { jsx as o, jsxs as e } from "@emotion/react/jsx-runtime";
import { useModuleDictionary as M } from "@m4l/core";
import { useIsMobile as k } from "@m4l/graphics";
import { useRef as w, useCallback as r } from "react";
import { useModal as I } from "../../../../../../../../hooks/useModal/index.js";
import { ContentModalSettingStyled as b, DataGridRootStyled as y } from "../../../../../../slots/DataGridSlot.js";
import { SettingsConfigOutlined as x } from "@m4l/icons";
import { ColumnsConfig as A } from "../../subcomponents/ColumnsConfig/ColumnsConfig.js";
import { ActionsContainer as D } from "../../../../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
import { useDataGrid as H } from "../../../../../../hooks/shared/useDataGrid/useDataGrid.js";
import { WindowBase as R } from "../../../../../../../WindowBase/WindowBase.js";
import { ActionCancel as j } from "../../../../../../../CommonActions/components/ActionCancel/ActionCancel.js";
import { ActionIntro as G } from "../../../../../../../CommonActions/components/ActionIntro/ActionIntro.js";
const K = (l, s) => {
  const { openModal: c, closeModal: t } = I(), { getConfigColumns: m, onChangeColumnsConfig: a, currentRowHeight: C, classes: i } = H(), d = m("list"), { getLabel: g } = M(), f = k(), n = w(null), u = r(() => {
    t();
  }, [t]), p = r(() => {
    n.current?.onClickIntro && n.current.onClickIntro();
  }, []), S = (h) => {
    a("list", h);
  };
  return () => {
    c({
      initialWidth: 500,
      initialHeight: 680,
      fullScreen: f,
      window: /* @__PURE__ */ o(
        R,
        {
          title: g("data_grid.settings_title"),
          iconUrl: /* @__PURE__ */ o(x, {}),
          onClose: t,
          className: "settings-modal",
          variant: "outlined",
          emergeType: "modal",
          children: /* @__PURE__ */ e(b, { ownerState: {}, classes: i?.contentModalSetting, children: [
            /* @__PURE__ */ o(y, { ownerState: {}, children: /* @__PURE__ */ o(
              A,
              {
                ref: n,
                rowHeight: C,
                columnsConfig: d,
                onChangeColumnsConfig: S,
                onCloseSettings: u,
                classes: i,
                size: l,
                columns: s
              }
            ) }),
            /* @__PURE__ */ e(D, { children: [
              /* @__PURE__ */ o(j, { onClick: t }),
              /* @__PURE__ */ o(G, { onClick: p })
            ] })
          ] })
        }
      )
    });
  };
};
export {
  K as useModalSettings
};
