import React, { createContext, useCallback, useContext } from "react";
//#region src/components/pisellRecordBoard/shellFrame/Calendar/calendarPersistGuard.tsx
const CalendarPersistContext = createContext({});
const CalendarPersistProvider = ({ children, value }) => /* @__PURE__ */ React.createElement(CalendarPersistContext.Provider, { value: value !== null && value !== void 0 ? value : {} }, children);
/**
* 在日历 Demo 内判断某类写操作是否允许执行本地 state 更新。
*/
function useCalendarPersist() {
	const ctx = useContext(CalendarPersistContext);
	return useCallback((kind) => {
		if (!ctx.beforePersist) return true;
		return ctx.beforePersist(kind);
	}, [ctx]);
}
//#endregion
export { CalendarPersistProvider, useCalendarPersist };
