{"version":3,"file":"TwoClickVideo.DeIptcMD.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/z2mZRMGMdSxB721g6fwA/K6G4pR9PJ4difRwVg9lg/TwoClickVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * PRIVACY VIDEO COMPONENT (GDPR/DSGVO Compliant)\n * Version 4.1: No Autoplay\n */export default function PrivacyVideo(props){const[isLoaded,setIsLoaded]=React.useState(false);const STORAGE_KEY=\"framer-video-privacy-consent\";const{videoUrl,thumbnail,overlayColor,textColor,buttonColor,buttonTextColor,privacyText,buttonText,aspectRatio,borderRadius,rememberConsent}=props;// 1. Check for existing consent on mount & listen for updates\nReact.useEffect(()=>{if(!rememberConsent)return;// Check if consent was already given in the past\nconst previouslyConsented=localStorage.getItem(STORAGE_KEY)===\"true\";if(previouslyConsented){setIsLoaded(true);}// Listener: If user clicks another video on the same page, unlock this one too\nconst handleLocalUpdate=()=>{if(localStorage.getItem(STORAGE_KEY)===\"true\"){setIsLoaded(true);}};window.addEventListener(\"privacy-video-unlock\",handleLocalUpdate);return()=>{window.removeEventListener(\"privacy-video-unlock\",handleLocalUpdate);};},[rememberConsent]);// Helper: Parse Ratio\nconst getAspectRatio=ratioString=>{if(!ratioString)return\"16 / 9\";const cleaned=ratioString.toString().replace(/[:x\\-]/g,\"/\");if(!cleaned.includes(\"/\"))return cleaned;return cleaned.replace(\"/\",\" / \");};const videoData=url=>{if(!url)return null;const ytRegExp=/^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/;const ytMatch=url.match(ytRegExp);if(ytMatch&&ytMatch[2].length===11)return{type:\"youtube\",id:ytMatch[2]};const vimeoRegExp=/(?:www\\.|player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/(?:[^\\/]*)\\/videos\\/|album\\/(?:\\d+)\\/video\\/|video\\/|)(\\d+)(?:[a-zA-Z0-9_\\-]+)?/;const vimeoMatch=url.match(vimeoRegExp);if(vimeoMatch&&vimeoMatch[1])return{type:\"vimeo\",id:vimeoMatch[1]};return null;};const data=videoData(videoUrl);// Handle Click\nconst handleConsent=()=>{setIsLoaded(true);if(rememberConsent){localStorage.setItem(STORAGE_KEY,\"true\");// Notify other components on the page to unlock immediately\nwindow.dispatchEvent(new Event(\"privacy-video-unlock\"));}};const bgImage=thumbnail||(data?.type===\"youtube\"?`https://img.youtube.com/vi/${data.id}/maxresdefault.jpg`:\"\");return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",aspectRatio:getAspectRatio(aspectRatio),position:\"relative\",borderRadius:borderRadius,overflow:\"hidden\",backgroundColor:\"#f0f0f0\"},children:isLoaded&&data?/*#__PURE__*/_jsx(\"iframe\",{src:data.type===\"youtube\"?`https://www.youtube.com/embed/${data.id}?autoplay=0`:`https://player.vimeo.com/video/${data.id}?autoplay=0&dnt=1`,width:\"100%\",height:\"100%\",allow:\"fullscreen; picture-in-picture\",allowFullScreen:true,style:{width:\"100%\",height:\"100%\",position:\"absolute\",top:0,left:0,border:\"none\",display:\"block\"}}):/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundImage:`url(${bgImage})`,backgroundSize:\"cover\",backgroundPosition:\"center\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",position:\"absolute\",top:0,left:0},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,backgroundColor:overlayColor,zIndex:1}}),/*#__PURE__*/_jsxs(\"div\",{style:{zIndex:2,padding:\"20px\",textAlign:\"center\",maxWidth:\"90%\"},children:[/*#__PURE__*/_jsx(\"p\",{style:{color:textColor,fontSize:\"14px\",lineHeight:\"1.5\",marginBottom:\"15px\",fontFamily:\"sans-serif\"},children:privacyText}),/*#__PURE__*/_jsx(\"button\",{onClick:handleConsent,style:{backgroundColor:buttonColor,color:buttonTextColor,border:\"none\",padding:\"10px 20px\",fontSize:\"16px\",fontWeight:\"bold\",cursor:\"pointer\",borderRadius:\"8px\"},children:buttonText})]})]})});}addPropertyControls(PrivacyVideo,{videoUrl:{type:ControlType.String,title:\"Video URL\",placeholder:\"https://...\"},aspectRatio:{type:ControlType.String,title:\"Ratio\",defaultValue:\"16:9\",description:\"CMS supported (e.g. 16:9)\"},rememberConsent:{type:ControlType.Boolean,title:\"Remember?\",defaultValue:true,description:\"Save consent to unlock all videos automatically.\"},thumbnail:{type:ControlType.Image,title:\"Cover Image\"},privacyText:{type:ControlType.String,title:\"Legal Text\",defaultValue:\"Externe Videoinhalte laden (YouTube/Vimeo) und Datenschutzerkl\\xe4rung akzeptieren.\",displayTextArea:true},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Video laden\"},overlayColor:{type:ControlType.Color,title:\"Overlay\",defaultValue:\"rgba(0,0,0,0.6)\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#ffffff\"},buttonColor:{type:ControlType.Color,title:\"Btn Color\",defaultValue:\"#0099ff\"},buttonTextColor:{type:ControlType.Color,title:\"Btn Text\",defaultValue:\"#ffffff\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:16}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PrivacyVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TwoClickVideo.map"],"mappings":"sMAGG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAe,GAAM,CAAO,EAAY,+BAAoC,CAAC,WAAS,YAAU,eAAa,YAAU,cAAY,kBAAgB,cAAY,aAAW,cAAY,eAAa,mBAAiB,EAC/R,MAAoB,CAAC,GAAG,CAAC,EAAgB,OACf,aAAa,QAAQ,EAAY,GAAG,QAA+B,EAAY,GAA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