{"version":3,"file":"PlaySound.B14F-XQ2.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/gObfUobRt3gH3Sj14r4e/xJImrJOZv4akFB0Z9Ice/PlaySound.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState}from\"react\";const soundUrls={click:\"https://avara.xyz/sounds/click.wav\",error:\"https://avara.xyz/sounds/error.wav\",open:\"https://avara.xyz/sounds/open.wav\",close:\"https://avara.xyz/sounds/close.wav\",forward:\"https://avara.xyz/sounds/forward.wav\",back:\"https://avara.xyz/sounds/back.wav\"};// ✅ Safe hook: only creates Audio in the browser\nfunction useSound(url){const[audio,setAudio]=useState(null);const audioRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const el=new Audio(url);audioRef.current=el;setAudio(el);return()=>{el.pause();el.src=\"\";};},[url]);return audio;}// ✅ Safe touch check (won’t crash on server)\nfunction isTouchDevice(){if(typeof window===\"undefined\")return false;return\"ontouchstart\"in window;}export function withError(Component){return props=>{const clickSound=useSound(soundUrls.click);const errorSound=useSound(soundUrls.error);const handleStart=()=>clickSound?.play();const handleEnd=()=>errorSound?.play();const events=isTouchDevice()?{onTouchStart:handleStart,onTouchEnd:handleEnd}:{onMouseDown:handleStart,onMouseUp:handleEnd};return /*#__PURE__*/_jsx(Component,{...props,...events});};}export function withFigure(Component){return props=>{const clickSound=useSound(soundUrls.click);const openSound=useSound(soundUrls.open);const handleStart=()=>clickSound?.play();const handleEnd=()=>openSound?.play();const events=isTouchDevice()?{onTouchStart:handleStart,onTouchEnd:handleEnd}:{onMouseDown:handleStart,onMouseUp:handleEnd};return /*#__PURE__*/_jsx(Component,{...props,...events});};}export function withLeave(Component){return props=>{const closeSound=useSound(soundUrls.close);const handleEnd=()=>closeSound?.play();const events=isTouchDevice()?{onTouchEnd:handleEnd}:{onMouseUp:handleEnd};return /*#__PURE__*/_jsx(Component,{...props,...events});};}export function withForward(Component){return props=>{const forwardSound=useSound(soundUrls.forward);const handleEnd=()=>forwardSound?.play();const events=isTouchDevice()?{onTouchEnd:handleEnd}:{onMouseUp:handleEnd};return /*#__PURE__*/_jsx(Component,{...props,...events});};}export function withBack(Component){return props=>{const backSound=useSound(soundUrls.back);const handleEnd=()=>backSound?.play();const events=isTouchDevice()?{onTouchEnd:handleEnd}:{onMouseUp:handleEnd};return /*#__PURE__*/_jsx(Component,{...props,...events});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withError\":{\"type\":\"reactHoc\",\"name\":\"withError\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBack\":{\"type\":\"reactHoc\",\"name\":\"withBack\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFigure\":{\"type\":\"reactHoc\",\"name\":\"withFigure\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withForward\":{\"type\":\"reactHoc\",\"name\":\"withForward\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLeave\":{\"type\":\"reactHoc\",\"name\":\"withLeave\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PlaySound.map"],"mappings":"8IACA,SAAS,EAAS,EAAI,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,KAAK,CAAO,EAASC,EAAO,KAAK,CAA0J,OAAzJ,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAG,IAAI,MAAM,EAAI,CAAkC,MAAjC,GAAS,QAAQ,EAAG,EAAS,EAAG,KAAW,CAAC,EAAG,OAAO,CAAC,EAAG,IAAI,KAAO,CAAC,EAAI,CAAC,CAAQ,EACxP,SAAS,GAAe,CAA6C,OAAlC,IAAS,OAAmB,GAAY,iBAAiB,EAAQ,SAAgB,EAAU,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAW,EAAS,EAAU,MAAM,CAAO,EAAW,EAAS,EAAU,MAAM,CAAO,MAAgB,GAAY,MAAM,CAAO,MAAc,GAAY,MAAM,CAAO,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