import { onActivated as v, onDeactivated as c } from "vue";
function s(i) {
  let e = "notKeepAlive", r = i?.afterDeactivated, t = i?.afterActivated;
  return v(() => {
    t && e === "deactivated" && Promise.resolve().then(t), e = "activated";
  }), c(() => {
    e = "deactivated", r?.();
  }), {
    isDeactivated: () => e === "deactivated",
    isActivated: () => e === "activated",
    registerAfterDeactivated: (a) => {
      r = a;
    },
    registerAfterActivated: (a) => {
      t = a;
    }
  };
}
export {
  s as useKeepAliveFlag
};
