gis-common 3.1.5 → 3.1.7

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