{"version":3,"file":"TypeText.CyPUqn40.mjs","names":["React.useRef","React.useState","React.useId","__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","de","init_jsx_runtime","p","ie","ce","RenderTarget","addPropertyControls","ControlType","init_framer_BisrWwwE","TypeText","props","ref","lines","text","text2","text3","text4","t","linesKey","view","setView","uid","el","total","rounds","ms","s","speed","visible","started","cancelled","timer","pending","step","i","k","wait","fn","delayMs","erase","final","hold","io","e","entries","delay","line","chars","typeDur","eraseDur","start","blinkCount","blinks","css","caretColor","style","font","init_TypeText"],"sources":["https:/framerusercontent.com/modules/u5OtCkDeeLTNiSlnhrGE/FsBQPaBELkkgOcQ92VaV/TypeText.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// Type Text. One line of text that types itself out once, when it scrolls into view.\n// Optional: fill Search 2–4 and it erases and types the next one after a pause,\n// for a set number of rounds, ending back on the first line. Pauses while off screen.\n// CSS does the letter-by-letter reveal (stepped clip); JS only switches lines on a timer.\n// The canvas and reduced motion show the first line, finished.\n/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function TypeText(props){const{text,text2,text3,text4,rounds,hold,font,color,caretColor,delay,speed,blinks,style}=props;const ref=React.useRef(null);const lines=[text,text2,text3,text4].filter(t=>typeof t===\"string\"&&t.trim()!==\"\");if(lines.length===0)lines.push(\"\");const linesKey=lines.join(\"\\n\");const[view,setView]=React.useState({mode:\"done\",i:0,first:true,final:true,k:0});const uid=\"tt\"+React.useId().replace(/[^a-zA-Z0-9]/g,\"\");React.useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;if(typeof window===\"undefined\"||!(\"IntersectionObserver\"in window))return;if(window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;const el=ref.current;if(!el)return;const total=lines.length>1?Math.max(0,Math.round(rounds))*lines.length:0;const ms=s=>Array.from(s).length*speed;let visible=false;let started=false;let cancelled=false;let timer=0;let pending=null;let step=0;let i=0;let k=0;const wait=(delayMs,fn)=>{timer=window.setTimeout(()=>{if(cancelled)return;if(visible)fn();else pending=fn;},delayMs);};const erase=()=>{setView({mode:\"erase\",i,first:false,final:false,k:++k});wait(ms(lines[i])*.45+80,()=>{step++;i=(i+1)%lines.length;const final=step>=total;setView({mode:\"type\",i,first:false,final,k:++k});if(!final)wait(150+ms(lines[i])+hold*1e3,erase);});};setView({mode:\"armed\",i:0,first:true,final:total===0,k:++k});const io=new IntersectionObserver(entries=>{const e=entries[entries.length-1];visible=e.isIntersecting;if(!started&&e.intersectionRatio>=.6){started=true;setView({mode:\"type\",i:0,first:true,final:total===0,k:++k});if(total>0)wait(delay*1e3+ms(lines[0])+hold*1e3,erase);}else if(visible&&pending){const fn=pending;pending=null;fn();}},{threshold:[0,.6]});io.observe(el);return()=>{cancelled=true;window.clearTimeout(timer);io.disconnect();};},[linesKey,rounds,hold,delay,speed]);const line=lines[view.i]??lines[0];const chars=Math.max(1,Array.from(line).length);const typeDur=chars*speed/1e3;const eraseDur=typeDur*.45;const start=view.first?delay:.15;const blinkCount=view.final?blinks:\"infinite\";const css=`\n.${uid} .tt-c { display: none; position: absolute; top: 12%; bottom: 12%; width: 1.5px; border-radius: 1px; background: ${caretColor}; }\n.${uid}[data-mode=\"armed\"] .tt-t { clip-path: inset(0 100% 0 0); }\n.${uid}[data-mode=\"armed\"] .tt-c { display: block; left: 0; }\n.${uid}[data-mode=\"type\"] .tt-t { animation: ${uid}-type ${typeDur}s steps(${chars}, end) ${start}s both; }\n.${uid}[data-mode=\"type\"] .tt-c { display: block; animation: ${uid}-move ${typeDur}s steps(${chars}, end) ${start}s both, ${uid}-blink 0.9s linear ${start+typeDur}s ${blinkCount} forwards; }\n.${uid}[data-mode=\"erase\"] .tt-t { animation: ${uid}-type ${eraseDur}s steps(${chars}, end) reverse both; }\n.${uid}[data-mode=\"erase\"] .tt-c { display: block; animation: ${uid}-move ${eraseDur}s steps(${chars}, end) reverse both; }\n@keyframes ${uid}-type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }\n@keyframes ${uid}-move { from { left: 0; } to { left: calc(100% - 2px); } }\n@keyframes ${uid}-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }\n`;return /*#__PURE__*/_jsxs(\"div\",{ref:ref,className:uid,\"data-mode\":view.mode,style:{...style,width:\"100%\",overflow:\"hidden\",whiteSpace:\"nowrap\",color,...font},children:[/*#__PURE__*/_jsxs(\"span\",{style:{position:\"relative\",display:\"inline-block\",paddingRight:2},children:[/*#__PURE__*/_jsx(\"span\",{className:\"tt-t\",children:line}),/*#__PURE__*/_jsx(\"span\",{className:\"tt-c\",\"aria-hidden\":\"true\"})]},view.k),/*#__PURE__*/_jsx(\"style\",{children:css})]});}TypeText.defaultProps={text:\"best GTM tool for startups\",text2:\"\",text3:\"\",text4:\"\",rounds:3,hold:4.5,color:\"#F4F5F7\",caretColor:\"#8AB4F8\",delay:.6,speed:28,blinks:2};addPropertyControls(TypeText,{text:{type:ControlType.String,title:\"Search 1\"},text2:{type:ControlType.String,title:\"Search 2\",placeholder:\"Optional: rotates after Search 1\"},text3:{type:ControlType.String,title:\"Search 3\",placeholder:\"Optional\"},text4:{type:ControlType.String,title:\"Search 4\",placeholder:\"Optional\"},rounds:{type:ControlType.Number,title:\"Rounds\",min:0,max:10,step:1,displayStepper:true,description:\"Times it cycles through the searches, then stops on Search 1.\"},hold:{type:ControlType.Number,title:\"Hold\",min:1,max:15,step:.5,unit:\"s\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:15,lineHeight:\"1.3em\"}},color:{type:ControlType.Color,title:\"Color\"},caretColor:{type:ControlType.Color,title:\"Caret\"},delay:{type:ControlType.Number,title:\"Delay\",min:0,max:5,step:.1,unit:\"s\"},speed:{type:ControlType.Number,title:\"Per Letter\",min:10,max:150,step:2,unit:\"ms\"},blinks:{type:ControlType.Number,title:\"Caret Blinks\",min:0,max:6,step:1,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypeText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypeText.map"],"mappings":"A,wNAQG,SAAwBiB,EAAS,EAAM,CAAC,GAAK,CAAC,OAAK,QAAM,QAAM,QAAM,SAAO,OAAK,OAAK,QAAM,aAAW,QAAM,QAAM,SAAO,SAAOC,EAAYC,EAAInB,EAAa,IAAI,EAAQoB,EAAM,CAACC,EAAKC,EAAMC,EAAMC,CAAK,CAAC,CAAC,OAAO,GAAG,OAAOC,GAAI,UAAUA,EAAE,KAAK,IAAI,EAAE,EAAKL,EAAM,SAAS,GAAEA,EAAM,KAAK,EAAE,EAAE,IAAMM,EAASN,EAAM,KAAK;CAAI,EAAO,CAACO,EAAKC,GAAS3B,EAAe,CAAC,KAAK,OAAO,EAAE,EAAE,MAAM,GAAK,MAAM,GAAK,EAAE,CAAC,CAAC,EAAQ4B,EAAI,KAAK3B,EAAY,CAAC,CAAC,QAAQ,gBAAgB,EAAE,EAAEU,MAAoB,CAAkI,GAA9HC,EAAa,QAAQ,IAAIA,EAAa,QAAwBT,IAAS,QAAa,EAAE,yBAAyBA,IAAkBA,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAQ,OAAO,IAAM0B,EAAGX,EAAI,QAAQ,GAAG,CAACW,EAAG,OAAO,IAAMC,EAAMX,EAAM,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,MAAMY,CAAM,CAAC,EAAEZ,EAAM,OAAO,EAAQa,EAAG,GAAG,MAAM,KAAKC,CAAC,CAAC,CAAC,OAAOC,EAAUC,EAAQ,GAAUC,EAAQ,GAAUC,EAAU,GAAUC,EAAM,E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