gis-common 3.1.4 → 3.1.6

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.
@@ -1,48 +1,35 @@
1
- var AnimateUtils = {
2
- animate(ele, attr_options, callback, timefn = "swing", speed = 5) {
3
- for (var attr in attr_options) {
4
- attr_options[attr] = {
5
- target: attr === "opacity" ? parseInt(attr_options[attr] * 100) : attr_options[attr],
6
- iNow: attr === "opacity" ? parseInt(getComputedStyle(ele)[attr] * 100) : parseInt(getComputedStyle(ele)[attr])
1
+ var G = Object.defineProperty;
2
+ var z = (t, e, n) => e in t ? G(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var P = (t, e, n) => z(t, typeof e != "symbol" ? e + "" : e, n);
4
+ const Y = {
5
+ /**
6
+ * 多属性的动画函数
7
+ * @param {*} ele 需要运动的节点
8
+ * @param {*} attr_options 传入的是一个需要运动的属性包括运动的目标值,操作的节点属性
9
+ * @param {*} timefn 运动的形式,默认是缓冲运动
10
+ * @param {*} speed 运动的速度
11
+ */
12
+ animate(t, e, n, r = "swing", a = 5) {
13
+ for (var s in e)
14
+ e[s] = {
15
+ target: s === "opacity" ? parseInt(e[s] * 100) : e[s],
16
+ // 需要计算得到
17
+ iNow: parseInt(s === "opacity" ? getComputedStyle(t)[s] * 100 : getComputedStyle(t)[s])
7
18
  };
8
- }
9
- if (timefn === "liner") {
10
- speed = attr_options[attr].iNow < attr_options[attr].target ? Math.abs(speed) : -Math.abs(speed);
11
- }
12
- clearInterval(ele.timer);
13
- ele.timer = setInterval(function() {
14
- for (var attr2 in attr_options) {
15
- var target = attr_options[attr2].target;
16
- var iNow = attr_options[attr2].iNow;
17
- if (timefn === "swing") {
18
- speed = (target - iNow) / 20;
19
- speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
20
- }
21
- if (Math.abs(target - iNow) <= Math.abs(speed)) {
22
- if (attr2 === "opacity") {
23
- ele.style[attr2] = target / 100;
24
- } else {
25
- ele.style[attr2] = target + "px";
26
- }
27
- delete attr_options[attr2];
28
- for (var num in attr_options) {
29
- return false;
30
- }
31
- clearInterval(ele.timer);
32
- typeof callback === "function" ? callback() : "";
33
- } else {
34
- attr_options[attr2].iNow += speed;
35
- if (attr2 === "opacity") {
36
- ele.style[attr2] = attr_options[attr2].iNow / 100;
37
- } else {
38
- ele.style[attr2] = attr_options[attr2].iNow + "px";
39
- }
40
- }
19
+ r === "liner" && (a = e[s].iNow < e[s].target ? Math.abs(a) : -Math.abs(a)), clearInterval(t.timer), t.timer = setInterval(function() {
20
+ for (var i in e) {
21
+ var o = e[i].target, c = e[i].iNow;
22
+ if (r === "swing" && (a = (o - c) / 20, a = a > 0 ? Math.ceil(a) : Math.floor(a)), Math.abs(o - c) <= Math.abs(a)) {
23
+ i === "opacity" ? t.style[i] = o / 100 : t.style[i] = o + "px", delete e[i];
24
+ for (var l in e)
25
+ return !1;
26
+ clearInterval(t.timer), typeof n == "function" && n();
27
+ } else
28
+ e[i].iNow += a, i === "opacity" ? t.style[i] = e[i].iNow / 100 : t.style[i] = e[i].iNow + "px";
41
29
  }
42
30
  }, 30);
43
31
  }
44
- };
45
- var EventType = {
32
+ }, v = {
46
33
  MAP_RENDER: "mapRender",
47
34
  MAP_READY: "mapReady",
48
35
  MOUSE_CLICK: "click",
@@ -64,39 +51,42 @@ var EventType = {
64
51
  WEB_SOCKET_ERROR: "webSocketError",
65
52
  WEB_SOCKET_MESSAGE: "webSocketMessage",
66
53
  WEB_SOCKET_CLOSE: "webSocketClose"
67
- };
68
- var ErrorType = {
69
- LOGIN_EXPIRED: "\u767B\u5F55\u4FE1\u606F\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55",
70
- CROSS_ERROR: "\u8DE8\u57DF\u8BBF\u95EE",
71
- UNEXIST_RESOURCE: "\u8D44\u6E90\u4E0D\u5B58\u5728",
72
- TIMEOUT: "\u8BF7\u6C42\u8D85\u65F6",
73
- INTERNAL_ERROR: "\u5185\u90E8\u9519\u8BEF",
74
- NETWORK_ERROR: "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u662F\u5426\u5DF2\u8FDE\u63A5",
75
- PROCESS_FAIL: "\u5904\u7406\u5931\u8D25",
76
- AUTH_VERIFY_ERROR: "\u6743\u9650\u9A8C\u8BC1\u5931\u8D25",
77
- NO_DATA_FOUND: "\u672A\u627E\u5230\u6570\u636E",
78
- DUPLICATE_INSTANCE: "\u5B9E\u4F8B\u4E3A\u5355\u4F8B\u6A21\u5F0F\uFF0C\u4E0D\u5141\u8BB8\u91CD\u590D\u6784\u5EFA",
79
- COORDINATE_ERROR: "\u5750\u6807\u9A8C\u8BC1\u5931\u8D25",
80
- JSON_PARSE_ERROR: "JSON\u89E3\u6790\u5931\u8D25\uFF0C\u683C\u5F0F\u6709\u8BEF",
81
- JSON_VALUE_ERROR: "JSON\u65E0\u6B64\u952E",
82
- PARAMETER_ERROR: "\u9A8C\u8BC1\u6570\u636E\u7C7B\u578B\u5931\u8D25",
83
- PARAMETER_ERROR_ARRAY: "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u6570\u7EC4",
84
- PARAMETER_ERROR_STRING: "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u5B57\u7B26",
85
- PARAMETER_ERROR_FUNCTION: "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u51FD\u6570",
86
- PARAMETER_ERROR_OBJECT: "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u5BF9\u8C61",
87
- PARAMETER_ERROR_LACK: "\u53C2\u6570\u7F3A\u5931",
88
- STRING_CHECK_LOSS: "\u5B57\u7B26\u7F3A\u5C11\u5173\u952E\u5B57"
89
- };
90
- var LayerType = {
54
+ }, m = {
55
+ LOGIN_EXPIRED: "登录信息过期,请重新登录",
56
+ CROSS_ERROR: "跨域访问",
57
+ UNEXIST_RESOURCE: "资源不存在",
58
+ TIMEOUT: "请求超时",
59
+ INTERNAL_ERROR: "内部错误",
60
+ NETWORK_ERROR: "请求失败,请检查网络是否已连接",
61
+ PROCESS_FAIL: "处理失败",
62
+ AUTH_VERIFY_ERROR: "权限验证失败",
63
+ NO_DATA_FOUND: "未找到数据",
64
+ DUPLICATE_INSTANCE: "实例为单例模式,不允许重复构建",
65
+ COORDINATE_ERROR: "坐标验证失败",
66
+ JSON_PARSE_ERROR: "JSON解析失败,格式有误",
67
+ JSON_VALUE_ERROR: "JSON无此键",
68
+ PARAMETER_ERROR: "验证数据类型失败",
69
+ PARAMETER_ERROR_ARRAY: "格式类型验证失败:必须是数组",
70
+ PARAMETER_ERROR_STRING: "格式类型验证失败:必须是字符",
71
+ PARAMETER_ERROR_FUNCTION: "格式类型验证失败:必须是函数",
72
+ PARAMETER_ERROR_OBJECT: "格式类型验证失败:必须是对象",
73
+ PARAMETER_ERROR_LACK: "参数缺失",
74
+ STRING_CHECK_LOSS: "字符缺少关键字"
75
+ }, K = {
91
76
  SUPER_MAP_IMAGES: "SuperMapImages",
77
+ // 超图影像服务 栅格数据
92
78
  SUPER_MAP_DATA: "SuperMapData",
79
+ // 超图服务 矢量数据
93
80
  ARC_GIS_MAP_IMAGES: "ArcGisMapImages",
81
+ // arcGis影像图层 栅格数据
94
82
  ARC_GIS_MAP_DATA: "ArcGisMapData",
83
+ // arcGis图层 矢量数据
95
84
  OSGB_LAYER: "OSGBLayer",
96
85
  S3M_GROUP: "S3MGroup",
86
+ // addS3MGroupLayer(url, options, index) 添加S3M分组图层。
97
87
  TERRAIN_LAYER: "TerrainFileLayer"
98
- };
99
- const GraphicType = {
88
+ // 地形图层, 需要单独处理
89
+ }, J = {
100
90
  POINT: "point",
101
91
  POLYLINE: "polyline",
102
92
  POLYGON: "polygon",
@@ -106,216 +96,199 @@ const GraphicType = {
106
96
  LABEL: "label",
107
97
  MODEL: "model",
108
98
  WALL: "wall"
109
- };
110
- const MeasureMode = {
99
+ }, V = {
111
100
  DISTANCE: "distance",
112
101
  AREA: "area",
113
102
  HEIGHT: "height"
114
- };
115
- var CommUtils = {
116
- getDataType(data) {
117
- return Object.prototype.toString.call(data).slice(8, -1);
118
- },
119
- isEmpty(value) {
120
- if (value == null) {
121
- return true;
122
- }
123
- const type = this.getDataType(value);
124
- switch (type) {
103
+ }, E = {
104
+ /**
105
+ * 判断数据类型
106
+ *
107
+ * @param {*} data
108
+ * @returns {*}
109
+ */
110
+ getDataType(t) {
111
+ return Object.prototype.toString.call(t).slice(8, -1);
112
+ },
113
+ isEmpty(t) {
114
+ if (t == null)
115
+ return !0;
116
+ switch (this.getDataType(t)) {
125
117
  case "String":
126
- return value.trim() === "";
118
+ return t.trim() === "";
127
119
  case "Array":
128
- return !value.length;
120
+ return !t.length;
129
121
  case "Object":
130
- return !Object.keys(value).length;
122
+ return !Object.keys(t).length;
131
123
  case "Boolean":
132
- return !value;
124
+ return !t;
133
125
  default:
134
- return false;
135
- }
136
- },
137
- isNotEmpty(val) {
138
- return !this.isEmpty(val);
139
- },
140
- json2form(json) {
141
- const formData = new FormData();
142
- Object.keys(json).forEach((key) => {
143
- formData.append(key, json[key] instanceof Object ? JSON.stringify(json[key]) : json[key]);
144
- });
145
- return formData;
146
- },
147
- json2Query(json) {
148
- var tempArr = [];
149
- for (var i in json) {
150
- var key = i;
151
- var value = json[i];
152
- tempArr.push(key + "=" + value);
153
- }
154
- var urlParamsStr = tempArr.join("&");
155
- return urlParamsStr;
126
+ return !1;
127
+ }
128
+ },
129
+ isNotEmpty(t) {
130
+ return !this.isEmpty(t);
131
+ },
132
+ json2form(t) {
133
+ const e = new FormData();
134
+ return Object.keys(t).forEach((n) => {
135
+ e.append(n, t[n] instanceof Object ? JSON.stringify(t[n]) : t[n]);
136
+ }), e;
137
+ },
138
+ /**
139
+ * json转换成get参数形式
140
+ *
141
+ * @param {*} json
142
+ * @returns {*}
143
+ */
144
+ json2Query(t) {
145
+ var e = [];
146
+ for (var n in t) {
147
+ var r = n, a = t[n];
148
+ e.push(r + "=" + a);
149
+ }
150
+ var s = e.join("&");
151
+ return s;
156
152
  },
157
153
  generateGuid() {
158
- const S4 = function() {
154
+ const t = function() {
159
155
  return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
160
156
  };
161
- return S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4();
162
- },
163
- decodeDict(...args) {
164
- let res = "";
165
- if (args.length > 1) {
166
- const items = args.slice(1, args.length % 2 === 0 ? args.length - 1 : args.length);
167
- for (let i = 0; i < items.length; i = i + 2) {
168
- const item = items[i];
169
- if (args[0] === item) {
170
- res = items[i + 1];
171
- }
172
- }
173
- if (!res && args.length % 2 === 0) {
174
- res = args[args.length - 1];
175
- }
176
- } else {
177
- res = args[0];
178
- }
179
- return res;
180
- },
181
- extend(dest, ...args) {
182
- let i, j, len, src;
183
- for (j = 0, len = args.length; j < len; j++) {
184
- src = args[j];
185
- for (i in src) {
186
- dest[i] = src[i];
187
- }
188
- }
189
- return dest;
190
- },
191
- rgb2hex(rgb) {
192
- var hex = "#" + ((1 << 24) + (rgb[0] << 16) + (rgb[1] << 8) + rgb[2]).toString(16).slice(1);
193
- return hex;
194
- },
195
- convertToTree2(data, idPropertyName = "id", parentIdPropertyName = "parentId", childrenPropertyName = "children") {
196
- const result = [];
197
- function buildChildren(item) {
198
- const id = item[idPropertyName];
199
- const children = data.filter((item2) => item2.hasOwnProperty(parentIdPropertyName) && item2[parentIdPropertyName] === id);
200
- if (children.length > 0) {
201
- children.forEach(buildChildren);
202
- item[childrenPropertyName] = children;
203
- }
204
- }
205
- for (const item of data) {
206
- if (data.findIndex((t) => t[idPropertyName] === item[parentIdPropertyName]) === -1) {
207
- buildChildren(item);
208
- result.push(item);
157
+ return t() + t() + t() + t() + t() + t() + t() + t();
158
+ },
159
+ decodeDict(...t) {
160
+ let e = "";
161
+ if (t.length > 1) {
162
+ const n = t.slice(1, t.length % 2 === 0 ? t.length - 1 : t.length);
163
+ for (let r = 0; r < n.length; r = r + 2) {
164
+ const a = n[r];
165
+ t[0] === a && (e = n[r + 1]);
209
166
  }
210
- }
211
- return result;
212
- },
213
- asyncLoadScript(url) {
214
- return new Promise((resolve, reject) => {
167
+ !e && t.length % 2 === 0 && (e = t[t.length - 1]);
168
+ } else
169
+ e = t[0];
170
+ return e;
171
+ },
172
+ /**
173
+ *
174
+ * @param {*} dest
175
+ * @param {...any} args
176
+ * @returns 等同于L.extend
177
+ */
178
+ extend(t, ...e) {
179
+ let n, r, a, s;
180
+ for (r = 0, a = e.length; r < a; r++) {
181
+ s = e[r];
182
+ for (n in s)
183
+ t[n] = s[n];
184
+ }
185
+ return t;
186
+ },
187
+ rgb2hex(t) {
188
+ var e = "#" + (16777216 + (t[0] << 16) + (t[1] << 8) + t[2]).toString(16).slice(1);
189
+ return e;
190
+ },
191
+ /**
192
+ * 将平级对象列表转换为树形结构对象列表
193
+ *
194
+ * @param {Array} data
195
+ * @param {string} [idPropertyName="id"]
196
+ * @param {string} [parentIdPropertyName="parentId"]
197
+ * @param {string} [childrenPropertyName="children"]
198
+ * @returns {*}
199
+ */
200
+ convertToTree2(t, e = "id", n = "parentId", r = "children") {
201
+ const a = [];
202
+ function s(i) {
203
+ const o = i[e], c = t.filter((l) => l.hasOwnProperty(n) && l[n] === o);
204
+ c.length > 0 && (c.forEach(s), i[r] = c);
205
+ }
206
+ for (const i of t)
207
+ t.findIndex((o) => o[e] === i[n]) === -1 && (s(i), a.push(i));
208
+ return a;
209
+ },
210
+ /**
211
+ * 异步加载script
212
+ *
213
+ * @param {*} url
214
+ */
215
+ asyncLoadScript(t) {
216
+ return new Promise((e, n) => {
215
217
  try {
216
- var oscript = document.createElement("script");
217
- if (oscript.readyState) {
218
- oscript.onreadystatechange = function() {
219
- if (oscript.readyState === "complete" || oscript.readyState === "loaded") {
220
- resolve(oscript);
221
- }
222
- };
223
- } else {
224
- oscript.onload = function() {
225
- resolve(oscript);
226
- };
227
- }
228
- oscript.type = "text/javascript";
229
- oscript.src = url;
230
- document.body.appendChild(oscript);
231
- } catch (error) {
232
- reject(error);
218
+ var r = document.createElement("script");
219
+ r.readyState ? r.onreadystatechange = function() {
220
+ (r.readyState === "complete" || r.readyState === "loaded") && e(r);
221
+ } : r.onload = function() {
222
+ e(r);
223
+ }, r.type = "text/javascript", r.src = t, document.body.appendChild(r);
224
+ } catch (a) {
225
+ n(a);
233
226
  }
234
227
  });
235
228
  },
236
- loadStyle(urls) {
237
- urls.forEach((url) => {
238
- const css = document.createElement("link");
239
- css.href = url;
240
- css.rel = "stylesheet";
241
- css.type = "text/css";
242
- document.head.appendChild(css);
229
+ loadStyle(t) {
230
+ t.forEach((e) => {
231
+ const n = document.createElement("link");
232
+ n.href = e, n.rel = "stylesheet", n.type = "text/css", document.head.appendChild(n);
243
233
  });
244
234
  },
245
- template(str, data) {
246
- const templateRe = /\{ *([\w_-]+) *\}/g;
247
- return str.replace(templateRe, function(str2, key) {
248
- var value = data[key];
249
- if (value === void 0) {
250
- throw new Error(ErrorType.JSON_VALUE_ERROR + str2);
251
- } else if (typeof value === "function") {
252
- value = value(data);
253
- }
254
- return value;
235
+ /**
236
+ * 提取json中的value组成一个新的字符串
237
+ * eg: template('aaa{key}', json)
238
+ *
239
+ * @param {*} str
240
+ * @param {*} data
241
+ * @returns {*}
242
+ */
243
+ template(t, e) {
244
+ const n = /\{ *([\w_-]+) *\}/g;
245
+ return t.replace(n, function(r, a) {
246
+ var s = e[a];
247
+ if (s === void 0)
248
+ throw new Error(m.JSON_VALUE_ERROR + r);
249
+ return typeof s == "function" && (s = s(e)), s;
255
250
  });
256
251
  },
257
- deleteEmptyProperty(data) {
252
+ deleteEmptyProperty(t) {
258
253
  return Object.fromEntries(
259
- Object.keys(data).filter((d) => !this.isEmpty(data[d])).map((i) => [i, data[i]])
254
+ Object.keys(t).filter((e) => !this.isEmpty(t[e])).map((e) => [e, t[e]])
260
255
  );
261
256
  },
262
257
  deepAssign() {
263
- let len = arguments.length, target = arguments[0];
264
- if (this.getDataType(target) !== "Object") {
265
- target = {};
266
- }
267
- for (let i = 1; i < len; i++) {
268
- let source = arguments[i];
269
- if (this.getDataType(source) === "Object") {
270
- for (let s in source) {
271
- if (s === "__proto__" || target === source[s]) {
272
- continue;
273
- }
274
- if (this.getDataType(source[s]) === "Object") {
275
- target[s] = this.deepAssign(target[s], source[s]);
276
- } else {
277
- target[s] = source[s];
278
- }
279
- }
280
- }
281
- }
282
- return target;
283
- },
284
- handleCopyValue(text) {
285
- if (!navigator.clipboard && window.isSecureContext) {
286
- return navigator.clipboard.writeText(text);
287
- } else {
288
- const textArea = document.createElement("textarea");
289
- textArea.style.position = "fixed";
290
- textArea.style.top = textArea.style.left = "-100vh";
291
- textArea.style.opacity = "0";
292
- textArea.value = text;
293
- document.body.appendChild(textArea);
294
- textArea.focus();
295
- textArea.select();
296
- return new Promise((resolve, reject) => {
297
- document.execCommand("copy") ? resolve() : reject(new Error("copy failed"));
298
- textArea.remove();
258
+ let t = arguments.length, e = arguments[0];
259
+ this.getDataType(e) !== "Object" && (e = {});
260
+ for (let n = 1; n < t; n++) {
261
+ let r = arguments[n];
262
+ if (this.getDataType(r) === "Object")
263
+ for (let a in r)
264
+ a === "__proto__" || e === r[a] || (this.getDataType(r[a]) === "Object" ? e[a] = this.deepAssign(e[a], r[a]) : e[a] = r[a]);
265
+ }
266
+ return e;
267
+ },
268
+ handleCopyValue(t) {
269
+ if (!navigator.clipboard && window.isSecureContext)
270
+ return navigator.clipboard.writeText(t);
271
+ {
272
+ const e = document.createElement("textarea");
273
+ 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) => {
274
+ document.execCommand("copy") ? n() : r(new Error("copy failed")), e.remove();
299
275
  });
300
276
  }
301
277
  }
302
278
  };
303
- Array.prototype.groupBy = function(f) {
304
- var groups = {};
305
- this.forEach(function(o) {
306
- var group = JSON.stringify(f(o));
307
- groups[group] = groups[group] || [];
308
- groups[group].push(o);
309
- });
310
- return Object.keys(groups).map((group) => groups[group]);
279
+ Array.prototype.groupBy = function(t) {
280
+ var e = {};
281
+ return this.forEach(function(n) {
282
+ var r = JSON.stringify(t(n));
283
+ e[r] = e[r] || [], e[r].push(n);
284
+ }), Object.keys(e).map((n) => e[n]);
311
285
  };
312
- Array.prototype.distinct = function(f = (d) => d) {
313
- const arr = [], obj = {};
314
- this.forEach((item) => {
315
- const val = f(item);
316
- !obj[val] && (obj[val] = arr.push(item));
317
- });
318
- return arr;
286
+ Array.prototype.distinct = function(t = (e) => e) {
287
+ const e = [], n = {};
288
+ return this.forEach((r) => {
289
+ const a = t(r);
290
+ !n[a] && (n[a] = e.push(r));
291
+ }), e;
319
292
  };
320
293
  Array.prototype.max = function() {
321
294
  return Math.max.apply({}, this);
@@ -324,1083 +297,954 @@ Array.prototype.min = function() {
324
297
  return Math.min.apply({}, this);
325
298
  };
326
299
  Array.prototype.sum = function() {
327
- return this.length > 0 ? this.reduce((prev = 0, curr = 0) => prev + curr) : 0;
300
+ return this.length > 0 ? this.reduce((t = 0, e = 0) => t + e) : 0;
328
301
  };
329
302
  Array.prototype.avg = function() {
330
303
  return this.length ? this.sum() / this.length : 0;
331
304
  };
332
- Array.prototype.desc = function(f = (d) => d) {
333
- return this.sort((n1, n2) => f(n2) - f(n1));
305
+ Array.prototype.desc = function(t = (e) => e) {
306
+ return this.sort((e, n) => t(n) - t(e));
334
307
  };
335
- Array.prototype.asc = function(f = (d) => d) {
336
- return this.sort((n1, n2) => f(n1) - f(n2));
308
+ Array.prototype.asc = function(t = (e) => e) {
309
+ return this.sort((e, n) => t(e) - t(n));
337
310
  };
338
311
  Array.prototype.clear = function() {
339
- this.length = 0;
340
- return this;
312
+ return this.length = 0, this;
341
313
  };
342
- var ArrayUtils = {
343
- asArray(obj) {
344
- return CommUtils.isEmpty(obj) ? [] : Array.isArray(obj) ? obj : [obj];
345
- },
346
- generateArray(length) {
347
- return [...new Array(length).keys()];
348
- },
349
- union(...args) {
350
- let res = [];
351
- args.forEach((arg) => {
352
- if (Array.isArray(arg)) {
353
- res = res.concat(arg.filter((v) => !res.includes(v)));
354
- }
355
- });
356
- return res;
357
- },
358
- intersection(...args) {
359
- let res = args[0] || [];
360
- args.forEach((arg) => {
361
- if (Array.isArray(arg)) {
362
- res = res.filter((v) => arg.includes(v));
363
- }
364
- });
365
- return res;
366
- },
367
- unionAll(...args) {
368
- return [...args].flat().filter((d) => !!d);
369
- },
370
- difference(...args) {
371
- return this.union(...args).filter((d) => !this.intersection(...args).includes(d));
314
+ const Q = {
315
+ asArray(t) {
316
+ return E.isEmpty(t) ? [] : Array.isArray(t) ? t : [t];
317
+ },
318
+ generateArray(t) {
319
+ return [...new Array(t).keys()];
320
+ },
321
+ union(...t) {
322
+ let e = [];
323
+ return t.forEach((n) => {
324
+ Array.isArray(n) && (e = e.concat(n.filter((r) => !e.includes(r))));
325
+ }), e;
326
+ },
327
+ intersection(...t) {
328
+ let e = t[0] || [];
329
+ return t.forEach((n) => {
330
+ Array.isArray(n) && (e = e.filter((r) => n.includes(r)));
331
+ }), e;
332
+ },
333
+ unionAll(...t) {
334
+ return [...t].flat().filter((e) => !!e);
335
+ },
336
+ difference(...t) {
337
+ return this.union(...t).filter((e) => !this.intersection(...t).includes(e));
372
338
  }
373
- };
374
- var BrowserUtils = {
375
- getUrlParams(href = window.location.href, needDecode = true) {
376
- const reg = /([^&=]+)=([\w\W]*?)(&|$|#)/g;
377
- const { search, hash } = new URL(href);
378
- const args = [search, hash];
379
- let obj = {};
380
- for (let i = 0; i < args.length; i++) {
381
- const str = args[i];
382
- if (str) {
383
- const s = str.replace(/#|\//g, "");
384
- const arr = s.split("?");
385
- if (arr.length > 1) {
386
- for (let i2 = 1; i2 < arr.length; i2++) {
387
- let res;
388
- while (res = reg.exec(arr[i2])) {
389
- obj[res[1]] = needDecode ? decodeURIComponent(res[2]) : res[2];
390
- }
339
+ }, X = {
340
+ getUrlParams(t = window.location.href, e = !0) {
341
+ const n = /([^&=]+)=([\w\W]*?)(&|$|#)/g, { search: r, hash: a } = new URL(t), s = [r, a];
342
+ let i = {};
343
+ for (let o = 0; o < s.length; o++) {
344
+ const c = s[o];
345
+ if (c) {
346
+ const h = c.replace(/#|\//g, "").split("?");
347
+ if (h.length > 1)
348
+ for (let u = 1; u < h.length; u++) {
349
+ let d;
350
+ for (; d = n.exec(h[u]); )
351
+ i[d[1]] = e ? decodeURIComponent(d[2]) : d[2];
391
352
  }
392
- }
393
353
  }
394
354
  }
395
- return obj;
355
+ return i;
396
356
  },
397
357
  getExplorer() {
398
- var explorer = window.navigator.userAgent;
399
- if (explorer.indexOf("MSIE") >= 0) {
358
+ var t = window.navigator.userAgent;
359
+ if (t.indexOf("MSIE") >= 0 || window.ActiveXObject || "ActiveXObject" in window)
400
360
  return "IE";
401
- }
402
- if (!!window.ActiveXObject || "ActiveXObject" in window) {
403
- return "IE";
404
- } else if (explorer.indexOf("Firefox") >= 0) {
361
+ if (t.indexOf("Firefox") >= 0)
405
362
  return "Firefox";
406
- } else if (explorer.indexOf("Chrome") >= 0) {
363
+ if (t.indexOf("Chrome") >= 0)
407
364
  return "Chrome";
408
- } else if (explorer.indexOf("Opera") >= 0) {
365
+ if (t.indexOf("Opera") >= 0)
409
366
  return "Opera";
410
- } else if (explorer.indexOf("Safari") >= 0) {
367
+ if (t.indexOf("Safari") >= 0)
411
368
  return "Safari";
412
- }
413
369
  },
414
370
  detectOS() {
415
- let os_type = "";
416
- const windows = navigator.userAgent.indexOf("Windows", 0) != -1 ? 1 : 0;
417
- const mac = navigator.userAgent.indexOf("mac", 0) != -1 ? 1 : 0;
418
- const linux = navigator.userAgent.indexOf("Linux", 0) != -1 ? 1 : 0;
419
- const unix = navigator.userAgent.indexOf("X11", 0) != -1 ? 1 : 0;
420
- if (windows)
421
- os_type = "MS Windows";
422
- else if (mac)
423
- os_type = "Apple mac";
424
- else if (linux)
425
- os_type = "Linux";
426
- else if (unix)
427
- os_type = "Unix";
428
- return os_type;
429
- },
430
- switchFullScreen(status) {
431
- if (status) {
432
- const element = document.documentElement;
433
- if (element.requestFullscreen) {
434
- element.requestFullscreen();
435
- } else if (element.msRequestFullscreen) {
436
- element.msRequestFullscreen();
437
- } else if (element.mozRequestFullScreen) {
438
- element.mozRequestFullScreen();
439
- } else if (element.webkitRequestFullscreen) {
440
- element.webkitRequestFullscreen();
441
- }
442
- } else {
443
- if (document.exitFullscreen) {
444
- document.exitFullscreen();
445
- } else if (document.msExitFullscreen) {
446
- document.msExitFullscreen();
447
- } else if (document.mozCancelFullScreen) {
448
- document.mozCancelFullScreen();
449
- } else if (document.webkitExitFullscreen) {
450
- document.webkitExitFullscreen();
451
- }
452
- }
453
- },
371
+ let t = "";
372
+ 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, a = navigator.userAgent.indexOf("X11", 0) != -1 ? 1 : 0;
373
+ return e ? t = "MS Windows" : n ? t = "Apple mac" : r ? t = "Linux" : a && (t = "Unix"), t;
374
+ },
375
+ switchFullScreen(t) {
376
+ if (t) {
377
+ const e = document.documentElement;
378
+ e.requestFullscreen ? e.requestFullscreen() : e.msRequestFullscreen ? e.msRequestFullscreen() : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.webkitRequestFullscreen && e.webkitRequestFullscreen();
379
+ } else
380
+ document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen();
381
+ },
382
+ /**
383
+ * scale屏幕适配方案
384
+ */
454
385
  refreshScale() {
455
- const baseWidth = document.documentElement.clientWidth;
456
- const baseHeight = document.documentElement.clientHeight;
457
- const appStyle = document.getElementById("app").style;
458
- const realRatio = baseWidth / baseHeight;
459
- const designRatio = 16 / 9;
460
- let scaleRate = baseWidth / 1920;
461
- if (realRatio > designRatio) {
462
- scaleRate = baseHeight / 1080;
463
- }
464
- appStyle.transformOrigin = "left top";
465
- appStyle.transform = `scale(${scaleRate}) translateX(-49.99%)`;
466
- appStyle.width = `${baseWidth / scaleRate}px`;
386
+ const t = document.documentElement.clientWidth, e = document.documentElement.clientHeight, n = document.getElementById("app").style, r = t / e, a = 16 / 9;
387
+ let s = t / 1920;
388
+ r > a && (s = e / 1080), n.transformOrigin = "left top", n.transform = `scale(${s}) translateX(-49.99%)`, n.width = `${t / s}px`;
467
389
  },
390
+ /**
391
+ * rem屏幕适配方案
392
+ */
468
393
  getHtmlFontSize() {
469
- const htmlwidth = document.documentElement.clientWidth || document.body.clientWidth;
470
- const htmlDom = document.querySelector("html");
471
- htmlDom.style.fontSize = htmlwidth / 192 + "px";
394
+ const t = document.documentElement.clientWidth || document.body.clientWidth, e = document.querySelector("html");
395
+ e.style.fontSize = t / 192 + "px";
472
396
  }
473
- };
474
- var Cookie = {
475
- set: function(name, value, Days = 30) {
476
- var exp = new Date();
477
- exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1e3);
478
- document.cookie = name + "=" + escape(value) + ";expires=" + exp.toUTCString();
479
- },
480
- remove: function(name) {
481
- var exp = new Date();
482
- exp.setTime(exp.getTime() - 1);
483
- var cval = this.get(name);
484
- if (cval != null) {
485
- document.cookie = name + "=" + cval + ";expires=" + exp.toUTCString();
486
- }
487
- },
488
- get: function(name) {
489
- var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
490
- if (arr != null) {
491
- return arr[2];
492
- } else {
493
- return "";
494
- }
397
+ }, Z = {
398
+ set: function(t, e, n = 30) {
399
+ var r = /* @__PURE__ */ new Date();
400
+ r.setTime(r.getTime() + n * 24 * 60 * 60 * 1e3), document.cookie = t + "=" + escape(e) + ";expires=" + r.toUTCString();
401
+ },
402
+ remove: function(t) {
403
+ var e = /* @__PURE__ */ new Date();
404
+ e.setTime(e.getTime() - 1);
405
+ var n = this.get(t);
406
+ n != null && (document.cookie = t + "=" + n + ";expires=" + e.toUTCString());
407
+ },
408
+ get: function(t) {
409
+ var e = document.cookie.match(new RegExp("(^| )" + t + "=([^;]*)(;|$)"));
410
+ return e != null ? e[2] : "";
495
411
  }
496
- };
497
- var CoordsUtils = {
412
+ }, tt = {
498
413
  PI: 3.141592653589793,
499
414
  XPI: 3.141592653589793 * 3e3 / 180,
500
- delta(lat, lng) {
501
- const a = 6378245;
502
- const ee = 0.006693421622965943;
503
- let dLat = this.transformLat(lng - 105, lat - 35);
504
- let dLon = this.transformLon(lng - 105, lat - 35);
505
- const radLat = lat / 180 * this.PI;
506
- let magic = Math.sin(radLat);
507
- magic = 1 - ee * magic * magic;
508
- const sqrtMagic = Math.sqrt(magic);
509
- dLat = dLat * 180 / (a * (1 - ee) / (magic * sqrtMagic) * this.PI);
510
- dLon = dLon * 180 / (a / sqrtMagic * Math.cos(radLat) * this.PI);
511
- return { lat: dLat, lng: dLon };
512
- },
513
- gcjEncrypt(wgsLat, wgsLon) {
514
- if (this.outOfChina(wgsLat, wgsLon)) {
515
- return { lat: wgsLat, lng: wgsLon };
516
- }
517
- const d = this.delta(wgsLat, wgsLon);
518
- return { lat: wgsLat + d.lat, lng: wgsLon + d.lng };
519
- },
520
- gcjDecrypt(gcjLat, gcjLon) {
521
- if (this.outOfChina(gcjLat, gcjLon)) {
522
- return { lat: gcjLat, lng: gcjLon };
523
- }
524
- const d = this.delta(gcjLat, gcjLon);
525
- return { lat: gcjLat - d.lat, lng: gcjLon - d.lng };
526
- },
527
- gcjDecryptExact(gcjLat, gcjLon) {
528
- const initDelta = 0.01;
529
- const threshold = 1e-9;
530
- let dLat = initDelta;
531
- let dLon = initDelta;
532
- let mLat = gcjLat - dLat;
533
- let mLon = gcjLon - dLon;
534
- let pLat = gcjLat + dLat;
535
- let pLon = gcjLon + dLon;
536
- let wgsLat;
537
- let wgsLon;
538
- let i = 0;
539
- while (1) {
540
- wgsLat = (mLat + pLat) / 2;
541
- wgsLon = (mLon + pLon) / 2;
542
- const tmp = this.gcj_encrypt(wgsLat, wgsLon);
543
- dLat = tmp.lat - gcjLat;
544
- dLon = tmp.lng - gcjLon;
545
- if (Math.abs(dLat) < threshold && Math.abs(dLon) < threshold) {
546
- break;
547
- }
548
- if (dLat > 0)
549
- pLat = wgsLat;
550
- else
551
- mLat = wgsLat;
552
- if (dLon > 0)
553
- pLon = wgsLon;
554
- else
555
- mLon = wgsLon;
556
- if (++i > 1e4)
557
- break;
558
- }
559
- return { lat: wgsLat, lng: wgsLon };
560
- },
561
- bdEncrypt(gcjLat, gcjLon) {
562
- const x = gcjLon;
563
- const y = gcjLat;
564
- const z = Math.sqrt(x * x + y * y) + 2e-5 * Math.sin(y * this.XPI);
565
- const theta = Math.atan2(y, x) + 3e-6 * Math.cos(x * this.XPI);
566
- const bdLon = z * Math.cos(theta) + 65e-4;
567
- const bdLat = z * Math.sin(theta) + 6e-3;
568
- return { lat: bdLat, lng: bdLon };
569
- },
570
- bdDecrypt(bdLat, bdLon) {
571
- const x = bdLon - 65e-4;
572
- const y = bdLat - 6e-3;
573
- const z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * this.XPI);
574
- const theta = Math.atan2(y, x) - 3e-6 * Math.cos(x * this.XPI);
575
- const gcjLon = z * Math.cos(theta);
576
- const gcjLat = z * Math.sin(theta);
577
- return { lat: gcjLat, lng: gcjLon };
578
- },
579
- mercatorEncrypt(wgsLat, wgsLon) {
580
- const x = wgsLon * 2003750834e-2 / 180;
581
- let y = Math.log(Math.tan((90 + wgsLat) * this.PI / 360)) / (this.PI / 180);
582
- y = y * 2003750834e-2 / 180;
583
- return { lat: y, lng: x };
584
- },
585
- mercatorDecrypt(mercatorLat, mercatorLon) {
586
- const x = mercatorLon / 2003750834e-2 * 180;
587
- let y = mercatorLat / 2003750834e-2 * 180;
588
- y = 180 / this.PI * (2 * Math.atan(Math.exp(y * this.PI / 180)) - this.PI / 2);
589
- return { lat: y, lng: x };
590
- },
591
- distance(latA, lngA, latB, lngB) {
592
- const earthR = 6371e3;
593
- const x = Math.cos(latA * this.PI / 180) * Math.cos(latB * this.PI / 180) * Math.cos((lngA - lngB) * this.PI / 180);
594
- const y = Math.sin(latA * this.PI / 180) * Math.sin(latB * this.PI / 180);
595
- let s = x + y;
596
- if (s > 1)
597
- s = 1;
598
- if (s < -1)
599
- s = -1;
600
- const alpha = Math.acos(s);
601
- const distance = alpha * earthR;
602
- return distance;
603
- },
604
- outOfChina(lat, lng) {
605
- if (lng < 72.004 || lng > 137.8347) {
606
- return true;
607
- }
608
- if (lat < 0.8293 || lat > 55.8271) {
609
- return true;
610
- }
611
- return false;
612
- },
613
- transformLat(x, y) {
614
- let ret = -100 + 2 * x + 3 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
615
- ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
616
- ret += (20 * Math.sin(y * this.PI) + 40 * Math.sin(y / 3 * this.PI)) * 2 / 3;
617
- ret += (160 * Math.sin(y / 12 * this.PI) + 320 * Math.sin(y * this.PI / 30)) * 2 / 3;
618
- return ret;
619
- },
620
- transformLon(x, y) {
621
- let ret = 300 + x + 2 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
622
- ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
623
- ret += (20 * Math.sin(x * this.PI) + 40 * Math.sin(x / 3 * this.PI)) * 2 / 3;
624
- ret += (150 * Math.sin(x / 12 * this.PI) + 300 * Math.sin(x / 30 * this.PI)) * 2 / 3;
625
- return ret;
626
- },
627
- randomCoordinate(minX, minY, maxX, maxY) {
415
+ delta(t, e) {
416
+ const r = 0.006693421622965943;
417
+ let a = this.transformLat(e - 105, t - 35), s = this.transformLon(e - 105, t - 35);
418
+ const i = t / 180 * this.PI;
419
+ let o = Math.sin(i);
420
+ o = 1 - r * o * o;
421
+ const c = Math.sqrt(o);
422
+ return a = a * 180 / (6378245 * (1 - r) / (o * c) * this.PI), s = s * 180 / (6378245 / c * Math.cos(i) * this.PI), { lat: a, lng: s };
423
+ },
424
+ // WGS-84 to GCJ-02
425
+ gcjEncrypt(t, e) {
426
+ if (this.outOfChina(t, e))
427
+ return { lat: t, lng: e };
428
+ const n = this.delta(t, e);
429
+ return { lat: t + n.lat, lng: e + n.lng };
430
+ },
431
+ // GCJ-02 to WGS-84
432
+ gcjDecrypt(t, e) {
433
+ if (this.outOfChina(t, e))
434
+ return { lat: t, lng: e };
435
+ const n = this.delta(t, e);
436
+ return { lat: t - n.lat, lng: e - n.lng };
437
+ },
438
+ // GCJ-02 to WGS-84 exactly
439
+ gcjDecryptExact(t, e) {
440
+ let a = 0.01, s = 0.01, i = t - a, o = e - s, c = t + a, l = e + s, h, u, d = 0;
441
+ for (; ; ) {
442
+ h = (i + c) / 2, u = (o + l) / 2;
443
+ const f = this.gcj_encrypt(h, u);
444
+ if (a = f.lat - t, s = f.lng - e, Math.abs(a) < 1e-9 && Math.abs(s) < 1e-9 || (a > 0 ? c = h : i = h, s > 0 ? l = u : o = u, ++d > 1e4)) break;
445
+ }
446
+ return { lat: h, lng: u };
447
+ },
448
+ // GCJ-02 to BD-09
449
+ bdEncrypt(t, e) {
450
+ const n = e, r = t, a = Math.sqrt(n * n + r * r) + 2e-5 * Math.sin(r * this.XPI), s = Math.atan2(r, n) + 3e-6 * Math.cos(n * this.XPI), i = a * Math.cos(s) + 65e-4;
451
+ return { lat: a * Math.sin(s) + 6e-3, lng: i };
452
+ },
453
+ // BD-09 to GCJ-02
454
+ bdDecrypt(t, e) {
455
+ const n = e - 65e-4, r = t - 6e-3, a = Math.sqrt(n * n + r * r) - 2e-5 * Math.sin(r * this.XPI), s = Math.atan2(r, n) - 3e-6 * Math.cos(n * this.XPI), i = a * Math.cos(s);
456
+ return { lat: a * Math.sin(s), lng: i };
457
+ },
458
+ // WGS-84 to Web mercator
459
+ // mercatorLat -> y mercatorLon -> x
460
+ mercatorEncrypt(t, e) {
461
+ const n = e * 2003750834e-2 / 180;
462
+ let r = Math.log(Math.tan((90 + t) * this.PI / 360)) / (this.PI / 180);
463
+ return r = r * 2003750834e-2 / 180, { lat: r, lng: n };
464
+ },
465
+ // Web mercator to WGS-84
466
+ // mercatorLat -> y mercatorLon -> x
467
+ mercatorDecrypt(t, e) {
468
+ const n = e / 2003750834e-2 * 180;
469
+ let r = t / 2003750834e-2 * 180;
470
+ return r = 180 / this.PI * (2 * Math.atan(Math.exp(r * this.PI / 180)) - this.PI / 2), { lat: r, lng: n };
471
+ },
472
+ // two point's distance
473
+ distance(t, e, n, r) {
474
+ const s = Math.cos(t * this.PI / 180) * Math.cos(n * this.PI / 180) * Math.cos((e - r) * this.PI / 180), i = Math.sin(t * this.PI / 180) * Math.sin(n * this.PI / 180);
475
+ let o = s + i;
476
+ return o > 1 && (o = 1), o < -1 && (o = -1), Math.acos(o) * 6371e3;
477
+ },
478
+ outOfChina(t, e) {
479
+ return e < 72.004 || e > 137.8347 || t < 0.8293 || t > 55.8271;
480
+ },
481
+ transformLat(t, e) {
482
+ let n = -100 + 2 * t + 3 * e + 0.2 * e * e + 0.1 * t * e + 0.2 * Math.sqrt(Math.abs(t));
483
+ 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;
484
+ },
485
+ transformLon(t, e) {
486
+ let n = 300 + t + 2 * e + 0.1 * t * t + 0.1 * t * e + 0.1 * Math.sqrt(Math.abs(t));
487
+ 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;
488
+ },
489
+ randomCoordinate(t, e, n, r) {
628
490
  return {
629
- lat: Math.random() * (maxY - minY) + minY,
630
- lng: Math.random() * (maxX - minX) + minX
491
+ lat: Math.random() * (r - e) + e,
492
+ lng: Math.random() * (n - t) + t
631
493
  };
632
494
  }
633
495
  };
634
- Date.prototype.format = function(fmt) {
635
- const o = {
496
+ Date.prototype.format = function(t) {
497
+ const e = {
636
498
  "M+": this.getMonth() + 1,
499
+ // 月份
637
500
  "d+": this.getDate(),
501
+ // 日
638
502
  "h+": this.getHours(),
503
+ // 小时
639
504
  "m+": this.getMinutes(),
505
+ // 分
640
506
  "s+": this.getSeconds(),
507
+ // 秒
641
508
  "q+": Math.floor((this.getMonth() + 3) / 3),
509
+ // 季度
642
510
  S: this.getMilliseconds()
511
+ // 毫秒
643
512
  };
644
- if (/(y+)/.test(fmt))
645
- fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
646
- for (const k in o) {
647
- if (new RegExp("(" + k + ")").test(fmt))
648
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
649
- }
650
- return fmt;
513
+ /(y+)/.test(t) && (t = t.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)));
514
+ for (const n in e)
515
+ new RegExp("(" + n + ")").test(t) && (t = t.replace(RegExp.$1, RegExp.$1.length === 1 ? e[n] : ("00" + e[n]).substr(("" + e[n]).length)));
516
+ return t;
651
517
  };
652
- Date.prototype.addDate = function(interval, number) {
653
- const date = new Date(this);
654
- switch (interval) {
518
+ Date.prototype.addDate = function(t, e) {
519
+ const n = new Date(this);
520
+ switch (t) {
655
521
  case "y":
656
- date.setFullYear(this.getFullYear() + number);
522
+ n.setFullYear(this.getFullYear() + e);
657
523
  break;
658
524
  case "q":
659
- date.setMonth(this.getMonth() + number * 3);
525
+ n.setMonth(this.getMonth() + e * 3);
660
526
  break;
661
527
  case "M":
662
- date.setMonth(this.getMonth() + number);
528
+ n.setMonth(this.getMonth() + e);
663
529
  break;
664
530
  case "w":
665
- date.setDate(this.getDate() + number * 7);
531
+ n.setDate(this.getDate() + e * 7);
666
532
  break;
667
533
  case "d":
668
- date.setDate(this.getDate() + number);
534
+ n.setDate(this.getDate() + e);
669
535
  break;
670
536
  case "h":
671
- date.setHours(this.getHours() + number);
537
+ n.setHours(this.getHours() + e);
672
538
  break;
673
539
  case "m":
674
- date.setMinutes(this.getMinutes() + number);
540
+ n.setMinutes(this.getMinutes() + e);
675
541
  break;
676
542
  case "s":
677
- date.setSeconds(this.getSeconds() + number);
543
+ n.setSeconds(this.getSeconds() + e);
678
544
  break;
679
545
  default:
680
- date.setDate(this.getDate() + number);
546
+ n.setDate(this.getDate() + e);
681
547
  break;
682
548
  }
683
- return date;
549
+ return n;
684
550
  };
685
- var DateUtils = {
686
- lastMonthDate: new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1),
687
- thisMonthDate: new Date(new Date().getFullYear(), new Date().getMonth(), 1),
688
- nextMonthDate: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1),
689
- lastWeekDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1 - 7 - new Date().getDay()),
690
- thisWeekDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1 - new Date().getDay()),
691
- nextWeekDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1 + 7 - new Date().getDay()),
692
- lastDayDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 1),
693
- thisDayDate: new Date(new Date().setHours(0, 0, 0, 0)),
694
- nextDayDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1),
695
- parseDate(str) {
696
- if (typeof str == "string") {
697
- var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
698
- if (results && results.length > 3)
699
- return new Date(parseInt(results[1]), parseInt(results[2]) - 1, parseInt(results[3]));
700
- results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);
701
- if (results && results.length > 6)
551
+ const et = {
552
+ lastMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1),
553
+ thisMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
554
+ nextMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1),
555
+ lastWeekDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - 7 - (/* @__PURE__ */ new Date()).getDay()),
556
+ thisWeekDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - (/* @__PURE__ */ new Date()).getDay()),
557
+ nextWeekDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 + 7 - (/* @__PURE__ */ new Date()).getDay()),
558
+ lastDayDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() - 1),
559
+ thisDayDate: new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)),
560
+ nextDayDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1),
561
+ parseDate(t) {
562
+ if (typeof t == "string") {
563
+ var e = t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
564
+ if (e && e.length > 3) return new Date(parseInt(e[1]), parseInt(e[2]) - 1, parseInt(e[3]));
565
+ 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)
702
566
  return new Date(
703
- parseInt(results[1]),
704
- parseInt(results[2]) - 1,
705
- parseInt(results[3]),
706
- parseInt(results[4]),
707
- parseInt(results[5]),
708
- parseInt(results[6])
567
+ parseInt(e[1]),
568
+ parseInt(e[2]) - 1,
569
+ parseInt(e[3]),
570
+ parseInt(e[4]),
571
+ parseInt(e[5]),
572
+ parseInt(e[6])
709
573
  );
710
- results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/);
711
- if (results && results.length > 7)
574
+ 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)
712
575
  return new Date(
713
- parseInt(results[1]),
714
- parseInt(results[2]) - 1,
715
- parseInt(results[3]),
716
- parseInt(results[4]),
717
- parseInt(results[5]),
718
- parseInt(results[6]),
719
- parseInt(results[7])
576
+ parseInt(e[1]),
577
+ parseInt(e[2]) - 1,
578
+ parseInt(e[3]),
579
+ parseInt(e[4]),
580
+ parseInt(e[5]),
581
+ parseInt(e[6]),
582
+ parseInt(e[7])
720
583
  );
721
584
  }
722
585
  return null;
723
586
  },
724
- formatDateInterval(startTime, endTime) {
725
- const dateCreateTime = new Date(startTime);
726
- const dateFinishTime = new Date(endTime);
727
- const dateInterval = dateFinishTime.getTime() - dateCreateTime.getTime();
728
- const days = Math.floor(dateInterval / (24 * 3600 * 1e3));
729
- const leave1 = dateInterval % (24 * 3600 * 1e3);
730
- const hours = Math.floor(leave1 / (3600 * 1e3));
731
- const leave2 = leave1 % (3600 * 1e3);
732
- const minutes = Math.floor(leave2 / (60 * 1e3));
733
- const leave3 = leave2 % (60 * 1e3);
734
- const seconds = Math.round(leave3 / 1e3);
735
- let intervalDes = "";
736
- if (days > 0) {
737
- intervalDes += days + "\u5929";
738
- }
739
- if (hours > 0) {
740
- intervalDes += hours + "\u65F6";
741
- }
742
- if (minutes > 0) {
743
- intervalDes += minutes + "\u5206";
744
- }
745
- if (seconds > 0) {
746
- intervalDes += seconds + "\u79D2";
747
- }
748
- if (days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
749
- intervalDes = "\u5C11\u4E8E1\u79D2";
750
- }
751
- return intervalDes;
752
- },
753
- formatterCounter(times) {
754
- const checked = function(j) {
755
- return (j > 10 ? "" : "0") + (j || 0);
756
- };
757
- const houres = checked(Math.floor(times / 3600));
758
- const level1 = times % 3600;
759
- const minutes = checked(Math.floor(level1 / 60));
760
- const leave2 = level1 % 60;
761
- const seconds = checked(Math.round(leave2));
762
- return `${houres}:${minutes}:${seconds}`;
763
- },
764
- sleep(d) {
587
+ /**
588
+ * 将时间间隔转换成中国话
589
+ *
590
+ * @param {*} startTime
591
+ * @param {*} endTime
592
+ * @returns {*}
593
+ */
594
+ formatDateInterval(t, e) {
595
+ const n = new Date(t), a = new Date(e).getTime() - n.getTime(), s = Math.floor(a / (24 * 3600 * 1e3)), i = a % (24 * 3600 * 1e3), o = Math.floor(i / (3600 * 1e3)), c = i % (3600 * 1e3), l = Math.floor(c / (60 * 1e3)), h = c % (60 * 1e3), u = Math.round(h / 1e3);
596
+ let d = "";
597
+ return s > 0 && (d += s + "天"), o > 0 && (d += o + "时"), l > 0 && (d += l + "分"), u > 0 && (d += u + "秒"), s === 0 && o === 0 && l === 0 && u === 0 && (d = "少于1秒"), d;
598
+ },
599
+ formatterCounter(t) {
600
+ const e = function(o) {
601
+ return (o > 10 ? "" : "0") + (o || 0);
602
+ }, n = e(Math.floor(t / 3600)), r = t % 3600, a = e(Math.floor(r / 60)), s = r % 60, i = e(Math.round(s));
603
+ return `${n}:${a}:${i}`;
604
+ },
605
+ sleep(t) {
765
606
  }
766
607
  };
767
- function trim(str) {
768
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
608
+ function N(t) {
609
+ return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "");
769
610
  }
770
- function splitWords(str) {
771
- return trim(str).split(/\s+/);
611
+ function L(t) {
612
+ return N(t).split(/\s+/);
772
613
  }
773
- var DomUtils = {
774
- getStyle(el, style) {
775
- let value = el.style[style] || el.currentStyle && el.currentStyle[style];
776
- if ((!value || value === "auto") && document.defaultView) {
777
- const css = document.defaultView.getComputedStyle(el, null);
778
- value = css ? css[style] : null;
779
- }
780
- return value === "auto" ? null : value;
781
- },
782
- create(tagName, className, container) {
783
- const el = document.createElement(tagName);
784
- el.className = className || "";
785
- if (container) {
786
- container.appendChild(el);
787
- }
788
- return el;
789
- },
790
- remove(el) {
791
- const parent = el.parentNode;
792
- if (parent) {
793
- parent.removeChild(el);
794
- }
795
- },
796
- empty(el) {
797
- while (el.firstChild) {
798
- el.removeChild(el.firstChild);
799
- }
800
- },
801
- toFront(el) {
802
- const parent = el.parentNode;
803
- if (parent && parent.lastChild !== el) {
804
- parent.appendChild(el);
805
- }
806
- },
807
- toBack(el) {
808
- const parent = el.parentNode;
809
- if (parent && parent.firstChild !== el) {
810
- parent.insertBefore(el, parent.firstChild);
811
- }
812
- },
813
- getClass(el) {
814
- if (el.correspondingElement) {
815
- el = el.correspondingElement;
816
- }
817
- return el.className.baseVal === void 0 ? el.className : el.className.baseVal;
818
- },
819
- hasClass(el, name) {
820
- if (el.classList !== void 0) {
821
- return el.classList.contains(name);
822
- }
823
- const className = this.getClass(el);
824
- return className.length > 0 && new RegExp("(^|\\s)" + name + "(\\s|$)").test(className);
825
- },
826
- addClass(el, name) {
827
- if (el.classList !== void 0) {
828
- const classes = splitWords(name);
829
- for (let i = 0, len = classes.length; i < len; i++) {
830
- el.classList.add(classes[i]);
831
- }
832
- } else if (!this.hasClass(el, name)) {
833
- const className = this.getClass(el);
834
- this.setClass(el, (className ? className + " " : "") + name);
835
- }
836
- },
837
- removeClass(el, name) {
838
- if (el.classList !== void 0) {
839
- const classes = splitWords(name);
840
- classes.forEach((name2) => el.classList.remove(name2));
841
- } else {
842
- this.setClass(el, trim((" " + this.getClass(el) + " ").replace(" " + name + " ", " ")));
843
- }
844
- },
845
- setClass(el, name) {
846
- if (el.className.baseVal === void 0) {
847
- el.className = name;
848
- } else {
849
- el.className.baseVal = name;
850
- }
851
- },
852
- parseFromString(str) {
853
- const parser = new DOMParser();
854
- const doc = parser.parseFromString(str, "text/xml");
855
- return doc.children[0];
614
+ const nt = {
615
+ getStyle(t, e) {
616
+ let n = t.style[e] || t.currentStyle && t.currentStyle[e];
617
+ if ((!n || n === "auto") && document.defaultView) {
618
+ const r = document.defaultView.getComputedStyle(t, null);
619
+ n = r ? r[e] : null;
620
+ }
621
+ return n === "auto" ? null : n;
622
+ },
623
+ create(t, e, n) {
624
+ const r = document.createElement(t);
625
+ return r.className = e || "", n && n.appendChild(r), r;
626
+ },
627
+ remove(t) {
628
+ const e = t.parentNode;
629
+ e && e.removeChild(t);
630
+ },
631
+ empty(t) {
632
+ for (; t.firstChild; )
633
+ t.removeChild(t.firstChild);
634
+ },
635
+ toFront(t) {
636
+ const e = t.parentNode;
637
+ e && e.lastChild !== t && e.appendChild(t);
638
+ },
639
+ toBack(t) {
640
+ const e = t.parentNode;
641
+ e && e.firstChild !== t && e.insertBefore(t, e.firstChild);
642
+ },
643
+ getClass(t) {
644
+ return t.correspondingElement && (t = t.correspondingElement), t.className.baseVal === void 0 ? t.className : t.className.baseVal;
645
+ },
646
+ hasClass(t, e) {
647
+ if (t.classList !== void 0)
648
+ return t.classList.contains(e);
649
+ const n = this.getClass(t);
650
+ return n.length > 0 && new RegExp("(^|\\s)" + e + "(\\s|$)").test(n);
651
+ },
652
+ addClass(t, e) {
653
+ if (t.classList !== void 0) {
654
+ const n = L(e);
655
+ for (let r = 0, a = n.length; r < a; r++)
656
+ t.classList.add(n[r]);
657
+ } else if (!this.hasClass(t, e)) {
658
+ const n = this.getClass(t);
659
+ this.setClass(t, (n ? n + " " : "") + e);
660
+ }
661
+ },
662
+ removeClass(t, e) {
663
+ t.classList !== void 0 ? L(e).forEach((r) => t.classList.remove(r)) : this.setClass(t, N((" " + this.getClass(t) + " ").replace(" " + e + " ", " ")));
664
+ },
665
+ setClass(t, e) {
666
+ t.className.baseVal === void 0 ? t.className = e : t.className.baseVal = e;
667
+ },
668
+ parseFromString(t) {
669
+ return new DOMParser().parseFromString(t, "text/xml").children[0];
856
670
  }
857
- };
858
- var MathUtils = {
671
+ }, g = {
859
672
  DEG2RAD: Math.PI / 180,
860
673
  RAD2DEG: 180 / Math.PI,
861
- randInt(low, high) {
862
- return low + Math.floor(Math.random() * (high - low + 1));
863
- },
864
- randFloat(low, high) {
865
- return low + Math.random() * (high - low);
866
- },
867
- degreesToRadians(degrees) {
868
- return degrees * this.DEG2RAD;
869
- },
870
- toRadians(degrees) {
871
- return degrees * this.DEG2RAD;
872
- },
873
- radiansToDegrees(radians) {
874
- return radians * this.RAD2DEG;
875
- },
876
- toDegrees(radians) {
877
- return radians * this.RAD2DEG;
878
- },
879
- formatFloat(value, n = 2) {
880
- return Math.round(value * Math.pow(10, n)) / Math.pow(10, n);
674
+ randInt(t, e) {
675
+ return t + Math.floor(Math.random() * (e - t + 1));
676
+ },
677
+ randFloat(t, e) {
678
+ return t + Math.random() * (e - t);
679
+ },
680
+ /**
681
+ * 角度转弧度
682
+ *
683
+ * @param {*} degrees
684
+ * @returns {*}
685
+ */
686
+ degreesToRadians(t) {
687
+ return t * this.DEG2RAD;
688
+ },
689
+ /**
690
+ * 角度转弧度
691
+ *
692
+ * @param {*} degrees
693
+ * @returns {*}
694
+ */
695
+ toRadians(t) {
696
+ return t * this.DEG2RAD;
697
+ },
698
+ /**
699
+ * 弧度转角度
700
+ *
701
+ * @param {*} radians
702
+ * @returns {*}
703
+ */
704
+ radiansToDegrees(t) {
705
+ return t * this.RAD2DEG;
706
+ },
707
+ /**
708
+ * 弧度转角度
709
+ *
710
+ * @param {*} radians
711
+ * @returns {*}
712
+ */
713
+ toDegrees(t) {
714
+ return t * this.RAD2DEG;
715
+ },
716
+ formatFloat(t, e = 2) {
717
+ return Math.round(t * Math.pow(10, e)) / Math.pow(10, e);
881
718
  }
882
- };
883
- var GeoUtils = {
719
+ }, j = {
884
720
  toRadian: Math.PI / 180,
885
721
  R: 6371393,
886
- isLnglat(lng, lat) {
887
- return lng && lat && !!(+lat > -90 && +lat < 90 && +lng > -180 && +lng < 180);
888
- },
889
- formatLnglat(lng, lat) {
890
- let res = "";
891
- function format(value) {
892
- const a = parseFloat(value);
893
- const degree = parseInt(a);
894
- let min = parseInt((a - degree) * 60);
895
- let sec = (a - degree) * 3600 - min * 60;
896
- return degree + "\xB0" + min + "\u2032" + sec.toFixed(2) + "\u2033";
897
- }
898
- if (lng && lat) {
899
- res = format(lng) + "," + format(lat);
900
- }
901
- return res;
902
- },
903
- transformLnglat(lng, lat) {
904
- function dms2deg(s) {
905
- var sw = /[sw]/i.test(s);
906
- var f = sw ? -1 : 1;
907
- var bits = s.match(/[\d.]+/g);
908
- var result = 0;
909
- for (var i = 0, iLen = bits.length; i < iLen; i++) {
910
- result += bits[i] / f;
911
- f *= 60;
912
- }
913
- return result;
914
- }
915
- if (lng && lat) {
722
+ /**
723
+ * 验证经纬度坐标
724
+ *
725
+ * @param {*} lng
726
+ * @param {*} lat
727
+ * @returns {*} {boolean}
728
+ */
729
+ isLnglat(t, e) {
730
+ return t && e && +e > -90 && +e < 90 && +t > -180 && +t < 180;
731
+ },
732
+ /**
733
+ * 格式化经纬度(转度分秒)
734
+ *
735
+ * @param {*} lng
736
+ * @param {*} lat
737
+ * @returns {*}
738
+ */
739
+ formatLnglat(t, e) {
740
+ let n = "";
741
+ function r(a) {
742
+ const s = parseFloat(a), i = parseInt(s);
743
+ let o = parseInt((s - i) * 60), c = (s - i) * 3600 - o * 60;
744
+ return i + "°" + o + "′" + c.toFixed(2) + "″";
745
+ }
746
+ return t && e && (n = r(t) + "," + r(e)), n;
747
+ },
748
+ /**
749
+ * 度分秒转十进制
750
+ *
751
+ * @param {*} lng
752
+ * @param {*} lat
753
+ * @returns {*}
754
+ */
755
+ transformLnglat(t, e) {
756
+ function n(r) {
757
+ for (var a = /[sw]/i.test(r), s = a ? -1 : 1, i = r.match(/[\d.]+/g), o = 0, c = 0, l = i.length; c < l; c++)
758
+ o += i[c] / s, s *= 60;
759
+ return o;
760
+ }
761
+ if (t && e)
916
762
  return {
917
- lng: dms2deg(lng),
918
- lat: dms2deg(lat)
763
+ lng: n(t),
764
+ lat: n(e)
919
765
  };
920
- }
921
766
  },
922
- rayCasting(p, poly) {
923
- var px = p.x, py = p.y, flag = false;
924
- for (var i = 0, l = poly.length, j = l - 1; i < l; j = i, i++) {
925
- var sx = poly[i].x, sy = poly[i].y, tx = poly[j].x, ty = poly[j].y;
926
- if (sx === px && sy === py || tx === px && ty === py) {
767
+ /**
768
+ * 判断点是否在多边形内
769
+ *
770
+ * @param {*} p
771
+ * @param {*} poly
772
+ * @returns {*}
773
+ */
774
+ rayCasting(t, e) {
775
+ for (var n = t.x, r = t.y, a = !1, s = 0, i = e.length, o = i - 1; s < i; o = s, s++) {
776
+ var c = e[s].x, l = e[s].y, h = e[o].x, u = e[o].y;
777
+ if (c === n && l === r || h === n && u === r)
927
778
  return "on";
928
- }
929
- if (sy < py && ty >= py || sy >= py && ty < py) {
930
- var x = sx + (py - sy) * (tx - sx) / (ty - sy);
931
- if (x === px) {
779
+ if (l < r && u >= r || l >= r && u < r) {
780
+ var d = c + (r - l) * (h - c) / (u - l);
781
+ if (d === n)
932
782
  return "on";
933
- }
934
- if (x > px) {
935
- flag = !flag;
936
- }
783
+ d > n && (a = !a);
937
784
  }
938
785
  }
939
- return flag ? "in" : "out";
940
- },
941
- wgs84PointsDistance(fromPoint, toPoint) {
942
- var PI = Math.PI;
943
- function getRad(d) {
944
- return d * PI / 180;
945
- }
946
- if (arguments.length != 2) {
786
+ return a ? "in" : "out";
787
+ },
788
+ /**
789
+ * 计算两点距离
790
+ *
791
+ * @param {*} fromPoint
792
+ * @param {*} toPoint
793
+ * @returns {*}
794
+ */
795
+ wgs84PointsDistance(t, e) {
796
+ var n = Math.PI;
797
+ function r(W) {
798
+ return W * n / 180;
799
+ }
800
+ if (arguments.length != 2)
947
801
  return 0;
948
- }
949
- lon1 = fromPoint.x;
950
- lat1 = fromPoint.y;
951
- lon2 = toPoint.x;
952
- lat2 = toPoint.y;
953
- var a = 6378137, b = 63567523142e-4, f = 1 / 298.257223563;
954
- var L = getRad(lon2 - lon1);
955
- var U1 = Math.atan((1 - f) * Math.tan(getRad(lat1)));
956
- var U2 = Math.atan((1 - f) * Math.tan(getRad(lat2)));
957
- var sinU1 = Math.sin(U1), cosU1 = Math.cos(U1);
958
- var sinU2 = Math.sin(U2), cosU2 = Math.cos(U2);
959
- var lambda = L, lambdaP, iterLimit = 100;
802
+ lon1 = t.x, lat1 = t.y, lon2 = e.x, lat2 = e.y;
803
+ var a = 6378137, s = 63567523142e-4, i = 1 / 298.257223563, o = r(lon2 - lon1), c = Math.atan((1 - i) * Math.tan(r(lat1))), l = Math.atan((1 - i) * Math.tan(r(lat2))), h = Math.sin(c), u = Math.cos(c), d = Math.sin(l), f = Math.cos(l), w = o, T, _ = 100;
960
804
  do {
961
- var sinLambda = Math.sin(lambda), cosLambda = Math.cos(lambda);
962
- var sinSigma = Math.sqrt(
963
- cosU2 * sinLambda * (cosU2 * sinLambda) + (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda)
805
+ var b = Math.sin(w), A = Math.cos(w), R = Math.sqrt(
806
+ f * b * (f * b) + (u * d - h * f * A) * (u * d - h * f * A)
964
807
  );
965
- if (sinSigma == 0)
966
- return 0;
967
- var cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda;
968
- var sigma = Math.atan2(sinSigma, cosSigma);
969
- var sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma;
970
- var cosSqAlpha = 1 - sinAlpha * sinAlpha;
971
- var cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha;
972
- if (isNaN(cos2SigmaM))
973
- cos2SigmaM = 0;
974
- var C = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha));
975
- lambdaP = lambda;
976
- lambda = L + (1 - C) * f * sinAlpha * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
977
- } while (Math.abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0);
978
- if (iterLimit == 0) {
808
+ if (R == 0) return 0;
809
+ var D = h * d + u * f * A, C = Math.atan2(R, D), x = u * f * b / R, O = 1 - x * x, p = D - 2 * h * d / O;
810
+ isNaN(p) && (p = 0);
811
+ var I = i / 16 * O * (4 + i * (4 - 3 * O));
812
+ T = w, w = o + (1 - I) * i * x * (C + I * R * (p + I * D * (-1 + 2 * p * p)));
813
+ } while (Math.abs(w - T) > 1e-12 && --_ > 0);
814
+ if (_ == 0)
979
815
  return NaN;
980
- }
981
- var uSq = cosSqAlpha * (a * a - b * b) / (b * b);
982
- var A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
983
- var B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
984
- var deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) - B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
985
- var s = b * A * (sigma - deltaSigma);
986
- return s;
987
- },
988
- rotatePoint(p1, p2, \u03B8) {
989
- const x = (p1.x - p2.x) * Math.cos(Math.PI / 180 * -\u03B8) - (p1.y - p2.y) * Math.sin(Math.PI / 180 * -\u03B8) + p2.x;
990
- const y = (p1.x - p2.x) * Math.sin(Math.PI / 180 * -\u03B8) + (p1.y - p2.y) * Math.cos(Math.PI / 180 * -\u03B8) + p2.y;
991
- return { x, y };
992
- },
993
- calcBearAndDis(p1, p2) {
994
- const { x: x1, y: y1 } = p1;
995
- const { x: x2, y: y2 } = p2;
996
- const dx = x2 - x1;
997
- const dy = y2 - y1;
998
- const distance = Math.sqrt(dx * dx + dy * dy);
999
- const angleInRadians = Math.atan2(dy, dx);
1000
- const angle = (angleInRadians * (180 / Math.PI) + 360 + 90) % 360;
1001
- return { angle, distance };
1002
- },
1003
- calcBearAndDisByPoints(latlng1, latlng2) {
1004
- var f1 = parseFloat(latlng1.lat), l1 = parseFloat(latlng1.lng), f2 = parseFloat(latlng2.lat), l2 = parseFloat(latlng2.lng);
1005
- var y = Math.sin((l2 - l1) * this.toRadian) * Math.cos(f2 * this.toRadian);
1006
- var x = Math.cos(f1 * this.toRadian) * Math.sin(f2 * this.toRadian) - Math.sin(f1 * this.toRadian) * Math.cos(f2 * this.toRadian) * Math.cos((l2 - l1) * this.toRadian);
1007
- var angle = Math.atan2(y, x) * (180 / Math.PI);
1008
- var deltaF = (f2 - f1) * this.toRadian;
1009
- var deltaL = (l2 - l1) * this.toRadian;
1010
- var a = Math.sin(deltaF / 2) * Math.sin(deltaF / 2) + Math.cos(f1 * this.toRadian) * Math.cos(f2 * this.toRadian) * Math.sin(deltaL / 2) * Math.sin(deltaL / 2);
1011
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
1012
- var distance = this.R * c;
816
+ var M = O * (a * a - s * s) / (s * s), F = 1 + M / 16384 * (4096 + M * (-768 + M * (320 - 175 * M))), S = M / 1024 * (256 + M * (-128 + M * (74 - 47 * M))), B = S * R * (p + S / 4 * (D * (-1 + 2 * p * p) - S / 6 * p * (-3 + 4 * R * R) * (-3 + 4 * p * p))), $ = s * F * (C - B);
817
+ return $;
818
+ },
819
+ /**
820
+ * P1绕一个坐标点P2旋转θ角度后,新的坐标的计算公式
821
+ *
822
+ * @param {*} p1
823
+ * @param {*} p2
824
+ * @param {*} θ 旋转角度,正:表示顺时针,负:表示逆时针
825
+ */
826
+ rotatePoint(t, e, n) {
827
+ const r = (t.x - e.x) * Math.cos(Math.PI / 180 * -n) - (t.y - e.y) * Math.sin(Math.PI / 180 * -n) + e.x, a = (t.x - e.x) * Math.sin(Math.PI / 180 * -n) + (t.y - e.y) * Math.cos(Math.PI / 180 * -n) + e.y;
828
+ return { x: r, y: a };
829
+ },
830
+ calcBearAndDis(t, e) {
831
+ const { x: n, y: r } = t, { x: a, y: s } = e, i = a - n, o = s - r, c = Math.sqrt(i * i + o * o);
832
+ return { angle: (Math.atan2(o, i) * (180 / Math.PI) + 360 + 90) % 360, distance: c };
833
+ },
834
+ /**
835
+ * 计算latlng2相对于latlng1的方位角和距离
836
+ *
837
+ * @param {*} latlng1
838
+ * @param {*} latlng2
839
+ * @returns {*} {boolean}
840
+ */
841
+ calcBearAndDisByPoints(t, e) {
842
+ var n = parseFloat(t.lat), r = parseFloat(t.lng), a = parseFloat(e.lat), s = parseFloat(e.lng), i = Math.sin((s - r) * this.toRadian) * Math.cos(a * this.toRadian), o = Math.cos(n * this.toRadian) * Math.sin(a * this.toRadian) - Math.sin(n * this.toRadian) * Math.cos(a * this.toRadian) * Math.cos((s - r) * this.toRadian), c = Math.atan2(i, o) * (180 / Math.PI), l = (a - n) * this.toRadian, h = (s - r) * this.toRadian, u = Math.sin(l / 2) * Math.sin(l / 2) + Math.cos(n * this.toRadian) * Math.cos(a * this.toRadian) * Math.sin(h / 2) * Math.sin(h / 2), d = 2 * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u)), f = this.R * d;
1013
843
  return {
1014
- angle,
1015
- distance
844
+ angle: c,
845
+ distance: f
1016
846
  };
1017
847
  },
1018
- calcPointByBearAndDis(latlng, angle, distance) {
1019
- const sLat = MathUtils.toRadians(parseFloat(latlng.lat));
1020
- const sLng = MathUtils.toRadians(parseFloat(latlng.lng));
1021
- angle = parseFloat(angle);
1022
- distance = parseFloat(distance);
1023
- const d = distance / this.R;
1024
- angle = MathUtils.toRadians(angle);
1025
- const lat = Math.asin(Math.sin(sLat) * Math.cos(d) + Math.cos(sLat) * Math.sin(d) * Math.cos(angle));
1026
- const lon = sLng + Math.atan2(Math.sin(angle) * Math.sin(d) * Math.cos(sLat), Math.cos(d) - Math.sin(sLat) * Math.sin(lat));
848
+ /**
849
+ * 根据方位角和距离生成新的坐标
850
+ *
851
+ * @param {*} latlng
852
+ * @param {*} angle
853
+ * @param {*} distance
854
+ * @returns {*}
855
+ */
856
+ calcPointByBearAndDis(t, e, n) {
857
+ const r = g.toRadians(parseFloat(t.lat)), a = g.toRadians(parseFloat(t.lng));
858
+ e = parseFloat(e), n = parseFloat(n);
859
+ const s = n / this.R;
860
+ e = g.toRadians(e);
861
+ const i = Math.asin(Math.sin(r) * Math.cos(s) + Math.cos(r) * Math.sin(s) * Math.cos(e)), o = a + Math.atan2(Math.sin(e) * Math.sin(s) * Math.cos(r), Math.cos(s) - Math.sin(r) * Math.sin(i));
1027
862
  return {
1028
- lat: MathUtils.toDegrees(lat),
1029
- lng: MathUtils.toDegrees(lon)
863
+ lat: g.toDegrees(i),
864
+ lng: g.toDegrees(o)
1030
865
  };
1031
866
  },
1032
- mercatorTolonlat(x, y) {
1033
- const lng = x / 2003750834e-2 * 180;
1034
- var mmy = y / 2003750834e-2 * 180;
1035
- const lat = 180 / Math.PI * (2 * Math.atan(Math.exp(mmy * Math.PI / 180)) - Math.PI / 2);
1036
- return { lng, lat };
1037
- },
1038
- lonlatToMercator(lng, lat) {
1039
- var earthRad = 6378137;
1040
- const x = lng * Math.PI / 180 * earthRad;
1041
- var a = lat * Math.PI / 180;
1042
- const y = earthRad / 2 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a)));
1043
- return { x, y };
867
+ mercatorTolonlat(t, e) {
868
+ const n = t / 2003750834e-2 * 180;
869
+ var r = e / 2003750834e-2 * 180;
870
+ const a = 180 / Math.PI * (2 * Math.atan(Math.exp(r * Math.PI / 180)) - Math.PI / 2);
871
+ return { lng: n, lat: a };
872
+ },
873
+ lonlatToMercator(t, e) {
874
+ var n = 6378137;
875
+ const r = t * Math.PI / 180 * n;
876
+ var a = e * Math.PI / 180;
877
+ const s = n / 2 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a)));
878
+ return { x: r, y: s };
1044
879
  }
1045
- };
1046
- var FileUtils = {
1047
- convertBase64ToBlob(data) {
1048
- var mimeString = data.split(",")[0].split(":")[1].split(";")[0];
1049
- var byteString = window.atob(data.split(",")[1]);
1050
- var ab = new ArrayBuffer(byteString.length);
1051
- var ia = new Uint8Array(ab);
1052
- for (var i = 0; i < byteString.length; i++) {
1053
- ia[i] = byteString.charCodeAt(i);
1054
- }
1055
- var bb = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
1056
- if (bb) {
1057
- bb = new (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder)();
1058
- bb.append(ab);
1059
- return bb.getBlob(mimeString);
1060
- } else {
1061
- bb = new Blob([ab], {
1062
- type: mimeString
1063
- });
1064
- return bb;
1065
- }
1066
- },
1067
- convertUrlToBase64(url, width, height) {
1068
- return new Promise(function(resolve, reject) {
1069
- var img = new Image();
1070
- img.crossOrigin = "Anonymous";
1071
- img.src = url;
1072
- img.onload = function() {
1073
- var canvas = document.createElement("canvas");
1074
- canvas.width = width || img.width;
1075
- canvas.height = height || img.height;
1076
- var ctx = canvas.getContext("2d");
1077
- ctx.drawImage(img, 0, 0, img.width, img.height);
1078
- var ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
1079
- var dataURL = canvas.toDataURL("image/" + ext);
1080
- var base64 = {
1081
- dataURL,
1082
- type: "image/" + ext,
1083
- ext
880
+ }, rt = {
881
+ /**
882
+ * 将base64类型编码的图片转换成blob类型
883
+ *
884
+ * @param {*} data
885
+ * @returns {*}
886
+ */
887
+ convertBase64ToBlob(t) {
888
+ for (var e = t.split(",")[0].split(":")[1].split(";")[0], n = window.atob(t.split(",")[1]), r = new ArrayBuffer(n.length), a = new Uint8Array(r), s = 0; s < n.length; s++)
889
+ a[s] = n.charCodeAt(s);
890
+ var i = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
891
+ return i ? (i = new (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder)(), i.append(r), i.getBlob(e)) : (i = new Blob([r], {
892
+ type: e
893
+ }), i);
894
+ },
895
+ /**
896
+ * 将url图片转换成base64编码的图片,也可用于图片压缩
897
+ *
898
+ * @param {*} url 需要转换的图片url
899
+ * @param {*} width 指定宽高,如未指定则使用默认宽度
900
+ * @param {*} height
901
+ * @returns {*}
902
+ */
903
+ convertUrlToBase64(t, e, n) {
904
+ return new Promise(function(r, a) {
905
+ var s = new Image();
906
+ s.crossOrigin = "Anonymous", s.src = t, s.onload = function() {
907
+ var i = document.createElement("canvas");
908
+ i.width = e || s.width, i.height = n || s.height;
909
+ var o = i.getContext("2d");
910
+ o.drawImage(s, 0, 0, s.width, s.height);
911
+ var c = s.src.substring(s.src.lastIndexOf(".") + 1).toLowerCase(), l = i.toDataURL("image/" + c), h = {
912
+ dataURL: l,
913
+ type: "image/" + c,
914
+ ext: c
1084
915
  };
1085
- resolve(base64);
916
+ r(h);
1086
917
  };
1087
918
  });
1088
919
  },
1089
- convertBase64ToFile(dataurl, filename) {
1090
- var arr = dataurl.split(","), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
1091
- while (n--) {
1092
- u8arr[n] = bstr.charCodeAt(n);
1093
- }
1094
- let file = new File([u8arr], filename, { type: mime });
1095
- return file;
1096
- },
1097
- downloadFromFile(data, saveName) {
1098
- if (typeof data == "object") {
1099
- if (data instanceof Blob) {
1100
- data = URL.createObjectURL(data);
1101
- } else {
1102
- const str = JSON.stringify(data);
1103
- const blob = new Blob([str], { type: "text/json" });
1104
- data = window.URL.createObjectURL(blob);
920
+ /**
921
+ * 将base64类型编码的图片转换成file类型
922
+ *
923
+ * @param {*} dataurl
924
+ * @param {*} filename
925
+ * @returns {*}
926
+ */
927
+ convertBase64ToFile(t, e) {
928
+ for (var n = t.split(","), r = n[0].match(/:(.*?);/)[1], a = atob(n[1]), s = a.length, i = new Uint8Array(s); s--; )
929
+ i[s] = a.charCodeAt(s);
930
+ return new File([i], e, { type: r });
931
+ },
932
+ /**
933
+ * 直接下载文件,支持blob类型和url类型
934
+ *
935
+ * @param {*} data
936
+ * @param {*} saveName
937
+ */
938
+ downloadFromFile(t, e) {
939
+ if (typeof t == "object")
940
+ if (t instanceof Blob)
941
+ t = URL.createObjectURL(t);
942
+ else {
943
+ const r = JSON.stringify(t), a = new Blob([r], { type: "text/json" });
944
+ t = window.URL.createObjectURL(a);
1105
945
  }
1106
- } else if (typeof data == "string" && data.indexOf("http") === -1) {
1107
- const blob = new Blob([data], { type: "text/json" });
1108
- data = window.URL.createObjectURL(blob);
946
+ else if (typeof t == "string" && t.indexOf("http") === -1) {
947
+ const r = new Blob([t], { type: "text/json" });
948
+ t = window.URL.createObjectURL(r);
1109
949
  }
1110
- var link = document.createElement("a");
1111
- link.href = data;
1112
- link.download = saveName || "";
1113
- link.click();
1114
- window.URL.revokeObjectURL(link.href);
950
+ var n = document.createElement("a");
951
+ n.href = t, n.download = e || "", n.click(), window.URL.revokeObjectURL(n.href);
1115
952
  }
1116
- };
1117
- var OptimizeUtils = {
1118
- debounce(func, wait, immediate = true) {
1119
- let timeout, args, context, timestamp, result;
1120
- const later = function() {
1121
- const last = +new Date() - timestamp;
1122
- if (last < wait && last > 0) {
1123
- timeout = setTimeout(later, wait - last);
1124
- } else {
1125
- timeout = null;
1126
- if (!immediate) {
1127
- result = func.apply(context, args);
1128
- if (!timeout)
1129
- context = args = null;
1130
- }
1131
- }
953
+ }, st = {
954
+ /**
955
+ * @desc 在事件被触发n秒后再执行回调函数,如果在这n秒内又被触发,则重新计时
956
+ * @desc 防止onresize,scroll,mousemove ,mousehover等,会被频繁触发影响性能
957
+ * @param func 需要执行的函数
958
+ * @param wait 延迟执行时间(毫秒)
959
+ * @param immediate---true 表立即执行,false 表非立即执行
960
+ * eg: window.addEventListener("resize",debounce(handle,1000));
961
+ * @returns {*}
962
+ */
963
+ debounce(t, e, n = !0) {
964
+ let r, a, s, i, o;
965
+ const c = function() {
966
+ const l = +/* @__PURE__ */ new Date() - i;
967
+ l < e && l > 0 ? r = setTimeout(c, e - l) : (r = null, n || (o = t.apply(s, a), r || (s = a = null)));
1132
968
  };
1133
- return function(...args2) {
1134
- context = this;
1135
- timestamp = +new Date();
1136
- const callNow = immediate && !timeout;
1137
- if (!timeout)
1138
- timeout = setTimeout(later, wait);
1139
- if (callNow) {
1140
- result = func.apply(context, args2);
1141
- context = args2 = null;
1142
- }
1143
- return result;
969
+ return function(...l) {
970
+ s = this, i = +/* @__PURE__ */ new Date();
971
+ const h = n && !r;
972
+ return r || (r = setTimeout(c, e)), h && (o = t.apply(s, l), s = l = null), o;
1144
973
  };
1145
974
  },
1146
- throttle(func, wait, type) {
1147
- if (type === 1) {
1148
- var previous = 0;
1149
- } else if (type === 2) {
1150
- var timeout;
1151
- }
975
+ /**
976
+ * 规定一个单位时间,在这个单位时间内,只能有一次触发事件的回调函数执行,如果在同一个单位时间内某事件被触发多次,只有一次能生效
977
+ *
978
+ * @param {*} func
979
+ * @param {*} wait
980
+ * @param {*} type 1 表时间戳版,2 表定时器版
981
+ * @returns {*}
982
+ */
983
+ throttle(t, e, n) {
984
+ if (n === 1)
985
+ var r = 0;
986
+ else if (n === 2)
987
+ var a;
1152
988
  return function() {
1153
- let context = this;
1154
- let args = arguments;
1155
- if (type === 1) {
1156
- let now = Date.now();
1157
- if (now - previous > wait) {
1158
- func.apply(context, args);
1159
- previous = now;
1160
- }
1161
- } else if (type === 2) {
1162
- if (!timeout) {
1163
- timeout = setTimeout(() => {
1164
- timeout = null;
1165
- func.apply(context, args);
1166
- }, wait);
1167
- }
1168
- }
989
+ let s = this, i = arguments;
990
+ if (n === 1) {
991
+ let o = Date.now();
992
+ o - r > e && (t.apply(s, i), r = o);
993
+ } else n === 2 && (a || (a = setTimeout(() => {
994
+ a = null, t.apply(s, i);
995
+ }, e)));
1169
996
  };
1170
997
  },
1171
- recurve(fun, frequency = 500, duration = 5e3) {
1172
- let timer = 0;
1173
- setTimeout(function fn() {
1174
- timer++;
1175
- if (timer < Math.floor(duration / frequency)) {
1176
- fun.call(this);
1177
- setTimeout(fn, frequency);
1178
- }
998
+ /**
999
+ * 延时递归
1000
+ *
1001
+ * @param {Number} frequency 间隔时间ms
1002
+ * @param {Number} duration 持续时间ms
1003
+ */
1004
+ recurve(t, e = 500, n = 5e3) {
1005
+ let r = 0;
1006
+ setTimeout(function a() {
1007
+ r++, r < Math.floor(n / e) && (t.call(this), setTimeout(a, e));
1179
1008
  });
1180
1009
  }
1181
- };
1182
- var StringUtils = {
1183
- checkStr(str, type) {
1184
- switch (type) {
1010
+ }, q = {
1011
+ /**
1012
+ * 常用正则验证
1013
+ *
1014
+ * @param {*} str
1015
+ * @param {*} type
1016
+ * @returns {*}
1017
+ */
1018
+ checkStr(t, e) {
1019
+ switch (e) {
1185
1020
  case "phone":
1186
- return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(str);
1021
+ return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);
1187
1022
  case "tel":
1188
- return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(str);
1023
+ return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);
1189
1024
  case "card":
1190
- return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(str);
1025
+ return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);
1191
1026
  case "pwd":
1192
- return /^[a-zA-Z]\w{5,17}$/.test(str);
1027
+ return /^[a-zA-Z]\w{5,17}$/.test(t);
1193
1028
  case "postal":
1194
- return /[1-9]\d{5}(?!\d)/.test(str);
1029
+ return /[1-9]\d{5}(?!\d)/.test(t);
1195
1030
  case "QQ":
1196
- return /^[1-9][0-9]{4,9}$/.test(str);
1031
+ return /^[1-9][0-9]{4,9}$/.test(t);
1197
1032
  case "email":
1198
- return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(str);
1033
+ return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);
1199
1034
  case "money":
1200
- return /^\d*(?:\.\d{0,2})?$/.test(str);
1035
+ return /^\d*(?:\.\d{0,2})?$/.test(t);
1201
1036
  case "URL":
1202
- return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(str);
1037
+ return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);
1203
1038
  case "IP":
1204
- return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(str);
1039
+ return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);
1205
1040
  case "date":
1206
- return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(str) || /^(\d{4})\-(\d{2})\-(\d{2})$/.test(str);
1041
+ 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);
1207
1042
  case "number":
1208
- return /^[0-9]$/.test(str);
1043
+ return /^[0-9]$/.test(t);
1209
1044
  case "english":
1210
- return /^[a-zA-Z]+$/.test(str);
1045
+ return /^[a-zA-Z]+$/.test(t);
1211
1046
  case "chinese":
1212
- return /^[\u4E00-\u9FA5]+$/.test(str);
1047
+ return /^[\u4E00-\u9FA5]+$/.test(t);
1213
1048
  case "lower":
1214
- return /^[a-z]+$/.test(str);
1049
+ return /^[a-z]+$/.test(t);
1215
1050
  case "upper":
1216
- return /^[A-Z]+$/.test(str);
1051
+ return /^[A-Z]+$/.test(t);
1217
1052
  case "HTML":
1218
- return /<("[^"]*"|'[^']*'|[^'">])*>/.test(str);
1053
+ return /<("[^"]*"|'[^']*'|[^'">])*>/.test(t);
1219
1054
  default:
1220
- return true;
1221
- }
1222
- },
1223
- changeCase(str, type) {
1224
- type = type || 4;
1225
- switch (type) {
1055
+ return !0;
1056
+ }
1057
+ },
1058
+ /**
1059
+ * 字符串大小写转换 type: 1:首字母大写 2:首页母小写 3:大小写转换 4:全部大写 5:全部小写
1060
+ *
1061
+ * @param {*} str
1062
+ * @param {*} type
1063
+ * @returns {*}
1064
+ */
1065
+ changeCase(t, e) {
1066
+ switch (e = e || 4, e) {
1226
1067
  case 1:
1227
- return str.replace(/\b\w+\b/g, function(word) {
1228
- return word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase();
1068
+ return t.replace(/\b\w+\b/g, function(n) {
1069
+ return n.substring(0, 1).toUpperCase() + n.substring(1).toLowerCase();
1229
1070
  });
1230
1071
  case 2:
1231
- return str.replace(/\b\w+\b/g, function(word) {
1232
- return word.substring(0, 1).toLowerCase() + word.substring(1).toUpperCase();
1072
+ return t.replace(/\b\w+\b/g, function(n) {
1073
+ return n.substring(0, 1).toLowerCase() + n.substring(1).toUpperCase();
1233
1074
  });
1234
1075
  case 3:
1235
- return str.split("").map(function(word) {
1236
- if (/[a-z]/.test(word)) {
1237
- return word.toUpperCase();
1238
- } else {
1239
- return word.toLowerCase();
1240
- }
1076
+ return t.split("").map(function(n) {
1077
+ return /[a-z]/.test(n) ? n.toUpperCase() : n.toLowerCase();
1241
1078
  }).join("");
1242
1079
  case 4:
1243
- return str.toUpperCase();
1080
+ return t.toUpperCase();
1244
1081
  case 5:
1245
- return str.toLowerCase();
1082
+ return t.toLowerCase();
1246
1083
  default:
1247
- return str;
1248
- }
1249
- },
1250
- tag(strArray, ...args) {
1251
- args = args.map((val) => {
1252
- switch (CommUtils.getDataType(val)) {
1084
+ return t;
1085
+ }
1086
+ },
1087
+ /**
1088
+ * 处理字符串模板
1089
+ * eg: tag`${abc}`
1090
+ * @param {*} strArray
1091
+ * @param {*} args
1092
+ * @returns {*}
1093
+ */
1094
+ tag(t, ...e) {
1095
+ return e = e.map((n) => {
1096
+ switch (E.getDataType(n)) {
1253
1097
  case "Object":
1254
- return val || "{}";
1098
+ return n || "{}";
1255
1099
  case "Array":
1256
- return val || "[]";
1100
+ return n || "[]";
1257
1101
  default:
1258
- return val || "";
1102
+ return n || "";
1259
1103
  }
1260
- });
1261
- return strArray.reduce((prev, next, index) => `${prev}${args[index - 1]}${next}`);
1262
- },
1263
- getByteLength(str) {
1264
- return str.replace(/[\u0391-\uFFE5]/g, "aa").length;
1265
- },
1266
- subStringByte(str, start, n) {
1104
+ }), t.reduce((n, r, a) => `${n}${e[a - 1]}${r}`);
1105
+ },
1106
+ /**
1107
+ * 获取字符串字节长度
1108
+ * @param {*} str
1109
+ * @returns {*}
1110
+ */
1111
+ getByteLength(t) {
1112
+ return t.replace(/[\u0391-\uFFE5]/g, "aa").length;
1113
+ },
1114
+ /**
1115
+ * 根据字节长度截取字符串
1116
+ * @param {*} str
1117
+ * @param {*} n
1118
+ * @returns {*}
1119
+ */
1120
+ subStringByte(t, e, n) {
1267
1121
  var r = /[^\x00-\xff]/g;
1268
- if (str.replace(r, "mm").length <= n) {
1269
- return str;
1122
+ if (t.replace(r, "mm").length <= n)
1123
+ return t;
1124
+ for (var a = Math.floor(n / 2), s = a; s < t.length; s++) {
1125
+ let i = t.substring(e, s);
1126
+ if (i.replace(r, "mm").length >= n)
1127
+ return i;
1270
1128
  }
1271
- var m = Math.floor(n / 2);
1272
- for (var i = m; i < str.length; i++) {
1273
- let sub = str.substring(start, i);
1274
- if (sub.replace(r, "mm").length >= n) {
1275
- return sub;
1276
- }
1277
- }
1278
- return str;
1129
+ return t;
1279
1130
  },
1280
- asString(value) {
1281
- if (CommUtils.isEmpty(value)) {
1131
+ asString(t) {
1132
+ if (E.isEmpty(t))
1282
1133
  return "";
1283
- } else {
1284
- switch (CommUtils.getDataType()) {
1285
- case "Object":
1286
- case "Array":
1287
- return JSON.stringify(value);
1288
- default:
1289
- return value;
1290
- }
1134
+ switch (E.getDataType()) {
1135
+ case "Object":
1136
+ case "Array":
1137
+ return JSON.stringify(t);
1138
+ default:
1139
+ return t;
1291
1140
  }
1292
1141
  }
1293
- };
1294
- var AssertUtils = {
1295
- notNull(data) {
1296
- if (CommUtils.isEmpty(data)) {
1297
- throw Error("\u4E0D\u80FD\u4E3A\u7A7A:>>>" + data);
1298
- }
1299
- },
1300
- legalLnglat(lng, lat) {
1301
- if (!GeoUtils.isLnglat(lng, lat)) {
1302
- throw Error(ErrorType.COORDINATE_ERROR);
1303
- }
1304
- },
1305
- contain(str, ...args) {
1306
- let res = false;
1307
- const len = args.length || 0;
1308
- for (let i = 0, l = len; i < l; i++) {
1309
- res = str.indexOf(args[i]) >= 0;
1310
- }
1311
- if (res) {
1312
- throw Error(ErrorType.STRING_CHECK_LOSS);
1313
- }
1142
+ }, at = {
1143
+ notNull(t) {
1144
+ if (E.isEmpty(t))
1145
+ throw Error("不能为空:>>>" + t);
1146
+ },
1147
+ legalLnglat(t, e) {
1148
+ if (!j.isLnglat(t, e))
1149
+ throw Error(m.COORDINATE_ERROR);
1150
+ },
1151
+ contain(t, ...e) {
1152
+ let n = !1;
1153
+ const r = e.length || 0;
1154
+ for (let a = 0, s = r; a < s; a++)
1155
+ n = t.indexOf(e[a]) >= 0;
1156
+ if (n)
1157
+ throw Error(m.STRING_CHECK_LOSS);
1314
1158
  },
1315
1159
  verify: {
1316
- array(data) {
1317
- if (CommUtils.getDataType(data) !== "Array") {
1318
- throw Error(ErrorType.PARAMETER_ERROR_ARRAY + ":>>>" + data);
1319
- }
1160
+ array(t) {
1161
+ if (E.getDataType(t) !== "Array")
1162
+ throw Error(m.PARAMETER_ERROR_ARRAY + ":>>>" + t);
1320
1163
  },
1321
- function(data) {
1322
- if (CommUtils.getDataType(data) !== "Function") {
1323
- throw Error(ErrorType.PARAMETER_ERROR_FUNCTION + ":>>>" + data);
1324
- }
1164
+ function(t) {
1165
+ if (E.getDataType(t) !== "Function")
1166
+ throw Error(m.PARAMETER_ERROR_FUNCTION + ":>>>" + t);
1325
1167
  },
1326
- object(data) {
1327
- if (CommUtils.getDataType(data) !== "Object") {
1328
- throw Error(ErrorType.PARAMETER_ERROR_OBJECT + ":>>>" + data);
1329
- }
1168
+ object(t) {
1169
+ if (E.getDataType(t) !== "Object")
1170
+ throw Error(m.PARAMETER_ERROR_OBJECT + ":>>>" + t);
1330
1171
  }
1331
1172
  },
1332
- legalJSON(data) {
1173
+ legalJSON(t) {
1333
1174
  try {
1334
- JSON.parse(data);
1335
- } catch (err) {
1336
- throw Error(ErrorType.JSON_PARSE_ERROR + ":>>>" + data);
1175
+ JSON.parse(t);
1176
+ } catch {
1177
+ throw Error(m.JSON_PARSE_ERROR + ":>>>" + t);
1337
1178
  }
1338
1179
  },
1339
- legalData(data, type) {
1340
- const bool = StringUtils.checkStr(data, type);
1341
- let typename = "";
1342
- switch (type) {
1180
+ legalData(t, e) {
1181
+ const n = q.checkStr(t, e);
1182
+ let r = "";
1183
+ switch (e) {
1343
1184
  case "phone":
1344
- typename = "\u7535\u8BDD";
1185
+ r = "电话";
1345
1186
  break;
1346
1187
  case "tel":
1347
- typename = "\u5EA7\u673A";
1188
+ r = "座机";
1348
1189
  break;
1349
1190
  case "card":
1350
- typename = "\u8EAB\u4EFD\u8BC1";
1191
+ r = "身份证";
1351
1192
  break;
1352
1193
  case "pwd":
1353
- typename = "\u5BC6\u7801";
1194
+ r = "密码";
1354
1195
  break;
1355
1196
  case "postal":
1356
- typename = "\u90AE\u653F\u7F16\u7801";
1197
+ r = "邮政编码";
1357
1198
  break;
1358
1199
  case "QQ":
1359
- typename = "QQ";
1200
+ r = "QQ";
1360
1201
  break;
1361
1202
  case "email":
1362
- typename = "\u90AE\u7BB1";
1203
+ r = "邮箱";
1363
1204
  break;
1364
1205
  case "money":
1365
- typename = "\u91D1\u989D";
1206
+ r = "金额";
1366
1207
  break;
1367
1208
  case "URL":
1368
- typename = "\u7F51\u5740";
1209
+ r = "网址";
1369
1210
  break;
1370
1211
  case "IP":
1371
- typename = "IP";
1212
+ r = "IP";
1372
1213
  break;
1373
1214
  case "date":
1374
- typename = "\u65E5\u671F\u65F6\u95F4";
1215
+ r = "日期时间";
1375
1216
  break;
1376
1217
  case "number":
1377
- typename = "\u6570\u5B57";
1218
+ r = "数字";
1378
1219
  break;
1379
1220
  case "english":
1380
- typename = "\u82F1\u6587";
1221
+ r = "英文";
1381
1222
  break;
1382
1223
  case "chinese":
1383
- typename = "\u4E2D\u6587";
1224
+ r = "中文";
1384
1225
  break;
1385
1226
  case "lower":
1386
- typename = "\u5C0F\u5199";
1227
+ r = "小写";
1387
1228
  break;
1388
1229
  case "upper":
1389
- typename = "\u5927\u5199";
1230
+ r = "大写";
1390
1231
  break;
1391
1232
  case "HTML":
1392
- typename = "HTML\u6807\u8BB0";
1233
+ r = "HTML标记";
1393
1234
  break;
1394
1235
  }
1395
- if (!bool) {
1396
- throw Error(ErrorType.PARAMETER_ERROR + ":>>>\u4E0D\u662F" + typename);
1397
- }
1236
+ if (!n)
1237
+ throw Error(m.PARAMETER_ERROR + ":>>>不是" + r);
1398
1238
  }
1399
1239
  };
1400
- class AudioPlayer {
1401
- constructor(url) {
1402
- this.audio = new Audio();
1403
- this.audio.src = url;
1240
+ class it {
1241
+ constructor(e) {
1242
+ /**
1243
+ * Creates an instance of AudioPlayer.
1244
+ * @param {*} url
1245
+ */
1246
+ P(this, "audio");
1247
+ this.audio = new Audio(), this.audio.src = e;
1404
1248
  }
1405
1249
  play() {
1406
1250
  !this.muted && this.audio.play();
@@ -1411,108 +1255,88 @@ class AudioPlayer {
1411
1255
  get muted() {
1412
1256
  return this.audio.muted;
1413
1257
  }
1414
- set muted(val) {
1415
- this.audio.muted = val;
1258
+ /**
1259
+ * @description 设置静音状态,如果静音,autoplay属性将失效
1260
+ */
1261
+ set muted(e) {
1262
+ this.audio.muted = e;
1416
1263
  }
1417
1264
  }
1418
- class CanvasDrawer {
1419
- constructor(el) {
1420
- if (CommUtils.getDataType(el) === "String") {
1421
- el = document.querySelector("#" + el);
1422
- }
1423
- this.ctx = el.getContext("2d");
1265
+ class ot {
1266
+ constructor(e) {
1267
+ E.getDataType(e) === "String" && (e = document.querySelector("#" + e)), this.ctx = e.getContext("2d");
1424
1268
  }
1425
- drawLine(startX, startY, endX, endY, options = {}) {
1269
+ drawLine(e, n, r, a, s = {}) {
1426
1270
  this.cxt.beginPath();
1427
- const width = options.width || 1;
1428
- const color = options.color || "#000";
1429
- this.cxt.lineWidth = width;
1430
- this.cxt.fillStyle = color;
1431
- this.cxt.moveTo(startX, startY);
1432
- this.cxt.lineTo(endX, endY);
1433
- this.cxt.closePath();
1434
- this.cxt.fill();
1271
+ const i = s.width || 1, o = s.color || "#000";
1272
+ this.cxt.lineWidth = i, this.cxt.fillStyle = o, this.cxt.moveTo(e, n), this.cxt.lineTo(r, a), this.cxt.closePath(), this.cxt.fill();
1435
1273
  }
1436
- drawArc(x, y, radius, startAngle, endAngle, anticlockwise, isFill, bgColor) {
1437
- if (isFill) {
1438
- this.cxt.fillStyle = bgColor;
1439
- this.cxt.beginPath();
1440
- this.cxt.arc(x, y, radius, MathUtils.degreesToRadians(startAngle), MathUtils.degreesToRadians(endAngle), anticlockwise);
1441
- this.cxt.closePath();
1442
- this.cxt.fill();
1443
- } else {
1444
- this.cxt.strokeStyle = bgColor;
1445
- this.cxt.beginPath();
1446
- this.cxt.arc(x, y, radius, MathUtils.degreesToRadians(startAngle), MathUtils.degreesToRadians(endAngle), anticlockwise);
1447
- this.cxt.stroke();
1448
- }
1274
+ /**
1275
+ * 绘制圆弧
1276
+ * @param {*} x 圆心X坐标
1277
+ * @param {*} y 圆心Y坐标
1278
+ * @param {*} radius 半径
1279
+ * @param {*} startAngle 开始的弧度
1280
+ * @param {*} endAngle 结束的弧度
1281
+ * @param {*} anticlockwise true为逆时针,false为顺时针
1282
+ * @param {boolean} isOnlyArc
1283
+ * @param {boolean} isFill 是否是填充,false为绘制边框,true为绘制填充
1284
+ * @param {*} bgColor 圆弧的颜色
1285
+ * @memberof CanvasDrawer
1286
+ */
1287
+ drawArc(e, n, r, a, s, i, o, c) {
1288
+ o ? (this.cxt.fillStyle = c, this.cxt.beginPath(), this.cxt.arc(e, n, r, g.degreesToRadians(a), g.degreesToRadians(s), i), this.cxt.closePath(), this.cxt.fill()) : (this.cxt.strokeStyle = c, this.cxt.beginPath(), this.cxt.arc(e, n, r, g.degreesToRadians(a), g.degreesToRadians(s), i), this.cxt.stroke());
1449
1289
  }
1450
1290
  }
1451
- function EventDispatcher() {
1291
+ function k() {
1452
1292
  }
1453
- Object.assign(EventDispatcher.prototype, {
1454
- addEventListener(type, listener, context, mutexStatus = false) {
1455
- if (this._listeners === void 0)
1456
- this._listeners = {};
1457
- this._mutex = this._mutex || {};
1458
- this._context = context;
1459
- const mutex = this._mutex;
1460
- const listeners = this._listeners;
1461
- if (listeners[type] === void 0) {
1462
- listeners[type] = [];
1463
- }
1464
- if (listeners[type].indexOf(listener) === -1) {
1465
- if (mutexStatus) {
1466
- mutex[type] = listener;
1467
- }
1468
- listeners[type].push(listener);
1469
- }
1470
- return this;
1471
- },
1472
- hasEventListener(type, listener) {
1473
- if (this._listeners === void 0)
1474
- return false;
1475
- const listeners = this._listeners;
1476
- return listeners[type] !== void 0 && listeners[type].indexOf(listener) !== -1;
1477
- },
1478
- removeEventListener(type, listener) {
1479
- if (this._listeners === void 0)
1480
- return;
1481
- const listeners = this._listeners;
1482
- const listenerArray = listeners[type];
1483
- if (this._mutex[type] === listener) {
1484
- this._mutex[type] = null;
1485
- }
1486
- if (listenerArray !== void 0) {
1487
- const index = listenerArray.map((d) => d.toString()).indexOf(listener.toString());
1488
- if (index !== -1) {
1489
- listenerArray.splice(index, 1);
1490
- }
1491
- }
1492
- },
1493
- dispatchEvent(event) {
1494
- if (this._listeners === void 0)
1495
- return;
1496
- const listeners = this._listeners;
1497
- const listenerArray = listeners[event.type];
1498
- if (listenerArray !== void 0) {
1499
- event.target = this;
1500
- const array = listenerArray.slice(0);
1501
- if (this._mutex[event.type]) {
1502
- const find = array.find((item) => item === this._mutex[event.type]);
1503
- find.call(this._context || this, event);
1293
+ Object.assign(k.prototype, {
1294
+ /**
1295
+ * 添加监听器
1296
+ * @param type{string}
1297
+ * @param listener{function}
1298
+ * @param mutexStatus{boolean}
1299
+ */
1300
+ addEventListener(t, e, n, r = !1) {
1301
+ this._listeners === void 0 && (this._listeners = {}), this._mutex = this._mutex || {}, this._context = n;
1302
+ const a = this._mutex, s = this._listeners;
1303
+ return s[t] === void 0 && (s[t] = []), s[t].indexOf(e) === -1 && (r && (a[t] = e), s[t].push(e)), this;
1304
+ },
1305
+ hasEventListener(t, e) {
1306
+ if (this._listeners === void 0) return !1;
1307
+ const n = this._listeners;
1308
+ return n[t] !== void 0 && n[t].indexOf(e) !== -1;
1309
+ },
1310
+ removeEventListener(t, e) {
1311
+ if (this._listeners === void 0) return;
1312
+ const r = this._listeners[t];
1313
+ if (this._mutex[t] === e && (this._mutex[t] = null), r !== void 0) {
1314
+ const a = r.map((s) => s.toString()).indexOf(e.toString());
1315
+ a !== -1 && r.splice(a, 1);
1316
+ }
1317
+ },
1318
+ /**
1319
+ * 派发事件
1320
+ * @param event{{type: string, message: {}}}
1321
+ */
1322
+ dispatchEvent(t) {
1323
+ if (this._listeners === void 0) return;
1324
+ const n = this._listeners[t.type];
1325
+ if (n !== void 0) {
1326
+ t.target = this;
1327
+ const r = n.slice(0);
1328
+ if (this._mutex[t.type]) {
1329
+ r.find((s) => s === this._mutex[t.type]).call(this._context || this, t);
1504
1330
  return;
1505
1331
  }
1506
- for (let i = 0, l = array.length; i < l; i++) {
1507
- array[i].call(this._context || this, event);
1508
- }
1332
+ for (let a = 0, s = r.length; a < s; a++)
1333
+ r[a].call(this._context || this, t);
1509
1334
  }
1510
1335
  },
1511
1336
  removeAllListener() {
1512
1337
  this._mutex = {};
1513
- for (const key in this._listeners) {
1514
- this._listeners[key] = [];
1515
- }
1338
+ for (const t in this._listeners)
1339
+ this._listeners[t] = [];
1516
1340
  }
1517
1341
  });
1518
1342
  Object.assign(Map.prototype, {
@@ -1529,223 +1353,202 @@ Object.assign(Map.prototype, {
1529
1353
  return Array.from(Map.prototype.entries.call(this));
1530
1354
  }
1531
1355
  });
1532
- function HashMap() {
1356
+ function U() {
1533
1357
  return /* @__PURE__ */ new Map();
1534
1358
  }
1535
- HashMap.fromEntries = function(array = []) {
1536
- const hashMap = new HashMap();
1537
- array.forEach((element) => {
1538
- if (Array.isArray(element) && element.length === 2) {
1539
- hashMap.set(element[0], element[1]);
1540
- }
1541
- });
1542
- return hashMap;
1359
+ U.fromEntries = function(t = []) {
1360
+ const e = new U();
1361
+ return t.forEach((n) => {
1362
+ Array.isArray(n) && n.length === 2 && e.set(n[0], n[1]);
1363
+ }), e;
1543
1364
  };
1544
- class WebSocketClient extends EventDispatcher {
1545
- constructor(url = "ws://127.0.0.1:10088") {
1546
- super();
1547
- this.maxCheckTimes = 10;
1548
- this.url = url;
1549
- this.checkTimes = 0;
1550
- this.connectStatus = false;
1551
- this.connect();
1552
- this.connCheckStatus(this.maxCheckTimes);
1553
- WebSocketClient.instance = this;
1365
+ class y extends k {
1366
+ constructor(e = "ws://127.0.0.1:10088") {
1367
+ super(), this.maxCheckTimes = 10, this.url = e, this.checkTimes = 0, this.connectStatus = !1, this.connect(), this.connCheckStatus(this.maxCheckTimes), y.instance = this;
1554
1368
  }
1555
1369
  connect() {
1556
- this.disconnect();
1557
- if (this.url) {
1370
+ if (this.disconnect(), this.url)
1558
1371
  try {
1559
- console.info("\u521B\u5EFAws\u8FDE\u63A5>>>" + this.url);
1560
- this.client = new WebSocket(this.url);
1561
- if (this.client) {
1562
- const self = this;
1563
- this.client.onopen = function(message) {
1564
- self.dispatchEvent({
1565
- type: EventType.WEB_SOCKET_CONNECT,
1566
- message
1372
+ if (console.info("创建ws连接>>>" + this.url), this.client = new WebSocket(this.url), this.client) {
1373
+ const e = this;
1374
+ this.client.onopen = function(n) {
1375
+ e.dispatchEvent({
1376
+ type: v.WEB_SOCKET_CONNECT,
1377
+ message: n
1567
1378
  });
1568
- };
1569
- this.client.onmessage = function(message) {
1570
- self.connectStatus = true;
1571
- self.dispatchEvent({
1572
- type: EventType.WEB_SOCKET_MESSAGE,
1573
- message
1379
+ }, this.client.onmessage = function(n) {
1380
+ e.connectStatus = !0, e.dispatchEvent({
1381
+ type: v.WEB_SOCKET_MESSAGE,
1382
+ message: n
1574
1383
  });
1575
- };
1576
- this.client.onclose = function(message) {
1577
- self.dispatchEvent({
1578
- type: EventType.WEB_SOCKET_CLOSE,
1579
- message
1384
+ }, this.client.onclose = function(n) {
1385
+ e.dispatchEvent({
1386
+ type: v.WEB_SOCKET_CLOSE,
1387
+ message: n
1580
1388
  });
1581
- };
1582
- if (this.checkTimes === this.maxCheckTimes) {
1583
- this.client.onerror = function(message) {
1584
- self.dispatchEvent({
1585
- type: EventType.WEB_SOCKET_ERROR,
1586
- message
1587
- });
1588
- };
1589
- }
1389
+ }, this.checkTimes === this.maxCheckTimes && (this.client.onerror = function(n) {
1390
+ e.dispatchEvent({
1391
+ type: v.WEB_SOCKET_ERROR,
1392
+ message: n
1393
+ });
1394
+ });
1590
1395
  }
1591
- } catch (ex) {
1592
- console.error("\u521B\u5EFAws\u8FDE\u63A5\u5931\u8D25" + this.url + ":" + ex);
1396
+ } catch (e) {
1397
+ console.error("创建ws连接失败" + this.url + ":" + e);
1593
1398
  }
1594
- }
1595
1399
  }
1596
1400
  disconnect() {
1597
- if (this.client) {
1401
+ if (this.client)
1598
1402
  try {
1599
- console.log("ws\u65AD\u5F00\u8FDE\u63A5" + this.url);
1600
- this.client.close();
1601
- this.client = null;
1602
- } catch (ex) {
1403
+ console.log("ws断开连接" + this.url), this.client.close(), this.client = null;
1404
+ } catch {
1603
1405
  this.client = null;
1604
1406
  }
1605
- }
1606
1407
  }
1607
- connCheckStatus(times) {
1608
- if (this.checkTimes > times)
1609
- return;
1610
- setTimeout(() => {
1611
- this.checkTimes++;
1612
- if (this.client && this.client.readyState !== 0 && this.client.readyState !== 1) {
1613
- this.connect();
1614
- }
1615
- this.connCheckStatus(times);
1408
+ connCheckStatus(e) {
1409
+ this.checkTimes > e || setTimeout(() => {
1410
+ this.checkTimes++, this.client && this.client.readyState !== 0 && this.client.readyState !== 1 && this.connect(), this.connCheckStatus(e);
1616
1411
  }, 2e3);
1617
1412
  }
1618
- send(message) {
1619
- if (this.client && this.client.readyState === 1) {
1620
- this.client.send(message);
1621
- return true;
1622
- }
1623
- console.error(this.url + "\u6D88\u606F\u53D1\u9001\u5931\u8D25\uFF1A" + message);
1624
- return false;
1413
+ send(e) {
1414
+ return this.client && this.client.readyState === 1 ? (this.client.send(e), !0) : (console.error(this.url + "消息发送失败:" + e), !1);
1625
1415
  }
1626
1416
  heartbeat() {
1627
1417
  setTimeout(() => {
1628
- if (this.client && this.client.readyState === 1) {
1629
- this.send("HeartBeat");
1630
- }
1631
- console.log("HeartBeat," + this.url);
1632
- setTimeout(this.heartbeat, 3e4);
1418
+ this.client && this.client.readyState === 1 && this.send("HeartBeat"), console.log("HeartBeat," + this.url), setTimeout(this.heartbeat, 3e4);
1633
1419
  }, 1e3);
1634
1420
  }
1635
1421
  static getInstance() {
1636
- if (WebSocketClient.instance) {
1637
- return WebSocketClient.instance;
1638
- } else {
1639
- return Object.freeze(new WebSocketClient());
1640
- }
1422
+ return y.instance ? y.instance : Object.freeze(new y());
1641
1423
  }
1642
1424
  static get _instance() {
1643
1425
  return this.getInstance();
1644
1426
  }
1645
1427
  }
1646
- class WebStorage {
1647
- constructor(type = 1) {
1648
- this.cacheType = type;
1649
- if (type === 1) {
1428
+ class ct {
1429
+ constructor(e = 1) {
1430
+ if (this.cacheType = e, e === 1)
1650
1431
  this.storage = window.localStorage;
1651
- } else if (type === 2) {
1432
+ else if (e === 2)
1652
1433
  this.storage = window.sessionStorage;
1653
- } else {
1654
- throw new Error(ErrorType.PARAMETER_ERROR);
1655
- }
1434
+ else
1435
+ throw new Error(m.PARAMETER_ERROR);
1656
1436
  }
1657
- setItem(key, value, expired) {
1658
- const tempObj = { key, value };
1437
+ /**
1438
+ * 设置带过期时间的LocalStorage
1439
+ * @param key 缓存关键字
1440
+ * @param value 缓存对象,可以是任意类型
1441
+ * @param expired 以秒为单位,默认为1小时
1442
+ * @returns {Object}
1443
+ */
1444
+ setItem(e, n, r) {
1445
+ const a = { key: e, value: n };
1659
1446
  if (this.cacheType === 1) {
1660
- const currTime = Date.now();
1661
- if (expired) {
1662
- tempObj.expired = currTime + expired * 1e3;
1663
- }
1447
+ const s = Date.now();
1448
+ r && (a.expired = s + r * 1e3);
1664
1449
  }
1665
- this.storage[key] = JSON.stringify(tempObj);
1666
- return tempObj;
1450
+ return this.storage[e] = JSON.stringify(a), a;
1667
1451
  }
1668
- getItem(key) {
1669
- const storageData = this.storage.getItem(key) || null;
1670
- const tempObj = JSON.parse(storageData) || {};
1452
+ /***
1453
+ * 获取带过期时间的缓存
1454
+ * @param key
1455
+ * @returns {null|*}
1456
+ */
1457
+ getItem(e) {
1458
+ const n = this.storage.getItem(e) || null, r = JSON.parse(n) || {};
1671
1459
  if (this.cacheType === 1) {
1672
- const expired = tempObj.expired || Date.now();
1673
- if (Date.now() > expired) {
1674
- this.remove(key);
1675
- return null;
1676
- }
1460
+ const a = r.expired || Date.now();
1461
+ if (Date.now() > a)
1462
+ return this.remove(e), null;
1677
1463
  }
1678
- return tempObj.value;
1464
+ return r.value;
1679
1465
  }
1680
- remove(keys) {
1681
- if (keys) {
1682
- if (keys.indexOf(",") > -1) {
1683
- keys.split(",").forEach((key) => {
1684
- this.storage.removeItem(key);
1685
- });
1686
- } else {
1687
- this.storage.removeItem(keys);
1688
- }
1689
- }
1466
+ /**
1467
+ * 移除指定缓存
1468
+ * @param keys
1469
+ */
1470
+ remove(e) {
1471
+ e && (e.indexOf(",") > -1 ? e.split(",").forEach((n) => {
1472
+ this.storage.removeItem(n);
1473
+ }) : this.storage.removeItem(e));
1690
1474
  }
1475
+ /**
1476
+ * 移出全部缓存
1477
+ */
1691
1478
  clear() {
1692
1479
  this.storage.clear();
1693
1480
  }
1694
1481
  }
1695
- class DevicePixelRatio {
1696
- constructor(magnification = 1) {
1697
- this.magnification = magnification;
1482
+ class lt {
1483
+ constructor(e = 1) {
1484
+ this.magnification = e;
1698
1485
  }
1486
+ // 获取系统类型
1699
1487
  _getSystem() {
1700
- var agent = navigator.userAgent.toLowerCase();
1701
- if (agent.indexOf("windows") >= 0) {
1702
- return true;
1703
- }
1488
+ var e = navigator.userAgent.toLowerCase();
1489
+ if (e.indexOf("windows") >= 0)
1490
+ return !0;
1704
1491
  }
1705
- _addHandler(element, type, handler) {
1706
- if (element.addEventListener) {
1707
- element.addEventListener(type, handler, false);
1708
- } else if (element.attachEvent) {
1709
- element.attachEvent("on" + type, handler);
1710
- } else {
1711
- element["on" + type] = handler;
1712
- }
1492
+ // 获取页面缩放比例
1493
+ // _getDevicePixelRatio() {
1494
+ // let t = this;
1495
+ // }
1496
+ // 监听方法兼容写法
1497
+ _addHandler(e, n, r) {
1498
+ e.addEventListener ? e.addEventListener(n, r, !1) : e.attachEvent ? e.attachEvent("on" + n, r) : e["on" + n] = r;
1713
1499
  }
1500
+ // 校正浏览器缩放比例
1714
1501
  _correct() {
1715
- let pageWidth = window.innerWidth;
1716
- if (typeof pageWidth != "number") {
1717
- if (document.compatMode == "CSS1Compat") {
1718
- pageWidth = document.documentElement.clientWidth;
1719
- } else {
1720
- pageWidth = document.body.clientWidth;
1721
- }
1722
- }
1723
- if (pageWidth <= 750) {
1724
- const baseSize = 75;
1725
- const scale = document.documentElement.clientWidth / pageWidth;
1726
- document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + "px";
1727
- } else if (pageWidth > 750 && pageWidth <= 1200) {
1728
- const baseSize = 85;
1729
- const scale = document.documentElement.clientWidth / pageWidth;
1730
- document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + "px";
1502
+ let e = window.innerWidth;
1503
+ if (typeof e != "number" && (document.compatMode == "CSS1Compat" ? e = document.documentElement.clientWidth : e = document.body.clientWidth), e <= 750) {
1504
+ const r = document.documentElement.clientWidth / e;
1505
+ document.documentElement.style.fontSize = this.magnification * 75 * Math.min(r, 2) + "px";
1506
+ } else if (e > 750 && e <= 1200) {
1507
+ const r = document.documentElement.clientWidth / e;
1508
+ document.documentElement.style.fontSize = this.magnification * 85 * Math.min(r, 2) + "px";
1731
1509
  } else {
1732
- const baseSize = 100;
1733
- const scale = document.documentElement.clientWidth / 1920;
1734
- document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + "px";
1510
+ const r = document.documentElement.clientWidth / 1920;
1511
+ document.documentElement.style.fontSize = this.magnification * 100 * Math.min(r, 2) + "px";
1735
1512
  }
1736
1513
  }
1514
+ // 监听页面缩放
1737
1515
  _watch() {
1738
- let t = this;
1739
- t._addHandler(window, "resize", function() {
1740
- t._correct();
1516
+ let e = this;
1517
+ e._addHandler(window, "resize", function() {
1518
+ e._correct();
1741
1519
  });
1742
1520
  }
1521
+ // 初始化页面比例
1743
1522
  init() {
1744
- let t = this;
1745
- if (t._getSystem()) {
1746
- t._correct();
1747
- t._watch();
1748
- }
1523
+ let e = this;
1524
+ e._getSystem() && (e._correct(), e._watch());
1749
1525
  }
1750
1526
  }
1751
- export { AnimateUtils, ArrayUtils, AssertUtils, AudioPlayer, BrowserUtils, CanvasDrawer, Cookie, CoordsUtils, DateUtils, DevicePixelRatio, DomUtils, ErrorType, EventDispatcher, EventType, FileUtils, GeoUtils, GraphicType, HashMap, LayerType, MathUtils, MeasureMode, OptimizeUtils, StringUtils, CommUtils as Utils, WebSocketClient, WebStorage };
1527
+ export {
1528
+ Y as AnimateUtils,
1529
+ Q as ArrayUtils,
1530
+ at as AssertUtils,
1531
+ it as AudioPlayer,
1532
+ X as BrowserUtils,
1533
+ ot as CanvasDrawer,
1534
+ Z as Cookie,
1535
+ tt as CoordsUtils,
1536
+ et as DateUtils,
1537
+ lt as DevicePixelRatio,
1538
+ nt as DomUtils,
1539
+ m as ErrorType,
1540
+ k as EventDispatcher,
1541
+ v as EventType,
1542
+ rt as FileUtils,
1543
+ j as GeoUtils,
1544
+ J as GraphicType,
1545
+ U as HashMap,
1546
+ K as LayerType,
1547
+ g as MathUtils,
1548
+ V as MeasureMode,
1549
+ st as OptimizeUtils,
1550
+ q as StringUtils,
1551
+ E as Utils,
1552
+ y as WebSocketClient,
1553
+ ct as WebStorage
1554
+ };