vendor: 102 bytes, lines 1-4
1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3/******/ var __webpack_modules__ = ({ 4
vendor: 37,841 bytes, lines 5-996
5/***/ "./node_modules/@googlemaps/markerclusterer/dist/index.esm.js": 6/*!********************************************************************!*\ 7 !*** ./node_modules/@googlemaps/markerclusterer/dist/index.esm.js ***! 8 \********************************************************************/ 9/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10 11__webpack_require__.r(__webpack_exports__); 12/* harmony export */ __webpack_require__.d(__webpack_exports__, { 13/* harmony export */ AbstractAlgorithm: () => (/* binding */ AbstractAlgorithm), 14/* harmony export */ AbstractViewportAlgorithm: () => (/* binding */ AbstractViewportAlgorithm), 15/* harmony export */ Cluster: () => (/* binding */ Cluster), 16/* harmony export */ ClusterStats: () => (/* binding */ ClusterStats), 17/* harmony export */ DefaultRenderer: () => (/* binding */ DefaultRenderer), 18/* harmony export */ GridAlgorithm: () => (/* binding */ GridAlgorithm), 19/* harmony export */ MarkerClusterer: () => (/* binding */ MarkerClusterer), 20/* harmony export */ MarkerClustererEvents: () => (/* binding */ MarkerClustererEvents), 21/* harmony export */ MarkerUtils: () => (/* binding */ MarkerUtils), 22/* harmony export */ NoopAlgorithm: () => (/* binding */ NoopAlgorithm), 23/* harmony export */ SuperClusterAlgorithm: () => (/* binding */ SuperClusterAlgorithm), 24/* harmony export */ SuperClusterViewportAlgorithm: () => (/* binding */ SuperClusterViewportAlgorithm), 25/* harmony export */ defaultOnClusterClickHandler: () => (/* binding */ defaultOnClusterClickHandler), 26/* harmony export */ distanceBetweenPoints: () => (/* binding */ distanceBetweenPoints), 27/* harmony export */ extendBoundsToPaddedViewport: () => (/* binding */ extendBoundsToPaddedViewport), 28/* harmony export */ extendPixelBounds: () => (/* binding */ extendPixelBounds), 29/* harmony export */ filterMarkersToPaddedViewport: () => (/* binding */ filterMarkersToPaddedViewport), 30/* harmony export */ getPaddedViewport: () => (/* binding */ getPaddedViewport), 31/* harmony export */ noop: () => (/* binding */ noop), 32/* harmony export */ pixelBoundsToLatLngBounds: () => (/* binding */ pixelBoundsToLatLngBounds) 33/* harmony export */ }); 34/* harmony import */ var fast_deep_equal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-deep-equal */ "./node_modules/fast-deep-equal/index.js"); 35/* harmony import */ var fast_deep_equal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal__WEBPACK_IMPORTED_MODULE_0__); 36/* harmony import */ var supercluster__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! supercluster */ "./node_modules/supercluster/index.js"); 37 38 39 40/*! ***************************************************************************** 41Copyright (c) Microsoft Corporation. 42 43Permission to use, copy, modify, and/or distribute this software for any 44purpose with or without fee is hereby granted. 45 46THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 47REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 48AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 49INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 50LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 51OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 52PERFORMANCE OF THIS SOFTWARE. 53***************************************************************************** */ 54 55function __rest(s, e) { 56 var t = {}; 57 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 58 t[p] = s[p]; 59 if (s != null && typeof Object.getOwnPropertySymbols === "function") 60 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 61 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 62 t[p[i]] = s[p[i]]; 63 } 64 return t; 65} 66 67/** 68 * Copyright 2023 Google LLC 69 * 70 * Licensed under the Apache License, Version 2.0 (the "License"); 71 * you may not use this file except in compliance with the License. 72 * You may obtain a copy of the License at 73 * 74 * http://www.apache.org/licenses/LICENSE-2.0 75 * 76 * Unless required by applicable law or agreed to in writing, software 77 * distributed under the License is distributed on an "AS IS" BASIS, 78 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 79 * See the License for the specific language governing permissions and 80 * limitations under the License. 81 */ 82/** 83 * util class that creates a common set of convenience functions to wrap 84 * shared behavior of Advanced Markers and Markers. 85 */ 86class MarkerUtils { 87 static isAdvancedMarkerAvailable(map) { 88 return (google.maps.marker && 89 map.getMapCapabilities().isAdvancedMarkersAvailable === true); 90 } 91 static isAdvancedMarker(marker) { 92 return (google.maps.marker && 93 marker instanceof google.maps.marker.AdvancedMarkerElement); 94 } 95 static setMap(marker, map) { 96 if (this.isAdvancedMarker(marker)) { 97 marker.map = map; 98 } 99 else { 100 marker.setMap(map); 101 } 102 } 103 static getPosition(marker) { 104 // SuperClusterAlgorithm.calculate expects a LatLng instance so we fake it for Adv Markers 105 if (this.isAdvancedMarker(marker)) { 106 if (marker.position) { 107 if (marker.position instanceof google.maps.LatLng) { 108 return marker.position; 109 } 110 // since we can't cast to LatLngLiteral for reasons =( 111 if (marker.position.lat && marker.position.lng) { 112 return new google.maps.LatLng(marker.position.lat, marker.position.lng); 113 } 114 } 115 return new google.maps.LatLng(null); 116 } 117 return marker.getPosition(); 118 } 119 static getVisible(marker) { 120 if (this.isAdvancedMarker(marker)) { 121 /** 122 * Always return true for Advanced Markers because the clusterer 123 * uses getVisible as a way to count legacy markers not as an actual 124 * indicator of visibility for some reason. Even when markers are hidden 125 * Marker.getVisible returns `true` and this is used to set the marker count 126 * on the cluster. See the behavior of Cluster.count 127 */ 128 return true; 129 } 130 return marker.getVisible(); 131 } 132} 133 134/** 135 * Copyright 2021 Google LLC 136 * 137 * Licensed under the Apache License, Version 2.0 (the "License"); 138 * you may not use this file except in compliance with the License. 139 * You may obtain a copy of the License at 140 * 141 * http://www.apache.org/licenses/LICENSE-2.0 142 * 143 * Unless required by applicable law or agreed to in writing, software 144 * distributed under the License is distributed on an "AS IS" BASIS, 145 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 146 * See the License for the specific language governing permissions and 147 * limitations under the License. 148 */ 149class Cluster { 150 constructor({ markers, position }) { 151 this.markers = markers; 152 if (position) { 153 if (position instanceof google.maps.LatLng) { 154 this._position = position; 155 } 156 else { 157 this._position = new google.maps.LatLng(position); 158 } 159 } 160 } 161 get bounds() { 162 if (this.markers.length === 0 && !this._position) { 163 return; 164 } 165 const bounds = new google.maps.LatLngBounds(this._position, this._position); 166 for (const marker of this.markers) { 167 bounds.extend(MarkerUtils.getPosition(marker)); 168 } 169 return bounds; 170 } 171 get position() { 172 return this._position || this.bounds.getCenter(); 173 } 174 /** 175 * Get the count of **visible** markers. 176 */ 177 get count() { 178 return this.markers.filter((m) => MarkerUtils.getVisible(m)).length; 179 } 180 /** 181 * Add a marker to the cluster. 182 */ 183 push(marker) { 184 this.markers.push(marker); 185 } 186 /** 187 * Cleanup references and remove marker from map. 188 */ 189 delete() { 190 if (this.marker) { 191 MarkerUtils.setMap(this.marker, null); 192 this.marker = undefined; 193 } 194 this.markers.length = 0; 195 } 196} 197 198/** 199 * Copyright 2021 Google LLC 200 * 201 * Licensed under the Apache License, Version 2.0 (the "License"); 202 * you may not use this file except in compliance with the License. 203 * You may obtain a copy of the License at 204 * 205 * http://www.apache.org/licenses/LICENSE-2.0 206 * 207 * Unless required by applicable law or agreed to in writing, software 208 * distributed under the License is distributed on an "AS IS" BASIS, 209 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 210 * See the License for the specific language governing permissions and 211 * limitations under the License. 212 */ 213/** 214 * Returns the markers visible in a padded map viewport 215 * 216 * @param map 217 * @param mapCanvasProjection 218 * @param markers The list of marker to filter 219 * @param viewportPaddingPixels The padding in pixel 220 * @returns The list of markers in the padded viewport 221 */ 222const filterMarkersToPaddedViewport = (map, mapCanvasProjection, markers, viewportPaddingPixels) => { 223 const extendedMapBounds = extendBoundsToPaddedViewport(map.getBounds(), mapCanvasProjection, viewportPaddingPixels); 224 return markers.filter((marker) => extendedMapBounds.contains(MarkerUtils.getPosition(marker))); 225}; 226/** 227 * Extends a bounds by a number of pixels in each direction 228 */ 229const extendBoundsToPaddedViewport = (bounds, projection, numPixels) => { 230 const { northEast, southWest } = latLngBoundsToPixelBounds(bounds, projection); 231 const extendedPixelBounds = extendPixelBounds({ northEast, southWest }, numPixels); 232 return pixelBoundsToLatLngBounds(extendedPixelBounds, projection); 233}; 234/** 235 * Gets the extended bounds as a bbox [westLng, southLat, eastLng, northLat] 236 */ 237const getPaddedViewport = (bounds, projection, pixels) => { 238 const extended = extendBoundsToPaddedViewport(bounds, projection, pixels); 239 const ne = extended.getNorthEast(); 240 const sw = extended.getSouthWest(); 241 return [sw.lng(), sw.lat(), ne.lng(), ne.lat()]; 242}; 243/** 244 * Returns the distance between 2 positions. 245 * 246 * @hidden 247 */ 248const distanceBetweenPoints = (p1, p2) => { 249 const R = 6371; // Radius of the Earth in km 250 const dLat = ((p2.lat - p1.lat) * Math.PI) / 180; 251 const dLon = ((p2.lng - p1.lng) * Math.PI) / 180; 252 const sinDLat = Math.sin(dLat / 2); 253 const sinDLon = Math.sin(dLon / 2); 254 const a = sinDLat * sinDLat + 255 Math.cos((p1.lat * Math.PI) / 180) * 256 Math.cos((p2.lat * Math.PI) / 180) * 257 sinDLon * 258 sinDLon; 259 const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 260 return R * c; 261}; 262/** 263 * Converts a LatLng bound to pixels. 264 * 265 * @hidden 266 */ 267const latLngBoundsToPixelBounds = (bounds, projection) => { 268 return { 269 northEast: projection.fromLatLngToDivPixel(bounds.getNorthEast()), 270 southWest: projection.fromLatLngToDivPixel(bounds.getSouthWest()), 271 }; 272}; 273/** 274 * Extends a pixel bounds by numPixels in all directions. 275 * 276 * @hidden 277 */ 278const extendPixelBounds = ({ northEast, southWest }, numPixels) => { 279 northEast.x += numPixels; 280 northEast.y -= numPixels; 281 southWest.x -= numPixels; 282 southWest.y += numPixels; 283 return { northEast, southWest }; 284}; 285/** 286 * @hidden 287 */ 288const pixelBoundsToLatLngBounds = ({ northEast, southWest }, projection) => { 289 const sw = projection.fromDivPixelToLatLng(southWest); 290 const ne = projection.fromDivPixelToLatLng(northEast); 291 return new google.maps.LatLngBounds(sw, ne); 292}; 293 294/** 295 * Copyright 2021 Google LLC 296 * 297 * Licensed under the Apache License, Version 2.0 (the "License"); 298 * you may not use this file except in compliance with the License. 299 * You may obtain a copy of the License at 300 * 301 * http://www.apache.org/licenses/LICENSE-2.0 302 * 303 * Unless required by applicable law or agreed to in writing, software 304 * distributed under the License is distributed on an "AS IS" BASIS, 305 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 306 * See the License for the specific language governing permissions and 307 * limitations under the License. 308 */ 309/** 310 * @hidden 311 */ 312class AbstractAlgorithm { 313 constructor({ maxZoom = 16 }) { 314 this.maxZoom = maxZoom; 315 } 316 /** 317 * Helper function to bypass clustering based upon some map state such as 318 * zoom, number of markers, etc. 319 * 320 * ```typescript 321 * cluster({markers, map}: AlgorithmInput): Cluster[] { 322 * if (shouldBypassClustering(map)) { 323 * return this.noop({markers}) 324 * } 325 * } 326 * ``` 327 */ 328 noop({ markers, }) { 329 return noop(markers); 330 } 331} 332/** 333 * Abstract viewport algorithm proves a class to filter markers by a padded 334 * viewport. This is a common optimization. 335 * 336 * @hidden 337 */ 338class AbstractViewportAlgorithm extends AbstractAlgorithm { 339 constructor(_a) { 340 var { viewportPadding = 60 } = _a, options = __rest(_a, ["viewportPadding"]); 341 super(options); 342 this.viewportPadding = 60; 343 this.viewportPadding = viewportPadding; 344 } 345 calculate({ markers, map, mapCanvasProjection, }) { 346 if (map.getZoom() >= this.maxZoom) { 347 return { 348 clusters: this.noop({ 349 markers, 350 }), 351 changed: false, 352 }; 353 } 354 return { 355 clusters: this.cluster({ 356 markers: filterMarkersToPaddedViewport(map, mapCanvasProjection, markers, this.viewportPadding), 357 map, 358 mapCanvasProjection, 359 }), 360 }; 361 } 362} 363/** 364 * @hidden 365 */ 366const noop = (markers) => { 367 const clusters = markers.map((marker) => new Cluster({ 368 position: MarkerUtils.getPosition(marker), 369 markers: [marker], 370 })); 371 return clusters; 372}; 373 374/** 375 * Copyright 2021 Google LLC 376 * 377 * Licensed under the Apache License, Version 2.0 (the "License"); 378 * you may not use this file except in compliance with the License. 379 * You may obtain a copy of the License at 380 * 381 * http://www.apache.org/licenses/LICENSE-2.0 382 * 383 * Unless required by applicable law or agreed to in writing, software 384 * distributed under the License is distributed on an "AS IS" BASIS, 385 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 386 * See the License for the specific language governing permissions and 387 * limitations under the License. 388 */ 389/** 390 * The default Grid algorithm historically used in Google Maps marker 391 * clustering. 392 * 393 * The Grid algorithm does not implement caching and markers may flash as the 394 * viewport changes. Instead use {@link SuperClusterAlgorithm}. 395 */ 396class GridAlgorithm extends AbstractViewportAlgorithm { 397 constructor(_a) { 398 var { maxDistance = 40000, gridSize = 40 } = _a, options = __rest(_a, ["maxDistance", "gridSize"]); 399 super(options); 400 this.clusters = []; 401 this.state = { zoom: -1 }; 402 this.maxDistance = maxDistance; 403 this.gridSize = gridSize; 404 } 405 calculate({ markers, map, mapCanvasProjection, }) { 406 const state = { zoom: map.getZoom() }; 407 let changed = false; 408 if (this.state.zoom >= this.maxZoom && state.zoom >= this.maxZoom) ; 409 else { 410 changed = !fast_deep_equal__WEBPACK_IMPORTED_MODULE_0___default()(this.state, state); 411 } 412 this.state = state; 413 if (map.getZoom() >= this.maxZoom) { 414 return { 415 clusters: this.noop({ 416 markers, 417 }), 418 changed, 419 }; 420 } 421 return { 422 clusters: this.cluster({ 423 markers: filterMarkersToPaddedViewport(map, mapCanvasProjection, markers, this.viewportPadding), 424 map, 425 mapCanvasProjection, 426 }), 427 }; 428 } 429 cluster({ markers, map, mapCanvasProjection, }) { 430 this.clusters = []; 431 markers.forEach((marker) => { 432 this.addToClosestCluster(marker, map, mapCanvasProjection); 433 }); 434 return this.clusters; 435 } 436 addToClosestCluster(marker, map, projection) { 437 let maxDistance = this.maxDistance; // Some large number 438 let cluster = null; 439 for (let i = 0; i < this.clusters.length; i++) { 440 const candidate = this.clusters[i]; 441 const distance = distanceBetweenPoints(candidate.bounds.getCenter().toJSON(), MarkerUtils.getPosition(marker).toJSON()); 442 if (distance < maxDistance) { 443 maxDistance = distance; 444 cluster = candidate; 445 } 446 } 447 if (cluster && 448 extendBoundsToPaddedViewport(cluster.bounds, projection, this.gridSize).contains(MarkerUtils.getPosition(marker))) { 449 cluster.push(marker); 450 } 451 else { 452 const cluster = new Cluster({ markers: [marker] }); 453 this.clusters.push(cluster); 454 } 455 } 456} 457 458/** 459 * Copyright 2021 Google LLC 460 * 461 * Licensed under the Apache License, Version 2.0 (the "License"); 462 * you may not use this file except in compliance with the License. 463 * You may obtain a copy of the License at 464 * 465 * http://www.apache.org/licenses/LICENSE-2.0 466 * 467 * Unless required by applicable law or agreed to in writing, software 468 * distributed under the License is distributed on an "AS IS" BASIS, 469 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 470 * See the License for the specific language governing permissions and 471 * limitations under the License. 472 */ 473/** 474 * Noop algorithm does not generate any clusters or filter markers by the an extended viewport. 475 */ 476class NoopAlgorithm extends AbstractAlgorithm { 477 constructor(_a) { 478 var options = __rest(_a, []); 479 super(options); 480 } 481 calculate({ markers, map, mapCanvasProjection, }) { 482 return { 483 clusters: this.cluster({ markers, map, mapCanvasProjection }), 484 changed: false, 485 }; 486 } 487 cluster(input) { 488 return this.noop(input); 489 } 490} 491 492/** 493 * Copyright 2021 Google LLC 494 * 495 * Licensed under the Apache License, Version 2.0 (the "License"); 496 * you may not use this file except in compliance with the License. 497 * You may obtain a copy of the License at 498 * 499 * http://www.apache.org/licenses/LICENSE-2.0 500 * 501 * Unless required by applicable law or agreed to in writing, software 502 * distributed under the License is distributed on an "AS IS" BASIS, 503 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 504 * See the License for the specific language governing permissions and 505 * limitations under the License. 506 */ 507/** 508 * A very fast JavaScript algorithm for geospatial point clustering using KD trees. 509 * 510 * @see https://www.npmjs.com/package/supercluster for more information on options. 511 */ 512class SuperClusterAlgorithm extends AbstractAlgorithm { 513 constructor(_a) { 514 var { maxZoom, radius = 60 } = _a, options = __rest(_a, ["maxZoom", "radius"]); 515 super({ maxZoom }); 516 this.state = { zoom: -1 }; 517 this.superCluster = new supercluster__WEBPACK_IMPORTED_MODULE_1__["default"](Object.assign({ maxZoom: this.maxZoom, radius }, options)); 518 } 519 calculate(input) { 520 let changed = false; 521 const state = { zoom: input.map.getZoom() }; 522 if (!fast_deep_equal__WEBPACK_IMPORTED_MODULE_0___default()(input.markers, this.markers)) { 523 changed = true; 524 // TODO use proxy to avoid copy? 525 this.markers = [...input.markers]; 526 const points = this.markers.map((marker) => { 527 const position = MarkerUtils.getPosition(marker); 528 const coordinates = [position.lng(), position.lat()]; 529 return { 530 type: "Feature", 531 geometry: { 532 type: "Point", 533 coordinates, 534 }, 535 properties: { marker }, 536 }; 537 }); 538 this.superCluster.load(points); 539 } 540 if (!changed) { 541 if (this.state.zoom <= this.maxZoom || state.zoom <= this.maxZoom) { 542 changed = !fast_deep_equal__WEBPACK_IMPORTED_MODULE_0___default()(this.state, state); 543 } 544 } 545 this.state = state; 546 if (changed) { 547 this.clusters = this.cluster(input); 548 } 549 return { clusters: this.clusters, changed }; 550 } 551 cluster({ map }) { 552 return this.superCluster 553 .getClusters([-180, -90, 180, 90], Math.round(map.getZoom())) 554 .map((feature) => this.transformCluster(feature)); 555 } 556 transformCluster({ geometry: { coordinates: [lng, lat], }, properties, }) { 557 if (properties.cluster) { 558 return new Cluster({ 559 markers: this.superCluster 560 .getLeaves(properties.cluster_id, Infinity) 561 .map((leaf) => leaf.properties.marker), 562 position: { lat, lng }, 563 }); 564 } 565 const marker = properties.marker; 566 return new Cluster({ 567 markers: [marker], 568 position: MarkerUtils.getPosition(marker), 569 }); 570 } 571} 572 573/** 574 * Copyright 2021 Google LLC 575 * 576 * Licensed under the Apache License, Version 2.0 (the "License"); 577 * you may not use this file except in compliance with the License. 578 * You may obtain a copy of the License at 579 * 580 * http://www.apache.org/licenses/LICENSE-2.0 581 * 582 * Unless required by applicable law or agreed to in writing, software 583 * distributed under the License is distributed on an "AS IS" BASIS, 584 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 585 * See the License for the specific language governing permissions and 586 * limitations under the License. 587 */ 588/** 589 * A very fast JavaScript algorithm for geospatial point clustering using KD trees. 590 * 591 * @see https://www.npmjs.com/package/supercluster for more information on options. 592 */ 593class SuperClusterViewportAlgorithm extends AbstractViewportAlgorithm { 594 constructor(_a) { 595 var { maxZoom, radius = 60, viewportPadding = 60 } = _a, options = __rest(_a, ["maxZoom", "radius", "viewportPadding"]); 596 super({ maxZoom, viewportPadding }); 597 this.superCluster = new supercluster__WEBPACK_IMPORTED_MODULE_1__["default"](Object.assign({ maxZoom: this.maxZoom, radius }, options)); 598 this.state = { zoom: -1, view: [0, 0, 0, 0] }; 599 } 600 calculate(input) { 601 const state = { 602 zoom: Math.round(input.map.getZoom()), 603 view: getPaddedViewport(input.map.getBounds(), input.mapCanvasProjection, this.viewportPadding), 604 }; 605 let changed = !fast_deep_equal__WEBPACK_IMPORTED_MODULE_0___default()(this.state, state); 606 if (!fast_deep_equal__WEBPACK_IMPORTED_MODULE_0___default()(input.markers, this.markers)) { 607 changed = true; 608 // TODO use proxy to avoid copy? 609 this.markers = [...input.markers]; 610 const points = this.markers.map((marker) => { 611 const position = MarkerUtils.getPosition(marker); 612 const coordinates = [position.lng(), position.lat()]; 613 return { 614 type: "Feature", 615 geometry: { 616 type: "Point", 617 coordinates, 618 }, 619 properties: { marker }, 620 }; 621 }); 622 this.superCluster.load(points); 623 } 624 if (changed) { 625 this.clusters = this.cluster(input); 626 this.state = state; 627 } 628 return { clusters: this.clusters, changed }; 629 } 630 cluster({ map, mapCanvasProjection }) { 631 /* recalculate new state because we can't use the cached version. */ 632 const state = { 633 zoom: Math.round(map.getZoom()), 634 view: getPaddedViewport(map.getBounds(), mapCanvasProjection, this.viewportPadding), 635 }; 636 return this.superCluster 637 .getClusters(state.view, state.zoom) 638 .map((feature) => this.transformCluster(feature)); 639 } 640 transformCluster({ geometry: { coordinates: [lng, lat], }, properties, }) { 641 if (properties.cluster) { 642 return new Cluster({ 643 markers: this.superCluster 644 .getLeaves(properties.cluster_id, Infinity) 645 .map((leaf) => leaf.properties.marker), 646 position: { lat, lng }, 647 }); 648 } 649 const marker = properties.marker; 650 return new Cluster({ 651 markers: [marker], 652 position: MarkerUtils.getPosition(marker), 653 }); 654 } 655} 656 657/** 658 * Copyright 2021 Google LLC 659 * 660 * Licensed under the Apache License, Version 2.0 (the "License"); 661 * you may not use this file except in compliance with the License. 662 * You may obtain a copy of the License at 663 * 664 * http://www.apache.org/licenses/LICENSE-2.0 665 * 666 * Unless required by applicable law or agreed to in writing, software 667 * distributed under the License is distributed on an "AS IS" BASIS, 668 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 669 * See the License for the specific language governing permissions and 670 * limitations under the License. 671 */ 672/** 673 * Provides statistics on all clusters in the current render cycle for use in {@link Renderer.render}. 674 */ 675class ClusterStats { 676 constructor(markers, clusters) { 677 this.markers = { sum: markers.length }; 678 const clusterMarkerCounts = clusters.map((a) => a.count); 679 const clusterMarkerSum = clusterMarkerCounts.reduce((a, b) => a + b, 0); 680 this.clusters = { 681 count: clusters.length, 682 markers: { 683 mean: clusterMarkerSum / clusters.length, 684 sum: clusterMarkerSum, 685 min: Math.min(...clusterMarkerCounts), 686 max: Math.max(...clusterMarkerCounts), 687 }, 688 }; 689 } 690} 691class DefaultRenderer { 692 /** 693 * The default render function for the library used by {@link MarkerClusterer}. 694 * 695 * Currently set to use the following: 696 * 697 * ```typescript 698 * // change color if this cluster has more markers than the mean cluster 699 * const color = 700 * count > Math.max(10, stats.clusters.markers.mean) 701 * ? "#ff0000" 702 * : "#0000ff"; 703 * 704 * // create svg url with fill color 705 * const svg = window.btoa(` 706 * <svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240"> 707 * <circle cx="120" cy="120" opacity=".6" r="70" /> 708 * <circle cx="120" cy="120" opacity=".3" r="90" /> 709 * <circle cx="120" cy="120" opacity=".2" r="110" /> 710 * <circle cx="120" cy="120" opacity=".1" r="130" /> 711 * </svg>`); 712 * 713 * // create marker using svg icon 714 * return new google.maps.Marker({ 715 * position, 716 * icon: { 717 * url: `data:image/svg+xml;base64,${svg}`, 718 * scaledSize: new google.maps.Size(45, 45), 719 * }, 720 * label: { 721 * text: String(count), 722 * color: "rgba(255,255,255,0.9)", 723 * fontSize: "12px", 724 * }, 725 * // adjust zIndex to be above other markers 726 * zIndex: 1000 + count, 727 * }); 728 * ``` 729 */ 730 render({ count, position }, stats, map) { 731 // change color if this cluster has more markers than the mean cluster 732 const color = count > Math.max(10, stats.clusters.markers.mean) ? "#ff0000" : "#0000ff"; 733 // create svg literal with fill color 734 const svg = `<svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50"> 735<circle cx="120" cy="120" opacity=".6" r="70" /> 736<circle cx="120" cy="120" opacity=".3" r="90" /> 737<circle cx="120" cy="120" opacity=".2" r="110" /> 738<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${count}</text> 739</svg>`; 740 const title = `Cluster of ${count} markers`, 741 // adjust zIndex to be above other markers 742 zIndex = Number(google.maps.Marker.MAX_ZINDEX) + count; 743 if (MarkerUtils.isAdvancedMarkerAvailable(map)) { 744 // create cluster SVG element 745 const parser = new DOMParser(); 746 const svgEl = parser.parseFromString(svg, "image/svg+xml").documentElement; 747 svgEl.setAttribute("transform", "translate(0 25)"); 748 const clusterOptions = { 749 map, 750 position, 751 zIndex, 752 title, 753 content: svgEl, 754 }; 755 return new google.maps.marker.AdvancedMarkerElement(clusterOptions); 756 } 757 const clusterOptions = { 758 position, 759 zIndex, 760 title, 761 icon: { 762 url: `data:image/svg+xml;base64,${btoa(svg)}`, 763 anchor: new google.maps.Point(25, 25), 764 }, 765 }; 766 return new google.maps.Marker(clusterOptions); 767 } 768} 769 770/** 771 * Copyright 2019 Google LLC. All Rights Reserved. 772 * 773 * Licensed under the Apache License, Version 2.0 (the "License"); 774 * you may not use this file except in compliance with the License. 775 * You may obtain a copy of the License at 776 * 777 * http://www.apache.org/licenses/LICENSE-2.0 778 * 779 * Unless required by applicable law or agreed to in writing, software 780 * distributed under the License is distributed on an "AS IS" BASIS, 781 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 782 * See the License for the specific language governing permissions and 783 * limitations under the License. 784 */ 785/** 786 * Extends an object's prototype by another's. 787 * 788 * @param type1 The Type to be extended. 789 * @param type2 The Type to extend with. 790 * @ignore 791 */ 792// eslint-disable-next-line @typescript-eslint/no-explicit-any 793function extend(type1, type2) { 794 /* istanbul ignore next */ 795 // eslint-disable-next-line prefer-const 796 for (let property in type2.prototype) { 797 type1.prototype[property] = type2.prototype[property]; 798 } 799} 800/** 801 * @ignore 802 */ 803class OverlayViewSafe { 804 constructor() { 805 // MarkerClusterer implements google.maps.OverlayView interface. We use the 806 // extend function to extend MarkerClusterer with google.maps.OverlayView 807 // because it might not always be available when the code is defined so we 808 // look for it at the last possible moment. If it doesn't exist now then 809 // there is no point going ahead :) 810 extend(OverlayViewSafe, google.maps.OverlayView); 811 } 812} 813 814/** 815 * Copyright 2021 Google LLC 816 * 817 * Licensed under the Apache License, Version 2.0 (the "License"); 818 * you may not use this file except in compliance with the License. 819 * You may obtain a copy of the License at 820 * 821 * http://www.apache.org/licenses/LICENSE-2.0 822 * 823 * Unless required by applicable law or agreed to in writing, software 824 * distributed under the License is distributed on an "AS IS" BASIS, 825 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 826 * See the License for the specific language governing permissions and 827 * limitations under the License. 828 */ 829var MarkerClustererEvents; 830(function (MarkerClustererEvents) { 831 MarkerClustererEvents["CLUSTERING_BEGIN"] = "clusteringbegin"; 832 MarkerClustererEvents["CLUSTERING_END"] = "clusteringend"; 833 MarkerClustererEvents["CLUSTER_CLICK"] = "click"; 834})(MarkerClustererEvents || (MarkerClustererEvents = {})); 835const defaultOnClusterClickHandler = (_, cluster, map) => { 836 map.fitBounds(cluster.bounds); 837}; 838/** 839 * MarkerClusterer creates and manages per-zoom-level clusters for large amounts 840 * of markers. See {@link MarkerClustererOptions} for more details. 841 * 842 */ 843class MarkerClusterer extends OverlayViewSafe { 844 constructor({ map, markers = [], algorithmOptions = {}, algorithm = new SuperClusterAlgorithm(algorithmOptions), renderer = new DefaultRenderer(), onClusterClick = defaultOnClusterClickHandler, }) { 845 super(); 846 this.markers = [...markers]; 847 this.clusters = []; 848 this.algorithm = algorithm; 849 this.renderer = renderer; 850 this.onClusterClick = onClusterClick; 851 if (map) { 852 this.setMap(map); 853 } 854 } 855 addMarker(marker, noDraw) { 856 if (this.markers.includes(marker)) { 857 return; 858 } 859 this.markers.push(marker); 860 if (!noDraw) { 861 this.render(); 862 } 863 } 864 addMarkers(markers, noDraw) { 865 markers.forEach((marker) => { 866 this.addMarker(marker, true); 867 }); 868 if (!noDraw) { 869 this.render(); 870 } 871 } 872 removeMarker(marker, noDraw) { 873 const index = this.markers.indexOf(marker); 874 if (index === -1) { 875 // Marker is not in our list of markers, so do nothing: 876 return false; 877 } 878 MarkerUtils.setMap(marker, null); 879 this.markers.splice(index, 1); // Remove the marker from the list of managed markers 880 if (!noDraw) { 881 this.render(); 882 } 883 return true; 884 } 885 removeMarkers(markers, noDraw) { 886 let removed = false; 887 markers.forEach((marker) => { 888 removed = this.removeMarker(marker, true) || removed; 889 }); 890 if (removed && !noDraw) { 891 this.render(); 892 } 893 return removed; 894 } 895 clearMarkers(noDraw) { 896 this.markers.length = 0; 897 if (!noDraw) { 898 this.render(); 899 } 900 } 901 /** 902 * Recalculates and draws all the marker clusters. 903 */ 904 render() { 905 const map = this.getMap(); 906 if (map instanceof google.maps.Map && map.getProjection()) { 907 google.maps.event.trigger(this, MarkerClustererEvents.CLUSTERING_BEGIN, this); 908 const { clusters, changed } = this.algorithm.calculate({ 909 markers: this.markers, 910 map, 911 mapCanvasProjection: this.getProjection(), 912 }); 913 // Allow algorithms to return flag on whether the clusters/markers have changed. 914 if (changed || changed == undefined) { 915 // Accumulate the markers of the clusters composed of a single marker. 916 // Those clusters directly use the marker. 917 // Clusters with more than one markers use a group marker generated by a renderer. 918 const singleMarker = new Set(); 919 for (const cluster of clusters) { 920 if (cluster.markers.length == 1) { 921 singleMarker.add(cluster.markers[0]); 922 } 923 } 924 const groupMarkers = []; 925 // Iterate the clusters that are currently rendered. 926 for (const cluster of this.clusters) { 927 if (cluster.marker == null) { 928 continue; 929 } 930 if (cluster.markers.length == 1) { 931 if (!singleMarker.has(cluster.marker)) { 932 // The marker: 933 // - was previously rendered because it is from a cluster with 1 marker, 934 // - should no more be rendered as it is not in singleMarker. 935 MarkerUtils.setMap(cluster.marker, null); 936 } 937 } 938 else { 939 // Delay the removal of old group markers to avoid flickering. 940 groupMarkers.push(cluster.marker); 941 } 942 } 943 this.clusters = clusters; 944 this.renderClusters(); 945 // Delayed removal of the markers of the former groups. 946 requestAnimationFrame(() => groupMarkers.forEach((marker) => MarkerUtils.setMap(marker, null))); 947 } 948 google.maps.event.trigger(this, MarkerClustererEvents.CLUSTERING_END, this); 949 } 950 } 951 onAdd() { 952 this.idleListener = this.getMap().addListener("idle", this.render.bind(this)); 953 this.render(); 954 } 955 onRemove() { 956 google.maps.event.removeListener(this.idleListener); 957 this.reset(); 958 } 959 reset() { 960 this.markers.forEach((marker) => MarkerUtils.setMap(marker, null)); 961 this.clusters.forEach((cluster) => cluster.delete()); 962 this.clusters = []; 963 } 964 renderClusters() { 965 // Generate stats to pass to renderers. 966 const stats = new ClusterStats(this.markers, this.clusters); 967 const map = this.getMap(); 968 this.clusters.forEach((cluster) => { 969 if (cluster.markers.length === 1) { 970 cluster.marker = cluster.markers[0]; 971 } 972 else { 973 // Generate the marker to represent the group. 974 cluster.marker = this.renderer.render(cluster, stats, map); 975 // Make sure all individual markers are removed from the map. 976 cluster.markers.forEach((marker) => MarkerUtils.setMap(marker, null)); 977 if (this.onClusterClick) { 978 cluster.marker.addListener("click", 979 /* istanbul ignore next */ 980 (event) => { 981 google.maps.event.trigger(this, MarkerClustererEvents.CLUSTER_CLICK, cluster); 982 this.onClusterClick(event, cluster, map); 983 }); 984 } 985 } 986 MarkerUtils.setMap(cluster.marker, map); 987 }); 988 } 989} 990 991 992//# sourceMappingURL=index.esm.js.map 993 994 995/***/ }), 996
vendor: 1,406 bytes, lines 997-1052
997/***/ "./node_modules/fast-deep-equal/index.js": 998/*!***********************************************!*\ 999 !*** ./node_modules/fast-deep-equal/index.js ***! 1000 \***********************************************/ 1001/***/ ((module) => { 1002 1003 1004 1005// do not edit .js files directly - edit src/index.jst 1006 1007 1008 1009module.exports = function equal(a, b) { 1010 if (a === b) return true; 1011 1012 if (a && b && typeof a == 'object' && typeof b == 'object') { 1013 if (a.constructor !== b.constructor) return false; 1014 1015 var length, i, keys; 1016 if (Array.isArray(a)) { 1017 length = a.length; 1018 if (length != b.length) return false; 1019 for (i = length; i-- !== 0;) 1020 if (!equal(a[i], b[i])) return false; 1021 return true; 1022 } 1023 1024 1025 1026 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 1027 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 1028 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 1029 1030 keys = Object.keys(a); 1031 length = keys.length; 1032 if (length !== Object.keys(b).length) return false; 1033 1034 for (i = length; i-- !== 0;) 1035 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 1036 1037 for (i = length; i-- !== 0;) { 1038 var key = keys[i]; 1039 1040 if (!equal(a[key], b[key])) return false; 1041 } 1042 1043 return true; 1044 } 1045 1046 // true if both NaN, false otherwise 1047 return a!==a && b!==b; 1048}; 1049 1050 1051/***/ }), 1052
vendor: 11,758 bytes, lines 1053-1393
1053/***/ "./node_modules/kdbush/index.js": 1054/*!**************************************!*\ 1055 !*** ./node_modules/kdbush/index.js ***! 1056 \**************************************/ 1057/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1058 1059__webpack_require__.r(__webpack_exports__); 1060/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1061/* harmony export */ "default": () => (/* binding */ KDBush) 1062/* harmony export */ }); 1063 1064const ARRAY_TYPES = [ 1065 Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, 1066 Int32Array, Uint32Array, Float32Array, Float64Array 1067]; 1068 1069/** @typedef {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor} TypedArrayConstructor */ 1070 1071const VERSION = 1; // serialized format version 1072const HEADER_SIZE = 8; 1073 1074class KDBush { 1075 1076 /** 1077 * Creates an index from raw `ArrayBuffer` data. 1078 * @param {ArrayBuffer} data 1079 */ 1080 static from(data) { 1081 if (!(data instanceof ArrayBuffer)) { 1082 throw new Error('Data must be an instance of ArrayBuffer.'); 1083 } 1084 const [magic, versionAndType] = new Uint8Array(data, 0, 2); 1085 if (magic !== 0xdb) { 1086 throw new Error('Data does not appear to be in a KDBush format.'); 1087 } 1088 const version = versionAndType >> 4; 1089 if (version !== VERSION) { 1090 throw new Error(`Got v${version} data when expected v${VERSION}.`); 1091 } 1092 const ArrayType = ARRAY_TYPES[versionAndType & 0x0f]; 1093 if (!ArrayType) { 1094 throw new Error('Unrecognized array type.'); 1095 } 1096 const [nodeSize] = new Uint16Array(data, 2, 1); 1097 const [numItems] = new Uint32Array(data, 4, 1); 1098 1099 return new KDBush(numItems, nodeSize, ArrayType, data); 1100 } 1101 1102 /** 1103 * Creates an index that will hold a given number of items. 1104 * @param {number} numItems 1105 * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default). 1106 * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default). 1107 * @param {ArrayBuffer} [data] (For internal use only) 1108 */ 1109 constructor(numItems, nodeSize = 64, ArrayType = Float64Array, data) { 1110 if (isNaN(numItems) || numItems < 0) throw new Error(`Unpexpected numItems value: ${numItems}.`); 1111 1112 this.numItems = +numItems; 1113 this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535); 1114 this.ArrayType = ArrayType; 1115 this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array; 1116 1117 const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType); 1118 const coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT; 1119 const idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT; 1120 const padCoords = (8 - idsByteSize % 8) % 8; 1121 1122 if (arrayTypeIndex < 0) { 1123 throw new Error(`Unexpected typed array class: ${ArrayType}.`); 1124 } 1125 1126 if (data && (data instanceof ArrayBuffer)) { // reconstruct an index from a buffer 1127 this.data = data; 1128 this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems); 1129 this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2); 1130 this._pos = numItems * 2; 1131 this._finished = true; 1132 } else { // initialize a new index 1133 this.data = new ArrayBuffer(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords); 1134 this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems); 1135 this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2); 1136 this._pos = 0; 1137 this._finished = false; 1138 1139 // set header 1140 new Uint8Array(this.data, 0, 2).set([0xdb, (VERSION << 4) + arrayTypeIndex]); 1141 new Uint16Array(this.data, 2, 1)[0] = nodeSize; 1142 new Uint32Array(this.data, 4, 1)[0] = numItems; 1143 } 1144 } 1145 1146 /** 1147 * Add a point to the index. 1148 * @param {number} x 1149 * @param {number} y 1150 * @returns {number} An incremental index associated with the added item (starting from `0`). 1151 */ 1152 add(x, y) { 1153 const index = this._pos >> 1; 1154 this.ids[index] = index; 1155 this.coords[this._pos++] = x; 1156 this.coords[this._pos++] = y; 1157 return index; 1158 } 1159 1160 /** 1161 * Perform indexing of the added points. 1162 */ 1163 finish() { 1164 const numAdded = this._pos >> 1; 1165 if (numAdded !== this.numItems) { 1166 throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`); 1167 } 1168 // kd-sort both arrays for efficient search 1169 sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0); 1170 1171 this._finished = true; 1172 return this; 1173 } 1174 1175 /** 1176 * Search the index for items within a given bounding box. 1177 * @param {number} minX 1178 * @param {number} minY 1179 * @param {number} maxX 1180 * @param {number} maxY 1181 * @returns {number[]} An array of indices correponding to the found items. 1182 */ 1183 range(minX, minY, maxX, maxY) { 1184 if (!this._finished) throw new Error('Data not yet indexed - call index.finish().'); 1185 1186 const {ids, coords, nodeSize} = this; 1187 const stack = [0, ids.length - 1, 0]; 1188 const result = []; 1189 1190 // recursively search for items in range in the kd-sorted arrays 1191 while (stack.length) { 1192 const axis = stack.pop() || 0; 1193 const right = stack.pop() || 0; 1194 const left = stack.pop() || 0; 1195 1196 // if we reached "tree node", search linearly 1197 if (right - left <= nodeSize) { 1198 for (let i = left; i <= right; i++) { 1199 const x = coords[2 * i]; 1200 const y = coords[2 * i + 1]; 1201 if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]); 1202 } 1203 continue; 1204 } 1205 1206 // otherwise find the middle index 1207 const m = (left + right) >> 1; 1208 1209 // include the middle item if it's in range 1210 const x = coords[2 * m]; 1211 const y = coords[2 * m + 1]; 1212 if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]); 1213 1214 // queue search in halves that intersect the query 1215 if (axis === 0 ? minX <= x : minY <= y) { 1216 stack.push(left); 1217 stack.push(m - 1); 1218 stack.push(1 - axis); 1219 } 1220 if (axis === 0 ? maxX >= x : maxY >= y) { 1221 stack.push(m + 1); 1222 stack.push(right); 1223 stack.push(1 - axis); 1224 } 1225 } 1226 1227 return result; 1228 } 1229 1230 /** 1231 * Search the index for items within a given radius. 1232 * @param {number} qx 1233 * @param {number} qy 1234 * @param {number} r Query radius. 1235 * @returns {number[]} An array of indices correponding to the found items. 1236 */ 1237 within(qx, qy, r) { 1238 if (!this._finished) throw new Error('Data not yet indexed - call index.finish().'); 1239 1240 const {ids, coords, nodeSize} = this; 1241 const stack = [0, ids.length - 1, 0]; 1242 const result = []; 1243 const r2 = r * r; 1244 1245 // recursively search for items within radius in the kd-sorted arrays 1246 while (stack.length) { 1247 const axis = stack.pop() || 0; 1248 const right = stack.pop() || 0; 1249 const left = stack.pop() || 0; 1250 1251 // if we reached "tree node", search linearly 1252 if (right - left <= nodeSize) { 1253 for (let i = left; i <= right; i++) { 1254 if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) result.push(ids[i]); 1255 } 1256 continue; 1257 } 1258 1259 // otherwise find the middle index 1260 const m = (left + right) >> 1; 1261 1262 // include the middle item if it's in range 1263 const x = coords[2 * m]; 1264 const y = coords[2 * m + 1]; 1265 if (sqDist(x, y, qx, qy) <= r2) result.push(ids[m]); 1266 1267 // queue search in halves that intersect the query 1268 if (axis === 0 ? qx - r <= x : qy - r <= y) { 1269 stack.push(left); 1270 stack.push(m - 1); 1271 stack.push(1 - axis); 1272 } 1273 if (axis === 0 ? qx + r >= x : qy + r >= y) { 1274 stack.push(m + 1); 1275 stack.push(right); 1276 stack.push(1 - axis); 1277 } 1278 } 1279 1280 return result; 1281 } 1282} 1283 1284/** 1285 * @param {Uint16Array | Uint32Array} ids 1286 * @param {InstanceType<TypedArrayConstructor>} coords 1287 * @param {number} nodeSize 1288 * @param {number} left 1289 * @param {number} right 1290 * @param {number} axis 1291 */ 1292function sort(ids, coords, nodeSize, left, right, axis) { 1293 if (right - left <= nodeSize) return; 1294 1295 const m = (left + right) >> 1; // middle index 1296 1297 // sort ids and coords around the middle index so that the halves lie 1298 // either left/right or top/bottom correspondingly (taking turns) 1299 select(ids, coords, m, left, right, axis); 1300 1301 // recursively kd-sort first half and second half on the opposite axis 1302 sort(ids, coords, nodeSize, left, m - 1, 1 - axis); 1303 sort(ids, coords, nodeSize, m + 1, right, 1 - axis); 1304} 1305 1306/** 1307 * Custom Floyd-Rivest selection algorithm: sort ids and coords so that 1308 * [left..k-1] items are smaller than k-th item (on either x or y axis) 1309 * @param {Uint16Array | Uint32Array} ids 1310 * @param {InstanceType<TypedArrayConstructor>} coords 1311 * @param {number} k 1312 * @param {number} left 1313 * @param {number} right 1314 * @param {number} axis 1315 */ 1316function select(ids, coords, k, left, right, axis) { 1317 1318 while (right > left) { 1319 if (right - left > 600) { 1320 const n = right - left + 1; 1321 const m = k - left + 1; 1322 const z = Math.log(n); 1323 const s = 0.5 * Math.exp(2 * z / 3); 1324 const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); 1325 const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); 1326 const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); 1327 select(ids, coords, k, newLeft, newRight, axis); 1328 } 1329 1330 const t = coords[2 * k + axis]; 1331 let i = left; 1332 let j = right; 1333 1334 swapItem(ids, coords, left, k); 1335 if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right); 1336 1337 while (i < j) { 1338 swapItem(ids, coords, i, j); 1339 i++; 1340 j--; 1341 while (coords[2 * i + axis] < t) i++; 1342 while (coords[2 * j + axis] > t) j--; 1343 } 1344 1345 if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j); 1346 else { 1347 j++; 1348 swapItem(ids, coords, j, right); 1349 } 1350 1351 if (j <= k) left = j + 1; 1352 if (k <= j) right = j - 1; 1353 } 1354} 1355 1356/** 1357 * @param {Uint16Array | Uint32Array} ids 1358 * @param {InstanceType<TypedArrayConstructor>} coords 1359 * @param {number} i 1360 * @param {number} j 1361 */ 1362function swapItem(ids, coords, i, j) { 1363 swap(ids, i, j); 1364 swap(coords, 2 * i, 2 * j); 1365 swap(coords, 2 * i + 1, 2 * j + 1); 1366} 1367 1368/** 1369 * @param {InstanceType<TypedArrayConstructor>} arr 1370 * @param {number} i 1371 * @param {number} j 1372 */ 1373function swap(arr, i, j) { 1374 const tmp = arr[i]; 1375 arr[i] = arr[j]; 1376 arr[j] = tmp; 1377} 1378 1379/** 1380 * @param {number} ax 1381 * @param {number} ay 1382 * @param {number} bx 1383 * @param {number} by 1384 */ 1385function sqDist(ax, ay, bx, by) { 1386 const dx = ax - bx; 1387 const dy = ay - by; 1388 return dx * dx + dy * dy; 1389} 1390 1391 1392/***/ }), 1393
vendor: 15,738 bytes, lines 1394-1831
1394/***/ "./node_modules/supercluster/index.js": 1395/*!********************************************!*\ 1396 !*** ./node_modules/supercluster/index.js ***! 1397 \********************************************/ 1398/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1399 1400__webpack_require__.r(__webpack_exports__); 1401/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1402/* harmony export */ "default": () => (/* binding */ Supercluster) 1403/* harmony export */ }); 1404/* harmony import */ var kdbush__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! kdbush */ "./node_modules/kdbush/index.js"); 1405 1406 1407 1408const defaultOptions = { 1409 minZoom: 0, // min zoom to generate clusters on 1410 maxZoom: 16, // max zoom level to cluster the points on 1411 minPoints: 2, // minimum points to form a cluster 1412 radius: 40, // cluster radius in pixels 1413 extent: 512, // tile extent (radius is calculated relative to it) 1414 nodeSize: 64, // size of the KD-tree leaf node, affects performance 1415 log: false, // whether to log timing info 1416 1417 // whether to generate numeric ids for input features (in vector tiles) 1418 generateId: false, 1419 1420 // a reduce function for calculating custom cluster properties 1421 reduce: null, // (accumulated, props) => { accumulated.sum += props.sum; } 1422 1423 // properties to use for individual points when running the reducer 1424 map: props => props // props => ({sum: props.my_value}) 1425}; 1426 1427const fround = Math.fround || (tmp => ((x) => { tmp[0] = +x; return tmp[0]; }))(new Float32Array(1)); 1428 1429const OFFSET_ZOOM = 2; 1430const OFFSET_ID = 3; 1431const OFFSET_PARENT = 4; 1432const OFFSET_NUM = 5; 1433const OFFSET_PROP = 6; 1434 1435class Supercluster { 1436 constructor(options) { 1437 this.options = Object.assign(Object.create(defaultOptions), options); 1438 this.trees = new Array(this.options.maxZoom + 1); 1439 this.stride = this.options.reduce ? 7 : 6; 1440 this.clusterProps = []; 1441 } 1442 1443 load(points) { 1444 const {log, minZoom, maxZoom} = this.options; 1445 1446 if (log) console.time('total time'); 1447 1448 const timerId = `prepare ${ points.length } points`; 1449 if (log) console.time(timerId); 1450 1451 this.points = points; 1452 1453 // generate a cluster object for each point and index input points into a KD-tree 1454 const data = []; 1455 1456 for (let i = 0; i < points.length; i++) { 1457 const p = points[i]; 1458 if (!p.geometry) continue; 1459 1460 const [lng, lat] = p.geometry.coordinates; 1461 const x = fround(lngX(lng)); 1462 const y = fround(latY(lat)); 1463 // store internal point/cluster data in flat numeric arrays for performance 1464 data.push( 1465 x, y, // projected point coordinates 1466 Infinity, // the last zoom the point was processed at 1467 i, // index of the source feature in the original input array 1468 -1, // parent cluster id 1469 1 // number of points in a cluster 1470 ); 1471 if (this.options.reduce) data.push(0); // noop 1472 } 1473 let tree = this.trees[maxZoom + 1] = this._createTree(data); 1474 1475 if (log) console.timeEnd(timerId); 1476 1477 // cluster points on max zoom, then cluster the results on previous zoom, etc.; 1478 // results in a cluster hierarchy across zoom levels 1479 for (let z = maxZoom; z >= minZoom; z--) { 1480 const now = +Date.now(); 1481 1482 // create a new set of clusters for the zoom and index them with a KD-tree 1483 tree = this.trees[z] = this._createTree(this._cluster(tree, z)); 1484 1485 if (log) console.log('z%d: %d clusters in %dms', z, tree.numItems, +Date.now() - now); 1486 } 1487 1488 if (log) console.timeEnd('total time'); 1489 1490 return this; 1491 } 1492 1493 getClusters(bbox, zoom) { 1494 let minLng = ((bbox[0] + 180) % 360 + 360) % 360 - 180; 1495 const minLat = Math.max(-90, Math.min(90, bbox[1])); 1496 let maxLng = bbox[2] === 180 ? 180 : ((bbox[2] + 180) % 360 + 360) % 360 - 180; 1497 const maxLat = Math.max(-90, Math.min(90, bbox[3])); 1498 1499 if (bbox[2] - bbox[0] >= 360) { 1500 minLng = -180; 1501 maxLng = 180; 1502 } else if (minLng > maxLng) { 1503 const easternHem = this.getClusters([minLng, minLat, 180, maxLat], zoom); 1504 const westernHem = this.getClusters([-180, minLat, maxLng, maxLat], zoom); 1505 return easternHem.concat(westernHem); 1506 } 1507 1508 const tree = this.trees[this._limitZoom(zoom)]; 1509 const ids = tree.range(lngX(minLng), latY(maxLat), lngX(maxLng), latY(minLat)); 1510 const data = tree.data; 1511 const clusters = []; 1512 for (const id of ids) { 1513 const k = this.stride * id; 1514 clusters.push(data[k + OFFSET_NUM] > 1 ? getClusterJSON(data, k, this.clusterProps) : this.points[data[k + OFFSET_ID]]); 1515 } 1516 return clusters; 1517 } 1518 1519 getChildren(clusterId) { 1520 const originId = this._getOriginId(clusterId); 1521 const originZoom = this._getOriginZoom(clusterId); 1522 const errorMsg = 'No cluster with the specified id.'; 1523 1524 const tree = this.trees[originZoom]; 1525 if (!tree) throw new Error(errorMsg); 1526 1527 const data = tree.data; 1528 if (originId * this.stride >= data.length) throw new Error(errorMsg); 1529 1530 const r = this.options.radius / (this.options.extent * Math.pow(2, originZoom - 1)); 1531 const x = data[originId * this.stride]; 1532 const y = data[originId * this.stride + 1]; 1533 const ids = tree.within(x, y, r); 1534 const children = []; 1535 for (const id of ids) { 1536 const k = id * this.stride; 1537 if (data[k + OFFSET_PARENT] === clusterId) { 1538 children.push(data[k + OFFSET_NUM] > 1 ? getClusterJSON(data, k, this.clusterProps) : this.points[data[k + OFFSET_ID]]); 1539 } 1540 } 1541 1542 if (children.length === 0) throw new Error(errorMsg); 1543 1544 return children; 1545 } 1546 1547 getLeaves(clusterId, limit, offset) { 1548 limit = limit || 10; 1549 offset = offset || 0; 1550 1551 const leaves = []; 1552 this._appendLeaves(leaves, clusterId, limit, offset, 0); 1553 1554 return leaves; 1555 } 1556 1557 getTile(z, x, y) { 1558 const tree = this.trees[this._limitZoom(z)]; 1559 const z2 = Math.pow(2, z); 1560 const {extent, radius} = this.options; 1561 const p = radius / extent; 1562 const top = (y - p) / z2; 1563 const bottom = (y + 1 + p) / z2; 1564 1565 const tile = { 1566 features: [] 1567 }; 1568 1569 this._addTileFeatures( 1570 tree.range((x - p) / z2, top, (x + 1 + p) / z2, bottom), 1571 tree.data, x, y, z2, tile); 1572 1573 if (x === 0) { 1574 this._addTileFeatures( 1575 tree.range(1 - p / z2, top, 1, bottom), 1576 tree.data, z2, y, z2, tile); 1577 } 1578 if (x === z2 - 1) { 1579 this._addTileFeatures( 1580 tree.range(0, top, p / z2, bottom), 1581 tree.data, -1, y, z2, tile); 1582 } 1583 1584 return tile.features.length ? tile : null; 1585 } 1586 1587 getClusterExpansionZoom(clusterId) { 1588 let expansionZoom = this._getOriginZoom(clusterId) - 1; 1589 while (expansionZoom <= this.options.maxZoom) { 1590 const children = this.getChildren(clusterId); 1591 expansionZoom++; 1592 if (children.length !== 1) break; 1593 clusterId = children[0].properties.cluster_id; 1594 } 1595 return expansionZoom; 1596 } 1597 1598 _appendLeaves(result, clusterId, limit, offset, skipped) { 1599 const children = this.getChildren(clusterId); 1600 1601 for (const child of children) { 1602 const props = child.properties; 1603 1604 if (props && props.cluster) { 1605 if (skipped + props.point_count <= offset) { 1606 // skip the whole cluster 1607 skipped += props.point_count; 1608 } else { 1609 // enter the cluster 1610 skipped = this._appendLeaves(result, props.cluster_id, limit, offset, skipped); 1611 // exit the cluster 1612 } 1613 } else if (skipped < offset) { 1614 // skip a single point 1615 skipped++; 1616 } else { 1617 // add a single point 1618 result.push(child); 1619 } 1620 if (result.length === limit) break; 1621 } 1622 1623 return skipped; 1624 } 1625 1626 _createTree(data) { 1627 const tree = new kdbush__WEBPACK_IMPORTED_MODULE_0__["default"](data.length / this.stride | 0, this.options.nodeSize, Float32Array); 1628 for (let i = 0; i < data.length; i += this.stride) tree.add(data[i], data[i + 1]); 1629 tree.finish(); 1630 tree.data = data; 1631 return tree; 1632 } 1633 1634 _addTileFeatures(ids, data, x, y, z2, tile) { 1635 for (const i of ids) { 1636 const k = i * this.stride; 1637 const isCluster = data[k + OFFSET_NUM] > 1; 1638 1639 let tags, px, py; 1640 if (isCluster) { 1641 tags = getClusterProperties(data, k, this.clusterProps); 1642 px = data[k]; 1643 py = data[k + 1]; 1644 } else { 1645 const p = this.points[data[k + OFFSET_ID]]; 1646 tags = p.properties; 1647 const [lng, lat] = p.geometry.coordinates; 1648 px = lngX(lng); 1649 py = latY(lat); 1650 } 1651 1652 const f = { 1653 type: 1, 1654 geometry: [[ 1655 Math.round(this.options.extent * (px * z2 - x)), 1656 Math.round(this.options.extent * (py * z2 - y)) 1657 ]], 1658 tags 1659 }; 1660 1661 // assign id 1662 let id; 1663 if (isCluster || this.options.generateId) { 1664 // optionally generate id for points 1665 id = data[k + OFFSET_ID]; 1666 } else { 1667 // keep id if already assigned 1668 id = this.points[data[k + OFFSET_ID]].id; 1669 } 1670 1671 if (id !== undefined) f.id = id; 1672 1673 tile.features.push(f); 1674 } 1675 } 1676 1677 _limitZoom(z) { 1678 return Math.max(this.options.minZoom, Math.min(Math.floor(+z), this.options.maxZoom + 1)); 1679 } 1680 1681 _cluster(tree, zoom) { 1682 const {radius, extent, reduce, minPoints} = this.options; 1683 const r = radius / (extent * Math.pow(2, zoom)); 1684 const data = tree.data; 1685 const nextData = []; 1686 const stride = this.stride; 1687 1688 // loop through each point 1689 for (let i = 0; i < data.length; i += stride) { 1690 // if we've already visited the point at this zoom level, skip it 1691 if (data[i + OFFSET_ZOOM] <= zoom) continue; 1692 data[i + OFFSET_ZOOM] = zoom; 1693 1694 // find all nearby points 1695 const x = data[i]; 1696 const y = data[i + 1]; 1697 const neighborIds = tree.within(data[i], data[i + 1], r); 1698 1699 const numPointsOrigin = data[i + OFFSET_NUM]; 1700 let numPoints = numPointsOrigin; 1701 1702 // count the number of points in a potential cluster 1703 for (const neighborId of neighborIds) { 1704 const k = neighborId * stride; 1705 // filter out neighbors that are already processed 1706 if (data[k + OFFSET_ZOOM] > zoom) numPoints += data[k + OFFSET_NUM]; 1707 } 1708 1709 // if there were neighbors to merge, and there are enough points to form a cluster 1710 if (numPoints > numPointsOrigin && numPoints >= minPoints) { 1711 let wx = x * numPointsOrigin; 1712 let wy = y * numPointsOrigin; 1713 1714 let clusterProperties; 1715 let clusterPropIndex = -1; 1716 1717 // encode both zoom and point index on which the cluster originated -- offset by total length of features 1718 const id = ((i / stride | 0) << 5) + (zoom + 1) + this.points.length; 1719 1720 for (const neighborId of neighborIds) { 1721 const k = neighborId * stride; 1722 1723 if (data[k + OFFSET_ZOOM] <= zoom) continue; 1724 data[k + OFFSET_ZOOM] = zoom; // save the zoom (so it doesn't get processed twice) 1725 1726 const numPoints2 = data[k + OFFSET_NUM]; 1727 wx += data[k] * numPoints2; // accumulate coordinates for calculating weighted center 1728 wy += data[k + 1] * numPoints2; 1729 1730 data[k + OFFSET_PARENT] = id; 1731 1732 if (reduce) { 1733 if (!clusterProperties) { 1734 clusterProperties = this._map(data, i, true); 1735 clusterPropIndex = this.clusterProps.length; 1736 this.clusterProps.push(clusterProperties); 1737 } 1738 reduce(clusterProperties, this._map(data, k)); 1739 } 1740 } 1741 1742 data[i + OFFSET_PARENT] = id; 1743 nextData.push(wx / numPoints, wy / numPoints, Infinity, id, -1, numPoints); 1744 if (reduce) nextData.push(clusterPropIndex); 1745 1746 } else { // left points as unclustered 1747 for (let j = 0; j < stride; j++) nextData.push(data[i + j]); 1748 1749 if (numPoints > 1) { 1750 for (const neighborId of neighborIds) { 1751 const k = neighborId * stride; 1752 if (data[k + OFFSET_ZOOM] <= zoom) continue; 1753 data[k + OFFSET_ZOOM] = zoom; 1754 for (let j = 0; j < stride; j++) nextData.push(data[k + j]); 1755 } 1756 } 1757 } 1758 } 1759 1760 return nextData; 1761 } 1762 1763 // get index of the point from which the cluster originated 1764 _getOriginId(clusterId) { 1765 return (clusterId - this.points.length) >> 5; 1766 } 1767 1768 // get zoom of the point from which the cluster originated 1769 _getOriginZoom(clusterId) { 1770 return (clusterId - this.points.length) % 32; 1771 } 1772 1773 _map(data, i, clone) { 1774 if (data[i + OFFSET_NUM] > 1) { 1775 const props = this.clusterProps[data[i + OFFSET_PROP]]; 1776 return clone ? Object.assign({}, props) : props; 1777 } 1778 const original = this.points[data[i + OFFSET_ID]].properties; 1779 const result = this.options.map(original); 1780 return clone && result === original ? Object.assign({}, result) : result; 1781 } 1782} 1783 1784function getClusterJSON(data, i, clusterProps) { 1785 return { 1786 type: 'Feature', 1787 id: data[i + OFFSET_ID], 1788 properties: getClusterProperties(data, i, clusterProps), 1789 geometry: { 1790 type: 'Point', 1791 coordinates: [xLng(data[i]), yLat(data[i + 1])] 1792 } 1793 }; 1794} 1795 1796function getClusterProperties(data, i, clusterProps) { 1797 const count = data[i + OFFSET_NUM]; 1798 const abbrev = 1799 count >= 10000 ? `${Math.round(count / 1000) }k` : 1800 count >= 1000 ? `${Math.round(count / 100) / 10 }k` : count; 1801 const propIndex = data[i + OFFSET_PROP]; 1802 const properties = propIndex === -1 ? {} : Object.assign({}, clusterProps[propIndex]); 1803 return Object.assign(properties, { 1804 cluster: true, 1805 cluster_id: data[i + OFFSET_ID], 1806 point_count: count, 1807 point_count_abbreviated: abbrev 1808 }); 1809} 1810 1811// longitude/latitude to spherical mercator in [0..1] range 1812function lngX(lng) { 1813 return lng / 360 + 0.5; 1814} 1815function latY(lat) { 1816 const sin = Math.sin(lat * Math.PI / 180); 1817 const y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI); 1818 return y < 0 ? 0 : y > 1 ? 1 : y; 1819} 1820 1821// spherical mercator to longitude/latitude 1822function xLng(x) { 1823 return (x - 0.5) * 360; 1824} 1825function yLat(y) { 1826 const y2 = (180 - y * 360) * Math.PI / 180; 1827 return 360 * Math.atan(Math.exp(y2)) / Math.PI - 90; 1828} 1829 1830 1831/***/ })
vendor: 3,258 bytes, lines 1831-1908
1831 1832 1833/******/ }); 1834/************************************************************************/ 1835/******/ // The module cache 1836/******/ var __webpack_module_cache__ = {}; 1837/******/ 1838/******/ // The require function 1839/******/ function __webpack_require__(moduleId) { 1840/******/ // Check if module is in cache 1841/******/ var cachedModule = __webpack_module_cache__[moduleId]; 1842/******/ if (cachedModule !== undefined) { 1843/******/ return cachedModule.exports; 1844/******/ } 1845/******/ // Create a new module (and put it into the cache) 1846/******/ var module = __webpack_module_cache__[moduleId] = { 1847/******/ // no module.id needed 1848/******/ // no module.loaded needed 1849/******/ exports: {} 1850/******/ }; 1851/******/ 1852/******/ // Execute the module function 1853/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 1854/******/ 1855/******/ // Return the exports of the module 1856/******/ return module.exports; 1857/******/ } 1858/******/ 1859/************************************************************************/ 1860/******/ /* webpack/runtime/compat get default export */ 1861/******/ (() => { 1862/******/ // getDefaultExport function for compatibility with non-harmony modules 1863/******/ __webpack_require__.n = (module) => { 1864/******/ var getter = module && module.__esModule ? 1865/******/ () => (module['default']) : 1866/******/ () => (module); 1867/******/ __webpack_require__.d(getter, { a: getter }); 1868/******/ return getter; 1869/******/ }; 1870/******/ })(); 1871/******/ 1872/******/ /* webpack/runtime/define property getters */ 1873/******/ (() => { 1874/******/ // define getter functions for harmony exports 1875/******/ __webpack_require__.d = (exports, definition) => { 1876/******/ for(var key in definition) { 1877/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 1878/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 1879/******/ } 1880/******/ } 1881/******/ }; 1882/******/ })(); 1883/******/ 1884/******/ /* webpack/runtime/hasOwnProperty shorthand */ 1885/******/ (() => { 1886/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 1887/******/ })(); 1888/******/ 1889/******/ /* webpack/runtime/make namespace object */ 1890/******/ (() => { 1891/******/ // define __esModule on exports 1892/******/ __webpack_require__.r = (exports) => { 1893/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 1894/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 1895/******/ } 1896/******/ Object.defineProperty(exports, '__esModule', { value: true }); 1897/******/ }; 1898/******/ })(); 1899/******/ 1900/************************************************************************/ 1901var __webpack_exports__ = {}; 1902// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. 1903(() => { 1904/*!***************************************!*\ 1905 !*** ./resources/scripts/user-map.js ***! 1906 \***************************************/ 1907__webpack_require__.r(__webpack_exports__); 1908/* harmony import */ var _googlemaps_markerclusterer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @googlemaps/markerclusterer */ "./node_modules/@googlemaps/markerclusterer/dist/index.esm.js");
vendor: 9,398 bytes, lines 1908-1911
1908 1909function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 1910function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } 1911function asyncGeneratorStep(
1911n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } 1912function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } 1913 1914document.addEventListener('DOMContentLoaded', function () { 1915 var button = document.getElementById('load-map-btn'); 1916 var container = document.getElementById('user-map-container'); 1917 if (!button || !container) return; 1918 button.addEventListener('click', function () { 1919 if (container.dataset.loaded) return; 1920 1921 // â CREA il div mappa e lo aggiunge al DOM 1922 var mapDiv = document.createElement('div'); 1923 mapDiv.id = 'map'; 1924 mapDiv.style.height = '500px'; 1925 mapDiv.style.width = '100%'; 1926 container.appendChild(mapDiv); 1927 button.style.display = 'none'; 1928 1929 // â Aspetta il prossimo frame per assicurarsi che il DOM sia aggiornato 1930 requestAnimationFrame(function () { 1931 var locations = Object.values(mapData.mapData); 1932 initMap(locations); 1933 container.dataset.loaded = 'true'; 1934 }); 1935 }); 1936}); 1937function initMap(_x) { 1938 return _initMap.apply(this, arguments); 1939} 1940function _initMap() { 1941 _initMap = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(locations) { 1942 var _yield$google$maps$im, Map, _yield$google$maps$im2, AdvancedMarkerElement, map, markers; 1943 return _regeneratorRuntime().wrap(function _callee$(_context) { 1944 while (1) switch (_context.prev = _context.next) { 1945 case 0: 1946 _context.next = 2; 1947 return google.maps.importLibrary("maps"); 1948 case 2: 1949 _yield$google$maps$im = _context.sent; 1950 Map = _yield$google$maps$im.Map; 1951 _context.next = 6; 1952 return google.maps.importLibrary("marker"); 1953 case 6: 1954 _yield$google$maps$im2 = _context.sent; 1955 AdvancedMarkerElement = _yield$google$maps$im2.AdvancedMarkerElement; 1956 console.log(document.getElementById("map")); 1957 map = new Map(document.getElementById("map"), { 1958 center: { 1959 lat: 45.464194, 1960 lng: 9.189635 1961 }, 1962 zoom: 8, 1963 disableDefaultUI: true, 1964 zoomControl: true, 1965 mapId: "USER_MAPS", 1966 maxZoom: 13 1967 }); 1968 markers = locations.map(function (position) { 1969 var pin = document.createElement('div'); 1970 pin.textContent = '1'; 1971 pin.className = 'custom-pin'; 1972 pin.style.cssText = "\n\t\t\tbackground: rgba(243, 147, 22, 0.9);\n\t\t\tcolor: white;\n\t\t\tborder-radius: 50%;\n\t\t\twidth: 40px;\n\t\t\theight: 40px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tfont-weight: bold;\n\t\t"; 1973 return new AdvancedMarkerElement({ 1974 position: position, 1975 content: pin, 1976 title: '1 socio in questo comune' 1977 }); 1978 }); 1979 new _googlemaps_markerclusterer__WEBPACK_IMPORTED_MODULE_0__.MarkerClusterer({ 1980 map: map, 1981 markers: markers, 1982 renderer: { 1983 render: function render(_ref) { 1984 var count = _ref.count, 1985 position = _ref.position; 1986 var cluster = document.createElement('div'); 1987 cluster.textContent = count; 1988 cluster.className = 'custom-cluster'; 1989 cluster.style.cssText = "\n\t\t\t\t\tbackground: rgba(243, 147, 22, 0.9);\n\t\t\t\t\tcolor: white;\n\t\t\t\t\tborder-radius: 50%;\n\t\t\t\t\twidth: 40px;\n\t\t\t\t\theight: 40px;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: center;\n\t\t\t\t\tfont-weight: bold;\n\t\t\t\t"; 1990 return new AdvancedMarkerElement({ 1991 position: position, 1992 content: cluster 1993 }); 1994 } 1995 } 1996 }); 1997 case 12: 1998 case "end": 1999 return _context.stop(); 2000 } 2001 }, _callee); 2002 })); 2003 return _initMap.apply(this, arguments); 2004} 2005})(); 2006 2007/******/ })() 2008;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.