{"version":3,"file":"LCMapTapToLoad.9kCls19s.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/FzDRUNEI3hZrBeSMpv7J/ahXuwTFX68nJBPUCXPJq/LCMapTapToLoad.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// LangkawiCruise location map (Google Maps embed, no API key).\n// Load on \"page\" (default, Alain 27 Sep 2026: map visible when the page opens, as on the current site) or on \"tap\"\n// (a locally drawn preview; nothing is requested from Google until the visitor taps \"Show map\").\n// Round 15: in \"page\" mode the map is requested only when its section comes near the screen (the preview shows until then).\n// \"Open in Google Maps\" is a plain link that opens Google Maps in a new tab. The Framer canvas always shows the preview.\nconst FONT=\"Inter, Inter Placeholder, system-ui, sans-serif\";// Round 15 (Alain 29 Sep 2026): load the page section by section. A photo (or map) is requested only when its\n// section is on the screen or about to be (up to 3/4 of a screen below, 1/4 above), so the first screen loads first\n// and the rest follows, top to bottom, as the visitor scrolls. Nothing is in the server HTML for those photos.\n// The position is checked again 150 ms later, because Framer lays lists out in steps while the page starts.\nfunction useNear(ref,enabled){const[near,setNear]=useState(false);useEffect(()=>{if(!enabled||near)return;const el=ref.current;if(!el||typeof IntersectionObserver===\"undefined\"){setNear(true);return;}let timer=0;const inRange=()=>{const r=el.getBoundingClientRect(),h=window.innerHeight||800;return(r.width>0||r.height>0)&&r.bottom>-h*.25&&r.top<h*1.75;};const io=new IntersectionObserver(entries=>{if(!entries.some(e=>e.isIntersecting))return;window.clearTimeout(timer);timer=window.setTimeout(()=>{if(inRange()){setNear(true);io.disconnect();}},150);},{rootMargin:\"25% 0px 75% 0px\"});io.observe(el);const onScroll=()=>{if(inRange()){window.clearTimeout(timer);timer=window.setTimeout(()=>{if(inRange()){setNear(true);io.disconnect();}},150);}};window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{io.disconnect();window.clearTimeout(timer);window.removeEventListener(\"scroll\",onScroll);};},[enabled,near]);return near;}const enc=s=>encodeURIComponent((s||\"\").trim());/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 520\n */export default function LCMapTapToLoad(props){const{name,address,query,cid,zoom,loadOn,height,showLabel,openLabel,note,textColor,mutedColor,accentColor,lineColor,tintColor,radius,style}=props;const[loaded,setLoaded]=useState(false);const box=useRef(null);const near=useNear(box,loadOn!==\"tap\");const boxHeight=Math.max(160,Number(height)||340)// values bound from the canvas can arrive as strings\n;const onCanvas=RenderTarget.current()===RenderTarget.canvas;const q=query||name;// A Google Business listing id (CID) pins the map to that exact listing; otherwise the place is found by name.\nconst id=String(cid||\"\").replace(/\\D/g,\"\");const embed=id?`https://maps.google.com/maps?cid=${id}&output=embed`:`https://www.google.com/maps?q=${enc(q)}&z=${Math.round(zoom||15)}&output=embed`;const open=id?`https://www.google.com/maps?cid=${id}`:`https://www.google.com/maps/search/?api=1&query=${enc(q)}`;const grid=`linear-gradient(${lineColor} 1px, transparent 1px), linear-gradient(90deg, ${lineColor} 1px, transparent 1px)`;return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",fontFamily:FONT,display:\"flex\",flexDirection:\"column\",gap:12,...style},children:[/*#__PURE__*/_jsx(\"div\",{ref:box,style:{position:\"relative\",width:\"100%\",height:boxHeight,borderRadius:Number(radius)||0,overflow:\"hidden\",border:`1px solid ${lineColor}`,background:tintColor},children:(loaded||loadOn!==\"tap\"&&near)&&!onCanvas?/*#__PURE__*/_jsx(\"iframe\",{title:`Map: ${name}`,src:embed,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",border:0},loading:\"lazy\",referrerPolicy:\"no-referrer-when-downgrade\",allowFullScreen:true}):/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",inset:0,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:12,padding:20,textAlign:\"center\",backgroundImage:grid,backgroundSize:\"36px 36px\",backgroundPosition:\"center\"},children:[/*#__PURE__*/_jsx(\"svg\",{width:\"40\",height:\"40\",viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{fill:accentColor,d:\"M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z\"})}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:17,fontWeight:700,lineHeight:1.3,color:textColor,maxWidth:420},children:name}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>setLoaded(true),\"aria-label\":`${showLabel}: ${name}`,style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",minHeight:44,padding:\"12px 22px\",borderRadius:100,border:\"none\",cursor:\"pointer\",background:accentColor,color:\"#fff\",fontFamily:FONT,fontSize:15,fontWeight:700,lineHeight:1.2},children:showLabel}),note&&loadOn===\"tap\"?/*#__PURE__*/_jsx(\"div\",{style:{fontSize:12,lineHeight:1.4,color:mutedColor,maxWidth:360},children:note}):null]})}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",alignItems:\"baseline\",justifyContent:\"space-between\",gap:\"6px 16px\"},children:[address?/*#__PURE__*/_jsx(\"div\",{style:{fontSize:14,lineHeight:1.45,color:mutedColor,flex:\"1 1 220px\",minWidth:0},children:address}):null,/*#__PURE__*/_jsxs(\"a\",{href:open,target:\"_blank\",rel:\"noopener noreferrer\",style:{fontSize:14,fontWeight:700,lineHeight:1.4,color:accentColor,textDecoration:\"none\"},children:[openLabel,\" ↗\"]})]})]});}LCMapTapToLoad.defaultProps={name:\"Royal Langkawi Yacht Club\",address:\"Jalan Dato Syed Omar, 07000 Kuah, Langkawi, Kedah\",query:\"Royal Langkawi Yacht Club\",cid:\"\",zoom:15,loadOn:\"page\",height:340,showLabel:\"Show map\",openLabel:\"Open in Google Maps\",note:\"The map loads from Google Maps when you tap.\",textColor:\"rgb(7, 27, 51)\",mutedColor:\"rgb(81, 98, 116)\",accentColor:\"rgb(14, 111, 120)\",lineColor:\"rgba(7, 27, 51, 0.12)\",tintColor:\"rgb(230, 244, 245)\",radius:20};addPropertyControls(LCMapTapToLoad,{name:{type:ControlType.String,title:\"Place name\"},address:{type:ControlType.String,title:\"Address\",displayTextArea:true},query:{type:ControlType.String,title:\"Maps search\"},cid:{type:ControlType.String,title:\"Listing CID\",placeholder:\"optional\"},zoom:{type:ControlType.Number,title:\"Zoom\",min:10,max:19,step:1},loadOn:{type:ControlType.Enum,title:\"Load map\",options:[\"page\",\"tap\"],optionTitles:[\"On page load\",\"On tap\"],defaultValue:\"page\"},height:{type:ControlType.Number,title:\"Map height\",min:200,max:640,step:10},showLabel:{type:ControlType.String,title:\"Show label\"},openLabel:{type:ControlType.String,title:\"Open label\"},note:{type:ControlType.String,title:\"Note\"},textColor:{type:ControlType.Color,title:\"Text\"},mutedColor:{type:ControlType.Color,title:\"Muted\"},accentColor:{type:ControlType.Color,title:\"Accent\"},lineColor:{type:ControlType.Color,title:\"Line\"},tintColor:{type:ControlType.Color,title:\"Tint\"},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:40}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LCMapTapToLoad\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"520\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LCMapTapToLoad.map"],"mappings":"0MASA,SAAS,EAAQ,EAAI,EAAQ,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,EAAK,EAA41B,OAA11B,MAAc,CAAC,GAAG,CAAC,GAAS,EAAK,OAAO,IAAM,EAAG,EAAI,QAAQ,GAAG,CAAC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