{"version":3,"file":"Text_Masking.-knybnNy.mjs","names":["React.forwardRef","React.useId","React.useLayoutEffect","_jsx","__esmMin","ie","le","init_ssg_sandbox_shims","window","c","J","init_npm_react_18_3_1","unwrapGeneratedWords","root","WORD_ATTRIBUTE","word","splitTextIntoWords","walker","textNodes","currentNode","textNode","parent","blockedTag","isInsideFitText","isNativeSvgText","words","fragment","part","HIDDEN_CLIP","installMask","triggerElement","replay","animations","hasPlayed","frame","runId","previousScrollY","previousCenter","wasHidden","playScrollY","furthestScrollY","canReplay","DESKTOP_MIN_WIDTH","revealImmediately","VISIBLE_CLIP","reset","animation","play","currentRun","currentScrollY","index","DURATION","START_DELAY","WORD_STAGGER","EASING","checkPosition","replayAllowed","bounds","center","scrollY","direction","queuePositionCheck","isEffectivelyHidden","element","depth","style","visibilityObserver","hidden","observedParent","parentDepth","createTextMask","Component","props","forwardedRef","maskId","desktop","removeMask","retryFrame","attempts","connect","syncBreakpoint","withGlyphicTextMask","withGlyphicTextMaskReplay","init_Text_Masking","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/gNI41JrxhFp1XOIOZtNA/ufYl1jBNA5lY49ZNnQTn/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\";// Framer page breakpoints: Phone < 810, Tablet < 1200, Desktop >= 1200.\nconst DESKTOP_MIN_WIDTH=1200;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;// Only desktop is eligible for replay.\nconst canReplay=()=>replay&&window.innerWidth>=DESKTOP_MIN_WIDTH;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;const replayAllowed=canReplay();if(hasPlayed&&!replayAllowed)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(replayAllowed&&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(replayAllowed&&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();const replayAllowed=canReplay();if(hidden){wasHidden=true;if(replayAllowed&&hasPlayed)reset();return;}if(wasHidden){wasHidden=false;if(replayAllowed)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(()=>{const desktop=window.matchMedia(`(min-width: ${DESKTOP_MIN_WIDTH}px)`);let removeMask=()=>{};let retryFrame=0;let attempts=0;const connect=()=>{// Leave the native text untouched on tablet and mobile.\nif(!desktop.matches)return;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);}};const syncBreakpoint=()=>{if(retryFrame)cancelAnimationFrame(retryFrame);retryFrame=0;// Cancels active animations and restores native text when\n// resizing from desktop to tablet/mobile.\nremoveMask();removeMask=()=>{};attempts=0;connect();};desktop.addEventListener(\"change\",syncBreakpoint);syncBreakpoint();return()=>{desktop.removeEventListener(\"change\",syncBreakpoint);if(retryFrame)cancelAnimationFrame(retryFrame);removeMask();};},[maskId]);return /*#__PURE__*/_jsx(Component,{...props,ref:forwardedRef,\"data-glyphic-mask-id\":maskId});});}/** Desktop: reveal once per mount. Tablet and mobile: native text, no mask. */export function withGlyphicTextMask(Component){return createTextMask(Component);}/** Desktop: keep replay behavior. Tablet and mobile: native text, no mask. */export function withGlyphicTextMaskReplay(Component){return createTextMask(Component,true);}\nexport const __FramerMetadata__ = {\"exports\":{\"withGlyphicTextMask\":{\"type\":\"reactHoc\",\"name\":\"withGlyphicTextMask\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGlyphicTextMaskReplay\":{\"type\":\"reactHoc\",\"name\":\"withGlyphicTextMaskReplay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Masking.map"],"mappings":"A,yIAC6B,SAASY,EAAqBC,EAAK,CAACA,EAAK,iBAAiB,IAAIC,EAAe,EAAE,CAAC,CAAC,QAAQC,GAAM,CAACA,EAAK,YAAY,SAAS,eAAeA,EAAK,aAAa,EAAE,CAAC,CAAE,CAAC,EAAEF,EAAK,UAAU,CAAE,CAAC,SAASG,EAAmBH,EAAK,CAACD,EAAqBC,CAAI,EAAE,IAAMI,EAAO,SAAS,iBAAiBJ,EAAK,WAAW,SAAS,EAAQK,EAAU,CAAC,EAAMC,EAAYF,EAAO,SAAS,EAAE,KAAME,GAAY,CAAC,IAAMC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