import { jsx as o, jsxs as s } from "@emotion/react/jsx-runtime";
import { useModuleDictionary as I, useEnvironment as w } from "@m4l/core";
import { useIsMobile as D } from "@m4l/graphics";
import { useRef as A, useCallback as l } from "react";
import { useModal as G } from "../../../../../../../../hooks/useModal/index.js";
import { ContentModalSettingStyled as H, DataGridRootStyled as W } from "../../../../../../slots/DataGridSlot.js";
import { pathIcons as y } from "../../../../../../icons.js";
import { ColumnsConfig as R } from "../../subcomponents/ColumnsConfig/ColumnsConfig.js";
import { ActionsContainer as v } from "../../../../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
import { useDataGrid as x } from "../../../../../../hooks/shared/useDataGrid/useDataGrid.js";
import { WindowBase as L } from "../../../../../../../WindowBase/WindowBase.js";
import { ActionCancel as O } from "../../../../../../../CommonActions/components/ActionCancel/ActionCancel.js";
import { ActionIntro as T } from "../../../../../../../CommonActions/components/ActionIntro/ActionIntro.js";
const a = 520, U = 80, Z = (c, i) => {
  const { openModal: m, closeModal: t } = G(), {
    columnsConfig: d,
    onChangeColumnsConfig: u,
    currentRowHeight: g,
    classes: r,
    reorderable: C
  } = x(), { getLabel: f } = I(), { host_static_assets: p, environment_assets: h } = w(), S = D(), e = A(null), M = i.some(
    (n) => n.groupable === !0 || n.grouped === !0
  ) ? a + U : a, b = l(() => {
    t();
  }, [t]), _ = l(() => {
    e.current?.onClickIntro && e.current.onClickIntro();
  }, []), k = (n) => {
    u("table", n);
  };
  return () => {
    m({
      initialWidth: M,
      initialHeight: 680,
      fullScreen: S,
      window: /* @__PURE__ */ o(
        L,
        {
          title: f("data_grid.settings_title"),
          iconUrl: `${p}/${h}/${y.configuration}`,
          onClose: t,
          className: "settings-modal",
          variant: "outlined",
          emergeType: "modal",
          children: /* @__PURE__ */ s(H, { ownerState: {}, classes: r?.contentModalSetting, children: [
            /* @__PURE__ */ o(W, { ownerState: {}, children: /* @__PURE__ */ o(
              R,
              {
                ref: e,
                rowHeight: g,
                columnsConfig: d,
                onChangeColumnsConfig: k,
                onCloseSettings: b,
                classes: r,
                size: c,
                columns: i,
                reorderable: C
              }
            ) }),
            /* @__PURE__ */ s(v, { children: [
              /* @__PURE__ */ o(O, { onClick: t }),
              /* @__PURE__ */ o(T, { onClick: _, "data-testid": "data-grid-settings-intro" })
            ] })
          ] })
        }
      )
    });
  };
};
export {
  Z as useModalSettings
};
