{"version":3,"file":"Shortcuts_Prod.Cc0rR9mL.mjs","names":["useState","useRef","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/ixn5bwVqHDFh2rnxxDYw/aUrpXThVRI7ohRQyuBpm/UseCurrentLocation.js","https:/framer.com/m/UseCurrentLocation-coQY.js","https:/framerusercontent.com/modules/a00rkf99JIwyJlJoC56r/r5M5eK0UdIs4bR6u59vZ/Shortcuts_Prod.js"],"sourcesContent":["//@ts-ignore\nimport{useRouter,useCurrentRouteId}from\"framer\";const useCurrentLocation=()=>{var _routes_currentRouteId;const{navigate,routes}=useRouter();const currentRouteId=useCurrentRouteId();const location=Array.isArray(routes)&&((_routes_currentRouteId=routes[currentRouteId])===null||_routes_currentRouteId===void 0?void 0:_routes_currentRouteId.path);const setLocation=path=>{var _Object_entries;const routeID=(_Object_entries=Object.entries(routes))===null||_Object_entries===void 0?void 0:_Object_entries.reduce((acc,item)=>{var _item_;return((_item_=item[1])===null||_item_===void 0?void 0:_item_.path)===path?item[0]:acc;},false);navigate(routeID,\"\");};return[location,setLocation];};export{useCurrentLocation};\nexport const __FramerMetadata__ = {\"exports\":{\"useCurrentLocation\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./UseCurrentLocation.map","/*\n * UseCurrentLocation\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/ixn5bwVqHDFh2rnxxDYw/aUrpXThVRI7ohRQyuBpm/UseCurrentLocation.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,useCallback,useRef,useMemo}from\"react\";import{useCurrentLocation}from\"https://framer.com/m/UseCurrentLocation-coQY.js\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function KeyboardShortcut({shortcuts}){// const setCurrentLocation = (redirectTo: string) => {\n//   console.log(redirectTo);\n// };\nconst[currentLocation,setCurrentLocation]=useCurrentLocation();const[pressedKeys,setPressedKeys]=useState(new Set);const resetTimerRef=useRef(null);const pressedKeysRef=useRef(pressedKeys);const containerRef=useRef(null);useEffect(()=>{pressedKeysRef.current=pressedKeys;},[pressedKeys]);// Add auto-focus effect\nuseEffect(()=>{if(containerRef.current){containerRef.current.focus();}},[]);const normalizeKey=useCallback(key=>{key=key.toLowerCase();if(key===\"meta\"||key===\"command\"||key===\"os\")return\"cmd\";if(key===\"control\")return\"ctrl\";if(key===\"alt\"||key===\"option\")return\"alt\";if(key===\"shift\")return\"shift\";return key;},[]);const isModifierKey=useCallback(key=>{return[\"cmd\",\"ctrl\",\"alt\",\"shift\"].includes(key);},[]);const normalizedShortcuts=useMemo(()=>{return shortcuts.map(shortcut=>({originalKey:shortcut.key,normalizedKey:shortcut.key.toLowerCase().split(\"+\").map(normalizeKey).sort().join(\"+\"),link:shortcut.link,newTab:shortcut.newTab})).filter(s=>s.normalizedKey);},[shortcuts,normalizeKey]);const resetKeys=useCallback(()=>{setPressedKeys(new Set);if(resetTimerRef.current){clearTimeout(resetTimerRef.current);resetTimerRef.current=null;}},[]);useEffect(()=>{const handleKeyDown=e=>{const targetElement=e.target;if(targetElement.tagName===\"INPUT\"||targetElement.tagName===\"TEXTAREA\"||targetElement.isContentEditable){return;}if(e.repeat)return;if(e.key===\"Dead\")return;const key=normalizeKey(e.key);const tempPressedSet=new Set(pressedKeysRef.current);tempPressedSet.add(key);const currentModifiers=Array.from(tempPressedSet).filter(isModifierKey);const keysToCheck=Array.from(tempPressedSet).filter(k=>!isModifierKey(k));if(keysToCheck.length>0){const currentCombination=[...currentModifiers,...keysToCheck].sort().join(\"+\");const isDefinedShortcut=normalizedShortcuts.some(shortcut=>shortcut.normalizedKey===currentCombination);if(isDefinedShortcut){e.preventDefault();}}setPressedKeys(prev=>{const newSet=new Set(prev);newSet.add(key);return newSet;});const finalModifiers=Array.from(tempPressedSet).filter(isModifierKey);const finalKeysToCheck=Array.from(tempPressedSet).filter(k=>!isModifierKey(k));if(finalKeysToCheck.length>0){const finalCombination=[...finalModifiers,...finalKeysToCheck].sort().join(\"+\");const matchedShortcut=normalizedShortcuts.find(shortcut=>shortcut.normalizedKey===finalCombination);if(matchedShortcut){let targetUrl=matchedShortcut.link;const openInNewTab=matchedShortcut.newTab;if(targetUrl===\"Home\"){targetUrl=\"/\";}else if(!targetUrl.startsWith(\"/\")&&!targetUrl.match(/^([a-zA-Z]+:)?\\/\\//)){if(targetUrl.includes(\".\")){targetUrl=`https://${targetUrl}`;}else{targetUrl=`/${targetUrl}`;}}if(openInNewTab){window.open(targetUrl,\"_blank\",\"noopener,noreferrer\");}else{// window.location.href = targetUrl;\nsetCurrentLocation(targetUrl);}resetKeys();return;}}if(resetTimerRef.current){clearTimeout(resetTimerRef.current);}resetTimerRef.current=window.setTimeout(resetKeys,1500);};const handleKeyUp=e=>{if(e.key===\"Dead\")return;const key=normalizeKey(e.key);setPressedKeys(prev=>{const newSet=new Set(prev);newSet.delete(key);return newSet;});};const handleBlur=()=>{resetKeys();};window.addEventListener(\"keydown\",handleKeyDown);window.addEventListener(\"keyup\",handleKeyUp);window.addEventListener(\"blur\",handleBlur);return()=>{window.removeEventListener(\"keydown\",handleKeyDown);window.removeEventListener(\"keyup\",handleKeyUp);window.removeEventListener(\"blur\",handleBlur);if(resetTimerRef.current){clearTimeout(resetTimerRef.current);}};},[normalizedShortcuts,resetKeys,isModifierKey,normalizeKey]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,tabIndex:-1,style:{outline:\"none\"}});}KeyboardShortcut.displayName=\"Shortcuts\";addPropertyControls(KeyboardShortcut,{shortcuts:{type:ControlType.Array,title:\"Shortcuts\",defaultValue:[{key:\"shift+a\",link:\"https://framer.university\",newTab:false}],control:{type:ControlType.Object,controls:{key:{type:ControlType.String,title:\"Key\",placeholder:\"shift+b...\",description:\"Use '+' for combinations.\"},link:{type:ControlType.Link,title:\"Link\"},newTab:{type:ControlType.Boolean,title:\"New Tab\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"}}},description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"KeyboardShortcut\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shortcuts_Prod.map"],"mappings":"uPACgD,CAAM,MAAuB,CAA4B,GAAK,CAAC,WAAS,UAAQ,GAAW,CAAO,EAAe,GAAmB,CAAsd,MAAM,CAA5c,MAAM,QAAQ,EAAO,EAA2B,EAAO,IAAuF,KAAwB,GAAM,CAAmQ,EAA/M,OAAO,QAAQ,EAAO,EAA0D,QAAQ,EAAI,IAAkC,EAAK,IAA0C,OAAQ,EAAK,EAAK,GAAG,EAAM,GAAM,CAAkB,GAAG,EAA+B,sBEGnqB,SAAwB,EAAiB,CAAC,aAAW,CAGxD,GAAK,CAAC,EAAgB,GAAoB,GAAoB,CAAM,CAAC,EAAY,GAAgBA,EAAS,IAAI,IAAI,CAAO,EAAcC,EAAO,KAAK,CAAO,EAAeA,EAAO,EAAY,CAAO,EAAaA,EAAO,KAAK,CAAC,MAAc,CAAC,EAAe,QAAQ,GAAc,CAAC,EAAY,CAAC,CAC/R,MAAc,CAAI,EAAa,SAAS,EAAa,QAAQ,OAAO,EAAI,EAAE,CAAC,CAAC,IAAM,EAAaC,EAAY,IAAM,EAAI,EAAI,aAAa,CAAI,IAAM,QAAQ,IAAM,WAAW,IAAM,KAAW,MAAS,IAAM,UAAgB,OAAU,IAAM,OAAO,IAAM,SAAe,MAAS,IAAM,QAAc,QAAe,GAAM,EAAE,CAAC,CAAO,EAAcA,EAAY,GAAY,CAAC,MAAM,OAAO,MAAM,QAAQ,CAAC,SAAS,EA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