"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const reactBinding = require("@contember/react-binding");
const useEntityRedirectOnPersistSuccess = require("./useEntityRedirectOnPersistSuccess.cjs");
const react = require("react");
const useOnPersistSuccess = ({ redirectOnSuccess, onPersistSuccess }) => {
  const redirectOnSuccessCb = useEntityRedirectOnPersistSuccess.useEntityRedirectOnPersistSuccess(redirectOnSuccess);
  return react.useMemo(() => {
    if (!redirectOnSuccessCb || !onPersistSuccess) {
      return redirectOnSuccessCb ?? onPersistSuccess;
    }
    const listeners = reactBinding.QueryLanguage.desugarEventListener(onPersistSuccess);
    listeners.add(redirectOnSuccessCb);
    return listeners;
  }, [onPersistSuccess, redirectOnSuccessCb]);
};
exports.useOnPersistSuccess = useOnPersistSuccess;
//# sourceMappingURL=useOnPersistSuccess.cjs.map
