React-amap is a Map Components Based On React and AMap(amap.com)
We are excited that you are interested in contributing to react-amap. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
## Issue Guidelines
- Issues are exclusively for bug reports and feature requests. Other questions may be closed directly.
- Before submitting an issue, please check if similar problems have already been issued.
- Please specify which version of react-amap you are using, and provide OS and browser information. [JSFiddle](https://jsfiddle.net/) is recommended to build a live demo so that your issue can be reproduced clearly.
## Pull Request Guidelines
- Fork this repository to your own account. Do not create branches here.
-**DO NOT** include files inside `lib` directory.
- Rebase before creating a PR to keep commit history clear.
- If you are fixing a bug, please include detailed description of the bug in the PR.
- Merging a PR takes two maintainers: one approves the changes after reviewing, and then the other reviews and merges.
## Code Style
Just comply with the [ESLint](https://github.com/ElemeFE/eslint-config-elemefe) configuration of [ElemeFE](https://github.com/elemefe).
在你的组件中,可以通过 props 访问到创建好的高德地图实例,以及地图的 div 容器;拥有访问这两个属性的能力后,你可以根据高德原生 API 做高德允许你做的一切事情。实际上,react-amap 中的其他组件就是这么做的。文档内容请参考[自定义地图组件](https://elemefe.github.io/react-amap/articles/extend)。
!function(e,t){"object"==typeofexports&&"object"==typeofmodule?module.exports=t(require("react"),require("react-dom")):"function"==typeofdefine&&define.amd?define(["react","react-dom"],t):"object"==typeofexports?exports.ReactAMAP=t(require("react"),require("react-dom")):e.ReactAMAP=t(e.React,e.ReactDOM)}(this,function(e,t){returnfunction(e){functiont(r){if(n[r])returnn[r].exports;varo=n[r]={i:r,l:!1,exports:{}};returne[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}varn={};returnt.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){varn=e&&e.__esModule?function(){returne.default}:function(){returne};returnt.d(n,"a",n),n},t.o=function(e,t){returnObject.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=8)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});varr={MARKER_ID_CONFLICT:"Marker 的 id 属性重复",MARKER_ID_REQUIRED:"每一个 Marker 必需有一个 id 属性",MAP_INSTANCE_REQUIRED:"没有地图实例;组件必须作为 Map 的子组件使用",CIRCLE_INSTANCE_REQUIRED:"",CIRCLE_CENTER_REQUIRED:"Circle 组件必需设置 center 属性",CIRCLE_RADIUS_REQUIRED:"Circle 组件必需设置 radius 属性",SRC_REQUIRED:"GroundImage 组件必需设置 src 属性",BOUNDS_REQUIRED:"GroundImage 组件必需设置 bounds 属性",WINDOW_POSITION_REQUIRED:"InfoWindow 组件必需设置 position 属性",INVALID_AMAP_PLUGIN:"plugins 属性不正确;目前支持的插件有'Scale', 'ToolBar', 'MapType', 'OverView'"},o=function(e){returneinr?r[e]:e},i={error:function(e){thrownewError(o(e))},warning:function(e){console.warn(o(e))},optimize:function(e){console.log("%c"+o(e),"color:#d4d483;border-left: 2px solid #d4d483;padding-left: 4px;")}};t.default=i},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}functionu(e){returnfunction(t){functionn(e){o(this,n);vart=i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));returnt.instanceCreated=!1,t.myMapComponent=null,t.registeredEvents=[],t.onInstanceCreated=t.onInstanceCreated.bind(t),t}returna(n,t),s(n,[{key:"onInstanceCreated",value:function(){if(this.instanceCreated=!0,"events"inthis.props){vare=this.myMapComponent.instance;this.props.events.created&&this.props.events.created(e)}this.reactivePropChange(this.props,!1)}},{key:"createEventsProxy",value:function(e){vart=this,n=this.myMapComponent.instance,r=Object.keys(e.events||{});r.length&&r.forEach(function(e){-1===t.registeredEvents.indexOf(e)&&(t.registeredEvents.push(e),n.on(e,function(e){returnfunction(){if(t.props.events&&eint.props.events){for(varn=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];t.props.events[e].apply(null,r)}}}(e)))})}},{key:"componentWillReceiveProps",value:function(e){this.reactivePropChange(e,!0)}},{key:"reactivePropChange",value:function(e){vart=this,n=!(arguments.length>1&&void0!==arguments[1])||arguments[1];if(!this.instanceCreated)return!1;varr=this.myMapComponent,o=r.setterMap,i=void0===o?{}:o,a=r.converterMap,u=void0===a?{}:a,l=r.instance,s=void0===l?{}:l,c=Object.keys(e);c.length&&c.forEach(function(r){if("events"===r)returnt.createEventsProxy(e);varo=!0;if(n&&(o=t.detectPropChange(r,e,t.props)),!o)return!1;vara=e[r];if(rinu&&(a=u[r](e[r])),rini)i[r](a);else{varl="set"+(0,d.default)(r);lins&&s[l](a)}})}},{key:"detectPropChange",value:function(e,t,n){returnt[e]!==n[e]}},{key:"render",value:function(){vart=this;returnf.default.createElement(e,l({onInstanceCreated:this.onInstanceCreated,ref:function(e){t.myMapComponent=e}},this.props))}},{key:"componentWillUnmount",value:function(){vare=this.myMapComponent.instance;e&&("destroy"ine&&setTimeout(function(){e.destroy()},10),"hide"ine&&e.hide(),"__map__"inthis.props&&"setMap"ine&&e.setMap(null))}}]),n}(f.default.Component)}Object.defineProperty(t,"__esModule",{value:!0});varl=Object.assign||function(e){for(vart=1;t<arguments.length;t++){varn=arguments[t];for(varrinn)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}returne},s=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),f=r(c),p=n(11),d=r(p);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});varr="undefined"!=typeofwindow,o=t.toLnglat=function(e){if(!e)returne;if("getLng"ine&&"getLat"ine)returne;vart=0,n=0;return"[object Array]"==={}.toString.call(e)?(t=e[0],n=e[1]):"lng"ine&&"lat"ine?(t=e.lng,n=e.lat):"longitude"ine&&"latitude"ine&&(t=e.longitude,n=e.latitude),r?newwindow.AMap.LngLat(t,n):null},i=t.toPixel=function(e){if(!e)returne;if("getX"ine&&"getY"ine)returne;vart=0,n=0;return"[object Array]"==={}.toString.call(e)?(t=e[0],n=e[1]):"x"ine&&"y"ine&&(t=e.x,n=e.y),r?newwindow.AMap.Pixel(t,n):null},a=t.toSize=function(e){returne?"getWidth"ine?e:r?newwindow.AMap.Size(e.width,e.height):null:e};t.default={toLnglat:o,toPixel:i,toSize:a}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});varr=function(e){return!!e&&"function"==typeofe};t.default=r},function(e,n){e.exports=t},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(2),f=r(c),p=n(1),d=r(p),h=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if("undefined"!=typeofwindow)if(e.__map__&&e.__poly__){varr=n;n.setterMap={active:function(e){r.toggleActive(e)}},n.map=e.__map__,n.poly=e.__poly__,n.editorActive=!1,n.createEditorInstance().then(function(){n.props.onInstanceCreated&&n.props.onInstanceCreated()})}elsed.default.warning("MAP_INSTANCE_REQUIRED");returnn}returna(t,e),u(t,[{key:"toggleActive",value:function(e){e?this.editorActive||this.activeEditor():this.editorActive&&this.inactiveEditor()}},{key:"activeEditor",value:function(){this.polyEditor&&(this.editorActive=!0,this.polyEditor.open())}},{key:"inactiveEditor",value:function(){this.editorActive=!1,this.polyEditor&&this.polyEditor.close()}},{key:"createEditorInstance",value:function(){vare=this;returnthis.polyEditor?Promise.resolve(this.polyEditor):newPromise(function(t){e.map.plugin(["AMap.PolyEditor"],function(){e.polyEditor=newwindow.AMap.PolyEditor(e.map,e.poly),t(e.polyEditor)})})}},{key:"render",value:function(){returnnull}},{key:"instance",get:function(){returnthis.polyEditor}}]),t}(s.default.Component);t.default=(0,f.default)(h)},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.renderMarkerComponent=t.getPropValue=t.MarkerAllProps=t.MarkerConfigurableProps=void0;varo=n(3),i=n(0),a=r(i),u=n(5),l=n(4),s=r(l),c=t.MarkerConfigurableProps=["position","offset","icon","content","draggable","visible","zIndex","angle","animation","shadow","title","clickable","extData","label"],f=t.MarkerAllProps=c.concat(["topWhenClick","bubble","raiseOnDrag","cursor","autoRotation","shape"]);t.getPropValue=function(e,t){return-1===f.indexOf(e)?null:"position"===e?(0,o.toLnglat)(t):"offset"===e?(0,o.toPixel)(t):t},t.renderMarkerComponent=function(e,t){varn=e;if((0,s.default)(e)){n=e(t.getExtData())}n&&(0,u.render)(a.default.createElement("div",null,n),t.getContent())}},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.MouseTool=t.Marker=t.GroundImage=t.InfoWindow=t.PolyEditor=t.Polyline=t.Polygon=t.CircleEditor=t.Circle=t.Markers=t.Map=void0;varo=n(9),i=r(o),a=n(12),u=r(a),l=n(13),s=r(l),c=n(14),f=r(c),p=n(15),d=r(p),h=n(16),v=r(h),y=n(17),m=r(y),b=n(18),_=r(b),w=n(19),g=r(w),k=n(6),C=r(k),M=n(20),E=r(M);t.Map=i.default,t.Markers=s.default,t.Circle=f.default,t.CircleEditor=g.default,t.Polygon=d.default,t.Polyline=v.default,t.PolyEditor=C.default,t.InfoWindow=m.default,t.GroundImage=_.default,t.Marker=u.default,t.MouseTool=E.default,t.default={Map:i.default,Markers:s.default,Circle:f.default,CircleEditor:g.default,Polygon:d.default,Polyline:v.default,PolyEditor:C.default,InfoWindow:m.default,GroundImage:_.default,Marker:u.default,MouseTool:E.default}},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){varn={};for(varrine)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);returnn}functioni(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functiona(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functionu(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varl=Object.assign||function(e){for(vart=1;t<arguments.length;t++){varn=arguments[t];for(varrinn)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}returne},s=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),f=r(c),p=n(10),d=r(p),h=n(4),v=r(h),y=n(1),m=r(y),b=n(3),_=n(2),w=r(_),g=f.default.Component,k=f.default.Children,C={width:"100%",height:"100%"},M={width:"100%",height:"100%",position:"relative"},E=["layers","zoom","center","labelzIndex","mapStyle","features","cursor","pitch"],O=["animateEnable","doubleClickZoom","dragEnable","isHotspot","jogEnable","keyboardEnable","resizeEnable","rotateEnable","scrollWheel","touchZoom","zoomEnable"],P=["view","zooms","showIndoorMap","indoorMap","expandZoomRange","showBuildingBlock","viewMode","pitchEnable","buildingAnimation","skyColor"],I=E.concat(O,P),j={MapType:{showRoad:!1,showTraffic:!1,defaultType:0},ToolBar:{position:"RB",noIpLocate:!0,locate:!0,liteStyle:!0,autoPosition:!1},OverView:{},ControlBar:{}},A=function(e){functiont(e){i(this,t);varn=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.state={mapLoaded:!1};varr=n;returnn.setterMap={zoom:function(e){r.map.setZoom(e)},cursor:function(e){r.map.setDefaultCursor(e)},labelzIndex:function(e){r.map.setlabelzIndex(e)}},n.converterMap={center:b.toLnglat},"undefined"!=typeofwindow&&(n.pluginMap={},newd.default({key:e.amapkey,useAMapUI:e.useAMapUI,version:e.version,protocol:e.protocol}).load().then(function(){n.createInstance(),n.state.mapLoaded||n.setState({mapLoaded:!0})})),n}returnu(t,e),s(t,[{key:"componentWillReceiveProps",value:function(e){this.state.mapLoaded&&this.updateMapProps(this.props,e)}},{key:"renderChildren",value:function(){vare=this;returnk.map(this.props.children,function(t){if(t){varn=t.type;returnn.preventAmap||"string"==typeofn?t:f.default.cloneElement(t,{__map__:e.map})}returnt})}},{key:"createInstance",value:function(){if(!this.map){vare=this.buildCreateOptions();this.map=newwindow.AMap.Map(this.mapWrapper,e),this.setPlugins(this.props),this.props.onInstanceCreated&&this.props.onInstanceCreated()}}},{key:"buildCreateOptions",value:function(){vare=this,t=this.props,n={};returnI.forEach(function(r){rint&&(n[r]=e.getSetterValue(r,t))}),n}},{key:"updateMapProps",value:function(e,t){varn=this,r={},o=!1,i=!1;O.forEach(function(a){aint&&(i=!0,n.detectPropChanged(a,e,t)&&(o=!0,r[a]=t[a]))}),o&&this.map.setStatus(r),i&&"status"int&&m.default.warning("以下这些属性可以单独提供进行配置,也可以统一作为‘status’属性配置;但是请不要同时使用这两种方式。\n("+O.join(", ")+")"),P.forEach(function(r){rint&&n.detectPropChanged(r,e,t)&&m.default.warning("'"+r+"' 是一个静态属性,地图实例创建成功后无法修改")}),this.setPlugins(t)}},{key:"getSetterValue",value:function(e,t){returneinthis.converterMap?this.converterMap[e](t[e]):t[e]}},{key:"detectPropChanged",value:function(e,t,n){returnt[e]!==n[e]}},{key:"setPlugins",value:function(e){vart=this,n=["Scale","ToolBar","MapType","OverView","ControlBar"];if("plugins"ine){varr=e.plugins;r&&r.length&&r.forEach(function(e){varr=void0,o=void0,i=void0;"string"==typeofe?(r=e,o=null,i=!0):(r=e.name,o=e.options||{},i=!("visible"ino&&"boolean"==typeofo.visible)||o.visible,deleteo.visible);vara=n.indexOf(r);-1===a?m.default.warning("没有 ‘"+r+"’ 这个插件,请检查是否拼写错误"):i&&(n.splice(a,1),t.installPlugin(r,o))})}this.removeOrDisablePlugins(n)}},{key:"removeOrDisablePlugins",value:function(e){vart=this;e&&e.length&&e.forEach(function(e){eint.pluginMap&&("ControlBar"===e?(t.map.removeControl(t.pluginMap[e]),deletet.pluginMap[e]):t.pluginMap[e].hide())})}},{key:"installPlugin",value:function(e,t){switch(t=t||{},e){case"Scale":case"ToolBar":case"OverView":case"MapType":this.setMapPlugin(e,t);break;case"ControlBar":this.setControlBar(t)}}},{key:"setMapPlugin",value:function(e,t){varn=this;if(this.pluginMap[e])this.pluginMap[e].show();else{varr=t.onCreated,i=o(t,["onCreated"]),a=l({},j[e],i);this.map.plugin(["AMap."+e],function(){n.pluginMap[e]=newwindow.AMap[e](a),n.map.addControl(n.pluginMap[e]),(0,v.default)(r)&&r(n.pluginMap[e])})}}},{key:"setControlBar",value:function(e){vart=this;if(this.pluginMap.ControlBar);else{varn=e.onCreated,r=o(e,["onCreated"]),i=l({},j.ControlBar,r);this.map.plugin(["AMap.ControlBar"],function(){t.pluginMap.ControlBar=newwindow.AMap.ControlBar(i),t.map.addControl(t.pluginMap.ControlBar),(0,v.default)(n)&&n(t.pluginMap.ControlBar)})}}},{key:"render",value:function(){vare=this;returnf.default.createElement("div",{style:M},f.default.createElement("div",{ref:function(t){e.mapWrapper=t},style:C},this.state.mapLoaded?null:this.props.loading||null),f.default.createElement("div",null,this.state.mapLoaded?this.renderChildren():null))}},{key:"instance",get:function(){returnthis.map}}]),t}(g);t.default=(0,w.default)(A)},function(e,t,n){"use strict";functionr(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});varo=Object.assign||function(e){for(vart=1;t<arguments.length;t++){varn=arguments[t];for(varrinn)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}returne},i=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),a={v:"1.4.0",hostAndPath:"webapi.amap.com/maps",key:"f97efc35164149d0c0f299e7a8adb3d2",callback:"__amap_init_callback",useAMapUI:!1},u=null,l=null,s=!1,c=function(){functione(t){varn=t.key,i=t.useAMapUI,u=t.version,l=t.protocol;r(this,e),this.config=o({},a,{useAMapUI:i,protocol:l}),"undefined"!=typeofwindow&&(n?this.config.key=n:"amapkey"inwindow&&(this.config.key=window.amapkey)),u&&(this.config.v=u),this.protocol=l||window.location.protocol,-1===this.protocol.indexOf(":")&&(this.protocol+=":")}returni(e,[{key:"getScriptSrc",value:function(e){returnthis.protocol+"//"+e.hostAndPath+"?v="+e.v+"&key="+e.key+"&callback="+e.callback}},{key:"buildScriptTag",value:function(e){vart=document.createElement("script");returnt.type="text/javascript",t.async=!0,t.defer=!0,t.src=e,t}},{key:"getAmapuiPromise",value:function(){vare=this.buildScriptTag(this.protocol+"//webapi.amap.com/ui/1.0/main-async.js"),t=newPromise(function(t){e.onload=function(){t()}});returndocument.body.appendChild(e),t}},{key:"getMainPromise",value:function(){vare=this,t=this.buildScriptTag(this.getScriptSrc(this.config)),n=newPromise(function(t){window[e.config.callback]=function(){t(),deletewindow[e.config.callback]}});returndocument.body.appendChild(t),n}},{key:"load",value:function(){if("undefined"==typeofwindow)returnnull;vare=this.config.useAMapUI;returnu=u||this.getMainPromise(),e&&(l=l||this.getAmapuiPromise()),newPromise(function(t){u.then(function(){e&&l?l.then(function(){window.initAMapUI&&!s&&(window.initAMapUI(),"function"==typeofe&&e(),s=!0),t()}):t()})})}}]),e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});varr=function(e){returne[0].toUpperCase()+e.slice(1,e.length)};t.default=r},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(e){returntypeofe}:function(e){returne&&"function"==typeofSymbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeofe},l=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),c=r(s),f=n(5),p=n(1),d=r(p),h=n(2),v=r(h),y=n(7),m=n(3),b=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if("undefined"!=typeofwindow)if(e.__map__){varr=n;n.setterMap={visible:function(e){e?r.marker&&r.marker.show():r.marker&&r.marker.hide()},zIndex:function(e){r.marker&&r.marker.setzIndex(e)}},n.converterMap={position:m.toLnglat,offset:m.toPixel},n.map=e.__map__,n.element=n.map.getContainer(),setTimeout(function(){n.createMarker(e)},13)}elsed.default.warning("MAP_INSTANCE_REQUIRED");returnn}returna(t,e),l(t,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillReceiveProps",value:function(e){this.map&&this.refreshMarkerLayout(e)}},{key:"createMarker",value:function(e){vart=this.buildCreateOptions(e);this.marker=newwindow.AMap.Marker(t),this.marker.render=function(e){returnfunction(t){(0,y.renderMarkerComponent)(t,e)}}(this.marker),this.props.onInstanceCreated&&this.props.onInstanceCreated(),this.setMarkerLayout(e),this.setChildComponent(e)}},{key:"buildCreateOptions",value:function(e){vart=this,n={};returny.MarkerAllProps.forEach(function(r){rine&&(n[r]=t.getSetterParam(r,e[r]))}),n.map=this.map,n}},{key:"setMarkerLayout",value:function(e){("render"ine||"children"ine&&e.children)&&(this.createContentWrapper(),"className"ine&&e.className&&(this.contentWrapper.className=e.className))}},{key:"createContentWrapper",value:function(){this.contentWrapper=document.createElement("div"),this.marker.setContent(this.contentWrapper)}},{key:"setChildComponent",value:function(e){if(this.contentWrapper)if("className"ine&&e.className&&(this.contentWrapper.className=e.className),"render"ine)(0,y.renderMarkerComponent)(e.render,this.marker);elseif("children"ine){vart=e.children,n=void0===t?"undefined":u(t);"undefined"!==n&&this.contentWrapper&&(0,f.render)(c.default.createElement("div",null,t),this.contentWrapper)}}},{key:"refreshMarkerLayout",value:function(e){this.setChildComponent(e)}},{key:"getSetterParam",value:function(e,t){returneinthis.converterMap?this.converterMap[e](t):t}},{key:"render",value:function(){returnnull}},{key:"instance",get:function(){returnthis.marker}}]),t}(c.default.Component);t.default=(0,v.default)(b)},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(5),f=n(4),p=r(f),d=n(1),h=r(d),v=n(7);if("undefined"!=typeofwindow){vary=document.head||document.getElementsByTagName("head")[0],m=document.createElement("style");m.type="text/css",m.textContent=".amap_markers_pop_window{\n padding: 10px;\n border: 1px solid #ddd;\n border-radius: 8px;\n background: #fff;\n position: relative;\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-start;\n}\n.amap_markers_pop_window::before{\n content: ' ';\n display: block;\n position: absolute;\n bottom: -12px;\n left: 50%;\n margin-left: -7px;\n width: 0;\n height: 0;\n border-top: 12px solid #ddd;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n}\n.amap_markers_pop_window::after{\n content: ' ';\n display: block;\n position: absolute;\n bottom: -11px;\n left: 50%;\n margin-left: -6px;\n width: 0;\n height: 0;\n border-top: 11px solid #fff;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n}\n.amap_markers_pop_window_item{\n cursor:pointer;\n width: 40px;\n height: 50px;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n}\n.amap_markers_pop_window_item span{\n pointer-events: none;\n}\n.amap_markers_window_overflow_warning{\n text-align: center;\n width: 100%;\n margin: 5px 0;\n color: #666;\n}",y.appendChild(m)}varb=s.default.Component,_=25.6,w=46*.8-2,g=46*.8,k=66*.8-2,C={useCluster:!1,markersCache:[],markerIDCache:[]},M=["gridSize","minClusterSize","maxZoom","averageCenter","styles","zoomOnClick","renderCluserMarker"],E=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return"undefined"!=typeofwindow&&(e.__map__?(n.map=e.__map__,n.element=n.map.getContainer(),n.markersCache=C.markersCache,n.useCluster=null,n.markerIDCache=C.markerIDCache,n.resetOffset=newwindow.AMap.Pixel(-_/2,-w),n.hoverOffset=newwindow.AMap.Pixel(-g/2,-k),n.createMarkers(e)):h.default.warning("MAP_INSTANCE_REQUIRED")),n}returna(t,e),u(t,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"createMarkers",value:function(e){vart=this,n=e.markers||[],r=[],o={};n.length&&n.forEach(function(n,i){vara=t.buildCreateOptions(e,n,i);a.map=t.map;varu=null;if((0,p.default)(e.render)){varl=e.render(n);if(!1!==l){vars=document.createElement("div");s.setAttribute("__react_amap__","1"),u=s,o[i]=l}}if(!u){u=document.createElement("div");varc=document.createElement("img");c.src="//webapi.amap.com/theme/v1.3/markers/n/mark_bs.png",u.appendChild(c)}a.content=u;varf=newwindow.AMap.Marker(a);f.on("click",function(e){t.onMarkerClick(e)}),f.on("mouseover",function(e){t.onMarkerHover(e)}),f.on("mouseout",function(e){t.onMarkerHoverOut(e)}),f.render=function(e){returnfunction(t){return(0,v.renderMarkerComponent)(t,e)}}(f),t.bindMarkerEvents(f),r.push(f)}),this.markersCache=r,this.markerReactChildDOM=o,this.exposeMarkerInstance(),this.checkClusterSettings(e)}},{key:"checkClusterSettings",value:function(e){vart=this;if(e.useCluster)this.loadClusterPlugin(e.useCluster).then(function(e){e.setMarkers(t.markersCache)});elseif(this.mapCluster){varn=this.mapCluster.getMarkers();this.mapCluster.clearMarkers(),n.forEach(function(e){e.setMap(t.map)})}}},{key:"componentDidMount",value:function(){this.map&&this.setMarkerChild()}},{key:"setMarkerChild",value:function(){vare=this;Object.keys(this.markerReactChildDOM).forEach(function(t){varn=e.markersCache[t].getContent(),r=e.markerReactChildDOM[t];e.renderMarkerChild(n,r)})}},{key:"renderMarkerChild",value:function(e,t){(0,c.render)(s.default.createElement("div",null,t),e)}},{key:"buildCreateOptions",value:function(e,t,n){varr={},o=["extData"];returnv.MarkerAllProps.forEach(function(i){if(iint&&-1===o.indexOf(i))r[i]=(0,v.getPropValue)(i,t[i]);elseif(iine)if((0,p.default)(e[i])){vara=e[i].call(null,t,n);r[i]=(0,v.getPropValue)(i,a)}elser[i]=(0,v.getPropValue)(i,e[i])}),r.extData=t,r}},{key:"componentWillReceiveProps",value:function(e){this.map&&this.refreshMarkersLayout(e)}},{key:"refreshMarkersLayout",value:function(e){vart=e.markers!==this.props.markers,n=!!this.props.useCluster!=!!e.useCluster;t&&(this.markersCache.length&&this.markersCache.forEach(function(e){e&&(e.setMap(null),e=null)}),this.markersCache=C.markersCache,this.createMarkers(e),this.setMarkerChild()),(t||n)&&this.markersWindow&&this.markersWindow.close(),n&&this.checkClusterSettings(e)}},{key:"loadClusterPlugin",value:function(e){vart=this;if(this.mapCluster)returnPromise.resolve(this.mapCluster);varn="boolean"==typeofe?{}:e;returnnewPromise(function(e){t.map.plugin(["AMap.MarkerClusterer"],function(){e(t.createClusterPlugin(n))})})}},{key:"createClusterPlugin",value:function(e){vart={},n={minClusterSize:2,zoomOnClick:!1,maxZoom:18,gridSize:60,averageCenter:!0};M.forEach(function(r){t[r]=rine?e[r]:n[r]}),this.mapCluster=newwindow.AMap.MarkerClusterer(this.map,[],t);varr={};return"events"ine&&"created"in(r=e.events)&&r.created(this.mapCluster),this.initClusterMarkerWindow(),this.bindClusterEvent(r),this.mapCluster}},{key:"onMarkerClick",value:function(e){vart=e.target;this.triggerMarkerClick(e,t)}},{key:"onMarkerHover",value:function(e){e.target.setTop(!0),this.setMarkerHovered(e,e.target)}},{key:"onMarkerHoverOut",value:function(e){e.target.setTop(!1),this.setMarkerHoverOut(e,e.target)}},{key:"onWindowMarkerClick",value:function(e){vart=e.markerRef;this.triggerMarkerClick(null,t)}},{key:"onWindowMarkerHover",value:function(e){vart=e.markerRef;this.setMarkerHovered(null,t)}},{key:"onWindowMarkerHoverOut",value:function(e){vart=e.markerRef;this.setMarkerHoverOut(null,t)}},{key:"setMarkerHovered",value:function(e,t){this.triggerMarkerHover(e,t)}},{key:"setMarkerHoverOut",value:function(e,t){this.triggerMarkerHoverOut(e,t)}},{key:"triggerMarkerClick",value:function(e,t){varn=this.props.events||{};(0,p.default)(n.click)&&n.click(e,t)}},{key:"triggerMarkerHover",value:function(e,t){varn=this.props.events||{};(0,p.default)(n.mouseover)&&n.mouseover(e,t)}},{key:"triggerMarkerHoverOut",value:function(e,t){varn=this.props.events||{};(0,p.default)(n.mouseout)&&n.mouseout(e,t)}},{key:"initClusterMarkerWindow",value:function(){this.markersWindow=newwindow.AMap.InfoWindow({isCustom:!0,autoMove:!0,closeWhenClickMap:!0,content:"<span>loading...</span>",showShadow:!1,offset:newwindow.AMap.Pixel(0,-20)}),this.markersDOM=document.createElement("div"),this.markersDOM.className="amap_markers_pop_window",this.markersWindow.setContent(this.markersDOM)}},{key:"bindClusterEvent",value:function(e){vart=this;this.mapCluster.on("click",function(n){if(t.props.useCluster&&t.props.useCluster.zoomOnClick);else{varr=!0;(0,p.default)(e.click)&&(r=e.click(n)),!1!==r&&t.showMarkersInfoWindow(n)}})}},{key:"showMarkersInfoWindow",value:function(e){vart=this,n=e.lnglat,r=e.markers;if(this.markersDOM.innerHTML="",r&&r.length){varo=r.length;if(o>42&&(r=r.slice(0,42)),r.forEach(function(e){varn=e.getContent(),r=document.createElement("div");r.className="window_marker_item",r.appendChild(n),r.markerRef=e,r.addEventListener("click",t.onWindowMarkerClick.bind(t,r),!0),r.addEventListener("mouseover",t.onWindowMarkerHover.bind(t,r),!0),r.addEventListener("mouseout",t.onWindowMarkerHoverOut.bind(t,r),!0),t.markersDOM.appendChild(r)}),o>42){vari=document.createElement("div");i.className="amap_markers_window_overflow_warning",i.innerText="更多坐标请放大地图查看",this.markersDOM.appendChild(i)}}this.markersWindow.open(this.map,n)}},{key:"exposeMarkerInstance",value:function(){if("events"inthis.props){vare=this.props.events||{};(0,p.default)(e.created)&&e.created(this.markersCache)}}},{key:"bindMarkerEvents",value:function(e){vart=this.props.events||{},n=Object.keys(t),r=["click","mouseover","mouseout","created"];n.length&&n.forEach(function(n){-1===r.indexOf(n)&&e.on(n,t[n])})}},{key:"render",value:function(){returnnull}}]),t}(b);t.default=E},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(2),f=r(c),p=n(1),d=r(p),h=n(3),v=["center","radius","draggable","extData","visible","style"],y=v.concat(["zIndex","bubble"]),m=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if("undefined"!=typeofwindow)if(e.__map__){varr=n;n.setterMap={visible:function(e){r.mapCircle&&(e?r.mapCircle.show():r.mapCircle.hide())},style:function(e){r.mapCircle&&r.mapCircle.setOptions(e)}},n.converterMap={center:h.toLnglat},n.state={loaded:!1},n.map=e.__map__,n.element=n.map.getContainer(),n.createInstance(e).then(function(){n.setState({loaded:!0}),n.props.onInstanceCreated&&n.props.onInstanceCreated()})}elsed.default.warning("MAP_INSTANCE_REQUIRED");returnn}returna(t,e),u(t,[{key:"createInstance",value:function(e){vart=this.buildCreateOptions(e);returnt.map=this.map,this.mapCircle=newwindow.AMap.Circle(t),Promise.resolve(this.mapCircle)}},{key:"buildCreateOptions",value:function(e){vart=this,n={};returny.forEach(function(r){if(rine)if("style"===r&&void0!==e.style){varo=Object.keys(e.style);o.forEach(function(t){n[t]=e.style[t]})}elsen[r]=t.getSetterValue(r,e)}),n}},{key:"getSetterValue",value:function(e,t){returneinthis.converterMap?this.converterMap[e](t[e]):t[e]}},{key:"renderEditor",value:function(e){returne?1!==s.default.Children.count(e)?null:s.default.cloneElement(s.default.Children.only(e),{__circle__:this.mapCircle,__map__:this.map,__ele__:this.element}):null}},{key:"render",value:function(){returnthis.state.loaded?this.renderEditor(this.props.children):null}},{key:"instance",get:function(){returnthis.mapCircle}}]),t}(s.default.Component);t.default=(0,f.default)(m)},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(2),f=r(c),p=n(1),d=r(p),h=n(6),v=r(h),y=n(3),m=["path","draggable","extData","style","visible"],b=m.concat(["zIndex","bubble"]),_=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if("undefined"!=typeofwindow)if(e.__map__){varr=n;n.setterMap={visible:function(e){e?r.polygon&&r.polygon.show():r.polygon&&r.polygon.hide()},style:function(e){r.polygon.setOptions(e)}},n.converterMap={path:function(e){returnr.buildPathValue(e)}},n.state={loaded:!1},n.map=e.__map__,n.element=n.map.getContainer(),setTimeout(function(){n.initMapPolygon(e)},13)}elsed.default.warning("MAP_INSTANCE_REQUIRED");returnn}returna(t,e),u(t,[{key:"initMapPolygon",value:function(e){vart=this.buildCreateOptions(e);t.map=this.map,this.polygon=newwindow.AMap.Polygon(t),this.setState({loaded:!0}),this.props.onInstanceCreated&&this.props.onInstanceCreated()}},{key:"buildCreateOptions",value:function(e){vart=this,n={};returnb.forEach(function(r){if(rine)if("style"===r&&e.style){varo=Object.keys(e.style);o.forEach(function(t){n[t]=e.style[t]})}else"visible"!==r&&(n[r]=t.getSetterValue(r,e[r]))}),n}},{key:"detectPropChanged",value:function(e,t){returnthis.props[e]!==t[e]}},{key:"getSetterValue",value:function(e,t){returneinthis.converterMap?this.converterMap[e](t):t}},{key:"buildPathValue",value:function(e){vart=this;if(e.length){varn=e[0];if("number"==typeofn[0])returne.map(function(e){return(0,y.toLnglat)(e)});if("getLng"inn)returne;if("longitude"inn||"lng"inn)returne.map(function(e){return(0,y.toLnglat)(e)});if("length"inn&&n.length)returne.map(function(e){returnt.buildPathValue(e)})}return[]}},{key:"renderEditor",value:function(e){if(!e)returnnull;if(1!==s.default.Children.count(e))returnnull;vart=s.default.Children.only(e);returnt.type===v.default?s.default.cloneElement(t,{__poly__:this.polygon,__map__:this.map}):null}},{key:"render",value:function(){returnthis.state.loaded?this.renderEditor(this.props.children):null}},{key:"instance",get:function(){returnthis.polygon}}]),t}(l.Component);t.default=(0,f.default)(_)},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(2),f=r(c),p=n(1),d=r(p),h=n(6),v=r(h),y=n(3),m=s.default.Component,b=["path","extData","draggable","visible","style"],_=b.concat(["zIndex","bubble","showDir"]),w=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if("undefined"!=typeofwindow)if(e.__map__){varr=n;n.setterMap={visible:function(e){e?r.polyline&&r.polyline.show():r.polyline&&r.polyline.hide()},style:function(e){r.polyline.setOptions(e)}},n.converterMap={path:function(e){returnr.buildPathValue(e)}},n.state={loaded:!1},n.map=e.__map__,n.element=n.map.getContainer(),setTimeout(function(){n.createMapPolyline(e)},13)}elsed.default.warning("MAP_INSTANCE_REQUIRED");returnn}returna(t,e),u(t,[{key:"createMapPolyline",value:function(e){vart=this.buildCreateOptions(e);t.map=this.map,this.polyline=newwindow.AMap.Polyline(t),this.setState({loaded:!0}),this.props.onInstanceCreated&&this.props.onInstanceCreated()}},{key:"buildCreateOptions",value:function(e){vart=this,n={};return_.forEach(function(r){if(rine)if("style"===r&&e.style){varo=Object.keys(e.style);o.forEach(function(t){n[t]=e.style[t]})}else"visible"!==r&&(n[r]=t.getSetterValue(r,e[r]))}),n}},{key:"detectPropChanged",value:function(e,t){returnthis.props[e]!==t[e]}},{key:"getSetterValue",value:function(e,t){returneinthis.converterMap?this.converterMap[e](t):t}},{key:"buildPathValue",value:function(e){returne.length?"getLng"ine[0]?e:e.map(function(e){return(0,y.toLnglat)(e)}):e}},{key:"renderEditor",value:function(e){if(!e)returnnull;if(1!==s.default.Children.count(e))returnnull;vart=s.default.Children.only(e);returnt.type===v.default?s.default.cloneElement(t,{__poly__:this.polyline,__map__:this.map}):null}},{key:"render",value:function(){returnthis.state.loaded?this.renderEditor(this.props.children):null}},{key:"instance",get:function(){returnthis.polyline}}]),t}(m);t.default=(0,f.default)(w)},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(5),f=n(2),p=r(f),d=n(1),h=r(d),v=n(3),y=s.default.Component,m=["content","position","size","visible","offset"],b=m.concat(["isCustom","autoMove","closeWhenClickMap","showShadow"]),_=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if("undefined"!=typeofwindow)if(e.__map__){varr=n;n.setterMap={visible:function(e){e?(r.showWindow(),r.setClassName(r.props),r.setChild(r.props)):r.closeWindow()}},n.converterMap={size:v.toSize,offset:v.toPixel,position:v.toLnglat},n.map=e.__map__,n.isCustom=!0,setTimeout(function(){n.createInfoWindow(e)},13)}elseh.default.warning("MAP_INSTANCE_REQUIRED");returnn}returna(t,e),u(t,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillReceiveProps",value:function(e){this.map&&this.refreshWindowLayout(e)}},{key:"createInfoWindow",value:function(e){vart=this.buildCreateOptions(e);this.infoWindow=newwindow.AMap.InfoWindow(t),this.props.onInstanceCreated&&this.props.onInstanceCreated()}},{key:"refreshWindowLayout",value:function(e){this.setChild(e),this.setClassName(e)}},{key:"checkPropChanged",value:function(e,t){returnthis.props[e]!==t[e]}},{key:"showWindow",value:function(){this.infoWindow.open(this.map,this.infoWindow.getPosition())}},{key:"closeWindow",value:function(){this.infoWindow.close()}},{key:"buildCreateOptions",value:function(e){vart=this,n={};returnn.isCustom="isCustom"ine&&!!e.isCustom,"content"ine?n.content=e.content:(this.infoDOM=document.createElement("div"),n.content=this.infoDOM),b.forEach(function(r){rine&&-1===["visible","isCustom","content"].indexOf(r)&&(n[r]=t.getSetterValue(r,e[r]))}),n}},{key:"getSetterValue",value:function(e,t){returneinthis.converterMap?this.converterMap[e](t):t}},{key:"setChild",value:function(e){vart=e.children;this.infoDOM&&t?(0,c.render)(s.default.createElement("div",null,t),this.infoDOM):e.children&&console.warn("因为你设置 isCustom 为 true,InfoWindow 的 Children 被忽略")}},{key:"setClassName",value:function(e){if(this.infoDOM){vart="";"className"ine&&e.className?t+=e.className:!0===e.isCustom&&(t+="amap_markers_pop_window"),this.infoDOM.className=t}}},{key:"render",value:function(){returnnull}},{key:"instance",get:function(){returnthis.infoWindow}}]),t}(y);t.default=(0,p.default)(_)},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(2),f=r(c),p=n(1),d=r(p),h={clickable:!1,opacity:1,visible:!0},v=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if("undefined"!=typeofwindow)if(e.__map__){varr=n;n.setterMap={visible:function(e){e?r.image&&r.image.show():r.image&&r.image.hide()},src:function(e){r.image.setImageUrl(e)}},n.converterMap={bounds:function(e){returnr.buildBounds(e)}},n.map=e.__map__,n.element=n.map.getContainer(),setTimeout(function(){n.createGroundImage(e)},13)}elsed.default.warning("MAP_INSTANCE_REQUIRED");returnn}returna(t,e),u(t,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"checkPropsChanged",value:function(e,t){returnthis.props[t]!==e[t]}},{key:"createGroundImage",value:function(e){vart=void0,n=void0,r=void0,o=void0;"src"ine?t=e.src:d.default.warning("SRC_REQUIRED",!0),"bounds"ine?n=this.buildBounds(e.bounds):d.default.warning("BOUNDS_REQUIRED",!0),o="clickable"ine?e.clickable:h.clickable,r="opacity"ine?e.opacity:h.opacity,this.image=newwindow.AMap.GroundImage(t,n,{map:this.map,clickable:o,opacity:r}),this.props.onInstanceCreated&&this.props.onInstanceCreated()}},{key:"buildBounds",value:function(e){returne?"getSouthWest"ine?e:newwindow.AMap.Bounds(newwindow.AMap.LngLat(e.sw.longitude,e.sw.latitude),newwindow.AMap.LngLat(e.ne.longitude,e.ne.latitude)):e}},{key:"render",value:function(){returnnull}},{key:"instance",get:function(){returnthis.image}}]),t}(s.default.Component);t.default=(0,f.default)(v)},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(1),f=r(c),p=n(4),d=r(p),h=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return"undefined"!=typeofwindow&&(e.__map__&&e.__circle__?(n.map=e.__map__,n.element=n.map.getContainer(),n.circle=e.__circle__,n.editorActive=!1,n.onPropsUpdate(e)):f.default.warning("CIRCLE_INSTANCE_REQUIRED")),n}returna(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){this.map&&this.onPropsUpdate(e)}},{key:"onPropsUpdate",value:function(e){"active"ine&&!1===e.active?this.toggleActive(!1,e):this.toggleActive(!0,e)}},{key:"toggleActive",value:function(e,t){e?this.editorActive||this.activeEditor(t):this.editorActive&&this.inactiveEditor()}},{key:"activeEditor",value:function(e){vart=this;this.loadCircleEditor(e).then(function(e){t.editorActive=!0,e.open()})}},{key:"inactiveEditor",value:function(){this.editorActive=!1,this.circleEditor&&this.circleEditor.close()}},{key:"loadCircleEditor",value:function(e){vart=this;returnthis.circleEditor?Promise.resolve(this.circleEditor):newPromise(function(n){t.map.plugin(["AMap.CircleEditor"],function(){n(t.createEditorInstance(e))})})}},{key:"createEditorInstance",value:function(e){this.circleEditor=newwindow.AMap.CircleEditor(this.map,this.circle);vart=this.exposeEditorInstance(e);returnt&&this.bindEditorEvents(t),this.circleEditor}},{key:"exposeEditorInstance",value:function(e){if("events"ine){vart=e.events||{};return(0,d.default)(t.created)&&t.created(this.circleEditor),deletet.created,t}return!1}},{key:"bindEditorEvents",value:function(e){vart=this,n=Object.keys(e);n.length&&n.forEach(function(n){t.circleEditor.on(n,e[n])})}},{key:"render",value:function(){returnnull}}]),t}(s.default.Component);t.default=h},function(e,t,n){"use strict";functionr(e){returne&&e.__esModule?e:{default:e}}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functioni(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functiona(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});varu=function(){functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=r(l),c=n(2),f=r(c),p=n(1),d=r(p),h=function(e){functiont(e){o(this,t);varn=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return"undefined"!=typeofwindow&&(e.__map__?(n.map=e.__map__,n.loadToolInstance().then(function(){n.props.onInstanceCreated&&n.props.onInstanceCreated()})):d.default.warning("MAP_INSTANCE_REQUIRED")),n}returna(t,e),u(t,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"loadToolInstance",value:function(){vare=this;returnnewPromise(function(t){e.map.plugin(["AMap.MouseTool"],function(){e.tool=newwindow.AMap.MouseTool(e.map),t()})})}},{key:"render",value:function(){returnnull}},{key:"instance",get:function(){returnthis.tool}}]),t}(s.default.Component);t.default=(0,f.default)(h)}])});
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}
function_possibleConstructorReturn(self,call){if(!self){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returncall&&(typeofcall==="object"||typeofcall==="function")?call:self;}
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function, not "+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}