{"version":3,"file":"DeviceSimulator.CblvJCSZ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/LDNfz1uQj2bsVjE7zG4W/yQHiU8XyzWZAYihMh19z/DeviceSimulator.js"],"sourcesContent":["// Device simulator with video background, play/pause controls, customizable padding and bezel, notch toggle, and device size presets\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Device Simulator\n *\n * @framerIntrinsicWidth 375\n * @framerIntrinsicHeight 812\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function DeviceSimulator(props){const{videoFile=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",fallbackImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Fallback image\"},mediaMode=\"auto\",deviceSize=\"iphone\",showNotch=true,notchHeight=30,screenPaddingWidth=8,screenPaddingColor=\"#000000\",borderRadius=40,bezelWidth=12,bezelColor=\"#C0C0C0\",showControls=true,autoplay=true,style}=props;const isVideoMode=mediaMode!==\"image\";const[isPlaying,setIsPlaying]=useState(isVideoMode?autoplay:false);const[showControlsOverlay,setShowControlsOverlay]=useState(isVideoMode?!autoplay:false);const[videoError,setVideoError]=useState(false);const[isLandscape,setIsLandscape]=useState(false);const videoRef=useRef(null);const containerRef=useRef(null);const hideControlsTimeoutRef=useRef(null);const isIPhone=deviceSize===\"iphone\";const aspectRatio=isIPhone?812/375:1024/768;useEffect(()=>{if(containerRef.current){const{width,height}=containerRef.current.getBoundingClientRect();startTransition(()=>setIsLandscape(width>height));}},[style?.width,style?.height]);useEffect(()=>{if(videoRef.current&&!videoError){if(isPlaying){videoRef.current.play().catch(()=>{startTransition(()=>setVideoError(true));});}else{videoRef.current.pause();}}},[isPlaying,videoError]);useEffect(()=>{// Autoplay video on mount and show controls if autoplay is on\nif(videoRef.current&&!videoError&&autoplay){videoRef.current.play().catch(()=>{startTransition(()=>setVideoError(true));});}startTransition(()=>setShowControlsOverlay(!autoplay));},[autoplay,videoError]);useEffect(()=>{startTransition(()=>{setVideoError(false);setIsPlaying(isVideoMode?autoplay:false);setShowControlsOverlay(isVideoMode?!autoplay:false);});},[mediaMode,autoplay,isVideoMode]);const handlePlayPause=()=>{if(!isVideoMode)return;startTransition(()=>setIsPlaying(!isPlaying));};const handleMouseEnter=()=>{startTransition(()=>setShowControlsOverlay(true));if(hideControlsTimeoutRef.current!==null){window.clearTimeout(hideControlsTimeoutRef.current);}};const handleMouseLeave=()=>{hideControlsTimeoutRef.current=window.setTimeout(()=>{startTransition(()=>setShowControlsOverlay(false));},1e3);};const handleVideoError=()=>{startTransition(()=>setVideoError(true));};useEffect(()=>{return()=>{if(hideControlsTimeoutRef.current!==null){window.clearTimeout(hideControlsTimeoutRef.current);}};},[]);const notchWidth=isIPhone?\"40%\":\"0%\";const actualNotchHeight=isIPhone&&showNotch?notchHeight:0;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor:bezelColor,borderRadius:borderRadius,padding:bezelWidth,boxShadow:\"0 10px 40px rgba(0,0,0,0.2)\",position:\"relative\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor:screenPaddingColor,borderRadius:borderRadius-bezelWidth,padding:screenPaddingWidth,position:\"relative\",overflow:\"hidden\"},children:[showNotch&&isIPhone&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:\"50%\",transform:\"translateX(-50%)\",width:notchWidth,height:actualNotchHeight,backgroundColor:screenPaddingColor,borderBottomLeftRadius:16,borderBottomRightRadius:16,zIndex:10}}),/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",borderRadius:borderRadius-bezelWidth-screenPaddingWidth,overflow:\"hidden\",position:\"relative\",cursor:\"pointer\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,onClick:handlePlayPause,children:[!videoError&&isVideoMode?/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoFile,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"},loop:true,muted:true,playsInline:true,onError:handleVideoError}):fallbackImage.src&&(mediaMode===\"image\"||mediaMode===\"auto\"&&videoError)&&/*#__PURE__*/_jsx(\"img\",{src:fallbackImage.src,alt:fallbackImage.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"rgba(0,0,0,0.3)\",opacity:showControlsOverlay&&showControls&&isVideoMode?1:0,transition:\"opacity 0.3s ease\",pointerEvents:showControlsOverlay&&showControls&&isVideoMode?\"auto\":\"none\"},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:16,alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:60,height:60,borderRadius:\"50%\",backgroundColor:\"rgba(255,255,255,0.9)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:isPlaying?/*#__PURE__*/_jsxs(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",children:[/*#__PURE__*/_jsx(\"title\",{children:\"Pause\"}),/*#__PURE__*/_jsx(\"rect\",{x:\"6\",y:\"4\",width:\"4\",height:\"16\",fill:\"currentColor\"}),/*#__PURE__*/_jsx(\"rect\",{x:\"14\",y:\"4\",width:\"4\",height:\"16\",fill:\"currentColor\"})]}):/*#__PURE__*/_jsxs(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"currentColor\",style:{marginLeft:2},children:[/*#__PURE__*/_jsx(\"title\",{children:\"Play\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M8 5v14l11-7z\"})]})})})})]})]})})});}addPropertyControls(DeviceSimulator,{mediaMode:{type:ControlType.Enum,title:\"Media\",options:[\"auto\",\"video\",\"image\"],optionTitles:[\"Auto\",\"Video\",\"Image\"],defaultValue:\"auto\",displaySegmentedControl:true},videoFile:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],hidden:({mediaMode})=>mediaMode===\"image\"},fallbackImage:{type:ControlType.ResponsiveImage,title:\"Image\"},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({mediaMode})=>mediaMode===\"image\"},deviceSize:{type:ControlType.Enum,title:\"Device Size\",options:[\"iphone\",\"ipad\"],optionTitles:[\"iPhone\",\"iPad\"],defaultValue:\"iphone\",displaySegmentedControl:true},showNotch:{type:ControlType.Boolean,title:\"Show Notch\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},notchHeight:{type:ControlType.Number,title:\"Notch Height\",defaultValue:30,min:10,max:60,step:1,unit:\"px\",hidden:({showNotch,deviceSize})=>!showNotch||deviceSize===\"ipad\"},showControls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},screenPaddingWidth:{type:ControlType.Number,title:\"Screen Padding\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},screenPaddingColor:{type:ControlType.Color,title:\"Padding Color\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:40,min:0,max:100,step:1,unit:\"px\"},bezelWidth:{type:ControlType.Number,title:\"Bezel Width\",defaultValue:12,min:0,max:50,step:1,unit:\"px\"},bezelColor:{type:ControlType.Color,title:\"Bezel Color\",defaultValue:\"#C0C0C0\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DeviceSimulator\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"375\",\"framerIntrinsicHeight\":\"812\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DeviceSimulator.map"],"mappings":"+MASG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,YAAU,uEAAuE,gBAAc,CAAC,IAAI,sEAAsE,IAAI,iBAAiB,CAAC,YAAU,OAAO,aAAW,SAAS,YAAU,GAAK,cAAY,GAAG,qBAAmB,EAAE,qBAAmB,UAAU,eAAa,GAAG,aAAW,GAAG,aAAW,UAAU,eAAa,GAAK,WAAS,GAAK,SAAO,EAAY,EAAY,IAAY,QAAa,CAAC,EAAU,GAAcA,EAAS,EAAY,EAAS,GAAM,CAAM,CAAC,EAAoB,GAAwBA,EAAS,EAAY,CAAC,EAAS,GAAM,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAASC,EAAO,KAAK,CAAO,EAAaA,EAAO,KAAK,CAAO,EAAuBA,EAAO,KAAK,CAAO,EAAS,IAAa,SAAqD,MAAc,CAAC,GAAG,EAAa,QAAQ,CAAC,GAAK,CAAC,QAAM,UAAQ,EAAa,QAAQ,uBAAuB,CAAC,MAAoB,EAAe,EAAM,EAAO,CAAC,GAAI,CAAC,GAAO,MAAM,GAAO,OAAO,CAAC,CAAC,MAAc,CAAI,EAAS,SAAS,CAAC,IAAe,EAAW,EAAS,QAAQ,MAAM,CAAC,UAAU,CAAC,MAAoB,EAAc,GAAK,CAAC,EAAG,CAAO,EAAS,QAAQ,OAAO,GAAK,CAAC,EAAU,EAAW,CAAC,CAAC,MAAc,CACvzC,EAAS,SAAS,CAAC,GAAY,GAAU,EAAS,QAAQ,MAAM,CAAC,UAA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