gis-common 4.1.5 → 4.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/CanvasDrawer.d.ts +1 -0
- package/dist/gis-common.es.js +232 -98
- package/dist/gis-common.umd.js +1 -1
- package/dist/utils/ArrayUtil.d.ts +7 -1
- package/dist/utils/ColorUtil.d.ts +1 -0
- package/dist/utils/CommUtil.d.ts +2 -1
- package/dist/utils/CoordsUtil.d.ts +10 -2
- package/dist/utils/DateUtil.d.ts +4 -4
- package/dist/utils/GeoJsonUtil.d.ts +72 -9
- package/dist/utils/ObjectUtil.d.ts +1 -0
- package/dist/utils/StringUtil.d.ts +1 -0
- package/package.json +1 -1
package/dist/gis-common.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var D = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
2
|
+
var b = (t, e, n) => e in t ? D(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var d = (t, e, n) => b(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
const R = {
|
|
5
5
|
MAP_RENDER: "mapRender",
|
|
6
6
|
MAP_READY: "mapReady",
|
|
7
7
|
MOUSE_CLICK: "click",
|
|
@@ -23,7 +23,7 @@ const E = {
|
|
|
23
23
|
WEB_SOCKET_ERROR: "webSocketError",
|
|
24
24
|
WEB_SOCKET_MESSAGE: "webSocketMessage",
|
|
25
25
|
WEB_SOCKET_CLOSE: "webSocketClose"
|
|
26
|
-
},
|
|
26
|
+
}, O = {
|
|
27
27
|
LOGIN_EXPIRED: "登录信息过期,请重新登录",
|
|
28
28
|
CROSS_ERROR: "跨域访问",
|
|
29
29
|
UNEXIST_RESOURCE: "资源不存在",
|
|
@@ -44,7 +44,7 @@ const E = {
|
|
|
44
44
|
PARAMETER_ERROR_OBJECT: "格式类型验证失败:必须是对象",
|
|
45
45
|
PARAMETER_ERROR_LACK: "参数缺失",
|
|
46
46
|
STRING_CHECK_LOSS: "字符缺少关键字"
|
|
47
|
-
},
|
|
47
|
+
}, P = {
|
|
48
48
|
SUPER_MAP_IMAGES: "SuperMapImages",
|
|
49
49
|
// 超图影像服务 栅格数据
|
|
50
50
|
SUPER_MAP_DATA: "SuperMapData",
|
|
@@ -68,11 +68,11 @@ const E = {
|
|
|
68
68
|
LABEL: "label",
|
|
69
69
|
MODEL: "model",
|
|
70
70
|
WALL: "wall"
|
|
71
|
-
},
|
|
71
|
+
}, L = {
|
|
72
72
|
DISTANCE: "distance",
|
|
73
73
|
AREA: "area",
|
|
74
74
|
HEIGHT: "height"
|
|
75
|
-
},
|
|
75
|
+
}, k = {
|
|
76
76
|
ADD: "add",
|
|
77
77
|
REMOVE: "remove",
|
|
78
78
|
INIT: "init"
|
|
@@ -83,7 +83,7 @@ class N {
|
|
|
83
83
|
* Creates an instance of AudioPlayer.
|
|
84
84
|
* @param {*} url
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
d(this, "audio");
|
|
87
87
|
this.audio = new Audio(), this.audio.src = e;
|
|
88
88
|
}
|
|
89
89
|
play() {
|
|
@@ -173,9 +173,9 @@ const m = {
|
|
|
173
173
|
return Math.max(Math.min(t, n), e);
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
-
class
|
|
176
|
+
class C {
|
|
177
177
|
constructor(e) {
|
|
178
|
-
|
|
178
|
+
d(this, "context", null);
|
|
179
179
|
if (typeof e == "string" && (e = document.querySelector("#" + e), !e))
|
|
180
180
|
throw new Error("Element not found");
|
|
181
181
|
if (e instanceof HTMLElement) {
|
|
@@ -226,11 +226,12 @@ class k {
|
|
|
226
226
|
return r = document.createElement("canvas"), e && (r.width = e), n && (r.height = n), r;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
d(C, "emptyImageUrl", "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
|
|
230
|
+
class T {
|
|
230
231
|
constructor() {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
d(this, "_listeners");
|
|
233
|
+
d(this, "_mutex", {});
|
|
234
|
+
d(this, "_context");
|
|
234
235
|
}
|
|
235
236
|
addEventListener(e, n, r, s = !1) {
|
|
236
237
|
this._listeners === void 0 && (this._listeners = {}), this._context = r;
|
|
@@ -275,7 +276,7 @@ class C {
|
|
|
275
276
|
this._listeners[e] = [];
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
|
-
class
|
|
279
|
+
class A extends Map {
|
|
279
280
|
isEmpty() {
|
|
280
281
|
return this.size === 0;
|
|
281
282
|
}
|
|
@@ -291,20 +292,20 @@ class x extends Map {
|
|
|
291
292
|
fromEntries() {
|
|
292
293
|
}
|
|
293
294
|
}
|
|
294
|
-
|
|
295
|
-
const e = new
|
|
295
|
+
A.prototype.fromEntries = function(t = []) {
|
|
296
|
+
const e = new A();
|
|
296
297
|
return t.forEach((n) => {
|
|
297
298
|
Array.isArray(n) && n.length === 2 && e.set(n[0], n[1]);
|
|
298
299
|
}), e;
|
|
299
300
|
};
|
|
300
|
-
class U extends
|
|
301
|
+
class U extends T {
|
|
301
302
|
constructor(n = "ws://127.0.0.1:10088") {
|
|
302
303
|
super();
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
d(this, "maxCheckTimes", 10);
|
|
305
|
+
d(this, "url");
|
|
306
|
+
d(this, "checkTimes", 0);
|
|
307
|
+
d(this, "connectStatus", !1);
|
|
308
|
+
d(this, "client", null);
|
|
308
309
|
this.maxCheckTimes = 10, this.url = n, this.checkTimes = 0, this.connect(), this.connCheckStatus(this.maxCheckTimes);
|
|
309
310
|
}
|
|
310
311
|
connect() {
|
|
@@ -314,22 +315,22 @@ class U extends C {
|
|
|
314
315
|
const n = this;
|
|
315
316
|
this.client.onopen = function(r) {
|
|
316
317
|
n.dispatchEvent({
|
|
317
|
-
type:
|
|
318
|
+
type: R.WEB_SOCKET_CONNECT,
|
|
318
319
|
message: r
|
|
319
320
|
});
|
|
320
321
|
}, this.client.onmessage = function(r) {
|
|
321
322
|
n.connectStatus = !0, n.dispatchEvent({
|
|
322
|
-
type:
|
|
323
|
+
type: R.WEB_SOCKET_MESSAGE,
|
|
323
324
|
message: r
|
|
324
325
|
});
|
|
325
326
|
}, this.client.onclose = function(r) {
|
|
326
327
|
n.dispatchEvent({
|
|
327
|
-
type:
|
|
328
|
+
type: R.WEB_SOCKET_CLOSE,
|
|
328
329
|
message: r
|
|
329
330
|
});
|
|
330
331
|
}, this.checkTimes === this.maxCheckTimes && (this.client.onerror = function(r) {
|
|
331
332
|
n.dispatchEvent({
|
|
332
|
-
type:
|
|
333
|
+
type: R.WEB_SOCKET_ERROR,
|
|
333
334
|
message: r
|
|
334
335
|
});
|
|
335
336
|
});
|
|
@@ -360,7 +361,7 @@ class U extends C {
|
|
|
360
361
|
}, 1e3);
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
|
-
const
|
|
364
|
+
const M = {
|
|
364
365
|
/**
|
|
365
366
|
* 获取数据类型
|
|
366
367
|
*
|
|
@@ -400,7 +401,7 @@ const R = {
|
|
|
400
401
|
*
|
|
401
402
|
* @returns 返回一个由8个16进制数组成的GUID字符串
|
|
402
403
|
*/
|
|
403
|
-
|
|
404
|
+
guid() {
|
|
404
405
|
const t = function() {
|
|
405
406
|
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
406
407
|
};
|
|
@@ -508,7 +509,7 @@ const R = {
|
|
|
508
509
|
return t.replace(n, (r, s) => {
|
|
509
510
|
const i = e[s];
|
|
510
511
|
if (i === void 0)
|
|
511
|
-
throw new Error(`${
|
|
512
|
+
throw new Error(`${O.JSON_VALUE_ERROR}: ${r}`);
|
|
512
513
|
return typeof i == "function" ? i(e) : i;
|
|
513
514
|
});
|
|
514
515
|
},
|
|
@@ -560,7 +561,10 @@ const R = {
|
|
|
560
561
|
return Object.prototype.toString.call(t).indexOf("Object") > -1;
|
|
561
562
|
},
|
|
562
563
|
isNil(t) {
|
|
563
|
-
return
|
|
564
|
+
return t === void 0 || t === "undefined" || t === null || t === "null";
|
|
565
|
+
},
|
|
566
|
+
isNumber(t) {
|
|
567
|
+
return typeof t == "number" && !isNaN(t) || typeof t == "string" && Number.isFinite(+t);
|
|
564
568
|
}
|
|
565
569
|
};
|
|
566
570
|
Array.prototype.groupBy = function(t) {
|
|
@@ -595,14 +599,24 @@ Array.prototype.desc = function(t = (e) => e) {
|
|
|
595
599
|
Array.prototype.asc = function(t = (e) => e) {
|
|
596
600
|
return this.sort((e, n) => t(e) - t(n));
|
|
597
601
|
};
|
|
602
|
+
Array.prototype.remove = function(t) {
|
|
603
|
+
const e = this.indexOf(t);
|
|
604
|
+
return e > -1 && this.splice(e, 1), this;
|
|
605
|
+
};
|
|
598
606
|
Array.prototype.clear = function() {
|
|
599
607
|
return this.length = 0, this;
|
|
600
608
|
};
|
|
601
609
|
const F = {
|
|
602
610
|
asArray(t) {
|
|
603
|
-
return
|
|
611
|
+
return M.isEmpty(t) ? [] : Array.isArray(t) ? t : [t];
|
|
604
612
|
},
|
|
605
|
-
|
|
613
|
+
/**
|
|
614
|
+
* 创建指定长度的数组,并返回其索引数组
|
|
615
|
+
*
|
|
616
|
+
* @param length 数组长度
|
|
617
|
+
* @returns 索引数组
|
|
618
|
+
*/
|
|
619
|
+
create(t) {
|
|
606
620
|
return [...new Array(t).keys()];
|
|
607
621
|
},
|
|
608
622
|
/**
|
|
@@ -700,7 +714,7 @@ const F = {
|
|
|
700
714
|
const t = document.documentElement.clientWidth || document.body.clientWidth, e = document.querySelector("html");
|
|
701
715
|
e && (e.style.fontSize = t / 192 + "px");
|
|
702
716
|
}
|
|
703
|
-
},
|
|
717
|
+
}, B = {
|
|
704
718
|
set: function(t, e, n = 30) {
|
|
705
719
|
var r = /* @__PURE__ */ new Date();
|
|
706
720
|
r.setTime(r.getTime() + n * 24 * 60 * 60 * 1e3), document.cookie = t + "=" + escape(e) + ";expires=" + r.toUTCString();
|
|
@@ -715,7 +729,7 @@ const F = {
|
|
|
715
729
|
var e = document.cookie.match(new RegExp("(^| )" + t + "=([^;]*)(;|$)"));
|
|
716
730
|
return e != null ? e[2] : "";
|
|
717
731
|
}
|
|
718
|
-
},
|
|
732
|
+
}, G = {
|
|
719
733
|
PI: 3.141592653589793,
|
|
720
734
|
XPI: 3.141592653589793 * 3e3 / 180,
|
|
721
735
|
delta(t, e) {
|
|
@@ -753,11 +767,11 @@ const F = {
|
|
|
753
767
|
},
|
|
754
768
|
// GCJ-02 to WGS-84 exactly
|
|
755
769
|
gcjDecryptExact(t, e) {
|
|
756
|
-
let s = 0.01, i = 0.01, o = t - s, a = e - i, c = t + s, h = e + i, l = 0, u = 0,
|
|
770
|
+
let s = 0.01, i = 0.01, o = t - s, a = e - i, c = t + s, h = e + i, l = 0, u = 0, f = 0;
|
|
757
771
|
for (; ; ) {
|
|
758
772
|
l = (o + c) / 2, u = (a + h) / 2;
|
|
759
773
|
const p = this.gcjEncrypt(l, u);
|
|
760
|
-
if (s = p.lat - t, i = p.lng - e, Math.abs(s) < 1e-9 && Math.abs(i) < 1e-9 || (s > 0 ? c = l : o = l, i > 0 ? h = u : a = u, ++
|
|
774
|
+
if (s = p.lat - t, i = p.lng - e, Math.abs(s) < 1e-9 && Math.abs(i) < 1e-9 || (s > 0 ? c = l : o = l, i > 0 ? h = u : a = u, ++f > 1e4)) break;
|
|
761
775
|
}
|
|
762
776
|
return { lat: l, lng: u };
|
|
763
777
|
},
|
|
@@ -793,13 +807,38 @@ const F = {
|
|
|
793
807
|
let n = 300 + t + 2 * e + 0.1 * t * t + 0.1 * t * e + 0.1 * Math.sqrt(Math.abs(t));
|
|
794
808
|
return n += (20 * Math.sin(6 * t * this.PI) + 20 * Math.sin(2 * t * this.PI)) * 2 / 3, n += (20 * Math.sin(t * this.PI) + 40 * Math.sin(t / 3 * this.PI)) * 2 / 3, n += (150 * Math.sin(t / 12 * this.PI) + 300 * Math.sin(t / 30 * this.PI)) * 2 / 3, n;
|
|
795
809
|
},
|
|
796
|
-
|
|
810
|
+
/**
|
|
811
|
+
* 生成指定范围内的随机经纬度坐标
|
|
812
|
+
*
|
|
813
|
+
* @param min 最小坐标,包含属性 x 和 y,分别表示最小经度和最小纬度
|
|
814
|
+
* @param max 最大坐标,包含属性 x 和 y,分别表示最大经度和最大纬度
|
|
815
|
+
* @returns 返回生成的随机经纬度坐标,包含属性 lat 和 lng,分别表示纬度和经度
|
|
816
|
+
*/
|
|
817
|
+
random({ x: t, y: e }, { x: n, y: r }) {
|
|
797
818
|
return {
|
|
798
819
|
lat: Math.random() * (r - e) + e,
|
|
799
820
|
lng: Math.random() * (n - t) + t
|
|
800
821
|
};
|
|
822
|
+
},
|
|
823
|
+
deCompose(t, e, n) {
|
|
824
|
+
if (!Array.isArray(t))
|
|
825
|
+
return n ? e.call(n, t) : e(t);
|
|
826
|
+
const r = [];
|
|
827
|
+
let s, i;
|
|
828
|
+
for (let o = 0, a = t.length; o < a; o++) {
|
|
829
|
+
if (s = t[o], M.isNil(s)) {
|
|
830
|
+
r.push(null);
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
Array.isArray(s) ? r.push(this.deCompose(s, e, n)) : (i = n ? e.call(n, s) : e(s), r.push(i));
|
|
834
|
+
}
|
|
835
|
+
return r;
|
|
801
836
|
}
|
|
802
837
|
}, J = {
|
|
838
|
+
random() {
|
|
839
|
+
let t = Math.floor(Math.random() * 256).toString(16), e = Math.floor(Math.random() * 256).toString(16), n = Math.floor(Math.random() * 256).toString(16);
|
|
840
|
+
return t = t.length === 1 ? "0" + t : t, e = e.length === 1 ? "0" + e : e, n = n.length === 1 ? "0" + n : n, "#" + t + e + n;
|
|
841
|
+
},
|
|
803
842
|
/**
|
|
804
843
|
* 将RGB颜色值转换为十六进制颜色值
|
|
805
844
|
*
|
|
@@ -846,8 +885,8 @@ const F = {
|
|
|
846
885
|
if (!e)
|
|
847
886
|
return null;
|
|
848
887
|
const n = parseInt(e[1], 10) / 360, r = parseInt(e[2], 10) / 100, s = parseInt(e[3], 10) / 100, i = e[4] ? parseFloat(e[4]) : 1;
|
|
849
|
-
function o(l, u,
|
|
850
|
-
return
|
|
888
|
+
function o(l, u, f) {
|
|
889
|
+
return f < 0 && (f += 1), f > 1 && (f -= 1), f < 1 / 6 ? l + (u - l) * 6 * f : f < 1 / 2 ? u : f < 2 / 3 ? l + (u - l) * (2 / 3 - f) * 6 : l;
|
|
851
890
|
}
|
|
852
891
|
let a, c, h;
|
|
853
892
|
if (r === 0)
|
|
@@ -973,16 +1012,16 @@ const q = {
|
|
|
973
1012
|
return null;
|
|
974
1013
|
},
|
|
975
1014
|
/**
|
|
976
|
-
*
|
|
1015
|
+
* 格式化时间间隔
|
|
977
1016
|
*
|
|
978
|
-
* @param
|
|
979
|
-
* @param
|
|
980
|
-
* @returns
|
|
1017
|
+
* @param startTime 开始时间,可以是字符串、数字或日期类型
|
|
1018
|
+
* @param endTime 结束时间,可以是字符串、数字或日期类型
|
|
1019
|
+
* @returns 返回格式化后的时间间隔字符串,格式为"天数 天 小时 时 分钟 分 秒 秒"或"少于1秒"
|
|
981
1020
|
*/
|
|
982
1021
|
formatDateInterval(t, e) {
|
|
983
1022
|
const n = new Date(t), s = new Date(e).getTime() - n.getTime(), i = Math.floor(s / (24 * 3600 * 1e3)), o = s % (24 * 3600 * 1e3), a = Math.floor(o / (3600 * 1e3)), c = o % (3600 * 1e3), h = Math.floor(c / (60 * 1e3)), l = c % (60 * 1e3), u = Math.round(l / 1e3);
|
|
984
|
-
let
|
|
985
|
-
return i > 0 && (
|
|
1023
|
+
let f = "";
|
|
1024
|
+
return i > 0 && (f += i + "天"), a > 0 && (f += a + "时"), h > 0 && (f += h + "分"), u > 0 && (f += u + "秒"), i === 0 && a === 0 && h === 0 && u === 0 && (f = "少于1秒"), f;
|
|
986
1025
|
},
|
|
987
1026
|
formatterCounter(t) {
|
|
988
1027
|
const e = function(a) {
|
|
@@ -993,11 +1032,11 @@ const q = {
|
|
|
993
1032
|
sleep(t) {
|
|
994
1033
|
}
|
|
995
1034
|
};
|
|
996
|
-
function
|
|
1035
|
+
function I(t) {
|
|
997
1036
|
return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "");
|
|
998
1037
|
}
|
|
999
|
-
function
|
|
1000
|
-
return
|
|
1038
|
+
function w(t) {
|
|
1039
|
+
return I(t).split(/\s+/);
|
|
1001
1040
|
}
|
|
1002
1041
|
const W = {
|
|
1003
1042
|
/**
|
|
@@ -1098,7 +1137,7 @@ const W = {
|
|
|
1098
1137
|
*/
|
|
1099
1138
|
addClass(t, e) {
|
|
1100
1139
|
if (t.classList !== void 0) {
|
|
1101
|
-
const n =
|
|
1140
|
+
const n = w(e);
|
|
1102
1141
|
for (let r = 0, s = n.length; r < s; r++)
|
|
1103
1142
|
t.classList.add(n[r]);
|
|
1104
1143
|
} else if (!this.hasClass(t, e)) {
|
|
@@ -1113,7 +1152,7 @@ const W = {
|
|
|
1113
1152
|
* @param name 要移除的类名,多个类名用空格分隔
|
|
1114
1153
|
*/
|
|
1115
1154
|
removeClass(t, e) {
|
|
1116
|
-
t.classList !== void 0 ?
|
|
1155
|
+
t.classList !== void 0 ? w(e).forEach((r) => t.classList.remove(r)) : this.setClass(t, (" " + this.getClass(t) + " ").replace(" " + e + " ", " ").trim());
|
|
1117
1156
|
},
|
|
1118
1157
|
/**
|
|
1119
1158
|
* 设置元素的 CSS 类名
|
|
@@ -1218,10 +1257,10 @@ const W = {
|
|
|
1218
1257
|
if (c === n && h === r || l === n && u === r)
|
|
1219
1258
|
return "on";
|
|
1220
1259
|
if (h < r && u >= r || h >= r && u < r) {
|
|
1221
|
-
var
|
|
1222
|
-
if (
|
|
1260
|
+
var f = c + (r - h) * (l - c) / (u - h);
|
|
1261
|
+
if (f === n)
|
|
1223
1262
|
return "on";
|
|
1224
|
-
|
|
1263
|
+
f > n && (s = !s);
|
|
1225
1264
|
}
|
|
1226
1265
|
}
|
|
1227
1266
|
return s ? "in" : "out";
|
|
@@ -1257,7 +1296,7 @@ const W = {
|
|
|
1257
1296
|
* @returns 包含方位角和距离的对象
|
|
1258
1297
|
*/
|
|
1259
1298
|
calcBearAndDisByPoints(t, e) {
|
|
1260
|
-
var n = t.lat * 1, r = t.lng * 1, s = e.lat * 1, i = e.lng * 1, o = Math.sin((i - r) * this.toRadian) * Math.cos(s * this.toRadian), a = Math.cos(n * this.toRadian) * Math.sin(s * this.toRadian) - Math.sin(n * this.toRadian) * Math.cos(s * this.toRadian) * Math.cos((i - r) * this.toRadian), c = Math.atan2(o, a) * (180 / Math.PI), h = (s - n) * this.toRadian, l = (i - r) * this.toRadian, u = Math.sin(h / 2) * Math.sin(h / 2) + Math.cos(n * this.toRadian) * Math.cos(s * this.toRadian) * Math.sin(l / 2) * Math.sin(l / 2),
|
|
1299
|
+
var n = t.lat * 1, r = t.lng * 1, s = e.lat * 1, i = e.lng * 1, o = Math.sin((i - r) * this.toRadian) * Math.cos(s * this.toRadian), a = Math.cos(n * this.toRadian) * Math.sin(s * this.toRadian) - Math.sin(n * this.toRadian) * Math.cos(s * this.toRadian) * Math.cos((i - r) * this.toRadian), c = Math.atan2(o, a) * (180 / Math.PI), h = (s - n) * this.toRadian, l = (i - r) * this.toRadian, u = Math.sin(h / 2) * Math.sin(h / 2) + Math.cos(n * this.toRadian) * Math.cos(s * this.toRadian) * Math.sin(l / 2) * Math.sin(l / 2), f = 2 * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u)), p = this.R * f;
|
|
1261
1300
|
return {
|
|
1262
1301
|
angle: c,
|
|
1263
1302
|
distance: p
|
|
@@ -1278,8 +1317,8 @@ const W = {
|
|
|
1278
1317
|
const l = (a - i) * (a - i) + (c - o) * (c - o);
|
|
1279
1318
|
if (h >= l)
|
|
1280
1319
|
return Math.sqrt((r - a) * (r - a) + (s - c) * (s - c));
|
|
1281
|
-
const u = h / l,
|
|
1282
|
-
return Math.sqrt((r -
|
|
1320
|
+
const u = h / l, f = i + (a - i) * u, p = o + (c - o) * u;
|
|
1321
|
+
return Math.sqrt((r - f) * (r - f) + (s - p) * (s - p));
|
|
1283
1322
|
},
|
|
1284
1323
|
/**
|
|
1285
1324
|
* 根据给定的经纬度、角度和距离计算新的经纬度点
|
|
@@ -1326,11 +1365,23 @@ const W = {
|
|
|
1326
1365
|
return { x: r, y: i };
|
|
1327
1366
|
}
|
|
1328
1367
|
}, y = ["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon"], j = {
|
|
1329
|
-
|
|
1368
|
+
/**
|
|
1369
|
+
* 获取GeoJSON要素的几何类型
|
|
1370
|
+
*
|
|
1371
|
+
* @param feature GeoJSONFeature 类型的要素
|
|
1372
|
+
* @returns 返回要素的几何类型,如果要素没有几何属性则返回 null
|
|
1373
|
+
*/
|
|
1374
|
+
getGeoJsonType(t) {
|
|
1330
1375
|
return t.geometry ? t.geometry.type : null;
|
|
1331
1376
|
},
|
|
1332
|
-
|
|
1333
|
-
|
|
1377
|
+
/**
|
|
1378
|
+
* 判断给定的GeoJSON要素是否为有效的GeoJSON格式
|
|
1379
|
+
*
|
|
1380
|
+
* @param feature 要判断的GeoJSON要素
|
|
1381
|
+
* @returns 如果为有效的GeoJSON格式则返回true,否则返回false
|
|
1382
|
+
*/
|
|
1383
|
+
isGeoJson(t) {
|
|
1384
|
+
const e = this.getGeoJsonType(t);
|
|
1334
1385
|
if (e) {
|
|
1335
1386
|
for (let n = 0, r = y.length; n < r; n++)
|
|
1336
1387
|
if (y[n] === e)
|
|
@@ -1338,27 +1389,64 @@ const W = {
|
|
|
1338
1389
|
}
|
|
1339
1390
|
return !1;
|
|
1340
1391
|
},
|
|
1341
|
-
|
|
1342
|
-
|
|
1392
|
+
/**
|
|
1393
|
+
* 判断是否为 GeoJSON 多边形
|
|
1394
|
+
*
|
|
1395
|
+
* @param feature GeoJSONFeature 对象
|
|
1396
|
+
* @returns 返回布尔值,表示是否为 GeoJSON 多边形
|
|
1397
|
+
*/
|
|
1398
|
+
isGeoJsonPolygon(t) {
|
|
1399
|
+
const e = this.getGeoJsonType(t);
|
|
1343
1400
|
return !!(e && (e === y[4] || e === y[5]));
|
|
1344
1401
|
},
|
|
1345
|
-
|
|
1346
|
-
|
|
1402
|
+
/**
|
|
1403
|
+
* 判断给定的 GeoJSONFeature 是否为 GeoJSON 线
|
|
1404
|
+
*
|
|
1405
|
+
* @param feature GeoJSONFeature 对象
|
|
1406
|
+
* @returns 是 GeoJSON 线返回 true,否则返回 false
|
|
1407
|
+
*/
|
|
1408
|
+
isGeoJsonLine(t) {
|
|
1409
|
+
const e = this.getGeoJsonType(t);
|
|
1347
1410
|
return !!(e && (e === y[2] || e === y[3]));
|
|
1348
1411
|
},
|
|
1349
|
-
|
|
1350
|
-
|
|
1412
|
+
/**
|
|
1413
|
+
* 判断是否为 GeoJSON 点类型
|
|
1414
|
+
*
|
|
1415
|
+
* @param feature GeoJSONFeature 对象
|
|
1416
|
+
* @returns 是点类型返回 true,否则返回 false
|
|
1417
|
+
*/
|
|
1418
|
+
isGeoJsonPoint(t) {
|
|
1419
|
+
const e = this.getGeoJsonType(t);
|
|
1351
1420
|
return !!(e && (e === y[0] || e === y[1]));
|
|
1352
1421
|
},
|
|
1353
|
-
|
|
1354
|
-
|
|
1422
|
+
/**
|
|
1423
|
+
* 判断传入的 GeoJSONFeature 是否为 Multi 类型的 GeoJSON。
|
|
1424
|
+
*
|
|
1425
|
+
* @param feature GeoJSONFeature 类型的参数,待判断是否为 Multi 类型的 GeoJSON。
|
|
1426
|
+
* @returns 返回一个布尔值,如果传入的 GeoJSONFeature 是 Multi 类型的 GeoJSON,则返回 true,否则返回 false。
|
|
1427
|
+
*/
|
|
1428
|
+
isGeoJsonMulti(t) {
|
|
1429
|
+
const e = this.getGeoJsonType(t);
|
|
1355
1430
|
return !!(e && e.indexOf("Multi") > -1);
|
|
1356
1431
|
},
|
|
1357
|
-
|
|
1432
|
+
/**
|
|
1433
|
+
* 获取GeoJSON要素的坐标数组
|
|
1434
|
+
*
|
|
1435
|
+
* @param feature GeoJSONFeature对象
|
|
1436
|
+
* @returns 返回一个包含坐标数组的数组,可以是二维、三维或四维数组
|
|
1437
|
+
*/
|
|
1438
|
+
getGeoJsonCoordinates(t) {
|
|
1358
1439
|
return t.geometry ? t.geometry.coordinates : [];
|
|
1359
1440
|
},
|
|
1360
|
-
|
|
1361
|
-
|
|
1441
|
+
/**
|
|
1442
|
+
* 获取GeoJSON要素的中心点坐标
|
|
1443
|
+
*
|
|
1444
|
+
* @param feature GeoJSON要素
|
|
1445
|
+
* @param out 输出坐标对象,默认为null
|
|
1446
|
+
* @returns 返回中心点坐标,如果无法获取则返回null
|
|
1447
|
+
*/
|
|
1448
|
+
getGeoJsonCenter(t, e) {
|
|
1449
|
+
const n = this.getGeoJsonType(t);
|
|
1362
1450
|
if (!n || !t.geometry)
|
|
1363
1451
|
return null;
|
|
1364
1452
|
const s = t.geometry.coordinates;
|
|
@@ -1379,23 +1467,29 @@ const W = {
|
|
|
1379
1467
|
case "MultiLineString":
|
|
1380
1468
|
case "Polygon": {
|
|
1381
1469
|
for (let l = 0, u = s.length; l < u; l++)
|
|
1382
|
-
for (let
|
|
1383
|
-
i += s[l][
|
|
1470
|
+
for (let f = 0, p = s[l].length; f < p; f++)
|
|
1471
|
+
i += s[l][f][0], o += s[l][f][1], a++;
|
|
1384
1472
|
break;
|
|
1385
1473
|
}
|
|
1386
1474
|
case "MultiPolygon": {
|
|
1387
1475
|
for (let l = 0, u = s.length; l < u; l++)
|
|
1388
|
-
for (let
|
|
1389
|
-
for (let
|
|
1390
|
-
i += s[l][
|
|
1476
|
+
for (let f = 0, p = s[l].length; f < p; f++)
|
|
1477
|
+
for (let E = 0, S = s[l][f].length; E < S; E++)
|
|
1478
|
+
i += s[l][f][E][0], o += s[l][f][E][1], a++;
|
|
1391
1479
|
break;
|
|
1392
1480
|
}
|
|
1393
1481
|
}
|
|
1394
1482
|
const c = i / a, h = o / a;
|
|
1395
1483
|
return e ? (e.x = c, e.y = h, e) : { x: c, y: h };
|
|
1396
1484
|
},
|
|
1397
|
-
|
|
1398
|
-
|
|
1485
|
+
/**
|
|
1486
|
+
* 将一个包含多个点、线或面的 GeoJSON 特征对象拆分成多个独立的 GeoJSON 特征对象数组。
|
|
1487
|
+
*
|
|
1488
|
+
* @param feature 包含多个点、线或面的 GeoJSON 特征对象
|
|
1489
|
+
* @returns 返回一个 GeoJSON 特征对象数组,如果拆分失败则返回 null
|
|
1490
|
+
*/
|
|
1491
|
+
spliteGeoJsonMulti(t) {
|
|
1492
|
+
const e = this.getGeoJsonType(t);
|
|
1399
1493
|
if (!e || !t.geometry)
|
|
1400
1494
|
return null;
|
|
1401
1495
|
const n = t.geometry, r = t.properties || {}, s = n.coordinates;
|
|
@@ -1430,6 +1524,36 @@ const W = {
|
|
|
1430
1524
|
else
|
|
1431
1525
|
i.push(t);
|
|
1432
1526
|
return i;
|
|
1527
|
+
},
|
|
1528
|
+
/**
|
|
1529
|
+
* 根据坐标数组生成GeoJSON要素
|
|
1530
|
+
*
|
|
1531
|
+
* @param coordinates 坐标数组
|
|
1532
|
+
* @returns GeoJSONFeature 生成的GeoJSON要素
|
|
1533
|
+
* @throws Error 如果coordinates参数格式错误
|
|
1534
|
+
*/
|
|
1535
|
+
getGeoJsonByCoordinates(t) {
|
|
1536
|
+
if (!Array.isArray(t))
|
|
1537
|
+
throw Error("coordinates 参数格式错误");
|
|
1538
|
+
let e;
|
|
1539
|
+
if (t.length === 2 && typeof t[0] == "number" && typeof t[1] == "number")
|
|
1540
|
+
e = "Point";
|
|
1541
|
+
else if (Array.isArray(t[0]) && t[0].length === 2)
|
|
1542
|
+
e = "LineString";
|
|
1543
|
+
else if (Array.isArray(t[0]) && Array.isArray(t[0][0])) {
|
|
1544
|
+
const n = t[0];
|
|
1545
|
+
if (n[0].join(",") === n[n.length - 1].join(","))
|
|
1546
|
+
e = "Polygon";
|
|
1547
|
+
else if (t.length > 1)
|
|
1548
|
+
e = "MultiPolygon";
|
|
1549
|
+
else
|
|
1550
|
+
throw Error("coordinates 参数格式错误");
|
|
1551
|
+
} else
|
|
1552
|
+
throw Error("coordinates 参数格式错误");
|
|
1553
|
+
return {
|
|
1554
|
+
type: "Feature",
|
|
1555
|
+
geometry: { type: e, coordinates: t }
|
|
1556
|
+
};
|
|
1433
1557
|
}
|
|
1434
1558
|
}, K = {
|
|
1435
1559
|
deepClone(t) {
|
|
@@ -1437,6 +1561,9 @@ const W = {
|
|
|
1437
1561
|
},
|
|
1438
1562
|
isEqual(t, e) {
|
|
1439
1563
|
return JSON.stringify(t) === JSON.stringify(e);
|
|
1564
|
+
},
|
|
1565
|
+
parse(t) {
|
|
1566
|
+
return !t || typeof t != "string" ? t : JSON.parse(t);
|
|
1440
1567
|
}
|
|
1441
1568
|
}, Y = {
|
|
1442
1569
|
/**
|
|
@@ -1694,7 +1821,7 @@ const W = {
|
|
|
1694
1821
|
*/
|
|
1695
1822
|
tag(t, ...e) {
|
|
1696
1823
|
return e = e.map((n) => {
|
|
1697
|
-
switch (
|
|
1824
|
+
switch (M.getDataType(n)) {
|
|
1698
1825
|
case "Object":
|
|
1699
1826
|
return n || "{}";
|
|
1700
1827
|
case "Array":
|
|
@@ -1739,15 +1866,22 @@ const W = {
|
|
|
1739
1866
|
* @returns 转换后的字符串,如果值为空,则返回空字符串
|
|
1740
1867
|
*/
|
|
1741
1868
|
asString(t) {
|
|
1742
|
-
if (
|
|
1869
|
+
if (M.isEmpty(t))
|
|
1743
1870
|
return "";
|
|
1744
|
-
switch (
|
|
1871
|
+
switch (M.getDataType(t)) {
|
|
1745
1872
|
case "Object":
|
|
1746
1873
|
case "Array":
|
|
1747
1874
|
return JSON.stringify(t);
|
|
1748
1875
|
default:
|
|
1749
1876
|
return t;
|
|
1750
1877
|
}
|
|
1878
|
+
},
|
|
1879
|
+
replaceAll(t, e, n) {
|
|
1880
|
+
if (!t)
|
|
1881
|
+
return t;
|
|
1882
|
+
for (; t.indexOf(e) > -1; )
|
|
1883
|
+
t = t.replace(e, n);
|
|
1884
|
+
return t;
|
|
1751
1885
|
}
|
|
1752
1886
|
}, g = class g {
|
|
1753
1887
|
static set(e, n = null, r = null) {
|
|
@@ -1800,10 +1934,10 @@ const W = {
|
|
|
1800
1934
|
}) : localStorage.clear();
|
|
1801
1935
|
}
|
|
1802
1936
|
};
|
|
1803
|
-
|
|
1937
|
+
d(g, "prefix", ""), d(g, "_getPrefixedKey", function(e, n) {
|
|
1804
1938
|
return n = n || {}, n.noPrefix ? e : g.prefix + e;
|
|
1805
1939
|
});
|
|
1806
|
-
let
|
|
1940
|
+
let x = g;
|
|
1807
1941
|
const Q = {
|
|
1808
1942
|
/**
|
|
1809
1943
|
* 将json对象转换为查询字符串
|
|
@@ -1837,9 +1971,9 @@ const Q = {
|
|
|
1837
1971
|
const l = c.replace(/#|\//g, "").split("?");
|
|
1838
1972
|
if (l.length > 1)
|
|
1839
1973
|
for (let u = 1; u < l.length; u++) {
|
|
1840
|
-
let
|
|
1841
|
-
for (;
|
|
1842
|
-
o[
|
|
1974
|
+
let f;
|
|
1975
|
+
for (; f = n.exec(l[u]); )
|
|
1976
|
+
o[f[1]] = e ? decodeURIComponent(f[2]) : f[2];
|
|
1843
1977
|
}
|
|
1844
1978
|
}
|
|
1845
1979
|
}
|
|
@@ -1850,29 +1984,29 @@ export {
|
|
|
1850
1984
|
F as ArrayUtil,
|
|
1851
1985
|
N as AudioPlayer,
|
|
1852
1986
|
$ as BrowserUtil,
|
|
1853
|
-
|
|
1987
|
+
C as CanvasDrawer,
|
|
1854
1988
|
J as ColorUtil,
|
|
1855
|
-
|
|
1856
|
-
|
|
1989
|
+
B as Cookie,
|
|
1990
|
+
G as CoordsUtil,
|
|
1857
1991
|
q as DateUtil,
|
|
1858
1992
|
W as DomUtil,
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1993
|
+
O as ErrorType,
|
|
1994
|
+
T as EventDispatcher,
|
|
1995
|
+
R as EventType,
|
|
1862
1996
|
Y as FileUtil,
|
|
1863
1997
|
j as GeoJsonUtil,
|
|
1864
1998
|
H as GeoUtil,
|
|
1865
1999
|
_ as GraphicType,
|
|
1866
|
-
|
|
1867
|
-
|
|
2000
|
+
A as HashMap,
|
|
2001
|
+
P as LayerType,
|
|
1868
2002
|
m as MathUtil,
|
|
1869
|
-
|
|
1870
|
-
|
|
2003
|
+
L as MeasureMode,
|
|
2004
|
+
k as ObjectState,
|
|
1871
2005
|
K as ObjectUtil,
|
|
1872
2006
|
z as OptimizeUtil,
|
|
1873
|
-
|
|
2007
|
+
x as StoreUtil,
|
|
1874
2008
|
X as StringUtil,
|
|
1875
2009
|
Q as UrlUtil,
|
|
1876
|
-
|
|
2010
|
+
M as Util,
|
|
1877
2011
|
U as WebSocketClient
|
|
1878
2012
|
};
|
package/dist/gis-common.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(f=typeof globalThis<"u"?globalThis:f||self,g(f["gis-common"]={}))})(this,function(f){"use strict";var X=Object.defineProperty;var Q=(f,g,R)=>g in f?X(f,g,{enumerable:!0,configurable:!0,writable:!0,value:R}):f[g]=R;var p=(f,g,R)=>Q(f,typeof g!="symbol"?g+"":g,R);const g={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},R={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},A={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},C={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},T={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},I={ADD:"add",REMOVE:"remove",INIT:"init"};class v{constructor(e){p(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}const M={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)},minMax(t,e,n){return Math.min(Math.max(t,e),n)},maxMin(t,e,n){return Math.max(Math.min(t,n),e)}};class P{constructor(e){p(this,"context",null);if(typeof e=="string"&&(e=document.querySelector("#"+e),!e))throw new Error("Element not found");if(e instanceof HTMLElement){const n=e;if(n.getContext)this.context=n.getContext("2d");else throw new Error("getContext is not available on this element")}else throw new Error("Element is not an HTMLElement")}drawLine({x:e,y:n},{x:r,y:s},i={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const o=i.width||1,a=i.color||"#000";this.context.lineWidth=o,this.context.strokeStyle=a,this.context.moveTo(e,n),this.context.lineTo(r,s),this.context.stroke()}drawArc({x:e,y:n},r,s,i,o,a,c){if(!this.context)throw new Error("Canvas context is null or undefined");a?(this.context.fillStyle=c,this.context.beginPath(),this.context.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(i),o),this.context.fill()):(this.context.strokeStyle=c,this.context.beginPath(),this.context.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(i),o),this.context.stroke())}static createCanvas(e=1,n=1){let r;if(typeof document<"u")return r=document.createElement("canvas"),e&&(r.width=e),n&&(r.height=n),r}}class x{constructor(){p(this,"_listeners");p(this,"_mutex",{});p(this,"_context")}addEventListener(e,n,r,s=!1){this._listeners===void 0&&(this._listeners={}),this._context=r;const i=this._mutex,o=this._listeners;return o[e]===void 0&&(o[e]=[]),o[e].indexOf(n)===-1&&(s&&(i[e]=n),o[e].push(n)),this}hasEventListener(e,n){if(this._listeners===null||this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const s=this._listeners[e];if(this._mutex[e]===n&&(this._mutex[e]=null),s!==void 0){const i=s.map(o=>o.toString()).indexOf(n.toString());i!==-1&&s.splice(i,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const s=r.slice(0);if(this._mutex[e.type]!==void 0){const i=s.find(o=>o===this._mutex[e.type]);if(i){i.call(this._context||this,e);return}}for(let i=0,o=s.length;i<o;i++){const a=s[i];typeof a=="function"&&a.call(this._context||this,e)}}}removeAllListener(){this._mutex={};for(const e in this._listeners)this._listeners[e]=[]}}class O extends Map{isEmpty(){return this.size===0}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}fromEntries(){}}O.prototype.fromEntries=function(t=[]){const e=new O;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class _ extends x{constructor(n="ws://127.0.0.1:10088"){super();p(this,"maxCheckTimes",10);p(this,"url");p(this,"checkTimes",0);p(this,"connectStatus",!1);p(this,"client",null);this.maxCheckTimes=10,this.url=n,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const n=this;this.client.onopen=function(r){n.dispatchEvent({type:g.WEB_SOCKET_CONNECT,message:r})},this.client.onmessage=function(r){n.connectStatus=!0,n.dispatchEvent({type:g.WEB_SOCKET_MESSAGE,message:r})},this.client.onclose=function(r){n.dispatchEvent({type:g.WEB_SOCKET_CLOSE,message:r})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(r){n.dispatchEvent({type:g.WEB_SOCKET_ERROR,message:r})})}}catch(n){console.error("创建ws连接失败"+this.url+":"+n)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(n){this.checkTimes>n||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(n)},2e3)}send(n){return this.client&&this.client.readyState===1?(this.client.send(n),!0):(console.error(this.url+"消息发送失败:"+n),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}}const S={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},generateGuid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const s=n[r];t[0]===s&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,s,i;for(r=0,s=e.length;r<s;r++){i=e[r];for(n in i)t[n]=i[n]}return t},convertToTree2(t,e="id",n="parentId",r="children"){const s=[];function i(o){const a=t.filter(c=>c[n]===o[e]).map(c=>(s.some(h=>h[e]===c[e])||i(c),c));a.length>0&&(o[r]=a)}return t.forEach(o=>{t.some(a=>a[n]===o[e])||(i(o),s.push(o))}),s},asyncLoadScript(t){return new Promise((e,n)=>{try{const r=document.createElement("script");r.type="text/javascript",r.src=t,"readyState"in r?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:(r.onload=function(){e(r)},r.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(r)}catch(r){n(r)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${e}`)},document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,(r,s)=>{const i=e[s];if(i===void 0)throw new Error(`${R.JSON_VALUE_ERROR}: ${r}`);return typeof i=="function"?i(e):i})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(t,...e){(typeof t!="object"||t===null)&&(t={});for(const n of e)if(typeof n=="object"&&n!==null)for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(typeof n[r]=="object"&&n[r]!==null?(t[r]||(t[r]=Array.isArray(n[r])?[]:{}),this.deepAssign(t[r],n[r])):t[r]=n[r]);return t},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,r)=>{try{document.execCommand("copy"),n()}catch{r(new Error("copy failed"))}finally{e.remove()}})}},isArray(t){return Array.isArray(t)},isObject(t){return Object.prototype.toString.call(t).indexOf("Object")>-1},isNil(t){return typeof t>"u"||t===null}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const s=t(r),i=String(s);n[i]||(n[i]=!0,e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.clear=function(){return this.length=0,this};const L={asArray(t){return S.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},U={getExplorer(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||/Trident\//.test(t)?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0&&t.indexOf("Chrome")===-1?"Safari":"Unknown"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,s=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":s&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():"msRequestFullscreen"in e?e.msRequestFullscreen():"mozRequestFullScreen"in e?e.mozRequestFullScreen():"webkitRequestFullscreen"in e&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth||0,e=document.documentElement.clientHeight||0,n=document.getElementById("app");if(!n)return;const r=n.style,s=t/e,i=16/9;let o=t/1920;s>i&&(o=e/1080),r.transformOrigin="left top",r.transform=`scale(${o}) translateX(-49.99%)`,r.width=`${t/o}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e&&(e.style.fontSize=t/192+"px")}},N={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},k={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let s=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const o=t/180*this.PI;let a=Math.sin(o);a=1-r*a*a;const c=Math.sqrt(a);return s=s*180/(6378245*(1-r)/(a*c)*this.PI),i=i*180/(6378245/c*Math.cos(o)*this.PI),{lat:s,lng:i}},outOfChina(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let s=.01,i=.01,o=t-s,a=e-i,c=t+s,h=e+i,l=0,u=0,d=0;for(;;){l=(o+c)/2,u=(a+h)/2;const y=this.gcjEncrypt(l,u);if(s=y.lat-t,i=y.lng-e,Math.abs(s)<1e-9&&Math.abs(i)<1e-9||(s>0?c=l:o=l,i>0?h=u:a=u,++d>1e4))break}return{lat:l,lng:u}},bdEncrypt(t,e){const n=e,r=t,s=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i)+.0065;return{lat:s*Math.sin(i)+.006,lng:o}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,s=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i);return{lat:s*Math.sin(i),lng:o}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},randomCoordinate(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}},F={rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},rgbToRgba(t){const e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?`rgba(${e[1]}, 1)`:t},hexToRgba(t){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,n=t.replace(e,(c,h,l,u)=>h+h+l+l+u+u),s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!s)return t;const i=parseInt(s[1],16),o=parseInt(s[2],16),a=parseInt(s[3],16);return`rgba(${i},${o},${a},1)`},hslToRgba(t){if(!t)return null;const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)return null;const n=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function o(l,u,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?l+(u-l)*6*d:d<1/2?u:d<2/3?l+(u-l)*(2/3-d)*6:l}let a,c,h;if(r===0)a=c=h=s;else{const l=s<.5?s*(1+r):s+r-s*r,u=2*s-l;a=o(u,l,n+1/3),c=o(u,l,n),h=o(u,l,n-1/3)}return`rgba(${Math.round(a*255)},${Math.round(c*255)},${Math.round(h*255)},${i})`},isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},isRgb(t){return/^rgb/.test(t)},isHsl(t){return/^hsl/.test(t)},isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)},colorToRgb(t){if(this.isRgb(t))return this.rgbToRgba(t);if(this.isHex(t))return this.hexToRgba(t);if(this.isHsl(t))return this.hslToRgba(t)}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)if(new RegExp("("+n+")").test(t)){const r=n.length===1?1:Number(n.slice(1));t=t.replace(RegExp.$1,("00"+e[n]).substr((""+e[n]).length+r-(e[n]+"").length))}return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const $={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),s=new Date(e).getTime()-n.getTime(),i=Math.floor(s/(24*3600*1e3)),o=s%(24*3600*1e3),a=Math.floor(o/(3600*1e3)),c=o%(3600*1e3),h=Math.floor(c/(60*1e3)),l=c%(60*1e3),u=Math.round(l/1e3);let d="";return i>0&&(d+=i+"天"),a>0&&(d+=a+"时"),h>0&&(d+=h+"分"),u>0&&(d+=u+"秒"),i===0&&a===0&&h===0&&u===0&&(d="少于1秒"),d},formatterCounter(t){const e=function(a){return(a>10?"":"0")+(a||0)},n=e(Math.floor(t/3600)),r=t%3600,s=e(Math.floor(r/60)),i=r%60,o=e(Math.round(i));return`${n}:${s}:${o}`},sleep(t){}};function G(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function b(t){return G(t).split(/\s+/)}const B={getStyle(t,e){var r;let n=t.style[e];if(!n||n==="auto"){const s=(r=document.defaultView)==null?void 0:r.getComputedStyle(t,null);n=s?s[e]:null,n==="auto"&&(n=null)}return n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return((t==null?void 0:t.host)||t).className.toString()},hasClass(t,e){var r;if((r=t.classList)!=null&&r.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(t.classList!==void 0){const n=b(e);for(let r=0,s=n.length;r<s;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?b(e).forEach(r=>t.classList.remove(r)):this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach(n=>t.classList.add(n)))},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},J={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return!isNaN(t)&&!isNaN(e)&&+e>-90&&+e<90&&+t>-180&&+t<180},distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},distanceByPoints(t,e){const{lng:n,lat:r}=t,{lng:s,lat:i}=e,o=6371e3,a=Math.cos(r*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-s)*Math.PI/180),c=Math.sin(r*Math.PI/180)*Math.sin(i*Math.PI/180);let h=a+c;return h>1&&(h=1),h<-1&&(h=-1),Math.acos(h)*o},formatLnglat(t,e){let n="";function r(s){const i=Math.floor(s),o=Math.floor((s-i)*60),a=(s-i)*3600-o*60;return`${i}°${o}′${a.toFixed(2)}″`}return this.isLnglat(t,e)?n=r(t)+","+r(e):isNaN(t)?isNaN(e)||(n=r(e)):n=r(t),n},transformLnglat(t,e){function n(r){let i=/[sw]/i.test(r)?-1:1;const o=r.match(/[\d.]+/g)||[];let a=0;for(let c=0;c<o.length;c++)a+=parseFloat(o[c])/i,i*=60;return a}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,s=!1,i=0,o=e.length,a=o-1;i<o;a=i,i++){var c=e[i].x,h=e[i].y,l=e[a].x,u=e[a].y;if(c===n&&h===r||l===n&&u===r)return"on";if(h<r&&u>=r||h>=r&&u<r){var d=c+(r-h)*(l-c)/(u-h);if(d===n)return"on";d>n&&(s=!s)}}return s?"in":"out"},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,s=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:s}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,o=s-n,a=i-r,c=Math.sqrt(o*o+a*a);return{angle:(Math.atan2(a,o)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=t.lat*1,r=t.lng*1,s=e.lat*1,i=e.lng*1,o=Math.sin((i-r)*this.toRadian)*Math.cos(s*this.toRadian),a=Math.cos(n*this.toRadian)*Math.sin(s*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.cos((i-r)*this.toRadian),c=Math.atan2(o,a)*(180/Math.PI),h=(s-n)*this.toRadian,l=(i-r)*this.toRadian,u=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.sin(l/2)*Math.sin(l/2),d=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),y=this.R*d;return{angle:c,distance:y}},distanceToSegment(t,e,n){const r=t.x,s=t.y,i=e.x,o=e.y,a=n.x,c=n.y,h=(a-i)*(r-i)+(c-o)*(s-o);if(h<=0)return Math.sqrt((r-i)*(r-i)+(s-o)*(s-o));const l=(a-i)*(a-i)+(c-o)*(c-o);if(h>=l)return Math.sqrt((r-a)*(r-a)+(s-c)*(s-c));const u=h/l,d=i+(a-i)*u,y=o+(c-o)*u;return Math.sqrt((r-d)*(r-d)+(s-y)*(s-y))},calcPointByBearAndDis(t,e,n){const r=M.toRadians(t.lat*1),s=M.toRadians(t.lng*1),i=n/this.R;e=M.toRadians(e);const o=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),a=s+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(o));return{lat:M.toDegrees(o),lng:M.toDegrees(a)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const s=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:s}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var s=e*Math.PI/180;const i=n/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)));return{x:r,y:i}}},E=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],q={getGeoJSONType(t){return t.geometry?t.geometry.type:null},isGeoJSON(t){const e=this.getGeoJSONType(t);if(e){for(let n=0,r=E.length;n<r;n++)if(E[n]===e)return!0}return!1},isGeoJSONPolygon(t){const e=this.getGeoJSONType(t);return!!(e&&(e===E[4]||e===E[5]))},isGeoJSONLine(t){const e=this.getGeoJSONType(t);return!!(e&&(e===E[2]||e===E[3]))},isGeoJSONPoint(t){const e=this.getGeoJSONType(t);return!!(e&&(e===E[0]||e===E[1]))},isGeoJSONMulti(t){const e=this.getGeoJSONType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJSONCoordinates(t){return t.geometry?t.geometry.coordinates:[]},getGeoJSONCenter(t,e){const n=this.getGeoJSONType(t);if(!n||!t.geometry)return null;const s=t.geometry.coordinates;if(!s)return null;let i=0,o=0,a=0;switch(n){case"Point":{i=s[0],o=s[1],a++;break}case"MultiPoint":case"LineString":{for(let l=0,u=s.length;l<u;l++)i+=s[l][0],o+=s[l][1],a++;break}case"MultiLineString":case"Polygon":{for(let l=0,u=s.length;l<u;l++)for(let d=0,y=s[l].length;d<y;d++)i+=s[l][d][0],o+=s[l][d][1],a++;break}case"MultiPolygon":{for(let l=0,u=s.length;l<u;l++)for(let d=0,y=s[l].length;d<y;d++)for(let w=0,z=s[l][d].length;w<z;w++)i+=s[l][d][w][0],o+=s[l][d][w][1],a++;break}}const c=i/a,h=o/a;return e?(e.x=c,e.y=h,e):{x:c,y:h}},spliteGeoJSONMulti(t){const e=this.getGeoJSONType(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},s=n.coordinates;if(!s)return null;const i=[];let o;switch(e){case"MultiPoint":{o="Point";break}case"MultiLineString":{o="LineString";break}case"MultiPolygon":{o="Polygon";break}}if(o)for(let a=0,c=s.length;a<c;a++)i.push({type:"Feature",geometry:{type:o,coordinates:s[a]},properties:r});else i.push(t);return i}},W={deepClone(t){return structuredClone(t)},isEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)}},j={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);const s=new Uint8Array(r);return new Blob([s],{type:e})},convertUrlToBase64(t,e,n){return new Promise((r,s)=>{var i=new Image;i.crossOrigin="Anonymous",i.src=t,i.onload=function(){var o=document.createElement("canvas");o.width=e||i.width,o.height=n||i.height;var a=o.getContext("2d");if(!a){s(new Error("Failed to get canvas context"));return}a.drawImage(i,0,0,i.width,i.height);var c=i.src.substring(i.src.lastIndexOf(".")+1).toLowerCase(),h=o.toDataURL("image/"+c),l={dataURL:h,type:"image/"+c,ext:c};r(l)},i.onerror=s})},convertBase64ToFile(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/png",i=atob(n[1]),o=new Uint8Array(i.length);for(let c=0;c<i.length;c++)o[c]=i.charCodeAt(c);return new File([o],e,{type:s})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),s=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(s)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},H={debounce(t,e,n=!0){let r=null,s,i,o;const a=()=>{const c=Date.now()-i;c<e&&c>0?r=setTimeout(a,e-c):(r=null,n||(o=t.apply(this,s)))};return(...c)=>{i=Date.now();const h=n&&!r;return r||(r=setTimeout(a,e)),h&&(o=t.apply(this,c),r||(c=null)),o}},throttle(t,e,n=1){let r=0,s=null;return(...i)=>{if(n===1){const o=Date.now();o-r>=e&&(t.apply(this,i),r=o)}else n===2&&(s||(s=setTimeout(()=>{s=null,t.apply(this,i)},e)))}},memoize(t){const e=new Map;return(...n)=>{const r=JSON.stringify(n);if(e.has(r))return e.get(r);{const s=t.apply(this,n);return e.set(r,s),s}}},recurve(t,e=500,n=5e3){let r=0;setTimeout(()=>{r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))},e)}},K={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(S.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,s)=>`${n}${e[s-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var s=Math.floor(n/2),i=s;i<t.length;i++){let o=t.substring(e,i);if(o.replace(r,"mm").length>=n)return o}return t},asString(t){if(S.isEmpty(t))return"";switch(S.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}}},m=class m{static set(e,n=null,r=null){var s=this._getPrefixedKey(e,r);try{localStorage.setItem(s,JSON.stringify({data:n}))}catch{console&&console.warn("StoreUtil didn't successfully save the '{"+e+": "+n+"}' pair, because the localStorage is full.")}}static get(e,n,r){var s=this._getPrefixedKey(e,r),i;try{i=JSON.parse(localStorage.getItem(s)||"")}catch{localStorage[s]?i={data:localStorage.getItem(s)}:i=null}if(i){if(typeof i=="object"&&typeof i.data<"u")return i.data}else return n}static keys(){const e=[];var n=Object.keys(localStorage);return m.prefix.length===0?n:(n.forEach(function(r){r.indexOf(m.prefix)!==-1&&e.push(r.replace(m.prefix,""))}),e)}static getAll(e){var n=m.keys();if(e){const r=[];return n.forEach(s=>{if(e.includes(s)){const i={};i[s]=m.get(s,null,null),r.push(i)}}),r}return n.map(r=>m.get(r,null,null))}static remove(e,n){var r=this._getPrefixedKey(e,n);localStorage.removeItem(r)}static clear(e){m.prefix.length?this.keys().forEach(n=>{localStorage.removeItem(this._getPrefixedKey(n,e))}):localStorage.clear()}};p(m,"prefix",""),p(m,"_getPrefixedKey",function(e,n){return n=n||{},n.noPrefix?e:m.prefix+e});let D=m;const Y={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var r=n,s=t[n];e.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}var i=e.join("&");return i},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:s}=new URL(t),i=[r,s];let o={};for(let a=0;a<i.length;a++){const c=i[a];if(c){const l=c.replace(/#|\//g,"").split("?");if(l.length>1)for(let u=1;u<l.length;u++){let d;for(;d=n.exec(l[u]);)o[d[1]]=e?decodeURIComponent(d[2]):d[2]}}}return o}};f.ArrayUtil=L,f.AudioPlayer=v,f.BrowserUtil=U,f.CanvasDrawer=P,f.ColorUtil=F,f.Cookie=N,f.CoordsUtil=k,f.DateUtil=$,f.DomUtil=B,f.ErrorType=R,f.EventDispatcher=x,f.EventType=g,f.FileUtil=j,f.GeoJsonUtil=q,f.GeoUtil=J,f.GraphicType=C,f.HashMap=O,f.LayerType=A,f.MathUtil=M,f.MeasureMode=T,f.ObjectState=I,f.ObjectUtil=W,f.OptimizeUtil=H,f.StoreUtil=D,f.StringUtil=K,f.UrlUtil=Y,f.Util=S,f.WebSocketClient=_,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(d,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(d=typeof globalThis<"u"?globalThis:d||self,g(d["gis-common"]={}))})(this,function(d){"use strict";var X=Object.defineProperty;var Q=(d,g,R)=>g in d?X(d,g,{enumerable:!0,configurable:!0,writable:!0,value:R}):d[g]=R;var p=(d,g,R)=>Q(d,typeof g!="symbol"?g+"":g,R);const g={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},R={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},C={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},T={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},I={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},v={ADD:"add",REMOVE:"remove",INIT:"init"};class P{constructor(e){p(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}const M={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)},minMax(t,e,n){return Math.min(Math.max(t,e),n)},maxMin(t,e,n){return Math.max(Math.min(t,n),e)}};class b{constructor(e){p(this,"context",null);if(typeof e=="string"&&(e=document.querySelector("#"+e),!e))throw new Error("Element not found");if(e instanceof HTMLElement){const n=e;if(n.getContext)this.context=n.getContext("2d");else throw new Error("getContext is not available on this element")}else throw new Error("Element is not an HTMLElement")}drawLine({x:e,y:n},{x:r,y:s},i={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const o=i.width||1,a=i.color||"#000";this.context.lineWidth=o,this.context.strokeStyle=a,this.context.moveTo(e,n),this.context.lineTo(r,s),this.context.stroke()}drawArc({x:e,y:n},r,s,i,o,a,c){if(!this.context)throw new Error("Canvas context is null or undefined");a?(this.context.fillStyle=c,this.context.beginPath(),this.context.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(i),o),this.context.fill()):(this.context.strokeStyle=c,this.context.beginPath(),this.context.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(i),o),this.context.stroke())}static createCanvas(e=1,n=1){let r;if(typeof document<"u")return r=document.createElement("canvas"),e&&(r.width=e),n&&(r.height=n),r}}p(b,"emptyImageUrl","data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");class O{constructor(){p(this,"_listeners");p(this,"_mutex",{});p(this,"_context")}addEventListener(e,n,r,s=!1){this._listeners===void 0&&(this._listeners={}),this._context=r;const i=this._mutex,o=this._listeners;return o[e]===void 0&&(o[e]=[]),o[e].indexOf(n)===-1&&(s&&(i[e]=n),o[e].push(n)),this}hasEventListener(e,n){if(this._listeners===null||this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const s=this._listeners[e];if(this._mutex[e]===n&&(this._mutex[e]=null),s!==void 0){const i=s.map(o=>o.toString()).indexOf(n.toString());i!==-1&&s.splice(i,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const s=r.slice(0);if(this._mutex[e.type]!==void 0){const i=s.find(o=>o===this._mutex[e.type]);if(i){i.call(this._context||this,e);return}}for(let i=0,o=s.length;i<o;i++){const a=s[i];typeof a=="function"&&a.call(this._context||this,e)}}}removeAllListener(){this._mutex={};for(const e in this._listeners)this._listeners[e]=[]}}class S extends Map{isEmpty(){return this.size===0}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}fromEntries(){}}S.prototype.fromEntries=function(t=[]){const e=new S;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class _ extends O{constructor(n="ws://127.0.0.1:10088"){super();p(this,"maxCheckTimes",10);p(this,"url");p(this,"checkTimes",0);p(this,"connectStatus",!1);p(this,"client",null);this.maxCheckTimes=10,this.url=n,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const n=this;this.client.onopen=function(r){n.dispatchEvent({type:g.WEB_SOCKET_CONNECT,message:r})},this.client.onmessage=function(r){n.connectStatus=!0,n.dispatchEvent({type:g.WEB_SOCKET_MESSAGE,message:r})},this.client.onclose=function(r){n.dispatchEvent({type:g.WEB_SOCKET_CLOSE,message:r})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(r){n.dispatchEvent({type:g.WEB_SOCKET_ERROR,message:r})})}}catch(n){console.error("创建ws连接失败"+this.url+":"+n)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(n){this.checkTimes>n||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(n)},2e3)}send(n){return this.client&&this.client.readyState===1?(this.client.send(n),!0):(console.error(this.url+"消息发送失败:"+n),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}}const A={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},guid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const s=n[r];t[0]===s&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,s,i;for(r=0,s=e.length;r<s;r++){i=e[r];for(n in i)t[n]=i[n]}return t},convertToTree2(t,e="id",n="parentId",r="children"){const s=[];function i(o){const a=t.filter(c=>c[n]===o[e]).map(c=>(s.some(h=>h[e]===c[e])||i(c),c));a.length>0&&(o[r]=a)}return t.forEach(o=>{t.some(a=>a[n]===o[e])||(i(o),s.push(o))}),s},asyncLoadScript(t){return new Promise((e,n)=>{try{const r=document.createElement("script");r.type="text/javascript",r.src=t,"readyState"in r?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:(r.onload=function(){e(r)},r.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(r)}catch(r){n(r)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${e}`)},document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,(r,s)=>{const i=e[s];if(i===void 0)throw new Error(`${R.JSON_VALUE_ERROR}: ${r}`);return typeof i=="function"?i(e):i})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(t,...e){(typeof t!="object"||t===null)&&(t={});for(const n of e)if(typeof n=="object"&&n!==null)for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(typeof n[r]=="object"&&n[r]!==null?(t[r]||(t[r]=Array.isArray(n[r])?[]:{}),this.deepAssign(t[r],n[r])):t[r]=n[r]);return t},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,r)=>{try{document.execCommand("copy"),n()}catch{r(new Error("copy failed"))}finally{e.remove()}})}},isArray(t){return Array.isArray(t)},isObject(t){return Object.prototype.toString.call(t).indexOf("Object")>-1},isNil(t){return t===void 0||t==="undefined"||t===null||t==="null"},isNumber(t){return typeof t=="number"&&!isNaN(t)||typeof t=="string"&&Number.isFinite(+t)}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const s=t(r),i=String(s);n[i]||(n[i]=!0,e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this},Array.prototype.clear=function(){return this.length=0,this};const L={asArray(t){return A.isEmpty(t)?[]:Array.isArray(t)?t:[t]},create(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},U={getExplorer(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||/Trident\//.test(t)?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0&&t.indexOf("Chrome")===-1?"Safari":"Unknown"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,s=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":s&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():"msRequestFullscreen"in e?e.msRequestFullscreen():"mozRequestFullScreen"in e?e.mozRequestFullScreen():"webkitRequestFullscreen"in e&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth||0,e=document.documentElement.clientHeight||0,n=document.getElementById("app");if(!n)return;const r=n.style,s=t/e,i=16/9;let o=t/1920;s>i&&(o=e/1080),r.transformOrigin="left top",r.transform=`scale(${o}) translateX(-49.99%)`,r.width=`${t/o}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e&&(e.style.fontSize=t/192+"px")}},k={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},N={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let s=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const o=t/180*this.PI;let a=Math.sin(o);a=1-r*a*a;const c=Math.sqrt(a);return s=s*180/(6378245*(1-r)/(a*c)*this.PI),i=i*180/(6378245/c*Math.cos(o)*this.PI),{lat:s,lng:i}},outOfChina(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let s=.01,i=.01,o=t-s,a=e-i,c=t+s,h=e+i,l=0,u=0,f=0;for(;;){l=(o+c)/2,u=(a+h)/2;const y=this.gcjEncrypt(l,u);if(s=y.lat-t,i=y.lng-e,Math.abs(s)<1e-9&&Math.abs(i)<1e-9||(s>0?c=l:o=l,i>0?h=u:a=u,++f>1e4))break}return{lat:l,lng:u}},bdEncrypt(t,e){const n=e,r=t,s=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i)+.0065;return{lat:s*Math.sin(i)+.006,lng:o}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,s=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i);return{lat:s*Math.sin(i),lng:o}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},random({x:t,y:e},{x:n,y:r}){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}},deCompose(t,e,n){if(!Array.isArray(t))return n?e.call(n,t):e(t);const r=[];let s,i;for(let o=0,a=t.length;o<a;o++){if(s=t[o],A.isNil(s)){r.push(null);continue}Array.isArray(s)?r.push(this.deCompose(s,e,n)):(i=n?e.call(n,s):e(s),r.push(i))}return r}},F={random(){let t=Math.floor(Math.random()*256).toString(16),e=Math.floor(Math.random()*256).toString(16),n=Math.floor(Math.random()*256).toString(16);return t=t.length===1?"0"+t:t,e=e.length===1?"0"+e:e,n=n.length===1?"0"+n:n,"#"+t+e+n},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},rgbToRgba(t){const e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?`rgba(${e[1]}, 1)`:t},hexToRgba(t){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,n=t.replace(e,(c,h,l,u)=>h+h+l+l+u+u),s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!s)return t;const i=parseInt(s[1],16),o=parseInt(s[2],16),a=parseInt(s[3],16);return`rgba(${i},${o},${a},1)`},hslToRgba(t){if(!t)return null;const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)return null;const n=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function o(l,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?l+(u-l)*6*f:f<1/2?u:f<2/3?l+(u-l)*(2/3-f)*6:l}let a,c,h;if(r===0)a=c=h=s;else{const l=s<.5?s*(1+r):s+r-s*r,u=2*s-l;a=o(u,l,n+1/3),c=o(u,l,n),h=o(u,l,n-1/3)}return`rgba(${Math.round(a*255)},${Math.round(c*255)},${Math.round(h*255)},${i})`},isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},isRgb(t){return/^rgb/.test(t)},isHsl(t){return/^hsl/.test(t)},isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)},colorToRgb(t){if(this.isRgb(t))return this.rgbToRgba(t);if(this.isHex(t))return this.hexToRgba(t);if(this.isHsl(t))return this.hslToRgba(t)}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)if(new RegExp("("+n+")").test(t)){const r=n.length===1?1:Number(n.slice(1));t=t.replace(RegExp.$1,("00"+e[n]).substr((""+e[n]).length+r-(e[n]+"").length))}return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const $={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),s=new Date(e).getTime()-n.getTime(),i=Math.floor(s/(24*3600*1e3)),o=s%(24*3600*1e3),a=Math.floor(o/(3600*1e3)),c=o%(3600*1e3),h=Math.floor(c/(60*1e3)),l=c%(60*1e3),u=Math.round(l/1e3);let f="";return i>0&&(f+=i+"天"),a>0&&(f+=a+"时"),h>0&&(f+=h+"分"),u>0&&(f+=u+"秒"),i===0&&a===0&&h===0&&u===0&&(f="少于1秒"),f},formatterCounter(t){const e=function(a){return(a>10?"":"0")+(a||0)},n=e(Math.floor(t/3600)),r=t%3600,s=e(Math.floor(r/60)),i=r%60,o=e(Math.round(i));return`${n}:${s}:${o}`},sleep(t){}};function G(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function x(t){return G(t).split(/\s+/)}const B={getStyle(t,e){var r;let n=t.style[e];if(!n||n==="auto"){const s=(r=document.defaultView)==null?void 0:r.getComputedStyle(t,null);n=s?s[e]:null,n==="auto"&&(n=null)}return n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return((t==null?void 0:t.host)||t).className.toString()},hasClass(t,e){var r;if((r=t.classList)!=null&&r.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(t.classList!==void 0){const n=x(e);for(let r=0,s=n.length;r<s;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?x(e).forEach(r=>t.classList.remove(r)):this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach(n=>t.classList.add(n)))},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},J={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return!isNaN(t)&&!isNaN(e)&&+e>-90&&+e<90&&+t>-180&&+t<180},distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},distanceByPoints(t,e){const{lng:n,lat:r}=t,{lng:s,lat:i}=e,o=6371e3,a=Math.cos(r*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-s)*Math.PI/180),c=Math.sin(r*Math.PI/180)*Math.sin(i*Math.PI/180);let h=a+c;return h>1&&(h=1),h<-1&&(h=-1),Math.acos(h)*o},formatLnglat(t,e){let n="";function r(s){const i=Math.floor(s),o=Math.floor((s-i)*60),a=(s-i)*3600-o*60;return`${i}°${o}′${a.toFixed(2)}″`}return this.isLnglat(t,e)?n=r(t)+","+r(e):isNaN(t)?isNaN(e)||(n=r(e)):n=r(t),n},transformLnglat(t,e){function n(r){let i=/[sw]/i.test(r)?-1:1;const o=r.match(/[\d.]+/g)||[];let a=0;for(let c=0;c<o.length;c++)a+=parseFloat(o[c])/i,i*=60;return a}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,s=!1,i=0,o=e.length,a=o-1;i<o;a=i,i++){var c=e[i].x,h=e[i].y,l=e[a].x,u=e[a].y;if(c===n&&h===r||l===n&&u===r)return"on";if(h<r&&u>=r||h>=r&&u<r){var f=c+(r-h)*(l-c)/(u-h);if(f===n)return"on";f>n&&(s=!s)}}return s?"in":"out"},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,s=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:s}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,o=s-n,a=i-r,c=Math.sqrt(o*o+a*a);return{angle:(Math.atan2(a,o)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=t.lat*1,r=t.lng*1,s=e.lat*1,i=e.lng*1,o=Math.sin((i-r)*this.toRadian)*Math.cos(s*this.toRadian),a=Math.cos(n*this.toRadian)*Math.sin(s*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.cos((i-r)*this.toRadian),c=Math.atan2(o,a)*(180/Math.PI),h=(s-n)*this.toRadian,l=(i-r)*this.toRadian,u=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.sin(l/2)*Math.sin(l/2),f=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),y=this.R*f;return{angle:c,distance:y}},distanceToSegment(t,e,n){const r=t.x,s=t.y,i=e.x,o=e.y,a=n.x,c=n.y,h=(a-i)*(r-i)+(c-o)*(s-o);if(h<=0)return Math.sqrt((r-i)*(r-i)+(s-o)*(s-o));const l=(a-i)*(a-i)+(c-o)*(c-o);if(h>=l)return Math.sqrt((r-a)*(r-a)+(s-c)*(s-c));const u=h/l,f=i+(a-i)*u,y=o+(c-o)*u;return Math.sqrt((r-f)*(r-f)+(s-y)*(s-y))},calcPointByBearAndDis(t,e,n){const r=M.toRadians(t.lat*1),s=M.toRadians(t.lng*1),i=n/this.R;e=M.toRadians(e);const o=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),a=s+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(o));return{lat:M.toDegrees(o),lng:M.toDegrees(a)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const s=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:s}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var s=e*Math.PI/180;const i=n/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)));return{x:r,y:i}}},E=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],j={getGeoJsonType(t){return t.geometry?t.geometry.type:null},isGeoJson(t){const e=this.getGeoJsonType(t);if(e){for(let n=0,r=E.length;n<r;n++)if(E[n]===e)return!0}return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!!(e&&(e===E[4]||e===E[5]))},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!!(e&&(e===E[2]||e===E[3]))},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!!(e&&(e===E[0]||e===E[1]))},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates(t){return t.geometry?t.geometry.coordinates:[]},getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const s=t.geometry.coordinates;if(!s)return null;let i=0,o=0,a=0;switch(n){case"Point":{i=s[0],o=s[1],a++;break}case"MultiPoint":case"LineString":{for(let l=0,u=s.length;l<u;l++)i+=s[l][0],o+=s[l][1],a++;break}case"MultiLineString":case"Polygon":{for(let l=0,u=s.length;l<u;l++)for(let f=0,y=s[l].length;f<y;f++)i+=s[l][f][0],o+=s[l][f][1],a++;break}case"MultiPolygon":{for(let l=0,u=s.length;l<u;l++)for(let f=0,y=s[l].length;f<y;f++)for(let w=0,z=s[l][f].length;w<z;w++)i+=s[l][f][w][0],o+=s[l][f][w][1],a++;break}}const c=i/a,h=o/a;return e?(e.x=c,e.y=h,e):{x:c,y:h}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},s=n.coordinates;if(!s)return null;const i=[];let o;switch(e){case"MultiPoint":{o="Point";break}case"MultiLineString":{o="LineString";break}case"MultiPolygon":{o="Polygon";break}}if(o)for(let a=0,c=s.length;a<c;a++)i.push({type:"Feature",geometry:{type:o,coordinates:s[a]},properties:r});else i.push(t);return i},getGeoJsonByCoordinates(t){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let e;if(t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number")e="Point";else if(Array.isArray(t[0])&&t[0].length===2)e="LineString";else if(Array.isArray(t[0])&&Array.isArray(t[0][0])){const n=t[0];if(n[0].join(",")===n[n.length-1].join(","))e="Polygon";else if(t.length>1)e="MultiPolygon";else throw Error("coordinates 参数格式错误")}else throw Error("coordinates 参数格式错误");return{type:"Feature",geometry:{type:e,coordinates:t}}}},q={deepClone(t){return structuredClone(t)},isEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)},parse(t){return!t||typeof t!="string"?t:JSON.parse(t)}},W={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);const s=new Uint8Array(r);return new Blob([s],{type:e})},convertUrlToBase64(t,e,n){return new Promise((r,s)=>{var i=new Image;i.crossOrigin="Anonymous",i.src=t,i.onload=function(){var o=document.createElement("canvas");o.width=e||i.width,o.height=n||i.height;var a=o.getContext("2d");if(!a){s(new Error("Failed to get canvas context"));return}a.drawImage(i,0,0,i.width,i.height);var c=i.src.substring(i.src.lastIndexOf(".")+1).toLowerCase(),h=o.toDataURL("image/"+c),l={dataURL:h,type:"image/"+c,ext:c};r(l)},i.onerror=s})},convertBase64ToFile(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/png",i=atob(n[1]),o=new Uint8Array(i.length);for(let c=0;c<i.length;c++)o[c]=i.charCodeAt(c);return new File([o],e,{type:s})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),s=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(s)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},H={debounce(t,e,n=!0){let r=null,s,i,o;const a=()=>{const c=Date.now()-i;c<e&&c>0?r=setTimeout(a,e-c):(r=null,n||(o=t.apply(this,s)))};return(...c)=>{i=Date.now();const h=n&&!r;return r||(r=setTimeout(a,e)),h&&(o=t.apply(this,c),r||(c=null)),o}},throttle(t,e,n=1){let r=0,s=null;return(...i)=>{if(n===1){const o=Date.now();o-r>=e&&(t.apply(this,i),r=o)}else n===2&&(s||(s=setTimeout(()=>{s=null,t.apply(this,i)},e)))}},memoize(t){const e=new Map;return(...n)=>{const r=JSON.stringify(n);if(e.has(r))return e.get(r);{const s=t.apply(this,n);return e.set(r,s),s}}},recurve(t,e=500,n=5e3){let r=0;setTimeout(()=>{r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))},e)}},K={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(A.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,s)=>`${n}${e[s-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var s=Math.floor(n/2),i=s;i<t.length;i++){let o=t.substring(e,i);if(o.replace(r,"mm").length>=n)return o}return t},asString(t){if(A.isEmpty(t))return"";switch(A.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},replaceAll(t,e,n){if(!t)return t;for(;t.indexOf(e)>-1;)t=t.replace(e,n);return t}},m=class m{static set(e,n=null,r=null){var s=this._getPrefixedKey(e,r);try{localStorage.setItem(s,JSON.stringify({data:n}))}catch{console&&console.warn("StoreUtil didn't successfully save the '{"+e+": "+n+"}' pair, because the localStorage is full.")}}static get(e,n,r){var s=this._getPrefixedKey(e,r),i;try{i=JSON.parse(localStorage.getItem(s)||"")}catch{localStorage[s]?i={data:localStorage.getItem(s)}:i=null}if(i){if(typeof i=="object"&&typeof i.data<"u")return i.data}else return n}static keys(){const e=[];var n=Object.keys(localStorage);return m.prefix.length===0?n:(n.forEach(function(r){r.indexOf(m.prefix)!==-1&&e.push(r.replace(m.prefix,""))}),e)}static getAll(e){var n=m.keys();if(e){const r=[];return n.forEach(s=>{if(e.includes(s)){const i={};i[s]=m.get(s,null,null),r.push(i)}}),r}return n.map(r=>m.get(r,null,null))}static remove(e,n){var r=this._getPrefixedKey(e,n);localStorage.removeItem(r)}static clear(e){m.prefix.length?this.keys().forEach(n=>{localStorage.removeItem(this._getPrefixedKey(n,e))}):localStorage.clear()}};p(m,"prefix",""),p(m,"_getPrefixedKey",function(e,n){return n=n||{},n.noPrefix?e:m.prefix+e});let D=m;const Y={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var r=n,s=t[n];e.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}var i=e.join("&");return i},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:s}=new URL(t),i=[r,s];let o={};for(let a=0;a<i.length;a++){const c=i[a];if(c){const l=c.replace(/#|\//g,"").split("?");if(l.length>1)for(let u=1;u<l.length;u++){let f;for(;f=n.exec(l[u]);)o[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return o}};d.ArrayUtil=L,d.AudioPlayer=P,d.BrowserUtil=U,d.CanvasDrawer=b,d.ColorUtil=F,d.Cookie=k,d.CoordsUtil=N,d.DateUtil=$,d.DomUtil=B,d.ErrorType=R,d.EventDispatcher=O,d.EventType=g,d.FileUtil=W,d.GeoJsonUtil=j,d.GeoUtil=J,d.GraphicType=T,d.HashMap=S,d.LayerType=C,d.MathUtil=M,d.MeasureMode=I,d.ObjectState=v,d.ObjectUtil=q,d.OptimizeUtil=H,d.StoreUtil=D,d.StringUtil=K,d.UrlUtil=Y,d.Util=A,d.WebSocketClient=_,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/dist/utils/CommUtil.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const _default: {
|
|
|
16
16
|
*
|
|
17
17
|
* @returns 返回一个由8个16进制数组成的GUID字符串
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
guid(): string;
|
|
20
20
|
/**
|
|
21
21
|
* 将参数进行解码并返回解码后的字符串
|
|
22
22
|
*
|
|
@@ -92,5 +92,6 @@ declare const _default: {
|
|
|
92
92
|
isArray(a: any): a is any[];
|
|
93
93
|
isObject(a: any): boolean;
|
|
94
94
|
isNil(a: any): boolean;
|
|
95
|
+
isNumber(a: any): boolean;
|
|
95
96
|
};
|
|
96
97
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LngLat } from '../types';
|
|
1
|
+
import { Coordinate, LngLat } from '../types';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
PI: number;
|
|
4
4
|
XPI: number;
|
|
@@ -23,6 +23,14 @@ declare const _default: {
|
|
|
23
23
|
mercatorDecrypt(mercatorLat: number, mercatorLon: number): LngLat;
|
|
24
24
|
transformLat(x: number, y: number): number;
|
|
25
25
|
transformLon(x: number, y: number): number;
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* 生成指定范围内的随机经纬度坐标
|
|
28
|
+
*
|
|
29
|
+
* @param min 最小坐标,包含属性 x 和 y,分别表示最小经度和最小纬度
|
|
30
|
+
* @param max 最大坐标,包含属性 x 和 y,分别表示最大经度和最大纬度
|
|
31
|
+
* @returns 返回生成的随机经纬度坐标,包含属性 lat 和 lng,分别表示纬度和经度
|
|
32
|
+
*/
|
|
33
|
+
random({ x: minX, y: minY }: Coordinate, { x: maxX, y: maxY }: Coordinate): LngLat;
|
|
34
|
+
deCompose(arr: any[], fn: Function, context?: any): any[];
|
|
27
35
|
};
|
|
28
36
|
export default _default;
|
package/dist/utils/DateUtil.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ declare const _default: {
|
|
|
10
10
|
nextDayDate: Date;
|
|
11
11
|
parseDate(str: string): Date;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 格式化时间间隔
|
|
14
14
|
*
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @returns
|
|
15
|
+
* @param startTime 开始时间,可以是字符串、数字或日期类型
|
|
16
|
+
* @param endTime 结束时间,可以是字符串、数字或日期类型
|
|
17
|
+
* @returns 返回格式化后的时间间隔字符串,格式为"天数 天 小时 时 分钟 分 秒 秒"或"少于1秒"
|
|
18
18
|
*/
|
|
19
19
|
formatDateInterval(startTime: string | number | Date, endTime: string | number | Date): string;
|
|
20
20
|
formatterCounter(times: number): string;
|
|
@@ -1,13 +1,76 @@
|
|
|
1
1
|
import { Coordinate, GeoJSONFeature } from '../types';
|
|
2
2
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 获取GeoJSON要素的几何类型
|
|
5
|
+
*
|
|
6
|
+
* @param feature GeoJSONFeature 类型的要素
|
|
7
|
+
* @returns 返回要素的几何类型,如果要素没有几何属性则返回 null
|
|
8
|
+
*/
|
|
9
|
+
getGeoJsonType(feature: GeoJSONFeature): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* 判断给定的GeoJSON要素是否为有效的GeoJSON格式
|
|
12
|
+
*
|
|
13
|
+
* @param feature 要判断的GeoJSON要素
|
|
14
|
+
* @returns 如果为有效的GeoJSON格式则返回true,否则返回false
|
|
15
|
+
*/
|
|
16
|
+
isGeoJson(feature: GeoJSONFeature): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 判断是否为 GeoJSON 多边形
|
|
19
|
+
*
|
|
20
|
+
* @param feature GeoJSONFeature 对象
|
|
21
|
+
* @returns 返回布尔值,表示是否为 GeoJSON 多边形
|
|
22
|
+
*/
|
|
23
|
+
isGeoJsonPolygon(feature: GeoJSONFeature): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 判断给定的 GeoJSONFeature 是否为 GeoJSON 线
|
|
26
|
+
*
|
|
27
|
+
* @param feature GeoJSONFeature 对象
|
|
28
|
+
* @returns 是 GeoJSON 线返回 true,否则返回 false
|
|
29
|
+
*/
|
|
30
|
+
isGeoJsonLine(feature: GeoJSONFeature): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 判断是否为 GeoJSON 点类型
|
|
33
|
+
*
|
|
34
|
+
* @param feature GeoJSONFeature 对象
|
|
35
|
+
* @returns 是点类型返回 true,否则返回 false
|
|
36
|
+
*/
|
|
37
|
+
isGeoJsonPoint(feature: GeoJSONFeature): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 判断传入的 GeoJSONFeature 是否为 Multi 类型的 GeoJSON。
|
|
40
|
+
*
|
|
41
|
+
* @param feature GeoJSONFeature 类型的参数,待判断是否为 Multi 类型的 GeoJSON。
|
|
42
|
+
* @returns 返回一个布尔值,如果传入的 GeoJSONFeature 是 Multi 类型的 GeoJSON,则返回 true,否则返回 false。
|
|
43
|
+
*/
|
|
44
|
+
isGeoJsonMulti(feature: GeoJSONFeature): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 获取GeoJSON要素的坐标数组
|
|
47
|
+
*
|
|
48
|
+
* @param feature GeoJSONFeature对象
|
|
49
|
+
* @returns 返回一个包含坐标数组的数组,可以是二维、三维或四维数组
|
|
50
|
+
*/
|
|
51
|
+
getGeoJsonCoordinates(feature: GeoJSONFeature): Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>;
|
|
52
|
+
/**
|
|
53
|
+
* 获取GeoJSON要素的中心点坐标
|
|
54
|
+
*
|
|
55
|
+
* @param feature GeoJSON要素
|
|
56
|
+
* @param out 输出坐标对象,默认为null
|
|
57
|
+
* @returns 返回中心点坐标,如果无法获取则返回null
|
|
58
|
+
*/
|
|
59
|
+
getGeoJsonCenter(feature: GeoJSONFeature, out?: Coordinate): Coordinate | null;
|
|
60
|
+
/**
|
|
61
|
+
* 将一个包含多个点、线或面的 GeoJSON 特征对象拆分成多个独立的 GeoJSON 特征对象数组。
|
|
62
|
+
*
|
|
63
|
+
* @param feature 包含多个点、线或面的 GeoJSON 特征对象
|
|
64
|
+
* @returns 返回一个 GeoJSON 特征对象数组,如果拆分失败则返回 null
|
|
65
|
+
*/
|
|
66
|
+
spliteGeoJsonMulti(feature: GeoJSONFeature): GeoJSONFeature[] | null;
|
|
67
|
+
/**
|
|
68
|
+
* 根据坐标数组生成GeoJSON要素
|
|
69
|
+
*
|
|
70
|
+
* @param coordinates 坐标数组
|
|
71
|
+
* @returns GeoJSONFeature 生成的GeoJSON要素
|
|
72
|
+
* @throws Error 如果coordinates参数格式错误
|
|
73
|
+
*/
|
|
74
|
+
getGeoJsonByCoordinates(coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>): GeoJSONFeature;
|
|
12
75
|
};
|
|
13
76
|
export default _default;
|