@corva/ui 3.70.0-4 → 3.70.0-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js +1 -1
  2. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  3. package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
  4. package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
  5. package/cjs-bundle/components/NewCommentCursor/NewCommentCursor.js +1 -1
  6. package/cjs-bundle/components/NewCommentCursor/NewCommentCursor.scss.js +1 -1
  7. package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js +1 -1
  8. package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
  9. package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
  10. package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
  11. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
  12. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
  13. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.js +1 -1
  14. package/cjs-bundle/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.js +1 -1
  15. package/cjs-bundle/components/PinnableFilters/effects/index.js +1 -1
  16. package/cjs-bundle/components/PinnableFilters/effects/index.js.map +1 -1
  17. package/cjs-bundle/config/mapbox/index.js +1 -1
  18. package/cjs-bundle/config/mapbox/index.js.map +1 -1
  19. package/components/AttachmentPreview/AttachmentPreview.d.ts.map +1 -1
  20. package/components/AttachmentPreview/AttachmentPreview.js +1 -1
  21. package/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  22. package/components/BICOffsetPickerDialog/components/Map/Map.d.ts.map +1 -1
  23. package/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
  24. package/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
  25. package/components/NewCommentCursor/NewCommentCursor.d.ts.map +1 -1
  26. package/components/NewCommentCursor/NewCommentCursor.js +1 -1
  27. package/components/NewCommentCursor/NewCommentCursor.scss.js +1 -1
  28. package/components/OffsetWellMap/OffsetWellMap.d.ts.map +1 -1
  29. package/components/OffsetWellMap/OffsetWellMap.js +1 -1
  30. package/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
  31. package/components/OffsetWellPickerV2/components/Map/Map.d.ts.map +1 -1
  32. package/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
  33. package/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
  34. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.d.ts.map +1 -1
  35. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
  36. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
  37. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.d.ts.map +1 -1
  38. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.js +1 -1
  39. package/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.d.ts.map +1 -1
  40. package/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.js +1 -1
  41. package/components/PinnableFilters/effects/index.js +1 -1
  42. package/components/PinnableFilters/effects/index.js.map +1 -1
  43. package/config/mapbox/index.d.ts +1 -0
  44. package/config/mapbox/index.d.ts.map +1 -1
  45. package/config/mapbox/index.js +1 -1
  46. package/config/mapbox/index.js.map +1 -1
  47. package/mcp-server/server.mjs +11 -1
  48. package/package.json +1 -1
  49. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sources":["../../../../../../src/components/OffsetWellPickerV2/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\nimport { MuiThemeProvider } from '@material-ui/core/styles';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport { theme } from '~/config';\nimport mapboxgl from '~/config/mapboxGl';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\nconst COLORS = [\n '#FF00FF',\n '#F5BD80',\n '#FF0000',\n '#0080FF',\n '#FF8000',\n '#58ACFA',\n '#FA58F4',\n '#40FF00',\n '#4B8A08',\n '#40FF00',\n '#D8F781',\n];\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n subjectWell,\n wells,\n offsetWells,\n radius,\n subjectWellMarkerSize,\n wellMarkerSize,\n popUpFormatter,\n coordsDataPath,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef(null);\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const restWells = useMemo(() => {\n return wells.filter(well => !subjectWell || subjectWell.id !== well.id);\n }, [subjectWell, wells]);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Get well marker colors according to its target formation\n const [formations, colorDict] = useMemo(() => {\n // NOTE: Determine well marker colors\n const restFormations = [];\n let hasNullFormation = false;\n\n restWells.forEach(well => {\n if (well.formation === 'Null') {\n hasNullFormation = true;\n } else if (\n (!subjectWell || subjectWell.formation !== well.formation) &&\n !restFormations.includes(well.formation)\n ) {\n restFormations.push(well.formation);\n }\n });\n\n const sortedFormations = subjectWell\n ? [subjectWell.formation].concat(sortBy(restFormations))\n : sortBy(restFormations);\n\n if (hasNullFormation && !sortedFormations.includes('Null')) {\n sortedFormations.push('Null');\n }\n\n const colors = sortedFormations.reduce(\n (result, item, idx) => ({\n ...result,\n [item]: COLORS[idx % COLORS.length],\n }),\n {}\n );\n\n return [sortedFormations, colors];\n }, [subjectWell, restWells]);\n\n // NOTE: Initialize map\n useEffect(() => {\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n\n const map = mapRef.current;\n return () => {\n map.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n popupRef.current?.remove();\n\n const offsetWellIds = offsetWells.map(well => well.id);\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n wells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? subjectWellMarkerSize : wellMarkerSize;\n const color = isWellSubject || isWellOffset ? OFFSET_WELL_COLOR : colorDict[well.formation];\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: { wellId: well.id, radius: r, color, opacity },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: colorDict[well.formation],\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(\n <MuiThemeProvider theme={theme.darkTheme}>{popUpContent}</MuiThemeProvider>,\n popUpContainer\n );\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n };\n }, [subjectWell, wells, offsetWells, colorDict, isMapReady]);\n\n useEffect(() => {\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n\n <div className={styles.mapFooter}>\n {offsetWells && (\n <div className={styles.mapFooterItem}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: OFFSET_WELL_COLOR }}\n />\n <div className={styles.mapFooterItemLabel}>Selected Offset Wells</div>\n </div>\n )}\n\n {formations.map(item => (\n <div className={styles.mapFooterItem} key={item}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: colorDict[item] }}\n />\n <div className={styles.mapFooterItemLabel}>{item}</div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nWellsMap.propTypes = {\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n subjectWellMarkerSize: PropTypes.number,\n wellMarkerSize: PropTypes.number,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n subjectWellMarkerSize: DEFAULT_SUBJECT_WELL_MARKER_SIZE,\n wellMarkerSize: DEFAULT_WELL_MARKER_SIZE,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","COLORS","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","subjectWell","wells","offsetWells","radius","subjectWellMarkerSize","wellMarkerSize","popUpFormatter","coordsDataPath","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","restWells","useMemo","filter","well","id","subjectWellCoords","get","restFormations","hasNullFormation","forEach","formation","includes","push","sortedFormations","concat","sortBy","colors","reduce","result","item","idx","length","_useMemo2","_useMemo","formations","colorDict","useEffect","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","source","paint","map","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","sin","makeCirclePolygon","geometry","coordinates","bounds","coord","extend","LngLatBounds","_popupRef$current","prevWells","offsetWellIds","wellsById","coords","isWellSubject","isWellOffset","r","color","opacity","properties","wellId","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","jsx","MuiThemeProvider","theme","darkTheme","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","setTimeout","fitBounds","padding","off","_jsxs","className","styles","mapMain","ref","jsxs","mapFooter","mapFooterItem","mapFooterItemSquare","backgroundColor","mapFooterItemLabel","propTypes","PropTypes","shape","number","string","arrayOf","isRequired","func","defaultProps","memo"],"mappings":"w1EAaA,IAAQA,EAAuBC,EAAMA,OAA7BD,mBAOFE,EAAS,CACb,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGIC,EAAiB,CAAC,WAAY,WAI9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAA,QAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EASNC,GAAA,IARDC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,sBACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,eAEMC,EAAkBC,SAAO,MACzBC,EAASD,SAAO,MAChBE,EAAwBF,SAAO,MAC/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ACG,SAEvBhJ,MAAO6I,EAAS,QAACI,QAAQJ,EAAAA,QAAUC,MAAM,CAAA,IAAKI,WAC9CjJ,YAAa4I,EAAS,QAACI,QAAQJ,EAAS,QAACC,MAAM,CAAE,IACjD5I,OAAQ2I,EAAAA,QAAUE,OAAOG,WACzB/I,sBAAuB0I,EAAS,QAACE,OACjC3I,eAAgByI,EAAS,QAACE,OAC1B1I,eAAgBwI,EAAS,QAACM,KAC1B7I,eAAgBuI,EAAS,QAACG,QAG5BnJ,EAASuJ,aAAe,CACtBrJ,YAAa,KACbI,sBA7UuC,GA8UvCC,eA7U+B,EA8U/BC,eAAgB,KAChBC,eAAgB,gCAChBL,YAAa,MAGf,IAAeoJ,EAAAA,EAAAA,KAAKxJ"}
1
+ {"version":3,"file":"Map.js","sources":["../../../../../../src/components/OffsetWellPickerV2/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\nimport { MuiThemeProvider } from '@material-ui/core/styles';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport { theme } from '~/config';\nimport mapboxgl from '~/config/mapboxGl';\nimport { IS_MAPBOX_ENABLED } from '~/config/mapbox';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\nconst COLORS = [\n '#FF00FF',\n '#F5BD80',\n '#FF0000',\n '#0080FF',\n '#FF8000',\n '#58ACFA',\n '#FA58F4',\n '#40FF00',\n '#4B8A08',\n '#40FF00',\n '#D8F781',\n];\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n subjectWell,\n wells,\n offsetWells,\n radius,\n subjectWellMarkerSize,\n wellMarkerSize,\n popUpFormatter,\n coordsDataPath,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef(null);\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const restWells = useMemo(() => {\n return wells.filter(well => !subjectWell || subjectWell.id !== well.id);\n }, [subjectWell, wells]);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Get well marker colors according to its target formation\n const [formations, colorDict] = useMemo(() => {\n // NOTE: Determine well marker colors\n const restFormations = [];\n let hasNullFormation = false;\n\n restWells.forEach(well => {\n if (well.formation === 'Null') {\n hasNullFormation = true;\n } else if (\n (!subjectWell || subjectWell.formation !== well.formation) &&\n !restFormations.includes(well.formation)\n ) {\n restFormations.push(well.formation);\n }\n });\n\n const sortedFormations = subjectWell\n ? [subjectWell.formation].concat(sortBy(restFormations))\n : sortBy(restFormations);\n\n if (hasNullFormation && !sortedFormations.includes('Null')) {\n sortedFormations.push('Null');\n }\n\n const colors = sortedFormations.reduce(\n (result, item, idx) => ({\n ...result,\n [item]: COLORS[idx % COLORS.length],\n }),\n {}\n );\n\n return [sortedFormations, colors];\n }, [subjectWell, restWells]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!IS_MAPBOX_ENABLED) return undefined;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n\n const map = mapRef.current;\n return () => {\n map.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n popupRef.current?.remove();\n\n const offsetWellIds = offsetWells.map(well => well.id);\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n wells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? subjectWellMarkerSize : wellMarkerSize;\n const color = isWellSubject || isWellOffset ? OFFSET_WELL_COLOR : colorDict[well.formation];\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: { wellId: well.id, radius: r, color, opacity },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: colorDict[well.formation],\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(\n <MuiThemeProvider theme={theme.darkTheme}>{popUpContent}</MuiThemeProvider>,\n popUpContainer\n );\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n };\n }, [subjectWell, wells, offsetWells, colorDict, isMapReady]);\n\n useEffect(() => {\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n\n <div className={styles.mapFooter}>\n {offsetWells && (\n <div className={styles.mapFooterItem}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: OFFSET_WELL_COLOR }}\n />\n <div className={styles.mapFooterItemLabel}>Selected Offset Wells</div>\n </div>\n )}\n\n {formations.map(item => (\n <div className={styles.mapFooterItem} key={item}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: colorDict[item] }}\n />\n <div className={styles.mapFooterItemLabel}>{item}</div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nWellsMap.propTypes = {\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n subjectWellMarkerSize: PropTypes.number,\n wellMarkerSize: PropTypes.number,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n subjectWellMarkerSize: DEFAULT_SUBJECT_WELL_MARKER_SIZE,\n wellMarkerSize: DEFAULT_WELL_MARKER_SIZE,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","COLORS","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","subjectWell","wells","offsetWells","radius","subjectWellMarkerSize","wellMarkerSize","popUpFormatter","coordsDataPath","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","restWells","useMemo","filter","well","id","subjectWellCoords","get","restFormations","hasNullFormation","forEach","formation","includes","push","sortedFormations","concat","sortBy","colors","reduce","result","item","idx","length","_useMemo2","_useMemo","formations","colorDict","useEffect","IS_MAPBOX_ENABLED","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","source","paint","map","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","sin","makeCirclePolygon","geometry","coordinates","bounds","coord","extend","LngLatBounds","_popupRef$current","prevWells","offsetWellIds","wellsById","coords","isWellSubject","isWellOffset","r","color","opacity","properties","wellId","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","jsx","MuiThemeProvider","theme","darkTheme","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","setTimeout","fitBounds","padding","off","_jsxs","className","styles","mapMain","ref","jsxs","mapFooter","mapFooterItem","mapFooterItemSquare","backgroundColor","mapFooterItemLabel","propTypes","PropTypes","shape","number","string","arrayOf","isRequired","func","defaultProps","memo"],"mappings":"44EAcA,IAAQA,EAAuBC,EAAMA,OAA7BD,mBAOFE,EAAS,CACb,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGIC,EAAiB,CAAC,WAAY,WAI9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAA,QAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EASNC,GAAA,IARDC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,sBACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,eAEMC,EAAkBC,SAAO,MACzBC,EAASD,SAAO,MAChBE,EAAwBF,SAAO,MAC/BG,EAAmBH,SAAO,MAC1BI,EAAWJ,SAAO,MAClBK,EAAeL,EAAAA,SACeM,EAAAA,EAAQA,UAAC,GAAMC,EAAApB,EAAAA,QAAAqB,EAAA,GAA5CC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAE1BI,EAAYC,EAAAA,SAAQ,WACxB,OAAOpB,EAAMqB,QAAO,SAAAC,GAAI,OAAKvB,GAAeA,EAAYwB,KAAOD,EAAKC,KACtE,GAAG,CAACxB,EAAaC,IAEXwB,EAAoBJ,EAAAA,SAAQ,WAChC,OAAOrB,GAAe0B,EAAAA,IAAI1B,EAAaO,EACzC,GAAG,CAACP,EAAaO,IAGec,EAAAA,EAAAA,SAAQ,WAEtC,IAAMM,EAAiB,GACnBC,GAAmB,EAEvBR,EAAUS,SAAQ,SAAAN,GACO,SAAnBA,EAAKO,UACPF,GAAmB,EAEjB5B,GAAeA,EAAY8B,YAAcP,EAAK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t=require("react-dom"),u=require("prop-types"),n=require("lodash"),o=require("./Map.css.js"),l=require("../../../../../../utils/index.js");require("../../../../../../config/mapboxGl/index.js"),require("mapbox-gl/dist/mapbox-gl.css");var a=require("react/jsx-runtime"),i=require("mapbox-gl");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=c(e),d=c(t),f=c(u),p=c(i),m=l.mapbox.isValidCoordinates,g=[29.749907,-95.358421],v={type:"FeatureCollection",features:[]},y=function(e){var r=s.default(e,2),t=r[0];return[r[1],t]};function h(e){var t=e.open,u=e.subjectWell,l=e.wells,i=e.offsetWells,c=e.radius,f=e.formationColors,h=e.popUpFormatter,w=e.coordsDataPath,b=e.onAddOffsetWell,q=e.onDeleteOffsetWell,x=r.useRef(null),D=r.useRef(),B=r.useRef(null),j=r.useRef(null),C=r.useRef(null),F=r.useRef(),R=r.useState(!1),W=s.default(R,2),M=W[0],P=W[1],E=r.useMemo((function(){return u&&n.get(u,w)}),[u,w]);return r.useEffect((function(){t&&!D.current&&(D.current=new p.default.Map({container:x.current,style:"mapbox://styles/mapbox/dark-v9",center:y(g),zoom:1,attributionControl:!1,scrollZoom:!1}),D.current.addControl(new p.default.NavigationControl({showCompass:!1}),"bottom-right"),D.current.on("load",(function(){D.current.addSource("radius-circle",{type:"geojson",data:v}),D.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),D.current.addSource("wells",{type:"geojson",data:v}),D.current.addLayer({id:"wells",type:"circle",source:"wells",layout:{"circle-sort-key":["get","sortKey"]},paint:{"circle-radius":["get","radius"],"circle-color":["get","color"],"circle-opacity":["get","opacity"]}}),P(!0)})))}),[t]),r.useEffect((function(){return function(){D.current&&(D.current.remove(),D.current=null,B.current=null,j.current=null)}}),[]),r.useEffect((function(){if(D.current&&M&&t){if(!E)return D.current.getSource("radius-circle").setData(v),void(B.current=null);var e=function(e,r){for(var t=s.default(e,2),u=t[0],n=t[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,l=[],a=r/(111320*Math.cos(u*Math.PI/180)),i=r/110574,c=0;c<=o;c+=1){var d=c/o*(2*Math.PI);l.push([n+a*Math.cos(d),u+i*Math.sin(d)])}return l}(E,1609.34*c);D.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}}),B.current=e.reduce((function(e,r){return e.extend(r)}),new p.default.LngLatBounds)}}),[c,E,t,M]),r.useEffect((function(){if(D.current&&M&&t){var e=F.current;F.current=l;var o=i.map((function(e){return e.id})),c=n.sortBy(l,(function(e){return o.includes(e.id)})),s=[],g={},v=new p.default.LngLatBounds;c.forEach((function(e){var r=n.get(e,w);if(r&&m(r)){var t=u&&u.id===e.id,l=o.includes(e.id),a=t?10:5,i=t||l?"#00FFFF":n.get(f,e.formation,"#BDBDBD"),c=t||l?1:.3;g[e.id]=e,v.extend(y(r)),s.push({type:"Feature",geometry:{type:"Point",coordinates:y(r)},properties:{wellId:e.id,radius:a,color:i,opacity:c,sortKey:l?1:0}})}})),D.current.getSource("wells").setData({type:"FeatureCollection",features:s}),j.current=s.length?v:null;var x=D.current,R=null,W=function(e){x.getCanvas().style.cursor="pointer";var t=g[e.features[0].properties.wellId];if(t&&t.id!==R&&(R=t.id,h)){var u=document.createElement("div"),o=r.createElement(h,{well:t,color:n.get(f,t.formation,"#BDBDBD")});d.default.render(a.jsx(a.Fragment,{children:o}),u),C.current||(C.current=new p.default.Popup({closeButton:!1,maxWidth:"none"})),C.current.setLngLat(y(n.get(t,w))).setDOMContent(u).addTo(x)}},P=function(){var e;R=null,x.getCanvas().style.cursor="",null===(e=C.current)||void 0===e||e.remove()},E=function(e){var r=e.features[0].properties.wellId,t=u&&u.id===r;o.includes(r)&&!t?q(r):b(r)};return x.on("mousemove","wells",W),x.on("mouseleave","wells",P),x.on("click","wells",E),setTimeout((function(){D.current&&B.current&&l!==e&&D.current.fitBounds(B.current,{padding:5})}),500),function(){x.off("mousemove","wells",W),x.off("mouseleave","wells",P),x.off("click","wells",E)}}}),[u,l,i,t,M]),r.useEffect((function(){t&&setTimeout((function(){u?D.current&&B.current&&D.current.fitBounds(B.current,{padding:5}):D.current&&j.current&&D.current.fitBounds(j.current)}),500)}),[c,u,t,M]),a.jsx("div",{className:o.map,children:a.jsx("div",{className:o.mapMain,ref:x})})}h.propTypes={open:f.default.bool.isRequired,subjectWell:f.default.shape({id:f.default.number,formation:f.default.string}),wells:f.default.arrayOf(f.default.shape({})).isRequired,offsetWells:f.default.arrayOf(f.default.shape({})),radius:f.default.number.isRequired,formationColors:f.default.shape({}).isRequired,popUpFormatter:f.default.func,coordsDataPath:f.default.string,onAddOffsetWell:f.default.func.isRequired,onDeleteOffsetWell:f.default.func.isRequired},h.defaultProps={subjectWell:null,popUpFormatter:null,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var w=r.memo(h);module.exports=w;
1
+ "use strict";var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("react-dom"),u=require("prop-types"),n=require("lodash"),o=require("./Map.css.js"),l=require("../../../../../../utils/index.js");require("../../../../../../config/mapboxGl/index.js");var a=require("../../../../../../config/mapbox/index.js");require("mapbox-gl/dist/mapbox-gl.css");var i=require("react/jsx-runtime"),c=require("mapbox-gl");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(e),f=s(t),p=s(u),m=s(c),g=l.mapbox.isValidCoordinates,v=[29.749907,-95.358421],y={type:"FeatureCollection",features:[]},h=function(e){var r=d.default(e,2),t=r[0];return[r[1],t]};function w(e){var t=e.open,u=e.subjectWell,l=e.wells,c=e.offsetWells,s=e.radius,p=e.formationColors,w=e.popUpFormatter,b=e.coordsDataPath,x=e.onAddOffsetWell,q=e.onDeleteOffsetWell,D=r.useRef(null),B=r.useRef(),j=r.useRef(null),C=r.useRef(null),F=r.useRef(null),R=r.useRef(),M=r.useState(!1),W=d.default(M,2),E=W[0],P=W[1],L=r.useMemo((function(){return u&&n.get(u,b)}),[u,b]);return r.useEffect((function(){a.IS_MAPBOX_ENABLED&&t&&!B.current&&(B.current=new m.default.Map({container:D.current,style:"mapbox://styles/mapbox/dark-v9",center:h(v),zoom:1,attributionControl:!1,scrollZoom:!1}),B.current.addControl(new m.default.NavigationControl({showCompass:!1}),"bottom-right"),B.current.on("load",(function(){B.current.addSource("radius-circle",{type:"geojson",data:y}),B.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),B.current.addSource("wells",{type:"geojson",data:y}),B.current.addLayer({id:"wells",type:"circle",source:"wells",layout:{"circle-sort-key":["get","sortKey"]},paint:{"circle-radius":["get","radius"],"circle-color":["get","color"],"circle-opacity":["get","opacity"]}}),P(!0)})))}),[t]),r.useEffect((function(){return function(){B.current&&(B.current.remove(),B.current=null,j.current=null,C.current=null)}}),[]),r.useEffect((function(){if(B.current&&E&&t){if(!L)return B.current.getSource("radius-circle").setData(y),void(j.current=null);var e=function(e,r){for(var t=d.default(e,2),u=t[0],n=t[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,l=[],a=r/(111320*Math.cos(u*Math.PI/180)),i=r/110574,c=0;c<=o;c+=1){var s=c/o*(2*Math.PI);l.push([n+a*Math.cos(s),u+i*Math.sin(s)])}return l}(L,1609.34*s);B.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}}),j.current=e.reduce((function(e,r){return e.extend(r)}),new m.default.LngLatBounds)}}),[s,L,t,E]),r.useEffect((function(){if(B.current&&E&&t){var e=R.current;R.current=l;var o=c.map((function(e){return e.id})),a=n.sortBy(l,(function(e){return o.includes(e.id)})),s=[],d={},v=new m.default.LngLatBounds;a.forEach((function(e){var r=n.get(e,b);if(r&&g(r)){var t=u&&u.id===e.id,l=o.includes(e.id),a=t?10:5,i=t||l?"#00FFFF":n.get(p,e.formation,"#BDBDBD"),c=t||l?1:.3;d[e.id]=e,v.extend(h(r)),s.push({type:"Feature",geometry:{type:"Point",coordinates:h(r)},properties:{wellId:e.id,radius:a,color:i,opacity:c,sortKey:l?1:0}})}})),B.current.getSource("wells").setData({type:"FeatureCollection",features:s}),C.current=s.length?v:null;var y=B.current,D=null,M=function(e){y.getCanvas().style.cursor="pointer";var t=d[e.features[0].properties.wellId];if(t&&t.id!==D&&(D=t.id,w)){var u=document.createElement("div"),o=r.createElement(w,{well:t,color:n.get(p,t.formation,"#BDBDBD")});f.default.render(i.jsx(i.Fragment,{children:o}),u),F.current||(F.current=new m.default.Popup({closeButton:!1,maxWidth:"none"})),F.current.setLngLat(h(n.get(t,b))).setDOMContent(u).addTo(y)}},W=function(){var e;D=null,y.getCanvas().style.cursor="",null===(e=F.current)||void 0===e||e.remove()},P=function(e){var r=e.features[0].properties.wellId,t=u&&u.id===r;o.includes(r)&&!t?q(r):x(r)};return y.on("mousemove","wells",M),y.on("mouseleave","wells",W),y.on("click","wells",P),setTimeout((function(){B.current&&j.current&&l!==e&&B.current.fitBounds(j.current,{padding:5})}),500),function(){y.off("mousemove","wells",M),y.off("mouseleave","wells",W),y.off("click","wells",P)}}}),[u,l,c,t,E]),r.useEffect((function(){t&&setTimeout((function(){u?B.current&&j.current&&B.current.fitBounds(j.current,{padding:5}):B.current&&C.current&&B.current.fitBounds(C.current)}),500)}),[s,u,t,E]),i.jsx("div",{className:o.map,children:i.jsx("div",{className:o.mapMain,ref:D})})}w.propTypes={open:p.default.bool.isRequired,subjectWell:p.default.shape({id:p.default.number,formation:p.default.string}),wells:p.default.arrayOf(p.default.shape({})).isRequired,offsetWells:p.default.arrayOf(p.default.shape({})),radius:p.default.number.isRequired,formationColors:p.default.shape({}).isRequired,popUpFormatter:p.default.func,coordsDataPath:p.default.string,onAddOffsetWell:p.default.func.isRequired,onDeleteOffsetWell:p.default.func.isRequired},w.defaultProps={subjectWell:null,popUpFormatter:null,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var b=r.memo(w);module.exports=b;
2
2
  //# sourceMappingURL=Map.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sources":["../../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport mapboxgl from '~/config/mapboxGl';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n open,\n subjectWell,\n wells,\n offsetWells,\n radius,\n formationColors,\n popUpFormatter,\n coordsDataPath,\n onAddOffsetWell,\n onDeleteOffsetWell,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef();\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!open || mapRef.current) return;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n layout: {\n 'circle-sort-key': ['get', 'sortKey'],\n },\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n }, [open]);\n\n useEffect(\n () => () => {\n if (mapRef.current) {\n mapRef.current.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n }\n },\n []\n );\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, open, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n const offsetWellIds = offsetWells.map(well => well.id);\n const sortedWells = sortBy(wells, well => offsetWellIds.includes(well.id));\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n sortedWells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? DEFAULT_SUBJECT_WELL_MARKER_SIZE : DEFAULT_WELL_MARKER_SIZE;\n const color =\n isWellSubject || isWellOffset\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n // NOTE: sortKey keeps offset wells rendered on top (was sortedWells insertion order)\n properties: { wellId: well.id, radius: r, color, opacity, sortKey: isWellOffset ? 1 : 0 },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n popupRef.current?.remove();\n };\n\n const handleClick = e => {\n const { wellId } = e.features[0].properties;\n const isWellSubject = subjectWell && subjectWell.id === wellId;\n const isWellOffset = offsetWellIds.includes(wellId);\n\n if (isWellOffset && !isWellSubject) {\n onDeleteOffsetWell(wellId);\n } else {\n onAddOffsetWell(wellId);\n }\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n map.on('click', WELLS_ID, handleClick);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n map.off('click', WELLS_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWells, open, isMapReady]);\n\n useEffect(() => {\n if (!open) return;\n\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, open, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n open: PropTypes.bool.isRequired,\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n formationColors: PropTypes.shape({}).isRequired,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n onAddOffsetWell: PropTypes.func.isRequired,\n onDeleteOffsetWell: PropTypes.func.isRequired,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","open","subjectWell","wells","offsetWells","radius","formationColors","popUpFormatter","coordsDataPath","onAddOffsetWell","onDeleteOffsetWell","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","subjectWellCoords","useMemo","get","useEffect","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","id","source","paint","layout","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","push","sin","makeCirclePolygon","geometry","coordinates","reduce","bounds","coord","extend","LngLatBounds","prevWells","offsetWellIds","map","well","sortedWells","sortBy","includes","wellsById","forEach","coords","isWellSubject","isWellOffset","r","color","formation","opacity","properties","wellId","sortKey","length","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","jsx","_Fragment","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","_popupRef$current","handleClick","setTimeout","fitBounds","padding","off","className","styles","mapMain","ref","propTypes","PropTypes","bool","isRequired","shape","number","string","arrayOf","func","defaultProps","memo"],"mappings":"ieAWQA,EAAuBC,EAAMA,OAA7BD,mBAEFE,EAAiB,CAAC,WAAY,WAS9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAA,QAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EAWNC,GAAA,IAVDC,IAAAA,KACAC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,gBACAC,IAAAA,mBAEMC,EAAkBC,SAAO,MACzBC,EAASD,EAAAA,SACTE,EAAwBF,SAAO,MAC/BG,EAAmBH,SAAO,MAC1BI,EAAWJ,SAAO,MAClBK,EAAeL,EAAAA,SACeM,EAAAA,EAAQA,UAAC,GAAMC,EAAAtB,EAAAA,QAAAuB,EAAA,GAA5CC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAE1BI,EAAoBC,EAAAA,SAAQ,WAChC,OAAOtB,GAAeuB,EAAAA,IAAIvB,EAAaM,EACzC,GAAG,CAACN,EAAaM,IAwNjB,OArNAkB,EAAAA,WAAU,WACHzB,IAAQY,EAAOc,UAEpBd,EAAOc,QAAU,IAAIC,EAAQ,QAACC,IAAI,CAChCC,UAAWnB,EAAgBgB,QAC3BI,MAAO,iCACPC,OAAQtC,EAASJ,GACjB2C,KAAM,EACNC,oBAAoB,EACpBC,YAAY,IAGdtB,EAAOc,QAAQS,WACb,IAAIR,EAAAA,QAASS,kBAAkB,CAAEC,aAAa,IAC9C,gBAKFzB,EAAOc,QAAQY,GAAG,QAAQ,WACxB1B,EAAOc,QAAQa,UAhEI,gBAgEwB,CACzChD,KAAM,UACNiD,KAAMlD,IAERsB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EAASuI,aAAe,CACtBpI,YAAa,KACbK,eAAgB,KAChBC,eAAgB,gCAChBJ,YAAa,MAGf,IAAemI,EAAAA,EAAAA,KAAKxI"}
1
+ {"version":3,"file":"Map.js","sources":["../../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport mapboxgl from '~/config/mapboxGl';\nimport { IS_MAPBOX_ENABLED } from '~/config/mapbox';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n open,\n subjectWell,\n wells,\n offsetWells,\n radius,\n formationColors,\n popUpFormatter,\n coordsDataPath,\n onAddOffsetWell,\n onDeleteOffsetWell,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef();\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!IS_MAPBOX_ENABLED || !open || mapRef.current) return;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n layout: {\n 'circle-sort-key': ['get', 'sortKey'],\n },\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n }, [open]);\n\n useEffect(\n () => () => {\n if (mapRef.current) {\n mapRef.current.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n }\n },\n []\n );\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, open, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n const offsetWellIds = offsetWells.map(well => well.id);\n const sortedWells = sortBy(wells, well => offsetWellIds.includes(well.id));\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n sortedWells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? DEFAULT_SUBJECT_WELL_MARKER_SIZE : DEFAULT_WELL_MARKER_SIZE;\n const color =\n isWellSubject || isWellOffset\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n // NOTE: sortKey keeps offset wells rendered on top (was sortedWells insertion order)\n properties: { wellId: well.id, radius: r, color, opacity, sortKey: isWellOffset ? 1 : 0 },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n popupRef.current?.remove();\n };\n\n const handleClick = e => {\n const { wellId } = e.features[0].properties;\n const isWellSubject = subjectWell && subjectWell.id === wellId;\n const isWellOffset = offsetWellIds.includes(wellId);\n\n if (isWellOffset && !isWellSubject) {\n onDeleteOffsetWell(wellId);\n } else {\n onAddOffsetWell(wellId);\n }\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n map.on('click', WELLS_ID, handleClick);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n map.off('click', WELLS_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWells, open, isMapReady]);\n\n useEffect(() => {\n if (!open) return;\n\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, open, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n open: PropTypes.bool.isRequired,\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n formationColors: PropTypes.shape({}).isRequired,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n onAddOffsetWell: PropTypes.func.isRequired,\n onDeleteOffsetWell: PropTypes.func.isRequired,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","open","subjectWell","wells","offsetWells","radius","formationColors","popUpFormatter","coordsDataPath","onAddOffsetWell","onDeleteOffsetWell","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","subjectWellCoords","useMemo","get","useEffect","IS_MAPBOX_ENABLED","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","id","source","paint","layout","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","push","sin","makeCirclePolygon","geometry","coordinates","reduce","bounds","coord","extend","LngLatBounds","prevWells","offsetWellIds","map","well","sortedWells","sortBy","includes","wellsById","forEach","coords","isWellSubject","isWellOffset","r","color","formation","opacity","properties","wellId","sortKey","length","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","jsx","_Fragment","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","_popupRef$current","handleClick","setTimeout","fitBounds","padding","off","className","styles","mapMain","ref","propTypes","PropTypes","bool","isRequired","shape","number","string","arrayOf","func","defaultProps","memo"],"mappings":"2hBAYQA,EAAuBC,EAAMA,OAA7BD,mBAEFE,EAAiB,CAAC,WAAY,WAS9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAA,QAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EAWNC,GAAA,IAVDC,IAAAA,KACAC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,gBACAC,IAAAA,mBAEMC,EAAkBC,SAAO,MACzBC,EAASD,EAAAA,SACTE,EAAwBF,SAAO,MAC/BG,EAAmBH,SAAO,MAC1BI,EAAWJ,SAAO,MAClBK,EAAeL,EAAAA,SACeM,EAAAA,EAAQA,UAAC,GAAMC,EAAAtB,EAAAA,QAAAuB,EAAA,GAA5CC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAE1BI,EAAoBC,EAAAA,SAAQ,WAChC,OAAOtB,GAAeuB,EAAAA,IAAIvB,EAAaM,EACzC,GAAG,CAACN,EAAaM,IAwNjB,OArNAkB,EAAAA,WAAU,WACHC,EAAAA,mBAAsB1B,IAAQY,EAAOe,UAE1Cf,EAAOe,QAAU,IAAIC,EAAQ,QAACC,IAAI,CAChCC,UAAWpB,EAAgBiB,QAC3BI,MAAO,iCACPC,OAAQvC,EAASJ,GACjB4C,KAAM,EACN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AAA,QAAUI,OAAOF,WACzB3H,gBAAiByH,EAAS,QAACG,MAAM,CAAA,GAAID,WACrC1H,eAAgBwH,EAAS,QAACO,KAC1B9H,eAAgBuH,EAAS,QAACK,OAC1B3H,gBAAiBsH,EAAAA,QAAUO,KAAKL,WAChCvH,mBAAoBqH,EAAAA,QAAUO,KAAKL,YAGrClI,EAASwI,aAAe,CACtBrI,YAAa,KACbK,eAAgB,KAChBC,eAAgB,gCAChBJ,YAAa,MAGf,IAAeoI,EAAAA,EAAAA,KAAKzI"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),o=require("react/jsx-runtime"),s=require("react"),l=require("@vis.gl/react-mapbox"),a=require("classnames");require("mapbox-gl/dist/mapbox-gl.css");var i=require("./components/MapLayers/MapLayers.js"),t=require("./components/MapOverlayControls/MapOverlayControls.js"),n=require("./components/MapResizeVeil/MapResizeVeil.js"),r=require("./hooks/useFlyToWell.js"),d=require("./hooks/useIsMapCompact.js"),u=require("./hooks/useMapResizeOnContainer.js"),c=require("./hooks/useOffsetWellMapState.js"),h=require("./constants.js"),p=require("./OffsetWellMap.module.css.js"),g=require("../../../../../componentsV2/LoaderLinear/LoaderLinear.js"),f=require("../../../../../config/mapbox/index.js");require("../../../../../config/mapboxGl/index.js");var m=require("mapbox-gl");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var M=v(e),y=v(l),O=v(a),S=v(m);function C(e,o){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);o&&(l=l.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),s.push.apply(s,l)}return s}function w(e){for(var o=1;o<arguments.length;o++){var s=null!=arguments[o]?arguments[o]:{};o%2?C(Object(s),!0).forEach((function(o){M.default(e,o,s[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):C(Object(s)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(s,o))}))}return e}var b=s.forwardRef((function(e,l){var a=e.subjectWell,m=void 0===a?null:a,v=e.wells,M=e.offsetWellIds,C=e.handleChangeOffsetWell,b=e.onBatchSelectWells,R=e.activeWellId,j=e.isClickable,W=void 0===j||j,L=e.selectionZone,D=e.onSelectionZoneConfirm,Z=e.shouldRecenter,x=e.onRecenterComplete,I=e.isResizing,P=void 0!==I&&I,A=e.classes,q=void 0===A?{}:A,E=c.useOffsetWellMapState({subjectWell:m,wells:v,offsetWellIds:M,handleChangeOffsetWell:C,onBatchSelectWells:b,activeWellId:null!=R?R:null,isClickable:W,selectionZone:L,onSelectionZoneConfirm:D,shouldRecenter:Z,onRecenterComplete:x});r.useFlyToWell(l,E.mapRef,v,E.isMapReady);var T=E.showRadiusInput&&null!==E.drawingRadiusMiles,k=d.useIsMapCompact(),V=k.ref,N=k.isCompact&&T,G=u.useMapResizeOnContainer(E.mapRef,P),z=s.useCallback((function(e){V(e),G(e)}),[V,G]);return o.jsxs("div",{ref:z,className:O.default(p.mapView,q.root),children:[o.jsxs(y.default,w(w({ref:E.mapRef},E.viewState),{},{onMove:E.handleMove,onMoveStart:E.handleMoveStart,onMoveEnd:E.handleMoveEnd,onResize:E.tileSafeOnResize,onLoad:E.handleMapLoad,mapboxAccessToken:f.MAP_BOX_ACCESS_TOKEN,mapLib:S.default,mapStyle:h.MapConfig.Styles[E.mapStyle],style:{borderRadius:"8px"},scrollZoom:!0,doubleClickZoom:!0,boxZoom:!1,attributionControl:!1,interactiveLayerIds:[h.MapConfig.LayerIds.WellsClusters,h.MapConfig.LayerIds.WellsUnclustered],onClick:E.handleMapClick,onMouseMove:E.handleMouseMove,onMouseLeave:E.handleMouseLeave,onDblClick:E.handleZoomInWithSync,onDragStart:E.handleDragStart,onDragEnd:E.handleDragEnd,onMouseDown:E.handleMouseDown,cursor:E.cursor,children:[(E.isTileLoading&&!E.isTooZoomedOut||E.isAllWellsLoading)&&o.jsx(g.LoaderLinear,{type:"fancy",size:"medium",className:p.mapLoader}),o.jsx(i.MapLayers,{wellsGeoJSON:E.wellsGeoJSON,highlightGeoJSON:E.highlightGeoJSON,activeHighlightGeoJSON:E.activeHighlightGeoJSON,loadingTilesGeoJSON:E.loadingTilesGeoJSON,hoveredWell:E.hoveredWell,mapStyle:E.mapStyle,isSatellite:E.isSatellite,clusterColorExpression:E.clusterColorExpression,isRadiusToolActive:E.isRadiusToolActive,radiusState:E.radiusState,radiusDrawingPreviewCircle:E.radiusDrawingPreviewCircle,isRadiusHoveringEdge:E.isRadiusHoveringEdge,isRadiusDrawingDragging:E.isRadiusDrawingDragging,showGhostZone:E.showGhostZone,selectionZone:L,isTooZoomedOut:E.isTooZoomedOut,isLoadAllWells:E.isLoadAllWells,isActiveWellIsSubjectWell:E.isActiveWellIsSubjectWell,isLassoActive:E.isLassoActive,isMapReady:E.isMapReady,polygonCoords:E.polygonCoords,drawRef:E.drawRef,handleDrawCreate:E.handleDrawCreate,handleDrawUpdate:E.handleDrawUpdate,handleDrawDelete:E.handleDrawDelete,handleModeChange:E.handleModeChange,handleSelectionChange:E.handleSelectionChange,subjectWellCoords:E.subjectWellCoords,subjectWell:m,handleSubjectWellMouseEnter:E.handleSubjectWellMouseEnter,handleSubjectWellMouseLeave:E.handleSubjectWellMouseLeave,hoveredCluster:E.hoveredCluster,tooltipAnchor:E.tooltipAnchor,tooltipOffset:E.tooltipOffset,isViewOnly:E.isViewOnly,isClickable:W})]})),o.jsx(n.MapResizeVeil,{isResizing:P}),o.jsx(t.MapOverlayControls,{showRadiusInput:E.showRadiusInput,drawingRadiusMiles:E.drawingRadiusMiles,setDrawingRadiusMiles:E.setDrawingRadiusMiles,isSatellite:E.isSatellite,handleZoomInWithSync:E.handleZoomInWithSync,handleZoomOutWithSync:E.handleZoomOutWithSync,handleResetZoom:E.handleResetZoom,canZoomIn:E.canZoomIn,canZoomOut:E.canZoomOut,isZoomReset:E.isZoomReset,isRadiusToolActive:E.isRadiusToolActive,handleRadiusToggle:E.handleRadiusToggle,isLassoActive:E.isLassoActive,handleLassoToggle:E.handleLassoToggle,distance:E.distance,mapStyle:E.mapStyle,setMapStyle:E.setMapStyle,isViewOnly:E.isViewOnly,hintsRef:E.hintsRef,hintsMode:E.hintsMode,areHintsCompact:N,boxState:E.boxState,isDrawing:E.isDrawing,drawingPointCount:E.drawingPointCount,isEditingPolygon:E.isEditingPolygon,isEditingVertices:E.isEditingVertices,hasValidPolygon:!!E.hasValidPolygon,effectiveZoomedOut:E.effectiveZoomedOut,isLoadAllWells:E.isLoadAllWells,lassoPhase:E.lassoState.phase,radiusPhase:E.radiusState.phase,wellsInBoxCount:E.wellsInBoxCount,toast:E.toast})]})}));b.displayName="OffsetWellMap",exports.OffsetWellMap=b;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),o=require("react/jsx-runtime"),s=require("react"),l=require("@vis.gl/react-mapbox"),a=require("classnames");require("mapbox-gl/dist/mapbox-gl.css");var i=require("./components/MapLayers/MapLayers.js"),t=require("./components/MapOverlayControls/MapOverlayControls.js"),n=require("./components/MapResizeVeil/MapResizeVeil.js"),r=require("./hooks/useFlyToWell.js"),d=require("./hooks/useIsMapCompact.js"),u=require("./hooks/useMapResizeOnContainer.js"),c=require("./hooks/useOffsetWellMapState.js"),h=require("./constants.js"),p=require("./OffsetWellMap.module.css.js"),g=require("../../../../../componentsV2/LoaderLinear/LoaderLinear.js"),f=require("../../../../../config/mapbox/index.js");require("../../../../../config/mapboxGl/index.js");var m=require("mapbox-gl");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var M=v(e),O=v(l),S=v(a),y=v(m);function C(e,o){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);o&&(l=l.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),s.push.apply(s,l)}return s}function w(e){for(var o=1;o<arguments.length;o++){var s=null!=arguments[o]?arguments[o]:{};o%2?C(Object(s),!0).forEach((function(o){M.default(e,o,s[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):C(Object(s)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(s,o))}))}return e}var b=s.forwardRef((function(e,l){var a=e.subjectWell,m=void 0===a?null:a,v=e.wells,M=e.offsetWellIds,C=e.handleChangeOffsetWell,b=e.onBatchSelectWells,R=e.activeWellId,j=e.isClickable,W=void 0===j||j,L=e.selectionZone,D=e.onSelectionZoneConfirm,Z=e.shouldRecenter,x=e.onRecenterComplete,A=e.isResizing,I=void 0!==A&&A,P=e.classes,E=void 0===P?{}:P,q=c.useOffsetWellMapState({subjectWell:m,wells:v,offsetWellIds:M,handleChangeOffsetWell:C,onBatchSelectWells:b,activeWellId:null!=R?R:null,isClickable:W,selectionZone:L,onSelectionZoneConfirm:D,shouldRecenter:Z,onRecenterComplete:x});r.useFlyToWell(l,q.mapRef,v,q.isMapReady);var T=q.showRadiusInput&&null!==q.drawingRadiusMiles,k=d.useIsMapCompact(),N=k.ref,V=k.isCompact&&T,G=u.useMapResizeOnContainer(q.mapRef,I),z=s.useCallback((function(e){N(e),G(e)}),[N,G]),J=S.default(p.mapView,E.root);return f.IS_MAPBOX_ENABLED?o.jsxs("div",{ref:z,className:J,children:[o.jsxs(O.default,w(w({ref:q.mapRef},q.viewState),{},{onMove:q.handleMove,onMoveStart:q.handleMoveStart,onMoveEnd:q.handleMoveEnd,onResize:q.tileSafeOnResize,onLoad:q.handleMapLoad,mapboxAccessToken:f.MAP_BOX_ACCESS_TOKEN,mapLib:y.default,mapStyle:h.MapConfig.Styles[q.mapStyle],style:{borderRadius:"8px"},scrollZoom:!0,doubleClickZoom:!0,boxZoom:!1,attributionControl:!1,interactiveLayerIds:[h.MapConfig.LayerIds.WellsClusters,h.MapConfig.LayerIds.WellsUnclustered],onClick:q.handleMapClick,onMouseMove:q.handleMouseMove,onMouseLeave:q.handleMouseLeave,onDblClick:q.handleZoomInWithSync,onDragStart:q.handleDragStart,onDragEnd:q.handleDragEnd,onMouseDown:q.handleMouseDown,cursor:q.cursor,children:[(q.isTileLoading&&!q.isTooZoomedOut||q.isAllWellsLoading)&&o.jsx(g.LoaderLinear,{type:"fancy",size:"medium",className:p.mapLoader}),o.jsx(i.MapLayers,{wellsGeoJSON:q.wellsGeoJSON,highlightGeoJSON:q.highlightGeoJSON,activeHighlightGeoJSON:q.activeHighlightGeoJSON,loadingTilesGeoJSON:q.loadingTilesGeoJSON,hoveredWell:q.hoveredWell,mapStyle:q.mapStyle,isSatellite:q.isSatellite,clusterColorExpression:q.clusterColorExpression,isRadiusToolActive:q.isRadiusToolActive,radiusState:q.radiusState,radiusDrawingPreviewCircle:q.radiusDrawingPreviewCircle,isRadiusHoveringEdge:q.isRadiusHoveringEdge,isRadiusDrawingDragging:q.isRadiusDrawingDragging,showGhostZone:q.showGhostZone,selectionZone:L,isTooZoomedOut:q.isTooZoomedOut,isLoadAllWells:q.isLoadAllWells,isActiveWellIsSubjectWell:q.isActiveWellIsSubjectWell,isLassoActive:q.isLassoActive,isMapReady:q.isMapReady,polygonCoords:q.polygonCoords,drawRef:q.drawRef,handleDrawCreate:q.handleDrawCreate,handleDrawUpdate:q.handleDrawUpdate,handleDrawDelete:q.handleDrawDelete,handleModeChange:q.handleModeChange,handleSelectionChange:q.handleSelectionChange,subjectWellCoords:q.subjectWellCoords,subjectWell:m,handleSubjectWellMouseEnter:q.handleSubjectWellMouseEnter,handleSubjectWellMouseLeave:q.handleSubjectWellMouseLeave,hoveredCluster:q.hoveredCluster,tooltipAnchor:q.tooltipAnchor,tooltipOffset:q.tooltipOffset,isViewOnly:q.isViewOnly,isClickable:W})]})),o.jsx(n.MapResizeVeil,{isResizing:I}),o.jsx(t.MapOverlayControls,{showRadiusInput:q.showRadiusInput,drawingRadiusMiles:q.drawingRadiusMiles,setDrawingRadiusMiles:q.setDrawingRadiusMiles,isSatellite:q.isSatellite,handleZoomInWithSync:q.handleZoomInWithSync,handleZoomOutWithSync:q.handleZoomOutWithSync,handleResetZoom:q.handleResetZoom,canZoomIn:q.canZoomIn,canZoomOut:q.canZoomOut,isZoomReset:q.isZoomReset,isRadiusToolActive:q.isRadiusToolActive,handleRadiusToggle:q.handleRadiusToggle,isLassoActive:q.isLassoActive,handleLassoToggle:q.handleLassoToggle,distance:q.distance,mapStyle:q.mapStyle,setMapStyle:q.setMapStyle,isViewOnly:q.isViewOnly,hintsRef:q.hintsRef,hintsMode:q.hintsMode,areHintsCompact:V,boxState:q.boxState,isDrawing:q.isDrawing,drawingPointCount:q.drawingPointCount,isEditingPolygon:q.isEditingPolygon,isEditingVertices:q.isEditingVertices,hasValidPolygon:!!q.hasValidPolygon,effectiveZoomedOut:q.effectiveZoomedOut,isLoadAllWells:q.isLoadAllWells,lassoPhase:q.lassoState.phase,radiusPhase:q.radiusState.phase,wellsInBoxCount:q.wellsInBoxCount,toast:q.toast})]}):o.jsx("div",{className:J})}));b.displayName="OffsetWellMap",exports.OffsetWellMap=b;
2
2
  //# sourceMappingURL=OffsetWellMap.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@vis.gl/react-mapbox");require("mapbox-gl/dist/mapbox-gl.css");var s=require("../Map/OffsetWellMap/constants.js");require("../../stores/user-settings-store/UserSettingsStoreProvider.js");var o=require("../../stores/user-settings-store/useUserSettingsStore.js");require("../../stores/user-settings-store/UserSettingsStoreContext.js");var i=require("./MapPreloader.module.css.js"),a=require("../../../../config/mapbox/index.js");require("../../../../config/mapboxGl/index.js");var n=require("mapbox-gl");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),d=u(n),p=r.memo((function(){var r,t=null!==(r=o.useUserSettingsStore((function(e){return e.settings.mapStyle})))&&void 0!==r?r:"satellite";return e.jsx("div",{className:i.container,children:e.jsx(l.default,{mapboxAccessToken:a.MAP_BOX_ACCESS_TOKEN,mapLib:d.default,mapStyle:s.MapConfig.Styles[t],longitude:s.MapConfig.DefaultCoords.longitude,latitude:s.MapConfig.DefaultCoords.latitude,zoom:s.MapConfig.Zoom.Initial,interactive:!1,attributionControl:!1})})}));p.displayName="MapPreloader",exports.MapPreloader=p;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@vis.gl/react-mapbox");require("mapbox-gl/dist/mapbox-gl.css");var s=require("../Map/OffsetWellMap/constants.js");require("../../stores/user-settings-store/UserSettingsStoreProvider.js");var o=require("../../stores/user-settings-store/useUserSettingsStore.js");require("../../stores/user-settings-store/UserSettingsStoreContext.js");var i=require("./MapPreloader.module.css.js"),a=require("../../../../config/mapbox/index.js");require("../../../../config/mapboxGl/index.js");var n=require("mapbox-gl");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),d=u(n),p=r.memo((function(){var r,t=null!==(r=o.useUserSettingsStore((function(e){return e.settings.mapStyle})))&&void 0!==r?r:"satellite";return a.IS_MAPBOX_ENABLED?e.jsx("div",{className:i.container,children:e.jsx(l.default,{mapboxAccessToken:a.MAP_BOX_ACCESS_TOKEN,mapLib:d.default,mapStyle:s.MapConfig.Styles[t],longitude:s.MapConfig.DefaultCoords.longitude,latitude:s.MapConfig.DefaultCoords.latitude,zoom:s.MapConfig.Zoom.Initial,interactive:!1,attributionControl:!1})}):null}));p.displayName="MapPreloader",exports.MapPreloader=p;
2
2
  //# sourceMappingURL=MapPreloader.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),i=require("react-dom"),u=require("lodash"),n=require("@material-ui/core/styles"),s=require("../components/FiltersToggler.js"),o=require("../utils.js"),l=require("../constants.js"),a=require("../../../config/theme/index.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/regenerator"),require("highcharts"),require("highcharts/highcharts-more"),require("highcharts/modules/solid-gauge"),require("highcharts/modules/heatmap"),require("highcharts/modules/boost"),require("highcharts/modules/exporting"),require("highcharts/modules/xrange"),require("highcharts/modules/dumbbell"),require("highcharts/modules/pattern-fill"),require("highcharts/modules/annotations"),require("highcharts-multicolor-series"),require("dompurify"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf"),require("@babel/runtime/helpers/toArray"),require("@babel/runtime/helpers/toConsumableArray"),require("../../../clients/subscriptions/constants.js"),require("../../../clients/subscriptions.v1.js"),require("../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../config/extendNative.js");var c=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=d(e),f=d(r),b=d(i);function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){h.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.useAppFilterTogglerWidth=function(){var e=t.useState(null),r=f.default(e,2),i=r[0],u=r[1];return t.useEffect((function(){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",document.body.appendChild(e),b.default.render(c.jsx(n.MuiThemeProvider,{theme:a.darkTheme,children:c.jsx(s,{})}),e,(function(){var r=e.getBoundingClientRect();e.remove(),u(r.width)}))}),[]),i},exports.useComonentsWidth=function(e){var r=t.useRef(),i=t.useState(null),n=f.default(i,2),s=n[0],o=n[1],l=t.useRef({}),a=e.filter((function(e){return!!e})),d=c.jsx("div",{ref:r,style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:a.map((function(e,r){return c.jsx("div",{"data-key":null==e?void 0:e.key,style:{position:"absolute"},children:e},r)}))});return t.useEffect((function(){var e;if(!u.isEqual(a,l.current)){var t=Array.from(null===(e=r.current)||void 0===e?void 0:e.childNodes).reduce((function(e,r){var t,i=null==r||null===(t=r.getAttribute)||void 0===t?void 0:t.call(r,"data-key"),u=null==r?void 0:r.getBoundingClientRect().width;return m(m({},e),{},h.default({},i,u))}),{});Object.values(t).length===a.length&&(u.isEqual(s,t)||o(t)),l.current=a}})),{componentsWidth:s,hiddenElements:d}},exports.useFilterLayout=function(e,r,i,u){var n=t.useState(null),s=f.default(n,2),a=s[0],c=s[1];return t.useEffect((function(){if(u&&r){var t=o.getStartComponent(e),n=o.getMiddleComponent(e),s=o.getEndComponents(e),a=t&&n&&!s,d=t&&!n&&s,h=t&&n&&s;if(t&&!n&&!s){var f=r[t.key];if(f<=u)return void c(l.LARGE_SIZE_LAYOUT);if(f<=u/2)return void c(l.MEDIUM_SIZE_LAYOUT)}else if(a||d){var b=r[t.key],p=a?r[n.key]:r[s.key];if(b+p<=u)return void c(l.LARGE_SIZE_LAYOUT);if(i+p<=u)return void c(l.MEDIUM_SIZE_LAYOUT)}else if(h){var m=r[t.key],v=r[n.key],g=r[s.key];if(m+v+g<=u)return void c(l.LARGE_SIZE_LAYOUT);if(i+v+g<=u)return void c(l.MEDIUM_SIZE_LAYOUT);if(i+g<=u)return void c(l.SMALL_SIZE_LAYOUT)}c(l.SMALL_SIZE_LAYOUT)}}),[r,u]),a};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),i=require("react-dom"),u=require("lodash"),n=require("@material-ui/core/styles"),s=require("../components/FiltersToggler.js"),o=require("../utils.js"),l=require("../constants.js"),a=require("../../../config/theme/index.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/regenerator"),require("highcharts"),require("highcharts/highcharts-more"),require("highcharts/modules/solid-gauge"),require("highcharts/modules/heatmap"),require("highcharts/modules/boost"),require("highcharts/modules/exporting"),require("highcharts/modules/xrange"),require("highcharts/modules/dumbbell"),require("highcharts/modules/pattern-fill"),require("highcharts/modules/annotations"),require("highcharts-multicolor-series"),require("dompurify"),require("../../../config/mapbox/index.js"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf"),require("@babel/runtime/helpers/toArray"),require("@babel/runtime/helpers/toConsumableArray"),require("../../../clients/subscriptions/constants.js"),require("../../../clients/subscriptions.v1.js"),require("../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../config/extendNative.js");var c=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=d(e),f=d(r),b=d(i);function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){h.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.useAppFilterTogglerWidth=function(){var e=t.useState(null),r=f.default(e,2),i=r[0],u=r[1];return t.useEffect((function(){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",document.body.appendChild(e),b.default.render(c.jsx(n.MuiThemeProvider,{theme:a.darkTheme,children:c.jsx(s,{})}),e,(function(){var r=e.getBoundingClientRect();e.remove(),u(r.width)}))}),[]),i},exports.useComonentsWidth=function(e){var r=t.useRef(),i=t.useState(null),n=f.default(i,2),s=n[0],o=n[1],l=t.useRef({}),a=e.filter((function(e){return!!e})),d=c.jsx("div",{ref:r,style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:a.map((function(e,r){return c.jsx("div",{"data-key":null==e?void 0:e.key,style:{position:"absolute"},children:e},r)}))});return t.useEffect((function(){var e;if(!u.isEqual(a,l.current)){var t=Array.from(null===(e=r.current)||void 0===e?void 0:e.childNodes).reduce((function(e,r){var t,i=null==r||null===(t=r.getAttribute)||void 0===t?void 0:t.call(r,"data-key"),u=null==r?void 0:r.getBoundingClientRect().width;return m(m({},e),{},h.default({},i,u))}),{});Object.values(t).length===a.length&&(u.isEqual(s,t)||o(t)),l.current=a}})),{componentsWidth:s,hiddenElements:d}},exports.useFilterLayout=function(e,r,i,u){var n=t.useState(null),s=f.default(n,2),a=s[0],c=s[1];return t.useEffect((function(){if(u&&r){var t=o.getStartComponent(e),n=o.getMiddleComponent(e),s=o.getEndComponents(e),a=t&&n&&!s,d=t&&!n&&s,h=t&&n&&s;if(t&&!n&&!s){var f=r[t.key];if(f<=u)return void c(l.LARGE_SIZE_LAYOUT);if(f<=u/2)return void c(l.MEDIUM_SIZE_LAYOUT)}else if(a||d){var b=r[t.key],p=a?r[n.key]:r[s.key];if(b+p<=u)return void c(l.LARGE_SIZE_LAYOUT);if(i+p<=u)return void c(l.MEDIUM_SIZE_LAYOUT)}else if(h){var m=r[t.key],g=r[n.key],v=r[s.key];if(m+g+v<=u)return void c(l.LARGE_SIZE_LAYOUT);if(i+g+v<=u)return void c(l.MEDIUM_SIZE_LAYOUT);if(i+v<=u)return void c(l.SMALL_SIZE_LAYOUT)}c(l.SMALL_SIZE_LAYOUT)}}),[r,u]),a};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/components/PinnableFilters/effects/index.js"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { isEqual } from 'lodash';\nimport { MuiThemeProvider } from '@material-ui/core/styles';\n\nimport FiltersToggler from '../components/FiltersToggler';\nimport { getEndComponents, getMiddleComponent, getStartComponent } from '../utils';\nimport { LARGE_SIZE_LAYOUT, MEDIUM_SIZE_LAYOUT, SMALL_SIZE_LAYOUT } from '../constants';\n\nimport { theme } from '~/config';\n\n// NOTE: Determine layout according to the width of elements\nexport function useFilterLayout(components, componentsWidth, appFilterTogglerWidth, appWidth) {\n const [layout, setLayout] = useState(null);\n\n useEffect(() => {\n if (!appWidth || !componentsWidth) {\n return;\n }\n\n const filtersComponent = getStartComponent(components);\n const goalComponent = getMiddleComponent(components);\n const switchComponent = getEndComponents(components);\n\n const hasFiltersOnly = filtersComponent && !goalComponent && !switchComponent;\n const hasFiltersAndGoals = filtersComponent && goalComponent && !switchComponent;\n const hasFiltersAndSwitch = filtersComponent && !goalComponent && switchComponent;\n const hasAll = filtersComponent && goalComponent && switchComponent;\n\n if (hasFiltersOnly) {\n const filtersWidth = componentsWidth[filtersComponent.key];\n\n if (filtersWidth <= appWidth) {\n setLayout(LARGE_SIZE_LAYOUT);\n return;\n }\n\n if (filtersWidth <= appWidth / 2) {\n setLayout(MEDIUM_SIZE_LAYOUT);\n return;\n }\n } else if (hasFiltersAndGoals || hasFiltersAndSwitch) {\n const startWidth = componentsWidth[filtersComponent.key];\n const endWidth = hasFiltersAndGoals\n ? componentsWidth[goalComponent.key]\n : componentsWidth[switchComponent.key];\n\n if (startWidth + endWidth <= appWidth) {\n setLayout(LARGE_SIZE_LAYOUT);\n return;\n }\n\n if (appFilterTogglerWidth + endWidth <= appWidth) {\n setLayout(MEDIUM_SIZE_LAYOUT);\n return;\n }\n } else if (hasAll) {\n const startWidth = componentsWidth[filtersComponent.key];\n const middleWidth = componentsWidth[goalComponent.key];\n const endWidth = componentsWidth[switchComponent.key];\n\n if (startWidth + middleWidth + endWidth <= appWidth) {\n setLayout(LARGE_SIZE_LAYOUT);\n return;\n }\n\n if (appFilterTogglerWidth + middleWidth + endWidth <= appWidth) {\n setLayout(MEDIUM_SIZE_LAYOUT);\n return;\n }\n\n if (appFilterTogglerWidth + endWidth <= appWidth) {\n setLayout(SMALL_SIZE_LAYOUT);\n return;\n }\n }\n\n setLayout(SMALL_SIZE_LAYOUT);\n }, [componentsWidth, appWidth]);\n\n return layout;\n}\n\n// NOTE: Calculate the width of child components here\nexport function useComonentsWidth(components) {\n // const widthRef = useRef({});\n const hiddenElementsRef = useRef();\n const [widthDict, setWidthDict] = useState(null);\n const prevComponentsRef = useRef({});\n\n const validComponents = components.filter(component => !!component);\n const hiddenElements = (\n <div\n ref={hiddenElementsRef}\n style={{ position: 'absolute', width: 0, height: 0, overflow: 'hidden' }}\n >\n {validComponents.map((component, index) => {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <div key={index} data-key={component?.key} style={{ position: 'absolute' }}>\n {component}\n </div>\n );\n })}\n </div>\n );\n\n // NOTE: Calcualte width of each components\n useEffect(() => {\n // NOTE: Don't calcuate width again\n if (isEqual(validComponents, prevComponentsRef.current)) {\n return;\n }\n\n const nodesArray = Array.from(hiddenElementsRef.current?.childNodes);\n const sizeMap = nodesArray.reduce((acc, node) => {\n const key = node?.getAttribute?.('data-key');\n const value = node?.getBoundingClientRect().width;\n\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n\n if (Object.values(sizeMap).length === validComponents.length) {\n if (!isEqual(widthDict, sizeMap)) {\n setWidthDict(sizeMap);\n }\n }\n\n prevComponentsRef.current = validComponents;\n });\n\n return { componentsWidth: widthDict, hiddenElements };\n}\n\n// NOTE: Calculate the width of Toggler Component\nexport function useAppFilterTogglerWidth() {\n const [width, setWidth] = useState(null);\n\n useEffect(() => {\n const element = document.createElement('div');\n element.style.position = 'absolute';\n element.style.visibility = 'hidden';\n document.body.appendChild(element);\n\n ReactDOM.render(\n <MuiThemeProvider theme={theme.darkTheme}>\n <FiltersToggler />\n </MuiThemeProvider>,\n element,\n () => {\n const dims = element.getBoundingClientRect();\n element.remove();\n setWidth(dims.width);\n }\n );\n }, []);\n\n return width;\n}\n"],"names":["useState","_useState6","_slicedToArray","_useState5","width","setWidth","useEffect","element","document","createElement","style","position","visibility","body","appendChild","ReactDOM","render","_jsx","jsx","MuiThemeProvider","theme","darkTheme","children","FiltersToggler","dims","getBoundingClientRect","remove","components","hiddenElementsRef","useRef","_useState4","_useState3","widthDict","setWidthDict","prevComponentsRef","validComponents","filter","component","hiddenElements","ref","height","overflow","map","index","key","_hiddenElementsRef$cu","isEqual","current","sizeMap","Array","from","childNodes","reduce","acc","node","_node$getAttribute","getAttribute","call","value","_objectSpread","_defineProperty","Object","values","length","componentsWidth","appFilterTogglerWidth","appWidth","_useState2","_useState","layout","setLayout","filtersComponent","getStartComponent","goalComponent","getMiddleComponent","switchComponent","getEndComponents","hasFiltersAndGoals","hasFiltersAndSwitch","hasAll","filtersWidth","LARGE_SIZE_LAYOUT","MEDIUM_SIZE_LAYOUT","startWidth","endWidth","middleWidth","SMALL_SIZE_LAYOUT"],"mappings":"6yEA0IO,WACL,IAA0BA,EAAAA,EAAQA,SAAC,MAAKC,EAAAC,EAAAA,QAAAC,EAAA,GAAjCC,EAAKH,EAAA,GAAEI,EAAQJ,EAAA,GAqBtB,OAnBAK,EAAAA,WAAU,WACR,IAAMC,EAAUC,SAASC,cAAc,OACvCF,EAAQG,MAAMC,SAAW,WACzBJ,EAAQG,MAAME,WAAa,SAC3BJ,SAASK,KAAKC,YAAYP,GAE1BQ,UAASC,OACPC,EAAAC,IAACC,mBAAgB,CAACC,MAAOA,EAAgBC,UAAAC,SACvCL,EAAAA,IAACM,EAAc,MAEjBhB,GACA,WACE,IAAMiB,EAAOjB,EAAQkB,wBACrBlB,EAAQmB,SACR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AG,CAACtB,EAAiBE,IAEdG,CACT"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/PinnableFilters/effects/index.js"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { isEqual } from 'lodash';\nimport { MuiThemeProvider } from '@material-ui/core/styles';\n\nimport FiltersToggler from '../components/FiltersToggler';\nimport { getEndComponents, getMiddleComponent, getStartComponent } from '../utils';\nimport { LARGE_SIZE_LAYOUT, MEDIUM_SIZE_LAYOUT, SMALL_SIZE_LAYOUT } from '../constants';\n\nimport { theme } from '~/config';\n\n// NOTE: Determine layout according to the width of elements\nexport function useFilterLayout(components, componentsWidth, appFilterTogglerWidth, appWidth) {\n const [layout, setLayout] = useState(null);\n\n useEffect(() => {\n if (!appWidth || !componentsWidth) {\n return;\n }\n\n const filtersComponent = getStartComponent(components);\n const goalComponent = getMiddleComponent(components);\n const switchComponent = getEndComponents(components);\n\n const hasFiltersOnly = filtersComponent && !goalComponent && !switchComponent;\n const hasFiltersAndGoals = filtersComponent && goalComponent && !switchComponent;\n const hasFiltersAndSwitch = filtersComponent && !goalComponent && switchComponent;\n const hasAll = filtersComponent && goalComponent && switchComponent;\n\n if (hasFiltersOnly) {\n const filtersWidth = componentsWidth[filtersComponent.key];\n\n if (filtersWidth <= appWidth) {\n setLayout(LARGE_SIZE_LAYOUT);\n return;\n }\n\n if (filtersWidth <= appWidth / 2) {\n setLayout(MEDIUM_SIZE_LAYOUT);\n return;\n }\n } else if (hasFiltersAndGoals || hasFiltersAndSwitch) {\n const startWidth = componentsWidth[filtersComponent.key];\n const endWidth = hasFiltersAndGoals\n ? componentsWidth[goalComponent.key]\n : componentsWidth[switchComponent.key];\n\n if (startWidth + endWidth <= appWidth) {\n setLayout(LARGE_SIZE_LAYOUT);\n return;\n }\n\n if (appFilterTogglerWidth + endWidth <= appWidth) {\n setLayout(MEDIUM_SIZE_LAYOUT);\n return;\n }\n } else if (hasAll) {\n const startWidth = componentsWidth[filtersComponent.key];\n const middleWidth = componentsWidth[goalComponent.key];\n const endWidth = componentsWidth[switchComponent.key];\n\n if (startWidth + middleWidth + endWidth <= appWidth) {\n setLayout(LARGE_SIZE_LAYOUT);\n return;\n }\n\n if (appFilterTogglerWidth + middleWidth + endWidth <= appWidth) {\n setLayout(MEDIUM_SIZE_LAYOUT);\n return;\n }\n\n if (appFilterTogglerWidth + endWidth <= appWidth) {\n setLayout(SMALL_SIZE_LAYOUT);\n return;\n }\n }\n\n setLayout(SMALL_SIZE_LAYOUT);\n }, [componentsWidth, appWidth]);\n\n return layout;\n}\n\n// NOTE: Calculate the width of child components here\nexport function useComonentsWidth(components) {\n // const widthRef = useRef({});\n const hiddenElementsRef = useRef();\n const [widthDict, setWidthDict] = useState(null);\n const prevComponentsRef = useRef({});\n\n const validComponents = components.filter(component => !!component);\n const hiddenElements = (\n <div\n ref={hiddenElementsRef}\n style={{ position: 'absolute', width: 0, height: 0, overflow: 'hidden' }}\n >\n {validComponents.map((component, index) => {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <div key={index} data-key={component?.key} style={{ position: 'absolute' }}>\n {component}\n </div>\n );\n })}\n </div>\n );\n\n // NOTE: Calcualte width of each components\n useEffect(() => {\n // NOTE: Don't calcuate width again\n if (isEqual(validComponents, prevComponentsRef.current)) {\n return;\n }\n\n const nodesArray = Array.from(hiddenElementsRef.current?.childNodes);\n const sizeMap = nodesArray.reduce((acc, node) => {\n const key = node?.getAttribute?.('data-key');\n const value = node?.getBoundingClientRect().width;\n\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n\n if (Object.values(sizeMap).length === validComponents.length) {\n if (!isEqual(widthDict, sizeMap)) {\n setWidthDict(sizeMap);\n }\n }\n\n prevComponentsRef.current = validComponents;\n });\n\n return { componentsWidth: widthDict, hiddenElements };\n}\n\n// NOTE: Calculate the width of Toggler Component\nexport function useAppFilterTogglerWidth() {\n const [width, setWidth] = useState(null);\n\n useEffect(() => {\n const element = document.createElement('div');\n element.style.position = 'absolute';\n element.style.visibility = 'hidden';\n document.body.appendChild(element);\n\n ReactDOM.render(\n <MuiThemeProvider theme={theme.darkTheme}>\n <FiltersToggler />\n </MuiThemeProvider>,\n element,\n () => {\n const dims = element.getBoundingClientRect();\n element.remove();\n setWidth(dims.width);\n }\n );\n }, []);\n\n return width;\n}\n"],"names":["useState","_useState6","_slicedToArray","_useState5","width","setWidth","useEffect","element","document","createElement","style","position","visibility","body","appendChild","ReactDOM","render","_jsx","jsx","MuiThemeProvider","theme","darkTheme","children","FiltersToggler","dims","getBoundingClientRect","remove","components","hiddenElementsRef","useRef","_useState4","_useState3","widthDict","setWidthDict","prevComponentsRef","validComponents","filter","component","hiddenElements","ref","height","overflow","map","index","key","_hiddenElementsRef$cu","isEqual","current","sizeMap","Array","from","childNodes","reduce","acc","node","_node$getAttribute","getAttribute","call","value","_objectSpread","_defineProperty","Object","values","length","componentsWidth","appFilterTogglerWidth","appWidth","_useState2","_useState","layout","setLayout","filtersComponent","getStartComponent","goalComponent","getMiddleComponent","switchComponent","getEndComponents","hasFiltersAndGoals","hasFiltersAndSwitch","hasAll","filtersWidth","LARGE_SIZE_LAYOUT","MEDIUM_SIZE_LAYOUT","startWidth","endWidth","middleWidth","SMALL_SIZE_LAYOUT"],"mappings":"w1EA0IO,WACL,IAA0BA,EAAAA,EAAQA,SAAC,MAAKC,EAAAC,EAAAA,QAAAC,EAAA,GAAjCC,EAAKH,EAAA,GAAEI,EAAQJ,EAAA,GAqBtB,OAnBAK,EAAAA,WAAU,WACR,IAAMC,EAAUC,SAASC,cAAc,OACvCF,EAAQG,MAAMC,SAAW,WACzBJ,EAAQG,MAAME,WAAa,SAC3BJ,SAASK,KAAKC,YAAYP,GAE1BQ,UAASC,OACPC,EAAAC,IAACC,mBAAgB,CAACC,MAAOA,EAAgBC,UAAAC,SACvCL,EAAAA,IAACM,EAAc,MAEjBhB,GACA,WACE,IAAMiB,EAAOjB,EAAQkB,wBACrBlB,EAAQmB,SACRrB,EAASmB,E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AAiBE,IAEdG,CACT"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.MAP_BOX_ACCESS_TOKEN="pk.eyJ1IjoiY29ydmEtYWkiLCJhIjoiY2tzeXg1Ym84Mm53NjJvbnZvZ3JxajVwayJ9.3B6ubssBj1UCqN5o25X6pw";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="true"===process.env.REACT_APP_MAPBOX_ENABLED;exports.IS_MAPBOX_ENABLED=e,exports.MAP_BOX_ACCESS_TOKEN="pk.eyJ1IjoiY29ydmEtYWkiLCJhIjoiY2tzeXg1Ym84Mm53NjJvbnZvZ3JxajVwayJ9.3B6ubssBj1UCqN5o25X6pw";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/config/mapbox/index.js"],"sourcesContent":["// NOTE: Access token from Jim Wang\nexport const MAP_BOX_ACCESS_TOKEN =\n 'pk.eyJ1IjoiY29ydmEtYWkiLCJhIjoiY2tzeXg1Ym84Mm53NjJvbnZvZ3JxajVwayJ9.3B6ubssBj1UCqN5o25X6pw';\n"],"names":[],"mappings":"iGAEE"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/config/mapbox/index.js"],"sourcesContent":["// NOTE: Access token from Jim Wang\nexport const MAP_BOX_ACCESS_TOKEN =\n 'pk.eyJ1IjoiY29ydmEtYWkiLCJhIjoiY2tzeXg1Ym84Mm53NjJvbnZvZ3JxajVwayJ9.3B6ubssBj1UCqN5o25X6pw';\n\n// Airgapped deployments cannot reach api.mapbox.com, so their maps must never mount.\n// The host app inlines this at its own build (corva-web-frontend maps VITE_ to REACT_APP_).\nexport const IS_MAPBOX_ENABLED = process.env.REACT_APP_MAPBOX_ENABLED === 'true';\n"],"names":["IS_MAPBOX_ENABLED","process","env","REACT_APP_MAPBOX_ENABLED"],"mappings":"oEACO,IAKMA,EAA6D,SAAzCC,QAAQC,IAAIC,kFAJ3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentPreview.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentPreview/AttachmentPreview.tsx"],"names":[],"mappings":"AASA,OAAO,EAAyB,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAgK1F,eAAO,MAAM,iBAAiB,mHAkB7B,CAAC"}
1
+ {"version":3,"file":"AttachmentPreview.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentPreview/AttachmentPreview.tsx"],"names":[],"mappings":"AASA,OAAO,EAAyB,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAsK1F,eAAO,MAAM,iBAAiB,mHAkB7B,CAAC"}
@@ -1,2 +1,2 @@
1
- import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{forwardRef as c}from"react";import n from"classnames";import{FileIcon as t}from"../../componentsV2/FileIcon/FileIcon.js";import{ButtonIcon as r}from"../../componentsV2/ButtonIcon/ButtonIcon.js";import{Tooltip as e}from"../../componentsV2/Tooltip/Tooltip.js";import{LoaderCircular as m}from"../../componentsV2/LoaderCircular/LoaderCircular.js";import{PlayOneIcon as a,DownloadIcon as l,UndoIcon as p,CloseSmallIcon as u}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import d from"./AttachmentPreview.scss.js";import I from"../../utils/main.js";var j=function(o){var s,i=o.split(".");return i.length>1?(null!==(s=i.pop())&&void 0!==s?s:"").toUpperCase():""},h=function(o){return function(s){s.stopPropagation(),o()}},v=function(c){var t=c.item,a=c.onRemove,l=c.onRetry;return s(i,{children:[t.isUploading&&s(i,{children:[o("div",{className:d.uploadingOverlay}),o("div",{className:d.uploadingSpinner,children:o(m,{size:"xs",className:d.loader})})]}),!!t.error&&s(i,{children:[o("div",{className:d.errorOverlay}),l&&o(e,{title:"Retry upload",children:o("div",{className:d.retryButton,children:o(r,{size:"xs",type:"tertiaryBg",onClick:h((function(){return l(t.id)})),testId:"attachment-retry",children:o(p,{size:"small"})})})})]}),a&&!t.isUploading&&o("div",{className:n(d.removeButton,!!t.error&&d.removeButtonVisible),children:o(r,{size:"xs",type:"tertiaryBg",onClick:h((function(){return a(t.id)})),testId:"attachment-remove",children:o(u,{size:"small"})})})]})},C=function(c){var r,m,p=c.item,u=c.onRemove,h=c.onRetry,C=c.onItemClick,f=null!==(r=p.kind)&&void 0!==r?r:"file",g=o(v,{item:p,onRemove:u,onRetry:h}),N=I.getFileNameWithExtensionFromPath(p.name);if("image"===f||"video"===f){var y=!!C&&!p.isUploading&&!p.error;return s("div",{className:n(d.thumbnail,y&&d.clickable,!!p.error&&d.thumbnailError),onClick:y?function(){return null==C?void 0:C(p)}:void 0,children:[o("div",{className:d.thumbnailInner,children:"image"===f?o("img",{src:p.src,alt:N,className:d.thumbnailImage}):o("video",{src:(m=p.src,m&&!m.includes("#t=")?"".concat(m,"#t=0.1"):m),className:d.thumbnailImage,preload:"metadata",playsInline:!0,muted:!0})}),"video"===f&&o("div",{className:d.videoOverlay,children:o(a,{theme:"filled",className:d.playIcon})}),g]})}var F,b=!(!p.downloadUrl||u||p.isUploading||p.error),O=s(i,{children:[s("div",{className:d.fileCardContent,children:[o(t,{name:N}),s("div",{className:d.fileInfo,children:[o(e,{title:N,children:o("div",{className:d.fileName,children:(F=N,F.replace(/\.[^/.]+$/,""))})}),o("div",{className:d.fileType,children:j(N)})]})]}),b&&o(e,{title:"Download file",children:o("span",{className:d.downloadButton,children:o(l,{size:16})})}),g]});return b?o("a",{href:p.downloadUrl,download:N,className:n(d.fileCard,d.fileCardLink),"data-testid":"attachment-download",children:O}):o("div",{className:n(d.fileCard,!!p.error&&d.thumbnailError),children:O})},f=c((function(s,i){var c=s.items,t=s.onRemove,r=s.onRetry,e=s.onItemClick,m=s.className,a=s.testId;return c.length?o("div",{ref:i,"data-testid":a,className:n(d.scroller,m),children:c.map((function(s){return o(C,{item:s,onRemove:t,onRetry:r,onItemClick:e},s.id)}))}):null}));export{f as AttachmentPreview};
1
+ import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{forwardRef as c}from"react";import n from"classnames";import{FileIcon as t}from"../../componentsV2/FileIcon/FileIcon.js";import{ButtonIcon as r}from"../../componentsV2/ButtonIcon/ButtonIcon.js";import{Tooltip as e}from"../../componentsV2/Tooltip/Tooltip.js";import{LoaderCircular as m}from"../../componentsV2/LoaderCircular/LoaderCircular.js";import{PlayOneIcon as a,DownloadIcon as l,UndoIcon as p,CloseSmallIcon as u}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import d from"./AttachmentPreview.scss.js";import I from"../../utils/main.js";var j=function(o){var s,i=o.split(".");return i.length>1?(null!==(s=i.pop())&&void 0!==s?s:"").toUpperCase():""},h=function(o){return function(s){s.stopPropagation(),o()}},v=function(c){var t=c.item,a=c.onRemove,l=c.onRetry;return s(i,{children:[t.isUploading&&s(i,{children:[o("div",{className:d.uploadingOverlay}),o("div",{className:d.uploadingSpinner,children:o(m,{size:"xs",className:d.loader})})]}),!!t.error&&s(i,{children:[o("div",{className:d.errorOverlay}),l&&o(e,{title:"Retry upload",children:o("div",{className:d.retryButton,children:o(r,{size:"xs",type:"tertiaryBg",onClick:h((function(){return l(t.id)})),testId:"attachment-retry",children:o(p,{size:"small"})})})})]}),a&&!t.isUploading&&o(e,{title:"Remove",children:o("div",{className:n(d.removeButton,!!t.error&&d.removeButtonVisible),children:o(r,{size:"xs",type:"tertiaryBg",onClick:h((function(){return a(t.id)})),testId:"attachment-remove",children:o(u,{size:"small"})})})})]})},C=function(c){var m,p,u=c.item,h=c.onRemove,C=c.onRetry,f=c.onItemClick,g=null!==(m=u.kind)&&void 0!==m?m:"file",N=o(v,{item:u,onRemove:h,onRetry:C}),y=I.getFileNameWithExtensionFromPath(u.name);if("image"===g||"video"===g){var b=!!f&&!u.isUploading&&!u.error;return s("div",{className:n(d.thumbnail,b&&d.clickable,!!u.error&&d.thumbnailError),onClick:b?function(){return null==f?void 0:f(u)}:void 0,children:[o("div",{className:d.thumbnailInner,children:"image"===g?o("img",{src:u.src,alt:y,className:d.thumbnailImage}):o("video",{src:(p=u.src,p&&!p.includes("#t=")?"".concat(p,"#t=0.1"):p),className:d.thumbnailImage,preload:"metadata",playsInline:!0,muted:!0})}),"video"===g&&o("div",{className:d.videoOverlay,children:o(a,{theme:"filled",className:d.playIcon})}),N]})}var F,O=!(!u.downloadUrl||h||u.isUploading||u.error),R=s(i,{children:[s("div",{className:d.fileCardContent,children:[o(t,{name:y}),s("div",{className:d.fileInfo,children:[o(e,{title:y,children:o("div",{className:d.fileName,children:(F=y,F.replace(/\.[^/.]+$/,""))})}),o("div",{className:d.fileType,children:j(y)})]})]}),O&&o(e,{title:"Download",children:o("div",{className:d.downloadButton,children:o(r,{size:"xs",type:"tertiaryBg",testId:"attachment-download-button",children:o(l,{size:"small"})})})}),N]});return O?o("a",{href:u.downloadUrl,download:y,className:n(d.fileCard,d.fileCardLink),"data-testid":"attachment-download",children:R}):o("div",{className:n(d.fileCard,!!u.error&&d.thumbnailError),children:R})},f=c((function(s,i){var c=s.items,t=s.onRemove,r=s.onRetry,e=s.onItemClick,m=s.className,a=s.testId;return c.length?o("div",{ref:i,"data-testid":a,className:n(d.scroller,m),children:c.map((function(s){return o(C,{item:s,onRemove:t,onRetry:r,onItemClick:e},s.id)}))}):null}));export{f as AttachmentPreview};
2
2
  //# sourceMappingURL=AttachmentPreview.js.map
@@ -1,2 +1,2 @@
1
- import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var t={spacing:"8",scroller:"AttachmentPreview_scroller__ZqYC8",thumbnail:"AttachmentPreview_thumbnail__ytI2L",clickable:"AttachmentPreview_clickable__BEXzK",thumbnailInner:"AttachmentPreview_thumbnailInner__9Ex4-",thumbnailImage:"AttachmentPreview_thumbnailImage__RQ4fL",videoOverlay:"AttachmentPreview_videoOverlay__5Lgi1",playIcon:"AttachmentPreview_playIcon__OOnql",fileCard:"AttachmentPreview_fileCard__oxDbD",fileCardLink:"AttachmentPreview_fileCardLink__TDpvh",fileCardContent:"AttachmentPreview_fileCardContent__c-99Q",fileInfo:"AttachmentPreview_fileInfo__eqJ-B",fileName:"AttachmentPreview_fileName__1Ccg0",fileType:"AttachmentPreview_fileType__0v6E4",downloadButton:"AttachmentPreview_downloadButton__9oBz-",removeButton:"AttachmentPreview_removeButton__aX-qu",removeButtonVisible:"AttachmentPreview_removeButtonVisible__BVjYB",thumbnailError:"AttachmentPreview_thumbnailError__yyH08",uploadingOverlay:"AttachmentPreview_uploadingOverlay__leV1D",uploadingSpinner:"AttachmentPreview_uploadingSpinner__u-t7d",loader:"AttachmentPreview_loader__HK5bZ",errorOverlay:"AttachmentPreview_errorOverlay__8sM1d",retryButton:"AttachmentPreview_retryButton__tKVV0"};e(".AttachmentPreview_scroller__ZqYC8{-ms-overflow-style:none;align-items:flex-start;display:flex;gap:8px;overflow-x:auto;overflow-y:visible;padding-top:6px;scroll-behavior:smooth;scrollbar-width:none}.AttachmentPreview_scroller__ZqYC8::-webkit-scrollbar{display:none}.AttachmentPreview_thumbnail__ytI2L{border-radius:8px;flex-shrink:0;height:64px;overflow:visible;position:relative;width:64px}.AttachmentPreview_clickable__BEXzK{cursor:pointer}.AttachmentPreview_clickable__BEXzK:hover{opacity:.9}.AttachmentPreview_thumbnailInner__9Ex4-{border-radius:8px;inset:0;overflow:hidden;pointer-events:none;position:absolute}.AttachmentPreview_thumbnailImage__RQ4fL{height:100%;left:50%;max-width:none;min-width:100%;object-fit:cover;pointer-events:none;position:absolute;top:0;transform:translateX(-50%);width:auto}.AttachmentPreview_videoOverlay__5Lgi1{align-items:center;background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute}.AttachmentPreview_playIcon__OOnql{color:var(--palette-primary-text-1);font-size:32px}.AttachmentPreview_fileCard__oxDbD{align-items:flex-start;border:1px solid rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:8px;display:flex;flex-direction:column;flex-shrink:0;height:64px;justify-content:center;padding:8px 16px;position:relative;width:142px}.AttachmentPreview_fileCardLink__TDpvh{color:inherit;cursor:pointer;text-decoration:none}.AttachmentPreview_fileCardLink__TDpvh:hover{border-color:rgb(from var(--palette-primary-text-1) r g b/.16)}.AttachmentPreview_fileCardContent__c-99Q{align-items:center;display:flex;gap:8px;width:100%}.AttachmentPreview_fileInfo__eqJ-B{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;justify-content:center;min-width:0}.AttachmentPreview_fileName__1Ccg0{color:var(--palette-primary-text-1)}.AttachmentPreview_fileName__1Ccg0,.AttachmentPreview_fileType__0v6E4{font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.AttachmentPreview_fileType__0v6E4{color:var(--palette-primary-text-6);text-transform:uppercase}.AttachmentPreview_downloadButton__9oBz-{align-items:center;backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:4px;color:var(--palette-primary-text-6);display:inline-flex;height:24px;justify-content:center;opacity:0;position:absolute;right:4px;top:4px;transition:opacity .2s;width:24px;z-index:3}.AttachmentPreview_downloadButton__9oBz-:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15);color:var(--palette-primary-text-1)}.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_downloadButton__9oBz-{opacity:1}.AttachmentPreview_removeButton__aX-qu{opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_removeButton__aX-qu button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important;border-radius:4px!important}.AttachmentPreview_removeButton__aX-qu button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_removeButton__aX-qu,.AttachmentPreview_removeButtonVisible__BVjYB,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_removeButton__aX-qu{opacity:1}.AttachmentPreview_thumbnailError__yyH08{border:1px solid rgb(from var(--palette-error-main) r g b/.4)}.AttachmentPreview_uploadingOverlay__leV1D{background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_uploadingSpinner__u-t7d{align-items:center;backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:4px;display:flex;height:24px;justify-content:center;position:absolute;right:-6px;top:-6px;width:24px;z-index:2}.AttachmentPreview_loader__HK5bZ{color:var(--palette-primary-text-6);height:14px!important;width:14px!important}.AttachmentPreview_errorOverlay__8sM1d{background:rgb(from var(--palette-error-main) r g b/.08);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_retryButton__tKVV0{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.AttachmentPreview_retryButton__tKVV0 button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important;border-radius:4px!important}.AttachmentPreview_retryButton__tKVV0 button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}");export{t as default};
1
+ import t from'./../../ext-esm/style-inject/dist/style-inject.es.js';var e={spacing:"8",scroller:"AttachmentPreview_scroller__ZqYC8",thumbnail:"AttachmentPreview_thumbnail__ytI2L",clickable:"AttachmentPreview_clickable__BEXzK",thumbnailInner:"AttachmentPreview_thumbnailInner__9Ex4-",thumbnailImage:"AttachmentPreview_thumbnailImage__RQ4fL",videoOverlay:"AttachmentPreview_videoOverlay__5Lgi1",playIcon:"AttachmentPreview_playIcon__OOnql",fileCard:"AttachmentPreview_fileCard__oxDbD",fileCardLink:"AttachmentPreview_fileCardLink__TDpvh",fileCardContent:"AttachmentPreview_fileCardContent__c-99Q",fileInfo:"AttachmentPreview_fileInfo__eqJ-B",fileName:"AttachmentPreview_fileName__1Ccg0",fileType:"AttachmentPreview_fileType__0v6E4",downloadButton:"AttachmentPreview_downloadButton__9oBz-",removeButton:"AttachmentPreview_removeButton__aX-qu",removeButtonVisible:"AttachmentPreview_removeButtonVisible__BVjYB",thumbnailError:"AttachmentPreview_thumbnailError__yyH08",uploadingOverlay:"AttachmentPreview_uploadingOverlay__leV1D",uploadingSpinner:"AttachmentPreview_uploadingSpinner__u-t7d",loader:"AttachmentPreview_loader__HK5bZ",errorOverlay:"AttachmentPreview_errorOverlay__8sM1d",retryButton:"AttachmentPreview_retryButton__tKVV0"};t(".AttachmentPreview_scroller__ZqYC8{-ms-overflow-style:none;align-items:flex-start;display:flex;gap:8px;overflow-x:auto;overflow-y:visible;padding-top:6px;scroll-behavior:smooth;scrollbar-width:none}.AttachmentPreview_scroller__ZqYC8::-webkit-scrollbar{display:none}.AttachmentPreview_thumbnail__ytI2L{border-radius:8px;flex-shrink:0;height:64px;overflow:visible;position:relative;width:64px}.AttachmentPreview_clickable__BEXzK{cursor:pointer}.AttachmentPreview_clickable__BEXzK:hover{opacity:.9}.AttachmentPreview_thumbnailInner__9Ex4-{border-radius:8px;inset:0;overflow:hidden;pointer-events:none;position:absolute}.AttachmentPreview_thumbnailImage__RQ4fL{height:100%;left:50%;max-width:none;min-width:100%;object-fit:cover;pointer-events:none;position:absolute;top:0;transform:translateX(-50%);width:auto}.AttachmentPreview_videoOverlay__5Lgi1{align-items:center;background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute}.AttachmentPreview_playIcon__OOnql{color:var(--palette-primary-text-1);font-size:32px}.AttachmentPreview_fileCard__oxDbD{align-items:flex-start;border:1px solid rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:8px;display:flex;flex-direction:column;flex-shrink:0;height:64px;justify-content:center;padding:8px 16px;position:relative;width:142px}.AttachmentPreview_fileCardLink__TDpvh{color:inherit;cursor:pointer;text-decoration:none}.AttachmentPreview_fileCardLink__TDpvh:hover{border-color:rgb(from var(--palette-primary-text-1) r g b/.16)}.AttachmentPreview_fileCardContent__c-99Q{align-items:center;display:flex;gap:8px;width:100%}.AttachmentPreview_fileInfo__eqJ-B{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;justify-content:center;min-width:0}.AttachmentPreview_fileName__1Ccg0{color:var(--palette-primary-text-1)}.AttachmentPreview_fileName__1Ccg0,.AttachmentPreview_fileType__0v6E4{font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.AttachmentPreview_fileType__0v6E4{color:var(--palette-primary-text-6);text-transform:uppercase}.AttachmentPreview_downloadButton__9oBz-{opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_downloadButton__9oBz- button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_downloadButton__9oBz- button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_downloadButton__9oBz-{opacity:1}.AttachmentPreview_removeButton__aX-qu{opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_removeButton__aX-qu button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_removeButton__aX-qu button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_removeButton__aX-qu,.AttachmentPreview_removeButtonVisible__BVjYB,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_removeButton__aX-qu{opacity:1}.AttachmentPreview_thumbnailError__yyH08{border:1px solid rgb(from var(--palette-error-main) r g b/.4)}.AttachmentPreview_uploadingOverlay__leV1D{background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_uploadingSpinner__u-t7d{align-items:center;backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:6px;display:flex;height:24px;justify-content:center;position:absolute;right:-6px;top:-6px;width:24px;z-index:2}.AttachmentPreview_loader__HK5bZ{color:var(--palette-primary-text-6)!important;height:14px!important;width:14px!important}.AttachmentPreview_errorOverlay__8sM1d{background:rgb(from var(--palette-error-main) r g b/.08);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_retryButton__tKVV0{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.AttachmentPreview_retryButton__tKVV0 button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_retryButton__tKVV0 button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}");export{e as default};
2
2
  //# sourceMappingURL=AttachmentPreview.scss.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../../src/components/BICOffsetPickerDialog/components/Map/Map.js"],"names":[],"mappings":";;AAoDA;;;;;;;;gBA6NC;;;;;;;;;;;;;;;;;;;;;;;;;sBA/QqB,YAAY;AAalC,gDAAyC,CAAC,CAAC;AAC3C,wCAAiC,CAAC,CAAC"}
1
+ {"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../../src/components/BICOffsetPickerDialog/components/Map/Map.js"],"names":[],"mappings":";;AAqDA;;;;;;;;gBA+NC;;;;;;;;;;;;;;;;;;;;;;;;;sBAlRqB,YAAY;AAclC,gDAAyC,CAAC,CAAC;AAC3C,wCAAiC,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{memo as r,useRef as t,useState as o,useMemo as n,useEffect as a,createElement as l}from"react";import i from"react-dom";import u from"prop-types";import{get as c}from"lodash";import s from"./Map.css.js";import{mapbox as d}from"../../../../utils/index.js";import"../../../../config/mapboxGl/index.js";import"mapbox-gl/dist/mapbox-gl.css";import{jsx as p}from"react/jsx-runtime";import f from"mapbox-gl";var m=d.isValidCoordinates,y=[29.749907,-95.358421],v="wells-highlight",g={type:"FeatureCollection",features:[]},h=function(r){var t=e(r,2),o=t[0];return[t[1],o]};function w(r){var u=r.subjectWell,d=r.wells,w=r.offsetWells,b=r.radius,S=r.subjectWellMarkerSize,M=r.wellMarkerSize,x=r.coordsDataPath,j=t(null),C=t(null),D=t(null),F=t(null),P=t(),W=o(!1),k=e(W,2),z=k[0],L=k[1],B=n((function(){return u&&c(u,x)}),[u,x]);a((function(){C.current=new f.Map({container:j.current,style:"mapbox://styles/mapbox/dark-v9",center:h(y),zoom:1,attributionControl:!1,scrollZoom:!1}),C.current.addControl(new f.NavigationControl({showCompass:!1}),"bottom-right"),C.current.on("load",(function(){C.current.addSource("radius-circle",{type:"geojson",data:g}),C.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),C.current.addSource("wells",{type:"geojson",data:g}),C.current.addLayer({id:"wells",type:"circle",source:"wells",paint:{"circle-radius":["get","radius"],"circle-color":"#FFC107","circle-opacity":["get","opacity"]}}),C.current.addSource(v,{type:"geojson",data:g}),C.current.addLayer({id:v,type:"circle",source:v,paint:{"circle-radius":["get","radius"],"circle-color":"#FFC107","circle-opacity":.2}}),L(!0)}));var e=C.current;return function(){e.remove(),C.current=null,D.current=null}}),[]),a((function(){if(C.current&&z)if(B){var r=function(r,t){for(var o=e(r,2),n=o[0],a=o[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,i=[],u=t/(111320*Math.cos(n*Math.PI/180)),c=t/110574,s=0;s<=l;s+=1){var d=s/l*(2*Math.PI);i.push([a+u*Math.cos(d),n+c*Math.sin(d)])}return i}(B,1609.34*b);C.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[r]}})}else C.current.getSource("radius-circle").setData(g)}),[b,B,z]);return a((function(){var e;if(C.current&&z){var r=P.current;P.current=d,null===(e=F.current)||void 0===e||e.remove(),C.current.getSource(v).setData(g);var t=w.map((function(e){return e.id})),o=[],n={},a=new f.LngLatBounds;d.forEach((function(e){var r=c(e,x);if(r&&m(r)){var l=u&&u.id===e.id,i=t.includes(e.id),s=l?S:M,d=l||i?1:.3;n[e.id]=e,a.extend(h(r)),o.push({type:"Feature",geometry:{type:"Point",coordinates:h(r)},properties:{wellId:e.id,radius:s,opacity:d}})}})),C.current.getSource("wells").setData({type:"FeatureCollection",features:o}),D.current=o.length?a:null;var s=C.current,y=null,b=function(e){s.getCanvas().style.cursor="pointer";var r=n[e.features[0].properties.wellId];if(r&&r.id!==y){y=r.id;var t=c(r,x),o=document.createElement("div"),a=l((function(e){var r=e.well;return p("div",{style:{color:"#fff",background:"##414141"},children:p("span",{style:{fontSize:"11px",lineHeight:"16px"},children:c(r,"name")})})}),{well:r});i.render(a,o),F.current||(F.current=new f.Popup({closeButton:!1,maxWidth:"none"})),F.current.setLngLat(h(t)).setDOMContent(o).addTo(s),function(e,r){C.current.getSource(v).setData({type:"Feature",geometry:{type:"Point",coordinates:h(e)},properties:{radius:3*r}})}(t,e.features[0].properties.radius)}},j=function(){var e;y=null,s.getCanvas().style.cursor="",s.getSource(v).setData(g),null===(e=F.current)||void 0===e||e.remove()},W=function(e){null!=e&&e.point&&s.queryRenderedFeatures(e.point,{layers:[v]}).length||j()};return s.on("mousemove","wells",b),s.on("mouseleave","wells",W),s.on("mouseleave",v,j),setTimeout((function(){C.current&&D.current&&d!==r&&C.current.fitBounds(D.current)}),500),function(){s.off("mousemove","wells",b),s.off("mouseleave","wells",W),s.off("mouseleave",v,j)}}}),[u,d,w,z]),p("div",{className:s.map,children:p("div",{className:s.mapMain,ref:j})})}w.propTypes={subjectWell:u.shape({id:u.number,formation:u.string}),wells:u.arrayOf(u.shape({})).isRequired,offsetWells:u.arrayOf(u.shape({})),radius:u.number.isRequired,subjectWellMarkerSize:u.number,wellMarkerSize:u.number,coordsDataPath:u.string},w.defaultProps={subjectWell:null,subjectWellMarkerSize:8,wellMarkerSize:5,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var b=r(w);export{b as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{memo as r,useRef as t,useState as o,useMemo as n,useEffect as a,createElement as i}from"react";import l from"react-dom";import u from"prop-types";import{get as c}from"lodash";import s from"./Map.css.js";import{mapbox as d}from"../../../../utils/index.js";import"../../../../config/mapboxGl/index.js";import{IS_MAPBOX_ENABLED as p}from"../../../../config/mapbox/index.js";import"mapbox-gl/dist/mapbox-gl.css";import{jsx as f}from"react/jsx-runtime";import m from"mapbox-gl";var y=d.isValidCoordinates,v=[29.749907,-95.358421],g="wells-highlight",h={type:"FeatureCollection",features:[]},w=function(r){var t=e(r,2),o=t[0];return[t[1],o]};function b(r){var u=r.subjectWell,d=r.wells,b=r.offsetWells,x=r.radius,S=r.subjectWellMarkerSize,M=r.wellMarkerSize,j=r.coordsDataPath,C=t(null),D=t(null),F=t(null),P=t(null),W=t(),k=o(!1),z=e(k,2),L=z[0],B=z[1],I=n((function(){return u&&c(u,j)}),[u,j]);a((function(){if(p){D.current=new m.Map({container:C.current,style:"mapbox://styles/mapbox/dark-v9",center:w(v),zoom:1,attributionControl:!1,scrollZoom:!1}),D.current.addControl(new m.NavigationControl({showCompass:!1}),"bottom-right"),D.current.on("load",(function(){D.current.addSource("radius-circle",{type:"geojson",data:h}),D.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),D.current.addSource("wells",{type:"geojson",data:h}),D.current.addLayer({id:"wells",type:"circle",source:"wells",paint:{"circle-radius":["get","radius"],"circle-color":"#FFC107","circle-opacity":["get","opacity"]}}),D.current.addSource(g,{type:"geojson",data:h}),D.current.addLayer({id:g,type:"circle",source:g,paint:{"circle-radius":["get","radius"],"circle-color":"#FFC107","circle-opacity":.2}}),B(!0)}));var e=D.current;return function(){e.remove(),D.current=null,F.current=null}}}),[]),a((function(){if(D.current&&L)if(I){var r=function(r,t){for(var o=e(r,2),n=o[0],a=o[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,l=[],u=t/(111320*Math.cos(n*Math.PI/180)),c=t/110574,s=0;s<=i;s+=1){var d=s/i*(2*Math.PI);l.push([a+u*Math.cos(d),n+c*Math.sin(d)])}return l}(I,1609.34*x);D.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[r]}})}else D.current.getSource("radius-circle").setData(h)}),[x,I,L]);return a((function(){var e;if(D.current&&L){var r=W.current;W.current=d,null===(e=P.current)||void 0===e||e.remove(),D.current.getSource(g).setData(h);var t=b.map((function(e){return e.id})),o=[],n={},a=new m.LngLatBounds;d.forEach((function(e){var r=c(e,j);if(r&&y(r)){var i=u&&u.id===e.id,l=t.includes(e.id),s=i?S:M,d=i||l?1:.3;n[e.id]=e,a.extend(w(r)),o.push({type:"Feature",geometry:{type:"Point",coordinates:w(r)},properties:{wellId:e.id,radius:s,opacity:d}})}})),D.current.getSource("wells").setData({type:"FeatureCollection",features:o}),F.current=o.length?a:null;var s=D.current,p=null,v=function(e){s.getCanvas().style.cursor="pointer";var r=n[e.features[0].properties.wellId];if(r&&r.id!==p){p=r.id;var t=c(r,j),o=document.createElement("div"),a=i((function(e){var r=e.well;return f("div",{style:{color:"#fff",background:"##414141"},children:f("span",{style:{fontSize:"11px",lineHeight:"16px"},children:c(r,"name")})})}),{well:r});l.render(a,o),P.current||(P.current=new m.Popup({closeButton:!1,maxWidth:"none"})),P.current.setLngLat(w(t)).setDOMContent(o).addTo(s),function(e,r){D.current.getSource(g).setData({type:"Feature",geometry:{type:"Point",coordinates:w(e)},properties:{radius:3*r}})}(t,e.features[0].properties.radius)}},x=function(){var e;p=null,s.getCanvas().style.cursor="",s.getSource(g).setData(h),null===(e=P.current)||void 0===e||e.remove()},C=function(e){null!=e&&e.point&&s.queryRenderedFeatures(e.point,{layers:[g]}).length||x()};return s.on("mousemove","wells",v),s.on("mouseleave","wells",C),s.on("mouseleave",g,x),setTimeout((function(){D.current&&F.current&&d!==r&&D.current.fitBounds(F.current)}),500),function(){s.off("mousemove","wells",v),s.off("mouseleave","wells",C),s.off("mouseleave",g,x)}}}),[u,d,b,L]),f("div",{className:s.map,children:f("div",{className:s.mapMain,ref:C})})}b.propTypes={subjectWell:u.shape({id:u.number,formation:u.string}),wells:u.arrayOf(u.shape({})).isRequired,offsetWells:u.arrayOf(u.shape({})),radius:u.number.isRequired,subjectWellMarkerSize:u.number,wellMarkerSize:u.number,coordsDataPath:u.string},b.defaultProps={subjectWell:null,subjectWellMarkerSize:8,wellMarkerSize:5,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var x=r(b);export{x as default};
2
2
  //# sourceMappingURL=Map.js.map