{"version":3,"file":"Calcom.DaYoIvN5.mjs","names":["useState","getCalApi","Cal"],"sources":["https:/framerusercontent.com/modules/3kSszCA7P49KbVg8UUZO/JpyaizoTPW5l4RsfyKkh/Calcom.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import Cal,{getCalApi}from\"@calcom/embed-react\";import{useState,useEffect}from\"react\";import{RenderTarget}from\"framer\";var BookerLayouts;var EmbedTheme;/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n *\n * @framerDisableUnlink\n *\n * @framerIntrinsicHeight 575\n * @framerIntrinsicWidth 1000\n */export default function Calcom(props){const{layout,eventLink,darkTheme,lightTheme,theme,showEventTypeDetails,namespace=\"\"}=props;const[error,setError]=useState();const[embedInfo,setEmbedInfo]=useState({origin:\"\",username:\"\",eventTypeSlug:\"\",namespace:\"\"});const isOnCavas=RenderTarget.current()===RenderTarget.canvas;let _namespace=namespace===\"\"&&embedInfo.namespace===\"\"?`uniqueId-${Math.floor(Math.random()*1e3)}`:namespace!==\"\"?namespace:embedInfo.namespace;useEffect(()=>{(async function(){let url=null;let normalizedLink=eventLink?.trim()||\"\";if(!/^https?:\\/\\//i.test(normalizedLink)){normalizedLink=\"https://\"+normalizedLink;}try{url=new URL(normalizedLink?.trim());}catch(err){console.error(`Incorrect URL: ${eventLink?.trim()} \n`,err);alert(`Incorrect URL: ${eventLink?.trim()} `);url=null;return;}const origin=url.origin;const[username,eventTypeSlug=\"\"]=url.pathname.slice(1).split(\"/\");if(!username){console.error(\"URL must include at least username.\");alert(`URL must include at least username.`);return;}setEmbedInfo(prev=>({...prev,origin,username,eventTypeSlug,namespace:_namespace}));const cal=await getCalApi({namespace:_namespace});cal(\"ui\",{cssVarsPerTheme:{light:{\"cal-brand\":lightTheme},dark:{\"cal-brand\":darkTheme}},hideEventTypeDetails:!showEventTypeDetails,layout:layout,theme:theme});})();},[eventLink,layout,lightTheme,darkTheme,theme,showEventTypeDetails]);return /*#__PURE__*/_jsx(Cal,{namespace:_namespace,calLink:`${embedInfo.username}/${embedInfo.eventTypeSlug}`,style:isOnCavas?{height:\"100%\",overflow:\"clip\"}:{width:\"100%\",height:\"100%\",overflow:\"scroll\"},config:{layout,theme},calOrigin:embedInfo.origin},`${eventLink}-${_namespace}`);}addPropertyControls(Calcom,{eventLink:{title:\"Event Link\",type:ControlType.String,defaultValue:\"https://cal.com/framer-placeholder/default\"},theme:{type:ControlType.Enum,options:[\"auto\",\"light\",\"dark\"],optionTitles:[\"Auto\",\"Light\",\"Dark\"],defaultValue:\"auto\"},lightTheme:{type:ControlType.Color,defaultValue:\"#292929\",title:\"Light Color\"},darkTheme:{type:ControlType.Color,defaultValue:\"#fafafa\",title:\"Dark Color\"},showEventTypeDetails:{type:ControlType.Enum,title:\"Event Info\",defaultValue:true,displaySegmentedControl:true,segmentedControlDirection:\"horizontal\",options:[true,false],optionTitles:[\"Show\",\"Hide\"]},layout:{type:ControlType.Enum,options:[\"month_view\",\"column_view\",\"week_view\"],optionTitles:[\"Month View\",\"Column View\",\"Week View\"],defaultValue:\"month_view\"}});Calcom.displayName=\"Cal.com\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Calcom\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"575\",\"framerIntrinsicWidth\":\"1000\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Calcom.map"],"mappings":"gPAQG,SAAwB,EAAO,EAAM,CAAC,GAAK,CAAC,SAAO,YAAU,YAAU,aAAW,QAAM,uBAAqB,YAAU,IAAI,EAAW,CAAC,EAAM,GAAUA,GAAU,CAAM,CAAC,EAAU,GAAcA,EAAS,CAAC,OAAO,GAAG,SAAS,GAAG,cAAc,GAAG,UA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