@performant-software/geospatial 3.1.7-beta.4 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs14.js +1 -1
- package/dist/index.cjs15.js +1 -1
- package/dist/index.cjs16.js +1 -1
- package/dist/index.cjs17.js +1 -1
- package/dist/index.cjs18.js +1 -1
- package/dist/index.cjs186.js +1 -1
- package/dist/index.cjs186.js.map +1 -1
- package/dist/index.cjs187.js +1 -1
- package/dist/index.cjs187.js.map +1 -1
- package/dist/index.cjs188.js +1 -1
- package/dist/index.cjs188.js.map +1 -1
- package/dist/index.cjs189.js +1 -1
- package/dist/index.cjs189.js.map +1 -1
- package/dist/index.cjs19.js +1 -1
- package/dist/index.cjs190.js +1 -1
- package/dist/index.cjs190.js.map +1 -1
- package/dist/index.cjs191.js +1 -1
- package/dist/index.cjs191.js.map +1 -1
- package/dist/index.cjs192.js +1 -1
- package/dist/index.cjs192.js.map +1 -1
- package/dist/index.cjs193.js +1 -1
- package/dist/index.cjs193.js.map +1 -1
- package/dist/index.cjs194.js +1 -1
- package/dist/index.cjs194.js.map +1 -1
- package/dist/index.cjs195.js +1 -1
- package/dist/index.cjs195.js.map +1 -1
- package/dist/index.cjs196.js +1 -1
- package/dist/index.cjs196.js.map +1 -1
- package/dist/index.cjs197.js +1 -1
- package/dist/index.cjs197.js.map +1 -1
- package/dist/index.cjs198.js +1 -1
- package/dist/index.cjs198.js.map +1 -1
- package/dist/index.cjs199.js +1 -1
- package/dist/index.cjs199.js.map +1 -1
- package/dist/index.cjs20.js +1 -1
- package/dist/index.cjs200.js +1 -1
- package/dist/index.cjs200.js.map +1 -1
- package/dist/index.cjs201.js +1 -1
- package/dist/index.cjs201.js.map +1 -1
- package/dist/index.cjs202.js +1 -1
- package/dist/index.cjs202.js.map +1 -1
- package/dist/index.cjs203.js +1 -1
- package/dist/index.cjs203.js.map +1 -1
- package/dist/index.cjs204.js +1 -1
- package/dist/index.cjs204.js.map +1 -1
- package/dist/index.cjs205.js +1 -1
- package/dist/index.cjs205.js.map +1 -1
- package/dist/index.cjs206.js +1 -1
- package/dist/index.cjs206.js.map +1 -1
- package/dist/index.cjs207.js +1 -1
- package/dist/index.cjs207.js.map +1 -1
- package/dist/index.cjs208.js +1 -1
- package/dist/index.cjs208.js.map +1 -1
- package/dist/index.cjs21.js +1 -1
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs23.js +1 -1
- package/dist/index.cjs236.js +7 -1
- package/dist/index.cjs236.js.map +1 -1
- package/dist/index.cjs237.js +1 -1
- package/dist/index.cjs237.js.map +1 -1
- package/dist/index.cjs238.js +1 -7
- package/dist/index.cjs238.js.map +1 -1
- package/dist/index.cjs239.js +1 -1
- package/dist/index.cjs239.js.map +1 -1
- package/dist/index.cjs24.js +1 -1
- package/dist/index.cjs244.js +1 -1
- package/dist/index.cjs247.js +1 -1
- package/dist/index.cjs250.js +1 -1
- package/dist/index.cjs253.js +1 -1
- package/dist/index.cjs255.js +1 -1
- package/dist/index.cjs258.js +1 -1
- package/dist/index.cjs259.js +1 -1
- package/dist/index.cjs262.js +1 -1
- package/dist/index.cjs262.js.map +1 -1
- package/dist/index.cjs263.js +1 -1
- package/dist/index.cjs263.js.map +1 -1
- package/dist/index.cjs264.js +1 -1
- package/dist/index.cjs27.js +1 -1
- package/dist/index.cjs28.js +1 -1
- package/dist/index.cjs29.js +1 -1
- package/dist/index.cjs31.js +1 -1
- package/dist/index.cjs33.js +1 -1
- package/dist/index.cjs34.js +1 -1
- package/dist/index.cjs68.js +1 -1
- package/dist/index.cjs70.js +1 -1
- package/dist/index.cjs71.js +1 -743
- package/dist/index.cjs71.js.map +1 -1
- package/dist/index.cjs72.js +1 -1
- package/dist/index.cjs73.js +1 -1
- package/dist/index.cjs73.js.map +1 -1
- package/dist/index.cjs74.js +1 -1
- package/dist/index.cjs74.js.map +1 -1
- package/dist/index.cjs75.js +1 -9
- package/dist/index.cjs75.js.map +1 -1
- package/dist/index.cjs76.js +3 -11
- package/dist/index.cjs76.js.map +1 -1
- package/dist/index.cjs77.js +17 -1
- package/dist/index.cjs77.js.map +1 -1
- package/dist/index.cjs78.js +1 -1
- package/dist/index.cjs78.js.map +1 -1
- package/dist/index.cjs79.js +1 -1
- package/dist/index.cjs79.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs80.js +743 -1
- package/dist/index.cjs80.js.map +1 -1
- package/dist/index.cjs81.js +1 -1
- package/dist/index.cjs81.js.map +1 -1
- package/dist/index.es14.js +2 -2
- package/dist/index.es15.js +4 -4
- package/dist/index.es16.js +3 -3
- package/dist/index.es17.js +3 -3
- package/dist/index.es18.js +1 -1
- package/dist/index.es186.js +144 -239
- package/dist/index.es186.js.map +1 -1
- package/dist/index.es187.js +6 -42
- package/dist/index.es187.js.map +1 -1
- package/dist/index.es188.js +5 -3
- package/dist/index.es188.js.map +1 -1
- package/dist/index.es189.js +3 -13
- package/dist/index.es189.js.map +1 -1
- package/dist/index.es19.js +1 -1
- package/dist/index.es190.js +3 -13
- package/dist/index.es190.js.map +1 -1
- package/dist/index.es191.js +33 -28
- package/dist/index.es191.js.map +1 -1
- package/dist/index.es192.js +3 -16
- package/dist/index.es192.js.map +1 -1
- package/dist/index.es193.js +22 -4
- package/dist/index.es193.js.map +1 -1
- package/dist/index.es194.js +2 -150
- package/dist/index.es194.js.map +1 -1
- package/dist/index.es195.js +3 -9
- package/dist/index.es195.js.map +1 -1
- package/dist/index.es196.js +2 -7
- package/dist/index.es196.js.map +1 -1
- package/dist/index.es197.js +33 -3
- package/dist/index.es197.js.map +1 -1
- package/dist/index.es198.js +14 -2
- package/dist/index.es198.js.map +1 -1
- package/dist/index.es199.js +13 -35
- package/dist/index.es199.js.map +1 -1
- package/dist/index.es20.js +1 -1
- package/dist/index.es200.js +11 -3
- package/dist/index.es200.js.map +1 -1
- package/dist/index.es201.js +242 -22
- package/dist/index.es201.js.map +1 -1
- package/dist/index.es202.js +45 -2
- package/dist/index.es202.js.map +1 -1
- package/dist/index.es203.js +5 -3
- package/dist/index.es203.js.map +1 -1
- package/dist/index.es204.js +13 -2
- package/dist/index.es204.js.map +1 -1
- package/dist/index.es205.js +10 -30
- package/dist/index.es205.js.map +1 -1
- package/dist/index.es206.js +31 -13
- package/dist/index.es206.js.map +1 -1
- package/dist/index.es207.js +13 -13
- package/dist/index.es207.js.map +1 -1
- package/dist/index.es208.js +4 -8
- package/dist/index.es208.js.map +1 -1
- package/dist/index.es21.js +1 -1
- package/dist/index.es22.js +1 -1
- package/dist/index.es23.js +1 -1
- package/dist/index.es236.js +7506 -20
- package/dist/index.es236.js.map +1 -1
- package/dist/index.es237.js +2 -23
- package/dist/index.es237.js.map +1 -1
- package/dist/index.es238.js +20 -7506
- package/dist/index.es238.js.map +1 -1
- package/dist/index.es239.js +23 -2
- package/dist/index.es239.js.map +1 -1
- package/dist/index.es24.js +1 -1
- package/dist/index.es244.js +1 -1
- package/dist/index.es247.js +1 -1
- package/dist/index.es250.js +1 -1
- package/dist/index.es253.js +2 -2
- package/dist/index.es255.js +1 -1
- package/dist/index.es258.js +1 -1
- package/dist/index.es259.js +1 -1
- package/dist/index.es262.js +4 -15
- package/dist/index.es262.js.map +1 -1
- package/dist/index.es263.js +15 -4
- package/dist/index.es263.js.map +1 -1
- package/dist/index.es264.js +2 -2
- package/dist/index.es27.js +1 -1
- package/dist/index.es28.js +2 -2
- package/dist/index.es29.js +2 -2
- package/dist/index.es31.js +2 -2
- package/dist/index.es33.js +2 -2
- package/dist/index.es34.js +2 -2
- package/dist/index.es68.js +1 -1
- package/dist/index.es70.js +12 -12
- package/dist/index.es71.js +1954 -21313
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +6 -2
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +2 -8
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +8 -2
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +2 -26
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +17 -580
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +556 -1960
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +105 -5
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +10 -2
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es8.js +43 -47
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es80.js +21350 -104
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +2 -10
- package/dist/index.es81.js.map +1 -1
- package/package.json +1 -1
- package/src/components/MapDraw.js +6 -21
- package/types/components/MapDraw.js.flow +6 -21
package/dist/index.es78.js
CHANGED
|
@@ -1,9 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import l from "react";
|
|
2
|
+
import { IconContext as s, DefaultContext as O } from "./index.es79.js";
|
|
3
|
+
var g = ["attr", "size", "title"];
|
|
4
|
+
function v(t, e) {
|
|
5
|
+
if (t == null) return {};
|
|
6
|
+
var r = y(t, e), n, i;
|
|
7
|
+
if (Object.getOwnPropertySymbols) {
|
|
8
|
+
var o = Object.getOwnPropertySymbols(t);
|
|
9
|
+
for (i = 0; i < o.length; i++)
|
|
10
|
+
n = o[i], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(t, n) && (r[n] = t[n]);
|
|
11
|
+
}
|
|
12
|
+
return r;
|
|
13
|
+
}
|
|
14
|
+
function y(t, e) {
|
|
15
|
+
if (t == null) return {};
|
|
16
|
+
var r = {};
|
|
17
|
+
for (var n in t)
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
19
|
+
if (e.indexOf(n) >= 0) continue;
|
|
20
|
+
r[n] = t[n];
|
|
21
|
+
}
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
function c() {
|
|
25
|
+
return c = Object.assign ? Object.assign.bind() : function(t) {
|
|
26
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
27
|
+
var r = arguments[e];
|
|
28
|
+
for (var n in r)
|
|
29
|
+
Object.prototype.hasOwnProperty.call(r, n) && (t[n] = r[n]);
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
}, c.apply(this, arguments);
|
|
33
|
+
}
|
|
34
|
+
function m(t, e) {
|
|
35
|
+
var r = Object.keys(t);
|
|
36
|
+
if (Object.getOwnPropertySymbols) {
|
|
37
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
38
|
+
e && (n = n.filter(function(i) {
|
|
39
|
+
return Object.getOwnPropertyDescriptor(t, i).enumerable;
|
|
40
|
+
})), r.push.apply(r, n);
|
|
41
|
+
}
|
|
42
|
+
return r;
|
|
43
|
+
}
|
|
44
|
+
function u(t) {
|
|
45
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
46
|
+
var r = arguments[e] != null ? arguments[e] : {};
|
|
47
|
+
e % 2 ? m(Object(r), !0).forEach(function(n) {
|
|
48
|
+
j(t, n, r[n]);
|
|
49
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : m(Object(r)).forEach(function(n) {
|
|
50
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
function j(t, e, r) {
|
|
56
|
+
return e = P(e), e in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
|
|
57
|
+
}
|
|
58
|
+
function P(t) {
|
|
59
|
+
var e = h(t, "string");
|
|
60
|
+
return typeof e == "symbol" ? e : e + "";
|
|
61
|
+
}
|
|
62
|
+
function h(t, e) {
|
|
63
|
+
if (typeof t != "object" || !t) return t;
|
|
64
|
+
var r = t[Symbol.toPrimitive];
|
|
65
|
+
if (r !== void 0) {
|
|
66
|
+
var n = r.call(t, e);
|
|
67
|
+
if (typeof n != "object") return n;
|
|
68
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
69
|
+
}
|
|
70
|
+
return (e === "string" ? String : Number)(t);
|
|
71
|
+
}
|
|
72
|
+
function p(t) {
|
|
73
|
+
return t && t.map((e, r) => /* @__PURE__ */ l.createElement(e.tag, u({
|
|
74
|
+
key: r
|
|
75
|
+
}, e.attr), p(e.child)));
|
|
76
|
+
}
|
|
77
|
+
function _(t) {
|
|
78
|
+
return (e) => /* @__PURE__ */ l.createElement(w, c({
|
|
79
|
+
attr: u({}, t.attr)
|
|
80
|
+
}, e), p(t.child));
|
|
81
|
+
}
|
|
82
|
+
function w(t) {
|
|
83
|
+
var e = (r) => {
|
|
84
|
+
var {
|
|
85
|
+
attr: n,
|
|
86
|
+
size: i,
|
|
87
|
+
title: o
|
|
88
|
+
} = t, b = v(t, g), f = i || r.size || "1em", a;
|
|
89
|
+
return r.className && (a = r.className), t.className && (a = (a ? a + " " : "") + t.className), /* @__PURE__ */ l.createElement("svg", c({
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
fill: "currentColor",
|
|
92
|
+
strokeWidth: "0"
|
|
93
|
+
}, r.attr, n, b, {
|
|
94
|
+
className: a,
|
|
95
|
+
style: u(u({
|
|
96
|
+
color: t.color || r.color
|
|
97
|
+
}, r.style), t.style),
|
|
98
|
+
height: f,
|
|
99
|
+
width: f,
|
|
100
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
101
|
+
}), o && /* @__PURE__ */ l.createElement("title", null, o), t.children);
|
|
102
|
+
};
|
|
103
|
+
return s !== void 0 ? /* @__PURE__ */ l.createElement(s.Consumer, null, (r) => e(r)) : e(O);
|
|
4
104
|
}
|
|
5
105
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
106
|
+
_ as GenIcon,
|
|
107
|
+
w as IconBase
|
|
8
108
|
};
|
|
9
109
|
//# sourceMappingURL=index.es78.js.map
|
package/dist/index.es78.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es78.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.es78.js","sources":["../../../node_modules/react-icons/lib/iconBase.mjs"],"sourcesContent":["var _excluded = [\"attr\", \"size\", \"title\"];\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport React from \"react\";\nimport { IconContext, DefaultContext } from \"./iconContext.mjs\";\nfunction Tree2Element(tree) {\n return tree && tree.map((node, i) => /*#__PURE__*/React.createElement(node.tag, _objectSpread({\n key: i\n }, node.attr), Tree2Element(node.child)));\n}\nexport function GenIcon(data) {\n return props => /*#__PURE__*/React.createElement(IconBase, _extends({\n attr: _objectSpread({}, data.attr)\n }, props), Tree2Element(data.child));\n}\nexport function IconBase(props) {\n var elem = conf => {\n var {\n attr,\n size,\n title\n } = props,\n svgProps = _objectWithoutProperties(props, _excluded);\n var computedSize = size || conf.size || \"1em\";\n var className;\n if (conf.className) className = conf.className;\n if (props.className) className = (className ? className + \" \" : \"\") + props.className;\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n stroke: \"currentColor\",\n fill: \"currentColor\",\n strokeWidth: \"0\"\n }, conf.attr, attr, svgProps, {\n className: className,\n style: _objectSpread(_objectSpread({\n color: props.color || conf.color\n }, conf.style), props.style),\n height: computedSize,\n width: computedSize,\n xmlns: \"http://www.w3.org/2000/svg\"\n }), title && /*#__PURE__*/React.createElement(\"title\", null, title), props.children);\n };\n return IconContext !== undefined ? /*#__PURE__*/React.createElement(IconContext.Consumer, null, conf => elem(conf)) : elem(DefaultContext);\n}"],"names":["_excluded","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","sourceSymbolKeys","_extends","i","ownKeys","e","r","t","o","_objectSpread","_defineProperty","obj","value","_toPropertyKey","_toPrimitive","Tree2Element","tree","node","React","GenIcon","data","props","IconBase","elem","conf","attr","size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G,EAAK;AAAA,MACnC,GAASA,EAAK,KAAK,GAAGH,EAAM,KAAK;AAAA,MAC3B,QAAQQ;AAAA,MACR,OAAOA;AAAA,MACP,OAAO;AAAA,IACb,CAAK,GAAGF,KAAsBT,gBAAAA,EAAM,cAAc,SAAS,MAAMS,CAAK,GAAGN,EAAM,QAAQ;AAAA,EACrF;AACA,SAAOU,MAAgB,SAAyBb,gBAAAA,EAAM,cAAca,EAAY,UAAU,MAAM,CAAAP,MAAQD,EAAKC,CAAI,CAAC,IAAID,EAAKS,CAAc;AAC3I;","x_google_ignoreList":[0]}
|
package/dist/index.es79.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import e from "react";
|
|
2
|
+
var t = {
|
|
3
|
+
color: void 0,
|
|
4
|
+
size: void 0,
|
|
5
|
+
className: void 0,
|
|
6
|
+
style: void 0,
|
|
7
|
+
attr: void 0
|
|
8
|
+
}, d = e.createContext && /* @__PURE__ */ e.createContext(t);
|
|
2
9
|
export {
|
|
3
|
-
|
|
10
|
+
t as DefaultContext,
|
|
11
|
+
d as IconContext
|
|
4
12
|
};
|
|
5
13
|
//# sourceMappingURL=index.es79.js.map
|
package/dist/index.es79.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es79.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index.es79.js","sources":["../../../node_modules/react-icons/lib/iconContext.mjs"],"sourcesContent":["import React from \"react\";\nexport var DefaultContext = {\n color: undefined,\n size: undefined,\n className: undefined,\n style: undefined,\n attr: undefined\n};\nexport var IconContext = React.createContext && /*#__PURE__*/React.createContext(DefaultContext);"],"names":["DefaultContext","IconContext","React"],"mappings":";AACU,IAACA,IAAiB;AAAA,EAC1B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AACR,GACWC,IAAcC,EAAM,iBAA8BA,gBAAAA,EAAM,cAAcF,CAAc;","x_google_ignoreList":[0]}
|
package/dist/index.es8.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
1
|
+
import { j as r } from "./index.es27.js";
|
|
2
|
+
import l from "./index.es14.js";
|
|
3
3
|
import b from "./index.es31.js";
|
|
4
|
-
import { useState as h, useRef as
|
|
4
|
+
import { useState as h, useRef as g, useCallback as a, useMemo as u, useEffect as x } from "react";
|
|
5
5
|
import { Map as D } from "./index.es15.js";
|
|
6
6
|
import "./index.es16.js";
|
|
7
7
|
import "./index.es17.js";
|
|
@@ -41,56 +41,52 @@ import "./index.es59.js";
|
|
|
41
41
|
import "./index.es60.js";
|
|
42
42
|
import "./index.es61.js";
|
|
43
43
|
import "./index.es62.js";
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
44
|
+
import w from "./index.es2.js";
|
|
45
|
+
import L from "./index.es4.js";
|
|
46
|
+
import O from "./index.es12.js";
|
|
47
47
|
/* empty css */
|
|
48
48
|
/* empty css */
|
|
49
|
-
import { feature as
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
49
|
+
import { feature as v } from "./index.es66.js";
|
|
50
|
+
l.constants.classes.CONTROL_BASE = "maplibregl-ctrl";
|
|
51
|
+
l.constants.classes.CONTROL_PREFIX = "maplibregl-ctrl-";
|
|
52
|
+
l.constants.classes.CONTROL_GROUP = "maplibregl-ctrl-group";
|
|
53
|
+
const B = 2, E = 1e3, m = {
|
|
54
54
|
geometryCollection: "GeometryCollection",
|
|
55
55
|
point: "Point",
|
|
56
56
|
polygon: ["Polygon", "MultiPolygon"]
|
|
57
|
-
},
|
|
58
|
-
const [c, d] = h(!1),
|
|
59
|
-
if (!
|
|
57
|
+
}, M = (t) => {
|
|
58
|
+
const [c, d] = h(!1), e = g(), s = g(), f = a((o) => {
|
|
59
|
+
if (!o)
|
|
60
60
|
return !1;
|
|
61
|
-
const { geometry: { type:
|
|
62
|
-
return
|
|
63
|
-
}, [
|
|
64
|
-
|
|
65
|
-
}, [
|
|
66
|
-
console.log(r);
|
|
67
|
-
const { detail: e } = r;
|
|
68
|
-
g(e) ? (console.log("valid"), console.log(e), console.log("before add"), console.log(t.current.getAll()), t.current.add(e.geometry), console.log("after add"), console.log(t.current.getAll()), i(), o.onGeocodingSelection && o.onGeocodingSelection(e)) : (console.log("invalid"), console.log(e));
|
|
69
|
-
}, [g, i, o.onGeocodingSelection]), y = u(() => `${o.mapStyle}?key=${o.apiKey}`, [o.apiKey, o.mapStyle]), C = u(() => ({ height: 500, width: "100%", ...o.style || {} }), [o.style]);
|
|
61
|
+
const { geometry: { type: n } } = o;
|
|
62
|
+
return t.geocoding === "point" && n === m.point || t.geocoding === "polygon" && m.polygon.includes(n);
|
|
63
|
+
}, [t.geocoding]), i = a(() => t.onChange(e.current.getAll()), [t.onChange]), p = a(({ feature: o }) => {
|
|
64
|
+
f(o) && (e.current.add(o.geometry), i(), t.onGeocodingSelection && t.onGeocodingSelection(o));
|
|
65
|
+
}, [f, i, t.onGeocodingSelection]), y = u(() => `${t.mapStyle}?key=${t.apiKey}`, [t.apiKey, t.mapStyle]), C = u(() => ({ height: 500, width: "100%", ...t.style || {} }), [t.style]);
|
|
70
66
|
return x(() => {
|
|
71
|
-
if (c &&
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}) :
|
|
67
|
+
if (c && t.data) {
|
|
68
|
+
const o = O.getBoundingBox(t.data, t.buffer);
|
|
69
|
+
o && s.current.fitBounds(o, { duration: t.zoomDuration }), t.data.type === m.geometryCollection ? G.each(t.data.geometries, (n) => {
|
|
70
|
+
e.current.add(v(n));
|
|
71
|
+
}) : e.current.add(t.data);
|
|
76
72
|
}
|
|
77
|
-
}, [c,
|
|
73
|
+
}, [c, t.data]), /* @__PURE__ */ r.jsxs(
|
|
78
74
|
D,
|
|
79
75
|
{
|
|
80
76
|
attributionControl: !1,
|
|
81
|
-
cooperativeGestures:
|
|
77
|
+
cooperativeGestures: t.cooperativeGestures,
|
|
82
78
|
mapLib: b,
|
|
83
|
-
maxPitch:
|
|
79
|
+
maxPitch: t.maxPitch,
|
|
84
80
|
onLoad: () => d(!0),
|
|
85
|
-
preserveDrawingBuffer:
|
|
81
|
+
preserveDrawingBuffer: t.preserveDrawingBuffer,
|
|
86
82
|
ref: s,
|
|
87
83
|
style: C,
|
|
88
84
|
mapStyle: y,
|
|
89
85
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
86
|
+
/* @__PURE__ */ r.jsx(
|
|
87
|
+
w,
|
|
92
88
|
{
|
|
93
|
-
ref:
|
|
89
|
+
ref: e,
|
|
94
90
|
controls: {
|
|
95
91
|
line_string: !0,
|
|
96
92
|
point: !0,
|
|
@@ -104,32 +100,32 @@ const A = 2, B = 1e3, a = {
|
|
|
104
100
|
position: "bottom-left"
|
|
105
101
|
}
|
|
106
102
|
),
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
t.geocoding && /* @__PURE__ */ r.jsx(
|
|
104
|
+
L,
|
|
109
105
|
{
|
|
110
|
-
apiKey:
|
|
106
|
+
apiKey: t.apiKey,
|
|
111
107
|
marker: !1,
|
|
112
|
-
pickedResultStyle:
|
|
108
|
+
pickedResultStyle: t.geocoding === "polygon" ? "full-geometry" : "marker-only",
|
|
113
109
|
position: "top-left",
|
|
114
110
|
onSelection: p,
|
|
115
111
|
showResultMarkers: !1
|
|
116
112
|
},
|
|
117
|
-
|
|
113
|
+
t.geocoding
|
|
118
114
|
),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
t.navigation && /* @__PURE__ */ r.jsx(S, {}),
|
|
116
|
+
t.fullscreen && /* @__PURE__ */ r.jsx(R, {}),
|
|
117
|
+
t.children
|
|
122
118
|
]
|
|
123
119
|
}
|
|
124
120
|
);
|
|
125
121
|
};
|
|
126
|
-
|
|
127
|
-
buffer:
|
|
122
|
+
M.defaultProps = {
|
|
123
|
+
buffer: B,
|
|
128
124
|
cooperativeGestures: !0,
|
|
129
125
|
preserveDrawingBuffer: !1,
|
|
130
|
-
zoomDuration:
|
|
126
|
+
zoomDuration: E
|
|
131
127
|
};
|
|
132
128
|
export {
|
|
133
|
-
|
|
129
|
+
M as default
|
|
134
130
|
};
|
|
135
131
|
//# sourceMappingURL=index.es8.js.map
|
package/dist/index.es8.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es8.js","sources":["../src/components/MapDraw.js"],"sourcesContent":["// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { feature, type FeatureCollection, type GeometryCollection } from '@turf/turf';\nimport maplibregl from 'maplibre-gl';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Node\n} from 'react';\nimport Map, {\n FullscreenControl,\n type MapboxMap,\n NavigationControl\n} from 'react-map-gl/maplibre';\nimport _ from 'underscore';\nimport DrawControl from './DrawControl';\nimport GeocodingControl from './GeocodingControl';\nimport MapUtils from '../utils/Map';\n\nimport '@maptiler/geocoding-control/style.css';\nimport './MapDraw.css';\n\n// Override the MapboxDraw components to use MapLibre styles\nMapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';\nMapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';\nMapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';\n\ntype Props = {\n /**\n * MapTiler API key.\n */\n apiKey?: string,\n\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer?: number,\n\n /**\n * Additional child nodes to render.\n */\n children?: Node,\n\n /**\n * If `true`, the map will require CTRL + scroll to zoom.\n */\n cooperativeGestures?: boolean,\n\n /**\n * GeoJSON structured data to be displayed on the map.\n */\n data: GeometryCollection | FeatureCollection,\n\n /**\n * If `true`, a control will be rendered to put the map in full screen mode.\n */\n fullscreen?: boolean,\n\n /**\n * Controls the type of GeoJSON data returned from the MapTiler Geocoding API.\n */\n geocoding?: undefined | 'point' | 'polygon',\n\n /**\n * URL of the map style to render. This URL should contain any necessary API keys.\n */\n mapStyle: string,\n\n /**\n * The maximum pitch of the map (0-85).\n */\n maxPitch?: number,\n\n /**\n * If `true`, the navigation controls will display.\n */\n navigation?: boolean,\n\n /**\n * Callback fired when the map geometries are changed.\n *\n * @param features\n */\n onChange: (features: Array<any>) => void,\n\n /**\n * Callback fired when an item is selected from the geocoding dropdown.\n */\n onGeocodingSelection?: (data: any) => void,\n\n /**\n * If `true`, the map's canvas can be exported to a PNG using `map.getCanvas().toDataURL()`.\n */\n preserveDrawingBuffer?: boolean,\n\n /**\n * Map style object.\n */\n style?: any,\n\n /**\n * The time in milliseconds to zoom into the location.\n */\n zoomDuration?: number\n};\n\nconst DEFAULT_BUFFER = 2;\nconst DEFAULT_ZOOM_DELAY = 1000;\n\nconst GeometryTypes = {\n geometryCollection: 'GeometryCollection',\n point: 'Point',\n polygon: ['Polygon', 'MultiPolygon']\n};\n\n/**\n * This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),\n * a line, or a polygon.\n */\nconst MapDraw = (props: Props) => {\n const [loaded, setLoaded] = useState(false);\n\n const drawRef = useRef<MapboxDraw>();\n const mapRef = useRef<MapboxMap>();\n\n /**\n * Returns true if the passed geometry type is valid. MapTiler fires the onSelection callback twice: Once after\n * selecting the record from the list (with a point geometry), and once after making a call to the server for the\n * full record (polygon geometry). We should on fire the onGeocodingSelection callback and add the geometry to the\n * map once.\n *\n * @type {function({geometry: {type: *}}): *}\n */\n const isValid = useCallback((detail) => {\n if (!detail) {\n return false;\n }\n\n const { geometry: { type } } = detail;\n\n return (props.geocoding === 'point' && type === GeometryTypes.point)\n || (props.geocoding === 'polygon' && GeometryTypes.polygon.includes(type));\n }, [props.geocoding]);\n\n /**\n * Calls the onChange prop with all of the geometries in the current drawer.\n *\n * @type {(function(): void)|*}\n */\n const onChange = useCallback(() => {\n console.log(\"fired callback\");\n console.log(drawRef.current.getAll());\n props.onChange(drawRef.current.getAll());\n }, [props.onChange]);\n\n /**\n * Adds the selected geometry to the map.\n *\n * @type {(function(evt: *): void)|*}\n */\n const onSelection = useCallback((evt) => {\n console.log(evt);\n const { detail } = evt;\n if (isValid(detail)) {\n console.log(\"valid\");\n console.log(detail);\n // Add the geometry to the map\n console.log(\"before add\");\n console.log(drawRef.current.getAll());\n drawRef.current.add(detail.geometry);\n console.log(\"after add\");\n console.log(drawRef.current.getAll());\n\n // Trigger the onChange prop\n onChange();\n\n // Call the onGeocoding selection callback\n if (props.onGeocodingSelection) {\n props.onGeocodingSelection(detail);\n }\n } else {\n console.log(\"invalid\");\n console.log(detail);\n }\n }, [isValid, onChange, props.onGeocodingSelection]);\n\n /**\n * Sets the map style URL.\n *\n * @type {string}\n */\n const mapStyleUrl = useMemo(() => `${props.mapStyle}?key=${props.apiKey}`, [props.apiKey, props.mapStyle]);\n\n /**\n * Sets the element map style.\n *\n * @type {{width: string, height: number}}\n */\n const style = useMemo(() => ({ height: 500, width: '100%', ...(props.style || {}) }), [props.style]);\n\n /**\n * Updates the map bounding box and drawer when the geometry is changed.\n */\n useEffect(() => {\n if (loaded && props.data) {\n // Sets the bounding box for the current geometry\n const bbox = MapUtils.getBoundingBox(props.data, props.buffer);\n\n if (bbox) {\n mapRef.current.fitBounds(bbox, { duration: props.zoomDuration });\n }\n\n // Handle special cases for geometry collection (not supported by mabox-gl-draw) and point\n if (props.data.type === GeometryTypes.geometryCollection) {\n _.each(props.data.geometries, (geometry) => {\n drawRef.current.add(feature(geometry));\n });\n } else {\n drawRef.current.add(props.data);\n }\n }\n }, [loaded, props.data]);\n\n return (\n <Map\n attributionControl={false}\n cooperativeGestures={props.cooperativeGestures}\n mapLib={maplibregl}\n maxPitch={props.maxPitch}\n onLoad={() => setLoaded(true)}\n preserveDrawingBuffer={props.preserveDrawingBuffer}\n ref={mapRef}\n style={style}\n mapStyle={mapStyleUrl}\n >\n <DrawControl\n ref={drawRef}\n controls={{\n line_string: true,\n point: true,\n polygon: true,\n trash: true\n }}\n displayControlsDefault={false}\n onCreate={onChange}\n onUpdate={onChange}\n onDelete={onChange}\n position='bottom-left'\n />\n { props.geocoding && (\n <GeocodingControl\n apiKey={props.apiKey}\n key={props.geocoding}\n marker={false}\n pickedResultStyle={props.geocoding === 'polygon' ? 'full-geometry' : 'marker-only'}\n position='top-left'\n onSelection={onSelection}\n showResultMarkers={false}\n />\n )}\n { props.navigation && (\n <NavigationControl />\n )}\n { props.fullscreen && (\n <FullscreenControl />\n )}\n { props.children }\n </Map>\n );\n};\n\nMapDraw.defaultProps = {\n buffer: DEFAULT_BUFFER,\n cooperativeGestures: true,\n preserveDrawingBuffer: false,\n zoomDuration: DEFAULT_ZOOM_DELAY\n};\n\nexport default MapDraw;\n"],"names":["MapboxDraw","DEFAULT_BUFFER","DEFAULT_ZOOM_DELAY","GeometryTypes","MapDraw","props","loaded","setLoaded","useState","drawRef","useRef","mapRef","isValid","useCallback","detail","type","onChange","onSelection","evt","mapStyleUrl","useMemo","style","useEffect","bbox","MapUtils","_","geometry","feature","jsxs","Map","maplibregl","jsx","DrawControl","GeocodingControl","NavigationControl","FullscreenControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BAA,EAAW,UAAU,QAAQ,eAAe;AAC5CA,EAAW,UAAU,QAAQ,iBAAiB;AAC9CA,EAAW,UAAU,QAAQ,gBAAgB;AAiF7C,MAAMC,IAAiB,GACjBC,IAAqB,KAErBC,IAAgB;AAAA,EACpB,oBAAoB;AAAA,EACpB,OAAO;AAAA,EACP,SAAS,CAAC,WAAW,cAAc;AACrC,GAMMC,IAAU,CAACC,MAAiB;AAChC,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpCC,IAAUC,EAAA,GACVC,IAASD,EAAA,GAUTE,IAAUC,EAAY,CAACC,MAAW;AACtC,QAAI,CAACA;AACH,aAAO;AAGT,UAAM,EAAE,UAAU,EAAE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AA,CAAA,CAAkB;AAAA,QAEnB7B,EAAM,cACN0B,gBAAAA,MAACI,GAAA,CAAA,CAAkB;AAAA,QAEnB9B,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGd;AAEAD,EAAQ,eAAe;AAAA,EACrB,QAAQH;AAAA,EACR,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EACvB,cAAcC;AAChB;"}
|
|
1
|
+
{"version":3,"file":"index.es8.js","sources":["../src/components/MapDraw.js"],"sourcesContent":["// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { feature, type FeatureCollection, type GeometryCollection } from '@turf/turf';\nimport maplibregl from 'maplibre-gl';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Node\n} from 'react';\nimport Map, {\n FullscreenControl,\n type MapboxMap,\n NavigationControl\n} from 'react-map-gl/maplibre';\nimport _ from 'underscore';\nimport DrawControl from './DrawControl';\nimport GeocodingControl from './GeocodingControl';\nimport MapUtils from '../utils/Map';\n\nimport '@maptiler/geocoding-control/style.css';\nimport './MapDraw.css';\n\n// Override the MapboxDraw components to use MapLibre styles\nMapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';\nMapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';\nMapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';\n\ntype Props = {\n /**\n * MapTiler API key.\n */\n apiKey?: string,\n\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer?: number,\n\n /**\n * Additional child nodes to render.\n */\n children?: Node,\n\n /**\n * If `true`, the map will require CTRL + scroll to zoom.\n */\n cooperativeGestures?: boolean,\n\n /**\n * GeoJSON structured data to be displayed on the map.\n */\n data: GeometryCollection | FeatureCollection,\n\n /**\n * If `true`, a control will be rendered to put the map in full screen mode.\n */\n fullscreen?: boolean,\n\n /**\n * Controls the type of GeoJSON data returned from the MapTiler Geocoding API.\n */\n geocoding?: undefined | 'point' | 'polygon',\n\n /**\n * URL of the map style to render. This URL should contain any necessary API keys.\n */\n mapStyle: string,\n\n /**\n * The maximum pitch of the map (0-85).\n */\n maxPitch?: number,\n\n /**\n * If `true`, the navigation controls will display.\n */\n navigation?: boolean,\n\n /**\n * Callback fired when the map geometries are changed.\n *\n * @param features\n */\n onChange: (features: Array<any>) => void,\n\n /**\n * Callback fired when an item is selected from the geocoding dropdown.\n */\n onGeocodingSelection?: (data: any) => void,\n\n /**\n * If `true`, the map's canvas can be exported to a PNG using `map.getCanvas().toDataURL()`.\n */\n preserveDrawingBuffer?: boolean,\n\n /**\n * Map style object.\n */\n style?: any,\n\n /**\n * The time in milliseconds to zoom into the location.\n */\n zoomDuration?: number\n};\n\nconst DEFAULT_BUFFER = 2;\nconst DEFAULT_ZOOM_DELAY = 1000;\n\nconst GeometryTypes = {\n geometryCollection: 'GeometryCollection',\n point: 'Point',\n polygon: ['Polygon', 'MultiPolygon']\n};\n\n/**\n * This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),\n * a line, or a polygon.\n */\nconst MapDraw = (props: Props) => {\n const [loaded, setLoaded] = useState(false);\n\n const drawRef = useRef<MapboxDraw>();\n const mapRef = useRef<MapboxMap>();\n\n /**\n * Returns true if the passed geometry type is valid. MapTiler fires the onSelection callback twice: Once after\n * selecting the record from the list (with a point geometry), and once after making a call to the server for the\n * full record (polygon geometry). We should on fire the onGeocodingSelection callback and add the geometry to the\n * map once.\n *\n * @type {function({geometry: {type: *}}): *}\n */\n const isValid = useCallback((detail) => {\n if (!detail) {\n return false;\n }\n\n const { geometry: { type } } = detail;\n\n return (props.geocoding === 'point' && type === GeometryTypes.point)\n || (props.geocoding === 'polygon' && GeometryTypes.polygon.includes(type));\n }, [props.geocoding]);\n\n /**\n * Calls the onChange prop with all of the geometries in the current drawer.\n *\n * @type {(function(): void)|*}\n */\n const onChange = useCallback(() => props.onChange(drawRef.current.getAll()), [props.onChange]);\n\n /**\n * Adds the selected geometry to the map.\n *\n * @type {(function({feature: *}): void)|*}\n */\n const onSelection = useCallback(({ feature }) => {\n if (isValid(feature)) {\n // Add the geometry to the map\n drawRef.current.add(feature.geometry);\n\n // Trigger the onChange prop\n onChange();\n\n // Call the onGeocoding selection callback\n if (props.onGeocodingSelection) {\n props.onGeocodingSelection(feature);\n }\n }\n }, [isValid, onChange, props.onGeocodingSelection]);\n\n /**\n * Sets the map style URL.\n *\n * @type {string}\n */\n const mapStyleUrl = useMemo(() => `${props.mapStyle}?key=${props.apiKey}`, [props.apiKey, props.mapStyle]);\n\n /**\n * Sets the element map style.\n *\n * @type {{width: string, height: number}}\n */\n const style = useMemo(() => ({ height: 500, width: '100%', ...(props.style || {}) }), [props.style]);\n\n /**\n * Updates the map bounding box and drawer when the geometry is changed.\n */\n useEffect(() => {\n if (loaded && props.data) {\n // Sets the bounding box for the current geometry\n const bbox = MapUtils.getBoundingBox(props.data, props.buffer);\n\n if (bbox) {\n mapRef.current.fitBounds(bbox, { duration: props.zoomDuration });\n }\n\n // Handle special cases for geometry collection (not supported by mabox-gl-draw) and point\n if (props.data.type === GeometryTypes.geometryCollection) {\n _.each(props.data.geometries, (geometry) => {\n drawRef.current.add(feature(geometry));\n });\n } else {\n drawRef.current.add(props.data);\n }\n }\n }, [loaded, props.data]);\n\n return (\n <Map\n attributionControl={false}\n cooperativeGestures={props.cooperativeGestures}\n mapLib={maplibregl}\n maxPitch={props.maxPitch}\n onLoad={() => setLoaded(true)}\n preserveDrawingBuffer={props.preserveDrawingBuffer}\n ref={mapRef}\n style={style}\n mapStyle={mapStyleUrl}\n >\n <DrawControl\n ref={drawRef}\n controls={{\n line_string: true,\n point: true,\n polygon: true,\n trash: true\n }}\n displayControlsDefault={false}\n onCreate={onChange}\n onUpdate={onChange}\n onDelete={onChange}\n position='bottom-left'\n />\n { props.geocoding && (\n <GeocodingControl\n apiKey={props.apiKey}\n key={props.geocoding}\n marker={false}\n pickedResultStyle={props.geocoding === 'polygon' ? 'full-geometry' : 'marker-only'}\n position='top-left'\n onSelection={onSelection}\n showResultMarkers={false}\n />\n )}\n { props.navigation && (\n <NavigationControl />\n )}\n { props.fullscreen && (\n <FullscreenControl />\n )}\n { props.children }\n </Map>\n );\n};\n\nMapDraw.defaultProps = {\n buffer: DEFAULT_BUFFER,\n cooperativeGestures: true,\n preserveDrawingBuffer: false,\n zoomDuration: DEFAULT_ZOOM_DELAY\n};\n\nexport default MapDraw;\n"],"names":["MapboxDraw","DEFAULT_BUFFER","DEFAULT_ZOOM_DELAY","GeometryTypes","MapDraw","props","loaded","setLoaded","useState","drawRef","useRef","mapRef","isValid","useCallback","detail","type","onChange","onSelection","feature","mapStyleUrl","useMemo","style","useEffect","bbox","MapUtils","_","geometry","jsxs","Map","maplibregl","jsx","DrawControl","GeocodingControl","NavigationControl","FullscreenControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BAA,EAAW,UAAU,QAAQ,eAAe;AAC5CA,EAAW,UAAU,QAAQ,iBAAiB;AAC9CA,EAAW,UAAU,QAAQ,gBAAgB;AAiF7C,MAAMC,IAAiB,GACjBC,IAAqB,KAErBC,IAAgB;AAAA,EACpB,oBAAoB;AAAA,EACpB,OAAO;AAAA,EACP,SAAS,CAAC,WAAW,cAAc;AACrC,GAMMC,IAAU,CAACC,MAAiB;AAChC,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpCC,IAAUC,EAAA,GACVC,IAASD,EAAA,GAUTE,IAAUC,EAAY,CAACC,MAAW;AACtC,QAAI,CAACA;AACH,aAAO;AAGT,UAAM,EAAE,UAAU,EAAE,MAAAC,EAAA,MAAWD;AAE/B,WAAQT,EAAM,cAAc,WAAWU,MAASZ,EAAc,SACxDE,EAAM,cAAc,aAAaF,EAAc,QAAQ,SAASY,CAAI;AAAA,EAC5E,GAAG,CAACV,EAAM,SAAS,CAAC,GAOdW,IAAWH,EAAY,MAAMR,EAAM,SAASI,EAAQ,QAAQ,OAA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