{"version":3,"file":"Typewriter.CPIrAX2X.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/21kbSGygMxflqz4HyfEY/izomRCoGCKCV3yAK1uY2/Typewriter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView}from\"framer-motion\";/**\n *\n * @framerIntrinsicWidth 588\n * @framerIntrinsicHeight 56\n *\n * @framerDisableUnlink\n *\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n *\n */export default function Typewriter({prefixText,dynamicTexts,suffixText,typingSpeed,pauseDuration,font,staticTextColor,dynamicTextColor,showCursor,cursorColor,textAlign}){const[displayText,setDisplayText]=useState(\"\");const[subIndex,setSubIndex]=useState(0);const[deleting,setDeleting]=useState(false);const[dynamicIndex,setDynamicIndex]=useState(0);const[isBlinking,setIsBlinking]=useState(false);const ref=useRef(null);const isInView=useInView(ref,{once:false,margin:\"-10% 0px\"});useEffect(()=>{if(!isInView)return;// Only run when the component is in view\nconst dynamicText=dynamicTexts[dynamicIndex];const handleTyping=()=>{if(deleting){setDisplayText(dynamicText.substring(0,subIndex-1));setSubIndex(prev=>prev-1);if(subIndex===0){setDeleting(false);setDynamicIndex(prev=>(prev+1)%dynamicTexts.length);setIsBlinking(false)// Stop blinking while typing\n;}}else{setDisplayText(dynamicText.substring(0,subIndex+1));setSubIndex(prev=>prev+1);if(subIndex===dynamicText.length){setTimeout(()=>{setDeleting(true);setIsBlinking(true)// Start blinking after typing completes\n;},pauseDuration);}}};const timeout=setTimeout(handleTyping,deleting?typingSpeed/2:typingSpeed);return()=>clearTimeout(timeout);},[isInView,subIndex,deleting,dynamicIndex,dynamicTexts,typingSpeed,pauseDuration]);return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...font,color:staticTextColor,display:\"inline-block\",textAlign,width:\"100%\"},children:[/*#__PURE__*/_jsxs(\"span\",{style:{color:staticTextColor},children:[prefixText,\" \"]}),/*#__PURE__*/_jsxs(\"span\",{style:{color:dynamicTextColor},children:[displayText,showCursor&&/*#__PURE__*/_jsx(\"span\",{style:{color:cursorColor,fontWeight:200,animation:isBlinking?\"blink 1s step-end infinite\":\"none\"},children:\"|\"})]}),/*#__PURE__*/_jsx(\"span\",{style:{color:staticTextColor},children:suffixText}),/*#__PURE__*/_jsx(\"style\",{children:`\n                    @keyframes blink {\n                        0%, 100% { opacity: 0; }\n                        50% { opacity: 1; }\n                    }\n                `})]});}addPropertyControls(Typewriter,{prefixText:{type:ControlType.String,title:\"Prefix Text\",defaultValue:\"You're\"},dynamicTexts:{type:ControlType.Array,title:\"Dynamic Texts\",defaultValue:[\" a Beautiful\",\"an Awesome\",\"an Amazing\"],propertyControl:{type:ControlType.String}},suffixText:{type:ControlType.String,title:\"Suffix Text\",defaultValue:\"Person\"},typingSpeed:{type:ControlType.Number,title:\"Typing Speed\",defaultValue:100,min:10,max:500,unit:\"ms\"},pauseDuration:{type:ControlType.Number,title:\"Pause Duration\",defaultValue:1e3,min:500,max:5e3,unit:\"ms\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontFamily:\"Inter\",fontWeight:\"Regular\",fontSize:44,lineHeight:\"1.5em\"},controls:\"extended\"},staticTextColor:{type:ControlType.Color,title:\"Static Text Color\",defaultValue:\"#275CE3\"},dynamicTextColor:{type:ControlType.Color,title:\"Dynamic Text Color\",defaultValue:\"#FF6200\"},showCursor:{type:ControlType.Boolean,title:\"Show Cursor\",defaultValue:true},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#FFD700\"},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],defaultValue:\"center\",description:\"[Mr. Framer](https://mrframer.com), Get Free High Quality Framer Resources.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Typewriter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\",\"framerIntrinsicHeight\":\"56\",\"framerIntrinsicWidth\":\"588\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Typewriter.map"],"mappings":"4WAWG,SAAwB,EAAW,CAAC,aAAW,eAAa,aAAW,cAAY,gBAAc,OAAK,kBAAgB,mBAAiB,aAAW,cAAY,YAAU,CAAC,CAAC,GAAK,CAAC,EAAY,EAAe,CAACA,EAAS,IAAS,CAAC,EAAS,EAAY,CAACA,EAAS,GAAQ,CAAC,EAAS,EAAY,CAACA,EAAS,IAAY,CAAC,EAAa,EAAgB,CAACA,EAAS,GAAQ,CAAC,EAAW,EAAc,CAACA,EAAS,IAAa,EAAIC,EAAO,MAAY,EAAS,EAAU,EAAI,CAAC,KAAK,GAAM,OAAO,WAAW,EAG9Q,OAHgR,MAAc,CAAC,GAAG,CAAC,EAAS,OAChgB,IAAM,EAAY,EAAa,GAAoB,MAAiB,CAAI,GAAU,EAAe,EAAY,UAAU,EAAE,EAAS,IAAI,EAAY,GAAM,EAAK,GAAM,IAAW,IAAG,EAAY,IAAO,EAAgB,IAAO,EAAK,GAAG,EAAa,QAAQ,EAAc,OAC9P,EAAe,EAAY,UAAU,EAAE,EAAS,IAAI,EAAY,GAAM,EAAK,GAAM,IAAW,EAAY,QAAQ,eAAe,CAAC,EAAY,IAAM,EAAc,GACtK,EAAC,GAAkB,EAAO,EAAQ,WAAW,EAAa,EAAS,EAAY,EAAE,GAAa,UAAU,aAAa,EAAU,EAAC,CAAC,EAAS,EAAS,EAAS,EAAa,EAAa,EAAY,EAAc,EAAsB,EAAM,MAAM,CAAK,MAAI,MAAM,CAAC,GAAG,EAAK,MAAM,EAAgB,QAAQ,eAAe,YAAU,MAAM,OAAO,CAAC,SAAS,CAAc,EAAM,OAAO,CAAC,MAAM,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