import { e as u } from "../../../../sdk/dist/shared/chunk-ML4JSDQM.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-5DZIQGY2.js";
import "../../../../sdk/dist/shared/chunk-VDX2J22H.js";
import "../../../../sdk/dist/shared/chunk-URRCKLAS.js";
import "../../../../sdk/dist/shared/chunk-2NLDX5FG.js";
import "../../../../sdk/dist/shared/chunk-XED6ARVN.js";
import "../../../../sdk/dist/shared/chunk-3QOAHMV4.js";
import "../../../../sdk/dist/shared/chunk-EVDZ2KND.js";
import "../../../../sdk/dist/shared/chunk-3P36LG6T.js";
import "../../../../sdk/dist/shared/chunk-ARYG4XMX.js";
import "../../../../sdk/dist/shared/chunk-QGFQA7OZ.js";
import "../../../../sdk/dist/shared/chunk-5X5SX5N7.js";
import "../../../../sdk/dist/shared/chunk-6R76KIHZ.js";
import "../../../../sdk/dist/shared/chunk-K5ADUHF4.js";
import "../../../../sdk/dist/shared/chunk-Y3X4F4YJ.js";
import "../../../../sdk/dist/shared/chunk-LT4CW2F7.js";
import "../../../../sdk/dist/shared/chunk-ILIWVWHC.js";
import "../../../../sdk/dist/shared/chunk-SAJY7H6N.js";
import "../../../../sdk/dist/shared/chunk-STDCM2KD.js";
import "../../../../sdk/dist/shared/chunk-TH5SONR6.js";
import { merge as x, get as a } from "lodash-es";
import "../../../../sdk/dist/shared/chunk-UDQWYGSO.js";
import "../../../../sdk/dist/shared/chunk-AZHH3XJJ.js";
import "../../../../sdk/dist/shared/chunk-6PGAWO4H.js";
import { b as S, d as P } from "../../../../sdk/dist/shared/chunk-LEWKHCRI.js";
import "../../../../sdk/dist/shared/chunk-F4JNKU7J.js";
import "../../../../sdk/dist/shared/chunk-7UBMXMNJ.js";
import "../../../../sdk/dist/shared/chunk-JRCVYDCD.js";
import { extractStylePath as w, brickStylesHelpersMap as y, brickWrapperStylesHelpersMap as H } from "../styles/helpers.js";
import { tx as h, css as g } from "../../../../style-system/dist/twind.js";
import { getStyleProperties as F } from "../styles/style-props.js";
import { usePageAttributes as j } from "../../../../../use-page-data.js";
function at({
  section: t,
  selected: i,
  editable: s,
  previewMode: p,
  isDropTarget: f
}) {
  const m = F(u), d = k(m, t);
  return h(
    // @mobile:flex-col @desktop:flex-row
    "flex flex-wrap w-full @container/section group/section overflow-visible relative mx-auto max-sm:max-w-dvw",
    [
      Object.values(d),
      t.props.maxWidth,
      typeof t.props.minHeight == "string" && t.props.minHeight !== "full" && `min-h-[${t.props.minHeight}]`,
      // full height
      t.props.minHeight === "full" && (s ? "min-h-[calc(100dvh-60px)]" : "min-h-dvh"),
      g({
        "&:has([data-no-section-padding])": {
          // This is a hack to ensure that the navbar is not affected by the section's padding
          paddingInline: "0px !important",
          paddingBlock: "0px !important"
        }
      }),
      // Section editor styles
      M({ editable: s, previewMode: p, selected: i, isDropTarget: f }),
      // Manage the section order using css "order" (flex) property
      g({
        order: t.order
      })
    ]
  );
}
function M({ editable: t, selected: i, previewMode: s, isDropTarget: p }) {
  return t ? [
    "select-none relative outline-dashed outline-2 -outline-offset-2",
    !p && !i && "outline-transparent",
    i || p ? "outline-upstart-500/40" : "hover:outline-upstart-500/40",
    // this is the grid overlay shown when dragging
    s && g`
      &:has(.moving), &:has(.moving) ~ section {
        & [data-floating-ui-portal] {
          display: none;
        }
        & .resizable-handle {
          display: none;
        }
      }`
  ] : null;
}
const O = S(u);
function k(t, i) {
  const { props: s, mobileProps: p } = i, f = j(), m = x({}, O, s), d = Object.entries(t).reduce((r, [e, l]) => {
    const n = a(u.properties, e);
    if (n) {
      const o = P(n);
      if (o.metadata?.filter) {
        const c = o.metadata.filter;
        c(o, m, f) || r.push(e);
      }
    }
    return r;
  }, []);
  return Object.entries(t).reduce(
    (r, [e, l]) => {
      const n = y[l] ?? H[l];
      if (!n)
        return console.warn("No helper found for styleId", l), r;
      if (d.includes(e))
        return console.warn("Filtered out section path", e), r;
      const o = w(e);
      r[o] = r[o] ?? [];
      const c = a(m, e), v = a(p, e), b = a(u.properties, e);
      return r[o].push(
        // @ts-expect-error
        h(n?.(c, v, b))
      ), r;
    },
    {}
  );
}
export {
  at as useSectionStyle
};
//# sourceMappingURL=use-section-style.js.map
