com.mware.web.product.map.dist.Map.js Maven / Gradle / Ivy
The newest version!
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1)):"function"==typeof define&&define.amd?define(["openlayers","prop-types","create-react-class","react-dom","util/withDataRequest","jscache","util/vertex/formatters","util/mapConfig","data/web-worker/store/ontology/selectors","react-redux","data/web-worker/store/selection/actions","data/web-worker/store/product/actions","data/web-worker/store/product/selectors","data/web-worker/store/actions","configuration/plugins/registry","util/dnd","components/DroppableHOC","components/RegistryInjectorHOC","product/toolbar/ProductToolbar","util/deepObjectCache"],t):"object"==typeof exports?exports.Map=t(require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1),require(!1)):e.Map=t(e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0],e[void 0])}("undefined"!=typeof self?self:this,function(e,t,r,n,o,i,a,s,c,u,l,d,p,f,g,v,h,y,m,x){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=64)}([function(t,r){t.exports=e},,function(e,r){e.exports=t},,function(e,t,r){function n(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var o,i,a=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],r=e.visible,o=void 0===r||r,i=e.opacity,a=void 0===i?1:i,s=e.zIndex,c=void 0===s?0:s,u=n(e,["visible","opacity","zIndex"]);_.mapObject(u,function(e,r){null===e?t.unset(r):t.set(r,e)}),t.setVisible(o),t.setOpacity(a),t.setZIndex(c)}function u(t,r,i){var a=t.features,c=r.source,u=_.indexBy(c.getFeatures(),function(e){return e.getId()}),l=[],d=!1;if(a)for(var f=0;f=0;t--)if(_.isFunction(e[t].getImage)){var r=e[t].getImage(),n=r&&_.isFunction(r.getRadius)&&r.getRadius();if(n){var o=n/devicePixelRatio;return o}}}var f="org-bigconnect-map-vector-selected-overlay",g={sortable:!0,toggleable:!0},v={tile:{configure:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.source,i=r.sourceOptions,a=void 0===i?{}:i,c=n(r,["source","sourceOptions"]),u=void 0;if(!(o in e.source&&_.isFunction(e.source[o])))throw console.error("Unknown map provider type: ",o),new Error("map.provider is invalid");return u=new e.source[o](s({crossOrigin:"anonymous"},a)),{source:u,layer:new e.layer.Tile(s({},g,{id:t,label:"Base",type:"tile",sortable:!1,source:u},c))}},addEvents:function(e,t,r){return[t.source.on("tileloaderror",function(e){var t=e.tile;t&&(t._retryCount=(t._retryCount||0)+1,t._retryCount<=3&&(console.warn("Tile error retry: "+t._retryCount+" of 3",t.src_),_.defer(function(){t.load()})))})]}},cluster:{configure:function(r){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=new e.source.Vector({features:[]}),c=new t({source:a}),u=new e.layer.Vector(s({},g,{id:r,label:"Cluster",type:"cluster",style:function(e){return n.style(e,{source:a})},source:c},i)),l=new e.layer.Heatmap(s({},g,i,{visible:!1,id:"heatmap_cluster",label:"Heatmap",type:"cluster_heatmap",source:a}));return o.clear(),{source:a,clusterSource:c,layers:[l,u]}},style:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.source,n=t.selected,o=void 0!==n&&n,i=e.get("count"),a=e.get("selectionState")||"none",s=o||"none"!==a;return i>1?h.cluster(e,{selected:s,source:r}):h.feature(e.get("features")[0],{selected:s})},addEvents:function(t,r,n){var o=this,i=r.source,s=r.clusterSource,c=r.layers,u=a(c,2),l=u[0],d=u[1],p=function(e){return function(t){var r=t.get("element"),n="vertex"===r.type?"vertices":"edges";e[n].push(r.id)}},f=function(e){if(e.get("count")<2)return!1;var t=e.get("features"),r=t.filter(function(e){return e.get("selected")});return 01&&void 0!==arguments[1]?arguments[1]:{},o=arguments[2],i=new e.source.Vector({features:[],wrapX:!1});if(n.getExtent){var a=i.getExtent;i.getExtent=function(){var t=a&&a.apply(this,arguments),r=n.getExtent(o,i,t);return e.extent.isEmpty(r)?t||e.extent.createEmpty():r||t||e.extent.createEmpty()}}var c=new e.layer.Vector(s({},g,{id:t,type:"ancillary",sortable:!1,toggleable:!1,source:i,renderBuffer:500,updateWhileInteracting:!0,updateWhileAnimating:!0,style:function(e){return r.style(e)}},n));return{source:i,layer:c}},style:function(e){var t=e.get("styles");if(t){var r=t.normal;if(r.length)return r}},update:u},vectorXhr:{configure:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.sourceOptions,i=void 0===o?{}:o,a=n(r,["sourceOptions"]),c=new e.source.Vector(i);return{source:c,layer:new e.layer.Vector(s({},g,{id:t,type:"vectorXhr",source:c},a))}},addEvents:function(t,r,n){var o=r.source,i=r.layer,a={vertices:[],edges:[]},s=i.get("element"),c="vertex"===s.type?"vertices":"edges",u=d(i);return a[c].push(s.id),[t.on("click",function(e){var t=e.map,r=e.pixel,i=t.getFeaturesAtPixel(r),s=o.getFeatures();i&&(1===i.length&&i[0].getId()===u&&o.getFeatureById(u)?n.onSelectElements({vertices:[],edges:[]}):i.every(function(e){return s.includes(e)})&&n.onSelectElements(a))}),o.on("propertyChange",function(t){if("status"===t.key&&"loaded"===t.target.get(t.key)){var r=o.getFeatureById(u);if(r){var n=void 0;o.forEachFeature(function(t){var r=t.getGeometry(),o=r.getExtent();t.getId()!==u&&(n?e.extent.extend(n,o):n=o)});var i=e.geom.Polygon.fromExtent(n);r.setGeometry(i)}}})]},update:function(t,r){var n=r.source,o=r.layer,i=t.element,a=(t.features,t.selected),s=o.get("status"),c=!1;if(i!==o.get("element")&&(n.set("element",i),c=!0),s){if(a!==n.get("selected")){var u=d(o);if(n.set("selected",a),c=!0,a&&"loaded"===s){var l=void 0;n.forEachFeature(function(t){var r=t.getGeometry(),n=r.getExtent();t.getId()!==u&&(l?e.extent.extend(l,n):l=n)});var p=new e.Feature(e.geom.Polygon.fromExtent(l||[0,0,0,0]));p.setStyle(new e.style.Style({fill:new e.style.Fill({color:[0,136,204,.3]}),stroke:new e.style.Stroke({color:[0,136,204,.4],width:1})})),p.setId(u),n.addFeature(p)}else{var f=n.getFeatureById(u);f&&n.removeFeature(f)}}}else this.loadFeatures(n,o).then(function(e){e&&(n.clear(!0),n.addFeatures(e),o.set("status","loaded"))});return{changed:c}},loadFeatures:function(t,n){var o=n.getProperties(),i=o.id,a=o.element,s=o.propName,c=o.propKey,u=o.mimeType;return n.set("status","loading"),r.dataRequest("vertex","propertyValue",i,s,c).then(function(t){var r=l(u),n=r.readProjection(t);if(n&&e.proj.get(n.getCode())){return r.readFeatures(t,{dataProjection:n,featureProjection:"EPSG:3857"})}throw new Error("unhandledDataProjection")}).then(function(e){return e.map(function(e,t){return e.setId(n.get("id")+":"+t),e.set("element",a),e})}).catch(function(e){var t="unhandledDataProjection"===e.message?i18n("org.bigconnect.web.product.map.MapWorkProduct.layer.error.data.format"):i18n("org.bigconnect.web.product.map.MapWorkProduct.layer.error");n.set("status",{type:"error",message:t})})}}},h={feature:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.selected,n=void 0!==r&&r,i=e.getProperties(),a=i.focused,s=i.focusedDim,c=i.styles,u=i.selected,l=i._nodeRadius,d=n||u,p=!0,f=void 0;if(c){var g=c.normal,v=c.selected,h=void 0;!g.length||d&&v.length?v.length&&d&&(h=v):h=g,h&&(f=_.isArray(h)?h:[h])}else!1,p=!1,f=o.getOrCreateFeature({src:e.get(d?"iconUrlSelected":"iconUrl"),imgSize:e.get("iconSize"),scale:1/e.get("pixelRatio"),anchor:e.get("iconAnchor")},a);return _.isEmpty(f)?(console.warn("No styles for feature, ignoring.",e),[]):p&&a?o.addFocus(l,o.reset(l,f)):s?o.addDim(l,f):o.reset(l,f)},cluster:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.selected,n=void 0!==r&&r,a=t.source,s=(t.clusterSource,e.get("count")),c=e.get("focusStats"),u=e.get("selectionState")||"none",l=e.get("selectionCount")||0,d=a.countStats,p=d.min,f=d.max,g=Math.min(f,Math.max(p,s)),v=p===f?12:i(g,p,f,12,20);return o.getOrCreateCluster({count:s,radius:v,selected:n,selectionState:u,selectionCount:l,focusStats:c})}};return{byType:v,styles:h,setLayerConfig:c}}.apply(t,o))&&(e.exports=i)},,function(e,t){e.exports=r},function(e,t,r){function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t0});u.max=Math.max(h,u.max),u.min=Math.min(h,u.min),t.features.push(t.createCluster(y,v,h))}}(f[g],g)}(i[l])}},t.prototype.createCluster=function(t,r,n){var o={some:0,all:!1,dim:!1};t.forEach(function(e){var t=e.get("focused");o.some+=t?1:0,o.all=o.all&&t,o.dim=o.dim||e.get("focusedDim")});var i=r.reduce(function(e,t){return e.map(function(e,r){return e+t[r]})},[0,0]),a=i.map(function(e){return e/r.length}),s=new e.geom.Point(a);return new e.Feature({geometry:s,features:t,coordinates:r,count:n,focusStats:o})},t}.apply(t,n))&&(e.exports=o)},function(e,t){e.exports=o},function(e,t){e.exports=i},function(e,t){e.exports=a},,,,,,,function(e,t){e.exports=s},,,,,,,,,function(e,t){e.exports=c},function(e,t){e.exports=u},function(e,t){e.exports=l},function(e,t){e.exports=d},function(e,t){e.exports=p},function(e,t,r){var n,o;n=[r(34)],void 0!==(o=function(e){return e.protectFromWorker(),e.createActions({workerImpl:"com/mware/web/product/map/dist/actions-impl",actions:{dropElements:function(e,t,r){return{productId:e,elements:t,undoable:r.undoable}},removeElements:function(e,t,r){return{productId:e,elements:t,undoable:r.undoable}},setLayerOrder:function(e,t){return{productId:e,layerOrder:t}}}})}.apply(t,n))&&(e.exports=o)},function(e,t){e.exports=f},,,,,,,,,,,,,function(e,t){e.exports=g},,,,,,,,,,,,,,,,,function(e,t,r){var n,o,i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var i,a,s=Object.assign||function(e){for(var t=1;t1&&i.show(e,t,n,a.styles.feature)},onMouseOut:function(e,t,r){i.hide(e,t)},onContextTap:function(e,t){var r=t.map,n=t.pixel,o=t.originalEvent;i.hide(e,r);var a=this.props.product.extendedData.vertices,s=r.getFeaturesAtPixel(n),c=function(e){var t=e&&a[e.id]&&a[e.id].ancillary;return e&&"vertex"===e.type&&!t},u=void 0;if(s&&s.length){var l=s[0],d=l.get("element");if(c(d))u=d.id;else{var p=l.get("features")||[],f=p.find(function(e){var t=e.get("element");return c(t)});u=f&&f.get("element").id}}if(u){var g=o.pageX,v=o.pageY;this.props.onVertexMenu(o.target,u,{x:g,y:v})}},onUpdatePreview:function(){var e=this.props;(0,e.onUpdatePreview)(e.product.id)},onViewport:function(e){var t=this.props.product.id,r=e.target,o=r.getZoom(),i=[].concat(n(r.getCenter()));this.currentViewport||(this.currentViewport={}),this.currentViewport[t]={zoom:o,pan:i},this.saveViewportDebounce(this.props)},saveViewport:function(e){if(this.mounted){var t=e.product.id;if(this.currentViewport&&t in this.currentViewport){var r=this.currentViewport[t];e.onUpdateViewport(t,r)}}},getGeometry:function(e,t,r){var n=this,o=this.props.registry,i=o["org.bigconnect.map.geometry"].reduce(function(o,i){var a=i.canHandle,s=i.geometry,c=i.layer;if(n.caches.geometries.canHandle.getOrUpdate(a,e,t,r)){var u=n.caches.geometries.geometry.getOrUpdate(s,e,t,r);u&&o.push({geometry:u,layer:c})}return o},[]);if(i.length)return i.length>1&&console.warn("Multiple geometry extensions applying to element, ignoring others",i.slice(1)),i[0]},getStyles:function(e,t,r){var o=this,i=this.props.registry,a=i["org.bigconnect.map.style"].reduce(function(i,a){var s=a.canHandle,c=a.style,u=a.selectedStyle;if(o.caches.styles.canHandle.getOrUpdate(s,e,t,r)){if(c){var l=o.caches.styles.style.getOrUpdate(c,e,t,r);if(l)if(_.isArray(l)){var d;l.length&&(d=i.normal).push.apply(d,n(l))}else i.normal.push(l)}if(u){var p=o.caches.styles.selectedStyle.getOrUpdate(u,e,t,r);if(p)if(_.isArray(p)){var f;p.length&&(f=i.selected).push.apply(f,n(p))}else i.selected.push(p)}}return i},{normal:[],selected:[]});if(a.normal.length||a.selected.length)return a},mapElementsToSources:function(){var e=this,t=this.props,r=t.product,n=(t.workspaceId,r.extendedData);if(!n||!n.vertices)return[];var i=this.props.elements,a=i.vertices,c=i.edges,u=s({},_.indexBy(this.props.selection.vertices),_.indexBy(this.props.selection.edges)),d=Object.values(a).concat(Object.values(c)),p=_.groupBy(this.props.ontologyProperties,"dataType").geoLocation,f=function(e,t){var r=e.id,n=o(e,["id"]);y[r]?y[r].features||(y[r].features=[]):y[r]=s({features:[]},n),y[r].features.push(t)},y={cluster:{id:"cluster",type:"cluster",features:[]}};return d.forEach(function(t){var r=n["vertex"===t.type?"vertices":"edges"],o=r[t.id],i=l.vertex.ontology(t),a=e.getStyles(o,t,i),c=e.getGeometry(o,t,i),d=c&&c.geometry,y=c&&c.layer||{},m=t.id in u;if(n.vertices[t.id]&&n.vertices[t.id].ancillary)return void f(s({id:"ancillary",type:"ancillary"},y),{id:t.id,element:t,selected:m,styles:a,geometry:d});if("document"===l.vertex.displayType(t)){var x=l.vertex.prop(t,ONTOLOGY_CONSTANTS.PROP_MIME_TYPE);if(h.includes(x)){var w=l.vertex.props(t,ONTOLOGY_CONSTANTS.PROP_RAW)[0];f({id:t.id,element:t,type:"vectorXhr",mimeType:x,propName:w.name,propKey:w.key,selected:m,styles:a})}}var b=p&&p.reduce(function(e,r){var n=r.title;return l.vertex.props(t,n).forEach(function(r){var n=r.value;if(n){var o=n.latitude,i=n.longitude;isNaN(o)||isNaN(i)||(o>=-90&&o<=90&&i>=-180&&i<=180?e.push([i,o]):console.warn("Vertex has geoLocation with invalid coordinates",n,t))}}),e},[]),E="map/marker/image?"+$.param({type:t.conceptType,workspaceId:e.props.workspaceId,scale:e.props.pixelRatio>1?"2":"1"}),P=E+"&selected=true";b.length&&f(s({id:"cluster"},y),{id:t.id,element:t,selected:m,iconUrl:E,iconUrlSelected:P,iconSize:v(e.props.pixelRatio),iconAnchor:g,pixelRatio:e.props.pixelRatio,styles:a,geometry:d,geoLocations:b})}),y},legacyListeners:function(e){var t=this;this.removeEvents=[],_.each(e,function(e,r){var n=t.wrap,o=e;_.isFunction(e)||(n=e.node,o=e.handler),t.removeEvents.push({node:n,func:o,events:r}),$(n).on(r,o)})},clearCaches:function(){var e=this;f.clear(),this.mounted&&(Object.keys(this.caches).forEach(function(t){Object.keys(e.caches[t]).forEach(function(r){return e.caches[t][r].clear()})}),this.forceUpdate())}}),["org.bigconnect.map.style","org.bigconnect.map.geometry","org.bigconnect.map.layer"])}.apply(t,i))&&(e.exports=a)},function(e,t){e.exports=y},function(e,t,r){function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var i,a,s=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},n=t.fit,o=void 0!==n&&n,i=this.state,a=i.map,s=i.layersWithSources,c=s.base,u=function(){o&&e.fit({animate:!1})};this._canvasPreviewBuffer&&(u(),a.once("postcompose",function(t){if(e._canvasPreviewBuffer){var n,o,i=0,s=0;u();var l=t.context.canvas,d=_.debounce(function(){e._canvasPreviewBuffer&&(u(),a.once("postrender",function(){if(e._canvasPreviewBuffer){var t=e._canvasPreviewBuffer,o=t.getContext("2d"),i=300/l.width,a=300/l.height,s=Math.min(i,a);t.width=Math.trunc(l.width*s),t.height=Math.trunc(l.height*s),o.drawImage(l,0,0,l.width,l.height,0,0,t.width,t.height),n&&n.forEach(function(e){return r.Observable.unByKey(e)}),e.props.onUpdatePreview(t.toDataURL("image/png"))}}),a.renderSync())},100),p=function(){clearTimeout(o),++i},f=function(e){clearTimeout(o),i===++s&&(o=d())};n=[c.source.on("tileloadstart",p),c.source.on("tileloadend",f),c.source.on("tileloaderror",f)]}}),a.renderSync())},componentDidMount:function(){this._canvasPreviewBuffer=document.createElement("canvas"),this._canvasPreviewBuffer.width=300,this._canvasPreviewBuffer.height=300,this.olEvents=[],this.domEvents=[],this.updatePreview=_.debounce(this._updatePreview,2e3);var e=this.configureMap(),t=e.map,r=e.layersWithSources;this.setState({map:t,layersWithSources:r})},componentWillUnmount:function(){this._canvasPreviewBuffer=null,clearTimeout(this._handleMouseMoveTimeout),this.domEvents&&(this.domEvents.forEach(function(e){return e()}),this.domEvents=null),this.olEvents&&(this.olEvents.forEach(function(e){return r.Observable.unByKey(e)}),this.olEvents=null)},render:function(){var e=this.state.panning?React.createElement("div",{className:"draggable-wrapper"}):"";return React.createElement("div",{style:{height:"100%"}},React.createElement("div",{style:{height:"100%"},ref:"map"}),React.createElement(a,{product:this.props.product,injectedProductProps:this.getInjectedToolProps(),rightOffset:this.props.panelPadding.right,showNavigationControls:!0,onFit:this.onControlsFit,onZoom:this.onControlsZoom}),e)},onControlsFit:function(){this.fit()},onControlsZoom:function(e){function t(e){return function(){var t=n.getResolution();t&&n.animate({resolution:n.constrainResolution(t,e),duration:u})}}var r=this.state.map,n=r.getView();this._slowZoomIn||(this._slowZoomIn=_.throttle(t(1),u,{trailing:!1}),this._slowZoomOut=_.throttle(t(-1),u,{trailing:!1})),"in"===e?this._slowZoomIn():this._slowZoomOut()},onControlsPan:function(e,t){var r=e.x,n=e.y,o=t.state;if("panningStart"===o)this.setState({panning:!0});else if("panningEnd"===o)this.setState({panning:!1});else{var i=this.state.map,a=i.getView(),s=a.getCenter(),c=a.getResolution(),u=a.constrainCenter([s[0]-r*c,s[1]+n*c]);a.setCenter(u)}},extentFromFeatures:function(e){var t=r.extent.createEmpty();return e.forEach(function(e){var n=e.getGeometry().getExtent();r.extent.isEmpty(n)||r.extent.extend(t,n)}),t},fit:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.animate,n=void 0===t||t,o=e.limitToFeatures,i=void 0===o?[]:o,a=this.state,c=a.map,l=a.layersWithSources,d=c.getView(),p=1!==i.length,f=void 0;if(i.length?f=this.extentFromFeatures(i):(f=r.extent.createEmpty(),c.getLayers().forEach(function(e){var t=l.cluster.layers.includes(e)?l.cluster.source:e.getSource();e.getVisible()&&_.isFunction(t.getExtent)&&r.extent.extend(f,t.getExtent())})),r.extent.isEmpty(f))d.animate(s({},this.getDefaultViewParameters(),{duration:n?u:0}));else{var g=d.getResolution(),v=f,h=this.props.panelPadding,y=h.left,m=h.right,x=h.top,w=h.bottom,b=this.refs.map.getBoundingClientRect(),E=b.width-y-m-40,P=b.height-x-w-40,S=r.extent.getSize(v),O=d.calculateExtent([E,P]),I=Math.max(S[0]/E,S[1]/P);if(i.length){var C=((y+20)/2-(m+20)/2)*g,M=((x+20)/2-(w+20)/2)*g;O[0]+=C,O[1]+=M,O[2]+=C,O[3]+=M;if(r.extent.containsExtent(O,f))return}var F=p?d.constrainResolution(Math.min(2e4,Math.max(I,30)),-1):d.getResolution(),T=r.extent.getCenter(v),k=y-m,j=x-w,L=k*F/2,q=j*F/2;T[0]=T[0]-L,T[1]=T[1]-q;var A={center:T};p&&(A.resolution=F),d.animate(s({},A,{duration:n?u:0}))}},getDefaultViewParameters:function(){return{zoom:2,minZoom:1,center:[0,0]}},configureMap:function(){var e=this,t=this.props,n=t.baseSource,a=t.baseSourceOptions,s=void 0===a?{}:a,c=t.sourcesByLayerId,u=t.layerExtensions,l={},d=function(t,r,n,o){if(!l[r]){var i=e.initializeLayer(t,r,n,o);(i.layers||[i.layer]).forEach(function(e){o.addLayer(e)}),l[r]=i}},p=new r.Map({loadTilesWhileInteracting:!0,keyboardEventTarget:document,controls:[],layers:[],target:this.refs.map});d(i.byType.tile,"base",{source:n,sourceOptions:s},p),_.mapObject(u,function(e,t){d(e,t,e.options,p)}),_.mapObject(c,function(e,t){var r=e.type,n=(e.features,o(e,["type","features"])),a=i.byType[r];a?d(a,t,n,p):console.warn("Sources present for layer: "+t+", but no layer type defined for: "+r)}),this.configureEvents(p);var f=new r.View(this.getDefaultViewParameters());return this.olEvents.push(f.on("change:center",function(t){return e.props.onPan(t)})),this.olEvents.push(f.on("change:resolution",function(t){return e.props.onZoom(t)})),p.setView(f),{map:p,layersWithSources:l}},configureEvents:function(e){var t=this,n=this;this.olEvents.push(e.on("click",function(e){n.props.onTap(e)})),this.olEvents.push(e.on("pointerup",function(e){var t=e.pointerEvent;t&&2===t.button&&n.props.onContextTap(r,e)}));var o=e.getViewport();this.domEvent(o,"contextmenu",function(e){e.preventDefault()}),this.domEvent(o,"mouseup",function(e){e.preventDefault(),2===e.button||e.ctrlKey}),this.domEvent(o,"mousemove",function(r){var n=e.getEventPixel(r),o=e.getFeaturesAtPixel(n);o?(t.handleMouseMove(o),e.getTarget().style.cursor="pointer"):(t.handleMouseMove(),e.getTarget().style.cursor="")})},initializeLayer:function(e,t,r,n){var a=this.props,s=(a.baseSource,a.baseSourceOptions,a.sourcesByLayerId,a.generatePreview,a.layerExtensions,a.layerConfig),c=o(a,["baseSource","baseSourceOptions","sourcesByLayerId","generatePreview","layerExtensions","layerConfig"]),u=e.type&&i.byType[e.type]||e,l=u.configure(t,r,n);return _.isFunction(u.addEvents)&&this.olEvents.concat(u.addEvents(n,l,c)),(l.layers||[l.layer]).forEach(function(e){var t=s&&s[e.get("id")];t&&i.setLayerConfig(t,e)}),l},applyLayerOrder:function(){var e=this.state.map,t=this.props,n=t.product,o=t.setLayerOrder,i=_.indexBy(e.getLayers().getArray(),function(e){return e.get("id")}),a=e.getLayerGroup(),s=n.extendedData&&n.extendedData["org-bigconnect-map-layers"]&&n.extendedData["org-bigconnect-map-layers"].layerOrder.slice(0)||[],c=new r.Collection,u=[];c.push(i.base),delete i.base,s.length?(s=s.reverse(),s.forEach(function(e,t){var r=i[e];r&&(c.push(r),delete i[e])}),_.mapObject(i,function(e,t){c.push(e),u.push(t)}),a.setLayers(c)):u=e.getLayers().getArray().slice(1).reduce(function(e,t){return e.push(t.get("id")),e},[]),u.length&&o(s.concat(u.reverse()))},applyLayerConfig:function(){var e=this.state.map,t=this.props.layerConfig;if(t){var r=_.indexBy(e.getLayers().getArray(),function(e){return e.get("id")});_.mapObject(r,function(e,n){var o=t[n];i.setLayerConfig(o,r[n])})}},domEvent:function(e,t,r){this.domEvents.push(function(){return e.removeEventListener(t,r)}),e.addEventListener(t,r,!1)},handleMouseMove:function(e){var t=this,n=this.props,o=n.onMouseOver,i=n.onMouseOut,a=this.state.map;if(o||i){e&&this._handleMouseMoveFeatures&&this._handleMouseMoveFeatures.length===e.length&&this._handleMouseMoveFeatures[0]===e[0]||(clearTimeout(this._handleMouseMoveTimeout),e&&e.length?this._handleMouseMoveTimeout=setTimeout(function(){t._handleMouseMoveFeatures=e,o&&o(r,a,t._handleMouseMoveFeatures)},250):this._handleMouseMoveFeatures&&(i&&i(r,a,this._handleMouseMoveFeatures),this._handleMouseMoveFeatures=null))}},getInjectedToolProps:function(){var e=this.props,t=e.clearCaches,n=e.product,o=this.state,i=o.map,a=o.layersWithSources,s={};return i&&a&&(s={product:n,ol:r,map:i,cluster:a.cluster,layersWithSources:a,requestUpdate:t}),s}})}.apply(t,i))&&(e.exports=a)},function(e,t){e.exports=m},function(e,t,r){var n,o;n=[r(0),r(19)],void 0!==(o=function(e,t){function r(e){var t=(e[2]-e[0])/(e[3]-e[1])||1,r=[200,200];return t>1?r[1]=Math.max(150,r[0]*(1/t)):r[0]=Math.max(150,r[1]*t),r}function n(){var r=t(),n=r.source,o=r.sourceOptions,i=new e.source[n](o),a=new e.layer.Vector({source:new e.source.Vector({features:[]})});return{map:new e.Map({controls:[],layers:[new e.layer.Tile({source:i}),a],target:s.find(".popover-content")[0]}),layer:a}}var o=void 0,i=void 0,a=void 0,s=void 0;return{show:function(e,t,c,u){o&&t.removeOverlay(o);var l=c.get("coordinates"),d=e.extent.boundingExtent(l),p=r(d),f=c.getGeometry().getCoordinates(),g=t.getPixelFromCoordinate(f),v=g[1]