@milemaker/milemaker-js 1.0.0 → 1.0.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MapBaseLayer } from "../../types";
|
|
2
2
|
export declare const DEFAULT_BASE_LAYER = MapBaseLayer.STREETS;
|
|
3
|
-
export declare const DEFAULT_BASE_API_URL = "https://proxy-nodejs.
|
|
3
|
+
export declare const DEFAULT_BASE_API_URL = "https://proxy-nodejs.prd.milemaker.com/proxy";
|
|
4
4
|
export declare const DEFAULT_ROUTE_COLOR = "rgba(0, 0, 0, 0.87)";
|
|
5
5
|
export declare const MAP_FIT_INTO_BOUNDS_DEFAULT_PADDING = 100;
|
|
6
6
|
export declare const MAP_DEFAULT_POLYLINE_STROKE_WIDTH = 5;
|
package/dist/index.cjs
CHANGED
|
@@ -3831,7 +3831,7 @@ Arguments: `+Array.prototype.slice.call(H0).join("")+`
|
|
|
3831
3831
|
<div class="nmapsgl-modal-footer">
|
|
3832
3832
|
<button type="submit" class="btn btn-primary nmapsgl-modal-submit">Submit</button>
|
|
3833
3833
|
</div>
|
|
3834
|
-
</div>`;const o=s0.create("div","nmapsgl-modal-body-loading-wrapper"),r=s0.create("div","nmapsgl-modal-body-loading nmapsgl-icon-loading");o.appendChild(r),n.querySelector(".nmapsgl-modal-body").appendChild(o);const s=O.window.document.createElement("div");n.querySelector(".nmapsgl-modal-body").removeChild(o),s.innerHTML=function(b,z){const f=s0.create("ul","nmapsgl-categories-list");return b.forEach(A=>{const _=s0.create("li","nmapsgl-parent-categorie");_.style.marginBottom="10px";const q=s0.create("span","nmapsgl-caret"),W=s0.create("input");W.id=`${z}_${A.id}`,W.type="checkbox",W.name=A.name,W.style.cursor="pointer";const R=s0.create("label","nmapsgl-parent-label");if(R.innerText=A.name,A.children&&A.children.length>0){const E=s0.create("ul","nmapsgl-nested nmapsgl-categories-list-children");A.children.forEach(T=>{const P=s0.create("li");P.style.marginBottom="5px";const V=s0.create("input");V.id=`${z}_${T.id}`,V.type="checkbox",V.style.cursor="pointer";const D=s0.create("label");D.innerText=T.name,P.appendChild(V),P.appendChild(D),E.appendChild(P)}),_.appendChild(q),_.appendChild(W),_.appendChild(R),_.appendChild(E)}else _.style.paddingLeft="20px",_.appendChild(W),_.appendChild(R);f.appendChild(_)}),f}(this._categories,e.id).outerHTML,n.querySelector(".nmapsgl-modal-body").appendChild(s),O.window.document.body.appendChild(n);const c=O.window.document.getElementsByClassName("nmapsgl-caret");for(let b=0;b<c.length;b++)c[b].addEventListener("click",function(){this.parentElement.querySelector(".nmapsgl-nested").classList.toggle("nmapsgl-active"),this.classList.toggle("nmapsgl-caret-down")});const p=gn.flatten(this._categories.map(b=>{let z=[];return b.hasOwnProperty("children")&&b.children?(b.map_visible&&z.push(b.id),z=gn.concat(z,b.children.filter(f=>f.map_visible).map(f=>f.id))):b.map_visible&&z.push(b.id),z}));gn.union(this._alwaysVisibleCategories,p).forEach(b=>{const z=O.window.document.getElementById(`${e.id}_${b}`);z&&(z.checked=!0)});const u=O.window.document.getElementsByClassName("nmapsgl-parent-categorie");for(let b=0;b<u.length;b++)u[b].childNodes[1].addEventListener("click",function(){const z=this.parentElement.childNodes[1].checked,f=u[b].getElementsByClassName("nmapsgl-categories-list-children");f&&f.length>0&&f[0].childNodes.forEach(A=>{A.childNodes[0].checked=z})});O.window.document.getElementsByClassName("nmapsgl-modal-overlay")[0].addEventListener("click",()=>{const b=this._filters[0].filter[2][1],z=O.window.document.getElementsByClassName("nmapsgl-parent-categorie");for(let f=0;f<z.length;f++){const A=z[f].childNodes.length===4?z[f].childNodes[1]:z[f].childNodes[0];A.checked=b.includes(A.id.split("_")[1]);const _=z[f].querySelector(".nmapsgl-active");_&&_.classList.toggle("nmapsgl-active");const q=z[f].querySelector(".nmapsgl-caret-down");q&&q.classList.toggle("nmapsgl-caret-down");const W=z[f].getElementsByClassName("nmapsgl-categories-list-children");W&&W.length>0&&W[0].childNodes.forEach(R=>{const E=R.childNodes[0];E.checked=b.includes(E.id.split("_")[1])})}}),O.window.document.getElementsByClassName("nmapsgl-modal-submit")[0].addEventListener("click",b=>{b.preventDefault(),O.window.location.hash="#";const z=[],f=O.window.document.getElementsByClassName("nmapsgl-parent-categorie");for(let A=0;A<f.length;A++){const _=f[A].childNodes.length===4?f[A].childNodes[1]:f[A].childNodes[0];_.checked&&z.push(_.id.split("_")[1]);const q=f[A].getElementsByClassName("nmapsgl-categories-list-children");q&&q.length>0&&q[0].childNodes.forEach(W=>{const R=W.childNodes[0];R.checked&&z.push(R.id.split("_")[1])})}e.id.forEach(A=>{const _=["in",["get","category_id"],["literal",gn.union(this._alwaysVisibleCategories,z)]];i.setFilter(A,_);const q=j5.filter(W=>W.name===e.name);q&&(q[0].filter=_)})}),O.window.location.hash="#",O.window.location.hash=t}}},GeocoderControl:class{constructor(i){this.options=O.extend({},nB,i),this.options.limit=gn.isNumber(this.options.limit)?Math.abs(this.options.limit):this.defaultOptions.limit,this.lastSelected=null,this.controller=null,O.bindAll(["_showButton","_hideButton","clear","setPlaceholder","_getPlaceholderText","_keydown","_handleMarker","_removeMarker","setRenderFunction","_onChange"],this)}onAdd(i){this._map=i;const e=this._container=s0.create("div","nmapsgl-ctrl-geocoder nmapsgl-ctrl nmapsgl-ctrl-geocoder-control"),t=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=s0.create("input","nmapsgl-ctrl-geocoder-input",this._container),this._inputEl.type="text",this.setPlaceholder(),this._container.addEventListener("mouseenter",this._showButton),this._container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keydown",gn.debounce(this._keydown,200)),this._inputEl.addEventListener("change",this._onChange);const n=s0.create("div","nmapsgl-ctrl-geocoder--pin-right");this._clearEl=s0.create("button","nmapsgl-ctrl-geocoder--button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._inputEl.addEventListener("change",this._onChange);const o=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');return this._clearEl.appendChild(o),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),n.appendChild(this._clearEl),n.appendChild(this._loadingEl),e.appendChild(t),e.appendChild(this._inputEl),e.appendChild(n),this._typeahead=new iB(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,e}createIcon(i,e){const t=O.window.document.createElementNS("http://www.w3.org/2000/svg","svg");if(t.setAttribute("class",`nmapsgl-ctrl-geocoder--icon nmapsgl-ctrl-geocoder--icon-${i}`),t.setAttribute("viewBox","0 0 18 18"),t.setAttribute("xml:space","preserve"),t.setAttribute("width",18),t.setAttribute("height",18),"innerHTML"in t)t.innerHTML=e;else{const n=O.window.document.createElement("div");n.innerHTML=`<svg>${e.valueOf().toString()}</svg>`,t.appendChild(n.firstChild.firstChild)}return t}onRemove(){s0.remove(this._container),this._removeMarker(),this._map=void 0}clear(i){this._clear(i),this._inputEl.focus()}_clear(i){i&&i.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this.lastSelected=null}_showButton(){this._typeahead.selected&&(this._clearEl.style.display="block")}_hideButton(){this._typeahead.selected&&(this._clearEl.style.display="none")}setPlaceholder(i){return this.placeholder=i||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this}_getPlaceholderText(){return this.options.hasOwnProperty("placeholder")?this.options.placeholder:"Search"}_keydown(i){if(i.key==="Enter"){if(!this._typeahead.selected){const e=i.target.value;if(e){this._clearEl.style.display="none",this._loadingEl.style.display="block",this.controller&&this.controller.abort(),this.controller=new AbortController;const t=this.controller.signal;let n;if(/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(e)){const o=e.split(/[\s(,)?]+/).map(r=>parseFloat(r,10));n=this.reverseGeocode(o,t,this.options.limit)}else{const o=this._map.getCenter();n=this.genericSearch(e,o,t,this.options.limit)}n.then(o=>{if(!o.ok)throw new Error("Not Ok");return this._loadingEl.style.display="none",o.json()}).then(o=>{this.controller=null,o.results.length?(this._clearEl.style.display="block",this._typeahead.update(o.results)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults())}).catch(o=>{o.name!=="AbortError"&&(this.controller=null,this._loadingEl.style.display="none",this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError())})}}}else oB.includes(i.key)||(this._typeahead.clear(),this._typeahead.selected=null)}_onChange(){const i=this._typeahead.selected;i&&JSON.stringify(i)!==this.lastSelected&&(this._clearEl.style.display="none",this.options.flyTo?this._map.flyTo({center:i.location,speed:1.3,zoom:this.options.zoom}):this._map.jumpTo({center:i.location,zoom:this.options.zoom}),this._handleMarker(i),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(i),this._typeahead.clear())}_handleMarker(i){if(this._map)return this._removeMarker(),i.location&&(this.mapMarker=new un().setLngLat(i.location).addTo(this._map)),this}_removeMarker(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)}_renderError(){this._renderMessage("<div class='nmapsgl-geocoder-error'>There was an error reaching the server</div>")}_renderNoResults(){this._renderMessage("<div class='nmapsgl-geocoder-error nmaps-gl-geocoder--no-results'>No results found</div>")}_renderMessage(i){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(i)}setRenderFunction(i){return i&&typeof i=="function"&&(this._typeahead.render=i),this}reverseGeocode(i,e,t=1,n="en"){return hn(`${O.config.NMAPS_API_URL}/v1/search/reverse_geocode${O.config.ACCESS_TOKEN?`?access_token=${O.config.ACCESS_TOKEN}`:""}`,{method:"post",body:JSON.stringify({language:n,location:{lat:i[0],lng:i[1]},max_results:t}),headers:{"Content-Type":"application/json"},signal:e})}genericSearch(i,e,t,n=5){return hn(`${O.config.NMAPS_API_URL}/v1/search/generic_search${O.config.ACCESS_TOKEN?`?access_token=${O.config.ACCESS_TOKEN}`:""}`,{method:"post",body:JSON.stringify({search_text:i,ref_location:{lat:e.lat,lng:e.lng},max_results:n}),headers:{"Content-Type":"application/json"},signal:t})}},DirectionsControl:X5,StreetViewControl:S5,STREET_STYLE:Hz,LIGHT_STYLE:qh,DARK_STYLE:Kb,SATELLITE_STYLE:xh,Popup:ms,Marker:un,Style:ko,LngLat:O.LngLat,LngLatBounds:O.LngLatBounds,Point:O.pointGeometry,Polyline:class{constructor(i){this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._polylineID=`polyline-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._polylineID)||(this._map.addSource(this._polylineID,this._lineSource),this._map.addLayer(this._layer))}),this._map.on("style.load",()=>{this._map.getSource(this._polylineID)||(this._map.addSource(this._polylineID,this._lineSource),this._map.addLayer(this._layer))}),this}remove(){return this._map&&(this._map.getLayer(this._polylineID)&&this._map.removeLayer(this._polylineID),this._map.removeSource(this._polylineID),delete this._map),this}getPath(){return this._pathLnglat}setPath(i){return this._pathLnglat=i.map(e=>O.LngLat.convert(e)),this}_createGeoJson(){this._lineSource={type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:this._pathLnglat.map(i=>i.toArray())}}},this._layer={id:this._polylineID,type:"line",source:this._polylineID,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this._strokeColor,"line-width":this._strokeWeight,"line-opacity":this._strokeOpacity}}}},Polygon:class{constructor(i){this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,this._fillColor=i&&i.fillColor||"#000000",this._fillOpacity=i&&i.fillOpacity>=0&&i.fillOpacity<=1?i.fillOpacity:.5,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._polygonID=`polygon-${O.uniqueId()}`,this._outlineID=`polygon-line-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._polygonID)||(this._map.addSource(this._polygonID,this._polygonSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this._map.on("style.load",()=>{this._map.getSource(this._polygonID)||(this._map.addSource(this._polygonID,this._polygonSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this}remove(){return this._map&&(this._map.getLayer(this._polygonID)&&this._map.removeLayer(this._polygonID),this._map.getLayer(this._outlineID)&&this._map.removeLayer(this._outlineID),this._map.removeSource(this._polygonID),delete this._map),this}getPath(){return this._pathLnglat}setPath(i){return this._pathLnglat=i.map(e=>O.LngLat.convert(e)),this}_createGeoJson(){this._polygonSource={type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[this._pathLnglat.map(i=>i.toArray())]}}},this._layer={id:this._polygonID,type:"fill",source:this._polygonID,layout:{},paint:{"fill-color":this._fillColor,"fill-opacity":this._fillOpacity}},this._outline={id:this._outlineID,type:"line",source:this._polygonID,layout:{},paint:{"line-color":this._strokeColor,"line-width":this._strokeWeight,"line-opacity":this._strokeOpacity}}}},Rectangle:class{constructor(i){this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,this._fillColor=i&&i.fillColor||"#000000",this._fillOpacity=i&&i.fillOpacity>=0&&i.fillOpacity<=1?i.fillOpacity:.5,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._rectangleID=`rectangle-${O.uniqueId()}`,this._outlineID=`rectangle-line-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._rectangleID)||(this._map.addSource(this._rectangleID,this._rectangleSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this._map.on("style.load",()=>{this._map.getSource(this._rectangleID)||(this._map.addSource(this._rectangleID,this._rectangleSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this}remove(){return this._map&&(this._map.getLayer(this._rectangleID)&&this._map.removeLayer(this._rectangleID),this._map.getLayer(this._outlineID)&&this._map.removeLayer(this._outlineID),this._map.removeSource(this._rectangleID),delete this._map),this}getBounds(){return this._boundsLnglat}setBounds(i){const e=["north","south","east","west"].every(t=>i.hasOwnProperty(t));if(this._boundsLnglat=[],e){const t=O.LngLat.convert([i.west,i.north]),n=O.LngLat.convert([i.east,i.north]),o=O.LngLat.convert([i.west,i.south]),r=O.LngLat.convert([i.east,i.south]);this._boundsLnglat.push(t,n,r,o,t)}else console.error("Bounds object is invalid. Please check documentation.");return this}_createGeoJson(){this._rectangleSource={type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[this._boundsLnglat.map(i=>i.toArray())]}}},this._layer={id:this._rectangleID,type:"fill",source:this._rectangleID,layout:{},paint:{"fill-color":this._fillColor,"fill-opacity":this._fillOpacity}},this._outline={id:this._outlineID,type:"line",source:this._rectangleID,layout:{},paint:{"line-color":this._strokeColor,"line-width":this._strokeWeight,"line-opacity":this._strokeOpacity}}}},Circle:class{constructor(i){this._radius=i&&i.radius>=0?i.radius:5,this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,this._fillColor=i&&i.fillColor||"#000000",this._fillOpacity=i&&i.fillOpacity>=0&&i.fillOpacity<=1?i.fillOpacity:.5,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._circleID=`circle-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._circleID)||(this._map.addSource(this._circleID,this._circleSource),this._map.addLayer(this._layer))}),this._map.on("style.load",()=>{this._map.getSource(this._circleID)||(this._map.addSource(this._circleID,this._circleSource),this._map.addLayer(this._layer))}),this}remove(){return this._map&&(this._map.getLayer(this._circleID)&&this._map.removeLayer(this._circleID),this._map.removeSource(this._circleID),delete this._map),this}getCenter(){return this._center}setCenter(i){return this._center=O.LngLat.convert(i),this}_createGeoJson(){this._circleSource={type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:this._center.toArray()}}},this._layer={id:this._circleID,type:"circle",source:this._circleID,layout:{},paint:{"circle-stroke-color":this._strokeColor,"circle-stroke-opacity":this._strokeOpacity,"circle-stroke-width":this._strokeWeight,"circle-color":this._fillColor,"circle-opacity":this._fillOpacity,"circle-radius":this._radius}}}},MercatorCoordinate:O.MercatorCoordinate,Evented:O.Evented,config:O.config,prewarm:function(){Q1().acquire(v1)},clearPrewarmedResources:function(){const i=ue;i&&(i.isPreloaded()&&i.numActive()===1?(i.release(v1),ue=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return O.config.ACCESS_TOKEN},set accessToken(i){O.config.ACCESS_TOKEN=i},get baseApiUrl(){return O.config.NMAPS_API_URL},set baseApiUrl(i){O.config.NMAPS_API_URL=i,O.config.EVENTS_URL=`${i}/events`},get workerCount(){return u1.workerCount},set workerCount(i){u1.workerCount=i},get maxParallelImageRequests(){return O.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(i){O.config.MAX_PARALLEL_IMAGE_REQUESTS=i},clearStorage(i){O.clearTileCache(i)},workerUrl:""};return Y5});var re=i1;return re})})(l6);var u6=l6.exports;const qS=Ab(u6),na=PE({__proto__:null,default:qS},[u6]),LO=exports.MapBaseLayer.STREETS,xS="https://proxy-nodejs.dev.milemaker.com/proxy",D2="rgba(0, 0, 0, 0.87)",WS=100,wS=5,RS=1,LS="traffic",CS="ndrive-traffic",Xx="visibility",P_={visible:"visible",none:"none"},BS=({map:k,defaultBaseLayer:c0=LO})=>{let w0=c0;return{changeBaseLayer:re=>{k.setStyle(re),w0=re},getCurrentBaseLayer:()=>w0,getIsVisibleBaseLayer:re=>w0===re}},ES=({map:k})=>{const c0=new na.Popup({closeButton:!1,offset:{bottom:[0,-20]},className:"nmapsgl-traffic-events-popup"}),w0=()=>{r1()},Q0=()=>k.getStyle()?.layers?.filter(ze=>ze.source===CS),i1=ze=>{k.getCanvas().style.cursor="pointer";const f1=ze.features?.[0],He=f1.geometry.coordinates.slice();for(;Math.abs(ze.lngLat.lng-He[0])>180;)He[0]+=ze.lngLat.lng>He[0]?360:-360;c0?.setLngLat(He).setHTML(SS(f1.properties)).addTo(k)},O1=()=>{k.getCanvas().style.cursor="",c0?.remove()},re=()=>{O(),k.on("mouseover","traffic_events",i1),k.on("mouseout","traffic_events",O1),k.on("style.load",w0)},O=()=>{k.off("mouseover","traffic_events",i1),k.off("mouseout","traffic_events",O1),k.off("style.load",w0)},x1=ze=>{Q0()?.forEach(f1=>{k.setLayoutProperty(f1.id,Xx,ze),f1.type==="line"&&k.setPaintProperty(f1.id,"line-opacity",.6)})},r1=()=>{re(),x1(P_.visible)},s0=()=>{x1(P_.none),O()},N1=()=>!!Q0()?.every(ze=>k.getLayoutProperty(ze.id,Xx)===P_.visible);return{showTrafficLayer:r1,hideTrafficLayer:s0,getIsVisibleTrafficLayer:N1,toggle:()=>{N1()?s0():r1()}}},SS=k=>{let c0;return Object.keys(k).forEach(w0=>{w0.match(/short/gi)&&(c0=k[w0])}),`
|
|
3834
|
+
</div>`;const o=s0.create("div","nmapsgl-modal-body-loading-wrapper"),r=s0.create("div","nmapsgl-modal-body-loading nmapsgl-icon-loading");o.appendChild(r),n.querySelector(".nmapsgl-modal-body").appendChild(o);const s=O.window.document.createElement("div");n.querySelector(".nmapsgl-modal-body").removeChild(o),s.innerHTML=function(b,z){const f=s0.create("ul","nmapsgl-categories-list");return b.forEach(A=>{const _=s0.create("li","nmapsgl-parent-categorie");_.style.marginBottom="10px";const q=s0.create("span","nmapsgl-caret"),W=s0.create("input");W.id=`${z}_${A.id}`,W.type="checkbox",W.name=A.name,W.style.cursor="pointer";const R=s0.create("label","nmapsgl-parent-label");if(R.innerText=A.name,A.children&&A.children.length>0){const E=s0.create("ul","nmapsgl-nested nmapsgl-categories-list-children");A.children.forEach(T=>{const P=s0.create("li");P.style.marginBottom="5px";const V=s0.create("input");V.id=`${z}_${T.id}`,V.type="checkbox",V.style.cursor="pointer";const D=s0.create("label");D.innerText=T.name,P.appendChild(V),P.appendChild(D),E.appendChild(P)}),_.appendChild(q),_.appendChild(W),_.appendChild(R),_.appendChild(E)}else _.style.paddingLeft="20px",_.appendChild(W),_.appendChild(R);f.appendChild(_)}),f}(this._categories,e.id).outerHTML,n.querySelector(".nmapsgl-modal-body").appendChild(s),O.window.document.body.appendChild(n);const c=O.window.document.getElementsByClassName("nmapsgl-caret");for(let b=0;b<c.length;b++)c[b].addEventListener("click",function(){this.parentElement.querySelector(".nmapsgl-nested").classList.toggle("nmapsgl-active"),this.classList.toggle("nmapsgl-caret-down")});const p=gn.flatten(this._categories.map(b=>{let z=[];return b.hasOwnProperty("children")&&b.children?(b.map_visible&&z.push(b.id),z=gn.concat(z,b.children.filter(f=>f.map_visible).map(f=>f.id))):b.map_visible&&z.push(b.id),z}));gn.union(this._alwaysVisibleCategories,p).forEach(b=>{const z=O.window.document.getElementById(`${e.id}_${b}`);z&&(z.checked=!0)});const u=O.window.document.getElementsByClassName("nmapsgl-parent-categorie");for(let b=0;b<u.length;b++)u[b].childNodes[1].addEventListener("click",function(){const z=this.parentElement.childNodes[1].checked,f=u[b].getElementsByClassName("nmapsgl-categories-list-children");f&&f.length>0&&f[0].childNodes.forEach(A=>{A.childNodes[0].checked=z})});O.window.document.getElementsByClassName("nmapsgl-modal-overlay")[0].addEventListener("click",()=>{const b=this._filters[0].filter[2][1],z=O.window.document.getElementsByClassName("nmapsgl-parent-categorie");for(let f=0;f<z.length;f++){const A=z[f].childNodes.length===4?z[f].childNodes[1]:z[f].childNodes[0];A.checked=b.includes(A.id.split("_")[1]);const _=z[f].querySelector(".nmapsgl-active");_&&_.classList.toggle("nmapsgl-active");const q=z[f].querySelector(".nmapsgl-caret-down");q&&q.classList.toggle("nmapsgl-caret-down");const W=z[f].getElementsByClassName("nmapsgl-categories-list-children");W&&W.length>0&&W[0].childNodes.forEach(R=>{const E=R.childNodes[0];E.checked=b.includes(E.id.split("_")[1])})}}),O.window.document.getElementsByClassName("nmapsgl-modal-submit")[0].addEventListener("click",b=>{b.preventDefault(),O.window.location.hash="#";const z=[],f=O.window.document.getElementsByClassName("nmapsgl-parent-categorie");for(let A=0;A<f.length;A++){const _=f[A].childNodes.length===4?f[A].childNodes[1]:f[A].childNodes[0];_.checked&&z.push(_.id.split("_")[1]);const q=f[A].getElementsByClassName("nmapsgl-categories-list-children");q&&q.length>0&&q[0].childNodes.forEach(W=>{const R=W.childNodes[0];R.checked&&z.push(R.id.split("_")[1])})}e.id.forEach(A=>{const _=["in",["get","category_id"],["literal",gn.union(this._alwaysVisibleCategories,z)]];i.setFilter(A,_);const q=j5.filter(W=>W.name===e.name);q&&(q[0].filter=_)})}),O.window.location.hash="#",O.window.location.hash=t}}},GeocoderControl:class{constructor(i){this.options=O.extend({},nB,i),this.options.limit=gn.isNumber(this.options.limit)?Math.abs(this.options.limit):this.defaultOptions.limit,this.lastSelected=null,this.controller=null,O.bindAll(["_showButton","_hideButton","clear","setPlaceholder","_getPlaceholderText","_keydown","_handleMarker","_removeMarker","setRenderFunction","_onChange"],this)}onAdd(i){this._map=i;const e=this._container=s0.create("div","nmapsgl-ctrl-geocoder nmapsgl-ctrl nmapsgl-ctrl-geocoder-control"),t=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=s0.create("input","nmapsgl-ctrl-geocoder-input",this._container),this._inputEl.type="text",this.setPlaceholder(),this._container.addEventListener("mouseenter",this._showButton),this._container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keydown",gn.debounce(this._keydown,200)),this._inputEl.addEventListener("change",this._onChange);const n=s0.create("div","nmapsgl-ctrl-geocoder--pin-right");this._clearEl=s0.create("button","nmapsgl-ctrl-geocoder--button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._inputEl.addEventListener("change",this._onChange);const o=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');return this._clearEl.appendChild(o),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),n.appendChild(this._clearEl),n.appendChild(this._loadingEl),e.appendChild(t),e.appendChild(this._inputEl),e.appendChild(n),this._typeahead=new iB(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,e}createIcon(i,e){const t=O.window.document.createElementNS("http://www.w3.org/2000/svg","svg");if(t.setAttribute("class",`nmapsgl-ctrl-geocoder--icon nmapsgl-ctrl-geocoder--icon-${i}`),t.setAttribute("viewBox","0 0 18 18"),t.setAttribute("xml:space","preserve"),t.setAttribute("width",18),t.setAttribute("height",18),"innerHTML"in t)t.innerHTML=e;else{const n=O.window.document.createElement("div");n.innerHTML=`<svg>${e.valueOf().toString()}</svg>`,t.appendChild(n.firstChild.firstChild)}return t}onRemove(){s0.remove(this._container),this._removeMarker(),this._map=void 0}clear(i){this._clear(i),this._inputEl.focus()}_clear(i){i&&i.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this.lastSelected=null}_showButton(){this._typeahead.selected&&(this._clearEl.style.display="block")}_hideButton(){this._typeahead.selected&&(this._clearEl.style.display="none")}setPlaceholder(i){return this.placeholder=i||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this}_getPlaceholderText(){return this.options.hasOwnProperty("placeholder")?this.options.placeholder:"Search"}_keydown(i){if(i.key==="Enter"){if(!this._typeahead.selected){const e=i.target.value;if(e){this._clearEl.style.display="none",this._loadingEl.style.display="block",this.controller&&this.controller.abort(),this.controller=new AbortController;const t=this.controller.signal;let n;if(/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(e)){const o=e.split(/[\s(,)?]+/).map(r=>parseFloat(r,10));n=this.reverseGeocode(o,t,this.options.limit)}else{const o=this._map.getCenter();n=this.genericSearch(e,o,t,this.options.limit)}n.then(o=>{if(!o.ok)throw new Error("Not Ok");return this._loadingEl.style.display="none",o.json()}).then(o=>{this.controller=null,o.results.length?(this._clearEl.style.display="block",this._typeahead.update(o.results)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults())}).catch(o=>{o.name!=="AbortError"&&(this.controller=null,this._loadingEl.style.display="none",this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError())})}}}else oB.includes(i.key)||(this._typeahead.clear(),this._typeahead.selected=null)}_onChange(){const i=this._typeahead.selected;i&&JSON.stringify(i)!==this.lastSelected&&(this._clearEl.style.display="none",this.options.flyTo?this._map.flyTo({center:i.location,speed:1.3,zoom:this.options.zoom}):this._map.jumpTo({center:i.location,zoom:this.options.zoom}),this._handleMarker(i),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(i),this._typeahead.clear())}_handleMarker(i){if(this._map)return this._removeMarker(),i.location&&(this.mapMarker=new un().setLngLat(i.location).addTo(this._map)),this}_removeMarker(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)}_renderError(){this._renderMessage("<div class='nmapsgl-geocoder-error'>There was an error reaching the server</div>")}_renderNoResults(){this._renderMessage("<div class='nmapsgl-geocoder-error nmaps-gl-geocoder--no-results'>No results found</div>")}_renderMessage(i){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(i)}setRenderFunction(i){return i&&typeof i=="function"&&(this._typeahead.render=i),this}reverseGeocode(i,e,t=1,n="en"){return hn(`${O.config.NMAPS_API_URL}/v1/search/reverse_geocode${O.config.ACCESS_TOKEN?`?access_token=${O.config.ACCESS_TOKEN}`:""}`,{method:"post",body:JSON.stringify({language:n,location:{lat:i[0],lng:i[1]},max_results:t}),headers:{"Content-Type":"application/json"},signal:e})}genericSearch(i,e,t,n=5){return hn(`${O.config.NMAPS_API_URL}/v1/search/generic_search${O.config.ACCESS_TOKEN?`?access_token=${O.config.ACCESS_TOKEN}`:""}`,{method:"post",body:JSON.stringify({search_text:i,ref_location:{lat:e.lat,lng:e.lng},max_results:n}),headers:{"Content-Type":"application/json"},signal:t})}},DirectionsControl:X5,StreetViewControl:S5,STREET_STYLE:Hz,LIGHT_STYLE:qh,DARK_STYLE:Kb,SATELLITE_STYLE:xh,Popup:ms,Marker:un,Style:ko,LngLat:O.LngLat,LngLatBounds:O.LngLatBounds,Point:O.pointGeometry,Polyline:class{constructor(i){this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._polylineID=`polyline-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._polylineID)||(this._map.addSource(this._polylineID,this._lineSource),this._map.addLayer(this._layer))}),this._map.on("style.load",()=>{this._map.getSource(this._polylineID)||(this._map.addSource(this._polylineID,this._lineSource),this._map.addLayer(this._layer))}),this}remove(){return this._map&&(this._map.getLayer(this._polylineID)&&this._map.removeLayer(this._polylineID),this._map.removeSource(this._polylineID),delete this._map),this}getPath(){return this._pathLnglat}setPath(i){return this._pathLnglat=i.map(e=>O.LngLat.convert(e)),this}_createGeoJson(){this._lineSource={type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:this._pathLnglat.map(i=>i.toArray())}}},this._layer={id:this._polylineID,type:"line",source:this._polylineID,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this._strokeColor,"line-width":this._strokeWeight,"line-opacity":this._strokeOpacity}}}},Polygon:class{constructor(i){this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,this._fillColor=i&&i.fillColor||"#000000",this._fillOpacity=i&&i.fillOpacity>=0&&i.fillOpacity<=1?i.fillOpacity:.5,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._polygonID=`polygon-${O.uniqueId()}`,this._outlineID=`polygon-line-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._polygonID)||(this._map.addSource(this._polygonID,this._polygonSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this._map.on("style.load",()=>{this._map.getSource(this._polygonID)||(this._map.addSource(this._polygonID,this._polygonSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this}remove(){return this._map&&(this._map.getLayer(this._polygonID)&&this._map.removeLayer(this._polygonID),this._map.getLayer(this._outlineID)&&this._map.removeLayer(this._outlineID),this._map.removeSource(this._polygonID),delete this._map),this}getPath(){return this._pathLnglat}setPath(i){return this._pathLnglat=i.map(e=>O.LngLat.convert(e)),this}_createGeoJson(){this._polygonSource={type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[this._pathLnglat.map(i=>i.toArray())]}}},this._layer={id:this._polygonID,type:"fill",source:this._polygonID,layout:{},paint:{"fill-color":this._fillColor,"fill-opacity":this._fillOpacity}},this._outline={id:this._outlineID,type:"line",source:this._polygonID,layout:{},paint:{"line-color":this._strokeColor,"line-width":this._strokeWeight,"line-opacity":this._strokeOpacity}}}},Rectangle:class{constructor(i){this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,this._fillColor=i&&i.fillColor||"#000000",this._fillOpacity=i&&i.fillOpacity>=0&&i.fillOpacity<=1?i.fillOpacity:.5,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._rectangleID=`rectangle-${O.uniqueId()}`,this._outlineID=`rectangle-line-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._rectangleID)||(this._map.addSource(this._rectangleID,this._rectangleSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this._map.on("style.load",()=>{this._map.getSource(this._rectangleID)||(this._map.addSource(this._rectangleID,this._rectangleSource),this._map.addLayer(this._layer),this._map.addLayer(this._outline))}),this}remove(){return this._map&&(this._map.getLayer(this._rectangleID)&&this._map.removeLayer(this._rectangleID),this._map.getLayer(this._outlineID)&&this._map.removeLayer(this._outlineID),this._map.removeSource(this._rectangleID),delete this._map),this}getBounds(){return this._boundsLnglat}setBounds(i){const e=["north","south","east","west"].every(t=>i.hasOwnProperty(t));if(this._boundsLnglat=[],e){const t=O.LngLat.convert([i.west,i.north]),n=O.LngLat.convert([i.east,i.north]),o=O.LngLat.convert([i.west,i.south]),r=O.LngLat.convert([i.east,i.south]);this._boundsLnglat.push(t,n,r,o,t)}else console.error("Bounds object is invalid. Please check documentation.");return this}_createGeoJson(){this._rectangleSource={type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[this._boundsLnglat.map(i=>i.toArray())]}}},this._layer={id:this._rectangleID,type:"fill",source:this._rectangleID,layout:{},paint:{"fill-color":this._fillColor,"fill-opacity":this._fillOpacity}},this._outline={id:this._outlineID,type:"line",source:this._rectangleID,layout:{},paint:{"line-color":this._strokeColor,"line-width":this._strokeWeight,"line-opacity":this._strokeOpacity}}}},Circle:class{constructor(i){this._radius=i&&i.radius>=0?i.radius:5,this._strokeColor=i&&i.strokeColor||"#000000",this._strokeOpacity=i&&i.strokeOpacity>=0&&i.strokeOpacity<=1?i.strokeOpacity:1,this._strokeWeight=i&&i.strokeWeight>=0?i.strokeWeight:3,this._fillColor=i&&i.fillColor||"#000000",this._fillOpacity=i&&i.fillOpacity>=0&&i.fillOpacity<=1?i.fillOpacity:.5,O.bindAll(["_createGeoJson"],this)}addTo(i){return this.remove(),this._circleID=`circle-${O.uniqueId()}`,this._map=i,this._createGeoJson(),this._map.on("load",()=>{this._map.getSource(this._circleID)||(this._map.addSource(this._circleID,this._circleSource),this._map.addLayer(this._layer))}),this._map.on("style.load",()=>{this._map.getSource(this._circleID)||(this._map.addSource(this._circleID,this._circleSource),this._map.addLayer(this._layer))}),this}remove(){return this._map&&(this._map.getLayer(this._circleID)&&this._map.removeLayer(this._circleID),this._map.removeSource(this._circleID),delete this._map),this}getCenter(){return this._center}setCenter(i){return this._center=O.LngLat.convert(i),this}_createGeoJson(){this._circleSource={type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:this._center.toArray()}}},this._layer={id:this._circleID,type:"circle",source:this._circleID,layout:{},paint:{"circle-stroke-color":this._strokeColor,"circle-stroke-opacity":this._strokeOpacity,"circle-stroke-width":this._strokeWeight,"circle-color":this._fillColor,"circle-opacity":this._fillOpacity,"circle-radius":this._radius}}}},MercatorCoordinate:O.MercatorCoordinate,Evented:O.Evented,config:O.config,prewarm:function(){Q1().acquire(v1)},clearPrewarmedResources:function(){const i=ue;i&&(i.isPreloaded()&&i.numActive()===1?(i.release(v1),ue=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return O.config.ACCESS_TOKEN},set accessToken(i){O.config.ACCESS_TOKEN=i},get baseApiUrl(){return O.config.NMAPS_API_URL},set baseApiUrl(i){O.config.NMAPS_API_URL=i,O.config.EVENTS_URL=`${i}/events`},get workerCount(){return u1.workerCount},set workerCount(i){u1.workerCount=i},get maxParallelImageRequests(){return O.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(i){O.config.MAX_PARALLEL_IMAGE_REQUESTS=i},clearStorage(i){O.clearTileCache(i)},workerUrl:""};return Y5});var re=i1;return re})})(l6);var u6=l6.exports;const qS=Ab(u6),na=PE({__proto__:null,default:qS},[u6]),LO=exports.MapBaseLayer.STREETS,xS="https://proxy-nodejs.prd.milemaker.com/proxy",D2="rgba(0, 0, 0, 0.87)",WS=100,wS=5,RS=1,LS="traffic",CS="ndrive-traffic",Xx="visibility",P_={visible:"visible",none:"none"},BS=({map:k,defaultBaseLayer:c0=LO})=>{let w0=c0;return{changeBaseLayer:re=>{k.setStyle(re),w0=re},getCurrentBaseLayer:()=>w0,getIsVisibleBaseLayer:re=>w0===re}},ES=({map:k})=>{const c0=new na.Popup({closeButton:!1,offset:{bottom:[0,-20]},className:"nmapsgl-traffic-events-popup"}),w0=()=>{r1()},Q0=()=>k.getStyle()?.layers?.filter(ze=>ze.source===CS),i1=ze=>{k.getCanvas().style.cursor="pointer";const f1=ze.features?.[0],He=f1.geometry.coordinates.slice();for(;Math.abs(ze.lngLat.lng-He[0])>180;)He[0]+=ze.lngLat.lng>He[0]?360:-360;c0?.setLngLat(He).setHTML(SS(f1.properties)).addTo(k)},O1=()=>{k.getCanvas().style.cursor="",c0?.remove()},re=()=>{O(),k.on("mouseover","traffic_events",i1),k.on("mouseout","traffic_events",O1),k.on("style.load",w0)},O=()=>{k.off("mouseover","traffic_events",i1),k.off("mouseout","traffic_events",O1),k.off("style.load",w0)},x1=ze=>{Q0()?.forEach(f1=>{k.setLayoutProperty(f1.id,Xx,ze),f1.type==="line"&&k.setPaintProperty(f1.id,"line-opacity",.6)})},r1=()=>{re(),x1(P_.visible)},s0=()=>{x1(P_.none),O()},N1=()=>!!Q0()?.every(ze=>k.getLayoutProperty(ze.id,Xx)===P_.visible);return{showTrafficLayer:r1,hideTrafficLayer:s0,getIsVisibleTrafficLayer:N1,toggle:()=>{N1()?s0():r1()}}},SS=k=>{let c0;return Object.keys(k).forEach(w0=>{w0.match(/short/gi)&&(c0=k[w0])}),`
|
|
3835
3835
|
<div class="nmapsgl-trafffic-events-popup">
|
|
3836
3836
|
<div class="nmapsgl-popup-wrapper">
|
|
3837
3837
|
<p>${k.type}</p>
|
package/dist/index.js
CHANGED
|
@@ -52303,7 +52303,7 @@ var b6 = h6.exports;
|
|
|
52303
52303
|
const qS = /* @__PURE__ */ Ab(b6), na = /* @__PURE__ */ PE({
|
|
52304
52304
|
__proto__: null,
|
|
52305
52305
|
default: qS
|
|
52306
|
-
}, [b6]), LO = k2.STREETS, xS = "https://proxy-nodejs.
|
|
52306
|
+
}, [b6]), LO = k2.STREETS, xS = "https://proxy-nodejs.prd.milemaker.com/proxy", F2 = "rgba(0, 0, 0, 0.87)", WS = 100, wS = 5, RS = 1, CS = "traffic", LS = "ndrive-traffic", Px = "visibility", k_ = {
|
|
52307
52307
|
visible: "visible",
|
|
52308
52308
|
none: "none"
|
|
52309
52309
|
}, BS = ({ map: k, defaultBaseLayer: c0 = LO }) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milemaker/milemaker-js",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1-alpha.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"files": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"milemaker-js-sdk"
|
|
18
18
|
],
|
|
19
19
|
"publishConfig": {
|
|
20
|
-
"access": "
|
|
20
|
+
"access": "public",
|
|
21
21
|
"registry": "https://registry.npmjs.org"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|