How to use oldMutant method in stryker-parent

Best JavaScript code snippet using stryker-parent

vue3-leaflet.es.js

Source:vue3-leaflet.es.js Github

copy

Full Screen

1var __defProp = Object.defineProperty;2var __defProps = Object.defineProperties;3var __getOwnPropDescs = Object.getOwnPropertyDescriptors;4var __getOwnPropSymbols = Object.getOwnPropertySymbols;5var __hasOwnProp = Object.prototype.hasOwnProperty;6var __propIsEnum = Object.prototype.propertyIsEnumerable;7var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;8var __spreadValues = (a, b) => {9 for (var prop in b || (b = {}))10 if (__hasOwnProp.call(b, prop))11 __defNormalProp(a, prop, b[prop]);12 if (__getOwnPropSymbols)13 for (var prop of __getOwnPropSymbols(b)) {14 if (__propIsEnum.call(b, prop))15 __defNormalProp(a, prop, b[prop]);16 }17 return a;18};19var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));20var __objRest = (source, exclude) => {21 var target = {};22 for (var prop in source)23 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)24 target[prop] = source[prop];25 if (source != null && __getOwnPropSymbols)26 for (var prop of __getOwnPropSymbols(source)) {27 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))28 target[prop] = source[prop];29 }30 return target;31};32import { toRefs, reactive, ref, onMounted, provide, watch, openBlock, createElementBlock, renderSlot, createCommentVNode, inject, unref, computed, onUnmounted, createElementVNode } from "vue";33import L$1, { LatLng, Map, Icon, Marker, Popup, Control } from "leaflet";34import { templateRef, get, whenever, set, useMounted } from "@vueuse/core";35import "leaflet.gridlayer.googlemutant/dist/Leaflet.GoogleMutant.js";36import "leaflet.smooth_marker_bouncing";37import "leaflet-pegman";38const _sfc_main$5 = {39 __name: "MapContainer",40 props: {41 center: {42 type: [LatLng, Array, Object],43 default: () => new LatLng(0, 0)44 },45 zoom: {46 type: Number,47 default: 1348 },49 zoomControl: {50 type: Boolean,51 default: true52 },53 scrollWheelZoom: {54 type: Boolean,55 default: true56 },57 bounds: {58 type: Array,59 default: void 060 }61 },62 emits: ["ready", "move", "zoomend"],63 setup(__props, { emit }) {64 const props = __props;65 const { center, zoom, zoomControl, bounds, scrollWheelZoom } = toRefs(props);66 const options = reactive({67 scrollWheelZoom68 });69 const container = templateRef("container");70 const mapRef = ref();71 function fitBounds(map, bounds2) {72 if (bounds2.length > 0) {73 map.fitBounds(bounds2);74 }75 }76 onMounted(() => {77 const map = new Map(get(container), options);78 provide("map", map);79 watch(center, (center2) => map.setView(center2, props.zoom), { immediate: true });80 watch(zoom, (zoom2) => map.setView(props.center, zoom2), { immediate: true });81 watch(zoomControl, (zoomControl2) => zoomControl2 ? map.zoomControl.addTo(map) : map.zoomControl.remove(), { immediate: true });82 whenever(bounds, (bounds2) => fitBounds(map, bounds2), { immediate: true });83 set(mapRef, map);84 map.on("move", (event) => emit("move", { event, center: map.getCenter() }));85 map.on("zoomend", () => emit("zoomend", map.getZoom()));86 emit("ready", map);87 });88 return (_ctx, _cache) => {89 return openBlock(), createElementBlock("div", {90 ref_key: "container",91 ref: container92 }, [93 mapRef.value ? renderSlot(_ctx.$slots, "default", {94 key: 0,95 map: mapRef.value96 }) : createCommentVNode("", true)97 ], 512);98 };99 }100};101const _sfc_main$4 = {102 __name: "OpenStreetMap",103 props: {104 url: {105 type: String,106 default: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"107 },108 attribution: {109 type: String,110 default: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors'111 },112 type: {113 type: String,114 default: "roadmap",115 validator: (type) => ["roadmap"].includes(type)116 }117 },118 setup(__props) {119 const props = __props;120 const map = ref(inject("map"));121 const layer = L$1.tileLayer(props.url, {122 attribution: props.attribution123 });124 provide("layer", layer);125 whenever(map, (map2) => map2.addLayer(layer), { immediate: true });126 return (_ctx, _cache) => {127 return renderSlot(_ctx.$slots, "default");128 };129 }130};131const _sfc_main$3 = {132 __name: "Mapbox",133 props: {134 url: {135 type: String,136 default: "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token={apiKey}"137 },138 apiKey: {139 type: String,140 required: true141 },142 attribution: {143 type: String,144 default: '&copy <a href="https://www.mapbox.com/about/maps/">Mapbox</a>&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> - <a href="https://www.mapbox.com/map-feedback/">Improve this map</a>'145 },146 tileSize: {147 type: Number,148 default: 512149 },150 zoomOffset: {151 type: Number,152 default: -1153 },154 type: {155 type: String,156 default: "roadmap",157 validator: (type) => ["roadmap"].includes(type)158 }159 },160 setup(__props) {161 const props = __props;162 const map = ref(inject("map"));163 const options = reactive({164 apiKey: props.apiKey,165 attribution: props.attribution,166 tileSize: props.tileSize,167 zoomOffset: props.zoomOffset168 });169 const layer = L$1.tileLayer(props.url, options);170 provide("layer", layer);171 whenever(map, (map2) => map2.addLayer(layer), { immediate: true });172 return (_ctx, _cache) => {173 return renderSlot(_ctx.$slots, "default");174 };175 }176};177function renderless(component) {178 return Object.assign(component, { render: () => void 0 });179}180function isRealObject(object) {181 return typeof object === "object" && object !== null;182}183function clean(object) {184 if (!isRealObject(object)) {185 return object;186 }187 Object.keys(object).forEach((key) => {188 if (isRealObject(object[key])) {189 object[key] = clean(object[key]);190 return;191 }192 if (typeof object[key] === "undefined") {193 if (Array.isArray(object)) {194 object.splice(key, 1);195 } else {196 delete object[key];197 }198 }199 });200 return object;201}202async function loadGmapsApi(GOOGLE_MAPS_API_KEY) {203 var _a;204 window.gmapsApi = (_a = window.gmapsApi) != null ? _a : new Promise((resolve, reject) => {205 const el = document.createElement("script");206 el.type = "text/javascript";207 el.src = "https://maps.googleapis.com/maps/api/js?key=" + GOOGLE_MAPS_API_KEY;208 el.async = true;209 el.addEventListener("error", (event) => reject(event));210 el.addEventListener("abort", (event) => reject(event));211 el.addEventListener("load", () => {212 window.L = L$1;213 resolve(true);214 });215 document.head.appendChild(el);216 });217 return window.gmapsApi;218}219const _sfc_main$2 = {220 __name: "GoogleMaps",221 props: {222 url: {223 type: String,224 default: "https://mt0.google.com/vt/lyrs=m&x={x}&y={y}&z={z}"225 },226 apiKey: {227 type: String,228 required: true229 },230 type: {231 type: String,232 default: "roadmap",233 validator: (type) => ["roadmap", "satellite", "terrain", "hybrid"].includes(type)234 }235 },236 setup(__props) {237 const props = __props;238 const { type } = toRefs(props);239 const defaultOptions = reactive({ type });240 const useGoogleMutant = (GOOGLE_MAPS_API_KEY) => {241 const mount = (map2, options2) => L$1.gridLayer.googleMutant(options2).addTo(map2);242 const load = async (map2, options2 = defaultOptions) => {243 await loadGmapsApi(GOOGLE_MAPS_API_KEY);244 mount(map2, options2);245 };246 return { load };247 };248 const map = ref(inject("map"));249 const options = reactive({250 apiKey: props.apiKey,251 attribution: props.attribution,252 tileSize: props.tileSize,253 zoomOffset: props.zoomOffset254 });255 const layer = L$1.tileLayer(props.url, options);256 const gmaps = useGoogleMutant(props.apiKey);257 const mutant = ref();258 whenever(mutant, (mutant2, oldMutant) => oldMutant == null ? void 0 : oldMutant.remove());259 watch(type, () => setMutant(unref(map)));260 async function setMutant(map2) {261 set(mutant, await gmaps.load(map2, defaultOptions));262 }263 provide("layer", layer);264 whenever(map, (map2) => setMutant(map2), { immediate: true });265 return (_ctx, _cache) => {266 return renderSlot(_ctx.$slots, "default");267 };268 }269};270const _sfc_main$1 = {271 __name: "Marker",272 props: {273 position: {274 type: [LatLng, Array, Object],275 required: true276 },277 icon: {278 type: [String, Object, Icon],279 default: void 0280 },281 title: {282 type: String,283 default: void 0284 },285 alt: {286 type: String,287 default: void 0288 },289 opacity: {290 type: Number,291 default: void 0292 },293 tooltip: {294 type: String,295 default: void 0296 },297 bounce: {298 type: [Boolean, Number],299 default: false300 },301 bounceHeight: {302 type: Number,303 default: void 0304 },305 contractHeight: {306 type: Number,307 default: void 0308 },309 bounceSpeed: {310 type: Number,311 default: void 0312 },313 contractSpeed: {314 type: Number,315 default: void 0316 },317 shadowAngle: {318 type: Number,319 default: void 0320 },321 elastic: {322 type: Boolean,323 default: void 0324 },325 exclusive: {326 type: Boolean,327 default: void 0328 }329 },330 emits: ["click", "bounceend"],331 setup(__props, { emit }) {332 const props = __props;333 Marker.prototype._animateZoom = function(opt) {334 if (!this._map) {335 return;336 }337 const pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();338 this._setPos(pos);339 };340 const {341 position,342 title,343 alt,344 opacity,345 bounce,346 bounceHeight,347 contractHeight,348 bounceSpeed,349 contractSpeed,350 shadowAngle,351 elastic,352 exclusive353 } = toRefs(props);354 const options = reactive({355 title,356 alt,357 opacity358 });359 const icon = computed(() => {360 if (props.icon instanceof Icon) {361 return props.icon;362 }363 if (props.icon instanceof Object) {364 return L$1.icon(props.icon);365 }366 if (typeof props.icon === "string") {367 const defaults = {368 iconSize: [50, 50],369 iconAnchor: [22, 50],370 popupAnchor: [0, -50]371 };372 return L$1.icon(__spreadValues({ iconUrl: props.icon }, defaults));373 }374 });375 const bouncingOptions = reactive({376 bounceHeight,377 contractHeight,378 bounceSpeed,379 contractSpeed,380 shadowAngle,381 elastic,382 exclusive383 });384 const map = ref(inject("map"));385 const marker = L$1.marker(props.position, clean(options));386 provide("layer", marker);387 marker.on("click", () => emit("click", marker));388 marker.on("bounceend", () => emit("bounceend"));389 function doBounce(marker2, value) {390 if (typeof value === "boolean") {391 value ? marker2.bounce() : marker2.stopBouncing();392 return;393 }394 marker2.bounce(value);395 }396 function updateOptions(marker2) {397 L$1.setOptions(marker2, clean(options));398 marker2._removeIcon();399 marker2._initIcon();400 marker2.update();401 }402 whenever(map, (map2) => map2.addLayer(marker), { immediate: true });403 whenever(position, (position2) => marker.setLatLng(position2));404 whenever(icon, (icon2) => marker.setIcon(icon2), { deep: true, immediate: true });405 whenever(options, () => updateOptions(marker), { deep: true, immediate: true });406 whenever(bouncingOptions, (bouncingOptions2) => marker.setBouncingOptions(clean(bouncingOptions2)), { deep: true, immediate: true });407 watch(bounce, (value) => doBounce(marker, value), { immediate: true });408 onUnmounted(() => marker.remove());409 return (_ctx, _cache) => {410 return renderSlot(_ctx.$slots, "default", { marker: unref(marker) });411 };412 }413};414const _hoisted_1 = { style: { "opacity": "0" } };415const _hoisted_2 = {416 ref: "popup-content",417 id: "popup-container"418};419const _sfc_main = {420 __name: "Popup",421 props: {422 position: {423 type: LatLng,424 default: void 0425 }426 },427 setup(__props) {428 const props = __props;429 Popup.prototype._animateZoom = function(e) {430 if (!this._map) {431 return;432 }433 const pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);434 const anchor = this._getAnchor();435 L.DomUtil.setPosition(this._container, pos.add(anchor));436 };437 if (!window.fixPopupCloseEvent) {438 document.addEventListener("click", (evt) => {439 let target = evt.target;440 while (target != null) {441 if (target.matches('a[href="#close"]')) {442 evt.preventDefault();443 return;444 }445 target = target.parentElement;446 }447 });448 window.fixPopupCloseEvent = true;449 }450 const { position } = toRefs(props);451 const popupContent = templateRef("popup-content");452 const popup = new Popup();453 const layer = inject("layer");454 const isMounted = useMounted();455 const isBound = ref(false);456 provide("layer", popup);457 function bindPopup() {458 if (get(isBound) === true) {459 return;460 }461 get(layer).bindPopup(popup);462 set(isBound, true);463 }464 function hydrateContent(content) {465 if (get(isMounted) === false) {466 return;467 }468 const isStructured = content.firstElementChild instanceof Element;469 if (content.innerHTML.trim().length > 0) {470 popup.setContent(isStructured ? content.firstElementChild : content);471 bindPopup();472 }473 }474 whenever(position, (position2) => popup.setLatLng(position2), { immediate: true });475 watch(popupContent, hydrateContent, { immediate: true });476 return (_ctx, _cache) => {477 return openBlock(), createElementBlock("div", _hoisted_1, [478 createElementVNode("div", _hoisted_2, [479 renderSlot(_ctx.$slots, "default")480 ], 512)481 ]);482 };483 }484};485var PathProps = {486 color: {487 type: String488 },489 weight: {490 type: Number491 },492 opacity: {493 type: Number494 },495 fillColor: {496 type: String497 }498};499var Circle = renderless({500 props: __spreadValues({501 center: {502 type: [LatLng, Array, Object],503 required: true504 },505 radius: {506 type: Number,507 required: true508 }509 }, PathProps),510 setup(props) {511 const {512 center,513 radius,514 color,515 weight,516 opacity,517 fillColor518 } = toRefs(props);519 const stroke = computed(() => props.color != null);520 const fill = computed(() => props.fillColor != null);521 const options = reactive({522 radius,523 stroke,524 color,525 weight,526 opacity,527 fill,528 fillColor529 });530 const map = ref(inject("map"));531 const circle = L$1.circle(props.center, clean(options));532 provide("layer", circle);533 whenever(map, (map2) => map2.addLayer(circle), { immediate: true });534 whenever(options, (options2) => L$1.setOptions(circle, clean(options2), { deep: true, immediate: true }));535 whenever(center, (position) => circle.setLatLng(position));536 onUnmounted(() => circle.remove());537 }538});539var leaflet_geometryutil = { exports: {} };540(function(module) {541 (function(factory) {542 var L2;543 {544 L2 = L$1;545 module.exports = factory(L2);546 }547 })(function(L2) {548 L2.Polyline._flat = L2.LineUtil.isFlat || L2.Polyline._flat || function(latlngs) {549 return !L2.Util.isArray(latlngs[0]) || typeof latlngs[0][0] !== "object" && typeof latlngs[0][0] !== "undefined";550 };551 L2.GeometryUtil = L2.extend(L2.GeometryUtil || {}, {552 distance: function(map, latlngA, latlngB) {553 return map.latLngToLayerPoint(latlngA).distanceTo(map.latLngToLayerPoint(latlngB));554 },555 distanceSegment: function(map, latlng, latlngA, latlngB) {556 var p = map.latLngToLayerPoint(latlng), p1 = map.latLngToLayerPoint(latlngA), p2 = map.latLngToLayerPoint(latlngB);557 return L2.LineUtil.pointToSegmentDistance(p, p1, p2);558 },559 readableDistance: function(distance, unit) {560 var isMetric = unit !== "imperial", distanceStr;561 if (isMetric) {562 if (distance > 1e3) {563 distanceStr = (distance / 1e3).toFixed(2) + " km";564 } else {565 distanceStr = distance.toFixed(1) + " m";566 }567 } else {568 distance *= 1.09361;569 if (distance > 1760) {570 distanceStr = (distance / 1760).toFixed(2) + " miles";571 } else {572 distanceStr = distance.toFixed(1) + " yd";573 }574 }575 return distanceStr;576 },577 belongsSegment: function(latlng, latlngA, latlngB, tolerance) {578 tolerance = tolerance === void 0 ? 0.2 : tolerance;579 var hypotenuse = latlngA.distanceTo(latlngB), delta = latlngA.distanceTo(latlng) + latlng.distanceTo(latlngB) - hypotenuse;580 return delta / hypotenuse < tolerance;581 },582 length: function(coords) {583 var accumulated = L2.GeometryUtil.accumulatedLengths(coords);584 return accumulated.length > 0 ? accumulated[accumulated.length - 1] : 0;585 },586 accumulatedLengths: function(coords) {587 if (typeof coords.getLatLngs == "function") {588 coords = coords.getLatLngs();589 }590 if (coords.length === 0)591 return [];592 var total = 0, lengths = [0];593 for (var i = 0, n = coords.length - 1; i < n; i++) {594 total += coords[i].distanceTo(coords[i + 1]);595 lengths.push(total);596 }597 return lengths;598 },599 closestOnSegment: function(map, latlng, latlngA, latlngB) {600 var maxzoom = map.getMaxZoom();601 if (maxzoom === Infinity)602 maxzoom = map.getZoom();603 var p = map.project(latlng, maxzoom), p1 = map.project(latlngA, maxzoom), p2 = map.project(latlngB, maxzoom), closest = L2.LineUtil.closestPointOnSegment(p, p1, p2);604 return map.unproject(closest, maxzoom);605 },606 closest: function(map, layer, latlng, vertices) {607 var latlngs, mindist = Infinity, result = null, i, n, distance, subResult;608 if (layer instanceof Array) {609 if (layer[0] instanceof Array && typeof layer[0][0] !== "number") {610 for (i = 0; i < layer.length; i++) {611 subResult = L2.GeometryUtil.closest(map, layer[i], latlng, vertices);612 if (subResult && subResult.distance < mindist) {613 mindist = subResult.distance;614 result = subResult;615 }616 }617 return result;618 } else if (layer[0] instanceof L2.LatLng || typeof layer[0][0] === "number" || typeof layer[0].lat === "number") {619 layer = L2.polyline(layer);620 } else {621 return result;622 }623 }624 if (!(layer instanceof L2.Polyline))625 return result;626 latlngs = JSON.parse(JSON.stringify(layer.getLatLngs().slice(0)));627 if (layer instanceof L2.Polygon) {628 var addLastSegment = function(latlngs2) {629 if (L2.Polyline._flat(latlngs2)) {630 latlngs2.push(latlngs2[0]);631 } else {632 for (var i2 = 0; i2 < latlngs2.length; i2++) {633 addLastSegment(latlngs2[i2]);634 }635 }636 };637 addLastSegment(latlngs);638 }639 if (!L2.Polyline._flat(latlngs)) {640 for (i = 0; i < latlngs.length; i++) {641 subResult = L2.GeometryUtil.closest(map, latlngs[i], latlng, vertices);642 if (subResult.distance < mindist) {643 mindist = subResult.distance;644 result = subResult;645 }646 }647 return result;648 } else {649 if (vertices) {650 for (i = 0, n = latlngs.length; i < n; i++) {651 var ll = latlngs[i];652 distance = L2.GeometryUtil.distance(map, latlng, ll);653 if (distance < mindist) {654 mindist = distance;655 result = ll;656 result.distance = distance;657 }658 }659 return result;660 }661 for (i = 0, n = latlngs.length; i < n - 1; i++) {662 var latlngA = latlngs[i], latlngB = latlngs[i + 1];663 distance = L2.GeometryUtil.distanceSegment(map, latlng, latlngA, latlngB);664 if (distance <= mindist) {665 mindist = distance;666 result = L2.GeometryUtil.closestOnSegment(map, latlng, latlngA, latlngB);667 result.distance = distance;668 }669 }670 return result;671 }672 },673 closestLayer: function(map, layers, latlng) {674 var mindist = Infinity, result = null, ll = null, distance = Infinity;675 for (var i = 0, n = layers.length; i < n; i++) {676 var layer = layers[i];677 if (layer instanceof L2.LayerGroup) {678 var subResult = L2.GeometryUtil.closestLayer(map, layer.getLayers(), latlng);679 if (subResult.distance < mindist) {680 mindist = subResult.distance;681 result = subResult;682 }683 } else {684 if (typeof layer.getLatLng == "function") {685 ll = layer.getLatLng();686 distance = L2.GeometryUtil.distance(map, latlng, ll);687 } else {688 ll = L2.GeometryUtil.closest(map, layer, latlng);689 if (ll)690 distance = ll.distance;691 }692 if (distance < mindist) {693 mindist = distance;694 result = { layer, latlng: ll, distance };695 }696 }697 }698 return result;699 },700 nClosestLayers: function(map, layers, latlng, n) {701 n = typeof n === "number" ? n : layers.length;702 if (n < 1 || layers.length < 1) {703 return null;704 }705 var results = [];706 var distance, ll;707 for (var i = 0, m = layers.length; i < m; i++) {708 var layer = layers[i];709 if (layer instanceof L2.LayerGroup) {710 var subResult = L2.GeometryUtil.closestLayer(map, layer.getLayers(), latlng);711 results.push(subResult);712 } else {713 if (typeof layer.getLatLng == "function") {714 ll = layer.getLatLng();715 distance = L2.GeometryUtil.distance(map, latlng, ll);716 } else {717 ll = L2.GeometryUtil.closest(map, layer, latlng);718 if (ll)719 distance = ll.distance;720 }721 results.push({ layer, latlng: ll, distance });722 }723 }724 results.sort(function(a, b) {725 return a.distance - b.distance;726 });727 if (results.length > n) {728 return results.slice(0, n);729 } else {730 return results;731 }732 },733 layersWithin: function(map, layers, latlng, radius) {734 radius = typeof radius == "number" ? radius : Infinity;735 var results = [];736 var ll = null;737 var distance = 0;738 for (var i = 0, n = layers.length; i < n; i++) {739 var layer = layers[i];740 if (typeof layer.getLatLng == "function") {741 ll = layer.getLatLng();742 distance = L2.GeometryUtil.distance(map, latlng, ll);743 } else {744 ll = L2.GeometryUtil.closest(map, layer, latlng);745 if (ll)746 distance = ll.distance;747 }748 if (ll && distance < radius) {749 results.push({ layer, latlng: ll, distance });750 }751 }752 var sortedResults = results.sort(function(a, b) {753 return a.distance - b.distance;754 });755 return sortedResults;756 },757 closestLayerSnap: function(map, layers, latlng, tolerance, withVertices) {758 tolerance = typeof tolerance == "number" ? tolerance : Infinity;759 withVertices = typeof withVertices == "boolean" ? withVertices : true;760 var result = L2.GeometryUtil.closestLayer(map, layers, latlng);761 if (!result || result.distance > tolerance)762 return null;763 if (withVertices && typeof result.layer.getLatLngs == "function") {764 var closest = L2.GeometryUtil.closest(map, result.layer, result.latlng, true);765 if (closest.distance < tolerance) {766 result.latlng = closest;767 result.distance = L2.GeometryUtil.distance(map, closest, latlng);768 }769 }770 return result;771 },772 interpolateOnPointSegment: function(pA, pB, ratio) {773 return L2.point(pA.x * (1 - ratio) + ratio * pB.x, pA.y * (1 - ratio) + ratio * pB.y);774 },775 interpolateOnLine: function(map, latLngs, ratio) {776 latLngs = latLngs instanceof L2.Polyline ? latLngs.getLatLngs() : latLngs;777 var n = latLngs.length;778 if (n < 2) {779 return null;780 }781 ratio = Math.max(Math.min(ratio, 1), 0);782 if (ratio === 0) {783 return {784 latLng: latLngs[0] instanceof L2.LatLng ? latLngs[0] : L2.latLng(latLngs[0]),785 predecessor: -1786 };787 }788 if (ratio == 1) {789 return {790 latLng: latLngs[latLngs.length - 1] instanceof L2.LatLng ? latLngs[latLngs.length - 1] : L2.latLng(latLngs[latLngs.length - 1]),791 predecessor: latLngs.length - 2792 };793 }794 var maxzoom = map.getMaxZoom();795 if (maxzoom === Infinity)796 maxzoom = map.getZoom();797 var pts = [];798 var lineLength = 0;799 for (var i = 0; i < n; i++) {800 pts[i] = map.project(latLngs[i], maxzoom);801 if (i > 0)802 lineLength += pts[i - 1].distanceTo(pts[i]);803 }804 var ratioDist = lineLength * ratio;805 var cumulativeDistanceToA = 0, cumulativeDistanceToB = 0;806 for (var i = 0; cumulativeDistanceToB < ratioDist; i++) {807 var pointA = pts[i], pointB = pts[i + 1];808 cumulativeDistanceToA = cumulativeDistanceToB;809 cumulativeDistanceToB += pointA.distanceTo(pointB);810 }811 if (pointA == void 0 && pointB == void 0) {812 var pointA = pts[0], pointB = pts[1], i = 1;813 }814 var segmentRatio = cumulativeDistanceToB - cumulativeDistanceToA !== 0 ? (ratioDist - cumulativeDistanceToA) / (cumulativeDistanceToB - cumulativeDistanceToA) : 0;815 var interpolatedPoint = L2.GeometryUtil.interpolateOnPointSegment(pointA, pointB, segmentRatio);816 return {817 latLng: map.unproject(interpolatedPoint, maxzoom),818 predecessor: i - 1819 };820 },821 locateOnLine: function(map, polyline, latlng) {822 var latlngs = polyline.getLatLngs();823 if (latlng.equals(latlngs[0]))824 return 0;825 if (latlng.equals(latlngs[latlngs.length - 1]))826 return 1;827 var point = L2.GeometryUtil.closest(map, polyline, latlng, false), lengths = L2.GeometryUtil.accumulatedLengths(latlngs), total_length = lengths[lengths.length - 1], portion = 0, found = false;828 for (var i = 0, n = latlngs.length - 1; i < n; i++) {829 var l1 = latlngs[i], l2 = latlngs[i + 1];830 portion = lengths[i];831 if (L2.GeometryUtil.belongsSegment(point, l1, l2, 1e-3)) {832 portion += l1.distanceTo(point);833 found = true;834 break;835 }836 }837 if (!found) {838 throw "Could not interpolate " + latlng.toString() + " within " + polyline.toString();839 }840 return portion / total_length;841 },842 reverse: function(polyline) {843 return L2.polyline(polyline.getLatLngs().slice(0).reverse());844 },845 extract: function(map, polyline, start, end) {846 if (start > end) {847 return L2.GeometryUtil.extract(map, L2.GeometryUtil.reverse(polyline), 1 - start, 1 - end);848 }849 start = Math.max(Math.min(start, 1), 0);850 end = Math.max(Math.min(end, 1), 0);851 var latlngs = polyline.getLatLngs(), startpoint = L2.GeometryUtil.interpolateOnLine(map, polyline, start), endpoint = L2.GeometryUtil.interpolateOnLine(map, polyline, end);852 if (start == end) {853 var point = L2.GeometryUtil.interpolateOnLine(map, polyline, end);854 return [point.latLng];855 }856 if (startpoint.predecessor == -1)857 startpoint.predecessor = 0;858 if (endpoint.predecessor == -1)859 endpoint.predecessor = 0;860 var result = latlngs.slice(startpoint.predecessor + 1, endpoint.predecessor + 1);861 result.unshift(startpoint.latLng);862 result.push(endpoint.latLng);863 return result;864 },865 isBefore: function(polyline, other) {866 if (!other)867 return false;868 var lla = polyline.getLatLngs(), llb = other.getLatLngs();869 return lla[lla.length - 1].equals(llb[0]);870 },871 isAfter: function(polyline, other) {872 if (!other)873 return false;874 var lla = polyline.getLatLngs(), llb = other.getLatLngs();875 return lla[0].equals(llb[llb.length - 1]);876 },877 startsAtExtremity: function(polyline, other) {878 if (!other)879 return false;880 var lla = polyline.getLatLngs(), llb = other.getLatLngs(), start = lla[0];881 return start.equals(llb[0]) || start.equals(llb[llb.length - 1]);882 },883 computeAngle: function(a, b) {884 return Math.atan2(b.y - a.y, b.x - a.x) * 180 / Math.PI;885 },886 computeSlope: function(a, b) {887 var s = (b.y - a.y) / (b.x - a.x), o = a.y - s * a.x;888 return { "a": s, "b": o };889 },890 rotatePoint: function(map, latlngPoint, angleDeg, latlngCenter) {891 var maxzoom = map.getMaxZoom();892 if (maxzoom === Infinity)893 maxzoom = map.getZoom();894 var angleRad = angleDeg * Math.PI / 180, pPoint = map.project(latlngPoint, maxzoom), pCenter = map.project(latlngCenter, maxzoom), x2 = Math.cos(angleRad) * (pPoint.x - pCenter.x) - Math.sin(angleRad) * (pPoint.y - pCenter.y) + pCenter.x, y2 = Math.sin(angleRad) * (pPoint.x - pCenter.x) + Math.cos(angleRad) * (pPoint.y - pCenter.y) + pCenter.y;895 return map.unproject(new L2.Point(x2, y2), maxzoom);896 },897 bearing: function(latlng1, latlng2) {898 var rad = Math.PI / 180, lat1 = latlng1.lat * rad, lat2 = latlng2.lat * rad, lon1 = latlng1.lng * rad, lon2 = latlng2.lng * rad, y = Math.sin(lon2 - lon1) * Math.cos(lat2), x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);899 var bearing = (Math.atan2(y, x) * 180 / Math.PI + 360) % 360;900 return bearing >= 180 ? bearing - 360 : bearing;901 },902 destination: function(latlng, heading, distance) {903 heading = (heading + 360) % 360;904 var rad = Math.PI / 180, radInv = 180 / Math.PI, R = 6378137, lon1 = latlng.lng * rad, lat1 = latlng.lat * rad, rheading = heading * rad, sinLat1 = Math.sin(lat1), cosLat1 = Math.cos(lat1), cosDistR = Math.cos(distance / R), sinDistR = Math.sin(distance / R), lat2 = Math.asin(sinLat1 * cosDistR + cosLat1 * sinDistR * Math.cos(rheading)), lon2 = lon1 + Math.atan2(Math.sin(rheading) * sinDistR * cosLat1, cosDistR - sinLat1 * Math.sin(lat2));905 lon2 = lon2 * radInv;906 lon2 = lon2 > 180 ? lon2 - 360 : lon2 < -180 ? lon2 + 360 : lon2;907 return L2.latLng([lat2 * radInv, lon2]);908 },909 angle: function(map, latlngA, latlngB) {910 var pointA = map.latLngToContainerPoint(latlngA), pointB = map.latLngToContainerPoint(latlngB), angleDeg = Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI + 90;911 angleDeg += angleDeg < 0 ? 360 : 0;912 return angleDeg;913 },914 destinationOnSegment: function(map, latlngA, latlngB, distance) {915 var angleDeg = L2.GeometryUtil.angle(map, latlngA, latlngB), latlng = L2.GeometryUtil.destination(latlngA, angleDeg, distance);916 return L2.GeometryUtil.closestOnSegment(map, latlng, latlngA, latlngB);917 }918 });919 return L2.GeometryUtil;920 });921})(leaflet_geometryutil);922function modulus(i, n) {923 return (i % n + n) % n;924}925function definedProps(obj) {926 return Object.fromEntries(Object.entries(obj).filter(([k, v]) => v !== void 0));927}928function isInMeters(value) {929 return value.toString().trim().slice(value.toString().length - 1, value.toString().length) === "m";930}931function isInPercent(value) {932 return value.toString().trim().slice(value.toString().length - 1, value.toString().length) === "%";933}934function isInPixels(value) {935 return value.toString().trim().slice(value.toString().length - 2, value.toString().length) === "px";936}937function pixelsToMeters(pixels, map) {938 let refPoint1 = map.getCenter();939 let xy1 = map.latLngToLayerPoint(refPoint1);940 let xy2 = {941 x: xy1.x + Number(pixels),942 y: xy1.y943 };944 let refPoint2 = map.layerPointToLatLng(xy2);945 let derivedMeters = map.distance(refPoint1, refPoint2);946 return derivedMeters;947}948L.Polyline.include({949 arrowheads: function(options = {}) {950 const defaults = {951 yawn: 60,952 size: "15%",953 frequency: "allvertices",954 proportionalToTotal: false955 };956 this.options.noClip = true;957 let actualOptions = Object.assign({}, defaults, options);958 this._arrowheadOptions = actualOptions;959 this._hatsApplied = true;960 return this;961 },962 buildVectorHats: function(options) {963 if (this._arrowheads) {964 this._arrowheads.remove();965 }966 if (this._ghosts) {967 this._ghosts.remove();968 }969 let defaultOptionsOfParent = Object.getPrototypeOf(Object.getPrototypeOf(this.options));970 let parentOptions = Object.assign({}, defaultOptionsOfParent, this.options);971 let hatOptions = Object.assign({}, parentOptions, options);972 hatOptions.smoothFactor = 1;973 hatOptions.fillOpacity = 1;974 hatOptions.fill = options.fill ? true : false;975 hatOptions.interactive = false;976 let size = options.size.toString();977 let allhats = [];978 const { frequency, offsets } = options;979 if ((offsets == null ? void 0 : offsets.start) || (offsets == null ? void 0 : offsets.end)) {980 this._buildGhosts({ start: offsets.start, end: offsets.end });981 }982 const lineToTrace = this._ghosts || this;983 lineToTrace._parts.forEach((peice, index) => {984 var _b;985 const latlngs = peice.map((point) => this._map.layerPointToLatLng(point));986 const totalLength = (() => {987 let total = 0;988 for (var i2 = 0; i2 < peice.length - 1; i2++) {989 total += this._map.distance(latlngs[i2], latlngs[i2 + 1]);990 }991 return total;992 })();993 let derivedLatLngs;994 let derivedBearings;995 let spacing;996 let noOfPoints;997 if (!isNaN(frequency)) {998 spacing = 1 / frequency;999 noOfPoints = frequency;1000 } else if (isInPercent(frequency)) {1001 console.error("Error: arrowhead frequency option cannot be given in percent. Try another unit.");1002 } else if (isInMeters(frequency)) {1003 spacing = frequency.slice(0, frequency.length - 1) / totalLength;1004 noOfPoints = 1 / spacing;1005 noOfPoints = Math.floor(noOfPoints);1006 spacing = 1 / noOfPoints;1007 } else if (isInPixels(frequency)) {1008 spacing = (() => {1009 let chosenFrequency = frequency.slice(0, frequency.length - 2);1010 let derivedMeters = pixelsToMeters(chosenFrequency, this._map);1011 return derivedMeters / totalLength;1012 })();1013 noOfPoints = 1 / spacing;1014 noOfPoints = Math.floor(noOfPoints);1015 spacing = 1 / noOfPoints;1016 }1017 if (options.frequency === "allvertices") {1018 derivedBearings = (() => {1019 let bearings = [];1020 for (var i2 = 1; i2 < latlngs.length; i2++) {1021 let bearing = L.GeometryUtil.angle(this._map, latlngs[modulus(i2 - 1, latlngs.length)], latlngs[i2]) + 180;1022 bearings.push(bearing);1023 }1024 return bearings;1025 })();1026 derivedLatLngs = latlngs;1027 derivedLatLngs.shift();1028 } else if (options.frequency === "endonly" && latlngs.length >= 2) {1029 derivedLatLngs = [latlngs[latlngs.length - 1]];1030 derivedBearings = [1031 L.GeometryUtil.angle(this._map, latlngs[latlngs.length - 2], latlngs[latlngs.length - 1]) + 1801032 ];1033 } else {1034 derivedLatLngs = [];1035 let interpolatedPoints = [];1036 for (var i = 0; i < noOfPoints; i++) {1037 let interpolatedPoint = L.GeometryUtil.interpolateOnLine(this._map, latlngs, spacing * (i + 1));1038 if (interpolatedPoint) {1039 interpolatedPoints.push(interpolatedPoint);1040 derivedLatLngs.push(interpolatedPoint.latLng);1041 }1042 }1043 derivedBearings = (() => {1044 let bearings = [];1045 for (var i2 = 0; i2 < interpolatedPoints.length; i2++) {1046 let bearing = L.GeometryUtil.angle(this._map, latlngs[interpolatedPoints[i2].predecessor + 1], latlngs[interpolatedPoints[i2].predecessor]);1047 bearings.push(bearing);1048 }1049 return bearings;1050 })();1051 }1052 let hats = [];1053 const pushHats = (size2, localHatOptions = {}) => {1054 var _a2;1055 let yawn = (_a2 = localHatOptions.yawn) != null ? _a2 : options.yawn;1056 let leftWingPoint = L.GeometryUtil.destination(derivedLatLngs[i], derivedBearings[i] - yawn / 2, size2);1057 let rightWingPoint = L.GeometryUtil.destination(derivedLatLngs[i], derivedBearings[i] + yawn / 2, size2);1058 let hatPoints = [1059 [leftWingPoint.lat, leftWingPoint.lng],1060 [derivedLatLngs[i].lat, derivedLatLngs[i].lng],1061 [rightWingPoint.lat, rightWingPoint.lng]1062 ];1063 let hat = options.fill ? L.polygon(hatPoints, __spreadValues(__spreadValues({}, hatOptions), localHatOptions)) : L.polyline(hatPoints, __spreadValues(__spreadValues({}, hatOptions), localHatOptions));1064 hats.push(hat);1065 };1066 const pushHatsFromPixels = (size2, localHatOptions = {}) => {1067 var _a2;1068 let sizePixels = size2.slice(0, size2.length - 2);1069 let yawn = (_a2 = localHatOptions.yawn) != null ? _a2 : options.yawn;1070 let derivedXY = this._map.latLngToLayerPoint(derivedLatLngs[i]);1071 let bearing = derivedBearings[i];1072 let thetaLeft = (180 - bearing - yawn / 2) * (Math.PI / 180), thetaRight = (180 - bearing + yawn / 2) * (Math.PI / 180);1073 let dxLeft = sizePixels * Math.sin(thetaLeft), dyLeft = sizePixels * Math.cos(thetaLeft), dxRight = sizePixels * Math.sin(thetaRight), dyRight = sizePixels * Math.cos(thetaRight);1074 let leftWingXY = {1075 x: derivedXY.x + dxLeft,1076 y: derivedXY.y + dyLeft1077 };1078 let rightWingXY = {1079 x: derivedXY.x + dxRight,1080 y: derivedXY.y + dyRight1081 };1082 let leftWingPoint = this._map.layerPointToLatLng(leftWingXY), rightWingPoint = this._map.layerPointToLatLng(rightWingXY);1083 let hatPoints = [1084 [leftWingPoint.lat, leftWingPoint.lng],1085 [derivedLatLngs[i].lat, derivedLatLngs[i].lng],1086 [rightWingPoint.lat, rightWingPoint.lng]1087 ];1088 let hat = options.fill ? L.polygon(hatPoints, __spreadValues(__spreadValues({}, hatOptions), localHatOptions)) : L.polyline(hatPoints, __spreadValues(__spreadValues({}, hatOptions), localHatOptions));1089 hats.push(hat);1090 };1091 for (var i = 0; i < derivedLatLngs.length; i++) {1092 let _a = options, { perArrowheadOptions } = _a, globalOptions = __objRest(_a, ["perArrowheadOptions"]);1093 perArrowheadOptions = perArrowheadOptions ? perArrowheadOptions(i) : {};1094 perArrowheadOptions = Object.assign(globalOptions, definedProps(perArrowheadOptions));1095 size = (_b = perArrowheadOptions.size) != null ? _b : size;1096 if (isInMeters(size)) {1097 let hatSize = size.slice(0, size.length - 1);1098 pushHats(hatSize, perArrowheadOptions);1099 } else if (isInPercent(size)) {1100 let sizePercent = size.slice(0, size.length - 1);1101 let hatSize = (() => {1102 if (options.frequency === "endonly" && options.proportionalToTotal) {1103 return totalLength * sizePercent / 100;1104 } else {1105 let averageDistance = totalLength / (peice.length - 1);1106 return averageDistance * sizePercent / 100;1107 }1108 })();1109 pushHats(hatSize, perArrowheadOptions);1110 } else if (isInPixels(size)) {1111 pushHatsFromPixels(options.size, perArrowheadOptions);1112 } else {1113 console.error("Error: Arrowhead size unit not defined. Check your arrowhead options.");1114 }1115 }1116 allhats.push(...hats);1117 });1118 let arrowheads = L.layerGroup(allhats);1119 this._arrowheads = arrowheads;1120 return this;1121 },1122 getArrowheads: function() {1123 if (this._arrowheads) {1124 return this._arrowheads;1125 } else {1126 return console.error(`Error: You tried to call '.getArrowheads() on a shape that does not have a arrowhead. Use '.arrowheads()' to add a arrowheads before trying to call '.getArrowheads()'`);1127 }1128 },1129 _buildGhosts: function({ start, end }) {1130 if (start || end) {1131 let latlngs = this.getLatLngs();1132 latlngs = Array.isArray(latlngs[0]) ? latlngs : [latlngs];1133 const newLatLngs = latlngs.map((segment) => {1134 const totalLength = (() => {1135 let total = 0;1136 for (var i = 0; i < segment.length - 1; i++) {1137 total += this._map.distance(segment[i], segment[i + 1]);1138 }1139 return total;1140 })();1141 if (start) {1142 let endOffsetInMeters = (() => {1143 if (isInMeters(start)) {1144 return Number(start.slice(0, start.length - 1));1145 } else if (isInPixels(start)) {1146 let pixels = Number(start.slice(0, start.length - 2));1147 return pixelsToMeters(pixels, this._map);1148 }1149 })();1150 let newStart = L.GeometryUtil.interpolateOnLine(this._map, segment, endOffsetInMeters / totalLength);1151 segment = segment.slice(newStart.predecessor === -1 ? 1 : newStart.predecessor + 1, segment.length);1152 segment.unshift(newStart.latLng);1153 }1154 if (end) {1155 let endOffsetInMeters = (() => {1156 if (isInMeters(end)) {1157 return Number(end.slice(0, end.length - 1));1158 } else if (isInPixels(end)) {1159 let pixels = Number(end.slice(0, end.length - 2));1160 return pixelsToMeters(pixels, this._map);1161 }1162 })();1163 let newEnd = L.GeometryUtil.interpolateOnLine(this._map, segment, (totalLength - endOffsetInMeters) / totalLength);1164 segment = segment.slice(0, newEnd.predecessor + 1);1165 segment.push(newEnd.latLng);1166 }1167 return segment;1168 });1169 this._ghosts = L.polyline(newLatLngs, __spreadProps(__spreadValues({}, this.options), {1170 color: "rgba(0,0,0,0)",1171 stroke: 0,1172 smoothFactor: 0,1173 interactive: false1174 }));1175 this._ghosts.addTo(this._map);1176 }1177 },1178 deleteArrowheads: function() {1179 if (this._arrowheads) {1180 this._arrowheads.remove();1181 delete this._arrowheads;1182 delete this._arrowheadOptions;1183 this._hatsApplied = false;1184 }1185 if (this._ghosts) {1186 this._ghosts.remove();1187 }1188 },1189 _update: function() {1190 if (!this._map) {1191 return;1192 }1193 this._clipPoints();1194 this._simplifyPoints();1195 this._updatePath();1196 if (this._hatsApplied) {1197 this.buildVectorHats(this._arrowheadOptions);1198 this._map.addLayer(this._arrowheads);1199 }1200 },1201 remove: function() {1202 if (this._arrowheads) {1203 this._arrowheads.remove();1204 }1205 if (this._ghosts) {1206 this._ghosts.remove();1207 }1208 return this.removeFrom(this._map || this._mapToAdd);1209 }1210});1211L.LayerGroup.include({1212 removeLayer: function(layer) {1213 var id = layer in this._layers ? layer : this.getLayerId(layer);1214 if (this._map && this._layers[id]) {1215 if (this._layers[id]._arrowheads) {1216 this._layers[id]._arrowheads.remove();1217 }1218 this._map.removeLayer(this._layers[id]);1219 }1220 delete this._layers[id];1221 return this;1222 },1223 onRemove: function(map, layer) {1224 for (var layer in this._layers) {1225 if (this._layers[layer]) {1226 this._layers[layer].remove();1227 }1228 }1229 this.eachLayer(map.removeLayer, map);1230 }1231});1232L.Map.include({1233 removeLayer: function(layer) {1234 var id = L.Util.stamp(layer);1235 if (layer._arrowheads) {1236 layer._arrowheads.remove();1237 }1238 if (layer._ghosts) {1239 layer._ghosts.remove();1240 }1241 if (!this._layers[id]) {1242 return this;1243 }1244 if (this._loaded) {1245 layer.onRemove(this);1246 }1247 if (layer.getAttribution && this.attributionControl) {1248 this.attributionControl.removeAttribution(layer.getAttribution());1249 }1250 delete this._layers[id];1251 if (this._loaded) {1252 this.fire("layerremove", { layer });1253 layer.fire("remove");1254 }1255 layer._map = layer._mapToAdd = null;1256 return this;1257 }1258});1259L.GeoJSON.include({1260 geometryToLayer: function(geojson, options) {1261 var geometry = geojson.type === "Feature" ? geojson.geometry : geojson, coords = geometry ? geometry.coordinates : null, layers = [], pointToLayer = options && options.pointToLayer, _coordsToLatLng = options && options.coordsToLatLng || L.GeoJSON.coordsToLatLng, latlng, latlngs, i, len;1262 if (!coords && !geometry) {1263 return null;1264 }1265 switch (geometry.type) {1266 case "Point":1267 latlng = _coordsToLatLng(coords);1268 return this._pointToLayer(pointToLayer, geojson, latlng, options);1269 case "MultiPoint":1270 for (i = 0, len = coords.length; i < len; i++) {1271 latlng = _coordsToLatLng(coords[i]);1272 layers.push(this._pointToLayer(pointToLayer, geojson, latlng, options));1273 }1274 return new L.FeatureGroup(layers);1275 case "LineString":1276 case "MultiLineString":1277 latlngs = L.GeoJSON.coordsToLatLngs(coords, geometry.type === "LineString" ? 0 : 1, _coordsToLatLng);1278 var polyline = new L.Polyline(latlngs, options);1279 if (options.arrowheads) {1280 polyline.arrowheads(options.arrowheads);1281 }1282 return polyline;1283 case "Polygon":1284 case "MultiPolygon":1285 latlngs = L.GeoJSON.coordsToLatLngs(coords, geometry.type === "Polygon" ? 1 : 2, _coordsToLatLng);1286 return new L.Polygon(latlngs, options);1287 case "GeometryCollection":1288 for (i = 0, len = geometry.geometries.length; i < len; i++) {1289 var layer = this.geometryToLayer({1290 geometry: geometry.geometries[i],1291 type: "Feature",1292 properties: geojson.properties1293 }, options);1294 if (layer) {1295 layers.push(layer);1296 }1297 }1298 return new L.FeatureGroup(layers);1299 default:1300 throw new Error("Invalid GeoJSON object.");1301 }1302 },1303 addData: function(geojson) {1304 var features = L.Util.isArray(geojson) ? geojson : geojson.features, i, len, feature;1305 if (features) {1306 for (i = 0, len = features.length; i < len; i++) {1307 feature = features[i];1308 if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {1309 this.addData(feature);1310 }1311 }1312 return this;1313 }1314 var options = this.options;1315 if (options.filter && !options.filter(geojson)) {1316 return this;1317 }1318 var layer = this.geometryToLayer(geojson, options);1319 if (!layer) {1320 return this;1321 }1322 layer.feature = L.GeoJSON.asFeature(geojson);1323 layer.defaultOptions = layer.options;1324 this.resetStyle(layer);1325 if (options.onEachFeature) {1326 options.onEachFeature(geojson, layer);1327 }1328 return this.addLayer(layer);1329 },1330 _pointToLayer: function(pointToLayerFn, geojson, latlng, options) {1331 return pointToLayerFn ? pointToLayerFn(geojson, latlng) : new L.Marker(latlng, options && options.markersInheritOptions && options);1332 }1333});1334var Polyline = renderless({1335 props: __spreadValues({1336 positions: {1337 type: Array,1338 required: true1339 },1340 arrows: {1341 type: Object,1342 default: void 01343 }1344 }, PathProps),1345 setup(props) {1346 const {1347 positions,1348 color,1349 weight,1350 opacity,1351 fillColor1352 } = toRefs(props);1353 const stroke = computed(() => props.color != null);1354 const fill = computed(() => props.fillColor != null);1355 const options = reactive({1356 stroke,1357 color,1358 weight,1359 opacity,1360 fill,1361 fillColor1362 });1363 const map = ref(inject("map"));1364 const polyline = L$1.polyline(props.positions, clean(options));1365 if (props.arrows) {1366 polyline.arrowheads(props.arrows);1367 }1368 provide("layer", polyline);1369 whenever(map, (map2) => map2.addLayer(polyline), { immediate: true });1370 whenever(options, (options2) => L$1.setOptions(polyline, clean(options2), { deep: true, immediate: true }));1371 whenever(positions, (positions2) => polyline.setLatLngs(positions2));1372 onUnmounted(() => polyline.remove());1373 }1374});1375var Polygon = renderless({1376 props: __spreadValues({1377 positions: {1378 type: Array,1379 required: true1380 }1381 }, PathProps),1382 setup(props) {1383 const {1384 positions,1385 color,1386 weight,1387 opacity,1388 fillColor1389 } = toRefs(props);1390 const stroke = computed(() => props.color != null);1391 const fill = computed(() => props.fillColor != null);1392 const options = reactive({1393 stroke,1394 color,1395 weight,1396 opacity,1397 fill,1398 fillColor1399 });1400 const map = ref(inject("map"));1401 const polygon = L$1.polygon(props.positions, clean(options));1402 provide("layer", polygon);1403 whenever(map, (map2) => map2.addLayer(polygon), { immediate: true });1404 whenever(options, (options2) => L$1.setOptions(polygon, clean(options2), { deep: true, immediate: true }));1405 whenever(positions, (positions2) => polygon.setLatLngs(positions2));1406 onUnmounted(() => polygon.remove());1407 }1408});1409var ZoomControl = renderless({1410 props: {1411 position: {1412 type: String,1413 default: void 01414 },1415 zoomInTitle: {1416 type: String,1417 default: void 01418 },1419 zoomOutTitle: {1420 type: String,1421 default: void 01422 }1423 },1424 setup(props) {1425 const map = ref(inject("map"));1426 const control = new Control.Zoom(clean(__spreadValues({}, props)));1427 const mount = (map2) => {1428 var _a;1429 (_a = map2 == null ? void 0 : map2.zoomControl) == null ? void 0 : _a.remove();1430 map2.addControl(control);1431 };1432 whenever(map, mount, { immediate: true });1433 }1434});1435var ScaleControl = renderless({1436 props: {1437 position: {1438 type: String,1439 default: void 01440 },1441 maxWidth: {1442 type: Number,1443 default: void 01444 },1445 imperial: {1446 type: Boolean,1447 default: void 01448 },1449 metric: {1450 type: Boolean,1451 default: void 01452 }1453 },1454 setup(props) {1455 const map = ref(inject("map"));1456 const control = L$1.control.scale(clean(__spreadValues({}, props)));1457 whenever(map, (map2) => map2.addControl(control), { immediate: true });1458 }1459});1460var L_Control_Locate = { exports: {} };1461/*!1462Copyright (c) 2016 Dominik Moritz1463This file is part of the leaflet locate control. It is licensed under the MIT license.1464You can find the project at: https://github.com/domoritz/leaflet-locatecontrol1465*/1466(function(module, exports) {1467 (function(factory, window2) {1468 {1469 if (typeof window2 !== "undefined" && window2.L) {1470 module.exports = factory(L);1471 } else {1472 module.exports = factory(L$1);1473 }1474 }1475 if (typeof window2 !== "undefined" && window2.L) {1476 window2.L.Control.Locate = factory(L);1477 }1478 })(function(L2) {1479 const LDomUtilApplyClassesMethod = (method, element, classNames) => {1480 classNames = classNames.split(" ");1481 classNames.forEach(function(className) {1482 L2.DomUtil[method].call(this, element, className);1483 });1484 };1485 const addClasses = (el, names) => LDomUtilApplyClassesMethod("addClass", el, names);1486 const removeClasses = (el, names) => LDomUtilApplyClassesMethod("removeClass", el, names);1487 const LocationMarker = L2.Marker.extend({1488 initialize(latlng, options) {1489 L2.Util.setOptions(this, options);1490 this._latlng = latlng;1491 this.createIcon();1492 },1493 createIcon() {1494 const opt = this.options;1495 let style = "";1496 if (opt.color !== void 0) {1497 style += `stroke:${opt.color};`;1498 }1499 if (opt.weight !== void 0) {1500 style += `stroke-width:${opt.weight};`;1501 }1502 if (opt.fillColor !== void 0) {1503 style += `fill:${opt.fillColor};`;1504 }1505 if (opt.fillOpacity !== void 0) {1506 style += `fill-opacity:${opt.fillOpacity};`;1507 }1508 if (opt.opacity !== void 0) {1509 style += `opacity:${opt.opacity};`;1510 }1511 const icon = this._getIconSVG(opt, style);1512 this._locationIcon = L2.divIcon({1513 className: icon.className,1514 html: icon.svg,1515 iconSize: [icon.w, icon.h]1516 });1517 this.setIcon(this._locationIcon);1518 },1519 _getIconSVG(options, style) {1520 const r = options.radius;1521 const w = options.weight;1522 const s = r + w;1523 const s2 = s * 2;1524 const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${s2}" height="${s2}" version="1.1" viewBox="-${s} -${s} ${s2} ${s2}"><circle r="` + r + '" style="' + style + '" /></svg>';1525 return {1526 className: "leaflet-control-locate-location",1527 svg,1528 w: s2,1529 h: s21530 };1531 },1532 setStyle(style) {1533 L2.Util.setOptions(this, style);1534 this.createIcon();1535 }1536 });1537 const CompassMarker = LocationMarker.extend({1538 initialize(latlng, heading, options) {1539 L2.Util.setOptions(this, options);1540 this._latlng = latlng;1541 this._heading = heading;1542 this.createIcon();1543 },1544 setHeading(heading) {1545 this._heading = heading;1546 },1547 _getIconSVG(options, style) {1548 const r = options.radius;1549 const w = options.width + options.weight;1550 const h = (r + options.depth + options.weight) * 2;1551 const path = `M0,0 l${options.width / 2},${options.depth} l-${w},0 z`;1552 const svgstyle = `transform: rotate(${this._heading}deg)`;1553 const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" version="1.1" viewBox="-${w / 2} 0 ${w} ${h}" style="${svgstyle}"><path d="` + path + '" style="' + style + '" /></svg>';1554 return {1555 className: "leaflet-control-locate-heading",1556 svg,1557 w,1558 h1559 };1560 }1561 });1562 const LocateControl2 = L2.Control.extend({1563 options: {1564 position: "topleft",1565 layer: void 0,1566 setView: "untilPanOrZoom",1567 keepCurrentZoomLevel: false,1568 initialZoomLevel: false,1569 getLocationBounds(locationEvent) {1570 return locationEvent.bounds;1571 },1572 flyTo: false,1573 clickBehavior: {1574 inView: "stop",1575 outOfView: "setView",1576 inViewNotFollowing: "inView"1577 },1578 returnToPrevBounds: false,1579 cacheLocation: true,1580 drawCircle: true,1581 drawMarker: true,1582 showCompass: true,1583 markerClass: LocationMarker,1584 compassClass: CompassMarker,1585 circleStyle: {1586 className: "leaflet-control-locate-circle",1587 color: "#136AEC",1588 fillColor: "#136AEC",1589 fillOpacity: 0.15,1590 weight: 01591 },1592 markerStyle: {1593 className: "leaflet-control-locate-marker",1594 color: "#fff",1595 fillColor: "#2A93EE",1596 fillOpacity: 1,1597 weight: 3,1598 opacity: 1,1599 radius: 91600 },1601 compassStyle: {1602 fillColor: "#2A93EE",1603 fillOpacity: 1,1604 weight: 0,1605 color: "#fff",1606 opacity: 1,1607 radius: 9,1608 width: 9,1609 depth: 61610 },1611 followCircleStyle: {},1612 followMarkerStyle: {},1613 followCompassStyle: {},1614 icon: "leaflet-control-locate-location-arrow",1615 iconLoading: "leaflet-control-locate-spinner",1616 iconElementTag: "span",1617 textElementTag: "small",1618 circlePadding: [0, 0],1619 metric: true,1620 createButtonCallback(container, options) {1621 const link = L2.DomUtil.create("a", "leaflet-bar-part leaflet-bar-part-single", container);1622 link.title = options.strings.title;1623 link.href = "#";1624 link.setAttribute("role", "button");1625 const icon = L2.DomUtil.create(options.iconElementTag, options.icon, link);1626 if (options.strings.text !== void 0) {1627 const text = L2.DomUtil.create(options.textElementTag, "leaflet-locate-text", link);1628 text.textContent = options.strings.text;1629 link.classList.add("leaflet-locate-text-active");1630 link.parentNode.style.display = "flex";1631 if (options.icon.length > 0) {1632 icon.classList.add("leaflet-locate-icon");1633 }1634 }1635 return { link, icon };1636 },1637 onLocationError(err, control) {1638 alert(err.message);1639 },1640 onLocationOutsideMapBounds(control) {1641 control.stop();1642 alert(control.options.strings.outsideMapBoundsMsg);1643 },1644 showPopup: true,1645 strings: {1646 title: "Show me where I am",1647 metersUnit: "meters",1648 feetUnit: "feet",1649 popup: "You are within {distance} {unit} from this point",1650 outsideMapBoundsMsg: "You seem located outside the boundaries of the map"1651 },1652 locateOptions: {1653 maxZoom: Infinity,1654 watch: true,1655 setView: false1656 }1657 },1658 initialize(options) {1659 for (const i in options) {1660 if (typeof this.options[i] === "object") {1661 L2.extend(this.options[i], options[i]);1662 } else {1663 this.options[i] = options[i];1664 }1665 }1666 this.options.followMarkerStyle = L2.extend({}, this.options.markerStyle, this.options.followMarkerStyle);1667 this.options.followCircleStyle = L2.extend({}, this.options.circleStyle, this.options.followCircleStyle);1668 this.options.followCompassStyle = L2.extend({}, this.options.compassStyle, this.options.followCompassStyle);1669 },1670 onAdd(map) {1671 const container = L2.DomUtil.create("div", "leaflet-control-locate leaflet-bar leaflet-control");1672 this._container = container;1673 this._map = map;1674 this._layer = this.options.layer || new L2.LayerGroup();1675 this._layer.addTo(map);1676 this._event = void 0;1677 this._compassHeading = null;1678 this._prevBounds = null;1679 const linkAndIcon = this.options.createButtonCallback(container, this.options);1680 this._link = linkAndIcon.link;1681 this._icon = linkAndIcon.icon;1682 L2.DomEvent.on(this._link, "click", function(ev) {1683 L2.DomEvent.stopPropagation(ev);1684 L2.DomEvent.preventDefault(ev);1685 this._onClick();1686 }, this).on(this._link, "dblclick", L2.DomEvent.stopPropagation);1687 this._resetVariables();1688 this._map.on("unload", this._unload, this);1689 return container;1690 },1691 _onClick() {1692 this._justClicked = true;1693 const wasFollowing = this._isFollowing();1694 this._userPanned = false;1695 this._userZoomed = false;1696 if (this._active && !this._event) {1697 this.stop();1698 } else if (this._active) {1699 const behaviors = this.options.clickBehavior;1700 let behavior = behaviors.outOfView;1701 if (this._map.getBounds().contains(this._event.latlng)) {1702 behavior = wasFollowing ? behaviors.inView : behaviors.inViewNotFollowing;1703 }1704 if (behaviors[behavior]) {1705 behavior = behaviors[behavior];1706 }1707 switch (behavior) {1708 case "setView":1709 this.setView();1710 break;1711 case "stop":1712 this.stop();1713 if (this.options.returnToPrevBounds) {1714 const f = this.options.flyTo ? this._map.flyToBounds : this._map.fitBounds;1715 f.bind(this._map)(this._prevBounds);1716 }1717 break;1718 }1719 } else {1720 if (this.options.returnToPrevBounds) {1721 this._prevBounds = this._map.getBounds();1722 }1723 this.start();1724 }1725 this._updateContainerStyle();1726 },1727 start() {1728 this._activate();1729 if (this._event) {1730 this._drawMarker(this._map);1731 if (this.options.setView) {1732 this.setView();1733 }1734 }1735 this._updateContainerStyle();1736 },1737 stop() {1738 this._deactivate();1739 this._cleanClasses();1740 this._resetVariables();1741 this._removeMarker();1742 },1743 stopFollowing() {1744 this._userPanned = true;1745 this._updateContainerStyle();1746 this._drawMarker();1747 },1748 _activate() {1749 if (!this._active) {1750 this._map.locate(this.options.locateOptions);1751 this._map.fire("locateactivate", this);1752 this._active = true;1753 this._map.on("locationfound", this._onLocationFound, this);1754 this._map.on("locationerror", this._onLocationError, this);1755 this._map.on("dragstart", this._onDrag, this);1756 this._map.on("zoomstart", this._onZoom, this);1757 this._map.on("zoomend", this._onZoomEnd, this);1758 if (this.options.showCompass) {1759 const oriAbs = "ondeviceorientationabsolute" in window;1760 if (oriAbs || "ondeviceorientation" in window) {1761 const _this = this;1762 const deviceorientation = function() {1763 L2.DomEvent.on(window, oriAbs ? "deviceorientationabsolute" : "deviceorientation", _this._onDeviceOrientation, _this);1764 };1765 if (DeviceOrientationEvent && typeof DeviceOrientationEvent.requestPermission === "function") {1766 DeviceOrientationEvent.requestPermission().then(function(permissionState) {1767 if (permissionState === "granted") {1768 deviceorientation();1769 }1770 });1771 } else {1772 deviceorientation();1773 }1774 }1775 }1776 }1777 },1778 _deactivate() {1779 this._map.stopLocate();1780 this._map.fire("locatedeactivate", this);1781 this._active = false;1782 if (!this.options.cacheLocation) {1783 this._event = void 0;1784 }1785 this._map.off("locationfound", this._onLocationFound, this);1786 this._map.off("locationerror", this._onLocationError, this);1787 this._map.off("dragstart", this._onDrag, this);1788 this._map.off("zoomstart", this._onZoom, this);1789 this._map.off("zoomend", this._onZoomEnd, this);1790 if (this.options.showCompass) {1791 this._compassHeading = null;1792 if ("ondeviceorientationabsolute" in window) {1793 L2.DomEvent.off(window, "deviceorientationabsolute", this._onDeviceOrientation, this);1794 } else if ("ondeviceorientation" in window) {1795 L2.DomEvent.off(window, "deviceorientation", this._onDeviceOrientation, this);1796 }1797 }1798 },1799 setView() {1800 this._drawMarker();1801 if (this._isOutsideMapBounds()) {1802 this._event = void 0;1803 this.options.onLocationOutsideMapBounds(this);1804 } else {1805 if (this._justClicked && this.options.initialZoomLevel !== false) {1806 var f = this.options.flyTo ? this._map.flyTo : this._map.setView;1807 f.bind(this._map)([this._event.latitude, this._event.longitude], this.options.initialZoomLevel);1808 } else if (this.options.keepCurrentZoomLevel) {1809 var f = this.options.flyTo ? this._map.flyTo : this._map.panTo;1810 f.bind(this._map)([this._event.latitude, this._event.longitude]);1811 } else {1812 var f = this.options.flyTo ? this._map.flyToBounds : this._map.fitBounds;1813 this._ignoreEvent = true;1814 f.bind(this._map)(this.options.getLocationBounds(this._event), {1815 padding: this.options.circlePadding,1816 maxZoom: this.options.initialZoomLevel || this.options.locateOptions.maxZoom1817 });1818 L2.Util.requestAnimFrame(function() {1819 this._ignoreEvent = false;1820 }, this);1821 }1822 }1823 },1824 _drawCompass() {1825 if (!this._event) {1826 return;1827 }1828 const latlng = this._event.latlng;1829 if (this.options.showCompass && latlng && this._compassHeading !== null) {1830 const cStyle = this._isFollowing() ? this.options.followCompassStyle : this.options.compassStyle;1831 if (!this._compass) {1832 this._compass = new this.options.compassClass(latlng, this._compassHeading, cStyle).addTo(this._layer);1833 } else {1834 this._compass.setLatLng(latlng);1835 this._compass.setHeading(this._compassHeading);1836 if (this._compass.setStyle) {1837 this._compass.setStyle(cStyle);1838 }1839 }1840 }1841 if (this._compass && (!this.options.showCompass || this._compassHeading === null)) {1842 this._compass.removeFrom(this._layer);1843 this._compass = null;1844 }1845 },1846 _drawMarker() {1847 if (this._event.accuracy === void 0) {1848 this._event.accuracy = 0;1849 }1850 const radius = this._event.accuracy;1851 const latlng = this._event.latlng;1852 if (this.options.drawCircle) {1853 const style = this._isFollowing() ? this.options.followCircleStyle : this.options.circleStyle;1854 if (!this._circle) {1855 this._circle = L2.circle(latlng, radius, style).addTo(this._layer);1856 } else {1857 this._circle.setLatLng(latlng).setRadius(radius).setStyle(style);1858 }1859 }1860 let distance;1861 let unit;1862 if (this.options.metric) {1863 distance = radius.toFixed(0);1864 unit = this.options.strings.metersUnit;1865 } else {1866 distance = (radius * 3.2808399).toFixed(0);1867 unit = this.options.strings.feetUnit;1868 }1869 if (this.options.drawMarker) {1870 const mStyle = this._isFollowing() ? this.options.followMarkerStyle : this.options.markerStyle;1871 if (!this._marker) {1872 this._marker = new this.options.markerClass(latlng, mStyle).addTo(this._layer);1873 } else {1874 this._marker.setLatLng(latlng);1875 if (this._marker.setStyle) {1876 this._marker.setStyle(mStyle);1877 }1878 }1879 }1880 this._drawCompass();1881 const t = this.options.strings.popup;1882 function getPopupText() {1883 if (typeof t === "string") {1884 return L2.Util.template(t, { distance, unit });1885 } else if (typeof t === "function") {1886 return t({ distance, unit });1887 } else {1888 return t;1889 }1890 }1891 if (this.options.showPopup && t && this._marker) {1892 this._marker.bindPopup(getPopupText())._popup.setLatLng(latlng);1893 }1894 if (this.options.showPopup && t && this._compass) {1895 this._compass.bindPopup(getPopupText())._popup.setLatLng(latlng);1896 }1897 },1898 _removeMarker() {1899 this._layer.clearLayers();1900 this._marker = void 0;1901 this._circle = void 0;1902 },1903 _unload() {1904 this.stop();1905 this._map.off("unload", this._unload, this);1906 },1907 _setCompassHeading(angle) {1908 if (!isNaN(parseFloat(angle)) && isFinite(angle)) {1909 angle = Math.round(angle);1910 this._compassHeading = angle;1911 L2.Util.requestAnimFrame(this._drawCompass, this);1912 } else {1913 this._compassHeading = null;1914 }1915 },1916 _onCompassNeedsCalibration() {1917 this._setCompassHeading();1918 },1919 _onDeviceOrientation(e) {1920 if (!this._active) {1921 return;1922 }1923 if (e.webkitCompassHeading) {1924 this._setCompassHeading(e.webkitCompassHeading);1925 } else if (e.absolute && e.alpha) {1926 this._setCompassHeading(360 - e.alpha);1927 }1928 },1929 _onLocationError(err) {1930 if (err.code == 3 && this.options.locateOptions.watch) {1931 return;1932 }1933 this.stop();1934 this.options.onLocationError(err, this);1935 },1936 _onLocationFound(e) {1937 if (this._event && (this._event.latlng.lat === e.latlng.lat && this._event.latlng.lng === e.latlng.lng && this._event.accuracy === e.accuracy)) {1938 return;1939 }1940 if (!this._active) {1941 return;1942 }1943 this._event = e;1944 this._drawMarker();1945 this._updateContainerStyle();1946 switch (this.options.setView) {1947 case "once":1948 if (this._justClicked) {1949 this.setView();1950 }1951 break;1952 case "untilPan":1953 if (!this._userPanned) {1954 this.setView();1955 }1956 break;1957 case "untilPanOrZoom":1958 if (!this._userPanned && !this._userZoomed) {1959 this.setView();1960 }1961 break;1962 case "always":1963 this.setView();1964 break;1965 }1966 this._justClicked = false;1967 },1968 _onDrag() {1969 if (this._event && !this._ignoreEvent) {1970 this._userPanned = true;1971 this._updateContainerStyle();1972 this._drawMarker();1973 }1974 },1975 _onZoom() {1976 if (this._event && !this._ignoreEvent) {1977 this._userZoomed = true;1978 this._updateContainerStyle();1979 this._drawMarker();1980 }1981 },1982 _onZoomEnd() {1983 if (this._event) {1984 this._drawCompass();1985 }1986 if (this._event && !this._ignoreEvent) {1987 if (this._marker && !this._map.getBounds().pad(-0.3).contains(this._marker.getLatLng())) {1988 this._userPanned = true;1989 this._updateContainerStyle();1990 this._drawMarker();1991 }1992 }1993 },1994 _isFollowing() {1995 if (!this._active) {1996 return false;1997 }1998 if (this.options.setView === "always") {1999 return true;2000 } else if (this.options.setView === "untilPan") {2001 return !this._userPanned;2002 } else if (this.options.setView === "untilPanOrZoom") {2003 return !this._userPanned && !this._userZoomed;2004 }2005 },2006 _isOutsideMapBounds() {2007 if (this._event === void 0) {2008 return false;2009 }2010 return this._map.options.maxBounds && !this._map.options.maxBounds.contains(this._event.latlng);2011 },2012 _updateContainerStyle() {2013 if (!this._container) {2014 return;2015 }2016 if (this._active && !this._event) {2017 this._setClasses("requesting");2018 } else if (this._isFollowing()) {2019 this._setClasses("following");2020 } else if (this._active) {2021 this._setClasses("active");2022 } else {2023 this._cleanClasses();2024 }2025 },2026 _setClasses(state) {2027 if (state == "requesting") {2028 removeClasses(this._container, "active following");2029 addClasses(this._container, "requesting");2030 removeClasses(this._icon, this.options.icon);2031 addClasses(this._icon, this.options.iconLoading);2032 } else if (state == "active") {2033 removeClasses(this._container, "requesting following");2034 addClasses(this._container, "active");2035 removeClasses(this._icon, this.options.iconLoading);2036 addClasses(this._icon, this.options.icon);2037 } else if (state == "following") {2038 removeClasses(this._container, "requesting");2039 addClasses(this._container, "active following");2040 removeClasses(this._icon, this.options.iconLoading);2041 addClasses(this._icon, this.options.icon);2042 }2043 },2044 _cleanClasses() {2045 L2.DomUtil.removeClass(this._container, "requesting");2046 L2.DomUtil.removeClass(this._container, "active");2047 L2.DomUtil.removeClass(this._container, "following");2048 removeClasses(this._icon, this.options.iconLoading);2049 addClasses(this._icon, this.options.icon);2050 },2051 _resetVariables() {2052 this._active = false;2053 this._justClicked = false;2054 this._userPanned = false;2055 this._userZoomed = false;2056 }2057 });2058 L2.control.locate = (options) => new L2.Control.Locate(options);2059 return LocateControl2;2060 }, window);2061})(L_Control_Locate);2062var LocateControl = renderless({2063 props: {2064 position: {2065 type: String,2066 default: void 02067 },2068 strings: {2069 type: Object,2070 default: void 02071 }2072 },2073 setup(props) {2074 const map = ref(inject("map"));2075 const control = L$1.control.locate(clean(__spreadValues({}, props)));2076 whenever(map, (map2) => map2.addControl(control), { immediate: true });2077 }2078});2079var PegmanControl = renderless({2080 emits: ["openstreetview", "closestreetview"],2081 props: {2082 apiKey: {2083 type: String,2084 default: void 02085 },2086 position: {2087 type: String,2088 default: "bottomright"2089 },2090 theme: {2091 type: String,2092 default: "leaflet-pegman-v3-small"2093 }2094 },2095 setup(props, { emit }) {2096 const map = ref(inject("map"));2097 const mount = async (map2) => {2098 if (props.apiKey) {2099 await loadGmapsApi(props.apiKey);2100 }2101 const control = new L$1.Control.Pegman({2102 position: props.position,2103 theme: props.theme2104 });2105 control.addTo(map2);2106 const observer = new MutationObserver((mutationList) => {2107 var _a, _b;2108 for (const mutation of mutationList) {2109 if (mutation.type === "childList") {2110 for (const node of mutation.addedNodes) {2111 if ((_a = node.classList) == null ? void 0 : _a.contains("pegman-marker")) {2112 emit("openstreetview");2113 }2114 }2115 for (const node of mutation.removedNodes) {2116 if ((_b = node.classList) == null ? void 0 : _b.contains("pegman-marker")) {2117 emit("closestreetview");2118 }2119 }2120 }2121 }2122 });2123 observer.observe(map2._container, { childList: true, subtree: true });2124 };2125 whenever(map, mount, { immediate: true });2126 }2127});...

Full Screen

Full Screen

incremental-differ.ts

Source:incremental-differ.ts Github

copy

Full Screen

1import path from 'path';2import { diff_match_patch as DiffMatchPatch } from 'diff-match-patch';3import chalk from 'chalk';4import { schema, Mutant, Position, Location, MutantStatus, StrykerOptions, FileDescriptions, MutateDescription } from '@stryker-mutator/api/core';5import { Logger } from '@stryker-mutator/api/logging';6import { TestResult, TestStatus } from '@stryker-mutator/api/test-runner';7import { I, normalizeFileName, normalizeLineEndings, notEmpty } from '@stryker-mutator/util';8import { TestDefinition } from 'mutation-testing-report-schema';9import { commonTokens } from '@stryker-mutator/api/plugin';10import { DiffChange, DiffStatisticsCollector } from './diff-statistics-collector.js';11import { TestCoverage } from './test-coverage.js';12/**13 * The 'diff match patch' high-performant 'diffing' of files.14 * @see https://github.com/google/diff-match-patch15 */16const diffMatchPatch = new DiffMatchPatch();17/**18 * This class is responsible for calculating the diff between a run and a previous run based on the incremental report.19 *20 * Since the ids of tests and mutants can differ across reports (they are only unique within 1 report), this class21 * identifies mutants and tests by attributes that make them unique:22 * - Mutant: file name, mutator name, location and replacement23 * - Test: test name, test file name (if present) and location (if present).24 *25 * We're storing these identifiers in local variables (maps and sets) as strings.26 * We should move to 'records' for these when they come available: https://github.com/tc39/proposal-record-tuple27 *28 * A mutant result from the previous run is reused if the following conditions were met:29 * - The location of the mutant refers to a piece of code that didn't change30 * - If mutant was killed:31 * - The culprit test wasn't changed32 * - If the mutant survived:33 * - No test was added34 *35 * It uses google's "diff-match-patch" project to calculate the new locations for tests and mutants, see link.36 * @link https://github.com/google/diff-match-patch37 */38export class IncrementalDiffer {39 public mutantStatisticsCollector: DiffStatisticsCollector | undefined;40 public testStatisticsCollector: DiffStatisticsCollector | undefined;41 private readonly mutateDescriptionByRelativeFileName: Map<string, MutateDescription>;42 public static inject = [commonTokens.logger, commonTokens.options, commonTokens.fileDescriptions] as const;43 constructor(private readonly logger: Logger, private readonly options: StrykerOptions, fileDescriptions: FileDescriptions) {44 this.mutateDescriptionByRelativeFileName = new Map(45 Object.entries(fileDescriptions).map(([name, description]) => [toRelativeNormalizedFileName(name), description.mutate])46 );47 }48 private isInMutatedScope(relativeFileName: string, mutant: schema.MutantResult): boolean {49 const mutate = this.mutateDescriptionByRelativeFileName.get(relativeFileName);50 return mutate === true || (Array.isArray(mutate) && mutate.some((range) => locationIncluded(range, mutant.location)));51 }52 public diff(53 currentMutants: readonly Mutant[],54 testCoverage: I<TestCoverage>,55 incrementalReport: schema.MutationTestResult,56 currentRelativeFiles: Map<string, string>57 ): readonly Mutant[] {58 const { files, testFiles } = incrementalReport;59 const mutantStatisticsCollector = new DiffStatisticsCollector();60 const testStatisticsCollector = new DiffStatisticsCollector();61 // Expose the collectors for unit testing purposes62 this.mutantStatisticsCollector = mutantStatisticsCollector;63 this.testStatisticsCollector = testStatisticsCollector;64 // Collect what we can reuse, while correcting for diff in the locations65 const reusableMutantsByKey = collectReusableMutantsByKey(this.logger);66 const { byId: oldTestsById, byKey: oldTestInfoByKey } = collectReusableTestInfo(this.logger);67 // Collect some helper maps and sets68 const { oldCoverageByMutantKey: oldCoverageTestKeysByMutantKey, oldKilledByMutantKey: oldKilledTestKeysByMutantKey } =69 collectOldKilledAndCoverageMatrix();70 const oldTestKeys = new Set([...oldTestsById.values()].map(({ key }) => key));71 const newTestKeys = new Set(72 [...testCoverage.testsById].map(([, test]) => testToIdentifyingKey(test, toRelativeNormalizedFileName(test.fileName)))73 );74 // Create a dictionary to more easily get test information75 const testInfoByKey = collectCurrentTestInfo();76 // Mark which tests are added77 for (const [key, { relativeFileName }] of testInfoByKey) {78 if (!oldTestKeys.has(key)) {79 testStatisticsCollector.count(relativeFileName, 'added');80 }81 }82 // Make sure that tests that didn't run this time around aren't forgotten83 for (const [84 testKey,85 {86 test: { name, location },87 relativeFileName,88 },89 ] of oldTestInfoByKey) {90 if (!testInfoByKey.has(testKey)) {91 const test: TestResult = {92 status: TestStatus.Success,93 id: testKey,94 name,95 startPosition: location?.start,96 timeSpentMs: 0,97 fileName: path.resolve(relativeFileName),98 };99 testInfoByKey.set(testKey, { test, relativeFileName: relativeFileName });100 testCoverage.addTest(test);101 }102 }103 // Done with preparations, time to map over the mutants104 let reusedMutantCount = 0;105 const currentMutantKeys = new Set<string>();106 const mutants = currentMutants.map((mutant) => {107 const relativeFileName = toRelativeNormalizedFileName(mutant.fileName);108 const mutantKey = mutantToIdentifyingKey(mutant, relativeFileName);109 currentMutantKeys.add(mutantKey);110 if (!mutant.status && !this.options.force) {111 const oldMutant = reusableMutantsByKey.get(mutantKey);112 if (oldMutant) {113 const coveringTests = testCoverage.forMutant(mutant.id);114 const killedByTestKeys = oldKilledTestKeysByMutantKey.get(mutantKey);115 if (mutantCanBeReused(mutant, oldMutant, mutantKey, coveringTests, killedByTestKeys)) {116 reusedMutantCount++;117 const { status, statusReason, testsCompleted } = oldMutant;118 return {119 ...mutant,120 status,121 statusReason,122 testsCompleted,123 coveredBy: [...(coveringTests ?? [])].map(({ id }) => id),124 killedBy: testKeysToId(killedByTestKeys),125 };126 }127 } else {128 mutantStatisticsCollector.count(relativeFileName, 'added');129 }130 }131 return mutant;132 });133 // Make sure that old mutants that didn't run this time around aren't forgotten134 for (const [mutantKey, oldResult] of reusableMutantsByKey) {135 // Do an additional check to see if the mutant is in mutated range.136 //137 // For example:138 // ```diff139 // - return a || b;140 // + return a && b;141 // ```142 // The conditional expression mutator here decides to _not_ mutate b to `false` the second time around. (even though the text of "b" itself didn't change)143 // Not doing this additional check would result in a sticky mutant that is never removed144 if (!currentMutantKeys.has(mutantKey) && !this.isInMutatedScope(oldResult.relativeFileName, oldResult)) {145 const coverage = oldCoverageTestKeysByMutantKey.get(mutantKey) ?? [];146 const killed = oldKilledTestKeysByMutantKey.get(mutantKey) ?? [];147 const coveredBy = testKeysToId(coverage);148 const killedBy = testKeysToId(killed);149 const reusedMutant = {150 ...oldResult,151 id: mutantKey,152 fileName: path.resolve(oldResult.relativeFileName),153 replacement: oldResult.replacement ?? oldResult.mutatorName,154 coveredBy,155 killedBy,156 };157 mutants.push(reusedMutant);158 testCoverage.addCoverage(reusedMutant.id, coveredBy);159 }160 }161 if (this.logger.isInfoEnabled()) {162 const testInfo = testCoverage.hasCoverage ? `\n\tTests:\t\t${testStatisticsCollector.createTotalsReport()}` : '';163 this.logger.info(164 `Incremental report:\n\tMutants:\t${mutantStatisticsCollector.createTotalsReport()}` +165 testInfo +166 `\n\tResult:\t\t${chalk.yellowBright(reusedMutantCount)} of ${currentMutants.length} mutant result(s) are reused.`167 );168 }169 if (this.logger.isDebugEnabled()) {170 const lineSeparator = '\n\t\t';171 const noChanges = 'No changes';172 const detailedMutantSummary = `${lineSeparator}${mutantStatisticsCollector.createDetailedReport().join(lineSeparator) || noChanges}`;173 const detailedTestsSummary = `${lineSeparator}${testStatisticsCollector.createDetailedReport().join(lineSeparator) || noChanges}`;174 this.logger.debug(`Detailed incremental report:\n\tMutants: ${detailedMutantSummary}\n\tTests: ${detailedTestsSummary}`);175 }176 return mutants;177 function testKeysToId(testKeys: Iterable<string> | undefined) {178 return [...(testKeys ?? [])]179 .map((id) => testInfoByKey.get(id))180 .filter(notEmpty)181 .map(({ test: { id } }) => id);182 }183 function collectReusableMutantsByKey(log: Logger) {184 return new Map(185 Object.entries(files).flatMap(([fileName, oldFile]) => {186 const relativeFileName = toRelativeNormalizedFileName(fileName);187 const currentFileSource = currentRelativeFiles.get(relativeFileName);188 if (currentFileSource) {189 log.trace('Diffing %s', relativeFileName);190 const { results, removeCount } = performFileDiff(oldFile.source, currentFileSource, oldFile.mutants);191 mutantStatisticsCollector.count(relativeFileName, 'removed', removeCount);192 return results.map((m) => [193 mutantToIdentifyingKey(m, relativeFileName),194 {195 ...m,196 relativeFileName,197 },198 ]);199 }200 mutantStatisticsCollector.count(relativeFileName, 'removed', oldFile.mutants.length);201 // File has since been deleted, these mutants are not reused202 return [];203 })204 );205 }206 function collectReusableTestInfo(log: Logger) {207 const byId = new Map<string, { relativeFileName: string; test: TestDefinition; key: string }>();208 const byKey = new Map<string, TestInfo>();209 Object.entries(testFiles ?? {}).forEach(([fileName, oldTestFile]) => {210 const relativeFileName = toRelativeNormalizedFileName(fileName);211 const currentFileSource = currentRelativeFiles.get(relativeFileName);212 if (currentFileSource !== undefined && oldTestFile.source !== undefined) {213 log.trace('Diffing %s', relativeFileName);214 const locatedTests = closeLocations(oldTestFile);215 const { results, removeCount } = performFileDiff(oldTestFile.source, currentFileSource, locatedTests);216 testStatisticsCollector.count(relativeFileName, 'removed', removeCount);217 results.forEach((test) => {218 const key = testToIdentifyingKey(test, relativeFileName);219 const testInfo = { key, test, relativeFileName };220 byId.set(test.id, testInfo);221 byKey.set(key, testInfo);222 });223 } else {224 // No sources to compare, we should do our best with the info we do have225 oldTestFile.tests.map((test) => {226 const key = testToIdentifyingKey(test, relativeFileName);227 const testInfo = { key, test, relativeFileName };228 byId.set(test.id, testInfo);229 byKey.set(key, testInfo);230 });231 }232 });233 return { byId, byKey };234 }235 function collectOldKilledAndCoverageMatrix() {236 const oldCoverageByMutantKey = new Map<string, Set<string>>();237 const oldKilledByMutantKey = new Map<string, Set<string>>();238 for (const [key, mutant] of reusableMutantsByKey) {239 const killedRow = new Set(mutant.killedBy?.map((testId) => oldTestsById.get(testId)?.key).filter(notEmpty));240 const coverageRow = new Set(mutant.coveredBy?.map((testId) => oldTestsById.get(testId)?.key).filter(notEmpty));241 killedRow.forEach((killed) => coverageRow.add(killed));242 oldCoverageByMutantKey.set(key, coverageRow);243 oldKilledByMutantKey.set(key, killedRow);244 }245 return { oldCoverageByMutantKey, oldKilledByMutantKey };246 }247 function collectCurrentTestInfo() {248 const byTestKey = new Map<string, { relativeFileName: string; test: TestResult }>();249 for (const testResult of testCoverage.testsById.values()) {250 const relativeFileName = toRelativeNormalizedFileName(testResult.fileName);251 const key = testToIdentifyingKey(testResult, relativeFileName);252 const info = { relativeFileName, test: testResult, key: key };253 byTestKey.set(key, info);254 }255 return byTestKey;256 }257 function mutantCanBeReused(258 mutant: Mutant,259 oldMutant: schema.MutantResult,260 mutantKey: string,261 coveringTests: ReadonlySet<TestResult> | undefined,262 oldKillingTests: Set<string> | undefined263 ): boolean {264 if (!testCoverage.hasCoverage) {265 // This is the best we can do when the test runner didn't report coverage.266 // We assume that all mutant test results can be reused,267 // End users can use --force to force retesting of certain mutants268 return true;269 }270 if (oldMutant.status === MutantStatus.Ignored) {271 // Was previously ignored, but not anymore, we need to run it now272 return false;273 }274 const testsDiff = diffTestCoverage(mutant.id, oldCoverageTestKeysByMutantKey.get(mutantKey), coveringTests);275 if (oldMutant.status === MutantStatus.Killed) {276 if (oldKillingTests) {277 for (const killingTest of oldKillingTests) {278 if (testsDiff.get(killingTest) === 'same') {279 return true;280 }281 }282 }283 // Killing tests has changed or no longer exists284 return false;285 }286 for (const action of testsDiff.values()) {287 if (action === 'added') {288 // A non-killed mutant got a new test, we need to run it289 return false;290 }291 }292 // A non-killed mutant did not get new tests, no need to rerun it293 return true;294 }295 /**296 * Determines if there is a diff between old test coverage and new test coverage.297 */298 function diffTestCoverage(299 mutantId: string,300 oldCoveringTestKeys: Set<string> | undefined,301 newCoveringTests: ReadonlySet<TestResult> | undefined302 ): Map<string, DiffAction> {303 const result = new Map<string, DiffAction>();304 if (newCoveringTests) {305 for (const newTest of newCoveringTests) {306 const key = testToIdentifyingKey(newTest, toRelativeNormalizedFileName(newTest.fileName));307 result.set(key, oldCoveringTestKeys?.has(key) ? 'same' : 'added');308 }309 }310 if (oldCoveringTestKeys) {311 const isStatic = testCoverage.hasStaticCoverage(mutantId);312 for (const oldTestKey of oldCoveringTestKeys) {313 if (!result.has(oldTestKey)) {314 // Static mutants might not have covering tests, but the test might still exist315 if (isStatic && newTestKeys.has(oldTestKey)) {316 result.set(oldTestKey, 'same');317 } else {318 result.set(oldTestKey, 'removed');319 }320 }321 }322 }323 return result;324 }325 }326}327/**328 * Finds the diff of mutants and tests. Removes mutants / tests that no longer exist (changed or removed). Updates locations of mutants or tests that do still exist.329 * @param oldCode The old code to use for the diff330 * @param newCode The new (current) code to use for the diff331 * @param items The mutants or tests to be looked . These will be treated as immutable.332 * @returns A list of items with updated locations, without items that are changed.333 */334function performFileDiff<T extends { location: Location }>(oldCode: string, newCode: string, items: T[]): { results: T[]; removeCount: number } {335 const oldSourceNormalized = normalizeLineEndings(oldCode);336 const currentSrcNormalized = normalizeLineEndings(newCode);337 const diffChanges = diffMatchPatch.diff_main(oldSourceNormalized, currentSrcNormalized);338 const toDo = new Set(items.map((m) => ({ ...m, location: deepClone(m.location) })));339 const [added, removed] = [1, -1];340 const done: T[] = [];341 const currentPosition: Position = { column: 0, line: 0 };342 let removeCount = 0;343 for (const [change, text] of diffChanges) {344 if (toDo.size === 0) {345 // There are more changes, but nothing left to update.346 break;347 }348 const offset = calculateOffset(text);349 if (change === added) {350 for (const test of toDo) {351 const { location } = test;352 if (gte(currentPosition, location.start) && gte(location.end, currentPosition)) {353 // This item cannot be reused, code was added here354 removeCount++;355 toDo.delete(test);356 } else {357 locationAdd(location, offset, currentPosition.line === location.start.line);358 }359 }360 positionMove(currentPosition, offset);361 } else if (change === removed) {362 for (const item of toDo) {363 const {364 location: { start },365 } = item;366 const endOffset = positionMove({ ...currentPosition }, offset);367 if (gte(endOffset, start)) {368 // This item cannot be reused, the code it covers has changed369 removeCount++;370 toDo.delete(item);371 } else {372 locationAdd(item.location, negate(offset), currentPosition.line === start.line);373 }374 }375 } else {376 positionMove(currentPosition, offset);377 toDo.forEach((item) => {378 const { end } = item.location;379 if (gte(currentPosition, end)) {380 // We're done with this item, it can be reused381 toDo.delete(item);382 done.push(item);383 }384 });385 }386 }387 done.push(...toDo);388 return { results: done, removeCount };389}390/**391 * A greater-than-equals implementation for positions392 */393function gte(a: Position, b: Position) {394 return a.line > b.line || (a.line === b.line && a.column >= b.column);395}396function locationIncluded(haystack: Location, needle: Location) {397 const startIncluded = gte(needle.start, haystack.start);398 const endIncluded = gte(haystack.end, needle.end);399 return startIncluded && endIncluded;400}401function deepClone(loc: Location): Location {402 return { start: { ...loc.start }, end: { ...loc.end } };403}404/**405 * Reduces a mutant to a string that identifies the mutant across reports.406 * Consists of the relative file name, mutator name, replacement, and location407 */408function mutantToIdentifyingKey(409 { mutatorName, replacement, location: { start, end } }: Pick<Mutant, 'location' | 'mutatorName'> & { replacement?: string },410 relativeFileName: string411) {412 return `${relativeFileName}@${start.line}:${start.column}-${end.line}:${end.column}\n${mutatorName}: ${replacement}`;413}414function testToIdentifyingKey(415 { name, location, startPosition }: Pick<schema.TestDefinition, 'location' | 'name'> & Pick<TestResult, 'startPosition'>,416 relativeFileName: string | undefined417) {418 startPosition = startPosition ?? location?.start ?? { line: 0, column: 0 };419 return `${relativeFileName}@${startPosition.line}:${startPosition.column}\n${name}`;420}421export function toRelativeNormalizedFileName(fileName: string | undefined): string {422 return normalizeFileName(path.relative(process.cwd(), fileName ?? ''));423}424function calculateOffset(text: string): Position {425 const pos: Position = { line: 0, column: 0 };426 for (const char of text) {427 if (char === '\n') {428 pos.line++;429 pos.column = 0;430 } else {431 pos.column++;432 }433 }434 return pos;435}436function positionMove(pos: Position, diff: Position): Position {437 pos.line += diff.line;438 if (diff.line === 0) {439 pos.column += diff.column;440 } else {441 pos.column = diff.column;442 }443 return pos;444}445function locationAdd({ start, end }: Location, { line, column }: Position, currentLine: boolean) {446 start.line += line;447 if (currentLine) {448 start.column += column;449 }450 end.line += line;451 if (line === 0 && currentLine) {452 end.column += column;453 }454}455function negate({ line, column }: Position): Position {456 return { line: -1 * line, column: -1 * column };457}458interface TestInfo {459 relativeFileName: string;460 test: TestDefinition;461 key: string;462}463type DiffAction = DiffChange | 'same';464/**465 * Sets the end position of each test to the start position of the next test.466 * This is an educated guess and necessary.467 * If a test has no location, it is assumed it spans the entire file (line 0 to Infinity)468 *469 * Knowing the end location of tests is necessary in order to know if the test was changed.470 */471function closeLocations(testFile: schema.TestFile): LocatedTest[] {472 const locatedTests: LocatedTest[] = [];473 const openEndedTests: OpenEndedTest[] = [];474 testFile.tests.forEach((test) => {475 if (testHasLocation(test)) {476 if (isClosed(test)) {477 locatedTests.push(test);478 } else {479 openEndedTests.push(test);480 }481 } else {482 locatedTests.push({ ...test, location: { start: { line: 0, column: 0 }, end: { line: Number.POSITIVE_INFINITY, column: 0 } } });483 }484 });485 if (openEndedTests.length) {486 // Sort the opened tests in order to close their locations487 openEndedTests.sort((a, b) => a.location.start.line - b.location.start.line);488 const startPositions = uniqueStartPositions(openEndedTests);489 let currentPositionIndex = 0;490 let currentPosition = startPositions[currentPositionIndex];491 openEndedTests.forEach((test) => {492 if (currentPosition && test.location.start.line === currentPosition.line && test.location.start.column === currentPosition.column) {493 currentPositionIndex++;494 currentPosition = startPositions[currentPositionIndex];495 }496 if (currentPosition) {497 locatedTests.push({ ...test, location: { start: test.location.start, end: currentPosition } });498 }499 });500 // Don't forget about the last test501 const lastTest = openEndedTests[openEndedTests.length - 1];502 locatedTests.push({ ...lastTest, location: { start: lastTest.location.start, end: { line: Number.POSITIVE_INFINITY, column: 0 } } });503 }504 return locatedTests;505}506/**507 * Determines the unique start positions of a sorted list of tests in order508 */509function uniqueStartPositions(sortedTests: OpenEndedTest[]) {510 let current: Position | undefined;511 const startPositions = sortedTests.reduce<Position[]>((collector, { location: { start } }) => {512 if (!current || current.line !== start.line || current.column !== start.column) {513 current = start;514 collector.push(current);515 }516 return collector;517 }, []);518 return startPositions;519}520function testHasLocation(test: schema.TestDefinition): test is OpenEndedTest {521 return !!test.location?.start;522}523function isClosed(test: Required<schema.TestDefinition>): test is LocatedTest {524 return !!test.location.end;525}526type LocatedTest = schema.TestDefinition & { location: Location };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var oldMutant = require('stryker-parent').oldMutant;2var newMutant = require('stryker-parent').newMutant;3var oldMutant = require('stryker').oldMutant;4var newMutant = require('stryker').newMutant;5var oldMutant = require('stryker').oldMutant;6var newMutant = require('stryker').newMutant;7var oldMutant = require('stryker').oldMutant;8var newMutant = require('stryker').newMutant;9var oldMutant = require('stryker').oldMutant;10var newMutant = require('stryker').newMutant;11var oldMutant = require('stryker').oldMutant;12var newMutant = require('stryker').newMutant;13var oldMutant = require('stryker').oldMutant;14var newMutant = require('stryker').newMutant;15var oldMutant = require('stryker').oldMutant;16var newMutant = require('stryker').newMutant;17var oldMutant = require('stryker').oldMutant;18var newMutant = require('stryker').newMutant;

Full Screen

Using AI Code Generation

copy

Full Screen

1const oldMutant = require('stryker-parent').oldMutant;2const newMutant = require('stryker-parent').newMutant;3const oldMutant = require('stryker-parent').oldMutant;4const newMutant = require('stryker-parent').newMutant;5const oldMutant = require('stryker-parent').oldMutant;6const newMutant = require('stryker-parent').newMutant;7const oldMutant = require('stryker-parent').oldMutant;8const newMutant = require('stryker-parent').newMutant;9const oldMutant = require('stryker-parent').oldMutant;10const newMutant = require('stryker-parent').newMutant;11const oldMutant = require('stryker-parent').oldMutant;12const newMutant = require('stryker-parent').newMutant;13const oldMutant = require('stryker-parent').oldMutant;14const newMutant = require('stryker-parent').newMutant;15const oldMutant = require('stryker-parent').oldMutant;16const newMutant = require('stryker-parent').newMutant;17const oldMutant = require('stryker-parent').oldMutant;

Full Screen

Using AI Code Generation

copy

Full Screen

1const oldMutant = require('stryker-parent/oldMutant');2const newMutant = require('stryker-parent/newMutant');3const oldMutantChild = require('stryker-child/oldMutant');4const newMutantChild = require('stryker-child/newMutant');5const oldMutantChild2 = require('stryker-child2/oldMutant');6const newMutantChild2 = require('stryker-child2/newMutant');7const oldMutantChild3 = require('stryker-child3/oldMutant');8const newMutantChild3 = require('stryker-child3/newMutant');9const oldMutantChild4 = require('stryker-child4/oldMutant');10const newMutantChild4 = require('stryker-child4/newMutant');11const oldMutantChild5 = require('stryker-child5/oldMutant');12const newMutantChild5 = require('stryker-child5/newMutant');13const oldMutantChild6 = require('stryker-child6/oldMutant');14const newMutantChild6 = require('stryker-child6/newMutant');15const oldMutantChild7 = require('stryker-child7/oldMutant');16const newMutantChild7 = require('stryker-child7/newMutant');

Full Screen

Using AI Code Generation

copy

Full Screen

1const oldMutant = require('stryker-parent').oldMutant;2module.exports = function (input) {3 return oldMutant(input);4};5module.exports = function(config) {6 config.set({7 commandRunner: {8 }9 });10};

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var oldMutant = stryker.Mutant;3var Mutant = function () {4 oldMutant.call(this);5};6Mutant.prototype = Object.create(oldMutant.prototype);7Mutant.prototype.constructor = Mutant;8module.exports = Mutant;9var stryker = require('stryker-parent');10var oldMutant = stryker.Mutant;11var Mutant = function () {12 oldMutant.call(this);13};14Mutant.prototype = Object.create(oldMutant.prototype);15Mutant.prototype.constructor = Mutant;16module.exports = Mutant;17var stryker = require('stryker-parent');18var oldMutant = stryker.Mutant;19var Mutant = function () {20 oldMutant.call(this);21};22Mutant.prototype = Object.create(oldMutant.prototype);23Mutant.prototype.constructor = Mutant;24module.exports = Mutant;25var stryker = require('stryker-parent');26var oldMutant = stryker.Mutant;27var Mutant = function () {28 oldMutant.call(this);29};30Mutant.prototype = Object.create(oldMutant.prototype);31Mutant.prototype.constructor = Mutant;32module.exports = Mutant;33var stryker = require('stryker-parent');34var oldMutant = stryker.Mutant;35var Mutant = function () {36 oldMutant.call(this);37};38Mutant.prototype = Object.create(oldMutant.prototype);39Mutant.prototype.constructor = Mutant;40module.exports = Mutant;41var stryker = require('stryker-parent');42var oldMutant = stryker.Mutant;43var Mutant = function () {44 oldMutant.call(this);45};46Mutant.prototype = Object.create(oldMutant.prototype);47Mutant.prototype.constructor = Mutant;48module.exports = Mutant;

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var oldMutant = stryker.Mutant;3stryker.Mutant = function (mutantId, fileName, mutatorName, range, replacement, mutator) {4 var self = this;5 self.id = mutantId;6 self.fileName = fileName;7 self.mutatorName = mutatorName;8 self.range = range;9 self.replacement = replacement;10 self.mutator = mutator;11 self.mutatedCode = function () {12 return self.mutator(self.replacement);13 };14};15module.exports = stryker;

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var oldMutant = stryker.Mutant.prototype;3module.exports = function () {4 return oldMutant;5};6var stryker = require('stryker-parent');7var newMutant = stryker.Mutant.prototype;8module.exports = function () {9 return newMutant;10};11var stryker = require('stryker-parent');12var oldMutant = stryker.Mutant.prototype;13module.exports = function () {14 return oldMutant;15};16var stryker = require('stryker-parent');17var newMutant = stryker.Mutant.prototype;18module.exports = function () {19 return newMutant;20};21var stryker = require('stryker-parent');22var oldMutant = stryker.Mutant.prototype;23module.exports = function () {24 return oldMutant;25};26var stryker = require('stryker-parent');27var newMutant = stryker.Mutant.prototype;28module.exports = function () {29 return newMutant;30};31var stryker = require('stryker-parent');32var oldMutant = stryker.Mutant.prototype;33module.exports = function () {34 return oldMutant;35};36var stryker = require('stryker-parent');37var newMutant = stryker.Mutant.prototype;38module.exports = function () {39 return newMutant;40};41var stryker = require('stryker-parent');42var oldMutant = stryker.Mutant.prototype;43module.exports = function () {

Full Screen

Using AI Code Generation

copy

Full Screen

1var oldMutant = require('stryker-parent').oldMutant;2var mutant = oldMutant('test.js', 'testMethod', 1, '1', '2');3var newMutant = require('stryker-parent').newMutant;4var mutant = newMutant('test.js', 'testMethod', 1, '1', '2');5var oldMutant = require('stryker-parent').oldMutant;6var mutant = oldMutant('test.js', 'testMethod', 1, '1', '2');7var newMutant = require('stryker-parent').newMutant;8var mutant = newMutant('test.js', 'testMethod', 1, '1', '2');9var oldMutant = require('stryker-parent').oldMutant;10var mutant = oldMutant('test.js', 'testMethod', 1, '1', '2');11var newMutant = require('stryker-parent').newMutant;12var mutant = newMutant('test.js', 'testMethod', 1, '1', '2');13var oldMutant = require('stryker-parent').oldMutant;14var mutant = oldMutant('test.js', 'testMethod', 1, '1', '2');15var newMutant = require('stryker-parent').newMutant;16var mutant = newMutant('test.js', 'testMethod', 1, '1', '2');17var oldMutant = require('stryker-parent').oldMutant;18var mutant = oldMutant('test.js', 'testMethod', 1, '1', '2');19var newMutant = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1var mutant = require('stryker-parent').oldMutant;2mutant({3 mutator: function(mutant) {4 mutant.name = 'changed';5 }6});7var mutant = require('stryker-parent').newMutant;8mutant({9 mutator: function(mutant) {10 mutant.name = 'changed';11 }12});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful