{"version":3,"file":"MapMexico.DOjStuBZ.mjs","names":["React.useState","React.useRef","React.useId","React.useMemo","p"],"sources":["https:/framerusercontent.com/modules/djoIGebTaRXLliI10bvX/CLnHzUTXGLyM7IRJCzQw/MapMexico.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function MapaMexicoPro(props){const{svgFile,colorBase,colorHover,colorStroke,strokeWidth,strokeOpacity,transitionDuration,highlightedConfig,colorHighlight,mapStyle,dotSize,dotSpacing,opacityBase,showConnections,connectionColor,connectionWidth,originState}=props;const[svgContent,setSvgContent]=React.useState(null);const[hoveredData,setHoveredData]=React.useState({name:\"\",extra:\"\",x:0,y:0,visible:false});const[stateCenters,setStateCenters]=React.useState([]);const containerRef=React.useRef(null);const patternId=React.useId().replace(/:/g,\"\");const maskId=React.useId().replace(/:/g,\"\");React.useEffect(()=>{if(!svgFile)return;fetch(svgFile).then(res=>res.text()).then(text=>{let cleanSvg=text.replace(/fill=\".*?\"/g,\"\").replace(/style=\".*?\"/g,\"\");if(!cleanSvg.includes(\"viewBox\")){cleanSvg=cleanSvg.replace(\"<svg\",`<svg viewBox=\"0 0 800 600\" preserveAspectRatio=\"xMidYMid meet\"`);}else{cleanSvg=cleanSvg.replace(\"<svg\",`<svg preserveAspectRatio=\"xMidYMid meet\"`);}setSvgContent(cleanSvg);});},[svgFile]);const highlightMap=React.useMemo(()=>{const map={};if(!highlightedConfig)return map;highlightedConfig.split(\",\").forEach(item=>{const[id,msg]=item.split(\":\");if(id)map[id.trim().toUpperCase()]=msg?msg.trim():\"\";});return map;},[highlightedConfig]);const highlightedIds=Object.keys(highlightMap);// Calcular centros para las conexiones\nReact.useEffect(()=>{if(!svgContent||!showConnections)return;const timer=setTimeout(()=>{const centers=[];// Incluimos el origen y los resaltados\nconst allTargets=Array.from(new Set([originState.toUpperCase(),...highlightedIds]));allTargets.forEach(id=>{const element=containerRef.current?.querySelector(`path[id*=\"${id}\" i], path[name*=\"${id}\" i]`);if(element&&typeof element.getBBox===\"function\"){const bbox=element.getBBox();centers.push({id,x:bbox.x+bbox.width/2,y:bbox.y+bbox.height/2});}});setStateCenters(centers);},600);return()=>clearTimeout(timer);},[svgContent,highlightedConfig,showConnections,originState]);const handleMouseMove=e=>{const target=e.target;if(target.tagName===\"path\"){const id=(target.id||target.getAttribute(\"name\")||\"\").toUpperCase();const matchedKey=highlightedIds.find(key=>id.includes(key));if(matchedKey){const rect=e.currentTarget.getBoundingClientRect();setHoveredData({name:matchedKey,extra:highlightMap[matchedKey],x:e.clientX-rect.left,y:e.clientY-rect.top,visible:true});}else{setHoveredData(p=>({...p,visible:false}));}}};const cssStyles=`\n        .map-container svg { width: 100%; height: 100%; display: block; overflow: visible; }\n        .map-container path {\n            fill: ${colorBase} !important;\n            fill-opacity: ${opacityBase};\n            stroke: ${colorStroke} !important;\n            stroke-width: ${strokeWidth}px !important;\n            stroke-opacity: ${strokeOpacity} !important;\n            transition: all ${transitionDuration}s ease;\n            cursor: pointer;\n            mask: url(#${maskId});\n            -webkit-mask: url(#${maskId});\n        }\n        ${highlightedIds.map(id=>`\n            .map-container path[id*=\"${id}\" i], .map-container path[name*=\"${id}\" i] {\n                fill: ${colorHighlight} !important;\n                fill-opacity: 1 !important;\n                mask: none !important;\n                -webkit-mask: none !important;\n                stroke-opacity: 1 !important;\n            }\n        `).join(\"\")}\n        .map-container path:hover {\n            fill: ${colorHover} !important;\n            fill-opacity: 1 !important;\n            mask: none !important;\n            -webkit-mask: none !important;\n            filter: drop-shadow(0 0 10px ${colorHover});\n        }\n        .flow-line {\n            fill: none;\n            stroke-linecap: round;\n            stroke-dasharray: 1000;\n            stroke-dashoffset: 1000;\n            animation: drawFlow 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;\n        }\n        @keyframes drawFlow {\n            from { stroke-dashoffset: 1000; opacity: 0; }\n            to { stroke-dashoffset: 0; opacity: 0.8; }\n        }\n    `;const originPoint=stateCenters.find(c=>c.id===originState.toUpperCase());const destinationPoints=stateCenters.filter(c=>c.id!==originState.toUpperCase());return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,className:\"map-container\",onMouseMove:handleMouseMove,onMouseLeave:()=>setHoveredData(p=>({...p,visible:false})),style:{width:\"100%\",height:\"100%\",position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"visible\"},children:[/*#__PURE__*/_jsx(\"style\",{children:cssStyles}),/*#__PURE__*/_jsx(\"svg\",{style:{position:\"absolute\",width:0,height:0},children:/*#__PURE__*/_jsxs(\"defs\",{children:[/*#__PURE__*/_jsxs(\"pattern\",{id:patternId,x:\"0\",y:\"0\",width:dotSpacing,height:dotSpacing,patternUnits:\"userSpaceOnUse\",children:[mapStyle===\"dots\"&&/*#__PURE__*/_jsx(\"circle\",{cx:dotSpacing/2,cy:dotSpacing/2,r:dotSize/2,fill:\"white\"}),mapStyle===\"hex\"&&/*#__PURE__*/_jsx(\"path\",{d:`M${dotSpacing/2},0 L${dotSpacing},${dotSpacing*.25} L${dotSpacing},${dotSpacing*.75} L${dotSpacing/2},${dotSpacing} L0,${dotSpacing*.75} L0,${dotSpacing*.25} Z`,fill:\"white\",transform:`scale(${dotSize/dotSpacing*.8})`,\"transform-origin\":\"center\"})]}),/*#__PURE__*/_jsx(\"mask\",{id:maskId,children:/*#__PURE__*/_jsx(\"rect\",{width:\"10000\",height:\"10000\",fill:mapStyle===\"solid\"?\"white\":`url(#${patternId})`})})]})}),svgContent?/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\"},dangerouslySetInnerHTML:{__html:svgContent}}),showConnections&&originPoint&&/*#__PURE__*/_jsx(\"svg\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",pointerEvents:\"none\",overflow:\"visible\"},viewBox:containerRef.current?.querySelector(\"svg\")?.getAttribute(\"viewBox\")||\"0 0 800 600\",children:destinationPoints.map((dest,i)=>{const dx=dest.x-originPoint.x;const dy=dest.y-originPoint.y;const dr=Math.sqrt(dx*dx+dy*dy)*1.2// Curvatura proporcional a la distancia\n;return /*#__PURE__*/_jsx(\"path\",{className:\"flow-line\",d:`M${originPoint.x},${originPoint.y} A${dr},${dr} 0 0,1 ${dest.x},${dest.y}`,stroke:connectionColor,strokeWidth:connectionWidth},i);})})]}):null,hoveredData.visible&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",left:hoveredData.x,top:hoveredData.y,transform:\"translate(-50%, -130%)\",pointerEvents:\"none\",zIndex:999,display:\"flex\",flexDirection:\"column\",alignItems:\"center\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{padding:\"12px 16px\",backgroundColor:\"#1c1c1e\",borderRadius:\"14px\",border:\"1px solid rgba(255, 255, 255, 0.1)\",boxShadow:\"0 20px 40px rgba(0,0,0,0.4)\",minWidth:\"180px\",display:\"flex\",flexDirection:\"column\",alignItems:\"flex-start\",gap:\"2px\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:10,fontWeight:800,color:\"rgba(255,255,255,0.4)\",textTransform:\"uppercase\"},children:hoveredData.name}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:13,color:\"#FFFFFF\",textAlign:\"left\"},children:hoveredData.extra})]}),/*#__PURE__*/_jsx(\"div\",{style:{width:0,height:0,borderLeft:\"6px solid transparent\",borderRight:\"6px solid transparent\",borderTop:\"6px solid #1c1c1e\"}})]})]});}addPropertyControls(MapaMexicoPro,{svgFile:{type:ControlType.File,allowedFileTypes:[\"svg\"],title:\"📦 Mapa SVG\"},originState:{type:ControlType.String,title:\"Estado Origen\",defaultValue:\"MEX\",description:\"ID del estado de donde salen las l\\xedneas (ej: MEX para CDMX)\"},highlightedConfig:{type:ControlType.String,title:\"Destinos\",defaultValue:\"TAM:Descripci\\xf3n aqu\\xed, COA:Descripci\\xf3n aqu\\xed\"},showConnections:{type:ControlType.Boolean,title:\"Animar L\\xedneas\",defaultValue:true},connectionColor:{type:ControlType.Color,title:\"Color L\\xednea\",defaultValue:\"#007aff\"},connectionWidth:{type:ControlType.Number,title:\"Grosor L\\xednea\",defaultValue:1.5},mapStyle:{type:ControlType.Enum,title:\"Estilo\",options:[\"solid\",\"dots\",\"hex\"],defaultValue:\"dots\"},colorBase:{type:ControlType.Color,title:\"Color Base\",defaultValue:\"#333\"},opacityBase:{type:ControlType.Number,title:\"Opacidad\",min:0,max:1,defaultValue:.5,step:.1},colorStroke:{type:ControlType.Color,title:\"Color Frontera\",defaultValue:\"#666\"},strokeWidth:{type:ControlType.Number,title:\"Grosor Frontera\",defaultValue:.5},strokeOpacity:{type:ControlType.Number,title:\"Opacidad Frontera\",defaultValue:.3},dotSize:{type:ControlType.Number,title:\"Tama\\xf1o Punto\",defaultValue:2},dotSpacing:{type:ControlType.Number,title:\"Espaciado\",defaultValue:6},colorHighlight:{type:ControlType.Color,title:\"Color Destinos\",defaultValue:\"#ff3b30\"},colorHover:{type:ControlType.Color,title:\"Color Hover\",defaultValue:\"#007aff\"},transitionDuration:{type:ControlType.Number,title:\"Suavidad\",defaultValue:.3}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MapaMexicoPro\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MapMexico.map"],"mappings":"6MAAyI,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,UAAQ,YAAU,aAAW,cAAY,cAAY,gBAAc,qBAAmB,oBAAkB,iBAAe,WAAS,UAAQ,aAAW,cAAY,kBAAgB,kBAAgB,kBAAgB,eAAa,EAAW,CAAC,EAAW,GAAeA,EAAe,KAAK,CAAM,CAAC,EAAY,GAAgBA,EAAe,CAAC,KAAK,GAAG,MAAM,GAAG,EAAE,EAAE,EAAE,EAAE,QAAQ,GAAM,CAAC,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