import { j as v } from "../../../../../_virtual/jsx-runtime.js";
import S from "./json-form/FormNavigator.js";
import { f as m } 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 n, set as w } 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 } 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 { useCallback as d, useMemo as u } from "react";
import { usePreviewMode as x } from "../../../../../use-editor.js";
import { getNavItemsFromManifest as h } from "./json-form/form-utils.js";
import { useLocalStorage as y } from "../../../../../node_modules/.pnpm/usehooks-ts@3.1.1_react@18.3.0-canary-3d9b20132-20240124/node_modules/usehooks-ts/dist/index.js";
import { useDraftHelpers as M } from "../../../../../use-page-data.js";
function po({ section: t, group: f }) {
  const { updateSectionProps: s } = M(), r = x(), [p, P] = y("upstart:editor:show-advanced", !1), a = d(
    (o) => (typeof o.metadata?.["ui:responsive"] > "u" || o.metadata?.["ui:responsive"] === !0 || o.metadata?.["ui:responsive"] === r) && (typeof o["ui:responsive"] > "u" || o["ui:responsive"] === !0 || o["ui:responsive"] === r) && (!o.metadata?.category || o.metadata?.category === "settings") && (!o["ui:advanced"] || p),
    [r, p]
  ), l = u(() => h(m.properties.props, a), [a]), c = u(() => {
    const o = b(m.properties.props, r);
    return r === "mobile" ? n({}, o, t.props, t.mobileProps) : n({}, o, t.props ?? {});
  }, [r, t.props, t.mobileProps]), g = d(
    (o, e) => {
      if (!e) {
        console.warn("propertyChangedPath is missing in style tab");
        return;
      }
      const i = structuredClone(t?.props ?? {});
      w(i, e, o[e]), console.log("SectionSettingsView onChange", {
        props: i
      }), s(t.id, i, r === "mobile");
    },
    [t.id, r, s, t.props]
  );
  return /* @__PURE__ */ v.jsx(
    S,
    {
      title: "Section settings",
      initialGroup: f,
      navItems: l,
      formSchema: m.properties.props,
      className: "flex-grow",
      formData: c,
      onChange: g,
      brickId: t.id
    },
    `section-settings-${t.id}-${r}`
  );
}
export {
  po as default
};
//# sourceMappingURL=SectionSettingsView.js.map
