{"version":3,"file":"VideoPlayer_2.msInLVSc.mjs","names":["useState","useRef","smartFitStyle","aspectRatioStyle","startTransition"],"sources":["https:/framerusercontent.com/modules/q5WMmf4K1jNVmKw5bSNe/XdJ0P1MOHPocXe2O2xd3/VideoPlayer_2.js"],"sourcesContent":["// Video player with adjustable fit (cover/contain), loop play, and support for YouTube URLs, files, and other URLs\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function getEmbedUrl(url){// YouTube detection\nconst youtubeRegex=/(?:youtube\\.com\\/(?:[^\\/]+\\/.+\\/|(?:v|e(?:mbed)?)\\/|.*[?&]v=)|youtu\\.be\\/)([^\"&?\\/\\s]{11})/;const youtubeMatch=url.match(youtubeRegex);if(youtubeMatch){return{embedUrl:`https://www.youtube.com/embed/${youtubeMatch[1]}?autoplay=1&mute=1&loop=1&playlist=${youtubeMatch[1]}`,type:\"youtube\"};}// Instagram detection\nconst instagramRegex=/instagram\\.com\\/(p|reel|tv)\\/([A-Za-z0-9_-]+)/;const instagramMatch=url.match(instagramRegex);if(instagramMatch){return{embedUrl:`https://www.instagram.com/${instagramMatch[1]}/${instagramMatch[2]}/embed`,type:\"instagram\"};}// Vimeo detection\nconst vimeoRegex=/vimeo\\.com\\/(?:video\\/)?(\\d+)/;const vimeoMatch=url.match(vimeoRegex);if(vimeoMatch){return{embedUrl:`https://player.vimeo.com/video/${vimeoMatch[1]}?autoplay=1&loop=1&muted=1`,type:\"vimeo\"};}// Google Drive detection: 여러 공유 링크 형식 지원\n// 예: https://drive.google.com/file/d/FILE_ID/view?usp=sharing\n// 예: https://drive.google.com/open?id=FILE_ID\n// 예: https://drive.google.com/uc?id=FILE_ID&export=download\nconst driveIdMatch=url.match(/drive\\.google\\.com\\/file\\/d\\/([a-zA-Z0-9_-]+)/)||url.match(/[?&]id=([a-zA-Z0-9_-]+)/);if(driveIdMatch){const fileId=driveIdMatch[1];return{embedUrl:`https://drive.google.com/file/d/${fileId}/preview`,type:\"drive\"};}// Gumlet detection\nconst gumletRegex=/play\\.gumlet\\.io\\/embed\\/([a-zA-Z0-9]+)/;const gumletMatch=url.match(gumletRegex);if(gumletMatch){// Parse existing URL parameters if any\nconst urlObj=new URL(url);return{embedUrl:url,type:\"gumlet\"};}// Direct video URL\nreturn{embedUrl:url,type:\"direct\"};}/**\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 300\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function VideoPlayer(props){const{sourceType=\"file\",fileSource=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",urlSource=\"\",objectFit=\"contain\",loop=false,autoplay=false,muted=true,controls=true,backgroundColor=\"#000000\",fitMode=\"default\",aspectRatio=\"original\",style}=props;const[videoSrc,setVideoSrc]=useState(\"\");const[embedType,setEmbedType]=useState(\"direct\");const[error,setError]=useState(\"\");const[isLoading,setIsLoading]=useState(false);const videoRef=useRef(null);const containerRef=useRef(null);const[containerSize,setContainerSize]=useState({width:0,height:0});const[isHovered,setIsHovered]=useState(false);// Measure container dimensions\nuseEffect(()=>{if(!containerRef.current||fitMode===\"default\")return;const updateSize=()=>{if(containerRef.current){const{width,height}=containerRef.current.getBoundingClientRect();startTransition(()=>{setContainerSize({width,height});});}};updateSize();if(typeof window!==\"undefined\"){window.addEventListener(\"resize\",updateSize);return()=>window.removeEventListener(\"resize\",updateSize);}},[fitMode]);// Calculate smart fit dimensions\nconst getSmartFitStyle=()=>{if(fitMode===\"default\")return{};const{width,height}=containerSize;if(width===0||height===0)return{};const containerRatio=width/height;// For square mode (1:1)\nif(fitMode===\"square\"){const targetRatio=1;if(containerRatio>targetRatio){// Container is wider, fit to height\nreturn{width:\"auto\",height:\"100%\"};}else{// Container is taller, fit to width\nreturn{width:\"100%\",height:\"auto\"};}}// For smart mode (9:16)\nconst targetRatio=16/9// 1.7778\n;// If container is wider than 16:9, fit to height\nif(containerRatio>targetRatio){return{width:\"auto\",height:\"100%\"};}else{// If container is narrower than 16:9, fit to width\nreturn{width:\"100%\",height:\"auto\"};}};// Calculate aspect ratio container style\nconst getAspectRatioStyle=()=>{if(aspectRatio===\"original\")return{};const ratioMap={\"1:1\":1/1,\"16:9\":16/9,\"9:16\":9/16,\"4:3\":4/3,\"21:9\":21/9,\"3:2\":3/2};const ratio=ratioMap[aspectRatio];return{aspectRatio:`${ratio}`,maxWidth:\"100%\",maxHeight:\"100%\"};};useEffect(()=>{startTransition(()=>{setError(\"\");setIsLoading(true);});if(sourceType===\"file\"){if(!fileSource){startTransition(()=>{setVideoSrc(\"\");setEmbedType(\"direct\");});return;}startTransition(()=>{setVideoSrc(fileSource);setEmbedType(\"direct\");});}else if(sourceType===\"url\"){if(!urlSource||urlSource.trim()===\"\"){startTransition(()=>{setVideoSrc(\"\");setEmbedType(\"direct\");});return;}const{embedUrl,type}=getEmbedUrl(urlSource);startTransition(()=>{setVideoSrc(embedUrl);setEmbedType(type);});}},[sourceType,urlSource,fileSource]);const handleVideoError=e=>{console.error(\"Video loading error:\",e);startTransition(()=>{setError(`동영상을 로드할 수 없습니다. (${embedType===\"direct\"?\"파일 형식\":\"URL\"} 확인 필요)`);setIsLoading(false);});};const handleVideoLoad=()=>{startTransition(()=>{setError(\"\");setIsLoading(false);});};if((embedType===\"youtube\"||embedType===\"instagram\"||embedType===\"vimeo\"||embedType===\"drive\")&&videoSrc){let iframeSrc=videoSrc;// Customize YouTube parameters based on props\nif(embedType===\"youtube\"){const url=new URL(videoSrc);url.searchParams.set(\"autoplay\",autoplay?\"1\":\"0\");url.searchParams.set(\"mute\",muted?\"1\":\"0\");url.searchParams.set(\"controls\",controls?\"1\":\"0\");url.searchParams.set(\"loop\",loop?\"1\":\"0\");iframeSrc=url.toString();}// Customize Vimeo parameters based on props\nif(embedType===\"vimeo\"){const url=new URL(videoSrc);url.searchParams.set(\"autoplay\",autoplay?\"1\":\"0\");url.searchParams.set(\"muted\",muted?\"1\":\"0\");url.searchParams.set(\"loop\",loop?\"1\":\"0\");url.searchParams.set(\"controls\",controls?\"1\":\"0\");iframeSrc=url.toString();}const smartFitStyle=getSmartFitStyle();const aspectRatioStyle=getAspectRatioStyle();return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",backgroundColor,overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:aspectRatioStyle,children:/*#__PURE__*/_jsx(\"iframe\",{src:iframeSrc,style:{...fitMode===\"smart\"?smartFitStyle:{width:\"100%\",height:\"100%\"},border:\"none\"},allow:\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\",allowFullScreen:true,title:\"Video player\"})})});}const smartFitStyle=getSmartFitStyle();const aspectRatioStyle=getAspectRatioStyle();return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),style:{width:\"100%\",height:\"100%\",position:\"relative\",backgroundColor,overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:videoSrc?/*#__PURE__*/_jsx(\"div\",{style:aspectRatioStyle,children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoSrc,loop:loop,autoPlay:autoplay,muted:muted,controls:controls&&isHovered,playsInline:true,style:{...fitMode===\"smart\"?smartFitStyle:{width:\"100%\",height:\"100%\"},objectFit:fitMode===\"smart\"?\"contain\":objectFit}})}):/*#__PURE__*/_jsx(\"div\",{style:{color:\"#FFFFFF\",fontSize:\"14px\",textAlign:\"center\",padding:\"20px\"},children:\"비디오 소스를 입력해주세요\"})});}addPropertyControls(VideoPlayer,{sourceType:{type:ControlType.Enum,title:\"Source Type\",options:[\"file\",\"url\"],optionTitles:[\"File\",\"URL\"],defaultValue:\"file\",displaySegmentedControl:true},fileSource:{type:ControlType.File,title:\"Video File\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],hidden:({sourceType})=>sourceType!==\"file\"},urlSource:{type:ControlType.String,title:\"Video URL\",defaultValue:\"\",placeholder:\"YouTube, Vimeo, Instagram, or direct video URL\",hidden:({sourceType})=>sourceType!==\"url\"},aspectRatio:{type:ControlType.Enum,title:\"Aspect Ratio\",options:[\"original\",\"1:1\",\"16:9\",\"9:16\",\"4:3\",\"21:9\",\"3:2\"],optionTitles:[\"Original\",\"1:1\",\"16:9\",\"9:16\",\"4:3\",\"21:9\",\"3:2\"],defaultValue:\"original\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},fitMode:{type:ControlType.Enum,title:\"Fit Mode\",options:[\"default\",\"smart\",\"square\"],optionTitles:[\"Default\",\"Smart (9:16)\",\"Square (1:1)\"],defaultValue:\"default\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\",hidden:({aspectRatio})=>aspectRatio!==\"original\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"cover\",\"contain\",\"fill\",\"none\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"None\"],defaultValue:\"contain\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\",hidden:({fitMode,aspectRatio})=>(fitMode===\"smart\"||fitMode===\"square\")&&aspectRatio===\"original\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},controls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoPlayer\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"300\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoPlayer_2.map"],"mappings":"6MAC4J,SAAS,EAAY,EAAI,CACrE,IAAM,EAAa,EAAI,MAApH,6FAAuI,CAAC,GAAG,EAAc,MAAM,CAAC,SAAS,iCAAiC,EAAa,GAAG,qCAAqC,EAAa,KAAK,KAAK,UAAU,CAC9O,IAAM,EAAe,EAAI,MAAzE,gDAA8F,CAAC,GAAG,EAAgB,MAAM,CAAC,SAAS,6BAA6B,EAAe,GAAG,GAAG,EAAe,GAAG,QAAQ,KAAK,YAAY,CACnM,IAAM,EAAW,EAAI,MAArD,gCAAsE,CAAC,GAAG,EAAY,MAAM,CAAC,SAAS,kCAAkC,EAAW,GAAG,4BAA4B,KAAK,QAAQ,CAIhN,IAAM,EAAa,EAAI,MAAM,gDAAgD,EAAE,EAAI,MAAM,0BAA0B,CAGnH,OAHuH,EAAiD,CAAC,SAAS,mCAAhC,EAAa,GAA6D,UAAU,KAAK,QAAQ,CACrK,EAAI,MAAhE,0CAAkF,EACvF,IAAI,IAAI,EAAI,CAAO,CAAC,SAAS,EAAI,KAAK,SAAS,EACtD,CAAC,SAAS,EAAI,KAAK,SAAS,CAK/B,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,aAAW,OAAO,aAAW,uEAAuE,YAAU,GAAG,YAAU,UAAU,OAAK,GAAM,WAAS,GAAM,QAAM,GAAK,WAAS,GAAK,kBAAgB,UAAU,UAAQ,UAAU,cAAY,WAAW,SAAO,EAAW,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,SAAS,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,E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