"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var navigation_prompt_exports = {};
__export(navigation_prompt_exports, {
  NavigationPrompt: () => NavigationPrompt
});
module.exports = __toCommonJS(navigation_prompt_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = require("react");
var import_ds_icons = require("@elliemae/ds-icons");
var import_ds_button = require("@elliemae/ds-button");
var import_ds_dialog = require("@elliemae/ds-dialog");
var import_react2 = require("../../../data/react.js");
var import_actions = require("../../../data/navigation-prompt/actions.js");
const NavigationPrompt = (0, import_react.memo)(
  ({ open = false }) => {
    const dispatch = (0, import_react2.useAppDispatch)();
    const cancelDialog = () => dispatch(import_actions.navigationPrompt.cancel());
    const confirmDialog = () => dispatch(import_actions.navigationPrompt.confirm());
    return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_dialog.DSDialog, { isOpen: open, onClickOutside: cancelDialog, centered: true, children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_dialog.DSDialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_dialog.DSDialogAddon, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.DSButtonV2, { buttonType: "icon", onClick: cancelDialog, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.Close, { color: ["neutral", "900"] }) }) }) }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_dialog.DSDialogSeparator, {}),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_dialog.DSDialogBody, { px: 24, mb: 16, children: "You currently have unsaved changes. Are you sure you want to proceed without saving?" }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_dialog.DSDialogSeparator, {}),
      /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_dialog.DSDialogFooter, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.DSButtonV2, { buttonType: "outline", onClick: cancelDialog, children: "Continue without saving" }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.DSButtonV2, { onClick: confirmDialog, children: "Save & Continue" })
      ] })
    ] });
  }
);
