"use client";
'use strict';

var OMU7RWRV = require('./OMU7RWRV.cjs');
var NTITENHD = require('./NTITENHD.cjs');
var MTZPJQMC = require('./MTZPJQMC.cjs');
var LMDWO4NN = require('./LMDWO4NN.cjs');
var ABQUS43J = require('./ABQUS43J.cjs');
var _3YLGPPWQ = require('./3YLGPPWQ.cjs');
var PBFD2E7P = require('../../../../../../@ariakit_core@0.4.15/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.cjs');
var jsxRuntime = require('react/jsx-runtime');

var TagName = "button";
var usePopoverDisclosure = LMDWO4NN.createHook(function usePopoverDisclosure2(_a) {
  var _b = _a, { store } = _b, props = _3YLGPPWQ.__objRest(_b, ["store"]);
  const context = MTZPJQMC.usePopoverProviderContext();
  store = store || context;
  PBFD2E7P.invariant(
    store,
    process.env.NODE_ENV !== "production" && "PopoverDisclosure must receive a `store` prop or be wrapped in a PopoverProvider component."
  );
  const onClickProp = props.onClick;
  const onClick = ABQUS43J.useEvent((event) => {
    store == null ? void 0 : store.setAnchorElement(event.currentTarget);
    onClickProp == null ? void 0 : onClickProp(event);
  });
  props = ABQUS43J.useWrapElement(
    props,
    (element) => /* @__PURE__ */ jsxRuntime.jsx(MTZPJQMC.PopoverScopedContextProvider, { value: store, children: element }),
    [store]
  );
  props = _3YLGPPWQ.__spreadProps(_3YLGPPWQ.__spreadValues({}, props), {
    onClick
  });
  props = OMU7RWRV.usePopoverAnchor(_3YLGPPWQ.__spreadValues({ store }, props));
  props = NTITENHD.useDialogDisclosure(_3YLGPPWQ.__spreadValues({ store }, props));
  return props;
});
LMDWO4NN.forwardRef(function PopoverDisclosure2(props) {
  const htmlProps = usePopoverDisclosure(props);
  return LMDWO4NN.createElement(TagName, htmlProps);
});

exports.usePopoverDisclosure = usePopoverDisclosure;
//# sourceMappingURL=WMYDSCNQ.cjs.map
