'use strict';

var FZZ2AVHF = require('./FZZ2AVHF.cjs');
var BCALMBPZ = require('./BCALMBPZ.cjs');
var PBFD2E7P = require('./PBFD2E7P.cjs');
var _3YLGPPWQ = require('./3YLGPPWQ.cjs');

// src/popover/popover-store.ts
function createPopoverStore(_a = {}) {
  var _b = _a, {
    popover: otherPopover
  } = _b, props = _3YLGPPWQ.__objRest(_b, [
    "popover"
  ]);
  const store = BCALMBPZ.mergeStore(
    props.store,
    BCALMBPZ.omit(otherPopover, [
      "arrowElement",
      "anchorElement",
      "contentElement",
      "popoverElement",
      "disclosureElement"
    ])
  );
  BCALMBPZ.throwOnConflictingProps(props, store);
  const syncState = store == null ? void 0 : store.getState();
  const dialog = FZZ2AVHF.createDialogStore(_3YLGPPWQ.__spreadProps(_3YLGPPWQ.__spreadValues({}, props), { store }));
  const placement = PBFD2E7P.defaultValue(
    props.placement,
    syncState == null ? void 0 : syncState.placement,
    "bottom"
  );
  const initialState = _3YLGPPWQ.__spreadProps(_3YLGPPWQ.__spreadValues({}, dialog.getState()), {
    placement,
    currentPlacement: placement,
    anchorElement: PBFD2E7P.defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
    popoverElement: PBFD2E7P.defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
    arrowElement: PBFD2E7P.defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
    rendered: Symbol("rendered")
  });
  const popover = BCALMBPZ.createStore(initialState, dialog, store);
  return _3YLGPPWQ.__spreadProps(_3YLGPPWQ.__spreadValues(_3YLGPPWQ.__spreadValues({}, dialog), popover), {
    setAnchorElement: (element) => popover.setState("anchorElement", element),
    setPopoverElement: (element) => popover.setState("popoverElement", element),
    setArrowElement: (element) => popover.setState("arrowElement", element),
    render: () => popover.setState("rendered", Symbol("rendered"))
  });
}

exports.createPopoverStore = createPopoverStore;
//# sourceMappingURL=ME2CUF3F.cjs.map
