import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t}from"./jsx-runtime-CiQ1k8xo.js";import{lt as n}from"./vscode-api-DjORcpSo.js";import{a as r,i}from"./dist-_kkJXwj8.js";var a=e(t(),1),o=(0,a.createContext)(null),s=new r(`transactionEventPlugin`),c=`prosemirrorDispatchTransaction`;function l(e,t){let{eventTarget:n}=s.getState(e.state);return n.addEventListener(c,t),()=>{n.removeEventListener(c,t)}}function u(e){return new i({key:s,state:{init(){return{eventTarget:e}},apply(e,t){return t}}})}var d=n(),f=()=>{let e=(0,a.useContext)(o);if(!e)throw Error(`useComposerController must be used within a ComposerControllerScope`);return e},p=(e,t)=>{let n=(0,d.c)(6),r;n[0]===e.view?r=n[1]:(r=t=>l(e.view,t),n[0]=e.view,n[1]=r);let i,o;return n[2]!==e||n[3]!==t?(i=()=>t(e),o=()=>t(e),n[2]=e,n[3]=t,n[4]=i,n[5]=o):(i=n[4],o=n[5]),(0,a.useSyncExternalStore)(r,i,o)};export{u as a,c as i,p as n,o,l as r,f as t};
//# sourceMappingURL=use-composer-controller-CKh6Bnuo.js.map