{"version":3,"file":"TextBlock.0jAPeWZW.mjs","names":["useRef","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","p","c","init_jsx_runtime","ce","de","useMotionValue","init_framer_motion_DhsWWWsN","motion","init_framer_BisrWwwE","addPropertyControls","useIsStaticRenderer","ControlType","init_Hydration_1","init_MachFonts","machFont","Style","stableId","clamp","max","min","value","parse","text","highlighted","part","TextBlock","props","id","desktop","tablet","phone","SIZES","size","isStatic","rootRef","y","root","slow","frame","apply","viewport","top","length","slowLength","speed","slowFrom","slowGap","queue","font","highlightColor","index","init_TextBlock"],"sources":["https:/framerusercontent.com/modules/Vdo5rPXqOytetMYSySRH/GcJpUeXNVctBXzfY5i4U/TextBlock.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{machFont}from\"https://framerusercontent.com/modules/a0TsvHledqpAPWOtDuE5/jPBOsaZJQ1xDQExa46Bu/MachFonts.js\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{stableId,Style}from\"https://framerusercontent.com/modules/0eGyxgeL83xzA0r3E1ED/eBh4H1eyJ0WBrRncuQqg/Hydration_1.js\";import{motion,useMotionValue}from\"framer-motion\";// Font sizes of the Body M and Body S text styles on desktop, tablet and phone.\nconst SIZES={M:[24,20,16],S:[16,16,14]};function clamp(value,min,max){return Math.min(max,Math.max(min,value));}// \"Intro *about* who we are\" -> plain parts and highlighted parts.\nfunction parse(text){return text.split(/(\\*[^*]+\\*)/g).filter(Boolean).map(part=>{const highlighted=part.length>2&&part.startsWith(\"*\")&&part.endsWith(\"*\");return{highlighted,value:highlighted?part.slice(1,-1):part};});}/**\n * Body text with highlighted words. Wrap a word in asterisks to highlight it:\n * \"Intro *about* who we are\". Optionally slows down for a stretch of scrolling,\n * drifting up and off the screen while something next to it is animating.\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 120\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight auto\n */export default function TextBlock(props){const{text,size,color,highlightColor,font,slow,slowFrom,slowLength,slowGap}=props;const id=stableId(\"mach-text-\",props);const[desktop,tablet,phone]=SIZES[size]??SIZES.M;const isStatic=useIsStaticRenderer();const rootRef=useRef(null);const y=useMotionValue(0);// Within the slow stretch the block gives back part of the scroll, so it rises at a fraction of the page speed.\nuseEffect(()=>{const root=rootRef.current;if(isStatic||!slow||!root||typeof window===\"undefined\"){y.set(0);return;}let frame=0;const apply=()=>{frame=0;const viewport=window.innerHeight;// The wrapper itself never moves, so its top is where the text would sit without any offset.\nconst top=root.getBoundingClientRect().top;const length=viewport*slowLength/100;// Just fast enough to be fully off the top, plus the gap, when the stretch ends —\n// so whatever is growing underneath never catches it.\nconst speed=Math.min(1,(slowFrom+root.offsetHeight+slowGap)/Math.max(1,length));y.set((1-speed)*clamp(slowFrom-top,0,length));};const queue=()=>{if(!frame)frame=window.requestAnimationFrame(apply);};apply();window.addEventListener(\"scroll\",queue,{passive:true});window.addEventListener(\"resize\",queue);return()=>{window.removeEventListener(\"scroll\",queue);window.removeEventListener(\"resize\",queue);if(frame)window.cancelAnimationFrame(frame);};},[isStatic,slow,slowFrom,slowLength,slowGap,y]);return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\"},children:[/*#__PURE__*/_jsx(Style,{css:`\n                    .${id} {\n                        font-size: ${desktop}px;\n                        text-wrap: pretty;\n                    }\n                    @media (max-width: 1199.98px) {\n                        .${id} {\n                            font-size: ${tablet}px;\n                        }\n                    }\n                    @media (max-width: 809.98px) {\n                        .${id} {\n                            font-size: ${phone}px;\n                        }\n                    }\n                `}),/*#__PURE__*/_jsx(motion.p,{className:id,style:{position:\"relative\",width:\"100%\",margin:0,y,color,fontFamily:'\"Die Grotesk B Medium\", \"Die Grotesk B\", sans-serif',fontWeight:500,lineHeight:1.125,// The Font setting makes Framer load the typeface; the size always comes from the Size setting.\n...machFont(font),fontSize:undefined},children:parse(text).map((part,index)=>part.highlighted?/*#__PURE__*/_jsx(\"span\",{style:{color:highlightColor},children:part.value},index):part.value)})]});}addPropertyControls(TextBlock,{text:{type:ControlType.String,title:\"Text\",description:\"Wrap words in *asterisks* to highlight them.\",displayTextArea:true,defaultValue:\"Intro *about* who we are Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\"},highlightColor:{type:ControlType.Color,title:\"Highlight\",defaultValue:\"#9F9EC2\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#0F051F\"},size:{type:ControlType.Enum,title:\"Size\",options:[\"M\",\"S\"],optionTitles:[\"Body M\",\"Body S\"],defaultValue:\"M\",displaySegmentedControl:true},font:{type:ControlType.Font,title:\"Font\",description:\"Set to Die Grotesk B Medium so the typeface loads.\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{variant:\"Medium\",lineHeight:\"1.125em\"}},slow:{type:ControlType.Boolean,title:\"Slow Scroll\",description:\"Rise more slowly than the page for a stretch of scrolling.\",defaultValue:false},slowFrom:{type:ControlType.Number,title:\"Slow From\",description:\"Distance from the top of the screen at which it starts to slow down. Match the space above the text.\",defaultValue:280,min:0,max:800,step:4,unit:\"px\",hidden:props=>!props.slow},slowLength:{type:ControlType.Number,title:\"Slow Length\",description:\"Scrolling it takes to leave the screen, in screen heights. Shorter leaves sooner.\",defaultValue:60,min:10,max:300,step:5,unit:\"%\",hidden:props=>!props.slow},slowGap:{type:ControlType.Number,title:\"Clear Gap\",description:\"Extra distance past the top edge it has covered when the stretch ends.\",defaultValue:42,min:0,max:200,step:2,unit:\"px\",hidden:props=>!props.slow}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextBlock\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"600\",\"framerIntrinsicHeight\":\"120\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\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