{"version":3,"file":"Text_Masking.d4MYHZkv.mjs","names":["React.useId"],"sources":["https:/framerusercontent.com/modules/gNI41JrxhFp1XOIOZtNA/S5vrgCwaqjrW1vYW2ceg/Text_Masking.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";const DURATION=1200;const WORD_STAGGER=0;const START_DELAY=60;const EASING=\"cubic-bezier(0.294, -0.002, 0.208, 0.996)\";const HIDDEN_CLIP=\"polygon(-10% -100%, 110% -100%, 110% 0%, -10% 0%)\";const VISIBLE_CLIP=\"polygon(-10% 0%, 110% 0%, 110% 110%, -10% 110%)\";const WORD_ATTRIBUTE=\"data-glyphic-mask-word\";function unwrapGeneratedWords(root){root.querySelectorAll(`[${WORD_ATTRIBUTE}]`).forEach(word=>{word.replaceWith(document.createTextNode(word.textContent??\"\"));});root.normalize();}function splitTextIntoWords(root){unwrapGeneratedWords(root);const walker=document.createTreeWalker(root,NodeFilter.SHOW_TEXT);const textNodes=[];let currentNode=walker.nextNode();while(currentNode){const textNode=currentNode;const parent=textNode.parentElement;const blockedTag=parent?.closest(\"script, style, noscript\");const isInsideFitText=Boolean(parent?.closest(\"foreignObject, foreignobject\"));const isNativeSvgText=parent?.namespaceURI===\"http://www.w3.org/2000/svg\"&&!isInsideFitText;if(!blockedTag&&!isNativeSvgText&&!parent?.closest(`[${WORD_ATTRIBUTE}]`)&&/\\S/.test(textNode.data)){textNodes.push(textNode);}currentNode=walker.nextNode();}const words=[];textNodes.forEach(textNode=>{const fragment=document.createDocumentFragment();const parts=textNode.data.split(/(\\s+)/);parts.forEach(part=>{if(!part)return;if(/^\\s+$/.test(part)){fragment.appendChild(document.createTextNode(part));return;}const word=document.createElement(\"span\");word.setAttribute(WORD_ATTRIBUTE,\"\");word.textContent=part;Object.assign(word.style,{position:\"relative\",display:\"inline-block\",verticalAlign:\"baseline\",transform:\"translate3d(0, 100%, 0)\",clipPath:HIDDEN_CLIP,willChange:\"transform, clip-path\"});fragment.appendChild(word);words.push(word);});textNode.replaceWith(fragment);});return words;}function installMask(root,triggerElement,replay=false){const words=splitTextIntoWords(root);const animations=[];let hasPlayed=false;let frame=0;let runId=0;let previousScrollY=null;let previousCenter=null;let wasHidden=false;let playScrollY=null;let furthestScrollY=null;const revealImmediately=()=>{words.forEach(word=>{word.style.transform=\"translate3d(0, 0%, 0)\";word.style.clipPath=VISIBLE_CLIP;word.style.willChange=\"auto\";});};const reset=()=>{runId+=1;animations.forEach(animation=>animation.cancel());animations.length=0;hasPlayed=false;words.forEach(word=>{word.style.transform=\"translate3d(0, 100%, 0)\";word.style.clipPath=HIDDEN_CLIP;word.style.willChange=\"transform, clip-path\";});};const play=()=>{if(hasPlayed)return;hasPlayed=true;const currentRun=++runId;const currentScrollY=window.scrollY||window.pageYOffset;playScrollY=currentScrollY;furthestScrollY=currentScrollY;if(typeof Element.prototype.animate!==\"function\"){revealImmediately();return;}words.forEach((word,index)=>{const animation=word.animate([{transform:\"translate3d(0, 100%, 0)\",clipPath:HIDDEN_CLIP},{transform:\"translate3d(0, 0%, 0)\",clipPath:VISIBLE_CLIP}],{duration:DURATION,delay:START_DELAY+index*WORD_STAGGER,easing:EASING,fill:\"both\"});animation.finished.then(()=>{if(currentRun!==runId)return;word.style.transform=\"translate3d(0, 0%, 0)\";word.style.clipPath=VISIBLE_CLIP;word.style.willChange=\"auto\";}).catch(()=>{});animations.push(animation);});};// Start the reveal when the vertical center of the text reaches\n// the bottom edge of the viewport (ScrollTrigger: \"center bottom\").\nconst checkPosition=()=>{frame=0;if(!root.isConnected)return;if(hasPlayed&&!replay)return;const bounds=triggerElement.getBoundingClientRect();const center=bounds.top+bounds.height/2;const scrollY=window.scrollY||window.pageYOffset;const direction=previousScrollY===null?0:scrollY>previousScrollY?1:scrollY<previousScrollY?-1:0;if(replay&&hasPlayed&&furthestScrollY!==null&&scrollY>furthestScrollY){furthestScrollY=scrollY;}// Sticky parents can keep a text layer partially inside the viewport\n// forever. Replay when its trigger point crosses the viewport edge,\n// instead of waiting for the complete layer to become invisible.\nif(replay&&hasPlayed&&previousCenter!==null&&(direction<0&&previousCenter<=window.innerHeight&&center>window.innerHeight||direction>0&&previousCenter>=0&&center<0||direction<0&&playScrollY!==null&&furthestScrollY!==null&&furthestScrollY>playScrollY&&scrollY<furthestScrollY-window.innerHeight*.35)){reset();playScrollY=null;furthestScrollY=null;}previousScrollY=scrollY;previousCenter=center;const isAtTrigger=center<=window.innerHeight&&bounds.bottom>=0;if(isAtTrigger)play();};const queuePositionCheck=()=>{if(!frame)frame=requestAnimationFrame(checkPosition);};const isEffectivelyHidden=()=>{if(!root.isConnected)return true;let element=root;for(let depth=0;element&&depth<4;depth+=1){const style=window.getComputedStyle(element);if(style.display===\"none\"||style.visibility===\"hidden\"||Number.parseFloat(style.opacity||\"1\")<=.01){return true;}element=element.parentElement;}return false;};// Framer can swap a variant while the sticky wrapper remains in the\n// viewport. Observe that visibility lifecycle as well as scroll position.\n// This is what makes replay work when the section is reactivated without\n// physically leaving the viewport.\nconst visibilityObserver=new MutationObserver(()=>{const hidden=isEffectivelyHidden();if(hidden){wasHidden=true;if(replay&&hasPlayed)reset();return;}if(replay&&wasHidden){wasHidden=false;reset();queuePositionCheck();}});visibilityObserver.observe(root,{attributes:true,attributeFilter:[\"style\",\"class\"]});let observedParent=root.parentElement;let parentDepth=0;while(observedParent&&parentDepth<3){visibilityObserver.observe(observedParent,{attributes:true,attributeFilter:[\"style\",\"class\",\"data-framer-name\"]});observedParent=observedParent.parentElement;parentDepth+=1;}window.addEventListener(\"scroll\",queuePositionCheck,{passive:true});window.addEventListener(\"resize\",queuePositionCheck,{passive:true});queuePositionCheck();return()=>{runId+=1;if(frame)cancelAnimationFrame(frame);window.removeEventListener(\"scroll\",queuePositionCheck);window.removeEventListener(\"resize\",queuePositionCheck);visibilityObserver.disconnect();animations.forEach(animation=>animation.cancel());previousScrollY=null;previousCenter=null;playScrollY=null;furthestScrollY=null;unwrapGeneratedWords(root);};}/**\n * Apply `withGlyphicTextMask` to any native Framer Text layer.\n *\n * The override keeps the original Text layer and only splits its rendered\n * words for the reveal. Font, rich text styling, wrapping, sizing, and\n * responsive breakpoint settings remain controlled natively in Framer.\n * Framer Fit Text is supported through its SVG foreignObject output.\n */function createTextMask(Component,replay=false){return /*#__PURE__*/React.forwardRef(function GlyphicTextMask(props,forwardedRef){const maskId=React.useId().replace(/:/g,\"\");React.useLayoutEffect(()=>{let removeMask=()=>{};let retryFrame=0;let attempts=0;const connect=()=>{const root=document.querySelector(`[data-glyphic-mask-id=\"${maskId}\"]`);if(root){removeMask=installMask(root,root,replay);return;}// Framer can attach the native Text DOM one frame after the\n// override itself. Retry briefly instead of failing silently.\nattempts+=1;if(attempts<12){retryFrame=requestAnimationFrame(connect);}};connect();return()=>{if(retryFrame)cancelAnimationFrame(retryFrame);removeMask();};},[maskId]);return /*#__PURE__*/_jsx(Component,{...props,ref:forwardedRef,\"data-glyphic-mask-id\":maskId});});}/** Default: reveal once per mount, without replay on scrolling back. */export function withGlyphicTextMask(Component){return createTextMask(Component);}/** Replay after the text leaves the viewport completely and re-enters. */export function withGlyphicTextMaskReplay(Component){return createTextMask(Component,true);}\nexport const __FramerMetadata__ = {\"exports\":{\"withGlyphicTextMaskReplay\":{\"type\":\"reactHoc\",\"name\":\"withGlyphicTextMaskReplay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGlyphicTextMask\":{\"type\":\"reactHoc\",\"name\":\"withGlyphicTextMask\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Masking.map"],"mappings":"yIAAuX,SAAS,EAAqB,EAAK,CAAC,EAAK,iBAAiB,IAAI,EAAe,EAAE,CAAC,CAAC,QAAQ,GAAM,CAAC,EAAK,YAAY,SAAS,eAAe,EAAK,aAAa,EAAE,CAAC,CAAE,CAAC,EAAE,EAAK,UAAU,CAAE,CAAC,SAAS,EAAmB,EAAK,CAAC,EAAqB,CAAI,EAAE,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