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-GOMXZC4B.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-PSCN3VVA.js";
import "../../../../sdk/dist/shared/chunk-R6ATC4TC.js";
import "../../../../sdk/dist/shared/chunk-CFF6Q7O7.js";
import "../../../../sdk/dist/shared/chunk-IKC3FK7L.js";
import "../../../../sdk/dist/shared/chunk-E6XEI7IK.js";
import "../../../../sdk/dist/shared/chunk-SQ5T4AT5.js";
import "../../../../sdk/dist/shared/chunk-G5CJU6RD.js";
import "../../../../sdk/dist/shared/chunk-PSTFJ5IJ.js";
import "../../../../sdk/dist/shared/chunk-NJGXC7D6.js";
import "../../../../sdk/dist/shared/chunk-SXHDQ64Z.js";
import "../../../../sdk/dist/shared/chunk-QX6OGRRT.js";
import "../../../../sdk/dist/shared/chunk-FLOMNC6J.js";
import "../../../../sdk/dist/shared/chunk-PLSV746R.js";
import "../../../../sdk/dist/shared/chunk-WBZW5LVH.js";
import "../../../../sdk/dist/shared/chunk-WYVJE6J5.js";
import "../../../../sdk/dist/shared/chunk-I3VL6SRH.js";
import "../../../../sdk/dist/shared/chunk-B3EATRFX.js";
import "../../../../sdk/dist/shared/chunk-IKHZD2JH.js";
import "../../../../sdk/dist/shared/chunk-PXI7AHWS.js";
import { merge as n, set as w } from "lodash-es";
import "../../../../sdk/dist/shared/chunk-SY6DZLTC.js";
import "../../../../sdk/dist/shared/chunk-7A2JNQX3.js";
import "../../../../sdk/dist/shared/chunk-3YVJ2ELD.js";
import { b } from "../../../../sdk/dist/shared/chunk-QGYZ7CG5.js";
import "../../../../sdk/dist/shared/chunk-AFVJZPLS.js";
import "../../../../sdk/dist/shared/chunk-A3GF4PYW.js";
import "../../../../sdk/dist/shared/chunk-W33JMRRN.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
