@nextgis/utils
Advanced tools
Comparing version 1.7.0 to 1.8.2
@@ -137,4 +137,8 @@ /// <reference types="node" /> | ||
export declare function flatten(data: Record<string, any>): Record<string, any>; | ||
export declare function flatten(data: Record<string, any>, opt?: FlattenOptions): Record<string, any>; | ||
export declare interface FlattenOptions { | ||
flatArray?: boolean; | ||
} | ||
/** | ||
@@ -141,0 +145,0 @@ * from https://github.com/CesiumGS/cesium/blob/master/Source/Core/defined.js |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/utils; version: 1.7.0; author: NextGIS */ | ||
/** Bundle of @nextgis/utils; version: 1.8.2; author: NextGIS */ | ||
'use strict'; | ||
@@ -532,3 +532,5 @@ | ||
function flatten(data) { | ||
function flatten(data, opt = {}) { | ||
var _a; | ||
const flatArray = (_a = opt.flatArray) !== null && _a !== void 0 ? _a : true; | ||
const result = {}; | ||
@@ -539,3 +541,3 @@ function recurse(cur, prop) { | ||
} | ||
else if (Array.isArray(cur)) { | ||
else if (Array.isArray(cur) && flatArray) { | ||
const l = cur.length; | ||
@@ -542,0 +544,0 @@ for (let i = 0; i < l; i++) { |
@@ -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 s(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 i(t){return{type:"Polygon",coordinates:[c(t)]}}function c(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}const a=Math.PI/180,u=180/Math.PI;function p(t,e,o=10,r=6){const n=o/6371*u,s=n/Math.cos(e*a),i=[];for(let o=0;o<r+1;o++){const c=Math.PI*(o/(r/2)),a=t+s*Math.cos(c),u=e+n*Math.sin(c);i.push([a,u])}return i}function f(t,e){l(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 l(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 y(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:d(t,e));return t===e}function d(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(!y(t[o[n]],e[r[n]],t,e))return!1}return!0}function g(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(m(t)?x(t):!!j(t)&&h(t))}function h(t){return!!j(t)&&t.every(g)}function x(t){if(m(t))for(const e in t)if(!g(e))return!1;return!1}function b(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function m(t){return"[object Object]"===Object.prototype.toString.call(t)}function j(t){return"[object Array]"===Object.prototype.toString.call(t)}class O{constructor(t){this.silent=!0,t&&this.copy(t)}static copy(t){return(new O).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(t){!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=O,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:s(r.value,t)}),this[o]}}}},exports.EARTHS_RADIUS=6371,exports.Events=class{constructor(t){this.emitter=t,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),s=void 0===r.replace||r.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((o=>{const r=-1!==n.indexOf(o);if(!s&&!r||s){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){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((t,e)=>e.toLocaleUpperCase())).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(t=>t.toLocaleUpperCase()))},exports.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},exports.coordinatesCount=function(t){let e=0;return f(t,(()=>e++)),e},exports.debounce=s,exports.debugLog=function(t){return!1},exports.deepmerge=function t(e,o,r=!1){let n=e;const s=o,i=Array.isArray(s);let c=i&&[]||{};return i&&Array.isArray(s)?r?(n=n||[],c=c.concat(n),s.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=s:(n&&"object"==typeof n&&Object.keys(n).forEach((function(t){c[t]=n[t]})),Object.keys(s).forEach((function(e){c[e]="object"==typeof s[e]&&s[e]&&"object"==typeof n[e]&&"object"==typeof s[e]?t(n[e],s[e],r):s[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=f,exports.eachGeometry=l,exports.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},exports.flatten=function(t){const e={};return function t(o,r){if(Object(o)!==o)e[r]=o;else if(Array.isArray(o)){const n=o.length;for(let e=0;e<n;e++)t(o[e],r+"["+e+"]");0===n&&(e[r]=[])}else{let n=!0;for(const e in o)n=!1,t(o[e],r?r+"."+e:e);n&&r&&(e[r]={})}}(t,""),e},exports.full=function(t){return"string"==typeof t?!!t:n(t)},exports.getBoundsCoordinates=c,exports.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:i(t)}},exports.getBoundsPolygon=i,exports.getCircleFeature=function(t,e,o=10,r=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[p(t,e,o,r)]}}},exports.getCirclePolygonCoordinates=p,exports.getCoordinates=function(t){const e=[];return f(t,(t=>e.push(t))),e},exports.getGlobalVariable=function(){return t?window:global},exports.getPolygons=function(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 o of t.coordinates)for(const t of o)e.push(t);return t})),e},exports.isAnyJson=g,exports.isArray=j,exports.isBrowser=t,exports.isJsonArray=h,exports.isJsonMap=x,exports.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))},exports.isObjKey=b,exports.isObject=m,exports.keyInObj=function(t,e){return b(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=d,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,s=o,i="";for(;n=e.exec(r);)s=s[i]||(s[i]=n[2]?[]:{}),i=n[2]||n[1];s[i]=t[r]}return o[""]||o}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t="undefined"!=typeof window&&void 0!==window.document,e=t?"browser":"node";function r(t){return function(t,e=[]){for(;null!==t;t=Object.getPrototypeOf(t)){const r=Object.getOwnPropertyNames(t);for(let t=0;t<r.length;t++)-1==e.indexOf(r[t])&&e.push(r[t])}return e}(t)}function o(t,e){return t.length===e.length&&t.every((function(t,r){return t===e[r]}))}function n(t){return null!=t}function i(t,e=10){let r;function o(...n){o.clear(),r=setTimeout((()=>{r=null,t.apply(this,n)}),e)}return o.clear=function(){r&&(clearTimeout(r),r=null)},o}function s(t){return{type:"Polygon",coordinates:[c(t)]}}function c(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}const a=Math.PI/180,u=180/Math.PI;function p(t,e,r=10,o=6){const n=r/6371*u,i=n/Math.cos(e*a),s=[];for(let r=0;r<o+1;r++){const c=Math.PI*(r/(o/2)),a=t+i*Math.cos(c),u=e+n*Math.sin(c);s.push([a,u])}return s}function f(t,e){l(t,(t=>{if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(const r of t.coordinates)r.forEach((t=>e(t)));else if("MultiPolygon"===t.type)for(const r of t.coordinates)r.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 r of t.coordinates)e(r);return t}))}function l(t,e){if("FeatureCollection"===t.type)for(const r of t.features)e(r.geometry);else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function y(t,e,r,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===r?e===o:d(t,e));return t===e}function d(t,e){const r=Object.keys(t).sort(),o=Object.keys(e).sort();if(r.length!==o.length)return!1;if(r.join("")!==o.join(""))return!1;for(let n=0;n<r.length;n++){if(!y(t[r[n]],e[o[n]],t,e))return!1}return!0}function g(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(m(t)?x(t):!!j(t)&&h(t))}function h(t){return!!j(t)&&t.every(g)}function x(t){if(m(t))for(const e in t)if(!g(e))return!1;return!1}function b(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function m(t){return"[object Object]"===Object.prototype.toString.call(t)}function j(t){return"[object Array]"===Object.prototype.toString.call(t)}class O{constructor(t){this.silent=!0,t&&this.copy(t)}static copy(t){return(new O).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(t){!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=O,exports.DebounceDecorator=function(t=10){return function(e,r,o){return{configurable:!0,enumerable:o.enumerable,get:function(){return Object.defineProperty(this,r,{configurable:!0,enumerable:o.enumerable,value:i(o.value,t)}),this[r]}}}},exports.EARTHS_RADIUS=6371,exports.Events=class{constructor(t){this.emitter=t,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=r,exports.applyMixins=function(t,e,o={}){const n=r(t.prototype),i=void 0===o.replace||o.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((r=>{const o=-1!==n.indexOf(r);if(!i&&!o||i){const o=Object.getOwnPropertyDescriptor(e.prototype,r);o&&Object.defineProperty(t.prototype,r,o)}}))}))},exports.arrayChunk=function(t,e){return Array.from({length:Math.ceil(t.length/e)},((r,o)=>t.slice(o*e,o*e+e)))},exports.arrayCompare=function(t,e){return o(t=Array.from(t).sort(),e=Array.from(e).sort())},exports.arrayCompareStrict=function(t,e){return o(t=Array.from(t),e=Array.from(e))},exports.arrayUnique=function(t){return t.filter(((t,e,r)=>r.indexOf(t)==e))},exports.camelize=function(t){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((t,e)=>e.toLocaleUpperCase())).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(t=>t.toLocaleUpperCase()))},exports.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},exports.coordinatesCount=function(t){let e=0;return f(t,(()=>e++)),e},exports.debounce=i,exports.debugLog=function(t){return!1},exports.deepmerge=function t(e,r,o=!1){let n=e;const i=r,s=Array.isArray(i);let c=s&&[]||{};return s&&Array.isArray(i)?o?(n=n||[],c=c.concat(n),i.forEach(((e,r)=>{void 0===c[r]?c[r]=e:"object"==typeof e?c[r]=t(n[r],e,o):-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],o):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 r=20037508.34*t/180;let o=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return o=20037508.34*o/180,[r,o]},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=f,exports.eachGeometry=l,exports.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},exports.flatten=function(t,e={}){var r;const o=null===(r=e.flatArray)||void 0===r||r,n={};return function t(e,r){if(Object(e)!==e)n[r]=e;else if(Array.isArray(e)&&o){const o=e.length;for(let n=0;n<o;n++)t(e[n],r+"["+n+"]");0===o&&(n[r]=[])}else{let o=!0;for(const n in e)o=!1,t(e[n],r?r+"."+n:n);o&&r&&(n[r]={})}}(t,""),n},exports.full=function(t){return"string"==typeof t?!!t:n(t)},exports.getBoundsCoordinates=c,exports.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:s(t)}},exports.getBoundsPolygon=s,exports.getCircleFeature=function(t,e,r=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[p(t,e,r,o)]}}},exports.getCirclePolygonCoordinates=p,exports.getCoordinates=function(t){const e=[];return f(t,(t=>e.push(t))),e},exports.getGlobalVariable=function(){return t?window:global},exports.getPolygons=function(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 r of t.coordinates)for(const t of r)e.push(t);return t})),e},exports.isAnyJson=g,exports.isArray=j,exports.isBrowser=t,exports.isJsonArray=h,exports.isJsonMap=x,exports.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))},exports.isObjKey=b,exports.isObject=m,exports.keyInObj=function(t,e){return b(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,r){r.forEach((r=>{const o=Object.getOwnPropertyDescriptor(e.prototype,r);o&&Object.defineProperty(t.prototype,r,o)}))},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 r of e)for(const e of Object.getOwnPropertyNames(r))t[e]=r[e]},exports.objectDeepEqual=d,exports.objectRemoveEmpty=function t(e){const r={};return Object.keys(e).forEach((o=>{e[o]instanceof Array||e[o]!==Object(e[o])?void 0!==e[o]&&(r[o]=e[o]):r[o]=t(e[o])})),r},exports.reEscape=function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},exports.round=function(t,e){const r=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*r)/r},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,r={};for(const o in t){let n,i=r,s="";for(;n=e.exec(o);)i=i[s]||(i[s]=n[2]?[]:{}),s=n[2]||n[1];i[s]=t[o]}return r[""]||r}; | ||
//# sourceMappingURL=utils.cjs.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/utils; version: 1.7.0; author: NextGIS */ | ||
/** Bundle of @nextgis/utils; version: 1.8.2; author: NextGIS */ | ||
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; | ||
@@ -528,3 +528,5 @@ const type = isBrowser ? 'browser' : 'node'; | ||
function flatten(data) { | ||
function flatten(data, opt = {}) { | ||
var _a; | ||
const flatArray = (_a = opt.flatArray) !== null && _a !== void 0 ? _a : true; | ||
const result = {}; | ||
@@ -535,3 +537,3 @@ function recurse(cur, prop) { | ||
} | ||
else if (Array.isArray(cur)) { | ||
else if (Array.isArray(cur) && flatArray) { | ||
const l = cur.length; | ||
@@ -538,0 +540,0 @@ for (let i = 0; i < l; i++) { |
@@ -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),c=void 0===n.replace||n.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!c&&!r||c){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 c(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function i(t,e){return a(t=Array.from(t).sort(),e=Array.from(e).sort())}function u(t,e){return a(t=Array.from(t),e=Array.from(e))}function a(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,c=Array.isArray(r);let i=c&&[]||{};return c&&Array.isArray(r)?n?(o=o||[],i=i.concat(o),r.forEach(((t,e)=>{void 0===i[e]?i[e]=t:"object"==typeof t?i[e]=y(o[e],t,n):-1===o.indexOf(t)&&i.push(t)}))):i=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){i[t]=o[t]})),Object.keys(r).forEach((function(t){i[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?y(o[t],r[t],n):r[t]}))),i}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]}}}}class j{constructor(t){this.emitter=t,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 O(t){return[t.lng,t.lat]}function P(t){return{lat:t[1],lng:t[0]}}const A=6371;function w(t){return{type:"Polygon",coordinates:[v(t)]}}function v(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function M(t){return{type:"Feature",properties:{},geometry:w(t)}}const E=Math.PI/180,C=180/Math.PI;function S(t,e,n=10,o=6){const r=n/6371*C,c=r/Math.cos(e*E),i=[];for(let n=0;n<o+1;n++){const u=Math.PI*(n/(o/2)),a=t+c*Math.cos(u),s=e+r*Math.sin(u);i.push([a,s])}return i}function L(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[S(t,e,n,o)]}}}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 x(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function D(t){return t*Math.PI/180}function I(t){let e=0;return _(t,(()=>e++)),e}function T(t){const e=[];return _(t,(t=>e.push(t))),e}function _(t,e){$(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 F(t){const e=[];return $(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 $(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 k(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function R(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function U(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:B(t,e));return t===e}function B(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(!U(t[n[r]],e[o[r]],t,e))return!1}return!0}function W(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]=W(t[n])})),e}function q(t){const e={};return function t(n,o){if(Object(n)!==n)e[o]=n;else if(Array.isArray(n)){const r=n.length;for(let e=0;e<r;e++)t(n[e],o+"["+e+"]");0===r&&(e[o]=[])}else{let r=!0;for(const e in n)r=!1,t(n[e],o?o+"."+e:e);r&&o&&(e[o]={})}}(t,""),e}function z(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,c=n,i="";for(;r=e.exec(o);)c=c[i]||(c[i]=r[2]?[]:{}),i=r[2]||r[1];c[i]=t[o]}return n[""]||n}function G(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function H(t=0){return new Promise((e=>setTimeout(e,t)))}function J(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function K(t){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((t,e)=>e.toLocaleUpperCase())).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(t=>t.toLocaleUpperCase()))}function Q(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function V(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function X(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(nt(t)?Z(t):!!ot(t)&&Y(t))}function Y(t){return!!ot(t)&&t.every(X)}function Z(t){if(nt(t))for(const e in t)if(!X(e))return!1;return!1}function tt(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function et(t,e){return tt(t,e)}function nt(t){return"[object Object]"===Object.prototype.toString.call(t)}function ot(t){return"[object Array]"===Object.prototype.toString.call(t)}function rt(t){return t.replace(/([^:]\/)\/+/g,"$1")}class ct{constructor(t){this.silent=!0,t&&this.copy(t)}static copy(t){return(new ct).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(t){!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{ct as Clipboard,m as DebounceDecorator,A as EARTHS_RADIUS,j as Events,r as allProperties,o as applyMixins,f as arrayChunk,i as arrayCompare,u as arrayCompareStrict,s as arrayUnique,K as camelize,J as capitalize,I as coordinatesCount,b as debounce,h as debugLog,y as deepmerge,l as defined,D as degrees2Radian,N as degrees2meters,g as deprecatedMapClick,d as deprecatedWarn,_ as eachCoordinates,$ as eachGeometry,rt as fixUrlStr,q as flatten,p as full,v as getBoundsCoordinates,M as getBoundsFeature,w as getBoundsPolygon,L as getCircleFeature,S as getCirclePolygonCoordinates,T as getCoordinates,n as getGlobalVariable,F as getPolygons,X as isAnyJson,ot as isArray,t as isBrowser,Y as isJsonArray,Z as isJsonMap,k as isLngLatBoundsArray,tt as isObjKey,nt as isObject,et as keyInObj,O as latLngToLngLatArray,P as lngLatArrayToLatLng,x as meters2degrees,c as mixinProperties,Q as numberWithSpaces,R as objectAssign,B as objectDeepEqual,W as objectRemoveEmpty,G as reEscape,V as round,H as sleep,e as type,z as unflatten}; | ||
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),c=void 0===n.replace||n.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!c&&!r||c){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 c(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function i(t,e){return a(t=Array.from(t).sort(),e=Array.from(e).sort())}function u(t,e){return a(t=Array.from(t),e=Array.from(e))}function a(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,c=Array.isArray(r);let i=c&&[]||{};return c&&Array.isArray(r)?n?(o=o||[],i=i.concat(o),r.forEach(((t,e)=>{void 0===i[e]?i[e]=t:"object"==typeof t?i[e]=y(o[e],t,n):-1===o.indexOf(t)&&i.push(t)}))):i=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){i[t]=o[t]})),Object.keys(r).forEach((function(t){i[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?y(o[t],r[t],n):r[t]}))),i}function h(t){return!1}function d(t){if(!t.lngLat&&t.latLng){t.lngLat=[t.latLng.lng,t.latLng.lat]}return t}function g(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]}}}}class j{constructor(t){this.emitter=t,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 O(t){return[t.lng,t.lat]}function P(t){return{lat:t[1],lng:t[0]}}const A=6371;function v(t){return{type:"Polygon",coordinates:[w(t)]}}function w(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function M(t){return{type:"Feature",properties:{},geometry:v(t)}}const E=Math.PI/180,C=180/Math.PI;function S(t,e,n=10,o=6){const r=n/6371*C,c=r/Math.cos(e*E),i=[];for(let n=0;n<o+1;n++){const u=Math.PI*(n/(o/2)),a=t+c*Math.cos(u),s=e+r*Math.sin(u);i.push([a,s])}return i}function L(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[S(t,e,n,o)]}}}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 x(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function D(t){return t*Math.PI/180}function I(t){let e=0;return _(t,(()=>e++)),e}function T(t){const e=[];return _(t,(t=>e.push(t))),e}function _(t,e){$(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 F(t){const e=[];return $(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 $(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 k(t){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function R(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function U(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:B(t,e));return t===e}function B(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(!U(t[n[r]],e[o[r]],t,e))return!1}return!0}function W(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]=W(t[n])})),e}function q(t,e={}){var n;const o=null===(n=e.flatArray)||void 0===n||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 z(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,c=n,i="";for(;r=e.exec(o);)c=c[i]||(c[i]=r[2]?[]:{}),i=r[2]||r[1];c[i]=t[o]}return n[""]||n}function G(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function H(t=0){return new Promise((e=>setTimeout(e,t)))}function J(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function K(t){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((t,e)=>e.toLocaleUpperCase())).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(t=>t.toLocaleUpperCase()))}function Q(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function V(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function X(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(nt(t)?Z(t):!!ot(t)&&Y(t))}function Y(t){return!!ot(t)&&t.every(X)}function Z(t){if(nt(t))for(const e in t)if(!X(e))return!1;return!1}function tt(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function et(t,e){return tt(t,e)}function nt(t){return"[object Object]"===Object.prototype.toString.call(t)}function ot(t){return"[object Array]"===Object.prototype.toString.call(t)}function rt(t){return t.replace(/([^:]\/)\/+/g,"$1")}class ct{constructor(t){this.silent=!0,t&&this.copy(t)}static copy(t){return(new ct).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(t){!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{ct as Clipboard,m as DebounceDecorator,A as EARTHS_RADIUS,j as Events,r as allProperties,o as applyMixins,f as arrayChunk,i as arrayCompare,u as arrayCompareStrict,s as arrayUnique,K as camelize,J as capitalize,I as coordinatesCount,b as debounce,h as debugLog,y as deepmerge,l as defined,D as degrees2Radian,N as degrees2meters,d as deprecatedMapClick,g as deprecatedWarn,_ as eachCoordinates,$ as eachGeometry,rt as fixUrlStr,q as flatten,p as full,w as getBoundsCoordinates,M as getBoundsFeature,v as getBoundsPolygon,L as getCircleFeature,S as getCirclePolygonCoordinates,T as getCoordinates,n as getGlobalVariable,F as getPolygons,X as isAnyJson,ot as isArray,t as isBrowser,Y as isJsonArray,Z as isJsonMap,k as isLngLatBoundsArray,tt as isObjKey,nt as isObject,et as keyInObj,O as latLngToLngLatArray,P as lngLatArrayToLatLng,x as meters2degrees,c as mixinProperties,Q as numberWithSpaces,R as objectAssign,B as objectDeepEqual,W as objectRemoveEmpty,G as reEscape,V as round,H as sleep,e as type,z as unflatten}; | ||
//# sourceMappingURL=utils.esm-browser.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/utils; version: 1.7.0; author: NextGIS */ | ||
/** Bundle of @nextgis/utils; version: 1.8.2; author: NextGIS */ | ||
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; | ||
@@ -529,3 +529,5 @@ const type = isBrowser ? 'browser' : 'node'; | ||
function flatten(data) { | ||
function flatten(data, opt = {}) { | ||
var _a; | ||
const flatArray = (_a = opt.flatArray) !== null && _a !== void 0 ? _a : true; | ||
const result = {}; | ||
@@ -536,3 +538,3 @@ function recurse(cur, prop) { | ||
} | ||
else if (Array.isArray(cur)) { | ||
else if (Array.isArray(cur) && flatArray) { | ||
const l = cur.length; | ||
@@ -539,0 +541,0 @@ for (let i = 0; i < l; i++) { |
@@ -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),c=void 0===n.replace||n.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!c&&!r||c){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 c(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function i(t,e){return a(t=Array.from(t).sort(),e=Array.from(e).sort())}function u(t,e){return a(t=Array.from(t),e=Array.from(e))}function a(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,c=Array.isArray(r);let i=c&&[]||{};return c&&Array.isArray(r)?n?(o=o||[],i=i.concat(o),r.forEach(((t,e)=>{void 0===i[e]?i[e]=t:"object"==typeof t?i[e]=y(o[e],t,n):-1===o.indexOf(t)&&i.push(t)}))):i=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){i[t]=o[t]})),Object.keys(r).forEach((function(t){i[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?y(o[t],r[t],n):r[t]}))),i}function h(t){return"production"!==process.env.NODE_ENV&&(console.trace("DEBUG: "+t),!0)}function d(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 g(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]}}}}class j{constructor(t){this.emitter=t,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 O(t){return[t.lng,t.lat]}function P(t){return{lat:t[1],lng:t[0]}}const A=6371;function E(t){return{type:"Polygon",coordinates:[v(t)]}}function v(t){const e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function w(t){return{type:"Feature",properties:{},geometry:E(t)}}const M=Math.PI/180,C=180/Math.PI;function L(t,e,n=10,o=6){const r=n/6371*C,c=r/Math.cos(e*M),i=[];for(let n=0;n<o+1;n++){const u=Math.PI*(n/(o/2)),a=t+c*Math.cos(u),s=e+r*Math.sin(u);i.push([a,s])}return i}function S(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[L(t,e,n,o)]}}}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 D(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function x(t){return t*Math.PI/180}function I(t){let e=0;return _(t,(()=>e++)),e}function T(t){const e=[];return _(t,(t=>e.push(t))),e}function _(t,e){F(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 k(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 n of t.coordinates)for(const t of n)e.push(t);return t})),e}function F(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){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function U(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function R(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:B(t,e));return t===e}function B(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(!R(t[n[r]],e[o[r]],t,e))return!1}return!0}function G(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]=G(t[n])})),e}function V(t){const e={};return function t(n,o){if(Object(n)!==n)e[o]=n;else if(Array.isArray(n)){const r=n.length;for(let e=0;e<r;e++)t(n[e],o+"["+e+"]");0===r&&(e[o]=[])}else{let r=!0;for(const e in n)r=!1,t(n[e],o?o+"."+e:e);r&&o&&(e[o]={})}}(t,""),e}function W(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,c=n,i="";for(;r=e.exec(o);)c=c[i]||(c[i]=r[2]?[]:{}),i=r[2]||r[1];c[i]=t[o]}return n[""]||n}function q(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function z(t=0){return new Promise((e=>setTimeout(e,t)))}function H(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function J(t){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((t,e)=>e.toLocaleUpperCase())).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(t=>t.toLocaleUpperCase()))}function K(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function Q(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function X(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(nt(t)?Z(t):!!ot(t)&&Y(t))}function Y(t){return!!ot(t)&&t.every(X)}function Z(t){if(nt(t))for(const e in t)if(!X(e))return!1;return!1}function tt(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function et(t,e){return tt(t,e)}function nt(t){return"[object Object]"===Object.prototype.toString.call(t)}function ot(t){return"[object Array]"===Object.prototype.toString.call(t)}function rt(t){return t.replace(/([^:]\/)\/+/g,"$1")}class ct{constructor(t){this.silent=!0,t&&this.copy(t)}static copy(t){return(new ct).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(t){!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{ct as Clipboard,m as DebounceDecorator,A as EARTHS_RADIUS,j as Events,r as allProperties,o as applyMixins,f as arrayChunk,i as arrayCompare,u as arrayCompareStrict,s as arrayUnique,J as camelize,H as capitalize,I as coordinatesCount,b as debounce,h as debugLog,y as deepmerge,l as defined,x as degrees2Radian,N as degrees2meters,d as deprecatedMapClick,g as deprecatedWarn,_ as eachCoordinates,F as eachGeometry,rt as fixUrlStr,V as flatten,p as full,v as getBoundsCoordinates,w as getBoundsFeature,E as getBoundsPolygon,S as getCircleFeature,L as getCirclePolygonCoordinates,T as getCoordinates,n as getGlobalVariable,k as getPolygons,X as isAnyJson,ot as isArray,t as isBrowser,Y as isJsonArray,Z as isJsonMap,$ as isLngLatBoundsArray,tt as isObjKey,nt as isObject,et as keyInObj,O as latLngToLngLatArray,P as lngLatArrayToLatLng,D as meters2degrees,c as mixinProperties,K as numberWithSpaces,U as objectAssign,B as objectDeepEqual,G as objectRemoveEmpty,q as reEscape,Q as round,z as sleep,e as type,W as unflatten}; | ||
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),c=void 0===n.replace||n.replace;e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{const r=-1!==o.indexOf(n);if(!c&&!r||c){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 c(t,e,n){n.forEach((n=>{const o=Object.getOwnPropertyDescriptor(e.prototype,n);o&&Object.defineProperty(t.prototype,n,o)}))}function i(t,e){return a(t=Array.from(t).sort(),e=Array.from(e).sort())}function u(t,e){return a(t=Array.from(t),e=Array.from(e))}function a(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,c=Array.isArray(r);let i=c&&[]||{};return c&&Array.isArray(r)?n?(o=o||[],i=i.concat(o),r.forEach(((t,e)=>{void 0===i[e]?i[e]=t:"object"==typeof t?i[e]=y(o[e],t,n):-1===o.indexOf(t)&&i.push(t)}))):i=r:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){i[t]=o[t]})),Object.keys(r).forEach((function(t){i[t]="object"==typeof r[t]&&r[t]&&"object"==typeof o[t]&&"object"==typeof r[t]?y(o[t],r[t],n):r[t]}))),i}function h(t){return"production"!==process.env.NODE_ENV&&(console.trace("DEBUG: "+t),!0)}function d(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 g(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]}}}}class j{constructor(t){this.emitter=t,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 O(t){return[t.lng,t.lat]}function P(t){return{lat:t[1],lng:t[0]}}const A=6371;function v(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 w(t){return{type:"Feature",properties:{},geometry:v(t)}}const M=Math.PI/180,C=180/Math.PI;function L(t,e,n=10,o=6){const r=n/6371*C,c=r/Math.cos(e*M),i=[];for(let n=0;n<o+1;n++){const u=Math.PI*(n/(o/2)),a=t+c*Math.cos(u),s=e+r*Math.sin(u);i.push([a,s])}return i}function S(t,e,n=10,o=6){return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[L(t,e,n,o)]}}}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 D(t,e){return[180*t/20037508.34,360*Math.atan(Math.exp(e*Math.PI/20037508.34))/Math.PI-90]}function x(t){return t*Math.PI/180}function I(t){let e=0;return _(t,(()=>e++)),e}function T(t){const e=[];return _(t,(t=>e.push(t))),e}function _(t,e){F(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 k(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 n of t.coordinates)for(const t of n)e.push(t);return t})),e}function F(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){return Array.isArray(t)&&4===t.length&&t.every((t=>"number"==typeof t))}function U(t,...e){for(const n of e)for(const e of Object.getOwnPropertyNames(n))t[e]=n[e]}function R(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:B(t,e));return t===e}function B(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(!R(t[n[r]],e[o[r]],t,e))return!1}return!0}function G(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]=G(t[n])})),e}function V(t,e={}){var n;const o=null===(n=e.flatArray)||void 0===n||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 W(t){if(Object(t)!==t||Array.isArray(t))return t;const e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(const o in t){let r,c=n,i="";for(;r=e.exec(o);)c=c[i]||(c[i]=r[2]?[]:{}),i=r[2]||r[1];c[i]=t[o]}return n[""]||n}function q(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function z(t=0){return new Promise((e=>setTimeout(e,t)))}function H(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)}function J(t){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((t,e)=>e.toLocaleUpperCase())).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(t=>t.toLocaleUpperCase()))}function K(t){const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}function Q(t,e){const n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n}function X(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(nt(t)?Z(t):!!ot(t)&&Y(t))}function Y(t){return!!ot(t)&&t.every(X)}function Z(t){if(nt(t))for(const e in t)if(!X(e))return!1;return!1}function tt(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function et(t,e){return tt(t,e)}function nt(t){return"[object Object]"===Object.prototype.toString.call(t)}function ot(t){return"[object Array]"===Object.prototype.toString.call(t)}function rt(t){return t.replace(/([^:]\/)\/+/g,"$1")}class ct{constructor(t){this.silent=!0,t&&this.copy(t)}static copy(t){return(new ct).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(t){!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{ct as Clipboard,m as DebounceDecorator,A as EARTHS_RADIUS,j as Events,r as allProperties,o as applyMixins,f as arrayChunk,i as arrayCompare,u as arrayCompareStrict,s as arrayUnique,J as camelize,H as capitalize,I as coordinatesCount,b as debounce,h as debugLog,y as deepmerge,l as defined,x as degrees2Radian,N as degrees2meters,d as deprecatedMapClick,g as deprecatedWarn,_ as eachCoordinates,F as eachGeometry,rt as fixUrlStr,V as flatten,p as full,E as getBoundsCoordinates,w as getBoundsFeature,v as getBoundsPolygon,S as getCircleFeature,L as getCirclePolygonCoordinates,T as getCoordinates,n as getGlobalVariable,k as getPolygons,X as isAnyJson,ot as isArray,t as isBrowser,Y as isJsonArray,Z as isJsonMap,$ as isLngLatBoundsArray,tt as isObjKey,nt as isObject,et as keyInObj,O as latLngToLngLatArray,P as lngLatArrayToLatLng,D as meters2degrees,c as mixinProperties,K as numberWithSpaces,U as objectAssign,B as objectDeepEqual,G as objectRemoveEmpty,q as reEscape,Q as round,z as sleep,e as type,W as unflatten}; | ||
//# sourceMappingURL=utils.esm-bundler.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/utils; version: 1.7.0; author: NextGIS */ | ||
/** Bundle of @nextgis/utils; version: 1.8.2; author: NextGIS */ | ||
var Utils = (function (exports) { | ||
@@ -563,3 +563,6 @@ 'use strict'; | ||
function flatten(data) { | ||
function flatten(data, opt) { | ||
var _a; | ||
if (opt === void 0) { opt = {}; } | ||
var flatArray = (_a = opt.flatArray) !== null && _a !== void 0 ? _a : true; | ||
var result = {}; | ||
@@ -570,3 +573,3 @@ function recurse(cur, prop) { | ||
} | ||
else if (Array.isArray(cur)) { | ||
else if (Array.isArray(cur) && flatArray) { | ||
var l = cur.length; | ||
@@ -573,0 +576,0 @@ for (var i = 0; i < l; i++) { |
@@ -1,2 +0,2 @@ | ||
var Utils=function(t){"use strict";var e="undefined"!=typeof window&&void 0!==window.document,n=e?"browser":"node";function r(t){return function(t,e){void 0===e&&(e=[]);for(;null!==t;t=Object.getPrototypeOf(t))for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++)-1==e.indexOf(n[r])&&e.push(n[r]);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 a(t,e){var n;function r(){for(var o=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];r.clear(),n=setTimeout((function(){n=null,t.apply(o,i)}),e)}return void 0===e&&(e=10),r.clear=function(){n&&(clearTimeout(n),n=null)},r}var u=function(){function t(t){this.emitter=t,this._eventsStatus={}}return t.prototype.setEventStatus=function(t,e){this._eventsStatus[t]=e},t.prototype.onLoad=function(t){var e=this,n=(Array.isArray(t)?t:[t]).map((function(t){return new Promise((function(n){e.getEventStatus(t)?n(e):e.emitter.once(t,(function(){e.setEventStatus(t,!0),n(e)}))}))}));return Promise.all(n).then((function(){return e}))},t.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return void 0!==e&&!!e},t}();function c(t){return{type:"Polygon",coordinates:[f(t)]}}function f(t){var e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}var s=Math.PI/180,l=180/Math.PI;function p(t,e,n,r){void 0===n&&(n=10),void 0===r&&(r=6);for(var o=n/6371*l,i=o/Math.cos(e*s),a=[],u=0;u<r+1;u++){var c=Math.PI*(u/(r/2)),f=t+i*Math.cos(c),p=e+o*Math.sin(c);a.push([f,p])}return a}function y(t,e){d(t,(function(t){if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(var n=0,r=t.coordinates;n<r.length;n++){r[n].forEach((function(t){return e(t)}))}else if("MultiPolygon"===t.type)for(var o=0,i=t.coordinates;o<i.length;o++){i[o].forEach((function(t){return t.forEach((function(t){return e(t)}))}))}else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(var a=0,u=t.coordinates;a<u.length;a++){e(u[a])}return t}))}function d(t,e){if("FeatureCollection"===t.type)for(var n=0,r=t.features;n<r.length;n++){e(r[n].geometry)}else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function g(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:v(t,e));return t===e}function v(t,e){var 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(var o=0;o<n.length;o++){if(!g(t[n[o]],e[r[o]],t,e))return!1}return!0}function h(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(O(t)?m(t):!!P(t)&&b(t))}function b(t){return!!P(t)&&t.every(h)}function m(t){if(O(t))for(var e in t)if(!h(e))return!1;return!1}function j(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function O(t){return"[object Object]"===Object.prototype.toString.call(t)}function P(t){return"[object Array]"===Object.prototype.toString.call(t)}var A=function(){function t(t){this.silent=!0,t&&this.copy(t)}return t.copy=function(e){return(new t).copy(e)},t.prototype.copy=function(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(t){!this.silent&&console.log("Please copy manually")}return!1},t.prototype.copyToClipboard=function(t){var e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}},t.prototype.copyNodeContentsToClipboard=function(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")},t}();return t.Clipboard=A,t.DebounceDecorator=function(t){return void 0===t&&(t=10),function(e,n,r){return{configurable:!0,enumerable:r.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:r.enumerable,value:a(r.value,t)}),this[n]}}}},t.EARTHS_RADIUS=6371,t.Events=u,t.allProperties=r,t.applyMixins=function(t,e,n){void 0===n&&(n={});var o=r(t.prototype),i=void 0===n.replace||n.replace;e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(n){var r=-1!==o.indexOf(n);if(!i&&!r||i){var a=Object.getOwnPropertyDescriptor(e.prototype,n);a&&Object.defineProperty(t.prototype,n,a)}}))}))},t.arrayChunk=function(t,e){return Array.from({length:Math.ceil(t.length/e)},(function(n,r){return 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((function(t,e,n){return n.indexOf(t)==e}))},t.camelize=function(t){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,(function(t,e){return e.toLocaleUpperCase()})).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(function(t){return t.toLocaleUpperCase()}))},t.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},t.coordinatesCount=function(t){var e=0;return y(t,(function(){return e++})),e},t.debounce=a,t.debugLog=function(t){return!1},t.deepmerge=function t(e,n,r){void 0===r&&(r=!1);var o=e,i=n,a=Array.isArray(i),u=a&&[]||{};return a&&Array.isArray(i)?r?(u=u.concat(o=o||[]),i.forEach((function(e,n){void 0===u[n]?u[n]=e:"object"==typeof e?u[n]=t(o[n],e,r):-1===o.indexOf(e)&&u.push(e)}))):u=i:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){u[t]=o[t]})),Object.keys(i).forEach((function(e){u[e]="object"==typeof i[e]&&i[e]&&"object"==typeof o[e]&&"object"==typeof i[e]?t(o[e],i[e],r):i[e]}))),u},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;var n=20037508.34*t/180,r=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return[n,r=20037508.34*r/180]},t.deprecatedMapClick=function(t){return!t.lngLat&&t.latLng&&(t.lngLat=[t.latLng.lng,t.latLng.lat]),t},t.deprecatedWarn=function(t){console.warn("DEPRECATED WARN: "+t)},t.eachCoordinates=y,t.eachGeometry=d,t.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},t.flatten=function(t){var e={};return function t(n,r){if(Object(n)!==n)e[r]=n;else if(Array.isArray(n)){for(var o=n.length,i=0;i<o;i++)t(n[i],r+"["+i+"]");0===o&&(e[r]=[])}else{var a=!0;for(var u in n)a=!1,t(n[u],r?r+"."+u:u);a&&r&&(e[r]={})}}(t,""),e},t.full=function(t){return"string"==typeof t?!!t:i(t)},t.getBoundsCoordinates=f,t.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:c(t)}},t.getBoundsPolygon=c,t.getCircleFeature=function(t,e,n,r){return void 0===n&&(n=10),void 0===r&&(r=6),{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[p(t,e,n,r)]}}},t.getCirclePolygonCoordinates=p,t.getCoordinates=function(t){var e=[];return y(t,(function(t){return e.push(t)})),e},t.getGlobalVariable=function(){return e?window:global},t.getPolygons=function(t){var e=[];return d(t,(function(t){if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((function(t){return e.push(t)}));else if("MultiPolygon"===t.type)for(var n=0,r=t.coordinates;n<r.length;n++)for(var o=0,i=r[n];o<i.length;o++){e.push(i[o])}return t})),e},t.isAnyJson=h,t.isArray=P,t.isBrowser=e,t.isJsonArray=b,t.isJsonMap=m,t.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((function(t){return"number"==typeof t}))},t.isObjKey=j,t.isObject=O,t.keyInObj=function(t,e){return j(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((function(n){var r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&Object.defineProperty(t.prototype,n,r)}))},t.numberWithSpaces=function(t){var e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")},t.objectAssign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,o=e;r<o.length;r++)for(var i=o[r],a=0,u=Object.getOwnPropertyNames(i);a<u.length;a++){var c=u[a];t[c]=i[c]}},t.objectDeepEqual=v,t.objectRemoveEmpty=function t(e){var n={};return Object.keys(e).forEach((function(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){var n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n},t.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},t.type=n,t.unflatten=function(t){if(Object(t)!==t||Array.isArray(t))return t;var e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(var r in t){for(var o=n,i="",a=void 0;a=e.exec(r);)o=o[i]||(o[i]=a[2]?[]:{}),i=a[2]||a[1];o[i]=t[r]}return n[""]||n},Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
var Utils=function(t){"use strict";var e="undefined"!=typeof window&&void 0!==window.document,n=e?"browser":"node";function r(t){return function(t,e){void 0===e&&(e=[]);for(;null!==t;t=Object.getPrototypeOf(t))for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++)-1==e.indexOf(n[r])&&e.push(n[r]);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 a(t,e){var n;function r(){for(var o=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];r.clear(),n=setTimeout((function(){n=null,t.apply(o,i)}),e)}return void 0===e&&(e=10),r.clear=function(){n&&(clearTimeout(n),n=null)},r}var u=function(){function t(t){this.emitter=t,this._eventsStatus={}}return t.prototype.setEventStatus=function(t,e){this._eventsStatus[t]=e},t.prototype.onLoad=function(t){var e=this,n=(Array.isArray(t)?t:[t]).map((function(t){return new Promise((function(n){e.getEventStatus(t)?n(e):e.emitter.once(t,(function(){e.setEventStatus(t,!0),n(e)}))}))}));return Promise.all(n).then((function(){return e}))},t.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return void 0!==e&&!!e},t}();function c(t){return{type:"Polygon",coordinates:[f(t)]}}function f(t){var e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}var l=Math.PI/180,s=180/Math.PI;function p(t,e,n,r){void 0===n&&(n=10),void 0===r&&(r=6);for(var o=n/6371*s,i=o/Math.cos(e*l),a=[],u=0;u<r+1;u++){var c=Math.PI*(u/(r/2)),f=t+i*Math.cos(c),p=e+o*Math.sin(c);a.push([f,p])}return a}function y(t,e){d(t,(function(t){if("coordinates"in t)if("Polygon"===t.type||"MultiLineString"===t.type)for(var n=0,r=t.coordinates;n<r.length;n++){r[n].forEach((function(t){return e(t)}))}else if("MultiPolygon"===t.type)for(var o=0,i=t.coordinates;o<i.length;o++){i[o].forEach((function(t){return t.forEach((function(t){return e(t)}))}))}else if("Point"===t.type)e(t.coordinates);else if("MultiPoint"===t.type||"LineString"===t.type)for(var a=0,u=t.coordinates;a<u.length;a++){e(u[a])}return t}))}function d(t,e){if("FeatureCollection"===t.type)for(var n=0,r=t.features;n<r.length;n++){e(r[n].geometry)}else"Feature"===t.type?e(t.geometry):"coordinates"in t&&e(t)}function g(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:v(t,e));return t===e}function v(t,e){var 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(var o=0;o<n.length;o++){if(!g(t[n[o]],e[r[o]],t,e))return!1}return!0}function h(t){return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||(O(t)?m(t):!!P(t)&&b(t))}function b(t){return!!P(t)&&t.every(h)}function m(t){if(O(t))for(var e in t)if(!h(e))return!1;return!1}function j(t,e){return("string"==typeof e||"number"==typeof e)&&e in t}function O(t){return"[object Object]"===Object.prototype.toString.call(t)}function P(t){return"[object Array]"===Object.prototype.toString.call(t)}var A=function(){function t(t){this.silent=!0,t&&this.copy(t)}return t.copy=function(e){return(new t).copy(e)},t.prototype.copy=function(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(t){!this.silent&&console.log("Please copy manually")}return!1},t.prototype.copyToClipboard=function(t){var e=document.createElement("input");e.value=t;try{document.body.appendChild(e),this.copyNodeContentsToClipboard(e)}finally{document.body.removeChild(e)}},t.prototype.copyNodeContentsToClipboard=function(t){t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")},t}();return t.Clipboard=A,t.DebounceDecorator=function(t){return void 0===t&&(t=10),function(e,n,r){return{configurable:!0,enumerable:r.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:r.enumerable,value:a(r.value,t)}),this[n]}}}},t.EARTHS_RADIUS=6371,t.Events=u,t.allProperties=r,t.applyMixins=function(t,e,n){void 0===n&&(n={});var o=r(t.prototype),i=void 0===n.replace||n.replace;e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(n){var r=-1!==o.indexOf(n);if(!i&&!r||i){var a=Object.getOwnPropertyDescriptor(e.prototype,n);a&&Object.defineProperty(t.prototype,n,a)}}))}))},t.arrayChunk=function(t,e){return Array.from({length:Math.ceil(t.length/e)},(function(n,r){return 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((function(t,e,n){return n.indexOf(t)==e}))},t.camelize=function(t){return t.replace(/^[_.\- ]+/,"").toLocaleLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,(function(t,e){return e.toLocaleUpperCase()})).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(function(t){return t.toLocaleUpperCase()}))},t.capitalize=function(t){return(t=String(t).toLowerCase())[0].toUpperCase()+t.slice(1)},t.coordinatesCount=function(t){var e=0;return y(t,(function(){return e++})),e},t.debounce=a,t.debugLog=function(t){return!1},t.deepmerge=function t(e,n,r){void 0===r&&(r=!1);var o=e,i=n,a=Array.isArray(i),u=a&&[]||{};return a&&Array.isArray(i)?r?(u=u.concat(o=o||[]),i.forEach((function(e,n){void 0===u[n]?u[n]=e:"object"==typeof e?u[n]=t(o[n],e,r):-1===o.indexOf(e)&&u.push(e)}))):u=i:(o&&"object"==typeof o&&Object.keys(o).forEach((function(t){u[t]=o[t]})),Object.keys(i).forEach((function(e){u[e]="object"==typeof i[e]&&i[e]&&"object"==typeof o[e]&&"object"==typeof i[e]?t(o[e],i[e],r):i[e]}))),u},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;var n=20037508.34*t/180,r=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return[n,r=20037508.34*r/180]},t.deprecatedMapClick=function(t){return!t.lngLat&&t.latLng&&(t.lngLat=[t.latLng.lng,t.latLng.lat]),t},t.deprecatedWarn=function(t){console.warn("DEPRECATED WARN: "+t)},t.eachCoordinates=y,t.eachGeometry=d,t.fixUrlStr=function(t){return t.replace(/([^:]\/)\/+/g,"$1")},t.flatten=function(t,e){var n;void 0===e&&(e={});var r=null===(n=e.flatArray)||void 0===n||n,o={};return function t(e,n){if(Object(e)!==e)o[n]=e;else if(Array.isArray(e)&&r){for(var i=e.length,a=0;a<i;a++)t(e[a],n+"["+a+"]");0===i&&(o[n]=[])}else{var u=!0;for(var c in e)u=!1,t(e[c],n?n+"."+c:c);u&&n&&(o[n]={})}}(t,""),o},t.full=function(t){return"string"==typeof t?!!t:i(t)},t.getBoundsCoordinates=f,t.getBoundsFeature=function(t){return{type:"Feature",properties:{},geometry:c(t)}},t.getBoundsPolygon=c,t.getCircleFeature=function(t,e,n,r){return void 0===n&&(n=10),void 0===r&&(r=6),{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[p(t,e,n,r)]}}},t.getCirclePolygonCoordinates=p,t.getCoordinates=function(t){var e=[];return y(t,(function(t){return e.push(t)})),e},t.getGlobalVariable=function(){return e?window:global},t.getPolygons=function(t){var e=[];return d(t,(function(t){if("coordinates"in t)if("Polygon"===t.type)t.coordinates.forEach((function(t){return e.push(t)}));else if("MultiPolygon"===t.type)for(var n=0,r=t.coordinates;n<r.length;n++)for(var o=0,i=r[n];o<i.length;o++){e.push(i[o])}return t})),e},t.isAnyJson=h,t.isArray=P,t.isBrowser=e,t.isJsonArray=b,t.isJsonMap=m,t.isLngLatBoundsArray=function(t){return Array.isArray(t)&&4===t.length&&t.every((function(t){return"number"==typeof t}))},t.isObjKey=j,t.isObject=O,t.keyInObj=function(t,e){return j(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((function(n){var r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&Object.defineProperty(t.prototype,n,r)}))},t.numberWithSpaces=function(t){var e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")},t.objectAssign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,o=e;r<o.length;r++)for(var i=o[r],a=0,u=Object.getOwnPropertyNames(i);a<u.length;a++){var c=u[a];t[c]=i[c]}},t.objectDeepEqual=v,t.objectRemoveEmpty=function t(e){var n={};return Object.keys(e).forEach((function(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){var n=e?Number("1e+"+e):1;return Math.round((t+Number.EPSILON)*n)/n},t.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},t.type=n,t.unflatten=function(t){if(Object(t)!==t||Array.isArray(t))return t;var e=/\.?([^.[\]]+)|\[(\d+)\]/g,n={};for(var r in t){for(var o=n,i="",a=void 0;a=e.exec(r);)o=o[i]||(o[i]=a[2]?[]:{}),i=a[2]||a[1];o[i]=t[r]}return n[""]||n},Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
//# sourceMappingURL=utils.global.prod.js.map |
{ | ||
"name": "@nextgis/utils", | ||
"version": "1.7.0", | ||
"version": "1.8.2", | ||
"description": "Common development tools", | ||
@@ -48,3 +48,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "a3113b03e87540abf798c1151d3243a1e20c8607" | ||
"gitHead": "6e6eec79de0a6420a8e413f8e31ff56d24f18c3d" | ||
} |
@@ -75,3 +75,3 @@ # Utils | ||
Check out the [API Documentation](https://github.com/nextgis/nextgis_frontend/blob/master/markdown/utils.md) | ||
Check out the [API Documentation](https://code-api.nextgis.com/modules/progress.html) | ||
@@ -78,0 +78,0 @@ ## Commercial support |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
475162
3359