{"version":3,"file":"draw.control-CLwG5zT4.cjs","sources":["../src/lib/debounce.ts","../src/types.ts","../src/components/controls/position.enum.ts","../src/composable/usePositionWatcher.ts","../src/components/controls/custom.control.ts","../src/components/button.component.ts","../node_modules/@turf/helpers/dist/esm/index.js","../node_modules/@turf/meta/dist/esm/index.js","../node_modules/@turf/area/dist/esm/index.js","../node_modules/@turf/invariant/dist/esm/index.js","../node_modules/@turf/destination/dist/esm/index.js","../node_modules/@turf/circle/dist/esm/index.js","../src/plugins/draw/mode.abstract.ts","../node_modules/robust-predicates/esm/util.js","../node_modules/robust-predicates/esm/orient2d.js","../node_modules/point-in-polygon-hao/dist/esm/index.js","../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js","../node_modules/@turf/distance/dist/esm/index.js","../src/plugins/draw/circle.mode.ts","../src/plugins/draw/html.ts","../src/plugins/draw/circleStatic.mode.ts","../node_modules/@turf/boolean-point-on-line/dist/esm/index.js","../node_modules/@turf/clean-coords/dist/esm/index.js","../node_modules/@turf/clone/dist/esm/index.js","../node_modules/@turf/simplify/dist/esm/index.js","../src/plugins/draw/polygon.mode.ts","../src/plugins/draw/styles.ts","../src/plugins/draw/types.ts","../node_modules/@turf/bbox/dist/esm/index.js","../src/plugins/draw/plugin.ts","../src/plugins/draw/draw.control.ts"],"sourcesContent":["export function debounce(fn: Function, wait = 250, immediate = false) {\n\tlet timeout: number | undefined;\n\n\tfunction debounced(/* ...args */) {\n\t\tconst args = arguments;\n\n\t\tconst later = () => {\n\t\t\ttimeout = undefined;\n\t\t\tif (immediate !== true) {\n\t\t\t\t// @ts-ignore\n\t\t\t\tfn.apply(this, args);\n\t\t\t}\n\t\t};\n\n\t\tclearTimeout(timeout!);\n\t\tif (immediate === true && timeout === undefined) {\n\t\t\t// @ts-ignore\n\t\t\tfn.apply(this, args);\n\t\t}\n\t\ttimeout = window.setTimeout(later, wait);\n\t}\n\n\tdebounced.cancel = () => {\n\t\tclearTimeout(timeout!);\n\t};\n\n\treturn debounced;\n}\n\n\nexport type ThrottledFunction<T extends (...args: any) => any> = (...args: Parameters<T>) => ReturnType<T>;\n\nexport function throttle<T extends (...args: any) => any>(func: T, ms: number): ThrottledFunction<T> {\n\tlet inThrottle: boolean;\n\tlet lastResult: ReturnType<T>;\n\n\treturn function (this: any): ReturnType<T> {\n\t\tconst args    = arguments;\n\t\tconst context = this;\n\n\t\tif (!inThrottle) {\n\t\t\tinThrottle = true;\n\n\t\t\tsetTimeout(() => (inThrottle = false), ms);\n\n\t\t\tlastResult = func.apply(context, args as unknown as any[]);\n\t\t}\n\n\t\treturn lastResult;\n\t};\n}\n","import type { MglMap } from '@/components';\nimport type { SourceLayerRegistry } from '@/lib/sourceLayer.registry';\nimport type { Map, MapOptions, SourceSpecification, StyleSpecification } from 'maplibre-gl';\nimport type { Emitter } from 'mitt';\nimport type { InjectionKey, Ref, ShallowRef } from 'vue';\n\nexport const mapSymbol              = Symbol('map') as InjectionKey<ShallowRef<Map | undefined>>,\n\t\t\t isLoadedSymbol         = Symbol('isLoaded') as InjectionKey<Ref<boolean>>,\n\t\t\t isInitializedSymbol    = Symbol('isInitialized') as InjectionKey<Ref<boolean>>,\n\t\t\t componentIdSymbol      = Symbol('componentId') as InjectionKey<number>,\n\t\t\t sourceIdSymbol         = Symbol('sourceId') as InjectionKey<string>,\n\t\t\t sourceLayerRegistry    = Symbol('sourceLayerRegistry') as InjectionKey<SourceLayerRegistry>,\n\t\t\t emitterSymbol          = Symbol('emitter') as InjectionKey<Emitter<MglEvents>>,\n\t\t\t fitBoundsOptionsSymbol = Symbol('fitBoundsOptions') as InjectionKey<FitBoundsOptions>;\n\nexport type FitBoundsOptions = MapOptions['fitBoundsOptions'] & { useOnBoundsUpdate?: boolean };\n\nexport interface MglEvent<T = any> {\n\ttype: string;\n\tcomponent: InstanceType<typeof MglMap>;\n\tmap: Map;\n\tevent: T;\n}\n\nexport type MglEvents = {\n\tstyleSwitched: StyleSwitchItem;\n}\n\nexport interface StyleSwitchItem {\n\tname: string;\n\tlabel: string;\n\ticon?: {\n\t\tpath: string;\n\t};\n\tstyle: StyleSpecification | string;\n}\n\nexport type AllProps<T extends object> = { [K in keyof T]: undefined };\n\n// only proper way to ensure all possible option to track option changes by type system\nexport function AllOptions<T extends object>(obj: AllProps<Required<T>>) {\n\treturn Object.keys(obj) as Array<keyof T>;\n}\n\nexport function AllSourceOptions<T = SourceSpecification>(obj: AllProps<Required<Omit<T, 'type'>>>) {\n\treturn Object.keys(obj) as Array<keyof T>;\n}\n\nexport type ValidLanguages =\n\t'sq'\n\t| 'am'\n\t| 'ar'\n\t| 'hy'\n\t| 'az'\n\t| 'eu'\n\t| 'be'\n\t| 'bs'\n\t| 'br'\n\t| 'bg'\n\t| 'ca'\n\t| 'zh'\n\t| 'co'\n\t| 'hr'\n\t| 'cs'\n\t| 'da'\n\t| 'nl'\n\t| 'en'\n\t| 'eo'\n\t| 'et'\n\t| 'fi'\n\t| 'fr'\n\t| 'fy'\n\t| 'ka'\n\t| 'de'\n\t| 'el'\n\t| 'he'\n\t| 'hi'\n\t| 'hu'\n\t| 'is'\n\t| 'id'\n\t| 'ga'\n\t| 'it'\n\t| 'ja'\n\t| 'ja-Hira'\n\t| 'ja_kana'\n\t| 'ja_rm'\n\t| 'ja-Latn'\n\t| 'kn'\n\t| 'kk'\n\t| 'ko'\n\t| 'ko-Latn'\n\t| 'ku'\n\t| 'la'\n\t| 'lv'\n\t| 'lt'\n\t| 'lb'\n\t| 'mk'\n\t| 'ml'\n\t| 'mt'\n\t| 'no'\n\t| 'oc'\n\t| 'pl'\n\t| 'pt'\n\t| 'ro'\n\t| 'rm'\n\t| 'ru'\n\t| 'gd'\n\t| 'sr'\n\t| 'sr-Latn'\n\t| 'sk'\n\t| 'sl'\n\t| 'es'\n\t| 'sv'\n\t| 'ta'\n\t| 'te'\n\t| 'th'\n\t| 'tr'\n\t| 'uk'\n\t| 'cy'\n","export enum Position {\n\tTOP_LEFT     = 'top-left',\n\tTOP_RIGHT    = 'top-right',\n\tBOTTOM_LEFT  = 'bottom-left',\n\tBOTTOM_RIGHT = 'bottom-right'\n}\n\nexport const PositionValues = Object.values(Position);\n\nexport type PositionProp = Position | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n","import { type Position, type PositionProp, PositionValues } from '@/components/controls/position.enum';\nimport type { WatchSource } from '@vue/runtime-core';\nimport type { IControl, Map } from 'maplibre-gl';\nimport { type ShallowRef, watch } from 'vue';\n\nexport function usePositionWatcher(source: WatchSource<PositionProp | undefined>, map: ShallowRef<Map | undefined>, control: IControl) {\n\twatch(source, (v) => {\n\t\tif (v && PositionValues.indexOf(v as Position) === -1) {\n\t\t\treturn;\n\t\t}\n\t\tif (map.value?.hasControl(control)) {\n\t\t\tmap.value.removeControl(control);\n\t\t}\n\t\tmap.value?.addControl(control, v);\n\t}, { immediate: true });\n}\n","import { Position, type PositionProp, PositionValues } from '@/components/controls/position.enum';\nimport { usePositionWatcher } from '@/composable/usePositionWatcher';\nimport { isInitializedSymbol, mapSymbol } from '@/types';\nimport type { ControlPosition, IControl } from 'maplibre-gl';\nimport { createCommentVNode, defineComponent, h, inject, nextTick, onBeforeUnmount, type PropType, ref, type Ref, type SlotsType, Teleport, watch } from 'vue';\n\n\nexport class CustomControl implements IControl {\n\n\tpublic static readonly CONTROL_CLASS       = 'maplibregl-ctrl';\n\tpublic static readonly CONTROL_GROUP_CLASS = 'maplibregl-ctrl-group';\n\n\tpublic readonly container: HTMLDivElement;\n\n\tconstructor(private isAdded: Ref<boolean>, noClasses: boolean) {\n\t\tthis.container = document.createElement('div');\n\t\tthis.setClasses(noClasses);\n\t}\n\n\tgetDefaultPosition(): ControlPosition {\n\t\treturn Position.TOP_LEFT;\n\t}\n\n\tonAdd(): HTMLElement {\n\t\tnextTick(() => this.isAdded.value = true);\n\t\treturn this.container;\n\t}\n\n\tonRemove(): void {\n\t\tthis.isAdded.value = false;\n\t\tthis.container.remove();\n\t}\n\n\tsetClasses(noClasses: boolean) {\n\t\tif (noClasses) {\n\t\t\tthis.container.classList.remove(CustomControl.CONTROL_CLASS);\n\t\t\tthis.container.classList.remove(CustomControl.CONTROL_GROUP_CLASS);\n\t\t} else {\n\t\t\tthis.container.classList.add(CustomControl.CONTROL_CLASS);\n\t\t\tthis.container.classList.add(CustomControl.CONTROL_GROUP_CLASS);\n\t\t}\n\t}\n\n}\n\nexport default /*#__PURE__*/ defineComponent({\n\tname : 'MglCustomControl',\n\tprops: {\n\t\tposition : {\n\t\t\ttype     : String as PropType<PositionProp>,\n\t\t\tvalidator: (v: Position) => {\n\t\t\t\treturn PositionValues.indexOf(v) !== -1;\n\t\t\t}\n\t\t},\n\t\tnoClasses: {\n\t\t\ttype   : Boolean as PropType<boolean>,\n\t\t\tdefault: false\n\t\t}\n\t},\n\tslots: Object as SlotsType<{ default: {} }>,\n\tsetup(props, { slots }) {\n\n\t\tconst map           = inject(mapSymbol)!,\n\t\t\t  isInitialized = inject(isInitializedSymbol)!,\n\t\t\t  isAdded       = ref(false),\n\t\t\t  control       = new CustomControl(isAdded, props.noClasses!);\n\n\t\tusePositionWatcher(() => props.position, map, control);\n\t\twatch(() => props.noClasses, v => control.setClasses(v!));\n\t\tonBeforeUnmount(() => isInitialized.value && map.value?.removeControl(control));\n\n\t\treturn () => {\n\t\t\tif (!isAdded.value) {\n\t\t\t\treturn createCommentVNode('custom-component');\n\t\t\t}\n\t\t\treturn h(\n\t\t\t\tTeleport as any,\n\t\t\t\t{ to: control.container },\n\t\t\t\tslots.default?.({})\n\t\t\t);\n\t\t};\n\n\t}\n});\n","import { defineComponent, h, type PropType, ref, type SlotsType, warn, watch } from 'vue';\n\nexport enum ButtonType {\n\tDEFAULT     = 'default',\n\tTEXT        = 'text',\n\tMDI         = 'mdi',\n\tSIMPLE_ICON = 'simple-icons',\n}\n\nexport const ButtonTypeValues = Object.values(ButtonType);\n\ninterface Default {\n\tsize: number;\n\tviewbox: string;\n}\n\nconst types: { [key in ButtonType]?: Default } = {\n\t[ ButtonType.TEXT ]       : undefined,\n\t[ ButtonType.MDI ]        : {\n\t\tsize   : 21,\n\t\tviewbox: '0 0 24 24'\n\t},\n\t[ ButtonType.SIMPLE_ICON ]: {\n\t\tsize   : 21,\n\t\tviewbox: '0 0 24 24'\n\t},\n\t[ ButtonType.DEFAULT ]    : {\n\t\tsize   : 0,\n\t\tviewbox: '0 0 0 0'\n\t}\n};\n\n\nexport default /*#__PURE__*/ defineComponent({\n\tname : 'MglButton',\n\tprops: {\n\t\ttype   : {\n\t\t\ttype     : String as PropType<ButtonType | 'default' | 'text' | 'mdi' | 'simple-icons'>,\n\t\t\tdefault  : ButtonType.DEFAULT,\n\t\t\tvalidator: (v: ButtonType) => {\n\t\t\t\treturn ButtonTypeValues.indexOf(v) !== -1;\n\t\t\t}\n\t\t},\n\t\tpath   : {\n\t\t\ttype: String as PropType<string>\n\t\t},\n\t\tsize   : Number as PropType<number>,\n\t\tviewbox: String as PropType<string>\n\t},\n\tslots: Object as SlotsType<{ default: {} }>,\n\tsetup(props, { slots }) {\n\n\t\tif (!props.path && props.type !== ButtonType.TEXT) {\n\t\t\twarn('property `path` must be set on MaplibreButton');\n\t\t}\n\n\t\tconst defaults = ref(types[ props.type ] || types.default);\n\t\twatch(() => props.type, v => defaults.value = types[ v ] || types.default);\n\n\t\treturn () => {\n\t\t\tif (props.type === ButtonType.TEXT) {\n\t\t\t\treturn h('button', { type: 'button' }, slots.default?.({}));\n\t\t\t}\n\t\t\treturn h('button', { type: 'button', 'class': 'maplibregl-ctrl-icon' },\n\t\t\t\t[\n\t\t\t\t\th(\n\t\t\t\t\t\t'svg',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twidth  : props.size || defaults.value!.size,\n\t\t\t\t\t\t\theight : props.size || defaults.value!.size,\n\t\t\t\t\t\t\tviewBox: props.viewbox || defaults.value!.viewbox\n\t\t\t\t\t\t},\n\t\t\t\t\t\th('path', { fill: 'currentColor', d: props.path })\n\t\t\t\t\t),\n\t\t\t\t\tslots.default?.({})\n\t\t\t\t]\n\t\t\t);\n\t\t};\n\n\t}\n});\n","// index.ts\nvar earthRadius = 63710088e-1;\nvar factors = {\n  centimeters: earthRadius * 100,\n  centimetres: earthRadius * 100,\n  degrees: 360 / (2 * Math.PI),\n  feet: earthRadius * 3.28084,\n  inches: earthRadius * 39.37,\n  kilometers: earthRadius / 1e3,\n  kilometres: earthRadius / 1e3,\n  meters: earthRadius,\n  metres: earthRadius,\n  miles: earthRadius / 1609.344,\n  millimeters: earthRadius * 1e3,\n  millimetres: earthRadius * 1e3,\n  nauticalmiles: earthRadius / 1852,\n  radians: 1,\n  yards: earthRadius * 1.0936\n};\nvar areaFactors = {\n  acres: 247105e-9,\n  centimeters: 1e4,\n  centimetres: 1e4,\n  feet: 10.763910417,\n  hectares: 1e-4,\n  inches: 1550.003100006,\n  kilometers: 1e-6,\n  kilometres: 1e-6,\n  meters: 1,\n  metres: 1,\n  miles: 386e-9,\n  nauticalmiles: 29155334959812285e-23,\n  millimeters: 1e6,\n  millimetres: 1e6,\n  yards: 1.195990046\n};\nfunction feature(geom, properties, options = {}) {\n  const feat = { type: \"Feature\" };\n  if (options.id === 0 || options.id) {\n    feat.id = options.id;\n  }\n  if (options.bbox) {\n    feat.bbox = options.bbox;\n  }\n  feat.properties = properties || {};\n  feat.geometry = geom;\n  return feat;\n}\nfunction geometry(type, coordinates, _options = {}) {\n  switch (type) {\n    case \"Point\":\n      return point(coordinates).geometry;\n    case \"LineString\":\n      return lineString(coordinates).geometry;\n    case \"Polygon\":\n      return polygon(coordinates).geometry;\n    case \"MultiPoint\":\n      return multiPoint(coordinates).geometry;\n    case \"MultiLineString\":\n      return multiLineString(coordinates).geometry;\n    case \"MultiPolygon\":\n      return multiPolygon(coordinates).geometry;\n    default:\n      throw new Error(type + \" is invalid\");\n  }\n}\nfunction point(coordinates, properties, options = {}) {\n  if (!coordinates) {\n    throw new Error(\"coordinates is required\");\n  }\n  if (!Array.isArray(coordinates)) {\n    throw new Error(\"coordinates must be an Array\");\n  }\n  if (coordinates.length < 2) {\n    throw new Error(\"coordinates must be at least 2 numbers long\");\n  }\n  if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n    throw new Error(\"coordinates must contain numbers\");\n  }\n  const geom = {\n    type: \"Point\",\n    coordinates\n  };\n  return feature(geom, properties, options);\n}\nfunction points(coordinates, properties, options = {}) {\n  return featureCollection(\n    coordinates.map((coords) => {\n      return point(coords, properties);\n    }),\n    options\n  );\n}\nfunction polygon(coordinates, properties, options = {}) {\n  for (const ring of coordinates) {\n    if (ring.length < 4) {\n      throw new Error(\n        \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n      );\n    }\n    if (ring[ring.length - 1].length !== ring[0].length) {\n      throw new Error(\"First and last Position are not equivalent.\");\n    }\n    for (let j = 0; j < ring[ring.length - 1].length; j++) {\n      if (ring[ring.length - 1][j] !== ring[0][j]) {\n        throw new Error(\"First and last Position are not equivalent.\");\n      }\n    }\n  }\n  const geom = {\n    type: \"Polygon\",\n    coordinates\n  };\n  return feature(geom, properties, options);\n}\nfunction polygons(coordinates, properties, options = {}) {\n  return featureCollection(\n    coordinates.map((coords) => {\n      return polygon(coords, properties);\n    }),\n    options\n  );\n}\nfunction lineString(coordinates, properties, options = {}) {\n  if (coordinates.length < 2) {\n    throw new Error(\"coordinates must be an array of two or more positions\");\n  }\n  const geom = {\n    type: \"LineString\",\n    coordinates\n  };\n  return feature(geom, properties, options);\n}\nfunction lineStrings(coordinates, properties, options = {}) {\n  return featureCollection(\n    coordinates.map((coords) => {\n      return lineString(coords, properties);\n    }),\n    options\n  );\n}\nfunction featureCollection(features, options = {}) {\n  const fc = { type: \"FeatureCollection\" };\n  if (options.id) {\n    fc.id = options.id;\n  }\n  if (options.bbox) {\n    fc.bbox = options.bbox;\n  }\n  fc.features = features;\n  return fc;\n}\nfunction multiLineString(coordinates, properties, options = {}) {\n  const geom = {\n    type: \"MultiLineString\",\n    coordinates\n  };\n  return feature(geom, properties, options);\n}\nfunction multiPoint(coordinates, properties, options = {}) {\n  const geom = {\n    type: \"MultiPoint\",\n    coordinates\n  };\n  return feature(geom, properties, options);\n}\nfunction multiPolygon(coordinates, properties, options = {}) {\n  const geom = {\n    type: \"MultiPolygon\",\n    coordinates\n  };\n  return feature(geom, properties, options);\n}\nfunction geometryCollection(geometries, properties, options = {}) {\n  const geom = {\n    type: \"GeometryCollection\",\n    geometries\n  };\n  return feature(geom, properties, options);\n}\nfunction round(num, precision = 0) {\n  if (precision && !(precision >= 0)) {\n    throw new Error(\"precision must be a positive number\");\n  }\n  const multiplier = Math.pow(10, precision || 0);\n  return Math.round(num * multiplier) / multiplier;\n}\nfunction radiansToLength(radians, units = \"kilometers\") {\n  const factor = factors[units];\n  if (!factor) {\n    throw new Error(units + \" units is invalid\");\n  }\n  return radians * factor;\n}\nfunction lengthToRadians(distance, units = \"kilometers\") {\n  const factor = factors[units];\n  if (!factor) {\n    throw new Error(units + \" units is invalid\");\n  }\n  return distance / factor;\n}\nfunction lengthToDegrees(distance, units) {\n  return radiansToDegrees(lengthToRadians(distance, units));\n}\nfunction bearingToAzimuth(bearing) {\n  let angle = bearing % 360;\n  if (angle < 0) {\n    angle += 360;\n  }\n  return angle;\n}\nfunction azimuthToBearing(angle) {\n  angle = angle % 360;\n  if (angle > 180) {\n    return angle - 360;\n  } else if (angle < -180) {\n    return angle + 360;\n  }\n  return angle;\n}\nfunction radiansToDegrees(radians) {\n  const normalisedRadians = radians % (2 * Math.PI);\n  return normalisedRadians * 180 / Math.PI;\n}\nfunction degreesToRadians(degrees) {\n  const normalisedDegrees = degrees % 360;\n  return normalisedDegrees * Math.PI / 180;\n}\nfunction convertLength(length, originalUnit = \"kilometers\", finalUnit = \"kilometers\") {\n  if (!(length >= 0)) {\n    throw new Error(\"length must be a positive number\");\n  }\n  return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\nfunction convertArea(area, originalUnit = \"meters\", finalUnit = \"kilometers\") {\n  if (!(area >= 0)) {\n    throw new Error(\"area must be a positive number\");\n  }\n  const startFactor = areaFactors[originalUnit];\n  if (!startFactor) {\n    throw new Error(\"invalid original units\");\n  }\n  const finalFactor = areaFactors[finalUnit];\n  if (!finalFactor) {\n    throw new Error(\"invalid final units\");\n  }\n  return area / startFactor * finalFactor;\n}\nfunction isNumber(num) {\n  return !isNaN(num) && num !== null && !Array.isArray(num);\n}\nfunction isObject(input) {\n  return input !== null && typeof input === \"object\" && !Array.isArray(input);\n}\nfunction validateBBox(bbox) {\n  if (!bbox) {\n    throw new Error(\"bbox is required\");\n  }\n  if (!Array.isArray(bbox)) {\n    throw new Error(\"bbox must be an Array\");\n  }\n  if (bbox.length !== 4 && bbox.length !== 6) {\n    throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n  }\n  bbox.forEach((num) => {\n    if (!isNumber(num)) {\n      throw new Error(\"bbox must only contain numbers\");\n    }\n  });\n}\nfunction validateId(id) {\n  if (!id) {\n    throw new Error(\"id is required\");\n  }\n  if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n    throw new Error(\"id must be a number or a string\");\n  }\n}\nexport {\n  areaFactors,\n  azimuthToBearing,\n  bearingToAzimuth,\n  convertArea,\n  convertLength,\n  degreesToRadians,\n  earthRadius,\n  factors,\n  feature,\n  featureCollection,\n  geometry,\n  geometryCollection,\n  isNumber,\n  isObject,\n  lengthToDegrees,\n  lengthToRadians,\n  lineString,\n  lineStrings,\n  multiLineString,\n  multiPoint,\n  multiPolygon,\n  point,\n  points,\n  polygon,\n  polygons,\n  radiansToDegrees,\n  radiansToLength,\n  round,\n  validateBBox,\n  validateId\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport { feature, point, lineString, isObject } from \"@turf/helpers\";\nfunction coordEach(geojson, callback, excludeWrapCoord) {\n  if (geojson === null) return;\n  var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === \"FeatureCollection\", isFeature = type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n    geometryMaybeCollection = isFeatureCollection ? (\n      // @ts-expect-error: Known type conflict\n      geojson.features[featureIndex].geometry\n    ) : isFeature ? (\n      // @ts-expect-error: Known type conflict\n      geojson.geometry\n    ) : geojson;\n    isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n    stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n    for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n      var multiFeatureIndex = 0;\n      var geometryIndex = 0;\n      geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;\n      if (geometry === null) continue;\n      coords = geometry.coordinates;\n      var geomType = geometry.type;\n      wrapShrink = excludeWrapCoord && (geomType === \"Polygon\" || geomType === \"MultiPolygon\") ? 1 : 0;\n      switch (geomType) {\n        case null:\n          break;\n        case \"Point\":\n          if (\n            // @ts-expect-error: Known type conflict\n            callback(\n              coords,\n              coordIndex,\n              featureIndex,\n              multiFeatureIndex,\n              geometryIndex\n            ) === false\n          )\n            return false;\n          coordIndex++;\n          multiFeatureIndex++;\n          break;\n        case \"LineString\":\n        case \"MultiPoint\":\n          for (j = 0; j < coords.length; j++) {\n            if (\n              // @ts-expect-error: Known type conflict\n              callback(\n                coords[j],\n                coordIndex,\n                featureIndex,\n                multiFeatureIndex,\n                geometryIndex\n              ) === false\n            )\n              return false;\n            coordIndex++;\n            if (geomType === \"MultiPoint\") multiFeatureIndex++;\n          }\n          if (geomType === \"LineString\") multiFeatureIndex++;\n          break;\n        case \"Polygon\":\n        case \"MultiLineString\":\n          for (j = 0; j < coords.length; j++) {\n            for (k = 0; k < coords[j].length - wrapShrink; k++) {\n              if (\n                // @ts-expect-error: Known type conflict\n                callback(\n                  coords[j][k],\n                  coordIndex,\n                  featureIndex,\n                  multiFeatureIndex,\n                  geometryIndex\n                ) === false\n              )\n                return false;\n              coordIndex++;\n            }\n            if (geomType === \"MultiLineString\") multiFeatureIndex++;\n            if (geomType === \"Polygon\") geometryIndex++;\n          }\n          if (geomType === \"Polygon\") multiFeatureIndex++;\n          break;\n        case \"MultiPolygon\":\n          for (j = 0; j < coords.length; j++) {\n            geometryIndex = 0;\n            for (k = 0; k < coords[j].length; k++) {\n              for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n                if (\n                  // @ts-expect-error: Known type conflict\n                  callback(\n                    coords[j][k][l],\n                    coordIndex,\n                    featureIndex,\n                    multiFeatureIndex,\n                    geometryIndex\n                  ) === false\n                )\n                  return false;\n                coordIndex++;\n              }\n              geometryIndex++;\n            }\n            multiFeatureIndex++;\n          }\n          break;\n        case \"GeometryCollection\":\n          for (j = 0; j < geometry.geometries.length; j++)\n            if (\n              // @ts-expect-error: Known type conflict\n              coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false\n            )\n              return false;\n          break;\n        default:\n          throw new Error(\"Unknown Geometry Type\");\n      }\n    }\n  }\n}\nfunction coordReduce(geojson, callback, initialValue, excludeWrapCoord) {\n  var previousValue = initialValue;\n  coordEach(\n    geojson,\n    function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n      if (coordIndex === 0 && initialValue === void 0)\n        previousValue = currentCoord;\n      else\n        previousValue = callback(\n          // @ts-expect-error: Known type conflict\n          previousValue,\n          currentCoord,\n          coordIndex,\n          featureIndex,\n          multiFeatureIndex,\n          geometryIndex\n        );\n    },\n    excludeWrapCoord\n  );\n  return previousValue;\n}\nfunction propEach(geojson, callback) {\n  var i;\n  switch (geojson.type) {\n    case \"FeatureCollection\":\n      for (i = 0; i < geojson.features.length; i++) {\n        if (callback(geojson.features[i].properties, i) === false) break;\n      }\n      break;\n    case \"Feature\":\n      callback(geojson.properties, 0);\n      break;\n  }\n}\nfunction propReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  propEach(geojson, function(currentProperties, featureIndex) {\n    if (featureIndex === 0 && initialValue === void 0)\n      previousValue = currentProperties;\n    else\n      previousValue = callback(previousValue, currentProperties, featureIndex);\n  });\n  return previousValue;\n}\nfunction featureEach(geojson, callback) {\n  if (geojson.type === \"Feature\") {\n    callback(geojson, 0);\n  } else if (geojson.type === \"FeatureCollection\") {\n    for (var i = 0; i < geojson.features.length; i++) {\n      if (callback(geojson.features[i], i) === false) break;\n    }\n  }\n}\nfunction featureReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  featureEach(geojson, function(currentFeature, featureIndex) {\n    if (featureIndex === 0 && initialValue === void 0)\n      previousValue = currentFeature;\n    else previousValue = callback(previousValue, currentFeature, featureIndex);\n  });\n  return previousValue;\n}\nfunction coordAll(geojson) {\n  var coords = [];\n  coordEach(geojson, function(coord) {\n    coords.push(coord);\n  });\n  return coords;\n}\nfunction geomEach(geojson, callback) {\n  var i, j, g, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === \"FeatureCollection\", isFeature = geojson.type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n  for (i = 0; i < stop; i++) {\n    geometryMaybeCollection = isFeatureCollection ? (\n      // @ts-expect-error: Known type conflict\n      geojson.features[i].geometry\n    ) : isFeature ? (\n      // @ts-expect-error: Known type conflict\n      geojson.geometry\n    ) : geojson;\n    featureProperties = isFeatureCollection ? (\n      // @ts-expect-error: Known type conflict\n      geojson.features[i].properties\n    ) : isFeature ? (\n      // @ts-expect-error: Known type conflict\n      geojson.properties\n    ) : {};\n    featureBBox = isFeatureCollection ? (\n      // @ts-expect-error: Known type conflict\n      geojson.features[i].bbox\n    ) : isFeature ? (\n      // @ts-expect-error: Known type conflict\n      geojson.bbox\n    ) : void 0;\n    featureId = isFeatureCollection ? (\n      // @ts-expect-error: Known type conflict\n      geojson.features[i].id\n    ) : isFeature ? (\n      // @ts-expect-error: Known type conflict\n      geojson.id\n    ) : void 0;\n    isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n    stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n    for (g = 0; g < stopG; g++) {\n      geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;\n      if (geometry === null) {\n        if (\n          // @ts-expect-error: Known type conflict\n          callback(\n            // @ts-expect-error: Known type conflict\n            null,\n            featureIndex,\n            featureProperties,\n            featureBBox,\n            featureId\n          ) === false\n        )\n          return false;\n        continue;\n      }\n      switch (geometry.type) {\n        case \"Point\":\n        case \"LineString\":\n        case \"MultiPoint\":\n        case \"Polygon\":\n        case \"MultiLineString\":\n        case \"MultiPolygon\": {\n          if (\n            // @ts-expect-error: Known type conflict\n            callback(\n              geometry,\n              featureIndex,\n              featureProperties,\n              featureBBox,\n              featureId\n            ) === false\n          )\n            return false;\n          break;\n        }\n        case \"GeometryCollection\": {\n          for (j = 0; j < geometry.geometries.length; j++) {\n            if (\n              // @ts-expect-error: Known type conflict\n              callback(\n                geometry.geometries[j],\n                featureIndex,\n                featureProperties,\n                featureBBox,\n                featureId\n              ) === false\n            )\n              return false;\n          }\n          break;\n        }\n        default:\n          throw new Error(\"Unknown Geometry Type\");\n      }\n    }\n    featureIndex++;\n  }\n}\nfunction geomReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  geomEach(\n    geojson,\n    function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n      if (featureIndex === 0 && initialValue === void 0)\n        previousValue = currentGeometry;\n      else\n        previousValue = callback(\n          // @ts-expect-error: Known type conflict\n          previousValue,\n          currentGeometry,\n          featureIndex,\n          featureProperties,\n          featureBBox,\n          featureId\n        );\n    }\n  );\n  return previousValue;\n}\nfunction flattenEach(geojson, callback) {\n  geomEach(geojson, function(geometry, featureIndex, properties, bbox, id) {\n    var type = geometry === null ? null : geometry.type;\n    switch (type) {\n      case null:\n      case \"Point\":\n      case \"LineString\":\n      case \"Polygon\":\n        if (\n          // @ts-expect-error: Known type conflict\n          callback(\n            feature(geometry, properties, { bbox, id }),\n            featureIndex,\n            0\n          ) === false\n        )\n          return false;\n        return;\n    }\n    var geomType;\n    switch (type) {\n      case \"MultiPoint\":\n        geomType = \"Point\";\n        break;\n      case \"MultiLineString\":\n        geomType = \"LineString\";\n        break;\n      case \"MultiPolygon\":\n        geomType = \"Polygon\";\n        break;\n    }\n    for (\n      var multiFeatureIndex = 0;\n      // @ts-expect-error: Known type conflict\n      multiFeatureIndex < geometry.coordinates.length;\n      multiFeatureIndex++\n    ) {\n      var coordinate = geometry.coordinates[multiFeatureIndex];\n      var geom = {\n        type: geomType,\n        coordinates: coordinate\n      };\n      if (\n        // @ts-expect-error: Known type conflict\n        callback(feature(geom, properties), featureIndex, multiFeatureIndex) === false\n      )\n        return false;\n    }\n  });\n}\nfunction flattenReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  flattenEach(\n    geojson,\n    function(currentFeature, featureIndex, multiFeatureIndex) {\n      if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)\n        previousValue = currentFeature;\n      else\n        previousValue = callback(\n          // @ts-expect-error: Known type conflict\n          previousValue,\n          currentFeature,\n          featureIndex,\n          multiFeatureIndex\n        );\n    }\n  );\n  return previousValue;\n}\nfunction segmentEach(geojson, callback) {\n  flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n    var segmentIndex = 0;\n    if (!feature2.geometry) return;\n    var type = feature2.geometry.type;\n    if (type === \"Point\" || type === \"MultiPoint\") return;\n    var previousCoords;\n    var previousFeatureIndex = 0;\n    var previousMultiIndex = 0;\n    var prevGeomIndex = 0;\n    if (\n      // @ts-expect-error: Known type conflict\n      coordEach(\n        feature2,\n        function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {\n          if (\n            // @ts-expect-error: Known type conflict\n            previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex\n          ) {\n            previousCoords = currentCoord;\n            previousFeatureIndex = featureIndex;\n            previousMultiIndex = multiPartIndexCoord;\n            prevGeomIndex = geometryIndex;\n            segmentIndex = 0;\n            return;\n          }\n          var currentSegment = lineString(\n            // @ts-expect-error: Known type conflict\n            [previousCoords, currentCoord],\n            feature2.properties\n          );\n          if (\n            // @ts-expect-error: Known type conflict\n            callback(\n              // @ts-expect-error: Known type conflict\n              currentSegment,\n              featureIndex,\n              multiFeatureIndex,\n              geometryIndex,\n              segmentIndex\n            ) === false\n          )\n            return false;\n          segmentIndex++;\n          previousCoords = currentCoord;\n        }\n      ) === false\n    )\n      return false;\n  });\n}\nfunction segmentReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  var started = false;\n  segmentEach(\n    geojson,\n    function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n      if (started === false && initialValue === void 0)\n        previousValue = currentSegment;\n      else\n        previousValue = callback(\n          previousValue,\n          // @ts-expect-error: Known type conflict\n          currentSegment,\n          featureIndex,\n          multiFeatureIndex,\n          geometryIndex,\n          segmentIndex\n        );\n      started = true;\n    }\n  );\n  return previousValue;\n}\nfunction lineEach(geojson, callback) {\n  if (!geojson) throw new Error(\"geojson is required\");\n  flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n    if (feature2.geometry === null) return;\n    var type = feature2.geometry.type;\n    var coords = feature2.geometry.coordinates;\n    switch (type) {\n      case \"LineString\":\n        if (callback(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)\n          return false;\n        break;\n      case \"Polygon\":\n        for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {\n          if (\n            // @ts-expect-error: Known type conflict\n            callback(\n              // @ts-expect-error: Known type conflict\n              lineString(coords[geometryIndex], feature2.properties),\n              featureIndex,\n              multiFeatureIndex,\n              geometryIndex\n            ) === false\n          )\n            return false;\n        }\n        break;\n    }\n  });\n}\nfunction lineReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  lineEach(\n    geojson,\n    function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n      if (featureIndex === 0 && initialValue === void 0)\n        previousValue = currentLine;\n      else\n        previousValue = callback(\n          previousValue,\n          currentLine,\n          featureIndex,\n          multiFeatureIndex,\n          geometryIndex\n        );\n    }\n  );\n  return previousValue;\n}\nfunction findSegment(geojson, options) {\n  options = options || {};\n  if (!isObject(options)) throw new Error(\"options is invalid\");\n  var featureIndex = options.featureIndex || 0;\n  var multiFeatureIndex = options.multiFeatureIndex || 0;\n  var geometryIndex = options.geometryIndex || 0;\n  var segmentIndex = options.segmentIndex || 0;\n  var properties = options.properties;\n  var geometry;\n  switch (geojson.type) {\n    case \"FeatureCollection\":\n      if (featureIndex < 0)\n        featureIndex = geojson.features.length + featureIndex;\n      properties = properties || geojson.features[featureIndex].properties;\n      geometry = geojson.features[featureIndex].geometry;\n      break;\n    case \"Feature\":\n      properties = properties || geojson.properties;\n      geometry = geojson.geometry;\n      break;\n    case \"Point\":\n    case \"MultiPoint\":\n      return null;\n    case \"LineString\":\n    case \"Polygon\":\n    case \"MultiLineString\":\n    case \"MultiPolygon\":\n      geometry = geojson;\n      break;\n    default:\n      throw new Error(\"geojson is invalid\");\n  }\n  if (geometry === null) return null;\n  var coords = geometry.coordinates;\n  switch (geometry.type) {\n    case \"Point\":\n    case \"MultiPoint\":\n      return null;\n    case \"LineString\":\n      if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1;\n      return lineString(\n        // @ts-expect-error: Known type conflict\n        [coords[segmentIndex], coords[segmentIndex + 1]],\n        properties,\n        options\n      );\n    case \"Polygon\":\n      if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n      if (segmentIndex < 0)\n        segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n      return lineString(\n        [\n          // @ts-expect-error: Known type conflict\n          coords[geometryIndex][segmentIndex],\n          // @ts-expect-error: Known type conflict\n          coords[geometryIndex][segmentIndex + 1]\n        ],\n        properties,\n        options\n      );\n    case \"MultiLineString\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (segmentIndex < 0)\n        segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n      return lineString(\n        [\n          // @ts-expect-error: Known type conflict\n          coords[multiFeatureIndex][segmentIndex],\n          // @ts-expect-error: Known type conflict\n          coords[multiFeatureIndex][segmentIndex + 1]\n        ],\n        properties,\n        options\n      );\n    case \"MultiPolygon\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (geometryIndex < 0)\n        geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n      if (segmentIndex < 0)\n        segmentIndex = // @ts-expect-error: Known type conflict\n        coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n      return lineString(\n        [\n          // @ts-expect-error: Known type conflict\n          coords[multiFeatureIndex][geometryIndex][segmentIndex],\n          // @ts-expect-error: Known type conflict\n          coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]\n        ],\n        properties,\n        options\n      );\n  }\n  throw new Error(\"geojson is invalid\");\n}\nfunction findPoint(geojson, options) {\n  options = options || {};\n  if (!isObject(options)) throw new Error(\"options is invalid\");\n  var featureIndex = options.featureIndex || 0;\n  var multiFeatureIndex = options.multiFeatureIndex || 0;\n  var geometryIndex = options.geometryIndex || 0;\n  var coordIndex = options.coordIndex || 0;\n  var properties = options.properties;\n  var geometry;\n  switch (geojson.type) {\n    case \"FeatureCollection\":\n      if (featureIndex < 0)\n        featureIndex = geojson.features.length + featureIndex;\n      properties = properties || geojson.features[featureIndex].properties;\n      geometry = geojson.features[featureIndex].geometry;\n      break;\n    case \"Feature\":\n      properties = properties || geojson.properties;\n      geometry = geojson.geometry;\n      break;\n    case \"Point\":\n    case \"MultiPoint\":\n      return null;\n    case \"LineString\":\n    case \"Polygon\":\n    case \"MultiLineString\":\n    case \"MultiPolygon\":\n      geometry = geojson;\n      break;\n    default:\n      throw new Error(\"geojson is invalid\");\n  }\n  if (geometry === null) return null;\n  var coords = geometry.coordinates;\n  switch (geometry.type) {\n    case \"Point\":\n      return point(coords, properties, options);\n    case \"MultiPoint\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      return point(coords[multiFeatureIndex], properties, options);\n    case \"LineString\":\n      if (coordIndex < 0) coordIndex = coords.length + coordIndex;\n      return point(coords[coordIndex], properties, options);\n    case \"Polygon\":\n      if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n      if (coordIndex < 0)\n        coordIndex = coords[geometryIndex].length + coordIndex;\n      return point(coords[geometryIndex][coordIndex], properties, options);\n    case \"MultiLineString\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (coordIndex < 0)\n        coordIndex = coords[multiFeatureIndex].length + coordIndex;\n      return point(coords[multiFeatureIndex][coordIndex], properties, options);\n    case \"MultiPolygon\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (geometryIndex < 0)\n        geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n      if (coordIndex < 0)\n        coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n      return point(\n        coords[multiFeatureIndex][geometryIndex][coordIndex],\n        properties,\n        options\n      );\n  }\n  throw new Error(\"geojson is invalid\");\n}\nexport {\n  coordAll,\n  coordEach,\n  coordReduce,\n  featureEach,\n  featureReduce,\n  findPoint,\n  findSegment,\n  flattenEach,\n  flattenReduce,\n  geomEach,\n  geomReduce,\n  lineEach,\n  lineReduce,\n  propEach,\n  propReduce,\n  segmentEach,\n  segmentReduce\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport { earthRadius } from \"@turf/helpers\";\nimport { geomReduce } from \"@turf/meta\";\nfunction area(geojson) {\n  return geomReduce(\n    geojson,\n    (value, geom) => {\n      return value + calculateArea(geom);\n    },\n    0\n  );\n}\nfunction calculateArea(geom) {\n  let total = 0;\n  let i;\n  switch (geom.type) {\n    case \"Polygon\":\n      return polygonArea(geom.coordinates);\n    case \"MultiPolygon\":\n      for (i = 0; i < geom.coordinates.length; i++) {\n        total += polygonArea(geom.coordinates[i]);\n      }\n      return total;\n    case \"Point\":\n    case \"MultiPoint\":\n    case \"LineString\":\n    case \"MultiLineString\":\n      return 0;\n  }\n  return 0;\n}\nfunction polygonArea(coords) {\n  let total = 0;\n  if (coords && coords.length > 0) {\n    total += Math.abs(ringArea(coords[0]));\n    for (let i = 1; i < coords.length; i++) {\n      total -= Math.abs(ringArea(coords[i]));\n    }\n  }\n  return total;\n}\nvar FACTOR = earthRadius * earthRadius / 2;\nvar PI_OVER_180 = Math.PI / 180;\nfunction ringArea(coords) {\n  const coordsLength = coords.length - 1;\n  if (coordsLength <= 2) return 0;\n  let total = 0;\n  let i = 0;\n  while (i < coordsLength) {\n    const lower = coords[i];\n    const middle = coords[i + 1 === coordsLength ? 0 : i + 1];\n    const upper = coords[i + 2 >= coordsLength ? (i + 2) % coordsLength : i + 2];\n    const lowerX = lower[0] * PI_OVER_180;\n    const middleY = middle[1] * PI_OVER_180;\n    const upperX = upper[0] * PI_OVER_180;\n    total += (upperX - lowerX) * Math.sin(middleY);\n    i++;\n  }\n  return total * FACTOR;\n}\nvar index_default = area;\nexport {\n  area,\n  index_default as default\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport { isNumber } from \"@turf/helpers\";\nfunction getCoord(coord) {\n  if (!coord) {\n    throw new Error(\"coord is required\");\n  }\n  if (!Array.isArray(coord)) {\n    if (coord.type === \"Feature\" && coord.geometry !== null && coord.geometry.type === \"Point\") {\n      return [...coord.geometry.coordinates];\n    }\n    if (coord.type === \"Point\") {\n      return [...coord.coordinates];\n    }\n  }\n  if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {\n    return [...coord];\n  }\n  throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\n}\nfunction getCoords(coords) {\n  if (Array.isArray(coords)) {\n    return coords;\n  }\n  if (coords.type === \"Feature\") {\n    if (coords.geometry !== null) {\n      return coords.geometry.coordinates;\n    }\n  } else {\n    if (coords.coordinates) {\n      return coords.coordinates;\n    }\n  }\n  throw new Error(\n    \"coords must be GeoJSON Feature, Geometry Object or an Array\"\n  );\n}\nfunction containsNumber(coordinates) {\n  if (coordinates.length > 1 && isNumber(coordinates[0]) && isNumber(coordinates[1])) {\n    return true;\n  }\n  if (Array.isArray(coordinates[0]) && coordinates[0].length) {\n    return containsNumber(coordinates[0]);\n  }\n  throw new Error(\"coordinates must only contain numbers\");\n}\nfunction geojsonType(value, type, name) {\n  if (!type || !name) {\n    throw new Error(\"type and name required\");\n  }\n  if (!value || value.type !== type) {\n    throw new Error(\n      \"Invalid input to \" + name + \": must be a \" + type + \", given \" + value.type\n    );\n  }\n}\nfunction featureOf(feature, type, name) {\n  if (!feature) {\n    throw new Error(\"No feature passed\");\n  }\n  if (!name) {\n    throw new Error(\".featureOf() requires a name\");\n  }\n  if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n    throw new Error(\n      \"Invalid input to \" + name + \", Feature with geometry required\"\n    );\n  }\n  if (!feature.geometry || feature.geometry.type !== type) {\n    throw new Error(\n      \"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type\n    );\n  }\n}\nfunction collectionOf(featureCollection, type, name) {\n  if (!featureCollection) {\n    throw new Error(\"No featureCollection passed\");\n  }\n  if (!name) {\n    throw new Error(\".collectionOf() requires a name\");\n  }\n  if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\n    throw new Error(\n      \"Invalid input to \" + name + \", FeatureCollection required\"\n    );\n  }\n  for (const feature of featureCollection.features) {\n    if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n      throw new Error(\n        \"Invalid input to \" + name + \", Feature with geometry required\"\n      );\n    }\n    if (!feature.geometry || feature.geometry.type !== type) {\n      throw new Error(\n        \"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type\n      );\n    }\n  }\n}\nfunction getGeom(geojson) {\n  if (geojson.type === \"Feature\") {\n    return geojson.geometry;\n  }\n  return geojson;\n}\nfunction getType(geojson, _name) {\n  if (geojson.type === \"FeatureCollection\") {\n    return \"FeatureCollection\";\n  }\n  if (geojson.type === \"GeometryCollection\") {\n    return \"GeometryCollection\";\n  }\n  if (geojson.type === \"Feature\" && geojson.geometry !== null) {\n    return geojson.geometry.type;\n  }\n  return geojson.type;\n}\nexport {\n  collectionOf,\n  containsNumber,\n  featureOf,\n  geojsonType,\n  getCoord,\n  getCoords,\n  getGeom,\n  getType\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport {\n  degreesToRadians,\n  lengthToRadians,\n  point,\n  radiansToDegrees\n} from \"@turf/helpers\";\nimport { getCoord } from \"@turf/invariant\";\nfunction destination(origin, distance, bearing, options = {}) {\n  const coordinates1 = getCoord(origin);\n  const longitude1 = degreesToRadians(coordinates1[0]);\n  const latitude1 = degreesToRadians(coordinates1[1]);\n  const bearingRad = degreesToRadians(bearing);\n  const radians = lengthToRadians(distance, options.units);\n  const latitude2 = Math.asin(\n    Math.sin(latitude1) * Math.cos(radians) + Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad)\n  );\n  const longitude2 = longitude1 + Math.atan2(\n    Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1),\n    Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2)\n  );\n  const lng = radiansToDegrees(longitude2);\n  const lat = radiansToDegrees(latitude2);\n  if (coordinates1[2] !== void 0) {\n    return point([lng, lat, coordinates1[2]], options.properties);\n  }\n  return point([lng, lat], options.properties);\n}\nvar index_default = destination;\nexport {\n  index_default as default,\n  destination\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport { destination } from \"@turf/destination\";\nimport { polygon } from \"@turf/helpers\";\nfunction circle(center, radius, options = {}) {\n  const steps = options.steps || 64;\n  const properties = options.properties ? options.properties : !Array.isArray(center) && center.type === \"Feature\" && center.properties ? center.properties : {};\n  const coordinates = [];\n  for (let i = 0; i < steps; i++) {\n    coordinates.push(\n      destination(center, radius, i * -360 / steps, options).geometry.coordinates\n    );\n  }\n  coordinates.push(coordinates[0]);\n  return polygon([coordinates], properties);\n}\nvar index_default = circle;\nexport {\n  circle,\n  index_default as default\n};\n//# sourceMappingURL=index.js.map","import type { DrawPlugin } from '@/plugins/draw/plugin.ts';\nimport type { DrawFeatureProperties, DrawModel } from '@/plugins/draw/types.ts';\nimport area from '@turf/area';\nimport circle from '@turf/circle';\nimport type { Feature, FeatureCollection, MultiPoint, Polygon, Position } from 'geojson';\nimport type { GeoJSONSource, LngLatLike, Map, MapLayerMouseEvent, MapLayerTouchEvent } from 'maplibre-gl';\n\nexport abstract class AbstractDrawMode {\n\n\tisTouchEventSupported: boolean = window !== undefined && !!window.TouchEvent;\n\tplugin: DrawPlugin;\n\tmap: Map;\n\tsource: GeoJSONSource;\n\n\tcollection: FeatureCollection<Polygon | MultiPoint, DrawFeatureProperties> | undefined;\n\n\tprotected constructor(plugin: DrawPlugin, map: Map, source: GeoJSONSource) {\n\t\tthis.plugin = plugin;\n\t\tthis.map    = map;\n\t\tthis.source = source;\n\t}\n\n\thasPolygon() {\n\t\treturn !!this.collection?.features[ 0 ];\n\t}\n\n\tgetPolygon(): Feature<Polygon, DrawFeatureProperties> {\n\t\treturn this.collection!.features[ 0 ] as Feature<Polygon, DrawFeatureProperties>;\n\t}\n\n\tclonePolygon(): Position[] {\n\t\treturn this.getPolygon().geometry.coordinates[ 0 ].map((p) => [ p[ 0 ], p[ 1 ] ]) as Position[];\n\t}\n\n\tisNearby(a: Position, b: { x: number, y: number }, isTouch: boolean): boolean {\n\t\tconst tolerance = isTouch ? this.plugin.options.pointerPrecision.touch : this.plugin.options.pointerPrecision.mouse,\n\t\t\t  point     = this.map.project(a as LngLatLike),\n\t\t\t  distance  = Math.sqrt((b.x - point.x) ** 2 + (b.y - point.y) ** 2);\n\t\treturn distance <= tolerance;\n\t}\n\n\tgetMidpoint(a: Position, b: Position): Position {\n\t\treturn [ (a[ 0 ] + b[ 0 ]) / 2, (a[ 1 ] + b[ 1 ]) / 2 ];\n\t}\n\n\tclear() {\n\t\tthis.source?.setData({ type: 'FeatureCollection', features: [] });\n\t}\n\n\trender() {\n\t\tif (!this.source) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.plugin.options.minArea.size && this.collection?.features[ 0 ]) {\n\t\t\tconst areaSize                                         = this.getAreaSize(this.collection!.features[ 0 ] as Feature<Polygon, DrawFeatureProperties>);\n\t\t\tthis.collection!.features[ 0 ].properties.area         = areaSize;\n\t\t\tthis.collection!.features[ 0 ].properties.tooSmall     = areaSize < this.plugin.options.minArea.size && !this.collection!.features[ 0 ].properties.hasHelperVertex;\n\t\t\tthis.collection!.features[ 0 ].properties.minSizeLabel = this.plugin.options.minArea.label;\n\t\t}\n\t\tthis.source.setData(this.collection ?? { type: 'FeatureCollection', features: [] });\n\t}\n\n\temitOnUpdate(feature?: Feature<Polygon, DrawFeatureProperties>) {\n\t\tif (feature) {\n\t\t\tthis.plugin.options.onUpdate?.(feature);\n\t\t} else if (this.collection) {\n\t\t\tthis.plugin.options.onUpdate?.(this.collection!.features[ 0 ] as Feature<Polygon, DrawFeatureProperties>);\n\t\t}\n\t}\n\n\tcreateCircle(center: Position, radius: number, steps = 64): Feature<Polygon, DrawFeatureProperties> {\n\t\tconst c               = circle<DrawFeatureProperties>(center, radius,\n\t\t\t{\n\t\t\t\tunits     : 'meters', steps,\n\t\t\t\tproperties: { center, radius, meta: 'circle', minSizeLabel: this.plugin.options.minArea.label }\n\t\t\t});\n\t\tc.properties.area     = this.getAreaSize(c);\n\t\tc.properties.tooSmall = c.properties.area < (this.plugin.options.minArea.size ?? -1);\n\t\treturn c;\n\t}\n\n\t// returns m²\n\tgetAreaSize(model: Feature<Polygon, DrawFeatureProperties>): number {\n\t\tif (model.properties.meta === 'circle' && model.properties.radius) {\n\t\t\treturn Math.PI * Math.pow(model.properties.radius, 2);\n\t\t}\n\t\treturn area(model);\n\t}\n\n\tisTouchEvent(e: MapLayerMouseEvent | MapLayerTouchEvent): boolean {\n\t\tif (this.isTouchEventSupported) {\n\t\t\treturn e.originalEvent instanceof TouchEvent;\n\t\t}\n\t\treturn false;\n\t}\n\n\tabstract register(): void;\n\n\tabstract unregister(): void;\n\n\tabstract setModel(model: DrawModel | undefined): void;\n\n\tabstract onOptionsUpdate(): void;\n\n}\n","export const epsilon = 1.1102230246251565e-16;\nexport const splitter = 134217729;\nexport const resulterrbound = (3 + 8 * epsilon) * epsilon;\n\n// fast_expansion_sum_zeroelim routine from oritinal code\nexport function sum(elen, e, flen, f, h) {\n    let Q, Qnew, hh, bvirt;\n    let enow = e[0];\n    let fnow = f[0];\n    let eindex = 0;\n    let findex = 0;\n    if ((fnow > enow) === (fnow > -enow)) {\n        Q = enow;\n        enow = e[++eindex];\n    } else {\n        Q = fnow;\n        fnow = f[++findex];\n    }\n    let hindex = 0;\n    if (eindex < elen && findex < flen) {\n        if ((fnow > enow) === (fnow > -enow)) {\n            Qnew = enow + Q;\n            hh = Q - (Qnew - enow);\n            enow = e[++eindex];\n        } else {\n            Qnew = fnow + Q;\n            hh = Q - (Qnew - fnow);\n            fnow = f[++findex];\n        }\n        Q = Qnew;\n        if (hh !== 0) {\n            h[hindex++] = hh;\n        }\n        while (eindex < elen && findex < flen) {\n            if ((fnow > enow) === (fnow > -enow)) {\n                Qnew = Q + enow;\n                bvirt = Qnew - Q;\n                hh = Q - (Qnew - bvirt) + (enow - bvirt);\n                enow = e[++eindex];\n            } else {\n                Qnew = Q + fnow;\n                bvirt = Qnew - Q;\n                hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n                fnow = f[++findex];\n            }\n            Q = Qnew;\n            if (hh !== 0) {\n                h[hindex++] = hh;\n            }\n        }\n    }\n    while (eindex < elen) {\n        Qnew = Q + enow;\n        bvirt = Qnew - Q;\n        hh = Q - (Qnew - bvirt) + (enow - bvirt);\n        enow = e[++eindex];\n        Q = Qnew;\n        if (hh !== 0) {\n            h[hindex++] = hh;\n        }\n    }\n    while (findex < flen) {\n        Qnew = Q + fnow;\n        bvirt = Qnew - Q;\n        hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n        fnow = f[++findex];\n        Q = Qnew;\n        if (hh !== 0) {\n            h[hindex++] = hh;\n        }\n    }\n    if (Q !== 0 || hindex === 0) {\n        h[hindex++] = Q;\n    }\n    return hindex;\n}\n\nexport function sum_three(alen, a, blen, b, clen, c, tmp, out) {\n    return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out);\n}\n\n// scale_expansion_zeroelim routine from oritinal code\nexport function scale(elen, e, b, h) {\n    let Q, sum, hh, product1, product0;\n    let bvirt, c, ahi, alo, bhi, blo;\n\n    c = splitter * b;\n    bhi = c - (c - b);\n    blo = b - bhi;\n    let enow = e[0];\n    Q = enow * b;\n    c = splitter * enow;\n    ahi = c - (c - enow);\n    alo = enow - ahi;\n    hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo);\n    let hindex = 0;\n    if (hh !== 0) {\n        h[hindex++] = hh;\n    }\n    for (let i = 1; i < elen; i++) {\n        enow = e[i];\n        product1 = enow * b;\n        c = splitter * enow;\n        ahi = c - (c - enow);\n        alo = enow - ahi;\n        product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo);\n        sum = Q + product0;\n        bvirt = sum - Q;\n        hh = Q - (sum - bvirt) + (product0 - bvirt);\n        if (hh !== 0) {\n            h[hindex++] = hh;\n        }\n        Q = product1 + sum;\n        hh = sum - (Q - product1);\n        if (hh !== 0) {\n            h[hindex++] = hh;\n        }\n    }\n    if (Q !== 0 || hindex === 0) {\n        h[hindex++] = Q;\n    }\n    return hindex;\n}\n\nexport function negate(elen, e) {\n    for (let i = 0; i < elen; i++) e[i] = -e[i];\n    return elen;\n}\n\nexport function estimate(elen, e) {\n    let Q = e[0];\n    for (let i = 1; i < elen; i++) Q += e[i];\n    return Q;\n}\n\nexport function vec(n) {\n    return new Float64Array(n);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum} from './util.js';\n\nconst ccwerrboundA = (3 + 16 * epsilon) * epsilon;\nconst ccwerrboundB = (2 + 12 * epsilon) * epsilon;\nconst ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;\n\nconst B = vec(4);\nconst C1 = vec(8);\nconst C2 = vec(12);\nconst D = vec(16);\nconst u = vec(4);\n\nfunction orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {\n    let acxtail, acytail, bcxtail, bcytail;\n    let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n    const acx = ax - cx;\n    const bcx = bx - cx;\n    const acy = ay - cy;\n    const bcy = by - cy;\n\n    s1 = acx * bcy;\n    c = splitter * acx;\n    ahi = c - (c - acx);\n    alo = acx - ahi;\n    c = splitter * bcy;\n    bhi = c - (c - bcy);\n    blo = bcy - bhi;\n    s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n    t1 = acy * bcx;\n    c = splitter * acy;\n    ahi = c - (c - acy);\n    alo = acy - ahi;\n    c = splitter * bcx;\n    bhi = c - (c - bcx);\n    blo = bcx - bhi;\n    t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n    _i = s0 - t0;\n    bvirt = s0 - _i;\n    B[0] = s0 - (_i + bvirt) + (bvirt - t0);\n    _j = s1 + _i;\n    bvirt = _j - s1;\n    _0 = s1 - (_j - bvirt) + (_i - bvirt);\n    _i = _0 - t1;\n    bvirt = _0 - _i;\n    B[1] = _0 - (_i + bvirt) + (bvirt - t1);\n    u3 = _j + _i;\n    bvirt = u3 - _j;\n    B[2] = _j - (u3 - bvirt) + (_i - bvirt);\n    B[3] = u3;\n\n    let det = estimate(4, B);\n    let errbound = ccwerrboundB * detsum;\n    if (det >= errbound || -det >= errbound) {\n        return det;\n    }\n\n    bvirt = ax - acx;\n    acxtail = ax - (acx + bvirt) + (bvirt - cx);\n    bvirt = bx - bcx;\n    bcxtail = bx - (bcx + bvirt) + (bvirt - cx);\n    bvirt = ay - acy;\n    acytail = ay - (acy + bvirt) + (bvirt - cy);\n    bvirt = by - bcy;\n    bcytail = by - (bcy + bvirt) + (bvirt - cy);\n\n    if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {\n        return det;\n    }\n\n    errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);\n    det += (acx * bcytail + bcy * acxtail) - (acy * bcxtail + bcx * acytail);\n    if (det >= errbound || -det >= errbound) return det;\n\n    s1 = acxtail * bcy;\n    c = splitter * acxtail;\n    ahi = c - (c - acxtail);\n    alo = acxtail - ahi;\n    c = splitter * bcy;\n    bhi = c - (c - bcy);\n    blo = bcy - bhi;\n    s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n    t1 = acytail * bcx;\n    c = splitter * acytail;\n    ahi = c - (c - acytail);\n    alo = acytail - ahi;\n    c = splitter * bcx;\n    bhi = c - (c - bcx);\n    blo = bcx - bhi;\n    t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n    _i = s0 - t0;\n    bvirt = s0 - _i;\n    u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n    _j = s1 + _i;\n    bvirt = _j - s1;\n    _0 = s1 - (_j - bvirt) + (_i - bvirt);\n    _i = _0 - t1;\n    bvirt = _0 - _i;\n    u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n    u3 = _j + _i;\n    bvirt = u3 - _j;\n    u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n    u[3] = u3;\n    const C1len = sum(4, B, 4, u, C1);\n\n    s1 = acx * bcytail;\n    c = splitter * acx;\n    ahi = c - (c - acx);\n    alo = acx - ahi;\n    c = splitter * bcytail;\n    bhi = c - (c - bcytail);\n    blo = bcytail - bhi;\n    s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n    t1 = acy * bcxtail;\n    c = splitter * acy;\n    ahi = c - (c - acy);\n    alo = acy - ahi;\n    c = splitter * bcxtail;\n    bhi = c - (c - bcxtail);\n    blo = bcxtail - bhi;\n    t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n    _i = s0 - t0;\n    bvirt = s0 - _i;\n    u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n    _j = s1 + _i;\n    bvirt = _j - s1;\n    _0 = s1 - (_j - bvirt) + (_i - bvirt);\n    _i = _0 - t1;\n    bvirt = _0 - _i;\n    u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n    u3 = _j + _i;\n    bvirt = u3 - _j;\n    u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n    u[3] = u3;\n    const C2len = sum(C1len, C1, 4, u, C2);\n\n    s1 = acxtail * bcytail;\n    c = splitter * acxtail;\n    ahi = c - (c - acxtail);\n    alo = acxtail - ahi;\n    c = splitter * bcytail;\n    bhi = c - (c - bcytail);\n    blo = bcytail - bhi;\n    s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n    t1 = acytail * bcxtail;\n    c = splitter * acytail;\n    ahi = c - (c - acytail);\n    alo = acytail - ahi;\n    c = splitter * bcxtail;\n    bhi = c - (c - bcxtail);\n    blo = bcxtail - bhi;\n    t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n    _i = s0 - t0;\n    bvirt = s0 - _i;\n    u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n    _j = s1 + _i;\n    bvirt = _j - s1;\n    _0 = s1 - (_j - bvirt) + (_i - bvirt);\n    _i = _0 - t1;\n    bvirt = _0 - _i;\n    u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n    u3 = _j + _i;\n    bvirt = u3 - _j;\n    u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n    u[3] = u3;\n    const Dlen = sum(C2len, C2, 4, u, D);\n\n    return D[Dlen - 1];\n}\n\nexport function orient2d(ax, ay, bx, by, cx, cy) {\n    const detleft = (ay - cy) * (bx - cx);\n    const detright = (ax - cx) * (by - cy);\n    const det = detleft - detright;\n\n    const detsum = Math.abs(detleft + detright);\n    if (Math.abs(det) >= ccwerrboundA * detsum) return det;\n\n    return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);\n}\n\nexport function orient2dfast(ax, ay, bx, by, cx, cy) {\n    return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy);\n}\n","import { orient2d } from 'robust-predicates';\n\nfunction pointInPolygon(p, polygon) {\n    var i;\n    var ii;\n    var k = 0;\n    var f;\n    var u1;\n    var v1;\n    var u2;\n    var v2;\n    var currentP;\n    var nextP;\n\n    var x = p[0];\n    var y = p[1];\n\n    var numContours = polygon.length;\n    for (i = 0; i < numContours; i++) {\n        ii = 0;\n        var contour = polygon[i];\n        var contourLen = contour.length - 1;\n\n        currentP = contour[0];\n        if (currentP[0] !== contour[contourLen][0] &&\n            currentP[1] !== contour[contourLen][1]) {\n            throw new Error('First and last coordinates in a ring must be the same')\n        }\n\n        u1 = currentP[0] - x;\n        v1 = currentP[1] - y;\n\n        for (ii; ii < contourLen; ii++) {\n            nextP = contour[ii + 1];\n\n            u2 = nextP[0] - x;\n            v2 = nextP[1] - y;\n\n            if (v1 === 0 && v2 === 0) {\n                if ((u2 <= 0 && u1 >= 0) || (u1 <= 0 && u2 >= 0)) { return 0 }\n            } else if ((v2 >= 0 && v1 <= 0) || (v2 <= 0 && v1 >= 0)) {\n                f = orient2d(u1, u2, v1, v2, 0, 0);\n                if (f === 0) { return 0 }\n                if ((f > 0 && v2 > 0 && v1 <= 0) || (f < 0 && v2 <= 0 && v1 > 0)) { k++; }\n            }\n            currentP = nextP;\n            v1 = v2;\n            u1 = u2;\n        }\n    }\n\n    if (k % 2 === 0) { return false }\n    return true\n}\n\nexport { pointInPolygon as default };\n","// index.ts\nimport pip from \"point-in-polygon-hao\";\nimport { getCoord, getGeom } from \"@turf/invariant\";\nfunction booleanPointInPolygon(point, polygon, options = {}) {\n  if (!point) {\n    throw new Error(\"point is required\");\n  }\n  if (!polygon) {\n    throw new Error(\"polygon is required\");\n  }\n  const pt = getCoord(point);\n  const geom = getGeom(polygon);\n  const type = geom.type;\n  const bbox = polygon.bbox;\n  let polys = geom.coordinates;\n  if (bbox && inBBox(pt, bbox) === false) {\n    return false;\n  }\n  if (type === \"Polygon\") {\n    polys = [polys];\n  }\n  let result = false;\n  for (var i = 0; i < polys.length; ++i) {\n    const polyResult = pip(pt, polys[i]);\n    if (polyResult === 0) return options.ignoreBoundary ? false : true;\n    else if (polyResult) result = true;\n  }\n  return result;\n}\nfunction inBBox(pt, bbox) {\n  return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];\n}\nvar index_default = booleanPointInPolygon;\nexport {\n  booleanPointInPolygon,\n  index_default as default\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport { getCoord } from \"@turf/invariant\";\nimport { radiansToLength, degreesToRadians } from \"@turf/helpers\";\nfunction distance(from, to, options = {}) {\n  var coordinates1 = getCoord(from);\n  var coordinates2 = getCoord(to);\n  var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);\n  var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);\n  var lat1 = degreesToRadians(coordinates1[1]);\n  var lat2 = degreesToRadians(coordinates2[1]);\n  var a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);\n  return radiansToLength(\n    2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)),\n    options.units\n  );\n}\nvar index_default = distance;\nexport {\n  index_default as default,\n  distance\n};\n//# sourceMappingURL=index.js.map","import { throttle } from '@/lib/debounce.ts';\nimport { AbstractDrawMode } from '@/plugins/draw/mode.abstract.ts';\nimport type { DrawPlugin } from '@/plugins/draw/plugin.ts';\nimport type { DrawFeatureProperties, DrawModel, DrawModeSnapshot } from '@/plugins/draw/types.ts';\nimport booleanPointInPolygon from '@turf/boolean-point-in-polygon';\nimport distance from '@turf/distance';\nimport type { Feature, Polygon, Position } from 'geojson';\nimport type { GeoJSONSource, Map, MapLayerMouseEvent, MapLayerTouchEvent } from 'maplibre-gl';\n\nexport class CircleMode extends AbstractDrawMode {\n\n\tprivate _mode: 'move' | 'resize' | undefined;\n\tprivate _moveStart: DrawModeSnapshot | undefined;\n\tprivate _resizeAnker: number | undefined;\n\n\tconstructor(plugin: DrawPlugin, map: Map, source: GeoJSONSource, model: DrawModel | undefined) {\n\t\tsuper(plugin, map, source);\n\t\tthis.onClick     = this.onClick.bind(this);\n\t\tthis.onMouseMove = throttle(this.onMouseMove.bind(this), 16);\n\t\tthis.onMouseDown = this.onMouseDown.bind(this);\n\t\tthis.onMouseUp   = this.onMouseUp.bind(this);\n\t\tthis.setModel(model);\n\t}\n\n\tonClick(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tif (this._mode) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.hasPolygon()) {\n\t\t\tconst polygon = this.getPolygon();\n\t\t\tif (booleanPointInPolygon(e.lngLat.toArray(), polygon)) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\n\t\tconst pos    = e.lngLat.toArray(),\n\t\t\t  pixel  = this.map.unproject([ e.point.x + this.plugin.options.circleMode.creationSize, e.point.y ]),\n\t\t\t  radius = distance(pos, pixel.toArray(), { units: 'meters' }),\n\t\t\t  c      = this.createCircle(pos, radius);\n\n\t\tthis.createFeatureCollection(c);\n\n\t\tthis.generateVertices();\n\t\tthis.render();\n\t\tthis.emitOnUpdate();\n\n\t}\n\n\tonMouseDown(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tif (!this.collection?.features.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ((e as MapLayerTouchEvent).points?.length > 1) {\n\t\t\t// multi touch event\n\t\t\treturn;\n\t\t}\n\n\t\tfor (let i = 0, len = this.collection.features[ 1 ].geometry.coordinates.length; i < len; i++) {\n\t\t\tif (this.isNearby(this.collection.features[ 1 ].geometry.coordinates[ i ] as Position, e.point, this.isTouchEvent(e))) {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._resizeAnker = i;\n\t\t\t\tthis._mode        = 'resize';\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst polygon = this.getPolygon();\n\t\tif (booleanPointInPolygon(e.lngLat.toArray(), polygon)) {\n\t\t\te.preventDefault();\n\t\t\tthis._moveStart = { polygon: this.clonePolygon(), point: [ ...polygon.properties.center! ], start: e.lngLat };\n\t\t\tthis._mode      = 'move';\n\t\t}\n\n\t}\n\n\tonMouseMove(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tif (!this._mode || !this.collection?.features.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet polygon: Feature<Polygon, DrawFeatureProperties>;\n\t\tswitch (this._mode) {\n\t\t\tcase 'move':\n\n\t\t\t\tif (!this._moveStart) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tpolygon = this.getPolygon();\n\n\t\t\t\tconst latd = e.lngLat.lat - this._moveStart.start.lat,\n\t\t\t\t\t  lngd = e.lngLat.lng - this._moveStart.start.lng;\n\t\t\t\tfor (let i = 0, len = polygon.geometry.coordinates[ 0 ].length; i < len; i++) {\n\t\t\t\t\tpolygon.geometry.coordinates[ 0 ][ i ][ 1 ] = this._moveStart.polygon[ i ][ 1 ] + latd;\n\t\t\t\t\tpolygon.geometry.coordinates[ 0 ][ i ][ 0 ] = this._moveStart.polygon[ i ][ 0 ] + lngd;\n\t\t\t\t}\n\t\t\t\tpolygon.properties.center![ 1 ] = this._moveStart.point![ 1 ] + latd;\n\t\t\t\tpolygon.properties.center![ 0 ] = this._moveStart.point![ 0 ] + lngd;\n\n\t\t\t\tthis.generateVertices();\n\t\t\t\tthis.render();\n\t\t\t\tbreak;\n\n\t\t\tcase 'resize':\n\n\t\t\t\tif (!this._resizeAnker) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tpolygon                           = this.getPolygon();\n\t\t\t\tconst radius                      = distance(polygon.properties.center!, e.lngLat.toArray(), { units: 'meters' });\n\t\t\t\tpolygon.geometry.coordinates[ 0 ] = this.createCircle(polygon.properties.center!, radius!).geometry.coordinates[ 0 ];\n\t\t\t\tpolygon.properties.radius         = radius!;\n\n\t\t\t\tthis.generateVertices();\n\t\t\t\tthis.render();\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tonMouseUp(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tif (!this._mode) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this._mode) {\n\t\t\tcase 'move':\n\t\t\tcase 'resize':\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._mode        = undefined;\n\t\t\t\tthis._moveStart   = undefined;\n\t\t\t\tthis._resizeAnker = undefined;\n\t\t\t\tthis.emitOnUpdate();\n\t\t\t\tbreak;\n\t\t}\n\n\t}\n\n\tprivate generateVertices() {\n\n\t\tif (!this.collection) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst polygon  = this.getPolygon(),\n\t\t\t  vertices = this.createCircle(polygon.properties.center!, polygon.properties.radius!, 4);\n\n\t\tthis.collection.features[ 1 ].geometry.coordinates = vertices.geometry.coordinates[ 0 ].slice(0, -1);\n\n\t}\n\n\tprivate createFeatureCollection(model: DrawModel) {\n\t\tthis.collection = {\n\t\t\ttype: 'FeatureCollection', features: [\n\t\t\t\tmodel,\n\t\t\t\t{\n\t\t\t\t\ttype      : 'Feature',\n\t\t\t\t\tgeometry  : {\n\t\t\t\t\t\ttype       : 'MultiPoint',\n\t\t\t\t\t\tcoordinates: []\n\t\t\t\t\t},\n\t\t\t\t\tproperties: { meta: 'vertex' }\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\t}\n\n\tregister(): void {\n\t\tthis.map.on('click', this.onClick);\n\t\tthis.map.on('mousemove', this.onMouseMove);\n\t\tthis.map.on('mousedown', this.onMouseDown);\n\t\tthis.map.on('mouseup', this.onMouseUp);\n\t\tthis.map.on('touchstart', this.onMouseDown);\n\t\tthis.map.on('touchmove', this.onMouseMove);\n\t\tthis.map.on('touchend', this.onMouseUp);\n\t}\n\n\tunregister(): void {\n\t\tthis.map.off('click', this.onClick);\n\t\tthis.map.off('mousemove', this.onMouseMove);\n\t\tthis.map.off('mousedown', this.onMouseDown);\n\t\tthis.map.off('mouseup', this.onMouseUp);\n\t\tthis.map.off('touchstart', this.onMouseDown);\n\t\tthis.map.off('touchmove', this.onMouseMove);\n\t\tthis.map.off('touchend', this.onMouseUp);\n\t}\n\n\tsetModel(model: DrawModel | undefined) {\n\t\tif (model?.properties?.meta === 'circle') {\n\t\t\tthis.createFeatureCollection(model);\n\t\t\tthis.generateVertices();\n\t\t} else {\n\t\t\tthis.collection = undefined;\n\t\t}\n\t\tthis.render();\n\t}\n\n\tonOptionsUpdate() {\n\t\tif (this.collection?.features[ 0 ]) {\n\t\t\tthis.collection.features[ 0 ].properties.minSizeLabel = this.plugin.options.minArea.label;\n\t\t}\n\t}\n\n}\n","export function createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, classes: string): HTMLElementTagNameMap[K] {\n\tconst element = document.createElement(tagName);\n\telement.classList.add(classes);\n\treturn element;\n}\n","import { throttle } from '@/lib/debounce.ts';\nimport { createElement } from '@/plugins/draw/html.ts';\nimport { AbstractDrawMode } from '@/plugins/draw/mode.abstract.ts';\nimport type { DrawPlugin } from '@/plugins/draw/plugin.ts';\nimport type { DrawModel } from '@/plugins/draw/types.ts';\nimport distance from '@turf/distance';\nimport { type GeoJSONSource, type Map, type PaddingOptions } from 'maplibre-gl';\n\nexport class CircleStaticMode extends AbstractDrawMode {\n\n\tprivate _model: DrawModel | undefined;\n\tprivate _container: HTMLDivElement;\n\tprivate _circle: HTMLDivElement;\n\tprivate _widthContstraint: HTMLDivElement;\n\tprivate _heightConstraint: HTMLDivElement;\n\tprivate _minSizeLabel: HTMLDivElement;\n\n\tconstructor(plugin: DrawPlugin, map: Map, source: GeoJSONSource, model: DrawModel | undefined) {\n\t\tsuper(plugin, map, source);\n\t\tthis.onViewportChangeEnd = this.onViewportChangeEnd.bind(this);\n\t\tthis.onViewportChange    = throttle(this.onViewportChange.bind(this), 100);\n\n\t\tthis._model = model;\n\n\t\tthis._container        = createElement('div', 'maplibregl-draw-circle-mode');\n\t\tthis._widthContstraint = createElement('div', 'maplibregl-draw-circle-mode-width-constraint');\n\t\tthis._heightConstraint = createElement('div', 'maplibregl-draw-circle-mode-height-constraint');\n\t\tthis._circle           = createElement('div', 'maplibregl-draw-circle-mode-circle');\n\t\tthis._circle.innerHTML = `<svg class=\"maplibre-draw-min-area-pattern\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\">\n    <defs>\n        <pattern id=\"maplibre-draw-min-area-pattern\" patternUnits=\"userSpaceOnUse\" width=\"4.5\" height=\"4.5\" patternTransform=\"rotate(135)\">\n            <line x1=\"0\" y=\"0\" x2=\"0\" y2=\"4.5\" stroke=\"currentColor\" stroke-width=\"1\" />\n        </pattern>\n    </defs>\n    <rect width=\"100%\" height=\"100%\" fill=\"url(#maplibre-draw-min-area-pattern)\" :opacity=\"1\" />\n</svg>`;\n\t\tthis._minSizeLabel     = createElement('div', 'maplibre-draw-circle-mode-below-min-area-size-label');\n\t\tif (plugin.options.minArea.label) {\n\t\t\tthis._minSizeLabel.textContent = plugin.options.minArea.label;\n\t\t}\n\t\tthis._container.appendChild(this._heightConstraint);\n\t\tthis._heightConstraint.appendChild(this._widthContstraint);\n\t\tthis._widthContstraint.appendChild(this._circle);\n\t\tthis._circle.appendChild(this._minSizeLabel);\n\t\tthis.setPadding();\n\t}\n\n\tonViewportChange() {\n\t\tthis._model = this.viewportToModel();\n\t\tif (this._model.properties.tooSmall) {\n\t\t\tthis._circle.classList.add('maplibregl-draw-circle-too-small');\n\t\t} else {\n\t\t\tthis._circle.classList.remove('maplibregl-draw-circle-too-small');\n\t\t}\n\t}\n\n\n\tonViewportChangeEnd() {\n\t\tthis._model = this.viewportToModel();\n\t\tthis.emitOnUpdate(this._model);\n\t\tif (this._model.properties.tooSmall) {\n\t\t\tthis._circle.classList.add('maplibregl-draw-circle-too-small');\n\t\t} else {\n\t\t\tthis._circle.classList.remove('maplibregl-draw-circle-too-small');\n\t\t}\n\t\t// to debug: make polygon visible on map\n\t\t// this.collection = { type: 'FeatureCollection', features: [ this._model ] };\n\t\t// this.render();\n\t}\n\n\tviewportToModel() {\n\t\tconst left      = this._container.offsetLeft + this._circle.offsetLeft,\n\t\t\t  top       = this._container.offsetTop + this._circle.offsetTop,\n\t\t\t  center    = this.map.unproject([ left + (this._circle.offsetWidth / 2), top + (this._circle.offsetHeight / 2) ]),\n\t\t\t  topCenter = this.map.unproject([ left + (this._circle.offsetWidth / 2), top ]),\n\t\t\t  pos       = center.toArray(),\n\t\t\t  radius    = distance(topCenter.toArray(), pos, { units: 'meters' });\n\n\t\treturn this.createCircle(pos, radius);\n\t}\n\n\tregister(): void {\n\t\tthis.map.getCanvasContainer().appendChild(this._container);\n\t\tthis.map.on('dragend', this.onViewportChangeEnd);\n\t\tthis.map.on('zoomend', this.onViewportChangeEnd);\n\t\tthis.map.on('zoom', this.onViewportChange);\n\t}\n\n\tunregister(): void {\n\t\tthis.map.getCanvasContainer().removeChild(this._container);\n\t\tthis.map.off('dragend', this.onViewportChangeEnd);\n\t\tthis.map.off('zoomend', this.onViewportChangeEnd);\n\t\tthis.map.off('zoom', this.onViewportChange);\n\t}\n\n\tsetModel(model: DrawModel | undefined): void {\n\t\tif (model?.properties.meta === 'circle') {\n\t\t\tthis._model = this.createCircle(model.properties.center!, model.properties.radius!);\n\t\t} else {\n\t\t\tthis._model = undefined;\n\t\t}\n\t}\n\n\tsetPadding() {\n\t\tconst padding = this.plugin.options.fitBoundsOptions?.padding;\n\t\tswitch (typeof padding) {\n\t\t\tcase 'number':\n\t\t\t\tthis._container.style.setProperty('--padding', `${padding}px`);\n\t\t\t\tbreak;\n\t\t\tcase 'object':\n\t\t\t\tlet side: keyof PaddingOptions;\n\t\t\t\tfor (side in padding) {\n\t\t\t\t\tif (typeof padding[ side ] === 'number') {\n\t\t\t\t\t\tthis._container.style.setProperty(`--padding-${side}`, `${padding[ side ]}px`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonOptionsUpdate() {\n\t\tif (this.plugin.options.minArea.label) {\n\t\t\tthis._minSizeLabel.textContent = this.plugin.options.minArea.label;\n\t\t}\n\t}\n\n}\n","// index.ts\nimport { getCoord, getCoords } from \"@turf/invariant\";\nfunction booleanPointOnLine(pt, line, options = {}) {\n  const ptCoords = getCoord(pt);\n  const lineCoords = getCoords(line);\n  for (let i = 0; i < lineCoords.length - 1; i++) {\n    let ignoreBoundary = false;\n    if (options.ignoreEndVertices) {\n      if (i === 0) {\n        ignoreBoundary = \"start\";\n      }\n      if (i === lineCoords.length - 2) {\n        ignoreBoundary = \"end\";\n      }\n      if (i === 0 && i + 1 === lineCoords.length - 1) {\n        ignoreBoundary = \"both\";\n      }\n    }\n    if (isPointOnLineSegment(\n      lineCoords[i],\n      lineCoords[i + 1],\n      ptCoords,\n      ignoreBoundary,\n      typeof options.epsilon === \"undefined\" ? null : options.epsilon\n    )) {\n      return true;\n    }\n  }\n  return false;\n}\nfunction isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon) {\n  const x = pt[0];\n  const y = pt[1];\n  const x1 = lineSegmentStart[0];\n  const y1 = lineSegmentStart[1];\n  const x2 = lineSegmentEnd[0];\n  const y2 = lineSegmentEnd[1];\n  const dxc = pt[0] - x1;\n  const dyc = pt[1] - y1;\n  const dxl = x2 - x1;\n  const dyl = y2 - y1;\n  const cross = dxc * dyl - dyc * dxl;\n  if (epsilon !== null) {\n    if (Math.abs(cross) > epsilon) {\n      return false;\n    }\n  } else if (cross !== 0) {\n    return false;\n  }\n  if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {\n    if (excludeBoundary) {\n      return false;\n    }\n    if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {\n      return true;\n    } else {\n      return false;\n    }\n  }\n  if (!excludeBoundary) {\n    if (Math.abs(dxl) >= Math.abs(dyl)) {\n      return dxl > 0 ? x1 <= x && x <= x2 : x2 <= x && x <= x1;\n    }\n    return dyl > 0 ? y1 <= y && y <= y2 : y2 <= y && y <= y1;\n  } else if (excludeBoundary === \"start\") {\n    if (Math.abs(dxl) >= Math.abs(dyl)) {\n      return dxl > 0 ? x1 < x && x <= x2 : x2 <= x && x < x1;\n    }\n    return dyl > 0 ? y1 < y && y <= y2 : y2 <= y && y < y1;\n  } else if (excludeBoundary === \"end\") {\n    if (Math.abs(dxl) >= Math.abs(dyl)) {\n      return dxl > 0 ? x1 <= x && x < x2 : x2 < x && x <= x1;\n    }\n    return dyl > 0 ? y1 <= y && y < y2 : y2 < y && y <= y1;\n  } else if (excludeBoundary === \"both\") {\n    if (Math.abs(dxl) >= Math.abs(dyl)) {\n      return dxl > 0 ? x1 < x && x < x2 : x2 < x && x < x1;\n    }\n    return dyl > 0 ? y1 < y && y < y2 : y2 < y && y < y1;\n  }\n  return false;\n}\nvar index_default = booleanPointOnLine;\nexport {\n  booleanPointOnLine,\n  index_default as default\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport { feature } from \"@turf/helpers\";\nimport { getCoords, getType } from \"@turf/invariant\";\nimport { booleanPointOnLine } from \"@turf/boolean-point-on-line\";\nimport { lineString } from \"@turf/helpers\";\nfunction cleanCoords(geojson, options = {}) {\n  var mutate = typeof options === \"object\" ? options.mutate : options;\n  if (!geojson) throw new Error(\"geojson is required\");\n  var type = getType(geojson);\n  var newCoords = [];\n  switch (type) {\n    case \"LineString\":\n      newCoords = cleanLine(geojson, type);\n      break;\n    case \"MultiLineString\":\n    case \"Polygon\":\n      getCoords(geojson).forEach(function(line) {\n        newCoords.push(cleanLine(line, type));\n      });\n      break;\n    case \"MultiPolygon\":\n      getCoords(geojson).forEach(function(polygons) {\n        var polyPoints = [];\n        polygons.forEach(function(ring) {\n          polyPoints.push(cleanLine(ring, type));\n        });\n        newCoords.push(polyPoints);\n      });\n      break;\n    case \"Point\":\n      return geojson;\n    case \"MultiPoint\":\n      var existing = {};\n      getCoords(geojson).forEach(function(coord) {\n        var key = coord.join(\"-\");\n        if (!Object.prototype.hasOwnProperty.call(existing, key)) {\n          newCoords.push(coord);\n          existing[key] = true;\n        }\n      });\n      break;\n    default:\n      throw new Error(type + \" geometry not supported\");\n  }\n  if (geojson.coordinates) {\n    if (mutate === true) {\n      geojson.coordinates = newCoords;\n      return geojson;\n    }\n    return { type, coordinates: newCoords };\n  } else {\n    if (mutate === true) {\n      geojson.geometry.coordinates = newCoords;\n      return geojson;\n    }\n    return feature({ type, coordinates: newCoords }, geojson.properties, {\n      bbox: geojson.bbox,\n      id: geojson.id\n    });\n  }\n}\nfunction cleanLine(line, type) {\n  const points = getCoords(line);\n  if (points.length === 2 && !equals(points[0], points[1])) return points;\n  const newPoints = [];\n  let a = 0, b = 1, c = 2;\n  newPoints.push(points[a]);\n  while (c < points.length) {\n    if (booleanPointOnLine(points[b], lineString([points[a], points[c]]))) {\n      b = c;\n    } else {\n      newPoints.push(points[b]);\n      a = b;\n      b++;\n      c = b;\n    }\n    c++;\n  }\n  newPoints.push(points[b]);\n  if (type === \"Polygon\" || type === \"MultiPolygon\") {\n    if (booleanPointOnLine(\n      newPoints[0],\n      lineString([newPoints[1], newPoints[newPoints.length - 2]])\n    )) {\n      newPoints.shift();\n      newPoints.pop();\n      newPoints.push(newPoints[0]);\n    }\n    if (newPoints.length < 4) {\n      throw new Error(\"invalid polygon, fewer than 4 points\");\n    }\n    if (!equals(newPoints[0], newPoints[newPoints.length - 1])) {\n      throw new Error(\"invalid polygon, first and last points not equal\");\n    }\n  }\n  return newPoints;\n}\nfunction equals(pt1, pt2) {\n  return pt1[0] === pt2[0] && pt1[1] === pt2[1];\n}\nvar index_default = cleanCoords;\nexport {\n  cleanCoords,\n  index_default as default\n};\n//# sourceMappingURL=index.js.map","// index.ts\nfunction clone(geojson) {\n  if (!geojson) {\n    throw new Error(\"geojson is required\");\n  }\n  switch (geojson.type) {\n    case \"Feature\":\n      return cloneFeature(geojson);\n    case \"FeatureCollection\":\n      return cloneFeatureCollection(geojson);\n    case \"Point\":\n    case \"LineString\":\n    case \"Polygon\":\n    case \"MultiPoint\":\n    case \"MultiLineString\":\n    case \"MultiPolygon\":\n    case \"GeometryCollection\":\n      return cloneGeometry(geojson);\n    default:\n      throw new Error(\"unknown GeoJSON type\");\n  }\n}\nfunction cloneFeature(geojson) {\n  const cloned = { type: \"Feature\" };\n  Object.keys(geojson).forEach((key) => {\n    switch (key) {\n      case \"type\":\n      case \"properties\":\n      case \"geometry\":\n        return;\n      default:\n        cloned[key] = geojson[key];\n    }\n  });\n  cloned.properties = cloneProperties(geojson.properties);\n  if (geojson.geometry == null) {\n    cloned.geometry = null;\n  } else {\n    cloned.geometry = cloneGeometry(geojson.geometry);\n  }\n  return cloned;\n}\nfunction cloneProperties(properties) {\n  const cloned = {};\n  if (!properties) {\n    return cloned;\n  }\n  Object.keys(properties).forEach((key) => {\n    const value = properties[key];\n    if (typeof value === \"object\") {\n      if (value === null) {\n        cloned[key] = null;\n      } else if (Array.isArray(value)) {\n        cloned[key] = value.map((item) => {\n          return item;\n        });\n      } else {\n        cloned[key] = cloneProperties(value);\n      }\n    } else {\n      cloned[key] = value;\n    }\n  });\n  return cloned;\n}\nfunction cloneFeatureCollection(geojson) {\n  const cloned = { type: \"FeatureCollection\" };\n  Object.keys(geojson).forEach((key) => {\n    switch (key) {\n      case \"type\":\n      case \"features\":\n        return;\n      default:\n        cloned[key] = geojson[key];\n    }\n  });\n  cloned.features = geojson.features.map((feature) => {\n    return cloneFeature(feature);\n  });\n  return cloned;\n}\nfunction cloneGeometry(geometry) {\n  const geom = { type: geometry.type };\n  if (geometry.bbox) {\n    geom.bbox = geometry.bbox;\n  }\n  if (geometry.type === \"GeometryCollection\") {\n    geom.geometries = geometry.geometries.map((g) => {\n      return cloneGeometry(g);\n    });\n    return geom;\n  }\n  geom.coordinates = deepSlice(geometry.coordinates);\n  return geom;\n}\nfunction deepSlice(coords) {\n  const cloned = coords;\n  if (typeof cloned[0] !== \"object\") {\n    return cloned.slice();\n  }\n  return cloned.map((coord) => {\n    return deepSlice(coord);\n  });\n}\nvar index_default = clone;\nexport {\n  clone,\n  cloneProperties,\n  index_default as default\n};\n//# sourceMappingURL=index.js.map","// index.ts\nimport { cleanCoords } from \"@turf/clean-coords\";\nimport { clone } from \"@turf/clone\";\nimport { geomEach } from \"@turf/meta\";\nimport { isObject } from \"@turf/helpers\";\n\n// lib/simplify.ts\nfunction getSqDist(p1, p2) {\n  var dx = p1[0] - p2[0], dy = p1[1] - p2[1];\n  return dx * dx + dy * dy;\n}\nfunction getSqSegDist(p, p1, p2) {\n  var x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;\n  if (dx !== 0 || dy !== 0) {\n    var t = ((p[0] - x) * dx + (p[1] - y) * dy) / (dx * dx + dy * dy);\n    if (t > 1) {\n      x = p2[0];\n      y = p2[1];\n    } else if (t > 0) {\n      x += dx * t;\n      y += dy * t;\n    }\n  }\n  dx = p[0] - x;\n  dy = p[1] - y;\n  return dx * dx + dy * dy;\n}\nfunction simplifyRadialDist(points, sqTolerance) {\n  var prevPoint = points[0], newPoints = [prevPoint], point;\n  for (var i = 1, len = points.length; i < len; i++) {\n    point = points[i];\n    if (getSqDist(point, prevPoint) > sqTolerance) {\n      newPoints.push(point);\n      prevPoint = point;\n    }\n  }\n  if (prevPoint !== point) newPoints.push(point);\n  return newPoints;\n}\nfunction simplifyDPStep(points, first, last, sqTolerance, simplified) {\n  var maxSqDist = sqTolerance, index;\n  for (var i = first + 1; i < last; i++) {\n    var sqDist = getSqSegDist(points[i], points[first], points[last]);\n    if (sqDist > maxSqDist) {\n      index = i;\n      maxSqDist = sqDist;\n    }\n  }\n  if (maxSqDist > sqTolerance) {\n    if (index - first > 1)\n      simplifyDPStep(points, first, index, sqTolerance, simplified);\n    simplified.push(points[index]);\n    if (last - index > 1)\n      simplifyDPStep(points, index, last, sqTolerance, simplified);\n  }\n}\nfunction simplifyDouglasPeucker(points, sqTolerance) {\n  var last = points.length - 1;\n  var simplified = [points[0]];\n  simplifyDPStep(points, 0, last, sqTolerance, simplified);\n  simplified.push(points[last]);\n  return simplified;\n}\nfunction simplify(points, tolerance, highestQuality) {\n  if (points.length <= 2) return points;\n  var sqTolerance = tolerance !== void 0 ? tolerance * tolerance : 1;\n  points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n  points = simplifyDouglasPeucker(points, sqTolerance);\n  return points;\n}\n\n// index.ts\nfunction simplify2(geojson, options = {}) {\n  var _a, _b, _c;\n  options = options != null ? options : {};\n  if (!isObject(options)) throw new Error(\"options is invalid\");\n  const tolerance = (_a = options.tolerance) != null ? _a : 1;\n  const highQuality = (_b = options.highQuality) != null ? _b : false;\n  const mutate = (_c = options.mutate) != null ? _c : false;\n  if (!geojson) throw new Error(\"geojson is required\");\n  if (tolerance && tolerance < 0) throw new Error(\"invalid tolerance\");\n  if (mutate !== true) geojson = clone(geojson);\n  geomEach(geojson, function(geom) {\n    simplifyGeom(geom, tolerance, highQuality);\n  });\n  return geojson;\n}\nfunction simplifyGeom(geometry, tolerance, highQuality) {\n  const type = geometry.type;\n  if (type === \"Point\" || type === \"MultiPoint\") return geometry;\n  cleanCoords(geometry, { mutate: true });\n  if (type !== \"GeometryCollection\") {\n    switch (type) {\n      case \"LineString\":\n        geometry.coordinates = simplify(\n          geometry.coordinates,\n          tolerance,\n          highQuality\n        );\n        break;\n      case \"MultiLineString\":\n        geometry.coordinates = geometry.coordinates.map(\n          (lines) => simplify(lines, tolerance, highQuality)\n        );\n        break;\n      case \"Polygon\":\n        geometry.coordinates = simplifyPolygon(\n          geometry.coordinates,\n          tolerance,\n          highQuality\n        );\n        break;\n      case \"MultiPolygon\":\n        geometry.coordinates = geometry.coordinates.map(\n          (rings) => simplifyPolygon(rings, tolerance, highQuality)\n        );\n    }\n  }\n  return geometry;\n}\nfunction simplifyPolygon(coordinates, tolerance, highQuality) {\n  return coordinates.map(function(ring) {\n    if (ring.length < 4) {\n      throw new Error(\"invalid polygon\");\n    }\n    let ringTolerance = tolerance;\n    let simpleRing = simplify(ring, ringTolerance, highQuality);\n    while (!checkValidity(simpleRing) && ringTolerance >= Number.EPSILON) {\n      ringTolerance -= ringTolerance * 0.01;\n      simpleRing = simplify(ring, ringTolerance, highQuality);\n    }\n    if (!checkValidity(simpleRing)) {\n      return ring;\n    }\n    if (simpleRing[simpleRing.length - 1][0] !== simpleRing[0][0] || simpleRing[simpleRing.length - 1][1] !== simpleRing[0][1]) {\n      simpleRing.push(simpleRing[0]);\n    }\n    return simpleRing;\n  });\n}\nfunction checkValidity(ring) {\n  if (ring.length < 3) return false;\n  return !(ring.length === 3 && ring[2][0] === ring[0][0] && ring[2][1] === ring[0][1]);\n}\nvar index_default = simplify2;\nexport {\n  index_default as default,\n  simplify2 as simplify\n};\n//# sourceMappingURL=index.js.map","import { throttle } from '@/lib/debounce.ts';\nimport { AbstractDrawMode } from '@/plugins/draw/mode.abstract.ts';\nimport type { DrawPlugin } from '@/plugins/draw/plugin.ts';\nimport type { DrawFeatureProperties, DrawModel, DrawModeSnapshot } from '@/plugins/draw/types.ts';\nimport booleanPointInPolygon from '@turf/boolean-point-in-polygon';\nimport simplify from '@turf/simplify';\nimport { type Feature, type Polygon, type Position } from 'geojson';\nimport { type GeoJSONSource, type Map, type MapLayerMouseEvent, type MapLayerTouchEvent } from 'maplibre-gl';\n\nexport class PolygonMode extends AbstractDrawMode {\n\n\tprivate _mode: 'create' | 'move' | 'add_vertex' | 'move_vertex' | undefined;\n\tprivate _moveStart: DrawModeSnapshot | undefined;\n\n\tconstructor(plugin: DrawPlugin, map: Map, source: GeoJSONSource, model: DrawModel | undefined) {\n\t\tsuper(plugin, map, source);\n\t\tthis.onClick       = this.onClick.bind(this);\n\t\tthis.onDoubleClick = this.onDoubleClick.bind(this);\n\t\tthis.onMouseMove   = throttle(this.onMouseMove.bind(this), 16);\n\t\tthis.onMouseDown   = this.onMouseDown.bind(this);\n\t\tthis.onMouseUp     = this.onMouseUp.bind(this);\n\t\tthis.setModel(model);\n\t}\n\n\tprivate onClick(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tconst pos: Position = e.lngLat.toArray();\n\t\tlet polygon: Feature<Polygon, DrawFeatureProperties> | undefined;\n\t\tswitch (this._mode) {\n\t\t\tcase 'create':\n\n\t\t\t\tpolygon = this.getPolygon();\n\n\t\t\t\t// check if it's a closing click\n\t\t\t\tif (this.isNearby(polygon.geometry.coordinates[ 0 ][ 0 ] as Position, e.point, this.isTouchEvent(e))) {\n\t\t\t\t\tconst polygon = this.getPolygon();\n\t\t\t\t\tpolygon.geometry.coordinates[ 0 ].splice(1, 1); // remove last created by mousedown\n\t\t\t\t\tthis.endCreation();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\n\t\t\t\tpolygon.geometry.coordinates[ 0 ].splice(1, 0, pos);\n\t\t\t\tthis.collection!.features[ 1 ].geometry.coordinates[ 1 ] = pos;\n\n\t\t\t\tconst len          = polygon.geometry.coordinates[ 0 ].length,\n\t\t\t\t\t  helperVertex = len - 2;\n\n\t\t\t\tif (polygon.properties.hasHelperVertex && len === 5) {\n\t\t\t\t\tpolygon.geometry.coordinates[ 0 ].splice(helperVertex, 1);\n\t\t\t\t\tpolygon.properties.hasHelperVertex = false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\t// control click removes vertex\n\t\t\t\tif (e.originalEvent.ctrlKey && this.collection) {\n\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tconst polygon = this.getPolygon(),\n\t\t\t\t\t\t  len     = polygon.geometry.coordinates[ 0 ].length;\n\n\t\t\t\t\tif (len < 5) {\n\t\t\t\t\t\t// we dont remove vertices on triangles\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (let i = 0; i < len; i++) {\n\t\t\t\t\t\tif (this.isNearby(polygon.geometry.coordinates[ 0 ][ i ], e.point, this.isTouchEvent(e))) {\n\t\t\t\t\t\t\tpolygon.geometry.coordinates[ 0 ].splice(i, 1);\n\t\t\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\t\t\tpolygon.geometry.coordinates[ 0 ].splice(-1, 1);\n\t\t\t\t\t\t\t\tpolygon.geometry.coordinates[ 0 ].push(polygon.geometry.coordinates[ 0 ][ 0 ]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.generateCollectionWithVertexes();\n\t\t\t\t\t\t\tthis.source?.setData(this.collection);\n\t\t\t\t\t\t\tthis.emitOnUpdate();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif (this.hasPolygon()) {\n\t\t\t\t\tpolygon = this.getPolygon();\n\t\t\t\t\tif (booleanPointInPolygon(e.lngLat.toArray(), polygon)) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tthis.createFeatureCollection({\n\t\t\t\t\ttype      : 'Feature',\n\t\t\t\t\tgeometry  : {\n\t\t\t\t\t\ttype       : 'Polygon',\n\t\t\t\t\t\tcoordinates: [ [ pos, pos, pos, pos ] ]\n\t\t\t\t\t},\n\t\t\t\t\tproperties: { meta: 'polygon', hasHelperVertex: true }\n\t\t\t\t});\n\t\t\t\tthis.collection!.features[ 1 ].geometry.coordinates = [ pos, pos ];\n\n\t\t\t\tthis._mode = 'create';\n\n\t\t}\n\n\t\tthis.render();\n\n\t}\n\n\tprivate onDoubleClick(e: MapLayerMouseEvent) {\n\n\t\tif (!this._mode || !this.collection) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this._mode) {\n\t\t\tcase 'create':\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tthis.endCreation();\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tprivate onMouseMove(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tif (!this._mode || !this.collection?.features.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet polygon: Feature<Polygon>, pos: Position;\n\t\tswitch (this._mode) {\n\t\t\tcase 'create':\n\n\t\t\t\te.preventDefault();\n\t\t\t\tpolygon = this.getPolygon();\n\t\t\t\tpos     = e.lngLat.toArray();\n\n\t\t\t\tconst len                              = polygon.geometry.coordinates[ 0 ].length,\n\t\t\t\t\t  helperVertex                     = len - 2;\n\t\t\t\tpolygon.geometry.coordinates[ 0 ][ 1 ] = pos;\n\t\t\t\tif (polygon.properties!.hasHelperVertex) {\n\t\t\t\t\tconst npos                                        = this.map.unproject([ e.point.x + 1, e.point.y ]),\n\t\t\t\t\t\t  dist                                        = Math.abs((npos.lng - pos[ 0 ]) / 3);\n\t\t\t\t\tpolygon.geometry.coordinates[ 0 ][ helperVertex ] = this.calculateB(pos, polygon.geometry.coordinates[ 0 ][ 0 ], dist);\n\t\t\t\t}\n\t\t\t\tthis.render();\n\t\t\t\tbreak;\n\n\t\t\tcase 'move':\n\n\t\t\t\tif (!this._moveStart) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tpolygon = this.getPolygon();\n\n\t\t\t\tconst lngd = e.lngLat.lng - this._moveStart.start.lng,\n\t\t\t\t\t  latd = e.lngLat.lat - this._moveStart.start.lat;\n\t\t\t\tfor (let i = 0, len = polygon.geometry.coordinates[ 0 ].length; i < len; i++) {\n\t\t\t\t\tpolygon.geometry.coordinates[ 0 ][ i ][ 0 ] = this._moveStart.polygon[ i ][ 0 ] + lngd;\n\t\t\t\t\tpolygon.geometry.coordinates[ 0 ][ i ][ 1 ] = this._moveStart.polygon[ i ][ 1 ] + latd;\n\t\t\t\t}\n\t\t\t\tthis.generateCollectionWithVertexes();\n\t\t\t\tthis.render();\n\t\t\t\tbreak;\n\n\t\t\tcase 'move_vertex':\n\n\t\t\t\tif (!this._moveStart) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tpolygon = this.getPolygon();\n\t\t\t\tpos     = e.lngLat.toArray();\n\n\t\t\t\tfor (let i = 0, len = polygon.geometry.coordinates[ 0 ].length; i < len; i++) {\n\t\t\t\t\tif (this._moveStart.polygon[ i ][ 0 ] === this._moveStart.point![ 0 ] && this._moveStart.polygon[ i ][ 1 ] === this._moveStart.point![ 1 ]) {\n\t\t\t\t\t\tpolygon.geometry.coordinates[ 0 ][ i ] = pos;\n\t\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\t\tpolygon.geometry.coordinates[ 0 ][ polygon.geometry.coordinates[ 0 ].length - 1 ] = pos;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.generateCollectionWithVertexes();\n\t\t\t\tthis.render();\n\t\t\t\tbreak;\n\n\t\t\tcase 'add_vertex':\n\n\t\t\t\tif (!this._moveStart) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\tpolygon = this.getPolygon();\n\t\t\t\tpos     = e.lngLat.toArray();\n\n\t\t\t\tfor (let i = 0, len = polygon.geometry.coordinates[ 0 ].length; i < len - 1; i++) {\n\t\t\t\t\tconst midpoint = this.getMidpoint(polygon.geometry.coordinates[ 0 ][ i ], polygon.geometry.coordinates[ 0 ][ i + 1 ]);\n\t\t\t\t\tif (midpoint[ 0 ] === this._moveStart.point![ 0 ] && midpoint[ 1 ] === this._moveStart.point![ 1 ]) {\n\n\t\t\t\t\t\tpolygon.geometry.coordinates[ 0 ].splice(i + 1, 0, midpoint);\n\n\t\t\t\t\t\tthis._moveStart = {\n\t\t\t\t\t\t\tpolygon: this.clonePolygon(),\n\t\t\t\t\t\t\tpoint  : midpoint,\n\t\t\t\t\t\t\tstart  : e.lngLat\n\t\t\t\t\t\t};\n\t\t\t\t\t\tthis._mode      = 'move_vertex';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tthis.generateCollectionWithVertexes();\n\t\t\t\tthis.render();\n\t\t\t\tbreak;\n\n\t\t}\n\n\n\t}\n\n\tonMouseDown(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tif (this._mode === 'create' || !this.collection?.features.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ((e as MapLayerTouchEvent).points?.length > 1) {\n\t\t\t// multi touch event\n\t\t\treturn;\n\t\t}\n\n\t\tfor (let i = 0, len = this.collection.features[ 1 ].geometry.coordinates.length; i < len; i++) {\n\t\t\tif (this.isNearby(this.collection.features[ 1 ].geometry.coordinates[ i ] as Position, e.point, this.isTouchEvent(e))) {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._moveStart = {\n\t\t\t\t\tpolygon: this.clonePolygon(),\n\t\t\t\t\tpoint  : this.collection.features[ 1 ].geometry.coordinates[ i ] as Position,\n\t\t\t\t\tstart  : e.lngLat\n\t\t\t\t};\n\t\t\t\tthis._mode      = 'move_vertex';\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0, len = this.collection.features[ 2 ].geometry.coordinates.length; i < len; i++) {\n\t\t\tif (this.isNearby(this.collection.features[ 2 ].geometry.coordinates[ i ] as Position, e.point, this.isTouchEvent(e))) {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._moveStart = {\n\t\t\t\t\tpolygon: this.clonePolygon(),\n\t\t\t\t\tpoint  : this.collection.features[ 2 ].geometry.coordinates[ i ] as Position,\n\t\t\t\t\tstart  : e.lngLat\n\t\t\t\t};\n\t\t\t\tthis._mode      = 'add_vertex';\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst polygon = this.getPolygon();\n\t\tif (booleanPointInPolygon(e.lngLat.toArray(), polygon)) {\n\t\t\te.preventDefault();\n\t\t\tthis._moveStart = { polygon: this.clonePolygon(), start: e.lngLat };\n\t\t\tthis._mode      = 'move';\n\t\t}\n\n\n\t}\n\n\tonMouseUp(e: MapLayerMouseEvent | MapLayerTouchEvent) {\n\n\t\tif (!this._mode) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this._mode) {\n\t\t\tcase 'move':\n\t\t\tcase 'move_vertex':\n\t\t\tcase 'add_vertex':\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._mode      = undefined;\n\t\t\t\tthis._moveStart = undefined;\n\n\t\t\t\t// don't emit on ctrl click, this will be handled separately in onClick\n\t\t\t\tif (!e.originalEvent.ctrlKey) {\n\t\t\t\t\tthis.emitOnUpdate();\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t}\n\n\t}\n\n\tregister(): void {\n\t\tthis.map.on('click', this.onClick);\n\t\tthis.map.on('dblclick', this.onDoubleClick);\n\t\tthis.map.on('mousemove', this.onMouseMove);\n\t\tthis.map.on('mousedown', this.onMouseDown);\n\t\tthis.map.on('mouseup', this.onMouseUp);\n\t\tthis.map.on('touchstart', this.onMouseDown);\n\t\tthis.map.on('touchmove', this.onMouseMove);\n\t\tthis.map.on('touchend', this.onMouseUp);\n\t}\n\n\tunregister(): void {\n\t\tthis.map.off('click', this.onClick);\n\t\tthis.map.off('dblclick', this.onDoubleClick);\n\t\tthis.map.off('mousemove', this.onMouseMove);\n\t\tthis.map.off('mousedown', this.onMouseDown);\n\t\tthis.map.off('mouseup', this.onMouseUp);\n\t\tthis.map.off('touchstart', this.onMouseDown);\n\t\tthis.map.off('touchmove', this.onMouseMove);\n\t\tthis.map.off('touchend', this.onMouseUp);\n\t}\n\n\tsetModel(model: DrawModel | undefined): void {\n\t\tif (model?.properties?.meta === 'polygon') {\n\t\t\tthis.createFeatureCollection(model);\n\t\t\tthis.generateCollectionWithVertexes();\n\t\t} else {\n\t\t\tthis.collection = undefined;\n\t\t}\n\t\tthis.render();\n\t}\n\n\tonOptionsUpdate() {\n\t\tif (this.collection?.features[ 0 ]) {\n\t\t\tthis.collection.features[ 0 ].properties.minSizeLabel = this.plugin.options.minArea.label;\n\t\t}\n\t}\n\n\tprivate createFeatureCollection(model: DrawModel) {\n\t\tthis.collection = {\n\t\t\ttype: 'FeatureCollection', features: [\n\t\t\t\tmodel,\n\t\t\t\t{\n\t\t\t\t\ttype      : 'Feature',\n\t\t\t\t\tgeometry  : {\n\t\t\t\t\t\ttype       : 'MultiPoint',\n\t\t\t\t\t\tcoordinates: []\n\t\t\t\t\t},\n\t\t\t\t\tproperties: { meta: 'vertex' }\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype      : 'Feature',\n\t\t\t\t\tgeometry  : {\n\t\t\t\t\t\ttype       : 'MultiPoint',\n\t\t\t\t\t\tcoordinates: []\n\t\t\t\t\t},\n\t\t\t\t\tproperties: { meta: 'midpoint' }\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\t}\n\n\tprivate endCreation() {\n\n\t\tconst polygon                  = this.getPolygon();\n\t\tthis._mode                     = undefined;\n\t\tthis.collection!.features[ 0 ] = simplify(polygon, { tolerance: 0.00001, highQuality: true });\n\n\t\tthis.generateCollectionWithVertexes();\n\t\tthis.render();\n\t\tthis.emitOnUpdate();\n\n\t}\n\n\tprivate generateCollectionWithVertexes() {\n\n\t\tif (!this.collection) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst polygon = this.getPolygon(),\n\t\t\t  len     = polygon.geometry.coordinates[ 0 ].length;\n\n\t\tthis.collection.features[ 1 ].geometry.coordinates = polygon.geometry.coordinates[ 0 ].slice(0, -1);\n\n\t\tconst midpoints: Position[] = new Array(len - 1);\n\t\tfor (let i = 0; i < len - 1; i++) {\n\t\t\tmidpoints[ i ] = this.getMidpoint(polygon.geometry.coordinates[ 0 ][ i ], polygon.geometry.coordinates[ 0 ][ i + 1 ]);\n\t\t}\n\t\tthis.collection.features[ 2 ].geometry.coordinates = midpoints;\n\n\t}\n\n\tprivate calculateB(a: Position, c: Position, dist: number): Position {\n\t\tconst dx       = a[ 0 ] - c[ 0 ];\n\t\tconst dy       = a[ 1 ] - c[ 1 ];\n\t\tconst lengthAC = Math.sqrt(dx * dx + dy * dy);\n\n\t\tconst xB = c[ 0 ] + dist * (-dy / lengthAC);\n\t\tconst yB = c[ 1 ] + dist * (dx / lengthAC);\n\n\t\treturn [ xB, yB ];\n\t}\n\n}\n","import type { DrawStyle } from '@/plugins/draw/types.ts';\n\nexport const DefaultDrawStyles: DrawStyle[] = [\n\t// ACTIVE (being drawn)\n\t// line stroke\n\t{\n\t\tid    : 'gl-draw-line',\n\t\ttype  : 'line',\n\t\tfilter: [ 'all', [ '==', '$type', 'LineString' ], [ '!=', 'mode', 'static' ] ],\n\t\tlayout: {\n\t\t\t'line-cap' : 'round',\n\t\t\t'line-join': 'round'\n\t\t},\n\t\tpaint : {\n\t\t\t'line-color'    : '#e74b3c',\n\t\t\t'line-dasharray': [ 0.2, 2 ],\n\t\t\t'line-width'    : 2\n\t\t}\n\t},\n\t// polygon fill\n\t{\n\t\tid    : 'gl-draw-polygon-fill',\n\t\ttype  : 'fill',\n\t\tfilter: [ 'all', [ '==', '$type', 'Polygon' ], [ '!=', 'mode', 'static' ] ],\n\t\tpaint : {\n\t\t\t'fill-color'        : '#3c99e7',\n\t\t\t'fill-outline-color': '#3c99e7',\n\t\t\t'fill-opacity'      : 0.1\n\t\t}\n\t},\n\t// polygon fill below min area size\n\t{\n\t\tid    : 'gl-draw-polygon-fill-below-min-area-size',\n\t\ttype  : 'fill',\n\t\tfilter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'tooSmall', true ] ],\n\t\tpaint : {\n\t\t\t'fill-pattern': 'maplibre-draw-min-area-pattern'\n\t\t}\n\t},\n\t// polygon label below min area size\n\t{\n\t\tid    : 'gl-draw-polygon-fill-below-min-area-size-label',\n\t\ttype  : 'symbol',\n\t\tfilter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'tooSmall', true ], [ 'has', 'minSizeLabel' ] ],\n\t\tlayout: {\n\t\t\t'text-field'      : [ 'get', 'minSizeLabel' ],\n\t\t\t'text-font'       : [ 'Open Sans Bold' ],\n\t\t\t'text-size'       : 24,\n\t\t\t'text-justify'    : 'center',\n\t\t\t'text-anchor'     : 'center'\n\t\t},\n\t\tpaint : {\n\t\t\t'text-color'     : '#e74b3c',\n\t\t\t'text-halo-color': '#fff',\n\t\t\t'text-halo-width': 3\n\t\t}\n\t},\n\t// polygon mid points\n\t{\n\t\tid    : 'gl-draw-polygon-midpoint',\n\t\ttype  : 'circle',\n\t\tfilter: [ 'all',\n\t\t\t\t  [ '==', '$type', 'Point' ],\n\t\t\t\t  [ '==', 'meta', 'midpoint' ] ],\n\t\tpaint : {\n\t\t\t'circle-radius': 4,\n\t\t\t'circle-color' : '#e74b3c'\n\t\t}\n\t},\n\t// polygon outline stroke\n\t// This doesn't style the first edge of the polygon, which uses the line stroke styling instead\n\t{\n\t\tid    : 'gl-draw-polygon-stroke-active',\n\t\ttype  : 'line',\n\t\tfilter: [ 'all', [ '==', '$type', 'Polygon' ], [ '!=', 'mode', 'static' ] ],\n\t\tlayout: {\n\t\t\t'line-cap' : 'round',\n\t\t\t'line-join': 'round'\n\t\t},\n\t\tpaint : {\n\t\t\t'line-color'    : '#e74b3c',\n\t\t\t'line-dasharray': [ 0.2, 2 ],\n\t\t\t'line-width'    : 2\n\t\t}\n\t},\n\t// vertex point halos\n\t{\n\t\tid    : 'gl-draw-polygon-and-line-vertex-halo-active',\n\t\ttype  : 'circle',\n\t\tfilter: [ 'all', [ '==', 'meta', 'vertex' ], [ '==', '$type', 'Point' ], [ '!=', 'mode', 'static' ] ],\n\t\tpaint : {\n\t\t\t'circle-radius': 8,\n\t\t\t'circle-color' : '#FFF'\n\t\t}\n\t},\n\t// vertex points\n\t{\n\t\tid    : 'gl-draw-polygon-and-line-vertex-active',\n\t\ttype  : 'circle',\n\t\tfilter: [ 'all', [ '==', 'meta', 'vertex' ], [ '==', '$type', 'Point' ], [ '!=', 'mode', 'static' ] ],\n\t\tpaint : {\n\t\t\t'circle-radius': 5,\n\t\t\t'circle-color' : '#e74b3c'\n\t\t}\n\t},\n\n\t// INACTIVE (static, already drawn)\n\t// line stroke\n\t{\n\t\tid    : 'gl-draw-line-static',\n\t\ttype  : 'line',\n\t\tfilter: [ 'all', [ '==', '$type', 'LineString' ], [ '==', 'mode', 'static' ] ],\n\t\tlayout: {\n\t\t\t'line-cap' : 'round',\n\t\t\t'line-join': 'round'\n\t\t},\n\t\tpaint : {\n\t\t\t'line-color': '#000',\n\t\t\t'line-width': 3\n\t\t}\n\t},\n\t// polygon fill\n\t{\n\t\tid    : 'gl-draw-polygon-fill-static',\n\t\ttype  : 'fill',\n\t\tfilter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'mode', 'static' ] ],\n\t\tpaint : {\n\t\t\t'fill-color'        : '#000',\n\t\t\t'fill-outline-color': '#000',\n\t\t\t'fill-opacity'      : 0.1\n\t\t}\n\t},\n\t// polygon outline\n\t{\n\t\tid    : 'gl-draw-polygon-stroke-static',\n\t\ttype  : 'line',\n\t\tfilter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'mode', 'static' ] ],\n\t\tlayout: {\n\t\t\t'line-cap' : 'round',\n\t\t\t'line-join': 'round'\n\t\t},\n\t\tpaint : {\n\t\t\t'line-color': '#000',\n\t\t\t'line-width': 3\n\t\t}\n\t}\n];\n","import type { FitBoundsOptions } from '@/types.ts';\nimport type { Feature, Polygon, Position } from 'geojson';\nimport type { LayerSpecification, LngLat } from 'maplibre-gl';\n\nexport enum DrawMode {\n\tPOLYGON       = 'POLYGON',\n\tCIRCLE        = 'CIRCLE',\n\tCIRCLE_STATIC = 'CIRCLE_STATIC',\n}\n\nexport interface DrawPluginOptions {\n\tmode?: DrawMode;\n\tstyles?: DrawStyle[];\n\tonUpdate?: OnUpdateHandler;\n\tautoZoom?: boolean; // true: automatic zoom an model changes and so on. false: you have to handle zoom on our own. default: true\n\tfitBoundsOptions?: FitBoundsOptions;\n\tminArea?: {\n\t\tsize?: number; // m²\n\t\tcolor?: string; // default: #e74b3c\n\t\tlabel?: string;\n\t};\n\tpointerPrecision?: PointerPrecisionOption;\n\twaitForSetup?: boolean;\n\tcircleMode?: {\n\t\tcreationSize: number; // default: 75 pixels\n\t};\n}\n\nexport interface PointerPrecisionOption {\n\tmouse: number; // default 24px\n\ttouch: number; // default 36px\n}\n\ntype WithoutSource<T> = T extends any ? Omit<T, 'source'> : never;\nexport type DrawStyle = WithoutSource<LayerSpecification>\n\nexport interface DrawFeatureProperties {\n\tcenter?: Position;\n\tradius?: number; // meters\n\tarea?: number; // m²\n\ttooSmall?: boolean;\n\tminSizeLabel?: string;\n\thasHelperVertex?: boolean;\n\tmeta: 'polygon' | 'circle' | 'vertex' | 'midpoint';\n}\n\nexport interface DrawModeSnapshot {\n\tpolygon: Position[];\n\tpoint?: Position;\n\tstart: LngLat;\n}\n\nexport type DrawModel = Feature<Polygon, DrawFeatureProperties>;\nexport type OnUpdateHandler = (m: DrawModel) => void;\n","// index.ts\nimport { coordEach } from \"@turf/meta\";\nfunction bbox(geojson, options = {}) {\n  if (geojson.bbox != null && true !== options.recompute) {\n    return geojson.bbox;\n  }\n  const result = [Infinity, Infinity, -Infinity, -Infinity];\n  coordEach(geojson, (coord) => {\n    if (result[0] > coord[0]) {\n      result[0] = coord[0];\n    }\n    if (result[1] > coord[1]) {\n      result[1] = coord[1];\n    }\n    if (result[2] < coord[0]) {\n      result[2] = coord[0];\n    }\n    if (result[3] < coord[1]) {\n      result[3] = coord[1];\n    }\n  });\n  return result;\n}\nvar index_default = bbox;\nexport {\n  bbox,\n  index_default as default\n};\n//# sourceMappingURL=index.js.map","import { CircleMode } from '@/plugins/draw/circle.mode.ts';\nimport { CircleStaticMode } from '@/plugins/draw/circleStatic.mode.ts';\nimport type { AbstractDrawMode } from '@/plugins/draw/mode.abstract.ts';\nimport { PolygonMode } from '@/plugins/draw/polygon.mode.ts';\nimport { DefaultDrawStyles } from '@/plugins/draw/styles.ts';\nimport { DrawMode, type DrawModel, type DrawPluginOptions, type DrawStyle, type OnUpdateHandler } from '@/plugins/draw/types.ts';\nimport bbox from '@turf/bbox';\nimport clone from '@turf/clone';\nimport type { GeoJSONSource, LayerSpecification, LngLatBoundsLike, Map } from 'maplibre-gl';\n\nexport class DrawPlugin {\n\n\tstatic readonly SOURCE_ID           = 'mgl-draw-plugin';\n\tstatic readonly MIN_AREA_PATTERN_ID = 'maplibre-draw-min-area-pattern';\n\n\tmap: Map;\n\n\tprivate _model: DrawModel | undefined;\n\tprivate _mode: DrawMode;\n\tprivate _modeInstance: AbstractDrawMode | undefined;\n\tprivate _source: GeoJSONSource | undefined;\n\toptions: DrawPluginOptions & Required<Pick<DrawPluginOptions, 'styles' | 'pointerPrecision' | 'minArea' | 'circleMode'>>;\n\n\tconstructor(map: Map, model: DrawModel | undefined, options: DrawPluginOptions = {}) {\n\t\tthis.map     = map;\n\t\tthis._model  = model ? this.prepareModel(model) : undefined;\n\t\tthis._mode   = options.mode ?? DrawMode.POLYGON;\n\t\tthis.options = {\n\t\t\t...options,\n\t\t\tstyles          : options.styles ?? DefaultDrawStyles,\n\t\t\tautoZoom        : options.autoZoom ?? true,\n\t\t\tminArea         : options.minArea ?? {},\n\t\t\tpointerPrecision: {\n\t\t\t\tmouse: 24,\n\t\t\t\ttouch: 36,\n\t\t\t\t...(options.pointerPrecision || {})\n\t\t\t},\n\t\t\tcircleMode      : {\n\t\t\t\tcreationSize: 75,\n\t\t\t\t...(options.circleMode || {})\n\t\t\t}\n\t\t};\n\n\t\tthis.setup       = this.setup.bind(this);\n\t\tthis.zoomToModel = this.zoomToModel.bind(this);\n\n\t\tif (!options.waitForSetup) {\n\t\t\tthis.setup();\n\t\t}\n\t}\n\n\tget mode(): DrawMode {\n\t\treturn this._mode;\n\t}\n\n\tsetMode(value: DrawMode, model?: DrawModel) {\n\t\tthis._model = model ? this.prepareModel(model) : undefined;\n\t\tif (this._mode !== value) {\n\t\t\tthis._mode = value;\n\t\t\tthis.setupMode();\n\t\t}\n\t}\n\n\tprivate setupMode() {\n\n\t\tif (this._modeInstance) {\n\t\t\tthis._modeInstance.unregister();\n\t\t\tthis._modeInstance.clear();\n\t\t}\n\t\tswitch (this._mode) {\n\t\t\tcase DrawMode.POLYGON:\n\t\t\t\tthis._modeInstance = new PolygonMode(this, this.map, this._source!, this._model);\n\t\t\t\tbreak;\n\t\t\tcase DrawMode.CIRCLE:\n\t\t\t\tthis._modeInstance = new CircleMode(this, this.map, this._source!, this._model);\n\t\t\t\tbreak;\n\t\t\tcase DrawMode.CIRCLE_STATIC:\n\t\t\t\tthis._modeInstance = new CircleStaticMode(this, this.map, this._source!, this._model);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unsupported mode \"${this._mode}\"`);\n\t\t}\n\t\tthis.zoomToModel();\n\t\tif (this._modeInstance) {\n\t\t\tthis._modeInstance.register();\n\t\t\tthis._modeInstance.render();\n\t\t}\n\n\t}\n\n\tprivate setupMap() {\n\t\tthis._source = this.map.getSource(DrawPlugin.SOURCE_ID);\n\t\tif (!this._source) {\n\t\t\tthis.map.addSource(DrawPlugin.SOURCE_ID, { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });\n\t\t\tthis._source = this.map.getSource(DrawPlugin.SOURCE_ID);\n\t\t\tthis.setupStyles();\n\t\t\tthis.map.on('resize', this.zoomToModel);\n\t\t}\n\t\tif (this._modeInstance) {\n\t\t\tthis._modeInstance.source = this._source!;\n\t\t}\n\t}\n\n\tprivate setupStyles() {\n\t\tfor (let i = 0, len = this.options.styles.length; i < len; i++) {\n\t\t\tthis.map.addLayer({ ...this.options.styles[ i ], source: DrawPlugin.SOURCE_ID, } as LayerSpecification);\n\t\t}\n\t}\n\n\tsetStyles(styles: DrawStyle[]) {\n\t\tthis.removeStyles();\n\t\tthis.options.styles = styles;\n\t\tthis.setupStyles();\n\t}\n\n\tsetOnUpdate(handler: OnUpdateHandler) {\n\t\tthis.options.onUpdate = handler;\n\t}\n\n\tsetModel(model: DrawModel | undefined) {\n\t\tthis._model = model ? this.prepareModel(model) : undefined;\n\t\tthis._modeInstance?.setModel(this._model);\n\t\tthis.zoomToModel();\n\t}\n\n\tsetMinAreaSize(size: number | undefined) {\n\t\tthis.options.minArea.size = size;\n\t\tif (size) {\n\t\t\tthis.setMinAreaSizePattern();\n\t\t}\n\t}\n\n\tsetMinAreaColor(color: string | undefined) {\n\t\tthis.options.minArea.color = color;\n\t\tif (this.options.minArea.size) {\n\t\t\tthis.setMinAreaSizePattern();\n\t\t}\n\t}\n\n\tsetMinAreaLabel(label: string | undefined) {\n\t\tthis.options.minArea.label = label;\n\t\tthis._modeInstance?.onOptionsUpdate();\n\t}\n\n\tzoomToModel() {\n\t\tif (this._model && this.options.autoZoom) {\n\t\t\tthis.map.fitBounds(bbox(this._model) as LngLatBoundsLike, this.options.fitBoundsOptions);\n\t\t}\n\t}\n\n\tsetAutoZoom(autoZoom: boolean) {\n\t\tthis.options.autoZoom = autoZoom;\n\t}\n\n\tprivate removeStyles() {\n\t\tfor (let i = 0, len = this.options.styles.length; i < len; i++) {\n\t\t\tthis.map.removeLayer(this.options.styles[ i ].id);\n\t\t}\n\t}\n\n\tsetup() {\n\t\tthis.setupMap();\n\t\tthis.setupMode();\n\t\tif (this.options.minArea.size) {\n\t\t\tthis.setMinAreaSizePattern();\n\t\t}\n\t}\n\n\tprepareModel(model: DrawModel): DrawModel {\n\t\tconst m = clone(model);\n\t\tif (m.geometry.coordinates?.[ 0 ]?.length) {\n\n\t\t\tconst start    = m.geometry.coordinates[ 0 ][ 0 ],\n\t\t\t\t  end      = m.geometry.coordinates[ 0 ][ m.geometry.coordinates[ 0 ].length - 1 ],\n\t\t\t\t  isClosed = start[ 0 ] === end[ 0 ] && end[ 1 ] === end[ 1 ];\n\t\t\tif (!isClosed) {\n\t\t\t\tm.geometry.coordinates[ 0 ].push(m.geometry.coordinates[ 0 ][ 0 ]);\n\t\t\t}\n\t\t}\n\t\treturn m;\n\t}\n\n\tprivate setMinAreaSizePattern() {\n\n\t\tconst patternCanvas = document.createElement('canvas');\n\t\tconst ctx           = patternCanvas.getContext('2d', { antialias: true }) as CanvasRenderingContext2D;\n\n\t\tconst ratio            = window.devicePixelRatio || 1;\n\t\tconst canvasSideLength = 12 * ratio;\n\t\tconst width            = canvasSideLength;\n\t\tconst height           = canvasSideLength;\n\t\tconst divisions        = 16 * ratio;\n\n\t\tpatternCanvas.width  = width;\n\t\tpatternCanvas.height = height;\n\t\tctx.fillStyle        = this.options.minArea.color || '#e74b3c';\n\n\t\tctx.translate(width / 2, height / 2);\n\t\tctx.rotate(Math.PI / 2);\n\t\tctx.translate(-width / 2, -height / 2);\n\n\t\t// Top line\n\t\tctx.beginPath();\n\t\tctx.moveTo(0, height * (1 / divisions));\n\t\tctx.lineTo(width * (1 / divisions), 0);\n\t\tctx.lineTo(0, 0);\n\t\tctx.lineTo(0, height * (1 / divisions));\n\t\tctx.fill();\n\n\t\t// Middle line\n\t\tctx.beginPath();\n\t\tctx.moveTo(width, height * (1 / divisions));\n\t\tctx.lineTo(width * (1 / divisions), height);\n\t\tctx.lineTo(0, height);\n\t\tctx.lineTo(0, height * ((divisions - 1) / divisions));\n\t\tctx.lineTo(width * ((divisions - 1) / divisions), 0);\n\t\tctx.lineTo(width, 0);\n\t\tctx.lineTo(width, height * (1 / divisions));\n\t\tctx.fill();\n\n\t\t// Bottom line\n\t\tctx.beginPath();\n\t\tctx.moveTo(width, height * ((divisions - 1) / divisions));\n\t\tctx.lineTo(width * ((divisions - 1) / divisions), height);\n\t\tctx.lineTo(width, height);\n\t\tctx.lineTo(width, height * ((divisions - 1) / divisions));\n\t\tctx.fill();\n\n\t\tconst pattern = ctx.getImageData(0, 0, width, height);\n\n\t\tif (this.map.hasImage(DrawPlugin.MIN_AREA_PATTERN_ID)) {\n\t\t\tthis.map.updateImage(DrawPlugin.MIN_AREA_PATTERN_ID, pattern);\n\t\t} else {\n\t\t\tthis.map.addImage(DrawPlugin.MIN_AREA_PATTERN_ID, pattern, { pixelRatio: 2 * ratio });\n\t\t}\n\n\t}\n\n\tdispose() {\n\t\tthis._modeInstance?.unregister();\n\t\tthis.map.off('resize', this.zoomToModel);\n\t\ttry {\n\t\t\tif (this.map) {\n\t\t\t\tfor (let i = 0, len = this.options.styles.length; i < len; i++) {\n\t\t\t\t\tif (this.map.getLayer(this.options.styles[ i ].id)) {\n\t\t\t\t\t\tthis.map.removeLayer(this.options.styles[ i ].id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (this.map.getSource(DrawPlugin.SOURCE_ID)) {\n\t\t\t\t\tthis.map.removeSource(DrawPlugin.SOURCE_ID);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t// nothing\n\t\t}\n\t}\n\n}\n","import { MglButton, MglCustomControl } from '@/components';\nimport { ButtonType } from '@/components/button.component.ts';\nimport type { PositionProp } from '@/components/controls/position.enum.ts';\nimport { Position } from '@/components/controls/position.enum.ts';\nimport { DrawMode, type DrawModel, DrawPlugin, type PointerPrecisionOption } from '@/plugins/draw';\nimport { fitBoundsOptionsSymbol, isLoadedSymbol, mapSymbol } from '@/types.ts';\nimport { defineComponent, h, inject, onBeforeUnmount, type PropType, reactive, type SlotsType, watch } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n\tname      : 'MglDrawControl',\n\tcomponents: { MglCustomControl },\n\tprops     : {\n\t\tposition        : { type: String as PropType<PositionProp>, default: Position.TOP_RIGHT },\n\t\tmodel           : { type: Object as PropType<DrawModel> },\n\t\tmode            : { type: String as PropType<DrawMode | 'POLYGON' | 'CIRCLE' | 'CIRCLE_STATIC'>, default: DrawMode.POLYGON },\n\t\tdefaultMode     : { type: String as PropType<DrawMode | 'POLYGON' | 'CIRCLE' | 'CIRCLE_STATIC'>, default: DrawMode.POLYGON },\n\t\tautoZoom        : { type: Boolean, default: true },\n\t\tminAreaSize     : { type: Number },\n\t\tminAreaColor    : { type: String },\n\t\tminAreaLabel    : { type: String },\n\t\tpointerPrecision: { type: Object as PropType<PointerPrecisionOption> }\n\t},\n\temits     : [ 'update:mode', 'update:model' ],\n\tslots     : Object as SlotsType<{\n\t\tbuttons: { mode: DrawMode, setMode: (mode: DrawMode) => void },\n\t}>,\n\tsetup(props, { emit, slots }) {\n\n\t\tconst map              = inject(mapSymbol)!,\n\t\t\t  isLoaded         = inject(isLoadedSymbol)!,\n\t\t\t  fitBoundsOptions = inject(fitBoundsOptionsSymbol);\n\n\t\tconst draw = reactive(new DrawPlugin(map.value!, props.model, {\n\t\t\tmode            : props.mode as DrawMode,\n\t\t\tautoZoom        : props.autoZoom,\n\t\t\tpointerPrecision: props.pointerPrecision,\n\t\t\tminArea         : {\n\t\t\t\tsize : props.minAreaSize,\n\t\t\t\tcolor: props.minAreaColor,\n\t\t\t\tlabel: props.minAreaLabel,\n\t\t\t},\n\t\t\tfitBoundsOptions: fitBoundsOptions,\n\t\t\tonUpdate        : (model) => emit('update:model', model),\n\t\t\twaitForSetup    : true\n\t\t}));\n\n\t\tfunction toggleMode(m: DrawMode) {\n\t\t\tif (draw.mode === m) {\n\t\t\t\tdraw.setMode(props.defaultMode as DrawMode, props.model);\n\t\t\t} else {\n\t\t\t\tdraw.setMode(m, props.model);\n\t\t\t}\n\t\t\temit('update:mode', m);\n\t\t}\n\n\t\twatch(() => props.mode, () => props.mode !== draw.mode && toggleMode(props.mode as DrawMode));\n\t\twatch(() => props.model, () => draw.setModel(props.model));\n\t\twatch(() => props.autoZoom, () => draw.setAutoZoom(props.autoZoom));\n\t\twatch(() => props.minAreaSize, () => draw.setMinAreaSize(props.minAreaSize));\n\t\twatch(() => props.minAreaColor, () => draw.setMinAreaColor(props.minAreaColor));\n\t\twatch(() => props.minAreaLabel, () => draw.setMinAreaColor(props.minAreaLabel));\n\t\twatch(isLoaded, () => isLoaded.value && draw.setup(), { immediate: true });\n\n\t\tonBeforeUnmount(() => draw.dispose());\n\n\t\treturn () => h(\n\t\t\tMglCustomControl,\n\t\t\t{ position: props.position },\n\t\t\t() =>\n\t\t\t\tslots.buttons\n\t\t\t\t\t? slots.buttons({ mode: draw.mode, setMode: toggleMode })\n\t\t\t\t\t: [\n\t\t\t\t\t\th(MglButton, {\n\t\t\t\t\t\t\ttype   : ButtonType.MDI,\n\t\t\t\t\t\t\tpath   : 'M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z',\n\t\t\t\t\t\t\t'class': [ 'maplibregl-ctrl-icon maplibregl-draw-control maplibregl-draw-control-polygon', draw.mode === DrawMode.POLYGON ? 'is-active' : undefined ],\n\t\t\t\t\t\t\tonClick: () => toggleMode(DrawMode.POLYGON)\n\t\t\t\t\t\t}),\n\t\t\t\t\t\th(MglButton, {\n\t\t\t\t\t\t\ttype   : ButtonType.MDI,\n\t\t\t\t\t\t\tpath   : 'M11,19A6,6 0 0,0 17,13H19A8,8 0 0,1 11,21A8,8 0 0,1 3,13A8,8 0 0,1 11,5V7A6,6 0 0,0 5,13A6,6 0 0,0 11,19M19,5H22V7H19V10H17V7H14V5H17V2H19V5Z',\n\t\t\t\t\t\t\t'class': [ 'maplibregl-ctrl-icon maplibregl-draw-control maplibregl-draw-control-circle', draw.mode === DrawMode.CIRCLE ? 'is-active' : undefined ],\n\t\t\t\t\t\t\tonClick: () => toggleMode(DrawMode.CIRCLE)\n\t\t\t\t\t\t}),\n\t\t\t\t\t\th(MglButton, {\n\t\t\t\t\t\t\ttype   : ButtonType.MDI,\n\t\t\t\t\t\t\tpath   : 'M3.05,13H1V11H3.05C3.5,6.83 6.83,3.5 11,3.05V1H13V3.05C17.17,3.5 20.5,6.83 20.95,11H23V13H20.95C20.5,17.17 17.17,20.5 13,20.95V23H11V20.95C6.83,20.5 3.5,17.17 3.05,13M12,5A7,7 0 0,0 5,12A7,7 0 0,0 12,19A7,7 0 0,0 19,12A7,7 0 0,0 12,5Z',\n\t\t\t\t\t\t\t'class': [ 'maplibregl-ctrl-icon maplibregl-draw-control maplibregl-draw-control-circle-static', draw.mode === DrawMode.CIRCLE_STATIC ? 'is-active' : undefined ],\n\t\t\t\t\t\t\tonClick: () => toggleMode(DrawMode.CIRCLE_STATIC)\n\t\t\t\t\t\t}),\n\t\t\t\t\t]\n\t\t);\n\n\t}\n});\n"],"names":["debounce","fn","wait","immediate","timeout","debounced","args","later","throttle","func","ms","inThrottle","lastResult","context","mapSymbol","isLoadedSymbol","isInitializedSymbol","componentIdSymbol","sourceIdSymbol","sourceLayerRegistry","emitterSymbol","fitBoundsOptionsSymbol","AllOptions","obj","AllSourceOptions","Position","PositionValues","usePositionWatcher","source","map","control","watch","v","CustomControl","isAdded","noClasses","nextTick","MglCustomControl","defineComponent","props","slots","inject","isInitialized","ref","onBeforeUnmount","h","Teleport","createCommentVNode","ButtonType","ButtonTypeValues","types","MglButton","warn","defaults","earthRadius","factors","feature","geom","properties","options","feat","point","coordinates","isNumber","polygon","ring","j","lineString","radiansToLength","radians","units","factor","lengthToRadians","distance","radiansToDegrees","degreesToRadians","degrees","num","isObject","input","coordEach","geojson","callback","excludeWrapCoord","k","l","geometry","stopG","coords","geometryMaybeCollection","wrapShrink","coordIndex","isGeometryCollection","type","isFeatureCollection","isFeature","stop","featureIndex","geomIndex","multiFeatureIndex","geometryIndex","geomType","geomEach","g","featureProperties","featureBBox","featureId","geomReduce","initialValue","previousValue","currentGeometry","area","value","calculateArea","total","polygonArea","ringArea","FACTOR","PI_OVER_180","coordsLength","i","lower","middle","upper","lowerX","middleY","upperX","index_default","getCoord","coord","getCoords","getGeom","getType","_name","destination","origin","bearing","coordinates1","longitude1","latitude1","bearingRad","latitude2","longitude2","lng","lat","circle","center","radius","steps","AbstractDrawMode","plugin","p","a","b","isTouch","tolerance","areaSize","c","model","epsilon","splitter","resulterrbound","sum","elen","flen","f","Q","Qnew","hh","bvirt","enow","fnow","eindex","findex","hindex","estimate","vec","n","ccwerrboundA","ccwerrboundB","ccwerrboundC","B","C1","C2","D","u","orient2dadapt","ax","ay","bx","by","cx","cy","detsum","acxtail","acytail","bcxtail","bcytail","ahi","alo","bhi","blo","_i","_j","_0","s1","s0","t1","t0","u3","acx","bcx","acy","bcy","det","errbound","C1len","C2len","Dlen","orient2d","detleft","detright","pointInPolygon","ii","u1","v1","u2","v2","currentP","nextP","x","y","numContours","contour","contourLen","booleanPointInPolygon","pt","bbox","polys","inBBox","result","polyResult","pip","from","to","coordinates2","dLat","dLon","lat1","lat2","CircleMode","pos","pixel","len","latd","lngd","vertices","createElement","tagName","classes","element","CircleStaticMode","left","top","topCenter","padding","side","booleanPointOnLine","line","ptCoords","lineCoords","ignoreBoundary","isPointOnLineSegment","lineSegmentStart","lineSegmentEnd","excludeBoundary","x1","y1","x2","y2","dxc","dyc","dxl","dyl","cross","cleanCoords","mutate","newCoords","cleanLine","polygons","polyPoints","existing","key","points","equals","newPoints","pt1","pt2","clone","cloneFeature","cloneFeatureCollection","cloneGeometry","cloned","cloneProperties","item","deepSlice","getSqDist","p1","p2","dx","dy","getSqSegDist","t","simplifyRadialDist","sqTolerance","prevPoint","simplifyDPStep","first","last","simplified","maxSqDist","index","sqDist","simplifyDouglasPeucker","simplify","highestQuality","simplify2","_a","_b","_c","highQuality","simplifyGeom","lines","simplifyPolygon","rings","ringTolerance","simpleRing","checkValidity","PolygonMode","helperVertex","npos","dist","midpoint","midpoints","lengthAC","xB","yB","DefaultDrawStyles","DrawMode","DrawPlugin","styles","handler","size","color","label","autoZoom","m","start","end","patternCanvas","ctx","ratio","canvasSideLength","width","height","divisions","pattern","draw_control","emit","isLoaded","fitBoundsOptions","draw","reactive","toggleMode"],"mappings":"8EAAO,SAASA,GAASC,EAAcC,EAAO,IAAKC,EAAY,GAAO,CACrE,IAAIC,EAEJ,SAASC,GAAyB,CACjC,MAAMC,EAAO,UAEPC,EAAQ,IAAM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