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ACRzB,KAAMA,GAAQ,EACdZ,YAAa,GACb8F,gBAAiB,GACjBC,QAAS,EACTC,QAAS,GACT3C,gBAAiBA,EACjB4C,UAAW,CACV,CAAC,GAAI,IAAI,CACT,CAAC,GAAI,KAAK,CACV,CAAC,IAAK,KAAK,CACX,CAAC,IAAK,IAAI,CACV,CACDC,MAAO,CACNC,OAAQ,OACRC,MAAO,OACP1F,SAAUkD,GAAY,CAACJ,EAAmB,QAAU,SACpD6C,IAAK,CACN,YACC/C,EACD,GAAAZ,EAAAC,GAAA,EAAC2D,EAAAA,CAASA,CAAAA,CACTN,QAAS,GACTO,YAAY,yEACZC,IAAK,oCAAwDC,MAAAA,CA/MtD,YA+MmD,KAAgEA,MAAAA,CA7MhH,4BA6MuE,2CAA6DpH,MAAA,CA3MjJ,kGA6MGqE,EACA,GAAAhB,EAAAC,GAAA,EAAC+D,EAAAA,CAAkBA,CAAAA,CAElBC,oBAAqB,GACrBC,mBAAoB1I,WACnB4G,IAGFA,EAEAnB,EACA,GAAAjB,EAAAC,GAAA,EAACrD,EAAAA,CACAW,kBAAmBA,EACnBV,cAAeA,EACfC,MAAOA,EACPC,mBAAoBA,EACpBC,WAAYA,EACZC,YAAaA,EACbC,YAAaA,EACbC,UAAWA,EACXC,YAAaA,EACbC,UAAWA,EACXC,YAAaA,EACbE,gBAAiBA,IAEf,SAIR,oBCtQA2G,EAAAC,OAAA,EAAkB","sources":["webpack://_N_E/./src/hooks/useDebounce.js","webpack://_N_E/./src/components/organism/LeafletMap.jsx","webpack://_N_E/./src/components/organism/LeafletMapStyles.module.scss"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nconst useDebounce = (value, timeout) => {\n const [state, setState] = useState(value);\n \n useEffect(() => {\n const handler = setTimeout(() => setState(value), timeout);\n return () => clearTimeout(handler);\n }, [value, timeout]);\n \n return state;\n};\n\nexport default useDebounce;\n","\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport L, { Browser } from \"leaflet\";\nimport {\n\tMapContainer,\n\tMarker,\n\tTileLayer,\n\tTooltip,\n\tuseMap,\n\tuseMapEvents,\n} from \"react-leaflet\";\nimport useDebounce from \"@/hooks/useDebounce\";\nimport { trackStepOnMapClick } from \"@/utils/mixpanel\";\nimport MarkerClusterGroup from \"react-leaflet-markercluster\";\nimport classNames from \"classnames\";\n\nimport \"leaflet/dist/leaflet.css\";\nimport styles from \"./LeafletMapStyles.module.scss\";\nimport { GlutenFreeIcons } from \"@/constants/gluten-free\";\n\nlet isStepClicked = false;\nlet allowClick = true;\n\nconst Config = {\n\tuser_name: \"stepsprod\",\n\tstyle_id: \"ckncu0enk1tdx17n0ruk0rz5k\",\n\tnew_style_id: \"clluv246y00d601qy1uf3guav\",\n\taccess_token:\n\t\t\"pk.eyJ1Ijoic3RlcHNwcm9kIiwiYSI6ImNrbW5va2Y0bTB5eGEycXJ6aTVnYnh2aXMifQ.ybxcnXuaQ4WB00KuJdvuWg\",\n};\n\nexport const stepIcon = {\n\tselectedStep: {\n\t\tkey: \"selectedStepIcon\",\n\t\tsrc: \"/images/MarkerSelected.svg\",\n\t\tsize: [36, 36],\n\t},\n\tghostStep: {\n\t\tkey: \"ghostStepIcon\",\n\t\tsrc: \"/images/top-ten/ghost-step-marker.svg\",\n\t},\n\tstep: {\n\t\tkey: \"stepIcon\",\n\t\tsrc: \"/images/Marker.svg\",\n\t\tsize: [36, 36],\n\t},\n\tarchived: {\n\t\tkey: \"archivedStepIcon\",\n\t\tsrc: \"/images/top-ten/archived-step-marker.svg\",\n\t},\n\tselectedArchivedStep: {\n\t\tkey: \"selectedArchivedStepIcon\",\n\t\tsrc: \"/images/top-ten/selected-archived-step-marker.svg\",\n\t},\n};\n\nconst createClusterCustomIcon = function (cluster) {\n\tconst markers = cluster.getAllChildMarkers();\n\tlet markerWithMostRecs = {\n\t\ttotal_recommendations: 0,\n\t};\n\n\tmarkers.forEach((item) => {\n\t\tif (\n\t\t\titem.options.place.total_recommendations >\n\t\t\tmarkerWithMostRecs.total_recommendations\n\t\t) {\n\t\t\tmarkerWithMostRecs = item.options.place;\n\t\t}\n\t});\n\n\tconst iconUrl = markerWithMostRecs.matchedMarker.getSrc(\n\t\tmarkerWithMostRecs.icon,\n\t\tmarkerWithMostRecs.total_recommendations || 0\n\t);\n\n\tconst icon = L.divIcon({\n\t\tclassName: \"custom-cluster-icon\",\n\t\thtml: `\n
\n
\n ${markerWithMostRecs.title}\n
\n \"${markerWithMostRecs.title}\"/\n
\n `,\n\t});\n\n\t// return L.icon({\n\t// name: 'clusterIcon',\n\t// title: 'foo',\n\t// tooltipAnchor: [0, 0],\n\t// iconUrl: iconUrl,\n\t// })\n\treturn icon;\n};\n\nconst MapSTPS = ({\n\tcenter,\n\tzoom,\n\tsteps = [],\n\tflyToPosition,\n\tselectedStepsIds = [],\n\tisFitBoundsBySteps,\n\tonClickMap,\n\tonClickStep,\n\tonZoomStart,\n\tonZoomEnd,\n\tonDragEnd,\n\tonDragStart,\n\tzoomControl,\n\tupdateMapCenter,\n\tscrollWheelZoom,\n\tchildren,\n\tmarker = stepIcon.step,\n\tmarkers = [],\n\tdisableZoomEvents = false,\n\tenforceStaticMap = false,\n\tshowAllTooltips = false,\n\tisClusterMap = false,\n\twithMapEvents = true,\n\tisMobile = false,\n}) => {\n\tconst [hoveredStep, setHoveredStep] = useState(null);\n\tconst [selectedStepId, setSelectedStepId] = useState(steps[0]?._id);\n\n\tconst createStepIcon = (type) => {\n\t\treturn L.icon({\n\t\t\ticonUrl: type.src,\n\t\t\ticonSize: type.size,\n\t\t});\n\t};\n\n\tconst markerEventHandlers = (step) => ({\n\t\tclick: () => {\n\t\t\thandleStepOnMapClick(step);\n\t\t\tonClickStep && onClickStep(step);\n\t\t},\n\t\tmouseover: (e) => {\n\t\t\tsetHoveredStep(step._id);\n\t\t\te.target.openPopup();\n\t\t},\n\t\tmouseout: (e) => {\n\t\t\tsetHoveredStep(null);\n\t\t\te.target.closePopup();\n\t\t},\n\t});\n\n\tconst handleStepOnMapClick = (step) => {\n\t\ttrackStepOnMapClick(step);\n\t};\n\n\tuseEffect(() => {\n\t\tif (selectedStepsIds.length > 0) {\n\t\t\tsetSelectedStepId(selectedStepsIds[0]);\n\t\t} else if (hoveredStep) {\n\t\t\tsetSelectedStepId(hoveredStep?._id);\n\t\t} else if (selectedStepId !== steps[0]?._id) {\n\t\t\tsetSelectedStepId(steps[0]?._id);\n\t\t}\n\t}, [selectedStepsIds, hoveredStep, steps]);\n\n\tconst stepsWithMarkers = useMemo(() => {\n\t\treturn steps.map((step, index) => {\n\t\t\tconst isSelected = selectedStepId === step._id;\n\t\t\tlet icon;\n\t\t\tlet matchedMarker;\n\n\t\t\tif (markers.length > 0) {\n\t\t\t\tmatchedMarker = markers.find((marker) => marker.key === step.icon);\n\t\t\t\tif (matchedMarker) {\n\t\t\t\t\tconst type = isSelected ? GlutenFreeIcons.SELECTED : step.icon;\n\t\t\t\t\ticon = createStepIcon(\n\t\t\t\t\t\t{ src: matchedMarker.getSrc(type, index + 1) } || marker\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (isSelected) {\n\t\t\t\ticon = createStepIcon(stepIcon.selectedStep);\n\t\t\t} else {\n\t\t\t\ticon = createStepIcon(marker);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{(isSelected || showAllTooltips) && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{step.title}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t)}\n\t\t\t\t\n\t\t\t);\n\t\t});\n\t}, [steps, showAllTooltips, selectedStepId]);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t{children}\n\t\t\t\tOpenStreetMap contributors'\n\t\t\t\t\turl={`https://api.mapbox.com/styles/v1/${Config.user_name}/${Config.new_style_id}/tiles/256/{z}/{x}/{y}@2x?access_token=${Config.access_token}`}\n\t\t\t\t/>\n\t\t\t\t{isClusterMap ? (\n\t\t\t\t\t\n\t\t\t\t\t\t{stepsWithMarkers}\n\t\t\t\t\t\n\t\t\t\t) : (\n\t\t\t\t\tstepsWithMarkers\n\t\t\t\t)}\n\t\t\t\t{withMapEvents ? (\n\t\t\t\t\t\n\t\t\t\t) : null}\n\t\t\t\n\t\t\n\t);\n};\n\nconst MapEvents = ({\n\tflyToPosition,\n\tsteps,\n\tisFitBoundsBySteps,\n\tonClickMap,\n\tonClickStep,\n\tonZoomStart,\n\tonZoomEnd,\n\tonDragStart,\n\tonDragEnd,\n\tzoomControl,\n\tdisableZoomEvents,\n\tupdateMapCenter,\n}) => {\n\tconst mapRef = useMap();\n\tconst [mapCenterState, setMapCenterState] = useState(null);\n\tconst mapCenterDebounce = useDebounce(mapCenterState, 50);\n\n\tuseEffect(() => {\n\t\tif (mapCenterDebounce && updateMapCenter)\n\t\t\tupdateMapCenter({\n\t\t\t\tposition: mapRef.getCenter(),\n\t\t\t\tzoom: mapRef.getZoom(),\n\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t});\n\t}, [mapCenterDebounce]);\n\n\tuseEffect(() => {\n\t\tif (mapRef && isFitBoundsBySteps) {\n\t\t\tconst latslons = steps.map((step) => [step.lat, step.lon]);\n\t\t\tmapRef.fitBounds(latslons, { padding: [10, 10] });\n\t\t}\n\t}, [steps, isFitBoundsBySteps, mapRef]);\n\n\tuseEffect(() => {\n\t\tif (flyToPosition) {\n\t\t\tlet isAnimation = true;\n\t\t\tconst lat = flyToPosition?.lat || flyToPosition[0];\n\t\t\tconst lon = flyToPosition?.lng || flyToPosition?.lon || flyToPosition[1];\n\t\t\tconst northEast = mapRef.getBounds().getNorthEast();\n\t\t\tconst southWest = mapRef.getBounds().getSouthWest();\n\t\t\tif (\n\t\t\t\tlat < southWest.lat ||\n\t\t\t\tlat > northEast.lat ||\n\t\t\t\tlon < southWest.lng ||\n\t\t\t\tlon > northEast.lng\n\t\t\t)\n\t\t\t\tisAnimation = false;\n\n\t\t\tconst currentZoom = mapRef.getZoom();\n\t\t\tmapRef.setView(flyToPosition, currentZoom, {\n\t\t\t\tanimate: isAnimation,\n\t\t\t\tduration: 1.5,\n\t\t\t});\n\t\t\tsetMapCenterState({\n\t\t\t\tposition: mapRef.getCenter(),\n\t\t\t\tzoom: mapRef.getZoom(),\n\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t});\n\t\t}\n\t}, [flyToPosition]);\n\n\tuseMapEvents({\n\t\tclick(e) {\n\t\t\tif (Browser.safari) {\n\t\t\t\tif (!allowClick) return;\n\t\t\t\tallowClick = false;\n\t\t\t\tsetTimeout(() => (allowClick = true), 200); // handle safari issue (bug on leaflet)\n\t\t\t}\n\t\t\tif (onClickMap && !isStepClicked) {\n\t\t\t\tonClickMap(e);\n\t\t\t} else if (onClickStep && isStepClicked) {\n\t\t\t\tonClickStep({\n\t\t\t\t\te,\n\t\t\t\t\tcenter: mapRef.getCenter(),\n\t\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t\t});\n\t\t\t\tisStepClicked = false;\n\t\t\t}\n\t\t},\n\t\tzoomstart(e) {\n\t\t\tif (disableZoomEvents) return;\n\t\t\tif (onZoomStart) onZoomStart(e);\n\t\t},\n\t\tzoomend(e) {\n\t\t\tif (disableZoomEvents) return;\n\t\t\tsetMapCenterState({\n\t\t\t\tposition: mapRef.getCenter(),\n\t\t\t\tzoom: mapRef.getZoom(),\n\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t});\n\t\t\tif (onZoomEnd)\n\t\t\t\tonZoomEnd({\n\t\t\t\t\te,\n\t\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t\t\tcenter: mapRef.getCenter(),\n\t\t\t\t});\n\t\t},\n\t\tdragend(e) {\n\t\t\tsetMapCenterState({\n\t\t\t\tposition: mapRef.getCenter(),\n\t\t\t\tzoom: mapRef.getZoom(),\n\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t});\n\t\t\tif (onDragEnd)\n\t\t\t\tonDragEnd({\n\t\t\t\t\te,\n\t\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t\t\tcenter: mapRef.getCenter(),\n\t\t\t\t});\n\t\t},\n\t\tdragstart(e) {\n\t\t\tif (onDragStart)\n\t\t\t\tonDragStart({\n\t\t\t\t\te,\n\t\t\t\t\tbounds: mapRef.getBounds(),\n\t\t\t\t\tcenter: mapRef.getCenter(),\n\t\t\t\t});\n\t\t},\n\t});\n\n\treturn (\n\t\t<>\n\t\t\t{zoomControl && (\n\t\t\t\t
\n\t\t\t\t\t {\n\t\t\t\t\t\t\tmapRef.setZoom(mapRef.getZoom() + 1);\n\t\t\t\t\t\t}}>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tmapRef.setZoom(mapRef.getZoom() - 1);\n\t\t\t\t\t\t}}>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t)}\n\t\t\n\t);\n};\n\nexport default MapSTPS;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"LeafletMapStyles_container__aYElV\",\"zoomPanel\":\"LeafletMapStyles_zoomPanel__dN9CS\",\"zoomControl\":\"LeafletMapStyles_zoomControl___1Nih\",\"popupTitle\":\"LeafletMapStyles_popupTitle__0IeO1\",\"clusterMarkerTitle\":\"LeafletMapStyles_clusterMarkerTitle__zxaFq\"};"],"names":["hooks_useDebounce","value","timeout","state","setState","useState","useEffect","handler","setTimeout","clearTimeout","isStepClicked","allowClick","stepIcon","selectedStep","key","src","size","ghostStep","step","archived","selectedArchivedStep","createClusterCustomIcon","cluster","markers","getAllChildMarkers","markerWithMostRecs","total_recommendations","forEach","item","options","place","iconUrl","matchedMarker","getSrc","icon","L","className","html","styles","title","concat","MapEvents","flyToPosition","steps","isFitBoundsBySteps","onClickMap","onClickStep","onZoomStart","onZoomEnd","onDragStart","onDragEnd","zoomControl","disableZoomEvents","updateMapCenter","param","mapRef","useMap","mapCenterState","setMapCenterState","mapCenterDebounce","useDebounce","position","getCenter","zoom","getZoom","bounds","getBounds","latslons","map","lat","lon","fitBounds","padding","isAnimation","lng","northEast","getNorthEast","southWest","getSouthWest","currentZoom","setView","animate","duration","useMapEvents","click","e","Browser","safari","center","zoomstart","zoomend","dragend","dragstart","jsx_runtime","jsx","Fragment","jsxs","div","button","onClick","setZoom","img","LeafletMap","selectedStepsIds","scrollWheelZoom","children","marker","enforceStaticMap","showAllTooltips","isClusterMap","withMapEvents","isMobile","hoveredStep","setHoveredStep","selectedStepId","setSelectedStepId","_id","createStepIcon","type","iconSize","markerEventHandlers","handleStepOnMapClick","mouseover","target","openPopup","mouseout","closePopup","trackStepOnMapClick","length","stepsWithMarkers","useMemo","index","isSelected","find","GlutenFreeIcons","SELECTED","Marker","eventHandlers","zIndexOffset","Tooltip","direction","permanent","classNames","span","MapContainer","doubleClickZoom","minZoom","maxZoom","maxBounds","style","height","width","top","TileLayer","attribution","url","Config","MarkerClusterGroup","showCoverageOnHover","iconCreateFunction","module","exports"],"sourceRoot":""}