hunk.code_window:     INVALID_GIT_REPO(400, 4033, "The remote repo is not empty. Please create a new empty repo and configure the SSH keys. " +
               "If you want to clone from remote repo and build application, please use import application from git option.", AppsmithErrorAction.DEFAULT, null, ErrorType.GIT_CONFIGURATION_ERROR),
       DEFAULT_RESOURCES_UNAVAILABLE(400, 4034, "Unexpected state. Default resources are unavailable for {0} with id {1}. Please reach out to Appsmith customer support to resolve this.",
               AppsmithErrorAction.LOG_EXTERNALLY, null, ErrorType.BAD_REQUEST),
       GIT_FILE_SYSTEM_ERROR(400, 4035, "Error while accessing the file system. Details: {0}", AppsmithErrorAction.DEFAULT, null, ErrorType.GIT_CONFIGURATION_ERROR),
       GIT_MERGE_FAILED_REMOTE_CHANGES(406, 4036, "Remote is ahead of local by {0} commits on branch {1}. Please pull remote changes first and try again.", AppsmithErrorAction.DEFAULT, null, ErrorType.GIT_ACTION_EXECUTION_ERROR),
       GIT_MERGE_FAILED_LOCAL_CHANGES(406, 4037, "There are uncommitted changes present in your local branch {0}. Please commit them first and try again", AppsmithErrorAction.DEFAULT, null, ErrorType.GIT_ACTION_EXECUTION_ERROR),
       REMOVE_LAST_ORG_ADMIN_ERROR(400, 4038, "The last admin can not be removed from an organization", AppsmithErrorAction.DEFAULT, null, ErrorType.INTERNAL_ERROR),
       INVALID_CRUD_PAGE_REQUEST(400, 4039, "Unable to process page generation request, {0}", AppsmithErrorAction.DEFAULT, null, ErrorType.BAD_REQUEST),
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.file_path: app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java
hunk.type: replace
file: import React from "react";
  import { toUpper, get } from "lodash";
  import { Action } from "entities/Action";
  import { Directions } from "utils/helpers";
  import { WidgetProps } from "widgets/BaseWidget";
  import CustomizedDropdown, {
    CustomizedDropdownOption,
  } from "pages/common/CustomizedDropdown";
  import Button from "components/editorComponents/Button";
  import {
    createNewApiAction,
    createNewQueryAction,
  } from "actions/apiPaneActions";
  import {
    LIGHTNING_MENU_DATA_API,
    LIGHTNING_MENU_DATA_QUERY,
    LIGHTNING_MENU_DATA_WIDGET,
    LIGHTNING_MENU_OPTION_HTML,
    LIGHTNING_MENU_OPTION_JS,
    LIGHTNING_MENU_QUERY_CREATE_NEW,
    LIGHTNING_MENU_API_CREATE_NEW,
    createMessage,
  } from "constants/messages";
  import { Skin } from "constants/DefaultTheme";
  import { ReduxAction } from "constants/ReduxActionConstants";
  
  export const getApiOptions = (
    skin: Skin,
    apis: Action[],
    pageId: string,
    dispatch: (action: ReduxAction<unknown>) => void,
    updateDynamicInputValue: (value: string, cursor?: number) => void,
  ) => ({
    sections: [
      {
        isSticky: true,
        options: [
          {
            content: (
              <Button
                icon="plus"
                iconAlignment="left"
                skin={skin}
                text={createMessage(LIGHTNING_MENU_API_CREATE_NEW)}
                type="button"
              />
            ),
            onSelect: () => {
              dispatch(createNewApiAction(pageId, "LIGHTNING_MENU"));
            },
          },
        ],
      },
      {
        options: apis.map((api) => ({
          content: api.name,
          onSelect: () => {
            updateDynamicInputValue(`{{${api.name}.data}}`);
          },
        })),
      },
    ],
    trigger: {
      text: createMessage(LIGHTNING_MENU_DATA_API),
    },
    openDirection: Directions.RIGHT,
    openOnHover: true,
    skin: skin,
    modifiers: {
      offset: {
        offset: "0, 16px",
      },
    },
  });
  
  export const getQueryOptions = (
    skin: Skin,
    queries: Action[],
    pageId: string,
    dispatch: (action: ReduxAction<unknown>) => void,
    updateDynamicInputValue: (value: string, cursor?: number) => void,
  ) => ({
    sections: [
      {
        isSticky: true,
        options: [
          {
            content: (
              <Button
                icon="plus"
                iconAlignment="left"
                skin={skin}
                text={createMessage(LIGHTNING_MENU_QUERY_CREATE_NEW)}
                type="button"
              />
            ),
            onSelect: () => {
              dispatch(createNewQueryAction(pageId, "LIGHTNING_MENU"));
            },
          },
        ],
      },
      {
        options: queries.map((query) => ({
          content: query.name,
          onSelect: () => {
            updateDynamicInputValue(`{{${query.name}.data}}`);
          },
        })),
      },
    ],
    trigger: {
      text: createMessage(LIGHTNING_MENU_DATA_QUERY),
    },
    openDirection: Directions.RIGHT,
    openOnHover: true,
    skin: skin,
    modifiers: {
      offset: {
        offset: "0, 16px",
      },
    },
  });
  
  export const getWidgetOptions = (
    skin: Skin,
    widgets: WidgetProps[],
    updateDynamicInputValue: (value: string, cursor?: number) => void,
  ) => ({
    sections: [
      {
        options: widgets.map((widget) => ({
          content: widget.widgetName,
          disabled: false,
          shouldCloseDropdown: true,
          onSelect: () => {
            updateDynamicInputValue(`{{${widget.widgetName}.}}`);
          },
        })),
      },
    ],
    trigger: {
      text: createMessage(LIGHTNING_MENU_DATA_WIDGET),
    },
    openDirection: Directions.RIGHT,
    openOnHover: true,
    skin: skin,
    modifiers: {
      offset: {
        offset: "0, 16px",
      },
    },
  });
  
  export const getLightningMenuOptions = (
    apis: Action[],
    queries: Action[],
    widgets: WidgetProps[],
    pageId: string,
    dispatch: (action: ReduxAction<unknown>) => void,
    skin: Skin,
    updateDynamicInputValue: (value: string, cursor?: number) => void,
  ) => {
    const options: CustomizedDropdownOption[] = [
      {
        content: (
          <CustomizedDropdown
            {...getApiOptions(
              skin,
              apis,
              pageId,
              dispatch,
              updateDynamicInputValue,
            )}
          />
        ),
        disabled: false,
        shouldCloseDropdown: false,
      },
      {
        content: (
          <CustomizedDropdown
            {...getQueryOptions(
              skin,
              queries,
              pageId,
              dispatch,
              updateDynamicInputValue,
            )}
          />
        ),
        disabled: false,
        shouldCloseDropdown: false,
      },
    ];
    if (widgets.length > 0) {
      widgets = widgets.sort((a: WidgetProps, b: WidgetProps) => {
        return toUpper(get(a, "widgetName")) > toUpper(get(b, "widgetName"))
          ? 1
          : -1;
      });
      options.push({
        content: (
          <CustomizedDropdown
            {...getWidgetOptions(skin, widgets, updateDynamicInputValue)}
          />
        ),
        disabled: false,
        shouldCloseDropdown: false,
      });
    }
    return [
      ...options,
      {
        content: createMessage(LIGHTNING_MENU_OPTION_JS),
        disabled: false,
        shouldCloseDropdown: true,
        onSelect: () => {
          updateDynamicInputValue("{{}}");
        },
      },
      {
        content: createMessage(LIGHTNING_MENU_OPTION_HTML),
        disabled: false,
        shouldCloseDropdown: true,
        onSelect: () => {
          updateDynamicInputValue("<p></p>", 3);
        },
      },
    ];
  };
  