"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);

// src/index.ts
var src_exports = {};
__export(src_exports, {
  Form: () => MuiForm_default,
  Templates: () => Templates_default,
  Theme: () => Theme_default,
  Widgets: () => Widgets_default,
  default: () => src_default,
  generateForm: () => generateForm,
  generateTemplates: () => generateTemplates,
  generateTheme: () => generateTheme,
  generateWidgets: () => generateWidgets
});
module.exports = __toCommonJS(src_exports);

// src/MuiForm/MuiForm.tsx
var import_core = require("@rjsf/core");

// src/AddButton/AddButton.tsx
var import_Add = __toESM(require("@material-ui/icons/Add"));
var import_IconButton = __toESM(require("@material-ui/core/IconButton"));
var import_utils = require("@rjsf/utils");
var import_jsx_runtime = require("react/jsx-runtime");
function AddButton({
  uiSchema,
  registry,
  ...props
}) {
  const { translateString } = registry;
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_IconButton.default, { title: translateString(import_utils.TranslatableString.AddItemButton), ...props, color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Add.default, {}) });
}

// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
var import_Box = __toESM(require("@material-ui/core/Box"));
var import_Grid = __toESM(require("@material-ui/core/Grid"));
var import_Paper = __toESM(require("@material-ui/core/Paper"));
var import_jsx_runtime2 = require("react/jsx-runtime");
function ArrayFieldItemTemplate(props) {
  const {
    children,
    disabled,
    hasToolbar,
    hasCopy,
    hasMoveDown,
    hasMoveUp,
    hasRemove,
    index,
    onCopyIndexClick,
    onDropIndexClick,
    onReorderClick,
    readonly,
    uiSchema,
    registry
  } = props;
  const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
  const btnStyle = {
    flex: 1,
    paddingLeft: 6,
    paddingRight: 6,
    fontWeight: "bold",
    minWidth: 0
  };
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_Grid.default, { container: true, alignItems: "center", children: [
    /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Grid.default, { item: true, xs: true, style: { overflow: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Box.default, { mb: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Paper.default, { elevation: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Box.default, { p: 2, children }) }) }) }),
    hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_Grid.default, { item: true, children: [
      (hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
        MoveUpButton2,
        {
          style: btnStyle,
          disabled: disabled || readonly || !hasMoveUp,
          onClick: onReorderClick(index, index - 1),
          uiSchema,
          registry
        }
      ),
      (hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
        MoveDownButton2,
        {
          style: btnStyle,
          disabled: disabled || readonly || !hasMoveDown,
          onClick: onReorderClick(index, index + 1),
          uiSchema,
          registry
        }
      ),
      hasCopy && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
        CopyButton2,
        {
          style: btnStyle,
          disabled: disabled || readonly,
          onClick: onCopyIndexClick(index),
          uiSchema,
          registry
        }
      ),
      hasRemove && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
        RemoveButton2,
        {
          style: btnStyle,
          disabled: disabled || readonly,
          onClick: onDropIndexClick(index),
          uiSchema,
          registry
        }
      )
    ] })
  ] });
}

// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
var import_Box2 = __toESM(require("@material-ui/core/Box"));
var import_Grid2 = __toESM(require("@material-ui/core/Grid"));
var import_Paper2 = __toESM(require("@material-ui/core/Paper"));
var import_utils2 = require("@rjsf/utils");
var import_jsx_runtime3 = require("react/jsx-runtime");
function ArrayFieldTemplate(props) {
  const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } = props;
  const uiOptions = (0, import_utils2.getUiOptions)(uiSchema);
  const ArrayFieldDescriptionTemplate = (0, import_utils2.getTemplate)(
    "ArrayFieldDescriptionTemplate",
    registry,
    uiOptions
  );
  const ArrayFieldItemTemplate2 = (0, import_utils2.getTemplate)(
    "ArrayFieldItemTemplate",
    registry,
    uiOptions
  );
  const ArrayFieldTitleTemplate = (0, import_utils2.getTemplate)(
    "ArrayFieldTitleTemplate",
    registry,
    uiOptions
  );
  const {
    ButtonTemplates: { AddButton: AddButton2 }
  } = registry.templates;
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Paper2.default, { elevation: 2, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_Box2.default, { p: 2, children: [
    /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
      ArrayFieldTitleTemplate,
      {
        idSchema,
        title: uiOptions.title || title,
        schema,
        uiSchema,
        required,
        registry
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
      ArrayFieldDescriptionTemplate,
      {
        idSchema,
        description: uiOptions.description || schema.description,
        schema,
        uiSchema,
        registry
      }
    ),
    items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrayFieldItemTemplate2, { ...itemProps }, key)),
    canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid2.default, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid2.default, { item: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Box2.default, { mt: 2, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
      AddButton2,
      {
        className: "array-item-add",
        onClick: onAddClick,
        disabled: disabled || readonly,
        uiSchema,
        registry
      }
    ) }) }) })
  ] }) });
}

// src/BaseInputTemplate/BaseInputTemplate.tsx
var import_TextField = __toESM(require("@material-ui/core/TextField"));
var import_utils3 = require("@rjsf/utils");
var import_jsx_runtime4 = require("react/jsx-runtime");
var TYPES_THAT_SHRINK_LABEL = ["date", "datetime-local", "file", "time"];
function BaseInputTemplate(props) {
  const {
    id,
    name,
    // remove this from textFieldProps
    placeholder,
    required,
    readonly,
    disabled,
    type,
    label,
    hideLabel,
    hideError,
    value,
    onChange,
    onChangeOverride,
    onBlur,
    onFocus,
    autofocus,
    options,
    schema,
    uiSchema,
    rawErrors = [],
    formContext,
    registry,
    InputLabelProps,
    ...textFieldProps
  } = props;
  const inputProps = (0, import_utils3.getInputProps)(schema, type, options);
  const { step, min, max, ...rest } = inputProps;
  const otherProps = {
    inputProps: {
      step,
      min,
      max,
      ...schema.examples ? { list: (0, import_utils3.examplesId)(id) } : void 0
    },
    ...rest
  };
  const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
  const _onBlur = ({ target }) => onBlur(id, target && target.value);
  const _onFocus = ({ target }) => onFocus(id, target && target.value);
  const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? {
    ...InputLabelProps,
    shrink: true
  } : InputLabelProps;
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
      import_TextField.default,
      {
        id,
        name: id,
        placeholder,
        label: (0, import_utils3.labelValue)(label || void 0, hideLabel, false),
        autoFocus: autofocus,
        required,
        disabled: disabled || readonly,
        ...otherProps,
        value: value || value === 0 ? value : "",
        error: rawErrors.length > 0,
        onChange: onChangeOverride || _onChange,
        onBlur: _onBlur,
        onFocus: _onFocus,
        InputLabelProps: DisplayInputLabelProps,
        ...textFieldProps,
        "aria-describedby": (0, import_utils3.ariaDescribedByIds)(id, !!schema.examples)
      }
    ),
    Array.isArray(schema.examples) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("datalist", { id: (0, import_utils3.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
      return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: example }, example);
    }) })
  ] });
}

// src/DescriptionField/DescriptionField.tsx
var import_Typography = __toESM(require("@material-ui/core/Typography"));
var import_jsx_runtime5 = require("react/jsx-runtime");
function DescriptionField(props) {
  const { id, description } = props;
  if (description) {
    return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Typography.default, { id, variant: "subtitle2", style: { marginTop: "5px" }, children: description });
  }
  return null;
}

// src/ErrorList/ErrorList.tsx
var import_Error = __toESM(require("@material-ui/icons/Error"));
var import_Box3 = __toESM(require("@material-ui/core/Box"));
var import_List = __toESM(require("@material-ui/core/List"));
var import_ListItem = __toESM(require("@material-ui/core/ListItem"));
var import_ListItemIcon = __toESM(require("@material-ui/core/ListItemIcon"));
var import_ListItemText = __toESM(require("@material-ui/core/ListItemText"));
var import_Paper3 = __toESM(require("@material-ui/core/Paper"));
var import_Typography2 = __toESM(require("@material-ui/core/Typography"));
var import_utils4 = require("@rjsf/utils");
var import_jsx_runtime6 = require("react/jsx-runtime");
function ErrorList({
  errors,
  registry
}) {
  const { translateString } = registry;
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Paper3.default, { elevation: 2, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_Box3.default, { mb: 2, p: 2, children: [
    /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Typography2.default, { variant: "h6", children: translateString(import_utils4.TranslatableString.ErrorsLabel) }),
    /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_List.default, { dense: true, children: errors.map((error, i) => {
      return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_ListItem.default, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListItemIcon.default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Error.default, { color: "error" }) }),
        /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListItemText.default, { primary: error.stack })
      ] }, i);
    }) })
  ] }) });
}

// src/IconButton/IconButton.tsx
var import_IconButton2 = __toESM(require("@material-ui/core/IconButton"));
var import_ArrowUpward = __toESM(require("@material-ui/icons/ArrowUpward"));
var import_ArrowDownward = __toESM(require("@material-ui/icons/ArrowDownward"));
var import_FileCopy = __toESM(require("@material-ui/icons/FileCopy"));
var import_Remove = __toESM(require("@material-ui/icons/Remove"));
var import_utils5 = require("@rjsf/utils");
var import_jsx_runtime7 = require("react/jsx-runtime");
function MuiIconButton(props) {
  const { icon, color, uiSchema, registry, ...otherProps } = props;
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_IconButton2.default, { ...otherProps, size: "small", color, children: icon });
}
function CopyButton(props) {
  const {
    registry: { translateString }
  } = props;
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
    MuiIconButton,
    {
      title: translateString(import_utils5.TranslatableString.CopyButton),
      ...props,
      icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_FileCopy.default, { fontSize: "small" })
    }
  );
}
function MoveDownButton(props) {
  const {
    registry: { translateString }
  } = props;
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
    MuiIconButton,
    {
      title: translateString(import_utils5.TranslatableString.MoveDownButton),
      ...props,
      icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowDownward.default, { fontSize: "small" })
    }
  );
}
function MoveUpButton(props) {
  const {
    registry: { translateString }
  } = props;
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
    MuiIconButton,
    {
      title: translateString(import_utils5.TranslatableString.MoveUpButton),
      ...props,
      icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowUpward.default, { fontSize: "small" })
    }
  );
}
function RemoveButton(props) {
  const { iconType, ...otherProps } = props;
  const {
    registry: { translateString }
  } = otherProps;
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
    MuiIconButton,
    {
      title: translateString(import_utils5.TranslatableString.RemoveButton),
      ...otherProps,
      color: "secondary",
      icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Remove.default, { fontSize: iconType === "default" ? "medium" : "small" })
    }
  );
}

// src/FieldErrorTemplate/FieldErrorTemplate.tsx
var import_ListItem2 = __toESM(require("@material-ui/core/ListItem"));
var import_FormHelperText = __toESM(require("@material-ui/core/FormHelperText"));
var import_List2 = __toESM(require("@material-ui/core/List"));
var import_utils6 = require("@rjsf/utils");
var import_jsx_runtime8 = require("react/jsx-runtime");
function FieldErrorTemplate(props) {
  const { errors = [], idSchema } = props;
  if (errors.length === 0) {
    return null;
  }
  const id = (0, import_utils6.errorId)(idSchema);
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_List2.default, { dense: true, disablePadding: true, children: errors.map((error, i) => {
    return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ListItem2.default, { disableGutters: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_FormHelperText.default, { id, children: error }) }, i);
  }) });
}

// src/FieldHelpTemplate/FieldHelpTemplate.tsx
var import_FormHelperText2 = __toESM(require("@material-ui/core/FormHelperText"));
var import_utils7 = require("@rjsf/utils");
var import_jsx_runtime9 = require("react/jsx-runtime");
function FieldHelpTemplate(props) {
  const { idSchema, help } = props;
  if (!help) {
    return null;
  }
  const id = (0, import_utils7.helpId)(idSchema);
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_FormHelperText2.default, { id, children: help });
}

// src/FieldTemplate/FieldTemplate.tsx
var import_FormControl = __toESM(require("@material-ui/core/FormControl"));
var import_Typography3 = __toESM(require("@material-ui/core/Typography"));
var import_utils8 = require("@rjsf/utils");
var import_jsx_runtime10 = require("react/jsx-runtime");
function FieldTemplate(props) {
  const {
    id,
    children,
    classNames,
    style,
    disabled,
    displayLabel,
    hidden,
    label,
    onDropPropertyClick,
    onKeyChange,
    readonly,
    required,
    rawErrors = [],
    errors,
    help,
    description,
    rawDescription,
    schema,
    uiSchema,
    registry
  } = props;
  const uiOptions = (0, import_utils8.getUiOptions)(uiSchema);
  const WrapIfAdditionalTemplate2 = (0, import_utils8.getTemplate)(
    "WrapIfAdditionalTemplate",
    registry,
    uiOptions
  );
  if (hidden) {
    return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "none" }, children });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
    WrapIfAdditionalTemplate2,
    {
      classNames,
      style,
      disabled,
      id,
      label,
      onDropPropertyClick,
      onKeyChange,
      readonly,
      required,
      schema,
      uiSchema,
      registry,
      children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_FormControl.default, { fullWidth: true, error: rawErrors.length ? true : false, required, children: [
        children,
        displayLabel && rawDescription ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_Typography3.default, { variant: "caption", color: "textSecondary", children: description }) : null,
        errors,
        help
      ] })
    }
  );
}

// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
var import_Grid3 = __toESM(require("@material-ui/core/Grid"));
var import_utils9 = require("@rjsf/utils");
var import_jsx_runtime11 = require("react/jsx-runtime");
function ObjectFieldTemplate(props) {
  const {
    description,
    title,
    properties,
    required,
    disabled,
    readonly,
    uiSchema,
    idSchema,
    schema,
    formData,
    onAddClick,
    registry
  } = props;
  const uiOptions = (0, import_utils9.getUiOptions)(uiSchema);
  const TitleFieldTemplate = (0, import_utils9.getTemplate)("TitleFieldTemplate", registry, uiOptions);
  const DescriptionFieldTemplate = (0, import_utils9.getTemplate)(
    "DescriptionFieldTemplate",
    registry,
    uiOptions
  );
  const {
    ButtonTemplates: { AddButton: AddButton2 }
  } = registry.templates;
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
    title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
      TitleFieldTemplate,
      {
        id: (0, import_utils9.titleId)(idSchema),
        title,
        required,
        schema,
        uiSchema,
        registry
      }
    ),
    description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
      DescriptionFieldTemplate,
      {
        id: (0, import_utils9.descriptionId)(idSchema),
        description,
        schema,
        uiSchema,
        registry
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_Grid3.default, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
      properties.map(
        (element, index) => (
          // Remove the <Grid> if the inner element is hidden as the <Grid>
          // itself would otherwise still take up space.
          element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Grid3.default, { item: true, xs: 12, style: { marginBottom: "10px" }, children: element.content }, index)
        )
      ),
      (0, import_utils9.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Grid3.default, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Grid3.default, { item: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
        AddButton2,
        {
          className: "object-property-expand",
          onClick: onAddClick(schema),
          disabled: disabled || readonly,
          uiSchema,
          registry
        }
      ) }) })
    ] })
  ] });
}

// src/SubmitButton/SubmitButton.tsx
var import_Box4 = __toESM(require("@material-ui/core/Box"));
var import_Button = __toESM(require("@material-ui/core/Button"));
var import_utils10 = require("@rjsf/utils");
var import_jsx_runtime12 = require("react/jsx-runtime");
function SubmitButton({ uiSchema }) {
  const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils10.getSubmitButtonOptions)(uiSchema);
  if (norender) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Box4.default, { marginTop: 3, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Button.default, { type: "submit", variant: "contained", color: "primary", ...submitButtonProps, children: submitText }) });
}

// src/TitleField/TitleField.tsx
var import_Box5 = __toESM(require("@material-ui/core/Box"));
var import_Divider = __toESM(require("@material-ui/core/Divider"));
var import_Typography4 = __toESM(require("@material-ui/core/Typography"));
var import_jsx_runtime13 = require("react/jsx-runtime");
function TitleField({
  id,
  title
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Box5.default, { id, mb: 1, mt: 1, children: [
    /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Typography4.default, { variant: "h5", children: title }),
    /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Divider.default, {})
  ] });
}

// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
var import_Grid4 = __toESM(require("@material-ui/core/Grid"));
var import_TextField2 = __toESM(require("@material-ui/core/TextField"));
var import_utils11 = require("@rjsf/utils");
var import_jsx_runtime14 = require("react/jsx-runtime");
function WrapIfAdditionalTemplate(props) {
  const {
    children,
    classNames,
    style,
    disabled,
    id,
    label,
    onDropPropertyClick,
    onKeyChange,
    readonly,
    required,
    schema,
    uiSchema,
    registry
  } = props;
  const { templates, translateString } = registry;
  const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
  const keyLabel = translateString(import_utils11.TranslatableString.KeyLabel, [label]);
  const additional = import_utils11.ADDITIONAL_PROPERTY_FLAG in schema;
  const btnStyle = {
    flex: 1,
    paddingLeft: 6,
    paddingRight: 6,
    fontWeight: "bold"
  };
  if (!additional) {
    return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: classNames, style, children });
  }
  const handleBlur = ({ target }) => onKeyChange(target.value);
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_Grid4.default, { container: true, alignItems: "center", spacing: 2, className: classNames, style, children: [
    /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Grid4.default, { item: true, xs: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
      import_TextField2.default,
      {
        fullWidth: true,
        required,
        label: keyLabel,
        defaultValue: label,
        disabled: disabled || readonly,
        id: `${id}-key`,
        name: `${id}-key`,
        onBlur: !readonly ? handleBlur : void 0,
        type: "text"
      }
    ) }),
    /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Grid4.default, { item: true, xs: true, children }),
    /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Grid4.default, { item: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
      RemoveButton2,
      {
        iconType: "default",
        style: btnStyle,
        disabled: disabled || readonly,
        onClick: onDropPropertyClick(label),
        uiSchema,
        registry
      }
    ) })
  ] }, `${id}-key`);
}

// src/Templates/Templates.ts
function generateTemplates() {
  return {
    ArrayFieldItemTemplate,
    ArrayFieldTemplate,
    BaseInputTemplate,
    ButtonTemplates: {
      AddButton,
      CopyButton,
      MoveDownButton,
      MoveUpButton,
      RemoveButton,
      SubmitButton
    },
    DescriptionFieldTemplate: DescriptionField,
    ErrorListTemplate: ErrorList,
    FieldErrorTemplate,
    FieldHelpTemplate,
    FieldTemplate,
    ObjectFieldTemplate,
    TitleFieldTemplate: TitleField,
    WrapIfAdditionalTemplate
  };
}
var Templates_default = generateTemplates();

// src/CheckboxWidget/CheckboxWidget.tsx
var import_Checkbox = __toESM(require("@material-ui/core/Checkbox"));
var import_FormControlLabel = __toESM(require("@material-ui/core/FormControlLabel"));
var import_utils12 = require("@rjsf/utils");
var import_jsx_runtime15 = require("react/jsx-runtime");
function CheckboxWidget(props) {
  const {
    schema,
    id,
    value,
    disabled,
    readonly,
    label = "",
    hideLabel,
    autofocus,
    onChange,
    onBlur,
    onFocus,
    registry,
    options,
    uiSchema
  } = props;
  const DescriptionFieldTemplate = (0, import_utils12.getTemplate)(
    "DescriptionFieldTemplate",
    registry,
    options
  );
  const required = (0, import_utils12.schemaRequiresTrueValue)(schema);
  const _onChange = (_, checked) => onChange(checked);
  const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
  const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
  const description = options.description ?? schema.description;
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
    !hideLabel && !!description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
      DescriptionFieldTemplate,
      {
        id: (0, import_utils12.descriptionId)(id),
        description,
        schema,
        uiSchema,
        registry
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
      import_FormControlLabel.default,
      {
        control: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
          import_Checkbox.default,
          {
            id,
            name: id,
            checked: typeof value === "undefined" ? false : Boolean(value),
            required,
            disabled: disabled || readonly,
            autoFocus: autofocus,
            onChange: _onChange,
            onBlur: _onBlur,
            onFocus: _onFocus,
            "aria-describedby": (0, import_utils12.ariaDescribedByIds)(id)
          }
        ),
        label: (0, import_utils12.labelValue)(label, hideLabel, false)
      }
    )
  ] });
}

// src/CheckboxesWidget/CheckboxesWidget.tsx
var import_Checkbox2 = __toESM(require("@material-ui/core/Checkbox"));
var import_FormControlLabel2 = __toESM(require("@material-ui/core/FormControlLabel"));
var import_FormGroup = __toESM(require("@material-ui/core/FormGroup"));
var import_FormLabel = __toESM(require("@material-ui/core/FormLabel"));
var import_utils13 = require("@rjsf/utils");
var import_jsx_runtime16 = require("react/jsx-runtime");
function CheckboxesWidget({
  label,
  hideLabel,
  id,
  disabled,
  options,
  value,
  autofocus,
  readonly,
  required,
  onChange,
  onBlur,
  onFocus
}) {
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
  const checkboxesValues = Array.isArray(value) ? value : [value];
  const _onChange = (index) => ({ target: { checked } }) => {
    if (checked) {
      onChange((0, import_utils13.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
    } else {
      onChange((0, import_utils13.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
    }
  };
  const _onBlur = ({ target: { value: value2 } }) => onBlur(id, (0, import_utils13.enumOptionsValueForIndex)(value2, enumOptions, emptyValue));
  const _onFocus = ({ target: { value: value2 } }) => onFocus(id, (0, import_utils13.enumOptionsValueForIndex)(value2, enumOptions, emptyValue));
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
    (0, import_utils13.labelValue)(
      /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_FormLabel.default, { required, htmlFor: id, children: label || void 0 }),
      hideLabel
    ),
    /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_FormGroup.default, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
      const checked = (0, import_utils13.enumOptionsIsSelected)(option.value, checkboxesValues);
      const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
      const checkbox = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
        import_Checkbox2.default,
        {
          id: (0, import_utils13.optionId)(id, index),
          name: id,
          checked,
          disabled: disabled || itemDisabled || readonly,
          autoFocus: autofocus && index === 0,
          onChange: _onChange(index),
          onBlur: _onBlur,
          onFocus: _onFocus,
          "aria-describedby": (0, import_utils13.ariaDescribedByIds)(id)
        }
      );
      return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_FormControlLabel2.default, { control: checkbox, label: option.label }, index);
    }) })
  ] });
}

// src/RadioWidget/RadioWidget.tsx
var import_FormControlLabel3 = __toESM(require("@material-ui/core/FormControlLabel"));
var import_FormLabel2 = __toESM(require("@material-ui/core/FormLabel"));
var import_Radio = __toESM(require("@material-ui/core/Radio"));
var import_RadioGroup = __toESM(require("@material-ui/core/RadioGroup"));
var import_utils14 = require("@rjsf/utils");
var import_jsx_runtime17 = require("react/jsx-runtime");
function RadioWidget({
  id,
  options,
  value,
  required,
  disabled,
  readonly,
  label,
  hideLabel,
  onChange,
  onBlur,
  onFocus
}) {
  const { enumOptions, enumDisabled, emptyValue } = options;
  const _onChange = (_, value2) => onChange((0, import_utils14.enumOptionsValueForIndex)(value2, enumOptions, emptyValue));
  const _onBlur = ({ target: { value: value2 } }) => onBlur(id, (0, import_utils14.enumOptionsValueForIndex)(value2, enumOptions, emptyValue));
  const _onFocus = ({ target: { value: value2 } }) => onFocus(id, (0, import_utils14.enumOptionsValueForIndex)(value2, enumOptions, emptyValue));
  const row = options ? options.inline : false;
  const selectedIndex = (0, import_utils14.enumOptionsIndexForValue)(value, enumOptions) ?? null;
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
    (0, import_utils14.labelValue)(
      /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_FormLabel2.default, { required, htmlFor: id, children: label || void 0 }),
      hideLabel
    ),
    /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
      import_RadioGroup.default,
      {
        id,
        name: id,
        value: selectedIndex,
        row,
        onChange: _onChange,
        onBlur: _onBlur,
        onFocus: _onFocus,
        "aria-describedby": (0, import_utils14.ariaDescribedByIds)(id),
        children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
          const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
          const radio = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
            import_FormControlLabel3.default,
            {
              control: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Radio.default, { name: id, id: (0, import_utils14.optionId)(id, index), color: "primary" }),
              label: option.label,
              value: String(index),
              disabled: disabled || itemDisabled || readonly
            },
            index
          );
          return radio;
        })
      }
    )
  ] });
}

// src/RangeWidget/RangeWidget.tsx
var import_FormLabel3 = __toESM(require("@material-ui/core/FormLabel"));
var import_Slider = __toESM(require("@material-ui/core/Slider"));
var import_utils15 = require("@rjsf/utils");
var import_jsx_runtime18 = require("react/jsx-runtime");
function RangeWidget(props) {
  const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
  const sliderProps = { value, label, id, name: id, ...(0, import_utils15.rangeSpec)(schema) };
  const _onChange = (_, value2) => {
    onChange(value2 ?? options.emptyValue);
  };
  const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
  const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
    (0, import_utils15.labelValue)(
      /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_FormLabel3.default, { required, htmlFor: id, children: label || void 0 }),
      hideLabel
    ),
    /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
      import_Slider.default,
      {
        disabled: disabled || readonly,
        onChange: _onChange,
        onBlur: _onBlur,
        onFocus: _onFocus,
        valueLabelDisplay: "auto",
        ...sliderProps,
        "aria-describedby": (0, import_utils15.ariaDescribedByIds)(id)
      }
    )
  ] });
}

// src/SelectWidget/SelectWidget.tsx
var import_MenuItem = __toESM(require("@material-ui/core/MenuItem"));
var import_TextField3 = __toESM(require("@material-ui/core/TextField"));
var import_utils16 = require("@rjsf/utils");
var import_jsx_runtime19 = require("react/jsx-runtime");
function SelectWidget({
  schema,
  id,
  name,
  // remove this from textFieldProps
  options,
  label,
  hideLabel,
  required,
  disabled,
  readonly,
  placeholder,
  value,
  multiple,
  autofocus,
  onChange,
  onBlur,
  onFocus,
  rawErrors = [],
  registry,
  uiSchema,
  hideError,
  formContext,
  ...textFieldProps
}) {
  const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
  multiple = typeof multiple === "undefined" ? false : !!multiple;
  const emptyValue = multiple ? [] : "";
  const isEmpty = typeof value === "undefined" || multiple && value.length < 1 || !multiple && value === emptyValue;
  const _onChange = ({ target: { value: value2 } }) => onChange((0, import_utils16.enumOptionsValueForIndex)(value2, enumOptions, optEmptyVal));
  const _onBlur = ({ target }) => onBlur(id, (0, import_utils16.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
  const _onFocus = ({ target }) => onFocus(id, (0, import_utils16.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
  const selectedIndexes = (0, import_utils16.enumOptionsIndexForValue)(value, enumOptions, multiple);
  const showPlaceholderOption = !multiple && schema.default === void 0;
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
    import_TextField3.default,
    {
      id,
      name: id,
      label: (0, import_utils16.labelValue)(label, hideLabel || !label, false),
      value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
      required,
      disabled: disabled || readonly,
      autoFocus: autofocus,
      placeholder,
      error: rawErrors.length > 0,
      onChange: _onChange,
      onBlur: _onBlur,
      onFocus: _onFocus,
      ...textFieldProps,
      select: true,
      InputLabelProps: {
        ...textFieldProps.InputLabelProps,
        shrink: !isEmpty
      },
      SelectProps: {
        ...textFieldProps.SelectProps,
        multiple
      },
      "aria-describedby": (0, import_utils16.ariaDescribedByIds)(id),
      children: [
        showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_MenuItem.default, { value: "", children: placeholder }),
        Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
          const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
          return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_MenuItem.default, { value: String(i), disabled: disabled2, children: label2 }, i);
        })
      ]
    }
  );
}

// src/TextareaWidget/TextareaWidget.tsx
var import_utils17 = require("@rjsf/utils");
var import_jsx_runtime20 = require("react/jsx-runtime");
function TextareaWidget(props) {
  const { options, registry } = props;
  const BaseInputTemplate2 = (0, import_utils17.getTemplate)("BaseInputTemplate", registry, options);
  let rows = 5;
  if (typeof options.rows === "string" || typeof options.rows === "number") {
    rows = options.rows;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BaseInputTemplate2, { ...props, multiline: true, rows });
}

// src/Widgets/Widgets.ts
function generateWidgets() {
  return {
    CheckboxWidget,
    CheckboxesWidget,
    RadioWidget,
    RangeWidget,
    SelectWidget,
    TextareaWidget
  };
}
var Widgets_default = generateWidgets();

// src/Theme/Theme.tsx
function generateTheme() {
  return {
    templates: generateTemplates(),
    widgets: generateWidgets()
  };
}
var Theme_default = generateTheme();

// src/MuiForm/MuiForm.tsx
function generateForm() {
  return (0, import_core.withTheme)(generateTheme());
}
var MuiForm_default = generateForm();

// src/index.ts
var src_default = MuiForm_default;
//# sourceMappingURL=index.js.map
