import{useMemo as e}from"react";import{usePopper as o}from"react-popper";import{DialogPlacement as s}from"./DialogConstants.js";import t from"./useForceUpdate.js";import{createObserveContentResizeModifier as r}from"./modifiers/observeContentResizeModifier.js";import{createObserveReferenceResizeModifier as i}from"./modifiers/observeReferenceResizeModifier.js";import{useIsomorphicLayoutEffect as a}from"../../../../shared/dist/hooks/ssr/useIsomorphicLayoutEffect.js";var n=s.RIGHT_START,f=[s.RIGHT_END,s.LEFT_START,s.LEFT_END];function m(s,m,p){var c=p.isOpen,l=p.placement,d=void 0===l?n:l,v=p.observeContentResize,b=p.observeReferenceResize,u=p.offset,R=p.fallbackPlacements,T=void 0===R?f:R,y=t();a((function(){y()}),[s,m,y]);var z=e((function(){return{placement:d,modifiers:[{name:"flip",options:{fallbackPlacements:T}},{name:"displayNone",enabled:!0,phase:"write",fn:function(e){var o=e.state;return o.styles.popper.visibility=c?"visible":"hidden",o}},r(v),i(b),void 0!==u&&{name:"offset",options:{offset:u}}]}}),[d,v,u,c]),h=o(s,m,z);return{styles:h.styles,attributes:h.attributes}}export{m as default};
//# sourceMappingURL=usePopover.js.map
