Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextgis/utils

Package Overview
Dependencies
Maintainers
0
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/utils - npm Package Compare versions

Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.13

170

lib/index.d.ts
import { EventEmitter } from 'events';
import { Polygon, Feature, Position as Position$1, GeoJSON, Geometry } from 'geojson';
import { LngLatBoundsArray as LngLatBoundsArray$1, LngLatArray as LngLatArray$1 } from '@nextgis/utils';
import { GeoJSON, Position as Position$1, Geometry, Polygon, Feature } from 'geojson';
import { LngLatArray as LngLatArray$1, LngLatBoundsArray as LngLatBoundsArray$1 } from '@nextgis/utils';
declare const isBrowser: boolean;
declare const type: 'browser' | 'node';
declare function getGlobalVariable(): any;
interface ApplyMixinOptions {

@@ -17,2 +13,4 @@ replace?: boolean;

declare function arrayChunk<T>(arr: T[], size: number): T[][];
/**

@@ -42,4 +40,20 @@ * Comparison of the contents of two arrays. Position of elements is ignored.

declare function arrayChunk<T>(arr: T[], size: number): T[][];
declare class Clipboard {
silent: boolean;
constructor(text?: string);
static copy(text: string): boolean;
copy(text: string): boolean;
private copyToClipboard;
private copyNodeContentsToClipboard;
}
declare function debounce<T extends (...args: any[]) => void>(cb: T, wait?: number): T & {
clear: () => void;
};
declare function DebounceDecorator(wait?: number): (_target: unknown, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
declare function debugLog(message?: string): boolean;
declare function deepmerge<T>(x: Partial<T>, y: Partial<T>, mergeArray?: boolean): T;
/**

@@ -77,11 +91,2 @@ * from https://github.com/CesiumGS/cesium/blob/master/Source/Core/defined.js

declare function deepmerge<T>(x: Partial<T>, y: Partial<T>, mergeArray?: boolean): T;
declare function debounce<T extends (...args: any[]) => void>(cb: T, wait?: number): T & {
clear: () => void;
};
declare function DebounceDecorator(wait?: number): (target: unknown, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
declare function debugLog(message?: string): boolean;
declare class Events<E = any> {

@@ -96,2 +101,7 @@ private emitter;

interface FlattenOptions {
flatArray?: boolean;
}
declare function flatten(data: Record<string, any>, opt?: FlattenOptions): Record<string, any>;
/**

@@ -132,4 +142,3 @@ * Map zoom level. From 0 to 22

declare function latLngToLngLatArray(latLng: LatLng): LngLatArray;
declare function lngLatArrayToLatLng(coord: LngLatArray): LatLng;
declare function checkExtent(extent: number[]): extent is LngLatBoundsArray;

@@ -141,2 +150,15 @@ /**

declare function degrees2meters(lng: number, lat: number): [number, number];
declare function meters2degrees(x: number, y: number): LngLatArray;
declare function degrees2Radian(deg: number): number;
declare function coordinatesCount(geojson: GeoJSON): number;
declare function getCoordinates(geojson: GeoJSON): Position$1[];
declare function eachCoordinates(geojson: GeoJSON, cb: (position: Position$1) => void): void;
declare function getPolygons(geojson: GeoJSON): Position$1[][];
declare function eachGeometry(geojson: GeoJSON, cb: (position: Geometry) => void): void;
declare function latLngToLngLatArray(latLng: LatLng): LngLatArray;
declare function lngLatArrayToLatLng(coord: LngLatArray): LatLng;
declare function getBoundsPolygon(b: LngLatBoundsArray): Polygon;

@@ -151,19 +173,15 @@ declare function getBoundsCoordinates(b: LngLatBoundsArray): number[][];

declare function getIdentifyRadius(center: LngLatArray$1, zoom: number, pixelRadius: number): number;
declare function getSquarePolygonCoordinates(lng: number, lat: number, halfSideLength?: number): Position$1[];
declare function degrees2meters(lng: number, lat: number): [number, number];
declare function meters2degrees(x: number, y: number): LngLatArray;
declare function degrees2Radian(deg: number): number;
declare function coordinatesCount(geojson: GeoJSON): number;
declare function getCoordinates(geojson: GeoJSON): Position$1[];
declare function eachCoordinates(geojson: GeoJSON, cb: (position: Position$1) => void): void;
declare function getPolygons(geojson: GeoJSON): Position$1[][];
declare function eachGeometry(geojson: GeoJSON, cb: (position: Geometry) => void): void;
declare function isLngLatBoundsArray(array: unknown): array is LngLatBoundsArray$1;
declare function getIdentifyRadius(center: LngLatArray$1, zoom: number, pixelRadius: number): number;
type FeatureProperties = {
[name: string]: any;
};
type FeatureProperties_<F extends Feature = Feature> = F['properties'];
type ExtractFeatureProperties<F extends Feature = Feature> = FeatureProperties_<F> extends null ? FeatureProperties : FeatureProperties;
declare function checkExtent(extent: number[]): extent is LngLatBoundsArray;
declare function round(val: number, toFixed?: number): number;

@@ -196,9 +214,6 @@ declare function objectAssign<T, U>(target: T, source: U): T & U;

interface FlattenOptions {
flatArray?: boolean;
}
declare function flatten(data: Record<string, any>, opt?: FlattenOptions): Record<string, any>;
declare const isBrowser: boolean;
declare const type: 'browser' | 'node';
declare function getGlobalVariable(): any;
declare function unflatten(data: Record<string, any> | any[]): Record<string, any>;
declare function reEscape(s: string): string;

@@ -208,4 +223,2 @@

declare function capitalize(str: string): string;
/**

@@ -219,48 +232,7 @@ * Camelize a string, cutting the string by separator character.

declare function capitalize(str: string): string;
declare function numberWithSpaces(x: number): string;
declare function round(val: number, toFixed?: number): number;
/**
* Same as Partial<T> but goes deeper and makes Partial<T> all its properties and sub-properties.
*/
type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>;
};
type Type<T> = new (...args: any[]) => T;
type AnyJson = boolean | number | string | null | JsonArray | JsonMap;
interface JsonMap {
[key: string]: AnyJson;
}
type JsonArray = Array<AnyJson>;
declare function isAnyJson(val: unknown): val is AnyJson;
declare function isJsonArray(val: unknown): val is JsonArray;
declare function isJsonMap(val: unknown): val is JsonMap;
type Obj = Record<string | number, any>;
declare function isObjKey<O extends Obj = Obj>(obj: O, key: unknown): key is keyof O;
/**
*
* @deprecated - use isObjKey instead
*/
declare function keyInObj<O extends Obj = Obj>(obj: O, key: unknown): key is keyof O;
declare function isObject(val: unknown): val is Record<string | number, any>;
declare function isArray(val: unknown): val is [];
declare function fixUrlStr(url: string): string;
declare function updateUrlParams(urlStr: string, params: Record<string, string | undefined>): string;
declare class Clipboard {
silent: boolean;
constructor(text?: string);
static copy(text: string): boolean;
copy(text: string): boolean;
private copyToClipboard;
private copyNodeContentsToClipboard;
}
/**
* This specification attempts to create a standard for representing metadata

@@ -386,8 +358,36 @@ * about multiple types of web-based layers, to aid clients in configuration and browsing.

type FeatureProperties = {
[name: string]: any;
/**
* Same as Partial<T> but goes deeper and makes Partial<T> all its properties and sub-properties.
*/
type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>;
};
type FeatureProperties_<F extends Feature = Feature> = F['properties'];
type ExtractFeatureProperties<F extends Feature = Feature> = FeatureProperties_<F> extends null ? FeatureProperties : FeatureProperties;
type Obj = Record<string | number, any>;
declare function isObjKey<O extends Obj = Obj>(obj: O, key: unknown): key is keyof O;
/**
*
* @deprecated - use isObjKey instead
*/
declare function keyInObj<O extends Obj = Obj>(obj: O, key: unknown): key is keyof O;
type AnyJson = boolean | number | string | null | JsonArray | JsonMap;
interface JsonMap {
[key: string]: AnyJson;
}
type JsonArray = Array<AnyJson>;
declare function isAnyJson(val: unknown): val is AnyJson;
declare function isJsonArray(val: unknown): val is JsonArray;
declare function isJsonMap(val: unknown): val is JsonMap;
type Type<T> = new (...args: any[]) => T;
declare function isObject(val: unknown): val is Record<string | number, any>;
declare function isArray(val: unknown): val is [];
declare function unflatten(data: Record<string, any> | any[]): Record<string, any>;
declare function fixUrlStr(url: string): string;
declare function updateUrlParams(urlStr: string, params: Record<string, string | undefined>): string;
export { type AnyJson, type ApplyMixinOptions, Clipboard, DebounceDecorator, type DeepPartial, EARTHS_RADIUS, Events, type ExtractFeatureProperties, type FeatureProperties, type FeatureProperties_, type FlattenOptions, type JsonArray, type JsonMap, type LatLng, type LngLatArray, type LngLatBoundsArray, type Position, type TileJson, type Type, type ZoomLevel, allProperties, applyMixins, arrayChunk, arrayCompare, arrayCompareStrict, arrayUnique, camelize, capitalize, checkExtent, coordinatesCount, debounce, debugLog, deepmerge, defined, degrees2Radian, degrees2meters, eachCoordinates, eachGeometry, fixUrlStr, flatten, full, getBoundsCoordinates, getBoundsFeature, getBoundsPolygon, getCircleFeature, getCirclePolygonCoordinates, getCoordinates, getGlobalVariable, getIdentifyRadius, getPolygons, getSquarePolygonCoordinates, isAnyJson, isArray, isBrowser, isJsonArray, isJsonMap, isLngLatBoundsArray, isObjKey, isObject, keyInObj, latLngToLngLatArray, lngLatArrayToLatLng, meters2degrees, mixinProperties, numberWithSpaces, objectAssign, objectDeepEqual, objectRemoveEmpty, reEscape, round, sleep, type, unflatten, updateUrlParams };

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/utils; version: 3.0.0-alpha.5; author: NextGIS */
/** Bundle of @nextgis/utils; version: 3.0.0-alpha.13; author: NextGIS */
'use strict';

@@ -6,12 +6,2 @@

const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
}
function applyMixins(derivedCtor, baseCtors, opt = {}) {

@@ -61,2 +51,9 @@ const derivedProperties = allProperties(derivedCtor.prototype);

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
}
function arrayCompare(array1, array2) {

@@ -84,16 +81,90 @@ array1 = Array.from(array1).sort();

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField$1(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
if (!this.silent) console.log("Copied to Clipboard");
return true;
} catch {
if (!this.silent) console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
function defined(val) {
return val !== void 0 && val !== null;
function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
function DebounceDecorator(wait = 10) {
return function(_target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
function debugLog(message) {
{
console.trace("DEBUG: " + message);
return true;
}
}
function deepmerge(target, src, mergeArray = false) {

@@ -143,8 +214,8 @@ let target_ = target;

function debugLog(message) {
{
console.trace("DEBUG: " + message);
return true;
}
function defined(val) {
return val !== void 0 && val !== null;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
}

@@ -165,43 +236,9 @@ function deprecatedMapClick(ev) {

function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function DebounceDecorator(wait = 10) {
return function(target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Events {
constructor(emitter) {
this.emitter = emitter;
__publicField$1(this, "_eventsStatus", {});
__publicField(this, "_eventsStatus", {});
}

@@ -235,72 +272,55 @@ setEventStatus(event, status) {

function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
}
recurse(data, "");
return result;
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
const EARTHS_RADIUS = 6371;
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
return extp;
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
const EARTHS_RADIUS = 6371;

@@ -385,6 +405,59 @@ function degrees2meters(lng, lat) {

function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
}
return extp;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
function getIdentifyRadius(center, zoom, pixelRadius) {

@@ -397,28 +470,23 @@ pixelRadius = pixelRadius != null ? pixelRadius : 10;

function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
}
function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
}
function objectAssign(target, ...sources) {

@@ -478,45 +546,12 @@ for (const source of sources) {

function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
recurse(data, "");
return result;
}
function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function reEscape(s) {

@@ -530,7 +565,2 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function camelize(text, separator = /[_.\- ]/) {

@@ -547,2 +577,7 @@ const words = text.split(separator);

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function numberWithSpaces(x) {

@@ -554,6 +589,11 @@ const parts = x.toString().split(".");

function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}

@@ -587,12 +627,2 @@ function isAnyJson(val) {

function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}
function isObject(val) {

@@ -605,2 +635,19 @@ return Object.prototype.toString.call(val) === "[object Object]";

function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function fixUrlStr(url) {

@@ -624,49 +671,2 @@ return url.replace(/([^:]\/)\/+/g, "$1");

var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
!this.silent && console.log("Copied to Clipboard");
return true;
} catch (e) {
!this.silent && console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
exports.Clipboard = Clipboard;

@@ -673,0 +673,0 @@ exports.DebounceDecorator = DebounceDecorator;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t="undefined"!=typeof window&&void 0!==window.document,e=t?"browser":"node";function o(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const o=Object.getOwnPropertyNames(t);for(let t=0;t<o.length;t++)-1==e.indexOf(o[t])&&e.push(o[t])}return e}(t)}function r(t,e){return t.length===e.length&&t.every((function(t,o){return t===e[o]}))}function n(t){return null!=t}function i(t,e=10){let o;function r(...n){r.clear(),o=setTimeout((()=>{o=null,t.apply(this,n)}),e)}return r.clear=function(){o&&(clearTimeout(o),o=null)},r}var s=Object.defineProperty,c=(t,e,o)=>((t,e,o)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o)(t,e+"",o);const a=6371;function u(t){return{type:"Polygon",coordinates:[p(t)]}}function p(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}const f=Math.PI/180,l=180/Math.PI;function y(t,e,o=10,r=6){const n=o/a*l,i=n/Math.cos(e*f),s=[];for(let c=0;c<r+1;c++){const o=Math.PI*(c/(r/2)),a=t+i*Math.cos(o),u=e+n*Math.sin(o);s.push([a,u])}return s}const d=Math.PI/180,g=180/Math.PI;function h(t,e){b(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const o of t.coordinates)o.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const o of t.coordinates)o.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const o of t.coordinates)e(o);return t}))}function b(t,e){if("FeatureCollection"===t.type)for(const o of t.features)e(o.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function x(t,e,o,r){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===o?e===r:m(t,e));return t===e}function m(t,e){const o=Object.keys(t).sort(),r=Object.keys(e).sort();if(o.length!==r.length)return!1;if(o.join("")!==r.join(""))return!1;for(let n=0;n<o.length;n++){if(!x(t[o[n]],e[r[n]],t,e))return!1}return!0}function j(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(A(t)?O(t):!!v(t)&&P(t))}function P(t){return!!v(t)&&t.every(j)}function O(t){if(A(t))for(const e in t)if(!j(e))return!1;return!1}function M(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function A(t){return"[object Object]"===Object.prototype.toString.call(t)}function v(t){return"[object Array]"===Object.prototype.toString.call(t)}var w=Object.defineProperty,C=(t,e,o)=>((t,e,o)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o)(t,e+"",o);class E{constructor(t){C(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new E).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),!this.silent&&console.log("Copied to Clipboard"),!0}catch(e){!this.silent&&console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}exports.Clipboard=E,exports.DebounceDecorator=function(t=10){return function(e,o,r){return{configurable:!0,enumerable:r.enumerable,get:function(){return Object.defineProperty(this,o,{configurable:!0,enumerable:r.enumerable,value:i(r.value,t)}),this[o]}}}},exports.EARTHS_RADIUS=a,exports.Events=class{constructor(t){this.emitter=t,c(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}},exports.allProperties=o,exports.applyMixins=function(t,e,r={}){const n=o(t.prototype),i=void 0===r.replace||r.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((o=>{const r=-1!==n.indexOf(o);if(!i&&!r||i){const r=Object.getOwnPropertyDescriptor(e.prototype,o);r&&Object.defineProperty(t.prototype,o,r)}}))}))},exports.arrayChunk=function(t,e){return Array.from({length:Math.ceil(t.length/e)},((o,r)=>t.slice(r*e,r*e+e)))},exports.arrayCompare=function(t,e){return r(t=Array.from(t).sort(),e=Array.from(e).sort())},exports.arrayCompareStrict=function(t,e){return r(t=Array.from(t),e=Array.from(e))},exports.arrayUnique=function(t){return t.filter(((t,e,o)=>o.indexOf(t)==e))},exports.camelize=function(t,e=/[_.\- ]/){const o=t.split(e);let r="";for(let n=0;n<o.length;n++){const t=o[n];r+=t.charAt(0).toUpperCase()+t.slice(1)}return r},exports.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},exports.checkExtent=function(t){const[e,o,r,n]=t,i=e<r&&o<n;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${o}, ${r}, ${n}]`);const t=[Math.min(e,r),Math.min(o,n),Math.max(e,r),Math.max(n,o)];console.log(`Expected order: [${t.join(", ")}]`)}const s=e>=-180&&r<=180,c=o>=-90&&n<=90;return s&&c||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&s&&c},exports.coordinatesCount=function(t){let e=0;return h(t,(()=>e++)),e},exports.debounce=i,exports.debugLog=function(t){return!1},exports.deepmerge=function t(e,o,r=!1){let n=e;const i=o,s=Array.isArray(i);let c=s&&[]||{};return s&&Array.isArray(i)?r?(n=n||[],c=c.concat(n),i.forEach(((e,o)=>{void 0===c[o]?c[o]=e:"object"==typeof e?c[o]=t(n[o],e,r):-1===n.indexOf(e)&&c.push(e)}))):c=i:(n&&"object"==typeof n&&Object.keys(n).forEach((function(t){c[t]=n[t]})),Object.keys(i).forEach((function(e){c[e]="object"==typeof i[e]&&i[e]&&"object"==typeof n[e]&&"object"==typeof i[e]?t(n[e],i[e],r):i[e]}))),c},exports.defined=n,exports.degrees2Radian=function(t){return t*Math.PI/180},exports.degrees2meters=function(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const o=20037508.34*t/180;let r=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return r=20037508.34*r/180,[o,r]},exports.deprecatedMapClick=function(t){if(!t.lngLat&&t.latLng){t.lngLat=[t.latLng.lng,t.latLng.lat]}return t},exports.deprecatedWarn=function(t){console.warn(`DEPRECATED WARN: ${t}`)},exports.eachCoordinates=h,exports.eachGeometry=b,exports.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},exports.flatten=function(t,e={}){var o;const r=null==(o=e.flatArray)||o,n={};return function t(e,o){if(Object(e)!==e)n[o]=e;else if(Array.isArray(e)&&r){const r=e.length;for(let n=0;n<r;n++)t(e[n],o+"["+n+"]");0===r&&(n[o]=[])}else{let r=!0;for(const n in e)r=!1,t(e[n],o?o+"."+n:n);r&&o&&(n[o]={})}}(t,""),n},exports.full=function(t){return"string"==typeof t?!!t:n(t)},exports.getBoundsCoordinates=p,exports.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:u(t)}},exports.getBoundsPolygon=u,exports.getCircleFeature=function(t,e,o=10,r=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[y(t,e,o,r)]}}},exports.getCirclePolygonCoordinates=y,exports.getCoordinates=function(t){const e=[];return h(t,(t=>e.push(t))),e},exports.getGlobalVariable=function(){return t?window:global},exports.getIdentifyRadius=function(t,e,o){return(o=null!=o?o:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4},exports.getPolygons=function(t){const e=[];return b(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const o of t.coordinates)for(const t of o)e.push(t);return t})),e},exports.getSquarePolygonCoordinates=function(t,e,o=10){const r=o/a*g,n=r/Math.cos(e*d),i=[t-n,e+r];return[i,[t+n,e+r],[t+n,e-r],[t-n,e-r],i]},exports.isAnyJson=j,exports.isArray=v,exports.isBrowser=t,exports.isJsonArray=P,exports.isJsonMap=O,exports.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))},exports.isObjKey=M,exports.isObject=A,exports.keyInObj=function(t,e){return M(t,e)},exports.latLngToLngLatArray=function(t){return[t.lng,t.lat]},exports.lngLatArrayToLatLng=function(t){return{lat:t[1],lng:t[0]}},exports.meters2degrees=function(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]},exports.mixinProperties=function(t,e,o){o.forEach((o=>{const r=Object.getOwnPropertyDescriptor(e.prototype,o);r&&Object.defineProperty(t.prototype,o,r)}))},exports.numberWithSpaces=function(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")},exports.objectAssign=function(t,...e){for(const o of e)for(const e of Object.getOwnPropertyNames(o))t[e]=o[e]},exports.objectDeepEqual=m,exports.objectRemoveEmpty=function t(e){const o={};return Object.keys(e).forEach((r=>{e[r]instanceof Array||e[r]!==Object(e[r])?void 0!==e[r]&&(o[r]=e[r]):o[r]=t(e[r])})),o},exports.reEscape=function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},exports.round=function(t,e){const o=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*o)/o},exports.sleep=function(t=0){return new Promise((e=>setTimeout(e,t)))},exports.type=e,exports.unflatten=function(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,o={};for(const r in t){let n,i=o,s="";for(;n=e.exec(r);)i=i[s]||(i[s]=n[2]?[]:{}),s=n[2]||n[1];i[s]=t[r]}return o[""]||o},exports.updateUrlParams=function(t,e){const o=new URL(t),r=new URLSearchParams(o.search);Object.entries(e).forEach((([t,e])=>{void 0===e?r.delete(t):r.set(t,e)})),r.set("timestamp",String((new Date).getTime()));const n=[...r.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${o.origin}${o.pathname}?${n}`};
"use strict";function t(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const o=Object.getOwnPropertyNames(t);for(let t=0;t<o.length;t++)-1==e.indexOf(o[t])&&e.push(o[t])}return e}(t)}function e(t,e){return t.length===e.length&&t.every((function(t,o){return t===e[o]}))}Object.defineProperty(exports,"__esModule",{value:!0});var o=Object.defineProperty,r=(t,e,r)=>((t,e,r)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,e+"",r);class n{constructor(t){r(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new n).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),this.silent||console.log("Copied to Clipboard"),!0}catch{this.silent||console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}function i(t,e=10){let o;function r(...n){r.clear(),o=setTimeout((()=>{o=null,t.apply(this,n)}),e)}return r.clear=function(){o&&(clearTimeout(o),o=null)},r}function s(t){return null!=t}var c=Object.defineProperty,a=(t,e,o)=>((t,e,o)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o)(t,e+"",o);const u=6371;function p(t,e){f(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const o of t.coordinates)o.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const o of t.coordinates)o.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const o of t.coordinates)e(o);return t}))}function f(t,e){if("FeatureCollection"===t.type)for(const o of t.features)e(o.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function l(t){return{type:"Polygon",coordinates:[y(t)]}}function y(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}const d=Math.PI/180,g=180/Math.PI;function h(t,e,o=10,r=6){const n=o/u*g,i=n/Math.cos(e*d),s=[];for(let c=0;c<r+1;c++){const o=Math.PI*(c/(r/2)),a=t+i*Math.cos(o),u=e+n*Math.sin(o);s.push([a,u])}return s}const b=Math.PI/180,x=180/Math.PI;function m(t,e,o,r){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===o?e===r:j(t,e));return t===e}function j(t,e){const o=Object.keys(t).sort(),r=Object.keys(e).sort();if(o.length!==r.length)return!1;if(o.join("")!==r.join(""))return!1;for(let n=0;n<o.length;n++){if(!m(t[o[n]],e[r[n]],t,e))return!1}return!0}const P="undefined"!=typeof window&&void 0!==window.document,O=P?"browser":"node";function M(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function A(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(C(t)?w(t):!!E(t)&&v(t))}function v(t){return!!E(t)&&t.every(A)}function w(t){if(C(t))for(const e in t)if(!A(e))return!1;return!1}function C(t){return"[object Object]"===Object.prototype.toString.call(t)}function E(t){return"[object Array]"===Object.prototype.toString.call(t)}exports.Clipboard=n,exports.DebounceDecorator=function(t=10){return function(e,o,r){return{configurable:!0,enumerable:r.enumerable,get:function(){return Object.defineProperty(this,o,{configurable:!0,enumerable:r.enumerable,value:i(r.value,t)}),this[o]}}}},exports.EARTHS_RADIUS=u,exports.Events=class{constructor(t){this.emitter=t,a(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}},exports.allProperties=t,exports.applyMixins=function(e,o,r={}){const n=t(e.prototype),i=void 0===r.replace||r.replace;o.forEach((t=>{Object.getOwnPropertyNames(t.prototype).forEach((o=>{const r=-1!==n.indexOf(o);if(!i&&!r||i){const r=Object.getOwnPropertyDescriptor(t.prototype,o);r&&Object.defineProperty(e.prototype,o,r)}}))}))},exports.arrayChunk=function(t,e){return Array.from({length:Math.ceil(t.length/e)},((o,r)=>t.slice(r*e,r*e+e)))},exports.arrayCompare=function(t,o){return e(t=Array.from(t).sort(),o=Array.from(o).sort())},exports.arrayCompareStrict=function(t,o){return e(t=Array.from(t),o=Array.from(o))},exports.arrayUnique=function(t){return t.filter(((t,e,o)=>o.indexOf(t)==e))},exports.camelize=function(t,e=/[_.\- ]/){const o=t.split(e);let r="";for(let n=0;n<o.length;n++){const t=o[n];r+=t.charAt(0).toUpperCase()+t.slice(1)}return r},exports.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},exports.checkExtent=function(t){const[e,o,r,n]=t,i=e<r&&o<n;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${o}, ${r}, ${n}]`);const t=[Math.min(e,r),Math.min(o,n),Math.max(e,r),Math.max(n,o)];console.log(`Expected order: [${t.join(", ")}]`)}const s=e>=-180&&r<=180,c=o>=-90&&n<=90;return s&&c||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&s&&c},exports.coordinatesCount=function(t){let e=0;return p(t,(()=>e++)),e},exports.debounce=i,exports.debugLog=function(t){return!1},exports.deepmerge=function t(e,o,r=!1){let n=e;const i=o,s=Array.isArray(i);let c=s&&[]||{};return s&&Array.isArray(i)?r?(n=n||[],c=c.concat(n),i.forEach(((e,o)=>{void 0===c[o]?c[o]=e:"object"==typeof e?c[o]=t(n[o],e,r):-1===n.indexOf(e)&&c.push(e)}))):c=i:(n&&"object"==typeof n&&Object.keys(n).forEach((function(t){c[t]=n[t]})),Object.keys(i).forEach((function(e){c[e]="object"==typeof i[e]&&i[e]&&"object"==typeof n[e]&&"object"==typeof i[e]?t(n[e],i[e],r):i[e]}))),c},exports.defined=s,exports.degrees2Radian=function(t){return t*Math.PI/180},exports.degrees2meters=function(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const o=20037508.34*t/180;let r=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return r=20037508.34*r/180,[o,r]},exports.deprecatedMapClick=function(t){if(!t.lngLat&&t.latLng){t.lngLat=[t.latLng.lng,t.latLng.lat]}return t},exports.deprecatedWarn=function(t){console.warn(`DEPRECATED WARN: ${t}`)},exports.eachCoordinates=p,exports.eachGeometry=f,exports.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},exports.flatten=function(t,e={}){var o;const r=null==(o=e.flatArray)||o,n={};return function t(e,o){if(Object(e)!==e)n[o]=e;else if(Array.isArray(e)&&r){const r=e.length;for(let n=0;n<r;n++)t(e[n],o+"["+n+"]");0===r&&(n[o]=[])}else{let r=!0;for(const n in e)r=!1,t(e[n],o?o+"."+n:n);r&&o&&(n[o]={})}}(t,""),n},exports.full=function(t){return"string"==typeof t?!!t:s(t)},exports.getBoundsCoordinates=y,exports.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:l(t)}},exports.getBoundsPolygon=l,exports.getCircleFeature=function(t,e,o=10,r=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[h(t,e,o,r)]}}},exports.getCirclePolygonCoordinates=h,exports.getCoordinates=function(t){const e=[];return p(t,(t=>e.push(t))),e},exports.getGlobalVariable=function(){return P?window:global},exports.getIdentifyRadius=function(t,e,o){return(o=null!=o?o:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4},exports.getPolygons=function(t){const e=[];return f(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const o of t.coordinates)for(const t of o)e.push(t);return t})),e},exports.getSquarePolygonCoordinates=function(t,e,o=10){const r=o/u*x,n=r/Math.cos(e*b),i=[t-n,e+r];return[i,[t+n,e+r],[t+n,e-r],[t-n,e-r],i]},exports.isAnyJson=A,exports.isArray=E,exports.isBrowser=P,exports.isJsonArray=v,exports.isJsonMap=w,exports.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))},exports.isObjKey=M,exports.isObject=C,exports.keyInObj=function(t,e){return M(t,e)},exports.latLngToLngLatArray=function(t){return[t.lng,t.lat]},exports.lngLatArrayToLatLng=function(t){return{lat:t[1],lng:t[0]}},exports.meters2degrees=function(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]},exports.mixinProperties=function(t,e,o){o.forEach((o=>{const r=Object.getOwnPropertyDescriptor(e.prototype,o);r&&Object.defineProperty(t.prototype,o,r)}))},exports.numberWithSpaces=function(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")},exports.objectAssign=function(t,...e){for(const o of e)for(const e of Object.getOwnPropertyNames(o))t[e]=o[e]},exports.objectDeepEqual=j,exports.objectRemoveEmpty=function t(e){const o={};return Object.keys(e).forEach((r=>{e[r]instanceof Array||e[r]!==Object(e[r])?void 0!==e[r]&&(o[r]=e[r]):o[r]=t(e[r])})),o},exports.reEscape=function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},exports.round=function(t,e){const o=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*o)/o},exports.sleep=function(t=0){return new Promise((e=>setTimeout(e,t)))},exports.type=O,exports.unflatten=function(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,o={};for(const r in t){let n,i=o,s="";for(;n=e.exec(r);)i=i[s]||(i[s]=n[2]?[]:{}),s=n[2]||n[1];i[s]=t[r]}return o[""]||o},exports.updateUrlParams=function(t,e){const o=new URL(t),r=new URLSearchParams(o.search);Object.entries(e).forEach((([t,e])=>{void 0===e?r.delete(t):r.set(t,e)})),r.set("timestamp",String((new Date).getTime()));const n=[...r.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${o.origin}${o.pathname}?${n}`};
//# sourceMappingURL=utils.cjs.prod.js.map

@@ -1,12 +0,2 @@

/** Bundle of @nextgis/utils; version: 3.0.0-alpha.5; author: NextGIS */
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
}
/** Bundle of @nextgis/utils; version: 3.0.0-alpha.13; author: NextGIS */
function applyMixins(derivedCtor, baseCtors, opt = {}) {

@@ -56,2 +46,9 @@ const derivedProperties = allProperties(derivedCtor.prototype);

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
}
function arrayCompare(array1, array2) {

@@ -79,16 +76,90 @@ array1 = Array.from(array1).sort();

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField$1(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
if (!this.silent) console.log("Copied to Clipboard");
return true;
} catch (e) {
if (!this.silent) console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
function defined(val) {
return val !== void 0 && val !== null;
function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
function DebounceDecorator(wait = 10) {
return function(_target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
function debugLog(message) {
{
console.trace("DEBUG: " + message);
return true;
}
}
function deepmerge(target, src, mergeArray = false) {

@@ -138,8 +209,8 @@ let target_ = target;

function debugLog(message) {
{
console.trace("DEBUG: " + message);
return true;
}
function defined(val) {
return val !== void 0 && val !== null;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
}

@@ -160,43 +231,9 @@ function deprecatedMapClick(ev) {

function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function DebounceDecorator(wait = 10) {
return function(target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Events {
constructor(emitter) {
this.emitter = emitter;
__publicField$1(this, "_eventsStatus", {});
__publicField(this, "_eventsStatus", {});
}

@@ -230,72 +267,55 @@ setEventStatus(event, status) {

function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
}
recurse(data, "");
return result;
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
const EARTHS_RADIUS = 6371;
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
return extp;
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
const EARTHS_RADIUS = 6371;

@@ -380,6 +400,59 @@ function degrees2meters(lng, lat) {

function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
}
return extp;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
function getIdentifyRadius(center, zoom, pixelRadius) {

@@ -392,28 +465,23 @@ pixelRadius = pixelRadius != null ? pixelRadius : 10;

function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
}
function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
}
function objectAssign(target, ...sources) {

@@ -473,45 +541,12 @@ for (const source of sources) {

function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
recurse(data, "");
return result;
}
function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function reEscape(s) {

@@ -525,7 +560,2 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function camelize(text, separator = /[_.\- ]/) {

@@ -542,2 +572,7 @@ const words = text.split(separator);

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function numberWithSpaces(x) {

@@ -549,6 +584,11 @@ const parts = x.toString().split(".");

function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}

@@ -582,12 +622,2 @@ function isAnyJson(val) {

function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}
function isObject(val) {

@@ -600,2 +630,19 @@ return Object.prototype.toString.call(val) === "[object Object]";

function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function fixUrlStr(url) {

@@ -619,50 +666,3 @@ return url.replace(/([^:]\/)\/+/g, "$1");

var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
!this.silent && console.log("Copied to Clipboard");
return true;
} catch (e) {
!this.silent && console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
export { Clipboard, DebounceDecorator, EARTHS_RADIUS, Events, allProperties, applyMixins, arrayChunk, arrayCompare, arrayCompareStrict, arrayUnique, camelize, capitalize, checkExtent, coordinatesCount, debounce, debugLog, deepmerge, defined, degrees2Radian, degrees2meters, deprecatedMapClick, deprecatedWarn, eachCoordinates, eachGeometry, fixUrlStr, flatten, full, getBoundsCoordinates, getBoundsFeature, getBoundsPolygon, getCircleFeature, getCirclePolygonCoordinates, getCoordinates, getGlobalVariable, getIdentifyRadius, getPolygons, getSquarePolygonCoordinates, isAnyJson, isArray, isBrowser, isJsonArray, isJsonMap, isLngLatBoundsArray, isObjKey, isObject, keyInObj, latLngToLngLatArray, lngLatArrayToLatLng, meters2degrees, mixinProperties, numberWithSpaces, objectAssign, objectDeepEqual, objectRemoveEmpty, reEscape, round, sleep, type, unflatten, updateUrlParams };
//# sourceMappingURL=utils.esm-browser.js.map

@@ -1,2 +0,2 @@

const t="undefined"!=typeof window&&void 0!==window.document,e=t?"browser":"node";function n(){return t?window:global}function o(t,e,n={}){const o=r(t.prototype),i=void 0===n.replace||n.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!i&&!r||i){const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}}))}))}function r(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyNames(t);for(let t=0;t<n.length;t++)-1==e.indexOf(n[t])&&e.push(n[t])}return e}(t)}function i(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function c(t,e){return u(t=Array.from(t).sort(),e=Array.from(e).sort())}function a(t,e){return u(t=Array.from(t),e=Array.from(e))}function u(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))}function s(t){return t.filter(((t,e,n)=>n.indexOf(t)==e))}function f(t,e){return Array.from({length:Math.ceil(t.length/e)},((n,o)=>t.slice(o*e,o*e+e)))}function l(t){return null!=t}function p(t){return"string"==typeof t?!!t:l(t)}function y(t,e,n=!1){let o=t;const r=e,i=Array.isArray(r);let c=i&&[]||{};return i&&Array.isArray(r)?n?(o=o||[],c=c.concat(o),r.forEach(((t,e)=>{void 0===c[e]?c[e]=t:"object"==typeof t?c[e]=y(o[e],t,n):-1===o.indexOf(t)&&c.push(t)}))):c=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){c[t]=o[t]})),Object.keys(r).forEach((function(t){c[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?y(o[t],r[t],n):r[t]}))),c}function h(t){return!1}function g(t){if(!t.lngLat&&t.latLng){t.lngLat=[t.latLng.lng,t.latLng.lat]}return t}function d(t){console.warn(`DEPRECATED WARN: ${t}`)}function b(t,e=10){let n;function o(...r){o.clear(),n=setTimeout((()=>{n=null,t.apply(this,r)}),e)}return o.clear=function(){n&&(clearTimeout(n),n=null)},o}function m(t=10){return function(e,n,o){return{configurable:!0,enumerable:o.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:o.enumerable,value:b(o.value,t)}),this[n]}}}}var j=Object.defineProperty,P=(t,e,n)=>((t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class O{constructor(t){this.emitter=t,P(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}}function M(t){return[t.lng,t.lat]}function v(t){return{lat:t[1],lng:t[0]}}const w=6371;function A(t){return{type:"Polygon",coordinates:[E(t)]}}function E(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function S(t){return{type:"Feature",properties:{},geometry:A(t)}}const C=Math.PI/180,x=180/Math.PI;function $(t,e,n=10,o=6){const r=n/w*x,i=r/Math.cos(e*C),c=[];for(let a=0;a<o+1;a++){const n=Math.PI*(a/(o/2)),u=t+i*Math.cos(n),s=e+r*Math.sin(n);c.push([u,s])}return c}function I(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[$(t,e,n,o)]}}}const L=Math.PI/180,T=180/Math.PI;function D(t,e,n=10){const o=n/w*T,r=o/Math.cos(e*L),i=[t-r,e+o];return[i,[t+r,e+o],[t+r,e-o],[t-r,e-o],i]}function N(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const n=20037508.34*t/180;let o=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return o=20037508.34*o/180,[n,o]}function F(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function R(t){return t*Math.PI/180}function k(t){let e=0;return _(t,(()=>e++)),e}function U(t){const e=[];return _(t,(t=>e.push(t))),e}function _(t,e){B(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const n of t.coordinates)n.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)n.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const n of t.coordinates)e(n);return t}))}function W(t){const e=[];return B(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)for(const t of n)e.push(t);return t})),e}function B(t,e){if("FeatureCollection"===t.type)for(const n of t.features)e(n.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function q(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function z(t,e,n){return(n=null!=n?n:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4}function G(t){const[e,n,o,r]=t,i=e<o&&n<r;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${n}, ${o}, ${r}]`);const t=[Math.min(e,o),Math.min(n,r),Math.max(e,o),Math.max(r,n)];console.log(`Expected order: [${t.join(", ")}]`)}const c=e>=-180&&o<=180,a=n>=-90&&r<=90;return c&&a||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&c&&a}function H(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function J(t,e,n,o){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===n?e===o:K(t,e));return t===e}function K(t,e){const n=Object.keys(t).sort(),o=Object.keys(e).sort();if(n.length!==o.length)return!1;if(n.join("")!==o.join(""))return!1;for(let r=0;r<n.length;r++){if(!J(t[n[r]],e[o[r]],t,e))return!1}return!0}function Q(t){const e={};return Object.keys(t).forEach((n=>{t[n]instanceof Array||t[n]!==Object(t[n])?void 0!==t[n]&&(e[n]=t[n]):e[n]=Q(t[n])})),e}function V(t,e={}){var n;const o=null==(n=e.flatArray)||n,r={};return function t(e,n){if(Object(e)!==e)r[n]=e;else if(Array.isArray(e)&&o){const o=e.length;for(let r=0;r<o;r++)t(e[r],n+"["+r+"]");0===o&&(r[n]=[])}else{let o=!0;for(const r in e)o=!1,t(e[r],n?n+"."+r:r);o&&n&&(r[n]={})}}(t,""),r}function X(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,i=n,c="";for(;r=e.exec(o);)i=i[c]||(i[c]=r[2]?[]:{}),c=r[2]||r[1];i[c]=t[o]}return n[""]||n}function Y(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(t=0){return new Promise((e=>setTimeout(e,t)))}function tt(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function et(t,e=/[_.\- ]/){const n=t.split(e);let o="";for(let r=0;r<n.length;r++){const t=n[r];o+=t.charAt(0).toUpperCase()+t.slice(1)}return o}function nt(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function ot(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function rt(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(st(t)?ct(t):!!ft(t)&&it(t))}function it(t){return!!ft(t)&&t.every(rt)}function ct(t){if(st(t))for(const e in t)if(!rt(e))return!1;return!1}function at(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function ut(t,e){return at(t,e)}function st(t){return"[object Object]"===Object.prototype.toString.call(t)}function ft(t){return"[object Array]"===Object.prototype.toString.call(t)}function lt(t){return t.replace(/([^:]\/)\/+/g,"$1")}function pt(t,e){const n=new URL(t),o=new URLSearchParams(n.search);Object.entries(e).forEach((([t,e])=>{void 0===e?o.delete(t):o.set(t,e)})),o.set("timestamp",String((new Date).getTime()));const r=[...o.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${n.origin}${n.pathname}?${r}`}var yt=Object.defineProperty,ht=(t,e,n)=>((t,e,n)=>e in t?yt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class gt{constructor(t){ht(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new gt).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),!this.silent&&console.log("Copied to Clipboard"),!0}catch(e){!this.silent&&console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}export{gt as Clipboard,m as DebounceDecorator,w as EARTHS_RADIUS,O as Events,r as allProperties,o as applyMixins,f as arrayChunk,c as arrayCompare,a as arrayCompareStrict,s as arrayUnique,et as camelize,tt as capitalize,G as checkExtent,k as coordinatesCount,b as debounce,h as debugLog,y as deepmerge,l as defined,R as degrees2Radian,N as degrees2meters,g as deprecatedMapClick,d as deprecatedWarn,_ as eachCoordinates,B as eachGeometry,lt as fixUrlStr,V as flatten,p as full,E as getBoundsCoordinates,S as getBoundsFeature,A as getBoundsPolygon,I as getCircleFeature,$ as getCirclePolygonCoordinates,U as getCoordinates,n as getGlobalVariable,z as getIdentifyRadius,W as getPolygons,D as getSquarePolygonCoordinates,rt as isAnyJson,ft as isArray,t as isBrowser,it as isJsonArray,ct as isJsonMap,q as isLngLatBoundsArray,at as isObjKey,st as isObject,ut as keyInObj,M as latLngToLngLatArray,v as lngLatArrayToLatLng,F as meters2degrees,i as mixinProperties,nt as numberWithSpaces,H as objectAssign,K as objectDeepEqual,Q as objectRemoveEmpty,Y as reEscape,ot as round,Z as sleep,e as type,X as unflatten,pt as updateUrlParams};
function t(t,n,o={}){const r=e(t.prototype),i=void 0===o.replace||o.replace;n.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const o=-1!==r.indexOf(n);if(!i&&!o||i){const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}}))}))}function e(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyNames(t);for(let t=0;t<n.length;t++)-1==e.indexOf(n[t])&&e.push(n[t])}return e}(t)}function n(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function o(t,e){return Array.from({length:Math.ceil(t.length/e)},((n,o)=>t.slice(o*e,o*e+e)))}function r(t,e){return c(t=Array.from(t).sort(),e=Array.from(e).sort())}function i(t,e){return c(t=Array.from(t),e=Array.from(e))}function c(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))}function a(t){return t.filter(((t,e,n)=>n.indexOf(t)==e))}var u=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class f{constructor(t){s(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new f).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),this.silent||console.log("Copied to Clipboard"),!0}catch(e){this.silent||console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}function l(t,e=10){let n;function o(...r){o.clear(),n=setTimeout((()=>{n=null,t.apply(this,r)}),e)}return o.clear=function(){n&&(clearTimeout(n),n=null)},o}function p(t=10){return function(e,n,o){return{configurable:!0,enumerable:o.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:o.enumerable,value:l(o.value,t)}),this[n]}}}}function y(t){return!1}function h(t,e,n=!1){let o=t;const r=e,i=Array.isArray(r);let c=i&&[]||{};return i&&Array.isArray(r)?n?(o=o||[],c=c.concat(o),r.forEach(((t,e)=>{void 0===c[e]?c[e]=t:"object"==typeof t?c[e]=h(o[e],t,n):-1===o.indexOf(t)&&c.push(t)}))):c=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){c[t]=o[t]})),Object.keys(r).forEach((function(t){c[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?h(o[t],r[t],n):r[t]}))),c}function g(t){return null!=t}function d(t){return"string"==typeof t?!!t:g(t)}function b(t){if(!t.lngLat&&t.latLng){t.lngLat=[t.latLng.lng,t.latLng.lat]}return t}function m(t){console.warn(`DEPRECATED WARN: ${t}`)}var j=Object.defineProperty,P=(t,e,n)=>((t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class O{constructor(t){this.emitter=t,P(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}}function M(t,e={}){var n;const o=null==(n=e.flatArray)||n,r={};return function t(e,n){if(Object(e)!==e)r[n]=e;else if(Array.isArray(e)&&o){const o=e.length;for(let r=0;r<o;r++)t(e[r],n+"["+r+"]");0===o&&(r[n]=[])}else{let o=!0;for(const r in e)o=!1,t(e[r],n?n+"."+r:r);o&&n&&(r[n]={})}}(t,""),r}function v(t){const[e,n,o,r]=t,i=e<o&&n<r;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${n}, ${o}, ${r}]`);const t=[Math.min(e,o),Math.min(n,r),Math.max(e,o),Math.max(r,n)];console.log(`Expected order: [${t.join(", ")}]`)}const c=e>=-180&&o<=180,a=n>=-90&&r<=90;return c&&a||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&c&&a}const w=6371;function A(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const n=20037508.34*t/180;let o=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return o=20037508.34*o/180,[n,o]}function E(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function S(t){return t*Math.PI/180}function C(t){let e=0;return $(t,(()=>e++)),e}function x(t){const e=[];return $(t,(t=>e.push(t))),e}function $(t,e){L(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const n of t.coordinates)n.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)n.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const n of t.coordinates)e(n);return t}))}function I(t){const e=[];return L(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)for(const t of n)e.push(t);return t})),e}function L(t,e){if("FeatureCollection"===t.type)for(const n of t.features)e(n.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function T(t){return[t.lng,t.lat]}function D(t){return{lat:t[1],lng:t[0]}}function N(t){return{type:"Polygon",coordinates:[F(t)]}}function F(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function R(t){return{type:"Feature",properties:{},geometry:N(t)}}const k=Math.PI/180,U=180/Math.PI;function _(t,e,n=10,o=6){const r=n/w*U,i=r/Math.cos(e*k),c=[];for(let a=0;a<o+1;a++){const n=Math.PI*(a/(o/2)),u=t+i*Math.cos(n),s=e+r*Math.sin(n);c.push([u,s])}return c}function W(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[_(t,e,n,o)]}}}function B(t,e,n){return(n=null!=n?n:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4}const q=Math.PI/180,z=180/Math.PI;function G(t,e,n=10){const o=n/w*z,r=o/Math.cos(e*q),i=[t-r,e+o];return[i,[t+r,e+o],[t+r,e-o],[t-r,e-o],i]}function H(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function J(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function K(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function Q(t,e,n,o){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===n?e===o:V(t,e));return t===e}function V(t,e){const n=Object.keys(t).sort(),o=Object.keys(e).sort();if(n.length!==o.length)return!1;if(n.join("")!==o.join(""))return!1;for(let r=0;r<n.length;r++){if(!Q(t[n[r]],e[o[r]],t,e))return!1}return!0}function X(t){const e={};return Object.keys(t).forEach((n=>{t[n]instanceof Array||t[n]!==Object(t[n])?void 0!==t[n]&&(e[n]=t[n]):e[n]=X(t[n])})),e}const Y="undefined"!=typeof window&&void 0!==window.document,Z=Y?"browser":"node";function tt(){return Y?window:global}function et(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function nt(t=0){return new Promise((e=>setTimeout(e,t)))}function ot(t,e=/[_.\- ]/){const n=t.split(e);let o="";for(let r=0;r<n.length;r++){const t=n[r];o+=t.charAt(0).toUpperCase()+t.slice(1)}return o}function rt(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function it(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function ct(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function at(t,e){return ct(t,e)}function ut(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(lt(t)?ft(t):!!pt(t)&&st(t))}function st(t){return!!pt(t)&&t.every(ut)}function ft(t){if(lt(t))for(const e in t)if(!ut(e))return!1;return!1}function lt(t){return"[object Object]"===Object.prototype.toString.call(t)}function pt(t){return"[object Array]"===Object.prototype.toString.call(t)}function yt(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,i=n,c="";for(;r=e.exec(o);)i=i[c]||(i[c]=r[2]?[]:{}),c=r[2]||r[1];i[c]=t[o]}return n[""]||n}function ht(t){return t.replace(/([^:]\/)\/+/g,"$1")}function gt(t,e){const n=new URL(t),o=new URLSearchParams(n.search);Object.entries(e).forEach((([t,e])=>{void 0===e?o.delete(t):o.set(t,e)})),o.set("timestamp",String((new Date).getTime()));const r=[...o.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${n.origin}${n.pathname}?${r}`}export{f as Clipboard,p as DebounceDecorator,w as EARTHS_RADIUS,O as Events,e as allProperties,t as applyMixins,o as arrayChunk,r as arrayCompare,i as arrayCompareStrict,a as arrayUnique,ot as camelize,rt as capitalize,v as checkExtent,C as coordinatesCount,l as debounce,y as debugLog,h as deepmerge,g as defined,S as degrees2Radian,A as degrees2meters,b as deprecatedMapClick,m as deprecatedWarn,$ as eachCoordinates,L as eachGeometry,ht as fixUrlStr,M as flatten,d as full,F as getBoundsCoordinates,R as getBoundsFeature,N as getBoundsPolygon,W as getCircleFeature,_ as getCirclePolygonCoordinates,x as getCoordinates,tt as getGlobalVariable,B as getIdentifyRadius,I as getPolygons,G as getSquarePolygonCoordinates,ut as isAnyJson,pt as isArray,Y as isBrowser,st as isJsonArray,ft as isJsonMap,H as isLngLatBoundsArray,ct as isObjKey,lt as isObject,at as keyInObj,T as latLngToLngLatArray,D as lngLatArrayToLatLng,E as meters2degrees,n as mixinProperties,it as numberWithSpaces,K as objectAssign,V as objectDeepEqual,X as objectRemoveEmpty,et as reEscape,J as round,nt as sleep,Z as type,yt as unflatten,gt as updateUrlParams};
//# sourceMappingURL=utils.esm-browser.prod.js.map

@@ -1,12 +0,2 @@

/** Bundle of @nextgis/utils; version: 3.0.0-alpha.5; author: NextGIS */
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
}
/** Bundle of @nextgis/utils; version: 3.0.0-alpha.13; author: NextGIS */
function applyMixins(derivedCtor, baseCtors, opt = {}) {

@@ -56,2 +46,9 @@ const derivedProperties = allProperties(derivedCtor.prototype);

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
}
function arrayCompare(array1, array2) {

@@ -79,16 +76,91 @@ array1 = Array.from(array1).sort();

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField$1(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
if (!this.silent) console.log("Copied to Clipboard");
return true;
} catch (e) {
if (!this.silent) console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
function defined(val) {
return val !== void 0 && val !== null;
function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
function DebounceDecorator(wait = 10) {
return function(_target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
function debugLog(message) {
if (!!(process.env.NODE_ENV !== "production")) {
console.trace("DEBUG: " + message);
return true;
}
return false;
}
function deepmerge(target, src, mergeArray = false) {

@@ -138,9 +210,8 @@ let target_ = target;

function debugLog(message) {
if (!!(process.env.NODE_ENV !== "production")) {
console.trace("DEBUG: " + message);
return true;
}
return false;
function defined(val) {
return val !== void 0 && val !== null;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
}

@@ -161,43 +232,9 @@ function deprecatedMapClick(ev) {

function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function DebounceDecorator(wait = 10) {
return function(target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Events {
constructor(emitter) {
this.emitter = emitter;
__publicField$1(this, "_eventsStatus", {});
__publicField(this, "_eventsStatus", {});
}

@@ -231,72 +268,55 @@ setEventStatus(event, status) {

function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
}
recurse(data, "");
return result;
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
const EARTHS_RADIUS = 6371;
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
return extp;
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
const EARTHS_RADIUS = 6371;

@@ -381,6 +401,59 @@ function degrees2meters(lng, lat) {

function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
}
return extp;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
function getIdentifyRadius(center, zoom, pixelRadius) {

@@ -393,28 +466,23 @@ pixelRadius = pixelRadius != null ? pixelRadius : 10;

function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
}
function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
}
function objectAssign(target, ...sources) {

@@ -474,45 +542,12 @@ for (const source of sources) {

function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
recurse(data, "");
return result;
}
function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function reEscape(s) {

@@ -526,7 +561,2 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function camelize(text, separator = /[_.\- ]/) {

@@ -543,2 +573,7 @@ const words = text.split(separator);

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function numberWithSpaces(x) {

@@ -550,6 +585,11 @@ const parts = x.toString().split(".");

function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}

@@ -583,12 +623,2 @@ function isAnyJson(val) {

function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}
function isObject(val) {

@@ -601,2 +631,19 @@ return Object.prototype.toString.call(val) === "[object Object]";

function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function fixUrlStr(url) {

@@ -620,50 +667,3 @@ return url.replace(/([^:]\/)\/+/g, "$1");

var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
!this.silent && console.log("Copied to Clipboard");
return true;
} catch (e) {
!this.silent && console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
export { Clipboard, DebounceDecorator, EARTHS_RADIUS, Events, allProperties, applyMixins, arrayChunk, arrayCompare, arrayCompareStrict, arrayUnique, camelize, capitalize, checkExtent, coordinatesCount, debounce, debugLog, deepmerge, defined, degrees2Radian, degrees2meters, deprecatedMapClick, deprecatedWarn, eachCoordinates, eachGeometry, fixUrlStr, flatten, full, getBoundsCoordinates, getBoundsFeature, getBoundsPolygon, getCircleFeature, getCirclePolygonCoordinates, getCoordinates, getGlobalVariable, getIdentifyRadius, getPolygons, getSquarePolygonCoordinates, isAnyJson, isArray, isBrowser, isJsonArray, isJsonMap, isLngLatBoundsArray, isObjKey, isObject, keyInObj, latLngToLngLatArray, lngLatArrayToLatLng, meters2degrees, mixinProperties, numberWithSpaces, objectAssign, objectDeepEqual, objectRemoveEmpty, reEscape, round, sleep, type, unflatten, updateUrlParams };
//# sourceMappingURL=utils.esm-bundler.js.map

@@ -1,2 +0,2 @@

const t="undefined"!=typeof window&&void 0!==window.document,e=t?"browser":"node";function n(){return t?window:global}function o(t,e,n={}){const o=r(t.prototype),i=void 0===n.replace||n.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!i&&!r||i){const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}}))}))}function r(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyNames(t);for(let t=0;t<n.length;t++)-1==e.indexOf(n[t])&&e.push(n[t])}return e}(t)}function i(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function c(t,e){return u(t=Array.from(t).sort(),e=Array.from(e).sort())}function a(t,e){return u(t=Array.from(t),e=Array.from(e))}function u(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))}function s(t){return t.filter(((t,e,n)=>n.indexOf(t)==e))}function f(t,e){return Array.from({length:Math.ceil(t.length/e)},((n,o)=>t.slice(o*e,o*e+e)))}function l(t){return null!=t}function p(t){return"string"==typeof t?!!t:l(t)}function y(t,e,n=!1){let o=t;const r=e,i=Array.isArray(r);let c=i&&[]||{};return i&&Array.isArray(r)?n?(o=o||[],c=c.concat(o),r.forEach(((t,e)=>{void 0===c[e]?c[e]=t:"object"==typeof t?c[e]=y(o[e],t,n):-1===o.indexOf(t)&&c.push(t)}))):c=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){c[t]=o[t]})),Object.keys(r).forEach((function(t){c[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?y(o[t],r[t],n):r[t]}))),c}function h(t){return"production"!==process.env.NODE_ENV&&(console.trace("DEBUG: "+t),!0)}function g(t){if(!t.lngLat&&t.latLng){h("deprecated use of latLng in MapClickEvent, use lngLat instead");t.lngLat=[t.latLng.lng,t.latLng.lat]}return t}function d(t){console.warn(`DEPRECATED WARN: ${t}`)}function b(t,e=10){let n;function o(...r){o.clear(),n=setTimeout((()=>{n=null,t.apply(this,r)}),e)}return o.clear=function(){n&&(clearTimeout(n),n=null)},o}function m(t=10){return function(e,n,o){return{configurable:!0,enumerable:o.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:o.enumerable,value:b(o.value,t)}),this[n]}}}}var j=Object.defineProperty,O=(t,e,n)=>((t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class P{constructor(t){this.emitter=t,O(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}}function M(t){return[t.lng,t.lat]}function v(t){return{lat:t[1],lng:t[0]}}const w=6371;function E(t){return{type:"Polygon",coordinates:[A(t)]}}function A(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function C(t){return{type:"Feature",properties:{},geometry:E(t)}}const S=Math.PI/180,x=180/Math.PI;function L(t,e,n=10,o=6){const r=n/w*x,i=r/Math.cos(e*S),c=[];for(let a=0;a<o+1;a++){const n=Math.PI*(a/(o/2)),u=t+i*Math.cos(n),s=e+r*Math.sin(n);c.push([u,s])}return c}function $(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[L(t,e,n,o)]}}}const D=Math.PI/180,I=180/Math.PI;function T(t,e,n=10){const o=n/w*I,r=o/Math.cos(e*D),i=[t-r,e+o];return[i,[t+r,e+o],[t+r,e-o],[t-r,e-o],i]}function N(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const n=20037508.34*t/180;let o=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return o=20037508.34*o/180,[n,o]}function k(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function F(t){return t*Math.PI/180}function R(t){let e=0;return _(t,(()=>e++)),e}function U(t){const e=[];return _(t,(t=>e.push(t))),e}function _(t,e){W(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const n of t.coordinates)n.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)n.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const n of t.coordinates)e(n);return t}))}function B(t){const e=[];return W(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)for(const t of n)e.push(t);return t})),e}function W(t,e){if("FeatureCollection"===t.type)for(const n of t.features)e(n.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function G(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function V(t,e,n){return(n=null!=n?n:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4}function q(t){const[e,n,o,r]=t,i=e<o&&n<r;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${n}, ${o}, ${r}]`);const t=[Math.min(e,o),Math.min(n,r),Math.max(e,o),Math.max(r,n)];console.log(`Expected order: [${t.join(", ")}]`)}const c=e>=-180&&o<=180,a=n>=-90&&r<=90;return c&&a||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&c&&a}function z(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function H(t,e,n,o){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===n?e===o:J(t,e));return t===e}function J(t,e){const n=Object.keys(t).sort(),o=Object.keys(e).sort();if(n.length!==o.length)return!1;if(n.join("")!==o.join(""))return!1;for(let r=0;r<n.length;r++){if(!H(t[n[r]],e[o[r]],t,e))return!1}return!0}function K(t){const e={};return Object.keys(t).forEach((n=>{t[n]instanceof Array||t[n]!==Object(t[n])?void 0!==t[n]&&(e[n]=t[n]):e[n]=K(t[n])})),e}function Q(t,e={}){var n;const o=null==(n=e.flatArray)||n,r={};return function t(e,n){if(Object(e)!==e)r[n]=e;else if(Array.isArray(e)&&o){const o=e.length;for(let r=0;r<o;r++)t(e[r],n+"["+r+"]");0===o&&(r[n]=[])}else{let o=!0;for(const r in e)o=!1,t(e[r],n?n+"."+r:r);o&&n&&(r[n]={})}}(t,""),r}function X(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,i=n,c="";for(;r=e.exec(o);)i=i[c]||(i[c]=r[2]?[]:{}),c=r[2]||r[1];i[c]=t[o]}return n[""]||n}function Y(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(t=0){return new Promise((e=>setTimeout(e,t)))}function tt(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function et(t,e=/[_.\- ]/){const n=t.split(e);let o="";for(let r=0;r<n.length;r++){const t=n[r];o+=t.charAt(0).toUpperCase()+t.slice(1)}return o}function nt(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function ot(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function rt(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(st(t)?ct(t):!!ft(t)&&it(t))}function it(t){return!!ft(t)&&t.every(rt)}function ct(t){if(st(t))for(const e in t)if(!rt(e))return!1;return!1}function at(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function ut(t,e){return at(t,e)}function st(t){return"[object Object]"===Object.prototype.toString.call(t)}function ft(t){return"[object Array]"===Object.prototype.toString.call(t)}function lt(t){return t.replace(/([^:]\/)\/+/g,"$1")}function pt(t,e){const n=new URL(t),o=new URLSearchParams(n.search);Object.entries(e).forEach((([t,e])=>{void 0===e?o.delete(t):o.set(t,e)})),o.set("timestamp",String((new Date).getTime()));const r=[...o.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${n.origin}${n.pathname}?${r}`}var yt=Object.defineProperty,ht=(t,e,n)=>((t,e,n)=>e in t?yt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class gt{constructor(t){ht(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new gt).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),!this.silent&&console.log("Copied to Clipboard"),!0}catch(e){!this.silent&&console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}export{gt as Clipboard,m as DebounceDecorator,w as EARTHS_RADIUS,P as Events,r as allProperties,o as applyMixins,f as arrayChunk,c as arrayCompare,a as arrayCompareStrict,s as arrayUnique,et as camelize,tt as capitalize,q as checkExtent,R as coordinatesCount,b as debounce,h as debugLog,y as deepmerge,l as defined,F as degrees2Radian,N as degrees2meters,g as deprecatedMapClick,d as deprecatedWarn,_ as eachCoordinates,W as eachGeometry,lt as fixUrlStr,Q as flatten,p as full,A as getBoundsCoordinates,C as getBoundsFeature,E as getBoundsPolygon,$ as getCircleFeature,L as getCirclePolygonCoordinates,U as getCoordinates,n as getGlobalVariable,V as getIdentifyRadius,B as getPolygons,T as getSquarePolygonCoordinates,rt as isAnyJson,ft as isArray,t as isBrowser,it as isJsonArray,ct as isJsonMap,G as isLngLatBoundsArray,at as isObjKey,st as isObject,ut as keyInObj,M as latLngToLngLatArray,v as lngLatArrayToLatLng,k as meters2degrees,i as mixinProperties,nt as numberWithSpaces,z as objectAssign,J as objectDeepEqual,K as objectRemoveEmpty,Y as reEscape,ot as round,Z as sleep,e as type,X as unflatten,pt as updateUrlParams};
function t(t,n,o={}){const r=e(t.prototype),i=void 0===o.replace||o.replace;n.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const o=-1!==r.indexOf(n);if(!i&&!o||i){const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}}))}))}function e(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyNames(t);for(let t=0;t<n.length;t++)-1==e.indexOf(n[t])&&e.push(n[t])}return e}(t)}function n(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function o(t,e){return Array.from({length:Math.ceil(t.length/e)},((n,o)=>t.slice(o*e,o*e+e)))}function r(t,e){return c(t=Array.from(t).sort(),e=Array.from(e).sort())}function i(t,e){return c(t=Array.from(t),e=Array.from(e))}function c(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))}function a(t){return t.filter(((t,e,n)=>n.indexOf(t)==e))}var u=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class f{constructor(t){s(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new f).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),this.silent||console.log("Copied to Clipboard"),!0}catch(e){this.silent||console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}function l(t,e=10){let n;function o(...r){o.clear(),n=setTimeout((()=>{n=null,t.apply(this,r)}),e)}return o.clear=function(){n&&(clearTimeout(n),n=null)},o}function p(t=10){return function(e,n,o){return{configurable:!0,enumerable:o.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:o.enumerable,value:l(o.value,t)}),this[n]}}}}function y(t){return"production"!==process.env.NODE_ENV&&(console.trace("DEBUG: "+t),!0)}function h(t,e,n=!1){let o=t;const r=e,i=Array.isArray(r);let c=i&&[]||{};return i&&Array.isArray(r)?n?(o=o||[],c=c.concat(o),r.forEach(((t,e)=>{void 0===c[e]?c[e]=t:"object"==typeof t?c[e]=h(o[e],t,n):-1===o.indexOf(t)&&c.push(t)}))):c=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){c[t]=o[t]})),Object.keys(r).forEach((function(t){c[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?h(o[t],r[t],n):r[t]}))),c}function g(t){return null!=t}function d(t){return"string"==typeof t?!!t:g(t)}function b(t){if(!t.lngLat&&t.latLng){y("deprecated use of latLng in MapClickEvent, use lngLat instead");t.lngLat=[t.latLng.lng,t.latLng.lat]}return t}function m(t){console.warn(`DEPRECATED WARN: ${t}`)}var j=Object.defineProperty,O=(t,e,n)=>((t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class P{constructor(t){this.emitter=t,O(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}}function M(t,e={}){var n;const o=null==(n=e.flatArray)||n,r={};return function t(e,n){if(Object(e)!==e)r[n]=e;else if(Array.isArray(e)&&o){const o=e.length;for(let r=0;r<o;r++)t(e[r],n+"["+r+"]");0===o&&(r[n]=[])}else{let o=!0;for(const r in e)o=!1,t(e[r],n?n+"."+r:r);o&&n&&(r[n]={})}}(t,""),r}function v(t){const[e,n,o,r]=t,i=e<o&&n<r;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${n}, ${o}, ${r}]`);const t=[Math.min(e,o),Math.min(n,r),Math.max(e,o),Math.max(r,n)];console.log(`Expected order: [${t.join(", ")}]`)}const c=e>=-180&&o<=180,a=n>=-90&&r<=90;return c&&a||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&c&&a}const w=6371;function E(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const n=20037508.34*t/180;let o=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return o=20037508.34*o/180,[n,o]}function A(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function C(t){return t*Math.PI/180}function S(t){let e=0;return L(t,(()=>e++)),e}function x(t){const e=[];return L(t,(t=>e.push(t))),e}function L(t,e){D(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const n of t.coordinates)n.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)n.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const n of t.coordinates)e(n);return t}))}function $(t){const e=[];return D(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)for(const t of n)e.push(t);return t})),e}function D(t,e){if("FeatureCollection"===t.type)for(const n of t.features)e(n.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function I(t){return[t.lng,t.lat]}function T(t){return{lat:t[1],lng:t[0]}}function N(t){return{type:"Polygon",coordinates:[k(t)]}}function k(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function F(t){return{type:"Feature",properties:{},geometry:N(t)}}const R=Math.PI/180,U=180/Math.PI;function _(t,e,n=10,o=6){const r=n/w*U,i=r/Math.cos(e*R),c=[];for(let a=0;a<o+1;a++){const n=Math.PI*(a/(o/2)),u=t+i*Math.cos(n),s=e+r*Math.sin(n);c.push([u,s])}return c}function B(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[_(t,e,n,o)]}}}function W(t,e,n){return(n=null!=n?n:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4}const G=Math.PI/180,V=180/Math.PI;function q(t,e,n=10){const o=n/w*V,r=o/Math.cos(e*G),i=[t-r,e+o];return[i,[t+r,e+o],[t+r,e-o],[t-r,e-o],i]}function z(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function H(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function J(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function K(t,e,n,o){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===n?e===o:Q(t,e));return t===e}function Q(t,e){const n=Object.keys(t).sort(),o=Object.keys(e).sort();if(n.length!==o.length)return!1;if(n.join("")!==o.join(""))return!1;for(let r=0;r<n.length;r++){if(!K(t[n[r]],e[o[r]],t,e))return!1}return!0}function X(t){const e={};return Object.keys(t).forEach((n=>{t[n]instanceof Array||t[n]!==Object(t[n])?void 0!==t[n]&&(e[n]=t[n]):e[n]=X(t[n])})),e}const Y="undefined"!=typeof window&&void 0!==window.document,Z=Y?"browser":"node";function tt(){return Y?window:global}function et(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function nt(t=0){return new Promise((e=>setTimeout(e,t)))}function ot(t,e=/[_.\- ]/){const n=t.split(e);let o="";for(let r=0;r<n.length;r++){const t=n[r];o+=t.charAt(0).toUpperCase()+t.slice(1)}return o}function rt(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function it(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function ct(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function at(t,e){return ct(t,e)}function ut(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(lt(t)?ft(t):!!pt(t)&&st(t))}function st(t){return!!pt(t)&&t.every(ut)}function ft(t){if(lt(t))for(const e in t)if(!ut(e))return!1;return!1}function lt(t){return"[object Object]"===Object.prototype.toString.call(t)}function pt(t){return"[object Array]"===Object.prototype.toString.call(t)}function yt(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,i=n,c="";for(;r=e.exec(o);)i=i[c]||(i[c]=r[2]?[]:{}),c=r[2]||r[1];i[c]=t[o]}return n[""]||n}function ht(t){return t.replace(/([^:]\/)\/+/g,"$1")}function gt(t,e){const n=new URL(t),o=new URLSearchParams(n.search);Object.entries(e).forEach((([t,e])=>{void 0===e?o.delete(t):o.set(t,e)})),o.set("timestamp",String((new Date).getTime()));const r=[...o.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${n.origin}${n.pathname}?${r}`}export{f as Clipboard,p as DebounceDecorator,w as EARTHS_RADIUS,P as Events,e as allProperties,t as applyMixins,o as arrayChunk,r as arrayCompare,i as arrayCompareStrict,a as arrayUnique,ot as camelize,rt as capitalize,v as checkExtent,S as coordinatesCount,l as debounce,y as debugLog,h as deepmerge,g as defined,C as degrees2Radian,E as degrees2meters,b as deprecatedMapClick,m as deprecatedWarn,L as eachCoordinates,D as eachGeometry,ht as fixUrlStr,M as flatten,d as full,k as getBoundsCoordinates,F as getBoundsFeature,N as getBoundsPolygon,B as getCircleFeature,_ as getCirclePolygonCoordinates,x as getCoordinates,tt as getGlobalVariable,W as getIdentifyRadius,$ as getPolygons,q as getSquarePolygonCoordinates,ut as isAnyJson,pt as isArray,Y as isBrowser,st as isJsonArray,ft as isJsonMap,z as isLngLatBoundsArray,ct as isObjKey,lt as isObject,at as keyInObj,I as latLngToLngLatArray,T as lngLatArrayToLatLng,A as meters2degrees,n as mixinProperties,it as numberWithSpaces,J as objectAssign,Q as objectDeepEqual,X as objectRemoveEmpty,et as reEscape,H as round,nt as sleep,Z as type,yt as unflatten,gt as updateUrlParams};
//# sourceMappingURL=utils.esm-bundler.prod.js.map

@@ -1,15 +0,5 @@

/** Bundle of @nextgis/utils; version: 3.0.0-alpha.5; author: NextGIS */
/** Bundle of @nextgis/utils; version: 3.0.0-alpha.13; author: NextGIS */
var Utils = (function (exports) {
'use strict';
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
}
function applyMixins(derivedCtor, baseCtors, opt = {}) {

@@ -59,2 +49,9 @@ const derivedProperties = allProperties(derivedCtor.prototype);

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
}
function arrayCompare(array1, array2) {

@@ -82,16 +79,90 @@ array1 = Array.from(array1).sort();

function arrayChunk(arr, size) {
return Array.from(
{ length: Math.ceil(arr.length / size) },
(v, i) => arr.slice(i * size, i * size + size)
);
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField$1(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
if (!this.silent) console.log("Copied to Clipboard");
return true;
} catch (e) {
if (!this.silent) console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
function defined(val) {
return val !== void 0 && val !== null;
function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
function DebounceDecorator(wait = 10) {
return function(_target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
function debugLog(message) {
{
console.trace("DEBUG: " + message);
return true;
}
}
function deepmerge(target, src, mergeArray = false) {

@@ -141,8 +212,8 @@ let target_ = target;

function debugLog(message) {
{
console.trace("DEBUG: " + message);
return true;
}
function defined(val) {
return val !== void 0 && val !== null;
}
function full(val) {
return typeof val === "string" ? !!val : defined(val);
}

@@ -163,43 +234,9 @@ function deprecatedMapClick(ev) {

function debounce(cb, wait = 10) {
let timeoutId;
function wrapper(...args) {
wrapper.clear();
timeoutId = setTimeout(() => {
timeoutId = null;
cb.apply(this, args);
}, wait);
}
wrapper.clear = function() {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
return wrapper;
}
function DebounceDecorator(wait = 10) {
return function(target, key, descriptor) {
return {
configurable: true,
enumerable: descriptor.enumerable,
get: function getter() {
Object.defineProperty(this, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: debounce(descriptor.value, wait)
});
return this[key];
}
};
};
}
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Events {
constructor(emitter) {
this.emitter = emitter;
__publicField$1(this, "_eventsStatus", {});
__publicField(this, "_eventsStatus", {});
}

@@ -233,72 +270,55 @@ setEventStatus(event, status) {

function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
}
recurse(data, "");
return result;
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
const EARTHS_RADIUS = 6371;
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
return extp;
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
const EARTHS_RADIUS = 6371;

@@ -383,6 +403,59 @@ function degrees2meters(lng, lat) {

function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
function latLngToLngLatArray(latLng) {
return [latLng.lng, latLng.lat];
}
function lngLatArrayToLatLng(coord) {
return { lat: coord[1], lng: coord[0] };
}
function getBoundsPolygon(b) {
const polygon = {
type: "Polygon",
coordinates: [getBoundsCoordinates(b)]
};
return polygon;
}
function getBoundsCoordinates(b) {
const westNorth = [b[0], b[1]];
const eastNorth = [b[2], b[1]];
const eastSouth = [b[2], b[3]];
const westSouth = [b[0], b[3]];
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
}
function getBoundsFeature(b) {
const feature = {
type: "Feature",
properties: {},
geometry: getBoundsPolygon(b)
};
return feature;
}
const d2r$1 = Math.PI / 180;
const r2d$1 = 180 / Math.PI;
function getCirclePolygonCoordinates(lng, lat, radius = 10, points = 6) {
const rlat = radius / EARTHS_RADIUS * r2d$1;
const rlng = rlat / Math.cos(lat * d2r$1);
const extp = [];
for (let i = 0; i < points + 1; i++) {
const theta = Math.PI * (i / (points / 2));
const ex = lng + rlng * Math.cos(theta);
const ey = lat + rlat * Math.sin(theta);
extp.push([ex, ey]);
}
return extp;
}
function getCircleFeature(lng, lat, radius = 10, points = 6) {
const polygon = getCirclePolygonCoordinates(lng, lat, radius, points);
const feature = {
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [polygon]
}
};
return feature;
}
function getIdentifyRadius(center, zoom, pixelRadius) {

@@ -395,28 +468,23 @@ pixelRadius = pixelRadius != null ? pixelRadius : 10;

function checkExtent(extent) {
const [minLon, minLat, maxLon, maxLat] = extent;
const isOrderValid = minLon < maxLon && minLat < maxLat;
if (!isOrderValid) {
console.log("Error: The extent coordinates are not in the correct order.");
console.log(
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
);
const correctedExtent = [
Math.min(minLon, maxLon),
Math.min(minLat, maxLat),
Math.max(minLon, maxLon),
Math.max(maxLat, minLat)
];
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
}
const isValidLon = minLon >= -180 && maxLon <= 180;
const isValidLat = minLat >= -90 && maxLat <= 90;
if (!isValidLon || !isValidLat) {
console.log(
"Warning: The coordinates may not be within valid geographic ranges."
);
}
return isOrderValid && isValidLon && isValidLat;
const d2r = Math.PI / 180;
const r2d = 180 / Math.PI;
function getSquarePolygonCoordinates(lng, lat, halfSideLength = 10) {
const rlat = halfSideLength / EARTHS_RADIUS * r2d;
const rlng = rlat / Math.cos(lat * d2r);
const topLeft = [lng - rlng, lat + rlat];
const topRight = [lng + rlng, lat + rlat];
const bottomRight = [lng + rlng, lat - rlat];
const bottomLeft = [lng - rlng, lat - rlat];
return [topLeft, topRight, bottomRight, bottomLeft, topLeft];
}
function isLngLatBoundsArray(array) {
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
}
function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
}
function objectAssign(target, ...sources) {

@@ -476,45 +544,12 @@ for (const source of sources) {

function flatten(data, opt = {}) {
var _a;
const flatArray = (_a = opt.flatArray) != null ? _a : true;
const result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if (Array.isArray(cur) && flatArray) {
const l = cur.length;
for (let i = 0; i < l; i++) {
recurse(cur[i], prop + "[" + i + "]");
}
if (l === 0) result[prop] = [];
} else {
let isEmpty = true;
for (const p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + "." + p : p);
}
if (isEmpty && prop) result[prop] = {};
}
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
const type = isBrowser ? "browser" : "node";
function getGlobalVariable() {
if (isBrowser) {
return window;
} else {
return global;
}
recurse(data, "");
return result;
}
function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function reEscape(s) {

@@ -528,7 +563,2 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function camelize(text, separator = /[_.\- ]/) {

@@ -545,2 +575,7 @@ const words = text.split(separator);

function capitalize(str) {
str = String(str).toLowerCase();
return str[0].toUpperCase() + str.slice(1);
}
function numberWithSpaces(x) {

@@ -552,6 +587,11 @@ const parts = x.toString().split(".");

function round(val, toFixed) {
const n = toFixed ? Number("1e+" + toFixed) : 1;
return Math.round((val + Number.EPSILON) * n) / n;
function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}

@@ -585,12 +625,2 @@ function isAnyJson(val) {

function isObjKey(obj, key) {
if (typeof key === "string" || typeof key === "number") {
return key in obj;
}
return false;
}
function keyInObj(obj, key) {
return isObjKey(obj, key);
}
function isObject(val) {

@@ -603,2 +633,19 @@ return Object.prototype.toString.call(val) === "[object Object]";

function unflatten(data) {
if (Object(data) !== data || Array.isArray(data)) return data;
const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
const flat = {};
for (const p in data) {
let cur = flat;
let prop = "";
let m;
while (m = regex.exec(p)) {
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
prop = m[2] || m[1];
}
cur[prop] = data[p];
}
return flat[""] || flat;
}
function fixUrlStr(url) {

@@ -622,49 +669,2 @@ return url.replace(/([^:]\/)\/+/g, "$1");

var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class Clipboard {
constructor(text) {
__publicField(this, "silent", true);
if (text) {
this.copy(text);
}
}
static copy(text) {
const clipboard = new Clipboard();
return clipboard.copy(text);
}
copy(text) {
try {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else if (window.clipboardData) {
window.clipboardData.setData("text", text);
} else {
this.copyToClipboard(text);
}
!this.silent && console.log("Copied to Clipboard");
return true;
} catch (e) {
!this.silent && console.log("Please copy manually");
}
return false;
}
copyToClipboard(text) {
const input = document.createElement("input");
input.value = text;
try {
document.body.appendChild(input);
this.copyNodeContentsToClipboard(input);
} finally {
document.body.removeChild(input);
}
}
copyNodeContentsToClipboard(input) {
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
}
}
exports.Clipboard = Clipboard;

@@ -671,0 +671,0 @@ exports.DebounceDecorator = DebounceDecorator;

@@ -1,2 +0,2 @@

var Utils=function(t){"use strict";const e="undefined"!=typeof window&&void 0!==window.document,n=e?"browser":"node";function r(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyNames(t);for(let t=0;t<n.length;t++)-1==e.indexOf(n[t])&&e.push(n[t])}return e}(t)}function o(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))}function i(t){return null!=t}function c(t,e=10){let n;function r(...o){r.clear(),n=setTimeout((()=>{n=null,t.apply(this,o)}),e)}return r.clear=function(){n&&(clearTimeout(n),n=null)},r}var a=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);const u=6371;function f(t){return{type:"Polygon",coordinates:[l(t)]}}function l(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}const p=Math.PI/180,y=180/Math.PI;function g(t,e,n=10,r=6){const o=n/u*y,i=o/Math.cos(e*p),c=[];for(let a=0;a<r+1;a++){const n=Math.PI*(a/(r/2)),s=t+i*Math.cos(n),u=e+o*Math.sin(n);c.push([s,u])}return c}const d=Math.PI/180,h=180/Math.PI;function b(t,e){m(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const n of t.coordinates)n.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)n.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const n of t.coordinates)e(n);return t}))}function m(t,e){if("FeatureCollection"===t.type)for(const n of t.features)e(n.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function j(t,e,n,r){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===n?e===r:P(t,e));return t===e}function P(t,e){const n=Object.keys(t).sort(),r=Object.keys(e).sort();if(n.length!==r.length)return!1;if(n.join("")!==r.join(""))return!1;for(let o=0;o<n.length;o++){if(!j(t[n[o]],e[r[o]],t,e))return!1}return!0}function O(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(w(t)?A(t):!!C(t)&&M(t))}function M(t){return!!C(t)&&t.every(O)}function A(t){if(w(t))for(const e in t)if(!O(e))return!1;return!1}function v(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function w(t){return"[object Object]"===Object.prototype.toString.call(t)}function C(t){return"[object Array]"===Object.prototype.toString.call(t)}var E=Object.defineProperty,S=(t,e,n)=>((t,e,n)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class L{constructor(t){S(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new L).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),!this.silent&&console.log("Copied to Clipboard"),!0}catch(e){!this.silent&&console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}return t.Clipboard=L,t.DebounceDecorator=function(t=10){return function(e,n,r){return{configurable:!0,enumerable:r.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:r.enumerable,value:c(r.value,t)}),this[n]}}}},t.EARTHS_RADIUS=u,t.Events=class{constructor(t){this.emitter=t,s(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}},t.allProperties=r,t.applyMixins=function(t,e,n={}){const o=r(t.prototype),i=void 0===n.replace||n.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!i&&!r||i){const r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&Object.defineProperty(t.prototype,n,r)}}))}))},t.arrayChunk=function(t,e){return Array.from({length:Math.ceil(t.length/e)},((n,r)=>t.slice(r*e,r*e+e)))},t.arrayCompare=function(t,e){return o(t=Array.from(t).sort(),e=Array.from(e).sort())},t.arrayCompareStrict=function(t,e){return o(t=Array.from(t),e=Array.from(e))},t.arrayUnique=function(t){return t.filter(((t,e,n)=>n.indexOf(t)==e))},t.camelize=function(t,e=/[_.\- ]/){const n=t.split(e);let r="";for(let o=0;o<n.length;o++){const t=n[o];r+=t.charAt(0).toUpperCase()+t.slice(1)}return r},t.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},t.checkExtent=function(t){const[e,n,r,o]=t,i=e<r&&n<o;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${n}, ${r}, ${o}]`);const t=[Math.min(e,r),Math.min(n,o),Math.max(e,r),Math.max(o,n)];console.log(`Expected order: [${t.join(", ")}]`)}const c=e>=-180&&r<=180,a=n>=-90&&o<=90;return c&&a||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&c&&a},t.coordinatesCount=function(t){let e=0;return b(t,(()=>e++)),e},t.debounce=c,t.debugLog=function(t){return!1},t.deepmerge=function t(e,n,r=!1){let o=e;const i=n,c=Array.isArray(i);let a=c&&[]||{};return c&&Array.isArray(i)?r?(o=o||[],a=a.concat(o),i.forEach(((e,n)=>{void 0===a[n]?a[n]=e:"object"==typeof e?a[n]=t(o[n],e,r):-1===o.indexOf(e)&&a.push(e)}))):a=i:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){a[t]=o[t]})),Object.keys(i).forEach((function(e){a[e]="object"==typeof i[e]&&i[e]&&"object"==typeof o[e]&&"object"==typeof i[e]?t(o[e],i[e],r):i[e]}))),a},t.defined=i,t.degrees2Radian=function(t){return t*Math.PI/180},t.degrees2meters=function(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const n=20037508.34*t/180;let r=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return r=20037508.34*r/180,[n,r]},t.deprecatedMapClick=function(t){if(!t.lngLat&&t.latLng){t.lngLat=[t.latLng.lng,t.latLng.lat]}return t},t.deprecatedWarn=function(t){console.warn(`DEPRECATED WARN: ${t}`)},t.eachCoordinates=b,t.eachGeometry=m,t.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},t.flatten=function(t,e={}){var n;const r=null==(n=e.flatArray)||n,o={};return function t(e,n){if(Object(e)!==e)o[n]=e;else if(Array.isArray(e)&&r){const r=e.length;for(let o=0;o<r;o++)t(e[o],n+"["+o+"]");0===r&&(o[n]=[])}else{let r=!0;for(const o in e)r=!1,t(e[o],n?n+"."+o:o);r&&n&&(o[n]={})}}(t,""),o},t.full=function(t){return"string"==typeof t?!!t:i(t)},t.getBoundsCoordinates=l,t.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:f(t)}},t.getBoundsPolygon=f,t.getCircleFeature=function(t,e,n=10,r=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[g(t,e,n,r)]}}},t.getCirclePolygonCoordinates=g,t.getCoordinates=function(t){const e=[];return b(t,(t=>e.push(t))),e},t.getGlobalVariable=function(){return e?window:global},t.getIdentifyRadius=function(t,e,n){return(n=null!=n?n:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4},t.getPolygons=function(t){const e=[];return m(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)for(const t of n)e.push(t);return t})),e},t.getSquarePolygonCoordinates=function(t,e,n=10){const r=n/u*h,o=r/Math.cos(e*d),i=[t-o,e+r];return[i,[t+o,e+r],[t+o,e-r],[t-o,e-r],i]},t.isAnyJson=O,t.isArray=C,t.isBrowser=e,t.isJsonArray=M,t.isJsonMap=A,t.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))},t.isObjKey=v,t.isObject=w,t.keyInObj=function(t,e){return v(t,e)},t.latLngToLngLatArray=function(t){return[t.lng,t.lat]},t.lngLatArrayToLatLng=function(t){return{lat:t[1],lng:t[0]}},t.meters2degrees=function(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]},t.mixinProperties=function(t,e,n){n.forEach((n=>{const r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&Object.defineProperty(t.prototype,n,r)}))},t.numberWithSpaces=function(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")},t.objectAssign=function(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]},t.objectDeepEqual=P,t.objectRemoveEmpty=function t(e){const n={};return Object.keys(e).forEach((r=>{e[r]instanceof Array||e[r]!==Object(e[r])?void 0!==e[r]&&(n[r]=e[r]):n[r]=t(e[r])})),n},t.reEscape=function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},t.round=function(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n},t.sleep=function(t=0){return new Promise((e=>setTimeout(e,t)))},t.type=n,t.unflatten=function(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const r in t){let o,i=n,c="";for(;o=e.exec(r);)i=i[c]||(i[c]=o[2]?[]:{}),c=o[2]||o[1];i[c]=t[r]}return n[""]||n},t.updateUrlParams=function(t,e){const n=new URL(t),r=new URLSearchParams(n.search);Object.entries(e).forEach((([t,e])=>{void 0===e?r.delete(t):r.set(t,e)})),r.set("timestamp",String((new Date).getTime()));const o=[...r.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${n.origin}${n.pathname}?${o}`},t}({});
var Utils=function(t){"use strict";function e(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyNames(t);for(let t=0;t<n.length;t++)-1==e.indexOf(n[t])&&e.push(n[t])}return e}(t)}function n(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))}var r=Object.defineProperty,o=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);class i{constructor(t){o(this,"silent",!0),t&&this.copy(t)}static copy(t){return(new i).copy(t)}copy(t){try{return navigator.clipboard?navigator.clipboard.writeText(t):window.clipboardData?window.clipboardData.setData("text",t):this.copyToClipboard(t),this.silent||console.log("Copied to Clipboard"),!0}catch(e){this.silent||console.log("Please copy manually")}return!1}copyToClipboard(t){const e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}}copyNodeContentsToClipboard(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}}function c(t,e=10){let n;function r(...o){r.clear(),n=setTimeout((()=>{n=null,t.apply(this,o)}),e)}return r.clear=function(){n&&(clearTimeout(n),n=null)},r}function a(t){return null!=t}var s=Object.defineProperty,u=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,e+"",n);const f=6371;function l(t,e){p(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const n of t.coordinates)n.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)n.forEach((t=>t.forEach((t=>e(t)))));else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(const n of t.coordinates)e(n);return t}))}function p(t,e){if("FeatureCollection"===t.type)for(const n of t.features)e(n.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function y(t){return{type:"Polygon",coordinates:[g(t)]}}function g(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}const d=Math.PI/180,h=180/Math.PI;function b(t,e,n=10,r=6){const o=n/f*h,i=o/Math.cos(e*d),c=[];for(let a=0;a<r+1;a++){const n=Math.PI*(a/(r/2)),s=t+i*Math.cos(n),u=e+o*Math.sin(n);c.push([s,u])}return c}const m=Math.PI/180,j=180/Math.PI;function P(t,e,n,r){if(t instanceof Array)return e instanceof Array&&e.sort().join("")===t.sort().join("");if(t instanceof Date)return e instanceof Date&&""+t==""+e;if(t instanceof Function){if(!(e instanceof Function))return!1}else if(t instanceof Object)return e instanceof Object&&(t===n?e===r:O(t,e));return t===e}function O(t,e){const n=Object.keys(t).sort(),r=Object.keys(e).sort();if(n.length!==r.length)return!1;if(n.join("")!==r.join(""))return!1;for(let o=0;o<n.length;o++){if(!P(t[n[o]],e[r[o]],t,e))return!1}return!0}const M="undefined"!=typeof window&&void 0!==window.document,A=M?"browser":"node";function v(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function w(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(S(t)?E(t):!!L(t)&&C(t))}function C(t){return!!L(t)&&t.every(w)}function E(t){if(S(t))for(const e in t)if(!w(e))return!1;return!1}function S(t){return"[object Object]"===Object.prototype.toString.call(t)}function L(t){return"[object Array]"===Object.prototype.toString.call(t)}return t.Clipboard=i,t.DebounceDecorator=function(t=10){return function(e,n,r){return{configurable:!0,enumerable:r.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:r.enumerable,value:c(r.value,t)}),this[n]}}}},t.EARTHS_RADIUS=f,t.Events=class{constructor(t){this.emitter=t,u(this,"_eventsStatus",{})}setEventStatus(t,e){this._eventsStatus[t]=e}onLoad(t){const e=(Array.isArray(t)?t:[t]).map((t=>new Promise((e=>{if(this.getEventStatus(t))e(this);else{this.emitter.once(t,(()=>{this.setEventStatus(t,!0),e(this)}))}}))));return Promise.all(e).then((()=>this))}getEventStatus(t){const e=this._eventsStatus[t];return void 0!==e&&!!e}},t.allProperties=e,t.applyMixins=function(t,n,r={}){const o=e(t.prototype),i=void 0===r.replace||r.replace;n.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!i&&!r||i){const r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&Object.defineProperty(t.prototype,n,r)}}))}))},t.arrayChunk=function(t,e){return Array.from({length:Math.ceil(t.length/e)},((n,r)=>t.slice(r*e,r*e+e)))},t.arrayCompare=function(t,e){return n(t=Array.from(t).sort(),e=Array.from(e).sort())},t.arrayCompareStrict=function(t,e){return n(t=Array.from(t),e=Array.from(e))},t.arrayUnique=function(t){return t.filter(((t,e,n)=>n.indexOf(t)==e))},t.camelize=function(t,e=/[_.\- ]/){const n=t.split(e);let r="";for(let o=0;o<n.length;o++){const t=n[o];r+=t.charAt(0).toUpperCase()+t.slice(1)}return r},t.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},t.checkExtent=function(t){const[e,n,r,o]=t,i=e<r&&n<o;if(!i){console.log("Error: The extent coordinates are not in the correct order."),console.log(`Received extent: [${e}, ${n}, ${r}, ${o}]`);const t=[Math.min(e,r),Math.min(n,o),Math.max(e,r),Math.max(o,n)];console.log(`Expected order: [${t.join(", ")}]`)}const c=e>=-180&&r<=180,a=n>=-90&&o<=90;return c&&a||console.log("Warning: The coordinates may not be within valid geographic ranges."),i&&c&&a},t.coordinatesCount=function(t){let e=0;return l(t,(()=>e++)),e},t.debounce=c,t.debugLog=function(t){return!1},t.deepmerge=function t(e,n,r=!1){let o=e;const i=n,c=Array.isArray(i);let a=c&&[]||{};return c&&Array.isArray(i)?r?(o=o||[],a=a.concat(o),i.forEach(((e,n)=>{void 0===a[n]?a[n]=e:"object"==typeof e?a[n]=t(o[n],e,r):-1===o.indexOf(e)&&a.push(e)}))):a=i:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){a[t]=o[t]})),Object.keys(i).forEach((function(e){a[e]="object"==typeof i[e]&&i[e]&&"object"==typeof o[e]&&"object"==typeof i[e]?t(o[e],i[e],r):i[e]}))),a},t.defined=a,t.degrees2Radian=function(t){return t*Math.PI/180},t.degrees2meters=function(t,e){e=e>85.06?85.06:e<-85.06?-85.06:e;const n=20037508.34*t/180;let r=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return r=20037508.34*r/180,[n,r]},t.deprecatedMapClick=function(t){if(!t.lngLat&&t.latLng){t.lngLat=[t.latLng.lng,t.latLng.lat]}return t},t.deprecatedWarn=function(t){console.warn(`DEPRECATED WARN: ${t}`)},t.eachCoordinates=l,t.eachGeometry=p,t.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},t.flatten=function(t,e={}){var n;const r=null==(n=e.flatArray)||n,o={};return function t(e,n){if(Object(e)!==e)o[n]=e;else if(Array.isArray(e)&&r){const r=e.length;for(let o=0;o<r;o++)t(e[o],n+"["+o+"]");0===r&&(o[n]=[])}else{let r=!0;for(const o in e)r=!1,t(e[o],n?n+"."+o:o);r&&n&&(o[n]={})}}(t,""),o},t.full=function(t){return"string"==typeof t?!!t:a(t)},t.getBoundsCoordinates=g,t.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:y(t)}},t.getBoundsPolygon=y,t.getCircleFeature=function(t,e,n=10,r=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[b(t,e,n,r)]}}},t.getCirclePolygonCoordinates=b,t.getCoordinates=function(t){const e=[];return l(t,(t=>e.push(t))),e},t.getGlobalVariable=function(){return M?window:global},t.getIdentifyRadius=function(t,e,n){return(n=null!=n?n:10)*(40075016.686*Math.abs(Math.cos(180*t[1]/Math.PI))/Math.pow(2,e+8))*5e-4},t.getPolygons=function(t){const e=[];return p(t,(t=>{if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((t=>e.push(t)));else if("MultiPolygon"===t.type)for(const n of t.coordinates)for(const t of n)e.push(t);return t})),e},t.getSquarePolygonCoordinates=function(t,e,n=10){const r=n/f*j,o=r/Math.cos(e*m),i=[t-o,e+r];return[i,[t+o,e+r],[t+o,e-r],[t-o,e-r],i]},t.isAnyJson=w,t.isArray=L,t.isBrowser=M,t.isJsonArray=C,t.isJsonMap=E,t.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))},t.isObjKey=v,t.isObject=S,t.keyInObj=function(t,e){return v(t,e)},t.latLngToLngLatArray=function(t){return[t.lng,t.lat]},t.lngLatArrayToLatLng=function(t){return{lat:t[1],lng:t[0]}},t.meters2degrees=function(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]},t.mixinProperties=function(t,e,n){n.forEach((n=>{const r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&Object.defineProperty(t.prototype,n,r)}))},t.numberWithSpaces=function(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")},t.objectAssign=function(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]},t.objectDeepEqual=O,t.objectRemoveEmpty=function t(e){const n={};return Object.keys(e).forEach((r=>{e[r]instanceof Array||e[r]!==Object(e[r])?void 0!==e[r]&&(n[r]=e[r]):n[r]=t(e[r])})),n},t.reEscape=function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},t.round=function(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n},t.sleep=function(t=0){return new Promise((e=>setTimeout(e,t)))},t.type=A,t.unflatten=function(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const r in t){let o,i=n,c="";for(;o=e.exec(r);)i=i[c]||(i[c]=o[2]?[]:{}),c=o[2]||o[1];i[c]=t[r]}return n[""]||n},t.updateUrlParams=function(t,e){const n=new URL(t),r=new URLSearchParams(n.search);Object.entries(e).forEach((([t,e])=>{void 0===e?r.delete(t):r.set(t,e)})),r.set("timestamp",String((new Date).getTime()));const o=[...r.entries()].map((([t,e])=>`${t}=${e}`)).join("&");return`${n.origin}${n.pathname}?${o}`},t}({});
//# sourceMappingURL=utils.global.prod.js.map
{
"name": "@nextgis/utils",
"version": "3.0.0-alpha.5",
"version": "3.0.0-alpha.13",
"description": "Common development tools",

@@ -12,3 +12,3 @@ "main": "index.js",

"devDependencies": {
"@nextgis/build-tools": "^3.0.0-alpha.5",
"@nextgis/build-tools": "^3.0.0-alpha.13",
"@types/geojson": "^7946.0.14"

@@ -50,3 +50,3 @@ },

},
"gitHead": "ab9ec6499222f3cb0cd51375be333381594c7bbf"
"gitHead": "5906588a63866935106f597726dd16da682784ef"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc