import { j as l } from "../../../../../_virtual/jsx-runtime.js";
import p from "./json-form/FormNavigator.js";
import { b as v } from "../../../../sdk/dist/shared/chunk-I46VBMLF.js";
import { useMemo as g, useCallback as j } from "react";
import { merge as w, set as x } from "lodash-es";
import { getNavItemsFromManifest as A } from "./json-form/form-utils.js";
import { usePreviewMode as M } from "../../../../../use-editor.js";
import { useDraft as b } from "../../../../../use-page-data.js";
function E({
  attributes: o,
  attributesSchema: t,
  title: a,
  group: m,
  type: u
}) {
  const s = M(), i = b(), f = A(t, (e) => (typeof e.metadata?.["ui:responsive"] > "u" || e.metadata?.["ui:responsive"] === !0 || e.metadata?.["ui:responsive"] === s) && (typeof e["ui:responsive"] > "u" || e["ui:responsive"] === !0 || e["ui:responsive"] === s)), d = g(() => {
    const e = v(t);
    return w({}, e, o ?? {});
  }, [o, t]), c = j((e, n) => {
    console.trace("AttributesSettingsView onChange");
    const r = structuredClone(o);
    x(r, n, e[n]), u === "page" ? i.updatePageAttributes(r) : i.updateSiteAttributes(r);
  }, []);
  return /* @__PURE__ */ l.jsx(
    p,
    {
      brickId: "none",
      title: a,
      initialGroup: m,
      navItems: f,
      formSchema: t,
      className: "h-full",
      formData: d,
      onChange: c
    }
  );
}
export {
  E as default
};
//# sourceMappingURL=AttributesSettingsView.js.map
