import{s as y}from"./chunk-LvLJmgfZ.js";import{d as A,n as p,p as P,u as g}from"./useEvent-D91BmmQi.js";import{t as k}from"./react-Bj1aDYRI.js";import{t as b}from"./react-dom-CSu739Rf.js";import{t as C}from"./compiler-runtime-B3qBwwSJ.js";import{h as E,t as O,v as _}from"./useEventListener-BakX-tnw.js";import{g as w}from"./utils-CCzEbCvM.js";b();var i=y(k(),1),D=(0,i.createContext)(null);function H(r){let e=(0,i.useRef)({});return i.createElement(D.Provider,{value:e},r.children)}var N=(0,i.createContext)({isSelected:!1}),v=P({});function R(){return g(v)}function S(){let r=A(v);return{registerAction:p((e,t)=>{r(o=>({...o,[e]:t}))}),unregisterAction:p(e=>{r(t=>{let{[e]:o,...a}=t;return a})})}}var j=C();function q(r,e){let t=(0,j.c)(13),{registerAction:o,unregisterAction:a}=S(),d=g(w),s=e===_.NOOP,u;t[0]===e?u=t[1]:(u=n=>e(n),t[0]=e,t[1]=u);let f=p(u),m;t[2]!==e||t[3]!==d||t[4]!==r?(m=n=>{if(n.defaultPrevented)return;let x=d.getHotkey(r).key;E(x)(n)&&e(n)!==!1&&(n.preventDefault(),n.stopPropagation())},t[2]=e,t[3]=d,t[4]=r,t[5]=m):m=t[5];let h=p(m);O(document,"keydown",h);let c,l;t[6]!==s||t[7]!==f||t[8]!==o||t[9]!==r||t[10]!==a?(c=()=>{if(!s)return o(r,f),()=>a(r)},l=[f,r,s,o,a],t[6]=s,t[7]=f,t[8]=o,t[9]=r,t[10]=a,t[11]=c,t[12]=l):(c=t[11],l=t[12]),(0,i.useEffect)(c,l)}export{H as i,R as n,N as r,q as t};
