{"version":3,"file":"CodeEditor.BaI4pFFK.mjs","names":["useContext","forwardRef","useState","useEffect","_jsx","createContext","useState","useRef","useMemo","useEffect","startTransition","_jsxs","_jsx","__esmMin","init_npm_react_18_3_1","te","oe","pe","window","ce","init_jsx_runtime","B","J","c","p","_e","de","init_ssg_sandbox_shims","useIsStaticRenderer","addPropertyControls","ControlType","init_framer_ChujFWHC","motion","useInView","init_framer_motion_1EwlFBEG","useCardHover","CardHoverContext","withCardHover","Component","props","ref","hovered","setHovered","canHover","setCanHover","mq","update","init_CardHover","CodeEditor","code","language","theme","animationSpeed","showLineNumbers","windowTitle","backgroundColor","textColor","accentColor","font","displayedCode","setDisplayedCode","currentIndex","setCurrentIndex","isStatic","containerRef","isInView","cardHover","hoverMode","playing","themeColors","interval","prev","next","highlightCode","text","keywords","strings","comments","functions","highlighted","match","funcName","lines","line","index","init_CodeEditor"],"sources":["https:/framerusercontent.com/modules/zMHJrDtyeKzWGXwCSXr6/2PM4Mmvqr8Qf5pc9PBru/CardHover.js","https:/framerusercontent.com/modules/S10zlHAEV6dKcbv8oi0c/RPXKDHyIb9eYB6U7BcqX/CodeEditor.js"],"sourcesContent":["// CardHover.tsx — hover-triggered animations for bento cards.\n// Apply the `withCardHover` override to a card frame; any code component inside it\n// that calls `useCardHover()` only animates while that card is hovered.\n// On touch devices (no hover) components fall back to playing when in view.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{createContext,forwardRef,useContext,useEffect,useState}from\"react\";export const CardHoverContext=/*#__PURE__*/createContext(null);/** Returns null when the component is not inside a `withCardHover` card. */export function useCardHover(){return useContext(CardHoverContext);}export function withCardHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[hovered,setHovered]=useState(false);const[canHover,setCanHover]=useState(true);useEffect(()=>{if(typeof window===\"undefined\"||!window.matchMedia)return;const mq=window.matchMedia(\"(hover: hover) and (pointer: fine)\");const update=()=>setCanHover(mq.matches);update();mq.addEventListener?.(\"change\",update);return()=>mq.removeEventListener?.(\"change\",update);},[]);return /*#__PURE__*/_jsx(CardHoverContext.Provider,{value:{hovered,canHover},children:/*#__PURE__*/_jsx(Component,{ref:ref,...props,onMouseEnter:e=>{props.onMouseEnter?.(e);setHovered(true);},onMouseLeave:e=>{props.onMouseLeave?.(e);setHovered(false);}})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"CardHoverState\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CardHoverContext\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCardHover\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCardHover\":{\"type\":\"reactHoc\",\"name\":\"withCardHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CardHover.map","// Animated code editor to visualize code in a simple window with 3:4 aspect ratio\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,startTransition,useMemo}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{useRef}from\"react\";import{useCardHover}from\"https://framerusercontent.com/modules/zMHJrDtyeKzWGXwCSXr6/2PM4Mmvqr8Qf5pc9PBru/CardHover.js\";/**\n * Animated Code Editor\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 800\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CodeEditor(props){const{code=`function greet(name) {\n  console.log(\\`Hello, \\${name}!\\`);\n  return true;\n}\n\ngreet(\"World\");`,language=\"javascript\",theme=\"dark\",animationSpeed=50,showLineNumbers=true,windowTitle=\"code.js\",backgroundColor,textColor,accentColor,font}=props;const[displayedCode,setDisplayedCode]=useState(\"\");const[currentIndex,setCurrentIndex]=useState(0);const isStatic=useIsStaticRenderer();const containerRef=useRef(null);const isInView=useInView(containerRef,{once:false});// Inside a `withCardHover` card: type only while the card is hovered\n// (touch devices fall back to in-view). Elsewhere: unchanged in-view behaviour.\nconst cardHover=useCardHover();const hoverMode=!!cardHover&&cardHover.canHover;const playing=hoverMode?cardHover.hovered:isInView;const themeColors=useMemo(()=>{if(theme===\"dark\"){return{window:backgroundColor||\"#1e1e1e\",titleBar:\"#2d2d2d\",text:textColor||\"#d4d4d4\",lineNumber:\"#858585\",keyword:accentColor||\"#569cd6\",string:\"#ce9178\",comment:\"#6a9955\",function:\"#dcdcaa\"};}return{window:backgroundColor||\"#ffffff\",titleBar:\"#f3f3f3\",text:textColor||\"#000000\",lineNumber:\"#999999\",keyword:accentColor||\"#0000ff\",string:\"#a31515\",comment:\"#008000\",function:\"#795e26\"};},[theme,backgroundColor,textColor,accentColor]);useEffect(()=>{if(isStatic||!playing){setDisplayedCode(code);if(hoverMode)setCurrentIndex(code.length);return;}setCurrentIndex(0);setDisplayedCode(\"\");const interval=setInterval(()=>{setCurrentIndex(prev=>{if(prev>=code.length){clearInterval(interval);return prev;}const next=prev+1;startTransition(()=>{setDisplayedCode(code.slice(0,next));});return next;});},animationSpeed);return()=>clearInterval(interval);},[code,animationSpeed,isStatic,playing,hoverMode]);const highlightCode=text=>{const keywords=/\\b(function|const|let|var|return|if|else|for|while|class|import|export|from|async|await|try|catch)\\b/g;const strings=/([\"'`])(?:(?=(\\\\?))\\2.)*?\\1/g;const comments=/(\\/\\/.*$|\\/\\*[\\s\\S]*?\\*\\/)/gm;const functions=/\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*\\(/g;let highlighted=text;highlighted=highlighted.replace(comments,match=>`<span style=\"color: ${themeColors.comment}\">${match}</span>`);highlighted=highlighted.replace(strings,match=>`<span style=\"color: ${themeColors.string}\">${match}</span>`);highlighted=highlighted.replace(keywords,match=>`<span style=\"color: ${themeColors.keyword}\">${match}</span>`);highlighted=highlighted.replace(functions,(match,funcName)=>`<span style=\"color: ${themeColors.function}\">${funcName}</span>(`);return highlighted;};const lines=displayedCode.split(\"\\n\");return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",backgroundColor:themeColors.window,borderRadius:8,overflow:\"hidden\",boxShadow:\"0 4px 20px rgba(0, 0, 0, 0.15)\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",padding:\"8px 12px\",backgroundColor:themeColors.titleBar,borderBottom:`1px solid ${theme===\"dark\"?\"#3e3e3e\":\"#e0e0e0\"}`},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:6,marginRight:12},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:10,height:10,borderRadius:\"50%\",backgroundColor:\"#ff5f56\"}}),/*#__PURE__*/_jsx(\"div\",{style:{width:10,height:10,borderRadius:\"50%\",backgroundColor:\"#ffbd2e\"}}),/*#__PURE__*/_jsx(\"div\",{style:{width:10,height:10,borderRadius:\"50%\",backgroundColor:\"#27c93f\"}})]}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontSize:11,color:themeColors.text,opacity:.8},children:windowTitle})]}),/*#__PURE__*/_jsx(\"div\",{style:{flex:1,padding:12,overflow:\"auto\",...font,fontSize:11,lineHeight:\"1.6\",fontFamily:\"monospace\"},children:lines.map((line,index)=>/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",minHeight:\"1.6em\"},children:[showLineNumbers&&/*#__PURE__*/_jsx(\"span\",{style:{color:themeColors.lineNumber,marginRight:12,userSelect:\"none\",minWidth:24,textAlign:\"right\"},children:index+1}),/*#__PURE__*/_jsx(\"span\",{style:{color:themeColors.text,whiteSpace:\"pre\"},dangerouslySetInnerHTML:{__html:highlightCode(line)}}),index===lines.length-1&&currentIndex<code.length&&/*#__PURE__*/_jsx(motion.span,{animate:{opacity:[1,0]},transition:{duration:.5,repeat:Infinity},style:{display:\"inline-block\",width:2,height:\"1.2em\",backgroundColor:themeColors.text,marginLeft:2}})]},index))})]});}addPropertyControls(CodeEditor,{code:{type:ControlType.String,title:\"Code\",displayTextArea:true,defaultValue:`function greet(name) {\n  console.log(\\`Hello, \\${name}!\\`);\n  return true;\n}\n\ngreet(\"World\");`},language:{type:ControlType.String,title:\"Language\",defaultValue:\"javascript\"},theme:{type:ControlType.Enum,title:\"Theme\",options:[\"dark\",\"light\"],optionTitles:[\"Dark\",\"Light\"],defaultValue:\"dark\",displaySegmentedControl:true},animationSpeed:{type:ControlType.Number,title:\"Speed\",defaultValue:50,min:10,max:200,step:10,unit:\"ms\"},showLineNumbers:{type:ControlType.Boolean,title:\"Line Numbers\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},windowTitle:{type:ControlType.String,title:\"Window Title\",defaultValue:\"code.js\"},backgroundColor:{type:ControlType.Color,title:\"Background\",optional:true},textColor:{type:ControlType.Color,title:\"Text Color\",optional:true},accentColor:{type:ControlType.Color,title:\"Accent Color\",optional:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"monospace\",defaultValue:{fontSize:\"11px\",letterSpacing:\"0em\",lineHeight:\"1.6em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CodeEditor\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"600\",\"framerIntrinsicHeight\":\"800\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CodeEditor.map"],"mappings":"A,iTAIgQ,SAAgBmC,GAAc,CAAC,OAAOnC,EAAWoC,CAAgB,CAAE,CAAC,SAAgBC,EAAcC,EAAU,CAAC,MAAoBrC,iBAAYsC,EAAMC,IAAM,CAAC,GAAK,CAACC,EAAQC,GAAYxC,EAAS,EAAK,EAAO,CAACyC,EAASC,GAAa1C,EAAS,EAAI,EAA+R,OAA7RC,MAAc,CAAC,GAAUe,IAAS,QAAa,CAACA,EAAO,WA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