{"version":3,"file":"shared-lib.DLtjV7xT.mjs","names":["useState","useRef","useCallback","useMemo","metadata","siteMetadata","metadataVersion","__FramerMetadata__","metadata","siteMetadata"],"sources":["https:/framerusercontent.com/modules/563Ku4S7x1UaLhvMXxQc/S308pZDgXq4bgiilz6JY/ScrollFadeTextBox.js","https:/framerusercontent.com/modules/5nZ7IKB9OSkwTQu1c41R/1zfqVHFBgG1nXvJpfrHx/siteMetadata.js","https:/framerusercontent.com/modules/ushiW1ygtopqxM5bxY3s/WkNEfdYLVICZ1CHDSpX4/augiA20Il.js","https:/framerusercontent.com/modules/yPCQE876TNANbTdS4p68/V3dMSKCCN4G1Jus5uBOL/iyHWOcBWV.js"],"sourcesContent":["// Text box element that can be fixed on the page, fades out on scroll down, fades in on scroll up, and always shows at top/bottom.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,useIsStaticRenderer}from\"framer\";import{motion,useReducedMotion}from\"framer-motion\";import{startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";/**\n * @framerIntrinsicWidth 320\n * @framerIntrinsicHeight 64\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ScrollFadeTextBox(props){const{text,font,backgroundColor,textColor,borderRadius,padding,shadow,border,hiddenOpacity,fadeDuration,fadeEase,atEdgesOpacity,edgeTolerance,contentAlign,debug,style}=props;const isStatic=useIsStaticRenderer();const reduceMotion=useReducedMotion();const[opacity,setOpacity]=useState(1);const lastYRef=useRef(0);const rafRef=useRef(null);const getScrollMetrics=useCallback(()=>{const scrollingEl=document.scrollingElement;const y=window.scrollY??window.pageYOffset??scrollingEl?.scrollTop??document.documentElement?.scrollTop??document.body?.scrollTop??0;const doc=document.documentElement;const body=document.body;const docHeight=scrollingEl?.scrollHeight??Math.max(doc?.scrollHeight||0,doc?.offsetHeight||0,body?.scrollHeight||0,body?.offsetHeight||0);const viewport=scrollingEl?.clientHeight??window.innerHeight??0;const maxScrollY=Math.max(0,docHeight-viewport);return{y,maxScrollY,viewport,docHeight};},[]);const computeNextOpacity=useCallback(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return 1;const{y,maxScrollY}=getScrollMetrics();const lastY=lastYRef.current;const atTop=y<=edgeTolerance;const atBottom=y>=Math.max(0,maxScrollY-edgeTolerance);lastYRef.current=y;if(atTop||atBottom)return 1;const delta=y-lastY;if(Math.abs(delta)<1)return null// ignore tiny changes\n;const scrollingDown=delta>0;return scrollingDown?hiddenOpacity:1;},[edgeTolerance,getScrollMetrics,hiddenOpacity]);const scheduleUpdate=useCallback(()=>{if(rafRef.current!=null)return;rafRef.current=window.requestAnimationFrame(()=>{rafRef.current=null;const next=computeNextOpacity();if(next==null)return;startTransition(()=>setOpacity(next));});},[computeNextOpacity]);useEffect(()=>{if(isStatic)return;if(typeof window===\"undefined\"||typeof document===\"undefined\")return;lastYRef.current=getScrollMetrics().y;const onScroll=()=>scheduleUpdate();// Window scroll (most cases)\nwindow.addEventListener(\"scroll\",onScroll,{passive:true});// Capture scroll events from nested scroll containers (common in editors/embeds)\ndocument.addEventListener(\"scroll\",onScroll,{passive:true,capture:true});// Ensure correct initial state (top/bottom)\nscheduleUpdate();return()=>{window.removeEventListener(\"scroll\",onScroll);document.removeEventListener(\"scroll\",onScroll,{capture:true});if(rafRef.current!=null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}};},[getScrollMetrics,isStatic,scheduleUpdate]);const transition=useMemo(()=>{if(reduceMotion)return{duration:0};// Use cubic-bezier arrays to satisfy framer-motion's `Easing` type.\n// linear:     [0, 0, 1, 1]\n// easeInOut:  [0.42, 0, 0.58, 1]\n// easeOut:    [0, 0, 0.58, 1]\nconst ease=fadeEase===\"linear\"?[0,0,1,1]:fadeEase===\"easeInOut\"?[.42,0,.58,1]:[0,0,.58,1];return{duration:Math.max(0,fadeDuration),ease};},[fadeDuration,fadeEase,reduceMotion]);const isFramerThumbnail=RenderTarget.current()===RenderTarget.thumbnail;const displayOpacity=isStatic||isFramerThumbnail?1:opacity;return /*#__PURE__*/_jsxs(motion.div,{style:{position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxSizing:\"border-box\",...style},animate:{opacity:displayOpacity},transition:transition,children:[/*#__PURE__*/_jsx(\"div\",{role:\"note\",\"aria-label\":\"Scroll fade text box\",style:{width:\"100%\",height:\"100%\",boxSizing:\"border-box\",display:\"flex\",flexDirection:\"column\",alignItems:\"stretch\",justifyContent:contentAlign===\"top\"?\"flex-start\":contentAlign===\"bottom\"?\"flex-end\":\"center\",padding,background:backgroundColor,color:textColor,borderRadius,boxShadow:shadow,...border?.borderWidth!=null||border?.borderColor!=null||border?.borderStyle!=null?{borderStyle:border?.borderStyle??\"solid\",borderColor:border?.borderColor??\"rgba(0,0,0,0.12)\",borderWidth:border?.borderWidth??1}:{},...font},children:/*#__PURE__*/_jsx(\"span\",{style:{width:\"100%\",minWidth:0,whiteSpace:\"pre-wrap\",overflowWrap:\"anywhere\",textAlign:font?.textAlign??\"center\",lineHeight:font?.lineHeight,letterSpacing:font?.letterSpacing},children:text})}),debug&&!isStatic&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",left:8,bottom:8,fontSize:10,fontFamily:\"monospace\",padding:\"4px 6px\",borderRadius:6,background:\"rgba(0,0,0,0.6)\",color:\"white\",pointerEvents:\"none\"},children:[\"opacity: \",Math.round(displayOpacity*100)/100]})]});}addPropertyControls(ScrollFadeTextBox,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"I fade out on scroll down and fade in on scroll up.\",displayTextArea:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\",textAlign:\"center\"}},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},border:{type:ControlType.Border,title:\"Border\",defaultValue:{borderWidth:1,borderStyle:\"solid\",borderColor:\"rgba(0,0,0,0.10)\"},optional:true},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"12px\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"14px\"},shadow:{type:ControlType.BoxShadow,title:\"Shadow\"},hiddenOpacity:{type:ControlType.Number,title:\"Hidden Opacity\",defaultValue:0,min:0,max:1,step:.01},atEdgesOpacity:{type:ControlType.Number,title:\"Edge Opacity\",defaultValue:1,min:0,max:1,step:.01},edgeTolerance:{type:ControlType.Number,title:\"Edge Tolerance\",defaultValue:2,min:0,max:48,step:1,unit:\"px\"},contentAlign:{type:ControlType.Enum,title:\"Content Align\",options:[\"top\",\"center\",\"bottom\"],optionTitles:[\"Top\",\"Center\",\"Bottom\"],defaultValue:\"center\",displaySegmentedControl:true},fadeDuration:{type:ControlType.Number,title:\"Fade Duration\",defaultValue:.25,min:0,max:2,step:.01,unit:\"s\"},fadeEase:{type:ControlType.Enum,title:\"Fade Ease\",options:[\"easeOut\",\"easeInOut\",\"linear\"],optionTitles:[\"Ease Out\",\"Ease In Out\",\"Linear\"],defaultValue:\"easeOut\",displaySegmentedControl:true},debug:{type:ControlType.Boolean,title:\"Debug\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollFadeTextBox\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"64\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"320\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollFadeTextBox.map","// Generated by Framer (18229b5)\nexport default function metadata(params,activeLocale){return{description:\"2k2 | Design Studio\",favicon:\"https://framerusercontent.com/assets/Thx6euAr3sifB9zmAt9Zsp84g.svg\",robots:\"max-image-preview:large\",title:\"2k2\"};}export const metadataVersion=1;\nexport const __FramerMetadata__ = {\"exports\":{\"metadataVersion\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// Generated by Framer (a1faaee)\nimport siteMetadata from\"#framer/local/siteMetadata/siteMetadata/siteMetadata.js\";export default function metadata(params,activeLocale){return{breakpoints:[{hash:\"72rtr7\"}],description:siteMetadata(params,activeLocale).description,elements:{},robots:\"max-image-preview:large\",serializationId:\"framer-JW7C0\",title:siteMetadata(params,activeLocale).title||\"Home\",viewport:\"width=1920\"};}export const metadataVersion=1;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"metadataVersion\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// Generated by Framer (a1faaee)\nimport siteMetadata from\"#framer/local/siteMetadata/siteMetadata/siteMetadata.js\";export default function metadata(params,activeLocale){return{breakpoints:[{hash:\"1idpl72\"}],description:siteMetadata(params,activeLocale).description,elements:{},robots:\"max-image-preview:large\",serializationId:\"framer-319AZ\",title:siteMetadata(params,activeLocale).title||\"Humanintelligence\",viewport:\"width=1920\"};}export const metadataVersion=1;\nexport const __FramerMetadata__ = {\"exports\":{\"metadataVersion\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"mSAOG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,kBAAgB,YAAU,eAAa,UAAQ,SAAO,SAAO,gBAAc,eAAa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