{"version":3,"file":"Shortcuts.B9kdGaPR.mjs","names":["e","t"],"sources":["https:/framerusercontent.com/modules/mskXVbljbKKDcEJj9fis/rU5cjmNjBMiAjfPRili9/Shortcuts.js"],"sourcesContent":["import{jsx as e}from\"react/jsx-runtime\";import t from\"react\";export function withKeyboardShortcuts(r){let n=e=>{// Don't capture input if the user is typing in an input field/textarea or a meta key is pressed\nif(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)return;// Save pressed keys to session storage\nlet t=JSON.parse(sessionStorage.getItem(\"pressedKeys\")||\"[]\");if(t.push(e.key),t.length>1&&t.shift(),sessionStorage.setItem(\"pressedKeys\",JSON.stringify(t)),\"undefined\"!=typeof window){// Notify other components\nlet e=new CustomEvent(\"pressedKeysChanged\",{detail:t});window.dispatchEvent(e);}},o=()=>{sessionStorage.removeItem(\"pressedKeys\");};return s=>(\"undefined\"!=typeof window&&t.useEffect(()=>(// Focus window on load\n        window.focus(),window.addEventListener(\"keydown\",n),window.addEventListener(\"beforeunload\",o),()=>{window.removeEventListener(\"keydown\",n),window.removeEventListener(\"beforeunload\",o);}),[]),/*#__PURE__*/e(r,{...s}));}export function withShortcutTrigger(r){let n=(e,t,r)=>{let n=e.detail;// Check if the last pressed key matches the shortcut\nn[n.length-1].toLowerCase()===t.toLowerCase()&&(e.preventDefault(),setTimeout(()=>{if(r.current){let e=r.current.querySelector(\"button\"),n=r.current.querySelector(\"a\");e?e.click():n?n.click():console.error(`🦎 Error: The shortcut trigger element ${t} isn't working properly. Check the docs for help.`);}else console.error(`🦎 Error: The shortcut trigger element ${t} isn't working properly. Check the docs for help.`);sessionStorage.removeItem(\"pressedKeys\");},0));};return o=>{var s;let i=null===(s=o.name)||void 0===s?void 0:s.match(/\\[(.*?)\\]/),d=\"\",a=t.useRef(null);return i?d=i[1]:console.error(`🦎 Error: Your shortcut trigger layer (${o.name}) is missing a key in its layer name.`),\"undefined\"!=typeof window&&t.useEffect(()=>{window.addEventListener(\"pressedKeysChanged\",e=>{n(e,d,a);});},[]),/*#__PURE__*/e(\"span\",{ref:a,\"data-lizard-shortcuts-trigger\":d,children:/*#__PURE__*/e(r,{...o})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withShortcutTrigger\":{\"type\":\"reactHoc\",\"name\":\"withShortcutTrigger\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withKeyboardShortcuts\":{\"type\":\"reactHoc\",\"name\":\"withKeyboardShortcuts\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shortcuts.map"],"mappings":"kMAA6D,SAAgB,EAAsB,EAAE,CAAC,IAAI,EAAE,GAAG,CAC/G,GAAGA,EAAE,kBAAkB,kBAAkBA,EAAE,kBAAkB,qBAAqBA,EAAE,UAAUA,EAAE,SAASA,EAAE,QAAQA,EAAE,QAAQ,OAC7H,IAAI,EAAE,KAAK,MAAM,eAAe,QAAQ,cAAc,EAAE,KAAK,CAAC,GAAG,EAAE,KAAKA,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,eAAe,QAAQ,cAAc,KAAK,UAAU,EAAE,CAAC,CAAqB,IAApB,OAA2B,CACxL,IAAIA,EAAE,IAAI,YAAY,qBAAqB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAO,cAAcA,EAAE,GAAI,MAAM,CAAC,eAAe,WAAW,cAAc,EAAG,MAAO,KAAwB,IAApB,QAA4BC,EAAE,eACrK,EAAO,OAAO,CAAC,EAAO,iBAAiB,UAAU,EAAE,CAAC,EAAO,iBAAiB,eAAe,EAAE,KAAK,CAAC,EAAO,oBAAoB,UAAU,EAAE,CAAC,EAAO,oBAAoB,eAAe,EAAE,GAAI,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,uBAJvL,IAAqB"}