"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 register_exports = {};
__export(register_exports, {
  registerComponent: () => registerComponent
});
module.exports = __toCommonJS(register_exports);
var import_controls = require("@makeswift/controls");
var import_constants = require("../constants");
var import_components_meta = require("../../../state/modules/components-meta");
var import_react = require("react");
var import_prop_controllers = require("@makeswift/prop-controllers");
function registerComponent(runtime) {
  function isHiddenBasedOnMenuAnimation(props, deviceId) {
    const mobileMenuAnimation = import_prop_controllers.ResponsiveSelect.fromPropData(
      props.mobileMenuAnimation
    );
    return !(0, import_controls.findBreakpointOverride)(runtime.getBreakpoints(), mobileMenuAnimation, deviceId);
  }
  return runtime.registerComponent(
    (0, import_react.lazy)(() => Promise.resolve().then(() => __toESM(require("./Navigation")))),
    {
      type: import_constants.MakeswiftComponentType.Navigation,
      label: "Navigation",
      icon: import_components_meta.ComponentIcon.Navigation,
      props: {
        id: (0, import_prop_controllers.ElementID)(),
        links: (0, import_prop_controllers.NavigationLinks)(),
        linkTextStyle: (0, import_prop_controllers.TextStyle)((props) => {
          const links = props.links;
          return {
            label: "Link text style",
            hidden: links == null || links.length === 0
          };
        }),
        showLogo: (0, import_prop_controllers.Checkbox)({ preset: true, label: "Show logo" }),
        logoFile: (0, import_prop_controllers.Image)((props) => ({
          label: "Logo",
          hidden: (0, import_prop_controllers.getCheckboxPropControllerDataBoolean)(
            import_prop_controllers.checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
          ) === false
        })),
        logoWidth: (0, import_prop_controllers.ResponsiveLength)((props) => ({
          // TODO(miguel): We're manually constructing the data here but should be using a factory
          // function instead. This is because the factory function currently expects a definition
          // but we don't have one to pass here. Perhaps we should make the factory function not
          // require the definition and use the latest version when a definition isn't provided.
          preset: {
            [import_prop_controllers.ControlDataTypeKey]: import_prop_controllers.ResponsiveLengthPropControllerDataV1Type,
            value: [
              {
                deviceId: (0, import_controls.getBaseBreakpoint)(runtime.getBreakpoints()).id,
                value: { value: 100, unit: "px" }
              }
            ]
          },
          label: "Logo width",
          min: 0,
          max: 1e3,
          // TODO: This is hardcoded value, import it from LengthInputOptions
          options: [{ value: "px", label: "Pixels", icon: "Px16" }],
          hidden: (0, import_prop_controllers.getCheckboxPropControllerDataBoolean)(
            import_prop_controllers.checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
          ) === false
        })),
        logoAltText: (0, import_prop_controllers.TextInput)((props) => ({
          label: "Logo alt text",
          hidden: (0, import_prop_controllers.getCheckboxPropControllerDataBoolean)(
            import_prop_controllers.checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
          ) === false
        })),
        logoLink: (0, import_prop_controllers.Link)((props) => ({
          label: "Logo on click",
          hidden: (0, import_prop_controllers.getCheckboxPropControllerDataBoolean)(
            import_prop_controllers.checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
          ) === false
        })),
        alignment: (0, import_prop_controllers.ResponsiveIconRadioGroup)({
          label: "Alignment",
          options: [
            { label: "Left", value: "flex-start", icon: "AlignLeft16" },
            { label: "Center", value: "center", icon: "AlignCenter16" },
            { label: "End", value: "flex-end", icon: "AlignRight16" }
          ],
          defaultValue: "flex-end"
        }),
        gutter: (0, import_prop_controllers.GapX)({
          preset: [
            {
              deviceId: (0, import_controls.getBaseBreakpoint)(runtime.getBreakpoints()).id,
              value: { value: 10, unit: "px" }
            }
          ],
          label: "Link gap",
          min: 0,
          max: 100,
          step: 1,
          defaultValue: { value: 0, unit: "px" }
        }),
        mobileMenuAnimation: (0, import_prop_controllers.ResponsiveSelect)({
          label: "Mobile menu",
          options: [
            { value: "coverRight", label: "Cover from right" },
            { value: "coverLeft", label: "Cover from left" }
          ]
        }),
        mobileMenuOpenIconColor: (0, import_prop_controllers.ResponsiveColor)((props, device) => {
          return {
            label: "Open icon color",
            placeholder: "rgba(161, 168, 194, 0.5)",
            hidden: isHiddenBasedOnMenuAnimation(props, device)
          };
        }),
        mobileMenuCloseIconColor: (0, import_prop_controllers.ResponsiveColor)((props, device) => {
          return {
            label: "Close icon color",
            placeholder: "rgba(161, 168, 194, 0.5)",
            hidden: isHiddenBasedOnMenuAnimation(props, device)
          };
        }),
        mobileMenuBackgroundColor: (0, import_prop_controllers.ResponsiveColor)((props, device) => {
          return {
            label: "Menu BG color",
            placeholder: "black",
            hidden: isHiddenBasedOnMenuAnimation(props, device)
          };
        }),
        width: (0, import_prop_controllers.Width)({
          format: import_prop_controllers.Width.Format.ClassName,
          defaultValue: { value: 100, unit: "%" }
        }),
        margin: (0, import_prop_controllers.Margin)({ format: import_prop_controllers.Margin.Format.ClassName })
      }
    }
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  registerComponent
});
//# sourceMappingURL=register.js.map