{"version":3,"sources":["webpack:///./node_modules/mapbox-gl-controls/lib/Base/Base.js","webpack:///./node_modules/mapbox-gl-controls/lib/Button/Button.js","webpack:///./node_modules/mapbox-gl-controls/lib/ImageControl/IImage.js","webpack:///./node_modules/mapbox-gl-controls/lib/ImageControl/types.js","webpack:///./node_modules/mapbox-gl-controls/lib/icons/right.js","webpack:///./node_modules/mapbox-gl-controls/lib/InspectControl/popupTemplate.js","webpack:///./node_modules/mapbox-gl-controls/lib/icons/plus.js","webpack:///./node_modules/mapbox-gl-controls/lib/icons/minus.js","webpack:///./node_modules/mapbox-gl-controls/lib/ZoomControl/ZoomControl.js"],"names":["Base","this","node","document","createElement","classList","add","button","appendChild","className","remove","map","onAddControl","onRemoveControl","parentNode","removeChild","undefined","Button","type","icon","text","textContent","callback","addEventListener","Cursor","EditMode","Visibility","Direction","DOMParser","parseFromString","firstChild","super","zoomIn","zoomOut","addClassName","setIcon","onClick","addButton","insert"],"mappings":"oJAAA,MAAMA,EACF,cACIC,KAAKC,KAAOC,SAASC,cAAc,OACnCH,KAAKC,KAAKG,UAAUC,IAAI,iBACxBL,KAAKC,KAAKG,UAAUC,IAAI,uBACxBL,KAAKC,KAAKG,UAAUC,IAAI,kBAE5B,UAAUC,GACNN,KAAKC,KAAKM,YAAYD,EAAOL,MAEjC,aAAaO,GACTR,KAAKC,KAAKG,UAAUC,IAAIG,GAE5B,gBAAgBA,GACZR,KAAKC,KAAKG,UAAUK,OAAOD,GAE/B,gBAGA,mBAGA,MAAME,GAGF,OAFAV,KAAKU,IAAMA,EACXV,KAAKW,eACEX,KAAKC,KAEhB,WACID,KAAKY,kBACLZ,KAAKC,KAAKY,WAAWC,YAAYd,KAAKC,MACtCD,KAAKU,SAAMK,GAGJ,QCjCf,MAAMC,EACF,cACIhB,KAAKC,KAAOC,SAASC,cAAc,UACnCH,KAAKC,KAAKgB,KAAO,SACjBjB,KAAKkB,KAAO,KAEhB,QAAQA,GACJlB,KAAKkB,KAAOA,EACZlB,KAA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n this.node = document.createElement('div');\n this.node.classList.add('mapboxgl-ctrl');\n this.node.classList.add('mapboxgl-ctrl-group');\n this.node.classList.add('mapbox-control');\n }\n addButton(button) {\n this.node.appendChild(button.node);\n }\n addClassName(className) {\n this.node.classList.add(className);\n }\n removeClassName(className) {\n this.node.classList.remove(className);\n }\n onAddControl() {\n // extend\n }\n onRemoveControl() {\n // extend\n }\n onAdd(map) {\n this.map = map;\n this.onAddControl();\n return this.node;\n }\n onRemove() {\n this.onRemoveControl();\n this.node.parentNode.removeChild(this.node);\n this.map = undefined;\n }\n}\nexport default Base;\n//# sourceMappingURL=Base.js.map","class Button {\n constructor() {\n this.node = document.createElement('button');\n this.node.type = 'button';\n this.icon = null;\n }\n setIcon(icon) {\n this.icon = icon;\n this.node.appendChild(icon);\n }\n setText(text) {\n this.node.textContent = text;\n }\n onClick(callback) {\n this.node.addEventListener('click', callback);\n }\n addClassName(className) {\n this.node.classList.add(className);\n }\n removeClassName(className) {\n this.node.classList.remove(className);\n }\n}\nexport default Button;\n//# sourceMappingURL=Button.js.map","class IImage {\n loadFile(file) {\n return new Promise(((resolve, reject) => {\n const reader = new FileReader();\n const node = new Image();\n reader.addEventListener('load', () => {\n const imageUrl = reader.result;\n node.onload = () => {\n this.id = file.name;\n this.url = imageUrl;\n this.width = node.width;\n this.height = node.height;\n resolve(this);\n };\n node.onerror = reject;\n node.src = imageUrl;\n }, false);\n reader.readAsDataURL(file);\n }));\n }\n loadUrl(url) {\n return new Promise(((resolve, reject) => {\n const node = new Image();\n node.onload = () => {\n this.id = url.split('/').pop();\n this.url = url;\n this.width = node.width;\n this.height = node.height;\n resolve(this);\n };\n node.onerror = reject;\n node.src = url;\n }));\n }\n setInitialPosition(map) {\n if (!this.width || !this.height)\n throw Error('image is not loaded');\n const padding = 20;\n const mapCanvas = map.getCanvas();\n const canvasWidth = mapCanvas.offsetWidth;\n const canvasHeight = mapCanvas.offsetHeight;\n const maxWidth = canvasWidth - padding * 2;\n const maxHeight = canvasHeight - padding * 2;\n const ratio = Math.min(maxWidth / this.width, maxHeight / this.height);\n const resizeWidth = this.width * ratio;\n const resizeHeight = this.height * ratio;\n const result = [\n [canvasWidth / 2 - resizeWidth / 2, canvasHeight / 2 - resizeHeight / 2],\n [canvasWidth / 2 + resizeWidth / 2, canvasHeight / 2 - resizeHeight / 2],\n [canvasWidth / 2 + resizeWidth / 2, canvasHeight / 2 + resizeHeight / 2],\n [canvasWidth / 2 - resizeWidth / 2, canvasHeight / 2 + resizeHeight / 2], // left bottom\n ];\n map.setPitch(0); // reset pitch for correct projection\n this.position = result.map(point => map.unproject(point));\n }\n get coordinates() {\n return this.position.map(p => [p.lng, p.lat]);\n }\n get asPolygon() {\n return {\n type: 'FeatureCollection',\n features: [\n {\n type: 'Feature',\n properties: { id: this.id },\n geometry: { type: 'Polygon', coordinates: [[...this.coordinates, this.coordinates[0]]] },\n },\n ],\n };\n }\n get asPoints() {\n return {\n type: 'FeatureCollection',\n features: this.coordinates.map((point, i) => ({\n type: 'Feature',\n properties: { index: i },\n geometry: { type: 'Point', coordinates: point },\n })),\n };\n }\n get imageSource() {\n return {\n id: `${this.id}-raster`,\n source: { type: 'image', url: this.url, coordinates: this.coordinates },\n };\n }\n get polygonSource() {\n return {\n id: `${this.id}-polygon`,\n source: { type: 'geojson', data: this.asPolygon },\n };\n }\n get cornersSource() {\n return {\n id: `${this.id}-corners`,\n source: { type: 'geojson', data: this.asPoints },\n };\n }\n get rasterLayer() {\n return {\n id: `${this.id}-raster`,\n type: 'raster',\n source: this.imageSource.id,\n paint: { 'raster-fade-duration': 0, 'raster-opacity': 0.5 },\n };\n }\n get fillLayer() {\n return ({\n id: `${this.id}-fill`,\n type: 'fill',\n source: this.polygonSource.id,\n paint: { 'fill-opacity': 0 },\n });\n }\n get ratio() {\n return this.width / this.height;\n }\n getOppositePoint(index) {\n if (index === 0)\n return 2;\n if (index === 1)\n return 3;\n if (index === 2)\n return 0;\n if (index === 3)\n return 1;\n throw Error('invalid corner index');\n }\n}\nexport default IImage;\n//# sourceMappingURL=IImage.js.map","export var Cursor;\n(function (Cursor) {\n Cursor[\"Default\"] = \"\";\n Cursor[\"Move\"] = \"move\";\n Cursor[\"Grabbing\"] = \"grabbing\";\n Cursor[\"NESWResize\"] = \"nesw-resize\";\n Cursor[\"NWSEResize\"] = \"nwse-resize\";\n})(Cursor || (Cursor = {}));\nexport var EditMode;\n(function (EditMode) {\n EditMode[\"Move\"] = \"move\";\n EditMode[\"Transform\"] = \"transform\";\n})(EditMode || (EditMode = {}));\nexport var Visibility;\n(function (Visibility) {\n Visibility[\"Visible\"] = \"visible\";\n Visibility[\"None\"] = \"none\";\n})(Visibility || (Visibility = {}));\n//# sourceMappingURL=types.js.map","const svg = `\n\n`;\nexport default function () {\n return (new DOMParser().parseFromString(svg, 'image/svg+xml')).firstChild;\n}\n//# sourceMappingURL=right.js.map","import iconLeft from '../icons/left';\nimport iconRight from '../icons/right';\nvar Direction;\n(function (Direction) {\n Direction[\"Next\"] = \"next\";\n Direction[\"Prev\"] = \"prev\";\n})(Direction || (Direction = {}));\nfunction getData(feature) {\n var _a;\n const layerData = [\n 'layer',\n { key: 'id', value: feature.layer.id },\n { key: 'type', value: feature.layer.type },\n { key: 'source', value: feature.layer.source },\n { key: 'source-layer', value: (_a = feature.layer['source-layer']) !== null && _a !== void 0 ? _a : '—' },\n ];\n const featureData = ['properties'];\n if (feature.id) {\n featureData.push({ key: '$id', value: feature.id });\n }\n Object.entries(feature.properties).forEach(([key, value]) => {\n featureData.push({ key, value });\n });\n if (featureData.length === 1) {\n featureData.pop(); // remove title if there are no properties\n }\n return [...layerData, ...featureData];\n}\nexport default function popupTemplate(features) {\n let current = 0;\n const root = document.createElement('div');\n root.classList.add('mapbox-control-inspect-popup');\n const content = document.createElement('div');\n content.classList.add('mapbox-control-inspect-content');\n const templatePrev = () => {\n const button = document.createElement('div');\n button.setAttribute('type', 'button');\n button.classList.add('mapbox-control-inspect-prev');\n button.appendChild(iconLeft());\n button.addEventListener('click', () => goTo(Direction.Prev));\n return button;\n };\n const templateNext = () => {\n const button = document.createElement('div');\n button.setAttribute('type', 'button');\n button.classList.add('mapbox-control-inspect-next');\n button.appendChild((iconRight()));\n button.addEventListener('click', () => goTo(Direction.Next));\n return button;\n };\n const templateTitle = () => {\n const title = document.createElement('div');\n title.classList.add('mapbox-control-inspect-current');\n title.textContent = `${current + 1} / ${features.length}`;\n return title;\n };\n const templateHeader = () => {\n const header = document.createElement('div');\n header.classList.add('mapbox-control-inspect-header');\n header.appendChild(templatePrev());\n header.appendChild(templateTitle());\n header.appendChild(templateNext());\n return header;\n };\n const templateFeature = (feature) => {\n const table = document.createElement('table');\n table.classList.add('mapbox-control-inspect-grid');\n const data = getData(feature);\n data.forEach((record) => {\n const row = document.createElement('tr');\n if (typeof record === 'string') {\n const caption = document.createElement('th');\n caption.classList.add('mapbox-control-inspect-caption');\n caption.colSpan = 2;\n caption.textContent = record;\n row.appendChild(caption);\n table.append(row);\n return;\n }\n const key = document.createElement('th');\n const value = document.createElement('td');\n key.classList.add('mapbox-control-inspect-key');\n value.classList.add('mapbox-control-inspect-value');\n key.textContent = record.key;\n value.textContent = String(record.value);\n row.appendChild(key);\n row.appendChild(value);\n table.append(row);\n });\n return table;\n };\n function goTo(dir) {\n if (dir === Direction.Prev) {\n current = current !== 0 ? current - 1 : features.length - 1;\n }\n else if (dir === Direction.Next) {\n current = current !== features.length - 1 ? current + 1 : 0;\n }\n content.innerHTML = '';\n content.appendChild(templateHeader());\n content.appendChild(templateFeature(features[current]));\n }\n root.appendChild(content);\n if (!features.length) {\n content.textContent = 'No features';\n }\n else {\n if (features.length > 1) {\n content.appendChild(templateHeader());\n }\n content.appendChild(templateFeature(features[current]));\n }\n return root;\n}\n//# sourceMappingURL=popupTemplate.js.map","const svg = `\n\n`;\nexport default function () {\n return (new DOMParser().parseFromString(svg, 'image/svg+xml')).firstChild;\n}\n//# sourceMappingURL=plus.js.map","const svg = `\n\n`;\nexport default function () {\n return (new DOMParser().parseFromString(svg, 'image/svg+xml')).firstChild;\n}\n//# sourceMappingURL=minus.js.map","import Base from '../Base/Base';\nimport Button from '../Button/Button';\nimport iconPlus from '../icons/plus';\nimport iconMinus from '../icons/minus';\nexport default class ZoomControl extends Base {\n constructor() {\n super();\n this.zoomIn = new Button();\n this.zoomOut = new Button();\n }\n insert() {\n this.addClassName('mapbox-zoom');\n this.zoomIn.setIcon(iconPlus());\n this.zoomIn.onClick(() => this.map.zoomIn());\n this.zoomOut.setIcon(iconMinus());\n this.zoomOut.onClick(() => this.map.zoomOut());\n this.addButton(this.zoomIn);\n this.addButton(this.zoomOut);\n }\n onAddControl() {\n this.insert();\n }\n}\n//# sourceMappingURL=ZoomControl.js.map"],"sourceRoot":""}