import i,{createContext as l,useContext as d}from"react";import{useIsoMorphicEffect as m}from"../hooks/use-iso-morphic-effect.js";import{useEvent as p}from"../hooks/use-event.js";let o=l(()=>{});o.displayName="StackContext";var f=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(f||{});function x(){return d(o)}function C({children:u,onUpdate:r,type:e,element:n}){let c=x(),t=p((...a)=>{r==null||r(...a),c(...a)});return m(()=>(t(0,e,n),()=>t(1,e,n)),[t,e,n]),i.createElement(o.Provider,{value:t},u)}export{f as StackMessage,C as StackProvider,x as useStackContext};
