import{s as d}from"./chunk-DZLz74EQ.js";import{c as b}from"./jotai-DDOP7CKM.js";import{n as A,t as v}from"./jsx-runtime-DvsdsEjx.js";import{o as D,t as p}from"./hotkeys-Lbk6RHir.js";import{f as y}from"./utils-DnJCRgaX.js";import{t as h}from"./cn-C5VTNYKf.js";import{l as S}from"./dropdown-menu-1SGi7wHR.js";import{t as x}from"./tooltip-BQKXsEoT.js";import{t as j}from"./kbd-CZFOBQmt.js";var f=d(A(),1),m=d(v(),1);function _(o,e=!0){return(0,m.jsx)(E,{shortcut:o,includeName:e})}var E=o=>{let e=(0,f.c)(11),{shortcut:l,includeName:s}=o,t=s===void 0?!0:s,a=b(y),n;e[0]!==a||e[1]!==l?(n=a.getHotkey(l),e[0]=a,e[1]=l,e[2]=n):n=e[2];let r=n,c;e[3]!==r.name||e[4]!==t?(c=t&&(0,m.jsx)("span",{className:"mr-2",children:r.name}),e[3]=r.name,e[4]=t,e[5]=c):c=e[5];let i;e[6]===r.key?i=e[7]:(i=(0,m.jsx)(w,{shortcut:r.key}),e[6]=r.key,e[7]=i);let u;return e[8]!==c||e[9]!==i?(u=(0,m.jsxs)("span",{className:"inline-flex",children:[c,i]}),e[8]=c,e[9]=i,e[10]=u):u=e[10],u};const w=o=>{let e=(0,f.c)(10),{shortcut:l,className:s}=o;if(l===p||l===""){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,m.jsx)("span",{}),e[0]=r):r=e[0],r}let t,a;if(e[1]!==s||e[2]!==l){let r=l.split("-");e[5]===s?t=e[6]:(t=h("flex gap-1",s),e[5]=s,e[6]=t),a=r.map(N).map(L),e[1]=s,e[2]=l,e[3]=t,e[4]=a}else t=e[3],a=e[4];let n;return e[7]!==t||e[8]!==a?(n=(0,m.jsx)("div",{className:t,children:a}),e[7]=t,e[8]=a,e[9]=n):n=e[9],n};function H(o){return(0,m.jsx)(C,{shortcut:o})}const C=o=>{let e=(0,f.c)(6),{className:l,shortcut:s}=o,t=b(y),a;e[0]!==t||e[1]!==s?(a=t.getHotkey(s),e[0]=t,e[1]=s,e[2]=a):a=e[2];let n=a,r;return e[3]!==l||e[4]!==n.key?(r=(0,m.jsx)(k,{shortcut:n.key,className:l}),e[3]=l,e[4]=n.key,e[5]=r):r=e[5],r},k=o=>{let e=(0,f.c)(12),{shortcut:l,className:s}=o;if(l===p||l===""){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("span",{}),e[0]=c):c=e[0],c}let t,a,n;if(e[1]!==s||e[2]!==l){let c=l.split("-");t=S,e[6]===s?a=e[7]:(a=h("flex gap-1 items-center",s),e[6]=s,e[7]=a),n=c.map(N).map(F),e[1]=s,e[2]=l,e[3]=t,e[4]=a,e[5]=n}else t=e[3],a=e[4],n=e[5];let r;return e[8]!==t||e[9]!==a||e[10]!==n?(r=(0,m.jsx)(t,{className:a,children:n}),e[8]=t,e[9]=a,e[10]=n,e[11]=r):r=e[11],r};function N(o){let e=D()?"mac":"default",l=o.toLowerCase(),s=I[o.toLowerCase()];if(s){let t=s.symbols[e]||s.symbols.default;return[s.label,t]}return[l]}var I={ctrl:{symbols:{mac:"\u2303",default:"Ctrl"},label:"Control"},control:{symbols:{mac:"\u2303",default:"Ctrl"},label:"Control"},shift:{symbols:{mac:"\u21E7",default:"Shift"},label:"Shift"},alt:{symbols:{mac:"\u2325",default:"Alt"},label:"Alt/Option"},escape:{symbols:{mac:"\u238B",default:"Esc"},label:"Escape"},arrowup:{symbols:{default:"\u2191"},label:"Arrow Up"},arrowdown:{symbols:{default:"\u2193"},label:"Arrow Down"},arrowleft:{symbols:{default:"\u2190"},label:"Arrow Left"},arrowright:{symbols:{default:"\u2192"},label:"Arrow Right"},backspace:{symbols:{mac:"\u232B",default:"\u27F5"},label:"Backspace"},tab:{symbols:{mac:"\u21E5",default:"\u2B7E"},label:"Tab"},capslock:{symbols:{default:"\u21EA"},label:"Caps Lock"},fn:{symbols:{default:"Fn"},label:"Fn"},cmd:{symbols:{mac:"\u2318",windows:"\u229E Win",default:"Command"},label:"Command"},insert:{symbols:{default:"Ins"},label:"Insert"},delete:{symbols:{mac:"\u2326",default:"Del"},label:"Delete"},home:{symbols:{mac:"\u2196",default:"Home"},label:"Home"},end:{symbols:{mac:"\u2198",default:"End"},label:"End"},mod:{symbols:{mac:"\u2318",windows:"\u229E Win",default:"Ctrl"},label:"Control"}};function g(o){return o.charAt(0).toUpperCase()+o.slice(1)}function L(o){let[e,l]=o;return l?(0,m.jsx)(x,{asChild:!1,tabIndex:-1,content:e,delayDuration:300,children:(0,m.jsx)(j,{children:l},e)},e):(0,m.jsx)(j,{children:g(e)},e)}function F(o){let[e,l]=o;return l?(0,m.jsx)(x,{content:e,delayDuration:300,tabIndex:-1,children:(0,m.jsx)("span",{children:l},e)},e):(0,m.jsx)("span",{children:g(e)},e)}export{_ as a,H as i,k as n,C as r,w as t};
