{"version":3,"file":"SoundSidebar.Da7f2X_-.mjs","names":["React.useState","React.Fragment","_Fragment","__esmMin","init_ssg_sandbox_shims","x","_e","init_jsx_runtime","c","p","init_npm_react_18_3_1","ce","window","motion","AnimatePresence","init_framer_motion_DhsWWWsN","init_framer_BWFVvmND","addPropertyControls","ControlType","SoundSidebar","props","activeIndex","setActiveIndex","hoveredIndex","setHoveredIndex","isVisible","setIsVisible","showOnScroll","ROW_HEIGHT","normalizeId","id","playSound","soundFile","audio","handleScroll","passedTop","scrollThreshold","distFromBottom","hitBottomOffset","hideNearBottom","bottomThreshold","footerVisible","footerId","footerEl","currentActive","i","sections","el","centerInViewport","leftOffset","isActive","idx","isHovered","section","activeColor","inactiveColor","l","init_SoundSidebar"],"sources":["https:/framerusercontent.com/modules/KtQkr2ekdXfJykVwO5ld/QUAvY1Ak6gAQhXxY0FEf/SoundSidebar.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{motion,AnimatePresence}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export default function SoundSidebar(props){const{sections,activeColor,inactiveColor,soundFile,showOnScroll,scrollThreshold,hideNearBottom,bottomThreshold,footerId,centerInViewport,leftOffset}=props;const[activeIndex,setActiveIndex]=React.useState(0);const[hoveredIndex,setHoveredIndex]=React.useState(null);const[isVisible,setIsVisible]=React.useState(!showOnScroll);const ROW_HEIGHT=\"20px\";const normalizeId=id=>(id??\"\").toLowerCase().replace(/\\s+/g,\"-\").trim();const playSound=()=>{if(!soundFile)return;const audio=new Audio(soundFile);audio.volume=.3;audio.play().catch(()=>{});};React.useEffect(()=>{const handleScroll=()=>{// 1. Top Check (Passed top threshold)\nconst passedTop=!showOnScroll||window.scrollY>scrollThreshold;// 2. Bottom Check (Distance from bottom of page with extra 80px buffer)\nconst distFromBottom=document.documentElement.scrollHeight-(window.scrollY+window.innerHeight);const hitBottomOffset=hideNearBottom&&distFromBottom<bottomThreshold;// 3. Footer Element Check (Triggers 80px before footer enters screen)\nlet footerVisible=false;if(hideNearBottom&&footerId){const footerEl=document.getElementById(normalizeId(footerId));if(footerEl){const rect=footerEl.getBoundingClientRect();if(rect.top<=window.innerHeight+80){footerVisible=true;}}}// Visible only between top threshold and bottom footer\nconst shouldBeVisible=passedTop&&!hitBottomOffset&&!footerVisible;setIsVisible(shouldBeVisible);// Active section detection: triggers at the exact center of the viewport (innerHeight / 2)\nlet currentActive=activeIndex;for(let i=sections.length-1;i>=0;i--){const el=document.getElementById(normalizeId(sections[i].scrollID||sections[i].id));if(el){const rect=el.getBoundingClientRect();if(rect.top<=window.innerHeight/2){currentActive=i;break;}}}if(currentActive!==activeIndex){setActiveIndex(currentActive);}};window.addEventListener(\"scroll\",handleScroll,{passive:true});handleScroll();return()=>window.removeEventListener(\"scroll\",handleScroll);},[activeIndex,sections,showOnScroll,scrollThreshold,hideNearBottom,bottomThreshold,footerId]);return /*#__PURE__*/_jsx(\"div\",{style:{position:centerInViewport?\"fixed\":\"relative\",top:centerInViewport?\"50%\":\"auto\",transform:centerInViewport?\"translateY(-50%)\":\"none\",left:centerInViewport?`${leftOffset}px`:\"auto\",zIndex:90,display:\"flex\",flexDirection:\"column\",alignItems:\"flex-start\",pointerEvents:isVisible?\"auto\":\"none\"},children:/*#__PURE__*/_jsx(AnimatePresence,{children:isVisible&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,x:-12},animate:{opacity:1,x:0},exit:{opacity:0,x:-12},transition:{duration:.3,ease:\"easeOut\"},style:{display:\"flex\",flexDirection:\"column\",gap:\"0px\",alignItems:\"flex-start\",position:\"relative\",width:\"100%\"},onMouseLeave:()=>setHoveredIndex(null),children:sections.map((section,idx)=>{const isActive=idx===activeIndex;const isHovered=idx===hoveredIndex;return /*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsxs(\"div\",{onClick:()=>{const el=document.getElementById(normalizeId(section.scrollID||section.id));if(el)el.scrollIntoView({behavior:\"smooth\"});},onMouseEnter:()=>{if(hoveredIndex!==idx)playSound();setHoveredIndex(idx);},style:{display:\"flex\",alignItems:\"center\",cursor:\"pointer\",height:ROW_HEIGHT},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"24px\",height:\"100%\",display:\"flex\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(motion.div,{initial:{width:isActive?\"24px\":\"16px\",backgroundColor:isActive?activeColor:inactiveColor},animate:{width:isActive||isHovered?\"24px\":\"16px\",backgroundColor:isActive||isHovered?activeColor:inactiveColor},transition:{duration:.2,ease:\"easeOut\"},style:{height:\"1.5px\"}})}),/*#__PURE__*/_jsx(motion.span,{initial:{color:isActive?activeColor:inactiveColor},animate:{color:isActive||isHovered?activeColor:inactiveColor,fontWeight:isActive?600:400},transition:{duration:.2},style:{marginLeft:\"12px\",fontFamily:'\"DM Sans\", sans-serif',fontSize:\"16px\",whiteSpace:\"nowrap\"},children:section.title})]}),idx<sections.length-1&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{height:ROW_HEIGHT,display:\"flex\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"24px\",display:\"flex\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"10px\",height:\"1.5px\",backgroundColor:inactiveColor}})})}),/*#__PURE__*/_jsx(\"div\",{style:{height:ROW_HEIGHT,display:\"flex\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"24px\",display:\"flex\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"10px\",height:\"1.5px\",backgroundColor:inactiveColor}})})})]})]},idx);})})})});}SoundSidebar.defaultProps={activeColor:\"#000000\",inactiveColor:\"#A3A3A3\",sections:[{title:\"Overview\",id:\"overview\"},{title:\"Problem\",id:\"problem\"},{title:\"Decision 1\",id:\"decision-1\"},{title:\"Decision 2\",id:\"decision-2\"},{title:\"Decision 3\",id:\"decision-3\"},{title:\"Outcome\",id:\"outcome\"},{title:\"Learnings\",id:\"learnings\"}],showOnScroll:true,scrollThreshold:1310,hideNearBottom:true,bottomThreshold:530,footerId:\"footer\",centerInViewport:true,leftOffset:48};addPropertyControls(SoundSidebar,{sections:{type:ControlType.Array,title:\"Sections\",control:{type:ControlType.Object,controls:{title:{type:ControlType.String,title:\"Title\"},id:{type:ControlType.String,title:\"Scroll ID\"}}}},soundFile:{type:ControlType.File,title:\"Hover Sound\",allowedFileTypes:[\"audio/*\"]},activeColor:{type:ControlType.Color,title:\"Active Color\"},inactiveColor:{type:ControlType.Color,title:\"Inactive Color\"},centerInViewport:{type:ControlType.Boolean,title:\"Center Vertically\",defaultValue:true},leftOffset:{type:ControlType.Number,title:\"Left Position (px)\",min:10,max:300,defaultValue:48,hidden(props){return!props.centerInViewport;}},showOnScroll:{type:ControlType.Boolean,title:\"Show on Scroll\"},scrollThreshold:{type:ControlType.Number,title:\"Top Trigger\",min:0,max:3e3,hidden(props){return!props.showOnScroll;}},hideNearBottom:{type:ControlType.Boolean,title:\"Hide At Footer\",defaultValue:true},bottomThreshold:{type:ControlType.Number,title:\"Bottom Offset (px)\",min:100,max:2e3,defaultValue:530,hidden(props){return!props.hideNearBottom;}},footerId:{type:ControlType.String,title:\"Footer Scroll ID\",defaultValue:\"footer\",hidden(props){return!props.hideNearBottom;}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SoundSidebar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SoundSidebar.map"],"mappings":"A,4QAAiN,SAAwBmB,EAAa,EAAM,CAAC,GAAK,CAAC,WAAS,cAAY,gBAAc,YAAU,eAAa,kBAAgB,iBAAe,kBAAgB,WAAS,mBAAiB,cAAYC,EAAW,CAACC,EAAYC,GAAgBtB,EAAe,CAAC,EAAO,CAACuB,EAAaC,GAAiBxB,E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