{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/91gnbzOUc6A6qhgemVw2/2ImxonxEJuFTl1X38bCc/Typewriter.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useState,useRef}from\"react\";import{motion,useMotionValue,animate}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function TypewriterComponent(props){const{text,cursor}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const Element=props.tag;const[textIndex,setTextIndex]=useState(0);const[characters,setCharacters]=useState(0);const characterMotionValue=useMotionValue(0);const textIndexRef=useRef(0);useEffect(()=>{function animateCharactersUp(newIndex){animate(characterMotionValue,text[newIndex].length,{duration:props.typeDelay*text[newIndex].length,type:\"tween\",ease:\"linear\",onUpdate:latest=>setCharacters(Math.floor(latest)),onComplete:()=>setTimeout(()=>{if(!props.looping&&newIndex==text.length-1&&props.endState==\"showText\"){var _props_completed;(_props_completed=props.completed)===null||_props_completed===void 0?void 0:_props_completed.call(props);}else{animateCharactersDown();}},props.endPause*1e3)});textIndexRef.current=newIndex;setTextIndex(newIndex);}function animateCharactersDown(){animate(characterMotionValue,0,{duration:props.deleteDelay*text[textIndexRef.current].length,type:\"tween\",ease:\"linear\",onUpdate:latest=>setCharacters(Math.floor(latest)),onComplete:()=>setTimeout(()=>{const newIndex=(textIndexRef.current+1)%text.length;if(newIndex==0){if(props.looping){var _props_looped;(_props_looped=props.looped)===null||_props_looped===void 0?void 0:_props_looped.call(props);animateCharactersUp(newIndex);}else{var _props_completed;(_props_completed=props.completed)===null||_props_completed===void 0?void 0:_props_completed.call(props);}}else{animateCharactersUp(newIndex);}},props.startPause*1e3)});}if(props.playing){animateCharactersUp(textIndex);}},[text.length,props.playing]);return /*#__PURE__*/_jsxs(Element,{style:{color:props.fontColor,margin:0,...props.font,...props.style},id:props.id,children:[isCanvas?text[0]:text[textIndex].slice(0,characters),cursor&&/*#__PURE__*/_jsx(motion.span,{style:{color:cursor.color},animate:{opacity:{blink:[1,1,0,0],pulse:[1,0],none:1}[cursor.animation]},transition:{duration:cursor.time,times:cursor.animation==\"blink\"?[0,cursor.time/2,cursor.time/2,cursor.time]:undefined,repeat:Infinity,repeatType:\"mirror\",ease:\"linear\"},children:cursor.character})]});}TypewriterComponent.displayName=\"Typewriter\";addPropertyControls(TypewriterComponent,{text:{type:ControlType.Array,defaultValue:[\"Framestack\",\"Typewriter\"],control:{type:ControlType.String,placeholder:\"Type here...\"}},playing:{type:ControlType.Boolean,defaultValue:true},looping:{type:ControlType.Boolean},endState:{type:ControlType.Enum,options:[\"showText\",\"clearText\"],optionTitles:[\"Show Text\",\"Clear Text\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\",hidden:props=>props.looping},typeDelay:{type:ControlType.Number,defaultValue:.1,min:0,step:.01},deleteDelay:{type:ControlType.Number,defaultValue:.05,min:0,step:.01},startPause:{type:ControlType.Number,defaultValue:.2,min:0,step:.01},endPause:{type:ControlType.Number,defaultValue:1,min:0,step:.01},cursor:{type:ControlType.Object,optional:true,defaultValue:{character:\"|\",color:\"rgba(0, 0, 0, 0.5)\",animation:\"blink\",time:.5},controls:{character:{type:ControlType.String,defaultValue:\"|\"},color:{type:ControlType.Color,defaultValue:\"rgba(0, 0, 0, 0.5)\"},animation:{type:ControlType.Enum,defaultValue:\"blink\",options:[\"pulse\",\"blink\",\"none\"],optionTitles:[\"Pulse\",\"Blink\",\"None\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},time:{type:ControlType.Number,defaultValue:.5,min:.1,step:.1,hidden:props=>props.animation===\"none\"}}},font:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4}},fontColor:{type:ControlType.Color,defaultValue:\"#000\"},tag:{type:ControlType.Enum,defaultValue:\"p\",options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"]},completed:{type:ControlType.EventHandler},looped:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypewriterComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Typewriter.map"],
  "mappings": "iJAGkB,SAARA,EAAqCC,EAAM,CAAC,GAAK,CAAC,KAAAC,EAAK,OAAAC,CAAM,EAAEF,EAAYG,EAASC,EAAa,QAAQ,IAAIA,EAAa,OAAaC,EAAQL,EAAM,IAAS,CAACM,EAAUC,CAAY,EAAEC,EAAS,CAAC,EAAO,CAACC,EAAWC,CAAa,EAAEF,EAAS,CAAC,EAAQG,EAAqBC,EAAe,CAAC,EAAQC,EAAaC,EAAO,CAAC,EAAE,OAAAC,EAAU,IAAI,CAAC,SAASC,EAAoBC,EAAS,CAACC,EAAQP,EAAqBV,EAAKgB,CAAQ,EAAE,OAAO,CAAC,SAASjB,EAAM,UAAUC,EAAKgB,CAAQ,EAAE,OAAO,KAAK,QAAQ,KAAK,SAAS,SAASE,GAAQT,EAAc,KAAK,MAAMS,CAAM,CAAC,EAAE,WAAW,IAAI,WAAW,IAAI,CAAC,GAAG,CAACnB,EAAM,SAASiB,GAAUhB,EAAK,OAAO,GAAGD,EAAM,UAAU,WAAW,CAAC,IAAIoB,GAAkBA,EAAiBpB,EAAM,aAAa,MAAMoB,IAAmB,QAAcA,EAAiB,KAAKpB,CAAK,CAAE,MAAMqB,EAAsB,CAAG,EAAErB,EAAM,SAAS,GAAG,CAAC,CAAC,EAAEa,EAAa,QAAQI,EAASV,EAAaU,CAAQ,CAAE,CAAC,SAASI,GAAuB,CAACH,EAAQP,EAAqB,EAAE,CAAC,SAASX,EAAM,YAAYC,EAAKY,EAAa,OAAO,EAAE,OAAO,KAA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KAAK,SAAS,WAAW,gBAAgB,aAAa,aAAa,CAAC,SAAS,GAAG,WAAW,GAAG,CAAC,EAAE,UAAU,CAAC,KAAKA,EAAY,MAAM,aAAa,MAAM,EAAE,IAAI,CAAC,KAAKA,EAAY,KAAK,aAAa,IAAI,QAAQ,CAAC,IAAI,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI,CAAC,EAAE,UAAU,CAAC,KAAKA,EAAY,YAAY,EAAE,OAAO,CAAC,KAAKA,EAAY,YAAY,CAAC,CAAC",
  "names": ["TypewriterComponent", "props", "text", "cursor", "isCanvas", "RenderTarget", "Element", "textIndex", "setTextIndex", "ye", "characters", "setCharacters", "characterMotionValue", "useMotionValue", "textIndexRef", "pe", "ue", "animateCharactersUp", "newIndex", "animate", "latest", "_props_completed", "animateCharactersDown", "_props_looped", "u", "p", "motion", "addPropertyControls", "ControlType"]
}
