@qaecy/cue-ui 0.0.57 → 0.0.58

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.
Files changed (75) hide show
  1. package/1051.js +1 -1
  2. package/1138.js +1 -1
  3. package/1153.js +1 -1
  4. package/1338.js +1 -1
  5. package/1520.js +1 -0
  6. package/1837.js +1 -1
  7. package/1985.js +1 -1
  8. package/2003.js +1 -0
  9. package/2014.js +1 -0
  10. package/2021.js +1 -1
  11. package/2081.js +1 -1
  12. package/2245.js +1 -1
  13. package/2283.js +1 -0
  14. package/2317.js +1 -1
  15. package/2775.js +1 -1
  16. package/2839.js +1 -1
  17. package/29.js +1 -1
  18. package/3036.js +1 -1
  19. package/3039.js +1 -1
  20. package/3288.js +1 -1
  21. package/3319.js +1 -0
  22. package/3577.js +1 -1
  23. package/3614.js +1 -1
  24. package/4098.js +1 -0
  25. package/4283.js +1 -1
  26. package/4311.js +1 -1
  27. package/4791.js +1 -0
  28. package/5277.js +1 -0
  29. package/5381.js +1 -0
  30. package/5448.js +1 -0
  31. package/5559.js +1 -1
  32. package/5649.js +1 -1
  33. package/5738.js +1 -1
  34. package/5872.js +1 -1
  35. package/5971.js +1 -0
  36. package/6027.js +1 -0
  37. package/617.js +1 -1
  38. package/6233.js +1 -1
  39. package/63.js +1 -1
  40. package/6419.js +1 -1
  41. package/6423.js +1 -1
  42. package/650.js +1 -1
  43. package/6947.js +1 -1
  44. package/7089.js +1 -0
  45. package/7154.js +1 -0
  46. package/7313.js +1 -0
  47. package/7441.js +1 -1
  48. package/7719.js +1 -1
  49. package/7802.js +1 -0
  50. package/7851.js +1 -0
  51. package/804.js +1 -1
  52. package/8194.js +1 -0
  53. package/8560.js +1 -1
  54. package/8659.js +1 -0
  55. package/880.js +1 -0
  56. package/8855.js +1 -1
  57. package/8957.js +1 -1
  58. package/928.js +1 -1
  59. package/9396.js +1 -1
  60. package/992.js +1 -0
  61. package/common.js +1 -1
  62. package/index.js +1 -1
  63. package/main.js +1 -1
  64. package/package.json +1 -1
  65. package/2399.js +0 -1
  66. package/2516.js +0 -1
  67. package/4687.js +0 -1
  68. package/4879.js +0 -1
  69. package/5041.js +0 -1
  70. package/5071.js +0 -1
  71. package/5137.js +0 -1
  72. package/7056.js +0 -1
  73. package/8336.js +0 -1
  74. package/8791.js +0 -1
  75. package/9376.js +0 -1
package/5872.js CHANGED
@@ -1 +1 @@
1
- (self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[5872],{503(fe,Q,g){var B=g(6119);function A(T){var m=0;if(T&&T.length>0){m+=Math.abs($(T[0]));for(var G=1;G<T.length;G++)m-=Math.abs($(T[G]))}return m}function $(T){var m,G,O,l,y,L,w=0,D=T.length;if(D>2){for(L=0;L<D;L++)L===D-2?(O=D-2,l=D-1,y=0):L===D-1?(O=D-1,l=0,y=1):(O=L,l=L+1,y=L+2),m=T[O],G=T[l],w+=(s(T[y][0])-s(m[0]))*Math.sin(s(G[1]));w=w*B.RADIUS*B.RADIUS/2}return w}function s(T){return T*Math.PI/180}fe.exports.geometry=function _(T){var G,m=0;switch(T.type){case"Polygon":return A(T.coordinates);case"MultiPolygon":for(G=0;G<T.coordinates.length;G++)m+=A(T.coordinates[G]);return m;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(G=0;G<T.geometries.length;G++)m+=_(T.geometries[G]);return m}},fe.exports.ring=$},5341(fe){fe.exports=function g(B){if(!B||!B.type)return null;var _=Q[B.type];return _?"geometry"===_?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:B}]}:"feature"===_?{type:"FeatureCollection",features:[B]}:"featurecollection"===_?B:void 0:null};var Q={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},6756(fe,Q,g){"use strict";g.d(Q,{BK:()=>B,In:()=>I,Kz:()=>O,Mc:()=>y,U6:()=>A,g0:()=>L,g8:()=>$,r:()=>_,u9:()=>T});const B=["#2B5DE6","#1A2B50","#C5E045","#6FA8FF","#00C2E0","#5847EB","#008585","#4ADE80","#0F4C81","#8B5CF6","#FACC15","#FB923C","#F43F5E","#E879F9","#D97706","#334155","#64748B","#94A3B8","#C7D2FE","#F8FAFC"];function _(v){switch(v){case"primary":default:return"#2859e1";case"accent":return"#e2f552";case"tertiary":return"#ffffff"}}function A(v){switch(v){case"primary":default:return"#1744c2";case"accent":return"#b8cc3f";case"tertiary":return"#eeeeee"}}function $(v){const[N,V,H]=function s(v,N){if(void 0===v)return[];const H=window.getComputedStyle(v.nativeElement);return N.map(j=>H.getPropertyValue(j).trim()||"")}(v,["--cue-chart-text-color","--cue-chart-border-background-color","--chart-graph-edge-color"]);return{text:N,borderBackground:V,edgeColor:H}}const T={fontFamily:"Poppins, sans-serif",fontWeight:"normal",color:"#333"};function I(v){return v>=1e6?`${(v/1e6).toFixed(1)}m`:v>=1e3?`${(v/1e3).toFixed(0)}k`:v.toString()}function O(v,N,V,H){if(1===H)return v;const j=w(v),p=w(N),M=V/(H-1);return`rgb(${Math.round(j.r+(p.r-j.r)*M)}, ${Math.round(j.g+(p.g-j.g)*M)}, ${Math.round(j.b+(p.b-j.b)*M)})`}const y=(v,N)=>void 0===N?v:N.children??[];function L(v,N,V=.05,H="Other"){const j=v.reduce((P,E)=>P+D(E),0),p=[],M=[];if(v.forEach(P=>{let E,F;E=void 0===P.value&&Array.isArray(P.children)&&P.children.length>0?P.children.reduce((X,J)=>X+D(J),0):void 0!==P.value?P.value:0,Array.isArray(P.children)&&P.children.length>0&&(F=L(P.children,N,V,H));const z={...P,value:E,children:F};N&&j>0&&E/j<V?M.push(z):p.push(z)}),N&&M.length>0){const P=M.reduce((E,F)=>E+F.value,0);p.push({id:"__grouped_small__",name:H,value:P,children:M,isGroup:!0})}return p}function w(v){const N=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(v);return N?{r:parseInt(N[1],16),g:parseInt(N[2],16),b:parseInt(N[3],16)}:{r:0,g:0,b:0}}function D(v){return"number"==typeof v.value?v.value:Array.isArray(v.children)&&v.children.length>0?v.children.reduce((N,V)=>N+D(V),0):0}},7517(fe,Q,g){"use strict";g.d(Q,{P:()=>L});var B=g(7705),_=g(2271),A=g(2245),$=g(1359),s=g(5381),T=g(5547),m=g(5802);const G=(w,D)=>D.category;function I(w,D){if(1&w){const v=T.RV6();T.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",2),T.bIt("checkedChange",function(){m.eBV(v);const V=T.XpG();return m.Njj(V.toggleAll())}),T.k0s()()}if(2&w){const v=T.XpG();T.R7$(),T.Y8G("checked",v.allVisible())}}function O(w,D){if(1&w&&(T.j41(0,"cue-typography",3),T.EFF(1),T.k0s()),2&w){const v=T.XpG().$implicit;T.R7$(),T.JRh(v.category)}}function l(w,D){if(1&w){const v=T.RV6();T.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",4),T.bIt("checkedChange",function(){const V=m.eBV(v).$implicit,H=T.XpG(2);return m.Njj(H.toggleSingle(V))}),T.k0s(),T.j41(2,"cue-typography",5),T.bIt("click",function(){const V=m.eBV(v).$implicit,H=T.XpG(2);return m.Njj(H.toggleSingle(V))}),T.EFF(3),T.k0s()()}if(2&w){const v=D.$implicit;T.R7$(),T.Y8G("checked",v.visible)("color",v.color),T.R7$(2),T.JRh(v.label)}}function y(w,D){if(1&w&&(T.nVh(0,O,2,1,"cue-typography",3),T.Z7z(1,l,4,3,"cue-flexcontainer",1,T.Vm6)),2&w){const v=D.$implicit;T.vxM(v.category?0:-1),T.R7$(),T.Dyx(v.items)}}let L=(()=>{class w{layers=(0,B.geq)([]);visibilityChange=(0,B.CGW)();layerChange=(0,B.CGW)();visibilityAll=(0,B.CGW)();showCheckAll=(0,_.EW)(()=>this.layers().length>1);allVisible=(0,_.EW)(()=>this.layers().every(v=>v.visible));groupedLayers=(0,_.EW)(()=>{const v=[];for(const N of this.layers()){const V=N.category,H=v.find(j=>j.category===V);H?H.items.push(N):v.push({category:V,items:[N]})}return v});toggleAll(){const v=this.allVisible(),N=this.layers().map(V=>(V.visible=!v,V));this.layers.update(()=>[...N]),this.visibilityAll.emit(v),this.emitChange()}toggleSingle(v){v.visible=!v.visible,this.layerChange.emit(v),this.layers.update(()=>[...this.layers()]),this.emitChange()}emitChange(){this.visibilityChange.emit(this.layers())}static \u0275fac=function(N){return new(N||w)};static \u0275cmp=T.VBU({type:w,selectors:[["cue-layer-legend"]],inputs:{layers:[1,"layers"]},outputs:{layers:"layersChange",visibilityChange:"visibilityChange",layerChange:"layerChange",visibilityAll:"visibilityAll"},decls:4,vars:1,consts:[["direction","column"],["align","center","justify","start",2,"width","100%"],["size","s",3,"checkedChange","checked"],["variant","label",2,"margin-top","4px","opacity","0.6"],["size","s",3,"checkedChange","checked","color"],[2,"cursor","pointer",3,"click"]],template:function(N,V){1&N&&(T.j41(0,"cue-flexcontainer",0),T.nVh(1,I,2,1,"cue-flexcontainer",1),T.Z7z(2,y,3,1,null,null,G),T.k0s()),2&N&&(T.R7$(),T.vxM(V.showCheckAll()?1:-1),T.R7$(),T.Dyx(V.groupedLayers()))},dependencies:[s.n,A.Typography,$.Checkbox],encapsulation:2,changeDetection:0})}return w})()},2843(fe,Q,g){"use strict";g.d(Q,{M:()=>Wn});var B={};g.r(B),g.d(B,{LAT_MAX:()=>V,LAT_MIN:()=>v,LAT_RENDERED_MAX:()=>H,LAT_RENDERED_MIN:()=>N,LNG_MAX:()=>p,LNG_MIN:()=>j,activeStates:()=>w,classes:()=>s,cursors:()=>m,events:()=>l,geojsonTypes:()=>I,interactions:()=>D,meta:()=>L,modes:()=>O,sources:()=>T,types:()=>G,updateActions:()=>y});var _={};g.r(_),g.d(_,{isActiveFeature:()=>E,isBackspaceKey:()=>pe,isDeleteKey:()=>me,isDigit1Key:()=>te,isDigit2Key:()=>$e,isDigit3Key:()=>Oe,isDigitKey:()=>ve,isEnterKey:()=>he,isEscapeKey:()=>ye,isFeature:()=>X,isInactiveFeature:()=>F,isOfMetaType:()=>M,isShiftDown:()=>re,isShiftMousedown:()=>P,isTrue:()=>ct,isVertex:()=>J,noTarget:()=>z});var A={};g.r(A),g.d(A,{CommonSelectors:()=>_,ModeHandler:()=>nt,StringSet:()=>De,constrainFeatureMovement:()=>Dt,createMidPoint:()=>nn,createSupplementaryPoints:()=>At,createVertex:()=>Je,doubleClickZoom:()=>Ie,euclideanDistance:()=>qe,featuresAt:()=>ke,getFeatureAtAndSetCursors:()=>Xe,isClick:()=>et,isEventAtCoordinates:()=>mt,isTap:()=>tt,mapEventToBoundingBox:()=>Ze,moveFeatures:()=>Nt,sortFeatures:()=>dt,stringSetsAreEqual:()=>pn,theme:()=>Gt,toDenseArray:()=>ge});var $=g(5802);const s={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},T={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},m={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},G={POLYGON:"polygon",LINE:"line_string",POINT:"point"},I={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},O={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},l={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},y={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},L={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},w={ACTIVE:"true",INACTIVE:"false"},D=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],v=-90,N=-85,V=90,H=85,j=-270,p=270;function M(e){return function(t){const n=t.featureTarget;return!(!n||!n.properties)&&n.properties.meta===e}}function P(e){return!(!e.originalEvent||!e.originalEvent.shiftKey)&&0===e.originalEvent.button}function E(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===w.ACTIVE&&e.featureTarget.properties.meta===L.FEATURE}function F(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===w.INACTIVE&&e.featureTarget.properties.meta===L.FEATURE}function z(e){return void 0===e.featureTarget}function X(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.meta===L.FEATURE}function J(e){const t=e.featureTarget;return!(!t||!t.properties)&&t.properties.meta===L.VERTEX}function re(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}function ye(e){return"Escape"===e.key||27===e.keyCode}function he(e){return"Enter"===e.key||13===e.keyCode}function pe(e){return"Backspace"===e.key||8===e.keyCode}function me(e){return"Delete"===e.key||46===e.keyCode}function te(e){return"1"===e.key||49===e.keyCode}function $e(e){return"2"===e.key||50===e.keyCode}function Oe(e){return"3"===e.key||51===e.keyCode}function ve(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function ct(){return!0}var He=g(503);const Ae={Point:0,LineString:1,MultiLineString:1,Polygon:2};function ut(e,t){const n=Ae[e.geometry.type]-Ae[t.geometry.type];return 0===n&&e.geometry.type===I.POLYGON?e.area-t.area:n}const dt=function _t(e){return e.map(t=>(t.geometry.type===I.POLYGON&&(t.area=He.geometry({type:I.FEATURE,property:{},geometry:t.geometry})),t)).sort(ut).map(t=>(delete t.area,t))},Ze=function je(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]};function Re(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,n=e.length;t<n;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}Re.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},Re.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},Re.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},Re.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,n)=>t.v-n.v).map(t=>t.k)},Re.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const De=Re,Qe=[L.FEATURE,L.MIDPOINT,L.VERTEX],ke={click:function vt(e,t,n){return ft(e,t,n,n.options.clickBuffer)},touch:function bt(e,t,n){return ft(e,t,n,n.options.touchBuffer)}};function ft(e,t,n,r){if(null===n.map)return[];const o=e?Ze(e,r):t,i={};n.options.styles&&(i.layers=n.options.styles.map(x=>x.id).filter(x=>null!=n.map.getLayer(x)));const u=n.map.queryRenderedFeatures(o,i).filter(x=>-1!==Qe.indexOf(x.properties.meta)),b=new De,d=[];return u.forEach(x=>{const W=x.properties.id;b.has(W)||(b.add(W),d.push(x))}),dt(d)}function Xe(e,t){const n=ke.click(e,null,t),r={mouse:m.NONE};return n[0]&&(r.mouse=n[0].properties.active===w.ACTIVE?m.MOVE:m.POINTER,r.feature=n[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(r.mouse=m.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),n[0]}function qe(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function et(e,t,n={}){const r=null!=n.fineTolerance?n.fineTolerance:4,o=null!=n.grossTolerance?n.grossTolerance:12,i=null!=n.interval?n.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;const u=qe(e.point,t.point);return u<r||u<o&&t.time-e.time<i}function tt(e,t,n={}){const r=null!=n.tolerance?n.tolerance:25,o=null!=n.interval?n.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,qe(e.point,t.point)<r&&t.time-e.time<o}const nt=function(e,t){const n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(i,u,b){if(void 0===n[i])throw new Error(`Invalid event type: ${i}`);n[i].push({selector:u,fn:b})},render(i){t.store.featureChanged(i)}},o=function(i,u){const b=n[i];let d=b.length;for(;d--;){const x=b[d];if(x.selector(u)){x.fn.call(r,u)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(i){o("drag",i)},click(i){o("click",i)},mousemove(i){o("mousemove",i)},mousedown(i){o("mousedown",i)},mouseup(i){o("mouseup",i)},mouseout(i){o("mouseout",i)},keydown(i){o("keydown",i)},keyup(i){o("keyup",i)},touchstart(i){o("touchstart",i)},touchmove(i){o("touchmove",i)},touchend(i){o("touchend",i)},tap(i){o("tap",i)}}},S=((e,t=21)=>(n=t)=>{let r="",o=0|n;for(;o--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function a(){return S()}const c=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||a(),this.type=t.geometry.type};c.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},c.prototype.incomingCoords=function(e){this.setCoordinates(e)},c.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},c.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},c.prototype.setProperty=function(e,t){this.properties[e]=t},c.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:I.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},c.prototype.internal=function(e){const t={id:this.id,meta:L.FEATURE,"meta:type":this.type,active:w.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const n in this.properties)t[`user_${n}`]=this.properties[n];return{type:I.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const h=c,k=function(e,t){h.call(this,e,t)};(k.prototype=Object.create(h.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},k.prototype.updateCoordinate=function(e,t,n){this.coordinates=3===arguments.length?[t,n]:[e,t],this.changed()},k.prototype.getCoordinate=function(){return this.getCoordinates()};const K=k,oe=function(e,t){h.call(this,e,t)};(oe.prototype=Object.create(h.prototype)).isValid=function(){return this.coordinates.length>1},oe.prototype.addCoordinate=function(e,t,n){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,n])},oe.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},oe.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},oe.prototype.updateCoordinate=function(e,t,n){const r=parseInt(e,10);this.coordinates[r]=[t,n],this.changed()};const ne=oe,de=function(e,t){h.call(this,e,t),this.coordinates=this.coordinates.map(n=>n.slice(0,-1))};(de.prototype=Object.create(h.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every(e=>e.length>2)},de.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()},de.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},de.prototype.addCoordinate=function(e,t,n){this.changed();const r=e.split(".").map(i=>parseInt(i,10));this.coordinates[r[0]].splice(r[1],0,[t,n])},de.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))},de.prototype.getCoordinate=function(e){const t=e.split(".").map(r=>parseInt(r,10));return JSON.parse(JSON.stringify(this.coordinates[t[0]][t[1]]))},de.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))},de.prototype.updateCoordinate=function(e,t,n){this.changed();const r=e.split("."),o=parseInt(r[0],10),i=parseInt(r[1],10);void 0===this.coordinates[o]&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,n]};const ae=de,ue={MultiPoint:K,MultiLineString:ne,MultiPolygon:ae},_e=(e,t,n,r,o)=>{const i=n.split("."),u=parseInt(i[0],10),b=i[1]?i.slice(1).join("."):null;return e[u][t](b,r,o)},Ee=function(e,t){if(h.call(this,e,t),delete this.coordinates,this.model=ue[t.geometry.type],void 0===this.model)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};(Ee.prototype=Object.create(h.prototype))._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(n=>new t(this.ctx,{id:a(),type:I.FEATURE,properties:{},geometry:{coordinates:n,type:this.type.replace("Multi","")}}))},Ee.prototype.isValid=function(){return this.features.every(e=>e.isValid())},Ee.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},Ee.prototype.getCoordinate=function(e){return _e(this.features,"getCoordinate",e)},Ee.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===I.POLYGON?e.getCoordinates():e.coordinates)))},Ee.prototype.updateCoordinate=function(e,t,n){_e(this.features,"updateCoordinate",e,t,n),this.changed()},Ee.prototype.addCoordinate=function(e,t,n){_e(this.features,"addCoordinate",e,t,n),this.changed()},Ee.prototype.removeCoordinate=function(e){_e(this.features,"removeCoordinate",e),this.changed()},Ee.prototype.getFeatures=function(){return this.features};const Ne=Ee;function Z(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}Z.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},Z.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,n)=>(void 0===t[n.feature_id]&&(t[n.feature_id]=!0,this._ctx.store.get(n.feature_id).changed()),t),{})},Z.prototype.getSelected=function(){return this._ctx.store.getSelected()},Z.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},Z.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},Z.prototype.getFeature=function(e){return this._ctx.store.get(e)},Z.prototype.select=function(e){return this._ctx.store.select(e)},Z.prototype.deselect=function(e){return this._ctx.store.deselect(e)},Z.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},Z.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},Z.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},Z.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},Z.prototype.setActionableState=function(e={}){return this._ctx.events.actionable({trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1})},Z.prototype.changeMode=function(e,t={},n={}){return this._ctx.events.changeMode(e,t,n)},Z.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},Z.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},Z.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},Z.prototype.featuresAt=function(e,t,n="click"){if("click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return ke[n](e,t,this._ctx)},Z.prototype.newFeature=function(e){const t=e.geometry.type;return t===I.POINT?new K(this._ctx,e):t===I.LINE_STRING?new ne(this._ctx,e):t===I.POLYGON?new ae(this._ctx,e):new Ne(this._ctx,e)},Z.prototype.isInstanceOf=function(e,t){if(e===I.POINT)return t instanceof K;if(e===I.LINE_STRING)return t instanceof ne;if(e===I.POLYGON)return t instanceof ae;if("MultiFeature"===e)return t instanceof Ne;throw new Error(`Unknown feature class: ${e}`)},Z.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};const q=Z;Z.prototype.onSetup=function(){},Z.prototype.onDrag=function(){},Z.prototype.onClick=function(){},Z.prototype.onMouseMove=function(){},Z.prototype.onMouseDown=function(){},Z.prototype.onMouseUp=function(){},Z.prototype.onMouseOut=function(){},Z.prototype.onKeyUp=function(){},Z.prototype.onKeyDown=function(){},Z.prototype.onTouchStart=function(){},Z.prototype.onTouchMove=function(){},Z.prototype.onTouchEnd=function(){},Z.prototype.onTap=function(){},Z.prototype.onStop=function(){},Z.prototype.onTrash=function(){},Z.prototype.onCombineFeature=function(){},Z.prototype.onUncombineFeature=function(){},Z.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const ie={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},be=Object.keys(ie);const ge=function Me(e){return[].concat(e).filter(t=>void 0!==t)};function rt(){const e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(T.HOT))return d();const n=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:n});let r=[],o=[];e.isDirty?o=e.getAllIds():(r=e.getChangedIds().filter(x=>void 0!==e.get(x)),o=e.sources.hot.filter(x=>x.properties.id&&-1===r.indexOf(x.properties.id)&&void 0!==e.get(x.properties.id)).map(x=>x.properties.id)),e.sources.hot=[];const i=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(x=>-1===r.indexOf(x.properties.id||x.properties.parent));const u=i!==e.sources.cold.length||o.length>0;function b(x,W){const C=e.get(x).internal(n);e.ctx.events.currentModeRender(C,R=>{R.properties.mode=n,e.sources[W].push(R)})}function d(){e.isDirty=!1,e.clearChangedIds()}r.forEach(x=>b(x,"hot")),o.forEach(x=>b(x,"cold")),u&&e.ctx.map.getSource(T.COLD).setData({type:I.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(T.HOT).setData({type:I.FEATURE_COLLECTION,features:e.sources.hot}),d()}function se(e){let t;this._features={},this._featureIds=new De,this._selectedFeatureIds=new De,this._selectedCoordinates=[],this._changedFeatureIds=new De,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,rt.call(this),this._emitSelectionChange&&(this.ctx.events.fire(l.SELECTION_CHANGE,{features:this.getSelected().map(n=>n.toGeoJSON()),points:this.getSelectedCoordinates().map(n=>({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:n.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(l.RENDER,{})}))},this.isDirty=!1}function ot(e,t={}){const n=e._selectedCoordinates.filter(r=>e._selectedFeatureIds.has(r.feature_id));e._selectedCoordinates.length!==n.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=n}se.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},se.prototype.setDirty=function(){return this.isDirty=!0,this},se.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){const r=this.get(e);this.ctx.events.fire(l.CREATE,{features:[r.toGeoJSON()]})}return this},se.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(l.UPDATE,{action:t.action?t.action:y.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},se.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},se.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},se.prototype.getAllIds=function(){return this._featureIds.values()},se.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},se.prototype.delete=function(e,t={}){const n=[];return ge(e).forEach(r=>{this._featureIds.has(r)&&(this._featureIds.delete(r),this._selectedFeatureIds.delete(r),t.silent||-1===n.indexOf(this._features[r])&&n.push(this._features[r].toGeoJSON()),delete this._features[r],this.isDirty=!0)}),n.length&&this.ctx.events.fire(l.DELETE,{features:n}),ot(this,t),this},se.prototype.get=function(e){return this._features[e]},se.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])},se.prototype.select=function(e,t={}){return ge(e).forEach(n=>{this._selectedFeatureIds.has(n)||(this._selectedFeatureIds.add(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),this},se.prototype.deselect=function(e,t={}){return ge(e).forEach(n=>{this._selectedFeatureIds.has(n)&&(this._selectedFeatureIds.delete(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),ot(this,t),this},se.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},se.prototype.setSelected=function(e,t={}){return e=ge(e),this.deselect(this._selectedFeatureIds.values().filter(n=>-1===e.indexOf(n)),{silent:t.silent}),this.select(e.filter(n=>!this._selectedFeatureIds.has(n)),{silent:t.silent}),this},se.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},se.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},se.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},se.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))},se.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))},se.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},se.prototype.setFeatureProperty=function(e,t,n,r={}){this.get(e).setProperty(t,n),this.featureChanged(e,{silent:r.silent,action:y.CHANGE_PROPERTIES})},se.prototype.storeMapConfig=function(){D.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})},se.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})},se.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};const it=["mode","feature","mouse"];function kt(e){let t=null,n=null;const r={onRemove(){return e.map.off("load",r.connect),clearInterval(n),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(n),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(o){if(e.map=o,e.events=function Be(e){const t=Object.keys(e.options.modes).reduce((C,R)=>(C[R]=function Pe(e){const t=Object.keys(e);return function(n,r={}){let o={};const i=t.reduce((b,d)=>(b[d]=e[d],b),new q(n));return{start(){o=i.onSetup(r),be.forEach(b=>{const d=ie[b];let x=()=>!1;e[d]&&(x=()=>!0),this.on(b,x,function u(b){return d=>i[b](o,d)}(d))})},stop(){i.onStop(o)},trash(){i.onTrash(o)},combineFeatures(){i.onCombineFeatures(o)},uncombineFeatures(){i.onUncombineFeatures(o)},render(b,d){i.toDisplayFeatures(o,b,d)}}}}(e.options.modes[R]),C),{});let n={},r={};const o={};let i=null,u=null;o.drag=function(C,R){R({point:C.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:m.DRAG}),u.drag(C)):C.originalEvent.stopPropagation()},o.mousedrag=function(C){o.drag(C,R=>!et(n,R))},o.touchdrag=function(C){o.drag(C,R=>!tt(r,R))},o.mousemove=function(C){if(1===(void 0!==C.originalEvent.buttons?C.originalEvent.buttons:C.originalEvent.which))return o.mousedrag(C);const U=Xe(C,e);C.featureTarget=U,u.mousemove(C)},o.mousedown=function(C){n={time:(new Date).getTime(),point:C.point};const R=Xe(C,e);C.featureTarget=R,u.mousedown(C)},o.mouseup=function(C){const R=Xe(C,e);C.featureTarget=R,et(n,{point:C.point,time:(new Date).getTime()})?u.click(C):u.mouseup(C)},o.mouseout=function(C){u.mouseout(C)},o.touchstart=function(C){if(!e.options.touchEnabled)return;r={time:(new Date).getTime(),point:C.point};const R=ke.touch(C,null,e)[0];C.featureTarget=R,u.touchstart(C)},o.touchmove=function(C){if(e.options.touchEnabled)return u.touchmove(C),o.touchdrag(C)},o.touchend=function(C){if(C.originalEvent.preventDefault(),!e.options.touchEnabled)return;const R=ke.touch(C,null,e)[0];C.featureTarget=R,tt(r,{time:(new Date).getTime(),point:C.point})?u.tap(C):u.touchend(C)};const b=C=>{const R=pe(C),U=me(C),ee=ve(C);return!(R||U||ee)};function d(C,R,U={}){u.stop();const ee=t[C];if(void 0===ee)throw new Error(`${C} is not valid`);i=C;const Ce=ee(e,R);u=nt(Ce,e),U.silent||e.map.fire(l.MODE_CHANGE,{mode:C}),e.store.setDirty(),e.store.render()}o.keydown=function(C){(C.srcElement||C.target).classList.contains(s.CANVAS)&&((pe(C)||me(C))&&e.options.controls.trash?(C.preventDefault(),u.trash()):b(C)?u.keydown(C):te(C)&&e.options.controls.point?d(O.DRAW_POINT):$e(C)&&e.options.controls.line_string?d(O.DRAW_LINE_STRING):Oe(C)&&e.options.controls.polygon&&d(O.DRAW_POLYGON))},o.keyup=function(C){b(C)&&u.keyup(C)},o.zoomend=function(){e.store.changeZoom()},o.data=function(C){if("style"===C.dataType){const{setup:R,map:U,options:ee,store:Ce}=e;ee.styles.some(Ve=>U.getLayer(Ve.id))||(R.addLayers(),Ce.setDirty(),Ce.render())}};const x={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start(){i=e.options.defaultMode,u=nt(t[i](e),e)},changeMode:d,actionable:function W(C){let R=!1;Object.keys(C).forEach(U=>{if(void 0===x[U])throw new Error("Invalid action type");x[U]!==C[U]&&(R=!0),x[U]=C[U]}),R&&e.map.fire(l.ACTIONABLE,{actions:x})},currentModeName:()=>i,currentModeRender:(C,R)=>u.render(C,R),fire(C,R){e.map&&e.map.fire(C,R)},addEventListeners(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash(C){u.trash(C)},combineFeatures(){u.combineFeatures()},uncombineFeatures(){u.uncombineFeatures()},getMode:()=>i}}(e),e.ui=function It(e){const t={};let n=null,r={mode:null,feature:null,mouse:null},o={mode:null,feature:null,mouse:null};function u(R){o=Object.assign(o,R)}function b(){if(!e.container)return;const R=[],U=[];it.forEach(ee=>{o[ee]!==r[ee]&&(R.push(`${ee}-${r[ee]}`),null!==o[ee]&&U.push(`${ee}-${o[ee]}`))}),R.length>0&&e.container.classList.remove(...R),U.length>0&&e.container.classList.add(...U),r=Object.assign(r,o)}function d(R,U={}){const ee=document.createElement("button");return ee.className=`${s.CONTROL_BUTTON} ${U.className}`,ee.setAttribute("title",U.title),U.container.appendChild(ee),ee.addEventListener("click",Ce=>{if(Ce.preventDefault(),Ce.stopPropagation(),Ce.target===n)return x(),void U.onDeactivate();W(R),U.onActivate()},!0),ee}function x(){n&&(n.classList.remove(s.ACTIVE_BUTTON),n=null)}function W(R){x();const U=t[R];U&&U&&"trash"!==R&&(U.classList.add(s.ACTIVE_BUTTON),n=U)}return{setActiveButton:W,queueMapClasses:u,updateMapClasses:b,clearMapClasses:function i(){u({mode:null,feature:null,mouse:null}),b()},addButtons:function Y(){const R=e.options.controls,U=document.createElement("div");return U.className=`${s.CONTROL_GROUP} ${s.CONTROL_BASE}`,R&&(R[G.POINT]&&(t[G.POINT]=d(G.POINT,{container:U,className:s.CONTROL_BUTTON_POINT,title:"Marker tool "+(e.options.keybindings?"(1)":""),onActivate:()=>e.events.changeMode(O.DRAW_POINT),onDeactivate:()=>e.events.trash()})),R[G.LINE]&&(t[G.LINE]=d(G.LINE,{container:U,className:s.CONTROL_BUTTON_LINE,title:"LineString tool "+(e.options.keybindings?"(2)":""),onActivate:()=>e.events.changeMode(O.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),R[G.POLYGON]&&(t[G.POLYGON]=d(G.POLYGON,{container:U,className:s.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(e.options.keybindings?"(3)":""),onActivate:()=>e.events.changeMode(O.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),R.trash&&(t.trash=d("trash",{container:U,className:s.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),R.combine_features&&(t.combine_features=d("combineFeatures",{container:U,className:s.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),R.uncombine_features&&(t.uncombine_features=d("uncombineFeatures",{container:U,className:s.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),U},removeButtons:function C(){Object.keys(t).forEach(R=>{const U=t[R];U.parentNode&&U.parentNode.removeChild(U),delete t[R]})}}}(e),e.container=o.getContainer(),e.store=new se(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable();const i=o.dragPan.isEnabled();o.dragPan.disable(),o.dragPan.enable(),i||o.dragPan.disable()}return o.loaded()?r.connect():(o.on("load",r.connect),n=setInterval(()=>{o.loaded()&&r.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(T.COLD,{data:{type:I.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(T.HOT,{data:{type:I.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(o=>{e.map.addLayer(o)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(o=>{e.map.getLayer(o.id)&&e.map.removeLayer(o.id)}),e.map.getSource(T.COLD)&&e.map.removeSource(T.COLD),e.map.getSource(T.HOT)&&e.map.removeSource(T.HOT)}};return e.setup=r,r}const st="#3bb2d0",at="#fbb03b",Gt=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],at,st],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],at,st],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],at,st]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":at}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":at}}];function Ge(e,t){this.x=e,this.y=t}Ge.prototype={clone(){return new Ge(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const n=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),n=Math.sin(e),o=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=o,this},_rotateAround(e,t){const n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ge},Ge.convert=function(e){if(e instanceof Ge)return e;if(Array.isArray(e))return new Ge(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new Ge(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const Ft=function mn(e,t){const n=t.getBoundingClientRect();return new Ge(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))};function Je(e,t,n,r){return{type:I.FEATURE,properties:{meta:L.VERTEX,parent:e,coord_path:n,active:r?w.ACTIVE:w.INACTIVE},geometry:{type:I.POINT,coordinates:t}}}function lt(e,t,n){if(null!==e)for(var r,o,i,u,b,d,x,C,W=0,Y=0,R=e.type,U="FeatureCollection"===R,ee="Feature"===R,Ce=U?e.features.length:1,Te=0;Te<Ce;Te++){b=(C=!!(x=U?e.features[Te].geometry:ee?e.geometry:e)&&"GeometryCollection"===x.type)?x.geometries.length:1;for(var Ve=0;Ve<b;Ve++){var Se=0,We=0;if(null!==(u=C?x.geometries[Ve]:x)){d=u.coordinates;var Ue=u.type;switch(W=!n||"Polygon"!==Ue&&"MultiPolygon"!==Ue?0:1,Ue){case null:break;case"Point":if(!1===t(d,Y,Te,Se,We))return!1;Y++,Se++;break;case"LineString":case"MultiPoint":for(r=0;r<d.length;r++){if(!1===t(d[r],Y,Te,Se,We))return!1;Y++,"MultiPoint"===Ue&&Se++}"LineString"===Ue&&Se++;break;case"Polygon":case"MultiLineString":for(r=0;r<d.length;r++){for(o=0;o<d[r].length-W;o++){if(!1===t(d[r][o],Y,Te,Se,We))return!1;Y++}"MultiLineString"===Ue&&Se++,"Polygon"===Ue&&We++}"Polygon"===Ue&&Se++;break;case"MultiPolygon":for(r=0;r<d.length;r++){for(We=0,o=0;o<d[r].length;o++){for(i=0;i<d[r][o].length-W;i++){if(!1===t(d[r][o][i],Y,Te,Se,We))return!1;Y++}We++}Se++}break;case"GeometryCollection":for(r=0;r<u.geometries.length;r++)if(!1===lt(u.geometries[r],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Kt(e){const t={type:"Feature"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=Yt(e.properties),t.geometry=null==e.geometry?null:Ot(e.geometry),t}function Yt(e){const t={};return e&&Object.keys(e).forEach(n=>{const r=e[n];t[n]="object"==typeof r?null===r?null:Array.isArray(r)?r.map(o=>o):Yt(r):r}),t}function Ot(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(n=>Ot(n)),t):(t.coordinates=jt(e.coordinates),t)}function jt(e){const t=e;return"object"!=typeof t[0]?t.slice():t.map(n=>jt(n))}function Qt(e,t={}){return qt(e,"mercator",t)}function qt(e,t,n={}){var r=(n=n||{}).mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&function ht(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}(e[0])?e="mercator"===t?en(e):tn(e):(!0!==r&&(e=function Sn(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Kt(e);case"FeatureCollection":return function Pn(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(n=>Kt(n)),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ot(e);default:throw new Error("unknown GeoJSON type")}}(e)),lt(e,function(o){var i="mercator"===t?en(o):tn(o);o[0]=i[0],o[1]=i[1]})),e}function en(e){var t=Math.PI/180,n=6378137,r=20037508.342789244,o=Math.abs(e[0])<=180?e[0]:e[0]-360*function Fn(e){return e<0?-1:e>0?1:0}(e[0]),i=[n*o*t,n*Math.log(Math.tan(.25*Math.PI+.5*e[1]*t))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function tn(e){var t=180/Math.PI,n=6378137;return[e[0]*t/n,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/n)))*t]}function nn(e,t,n){const r=t.geometry.coordinates,o=n.geometry.coordinates;if(r[1]>H||r[1]<N||o[1]>H||o[1]<N)return null;const i=Qt(r),u=Qt(o),b=Y=>Number(Y.toFixed(8)),d=(Y,C)=>(Y+C)/2,x=function In(e,t={}){return qt(e,"wgs84",t)}([d(i[0],u[0]),d(i[1],u[1])]),W=[b(x[0]),b(x[1])];return{type:I.FEATURE,properties:{meta:L.MIDPOINT,parent:e,lng:W[0],lat:W[1],coord_path:n.properties.coord_path},geometry:{type:I.POINT,coordinates:W}}}Math;const At=function rn(e,t={},n=null){const{type:r,coordinates:o}=e.geometry,i=e.properties&&e.properties.id;let u=[];function b(W,Y){let C="",R=null;W.forEach((U,ee)=>{const Ce=null!=Y?`${Y}.${ee}`:String(ee),Te=Je(i,U,Ce,d(Ce));if(t.midpoints&&R){const Se=nn(i,R,Te);Se&&u.push(Se)}R=Te;const Ve=JSON.stringify(U);C!==Ve&&u.push(Te),0===ee&&(C=Ve)})}function d(W){return!!t.selectedPaths&&-1!==t.selectedPaths.indexOf(W)}return r===I.POINT?u.push(Je(i,o,n,d(n))):r===I.POLYGON?o.forEach((W,Y)=>{b(W,null!==n?`${n}.${Y}`:String(Y))}):r===I.LINE_STRING?b(o,n):0===r.indexOf(I.MULTI_PREFIX)&&function x(){const W=r.replace(I.MULTI_PREFIX,"");o.forEach((Y,C)=>{u=u.concat(rn({type:I.FEATURE,properties:e.properties,geometry:{type:W,coordinates:Y}},t,C))})}(),u},Ie={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:pt,LAT_MAX:gt,LAT_RENDERED_MIN:on,LAT_RENDERED_MAX:sn,LNG_MIN:an,LNG_MAX:ln}=B;function Dt(e,t){let n=pt,r=gt,o=pt,i=gt,u=ln,b=an;e.forEach(x=>{const W=function wn(e){const n=[e.geometry.coordinates].flat({Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type]),r=n.map(b=>b[0]),o=n.map(b=>b[1]),i=b=>Math.min.apply(null,b),u=b=>Math.max.apply(null,b);return[i(r),i(o),u(r),u(o)]}(x),Y=W[1],C=W[3],R=W[0],U=W[2];Y>n&&(n=Y),C<r&&(r=C),C>o&&(o=C),Y<i&&(i=Y),R<u&&(u=R),U>b&&(b=U)});const d=t;return n+d.lat>sn&&(d.lat=sn-n),o+d.lat>gt&&(d.lat=gt-o),r+d.lat<on&&(d.lat=on-r),i+d.lat<pt&&(d.lat=pt-i),u+d.lng<=an&&(d.lng+=360*Math.ceil(Math.abs(d.lng)/360)),b+d.lng>=ln&&(d.lng-=360*Math.ceil(Math.abs(d.lng)/360)),d}function Nt(e,t){const n=Dt(e.map(r=>r.toGeoJSON()),t);e.forEach(r=>{const o=r.getCoordinates(),i=x=>{const W={lng:x[0]+n.lng,lat:x[1]+n.lat};return[W.lng,W.lat]},u=x=>x.map(W=>i(W));let d;r.type===I.POINT?d=i(o):r.type===I.LINE_STRING||r.type===I.MULTI_POINT?d=o.map(i):r.type===I.POLYGON||r.type===I.MULTI_LINE_STRING?d=o.map(u):r.type===I.MULTI_POLYGON&&(d=o.map(x=>x.map(W=>u(W)))),r.incomingCoords(d)})}const le={onSetup:function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(n=>void 0!==this.getFeature(n))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},fireUpdate:function(){this.fire(l.UPDATE,{action:y.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(){const e=this.getSelected(),t=e.filter(i=>this.isInstanceOf("MultiFeature",i));let n=!1;if(e.length>1){n=!0;const i=e[0].type.replace("Multi","");e.forEach(u=>{u.type.replace("Multi","")!==i&&(n=!1)})}this.setActionableState({combineFeatures:n,uncombineFeatures:t.length>0,trash:e.length>0})},getUniqueIds:function(e){return e.length?e.map(n=>n.properties.id).filter(n=>void 0!==n).reduce((n,r)=>(n.add(r),n),new De).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){Ie.enable(this)},onMouseMove:function(e,t){return X(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};le.onTap=le.onClick=function(e,t){return z(t)?this.clickAnywhere(e,t):M(L.VERTEX)(t)?this.clickOnVertex(e,t):X(t)?this.clickOnFeature(e,t):void 0},le.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(n=>this.doRender(n))),Ie.enable(this),this.stopExtendedInteractions(e)},le.clickOnVertex=function(e,t){this.changeMode(O.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:m.MOVE})},le.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},le.clickOnFeature=function(e,t){Ie.disable(this),this.stopExtendedInteractions(e);const n=re(t),r=this.getSelectedIds(),o=t.featureTarget.properties.id,i=this.isSelected(o);if(!n&&i&&this.getFeature(o).type!==I.POINT)return this.changeMode(O.DIRECT_SELECT,{featureId:o});i&&n?(this.deselect(o),this.updateUIClasses({mouse:m.POINTER}),1===r.length&&Ie.enable(this)):!i&&n?(this.select(o),this.updateUIClasses({mouse:m.MOVE})):!i&&!n&&(r.forEach(u=>this.doRender(u)),this.setSelected(o),this.updateUIClasses({mouse:m.MOVE})),this.doRender(o)},le.onMouseDown=function(e,t){return e.initialDragPanState=this.map.dragPan.isEnabled(),E(t)?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&P(t)?this.startBoxSelect(e,t):void 0},le.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Ft(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},le.onTouchStart=function(e,t){if(E(t))return this.startOnActiveFeature(e,t)},le.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},le.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:m.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(s.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=Ft(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,n.x),o=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),u=Math.max(e.boxSelectStartLocation.y,n.y),b=`translate(${r}px, ${i}px)`;e.boxSelectElement.style.transform=b,e.boxSelectElement.style.WebkitTransform=b,e.boxSelectElement.style.width=o-r+"px",e.boxSelectElement.style.height=u-i+"px"},le.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};Nt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},le.onTouchEnd=le.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const n=[e.boxSelectStartLocation,Ft(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,n,"click"),o=this.getUniqueIds(r).filter(i=>!this.isSelected(i));o.length&&(this.select(o),o.forEach(i=>this.doRender(i)),this.updateUIClasses({mouse:m.MOVE}))}this.stopExtendedInteractions(e)},le.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?w.ACTIVE:w.INACTIVE,n(t),this.fireActionable(),t.properties.active===w.ACTIVE&&t.geometry.type!==I.POINT&&At(t).forEach(n)},le.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},le.onCombineFeatures=function(){const e=this.getSelected();if(0===e.length||e.length<2)return;const t=[],n=[],r=e[0].type.replace("Multi","");for(let o=0;o<e.length;o++){const i=e[o];if(i.type.replace("Multi","")!==r)return;i.type.includes("Multi")?i.getCoordinates().forEach(u=>{t.push(u)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){const o=this.newFeature({type:I.FEATURE,properties:n[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(o),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([o.id]),this.fire(l.COMBINE_FEATURES,{createdFeatures:[o.toGeoJSON()],deletedFeatures:n})}this.fireActionable()},le.onUncombineFeatures=function(){const e=this.getSelected();if(0===e.length)return;const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];this.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach(i=>{this.addFeature(i),i.properties=o.properties,t.push(i.toGeoJSON()),this.select([i.id])}),this.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))}t.length>1&&this.fire(l.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:n}),this.fireActionable()};const xn=le,cn=M(L.VERTEX),un=M(L.MIDPOINT),ce={fireUpdate:function(){this.fire(l.UPDATE,{action:y.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){null==e.initialDragPanState&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){e.canDragMove&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(n.coord_path);re(t)||-1!==r?re(t)&&-1===r&&e.selectedCoordPaths.push(n.coord_path):e.selectedCoordPaths=[n.coord_path];const o=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(o)},onMidpoint:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(e,t){return t.map(n=>({feature_id:e,coord_path:n}))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,n){Nt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,n){const r=e.selectedCoordPaths.map(u=>e.feature.getCoordinate(u)),i=Dt(r.map(u=>({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:u}})),n);for(let u=0;u<r.length;u++){const b=r[u];e.feature.updateCoordinate(e.selectedCoordPaths[u],b[0]+i.lng,b[1]+i.lat)}},clickNoTarget:function(){this.changeMode(O.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(O.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){const t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===I.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),Ie.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){Ie.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,n){e.featureId===t.properties.id?(t.properties.active=w.ACTIVE,n(t),At(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=w.INACTIVE,n(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort((t,n)=>n.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(O.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){const n=E(t),r=cn(t),o=un(t),i=0===e.selectedCoordPaths.length;return this.updateUIClasses(n&&i||r&&!i?{mouse:m.MOVE}:{mouse:m.NONE}),(r||n||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};ce.onTouchStart=ce.onMouseDown=function(e,t){return cn(t)?this.onVertex(e,t):E(t)?this.onFeature(e,t):un(t)?this.onMidpoint(e,t):void 0},ce.onDrag=function(e,t){if(!0!==e.canDragMove)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat},ce.onClick=function(e,t){return z(t)?this.clickNoTarget(e,t):E(t)?this.clickActiveFeature(e,t):F(t)?this.clickInactive(e,t):void this.stopDragging(e)},ce.onTap=function(e,t){return z(t)?this.clickNoTarget(e,t):E(t)?this.clickActiveFeature(e,t):F(t)?this.clickInactive(e,t):void 0},ce.onTouchEnd=ce.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const On=ce,xe={onSetup:function(){const e=this.newFeature({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:m.ADD}),this.activateUIButton(G.POINT),this.setActionableState({trash:!0}),{point:e}},stopDrawingAndRemove:function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)}};xe.onTap=xe.onClick=function(e,t){this.updateUIClasses({mouse:m.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(l.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.point.id]})},xe.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},xe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.point.id;if(t.properties.active=r?w.ACTIVE:w.INACTIVE,!r)return n(t)},xe.onTrash=xe.stopDrawingAndRemove,xe.onKeyUp=function(e,t){if(ye(t)||he(t))return this.stopDrawingAndRemove(e,t)};const An=xe,mt=function Dn(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]},Fe={onSetup:function(){const e=this.newFeature({type:I.FEATURE,properties:{},geometry:{type:I.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),Ie.disable(this),this.updateUIClasses({mouse:m.ADD}),this.activateUIButton(G.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:m.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:m.POINTER})}};Fe.onTap=Fe.onClick=function(e,t){return J(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},Fe.onKeyUp=function(e,t){ye(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)):he(t)&&this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},Fe.onStop=function(e){this.updateUIClasses({mouse:m.NONE}),Ie.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(l.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT,{},{silent:!0})))},Fe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?w.ACTIVE:w.INACTIVE,!r)return n(t);if(0===t.geometry.coordinates.length)return;const o=t.geometry.coordinates[0].length;if(!(o<3)){if(t.properties.meta=L.FEATURE,n(Je(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),o>3){const i=t.geometry.coordinates[0].length-3;n(Je(e.polygon.id,t.geometry.coordinates[0][i],`0.${i}`,!1))}if(o<=4&&(n({type:I.FEATURE,properties:t.properties,geometry:{coordinates:[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]],type:I.LINE_STRING}}),3===o))return;return n(t)}},Fe.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)};const Nn=Fe,we={onSetup:function(e){const t=(e=e||{}).featureId;let n,r,o="forward";if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let i=e.from;if(i&&"Feature"===i.type&&i.geometry&&"Point"===i.geometry.type&&(i=i.geometry),i&&"Point"===i.type&&i.coordinates&&2===i.coordinates.length&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");const u=n.coordinates.length-1;if(n.coordinates[u][0]===i[0]&&n.coordinates[u][1]===i[1])r=u+1,n.addCoordinate(r,...n.coordinates[u]);else{if(n.coordinates[0][0]!==i[0]||n.coordinates[0][1]!==i[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");o="backwards",r=0,n.addCoordinate(r,...n.coordinates[0])}}else n=this.newFeature({type:I.FEATURE,properties:{},geometry:{type:I.LINE_STRING,coordinates:[]}}),r=0,this.addFeature(n);return this.clearSelectedFeatures(),Ie.disable(this),this.updateUIClasses({mouse:m.ADD}),this.activateUIButton(G.LINE),this.setActionableState({trash:!0}),{line:n,currentVertexPosition:r,direction:o}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&mt(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:m.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:m.POINTER})}};we.onTap=we.onClick=function(e,t){if(J(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},we.onKeyUp=function(e,t){he(t)?this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.line.id]}):ye(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT))},we.onStop=function(e){Ie.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(l.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT,{},{silent:!0})))},we.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)},we.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.line.id;if(t.properties.active=r?w.ACTIVE:w.INACTIVE,!r)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=L.FEATURE,n(Je(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],""+("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),n(t))};const dn={simple_select:xn,direct_select:On,draw_point:An,draw_polygon:Nn,draw_line_string:we},Rn={defaultMode:O.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Gt,modes:dn,controls:{},userProperties:!1,suppressAPIEvents:!0},kn={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Bn={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function fn(e,t){return e.map(n=>n.source?n:Object.assign({},n,{id:`${n.id}.${t}`,source:"hot"===t?T.HOT:T.COLD}))}var hn=g(362),Vn=g(5341);function pn(e,t){return e.length===t.length&&JSON.stringify(e.map(n=>n).sort())===JSON.stringify(t.map(n=>n).sort())}const Un={Polygon:ae,LineString:ne,Point:K,MultiPolygon:Ne,MultiLineString:Ne,MultiPoint:Ne};function yt(e){!function(e,t){e=function Gn(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),t.controls=Object.assign({},!1===e.displayControlsDefault?Bn:kn,e.controls),t=Object.assign({},Rn,t),t.styles=fn(t.styles,"cold").concat(fn(t.styles,"hot")),t}(e);const n={options:e};t=function $n(e,t){t.modes=O;const n=void 0===e.options.suppressAPIEvents||!!e.options.suppressAPIEvents;return t.getFeatureIdsAt=function(r){return ke.click({point:r},null,e).map(i=>i.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:I.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(r=>e.store.get(r)).map(r=>r.toGeoJSON())}},t.getSelectedPoints=function(){return{type:I.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(r=>({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:r.coordinates}}))}},t.set=function(r){if(void 0===r.type||r.type!==I.FEATURE_COLLECTION||!Array.isArray(r.features))throw new Error("Invalid FeatureCollection");const o=e.store.createRenderBatch();let i=e.store.getAllIds().slice();const u=t.add(r),b=new De(u);return i=i.filter(d=>!b.has(d)),i.length&&t.delete(i),o(),u},t.add=function(r){const i=JSON.parse(JSON.stringify(Vn(r))).features.map(u=>{if(u.id=u.id||a(),null===u.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(u.id)||e.store.get(u.id).type!==u.geometry.type){const b=Un[u.geometry.type];if(void 0===b)throw new Error(`Invalid geometry type: ${u.geometry.type}.`);const d=new b(e,u);e.store.add(d,{silent:n})}else{const b=e.store.get(u.id),d=b.properties;b.properties=u.properties,hn(d,u.properties)||e.store.featureChanged(b.id,{silent:n}),hn(b.getCoordinates(),u.geometry.coordinates)||b.incomingCoords(u.geometry.coordinates)}return u.id});return e.store.render(),i},t.get=function(r){const o=e.store.get(r);if(o)return o.toGeoJSON()},t.getAll=function(){return{type:I.FEATURE_COLLECTION,features:e.store.getAll().map(r=>r.toGeoJSON())}},t.delete=function(r){return e.store.delete(r,{silent:n}),t.getMode()!==O.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(O.SIMPLE_SELECT,void 0,{silent:n}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:n}),t.getMode()===O.DIRECT_SELECT?e.events.changeMode(O.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.changeMode=function(r,o={}){return r===O.SIMPLE_SELECT&&t.getMode()===O.SIMPLE_SELECT?(pn(o.featureIds||[],e.store.getSelectedIds())||(e.store.setSelected(o.featureIds,{silent:n}),e.store.render()),t):(r===O.DIRECT_SELECT&&t.getMode()===O.DIRECT_SELECT&&o.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,o,{silent:n}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:n}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:n}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:n}),t},t.setFeatureProperty=function(r,o,i){return e.store.setFeatureProperty(r,o,i,{silent:n}),t},t}(n,t),n.api=t;const r=kt(n);t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=G,t.options=e}(e,this)}yt.modes=dn,yt.constants=B,yt.lib=A;const gn=yt;let Wn=(()=>{class e{_draw;_map;_drawMode=(0,$.vPA)(!1);_settingDrawMode=!1;_eventListeners=[];_clearAfterFinish=!0;drawEvent=(0,$.vPA)(void 0);destroy(){this._cleanup()}initializeWithMap(n){this._map=n,this._initDrawControl(n)}setDrawMode(n,r){if(this._draw&&this._map&&!this._settingDrawMode){if(this._clearAfterFinish=r,this._settingDrawMode=!0,this._drawMode.set(n),n){this._draw.deleteAll(),this._draw.changeMode("draw_polygon");const o={type:"polygon",status:"started",coordinates:[],bbox:{minLng:0,minLat:0,maxLng:0,maxLat:0}};this.drawEvent.update(()=>o)}else this._draw.changeMode("simple_select"),this._draw.deleteAll();this._settingDrawMode=!1}}setClearAfterFinish(n){this._clearAfterFinish=n}getClearAfterFinish(){return this._clearAfterFinish}getDrawMode(){return this._drawMode()}clearDrawings(){this._draw&&this._draw.deleteAll()}getDrawInstance(){return this._draw}_initDrawControl(n){this._draw=new gn({displayControlsDefault:!1,modes:{...gn.modes}}),n.addControl(this._draw,"top-left");const r=document.querySelector(".mapbox-gl-draw_ctrl-draw-btn")?.parentElement;r&&(r.style.display="none");const o=b=>{const d=b.features[0];if("Polygon"===d.geometry.type){const x=d.geometry.coordinates[0],Y={type:"polygon",status:"ended",coordinates:x,bbox:this._calculateBBox(x)};this.drawEvent.update(()=>Y),this._drawMode.set(!1),this._clearAfterFinish&&this._draw?.deleteAll()}},i=b=>{const d=b.features[0];if("Polygon"===d.geometry.type){const x=d.geometry.coordinates[0],Y={type:"polygon",status:"in-progress",coordinates:x,bbox:this._calculateBBox(x)};this.drawEvent.update(()=>Y)}},u=()=>{if(this._drawMode()){const b=this._draw?.getAll();if(b?.features?.length){const d=b.features[0];if("Polygon"===d.geometry.type){const x=d.geometry.coordinates[0];if(x.length>2){const Y={type:"polygon",status:"in-progress",coordinates:x,bbox:this._calculateBBox(x)};this.drawEvent.update(()=>Y)}}}}};n.on("draw.create",o),n.on("draw.update",i),n.on("mousemove",u),this._eventListeners.push({event:"draw.create",handler:o}),this._eventListeners.push({event:"draw.update",handler:i}),this._eventListeners.push({event:"mousemove",handler:u})}_cleanup(){this._map&&(this._eventListeners.forEach(({event:n,handler:r})=>{this._map?.off(n,r)}),this._eventListeners=[],this._draw&&this._map._controls?.includes(this._draw)&&this._map.removeControl(this._draw)),this._draw=void 0,this._map=void 0,this.drawEvent.set(void 0)}_calculateBBox(n){return n.reduce((r,o)=>({minLng:Math.min(r.minLng,o[0]),minLat:Math.min(r.minLat,o[1]),maxLng:Math.max(r.maxLng,o[0]),maxLat:Math.max(r.maxLat,o[1])}),{minLng:1/0,minLat:1/0,maxLng:-1/0,maxLat:-1/0})}static \u0275fac=function(r){return new(r||e)};static \u0275prov=$.jDH({token:e,factory:e.\u0275fac})}return e})()},6986(fe,Q,g){"use strict";g.d(Q,{A4:()=>B,Jc:()=>m,Ln:()=>A,dx:()=>s,g8:()=>_,j5:()=>$,n7:()=>T});const B=12;function _(O,l,y){return{id:O,source:l,type:"circle",maxzoom:B,filter:["==",["get","_isCentroid"],!0],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],y],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}}function A(O,l,y,L){return function I(O,l,y,L,w){const D={id:O,source:L},v=w||y;switch(l){case"Point":case"MultiPoint":return[{...D,id:`${O}-clusters`,type:"circle",filter:["has","point_count"],paint:{"circle-color":v,"circle-radius":["step",["get","point_count"],15,100,20,750,25],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}},{...D,id:`${O}-cluster-count`,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#ffffff","text-halo-color":"rgba(0, 0, 0, 0.3)","text-halo-width":1}},{...D,id:`${O}-unclustered`,type:"circle",filter:["!",["has","point_count"]],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],y],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}];case"LineString":case"MultiLineString":return{...D,type:"line",paint:{"line-color":["coalesce",["get","_color"],y],"line-width":3,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}};case"Polygon":case"MultiPolygon":return[{id:`${O}-fill`,source:L,type:"fill",paint:{"fill-color":["coalesce",["get","_color"],y],"fill-opacity":.3}},{id:`${O}-stroke`,source:L,type:"line",paint:{"line-color":["coalesce",["get","_color"],y],"line-width":2,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}},{id:`${O}-labels`,source:L,type:"symbol",layout:{"text-field":["coalesce",["get","label"],""],"text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":13,"text-anchor":"center","text-allow-overlap":!1},paint:{"text-color":"#333333","text-halo-color":"rgba(255, 255, 255, 0.9)","text-halo-width":2}}];default:return console.warn(`Unsupported geometry type: ${l}`),null}}(O,l,y,L,y)}function $(O){return"Polygon"===O||"MultiPolygon"===O}function s(O){return"LineString"===O||"MultiLineString"===O}function T(O,l){return l&&("Point"===O||"MultiPoint"===O)}function m(O,l){return T(O,l)?{cluster:!0,clusterMaxZoom:14,clusterRadius:50,clusterMinPoints:2}:{cluster:!1}}},3646(fe,Q,g){"use strict";g.d(Q,{B:()=>V});var B=g(467),_=g(5802),A=g(2271),$=g(4412),s=g(1413),T=g(2306),m=g(140);function v(H){let j=1/0,p=1/0,M=-1/0,P=-1/0;const E=H.features,F=X=>{X.length>=2&&(j=Math.min(j,X[0]),p=Math.min(p,X[1]),M=Math.max(M,X[0]),P=Math.max(P,X[1]))},z=(X,J)=>{if(0===J)F(X);else if(Array.isArray(X))for(const re of X)z(re,J-1)};for(const X of E){const J=X.geometry;switch(J.type){case"Point":z(J.coordinates,0);break;case"LineString":case"MultiPoint":z(J.coordinates,1);break;case"Polygon":case"MultiLineString":z(J.coordinates,2);break;case"MultiPolygon":z(J.coordinates,3);break;case"GeometryCollection":for(const re of J.geometries){const pe=v(new m.o([{type:"Feature",geometry:re,properties:null}]));pe&&(F([pe[0],pe[1]]),F([pe[2],pe[3]]))}}}return j===1/0?null:[j,p,M,P]}var N=g(6986);let V=(()=>{class H{_layers$=new $.t([]);_map;_sources={};_sourceLayers={};_sourceIds=[];_attachedListeners=[];_hoveredFeature=(0,_.vPA)(void 0);_layerGroups={};_layerClickable={};_pointLayerIds=new Set;_lineLayerIds=new Set;_processedClickEvents=new WeakSet;_clearHoverTimeout;_hoverSequence=0;layers=this._layers$.asObservable();layersSignal=(0,A.EW)(()=>this._layers$.getValue());clickedFeature=new s.B;hoveredFeature=new s.B;initializeWithMap(p){this._map=p,p.on("mousemove",M=>{const P=p.getCanvas();if(!P)return;const E=Object.keys(this._layerClickable).filter(z=>this._layerClickable[z]&&p.getLayer(z)),F=p.queryRenderedFeatures(M.point,{layers:E});P.style.cursor=F.length>0?"pointer":""})}getLayers(){return this._layers$.getValue()}setLayers(p){this._layers$.next([...p])}addLayer(p){const M=this._layers$.getValue(),P=M.findIndex(E=>E.id===p.id);P>=0?M[P]={...p}:M.push({...p}),this._layers$.next([...M])}removeLayer(p){const P=this._layers$.getValue().filter(E=>E.id!==p);this._layers$.next(P),this._deleteSourceIfExists(p.toString()),delete this._sources[p.toString()],delete this._sourceLayers[p.toString()],delete this._layerClickable[p.toString()],this._pointLayerIds.delete(p.toString()),this._lineLayerIds.delete(p.toString()),this._sourceIds=this._sourceIds.filter(E=>E!==p.toString())}toggleVisibility(p){const M=p.toString();if(this._layerGroups[M])return void this.toggleLayerGroupVisibility(M);const E=this._layers$.getValue().map(F=>{if(F.id===p){const z={...F,visible:!F.visible};return this._updateLayerVisibility(p.toString(),z.visible),z}return F});this._layers$.next(E)}setLayerVisibility(p,M){const P=p.toString();if(this._layerGroups[P]){if(this._map){const X=M?"visible":"none";this._layerGroups[P].forEach(J=>{this._map.setLayoutProperty(J,"visibility",X)})}}else this._updateLayerVisibility(P,M);const F=this._layers$.getValue().map(z=>z.id===p?{...z,visible:M}:z);this._layers$.next(F)}loadGeoJSONLayerGroup(p,M,P){var E=this;return(0,B.A)(function*(F,z,X,J={}){const{cluster:re=!1,zoomToFit:ye=!0,visible:he=!0,label:pe=F,color:me=E._extractColorFromLayer(X[0])}=J;if(!E._map)return void console.warn("Map not initialized in LayerService");const te=F;yield E._addSource(F,{type:"geojson",data:z,...(0,N.Jc)("Point",re)});const $e=[];for(const ve of X){$e.push(ve.id),E._layerClickable[ve.id]=!0,E._sourceLayers[te]||(E._sourceLayers[te]={layer:ve,clickable:!0});const He=ve.type;if("circle"===He||"symbol"===He)E._pointLayerIds.add(ve.id),E._map.addLayer(ve);else if("line"===He){E._lineLayerIds.add(ve.id);const Ae=E._getBeforePointLayerId();E._map.addLayer(ve,Ae)}else{const Ae=E._getBeforeLineLayerId()??E._getBeforePointLayerId();E._map.addLayer(ve,Ae)}E._map&&E._map.setLayoutProperty(ve.id,"visibility",he?"visible":"none")}for(const ve of X)E._setLayerEvents(te,ve);E._layerGroups[F]=$e;const Oe=new T.ux(pe,F);Oe.collection=z,Oe.color=me,Oe.visible=he,E.addLayer(Oe),ye&&E.fitLayerBounds(F)}).apply(this,arguments)}toggleLayerGroupVisibility(p){const M=this._layerGroups[p];if(!M)return;const P=this.getLayer(p);if(!P)return;const E=!P.visible;if(this._map){const F=E?"visible":"none";M.forEach(z=>{this._map.setLayoutProperty(z,"visibility",F)})}this.updateLayer(p,{visible:E})}removeLayerGroup(p){const M=this._layerGroups[p];M&&(this._map&&(M.forEach(P=>{this._map.removeLayer(P),this._attachedListeners=this._attachedListeners.filter(E=>E!==p),delete this._layerClickable[P],this._pointLayerIds.delete(P),this._lineLayerIds.delete(P)}),this._deleteSourceIfExists(p)),delete this._sources[p],delete this._sourceLayers[p],this._sourceIds=this._sourceIds.filter(P=>P!==p),delete this._layerGroups[p],this.removeLayer(p))}loadGeoJSONLayer(p,M,P){var E=this;return(0,B.A)(function*(F,z,X,J={}){const{cluster:re=!0,zoomToFit:ye=!0,visible:he=!0,label:pe=F,color:me=E._extractColorFromLayer(X)}=J;if(!E._map)return void console.warn("Map not initialized in LayerService");yield E._addSource(F,{type:"geojson",data:z,...(0,N.Jc)("Point",re)},X);const te=new T.ux(pe,F);te.collection=z,te.color=me,te.visible=he,E.addLayer(te),E._updateLayerVisibility(F,he),ye&&E.fitLayerBounds(F)}).apply(this,arguments)}_addSource(p,M,P){var E=this;return(0,B.A)(function*(F,z,X,J=!0){E._map&&(E._sources[F]=z,E._deleteSourceIfExists(F),E._sourceIds.push(F),E._map.getSource(F)&&E._map.removeSource(F),E._map.addSource(F,z),X&&E._addSourceLayer(F,X,J))}).apply(this,arguments)}_getBeforePointLayerId(){if(!this._map||0===this._pointLayerIds.size)return;const p=this._map.getStyle()?.layers??[];for(const M of p)if(this._pointLayerIds.has(M.id))return M.id}_getBeforeLineLayerId(){if(!this._map||0===this._lineLayerIds.size)return;const p=this._map.getStyle()?.layers??[];for(const M of p)if(this._lineLayerIds.has(M.id))return M.id}_addSourceLayer(p,M,P=!0){if(!this._map)return;this._layerClickable[M.id]=P,this._sourceLayers[p]||(this._sourceLayers[p]={layer:M,clickable:P});const E=M.type;if("circle"===E||"symbol"===E)this._pointLayerIds.add(M.id),this._map.addLayer(M);else if("line"===E){this._lineLayerIds.add(M.id);const F=this._getBeforePointLayerId();this._map.addLayer(M,F)}else{const F=this._getBeforeLineLayerId()??this._getBeforePointLayerId();this._map.addLayer(M,F)}P&&this._setLayerEvents(p,M)}_updateLayerVisibility(p,M){if(!this._map)return;const P=this._sourceLayers[p];P&&this._map.setLayoutProperty(P.layer.id,"visibility",M?"visible":"none")}getLayer(p){return this._layers$.getValue().find(M=>M.id===p)}updateLayer(p,M){const E=this._layers$.getValue().map(F=>{if(F.id===p){const z={...F,...M};return void 0!==M.visible&&this._updateLayerVisibility(p.toString(),M.visible),z}return F});this._layers$.next(E)}toggleAllLayers(){const p=this._layers$.getValue(),P=!p.some(F=>F.visible),E=p.map(F=>(this._updateLayerVisibility(F.id.toString(),P),{...F,visible:P}));this._layers$.next(E)}getVisibleLayersCount(){return this._layers$.getValue().filter(p=>p.visible).length}getTotalLayersCount(){return this._layers$.getValue().length}hasLayer(p){return this._layers$.getValue().some(M=>M.id===p)}fitGeoJSONBounds(p,M=50,P=!0,E=19){this._fitGeoJSONBounds(p,M,P,E)}fitLayerBounds(p,M=50){const P=this._layers$.getValue().find(E=>E.id===p);!P||!P.collection||!this._map||("features"in P.collection?this._fitGeoJSONBounds(P.collection,M):console.warn("Layer collection is not a FeatureCollection, cannot fit bounds."))}fitAllVisibleLayers(p=50){const M=this._layers$.getValue().filter(z=>z.visible&&z.collection);if(0===M.length||!this._map)return;const P=M.flatMap(z=>{const X=z.collection;return X&&"features"in X&&Array.isArray(X.features)?X.features:[]}),E=new m.o(P),F=v(E);F&&(E.bbox=F),this._fitGeoJSONBounds(E,p)}clearAllLayers(){if(this._map){for(const[p,M]of Object.entries(this._layerGroups))M.forEach(P=>{this._map.getLayer(P)&&this._map.removeLayer(P)}),this._map.getSource(p)&&this._map.removeSource(p);for(const p of this._sourceIds)this._layerGroups[p]||this._deleteSourceIfExists(p)}this._sourceIds=[],this._sourceLayers={},this._sources={},this._attachedListeners=[],this._layerGroups={},this._layerClickable={},this._layers$.next([])}reapplyLayers(){this._map&&(Object.keys(this._sources).forEach(p=>{this._deleteSourceIfExists(p),this._map.addSource(p,this._sources[p]);const M=this._sourceLayers[p];if(M){this._map.addLayer(M.layer);const P=this._layers$.getValue().find(E=>E.id===p);P&&this._updateLayerVisibility(p,P.visible)}}),this._reattachAllLayerEvents())}_extractColorFromLayer(p){if("paint"in p&&"object"==typeof p.paint){const M=p.paint;return M["circle-color"]||M["fill-color"]||M["line-color"]||""}return""}_fitGeoJSONBounds(p,M=50,P=!0,E=19){if(!this._map)return void console.warn("Map not initialized when trying to fit bounds");if(!p.features||0===p.features.length)return void console.warn("No features to fit bounds to");let F=p.bbox;if(!F){const z=v(p);if(!z)return void console.warn("Failed to calculate bbox for GeoJSON");p.bbox=z,F=z}if(F&&4===F.length)try{this._map.fitBounds([[F[0],F[1]],[F[2],F[3]]],{padding:M,maxZoom:E,animate:P})}catch(z){console.error("Error fitting bounds:",z)}}_deleteSourceIfExists(p){if(!this._map||!this._map.getSource(p))return;const P=this._layerGroups[p];if(P)P.forEach(E=>{this._map.getLayer(E)&&this._map.removeLayer(E)});else{const E=Object.values(this._sourceLayers).find(F=>"source"in F.layer&&F.layer.source===p);E&&this._map.getLayer(E.layer.id)&&(this._map.removeLayer(E.layer.id),this._attachedListeners=this._attachedListeners.filter(F=>F!==E.layer.id))}this._map.removeSource(p)}_setLayerEvents(p,M){if(!this._map)return;const P=M.id.endsWith("-fill"),E=M.id.endsWith("-stroke"),F=P?M.id.replace("-fill",""):E?M.id.replace("-stroke",""):M.id;if(P||E){const J=`${F}-stroke`;this._layerClickable[`${F}-fill`]=!0,this._layerClickable[J]=!0}if(!this._layerClickable[M.id])return;const z=[];if(P||E){const X=`${F}-fill`,J=`${F}-stroke`;this._map.getLayer(X)&&z.push(X),this._map.getLayer(J)&&z.push(J)}else z.push(M.id);z.forEach(X=>{this._attachedListeners.includes(X)||(this._map.on("click",X,J=>{if(!J.features||this._processedClickEvents.has(J.originalEvent))return;const re=J.features[0],ye=re.properties;if(ye&&!ye.cluster){const he=this.getLayer(p)||this.getLayer(F)||this.getLayer(X);if(he){const pe={...re,geometry:re.geometry};if(he.collection&&"features"in he.collection){const me=he.collection.features.find(te=>te.geometry.type===re.geometry?.type&&JSON.stringify(te.properties)===JSON.stringify(re.properties));me&&me.id&&(pe.id=me.id)}this._processedClickEvents.add(J.originalEvent),this.clickedFeature.next({feature:pe,event:J.originalEvent,layer:he,lngLat:J.lngLat})}}}),this._map.on("mouseenter",X,J=>{if(this._hoverSequence++,this._clearHoverTimeout&&(clearTimeout(this._clearHoverTimeout),this._clearHoverTimeout=void 0),!J.features)return;const re=J.features[0],ye=re.properties,he={...re,geometry:re.geometry};if(ye&&!ye.cluster){const pe=this.getLayer(p)||this.getLayer(F)||this.getLayer(X);if(pe){if(pe.collection&&"features"in pe.collection){const me=pe.collection.features.find(te=>te.geometry.type===re.geometry?.type&&JSON.stringify(te.properties)===JSON.stringify(re.properties));me&&me.id&&(he.id=me.id)}this.hoveredFeature.next({feature:he,event:J.originalEvent,layer:pe,lngLat:J.lngLat})}this._hoveredFeature.set(he)}}),this._map.on("mouseleave",X,()=>{const J=this._hoverSequence;this._clearHoverTimeout=window.setTimeout(()=>{this._hoverSequence===J&&(this._hoveredFeature.set(void 0),this.hoveredFeature.next(void 0)),this._clearHoverTimeout=void 0},50)}),this._map.on("click",X,J=>{if(!J.features)return;const re=J.features[0].properties;if(re&&re.cluster){const ye=this._map?.getZoom();ye&&this._map?.flyTo({center:J.lngLat,zoom:ye+1})}}),this._attachedListeners.push(X))})}_reattachAllLayerEvents(){this._attachedListeners=[],Object.keys(this._sourceLayers).forEach(p=>{const M=this._sourceLayers[p];M&&this._setLayerEvents(p,M.layer)})}static \u0275fac=function(M){return new(M||H)};static \u0275prov=_.jDH({token:H,factory:H.\u0275fac})}return H})()},8017(fe,Q,g){"use strict";g.d(Q,{T:()=>Pt});var B=g(467),_=g(5802),A=g(7705),$=g(2271),s=g(5547),T=g(9769),m=g(5970),G=g(6170),I=g(5949),O=g(2843),l=g(3646),y=g(9079),L=g(1413),w=g(2306),D=g(7089),v=g(9352),N=g(5381),V=g(5187),H=g(5971),j=g(3319);function p(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-button",5),s.nI1(1,"transloco"),s.bIt("click",function(){_.eBV(a);const h=s.XpG(2);return _.Njj(h.handleZoomFit())}),s.nrm(2,"cue-button-icon",9),s.k0s()}2&f&&s.Y8G("cueTooltip",s.bMT(1,1,"components.map.tooltipZoomFit"))}function M(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-flexcontainer",3)(1,"cue-button",5),s.nI1(2,"transloco"),s.bIt("click",function(){_.eBV(a);const h=s.XpG();return _.Njj(h.handleZoomOut())}),s.nrm(3,"cue-button-icon",6),s.k0s(),s.j41(4,"cue-button",5),s.nI1(5,"transloco"),s.bIt("click",function(){_.eBV(a);const h=s.XpG();return _.Njj(h.handleZoomIn())}),s.nrm(6,"cue-button-icon",7),s.k0s(),s.nVh(7,p,3,3,"cue-button",8),s.k0s()}if(2&f){const a=s.XpG();s.R7$(),s.Y8G("cueTooltip",s.bMT(2,3,"components.map.tooltipZoomOut")),s.R7$(3),s.Y8G("cueTooltip",s.bMT(5,5,"components.map.tooltipZoomIn")),s.R7$(3),s.vxM(a.displayZoomFit()?7:-1)}}function P(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(h){_.eBV(a);const k=s.XpG();return s.DH7(k.layersVisible,h)||(k.layersVisible=h),_.Njj(h)}),s.nrm(3,"cue-button-icon",11),s.k0s()}if(2&f){const a=s.XpG();s.AVh("border-left",a.options().displayZoom&&a.displayLayerToggle()),s.Y8G("cueTooltip",a.layersVisible()?s.bMT(1,6,"components.map.tooltipHideLayers"):s.bMT(2,8,"components.map.tooltipShowLayers"))("toggleButton",!0),s.R50("selected",a.layersVisible),s.R7$(3),s.Y8G("icon",a.layersVisible()?"layers-clear":"layers")}}function E(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(h){_.eBV(a);const k=s.XpG();return s.DH7(k.geoFenceDrawEnabled,h)||(k.geoFenceDrawEnabled=h),_.Njj(h)}),s.nrm(3,"cue-button-icon",12),s.k0s()}if(2&f){const a=s.XpG();s.AVh("border-left",a.options().displayGeofenceDraw),s.Y8G("cueTooltip",a.geoFenceDrawEnabled()?s.bMT(1,5,"components.map.tooltipEndDrawGeofence"):s.bMT(2,7,"components.map.tooltipDrawGeofence"))("toggleButton",!0),s.R50("selected",a.geoFenceDrawEnabled)}}let F=(()=>{class f{_service=(0,_.WQX)(I.u);layerService=(0,_.WQX)(l.B);mapLayers=(0,y.ot)(this.layerService.layers);options=(0,A.hFB)(new w.AA);zoom=(0,A.geq)(1);rotate=(0,A.CGW)();geoFenceDrawEnabled=(0,A.geq)(!1);layersVisible=(0,A.geq)(!1);hasLayers=(0,$.EW)(()=>void 0!==this.mapLayers()&&this.mapLayers().length>0);displayLayerToggle=(0,$.EW)(()=>this.options().displayLayerToggle&&this.hasLayers());displayZoomFit=(0,$.EW)(()=>this.options().displayZoom&&this.hasLayers());selectMenuPositions=(0,$.EW)(()=>"top"===this.options().position?"bottomleft":"topleft");handleZoomIn(){this._service.zoomIn()}handleZoomOut(){this._service.zoomOut()}handleZoomFit(){this._service.fitGeoJSONBBOX(void 0,.01)}static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-map-toolbar"]],inputs:{options:[1,"options"],zoom:[1,"zoom"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],layersVisible:[1,"layersVisible"]},outputs:{zoom:"zoomChange",rotate:"rotate",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",layersVisible:"layersVisibleChange"},decls:6,vars:4,consts:[["justify","center",1,"container"],[1,"toolbar",3,"padded"],["align","center"],["align","center","gap","s"],["size","xs","variant","ghost",3,"border-left","cueTooltip","toggleButton","selected"],["size","xs","variant","tertiary",3,"click","cueTooltip"],["icon","zoom-out"],["icon","zoom-in"],["size","xs","variant","tertiary",3,"cueTooltip"],["icon","zoom-fit"],["size","xs","variant","ghost",3,"selectedChange","cueTooltip","toggleButton","selected"],[3,"icon"],["icon","polygon"]],template:function(c,h){1&c&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-card",1)(2,"cue-flexcontainer",2),s.nVh(3,M,8,7,"cue-flexcontainer",3),s.nVh(4,P,4,10,"cue-button",4),s.nVh(5,E,4,9,"cue-button",4),s.k0s()()()),2&c&&(s.R7$(),s.Y8G("padded",!1),s.R7$(2),s.vxM(h.options().displayZoom?3:-1),s.R7$(),s.vxM(h.displayLayerToggle()?4:-1),s.R7$(),s.vxM(h.options().displayGeofenceDraw?5:-1))},dependencies:[N.n,V.Card,H.$,j.a,D.d,v.Kj],styles:[".container[_ngcontent-%COMP%]{width:100%;pointer-events:none}.toolbar[_ngcontent-%COMP%]{pointer-events:all;padding:5px 10px}.border-left[_ngcontent-%COMP%]{border-left:1px solid;padding-left:12px}"],changeDetection:0})}return f})();var z=g(7023),X=g(1024),J=g(9421);function re(f,S){if(1&f&&s.nrm(0,"cue-key-val",1),2&f){const a=S.$implicit;s.Y8G("key",a.key)("val",a.val)}}let ye=(()=>{class f{props=(0,A.hFB)(null);keyVals=(0,$.EW)(()=>{const a=this.props();return a?Object.entries(a).map(([c,h])=>({key:c,val:String(h)})):[]});static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-props-panel"]],inputs:{props:[1,"props"]},decls:4,vars:0,consts:[[2,"height","100%","overflow-y","auto"],[3,"key","val"]],template:function(c,h){1&c&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-key-val-list"),s.Z7z(2,re,1,2,"cue-key-val",1,s.Vm6),s.k0s()()),2&c&&(s.R7$(2),s.Dyx(h.keyVals()))},dependencies:[X.p,J.F,N.n],encapsulation:2,changeDetection:0})}return f})();var he=g(7517);let pe=(()=>{class f{layerService=(0,_.WQX)(l.B);mapLayers=(0,y.ot)(this.layerService.layers);layerDefs=(0,$.EW)(()=>{const a=this.mapLayers();return a?a.map(c=>({label:c.label,color:c.color??"#000000",visible:c.visible,category:c.category})):[]});updateSingle(a){const c=this.mapLayers()?.find(h=>h.label===a.label);c&&this.layerService.toggleVisibility(c.id)}updateAll(a){const c=this.mapLayers();if(c)for(const h of c)h.visible===a&&this.layerService.toggleVisibility(h.id)}static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-layer-panel"]],decls:1,vars:1,consts:[[3,"layerChange","visibilityAll","layers"]],template:function(c,h){1&c&&(s.j41(0,"cue-layer-legend",0),s.bIt("layerChange",function(K){return h.updateSingle(K)})("visibilityAll",function(K){return h.updateAll(K)}),s.k0s()),2&c&&s.Y8G("layers",h.layerDefs())},dependencies:[T.MD,he.P],encapsulation:2})}return f})();var me=g(140),te=g(6986);function ve(f){const S=f.flatMap(a=>{const c=function Oe(f){switch(f.type){case"Point":return[f.coordinates[0],f.coordinates[1]];case"MultiPoint":{if(!f.coordinates.length)return null;const S=f.coordinates.reduce((a,c)=>[a[0]+c[0],a[1]+c[1]],[0,0]);return[S[0]/f.coordinates.length,S[1]/f.coordinates.length]}case"LineString":{if(!f.coordinates.length)return null;const S=Math.floor(f.coordinates.length/2);return[f.coordinates[S][0],f.coordinates[S][1]]}case"MultiLineString":{if(!f.coordinates.length||!f.coordinates[0].length)return null;const S=f.coordinates[0],a=Math.floor(S.length/2);return[S[a][0],S[a][1]]}case"Polygon":{if(!f.coordinates.length||!f.coordinates[0].length)return null;const S=f.coordinates[0],a=S.reduce((c,h)=>[c[0]+h[0],c[1]+h[1]],[0,0]);return[a[0]/S.length,a[1]/S.length]}case"MultiPolygon":{if(!f.coordinates.length||!f.coordinates[0]?.length||!f.coordinates[0][0]?.length)return null;const S=f.coordinates[0][0],a=S.reduce((c,h)=>[c[0]+h[0],c[1]+h[1]],[0,0]);return[a[0]/S.length,a[1]/S.length]}default:return null}}(a.geometry);return c?[{type:"Feature",id:a.id,geometry:{type:"Point",coordinates:c},properties:{...a.properties??{},_isCentroid:!0}}]:[]});return[...f,...S]}const ut=["rgba(255, 0, 0, 0.5)","rgba(0, 0, 255, 0.5)","rgba(0, 255, 0, 0.5)","rgba(255, 165, 0, 0.5)","rgba(128, 0, 128, 0.5)","rgba(255, 192, 203, 0.5)","rgba(255, 255, 0, 0.5)"];function _t(f){const S=f.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d\.]+))?\)/);if(S)return{r:parseInt(S[1]),g:parseInt(S[2]),b:parseInt(S[3]),a:S[4]?parseFloat(S[4]):1};const a=f.match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/);if(a){const c=a[1];return{r:parseInt(3===c.length?c[0]+c[0]:c.slice(0,2),16),g:parseInt(3===c.length?c[1]+c[1]:c.slice(2,4),16),b:parseInt(3===c.length?c[2]+c[2]:c.slice(4,6),16),a:1}}return{r:0,g:0,b:0,a:1}}function je(f){if(0===f.length)return ut[0];if(1===f.length)return f[0].color;const S=f.map(ae=>({...ae,totalWeight:ae.featureCount*ae.weight})).sort((ae,ue)=>ue.totalWeight-ae.totalWeight),a=S.reduce((ae,ue)=>ae+ue.totalWeight,0),c=S[0];if(c.totalWeight/a>.6)return c.color;const h=S.slice(0,Math.min(3,S.length)),k=h.reduce((ae,ue)=>ae+ue.totalWeight,0);let K=0,oe=0,ne=0,de=0;for(const ae of h){const ue=_t(ae.color),_e=ae.totalWeight/k;K+=ue.r*_e,oe+=ue.g*_e,ne+=ue.b*_e,de+=ue.a*_e}return function dt(f,S,a,c=1){return c<1?`rgba(${Math.round(f)}, ${Math.round(S)}, ${Math.round(a)}, ${c})`:`rgb(${Math.round(f)}, ${Math.round(S)}, ${Math.round(a)})`}(K,oe,ne,de)}function Ze(f,S,a,c){if(!c||"Point"!==a&&"MultiPoint"!==a)return[{color:S,weight:1,featureCount:f.length}];const h=f.length;if(h<10)return[{color:S,weight:1,featureCount:h}];let k=0,K=0,oe=0;h>=750?(k=Math.floor(.1*h),K=Math.floor(.3*h),oe=h-k-K):h>=100?(K=Math.floor(.4*h),oe=h-K):(oe=Math.floor(.8*h),K=h-oe);const ne=[];return oe>0&&ne.push({color:S,weight:1,featureCount:oe}),K>0&&ne.push({color:"#f28cb1",weight:2,featureCount:K}),k>0&&ne.push({color:"#e2f552",weight:3,featureCount:k}),ne}function Qe(f,S,a,c,h,k){const K=Array.isArray(c)?c:[c];(0,te.j5)(h)?f.layerService.loadGeoJSONLayerGroup(S,a,K,{cluster:!1,zoomToFit:k.zoomToFit,visible:k.visible,label:k.label,color:k.color}):K.length>1||("Point"===h||"MultiPoint"===h)&&Array.isArray(K)&&K.length>1?f.layerService.loadGeoJSONLayerGroup(S,a,K,{cluster:(0,te.n7)(h,k.cluster),zoomToFit:k.zoomToFit,visible:k.visible,label:k.label,color:k.color}):f.loadGeoJSON(S,a,K[0],(0,te.n7)(h,k.cluster),k.zoomToFit)}var vt=g(6756),bt=g(356),ft=g(6279);const Xe=["map"],qe=f=>({position:"bottomleft",hoveredFeature:f}),Et=(f,S)=>S.label;function Mt(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-menu-item",6),s.bIt("click",function(h){const k=_.eBV(a).$implicit;return _.Njj(k.action(h))}),s.EFF(1),s.k0s()}if(2&f){const a=S.$implicit;s.R7$(),s.JRh(a.label)}}function Ct(f,S){if(1&f&&(s.j41(0,"cue-menu-wrap"),s.Z7z(1,Mt,2,1,"cue-menu-item",null,Et),s.k0s()),2&f){const a=s.XpG();s.R7$(),s.Dyx(a.contextMenuItems())}}function et(f,S){if(1&f&&(s.j41(0,"span"),s.EFF(1),s.k0s()),2&f){const a=s.XpG();s.R7$(),s.JRh(a.mapService.error())}}function Lt(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-map-toolbar",8),s.mxI("zoomChange",function(h){_.eBV(a);const k=s.XpG(2);return s.DH7(k.zoom,h)||(k.zoom=h),_.Njj(h)})("layersVisibleChange",function(h){_.eBV(a);const k=s.XpG(2);return s.DH7(k.layerPanelVisible,h)||(k.layerPanelVisible=h),_.Njj(h)})("geoFenceDrawEnabledChange",function(h){_.eBV(a);const k=s.XpG(2);return s.DH7(k.geoFenceDrawEnabled,h)||(k.geoFenceDrawEnabled=h),_.Njj(h)}),s.k0s()}if(2&f){const a=s.XpG(),c=s.XpG();s.Aen(c.toolbarStyle()),s.Y8G("options",a),s.R50("zoom",c.zoom)("layersVisible",c.layerPanelVisible)("geoFenceDrawEnabled",c.geoFenceDrawEnabled)}}function Tt(f,S){1&f&&s.nVh(0,Lt,1,6,"cue-map-toolbar",7),2&f&&s.vxM(S.hidden?-1:0)}function tt(f,S){1&f&&(s.j41(0,"cue-card",4),s.nrm(1,"cue-layer-panel"),s.k0s())}function Rt(f,S){1&f&&(s.j41(0,"cue-card",5),s.nrm(1,"cue-props-panel",9),s.k0s()),2&f&&(s.R7$(),s.Y8G("props",S))}function nt(f,S){if(1&f&&(s.j41(0,"div",11),s.EFF(1),s.k0s()),2&f){const a=S,c=s.XpG();s.xc7("left",a.x,"px")("top",a.y,"px"),s.R7$(),s.SpI(" ",c," ")}}function St(f,S){if(1&f&&s.nVh(0,nt,2,5,"div",10),2&f){let a;const c=s.XpG();s.vxM((a=c.hoveredTooltipPosition())?0:-1,a)}}let Pt=(()=>{class f{mapService=(0,_.WQX)(I.u);drawService=(0,_.WQX)(O.M);settings=(0,A.hFB)(new w.yY);center=(0,A.hFB)([8.5,47.4]);layerPanelVisible=(0,A.geq)(!1);zoom=(0,A.geq)(2);instruction=(0,A.geq)("Hello");layers=(0,A.hFB)([]);zoomToFit=(0,A.hFB)(!0);zoomToFitEachLayer=(0,A.hFB)(!1);splitLayersByGeometryType=(0,A.hFB)(!0);maxClickZoom=(0,A.hFB)(1/0);borderRadius=(0,A.hFB)("0");geoFenceDrawEnabled=(0,A.geq)(!1);contextMenuItemsBefore=(0,A.hFB)([]);contextMenuItemsAfter=(0,A.hFB)([]);immidiateDrawMode=(0,A.hFB)(void 0);hoverTooltipFn=(0,A.hFB)(null);mapReady=(0,A.CGW)();clickedMap=(0,A.CGW)();pannedMap=(0,A.CGW)();panningMap=(0,A.CGW)();zoomedMap=(0,A.CGW)();clickedFeature=(0,A.CGW)();hoveredFeature=(0,A.CGW)();drawEvent=(0,A.CGW)();layersSaturated=(0,$.EW)(()=>this.layers().map((a,c)=>{const h={...a};return h.color||(h.color=vt.BK[c]),h}));toolbarOptions=(0,$.EW)(()=>this.settings().toolbar);featureBeingHovered=(0,_.vPA)(void 0);lastClickedFeatureEvent=(0,_.vPA)(void 0);lastHoveredFeatureEvent=(0,_.vPA)(void 0);shownProperties=(0,_.vPA)(null);hoveredTooltipLabel=(0,$.EW)(()=>{const a=this.hoverTooltipFn();if(!a)return null;const c=this.lastHoveredFeatureEvent();return c?a(c.feature.properties??{})??null:null});hoveredTooltipPosition=(0,$.EW)(()=>{if(!this.hoveredTooltipLabel())return null;const a=this.lastHoveredFeatureEvent();if(!a)return null;const c=this.mapService.map;if(!c)return null;const h=c.project([a.lngLat.lng,a.lngLat.lat]);return{x:h.x,y:h.y}});_featureClickedThisTick=!1;_previousLayersHash=(0,_.vPA)("");_userHasInteracted=(0,_.vPA)(!1);toolbarStyle=(0,$.EW)(()=>{const a=this.toolbarOptions();return{position:"absolute",left:a.margin,right:a.margin,["top"===a.position?"top":"bottom"]:a.margin,"z-index":"10",display:"flex","justify-content":"center"}});contextMenuEnabled=(0,$.EW)(()=>{const a=this.contextMenuItems().length>0,c=this.featureBeingHovered(),h=this.lastClickedFeatureEvent();return a&&(void 0!==c||void 0!==h)});contextMenuItems=(0,$.EW)(()=>{const a=this.lastHoveredFeatureEvent(),c=this.lastClickedFeatureEvent(),k=(a?.feature||c?.feature)?.properties||null,K=k?Object.fromEntries(Object.entries(k).filter(([_e])=>!_e.startsWith("_"))):null,oe=a?.lngLat||c?.lngLat||null,de=[...this.contextMenuItemsBefore()||[]],ae=this.settings().contextMenu;K&&Object.keys(K).length>0&&ae.showProperties&&de.push({label:"Show properties",action:()=>{this.shownProperties.update(()=>K)}}),oe&&ae.showFlyTo&&de.push({label:"Fly to feature",action:()=>{this.mapService.flyTo([oe.lng,oe.lat],this.zoom())}});const ue=this.contextMenuItemsAfter()||[];return[...de,...ue]});_mapContainer;_destroy$=new L.B;constructor(){this._subscribeToServiceOutputs(),this._setupEffects(),(0,s.mal)(()=>{this._destroy$.closed||this._tryInitializeMap()})}ngOnDestroy(){this._destroy$.next(),this._destroy$.complete(),this.drawService.destroy(),this.mapService.destroy()}_subscribeToServiceOutputs(){this.mapService.mapReady.pipe((0,y.pQ)()).subscribe(()=>this.mapReady.emit()),this.mapService.clickedMap.pipe((0,y.pQ)()).subscribe(a=>{this._featureClickedThisTick||(this.lastClickedFeatureEvent.update(()=>{}),this.lastHoveredFeatureEvent.update(()=>{}),this.featureBeingHovered.update(()=>{}),this.clickedMap.emit(a),this.shownProperties.update(()=>null))}),this.mapService.pannedMap.pipe((0,y.pQ)()).subscribe(a=>{this._userHasInteracted.set(!0),this.pannedMap.emit(a)}),this.mapService.panningMap.pipe((0,y.pQ)()).subscribe(a=>this.panningMap.emit(a)),this.mapService.zoomedMap.pipe((0,y.pQ)()).subscribe(a=>{this._userHasInteracted.set(!0),this.zoomedMap.emit(this.mapService.getZoom()??this.zoom())}),this.mapService.clickedFeature.pipe((0,y.pQ)()).subscribe(a=>{this._featureClickedThisTick=!0,queueMicrotask(()=>{this._featureClickedThisTick=!1}),this.lastClickedFeatureEvent.update(()=>a),this.clickedFeature.emit(a);const c=a.feature?.geometry?.type,h="Point"===c||"MultiPoint"===c,k=this.mapService.getZoom()??0,K=this.contextMenuItems().length>0;h&&!K&&k<this.maxClickZoom()&&this.mapService.zoomToCoordinate(a.lngLat)}),this.mapService.hoveredFeature.pipe((0,y.pQ)()).subscribe(a=>{this.featureBeingHovered.update(()=>a?.feature),this.lastHoveredFeatureEvent.update(()=>a),this.hoveredFeature.emit(a)})}_setupEffects(){var a=this;(0,_.QZP)(()=>{"polygon"===this.immidiateDrawMode()&&(this.geoFenceDrawEnabled.set(!0),setTimeout(()=>{this.drawService.setDrawMode(!0,this.settings().toolbar.clearGeofenceAfterDraw)},500))}),(0,_.QZP)(()=>this.mapService.flyTo(this.center(),this.zoom())),(0,_.QZP)(()=>{const h=this.settings()?.mapboxToken;h&&"string"==typeof h&&""!==h.trim()&&!this.mapService.isMapReady()&&this._tryInitializeMap()}),(0,_.QZP)(()=>{const c=this.geoFenceDrawEnabled();this.drawService.setDrawMode(c,this.settings().toolbar.clearGeofenceAfterDraw)}),(0,_.QZP)(()=>{const c=this.drawService.drawEvent();void 0!==c&&this.drawEvent.emit(c)}),(0,_.QZP)((0,B.A)(function*(){const c=a.layersSaturated();if(!c||0===c.length)return;const h=a._createLayersHash(c);if(h===a._previousLayersHash())return;a._previousLayersHash.set(h),yield a.mapService.waitForMapReady(),a.mapService.clearLayers();const K=a.zoomToFitEachLayer();c.forEach((ne,de)=>{!function ke(f,S,a,c,h,k,K){const oe=S.collection,ne=S.color??ut[a];let de;de="geometries"in oe?function Re(f){const S=f.geometries.map((c,h)=>({type:"Feature",geometry:c,properties:{},id:f.id?`${f.id}_${h}`:void 0})),a=new me.o(S);return a.id=f.id,a.bbox=f.bbox,a}(oe):oe;const ae=function De(f){const S=[];return f.forEach(a=>{a.geometry&&"GeometryCollection"===a.geometry.type?a.geometry.geometries.forEach((c,h)=>{S.push({type:"Feature",geometry:c,properties:a.properties||{},id:a.id?`${a.id}_${h}`:void 0})}):S.push(a)}),S}(de.features),ue=new me.o(ae);ue.id=de.id,ue.bbox=de.bbox;let _e=ne;if(!k){const Z=S.id.toString(),q=ae[0]?.geometry?.type||"Point";_e=je(Ze(ae,ne,q,c));let be=K(Z,q,_e,Z),Pe=ue;const Be="Point"!==q&&"MultiPoint"!==q,Me=(0,te.j5)(q),ge=(0,te.dx)(q);if(c&&Be&&!Me&&!ge&&be){const rt=Array.isArray(be)?be:[be],se=ve(ae);Pe=new me.o(se),Pe.id=ue.id,Pe.bbox=ue.bbox,be=[(0,te.g8)(`${Z}-centroid`,Z,_e),...rt.map(it=>({...it,minzoom:te.A4}))]}return void(be&&Qe(f,Z,Pe,be,q,{cluster:c,zoomToFit:h,visible:!0,label:S.label||S.id.toString(),color:_e}))}if(k){const Z=new Set(ae.map(ie=>ie.geometry.type)),q=[];return Z.forEach(ie=>{const be=`${S.id.toString()}-${ie}`,Pe=ae.filter(ge=>ge.geometry.type===ie),Be=Ze(Pe,ne,ie,c);q.push(...Be);let Me=K(be,ie,ne,be);if(Me){let ge=new me.o(Pe);ge.id=ue.id,ge.bbox=ue.bbox;const rt="Point"!==ie&&"MultiPoint"!==ie,se=(0,te.j5)(ie),ot=(0,te.dx)(ie);if(c&&rt&&!se&&!ot){const it=Array.isArray(Me)?Me:[Me],It=ve(Pe);ge=new me.o(It),ge.id=ue.id,ge.bbox=ue.bbox,Me=[(0,te.g8)(`${be}-centroid`,be,ne),...it.map(st=>({...st,minzoom:te.A4}))]}Qe(f,be,ge,Me,ie,{cluster:c,zoomToFit:h,visible:!0,label:Z.size>1?`${S.label||S.id} (${ie})`:`${S.label||S.id}`,color:ne})}}),void(q.length>0&&(_e=je(q),f.layerService.getLayer(S.id.toString())&&f.layerService.updateLayer(S.id.toString(),{color:_e})))}const Ee=new Map;ae.forEach(Z=>{const q=Z.geometry.type;let ie;ie="Point"===q||"MultiPoint"===q?"Point":"LineString"===q||"MultiLineString"===q?"LineString":"Polygon"===q||"MultiPolygon"===q?"Polygon":q,Ee.has(ie)||Ee.set(ie,[]),Ee.get(ie).push(q)});const Ne=[];Ee.forEach((Z,q)=>{const ie=`${S.id.toString()}-${q}`,be=ae.filter(Me=>{const ge=Me.geometry.type;return"Point"===q?"Point"===ge||"MultiPoint"===ge:"LineString"===q?"LineString"===ge||"MultiLineString"===ge:"Polygon"===q?"Polygon"===ge||"MultiPolygon"===ge:ge===q}),Pe=Ze(be,ne,q,c);Ne.push(...Pe);const Be=K(ie,q,ne,ie);if(Be){const Me=new me.o(be);Me.id=ue.id,Me.bbox=ue.bbox,Qe(f,ie,Me,Be,q,{cluster:c,zoomToFit:h,visible:!0,label:Ee.size>1?`${S.label||S.id} (${q})`:`${S.label||S.id}`,color:ne})}}),Ne.length>0&&(_e=je(Ne),f.layerService.getLayer(S.id.toString())&&f.layerService.updateLayer(S.id.toString(),{color:_e}))}(a.mapService,ne,de,ne.cluster,K&&ne.zoomToFit,a.splitLayersByGeometryType(),te.Ln)});const oe=c.some(ne=>ne.zoomToFit);(a.zoomToFit()&&!K&&!a._userHasInteracted()||oe&&!K)&&a.mapService.fitGeoJSONBBOX()}))}_tryInitializeMap(){if(this._destroy$.closed)return;const c=this.settings()?.mapboxToken,h=c&&"string"==typeof c&&""!==c.trim(),k=this._mapContainer,K=!this.mapService.isMapReady();h&&k&&K&&(this._userHasInteracted.set(!1),this.mapService.init(this._mapContainer.nativeElement,c,this.center(),this.zoom(),this.borderRadius()))}_createLayersHash(a){return a.map(c=>{const h=c.collection;let k=0;return h&&"FeatureCollection"===h.type&&"features"in h&&(k=Array.isArray(h.features)?h.features.length:0),`${c.id}|${c.label}|${c.visible}|${k}`}).join("::")}static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-map"]],viewQuery:function(c,h){if(1&c&&s.GBs(Xe,5),2&c){let k;s.mGM(k=s.lsd())&&(h._mapContainer=k.first)}},hostAttrs:["data-component","cue-map-main"],inputs:{settings:[1,"settings"],center:[1,"center"],layerPanelVisible:[1,"layerPanelVisible"],zoom:[1,"zoom"],instruction:[1,"instruction"],layers:[1,"layers"],zoomToFit:[1,"zoomToFit"],zoomToFitEachLayer:[1,"zoomToFitEachLayer"],splitLayersByGeometryType:[1,"splitLayersByGeometryType"],maxClickZoom:[1,"maxClickZoom"],borderRadius:[1,"borderRadius"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],contextMenuItemsBefore:[1,"contextMenuItemsBefore"],contextMenuItemsAfter:[1,"contextMenuItemsAfter"],immidiateDrawMode:[1,"immidiateDrawMode"],hoverTooltipFn:[1,"hoverTooltipFn"]},outputs:{layerPanelVisible:"layerPanelVisibleChange",zoom:"zoomChange",instruction:"instructionChange",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",mapReady:"mapReady",clickedMap:"clickedMap",pannedMap:"pannedMap",panningMap:"panningMap",zoomedMap:"zoomedMap",clickedFeature:"clickedFeature",hoveredFeature:"hoveredFeature",drawEvent:"drawEvent"},features:[s.Jv_([I.u,O.M,l.B])],decls:10,vars:10,consts:[["hoveringFeature",""],["map",""],["direction","row",1,"container"],["id","map","cueResized","","cueDarkMode","","trigger","leftclick",3,"darkModeChange","resized","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"layer-panel"],[1,"props-panel"],[3,"click"],[3,"options","style","zoom","layersVisible","geoFenceDrawEnabled"],[3,"zoomChange","layersVisibleChange","geoFenceDrawEnabledChange","options","zoom","layersVisible","geoFenceDrawEnabled"],[3,"props"],[1,"hover-tooltip",3,"left","top"],[1,"hover-tooltip"]],template:function(c,h){if(1&c&&(s.DNE(0,Ct,3,0,"ng-template",null,0,s.C5r),s.j41(2,"cue-flexcontainer",2)(3,"div",3,1),s.bIt("darkModeChange",function(K){return h.mapService.setDarkMode(K)})("resized",function(){return h.mapService.onParentResize()}),s.k0s(),s.nVh(5,et,2,1,"span"),s.nVh(6,Tt,1,1),s.nVh(7,tt,2,0,"cue-card",4),s.nVh(8,Rt,2,1,"cue-card",5),s.nVh(9,St,1,1),s.k0s()),2&c){let k,K,oe;const ne=s.sdS(1);s.R7$(3),s.Y8G("cueContextMenu",ne)("contextMenuData",s.eq3(8,qe,h.lastHoveredFeatureEvent()))("cueContextEnabled",h.contextMenuEnabled()),s.R7$(2),s.vxM(h.mapService.error()?5:-1),s.R7$(),s.vxM((k=h.toolbarOptions())?6:-1,k),s.R7$(),s.vxM(h.layerPanelVisible()?7:-1),s.R7$(),s.vxM((K=h.shownProperties())?8:-1,K),s.R7$(),s.vxM((oe=h.hoveredTooltipLabel())?9:-1,oe)}},dependencies:[T.MD,m.C,G.R,F,z.Q,bt.M,ft.D,N.n,ye,pe,V.Card],styles:["#map[_ngcontent-%COMP%]{flex:1;min-height:0;border-radius:inherit;overflow:hidden}[_nghost-%COMP%]{display:flex;flex-direction:column;position:relative;width:100%;height:100%;min-height:400px;min-width:200px;flex:1 1 auto;align-self:stretch;box-sizing:border-box;overflow:hidden;border-radius:var(--cue-card-border-radius, inherit)}.mapboxgl-canvas-container[_ngcontent-%COMP%], .mapboxgl-canvas[_ngcontent-%COMP%]{border-radius:inherit!important}.mapboxgl-map[_ngcontent-%COMP%]{border-radius:inherit!important;overflow:hidden!important}.container[_ngcontent-%COMP%]{position:relative;width:100%;flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}.props-panel[_ngcontent-%COMP%]{position:absolute;top:8px;right:8px;bottom:8px;z-index:10}.layer-panel[_ngcontent-%COMP%]{position:absolute;top:10px;left:10px;z-index:10}cue-map-toolbar[_ngcontent-%COMP%]{position:absolute;left:0;right:0;bottom:0;z-index:10;display:flex;justify-content:center}.hover-tooltip[_ngcontent-%COMP%]{position:absolute;background:var(--cue-menu-background-color);color:var(--cue-menu-foreground-color);box-shadow:var(--cue-menu-box-shadow);border:1px solid var(--cue-menu-border-color);padding:3px 8px;border-radius:4px;font-family:var(--cue-font-family);font-size:.75rem;line-height:1.4;pointer-events:none;white-space:nowrap;z-index:20;transform:translate(-50%,calc(-100% - 8px))}"]})}return f})()},5949(fe,Q,g){"use strict";g.d(Q,{u:()=>G});var B=g(467),_=g(5802),A=g(2271),$=g(1413),s=g(3646),T=g(2843),m=g(9079);let G=(()=>{class I{_map;_mapContainer;_isInitializing=!1;_mapReadyPromiseResolve;_mapReady=new Promise(l=>{this._mapReadyPromiseResolve=l});_emittedReady=!1;_firstThemeReceived=!1;_hoveredFeature=(0,_.vPA)(void 0);_layerService=(0,_.WQX)(s.B);_drawService=(0,_.WQX)(T.M);mapboxToken=(0,_.vPA)("");center=(0,_.vPA)([8.5,47.4]);zoom=(0,_.vPA)(2);borderRadius=(0,_.vPA)("0");mapReady=new $.B;clickedMap=new $.B;pannedMap=new $.B;panningMap=new $.B;zoomedMap=new $.B;error=(0,_.vPA)("");get clickedFeature(){return this._layerService.clickedFeature}get hoveredFeature(){return this._layerService.hoveredFeature}get layers(){return this._layerService.layers}get layersSignal(){return this._layerService.layersSignal}get layerService(){return this._layerService}get drawService(){return this._drawService}get drawEvent(){return this._drawService.drawEvent}_darkMode=(0,_.vPA)(this._getSystemColorPreference());_styleId=(0,A.EW)(()=>this._darkMode()?"madsholten/clwjh4xeu00q601pnczm07jq6":"madsholten/clwjh6ug900q701pn6eor8p51");get map(){return this._map}constructor(){this._layerService.hoveredFeature.pipe((0,m.pQ)()).subscribe(l=>{this._hoveredFeature.set(l?.feature)}),(0,_.QZP)(()=>{this._styleId(),this._firstThemeReceived?void 0!==this._map&&this._updateStyle().catch(l=>{console.error("Failed to update map style:",l)}):this._firstThemeReceived=!0})}destroy(){if(this._layerService?.clearAllLayers(),this._drawService?.destroy(),this._map)try{this._map.remove()}catch(l){console.warn("Error removing map:",l)}this._map=void 0,this._mapContainer&&(this._mapContainer.innerHTML="",this._mapContainer=void 0),this._isInitializing=!1,this._emittedReady=!1,this._mapReady=new Promise(l=>{this._mapReadyPromiseResolve=l})}isMapReady(){return void 0!==this._map&&this._emittedReady&&!this._isInitializing}waitForMapReady(){var l=this;return(0,B.A)(function*(){return l._mapReady})()}init(l,y,L,w,D){var v=this;return(0,B.A)(function*(){if(y&&""!==y.trim())if(v._map||v._isInitializing)console.warn("MapService: Map is already initialized or currently initializing");else{v._isInitializing=!0,v.mapboxToken.set(y),v.center.set(L),v.zoom.set(w),v.borderRadius.set(D),v._mapContainer=l,v._mapContainer&&(v._mapContainer.innerHTML="");try{yield v._loadMapboxCSS();const N=yield g.e(1247).then(g.t.bind(g,1247,23)),V=N.default||N;if(!V||"function"!=typeof V.Map)throw new Error("Mapbox GL JS not properly loaded");V.accessToken=v.mapboxToken(),v._map=new V.Map({container:l,style:v._getMapStyleURL(),center:v.center(),zoom:v.zoom()}),v._applyBorderRadius(l),v._initEventListeners(v._map)}catch(N){console.error("Failed to load mapbox-gl:",N),v.error.set("Failed to load map library. Please ensure mapbox-gl is installed.")}finally{v._isInitializing=!1}}else console.warn("MapService: Cannot initialize map without valid mapbox token")})()}loadGeoJSON(l,y,L){var w=this;return(0,B.A)(function*(D,v,N,V=!0,H=!0){return yield w._mapReady,w._layerService.loadGeoJSONLayer(D,v,N,{cluster:V,zoomToFit:H,visible:!0,label:D})}).apply(this,arguments)}fitGeoJSONBBOX(l){var y=this;return(0,B.A)(function*(L,w=50,D=!0,v=19){yield y._mapReady,L?y._layerService.fitGeoJSONBounds(L,w,D,v):y._layerService.fitAllVisibleLayers(w)}).apply(this,arguments)}jumpTo(l,y){this._map?.jumpTo({center:l,zoom:y??this.zoom()})}setDarkMode(l){this._darkMode.set(l)}zoomToCoordinate(l){const y=this._map?.getZoom();if(!y)return;const L=y+1;this._map?.flyTo({center:l,zoom:L})}getZoom(){return this._map?.getZoom()}flyTo(l,y,L){this._map?.flyTo({center:l,zoom:y??this.zoom(),essential:!0,padding:L})}zoomIn(){if(!this._map)return;const l=this._map.getZoom();this._map.flyTo({zoom:l+1})}zoomOut(){if(!this._map)return;const l=this._map.getZoom();this._map.flyTo({zoom:l-1})}clearLayers(){this._layerService.clearAllLayers()}getImage(){const l=this._map?.getCanvas();if(void 0!==l)return l.toDataURL("image/png")}onParentResize(){this._map?.resize()}_loadMapboxCSS(){return(0,B.A)(function*(){return new Promise((l,y)=>{if(document.querySelector('link[href*="mapbox-gl.css"]'))return void l();const L=document.createElement("link");L.rel="stylesheet",L.href="https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css",L.onload=()=>l(),L.onerror=()=>{const w=document.createElement("link");w.rel="stylesheet",w.href="node_modules/mapbox-gl/dist/mapbox-gl.css",w.onload=()=>l(),w.onerror=()=>y(new Error("Failed to load Mapbox CSS")),document.head.appendChild(w)},document.head.appendChild(L)})})()}_applyBorderRadius(l){const y=this.borderRadius();let L=y;if("0"===y){const D=l.closest("cue-map")?.parentElement;D&&(L=getComputedStyle(D).borderRadius||"0")}"0"!==L&&(l.style.borderRadius=L,l.style.overflow="hidden",setTimeout(()=>{const w=l.querySelector(".mapboxgl-canvas"),D=l.querySelector(".mapboxgl-canvas-container"),v=l.querySelector(".mapboxgl-map");w&&(w.style.borderRadius=L),D&&(D.style.borderRadius=L),v&&(v.style.borderRadius=L)},100))}_initEventListeners(l){l.on("click",y=>{void 0===this._hoveredFeature()&&this.clickedMap.next(y)}),l.on("drag",y=>{void 0===this._hoveredFeature()&&this.panningMap.next(y)}),l.on("dragend",y=>{void 0===this._hoveredFeature()&&this.pannedMap.next(y)}),l.on("zoomend",y=>{this.zoomedMap.next(y)}),l.on("load",()=>{this._emittedReady||(this._layerService.initializeWithMap(l),this._drawService.initializeWithMap(l),this._mapReadyPromiseResolve(),this.mapReady.next(),this._emittedReady=!0)}),l.on("error",y=>{this.error.set(y.error.message)})}_getMapStyleURL(){return`mapbox://styles/${this._styleId()}`}_updateStyle(){var l=this;return(0,B.A)(function*(){if(void 0===l._map)return;const y=l._map.getZoom(),L=l._map.getCenter();void 0!==l._mapContainer&&(yield l.init(l._mapContainer,l.mapboxToken(),L,y,l.borderRadius()),setTimeout(()=>{l._layerService.reapplyLayers(),l._map?.flyTo({center:L,zoom:y})},500))})()}_getSystemColorPreference(){return typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches}static \u0275fac=function(y){return new(y||I)};static \u0275prov=_.jDH({token:I,factory:I.\u0275fac})}return I})()},2306(fe,Q,g){"use strict";g.d(Q,{AA:()=>$,ux:()=>s,yY:()=>A});var B=g(140),_=g(8402);class A{mapboxToken;contextMenu={showProperties:!0,showFlyTo:!0};toolbar=new $}class ${hidden=!1;position="bottom";margin="20px";displayZoom=!0;displayGeofenceDraw=!1;displayLayerToggle=!0;clearGeofenceAfterDraw=!0}class s{label;id;collection=new B.o;color;visible=!0;cluster=!0;zoomToFit=!0;category;constructor(m,G=(0,_.A)()){this.label=m,this.id=G}}},8334(fe,Q,g){"use strict";g.d(Q,{o:()=>$});var B=g(7705),_=g(5547);const A=["*"];let $=(()=>{class s{label=B.hFB.required();active=(0,B.geq)(!1);static \u0275fac=function(G){return new(G||s)};static \u0275cmp=_.VBU({type:s,selectors:[["cue-tab"]],hostVars:1,hostBindings:function(G,I){2&G&&_.Avn("hidden",!I.active())},inputs:{label:[1,"label"],active:[1,"active"]},outputs:{active:"activeChange"},ngContentSelectors:A,decls:1,vars:0,template:function(G,I){1&G&&(_.NAR(),_.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0}[hidden][_nghost-%COMP%]{display:none!important}"]})}return s})()},6455(fe,Q,g){"use strict";g.d(Q,{t:()=>w});var B=g(7705),_=g(5802),A=g(2271),$=g(8334),s=g(5187),T=g(9769),m=g(5547);const G=["*"],I=(D,v)=>v.label();function O(D,v){if(1&D&&(m.j41(0,"cue-card",1),m.eu8(1,2),m.k0s()),2&D){const N=m.XpG(),V=m.sdS(3);m.Y8G("variant",N._cardVariant())("padded",!1),m.R7$(),m.Y8G("ngTemplateOutlet",V)}}function l(D,v){if(1&D&&m.eu8(0,2),2&D){m.XpG();const N=m.sdS(3);m.Y8G("ngTemplateOutlet",N)}}function y(D,v){if(1&D){const N=m.RV6();m.j41(0,"button",6),m.bIt("click",function(){const H=_.eBV(N).$index,j=m.XpG(2);return _.Njj(j.setActive(H))}),m.EFF(1),m.k0s()}if(2&D){const N=v.$implicit,V=v.$index,H=m.XpG(2);m.AVh("active",H.activeIndex()===V),m.R7$(),m.SpI(" ",N.label()," ")}}function L(D,v){if(1&D&&(m.j41(0,"div",3),m.Z7z(1,y,2,3,"button",4,I),m.k0s(),m.j41(3,"div",5),m.SdG(4),m.k0s()),2&D){const N=m.XpG();m.R7$(),m.Dyx(N.tabs())}}let w=(()=>{class D{tabs=(0,B.tEk)($.o);activeIndex=(0,_.vPA)(0);variant=(0,B.hFB)("none");_cardVariant=(0,A.EW)(()=>"none"===this.variant()?"default":this.variant());constructor(){(0,_.QZP)(()=>{const N=this.tabs(),V=this.activeIndex();N.forEach((H,j)=>H.active.set(j===V))})}setActive(N){this.activeIndex.set(N)}static \u0275fac=function(V){return new(V||D)};static \u0275cmp=m.VBU({type:D,selectors:[["cue-tabs"]],contentQueries:function(V,H,j){1&V&&m.C6U(j,H.tabs,$.o,4),2&V&&m.NyB()},inputs:{variant:[1,"variant"]},ngContentSelectors:G,decls:4,vars:1,consts:[["inner",""],[2,"height","100%","width","100%","display","flex","flex-direction","column","overflow","hidden",3,"variant","padded"],[3,"ngTemplateOutlet"],[1,"tabs-header"],[1,"tab-button",3,"active"],[1,"tabs-content"],[1,"tab-button",3,"click"]],template:function(V,H){1&V&&(m.NAR(),m.nVh(0,O,2,3,"cue-card",1)(1,l,1,1,"ng-container",2),m.DNE(2,L,5,0,"ng-template",null,0,m.C5r)),2&V&&m.vxM("none"!==H.variant()?0:1)},dependencies:[s.Card,T.T3],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;box-sizing:border-box;border-radius:var(--cue-card-border-radius);border:1px solid var(--cue-card-border-color);background-color:var(--cue-default);color:var(--cue-defaultContrast);overflow:hidden}.tabs-header[_ngcontent-%COMP%]{display:flex;border-bottom:1px solid var(--cue-card-border-color);background-color:var(--background-color, var(--cue-default))}.tab-button[_ngcontent-%COMP%]{padding:10px 16px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;color:inherit;font-family:var(--cue-font-family);font-size:var(--cue-font-s-size);line-height:var(--cue-font-s-line-height);opacity:.6;transition:opacity .15s,border-bottom-color .15s}.tab-button[_ngcontent-%COMP%]:hover{opacity:.9}.tab-button.active[_ngcontent-%COMP%]{border-bottom-color:currentColor;opacity:1;font-weight:500}.tabs-content[_ngcontent-%COMP%]{padding:var(--cue-card-padding-y) var(--cue-card-padding-x);flex:1;min-height:0;box-sizing:border-box;display:flex;flex-direction:column}"]})}return D})()},140(fe,Q,g){"use strict";g.d(Q,{o:()=>B});class B{type="FeatureCollection";features=[];bbox;id;constructor(A=[]){this.features=A}addFeature(A){this.features.push(A)}removeFeature(A){return this.features.splice(A,1)[0]}getFeatureCount(){return this.features.length}clear(){this.features=[]}}},58(fe,Q,g){"use strict";function B(l){let y=0,L=-1,w=-1;for(let D=0;D<l.length;D++)if("("===l[D])y++,1===y&&(L=D+1);else if(")"===l[D]&&(y--,0===y)){w=D;break}return-1!==L&&-1!==w?l.substring(L,w):null}g.d(Q,{S:()=>I,n:()=>O});class _{x;y;z;constructor(y,L,w){this.x=y,this.y=L,this.z=w}}class A{points;constructor(y){this.points=y}}class ${lines;constructor(y){this.lines=y}}function I(l){if(l){if((l=l.trim().toUpperCase()).startsWith("POINT"))return function T(l){l=l.trim().toUpperCase();const L=B(l)?.split(" ")??[];return l.includes("POINT Z")?new _(parseFloat(L[0]),parseFloat(L[1]),parseFloat(L[2])):new _(parseFloat(L[0]),parseFloat(L[1]))}(l);if(l.startsWith("LINESTRING"))return function s(l){const y=B(l=l.trim().toUpperCase()),L=[];return y?.split(",").map(w=>w.trim().split(" ").map(D=>parseFloat(D))).map(w=>{L.push(new _(w[0],w[1],w[2]))}),new A(L)}(l);if(l.startsWith("POLYGON"))return function m(l){const y=B(l=l.trim().toUpperCase());if(!y)return new $([]);const L=y.match(/\(([^)]+)\)/g);if(!L)return new $([]);const w=L.map(D=>{const v=B(D);return v?v.split(",").map(N=>{const V=N.trim().split(" ");return V.length>=3?new _(parseFloat(V[0]),parseFloat(V[1]),parseFloat(V[2])):new _(parseFloat(V[0]),parseFloat(V[1]))}):[]});return new $(w)}(l)}}function O(l){if(l instanceof _)return{type:"Point",coordinates:void 0!==l.z?[l.x,l.y,l.z]:[l.x,l.y]};if(l instanceof A)return{type:"LineString",coordinates:l.points.map(y=>void 0!==y.z?[y.x,y.y,y.z]:[y.x,y.y])};if(l instanceof $)return{type:"Polygon",coordinates:l.lines.map(y=>y.map(L=>void 0!==L.z?[L.x,L.y,L.z]:[L.x,L.y]))};throw new Error("Unknown WKT type")}},362(fe){"use strict";fe.exports=function Q(g,B){if(g===B)return!0;if(g&&B&&"object"==typeof g&&"object"==typeof B){if(g.constructor!==B.constructor)return!1;var _,A,$;if(Array.isArray(g)){if((_=g.length)!=B.length)return!1;for(A=_;0!==A--;)if(!Q(g[A],B[A]))return!1;return!0}if(g.constructor===RegExp)return g.source===B.source&&g.flags===B.flags;if(g.valueOf!==Object.prototype.valueOf)return g.valueOf()===B.valueOf();if(g.toString!==Object.prototype.toString)return g.toString()===B.toString();if((_=($=Object.keys(g)).length)!==Object.keys(B).length)return!1;for(A=_;0!==A--;)if(!Object.prototype.hasOwnProperty.call(B,$[A]))return!1;for(A=_;0!==A--;){var s=$[A];if(!Q(g[s],B[s]))return!1}return!0}return g!=g&&B!=B}},5332(fe,Q,g){"use strict";g.d(Q,{k:()=>$});for(var _=[],A=0;A<256;++A)_.push((A+256).toString(16).slice(1));function $(m,G=0){return(_[m[G+0]]+_[m[G+1]]+_[m[G+2]]+_[m[G+3]]+"-"+_[m[G+4]]+_[m[G+5]]+"-"+_[m[G+6]]+_[m[G+7]]+"-"+_[m[G+8]]+_[m[G+9]]+"-"+_[m[G+10]]+_[m[G+11]]+_[m[G+12]]+_[m[G+13]]+_[m[G+14]]+_[m[G+15]]).toLowerCase()}},8402(fe,Q,g){"use strict";g.d(Q,{A:()=>G});const _={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var A,$=new Uint8Array(16);function s(){if(!A&&!(A=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return A($)}var T=g(5332);const G=function m(I,O,l){if(_.randomUUID&&!O&&!I)return _.randomUUID();var y=(I=I||{}).random||(I.rng||s)();if(y[6]=15&y[6]|64,y[8]=63&y[8]|128,O){l=l||0;for(var L=0;L<16;++L)O[l+L]=y[L];return O}return(0,T.k)(y)}},6119(fe){fe.exports.RADIUS=6378137,fe.exports.FLATTENING=1/298.257223563,fe.exports.POLAR_RADIUS=6356752.3142}}]);
1
+ (self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[5872],{503(fe,Q,g){var B=g(6119);function A(T){var m=0;if(T&&T.length>0){m+=Math.abs($(T[0]));for(var G=1;G<T.length;G++)m-=Math.abs($(T[G]))}return m}function $(T){var m,G,O,l,y,L,w=0,D=T.length;if(D>2){for(L=0;L<D;L++)L===D-2?(O=D-2,l=D-1,y=0):L===D-1?(O=D-1,l=0,y=1):(O=L,l=L+1,y=L+2),m=T[O],G=T[l],w+=(s(T[y][0])-s(m[0]))*Math.sin(s(G[1]));w=w*B.RADIUS*B.RADIUS/2}return w}function s(T){return T*Math.PI/180}fe.exports.geometry=function _(T){var G,m=0;switch(T.type){case"Polygon":return A(T.coordinates);case"MultiPolygon":for(G=0;G<T.coordinates.length;G++)m+=A(T.coordinates[G]);return m;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(G=0;G<T.geometries.length;G++)m+=_(T.geometries[G]);return m}},fe.exports.ring=$},5341(fe){fe.exports=function g(B){if(!B||!B.type)return null;var _=Q[B.type];return _?"geometry"===_?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:B}]}:"feature"===_?{type:"FeatureCollection",features:[B]}:"featurecollection"===_?B:void 0:null};var Q={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},6756(fe,Q,g){"use strict";g.d(Q,{BK:()=>B,In:()=>I,Kz:()=>O,Mc:()=>y,U6:()=>A,g0:()=>L,g8:()=>$,r:()=>_,u9:()=>T});const B=["#2B5DE6","#1A2B50","#C5E045","#6FA8FF","#00C2E0","#5847EB","#008585","#4ADE80","#0F4C81","#8B5CF6","#FACC15","#FB923C","#F43F5E","#E879F9","#D97706","#334155","#64748B","#94A3B8","#C7D2FE","#F8FAFC"];function _(v){switch(v){case"primary":default:return"#2859e1";case"accent":return"#e2f552";case"tertiary":return"#ffffff"}}function A(v){switch(v){case"primary":default:return"#1744c2";case"accent":return"#b8cc3f";case"tertiary":return"#eeeeee"}}function $(v){const[N,V,H]=function s(v,N){if(void 0===v)return[];const H=window.getComputedStyle(v.nativeElement);return N.map(j=>H.getPropertyValue(j).trim()||"")}(v,["--cue-chart-text-color","--cue-chart-border-background-color","--chart-graph-edge-color"]);return{text:N,borderBackground:V,edgeColor:H}}const T={fontFamily:"Poppins, sans-serif",fontWeight:"normal",color:"#333"};function I(v){return v>=1e6?`${(v/1e6).toFixed(1)}m`:v>=1e3?`${(v/1e3).toFixed(0)}k`:v.toString()}function O(v,N,V,H){if(1===H)return v;const j=w(v),p=w(N),M=V/(H-1);return`rgb(${Math.round(j.r+(p.r-j.r)*M)}, ${Math.round(j.g+(p.g-j.g)*M)}, ${Math.round(j.b+(p.b-j.b)*M)})`}const y=(v,N)=>void 0===N?v:N.children??[];function L(v,N,V=.05,H="Other"){const j=v.reduce((P,E)=>P+D(E),0),p=[],M=[];if(v.forEach(P=>{let E,F;E=void 0===P.value&&Array.isArray(P.children)&&P.children.length>0?P.children.reduce((X,J)=>X+D(J),0):void 0!==P.value?P.value:0,Array.isArray(P.children)&&P.children.length>0&&(F=L(P.children,N,V,H));const z={...P,value:E,children:F};N&&j>0&&E/j<V?M.push(z):p.push(z)}),N&&M.length>0){const P=M.reduce((E,F)=>E+F.value,0);p.push({id:"__grouped_small__",name:H,value:P,children:M,isGroup:!0})}return p}function w(v){const N=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(v);return N?{r:parseInt(N[1],16),g:parseInt(N[2],16),b:parseInt(N[3],16)}:{r:0,g:0,b:0}}function D(v){return"number"==typeof v.value?v.value:Array.isArray(v.children)&&v.children.length>0?v.children.reduce((N,V)=>N+D(V),0):0}},7517(fe,Q,g){"use strict";g.d(Q,{P:()=>L});var B=g(7705),_=g(2271),A=g(2245),$=g(1359),s=g(5381),T=g(5547),m=g(5802);const G=(w,D)=>D.category;function I(w,D){if(1&w){const v=T.RV6();T.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",2),T.bIt("checkedChange",function(){m.eBV(v);const V=T.XpG();return m.Njj(V.toggleAll())}),T.k0s()()}if(2&w){const v=T.XpG();T.R7$(),T.Y8G("checked",v.allVisible())}}function O(w,D){if(1&w&&(T.j41(0,"cue-typography",3),T.EFF(1),T.k0s()),2&w){const v=T.XpG().$implicit;T.R7$(),T.JRh(v.category)}}function l(w,D){if(1&w){const v=T.RV6();T.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",4),T.bIt("checkedChange",function(){const V=m.eBV(v).$implicit,H=T.XpG(2);return m.Njj(H.toggleSingle(V))}),T.k0s(),T.j41(2,"cue-typography",5),T.bIt("click",function(){const V=m.eBV(v).$implicit,H=T.XpG(2);return m.Njj(H.toggleSingle(V))}),T.EFF(3),T.k0s()()}if(2&w){const v=D.$implicit;T.R7$(),T.Y8G("checked",v.visible)("color",v.color),T.R7$(2),T.JRh(v.label)}}function y(w,D){if(1&w&&(T.nVh(0,O,2,1,"cue-typography",3),T.Z7z(1,l,4,3,"cue-flexcontainer",1,T.Vm6)),2&w){const v=D.$implicit;T.vxM(v.category?0:-1),T.R7$(),T.Dyx(v.items)}}let L=(()=>{class w{layers=(0,B.geq)([]);visibilityChange=(0,B.CGW)();layerChange=(0,B.CGW)();visibilityAll=(0,B.CGW)();showCheckAll=(0,_.EW)(()=>this.layers().length>1);allVisible=(0,_.EW)(()=>this.layers().every(v=>v.visible));groupedLayers=(0,_.EW)(()=>{const v=[];for(const N of this.layers()){const V=N.category,H=v.find(j=>j.category===V);H?H.items.push(N):v.push({category:V,items:[N]})}return v});toggleAll(){const v=this.allVisible(),N=this.layers().map(V=>(V.visible=!v,V));this.layers.update(()=>[...N]),this.visibilityAll.emit(v),this.emitChange()}toggleSingle(v){v.visible=!v.visible,this.layerChange.emit(v),this.layers.update(()=>[...this.layers()]),this.emitChange()}emitChange(){this.visibilityChange.emit(this.layers())}static \u0275fac=function(N){return new(N||w)};static \u0275cmp=T.VBU({type:w,selectors:[["cue-layer-legend"]],inputs:{layers:[1,"layers"]},outputs:{layers:"layersChange",visibilityChange:"visibilityChange",layerChange:"layerChange",visibilityAll:"visibilityAll"},decls:4,vars:1,consts:[["direction","column"],["align","center","justify","start",2,"width","100%"],["size","s",3,"checkedChange","checked"],["variant","label",2,"margin-top","4px","opacity","0.6"],["size","s",3,"checkedChange","checked","color"],[2,"cursor","pointer",3,"click"]],template:function(N,V){1&N&&(T.j41(0,"cue-flexcontainer",0),T.nVh(1,I,2,1,"cue-flexcontainer",1),T.Z7z(2,y,3,1,null,null,G),T.k0s()),2&N&&(T.R7$(),T.vxM(V.showCheckAll()?1:-1),T.R7$(),T.Dyx(V.groupedLayers()))},dependencies:[s.FlexContainer,A.Typography,$.Checkbox],encapsulation:2,changeDetection:0})}return w})()},2843(fe,Q,g){"use strict";g.d(Q,{M:()=>Wn});var B={};g.r(B),g.d(B,{LAT_MAX:()=>V,LAT_MIN:()=>v,LAT_RENDERED_MAX:()=>H,LAT_RENDERED_MIN:()=>N,LNG_MAX:()=>p,LNG_MIN:()=>j,activeStates:()=>w,classes:()=>s,cursors:()=>m,events:()=>l,geojsonTypes:()=>I,interactions:()=>D,meta:()=>L,modes:()=>O,sources:()=>T,types:()=>G,updateActions:()=>y});var _={};g.r(_),g.d(_,{isActiveFeature:()=>E,isBackspaceKey:()=>pe,isDeleteKey:()=>me,isDigit1Key:()=>te,isDigit2Key:()=>$e,isDigit3Key:()=>Oe,isDigitKey:()=>ve,isEnterKey:()=>he,isEscapeKey:()=>ye,isFeature:()=>X,isInactiveFeature:()=>F,isOfMetaType:()=>M,isShiftDown:()=>re,isShiftMousedown:()=>P,isTrue:()=>ct,isVertex:()=>J,noTarget:()=>z});var A={};g.r(A),g.d(A,{CommonSelectors:()=>_,ModeHandler:()=>nt,StringSet:()=>De,constrainFeatureMovement:()=>Dt,createMidPoint:()=>nn,createSupplementaryPoints:()=>At,createVertex:()=>Je,doubleClickZoom:()=>Ie,euclideanDistance:()=>qe,featuresAt:()=>ke,getFeatureAtAndSetCursors:()=>Xe,isClick:()=>et,isEventAtCoordinates:()=>mt,isTap:()=>tt,mapEventToBoundingBox:()=>Ze,moveFeatures:()=>Nt,sortFeatures:()=>dt,stringSetsAreEqual:()=>pn,theme:()=>Gt,toDenseArray:()=>ge});var $=g(5802);const s={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},T={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},m={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},G={POLYGON:"polygon",LINE:"line_string",POINT:"point"},I={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},O={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},l={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},y={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},L={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},w={ACTIVE:"true",INACTIVE:"false"},D=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],v=-90,N=-85,V=90,H=85,j=-270,p=270;function M(e){return function(t){const n=t.featureTarget;return!(!n||!n.properties)&&n.properties.meta===e}}function P(e){return!(!e.originalEvent||!e.originalEvent.shiftKey)&&0===e.originalEvent.button}function E(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===w.ACTIVE&&e.featureTarget.properties.meta===L.FEATURE}function F(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===w.INACTIVE&&e.featureTarget.properties.meta===L.FEATURE}function z(e){return void 0===e.featureTarget}function X(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.meta===L.FEATURE}function J(e){const t=e.featureTarget;return!(!t||!t.properties)&&t.properties.meta===L.VERTEX}function re(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}function ye(e){return"Escape"===e.key||27===e.keyCode}function he(e){return"Enter"===e.key||13===e.keyCode}function pe(e){return"Backspace"===e.key||8===e.keyCode}function me(e){return"Delete"===e.key||46===e.keyCode}function te(e){return"1"===e.key||49===e.keyCode}function $e(e){return"2"===e.key||50===e.keyCode}function Oe(e){return"3"===e.key||51===e.keyCode}function ve(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function ct(){return!0}var He=g(503);const Ae={Point:0,LineString:1,MultiLineString:1,Polygon:2};function ut(e,t){const n=Ae[e.geometry.type]-Ae[t.geometry.type];return 0===n&&e.geometry.type===I.POLYGON?e.area-t.area:n}const dt=function _t(e){return e.map(t=>(t.geometry.type===I.POLYGON&&(t.area=He.geometry({type:I.FEATURE,property:{},geometry:t.geometry})),t)).sort(ut).map(t=>(delete t.area,t))},Ze=function je(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]};function Re(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,n=e.length;t<n;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}Re.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},Re.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},Re.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},Re.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,n)=>t.v-n.v).map(t=>t.k)},Re.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const De=Re,Qe=[L.FEATURE,L.MIDPOINT,L.VERTEX],ke={click:function vt(e,t,n){return ft(e,t,n,n.options.clickBuffer)},touch:function bt(e,t,n){return ft(e,t,n,n.options.touchBuffer)}};function ft(e,t,n,r){if(null===n.map)return[];const o=e?Ze(e,r):t,i={};n.options.styles&&(i.layers=n.options.styles.map(x=>x.id).filter(x=>null!=n.map.getLayer(x)));const u=n.map.queryRenderedFeatures(o,i).filter(x=>-1!==Qe.indexOf(x.properties.meta)),b=new De,d=[];return u.forEach(x=>{const W=x.properties.id;b.has(W)||(b.add(W),d.push(x))}),dt(d)}function Xe(e,t){const n=ke.click(e,null,t),r={mouse:m.NONE};return n[0]&&(r.mouse=n[0].properties.active===w.ACTIVE?m.MOVE:m.POINTER,r.feature=n[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(r.mouse=m.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),n[0]}function qe(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function et(e,t,n={}){const r=null!=n.fineTolerance?n.fineTolerance:4,o=null!=n.grossTolerance?n.grossTolerance:12,i=null!=n.interval?n.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;const u=qe(e.point,t.point);return u<r||u<o&&t.time-e.time<i}function tt(e,t,n={}){const r=null!=n.tolerance?n.tolerance:25,o=null!=n.interval?n.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,qe(e.point,t.point)<r&&t.time-e.time<o}const nt=function(e,t){const n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(i,u,b){if(void 0===n[i])throw new Error(`Invalid event type: ${i}`);n[i].push({selector:u,fn:b})},render(i){t.store.featureChanged(i)}},o=function(i,u){const b=n[i];let d=b.length;for(;d--;){const x=b[d];if(x.selector(u)){x.fn.call(r,u)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(i){o("drag",i)},click(i){o("click",i)},mousemove(i){o("mousemove",i)},mousedown(i){o("mousedown",i)},mouseup(i){o("mouseup",i)},mouseout(i){o("mouseout",i)},keydown(i){o("keydown",i)},keyup(i){o("keyup",i)},touchstart(i){o("touchstart",i)},touchmove(i){o("touchmove",i)},touchend(i){o("touchend",i)},tap(i){o("tap",i)}}},S=((e,t=21)=>(n=t)=>{let r="",o=0|n;for(;o--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function a(){return S()}const c=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||a(),this.type=t.geometry.type};c.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},c.prototype.incomingCoords=function(e){this.setCoordinates(e)},c.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},c.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},c.prototype.setProperty=function(e,t){this.properties[e]=t},c.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:I.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},c.prototype.internal=function(e){const t={id:this.id,meta:L.FEATURE,"meta:type":this.type,active:w.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const n in this.properties)t[`user_${n}`]=this.properties[n];return{type:I.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const h=c,k=function(e,t){h.call(this,e,t)};(k.prototype=Object.create(h.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},k.prototype.updateCoordinate=function(e,t,n){this.coordinates=3===arguments.length?[t,n]:[e,t],this.changed()},k.prototype.getCoordinate=function(){return this.getCoordinates()};const K=k,oe=function(e,t){h.call(this,e,t)};(oe.prototype=Object.create(h.prototype)).isValid=function(){return this.coordinates.length>1},oe.prototype.addCoordinate=function(e,t,n){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,n])},oe.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},oe.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},oe.prototype.updateCoordinate=function(e,t,n){const r=parseInt(e,10);this.coordinates[r]=[t,n],this.changed()};const ne=oe,de=function(e,t){h.call(this,e,t),this.coordinates=this.coordinates.map(n=>n.slice(0,-1))};(de.prototype=Object.create(h.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every(e=>e.length>2)},de.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()},de.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},de.prototype.addCoordinate=function(e,t,n){this.changed();const r=e.split(".").map(i=>parseInt(i,10));this.coordinates[r[0]].splice(r[1],0,[t,n])},de.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))},de.prototype.getCoordinate=function(e){const t=e.split(".").map(r=>parseInt(r,10));return JSON.parse(JSON.stringify(this.coordinates[t[0]][t[1]]))},de.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))},de.prototype.updateCoordinate=function(e,t,n){this.changed();const r=e.split("."),o=parseInt(r[0],10),i=parseInt(r[1],10);void 0===this.coordinates[o]&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,n]};const ae=de,ue={MultiPoint:K,MultiLineString:ne,MultiPolygon:ae},_e=(e,t,n,r,o)=>{const i=n.split("."),u=parseInt(i[0],10),b=i[1]?i.slice(1).join("."):null;return e[u][t](b,r,o)},Ee=function(e,t){if(h.call(this,e,t),delete this.coordinates,this.model=ue[t.geometry.type],void 0===this.model)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};(Ee.prototype=Object.create(h.prototype))._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(n=>new t(this.ctx,{id:a(),type:I.FEATURE,properties:{},geometry:{coordinates:n,type:this.type.replace("Multi","")}}))},Ee.prototype.isValid=function(){return this.features.every(e=>e.isValid())},Ee.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},Ee.prototype.getCoordinate=function(e){return _e(this.features,"getCoordinate",e)},Ee.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===I.POLYGON?e.getCoordinates():e.coordinates)))},Ee.prototype.updateCoordinate=function(e,t,n){_e(this.features,"updateCoordinate",e,t,n),this.changed()},Ee.prototype.addCoordinate=function(e,t,n){_e(this.features,"addCoordinate",e,t,n),this.changed()},Ee.prototype.removeCoordinate=function(e){_e(this.features,"removeCoordinate",e),this.changed()},Ee.prototype.getFeatures=function(){return this.features};const Ne=Ee;function Z(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}Z.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},Z.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,n)=>(void 0===t[n.feature_id]&&(t[n.feature_id]=!0,this._ctx.store.get(n.feature_id).changed()),t),{})},Z.prototype.getSelected=function(){return this._ctx.store.getSelected()},Z.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},Z.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},Z.prototype.getFeature=function(e){return this._ctx.store.get(e)},Z.prototype.select=function(e){return this._ctx.store.select(e)},Z.prototype.deselect=function(e){return this._ctx.store.deselect(e)},Z.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},Z.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},Z.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},Z.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},Z.prototype.setActionableState=function(e={}){return this._ctx.events.actionable({trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1})},Z.prototype.changeMode=function(e,t={},n={}){return this._ctx.events.changeMode(e,t,n)},Z.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},Z.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},Z.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},Z.prototype.featuresAt=function(e,t,n="click"){if("click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return ke[n](e,t,this._ctx)},Z.prototype.newFeature=function(e){const t=e.geometry.type;return t===I.POINT?new K(this._ctx,e):t===I.LINE_STRING?new ne(this._ctx,e):t===I.POLYGON?new ae(this._ctx,e):new Ne(this._ctx,e)},Z.prototype.isInstanceOf=function(e,t){if(e===I.POINT)return t instanceof K;if(e===I.LINE_STRING)return t instanceof ne;if(e===I.POLYGON)return t instanceof ae;if("MultiFeature"===e)return t instanceof Ne;throw new Error(`Unknown feature class: ${e}`)},Z.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};const q=Z;Z.prototype.onSetup=function(){},Z.prototype.onDrag=function(){},Z.prototype.onClick=function(){},Z.prototype.onMouseMove=function(){},Z.prototype.onMouseDown=function(){},Z.prototype.onMouseUp=function(){},Z.prototype.onMouseOut=function(){},Z.prototype.onKeyUp=function(){},Z.prototype.onKeyDown=function(){},Z.prototype.onTouchStart=function(){},Z.prototype.onTouchMove=function(){},Z.prototype.onTouchEnd=function(){},Z.prototype.onTap=function(){},Z.prototype.onStop=function(){},Z.prototype.onTrash=function(){},Z.prototype.onCombineFeature=function(){},Z.prototype.onUncombineFeature=function(){},Z.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const ie={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},be=Object.keys(ie);const ge=function Me(e){return[].concat(e).filter(t=>void 0!==t)};function rt(){const e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(T.HOT))return d();const n=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:n});let r=[],o=[];e.isDirty?o=e.getAllIds():(r=e.getChangedIds().filter(x=>void 0!==e.get(x)),o=e.sources.hot.filter(x=>x.properties.id&&-1===r.indexOf(x.properties.id)&&void 0!==e.get(x.properties.id)).map(x=>x.properties.id)),e.sources.hot=[];const i=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(x=>-1===r.indexOf(x.properties.id||x.properties.parent));const u=i!==e.sources.cold.length||o.length>0;function b(x,W){const C=e.get(x).internal(n);e.ctx.events.currentModeRender(C,R=>{R.properties.mode=n,e.sources[W].push(R)})}function d(){e.isDirty=!1,e.clearChangedIds()}r.forEach(x=>b(x,"hot")),o.forEach(x=>b(x,"cold")),u&&e.ctx.map.getSource(T.COLD).setData({type:I.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(T.HOT).setData({type:I.FEATURE_COLLECTION,features:e.sources.hot}),d()}function se(e){let t;this._features={},this._featureIds=new De,this._selectedFeatureIds=new De,this._selectedCoordinates=[],this._changedFeatureIds=new De,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,rt.call(this),this._emitSelectionChange&&(this.ctx.events.fire(l.SELECTION_CHANGE,{features:this.getSelected().map(n=>n.toGeoJSON()),points:this.getSelectedCoordinates().map(n=>({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:n.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(l.RENDER,{})}))},this.isDirty=!1}function ot(e,t={}){const n=e._selectedCoordinates.filter(r=>e._selectedFeatureIds.has(r.feature_id));e._selectedCoordinates.length!==n.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=n}se.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},se.prototype.setDirty=function(){return this.isDirty=!0,this},se.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){const r=this.get(e);this.ctx.events.fire(l.CREATE,{features:[r.toGeoJSON()]})}return this},se.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(l.UPDATE,{action:t.action?t.action:y.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},se.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},se.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},se.prototype.getAllIds=function(){return this._featureIds.values()},se.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},se.prototype.delete=function(e,t={}){const n=[];return ge(e).forEach(r=>{this._featureIds.has(r)&&(this._featureIds.delete(r),this._selectedFeatureIds.delete(r),t.silent||-1===n.indexOf(this._features[r])&&n.push(this._features[r].toGeoJSON()),delete this._features[r],this.isDirty=!0)}),n.length&&this.ctx.events.fire(l.DELETE,{features:n}),ot(this,t),this},se.prototype.get=function(e){return this._features[e]},se.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])},se.prototype.select=function(e,t={}){return ge(e).forEach(n=>{this._selectedFeatureIds.has(n)||(this._selectedFeatureIds.add(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),this},se.prototype.deselect=function(e,t={}){return ge(e).forEach(n=>{this._selectedFeatureIds.has(n)&&(this._selectedFeatureIds.delete(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),ot(this,t),this},se.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},se.prototype.setSelected=function(e,t={}){return e=ge(e),this.deselect(this._selectedFeatureIds.values().filter(n=>-1===e.indexOf(n)),{silent:t.silent}),this.select(e.filter(n=>!this._selectedFeatureIds.has(n)),{silent:t.silent}),this},se.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},se.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},se.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},se.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))},se.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))},se.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},se.prototype.setFeatureProperty=function(e,t,n,r={}){this.get(e).setProperty(t,n),this.featureChanged(e,{silent:r.silent,action:y.CHANGE_PROPERTIES})},se.prototype.storeMapConfig=function(){D.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})},se.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})},se.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};const it=["mode","feature","mouse"];function kt(e){let t=null,n=null;const r={onRemove(){return e.map.off("load",r.connect),clearInterval(n),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(n),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(o){if(e.map=o,e.events=function Be(e){const t=Object.keys(e.options.modes).reduce((C,R)=>(C[R]=function Pe(e){const t=Object.keys(e);return function(n,r={}){let o={};const i=t.reduce((b,d)=>(b[d]=e[d],b),new q(n));return{start(){o=i.onSetup(r),be.forEach(b=>{const d=ie[b];let x=()=>!1;e[d]&&(x=()=>!0),this.on(b,x,function u(b){return d=>i[b](o,d)}(d))})},stop(){i.onStop(o)},trash(){i.onTrash(o)},combineFeatures(){i.onCombineFeatures(o)},uncombineFeatures(){i.onUncombineFeatures(o)},render(b,d){i.toDisplayFeatures(o,b,d)}}}}(e.options.modes[R]),C),{});let n={},r={};const o={};let i=null,u=null;o.drag=function(C,R){R({point:C.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:m.DRAG}),u.drag(C)):C.originalEvent.stopPropagation()},o.mousedrag=function(C){o.drag(C,R=>!et(n,R))},o.touchdrag=function(C){o.drag(C,R=>!tt(r,R))},o.mousemove=function(C){if(1===(void 0!==C.originalEvent.buttons?C.originalEvent.buttons:C.originalEvent.which))return o.mousedrag(C);const U=Xe(C,e);C.featureTarget=U,u.mousemove(C)},o.mousedown=function(C){n={time:(new Date).getTime(),point:C.point};const R=Xe(C,e);C.featureTarget=R,u.mousedown(C)},o.mouseup=function(C){const R=Xe(C,e);C.featureTarget=R,et(n,{point:C.point,time:(new Date).getTime()})?u.click(C):u.mouseup(C)},o.mouseout=function(C){u.mouseout(C)},o.touchstart=function(C){if(!e.options.touchEnabled)return;r={time:(new Date).getTime(),point:C.point};const R=ke.touch(C,null,e)[0];C.featureTarget=R,u.touchstart(C)},o.touchmove=function(C){if(e.options.touchEnabled)return u.touchmove(C),o.touchdrag(C)},o.touchend=function(C){if(C.originalEvent.preventDefault(),!e.options.touchEnabled)return;const R=ke.touch(C,null,e)[0];C.featureTarget=R,tt(r,{time:(new Date).getTime(),point:C.point})?u.tap(C):u.touchend(C)};const b=C=>{const R=pe(C),U=me(C),ee=ve(C);return!(R||U||ee)};function d(C,R,U={}){u.stop();const ee=t[C];if(void 0===ee)throw new Error(`${C} is not valid`);i=C;const Ce=ee(e,R);u=nt(Ce,e),U.silent||e.map.fire(l.MODE_CHANGE,{mode:C}),e.store.setDirty(),e.store.render()}o.keydown=function(C){(C.srcElement||C.target).classList.contains(s.CANVAS)&&((pe(C)||me(C))&&e.options.controls.trash?(C.preventDefault(),u.trash()):b(C)?u.keydown(C):te(C)&&e.options.controls.point?d(O.DRAW_POINT):$e(C)&&e.options.controls.line_string?d(O.DRAW_LINE_STRING):Oe(C)&&e.options.controls.polygon&&d(O.DRAW_POLYGON))},o.keyup=function(C){b(C)&&u.keyup(C)},o.zoomend=function(){e.store.changeZoom()},o.data=function(C){if("style"===C.dataType){const{setup:R,map:U,options:ee,store:Ce}=e;ee.styles.some(Ve=>U.getLayer(Ve.id))||(R.addLayers(),Ce.setDirty(),Ce.render())}};const x={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start(){i=e.options.defaultMode,u=nt(t[i](e),e)},changeMode:d,actionable:function W(C){let R=!1;Object.keys(C).forEach(U=>{if(void 0===x[U])throw new Error("Invalid action type");x[U]!==C[U]&&(R=!0),x[U]=C[U]}),R&&e.map.fire(l.ACTIONABLE,{actions:x})},currentModeName:()=>i,currentModeRender:(C,R)=>u.render(C,R),fire(C,R){e.map&&e.map.fire(C,R)},addEventListeners(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash(C){u.trash(C)},combineFeatures(){u.combineFeatures()},uncombineFeatures(){u.uncombineFeatures()},getMode:()=>i}}(e),e.ui=function It(e){const t={};let n=null,r={mode:null,feature:null,mouse:null},o={mode:null,feature:null,mouse:null};function u(R){o=Object.assign(o,R)}function b(){if(!e.container)return;const R=[],U=[];it.forEach(ee=>{o[ee]!==r[ee]&&(R.push(`${ee}-${r[ee]}`),null!==o[ee]&&U.push(`${ee}-${o[ee]}`))}),R.length>0&&e.container.classList.remove(...R),U.length>0&&e.container.classList.add(...U),r=Object.assign(r,o)}function d(R,U={}){const ee=document.createElement("button");return ee.className=`${s.CONTROL_BUTTON} ${U.className}`,ee.setAttribute("title",U.title),U.container.appendChild(ee),ee.addEventListener("click",Ce=>{if(Ce.preventDefault(),Ce.stopPropagation(),Ce.target===n)return x(),void U.onDeactivate();W(R),U.onActivate()},!0),ee}function x(){n&&(n.classList.remove(s.ACTIVE_BUTTON),n=null)}function W(R){x();const U=t[R];U&&U&&"trash"!==R&&(U.classList.add(s.ACTIVE_BUTTON),n=U)}return{setActiveButton:W,queueMapClasses:u,updateMapClasses:b,clearMapClasses:function i(){u({mode:null,feature:null,mouse:null}),b()},addButtons:function Y(){const R=e.options.controls,U=document.createElement("div");return U.className=`${s.CONTROL_GROUP} ${s.CONTROL_BASE}`,R&&(R[G.POINT]&&(t[G.POINT]=d(G.POINT,{container:U,className:s.CONTROL_BUTTON_POINT,title:"Marker tool "+(e.options.keybindings?"(1)":""),onActivate:()=>e.events.changeMode(O.DRAW_POINT),onDeactivate:()=>e.events.trash()})),R[G.LINE]&&(t[G.LINE]=d(G.LINE,{container:U,className:s.CONTROL_BUTTON_LINE,title:"LineString tool "+(e.options.keybindings?"(2)":""),onActivate:()=>e.events.changeMode(O.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),R[G.POLYGON]&&(t[G.POLYGON]=d(G.POLYGON,{container:U,className:s.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(e.options.keybindings?"(3)":""),onActivate:()=>e.events.changeMode(O.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),R.trash&&(t.trash=d("trash",{container:U,className:s.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),R.combine_features&&(t.combine_features=d("combineFeatures",{container:U,className:s.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),R.uncombine_features&&(t.uncombine_features=d("uncombineFeatures",{container:U,className:s.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),U},removeButtons:function C(){Object.keys(t).forEach(R=>{const U=t[R];U.parentNode&&U.parentNode.removeChild(U),delete t[R]})}}}(e),e.container=o.getContainer(),e.store=new se(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable();const i=o.dragPan.isEnabled();o.dragPan.disable(),o.dragPan.enable(),i||o.dragPan.disable()}return o.loaded()?r.connect():(o.on("load",r.connect),n=setInterval(()=>{o.loaded()&&r.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(T.COLD,{data:{type:I.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(T.HOT,{data:{type:I.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(o=>{e.map.addLayer(o)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(o=>{e.map.getLayer(o.id)&&e.map.removeLayer(o.id)}),e.map.getSource(T.COLD)&&e.map.removeSource(T.COLD),e.map.getSource(T.HOT)&&e.map.removeSource(T.HOT)}};return e.setup=r,r}const st="#3bb2d0",at="#fbb03b",Gt=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],at,st],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],at,st],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],at,st]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":at}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":at}}];function Ge(e,t){this.x=e,this.y=t}Ge.prototype={clone(){return new Ge(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const n=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),n=Math.sin(e),o=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=o,this},_rotateAround(e,t){const n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ge},Ge.convert=function(e){if(e instanceof Ge)return e;if(Array.isArray(e))return new Ge(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new Ge(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const Ft=function mn(e,t){const n=t.getBoundingClientRect();return new Ge(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))};function Je(e,t,n,r){return{type:I.FEATURE,properties:{meta:L.VERTEX,parent:e,coord_path:n,active:r?w.ACTIVE:w.INACTIVE},geometry:{type:I.POINT,coordinates:t}}}function lt(e,t,n){if(null!==e)for(var r,o,i,u,b,d,x,C,W=0,Y=0,R=e.type,U="FeatureCollection"===R,ee="Feature"===R,Ce=U?e.features.length:1,Te=0;Te<Ce;Te++){b=(C=!!(x=U?e.features[Te].geometry:ee?e.geometry:e)&&"GeometryCollection"===x.type)?x.geometries.length:1;for(var Ve=0;Ve<b;Ve++){var Se=0,We=0;if(null!==(u=C?x.geometries[Ve]:x)){d=u.coordinates;var Ue=u.type;switch(W=!n||"Polygon"!==Ue&&"MultiPolygon"!==Ue?0:1,Ue){case null:break;case"Point":if(!1===t(d,Y,Te,Se,We))return!1;Y++,Se++;break;case"LineString":case"MultiPoint":for(r=0;r<d.length;r++){if(!1===t(d[r],Y,Te,Se,We))return!1;Y++,"MultiPoint"===Ue&&Se++}"LineString"===Ue&&Se++;break;case"Polygon":case"MultiLineString":for(r=0;r<d.length;r++){for(o=0;o<d[r].length-W;o++){if(!1===t(d[r][o],Y,Te,Se,We))return!1;Y++}"MultiLineString"===Ue&&Se++,"Polygon"===Ue&&We++}"Polygon"===Ue&&Se++;break;case"MultiPolygon":for(r=0;r<d.length;r++){for(We=0,o=0;o<d[r].length;o++){for(i=0;i<d[r][o].length-W;i++){if(!1===t(d[r][o][i],Y,Te,Se,We))return!1;Y++}We++}Se++}break;case"GeometryCollection":for(r=0;r<u.geometries.length;r++)if(!1===lt(u.geometries[r],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Kt(e){const t={type:"Feature"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=Yt(e.properties),t.geometry=null==e.geometry?null:Ot(e.geometry),t}function Yt(e){const t={};return e&&Object.keys(e).forEach(n=>{const r=e[n];t[n]="object"==typeof r?null===r?null:Array.isArray(r)?r.map(o=>o):Yt(r):r}),t}function Ot(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(n=>Ot(n)),t):(t.coordinates=jt(e.coordinates),t)}function jt(e){const t=e;return"object"!=typeof t[0]?t.slice():t.map(n=>jt(n))}function Qt(e,t={}){return qt(e,"mercator",t)}function qt(e,t,n={}){var r=(n=n||{}).mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&function ht(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}(e[0])?e="mercator"===t?en(e):tn(e):(!0!==r&&(e=function Sn(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Kt(e);case"FeatureCollection":return function Pn(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(n=>Kt(n)),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ot(e);default:throw new Error("unknown GeoJSON type")}}(e)),lt(e,function(o){var i="mercator"===t?en(o):tn(o);o[0]=i[0],o[1]=i[1]})),e}function en(e){var t=Math.PI/180,n=6378137,r=20037508.342789244,o=Math.abs(e[0])<=180?e[0]:e[0]-360*function Fn(e){return e<0?-1:e>0?1:0}(e[0]),i=[n*o*t,n*Math.log(Math.tan(.25*Math.PI+.5*e[1]*t))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function tn(e){var t=180/Math.PI,n=6378137;return[e[0]*t/n,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/n)))*t]}function nn(e,t,n){const r=t.geometry.coordinates,o=n.geometry.coordinates;if(r[1]>H||r[1]<N||o[1]>H||o[1]<N)return null;const i=Qt(r),u=Qt(o),b=Y=>Number(Y.toFixed(8)),d=(Y,C)=>(Y+C)/2,x=function In(e,t={}){return qt(e,"wgs84",t)}([d(i[0],u[0]),d(i[1],u[1])]),W=[b(x[0]),b(x[1])];return{type:I.FEATURE,properties:{meta:L.MIDPOINT,parent:e,lng:W[0],lat:W[1],coord_path:n.properties.coord_path},geometry:{type:I.POINT,coordinates:W}}}Math;const At=function rn(e,t={},n=null){const{type:r,coordinates:o}=e.geometry,i=e.properties&&e.properties.id;let u=[];function b(W,Y){let C="",R=null;W.forEach((U,ee)=>{const Ce=null!=Y?`${Y}.${ee}`:String(ee),Te=Je(i,U,Ce,d(Ce));if(t.midpoints&&R){const Se=nn(i,R,Te);Se&&u.push(Se)}R=Te;const Ve=JSON.stringify(U);C!==Ve&&u.push(Te),0===ee&&(C=Ve)})}function d(W){return!!t.selectedPaths&&-1!==t.selectedPaths.indexOf(W)}return r===I.POINT?u.push(Je(i,o,n,d(n))):r===I.POLYGON?o.forEach((W,Y)=>{b(W,null!==n?`${n}.${Y}`:String(Y))}):r===I.LINE_STRING?b(o,n):0===r.indexOf(I.MULTI_PREFIX)&&function x(){const W=r.replace(I.MULTI_PREFIX,"");o.forEach((Y,C)=>{u=u.concat(rn({type:I.FEATURE,properties:e.properties,geometry:{type:W,coordinates:Y}},t,C))})}(),u},Ie={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:pt,LAT_MAX:gt,LAT_RENDERED_MIN:on,LAT_RENDERED_MAX:sn,LNG_MIN:an,LNG_MAX:ln}=B;function Dt(e,t){let n=pt,r=gt,o=pt,i=gt,u=ln,b=an;e.forEach(x=>{const W=function wn(e){const n=[e.geometry.coordinates].flat({Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type]),r=n.map(b=>b[0]),o=n.map(b=>b[1]),i=b=>Math.min.apply(null,b),u=b=>Math.max.apply(null,b);return[i(r),i(o),u(r),u(o)]}(x),Y=W[1],C=W[3],R=W[0],U=W[2];Y>n&&(n=Y),C<r&&(r=C),C>o&&(o=C),Y<i&&(i=Y),R<u&&(u=R),U>b&&(b=U)});const d=t;return n+d.lat>sn&&(d.lat=sn-n),o+d.lat>gt&&(d.lat=gt-o),r+d.lat<on&&(d.lat=on-r),i+d.lat<pt&&(d.lat=pt-i),u+d.lng<=an&&(d.lng+=360*Math.ceil(Math.abs(d.lng)/360)),b+d.lng>=ln&&(d.lng-=360*Math.ceil(Math.abs(d.lng)/360)),d}function Nt(e,t){const n=Dt(e.map(r=>r.toGeoJSON()),t);e.forEach(r=>{const o=r.getCoordinates(),i=x=>{const W={lng:x[0]+n.lng,lat:x[1]+n.lat};return[W.lng,W.lat]},u=x=>x.map(W=>i(W));let d;r.type===I.POINT?d=i(o):r.type===I.LINE_STRING||r.type===I.MULTI_POINT?d=o.map(i):r.type===I.POLYGON||r.type===I.MULTI_LINE_STRING?d=o.map(u):r.type===I.MULTI_POLYGON&&(d=o.map(x=>x.map(W=>u(W)))),r.incomingCoords(d)})}const le={onSetup:function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(n=>void 0!==this.getFeature(n))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},fireUpdate:function(){this.fire(l.UPDATE,{action:y.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(){const e=this.getSelected(),t=e.filter(i=>this.isInstanceOf("MultiFeature",i));let n=!1;if(e.length>1){n=!0;const i=e[0].type.replace("Multi","");e.forEach(u=>{u.type.replace("Multi","")!==i&&(n=!1)})}this.setActionableState({combineFeatures:n,uncombineFeatures:t.length>0,trash:e.length>0})},getUniqueIds:function(e){return e.length?e.map(n=>n.properties.id).filter(n=>void 0!==n).reduce((n,r)=>(n.add(r),n),new De).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){Ie.enable(this)},onMouseMove:function(e,t){return X(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};le.onTap=le.onClick=function(e,t){return z(t)?this.clickAnywhere(e,t):M(L.VERTEX)(t)?this.clickOnVertex(e,t):X(t)?this.clickOnFeature(e,t):void 0},le.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(n=>this.doRender(n))),Ie.enable(this),this.stopExtendedInteractions(e)},le.clickOnVertex=function(e,t){this.changeMode(O.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:m.MOVE})},le.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},le.clickOnFeature=function(e,t){Ie.disable(this),this.stopExtendedInteractions(e);const n=re(t),r=this.getSelectedIds(),o=t.featureTarget.properties.id,i=this.isSelected(o);if(!n&&i&&this.getFeature(o).type!==I.POINT)return this.changeMode(O.DIRECT_SELECT,{featureId:o});i&&n?(this.deselect(o),this.updateUIClasses({mouse:m.POINTER}),1===r.length&&Ie.enable(this)):!i&&n?(this.select(o),this.updateUIClasses({mouse:m.MOVE})):!i&&!n&&(r.forEach(u=>this.doRender(u)),this.setSelected(o),this.updateUIClasses({mouse:m.MOVE})),this.doRender(o)},le.onMouseDown=function(e,t){return e.initialDragPanState=this.map.dragPan.isEnabled(),E(t)?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&P(t)?this.startBoxSelect(e,t):void 0},le.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Ft(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},le.onTouchStart=function(e,t){if(E(t))return this.startOnActiveFeature(e,t)},le.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},le.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:m.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(s.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=Ft(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,n.x),o=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),u=Math.max(e.boxSelectStartLocation.y,n.y),b=`translate(${r}px, ${i}px)`;e.boxSelectElement.style.transform=b,e.boxSelectElement.style.WebkitTransform=b,e.boxSelectElement.style.width=o-r+"px",e.boxSelectElement.style.height=u-i+"px"},le.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};Nt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},le.onTouchEnd=le.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const n=[e.boxSelectStartLocation,Ft(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,n,"click"),o=this.getUniqueIds(r).filter(i=>!this.isSelected(i));o.length&&(this.select(o),o.forEach(i=>this.doRender(i)),this.updateUIClasses({mouse:m.MOVE}))}this.stopExtendedInteractions(e)},le.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?w.ACTIVE:w.INACTIVE,n(t),this.fireActionable(),t.properties.active===w.ACTIVE&&t.geometry.type!==I.POINT&&At(t).forEach(n)},le.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},le.onCombineFeatures=function(){const e=this.getSelected();if(0===e.length||e.length<2)return;const t=[],n=[],r=e[0].type.replace("Multi","");for(let o=0;o<e.length;o++){const i=e[o];if(i.type.replace("Multi","")!==r)return;i.type.includes("Multi")?i.getCoordinates().forEach(u=>{t.push(u)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){const o=this.newFeature({type:I.FEATURE,properties:n[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(o),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([o.id]),this.fire(l.COMBINE_FEATURES,{createdFeatures:[o.toGeoJSON()],deletedFeatures:n})}this.fireActionable()},le.onUncombineFeatures=function(){const e=this.getSelected();if(0===e.length)return;const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];this.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach(i=>{this.addFeature(i),i.properties=o.properties,t.push(i.toGeoJSON()),this.select([i.id])}),this.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))}t.length>1&&this.fire(l.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:n}),this.fireActionable()};const xn=le,cn=M(L.VERTEX),un=M(L.MIDPOINT),ce={fireUpdate:function(){this.fire(l.UPDATE,{action:y.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){null==e.initialDragPanState&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){e.canDragMove&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(n.coord_path);re(t)||-1!==r?re(t)&&-1===r&&e.selectedCoordPaths.push(n.coord_path):e.selectedCoordPaths=[n.coord_path];const o=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(o)},onMidpoint:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(e,t){return t.map(n=>({feature_id:e,coord_path:n}))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,n){Nt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,n){const r=e.selectedCoordPaths.map(u=>e.feature.getCoordinate(u)),i=Dt(r.map(u=>({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:u}})),n);for(let u=0;u<r.length;u++){const b=r[u];e.feature.updateCoordinate(e.selectedCoordPaths[u],b[0]+i.lng,b[1]+i.lat)}},clickNoTarget:function(){this.changeMode(O.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(O.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){const t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===I.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),Ie.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){Ie.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,n){e.featureId===t.properties.id?(t.properties.active=w.ACTIVE,n(t),At(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=w.INACTIVE,n(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort((t,n)=>n.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(O.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){const n=E(t),r=cn(t),o=un(t),i=0===e.selectedCoordPaths.length;return this.updateUIClasses(n&&i||r&&!i?{mouse:m.MOVE}:{mouse:m.NONE}),(r||n||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};ce.onTouchStart=ce.onMouseDown=function(e,t){return cn(t)?this.onVertex(e,t):E(t)?this.onFeature(e,t):un(t)?this.onMidpoint(e,t):void 0},ce.onDrag=function(e,t){if(!0!==e.canDragMove)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat},ce.onClick=function(e,t){return z(t)?this.clickNoTarget(e,t):E(t)?this.clickActiveFeature(e,t):F(t)?this.clickInactive(e,t):void this.stopDragging(e)},ce.onTap=function(e,t){return z(t)?this.clickNoTarget(e,t):E(t)?this.clickActiveFeature(e,t):F(t)?this.clickInactive(e,t):void 0},ce.onTouchEnd=ce.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const On=ce,xe={onSetup:function(){const e=this.newFeature({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:m.ADD}),this.activateUIButton(G.POINT),this.setActionableState({trash:!0}),{point:e}},stopDrawingAndRemove:function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)}};xe.onTap=xe.onClick=function(e,t){this.updateUIClasses({mouse:m.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(l.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.point.id]})},xe.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},xe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.point.id;if(t.properties.active=r?w.ACTIVE:w.INACTIVE,!r)return n(t)},xe.onTrash=xe.stopDrawingAndRemove,xe.onKeyUp=function(e,t){if(ye(t)||he(t))return this.stopDrawingAndRemove(e,t)};const An=xe,mt=function Dn(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]},Fe={onSetup:function(){const e=this.newFeature({type:I.FEATURE,properties:{},geometry:{type:I.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),Ie.disable(this),this.updateUIClasses({mouse:m.ADD}),this.activateUIButton(G.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:m.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:m.POINTER})}};Fe.onTap=Fe.onClick=function(e,t){return J(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},Fe.onKeyUp=function(e,t){ye(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)):he(t)&&this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},Fe.onStop=function(e){this.updateUIClasses({mouse:m.NONE}),Ie.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(l.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT,{},{silent:!0})))},Fe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?w.ACTIVE:w.INACTIVE,!r)return n(t);if(0===t.geometry.coordinates.length)return;const o=t.geometry.coordinates[0].length;if(!(o<3)){if(t.properties.meta=L.FEATURE,n(Je(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),o>3){const i=t.geometry.coordinates[0].length-3;n(Je(e.polygon.id,t.geometry.coordinates[0][i],`0.${i}`,!1))}if(o<=4&&(n({type:I.FEATURE,properties:t.properties,geometry:{coordinates:[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]],type:I.LINE_STRING}}),3===o))return;return n(t)}},Fe.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)};const Nn=Fe,we={onSetup:function(e){const t=(e=e||{}).featureId;let n,r,o="forward";if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let i=e.from;if(i&&"Feature"===i.type&&i.geometry&&"Point"===i.geometry.type&&(i=i.geometry),i&&"Point"===i.type&&i.coordinates&&2===i.coordinates.length&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");const u=n.coordinates.length-1;if(n.coordinates[u][0]===i[0]&&n.coordinates[u][1]===i[1])r=u+1,n.addCoordinate(r,...n.coordinates[u]);else{if(n.coordinates[0][0]!==i[0]||n.coordinates[0][1]!==i[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");o="backwards",r=0,n.addCoordinate(r,...n.coordinates[0])}}else n=this.newFeature({type:I.FEATURE,properties:{},geometry:{type:I.LINE_STRING,coordinates:[]}}),r=0,this.addFeature(n);return this.clearSelectedFeatures(),Ie.disable(this),this.updateUIClasses({mouse:m.ADD}),this.activateUIButton(G.LINE),this.setActionableState({trash:!0}),{line:n,currentVertexPosition:r,direction:o}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&mt(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:m.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:m.POINTER})}};we.onTap=we.onClick=function(e,t){if(J(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},we.onKeyUp=function(e,t){he(t)?this.changeMode(O.SIMPLE_SELECT,{featureIds:[e.line.id]}):ye(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT))},we.onStop=function(e){Ie.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(l.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT,{},{silent:!0})))},we.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(O.SIMPLE_SELECT)},we.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.line.id;if(t.properties.active=r?w.ACTIVE:w.INACTIVE,!r)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=L.FEATURE,n(Je(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],""+("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),n(t))};const dn={simple_select:xn,direct_select:On,draw_point:An,draw_polygon:Nn,draw_line_string:we},Rn={defaultMode:O.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Gt,modes:dn,controls:{},userProperties:!1,suppressAPIEvents:!0},kn={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Bn={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function fn(e,t){return e.map(n=>n.source?n:Object.assign({},n,{id:`${n.id}.${t}`,source:"hot"===t?T.HOT:T.COLD}))}var hn=g(362),Vn=g(5341);function pn(e,t){return e.length===t.length&&JSON.stringify(e.map(n=>n).sort())===JSON.stringify(t.map(n=>n).sort())}const Un={Polygon:ae,LineString:ne,Point:K,MultiPolygon:Ne,MultiLineString:Ne,MultiPoint:Ne};function yt(e){!function(e,t){e=function Gn(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),t.controls=Object.assign({},!1===e.displayControlsDefault?Bn:kn,e.controls),t=Object.assign({},Rn,t),t.styles=fn(t.styles,"cold").concat(fn(t.styles,"hot")),t}(e);const n={options:e};t=function $n(e,t){t.modes=O;const n=void 0===e.options.suppressAPIEvents||!!e.options.suppressAPIEvents;return t.getFeatureIdsAt=function(r){return ke.click({point:r},null,e).map(i=>i.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:I.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(r=>e.store.get(r)).map(r=>r.toGeoJSON())}},t.getSelectedPoints=function(){return{type:I.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(r=>({type:I.FEATURE,properties:{},geometry:{type:I.POINT,coordinates:r.coordinates}}))}},t.set=function(r){if(void 0===r.type||r.type!==I.FEATURE_COLLECTION||!Array.isArray(r.features))throw new Error("Invalid FeatureCollection");const o=e.store.createRenderBatch();let i=e.store.getAllIds().slice();const u=t.add(r),b=new De(u);return i=i.filter(d=>!b.has(d)),i.length&&t.delete(i),o(),u},t.add=function(r){const i=JSON.parse(JSON.stringify(Vn(r))).features.map(u=>{if(u.id=u.id||a(),null===u.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(u.id)||e.store.get(u.id).type!==u.geometry.type){const b=Un[u.geometry.type];if(void 0===b)throw new Error(`Invalid geometry type: ${u.geometry.type}.`);const d=new b(e,u);e.store.add(d,{silent:n})}else{const b=e.store.get(u.id),d=b.properties;b.properties=u.properties,hn(d,u.properties)||e.store.featureChanged(b.id,{silent:n}),hn(b.getCoordinates(),u.geometry.coordinates)||b.incomingCoords(u.geometry.coordinates)}return u.id});return e.store.render(),i},t.get=function(r){const o=e.store.get(r);if(o)return o.toGeoJSON()},t.getAll=function(){return{type:I.FEATURE_COLLECTION,features:e.store.getAll().map(r=>r.toGeoJSON())}},t.delete=function(r){return e.store.delete(r,{silent:n}),t.getMode()!==O.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(O.SIMPLE_SELECT,void 0,{silent:n}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:n}),t.getMode()===O.DIRECT_SELECT?e.events.changeMode(O.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.changeMode=function(r,o={}){return r===O.SIMPLE_SELECT&&t.getMode()===O.SIMPLE_SELECT?(pn(o.featureIds||[],e.store.getSelectedIds())||(e.store.setSelected(o.featureIds,{silent:n}),e.store.render()),t):(r===O.DIRECT_SELECT&&t.getMode()===O.DIRECT_SELECT&&o.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,o,{silent:n}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:n}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:n}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:n}),t},t.setFeatureProperty=function(r,o,i){return e.store.setFeatureProperty(r,o,i,{silent:n}),t},t}(n,t),n.api=t;const r=kt(n);t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=G,t.options=e}(e,this)}yt.modes=dn,yt.constants=B,yt.lib=A;const gn=yt;let Wn=(()=>{class e{_draw;_map;_drawMode=(0,$.vPA)(!1);_settingDrawMode=!1;_eventListeners=[];_clearAfterFinish=!0;drawEvent=(0,$.vPA)(void 0);destroy(){this._cleanup()}initializeWithMap(n){this._map=n,this._initDrawControl(n)}setDrawMode(n,r){if(this._draw&&this._map&&!this._settingDrawMode){if(this._clearAfterFinish=r,this._settingDrawMode=!0,this._drawMode.set(n),n){this._draw.deleteAll(),this._draw.changeMode("draw_polygon");const o={type:"polygon",status:"started",coordinates:[],bbox:{minLng:0,minLat:0,maxLng:0,maxLat:0}};this.drawEvent.update(()=>o)}else this._draw.changeMode("simple_select"),this._draw.deleteAll();this._settingDrawMode=!1}}setClearAfterFinish(n){this._clearAfterFinish=n}getClearAfterFinish(){return this._clearAfterFinish}getDrawMode(){return this._drawMode()}clearDrawings(){this._draw&&this._draw.deleteAll()}getDrawInstance(){return this._draw}_initDrawControl(n){this._draw=new gn({displayControlsDefault:!1,modes:{...gn.modes}}),n.addControl(this._draw,"top-left");const r=document.querySelector(".mapbox-gl-draw_ctrl-draw-btn")?.parentElement;r&&(r.style.display="none");const o=b=>{const d=b.features[0];if("Polygon"===d.geometry.type){const x=d.geometry.coordinates[0],Y={type:"polygon",status:"ended",coordinates:x,bbox:this._calculateBBox(x)};this.drawEvent.update(()=>Y),this._drawMode.set(!1),this._clearAfterFinish&&this._draw?.deleteAll()}},i=b=>{const d=b.features[0];if("Polygon"===d.geometry.type){const x=d.geometry.coordinates[0],Y={type:"polygon",status:"in-progress",coordinates:x,bbox:this._calculateBBox(x)};this.drawEvent.update(()=>Y)}},u=()=>{if(this._drawMode()){const b=this._draw?.getAll();if(b?.features?.length){const d=b.features[0];if("Polygon"===d.geometry.type){const x=d.geometry.coordinates[0];if(x.length>2){const Y={type:"polygon",status:"in-progress",coordinates:x,bbox:this._calculateBBox(x)};this.drawEvent.update(()=>Y)}}}}};n.on("draw.create",o),n.on("draw.update",i),n.on("mousemove",u),this._eventListeners.push({event:"draw.create",handler:o}),this._eventListeners.push({event:"draw.update",handler:i}),this._eventListeners.push({event:"mousemove",handler:u})}_cleanup(){this._map&&(this._eventListeners.forEach(({event:n,handler:r})=>{this._map?.off(n,r)}),this._eventListeners=[],this._draw&&this._map._controls?.includes(this._draw)&&this._map.removeControl(this._draw)),this._draw=void 0,this._map=void 0,this.drawEvent.set(void 0)}_calculateBBox(n){return n.reduce((r,o)=>({minLng:Math.min(r.minLng,o[0]),minLat:Math.min(r.minLat,o[1]),maxLng:Math.max(r.maxLng,o[0]),maxLat:Math.max(r.maxLat,o[1])}),{minLng:1/0,minLat:1/0,maxLng:-1/0,maxLat:-1/0})}static \u0275fac=function(r){return new(r||e)};static \u0275prov=$.jDH({token:e,factory:e.\u0275fac})}return e})()},6986(fe,Q,g){"use strict";g.d(Q,{A4:()=>B,Jc:()=>m,Ln:()=>A,dx:()=>s,g8:()=>_,j5:()=>$,n7:()=>T});const B=12;function _(O,l,y){return{id:O,source:l,type:"circle",maxzoom:B,filter:["==",["get","_isCentroid"],!0],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],y],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}}function A(O,l,y,L){return function I(O,l,y,L,w){const D={id:O,source:L},v=w||y;switch(l){case"Point":case"MultiPoint":return[{...D,id:`${O}-clusters`,type:"circle",filter:["has","point_count"],paint:{"circle-color":v,"circle-radius":["step",["get","point_count"],15,100,20,750,25],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}},{...D,id:`${O}-cluster-count`,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#ffffff","text-halo-color":"rgba(0, 0, 0, 0.3)","text-halo-width":1}},{...D,id:`${O}-unclustered`,type:"circle",filter:["!",["has","point_count"]],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],y],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}];case"LineString":case"MultiLineString":return{...D,type:"line",paint:{"line-color":["coalesce",["get","_color"],y],"line-width":3,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}};case"Polygon":case"MultiPolygon":return[{id:`${O}-fill`,source:L,type:"fill",paint:{"fill-color":["coalesce",["get","_color"],y],"fill-opacity":.3}},{id:`${O}-stroke`,source:L,type:"line",paint:{"line-color":["coalesce",["get","_color"],y],"line-width":2,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}},{id:`${O}-labels`,source:L,type:"symbol",layout:{"text-field":["coalesce",["get","label"],""],"text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":13,"text-anchor":"center","text-allow-overlap":!1},paint:{"text-color":"#333333","text-halo-color":"rgba(255, 255, 255, 0.9)","text-halo-width":2}}];default:return console.warn(`Unsupported geometry type: ${l}`),null}}(O,l,y,L,y)}function $(O){return"Polygon"===O||"MultiPolygon"===O}function s(O){return"LineString"===O||"MultiLineString"===O}function T(O,l){return l&&("Point"===O||"MultiPoint"===O)}function m(O,l){return T(O,l)?{cluster:!0,clusterMaxZoom:14,clusterRadius:50,clusterMinPoints:2}:{cluster:!1}}},3646(fe,Q,g){"use strict";g.d(Q,{B:()=>V});var B=g(467),_=g(5802),A=g(2271),$=g(4412),s=g(1413),T=g(2306),m=g(140);function v(H){let j=1/0,p=1/0,M=-1/0,P=-1/0;const E=H.features,F=X=>{X.length>=2&&(j=Math.min(j,X[0]),p=Math.min(p,X[1]),M=Math.max(M,X[0]),P=Math.max(P,X[1]))},z=(X,J)=>{if(0===J)F(X);else if(Array.isArray(X))for(const re of X)z(re,J-1)};for(const X of E){const J=X.geometry;switch(J.type){case"Point":z(J.coordinates,0);break;case"LineString":case"MultiPoint":z(J.coordinates,1);break;case"Polygon":case"MultiLineString":z(J.coordinates,2);break;case"MultiPolygon":z(J.coordinates,3);break;case"GeometryCollection":for(const re of J.geometries){const pe=v(new m.o([{type:"Feature",geometry:re,properties:null}]));pe&&(F([pe[0],pe[1]]),F([pe[2],pe[3]]))}}}return j===1/0?null:[j,p,M,P]}var N=g(6986);let V=(()=>{class H{_layers$=new $.t([]);_map;_sources={};_sourceLayers={};_sourceIds=[];_attachedListeners=[];_hoveredFeature=(0,_.vPA)(void 0);_layerGroups={};_layerClickable={};_pointLayerIds=new Set;_lineLayerIds=new Set;_processedClickEvents=new WeakSet;_clearHoverTimeout;_hoverSequence=0;layers=this._layers$.asObservable();layersSignal=(0,A.EW)(()=>this._layers$.getValue());clickedFeature=new s.B;hoveredFeature=new s.B;initializeWithMap(p){this._map=p,p.on("mousemove",M=>{const P=p.getCanvas();if(!P)return;const E=Object.keys(this._layerClickable).filter(z=>this._layerClickable[z]&&p.getLayer(z)),F=p.queryRenderedFeatures(M.point,{layers:E});P.style.cursor=F.length>0?"pointer":""})}getLayers(){return this._layers$.getValue()}setLayers(p){this._layers$.next([...p])}addLayer(p){const M=this._layers$.getValue(),P=M.findIndex(E=>E.id===p.id);P>=0?M[P]={...p}:M.push({...p}),this._layers$.next([...M])}removeLayer(p){const P=this._layers$.getValue().filter(E=>E.id!==p);this._layers$.next(P),this._deleteSourceIfExists(p.toString()),delete this._sources[p.toString()],delete this._sourceLayers[p.toString()],delete this._layerClickable[p.toString()],this._pointLayerIds.delete(p.toString()),this._lineLayerIds.delete(p.toString()),this._sourceIds=this._sourceIds.filter(E=>E!==p.toString())}toggleVisibility(p){const M=p.toString();if(this._layerGroups[M])return void this.toggleLayerGroupVisibility(M);const E=this._layers$.getValue().map(F=>{if(F.id===p){const z={...F,visible:!F.visible};return this._updateLayerVisibility(p.toString(),z.visible),z}return F});this._layers$.next(E)}setLayerVisibility(p,M){const P=p.toString();if(this._layerGroups[P]){if(this._map){const X=M?"visible":"none";this._layerGroups[P].forEach(J=>{this._map.setLayoutProperty(J,"visibility",X)})}}else this._updateLayerVisibility(P,M);const F=this._layers$.getValue().map(z=>z.id===p?{...z,visible:M}:z);this._layers$.next(F)}loadGeoJSONLayerGroup(p,M,P){var E=this;return(0,B.A)(function*(F,z,X,J={}){const{cluster:re=!1,zoomToFit:ye=!0,visible:he=!0,label:pe=F,color:me=E._extractColorFromLayer(X[0])}=J;if(!E._map)return void console.warn("Map not initialized in LayerService");const te=F;yield E._addSource(F,{type:"geojson",data:z,...(0,N.Jc)("Point",re)});const $e=[];for(const ve of X){$e.push(ve.id),E._layerClickable[ve.id]=!0,E._sourceLayers[te]||(E._sourceLayers[te]={layer:ve,clickable:!0});const He=ve.type;if("circle"===He||"symbol"===He)E._pointLayerIds.add(ve.id),E._map.addLayer(ve);else if("line"===He){E._lineLayerIds.add(ve.id);const Ae=E._getBeforePointLayerId();E._map.addLayer(ve,Ae)}else{const Ae=E._getBeforeLineLayerId()??E._getBeforePointLayerId();E._map.addLayer(ve,Ae)}E._map&&E._map.setLayoutProperty(ve.id,"visibility",he?"visible":"none")}for(const ve of X)E._setLayerEvents(te,ve);E._layerGroups[F]=$e;const Oe=new T.ux(pe,F);Oe.collection=z,Oe.color=me,Oe.visible=he,E.addLayer(Oe),ye&&E.fitLayerBounds(F)}).apply(this,arguments)}toggleLayerGroupVisibility(p){const M=this._layerGroups[p];if(!M)return;const P=this.getLayer(p);if(!P)return;const E=!P.visible;if(this._map){const F=E?"visible":"none";M.forEach(z=>{this._map.setLayoutProperty(z,"visibility",F)})}this.updateLayer(p,{visible:E})}removeLayerGroup(p){const M=this._layerGroups[p];M&&(this._map&&(M.forEach(P=>{this._map.removeLayer(P),this._attachedListeners=this._attachedListeners.filter(E=>E!==p),delete this._layerClickable[P],this._pointLayerIds.delete(P),this._lineLayerIds.delete(P)}),this._deleteSourceIfExists(p)),delete this._sources[p],delete this._sourceLayers[p],this._sourceIds=this._sourceIds.filter(P=>P!==p),delete this._layerGroups[p],this.removeLayer(p))}loadGeoJSONLayer(p,M,P){var E=this;return(0,B.A)(function*(F,z,X,J={}){const{cluster:re=!0,zoomToFit:ye=!0,visible:he=!0,label:pe=F,color:me=E._extractColorFromLayer(X)}=J;if(!E._map)return void console.warn("Map not initialized in LayerService");yield E._addSource(F,{type:"geojson",data:z,...(0,N.Jc)("Point",re)},X);const te=new T.ux(pe,F);te.collection=z,te.color=me,te.visible=he,E.addLayer(te),E._updateLayerVisibility(F,he),ye&&E.fitLayerBounds(F)}).apply(this,arguments)}_addSource(p,M,P){var E=this;return(0,B.A)(function*(F,z,X,J=!0){E._map&&(E._sources[F]=z,E._deleteSourceIfExists(F),E._sourceIds.push(F),E._map.getSource(F)&&E._map.removeSource(F),E._map.addSource(F,z),X&&E._addSourceLayer(F,X,J))}).apply(this,arguments)}_getBeforePointLayerId(){if(!this._map||0===this._pointLayerIds.size)return;const p=this._map.getStyle()?.layers??[];for(const M of p)if(this._pointLayerIds.has(M.id))return M.id}_getBeforeLineLayerId(){if(!this._map||0===this._lineLayerIds.size)return;const p=this._map.getStyle()?.layers??[];for(const M of p)if(this._lineLayerIds.has(M.id))return M.id}_addSourceLayer(p,M,P=!0){if(!this._map)return;this._layerClickable[M.id]=P,this._sourceLayers[p]||(this._sourceLayers[p]={layer:M,clickable:P});const E=M.type;if("circle"===E||"symbol"===E)this._pointLayerIds.add(M.id),this._map.addLayer(M);else if("line"===E){this._lineLayerIds.add(M.id);const F=this._getBeforePointLayerId();this._map.addLayer(M,F)}else{const F=this._getBeforeLineLayerId()??this._getBeforePointLayerId();this._map.addLayer(M,F)}P&&this._setLayerEvents(p,M)}_updateLayerVisibility(p,M){if(!this._map)return;const P=this._sourceLayers[p];P&&this._map.setLayoutProperty(P.layer.id,"visibility",M?"visible":"none")}getLayer(p){return this._layers$.getValue().find(M=>M.id===p)}updateLayer(p,M){const E=this._layers$.getValue().map(F=>{if(F.id===p){const z={...F,...M};return void 0!==M.visible&&this._updateLayerVisibility(p.toString(),M.visible),z}return F});this._layers$.next(E)}toggleAllLayers(){const p=this._layers$.getValue(),P=!p.some(F=>F.visible),E=p.map(F=>(this._updateLayerVisibility(F.id.toString(),P),{...F,visible:P}));this._layers$.next(E)}getVisibleLayersCount(){return this._layers$.getValue().filter(p=>p.visible).length}getTotalLayersCount(){return this._layers$.getValue().length}hasLayer(p){return this._layers$.getValue().some(M=>M.id===p)}fitGeoJSONBounds(p,M=50,P=!0,E=19){this._fitGeoJSONBounds(p,M,P,E)}fitLayerBounds(p,M=50){const P=this._layers$.getValue().find(E=>E.id===p);!P||!P.collection||!this._map||("features"in P.collection?this._fitGeoJSONBounds(P.collection,M):console.warn("Layer collection is not a FeatureCollection, cannot fit bounds."))}fitAllVisibleLayers(p=50){const M=this._layers$.getValue().filter(z=>z.visible&&z.collection);if(0===M.length||!this._map)return;const P=M.flatMap(z=>{const X=z.collection;return X&&"features"in X&&Array.isArray(X.features)?X.features:[]}),E=new m.o(P),F=v(E);F&&(E.bbox=F),this._fitGeoJSONBounds(E,p)}clearAllLayers(){if(this._map){for(const[p,M]of Object.entries(this._layerGroups))M.forEach(P=>{this._map.getLayer(P)&&this._map.removeLayer(P)}),this._map.getSource(p)&&this._map.removeSource(p);for(const p of this._sourceIds)this._layerGroups[p]||this._deleteSourceIfExists(p)}this._sourceIds=[],this._sourceLayers={},this._sources={},this._attachedListeners=[],this._layerGroups={},this._layerClickable={},this._layers$.next([])}reapplyLayers(){this._map&&(Object.keys(this._sources).forEach(p=>{this._deleteSourceIfExists(p),this._map.addSource(p,this._sources[p]);const M=this._sourceLayers[p];if(M){this._map.addLayer(M.layer);const P=this._layers$.getValue().find(E=>E.id===p);P&&this._updateLayerVisibility(p,P.visible)}}),this._reattachAllLayerEvents())}_extractColorFromLayer(p){if("paint"in p&&"object"==typeof p.paint){const M=p.paint;return M["circle-color"]||M["fill-color"]||M["line-color"]||""}return""}_fitGeoJSONBounds(p,M=50,P=!0,E=19){if(!this._map)return void console.warn("Map not initialized when trying to fit bounds");if(!p.features||0===p.features.length)return void console.warn("No features to fit bounds to");let F=p.bbox;if(!F){const z=v(p);if(!z)return void console.warn("Failed to calculate bbox for GeoJSON");p.bbox=z,F=z}if(F&&4===F.length)try{this._map.fitBounds([[F[0],F[1]],[F[2],F[3]]],{padding:M,maxZoom:E,animate:P})}catch(z){console.error("Error fitting bounds:",z)}}_deleteSourceIfExists(p){if(!this._map||!this._map.getSource(p))return;const P=this._layerGroups[p];if(P)P.forEach(E=>{this._map.getLayer(E)&&this._map.removeLayer(E)});else{const E=Object.values(this._sourceLayers).find(F=>"source"in F.layer&&F.layer.source===p);E&&this._map.getLayer(E.layer.id)&&(this._map.removeLayer(E.layer.id),this._attachedListeners=this._attachedListeners.filter(F=>F!==E.layer.id))}this._map.removeSource(p)}_setLayerEvents(p,M){if(!this._map)return;const P=M.id.endsWith("-fill"),E=M.id.endsWith("-stroke"),F=P?M.id.replace("-fill",""):E?M.id.replace("-stroke",""):M.id;if(P||E){const J=`${F}-stroke`;this._layerClickable[`${F}-fill`]=!0,this._layerClickable[J]=!0}if(!this._layerClickable[M.id])return;const z=[];if(P||E){const X=`${F}-fill`,J=`${F}-stroke`;this._map.getLayer(X)&&z.push(X),this._map.getLayer(J)&&z.push(J)}else z.push(M.id);z.forEach(X=>{this._attachedListeners.includes(X)||(this._map.on("click",X,J=>{if(!J.features||this._processedClickEvents.has(J.originalEvent))return;const re=J.features[0],ye=re.properties;if(ye&&!ye.cluster){const he=this.getLayer(p)||this.getLayer(F)||this.getLayer(X);if(he){const pe={...re,geometry:re.geometry};if(he.collection&&"features"in he.collection){const me=he.collection.features.find(te=>te.geometry.type===re.geometry?.type&&JSON.stringify(te.properties)===JSON.stringify(re.properties));me&&me.id&&(pe.id=me.id)}this._processedClickEvents.add(J.originalEvent),this.clickedFeature.next({feature:pe,event:J.originalEvent,layer:he,lngLat:J.lngLat})}}}),this._map.on("mouseenter",X,J=>{if(this._hoverSequence++,this._clearHoverTimeout&&(clearTimeout(this._clearHoverTimeout),this._clearHoverTimeout=void 0),!J.features)return;const re=J.features[0],ye=re.properties,he={...re,geometry:re.geometry};if(ye&&!ye.cluster){const pe=this.getLayer(p)||this.getLayer(F)||this.getLayer(X);if(pe){if(pe.collection&&"features"in pe.collection){const me=pe.collection.features.find(te=>te.geometry.type===re.geometry?.type&&JSON.stringify(te.properties)===JSON.stringify(re.properties));me&&me.id&&(he.id=me.id)}this.hoveredFeature.next({feature:he,event:J.originalEvent,layer:pe,lngLat:J.lngLat})}this._hoveredFeature.set(he)}}),this._map.on("mouseleave",X,()=>{const J=this._hoverSequence;this._clearHoverTimeout=window.setTimeout(()=>{this._hoverSequence===J&&(this._hoveredFeature.set(void 0),this.hoveredFeature.next(void 0)),this._clearHoverTimeout=void 0},50)}),this._map.on("click",X,J=>{if(!J.features)return;const re=J.features[0].properties;if(re&&re.cluster){const ye=this._map?.getZoom();ye&&this._map?.flyTo({center:J.lngLat,zoom:ye+1})}}),this._attachedListeners.push(X))})}_reattachAllLayerEvents(){this._attachedListeners=[],Object.keys(this._sourceLayers).forEach(p=>{const M=this._sourceLayers[p];M&&this._setLayerEvents(p,M.layer)})}static \u0275fac=function(M){return new(M||H)};static \u0275prov=_.jDH({token:H,factory:H.\u0275fac})}return H})()},8017(fe,Q,g){"use strict";g.d(Q,{T:()=>Pt});var B=g(467),_=g(5802),A=g(7705),$=g(2271),s=g(5547),T=g(9769),m=g(5970),G=g(6170),I=g(5949),O=g(2843),l=g(3646),y=g(9079),L=g(1413),w=g(2306),D=g(7089),v=g(9352),N=g(5381),V=g(5187),H=g(5971),j=g(3319);function p(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-button",5),s.nI1(1,"transloco"),s.bIt("click",function(){_.eBV(a);const h=s.XpG(2);return _.Njj(h.handleZoomFit())}),s.nrm(2,"cue-button-icon",9),s.k0s()}2&f&&s.Y8G("cueTooltip",s.bMT(1,1,"components.map.tooltipZoomFit"))}function M(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-flexcontainer",3)(1,"cue-button",5),s.nI1(2,"transloco"),s.bIt("click",function(){_.eBV(a);const h=s.XpG();return _.Njj(h.handleZoomOut())}),s.nrm(3,"cue-button-icon",6),s.k0s(),s.j41(4,"cue-button",5),s.nI1(5,"transloco"),s.bIt("click",function(){_.eBV(a);const h=s.XpG();return _.Njj(h.handleZoomIn())}),s.nrm(6,"cue-button-icon",7),s.k0s(),s.nVh(7,p,3,3,"cue-button",8),s.k0s()}if(2&f){const a=s.XpG();s.R7$(),s.Y8G("cueTooltip",s.bMT(2,3,"components.map.tooltipZoomOut")),s.R7$(3),s.Y8G("cueTooltip",s.bMT(5,5,"components.map.tooltipZoomIn")),s.R7$(3),s.vxM(a.displayZoomFit()?7:-1)}}function P(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(h){_.eBV(a);const k=s.XpG();return s.DH7(k.layersVisible,h)||(k.layersVisible=h),_.Njj(h)}),s.nrm(3,"cue-button-icon",11),s.k0s()}if(2&f){const a=s.XpG();s.AVh("border-left",a.options().displayZoom&&a.displayLayerToggle()),s.Y8G("cueTooltip",a.layersVisible()?s.bMT(1,6,"components.map.tooltipHideLayers"):s.bMT(2,8,"components.map.tooltipShowLayers"))("toggleButton",!0),s.R50("selected",a.layersVisible),s.R7$(3),s.Y8G("icon",a.layersVisible()?"layers-clear":"layers")}}function E(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(h){_.eBV(a);const k=s.XpG();return s.DH7(k.geoFenceDrawEnabled,h)||(k.geoFenceDrawEnabled=h),_.Njj(h)}),s.nrm(3,"cue-button-icon",12),s.k0s()}if(2&f){const a=s.XpG();s.AVh("border-left",a.options().displayGeofenceDraw),s.Y8G("cueTooltip",a.geoFenceDrawEnabled()?s.bMT(1,5,"components.map.tooltipEndDrawGeofence"):s.bMT(2,7,"components.map.tooltipDrawGeofence"))("toggleButton",!0),s.R50("selected",a.geoFenceDrawEnabled)}}let F=(()=>{class f{_service=(0,_.WQX)(I.u);layerService=(0,_.WQX)(l.B);mapLayers=(0,y.ot)(this.layerService.layers);options=(0,A.hFB)(new w.AA);zoom=(0,A.geq)(1);rotate=(0,A.CGW)();geoFenceDrawEnabled=(0,A.geq)(!1);layersVisible=(0,A.geq)(!1);hasLayers=(0,$.EW)(()=>void 0!==this.mapLayers()&&this.mapLayers().length>0);displayLayerToggle=(0,$.EW)(()=>this.options().displayLayerToggle&&this.hasLayers());displayZoomFit=(0,$.EW)(()=>this.options().displayZoom&&this.hasLayers());selectMenuPositions=(0,$.EW)(()=>"top"===this.options().position?"bottomleft":"topleft");handleZoomIn(){this._service.zoomIn()}handleZoomOut(){this._service.zoomOut()}handleZoomFit(){this._service.fitGeoJSONBBOX(void 0,.01)}static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-map-toolbar"]],inputs:{options:[1,"options"],zoom:[1,"zoom"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],layersVisible:[1,"layersVisible"]},outputs:{zoom:"zoomChange",rotate:"rotate",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",layersVisible:"layersVisibleChange"},decls:6,vars:4,consts:[["justify","center",1,"container"],[1,"toolbar",3,"padded"],["align","center"],["align","center","gap","s"],["size","xs","variant","ghost",3,"border-left","cueTooltip","toggleButton","selected"],["size","xs","variant","tertiary",3,"click","cueTooltip"],["icon","zoom-out"],["icon","zoom-in"],["size","xs","variant","tertiary",3,"cueTooltip"],["icon","zoom-fit"],["size","xs","variant","ghost",3,"selectedChange","cueTooltip","toggleButton","selected"],[3,"icon"],["icon","polygon"]],template:function(c,h){1&c&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-card",1)(2,"cue-flexcontainer",2),s.nVh(3,M,8,7,"cue-flexcontainer",3),s.nVh(4,P,4,10,"cue-button",4),s.nVh(5,E,4,9,"cue-button",4),s.k0s()()()),2&c&&(s.R7$(),s.Y8G("padded",!1),s.R7$(2),s.vxM(h.options().displayZoom?3:-1),s.R7$(),s.vxM(h.displayLayerToggle()?4:-1),s.R7$(),s.vxM(h.options().displayGeofenceDraw?5:-1))},dependencies:[N.FlexContainer,V.Card,H.Button,j.ButtonIcon,D.d,v.Kj],styles:[".container[_ngcontent-%COMP%]{width:100%;pointer-events:none}.toolbar[_ngcontent-%COMP%]{pointer-events:all;padding:5px 10px}.border-left[_ngcontent-%COMP%]{border-left:1px solid;padding-left:12px}"],changeDetection:0})}return f})();var z=g(7023),X=g(1024),J=g(9421);function re(f,S){if(1&f&&s.nrm(0,"cue-key-val",1),2&f){const a=S.$implicit;s.Y8G("key",a.key)("val",a.val)}}let ye=(()=>{class f{props=(0,A.hFB)(null);keyVals=(0,$.EW)(()=>{const a=this.props();return a?Object.entries(a).map(([c,h])=>({key:c,val:String(h)})):[]});static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-props-panel"]],inputs:{props:[1,"props"]},decls:4,vars:0,consts:[[2,"height","100%","overflow-y","auto"],[3,"key","val"]],template:function(c,h){1&c&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-key-val-list"),s.Z7z(2,re,1,2,"cue-key-val",1,s.Vm6),s.k0s()()),2&c&&(s.R7$(2),s.Dyx(h.keyVals()))},dependencies:[X.p,J.F,N.FlexContainer],encapsulation:2,changeDetection:0})}return f})();var he=g(7517);let pe=(()=>{class f{layerService=(0,_.WQX)(l.B);mapLayers=(0,y.ot)(this.layerService.layers);layerDefs=(0,$.EW)(()=>{const a=this.mapLayers();return a?a.map(c=>({label:c.label,color:c.color??"#000000",visible:c.visible,category:c.category})):[]});updateSingle(a){const c=this.mapLayers()?.find(h=>h.label===a.label);c&&this.layerService.toggleVisibility(c.id)}updateAll(a){const c=this.mapLayers();if(c)for(const h of c)h.visible===a&&this.layerService.toggleVisibility(h.id)}static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-layer-panel"]],decls:1,vars:1,consts:[[3,"layerChange","visibilityAll","layers"]],template:function(c,h){1&c&&(s.j41(0,"cue-layer-legend",0),s.bIt("layerChange",function(K){return h.updateSingle(K)})("visibilityAll",function(K){return h.updateAll(K)}),s.k0s()),2&c&&s.Y8G("layers",h.layerDefs())},dependencies:[T.MD,he.P],encapsulation:2})}return f})();var me=g(140),te=g(6986);function ve(f){const S=f.flatMap(a=>{const c=function Oe(f){switch(f.type){case"Point":return[f.coordinates[0],f.coordinates[1]];case"MultiPoint":{if(!f.coordinates.length)return null;const S=f.coordinates.reduce((a,c)=>[a[0]+c[0],a[1]+c[1]],[0,0]);return[S[0]/f.coordinates.length,S[1]/f.coordinates.length]}case"LineString":{if(!f.coordinates.length)return null;const S=Math.floor(f.coordinates.length/2);return[f.coordinates[S][0],f.coordinates[S][1]]}case"MultiLineString":{if(!f.coordinates.length||!f.coordinates[0].length)return null;const S=f.coordinates[0],a=Math.floor(S.length/2);return[S[a][0],S[a][1]]}case"Polygon":{if(!f.coordinates.length||!f.coordinates[0].length)return null;const S=f.coordinates[0],a=S.reduce((c,h)=>[c[0]+h[0],c[1]+h[1]],[0,0]);return[a[0]/S.length,a[1]/S.length]}case"MultiPolygon":{if(!f.coordinates.length||!f.coordinates[0]?.length||!f.coordinates[0][0]?.length)return null;const S=f.coordinates[0][0],a=S.reduce((c,h)=>[c[0]+h[0],c[1]+h[1]],[0,0]);return[a[0]/S.length,a[1]/S.length]}default:return null}}(a.geometry);return c?[{type:"Feature",id:a.id,geometry:{type:"Point",coordinates:c},properties:{...a.properties??{},_isCentroid:!0}}]:[]});return[...f,...S]}const ut=["rgba(255, 0, 0, 0.5)","rgba(0, 0, 255, 0.5)","rgba(0, 255, 0, 0.5)","rgba(255, 165, 0, 0.5)","rgba(128, 0, 128, 0.5)","rgba(255, 192, 203, 0.5)","rgba(255, 255, 0, 0.5)"];function _t(f){const S=f.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d\.]+))?\)/);if(S)return{r:parseInt(S[1]),g:parseInt(S[2]),b:parseInt(S[3]),a:S[4]?parseFloat(S[4]):1};const a=f.match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/);if(a){const c=a[1];return{r:parseInt(3===c.length?c[0]+c[0]:c.slice(0,2),16),g:parseInt(3===c.length?c[1]+c[1]:c.slice(2,4),16),b:parseInt(3===c.length?c[2]+c[2]:c.slice(4,6),16),a:1}}return{r:0,g:0,b:0,a:1}}function je(f){if(0===f.length)return ut[0];if(1===f.length)return f[0].color;const S=f.map(ae=>({...ae,totalWeight:ae.featureCount*ae.weight})).sort((ae,ue)=>ue.totalWeight-ae.totalWeight),a=S.reduce((ae,ue)=>ae+ue.totalWeight,0),c=S[0];if(c.totalWeight/a>.6)return c.color;const h=S.slice(0,Math.min(3,S.length)),k=h.reduce((ae,ue)=>ae+ue.totalWeight,0);let K=0,oe=0,ne=0,de=0;for(const ae of h){const ue=_t(ae.color),_e=ae.totalWeight/k;K+=ue.r*_e,oe+=ue.g*_e,ne+=ue.b*_e,de+=ue.a*_e}return function dt(f,S,a,c=1){return c<1?`rgba(${Math.round(f)}, ${Math.round(S)}, ${Math.round(a)}, ${c})`:`rgb(${Math.round(f)}, ${Math.round(S)}, ${Math.round(a)})`}(K,oe,ne,de)}function Ze(f,S,a,c){if(!c||"Point"!==a&&"MultiPoint"!==a)return[{color:S,weight:1,featureCount:f.length}];const h=f.length;if(h<10)return[{color:S,weight:1,featureCount:h}];let k=0,K=0,oe=0;h>=750?(k=Math.floor(.1*h),K=Math.floor(.3*h),oe=h-k-K):h>=100?(K=Math.floor(.4*h),oe=h-K):(oe=Math.floor(.8*h),K=h-oe);const ne=[];return oe>0&&ne.push({color:S,weight:1,featureCount:oe}),K>0&&ne.push({color:"#f28cb1",weight:2,featureCount:K}),k>0&&ne.push({color:"#e2f552",weight:3,featureCount:k}),ne}function Qe(f,S,a,c,h,k){const K=Array.isArray(c)?c:[c];(0,te.j5)(h)?f.layerService.loadGeoJSONLayerGroup(S,a,K,{cluster:!1,zoomToFit:k.zoomToFit,visible:k.visible,label:k.label,color:k.color}):K.length>1||("Point"===h||"MultiPoint"===h)&&Array.isArray(K)&&K.length>1?f.layerService.loadGeoJSONLayerGroup(S,a,K,{cluster:(0,te.n7)(h,k.cluster),zoomToFit:k.zoomToFit,visible:k.visible,label:k.label,color:k.color}):f.loadGeoJSON(S,a,K[0],(0,te.n7)(h,k.cluster),k.zoomToFit)}var vt=g(6756),bt=g(356),ft=g(6279);const Xe=["map"],qe=f=>({position:"bottomleft",hoveredFeature:f}),Et=(f,S)=>S.label;function Mt(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-menu-item",6),s.bIt("click",function(h){const k=_.eBV(a).$implicit;return _.Njj(k.action(h))}),s.EFF(1),s.k0s()}if(2&f){const a=S.$implicit;s.R7$(),s.JRh(a.label)}}function Ct(f,S){if(1&f&&(s.j41(0,"cue-menu-wrap"),s.Z7z(1,Mt,2,1,"cue-menu-item",null,Et),s.k0s()),2&f){const a=s.XpG();s.R7$(),s.Dyx(a.contextMenuItems())}}function et(f,S){if(1&f&&(s.j41(0,"span"),s.EFF(1),s.k0s()),2&f){const a=s.XpG();s.R7$(),s.JRh(a.mapService.error())}}function Lt(f,S){if(1&f){const a=s.RV6();s.j41(0,"cue-map-toolbar",8),s.mxI("zoomChange",function(h){_.eBV(a);const k=s.XpG(2);return s.DH7(k.zoom,h)||(k.zoom=h),_.Njj(h)})("layersVisibleChange",function(h){_.eBV(a);const k=s.XpG(2);return s.DH7(k.layerPanelVisible,h)||(k.layerPanelVisible=h),_.Njj(h)})("geoFenceDrawEnabledChange",function(h){_.eBV(a);const k=s.XpG(2);return s.DH7(k.geoFenceDrawEnabled,h)||(k.geoFenceDrawEnabled=h),_.Njj(h)}),s.k0s()}if(2&f){const a=s.XpG(),c=s.XpG();s.Aen(c.toolbarStyle()),s.Y8G("options",a),s.R50("zoom",c.zoom)("layersVisible",c.layerPanelVisible)("geoFenceDrawEnabled",c.geoFenceDrawEnabled)}}function Tt(f,S){1&f&&s.nVh(0,Lt,1,6,"cue-map-toolbar",7),2&f&&s.vxM(S.hidden?-1:0)}function tt(f,S){1&f&&(s.j41(0,"cue-card",4),s.nrm(1,"cue-layer-panel"),s.k0s())}function Rt(f,S){1&f&&(s.j41(0,"cue-card",5),s.nrm(1,"cue-props-panel",9),s.k0s()),2&f&&(s.R7$(),s.Y8G("props",S))}function nt(f,S){if(1&f&&(s.j41(0,"div",11),s.EFF(1),s.k0s()),2&f){const a=S,c=s.XpG();s.xc7("left",a.x,"px")("top",a.y,"px"),s.R7$(),s.SpI(" ",c," ")}}function St(f,S){if(1&f&&s.nVh(0,nt,2,5,"div",10),2&f){let a;const c=s.XpG();s.vxM((a=c.hoveredTooltipPosition())?0:-1,a)}}let Pt=(()=>{class f{mapService=(0,_.WQX)(I.u);drawService=(0,_.WQX)(O.M);settings=(0,A.hFB)(new w.yY);center=(0,A.hFB)([8.5,47.4]);layerPanelVisible=(0,A.geq)(!1);zoom=(0,A.geq)(2);instruction=(0,A.geq)("Hello");layers=(0,A.hFB)([]);zoomToFit=(0,A.hFB)(!0);zoomToFitEachLayer=(0,A.hFB)(!1);splitLayersByGeometryType=(0,A.hFB)(!0);maxClickZoom=(0,A.hFB)(1/0);borderRadius=(0,A.hFB)("0");geoFenceDrawEnabled=(0,A.geq)(!1);contextMenuItemsBefore=(0,A.hFB)([]);contextMenuItemsAfter=(0,A.hFB)([]);immidiateDrawMode=(0,A.hFB)(void 0);hoverTooltipFn=(0,A.hFB)(null);mapReady=(0,A.CGW)();clickedMap=(0,A.CGW)();pannedMap=(0,A.CGW)();panningMap=(0,A.CGW)();zoomedMap=(0,A.CGW)();clickedFeature=(0,A.CGW)();hoveredFeature=(0,A.CGW)();drawEvent=(0,A.CGW)();layersSaturated=(0,$.EW)(()=>this.layers().map((a,c)=>{const h={...a};return h.color||(h.color=vt.BK[c]),h}));toolbarOptions=(0,$.EW)(()=>this.settings().toolbar);featureBeingHovered=(0,_.vPA)(void 0);lastClickedFeatureEvent=(0,_.vPA)(void 0);lastHoveredFeatureEvent=(0,_.vPA)(void 0);shownProperties=(0,_.vPA)(null);hoveredTooltipLabel=(0,$.EW)(()=>{const a=this.hoverTooltipFn();if(!a)return null;const c=this.lastHoveredFeatureEvent();return c?a(c.feature.properties??{})??null:null});hoveredTooltipPosition=(0,$.EW)(()=>{if(!this.hoveredTooltipLabel())return null;const a=this.lastHoveredFeatureEvent();if(!a)return null;const c=this.mapService.map;if(!c)return null;const h=c.project([a.lngLat.lng,a.lngLat.lat]);return{x:h.x,y:h.y}});_featureClickedThisTick=!1;_previousLayersHash=(0,_.vPA)("");_userHasInteracted=(0,_.vPA)(!1);toolbarStyle=(0,$.EW)(()=>{const a=this.toolbarOptions();return{position:"absolute",left:a.margin,right:a.margin,["top"===a.position?"top":"bottom"]:a.margin,"z-index":"10",display:"flex","justify-content":"center"}});contextMenuEnabled=(0,$.EW)(()=>{const a=this.contextMenuItems().length>0,c=this.featureBeingHovered(),h=this.lastClickedFeatureEvent();return a&&(void 0!==c||void 0!==h)});contextMenuItems=(0,$.EW)(()=>{const a=this.lastHoveredFeatureEvent(),c=this.lastClickedFeatureEvent(),k=(a?.feature||c?.feature)?.properties||null,K=k?Object.fromEntries(Object.entries(k).filter(([_e])=>!_e.startsWith("_"))):null,oe=a?.lngLat||c?.lngLat||null,de=[...this.contextMenuItemsBefore()||[]],ae=this.settings().contextMenu;K&&Object.keys(K).length>0&&ae.showProperties&&de.push({label:"Show properties",action:()=>{this.shownProperties.update(()=>K)}}),oe&&ae.showFlyTo&&de.push({label:"Fly to feature",action:()=>{this.mapService.flyTo([oe.lng,oe.lat],this.zoom())}});const ue=this.contextMenuItemsAfter()||[];return[...de,...ue]});_mapContainer;_destroy$=new L.B;constructor(){this._subscribeToServiceOutputs(),this._setupEffects(),(0,s.mal)(()=>{this._destroy$.closed||this._tryInitializeMap()})}ngOnDestroy(){this._destroy$.next(),this._destroy$.complete(),this.drawService.destroy(),this.mapService.destroy()}_subscribeToServiceOutputs(){this.mapService.mapReady.pipe((0,y.pQ)()).subscribe(()=>this.mapReady.emit()),this.mapService.clickedMap.pipe((0,y.pQ)()).subscribe(a=>{this._featureClickedThisTick||(this.lastClickedFeatureEvent.update(()=>{}),this.lastHoveredFeatureEvent.update(()=>{}),this.featureBeingHovered.update(()=>{}),this.clickedMap.emit(a),this.shownProperties.update(()=>null))}),this.mapService.pannedMap.pipe((0,y.pQ)()).subscribe(a=>{this._userHasInteracted.set(!0),this.pannedMap.emit(a)}),this.mapService.panningMap.pipe((0,y.pQ)()).subscribe(a=>this.panningMap.emit(a)),this.mapService.zoomedMap.pipe((0,y.pQ)()).subscribe(a=>{this._userHasInteracted.set(!0),this.zoomedMap.emit(this.mapService.getZoom()??this.zoom())}),this.mapService.clickedFeature.pipe((0,y.pQ)()).subscribe(a=>{this._featureClickedThisTick=!0,queueMicrotask(()=>{this._featureClickedThisTick=!1}),this.lastClickedFeatureEvent.update(()=>a),this.clickedFeature.emit(a);const c=a.feature?.geometry?.type,h="Point"===c||"MultiPoint"===c,k=this.mapService.getZoom()??0,K=this.contextMenuItems().length>0;h&&!K&&k<this.maxClickZoom()&&this.mapService.zoomToCoordinate(a.lngLat)}),this.mapService.hoveredFeature.pipe((0,y.pQ)()).subscribe(a=>{this.featureBeingHovered.update(()=>a?.feature),this.lastHoveredFeatureEvent.update(()=>a),this.hoveredFeature.emit(a)})}_setupEffects(){var a=this;(0,_.QZP)(()=>{"polygon"===this.immidiateDrawMode()&&(this.geoFenceDrawEnabled.set(!0),setTimeout(()=>{this.drawService.setDrawMode(!0,this.settings().toolbar.clearGeofenceAfterDraw)},500))}),(0,_.QZP)(()=>this.mapService.flyTo(this.center(),this.zoom())),(0,_.QZP)(()=>{const h=this.settings()?.mapboxToken;h&&"string"==typeof h&&""!==h.trim()&&!this.mapService.isMapReady()&&this._tryInitializeMap()}),(0,_.QZP)(()=>{const c=this.geoFenceDrawEnabled();this.drawService.setDrawMode(c,this.settings().toolbar.clearGeofenceAfterDraw)}),(0,_.QZP)(()=>{const c=this.drawService.drawEvent();void 0!==c&&this.drawEvent.emit(c)}),(0,_.QZP)((0,B.A)(function*(){const c=a.layersSaturated();if(!c||0===c.length)return;const h=a._createLayersHash(c);if(h===a._previousLayersHash())return;a._previousLayersHash.set(h),yield a.mapService.waitForMapReady(),a.mapService.clearLayers();const K=a.zoomToFitEachLayer();c.forEach((ne,de)=>{!function ke(f,S,a,c,h,k,K){const oe=S.collection,ne=S.color??ut[a];let de;de="geometries"in oe?function Re(f){const S=f.geometries.map((c,h)=>({type:"Feature",geometry:c,properties:{},id:f.id?`${f.id}_${h}`:void 0})),a=new me.o(S);return a.id=f.id,a.bbox=f.bbox,a}(oe):oe;const ae=function De(f){const S=[];return f.forEach(a=>{a.geometry&&"GeometryCollection"===a.geometry.type?a.geometry.geometries.forEach((c,h)=>{S.push({type:"Feature",geometry:c,properties:a.properties||{},id:a.id?`${a.id}_${h}`:void 0})}):S.push(a)}),S}(de.features),ue=new me.o(ae);ue.id=de.id,ue.bbox=de.bbox;let _e=ne;if(!k){const Z=S.id.toString(),q=ae[0]?.geometry?.type||"Point";_e=je(Ze(ae,ne,q,c));let be=K(Z,q,_e,Z),Pe=ue;const Be="Point"!==q&&"MultiPoint"!==q,Me=(0,te.j5)(q),ge=(0,te.dx)(q);if(c&&Be&&!Me&&!ge&&be){const rt=Array.isArray(be)?be:[be],se=ve(ae);Pe=new me.o(se),Pe.id=ue.id,Pe.bbox=ue.bbox,be=[(0,te.g8)(`${Z}-centroid`,Z,_e),...rt.map(it=>({...it,minzoom:te.A4}))]}return void(be&&Qe(f,Z,Pe,be,q,{cluster:c,zoomToFit:h,visible:!0,label:S.label||S.id.toString(),color:_e}))}if(k){const Z=new Set(ae.map(ie=>ie.geometry.type)),q=[];return Z.forEach(ie=>{const be=`${S.id.toString()}-${ie}`,Pe=ae.filter(ge=>ge.geometry.type===ie),Be=Ze(Pe,ne,ie,c);q.push(...Be);let Me=K(be,ie,ne,be);if(Me){let ge=new me.o(Pe);ge.id=ue.id,ge.bbox=ue.bbox;const rt="Point"!==ie&&"MultiPoint"!==ie,se=(0,te.j5)(ie),ot=(0,te.dx)(ie);if(c&&rt&&!se&&!ot){const it=Array.isArray(Me)?Me:[Me],It=ve(Pe);ge=new me.o(It),ge.id=ue.id,ge.bbox=ue.bbox,Me=[(0,te.g8)(`${be}-centroid`,be,ne),...it.map(st=>({...st,minzoom:te.A4}))]}Qe(f,be,ge,Me,ie,{cluster:c,zoomToFit:h,visible:!0,label:Z.size>1?`${S.label||S.id} (${ie})`:`${S.label||S.id}`,color:ne})}}),void(q.length>0&&(_e=je(q),f.layerService.getLayer(S.id.toString())&&f.layerService.updateLayer(S.id.toString(),{color:_e})))}const Ee=new Map;ae.forEach(Z=>{const q=Z.geometry.type;let ie;ie="Point"===q||"MultiPoint"===q?"Point":"LineString"===q||"MultiLineString"===q?"LineString":"Polygon"===q||"MultiPolygon"===q?"Polygon":q,Ee.has(ie)||Ee.set(ie,[]),Ee.get(ie).push(q)});const Ne=[];Ee.forEach((Z,q)=>{const ie=`${S.id.toString()}-${q}`,be=ae.filter(Me=>{const ge=Me.geometry.type;return"Point"===q?"Point"===ge||"MultiPoint"===ge:"LineString"===q?"LineString"===ge||"MultiLineString"===ge:"Polygon"===q?"Polygon"===ge||"MultiPolygon"===ge:ge===q}),Pe=Ze(be,ne,q,c);Ne.push(...Pe);const Be=K(ie,q,ne,ie);if(Be){const Me=new me.o(be);Me.id=ue.id,Me.bbox=ue.bbox,Qe(f,ie,Me,Be,q,{cluster:c,zoomToFit:h,visible:!0,label:Ee.size>1?`${S.label||S.id} (${q})`:`${S.label||S.id}`,color:ne})}}),Ne.length>0&&(_e=je(Ne),f.layerService.getLayer(S.id.toString())&&f.layerService.updateLayer(S.id.toString(),{color:_e}))}(a.mapService,ne,de,ne.cluster,K&&ne.zoomToFit,a.splitLayersByGeometryType(),te.Ln)});const oe=c.some(ne=>ne.zoomToFit);(a.zoomToFit()&&!K&&!a._userHasInteracted()||oe&&!K)&&a.mapService.fitGeoJSONBBOX()}))}_tryInitializeMap(){if(this._destroy$.closed)return;const c=this.settings()?.mapboxToken,h=c&&"string"==typeof c&&""!==c.trim(),k=this._mapContainer,K=!this.mapService.isMapReady();h&&k&&K&&(this._userHasInteracted.set(!1),this.mapService.init(this._mapContainer.nativeElement,c,this.center(),this.zoom(),this.borderRadius()))}_createLayersHash(a){return a.map(c=>{const h=c.collection;let k=0;return h&&"FeatureCollection"===h.type&&"features"in h&&(k=Array.isArray(h.features)?h.features.length:0),`${c.id}|${c.label}|${c.visible}|${k}`}).join("::")}static \u0275fac=function(c){return new(c||f)};static \u0275cmp=s.VBU({type:f,selectors:[["cue-map"]],viewQuery:function(c,h){if(1&c&&s.GBs(Xe,5),2&c){let k;s.mGM(k=s.lsd())&&(h._mapContainer=k.first)}},hostAttrs:["data-component","cue-map-main"],inputs:{settings:[1,"settings"],center:[1,"center"],layerPanelVisible:[1,"layerPanelVisible"],zoom:[1,"zoom"],instruction:[1,"instruction"],layers:[1,"layers"],zoomToFit:[1,"zoomToFit"],zoomToFitEachLayer:[1,"zoomToFitEachLayer"],splitLayersByGeometryType:[1,"splitLayersByGeometryType"],maxClickZoom:[1,"maxClickZoom"],borderRadius:[1,"borderRadius"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],contextMenuItemsBefore:[1,"contextMenuItemsBefore"],contextMenuItemsAfter:[1,"contextMenuItemsAfter"],immidiateDrawMode:[1,"immidiateDrawMode"],hoverTooltipFn:[1,"hoverTooltipFn"]},outputs:{layerPanelVisible:"layerPanelVisibleChange",zoom:"zoomChange",instruction:"instructionChange",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",mapReady:"mapReady",clickedMap:"clickedMap",pannedMap:"pannedMap",panningMap:"panningMap",zoomedMap:"zoomedMap",clickedFeature:"clickedFeature",hoveredFeature:"hoveredFeature",drawEvent:"drawEvent"},features:[s.Jv_([I.u,O.M,l.B])],decls:10,vars:10,consts:[["hoveringFeature",""],["map",""],["direction","row",1,"container"],["id","map","cueResized","","cueDarkMode","","trigger","leftclick",3,"darkModeChange","resized","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"layer-panel"],[1,"props-panel"],[3,"click"],[3,"options","style","zoom","layersVisible","geoFenceDrawEnabled"],[3,"zoomChange","layersVisibleChange","geoFenceDrawEnabledChange","options","zoom","layersVisible","geoFenceDrawEnabled"],[3,"props"],[1,"hover-tooltip",3,"left","top"],[1,"hover-tooltip"]],template:function(c,h){if(1&c&&(s.DNE(0,Ct,3,0,"ng-template",null,0,s.C5r),s.j41(2,"cue-flexcontainer",2)(3,"div",3,1),s.bIt("darkModeChange",function(K){return h.mapService.setDarkMode(K)})("resized",function(){return h.mapService.onParentResize()}),s.k0s(),s.nVh(5,et,2,1,"span"),s.nVh(6,Tt,1,1),s.nVh(7,tt,2,0,"cue-card",4),s.nVh(8,Rt,2,1,"cue-card",5),s.nVh(9,St,1,1),s.k0s()),2&c){let k,K,oe;const ne=s.sdS(1);s.R7$(3),s.Y8G("cueContextMenu",ne)("contextMenuData",s.eq3(8,qe,h.lastHoveredFeatureEvent()))("cueContextEnabled",h.contextMenuEnabled()),s.R7$(2),s.vxM(h.mapService.error()?5:-1),s.R7$(),s.vxM((k=h.toolbarOptions())?6:-1,k),s.R7$(),s.vxM(h.layerPanelVisible()?7:-1),s.R7$(),s.vxM((K=h.shownProperties())?8:-1,K),s.R7$(),s.vxM((oe=h.hoveredTooltipLabel())?9:-1,oe)}},dependencies:[T.MD,m.C,G.R,F,z.Q,bt.M,ft.D,N.FlexContainer,ye,pe,V.Card],styles:["#map[_ngcontent-%COMP%]{flex:1;min-height:0;border-radius:inherit;overflow:hidden}[_nghost-%COMP%]{display:flex;flex-direction:column;position:relative;width:100%;height:100%;min-height:400px;min-width:200px;flex:1 1 auto;align-self:stretch;box-sizing:border-box;overflow:hidden;border-radius:var(--cue-card-border-radius, inherit)}.mapboxgl-canvas-container[_ngcontent-%COMP%], .mapboxgl-canvas[_ngcontent-%COMP%]{border-radius:inherit!important}.mapboxgl-map[_ngcontent-%COMP%]{border-radius:inherit!important;overflow:hidden!important}.container[_ngcontent-%COMP%]{position:relative;width:100%;flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}.props-panel[_ngcontent-%COMP%]{position:absolute;top:8px;right:8px;bottom:8px;z-index:10}.layer-panel[_ngcontent-%COMP%]{position:absolute;top:10px;left:10px;z-index:10}cue-map-toolbar[_ngcontent-%COMP%]{position:absolute;left:0;right:0;bottom:0;z-index:10;display:flex;justify-content:center}.hover-tooltip[_ngcontent-%COMP%]{position:absolute;background:var(--cue-menu-background-color);color:var(--cue-menu-foreground-color);box-shadow:var(--cue-menu-box-shadow);border:1px solid var(--cue-menu-border-color);padding:3px 8px;border-radius:4px;font-family:var(--cue-font-family);font-size:.75rem;line-height:1.4;pointer-events:none;white-space:nowrap;z-index:20;transform:translate(-50%,calc(-100% - 8px))}"]})}return f})()},5949(fe,Q,g){"use strict";g.d(Q,{u:()=>G});var B=g(467),_=g(5802),A=g(2271),$=g(1413),s=g(3646),T=g(2843),m=g(9079);let G=(()=>{class I{_map;_mapContainer;_isInitializing=!1;_mapReadyPromiseResolve;_mapReady=new Promise(l=>{this._mapReadyPromiseResolve=l});_emittedReady=!1;_firstThemeReceived=!1;_hoveredFeature=(0,_.vPA)(void 0);_layerService=(0,_.WQX)(s.B);_drawService=(0,_.WQX)(T.M);mapboxToken=(0,_.vPA)("");center=(0,_.vPA)([8.5,47.4]);zoom=(0,_.vPA)(2);borderRadius=(0,_.vPA)("0");mapReady=new $.B;clickedMap=new $.B;pannedMap=new $.B;panningMap=new $.B;zoomedMap=new $.B;error=(0,_.vPA)("");get clickedFeature(){return this._layerService.clickedFeature}get hoveredFeature(){return this._layerService.hoveredFeature}get layers(){return this._layerService.layers}get layersSignal(){return this._layerService.layersSignal}get layerService(){return this._layerService}get drawService(){return this._drawService}get drawEvent(){return this._drawService.drawEvent}_darkMode=(0,_.vPA)(this._getSystemColorPreference());_styleId=(0,A.EW)(()=>this._darkMode()?"madsholten/clwjh4xeu00q601pnczm07jq6":"madsholten/clwjh6ug900q701pn6eor8p51");get map(){return this._map}constructor(){this._layerService.hoveredFeature.pipe((0,m.pQ)()).subscribe(l=>{this._hoveredFeature.set(l?.feature)}),(0,_.QZP)(()=>{this._styleId(),this._firstThemeReceived?void 0!==this._map&&this._updateStyle().catch(l=>{console.error("Failed to update map style:",l)}):this._firstThemeReceived=!0})}destroy(){if(this._layerService?.clearAllLayers(),this._drawService?.destroy(),this._map)try{this._map.remove()}catch(l){console.warn("Error removing map:",l)}this._map=void 0,this._mapContainer&&(this._mapContainer.innerHTML="",this._mapContainer=void 0),this._isInitializing=!1,this._emittedReady=!1,this._mapReady=new Promise(l=>{this._mapReadyPromiseResolve=l})}isMapReady(){return void 0!==this._map&&this._emittedReady&&!this._isInitializing}waitForMapReady(){var l=this;return(0,B.A)(function*(){return l._mapReady})()}init(l,y,L,w,D){var v=this;return(0,B.A)(function*(){if(y&&""!==y.trim())if(v._map||v._isInitializing)console.warn("MapService: Map is already initialized or currently initializing");else{v._isInitializing=!0,v.mapboxToken.set(y),v.center.set(L),v.zoom.set(w),v.borderRadius.set(D),v._mapContainer=l,v._mapContainer&&(v._mapContainer.innerHTML="");try{yield v._loadMapboxCSS();const N=yield g.e(1247).then(g.t.bind(g,1247,23)),V=N.default||N;if(!V||"function"!=typeof V.Map)throw new Error("Mapbox GL JS not properly loaded");V.accessToken=v.mapboxToken(),v._map=new V.Map({container:l,style:v._getMapStyleURL(),center:v.center(),zoom:v.zoom()}),v._applyBorderRadius(l),v._initEventListeners(v._map)}catch(N){console.error("Failed to load mapbox-gl:",N),v.error.set("Failed to load map library. Please ensure mapbox-gl is installed.")}finally{v._isInitializing=!1}}else console.warn("MapService: Cannot initialize map without valid mapbox token")})()}loadGeoJSON(l,y,L){var w=this;return(0,B.A)(function*(D,v,N,V=!0,H=!0){return yield w._mapReady,w._layerService.loadGeoJSONLayer(D,v,N,{cluster:V,zoomToFit:H,visible:!0,label:D})}).apply(this,arguments)}fitGeoJSONBBOX(l){var y=this;return(0,B.A)(function*(L,w=50,D=!0,v=19){yield y._mapReady,L?y._layerService.fitGeoJSONBounds(L,w,D,v):y._layerService.fitAllVisibleLayers(w)}).apply(this,arguments)}jumpTo(l,y){this._map?.jumpTo({center:l,zoom:y??this.zoom()})}setDarkMode(l){this._darkMode.set(l)}zoomToCoordinate(l){const y=this._map?.getZoom();if(!y)return;const L=y+1;this._map?.flyTo({center:l,zoom:L})}getZoom(){return this._map?.getZoom()}flyTo(l,y,L){this._map?.flyTo({center:l,zoom:y??this.zoom(),essential:!0,padding:L})}zoomIn(){if(!this._map)return;const l=this._map.getZoom();this._map.flyTo({zoom:l+1})}zoomOut(){if(!this._map)return;const l=this._map.getZoom();this._map.flyTo({zoom:l-1})}clearLayers(){this._layerService.clearAllLayers()}getImage(){const l=this._map?.getCanvas();if(void 0!==l)return l.toDataURL("image/png")}onParentResize(){this._map?.resize()}_loadMapboxCSS(){return(0,B.A)(function*(){return new Promise((l,y)=>{if(document.querySelector('link[href*="mapbox-gl.css"]'))return void l();const L=document.createElement("link");L.rel="stylesheet",L.href="https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css",L.onload=()=>l(),L.onerror=()=>{const w=document.createElement("link");w.rel="stylesheet",w.href="node_modules/mapbox-gl/dist/mapbox-gl.css",w.onload=()=>l(),w.onerror=()=>y(new Error("Failed to load Mapbox CSS")),document.head.appendChild(w)},document.head.appendChild(L)})})()}_applyBorderRadius(l){const y=this.borderRadius();let L=y;if("0"===y){const D=l.closest("cue-map")?.parentElement;D&&(L=getComputedStyle(D).borderRadius||"0")}"0"!==L&&(l.style.borderRadius=L,l.style.overflow="hidden",setTimeout(()=>{const w=l.querySelector(".mapboxgl-canvas"),D=l.querySelector(".mapboxgl-canvas-container"),v=l.querySelector(".mapboxgl-map");w&&(w.style.borderRadius=L),D&&(D.style.borderRadius=L),v&&(v.style.borderRadius=L)},100))}_initEventListeners(l){l.on("click",y=>{void 0===this._hoveredFeature()&&this.clickedMap.next(y)}),l.on("drag",y=>{void 0===this._hoveredFeature()&&this.panningMap.next(y)}),l.on("dragend",y=>{void 0===this._hoveredFeature()&&this.pannedMap.next(y)}),l.on("zoomend",y=>{this.zoomedMap.next(y)}),l.on("load",()=>{this._emittedReady||(this._layerService.initializeWithMap(l),this._drawService.initializeWithMap(l),this._mapReadyPromiseResolve(),this.mapReady.next(),this._emittedReady=!0)}),l.on("error",y=>{this.error.set(y.error.message)})}_getMapStyleURL(){return`mapbox://styles/${this._styleId()}`}_updateStyle(){var l=this;return(0,B.A)(function*(){if(void 0===l._map)return;const y=l._map.getZoom(),L=l._map.getCenter();void 0!==l._mapContainer&&(yield l.init(l._mapContainer,l.mapboxToken(),L,y,l.borderRadius()),setTimeout(()=>{l._layerService.reapplyLayers(),l._map?.flyTo({center:L,zoom:y})},500))})()}_getSystemColorPreference(){return typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches}static \u0275fac=function(y){return new(y||I)};static \u0275prov=_.jDH({token:I,factory:I.\u0275fac})}return I})()},2306(fe,Q,g){"use strict";g.d(Q,{AA:()=>$,ux:()=>s,yY:()=>A});var B=g(140),_=g(8402);class A{mapboxToken;contextMenu={showProperties:!0,showFlyTo:!0};toolbar=new $}class ${hidden=!1;position="bottom";margin="20px";displayZoom=!0;displayGeofenceDraw=!1;displayLayerToggle=!0;clearGeofenceAfterDraw=!0}class s{label;id;collection=new B.o;color;visible=!0;cluster=!0;zoomToFit=!0;category;constructor(m,G=(0,_.A)()){this.label=m,this.id=G}}},8334(fe,Q,g){"use strict";g.d(Q,{o:()=>$});var B=g(7705),_=g(5547);const A=["*"];let $=(()=>{class s{label=B.hFB.required();active=(0,B.geq)(!1);static \u0275fac=function(G){return new(G||s)};static \u0275cmp=_.VBU({type:s,selectors:[["cue-tab"]],hostVars:1,hostBindings:function(G,I){2&G&&_.Avn("hidden",!I.active())},inputs:{label:[1,"label"],active:[1,"active"]},outputs:{active:"activeChange"},ngContentSelectors:A,decls:1,vars:0,template:function(G,I){1&G&&(_.NAR(),_.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0}[hidden][_nghost-%COMP%]{display:none!important}"]})}return s})()},6455(fe,Q,g){"use strict";g.d(Q,{t:()=>w});var B=g(7705),_=g(5802),A=g(2271),$=g(8334),s=g(5187),T=g(9769),m=g(5547);const G=["*"],I=(D,v)=>v.label();function O(D,v){if(1&D&&(m.j41(0,"cue-card",1),m.eu8(1,2),m.k0s()),2&D){const N=m.XpG(),V=m.sdS(3);m.Y8G("variant",N._cardVariant())("padded",!1),m.R7$(),m.Y8G("ngTemplateOutlet",V)}}function l(D,v){if(1&D&&m.eu8(0,2),2&D){m.XpG();const N=m.sdS(3);m.Y8G("ngTemplateOutlet",N)}}function y(D,v){if(1&D){const N=m.RV6();m.j41(0,"button",6),m.bIt("click",function(){const H=_.eBV(N).$index,j=m.XpG(2);return _.Njj(j.setActive(H))}),m.EFF(1),m.k0s()}if(2&D){const N=v.$implicit,V=v.$index,H=m.XpG(2);m.AVh("active",H.activeIndex()===V),m.R7$(),m.SpI(" ",N.label()," ")}}function L(D,v){if(1&D&&(m.j41(0,"div",3),m.Z7z(1,y,2,3,"button",4,I),m.k0s(),m.j41(3,"div",5),m.SdG(4),m.k0s()),2&D){const N=m.XpG();m.R7$(),m.Dyx(N.tabs())}}let w=(()=>{class D{tabs=(0,B.tEk)($.o);activeIndex=(0,_.vPA)(0);variant=(0,B.hFB)("none");_cardVariant=(0,A.EW)(()=>"none"===this.variant()?"default":this.variant());constructor(){(0,_.QZP)(()=>{const N=this.tabs(),V=this.activeIndex();N.forEach((H,j)=>H.active.set(j===V))})}setActive(N){this.activeIndex.set(N)}static \u0275fac=function(V){return new(V||D)};static \u0275cmp=m.VBU({type:D,selectors:[["cue-tabs"]],contentQueries:function(V,H,j){1&V&&m.C6U(j,H.tabs,$.o,4),2&V&&m.NyB()},inputs:{variant:[1,"variant"]},ngContentSelectors:G,decls:4,vars:1,consts:[["inner",""],[2,"height","100%","width","100%","display","flex","flex-direction","column","overflow","hidden",3,"variant","padded"],[3,"ngTemplateOutlet"],[1,"tabs-header"],[1,"tab-button",3,"active"],[1,"tabs-content"],[1,"tab-button",3,"click"]],template:function(V,H){1&V&&(m.NAR(),m.nVh(0,O,2,3,"cue-card",1)(1,l,1,1,"ng-container",2),m.DNE(2,L,5,0,"ng-template",null,0,m.C5r)),2&V&&m.vxM("none"!==H.variant()?0:1)},dependencies:[s.Card,T.T3],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;box-sizing:border-box;border-radius:var(--cue-card-border-radius);border:1px solid var(--cue-card-border-color);background-color:var(--cue-default);color:var(--cue-defaultContrast);overflow:hidden}.tabs-header[_ngcontent-%COMP%]{display:flex;border-bottom:1px solid var(--cue-card-border-color);background-color:var(--background-color, var(--cue-default))}.tab-button[_ngcontent-%COMP%]{padding:10px 16px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;color:inherit;font-family:var(--cue-font-family);font-size:var(--cue-font-s-size);line-height:var(--cue-font-s-line-height);opacity:.6;transition:opacity .15s,border-bottom-color .15s}.tab-button[_ngcontent-%COMP%]:hover{opacity:.9}.tab-button.active[_ngcontent-%COMP%]{border-bottom-color:currentColor;opacity:1;font-weight:500}.tabs-content[_ngcontent-%COMP%]{padding:var(--cue-card-padding-y) var(--cue-card-padding-x);flex:1;min-height:0;box-sizing:border-box;display:flex;flex-direction:column}"]})}return D})()},140(fe,Q,g){"use strict";g.d(Q,{o:()=>B});class B{type="FeatureCollection";features=[];bbox;id;constructor(A=[]){this.features=A}addFeature(A){this.features.push(A)}removeFeature(A){return this.features.splice(A,1)[0]}getFeatureCount(){return this.features.length}clear(){this.features=[]}}},58(fe,Q,g){"use strict";function B(l){let y=0,L=-1,w=-1;for(let D=0;D<l.length;D++)if("("===l[D])y++,1===y&&(L=D+1);else if(")"===l[D]&&(y--,0===y)){w=D;break}return-1!==L&&-1!==w?l.substring(L,w):null}g.d(Q,{S:()=>I,n:()=>O});class _{x;y;z;constructor(y,L,w){this.x=y,this.y=L,this.z=w}}class A{points;constructor(y){this.points=y}}class ${lines;constructor(y){this.lines=y}}function I(l){if(l){if((l=l.trim().toUpperCase()).startsWith("POINT"))return function T(l){l=l.trim().toUpperCase();const L=B(l)?.split(" ")??[];return l.includes("POINT Z")?new _(parseFloat(L[0]),parseFloat(L[1]),parseFloat(L[2])):new _(parseFloat(L[0]),parseFloat(L[1]))}(l);if(l.startsWith("LINESTRING"))return function s(l){const y=B(l=l.trim().toUpperCase()),L=[];return y?.split(",").map(w=>w.trim().split(" ").map(D=>parseFloat(D))).map(w=>{L.push(new _(w[0],w[1],w[2]))}),new A(L)}(l);if(l.startsWith("POLYGON"))return function m(l){const y=B(l=l.trim().toUpperCase());if(!y)return new $([]);const L=y.match(/\(([^)]+)\)/g);if(!L)return new $([]);const w=L.map(D=>{const v=B(D);return v?v.split(",").map(N=>{const V=N.trim().split(" ");return V.length>=3?new _(parseFloat(V[0]),parseFloat(V[1]),parseFloat(V[2])):new _(parseFloat(V[0]),parseFloat(V[1]))}):[]});return new $(w)}(l)}}function O(l){if(l instanceof _)return{type:"Point",coordinates:void 0!==l.z?[l.x,l.y,l.z]:[l.x,l.y]};if(l instanceof A)return{type:"LineString",coordinates:l.points.map(y=>void 0!==y.z?[y.x,y.y,y.z]:[y.x,y.y])};if(l instanceof $)return{type:"Polygon",coordinates:l.lines.map(y=>y.map(L=>void 0!==L.z?[L.x,L.y,L.z]:[L.x,L.y]))};throw new Error("Unknown WKT type")}},362(fe){"use strict";fe.exports=function Q(g,B){if(g===B)return!0;if(g&&B&&"object"==typeof g&&"object"==typeof B){if(g.constructor!==B.constructor)return!1;var _,A,$;if(Array.isArray(g)){if((_=g.length)!=B.length)return!1;for(A=_;0!==A--;)if(!Q(g[A],B[A]))return!1;return!0}if(g.constructor===RegExp)return g.source===B.source&&g.flags===B.flags;if(g.valueOf!==Object.prototype.valueOf)return g.valueOf()===B.valueOf();if(g.toString!==Object.prototype.toString)return g.toString()===B.toString();if((_=($=Object.keys(g)).length)!==Object.keys(B).length)return!1;for(A=_;0!==A--;)if(!Object.prototype.hasOwnProperty.call(B,$[A]))return!1;for(A=_;0!==A--;){var s=$[A];if(!Q(g[s],B[s]))return!1}return!0}return g!=g&&B!=B}},5332(fe,Q,g){"use strict";g.d(Q,{k:()=>$});for(var _=[],A=0;A<256;++A)_.push((A+256).toString(16).slice(1));function $(m,G=0){return(_[m[G+0]]+_[m[G+1]]+_[m[G+2]]+_[m[G+3]]+"-"+_[m[G+4]]+_[m[G+5]]+"-"+_[m[G+6]]+_[m[G+7]]+"-"+_[m[G+8]]+_[m[G+9]]+"-"+_[m[G+10]]+_[m[G+11]]+_[m[G+12]]+_[m[G+13]]+_[m[G+14]]+_[m[G+15]]).toLowerCase()}},8402(fe,Q,g){"use strict";g.d(Q,{A:()=>G});const _={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var A,$=new Uint8Array(16);function s(){if(!A&&!(A=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return A($)}var T=g(5332);const G=function m(I,O,l){if(_.randomUUID&&!O&&!I)return _.randomUUID();var y=(I=I||{}).random||(I.rng||s)();if(y[6]=15&y[6]|64,y[8]=63&y[8]|128,O){l=l||0;for(var L=0;L<16;++L)O[l+L]=y[L];return O}return(0,T.k)(y)}},6119(fe){fe.exports.RADIUS=6378137,fe.exports.FLATTENING=1/298.257223563,fe.exports.POLAR_RADIUS=6356752.3142}}]);