import * as React from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
export var EasyAntdModalContext = /*#__PURE__*/React.createContext({
  triggerProps: 'trigger',
  contentProps: 'children'
});
export var useEasyAntdModal = function useEasyAntdModal() {
  return React.useContext(EasyAntdModalContext);
};
export var EasyAntdModalProvider = function EasyAntdModalProvider(props) {
  var _useEasyAntdModal = useEasyAntdModal(),
    _useEasyAntdModal$tri = _useEasyAntdModal.triggerProps,
    parentTriggerProps = _useEasyAntdModal$tri === void 0 ? 'trigger' : _useEasyAntdModal$tri,
    _useEasyAntdModal$con = _useEasyAntdModal.contentProps,
    parentContentProps = _useEasyAntdModal$con === void 0 ? 'children' : _useEasyAntdModal$con;
  var children = props.children,
    _props$triggerProps = props.triggerProps,
    triggerProps = _props$triggerProps === void 0 ? parentTriggerProps : _props$triggerProps,
    _props$contentProps = props.contentProps,
    contentProps = _props$contentProps === void 0 ? parentContentProps : _props$contentProps;
  if (triggerProps === contentProps) {
    throw new Error("\"triggerProps\" and \"contentProps\" cannot be the same");
  }
  var memoizedContextValue = React.useMemo(function () {
    return {
      triggerProps: triggerProps,
      contentProps: contentProps
    };
  }, [triggerProps, contentProps]);
  return /*#__PURE__*/_jsx(EasyAntdModalContext.Provider, {
    value: memoizedContextValue,
    children: children
  });
};