"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Root_exports = {};
__export(Root_exports, {
  default: () => Root_default
});
module.exports = __toCommonJS(Root_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_polished = require("polished");
var import_react = require("react");
var import_Element = require("../../../runtimes/react/components/Element");
var import_use_global_style = require("../../../runtimes/react/use-global-style");
var import_use_style = require("../../../runtimes/react/use-style");
var import_root_style_registry = require("../../../runtimes/react/root-style-registry");
var import_grid_item = require("../../shared/grid-item");
var import_BackgroundsContainer = __toESM(require("../../shared/BackgroundsContainer"));
var import_Placeholder = __toESM(require("./components/Placeholder"));
const Root = (0, import_react.forwardRef)(function Page({ children, backgrounds, rowGap, columnGap }, ref) {
  const cssResetEnabled = (0, import_root_style_registry.useCSSResetEnabled)();
  (0, import_use_global_style.useGlobalStyle)(
    cssResetEnabled ? [
      { html: { boxSizing: "border-box" }, "*, *::before, *::after": { boxSizing: "inherit" } },
      (0, import_polished.normalize)()
    ] : []
  );
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BackgroundsContainer.default, { ref, style: { background: "white" }, backgrounds, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_use_style.useStyle)({ display: "flex", flexWrap: "wrap", width: "100%" }), children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_grid_item.GridItem,
    {
      grid: children.columns,
      index,
      columnGap,
      rowGap,
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Element.Element, { element: child })
    },
    child.key
  )) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Placeholder.default, {}) }) });
});
var Root_default = Root;
//# sourceMappingURL=Root.js.map