{"version":3,"file":"PersistentMusicControl.CXKQFABY.mjs","names":["React.useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/wMiSszmMftbANm4Z82sH/vvKBxTZFYfjHs0u8WbTF/Circularbackbutton.js","https:/framerusercontent.com/modules/ogNaV3EPZDlkjvfymfM7/7EcgFCpOaHI01MBsa3s3/PersistentMusicControl.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{pauseInvitationMusicForNavigation}from\"https://framerusercontent.com/modules/Z5J6Y7FSzykbDb8WVk35/2bofZU3Z17DFgvs3lf6P/InvitationMusicEngine.js\";/** A viewport-fixed circular back button. */export default function CircularBackButton(props){const{link,buttonColor,iconColor,size,top,left,shadow,ariaLabel}=props;const goToDestination=()=>{pauseInvitationMusicForNavigation();if(window.history.length>1)window.history.back();else if(link?.trim())window.location.assign(link);};return /*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":ariaLabel,title:ariaLabel,onClick:goToDestination,style:{position:\"fixed\",top,left,width:size,height:size,border:\"none\",borderRadius:\"50%\",background:buttonColor,color:iconColor,display:\"grid\",placeItems:\"center\",padding:0,cursor:\"pointer\",zIndex:9999,boxShadow:shadow,WebkitTapHighlightColor:\"transparent\"},children:/*#__PURE__*/_jsx(\"svg\",{width:Math.round(size*.44),height:Math.round(size*.44),viewBox:\"0 0 24 24\",fill:\"none\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M19 12H5M11 18l-6-6 6-6\",stroke:\"currentColor\",strokeWidth:\"2.4\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})});}CircularBackButton.defaultProps={link:\"\",buttonColor:\"#111111\",iconColor:\"#FFFFFF\",size:48,top:20,left:20,shadow:\"0 8px 24px rgba(0, 0, 0, 0.18)\",ariaLabel:\"Go back\"};addPropertyControls(CircularBackButton,{link:{type:ControlType.Link,title:\"Link to\",defaultValue:\"\"},buttonColor:{type:ControlType.Color,title:\"Button\",defaultValue:\"#111111\"},iconColor:{type:ControlType.Color,title:\"Icon\",defaultValue:\"#FFFFFF\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:48,min:32,max:120,step:1,unit:\"px\"},top:{type:ControlType.Number,title:\"Top offset\",defaultValue:20,min:0,max:200,step:1,unit:\"px\"},left:{type:ControlType.Number,title:\"Left offset\",defaultValue:20,min:0,max:200,step:1,unit:\"px\"},shadow:{type:ControlType.String,title:\"Shadow\",defaultValue:\"0 8px 24px rgba(0, 0, 0, 0.18)\"},ariaLabel:{type:ControlType.String,title:\"Accessibility\",defaultValue:\"Go back\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CircularBackButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{getCurrentInvitationAudio,getInvitationAudio,playInvitationAudio,readInvitationMusic,saveInvitationMusic,setInvitationMusicMuted}from\"https://framerusercontent.com/modules/Z5J6Y7FSzykbDb8WVk35/2bofZU3Z17DFgvs3lf6P/InvitationMusicEngine.js\";/**\n * Place this only on invitation subpages. It controls the exact same global\n * audio element created by EnvelopeReveal and never creates a second player\n * while that player exists.\n */export default function PersistentMusicControl(props){const{background,iconColor,size,rightOffset,bottomOffset,style}=props;const[audio,setAudio]=React.useState(null);const[isMuted,setIsMuted]=React.useState(false);React.useEffect(()=>{const initialSaved=readInvitationMusic();if(!initialSaved?.source||!initialSaved.shouldPlay)return;let saved=initialSaved;const media=getInvitationAudio(saved.source);const intendedVolume=saved.volume>0?saved.volume:.3;media.volume=intendedVolume;media.muted=saved.muted;let disposed=false;let retryArmed=false;let playPending=false;let timeRestored=!media.paused;// This controller has no \"stop music\" action. A temporary pause only\n// hands playback to the next/previous page, so never save it as an\n// instruction to stop. Otherwise React cleanup can overwrite the\n// navigation handoff with shouldPlay:false after media.pause().\nconst persist=()=>{// A newly created audio element can emit timeupdate at 0 before its\n// saved seek is restored. Never let that event erase the previous\n// page's valid position.\nif(!timeRestored&&saved.currentTime>0&&media.currentTime<.05)return;saveInvitationMusic(media,true,intendedVolume);};const removeRetry=()=>{if(!retryArmed)return;retryArmed=false;document.removeEventListener(\"pointerup\",retry,true);document.removeEventListener(\"touchend\",retry,true);};const armRetry=()=>{if(retryArmed||disposed)return;retryArmed=true;document.addEventListener(\"pointerup\",retry,{once:true,passive:true,capture:true});document.addEventListener(\"touchend\",retry,{once:true,passive:true,capture:true});};const restoreAndPlay=()=>{if(disposed||playPending||!media.paused)return;// Android must know the duration before accepting a restored seek.\nif(media.readyState===HTMLMediaElement.HAVE_NOTHING){media.load();return;}if(!timeRestored){if(saved.currentTime>0&&Number.isFinite(saved.currentTime)){try{const elapsed=saved.updatedAt?Math.max(0,(Date.now()-saved.updatedAt)/1e3):0;const continuousTime=saved.currentTime+elapsed;media.currentTime=Number.isFinite(media.duration)&&media.duration>0?continuousTime%media.duration:continuousTime;}catch{return;}}timeRestored=true;}playPending=true;playInvitationAudio(media).then(()=>{playPending=false;if(disposed)return;removeRetry();persist();}).catch(()=>{playPending=false;armRetry();});};function retry(){removeRetry();restoreAndPlay();}const handlePageHide=()=>{persist();media.pause();};const handlePageShow=()=>{const latest=readInvitationMusic();if(latest?.source===saved.source&&latest.shouldPlay){saved=latest;timeRestored=false;media.volume=latest.volume>0?latest.volume:intendedVolume;media.muted=latest.muted;}setIsMuted(media.muted);restoreAndPlay();};const handleVisibility=()=>{if(document.visibilityState===\"visible\")restoreAndPlay();else handlePageHide();};media.addEventListener(\"loadedmetadata\",restoreAndPlay);media.addEventListener(\"canplay\",restoreAndPlay);media.addEventListener(\"timeupdate\",persist);window.addEventListener(\"pagehide\",handlePageHide);window.addEventListener(\"pageshow\",handlePageShow);document.addEventListener(\"visibilitychange\",handleVisibility);setAudio(media);setIsMuted(media.muted);restoreAndPlay();return()=>{disposed=true;persist();removeRetry();media.removeEventListener(\"loadedmetadata\",restoreAndPlay);media.removeEventListener(\"canplay\",restoreAndPlay);media.removeEventListener(\"timeupdate\",persist);window.removeEventListener(\"pagehide\",handlePageHide);window.removeEventListener(\"pageshow\",handlePageShow);document.removeEventListener(\"visibilitychange\",handleVisibility);};},[]);if(!audio)return null;const toggleMute=()=>{const current=getCurrentInvitationAudio()??audio;const nextMuted=!current.muted;setInvitationMusicMuted(nextMuted);setIsMuted(nextMuted);saveInvitationMusic(current,true,current.volume);};return /*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:toggleMute,\"aria-label\":isMuted?\"Unmute background music\":\"Mute background music\",style:{...style,position:\"fixed\",right:rightOffset,bottom:bottomOffset,zIndex:9998,width:size,height:size,display:\"grid\",placeItems:\"center\",border:\"1px solid rgba(255,255,255,0.5)\",borderRadius:\"50%\",padding:0,background,color:iconColor,cursor:\"pointer\",lineHeight:1,backdropFilter:\"blur(8px)\",WebkitBackdropFilter:\"blur(8px)\"},children:/*#__PURE__*/_jsxs(\"svg\",{viewBox:\"0 0 24 24\",width:size*.48,height:size*.48,fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M11 5 6 9H2v6h4l5 4z\"}),isMuted?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"path\",{d:\"m23 9-6 6\"}),/*#__PURE__*/_jsx(\"path\",{d:\"m17 9 6 6\"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"path\",{d:\"M15.5 8.5a5 5 0 0 1 0 7\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M19 5a10 10 0 0 1 0 14\"})]})]})});}PersistentMusicControl.defaultProps={background:\"rgba(22, 16, 11, 0.7)\",iconColor:\"#FFFFFF\",size:42,rightOffset:20,bottomOffset:20};addPropertyControls(PersistentMusicControl,{background:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgba(22, 16, 11, 0.7)\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#FFFFFF\"},size:{type:ControlType.Number,title:\"Button Size\",defaultValue:42,min:28,max:96,step:1,unit:\"px\"},rightOffset:{type:ControlType.Number,title:\"Right Offset\",defaultValue:20,min:0,max:100,step:1,unit:\"px\"},bottomOffset:{type:ControlType.Number,title:\"Bottom Offset\",defaultValue:20,min:0,max:100,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PersistentMusicControl\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"uTAAoS,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,OAAK,cAAY,YAAU,OAAK,MAAI,OAAK,SAAO,aAAW,EAA0K,OAAoB,EAAK,SAAS,CAAC,KAAK,SAAS,aAAa,EAAU,MAAM,EAAU,YAAlO,CAAC,EAAkC,EAAK,EAAO,QAAQ,OAAO,EAAE,EAAO,QAAQ,KAAK,EAAU,GAAM,KAAK,GAAE,EAAO,SAAS,OAAO,CAAI,CAAE,EAAkH,MAAM,CAAC,SAAS,QAAQ,MAAI,OAAK,MAAM,EAAK,OAAO,EAAK,OAAO,OAAO,aAAa,MAAM,WAAW,EAAY,MAAM,EAAU,QAAQ,OAAO,WAAW,SAAS,QAAQ,EAAE,OAAO,UAAU,OAAO,KAAK,UAAU,EAAO,wBAAwB,aAAa,EAAE,SAAsB,EAAK,MAAM,CAAC,MAAM,KAAK,MAAM,EAAK,GAAG,EAAE,OAAO,KAAK,MAAM,EAAK,GAAG,EAAE,QAAQ,YAAY,KAAK,OAAO,cAAc,OAAO,SAAsB,EAAK,OAAO,CAAC,EAAE,0BAA0B,OAAO,eAAe,YAAY,MAAM,cAAc,QAAQ,eAAe,OAAO,CAA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