@mappedin/marker-cluster 6.0.1-beta.50 → 6.0.1-beta.51

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 (2) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/package.json +2 -2
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- var nt=Object.defineProperty,mt=Object.defineProperties;var pt=Object.getOwnPropertyDescriptors;var st=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var it=n=>{throw TypeError(n)};var W=(n,t,e)=>t in n?nt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,y=(n,t)=>{for(var e in t||(t={}))gt.call(t,e)&&W(n,e,t[e]);if(st)for(var e of st(t))Et.call(t,e)&&W(n,e,t[e]);return n},P=(n,t)=>mt(n,pt(t)),i=(n,t)=>nt(n,"name",{value:t,configurable:!0});var c=(n,t,e)=>W(n,typeof t!="symbol"?t+"":t,e),ot=(n,t,e)=>t.has(n)||it("Cannot "+e);var r=(n,t,e)=>(ot(n,t,"read from private field"),e?e.call(n):t.get(n)),a=(n,t,e)=>t.has(n)?it("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),m=(n,t,e,s)=>(ot(n,t,"write to private field"),s?s.call(n,e):t.set(n,e),e);var h={env:{NODE_ENV:"production",npm_package_version:"6.0.1-beta.50"}};var yt="[MappedinJS]";function bt(n=""){let t="".concat(yt).concat(n?"-".concat(n):"");return{logState:h.env.NODE_ENV==="test"?3:0,log(...e){this.logState<=0&&console.log(t,...e)},warn(...e){this.logState<=1&&console.warn(t,...e)},error(...e){this.logState<=2&&console.error(t,...e)},assert(...e){console.assert(...e)},time(e){console.time(e)},timeEnd(e){console.timeEnd(e)},setLevel(e){0<=e&&e<=3&&(this.logState=e)}}}i(bt,"createLogger");var xt=bt();var v=xt;var H=class H extends Error{};i(H,"InvalidTokenError");var X=H;X.prototype.name="InvalidTokenError";function at(n,t,e=!1){let s=null,o=0;return function(...l){o++,o===1&&e===!0&&n(...l);let f=i(()=>{(!e||o>1)&&n(...l),s=null,o=0},"later");clearTimeout(s),s=setTimeout(f,t)}}i(at,"debounce");var Z=[0,4,6,8,10],Q=i(()=>{let n=new Array(16).fill(0),t=Math.random()*4294967296;for(let s=0;s<n.length;s++)s>0&&(s&3)===0&&(t=Math.random()*4294967296),n[s]=t>>>((s&3)<<3)&255;let e=n.map(s=>s.toString(16).padStart(2,"0"));return e[6]="4"+e[6][1],e[8]=["8","9","a","b"].includes(e[7][0])?e[7]:"a"+e[7][1],Z.map((s,o)=>e.slice(s,o===Z.length-1?void 0:Z[o+1]).join("")).join("-")},"randomId");var V=["red","blue","green","purple","orange","pink","brown","gray","black","magenta","cyan","silver","maroon","teal","aqua"],ut=i((n,t,e)=>'<div style="background-color:'.concat(t,";color:white;width:").concat(e,"px;height:").concat(e,"px;border-radius:50%;text-align:center;line-height:").concat(e,"px;border:1px solid white;font-size:").concat(Math.floor(e*.7),'px;">').concat(n,"</div>"),"debugMarkerFn");import{Coordinate as lt}from"@mappedin/mappedin-js";var B=i(n=>parseFloat(n.toFixed(8)),"trimCoordValue"),ct=i((n,t)=>{if(n.length===0)return new lt({latitude:0,longitude:0});let e=n.reduce((o,l)=>o+l.latitude,0)/n.length,s=n.reduce((o,l)=>o+l.longitude,0)/n.length;return new lt({latitude:B(e),longitude:B(s),floorId:t!=null?t:n[0].floorId})},"averageCoords"),dt=i((n,t)=>n.length===0?"":[...n.map(e=>e.id).sort(),B(t.latitude),B(t.longitude),t.floorId].filter(e=>e!=null).join("-"),"getClusterId"),ht=i((n,t)=>{if(t<=0)throw new Error("Buffer must be greater than 0");return{minX:n.x-t/2,minY:n.y-t/2,maxX:n.x+t/2,maxY:n.y+t/2}},"bufferPoint");import It from"rbush";var R=i(n=>"".concat(n.x,",").concat(n.y),"serializePoint"),g,j=class j extends It{constructor(){super(...arguments);a(this,g,new Map);c(this,"load",i(e=>{for(let s of e)r(this,g).set(R(s),s);return super.load(e)},"load"));c(this,"insert",i(e=>(r(this,g).set(R(e),e),super.insert(e)),"insert"));c(this,"remove",i(e=>(r(this,g).delete(R(e)),super.remove(e)),"remove"));c(this,"clear",i(()=>(r(this,g).clear(),super.clear()),"clear"));c(this,"peek",i(()=>r(this,g).values().next().value,"peek"));c(this,"has",i(e=>r(this,g).has(R(e)),"has"));c(this,"find",i(e=>{for(let s of r(this,g).values())if(e(s))return s},"find"));c(this,"toBBox",i(e=>({minX:e.x,minY:e.y,maxX:e.x,maxY:e.y}),"toBBox"));c(this,"compareMinX",i((e,s)=>e.x-s.x,"compareMinX"));c(this,"compareMinY",i((e,s)=>e.y-s.y,"compareMinY"));c(this,"equals",i((e,s)=>e.x===s.x&&e.y===s.y,"equals"))}get size(){return r(this,g).size}};g=new WeakMap,i(j,"PointRBush");var w=j;var D,b,E,M,x,$,Y,tt=class tt{constructor(t){a(this,D);a(this,b,{threshold:100});a(this,E,new w);a(this,M,new Map);a(this,x,[]);a(this,$,i(()=>[...r(this,M).values()].map(t=>P(y({},r(this,D).getScreenCoordinateFromCoordinate(t.target.anchorTarget)),{markerId:t.id})),"#getScreenCoordinates"));a(this,Y,i(t=>{let e=[t];r(this,E).remove(t);let s=r(this,E).search(ht(t,r(this,b).threshold));if(s.length===0)return e;e.push(...s);for(let o of s)r(this,E).remove(o);return e},"#resolveNeighbours"));m(this,D,t)}setOptions(t){if(t.threshold!=null&&t.threshold<=0)throw new Error("Cluster threshold must be greater than 0");m(this,b,y(y({},r(this,b)),t))}load(t){r(this,M).clear();for(let e of t)r(this,M).set(e.id,e)}getClusters(){var l;let t=r(this,$).call(this);r(this,E).clear(),r(this,E).load(t);let e=r(this,E),s=[],o=[];for(;e.size>0;){let f=(l=e.find(C=>r(this,x).includes(C)))!=null?l:e.peek();if(f==null)break;o.push(f);let ft=r(this,Y).call(this,f).map(C=>r(this,M).get(C.markerId)).filter(C=>C!=null);s.push(ft)}return m(this,x,o),s}destroy(){r(this,M).clear(),r(this,E).clear(),m(this,x,[])}};D=new WeakMap,b=new WeakMap,E=new WeakMap,M=new WeakMap,x=new WeakMap,$=new WeakMap,Y=new WeakMap,i(tt,"ScreenDistanceClustering");var N=tt;var I,p,d,u,S,_,F,K,G,J,U,q,L,T,k,O,A,rt=class rt{constructor(t,e,s){c(this,"id",Q());a(this,I);a(this,p);a(this,d);a(this,u,{singleMarkersById:new Map,clustersById:new Map,clusterMarkersByClusterId:new Map,debugMarkersByClusterId:new Map,debugColorsByClusterId:new Map});a(this,S);a(this,_);a(this,F,i(()=>[...r(this,u).singleMarkersById.values()],"#getMarkers"));a(this,K,i(t=>{r(this,p).updateState(t,{enabled:!1})},"#hideMarker"));a(this,G,i(t=>{r(this,p).updateState(t,{enabled:!0})},"#showMarker"));a(this,J,i(()=>{let t=r(this,d).algorithm;return t.load(r(this,F).call(this)),t.getClusters()},"#getClusteredMarkers"));a(this,U,i(t=>{var s;let e=ct(t.map(o=>o.target.anchorTarget),(s=r(this,d).floor)==null?void 0:s.id);return{id:dt(t,e),markers:t,center:e}},"#createCluster"));a(this,q,i(t=>{var o;let e=(o=r(this,u).debugColorsByClusterId.get(t.id))!=null?o:V[0],s=r(this,S).call(this,t);s!=null&&r(this,u).clusterMarkersByClusterId.set(t.id,s);for(let l of t.markers)r(this,d).debug&&(l.contentEl.style.outline="2px solid ".concat(e)),r(this,d).hideClusteredMarkers&&r(this,K).call(this,l);if(r(this,d).debug){(s==null?void 0:s.contentEl.firstChild)instanceof HTMLElement&&(s.contentEl.firstChild.style.opacity="0.25");let l=r(this,p).Markers.add(t.center,ut(t.markers.length.toString(),e,20),{rank:"always-visible",zIndex:99});r(this,u).debugMarkersByClusterId.set(t.id,l)}},"#addClusterMarkers"));a(this,L,i(t=>{let e=r(this,u).clusterMarkersByClusterId.get(t.id);if(e!=null&&(r(this,p).Markers.remove(e),r(this,u).clusterMarkersByClusterId.delete(t.id)),r(this,d).debug){let s=r(this,u).debugMarkersByClusterId.get(t.id);s!=null&&(r(this,p).Markers.remove(s),r(this,u).debugMarkersByClusterId.delete(t.id))}for(let s of t.markers)r(this,G).call(this,s)},"#removeClusterMarkers"));a(this,T,i(()=>{let t=new Map(r(this,u).clustersById),e=[],s=r(this,J).call(this);for(let o=0;o<s.length;o++){let l=s[o];if(l.length<r(this,d).minSize)continue;let f=r(this,U).call(this,l);r(this,u).clustersById.has(f.id)?t.delete(f.id):e.push(f)}for(let o of t.values())r(this,L).call(this,o),r(this,u).clustersById.delete(o.id),r(this,d).debug&&r(this,u).debugColorsByClusterId.delete(o.id);for(let o of e){if(r(this,d).debug){let l=V[Math.floor(Math.random()*V.length)];r(this,u).debugColorsByClusterId.set(o.id,l)}r(this,q).call(this,o),r(this,u).clustersById.set(o.id,o)}},"#updateImmediately"));a(this,k,i(()=>{r(this,d).debounce===0?r(this,T).call(this):r(this,_).call(this)},"#update"));a(this,O,i(()=>{r(this,k).call(this)},"#handleCameraChange"));a(this,A,i(()=>{r(this,T).call(this)},"#handleFocus"));c(this,"add",i(t=>{var e,s;if(r(this,d).floor==null)r(this,d).floor=(s=r(this,I).getById("floor",(e=t.target.anchorTarget.floorId)!=null?e:""))!=null?s:null;else if(r(this,d).floor.id!==t.target.anchorTarget.floorId)throw new Error("Cannot cluster markers on different floors!");r(this,u).singleMarkersById.set(t.id,t),r(this,k).call(this)},"add"));c(this,"remove",i(t=>{if(!r(this,u).singleMarkersById.has(t.id)){v.log("Cannot remove marker ".concat(t.id," because it is not in the cluster!"));return}r(this,u).singleMarkersById.delete(t.id),r(this,k).call(this)},"remove"));c(this,"has",i(t=>r(this,u).singleMarkersById.has(t.id),"has"));c(this,"destroy",i(()=>{r(this,d).algorithm.destroy(),r(this,p).off("camera-change",r(this,O)),window.removeEventListener("focus",r(this,A));for(let[,t]of r(this,u).clustersById)r(this,L).call(this,t);for(let t of Object.values(r(this,u)))if(t instanceof Map)t.clear();else throw new Error("Encountered unexpected data type in cache! Potentially failed to clean up MarkerCluster.")},"destroy"));var l,f;let o;if((s==null?void 0:s.algorithm)==null){let z=new N(t);z.setOptions((l=s==null?void 0:s.algorithmOptions)!=null?l:{}),o=z}else o=s.algorithm,o.setOptions((f=s==null?void 0:s.algorithmOptions)!=null?f:{});if(m(this,d,P(y({floor:null,minSize:2,debounce:50,debug:!1,hideClusteredMarkers:!0},s),{algorithm:o})),m(this,p,t),m(this,I,Object.values(r(this,p).getMapData())[0]),r(this,I)==null)throw new Error("No map data found in MapView!");m(this,S,e),m(this,_,at(r(this,T),r(this,d).debounce)),r(this,p).on("camera-change",r(this,O)),window.addEventListener("focus",r(this,A))}get clusters(){return[...r(this,u).clustersById.values()]}};I=new WeakMap,p=new WeakMap,d=new WeakMap,u=new WeakMap,S=new WeakMap,_=new WeakMap,F=new WeakMap,K=new WeakMap,G=new WeakMap,J=new WeakMap,U=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,k=new WeakMap,O=new WeakMap,A=new WeakMap,i(rt,"MarkerCluster");var et=rt;export{et as MarkerCluster,w as PointRBush,N as ScreenDistanceClustering};
1
+ var ne=Object.defineProperty,me=Object.defineProperties;var pe=Object.getOwnPropertyDescriptors;var se=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;var ie=n=>{throw TypeError(n)};var W=(n,e,t)=>e in n?ne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))ge.call(e,t)&&W(n,t,e[t]);if(se)for(var t of se(e))Ee.call(e,t)&&W(n,t,e[t]);return n},P=(n,e)=>me(n,pe(e)),i=(n,e)=>ne(n,"name",{value:e,configurable:!0});var c=(n,e,t)=>W(n,typeof e!="symbol"?e+"":e,t),oe=(n,e,t)=>e.has(n)||ie("Cannot "+t);var r=(n,e,t)=>(oe(n,e,"read from private field"),t?t.call(n):e.get(n)),a=(n,e,t)=>e.has(n)?ie("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),m=(n,e,t,s)=>(oe(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t);var f={env:{NODE_ENV:"production",npm_package_version:"6.0.1-beta.51"}};var ye="[MappedinJS]";function be(n=""){let e="".concat(ye).concat(n?"-".concat(n):""),t=i((s,o)=>{if(typeof window<"u"&&window.rnDebug){let u=o.map(h=>h instanceof Error&&h.stack?"".concat(h.message,"\n").concat(h.stack):h);window.rnDebug("".concat(e," ").concat(s,": ").concat(u.join(" ")))}},"rnDebug");return{logState:f.env.NODE_ENV==="test"?3:0,log(...s){this.logState<=0&&(console.log(e,...s),t("log",s))},warn(...s){this.logState<=1&&(console.warn(e,...s),t("warn",s))},error(...s){this.logState<=2&&(console.error(e,...s),t("error",s))},assert(...s){console.assert(...s)},time(s){console.time(s)},timeEnd(s){console.timeEnd(s)},setLevel(s){0<=s&&s<=3&&(this.logState=s)}}}i(be,"createLogger");var xe=be();var v=xe;var H=class H extends Error{};i(H,"InvalidTokenError");var X=H;X.prototype.name="InvalidTokenError";function ae(n,e,t=!1){let s=null,o=0;return function(...u){o++,o===1&&t===!0&&n(...u);let h=i(()=>{(!t||o>1)&&n(...u),s=null,o=0},"later");clearTimeout(s),s=setTimeout(h,e)}}i(ae,"debounce");var Z=[0,4,6,8,10],Q=i(()=>{let n=new Array(16).fill(0),e=Math.random()*4294967296;for(let s=0;s<n.length;s++)s>0&&(s&3)===0&&(e=Math.random()*4294967296),n[s]=e>>>((s&3)<<3)&255;let t=n.map(s=>s.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],Z.map((s,o)=>t.slice(s,o===Z.length-1?void 0:Z[o+1]).join("")).join("-")},"randomId");var V=["red","blue","green","purple","orange","pink","brown","gray","black","magenta","cyan","silver","maroon","teal","aqua"],ue=i((n,e,t)=>'<div style="background-color:'.concat(e,";color:white;width:").concat(t,"px;height:").concat(t,"px;border-radius:50%;text-align:center;line-height:").concat(t,"px;border:1px solid white;font-size:").concat(Math.floor(t*.7),'px;">').concat(n,"</div>"),"debugMarkerFn");import{Coordinate as le}from"@mappedin/mappedin-js";var B=i(n=>parseFloat(n.toFixed(8)),"trimCoordValue"),ce=i((n,e)=>{if(n.length===0)return new le({latitude:0,longitude:0});let t=n.reduce((o,u)=>o+u.latitude,0)/n.length,s=n.reduce((o,u)=>o+u.longitude,0)/n.length;return new le({latitude:B(t),longitude:B(s),floorId:e!=null?e:n[0].floorId})},"averageCoords"),de=i((n,e)=>n.length===0?"":[...n.map(t=>t.id).sort(),B(e.latitude),B(e.longitude),e.floorId].filter(t=>t!=null).join("-"),"getClusterId"),he=i((n,e)=>{if(e<=0)throw new Error("Buffer must be greater than 0");return{minX:n.x-e/2,minY:n.y-e/2,maxX:n.x+e/2,maxY:n.y+e/2}},"bufferPoint");import Ie from"rbush";var $=i(n=>"".concat(n.x,",").concat(n.y),"serializePoint"),g,j=class j extends Ie{constructor(){super(...arguments);a(this,g,new Map);c(this,"load",i(t=>{for(let s of t)r(this,g).set($(s),s);return super.load(t)},"load"));c(this,"insert",i(t=>(r(this,g).set($(t),t),super.insert(t)),"insert"));c(this,"remove",i(t=>(r(this,g).delete($(t)),super.remove(t)),"remove"));c(this,"clear",i(()=>(r(this,g).clear(),super.clear()),"clear"));c(this,"peek",i(()=>r(this,g).values().next().value,"peek"));c(this,"has",i(t=>r(this,g).has($(t)),"has"));c(this,"find",i(t=>{for(let s of r(this,g).values())if(t(s))return s},"find"));c(this,"toBBox",i(t=>({minX:t.x,minY:t.y,maxX:t.x,maxY:t.y}),"toBBox"));c(this,"compareMinX",i((t,s)=>t.x-s.x,"compareMinX"));c(this,"compareMinY",i((t,s)=>t.y-s.y,"compareMinY"));c(this,"equals",i((t,s)=>t.x===s.x&&t.y===s.y,"equals"))}get size(){return r(this,g).size}};g=new WeakMap,i(j,"PointRBush");var C=j;var N,b,E,M,x,R,Y,ee=class ee{constructor(e){a(this,N);a(this,b,{threshold:100});a(this,E,new C);a(this,M,new Map);a(this,x,[]);a(this,R,i(()=>[...r(this,M).values()].map(e=>P(y({},r(this,N).getScreenCoordinateFromCoordinate(e.target.anchorTarget)),{markerId:e.id})),"#getScreenCoordinates"));a(this,Y,i(e=>{let t=[e];r(this,E).remove(e);let s=r(this,E).search(he(e,r(this,b).threshold));if(s.length===0)return t;t.push(...s);for(let o of s)r(this,E).remove(o);return t},"#resolveNeighbours"));m(this,N,e)}setOptions(e){if(e.threshold!=null&&e.threshold<=0)throw new Error("Cluster threshold must be greater than 0");m(this,b,y(y({},r(this,b)),e))}load(e){r(this,M).clear();for(let t of e)r(this,M).set(t.id,t)}getClusters(){var u;let e=r(this,R).call(this);r(this,E).clear(),r(this,E).load(e);let t=r(this,E),s=[],o=[];for(;t.size>0;){let h=(u=t.find(w=>r(this,x).includes(w)))!=null?u:t.peek();if(h==null)break;o.push(h);let fe=r(this,Y).call(this,h).map(w=>r(this,M).get(w.markerId)).filter(w=>w!=null);s.push(fe)}return m(this,x,o),s}destroy(){r(this,M).clear(),r(this,E).clear(),m(this,x,[])}};N=new WeakMap,b=new WeakMap,E=new WeakMap,M=new WeakMap,x=new WeakMap,R=new WeakMap,Y=new WeakMap,i(ee,"ScreenDistanceClustering");var D=ee;var I,p,d,l,S,_,F,K,G,J,U,q,L,T,k,O,A,re=class re{constructor(e,t,s){c(this,"id",Q());a(this,I);a(this,p);a(this,d);a(this,l,{singleMarkersById:new Map,clustersById:new Map,clusterMarkersByClusterId:new Map,debugMarkersByClusterId:new Map,debugColorsByClusterId:new Map});a(this,S);a(this,_);a(this,F,i(()=>[...r(this,l).singleMarkersById.values()],"#getMarkers"));a(this,K,i(e=>{r(this,p).updateState(e,{enabled:!1})},"#hideMarker"));a(this,G,i(e=>{r(this,p).updateState(e,{enabled:!0})},"#showMarker"));a(this,J,i(()=>{let e=r(this,d).algorithm;return e.load(r(this,F).call(this)),e.getClusters()},"#getClusteredMarkers"));a(this,U,i(e=>{var s;let t=ce(e.map(o=>o.target.anchorTarget),(s=r(this,d).floor)==null?void 0:s.id);return{id:de(e,t),markers:e,center:t}},"#createCluster"));a(this,q,i(e=>{var o;let t=(o=r(this,l).debugColorsByClusterId.get(e.id))!=null?o:V[0],s=r(this,S).call(this,e);s!=null&&r(this,l).clusterMarkersByClusterId.set(e.id,s);for(let u of e.markers)r(this,d).debug&&(u.contentEl.style.outline="2px solid ".concat(t)),r(this,d).hideClusteredMarkers&&r(this,K).call(this,u);if(r(this,d).debug){(s==null?void 0:s.contentEl.firstChild)instanceof HTMLElement&&(s.contentEl.firstChild.style.opacity="0.25");let u=r(this,p).Markers.add(e.center,ue(e.markers.length.toString(),t,20),{rank:"always-visible",zIndex:99});r(this,l).debugMarkersByClusterId.set(e.id,u)}},"#addClusterMarkers"));a(this,L,i(e=>{let t=r(this,l).clusterMarkersByClusterId.get(e.id);if(t!=null&&(r(this,p).Markers.remove(t),r(this,l).clusterMarkersByClusterId.delete(e.id)),r(this,d).debug){let s=r(this,l).debugMarkersByClusterId.get(e.id);s!=null&&(r(this,p).Markers.remove(s),r(this,l).debugMarkersByClusterId.delete(e.id))}for(let s of e.markers)r(this,G).call(this,s)},"#removeClusterMarkers"));a(this,T,i(()=>{let e=new Map(r(this,l).clustersById),t=[],s=r(this,J).call(this);for(let o=0;o<s.length;o++){let u=s[o];if(u.length<r(this,d).minSize)continue;let h=r(this,U).call(this,u);r(this,l).clustersById.has(h.id)?e.delete(h.id):t.push(h)}for(let o of e.values())r(this,L).call(this,o),r(this,l).clustersById.delete(o.id),r(this,d).debug&&r(this,l).debugColorsByClusterId.delete(o.id);for(let o of t){if(r(this,d).debug){let u=V[Math.floor(Math.random()*V.length)];r(this,l).debugColorsByClusterId.set(o.id,u)}r(this,q).call(this,o),r(this,l).clustersById.set(o.id,o)}},"#updateImmediately"));a(this,k,i(()=>{r(this,d).debounce===0?r(this,T).call(this):r(this,_).call(this)},"#update"));a(this,O,i(()=>{r(this,k).call(this)},"#handleCameraChange"));a(this,A,i(()=>{r(this,T).call(this)},"#handleFocus"));c(this,"add",i(e=>{var t,s;if(r(this,d).floor==null)r(this,d).floor=(s=r(this,I).getById("floor",(t=e.target.anchorTarget.floorId)!=null?t:""))!=null?s:null;else if(r(this,d).floor.id!==e.target.anchorTarget.floorId)throw new Error("Cannot cluster markers on different floors!");r(this,l).singleMarkersById.set(e.id,e),r(this,k).call(this)},"add"));c(this,"remove",i(e=>{if(!r(this,l).singleMarkersById.has(e.id)){v.log("Cannot remove marker ".concat(e.id," because it is not in the cluster!"));return}r(this,l).singleMarkersById.delete(e.id),r(this,k).call(this)},"remove"));c(this,"has",i(e=>r(this,l).singleMarkersById.has(e.id),"has"));c(this,"destroy",i(()=>{r(this,d).algorithm.destroy(),r(this,p).off("camera-change",r(this,O)),window.removeEventListener("focus",r(this,A));for(let[,e]of r(this,l).clustersById)r(this,L).call(this,e);for(let e of Object.values(r(this,l)))if(e instanceof Map)e.clear();else throw new Error("Encountered unexpected data type in cache! Potentially failed to clean up MarkerCluster.")},"destroy"));var u,h;let o;if((s==null?void 0:s.algorithm)==null){let z=new D(e);z.setOptions((u=s==null?void 0:s.algorithmOptions)!=null?u:{}),o=z}else o=s.algorithm,o.setOptions((h=s==null?void 0:s.algorithmOptions)!=null?h:{});if(m(this,d,P(y({floor:null,minSize:2,debounce:50,debug:!1,hideClusteredMarkers:!0},s),{algorithm:o})),m(this,p,e),m(this,I,Object.values(r(this,p).getMapData())[0]),r(this,I)==null)throw new Error("No map data found in MapView!");m(this,S,t),m(this,_,ae(r(this,T),r(this,d).debounce)),r(this,p).on("camera-change",r(this,O)),window.addEventListener("focus",r(this,A))}get clusters(){return[...r(this,l).clustersById.values()]}};I=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,S=new WeakMap,_=new WeakMap,F=new WeakMap,K=new WeakMap,G=new WeakMap,J=new WeakMap,U=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,k=new WeakMap,O=new WeakMap,A=new WeakMap,i(re,"MarkerCluster");var te=re;export{te as MarkerCluster,C as PointRBush,D as ScreenDistanceClustering};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/marker-cluster",
3
- "version": "6.0.1-beta.50",
3
+ "version": "6.0.1-beta.51",
4
4
  "homepage": "https://developer.mappedin.com/",
5
5
  "private": false,
6
6
  "main": "lib/esm/index.js",
@@ -30,5 +30,5 @@
30
30
  "volta": {
31
31
  "extends": "../../package.json"
32
32
  },
33
- "gitHead": "2a421dbb5f163bf7bbcef2937c806909b21818f3"
33
+ "gitHead": "e2b87403478e2cf4c2f0e07a053e2c74d2a125fa"
34
34
  }