{"version":3,"file":"FadeInOnce.CbMosGyh.mjs","names":["__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","c","init_jsx_runtime","ce","init_framer_BWFVvmND","addPropertyControls","ControlType","FadeInOnce","props","layerName","els","timers","observers","el","r","lines","mode","p","targets","io","entries","duration","delay","at","i","lineFade","finalPause","lineHold","o","t","init_FadeInOnce"],"sources":["https:/framerusercontent.com/modules/aZtaOEmmkEJ0mno3RXx2/ZU4VI108WOx3mlV2PKBv/FadeInOnce.js"],"sourcesContent":["// FadeInOnce — a quiet, once-only opacity fade for a named canvas layer\n// (first used 2026-10-23 for Encounter's closing question, layer\n// \"Closing question\").\n// - Scripts hide the layer only if it is still below the window when the\n//   page starts; it then fades in once (after `delay`, over `duration`) when\n//   it is comfortably inside the window (its top above ~80% of the window\n//   height). It stays visible afterwards. No movement, no extra scroll space.\n// - Reduced motion, no scripting, or the layer already in view at load: the\n//   text is simply shown (nothing is hidden). Opacity never removes the text\n//   from the accessibility tree.\n// Mode \"lines\" (2026-10-23, Participation's four-sentence passage): each line\n// (paragraph block) of the layer fades in in turn — `lineFade` per line,\n// `lineHold` reading time before the next, and `finalPause` before the last\n// line (counted from when the previous line has fully appeared). Earlier lines\n// stay; heights are reserved from the start (opacity only).\n// Renders only an empty hidden element; place it anywhere (absolute, 1×1).\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function FadeInOnce(props){const{layerName=\"Closing question\",delay=300,duration=800,mode=\"whole\",lineFade=600,lineHold=700,finalPause=1e3}=props;useEffect(()=>{if(!layerName||typeof window===\"undefined\")return;if(window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;const els=Array.from(document.querySelectorAll(\"[data-framer-name]\")).filter(e=>e.getAttribute(\"data-framer-name\")===layerName);const timers=[];const observers=[];for(const el of els){const r=el.getBoundingClientRect();if(!r.width&&!r.height)continue;// other breakpoints' copies\nif(r.top<window.innerHeight*.8)continue;// already in view: leave it shown\nconst lines=mode===\"lines\"?Array.from(el.querySelectorAll(\"p\")).filter(p=>p.textContent?.trim()):[];const targets=lines.length>1?lines:[el];targets.forEach(t=>t.style.opacity=\"0\");const io=new IntersectionObserver(entries=>{if(!entries.some(e=>e.isIntersecting))return;io.disconnect();if(targets.length===1){timers.push(window.setTimeout(()=>{el.style.transition=`opacity ${duration}ms ease`;el.style.opacity=\"1\";},delay));return;}let at=delay;targets.forEach((t,i)=>{if(i>0)at+=lineFade+(i===targets.length-1?finalPause:lineHold);timers.push(window.setTimeout(()=>{t.style.transition=`opacity ${lineFade}ms ease`;t.style.opacity=\"1\";},at));});},{rootMargin:\"0px 0px -20% 0px\",threshold:0});io.observe(el);observers.push(io);}return()=>{observers.forEach(o=>o.disconnect());timers.forEach(t=>window.clearTimeout(t));};},[layerName,delay,duration,mode,lineFade,lineHold,finalPause]);return /*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{display:\"none\"}});}addPropertyControls(FadeInOnce,{layerName:{type:ControlType.String,title:\"Layer name\",defaultValue:\"Closing question\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:300,min:0,max:3e3,step:50,unit:\"ms\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:800,min:100,max:4e3,step:50,unit:\"ms\"},mode:{type:ControlType.Enum,title:\"Mode\",options:[\"whole\",\"lines\"],optionTitles:[\"Whole passage\",\"Line by line\"],defaultValue:\"whole\"},lineFade:{type:ControlType.Number,title:\"Line Fade\",defaultValue:600,min:100,max:3e3,step:50,unit:\"ms\",hidden:p=>p.mode!==\"lines\"},lineHold:{type:ControlType.Number,title:\"Line Hold\",defaultValue:700,min:0,max:5e3,step:50,unit:\"ms\",hidden:p=>p.mode!==\"lines\"},finalPause:{type:ControlType.Number,title:\"Final Pause\",defaultValue:1e3,min:0,max:5e3,step:50,unit:\"ms\",hidden:p=>p.mode!==\"lines\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FadeInOnce\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FadeInOnce.map"],"mappings":"A,wLAmBG,SAAwBU,EAAW,EAAM,CAAC,GAAK,CAAC,YAAU,mBAAmB,QAAM,IAAI,WAAS,IAAI,OAAK,QAAQ,WAAS,IAAI,WAAS,IAAI,aAAW,KAAKC,EAEotB,OAF9sBL,MAAc,CAAmD,GAA/C,CAACM,GAAkBT,IAAS,QAAsBA,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAQ,OAAO,IAAMU,EAAI,MAAM,KAAK,SAAS,iBAAiB,oBAAoB,CAAC,CAAC,CAAC,OAAO,GAAG,EAAE,aAAa,kBAAkB,IAAID,CAAS,EAAQE,EAAO,CAAC,EAAQC,EAAU,CAAC,EAAE,IAAI,IAAMC,KAAMH,EAAI,CAAC,IAAMI,EAAED,EAAG,sBAAsB,EACtgB,GAD2gB,CAACC,EAAE,OAAO,CAACA,EAAE,QACrhBA,EAAE,IAAId,EAAO,YAAY,GAAG,SAC/B,IAAMe,EAAMC,IAAO,QAAQ,MAAM,KAAKH,EAAG,iBAAiB,GAAG,CAAC,CAAC,CAAC,OAAO,GAAGI,EAAE,aAAa,KAAK,CAAC,EAAE,CAAC,EAAQC,EAAQH,EAAM,OAAO,EAAEA,EAAM,CAACF,CAAE,EAAEK,EAAQ,QAAQ,GAAG,EAAE,MAAM,QAAQ,GAAG,EAAE,IAAMC,EAAG,IAAI,qBAAqB,GAAS,CAAC,GAAG,CAACC,EAAQ,KAAK,GAAG,EAAE,cAAc,EAAE,OAAuB,GAAhBD,EAAG,WAAW,EAAKD,EAAQ,SAAS,EAAE,CAACP,EAAO,KAAKX,EAAO,eAAe,CAAC,EAAG,MAAM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