jam-cloud/jam-ui/node_modules/react-leaflet/dist/react-leaflet.min.js

2 lines
36 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("leaflet"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","leaflet","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactLeaflet={},e.React,e.L,e.ReactDOM)}(this,function(e,l,a,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(l);function o(e,t){return e(t={exports:{}},t.exports),t.exports}var r=o(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,o=arguments[t];for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},t.apply(this,arguments)}e.exports=t}),s="function"==typeof Symbol&&Symbol.for,u=s?Symbol.for("react.element"):60103,p=s?Symbol.for("react.portal"):60106,c=s?Symbol.for("react.fragment"):60107,f=s?Symbol.for("react.strict_mode"):60108,h=s?Symbol.for("react.profiler"):60114,m=s?Symbol.for("react.provider"):60109,y=s?Symbol.for("react.context"):60110,d=s?Symbol.for("react.async_mode"):60111,v=s?Symbol.for("react.concurrent_mode"):60111,E=s?Symbol.for("react.forward_ref"):60112,b=s?Symbol.for("react.suspense"):60113,g=s?Symbol.for("react.suspense_list"):60120,O=s?Symbol.for("react.memo"):60115,L=s?Symbol.for("react.lazy"):60116,k=s?Symbol.for("react.block"):60121,C=s?Symbol.for("react.fundamental"):60117,w=s?Symbol.for("react.responder"):60118,x=s?Symbol.for("react.scope"):60119;function P(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case u:switch(e=e.type){case d:case v:case c:case h:case f:case b:return e;default:switch(e=e&&e.$$typeof){case y:case E:case L:case O:case m:return e;default:return t}}case p:return t}}}function S(e){return P(e)===v}var j={AsyncMode:d,ConcurrentMode:v,ContextConsumer:y,ContextProvider:m,Element:u,ForwardRef:E,Fragment:c,Lazy:L,Memo:O,Portal:p,Profiler:h,StrictMode:f,Suspense:b,isAsyncMode:function(e){return S(e)||P(e)===d},isConcurrentMode:S,isContextConsumer:function(e){return P(e)===y},isContextProvider:function(e){return P(e)===m},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===u},isForwardRef:function(e){return P(e)===E},isFragment:function(e){return P(e)===c},isLazy:function(e){return P(e)===L},isMemo:function(e){return P(e)===O},isPortal:function(e){return P(e)===p},isProfiler:function(e){return P(e)===h},isStrictMode:function(e){return P(e)===f},isSuspense:function(e){return P(e)===b},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===c||e===v||e===h||e===f||e===b||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===L||e.$$typeof===O||e.$$typeof===m||e.$$typeof===y||e.$$typeof===E||e.$$typeof===C||e.$$typeof===w||e.$$typeof===x||e.$$typeof===k)},typeOf:P},_=o(function(e){e.exports=j}),M={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Z={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},D={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},U={};function V(e){return _.isMemo(e)?D:U[e.$$typeof]||M}U[_.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},U[_.Memo]=D;var R=Object.defineProperty,B=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols,T=Object.getOwnPropertyDescriptor,z=Object.getPrototypeOf,$=Object.prototype;function A(o){var e=function(t,n){return i.default.createElement(F,null,function(e){return i.default.createElement(o,r({},t,{leaflet:e,ref:n}))})},t=o.displayName||o.name||"Component";return e.displayName="Leaflet(".concat(t,")"),N(e=l.forwardRef(e),o),e}var N=function e(t,n,o){if("string"!=typeof n){var l;!$||(l=z(n))&&l!==$&&e(t,l,o);var r=B(n);I&&(r=r.concat(I(n)));for(var a=V(t),i=V(n),s=0;s<r.length;++s){var u=r[s];if(!(Z[u]||o&&o[u]||i&&i[u]||a&&a[u])){var p=T(n,u);try{R(t,u,p)}catch(e){}}}}return t},W=l.createContext({}),F=W.Consumer,G=W.Provider;var q=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function J(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var H=function(e,t,n){return t&&J(e.prototype,t),n&&J(e,n),e},K=o(function(n){function o(e,t){return n.exports=o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}n.exports=o});var Q=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)},X=o(function(t){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}t.exports=n});var Y=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}},ee=o(function(t){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(e){return typeof e}:t.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}t.exports=n});var te=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var ne=function(e,t){return!t||"object"!==ee(t)&&"function"!=typeof t?te(e):t};var oe=function(n){var o=Y();return function(){var e,t=X(n);return t=o?(e=X(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),ne(this,t)}};var le=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},re=function(e){Q(n,e);var t=oe(n);function n(e){return q(this,n),e=t.call(this,e),le(te(e),"leafletElement",void 0),e.leafletElement=e.createLeafletElement(e.props),e}return H(n,[{key:"createLeafletElement",value:function(){throw new Error("createLeafletElement() must be implemented")}},{key:"updateLeafletElement",value:function(e,t){t.position!==e.position&&this.leafletElement.setPosition(t.position)}},{key:"componentDidMount",value:function(){this.leafletElement.addTo(this.props.leaflet.map)}},{key:"componentDidUpdate",value:function(e){this.updateLeafletElement(e,this.props)}},{key:"componentWillUnmount",value:function(){this.leafletElement.remove()}},{key:"render",value:function(){return null}}]),n}(l.Component),ae=A(function(){Q(t,re);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.Control.Attribution(e)}}]),t}());var ie=function(e,t){if(null==e)return{};for(var n,o={},l=Object.keys(e),r=0;r<l.length;r++)n=l[r],0<=t.indexOf(n)||(o[n]=e[n]);return o};var se=function(e,t){if(null==e)return{};var n,o=ie(e,t);if(Object.getOwnPropertySymbols)for(var l=Object.getOwnPropertySymbols(e),r=0;r<l.length;r++)n=l[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o};function ue(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}var pe=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ue(Object(n),!0).forEach(function(e){le(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t};function ce(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,o,l;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(o=n;0!=o--;)if(!ce(e[o],t[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(l=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,l[o]))return!1;for(o=n;0!=o--;){var r=l[o];if(!ce(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}var fe=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=X(e)););return e},he=o(function(o){function l(e,t,n){return"undefined"!=typeof Reflect&&Reflect.get?o.exports=l=Reflect.get:o.exports=l=function(e,t,n){e=fe(e,t);if(e){t=Object.getOwnPropertyDescriptor(e,t);return t.get?t.get.call(n):t.value}},l(e,t,n||e)}o.exports=l}),me=/^on(.+)$/i,ye=function(e){Q(o,e);var n=oe(o);function o(e){var t;return q(this,o),t=n.call(this,e),le(te(t),"_leafletEvents",void 0),le(te(t),"leafletElement",void 0),t._leafletEvents=t.extractLeafletEvents(e),t}return H(o,[{key:"componentDidMount",value:function(){this.bindLeafletEvents(this._leafletEvents)}},{key:"componentDidUpdate",value:function(){this._leafletEvents=this.bindLeafletEvents(this.extractLeafletEvents(this.props),this._leafletEvents)}},{key:"componentWillUnmount",value:function(){var t=this,n=this.leafletElement;n&&Object.keys(this._leafletEvents).forEach(function(e){n.off(e,t._leafletEvents[e])})}},{key:"extractLeafletEvents",value:function(n){return Object.keys(n).reduce(function(e,t){return me.test(t)&&null!=n[t]&&(e[t.replace(me,function(e,t){return t.toLowerCase()})]=n[t]),e},{})}},{key:"bindLeafletEvents",value:function(e,t){var n=0<arguments.length&&void 0!==e?e:{},o=1<arguments.length&&void 0!==t?t:{},l=this.leafletElement;if(null==l||null==l.on)return{};var r=pe({},o);return Object.keys(o).forEach(function(e){null!=n[e]&&o[e]===n[e]||(delete r[e],l.off(e,o[e]))}),Object.keys(n).forEach(function(e){null!=o[e]&&n[e]===o[e]||(r[e]=n[e],l.on(e,n[e]))}),r}},{key:"fireLeafletEvent",value:function(e,t){var n=this.leafletElement;n&&n.fire(e,t)}}]),o}(l.Component),de=function(){Q(t,ye);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"getOptions",value:function(e){return null==e.pane&&null!=e.leaflet&&null!=e.leaflet.pane?pe(pe({},e),{},{pane:e.leaflet.pane}):e}}]),t}(),ve=function(){Q(o,de);var n=oe(o);function o(e){var t;return q(this,o),t=n.call(this,e),le(te(t),"contextValue",void 0),le(te(t),"leafletElement",void 0),t.leafletElement=t.createLeafletElement(e),t}return H(o,[{key:"createLeafletElement",value:function(){throw new Error("createLeafletElement() must be implemented")}},{key:"updateLeafletElement",value:function(){}},{key:"componentDidMount",value:function(){he(X(o.prototype),"componentDidMount",this).call(this),this.layerContainer.addLayer(this.leafletElement)}},{key:"componentDidUpdate",value:function(e){var t;he(X(o.prototype),"componentDidUpdate",this).call(this,e),this.props.attribution===e.attribution||null!=(t=this.props.leaflet.map)&&null!=t.attributionControl&&(t.attributionControl.removeAttribution(e.attribution),t.attributionControl.addAttribution(this.props.attribution)),this.updateLeafletElement(e,this.props)}},{key:"componentWillUnmount",value:function(){he(X(o.prototype),"componentWillUnmount",this).call(this),this.layerContainer.removeLayer(this.leafletElement)}},{key:"render",value:function(){var e=this.props.children;return null==e?null:null==this.contextValue?i.default.createElement(l.Fragment,null,e):i.default.createElement(G,{value:this.contextValue},e)}},{key:"layerContainer",get:function(){return this.props.leaflet.layerContainer||this.props.leaflet.map}}]),o}();function Ee(e){return(0<arguments.length&&void 0!==e?e:"").split(" ").filter(Boolean)}function be(t,e){Ee(e).forEach(function(e){a.DomUtil.removeClass(t,e)})}function ge(e,t,n){null!=e&&n!==t&&(null!=t&&0<t.length&&be(e,t),null!=n&&0<n.length&&we(e,n))}var Oe=["stroke","color","weight","opacity","lineCap","lineJoin","dashArray","dashOffset","fill","fillColor","fillOpacity","fillRule","bubblingMouseEvents","renderer","className","interactive","pane","attribution"],Le=function(){Q(o,ve);var n=oe(o);function o(e){var t;return q(this,o),null==(t=n.call(this,e)).contextValue&&(t.contextValue=pe(pe({},e.leaflet),{},{popupContainer:t.leafletElement})),t}return H(o,[{key:"componentDidUpdate",value:function(e){he(X(o.prototype),"componentDidUpdate",this).call(this,e),this.setStyleIfChanged(e,this.props)}},{key:"getPathOptions",value:function(e){return n=e,Oe.reduce(function(e,t){return void 0!==n[t]&&(e[t]=n[t]),e},{});var n}},{key:"setStyle",value:function(e){e=0<arguments.length&&void 0!==e?e:{};this.leafletElement.setStyle(e)}},{key:"setStyleIfChanged",value:function(e,t){t=this.getPathOptions(t);ce(t,this.getPathOptions(e))||this.setStyle(t)}}]),o}(),ke=A(function(){Q(t,Le);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){var t=e.center,n=e.radius,e=se(e,["center","radius"]);return new a.Circle(t,n,this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){t.center!==e.center&&this.leafletElement.setLatLng(t.center),t.radius!==e.radius&&this.leafletElement.setRadius(t.radius)}}]),t}()),Ce=A(function(){Q(t,Le);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){var t=new a.CircleMarker(e.center,this.getOptions(e));return this.contextValue=pe(pe({},e.leaflet),{},{popupContainer:t}),t}},{key:"updateLeafletElement",value:function(e,t){t.center!==e.center&&this.leafletElement.setLatLng(t.center),t.radius!==e.radius&&this.leafletElement.setRadius(t.radius)}}]),t}()),we=function(t,e){Ee(e).forEach(function(e){a.DomUtil.addClass(t,e)})},xe=function(){Q(o,de);var n=oe(o);function o(e){var t;return q(this,o),t=n.call(this,e),le(te(t),"onClose",function(){t.props.onClose&&t.props.onClose()}),le(te(t),"onOpen",function(){t.forceUpdate(),t.props.onOpen&&t.props.onOpen()}),t.leafletElement=t.createLeafletElement(e),t}return H(o,[{key:"createLeafletElement",value:function(){throw new Error("createLeafletElement() must be implemented")}},{key:"updateLeafletElement",value:function(){}},{key:"componentDidUpdate",value:function(e){ge(this.leafletElement._container,e.className,this.props.className),this.updateLeafletElement(e,this.props),this.leafletElement.isOpen()&&(this.leafletElement.update(),this.onRender())}},{key:"onRender",value:function(){}},{key:"render",value:function(){return this.leafletElement._contentNode?t.createPortal(this.props.children,this.leafletElement._contentNode):null}}]),o}(),Pe=A(function(){Q(t,Le);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){var t=new a.FeatureGroup(this.getOptions(e));return this.contextValue=pe(pe({},e.leaflet),{},{layerContainer:t,popupContainer:t}),t}},{key:"componentDidMount",value:function(){he(X(t.prototype),"componentDidMount",this).call(this),this.setStyle(this.props)}}]),t}()),Se=A(function(){Q(t,Le);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.GeoJSON(e.data,this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){"function"==typeof t.style?this.leafletElement.setStyle(t.style):this.setStyleIfChanged(e,t)}}]),t}()),je=function(){Q(n,ve);var e=oe(n);function n(){return q(this,n),e.apply(this,arguments)}return H(n,[{key:"createLeafletElement",value:function(e){return new a.GridLayer(this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){var n=t.opacity,t=t.zIndex;n!==e.opacity&&this.leafletElement.setOpacity(n),t!==e.zIndex&&this.leafletElement.setZIndex(t)}},{key:"getOptions",value:function(e){var t=pe({},he(X(n.prototype),"getOptions",this).call(this,e)),e=e.leaflet.map;return null!=e&&(null==t.maxZoom&&null!=e.options.maxZoom&&(t.maxZoom=e.options.maxZoom),null==t.minZoom&&null!=e.options.minZoom&&(t.minZoom=e.options.minZoom)),t}},{key:"render",value:function(){return null}}]),n}(),_e=A(function(){Q(t,ve);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){var t=new a.ImageOverlay(e.url,e.bounds,this.getOptions(e));return this.contextValue=pe(pe({},e.leaflet),{},{popupContainer:t}),t}},{key:"updateLeafletElement",value:function(e,t){t.url!==e.url&&this.leafletElement.setUrl(t.url),t.bounds!==e.bounds&&this.leafletElement.setBounds(a.latLngBounds(t.bounds)),t.opacity!==e.opacity&&this.leafletElement.setOpacity(t.opacity),t.zIndex!==e.zIndex&&this.leafletElement.setZIndex(t.zIndex)}}]),t}()),Me=A(function(){Q(t,ve);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){var t=new a.LayerGroup([],this.getOptions(e));return this.contextValue=pe(pe({},e.leaflet),{},{layerContainer:t}),t}}]),t}()),Ze=function(e){Q(r,e);var l=oe(r);function r(){var e;q(this,r);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e=l.call.apply(l,[this].concat(n)),le(te(e),"contextValue",void 0),le(te(e),"layer",void 0),e}return H(r,[{key:"componentDidUpdate",value:function(e){e=e.checked;null!=this.props.leaflet.map&&(!0!==this.props.checked||null!=e&&!1!==e?!0!==e||null!=this.props.checked&&!1!==this.props.checked||this.props.leaflet.map.removeLayer(this.layer):this.props.leaflet.map.addLayer(this.layer))}},{key:"componentWillUnmount",value:function(){this.props.removeLayerControl(this.layer)}},{key:"addLayer",value:function(){throw new Error("Must be implemented in extending class")}},{key:"removeLayer",value:function(e){this.props.removeLayer(e)}},{key:"render",value:function(){var e=this.props.children;return e?i.default.createElement(G,{value:this.contextValue},e):null}}]),r}(l.Component),De=function(){Q(n,Ze);var t=oe(n);function n(e){var l;return q(this,n),l=t.call(this,e),le(te(l),"addLayer",function(e){l.layer=e;var t=l.props,n=t.addBaseLayer,o=t.checked;n(e,t.name,o)}),l.contextValue=pe(pe({},e.leaflet),{},{layerContainer:{addLayer:l.addLayer.bind(te(l)),removeLayer:l.removeLayer.bind(te(l))}}),l}return n}(),Ue=function(){Q(n,Ze);var t=oe(n);function n(e){var l;return q(this,n),l=t.call(this,e),le(te(l),"addLayer",function(e){l.layer=e;var t=l.props,n=t.addOverlay,o=t.checked;n(e,t.name,o)}),l.contextValue=pe(pe({},e.leaflet),{},{layerContainer:{addLayer:l.addLayer.bind(te(l)),removeLayer:l.removeLayer.bind(te(l))}}),l}return n}(),Ve=A(function(){Q(o,re);var n=oe(o);function o(e){var t;return q(this,o),t=n.call(this,e),le(te(t),"controlProps",void 0),t.controlProps={addBaseLayer:t.addBaseLayer.bind(te(t)),addOverlay:t.addOverlay.bind(te(t)),leaflet:e.leaflet,removeLayer:t.removeLayer.bind(te(t)),removeLayerControl:t.removeLayerControl.bind(te(t))},t}return H(o,[{key:"createLeafletElement",value:function(e){e.children;e=se(e,["children"]);return new a.Control.Layers(void 0,void 0,e)}},{key:"updateLeafletElement",value:function(e,t){he(X(o.prototype),"updateLeafletElement",this).call(this,e,t),t.collapsed!==e.collapsed&&(!0===t.collapsed?this.leafletElement.collapse():this.leafletElement.expand())}},{key:"componentWillUnmount",value:function(){var e=this;setTimeout(function(){he(X(o.prototype),"componentWillUnmount",e).call(e)},0)}},{key:"addBaseLayer",value:function(e,t,n){2<arguments.length&&void 0!==n&&n&&null!=this.props.leaflet.map&&this.props.leaflet.map.addLayer(e),this.leafletElement.addBaseLayer(e,t)}},{key:"addOverlay",value:function(e,t,n){2<arguments.length&&void 0!==n&&n&&null!=this.props.leaflet.map&&this.props.leaflet.map.addLayer(e),this.leafletElement.addOverlay(e,t)}},{key:"removeLayer",value:function(e){null!=this.props.leaflet.map&&this.props.leaflet.map.removeLayer(e)}},{key:"removeLayerControl",value:function(e){this.leafletElement.removeLayer(e)}},{key:"render",value:function(){var t=this,e=l.Children.map(this.props.children,function(e){return e?l.cloneElement(e,t.controlProps):null});return i.default.createElement(l.Fragment,null,e)}}]),o}());function Re(n){for(var e=arguments.length,o=new Array(1<e?e-1:0),t=1;t<e;t++)o[t-1]=arguments[t];return Object.keys(n).reduce(function(e,t){return-1===o.indexOf(t)&&(e[t]=n[t]),e},{})}Ve.BaseLayer=De,Ve.Overlay=Ue;function Be(e){return Array.isArray(e)?[e[0],e[1]]:[e.lat,e.lon||e.lng]}var Ie=["children","className","id","style","useFlyTo","whenReady"],Te=function(){Q(o,ye);var n=oe(o);function o(e){var t;return q(this,o),t=n.call(this,e),le(te(t),"className",void 0),le(te(t),"contextValue",void 0),le(te(t),"container",void 0),le(te(t),"viewport",{center:void 0,zoom:void 0}),le(te(t),"_ready",!1),le(te(t),"_updating",!1),le(te(t),"onViewportChange",function(){var e=t.leafletElement.getCenter();t.viewport={center:e?[e.lat,e.lng]:void 0,zoom:t.leafletElement.getZoom()},t.props.onViewportChange&&!t._updating&&t.props.onViewportChange(t.viewport)}),le(te(t),"onViewportChanged",function(){t.props.onViewportChanged&&!t._updating&&t.props.onViewportChanged(t.viewport)}),le(te(t),"bindContainer",function(e){t.container=e}),t.className=e.className,t}return H(o,[{key:"createLeafletElement",value:function(e){var t=e.viewport,e=se(e,["viewport"]);return t&&(t.center&&(e.center=t.center),"number"==typeof t.zoom&&(e.zoom=t.zoom)),new a.Map(this.container,e)}},{key:"updateLeafletElement",value:function(e,t){this._updating=!0;var n=t.bounds,o=t.boundsOptions,l=t.boxZoom,r=t.center,a=t.className,i=t.doubleClickZoom,s=t.dragging,u=t.keyboard,p=t.maxBounds,c=t.scrollWheelZoom,f=t.tap,h=t.touchZoom,m=t.useFlyTo,y=t.viewport,d=t.zoom;ge(this.container,e.className,a),y&&y!==e.viewport?(a=y.center||r,y=null==y.zoom?d:y.zoom,!0===m?this.leafletElement.flyTo(a,y,this.getZoomPanOptions(t)):this.leafletElement.setView(a,y,this.getZoomPanOptions(t))):r&&this.shouldUpdateCenter(r,e.center)?!0===m?this.leafletElement.flyTo(r,d,this.getZoomPanOptions(t)):this.leafletElement.setView(r,d,this.getZoomPanOptions(t)):"number"==typeof d&&d!==e.zoom&&(null==e.zoom?this.leafletElement.setView(r,d,this.getZoomPanOptions(t)):this.leafletElement.setZoom(d,this.getZoomPanOptions(t))),p&&this.shouldUpdateBounds(p,e.maxBounds)&&this.leafletElement.setMaxBounds(p),n&&(this.shouldUpdateBounds(n,e.bounds)||o!==e.boundsOptions)&&(!0===m?this.leafletElement.flyToBounds(n,this.getFitBoundsOptions(t)):this.leafletElement.fitBounds(n,this.getFitBoundsOptions(t))),l!==e.boxZoom&&(!0===l?this.leafletElement.boxZoom.enable():this.leafletElement.boxZoom.disable()),i!==e.doubleClickZoom&&(!0===i||"string"==typeof i?(this.leafletElement.options.doubleClickZoom=i,this.leafletElement.doubleClickZoom.enable()):this.leafletElement.doubleClickZoom.disable()),s!==e.dragging&&(!0===s?this.leafletElement.dragging.enable():this.leafletElement.dragging.disable()),u!==e.keyboard&&(!0===u?this.leafletElement.keyboard.enable():this.leafletElement.keyboard.disable()),c!==e.scrollWheelZoom&&(!0===c||"string"==typeof c?(this.leafletElement.options.scrollWheelZoom=c,this.leafletElement.scrollWheelZoom.enable()):this.leafletElement.scrollWheelZoom.disable()),f!==e.tap&&(!0===f?this.leafletElement.tap.enable():this.leafletElement.tap.disable()),h!==e.touchZoom&&(!0===h||"string"==typeof h?(this.leafletElement.options.touchZoom=h,this.leafletElement.touchZoom.enable()):this.leafletElement.touchZoom.disable()),this._updating=!1}},{key:"getZoomPanOptions",value:function(e){return{animate:e.animate,duration:e.duration,easeLinearity:e.easeLinearity,noMoveStart:e.noMoveStart}}},{key:"getFitBoundsOptions",value:function(e){var t=this.getZoomPanOptions(e);return pe(pe({},t),e.boundsOptions)}},{key:"componentDidMount",value:function(){var e=Re.apply(void 0,[this.props].concat(Ie));this.leafletElement=this.createLeafletElement(e),this.leafletElement.on("move",this.onViewportChange),this.leafletElement.on("moveend",this.onViewportChanged),null!=e.bounds&&this.leafletElement.fitBounds(e.bounds,this.getFitBoundsOptions(e)),this.contextValue={layerContainer:this.leafletElement,map:this.leafletElement},he(X(o.prototype),"componentDidMount",this).call(this),this.forceUpdate()}},{key:"componentDidUpdate",value:function(e){!1===this._ready&&(this._ready=!0,this.props.whenReady&&this.leafletElement.whenReady(this.props.whenReady)),he(X(o.prototype),"componentDidUpdate",this).call(this,e),this.updateLeafletElement(e,this.props)}},{key:"componentWillUnmount",value:function(){he(X(o.prototype),"componentWillUnmount",this).call(this),this.leafletElement.off("move",this.onViewportChange),this.leafletElement.off("moveend",this.onViewportChanged),!0===this.props.preferCanvas?(this.leafletElement._initEvents(!0),this.leafletElement._stop()):this.leafletElement.remove()}},{key:"shouldUpdateCenter",value:function(e,t){return!t||(e=Be(e),t=Be(t),e[0]!==t[0]||e[1]!==t[1])}},{key:"shouldUpdateBounds",value:function(e,t){return!t||!a.latLngBounds(e).equals(a.latLngBounds(t))}},{key:"render",value:function(){return i.default.createElement("div",{className:this.className,id:this.props.id,ref:this.bindContainer,style:this.props.style},this.contextValue?i.default.createElement(G,{value:this.contextValue},this.props.children):null)}}]),o}(),ze=A(function(){Q(t,ve);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){var t=new a.Marker(e.position,this.getOptions(e));return this.contextValue=pe(pe({},e.leaflet),{},{popupContainer:t}),t}},{key:"updateLeafletElement",value:function(e,t){t.position!==e.position&&this.leafletElement.setLatLng(t.position),t.icon!==e.icon&&this.leafletElement.setIcon(t.icon),t.zIndexOffset!==e.zIndexOffset&&this.leafletElement.setZIndexOffset(t.zIndexOffset),t.opacity!==e.opacity&&this.leafletElement.setOpacity(t.opacity),t.draggable!==e.draggable&&(!0===t.draggable?this.leafletElement.dragging.enable():this.leafletElement.dragging.disable())}},{key:"render",value:function(){var e=this.props.children;return null==e||null==this.contextValue?null:i.default.createElement(G,{value:this.contextValue},e)}}]),t}()),$e=0,Ae=["tile","shadow","overlay","map","marker","tooltip","popup"],Ne=/-*pane/gi,We={position:"absolute",top:0,right:0,bottom:0,left:0},Fe=A(function(e){Q(r,e);var l=oe(r);function r(){var o;q(this,r);for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o=l.call.apply(l,[this].concat(t)),le(te(o),"state",{name:void 0,context:void 0}),le(te(o),"setStyle",function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:o.props,t=e.style,e=e.className,n=o.getPane(o.state.name);n&&(e&&we(n,e),t&&Object.keys(t).forEach(function(e){n.style[e]=t[e]}))}),o}return H(r,[{key:"componentDidMount",value:function(){this.createPane(this.props)}},{key:"componentDidUpdate",value:function(e){var t;this.state.name&&(this.props.name!==e.name?(this.removePane(),this.createPane(this.props)):(!e.className||this.props.className===e.className||null!=(t=this.getPane(this.state.name))&&null!=e.className&&be(t,e.className),this.setStyle(this.props)))}},{key:"componentWillUnmount",value:function(){this.removePane()}},{key:"createPane",value:function(e){var t,n=e.leaflet.map,o=e.name||"pane-".concat(++$e);null!=n&&null!=n.createPane&&(null==((t=o,-1!==Ae.indexOf(t.replace(Ne,"")))||this.getPane(o))&&n.createPane(o,this.getParentPane()),this.setState({name:o,context:pe(pe({},e.leaflet),{},{pane:o})},this.setStyle))}},{key:"removePane",value:function(){var e,t=this.state.name;null!=t&&(null!=(e=this.getPane(t))&&e.remove&&e.remove(),null!=(e=this.props.leaflet.map)&&null!=e._panes&&(e._panes=Re(e._panes,t),e._paneRenderers=Re(e._paneRenderers,t)))}},{key:"getParentPane",value:function(){return this.getPane(this.props.pane||this.props.leaflet.pane)}},{key:"getPane",value:function(e){if(null!=e&&null!=this.props.leaflet.map)return this.props.leaflet.map.getPane(e)}},{key:"render",value:function(){var e=this.state.context;return e?i.default.createElement(G,{value:e},i.default.createElement("div",{style:We},this.props.children)):null}}]),r}(l.Component)),Ge=A(function(){Q(t,Le);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.Polygon(e.positions,this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){t.positions!==e.positions&&this.leafletElement.setLatLngs(t.positions),this.setStyleIfChanged(e,t)}}]),t}()),qe=A(function(){Q(t,Le);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.Polyline(e.positions,this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){t.positions!==e.positions&&this.leafletElement.setLatLngs(t.positions),this.setStyleIfChanged(e,t)}}]),t}()),Je=function(){Q(r,xe);var l=oe(r);function r(){var t;q(this,r);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return t=l.call.apply(l,[this].concat(n)),le(te(t),"onPopupOpen",function(e){e.popup===t.leafletElement&&t.onOpen()}),le(te(t),"onPopupClose",function(e){e.popup===t.leafletElement&&t.onClose()}),le(te(t),"onRender",function(){!1!==t.props.autoPan&&t.leafletElement.isOpen()&&(t.leafletElement._map&&t.leafletElement._map._panAnim&&(t.leafletElement._map._panAnim=void 0),t.leafletElement._adjustPan())}),t}return H(r,[{key:"getOptions",value:function(e){return pe(pe({},he(X(r.prototype),"getOptions",this).call(this,e)),{},{autoPan:!1})}},{key:"createLeafletElement",value:function(e){var t=this.getOptions(e);return t.autoPan=!1!==e.autoPan,new a.Popup(t,e.leaflet.popupContainer)}},{key:"updateLeafletElement",value:function(e,t){t.position!==e.position&&this.leafletElement.setLatLng(t.position)}},{key:"componentDidMount",value:function(){var e=this.props.position,t=this.props.leaflet,n=t.map,o=t.popupContainer,t=this.leafletElement;null!=n&&n.on({popupopen:this.onPopupOpen,popupclose:this.onPopupClose}),o?o.bindPopup(t):(e&&t.setLatLng(e),t.openOn(n))}},{key:"componentWillUnmount",value:function(){var e=this.props.leaflet.map;null!=e&&(e.off({popupopen:this.onPopupOpen,popupclose:this.onPopupClose}),e.removeLayer(this.leafletElement)),he(X(r.prototype),"componentWillUnmount",this).call(this)}}]),r}();le(Je,"defaultProps",{pane:"popupPane"});var He=A(Je),Ke=A(function(){Q(t,Le);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.Rectangle(e.bounds,this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){t.bounds!==e.bounds&&this.leafletElement.setBounds(t.bounds),this.setStyleIfChanged(e,t)}}]),t}()),Qe=A(function(){Q(t,re);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.Control.Scale(e)}}]),t}());function Xe(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}var Ye=A(function(){Q(o,de);var n=oe(o);function o(e){var t;return q(this,o),t=n.call(this,e),le(te(t),"leafletElement",void 0),le(te(t),"container",void 0),t.leafletElement=t.createLeafletElement(e),t}return H(o,[{key:"createLeafletElement",value:function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");return Xe(t,"xmlns","http://www.w3.org/2000/svg"),Xe(t,"preserveAspectRatio",e.preserveAspectRatio),Xe(t,"viewBox",e.viewBox),this.container=t,new a.SVGOverlay(t,e.bounds,this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){t.bounds!==e.bounds&&this.leafletElement.setBounds(t.bounds),t.opacity!==e.opacity&&this.leafletElement.setOpacity(t.opacity),this.container&&t.preserveAspectRatio!==e.preserveAspectRatio&&Xe(this.container,"preserveAspectRatio",t.preserveAspectRatio),this.container&&t.viewBox!==e.viewBox&&Xe(this.container,"viewBox",t.viewBox),t.zIndex!==e.zIndex&&this.leafletElement.setZIndex(t.zIndex)}},{key:"componentDidMount",value:function(){he(X(o.prototype),"componentDidMount",this).call(this),this.layerContainer.addLayer(this.leafletElement)}},{key:"componentDidUpdate",value:function(e){var t;he(X(o.prototype),"componentDidUpdate",this).call(this,e),this.props.attribution===e.attribution||null!=(t=this.props.leaflet.map)&&null!=t.attributionControl&&(t.attributionControl.removeAttribution(e.attribution),t.attributionControl.addAttribution(this.props.attribution)),this.updateLeafletElement(e,this.props)}},{key:"componentWillUnmount",value:function(){he(X(o.prototype),"componentWillUnmount",this).call(this),this.layerContainer.removeLayer(this.leafletElement),this.container=null}},{key:"render",value:function(){var e=this.props.children;return null==e||null==this.container?null:t.createPortal(e,this.container)}},{key:"layerContainer",get:function(){return this.props.leaflet.layerContainer||this.props.leaflet.map}}]),o}()),et=A(function(){Q(n,je);var e=oe(n);function n(){return q(this,n),e.apply(this,arguments)}return H(n,[{key:"createLeafletElement",value:function(e){return new a.TileLayer(e.url,this.getOptions(e))}},{key:"updateLeafletElement",value:function(e,t){he(X(n.prototype),"updateLeafletElement",this).call(this,e,t),t.url!==e.url&&this.leafletElement.setUrl(t.url)}}]),n}()),s=function(){Q(r,xe);var l=oe(r);function r(){var t;q(this,r);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return t=l.call.apply(l,[this].concat(n)),le(te(t),"onTooltipOpen",function(e){e.tooltip===t.leafletElement&&t.onOpen()}),le(te(t),"onTooltipClose",function(e){e.tooltip===t.leafletElement&&t.onClose()}),t}return H(r,[{key:"createLeafletElement",value:function(e){return new a.Tooltip(this.getOptions(e),e.leaflet.popupContainer)}},{key:"componentDidMount",value:function(){var e=this.props.leaflet.popupContainer;null!=e&&(e.on({tooltipopen:this.onTooltipOpen,tooltipclose:this.onTooltipClose}),e.bindTooltip(this.leafletElement))}},{key:"componentWillUnmount",value:function(){var e=this.props.leaflet.popupContainer;null!=e&&(e.off({tooltipopen:this.onTooltipOpen,tooltipclose:this.onTooltipClose}),null!=e._map&&e.unbindTooltip(this.leafletElement))}}]),r}();le(s,"defaultProps",{pane:"tooltipPane"});De=A(s),Ue=A(function(){Q(t,ve);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.VideoOverlay(e.url,e.bounds,this.getOptions(e))}},{key:"componentDidMount",value:function(){he(X(t.prototype),"componentDidMount",this).call(this),!0===this.props.play&&this.leafletElement.getElement().play()}},{key:"updateLeafletElement",value:function(e,t){t.url!==e.url&&this.leafletElement.setUrl(t.url),t.bounds!==e.bounds&&this.leafletElement.setBounds(a.latLngBounds(t.bounds)),t.opacity!==e.opacity&&this.leafletElement.setOpacity(t.opacity),t.zIndex!==e.zIndex&&this.leafletElement.setZIndex(t.zIndex),!0!==t.play||e.play?t.play||!0!==e.play||this.leafletElement.getElement().pause():this.leafletElement.getElement().play()}}]),t}()),Je=A(function(){Q(l,je);var e=oe(l);function l(){return q(this,l),e.apply(this,arguments)}return H(l,[{key:"createLeafletElement",value:function(e){var t=e.url,e=se(e,["url"]),e=this.getOptions(e),e=(e.leaflet,se(e,["leaflet"]));return new a.TileLayer.WMS(t,e)}},{key:"updateLeafletElement",value:function(e,t){he(X(l.prototype),"updateLeafletElement",this).call(this,e,t);var n=e.url,o=(e.opacity,e.zIndex,se(e,["url","opacity","zIndex"])),e=this.getOptions(o),o=(e.leaflet,se(e,["leaflet"])),e=t.url,t=(t.opacity,t.zIndex,se(t,["url","opacity","zIndex"])),t=this.getOptions(t),t=(t.leaflet,se(t,["leaflet"]));e!==n&&this.leafletElement.setUrl(e),ce(t,o)||this.leafletElement.setParams(t)}},{key:"getOptions",value:function(e){var n=he(X(l.prototype),"getOptions",this).call(this,e);return Object.keys(n).reduce(function(e,t){return me.test(t)||(e[t]=n[t]),e},{})}}]),l}()),s=A(function(){Q(t,re);var e=oe(t);function t(){return q(this,t),e.apply(this,arguments)}return H(t,[{key:"createLeafletElement",value:function(e){return new a.Control.Zoom(e)}}]),t}());e.AttributionControl=ae,e.Circle=ke,e.CircleMarker=Ce,e.ControlledLayer=Ze,e.DivOverlay=xe,e.FeatureGroup=Pe,e.GeoJSON=Se,e.GridLayer=je,e.ImageOverlay=_e,e.LayerGroup=Me,e.LayersControl=Ve,e.LeafletConsumer=F,e.LeafletProvider=G,e.Map=Te,e.MapComponent=de,e.MapControl=re,e.MapEvented=ye,e.MapLayer=ve,e.Marker=ze,e.Pane=Fe,e.Path=Le,e.Polygon=Ge,e.Polyline=qe,e.Popup=He,e.Rectangle=Ke,e.SVGOverlay=Ye,e.ScaleControl=Qe,e.TileLayer=et,e.Tooltip=De,e.VideoOverlay=Ue,e.WMSTileLayer=Je,e.ZoomControl=s,e.useLeaflet=function(){return l.useContext(W)},e.withLeaflet=A,Object.defineProperty(e,"__esModule",{value:!0})});