gis-common 5.0.5 → 5.1.1

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,13 +1,17 @@
1
- export default class {
2
- static readonly lastMonthDate: Date;
3
- static readonly thisMonthDate: Date;
4
- static readonly nextMonthDate: Date;
5
- static readonly lastWeekDate: Date;
6
- static readonly thisWeekDate: Date;
7
- static readonly nextWeekDate: Date;
8
- static readonly lastDayDate: Date;
9
- static readonly thisDayDate: Date;
10
- static readonly nextDayDate: Date;
1
+ import { default as DateTime } from './DateTime';
2
+ export default class extends Date {
3
+ constructor(...val: any);
4
+ format(fmt?: string): string;
5
+ addDate(interval: string, number: number): Date;
6
+ static lastMonth(): DateTime;
7
+ static thisMonth(): DateTime;
8
+ static nextMonth(): DateTime;
9
+ static lastWeek(): DateTime;
10
+ static thisWeek(): DateTime;
11
+ static nextWeek(): DateTime;
12
+ static lastDay(): DateTime;
13
+ static thisDay(): DateTime;
14
+ static nextDay(): DateTime;
11
15
  /**
12
16
  * 解析日期字符串,并返回对应的Date对象。
13
17
  *
@@ -14,12 +14,12 @@ export default class MqttClient extends EventDispatcher {
14
14
  private static defaultContext;
15
15
  state: State;
16
16
  url: string;
17
- context: MqttClientContext;
17
+ context: any;
18
18
  options: any;
19
19
  client: any;
20
20
  topics: string[];
21
21
  private _timer;
22
- constructor(url?: string, config?: {});
22
+ constructor(url?: string, config?: Partial<MqttClientContext>);
23
23
  _onConnect(): void;
24
24
  _onError(): void;
25
25
  _onMessage(): void;
@@ -2,6 +2,7 @@ export { default as AudioPlayer } from './AudioPlayer';
2
2
  export { default as Cookie } from './Cookie';
3
3
  export { default as Color } from './Color';
4
4
  export { default as CanvasDrawer } from './CanvasDrawer';
5
+ export { default as DateTime } from './DateTime';
5
6
  export { default as EventDispatcher } from './EventDispatcher';
6
7
  export { default as FullScreen } from './FullScreen';
7
8
  export { default as HashMap } from './HashMap';
@@ -2505,176 +2505,6 @@ class CoordsUtil {
2505
2505
  }
2506
2506
  __publicField(CoordsUtil, "PI", 3.141592653589793);
2507
2507
  __publicField(CoordsUtil, "XPI", 3.141592653589793 * 3e3 / 180);
2508
- const myDate = Object.create(Date);
2509
- myDate.prototype.format = function(fmt = "yyyy-MM-dd hh:mm:ss") {
2510
- const o = {
2511
- "M+": this.getMonth() + 1,
2512
- // 月份
2513
- "d+": this.getDate(),
2514
- // 日
2515
- "h+": this.getHours(),
2516
- // 小时
2517
- "H+": this.getHours(),
2518
- // 小时 (24小时制)
2519
- "m+": this.getMinutes(),
2520
- // 分
2521
- "s+": this.getSeconds(),
2522
- // 秒
2523
- "q+": Math.floor((this.getMonth() + 3) / 3),
2524
- // 季度
2525
- S: this.getMilliseconds()
2526
- // 毫秒
2527
- };
2528
- if (/(y+)/.test(fmt)) {
2529
- fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
2530
- }
2531
- for (const k in o) {
2532
- const reg = new RegExp("(" + k + ")", "g");
2533
- if (reg.test(fmt)) {
2534
- fmt = fmt.replace(reg, (match) => (match.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)).toString());
2535
- }
2536
- }
2537
- return fmt;
2538
- };
2539
- myDate.prototype.addDate = function(interval, number) {
2540
- const date = new Date(this);
2541
- switch (interval) {
2542
- case "y":
2543
- date.setFullYear(this.getFullYear() + number);
2544
- break;
2545
- case "q":
2546
- date.setMonth(this.getMonth() + number * 3);
2547
- break;
2548
- case "M":
2549
- date.setMonth(this.getMonth() + number);
2550
- break;
2551
- case "w":
2552
- date.setDate(this.getDate() + number * 7);
2553
- break;
2554
- case "d":
2555
- date.setDate(this.getDate() + number);
2556
- break;
2557
- case "h":
2558
- date.setHours(this.getHours() + number);
2559
- break;
2560
- case "m":
2561
- date.setMinutes(this.getMinutes() + number);
2562
- break;
2563
- case "s":
2564
- date.setSeconds(this.getSeconds() + number);
2565
- break;
2566
- default:
2567
- date.setDate(this.getDate() + number);
2568
- break;
2569
- }
2570
- return date;
2571
- };
2572
- class DateUtil {
2573
- /**
2574
- * 解析日期字符串,并返回对应的Date对象。
2575
- *
2576
- * @param str 日期字符串,格式为"yyyy-MM-dd"、"yyyy-MM-dd HH:mm:ss"或"yyyy-MM-dd HH:mm:ss.SSS"。
2577
- * @returns 返回解析后的Date对象,如果解析失败则返回null。
2578
- */
2579
- static parseDate(str) {
2580
- if (typeof str == "string") {
2581
- var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
2582
- if (results && results.length > 3) return new Date(parseInt(results[1]), parseInt(results[2]) - 1, parseInt(results[3]));
2583
- results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);
2584
- if (results && results.length > 6)
2585
- return new Date(
2586
- parseInt(results[1]),
2587
- parseInt(results[2]) - 1,
2588
- parseInt(results[3]),
2589
- parseInt(results[4]),
2590
- parseInt(results[5]),
2591
- parseInt(results[6])
2592
- );
2593
- results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/);
2594
- if (results && results.length > 7)
2595
- return new Date(
2596
- parseInt(results[1]),
2597
- parseInt(results[2]) - 1,
2598
- parseInt(results[3]),
2599
- parseInt(results[4]),
2600
- parseInt(results[5]),
2601
- parseInt(results[6]),
2602
- parseInt(results[7])
2603
- );
2604
- }
2605
- return null;
2606
- }
2607
- /**
2608
- * 格式化时间间隔
2609
- *
2610
- * @param startTime 开始时间,可以是字符串、数字或日期类型
2611
- * @param endTime 结束时间,可以是字符串、数字或日期类型
2612
- * @returns 返回格式化后的时间间隔字符串,格式为"天数 天 小时 时 分钟 分 秒 秒"或"少于1秒"
2613
- */
2614
- static formatDateInterval(startTime, endTime) {
2615
- const dateCreateTime = new Date(startTime);
2616
- const dateFinishTime = new Date(endTime);
2617
- const dateInterval = dateFinishTime.getTime() - dateCreateTime.getTime();
2618
- const days = Math.floor(dateInterval / (24 * 3600 * 1e3));
2619
- const leave1 = dateInterval % (24 * 3600 * 1e3);
2620
- const hours = Math.floor(leave1 / (3600 * 1e3));
2621
- const leave2 = leave1 % (3600 * 1e3);
2622
- const minutes = Math.floor(leave2 / (60 * 1e3));
2623
- const leave3 = leave2 % (60 * 1e3);
2624
- const seconds = Math.round(leave3 / 1e3);
2625
- let intervalDes = "";
2626
- if (days > 0) {
2627
- intervalDes += days + "天";
2628
- }
2629
- if (hours > 0) {
2630
- intervalDes += hours + "时";
2631
- }
2632
- if (minutes > 0) {
2633
- intervalDes += minutes + "分";
2634
- }
2635
- if (seconds > 0) {
2636
- intervalDes += seconds + "秒";
2637
- }
2638
- if (days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
2639
- intervalDes = "少于1秒";
2640
- }
2641
- return intervalDes;
2642
- }
2643
- /**
2644
- * 将给定的时间(秒)格式化为时:分:秒格式的字符串
2645
- *
2646
- * @param times 时间(秒)
2647
- * @returns 返回格式化后的字符串
2648
- */
2649
- static formatterCounter(times) {
2650
- const checked = function(j) {
2651
- return (j > 10 ? "" : "0") + (j || 0);
2652
- };
2653
- const houres = checked(Math.floor(times / 3600));
2654
- const level1 = times % 3600;
2655
- const minutes = checked(Math.floor(level1 / 60));
2656
- const leave2 = level1 % 60;
2657
- const seconds = checked(Math.round(leave2));
2658
- return `${houres}:${minutes}:${seconds}`;
2659
- }
2660
- /**
2661
- * 静态方法:使当前线程暂停执行指定的毫秒数
2662
- *
2663
- * @param d 需要暂停的毫秒数
2664
- * @returns 无返回值
2665
- */
2666
- static sleep(d) {
2667
- }
2668
- }
2669
- __publicField(DateUtil, "lastMonthDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1));
2670
- __publicField(DateUtil, "thisMonthDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1));
2671
- __publicField(DateUtil, "nextMonthDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1));
2672
- __publicField(DateUtil, "lastWeekDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - 7 - (/* @__PURE__ */ new Date()).getDay()));
2673
- __publicField(DateUtil, "thisWeekDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - (/* @__PURE__ */ new Date()).getDay()));
2674
- __publicField(DateUtil, "nextWeekDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 + 7 - (/* @__PURE__ */ new Date()).getDay()));
2675
- __publicField(DateUtil, "lastDayDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() - 1));
2676
- __publicField(DateUtil, "thisDayDate", new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)));
2677
- __publicField(DateUtil, "nextDayDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1));
2678
2508
  function trim(str) {
2679
2509
  return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
2680
2510
  }
@@ -3481,6 +3311,196 @@ class CanvasDrawer {
3481
3311
  return canvas;
3482
3312
  }
3483
3313
  }
3314
+ class DateTime extends Date {
3315
+ constructor(...val) {
3316
+ super(val.length ? val : /* @__PURE__ */ new Date());
3317
+ }
3318
+ format(fmt = "yyyy-MM-dd hh:mm:ss") {
3319
+ const o = {
3320
+ "M+": this.getMonth() + 1,
3321
+ // 月份
3322
+ "d+": this.getDate(),
3323
+ // 日
3324
+ "h+": this.getHours(),
3325
+ // 小时
3326
+ "H+": this.getHours(),
3327
+ // 小时 (24小时制)
3328
+ "m+": this.getMinutes(),
3329
+ // 分
3330
+ "s+": this.getSeconds(),
3331
+ // 秒
3332
+ "q+": Math.floor((this.getMonth() + 3) / 3),
3333
+ // 季度
3334
+ S: this.getMilliseconds()
3335
+ // 毫秒
3336
+ };
3337
+ if (/(y+)/.test(fmt)) {
3338
+ fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
3339
+ }
3340
+ for (const k in o) {
3341
+ const reg = new RegExp("(" + k + ")", "g");
3342
+ if (reg.test(fmt)) {
3343
+ fmt = fmt.replace(reg, (match) => (match.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)).toString());
3344
+ }
3345
+ }
3346
+ return fmt;
3347
+ }
3348
+ addDate(interval, number) {
3349
+ const date = new Date(this);
3350
+ switch (interval) {
3351
+ case "y":
3352
+ date.setFullYear(this.getFullYear() + number);
3353
+ break;
3354
+ case "q":
3355
+ date.setMonth(this.getMonth() + number * 3);
3356
+ break;
3357
+ case "M":
3358
+ date.setMonth(this.getMonth() + number);
3359
+ break;
3360
+ case "w":
3361
+ date.setDate(this.getDate() + number * 7);
3362
+ break;
3363
+ case "d":
3364
+ date.setDate(this.getDate() + number);
3365
+ break;
3366
+ case "h":
3367
+ date.setHours(this.getHours() + number);
3368
+ break;
3369
+ case "m":
3370
+ date.setMinutes(this.getMinutes() + number);
3371
+ break;
3372
+ case "s":
3373
+ date.setSeconds(this.getSeconds() + number);
3374
+ break;
3375
+ default:
3376
+ date.setDate(this.getDate() + number);
3377
+ break;
3378
+ }
3379
+ return date;
3380
+ }
3381
+ static lastMonth() {
3382
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1);
3383
+ }
3384
+ static thisMonth() {
3385
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1);
3386
+ }
3387
+ static nextMonth() {
3388
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 2, 1);
3389
+ }
3390
+ static lastWeek() {
3391
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - 7 - (/* @__PURE__ */ new Date()).getDay());
3392
+ }
3393
+ static thisWeek() {
3394
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - (/* @__PURE__ */ new Date()).getDay());
3395
+ }
3396
+ static nextWeek() {
3397
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 + 7 - (/* @__PURE__ */ new Date()).getDay());
3398
+ }
3399
+ static lastDay() {
3400
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() - 1);
3401
+ }
3402
+ static thisDay() {
3403
+ return new DateTime((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
3404
+ }
3405
+ static nextDay() {
3406
+ return new DateTime((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1);
3407
+ }
3408
+ /**
3409
+ * 解析日期字符串,并返回对应的Date对象。
3410
+ *
3411
+ * @param str 日期字符串,格式为"yyyy-MM-dd"、"yyyy-MM-dd HH:mm:ss"或"yyyy-MM-dd HH:mm:ss.SSS"。
3412
+ * @returns 返回解析后的Date对象,如果解析失败则返回null。
3413
+ */
3414
+ static parseDate(str) {
3415
+ if (typeof str == "string") {
3416
+ var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
3417
+ if (results && results.length > 3) return new Date(parseInt(results[1]), parseInt(results[2]) - 1, parseInt(results[3]));
3418
+ results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);
3419
+ if (results && results.length > 6)
3420
+ return new Date(
3421
+ parseInt(results[1]),
3422
+ parseInt(results[2]) - 1,
3423
+ parseInt(results[3]),
3424
+ parseInt(results[4]),
3425
+ parseInt(results[5]),
3426
+ parseInt(results[6])
3427
+ );
3428
+ results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/);
3429
+ if (results && results.length > 7)
3430
+ return new Date(
3431
+ parseInt(results[1]),
3432
+ parseInt(results[2]) - 1,
3433
+ parseInt(results[3]),
3434
+ parseInt(results[4]),
3435
+ parseInt(results[5]),
3436
+ parseInt(results[6]),
3437
+ parseInt(results[7])
3438
+ );
3439
+ }
3440
+ return null;
3441
+ }
3442
+ /**
3443
+ * 格式化时间间隔
3444
+ *
3445
+ * @param startTime 开始时间,可以是字符串、数字或日期类型
3446
+ * @param endTime 结束时间,可以是字符串、数字或日期类型
3447
+ * @returns 返回格式化后的时间间隔字符串,格式为"天数 天 小时 时 分钟 分 秒 秒"或"少于1秒"
3448
+ */
3449
+ static formatDateInterval(startTime, endTime) {
3450
+ const dateCreateTime = new Date(startTime);
3451
+ const dateFinishTime = new Date(endTime);
3452
+ const dateInterval = dateFinishTime.getTime() - dateCreateTime.getTime();
3453
+ const days = Math.floor(dateInterval / (24 * 3600 * 1e3));
3454
+ const leave1 = dateInterval % (24 * 3600 * 1e3);
3455
+ const hours = Math.floor(leave1 / (3600 * 1e3));
3456
+ const leave2 = leave1 % (3600 * 1e3);
3457
+ const minutes = Math.floor(leave2 / (60 * 1e3));
3458
+ const leave3 = leave2 % (60 * 1e3);
3459
+ const seconds = Math.round(leave3 / 1e3);
3460
+ let intervalDes = "";
3461
+ if (days > 0) {
3462
+ intervalDes += days + "天";
3463
+ }
3464
+ if (hours > 0) {
3465
+ intervalDes += hours + "时";
3466
+ }
3467
+ if (minutes > 0) {
3468
+ intervalDes += minutes + "分";
3469
+ }
3470
+ if (seconds > 0) {
3471
+ intervalDes += seconds + "秒";
3472
+ }
3473
+ if (days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
3474
+ intervalDes = "少于1秒";
3475
+ }
3476
+ return intervalDes;
3477
+ }
3478
+ /**
3479
+ * 将给定的时间(秒)格式化为时:分:秒格式的字符串
3480
+ *
3481
+ * @param times 时间(秒)
3482
+ * @returns 返回格式化后的字符串
3483
+ */
3484
+ static formatterCounter(times) {
3485
+ const checked = function(j) {
3486
+ return (j > 10 ? "" : "0") + (j || 0);
3487
+ };
3488
+ const houres = checked(Math.floor(times / 3600));
3489
+ const level1 = times % 3600;
3490
+ const minutes = checked(Math.floor(level1 / 60));
3491
+ const leave2 = level1 % 60;
3492
+ const seconds = checked(Math.round(leave2));
3493
+ return `${houres}:${minutes}:${seconds}`;
3494
+ }
3495
+ /**
3496
+ * 静态方法:使当前线程暂停执行指定的毫秒数
3497
+ *
3498
+ * @param d 需要暂停的毫秒数
3499
+ * @returns 无返回值
3500
+ */
3501
+ static sleep(d) {
3502
+ }
3503
+ }
3484
3504
  class EventDispatcher {
3485
3505
  constructor() {
3486
3506
  __publicField(this, "_listeners", {});
@@ -4230,7 +4250,7 @@ export {
4230
4250
  Color,
4231
4251
  Cookie,
4232
4252
  CoordsUtil,
4233
- DateUtil,
4253
+ DateTime,
4234
4254
  DomUtil,
4235
4255
  ErrorType,
4236
4256
  EventDispatcher,
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mqtt-browser")):"function"==typeof define&&define.amd?define(["exports","mqtt-browser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={},t.mqttBrowser)}(this,(function(t,e){"use strict";var n,r=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),o=(t=>(t.MAP_RENDER="mapRender",t.MAP_READY="mapReady",t.MOUSE_CLICK="click",t.MOUSE_DOUBLE_CLICK="dblclick",t.MOUSE_MOVE="mousemove",t.MOUSE_IN="mousein",t.MOUSE_OUT="mouseout",t.MOUSE_RIGHT_CLICK="mouseRightClick",t.KEY_DOWN="keyDown",t.KEY_UP="keyUp",t.DRAW_ACTIVE="drawActive",t.DRAW_MOVE="drawMove",t.DRAW_COMPLETE="drawComplete",t.MQTT_CONNECT="mqttConnect",t.MQTT_ERROR="mqttError",t.MQTT_MESSAGE="mqttMessage",t.MQTT_CLOSE="mqttClose",t.WEB_SOCKET_CONNECT="webSocketConnect",t.WEB_SOCKET_ERROR="webSocketError",t.WEB_SOCKET_MESSAGE="webSocketMessage",t.WEB_SOCKET_CLOSE="webSocketClose",t))(o||{}),i=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="任务处理失败",t.PROCESS_TIMEOUT="任务处理超时",t.AUTH_VERIFY_ERROR="权限验证失败",t.INSTANCE_DUPLICATE="实例为单例模式,不允许重复构建",t.STRING_CHECK_LOSS="字符串缺少关键字",t.PARAMETER_ERROR="验证参数类型失败",t.PARAMETER_ERROR_ARRAY="验证参数类型失败,必须是数组",t.PARAMETER_ERROR_STRING="验证参数类型失败,必须是字符",t.PARAMETER_ERROR_FUNCTION="验证参数类型失败,必须是函数",t.PARAMETER_ERROR_OBJECT="验证参数类型失败,必须是对象",t.PARAMETER_ERROR_INTEGER="验证参数类型失败,必须是整型",t.PARAMETER_ERROR_NUMBER="验证参数类型失败,必须是数值",t.PARAMETER_ERROR_LACK="验证参数类型失败,必须非空",t.PARAMETER_ERROR_ENUM="验证参数类型失败,必须是指定的值",t.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_JSON="JSON解析失败,格式有误",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t.REQUEST_ERROR="请求资源失败",t.REQUEST_ERROR_CROSS="不允许跨站点访问资源",t.REQUEST_ERROR_TIMEOUT="请求超时,请检查网络",t.REQUEST_ERROR_NOT_FOUND="请求资源不存在",t.REQUEST_ERROR_FORBIDDEN="请求资源禁止访问",t.REQUEST_ERROR_EMPTY="请求数据记录为空",t))(i||{}),a=(t=>(t[t.SUPER_MAP_IMAGES=0]="SUPER_MAP_IMAGES",t[t.SUPER_MAP_DATA=1]="SUPER_MAP_DATA",t[t.ARC_GIS_MAP_IMAGES=2]="ARC_GIS_MAP_IMAGES",t[t.ARC_GIS_MAP_DATA=3]="ARC_GIS_MAP_DATA",t[t.OSGB_LAYER=4]="OSGB_LAYER",t[t.S3M_GROUP=5]="S3M_GROUP",t[t.TERRAIN_LAYER=6]="TERRAIN_LAYER",t))(a||{}),l=(t=>(t[t.ADD=0]="ADD",t[t.MODIFY=1]="MODIFY",t[t.DETAIL=2]="DETAIL",t))(l||{}),c=(t=>(t[t.REVERSE_CASE=0]="REVERSE_CASE",t[t.UPPER_CAMEL_CASE=1]="UPPER_CAMEL_CASE",t[t.LOWER_CAMEL_CASE=2]="LOWER_CAMEL_CASE",t[t.UPPER_CASE=3]="UPPER_CASE",t[t.LOWER_CASE=4]="LOWER_CASE",t))(c||{}),h=(t=>(t.POINT="Point",t.POLYLINE="Polyline",t.POLYGON="Polygon",t.RECTANGLE="Rectangle",t.BILLBOARD="Billboard",t.CYLINDER="Cylinder",t.ELLIPSOID="Ellipsoid",t.LABEL="Label",t.MODEL="Model",t.WALL="Wall",t.CIRCLE="Circle",t))(h||{}),u=(t=>(t[t.SOLID=0]="SOLID",t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(u||{}),d=(t=>(t[t.DISTANCE=0]="DISTANCE",t[t.AREA=1]="AREA",t[t.HEIGHT=2]="HEIGHT",t[t.ANGLE=3]="ANGLE",t))(d||{});const g={getException(t,e){const n=function(){Error.call(this,e),this.name=t,this.message=e,this.stack=(new Error).stack};return Error&&(n.__proto__=Error),(n.prototype=Object.create(Error&&Error.prototype)).constructor=n,n},throwException(t){throw new(this.getException("Exception",t))(t)},throwColorException(t){throw new(this.getException("ColorException",i.DATA_ERROR_COLOR+" -> "+(t||"")))(t)},throwCoordinateException(t){throw new(this.getException("CoordinateException",i.DATA_ERROR_COORDINATE+" -> "+(t||"")))(t)},throwGeoJsonException(t){throw new(this.getException("GeoJsonException",i.DATA_ERROR_GEOJSON+" -> "+(t||"")))(t)},throwEmptyException(t){throw new(this.getException("EmptyException",i.PARAMETER_ERROR_LACK+" -> "+(t||"")))(t)},throwIntegerException(t){throw new(this.getException("IntegerException",i.PARAMETER_ERROR_INTEGER+" -> "+(t||"")))(t)},throwNumberException(t){throw new(this.getException("NumberException",i.PARAMETER_ERROR_NUMBER+" -> "+(t||"")))(t)},throwArrayException(t){throw new(this.getException("ArrayException",i.PARAMETER_ERROR_ARRAY+" -> "+(t||"")))(t)},throwFunctionException(t){throw new(this.getException("FunctionException",i.PARAMETER_ERROR_FUNCTION+" -> "+(t||"")))(t)},throwProcessException(t){throw new(this.getException("ProcessException",i.PROCESS_FAIL+" -> "+(t||"")))(t)},throwNetworkException(t){throw new(this.getException("NetworkException",i.REQUEST_ERROR_TIMEOUT+" -> "+(t||"")))(t)}},p={getDataType:t=>Object.prototype.toString.call(t).slice(8,-1),asArray(t){return this.isEmpty(t)?[]:Array.isArray(t)?t:[t]},asNumber:t=>Number.isNaN(Number(t))?0:Number(t),asString(t){if(this.isEmpty(t))return"";switch(this.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},isEmpty(t){if(null==t)return!0;switch(this.getDataType(t)){case"String":return""===t.trim();case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},json2form(t){const e=new FormData;return this.isEmpty(t)||Object.keys(t).forEach((n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])})),e},guid(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2==0?t.length-1:t.length);for(let r=0;r<n.length;r+=2){const s=n[r];t[0]===s&&(e=n[r+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},convertToTree2(t,e="id",n="parentId",r="children"){const s=[];function o(i){const a=t.filter((t=>t[n]===i[e])).map((t=>(s.some((n=>n[e]===t[e]))||o(t),t)));a.length>0&&(i[r]=a)}return t.forEach((r=>{t.some((t=>t[n]===r[e]))||(o(r),s.push(r))})),s},asyncLoadScript:t=>new Promise(((e,n)=>{try{const r=document.querySelector(`script[src="${t}"]`);r&&r.remove();const s=document.createElement("script");s.type="text/javascript",s.src=t,"readyState"in s?s.onreadystatechange=function(){"complete"!==s.readyState&&"loaded"!==s.readyState||e(s)}:(s.onload=function(){e(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(s)}catch(r){n(r)}})),loadStyle(t){t.forEach((t=>{const e=document.querySelector(`link[href="${t}"]`);e&&e.remove();const n=document.createElement("link");n.href=t,n.rel="stylesheet",n.type="text/css",n.onerror=function(){g.throwException(`Style loading failed for URL: ${t}`)},document.head.appendChild(n)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,n)=>{const r=e[n];if(void 0!==r)return"function"==typeof r?r(e):r;g.throwException(`${i.DATA_ERROR_JSON}: ${t}`)})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[e]])))},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise(((t,n)=>{try{document.execCommand("copy"),t()}catch(r){n(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>"object"==typeof t&&null!==t,isNil:t=>void 0===t||"undefined"===t||null===t||"null"===t,isNumber:t=>"number"==typeof t&&!isNaN(t)||"string"==typeof t&&Number.isFinite(+t),isInteger:t=>parseInt(t)===t,isFunction(t){return!this.isNil(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)},isElement:t=>"object"==typeof t&&1===t.nodeType,checheVersion:(t,e)=>t.replace(/[^0-9]/gi,"")<e.replace(/[^0-9]/gi,"")},f={assign(t,...e){let n,r,s,o;for(p.isEmpty(t)&&(t={}),r=0,s=e.length;r<s;r++)for(n in o=e[r],o)o.hasOwnProperty(n)&&(t[n]=o[n]);return t},deepAssign(t,...e){const n=new WeakMap,r=(t,e)=>{if("object"!=typeof e||null===e)return e;if(n.has(e))return n.get(e);let s;s=Array.isArray(e)?Array.isArray(t)?t:[]:"object"!=typeof t||null===t||Array.isArray(t)?{}:t,n.set(e,s);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=r(s[n],e[n]));return s};let s=Object(t);for(const o of e)"object"==typeof o&&null!==o&&(s=r(s,o));return s},clone:t=>JSON.parse(JSON.stringify(t)),deepClone(t,e){return this.assign(t,e),Object.setPrototypeOf(t.__proto__,e.__proto__),t},isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse(t){if(p.isEmpty(t))return{};if(p.isObject(t))return t;try{return JSON.parse(t)}catch{g.throwException(i.DATA_ERROR_JSON+" -> "+t)}}},m={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",createCircle(t,e={}){const n=e.lineWidth||1,r=G.createCanvas(2*t,2*t),s=r.getContext("2d");return s.beginPath(),s.fillStyle=e.fillColor||"#f00",s.strokeStyle=e.color||"#f00",s.lineWidth=n,s.arc(t,t,t,0,2*Math.PI),s.stroke(),s.fill(),r.toDataURL("image/png")},createRectangle(t,e,n={}){const r=n.lineWidth||1,s=G.createCanvas(t,e),o=s.getContext("2d");return o.fillStyle=n.fillColor||"#f00",o.strokeStyle=n.color||"#f00",o.lineWidth=r,o.beginPath(),o.stroke(),o.fillRect(0,0,t,e),s.toDataURL("image/png")},getBase64(t){let e,n;if(t instanceof HTMLCanvasElement)n=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const r=e.getContext("2d");t instanceof ImageData?r.putImageData(t,0,0):t instanceof Image&&r.drawImage(t,0,0,t.width,t.height),n=e}return n.width>2048||n.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")},getBase64FromUrl(t){return new Promise(((e,n)=>{let r=new Image;r.setAttribute("crossOrigin","Anonymous"),r.src=t,r.onload=()=>{let t=this.getBase64(r);e(t)},r.onerror=n}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);if(e&&e.groups)return{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data};g.throwException("parseBase64: Invalid base64 string")},async copyImage(t){try{const e=await this.getBase64FromUrl(t),n=this.parseBase64(e);if(!n)throw new Error("Failed to parse base64 data.");let r=n.type,s=atob(n.data),o=new ArrayBuffer(s.length),i=new Uint8Array(o);for(let t=0;t<s.length;t++)i[t]=s.charCodeAt(t);let a=new Blob([o],{type:r});await navigator.clipboard.write([new ClipboardItem({[r]:a})])}catch(e){g.throwException("Failed to copy image to clipboard:")}}},E={jsonp(t,e){const n="_jsonp_"+p.guid(),r=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+n:t+="?callback="+n;let s=document.createElement("script");s.type="text/javascript",s.src=t,window[n]=function(t){e(null,t),r.removeChild(s),s=null,delete window[n]},r.appendChild(s)},get(t,e={},n){if(p.isFunction(e)){const t=n;n=e,e=t}const r=this._getClient(n);if(r.open("GET",t,!0),e){for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);r.withCredentials="include"===e.credentials,e.responseType&&(r.responseType=e.responseType)}return r.send(null),r},post(t,e={},n){let r;if("string"!=typeof t?(n=e.cb,r=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(n=e,e={}),r=e.postData),!n)throw new Error("Callback function is required");const s=this._getClient(n);return s.open("POST",t,!0),e.headers=e.headers||{},e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.keys(e.headers).forEach((t=>{s.setRequestHeader(t,e.headers[t])})),"string"!=typeof r&&(r=JSON.stringify(r)),s.send(r),s},_wrapCallback:(t,e)=>function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e(new Error("http status 200 returned without content.")):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e(new Error(t.statusText+","+t.status))},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch(n){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,n){if(p.isFunction(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,n)},getImage(t,e,n){return this.getArrayBuffer(e,n,((e,n)=>{if(e)t.onerror&&t.onerror(e);else if(n){const e=window.URL||window.webkitURL,r=t.onload;t.onload=()=>{r&&r(),e.revokeObjectURL(t.src)};const s=new Blob([new Uint8Array(n.data)],{type:n.contentType});t.cacheControl=n.cacheControl,t.expires=n.expires,t.src=n.data.byteLength?e.createObjectURL(s):m.emptyImageUrl}}))},getJSON(t,e={},n){if(p.isFunction(e)){const t=n;n=e,e=t}const r=function(t,e){const r=e?f.parse(e):null;n&&n(t,r)};return e&&e.jsonp?this.jsonp(t,r):this.get(t,e,r)}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:(t,e)=>t+Math.floor(Math.random()*(e-t+1)),randFloat:(t,e)=>t+Math.random()*(e-t),deg2Rad(t){return t*this.DEG2RAD},rad2Deg(t){return t*this.RAD2DEG},round:(t,e=2)=>p.isNumber(t)?Math.round(Number(t)*Math.pow(10,e))/Math.pow(10,e):0,clamp:(t,e,n)=>Math.max(e,Math.min(n,t))};class w{static isLnglat(t,e){return p.isNumber(t)&&p.isNumber(e)&&!!(+e>=-90&&+e<=90&&+t>=-180&&+t<=180)}static distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}static distanceByPoints(t,e){const{lng:n,lat:r}=t,{lng:s,lat:o}=e;let i=Math.cos(r*Math.PI/180)*Math.cos(o*Math.PI/180)*Math.cos((n-s)*Math.PI/180)+Math.sin(r*Math.PI/180)*Math.sin(o*Math.PI/180);i>1&&(i=1),i<-1&&(i=-1);return 6371e3*Math.acos(i)}static formatLnglat(t,e){let n="";function r(t){const e=Math.floor(t),n=Math.floor(60*(t-e));return`${e}°${n}′${(3600*(t-e)-60*n).toFixed(2)}″`}return this.isLnglat(t,e)?n=r(t)+","+r(e):isNaN(t)?isNaN(e)||(n=r(e)):n=r(t),n}static transformLnglat(t,e){function n(t){let e=/[sw]/i.test(t)?-1:1;const n=t.match(/[\d.]+/g)||[];let r=0;for(let s=0;s<n.length;s++)r+=parseFloat(n[s])/e,e*=60;return r}if(t&&e)return{lng:n(t),lat:n(e)}}static rayCasting(t,e){for(var n=t.x,r=t.y,s=!1,o=0,i=e.length,a=i-1;o<i;a=o,o++){var l=e[o].x,c=e[o].y,h=e[a].x,u=e[a].y;if(l===n&&c===r||h===n&&u===r)return"on";if(c<r&&u>=r||c>=r&&u<r){var d=l+(r-c)*(h-l)/(u-c);if(d===n)return"on";d>n&&(s=!s)}}return s?"in":"out"}static rotatePoint(t,e,n){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}}static calcBearAndDis(t,e){const{x:n,y:r}=t,{x:s,y:o}=e,i=s-n,a=o-r,l=Math.sqrt(i*i+a*a);return{angle:(Math.atan2(a,i)*(180/Math.PI)+360+90)%360,distance:l}}static calcBearAndDisByPoints(t,e){var n=1*t.lat,r=1*t.lng,s=1*e.lat,o=1*e.lng,i=Math.sin((o-r)*this.toRadian)*Math.cos(s*this.toRadian),a=Math.cos(n*this.toRadian)*Math.sin(s*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.cos((o-r)*this.toRadian),l=Math.atan2(i,a)*(180/Math.PI),c=(s-n)*this.toRadian,h=(o-r)*this.toRadian,u=Math.sin(c/2)*Math.sin(c/2)+Math.cos(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.sin(h/2)*Math.sin(h/2),d=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return{angle:l,distance:this.R*d}}static distanceToSegment(t,e,n){const r=t.x,s=t.y,o=e.x,i=e.y,a=n.x,l=n.y,c=(a-o)*(r-o)+(l-i)*(s-i);if(c<=0)return Math.sqrt((r-o)*(r-o)+(s-i)*(s-i));const h=(a-o)*(a-o)+(l-i)*(l-i);if(c>=h)return Math.sqrt((r-a)*(r-a)+(s-l)*(s-l));const u=c/h,d=o+(a-o)*u,g=i+(l-i)*u;return Math.sqrt((r-d)*(r-d)+(s-g)*(s-g))}static calcPointByBearAndDis(t,e,n){const r=y.deg2Rad(1*t.lat),s=y.deg2Rad(1*t.lng),o=n/this.R;e=y.deg2Rad(e);const i=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(e)),a=s+Math.atan2(Math.sin(e)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(i));return{lat:y.rad2Deg(i),lng:y.rad2Deg(a)}}static mercatorTolonlat(t,e){const n=this.R_EQU;return{lng:t/n*(180/Math.PI),lat:Math.atan(Math.exp(e/n))*(180/Math.PI)*2-90}}static lonlatToMercator(t,e){var n=this.R_EQU;const r=t*Math.PI/180*n;var s=e*Math.PI/180;return{x:r,y:n/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))}}static interpolate({x:t,y:e,z:n=0},{x:r,y:s,z:o=0},i){return{x:t+(r-t)*i,y:e+(s-e)*i,z:n+(o-n)*i}}static getTraingleArea(t,e,n){let r=0;const s=[];if(s[0]=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow((t.z||0)-(e.z||0),2)),s[1]=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)+Math.pow((t.z||0)-(n.z||0),2)),s[2]=Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2)+Math.pow((n.z||0)-(e.z||0),2)),s[0]+s[1]<=s[2]||s[0]+s[2]<=s[1]||s[1]+s[2]<=s[0])return r;const o=(s[0]+s[1]+s[2])/2;return r=Math.sqrt(o*(o-s[0])*(o-s[1])*(o-s[2])),r}}s(w,"toRadian",Math.PI/180),s(w,"R",6371393),s(w,"R_EQU",6378137);const R={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class M{constructor(t,e,n,r){s(this,"_r"),s(this,"_g"),s(this,"_b"),s(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this._alpha=y.clamp(r||1,0,1)}_validateColorChannel(t){(t<0||t>255)&&g.throwException("Color channel must be between 0 and 255.")}toString(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}toJson(){return{r:this._r,g:this._g,b:this._b,a:this._alpha}}get rgba(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}get hex(){return M.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=y.clamp(t,0,1),this}setRgb(t,e,n){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this}static fromRgba(t){const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);if(!e)throw new Error("Invalid RGBA color value");const n=parseInt(e[1],10),r=parseInt(e[2],10),s=parseInt(e[3],10),o=e[5]?parseFloat(e[5]):1;return new M(n,r,s,o)}static fromHex(t,e=1){const n=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,n,r)=>e+e+n+n+r+r)),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!r)throw new Error("Invalid HEX color value");const s=parseInt(r[1],16),o=parseInt(r[2],16),i=parseInt(r[3],16);return new M(s,o,i,e)}static fromHsl(t){const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)throw new Error("Invalid HSL color value");const n=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100,o=e[4]?parseFloat(e[4]):1;function i(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}let a,l,c;if(0===r)a=l=c=s;else{const t=s<.5?s*(1+r):s+r-s*r,e=2*s-t;a=i(e,t,n+1/3),l=i(e,t,n),c=i(e,t,n-1/3)}return new M(Math.round(255*a),Math.round(255*l),Math.round(255*c),o)}static fromName(t){const e=R[t];return e||g.throwException(`Invalid color name: ${t}`),new M(e[0],e[1],e[2],e.length>3?e[3]:1)}static from(t){return this.isRgb(t)?this.fromRgba(t):this.isHex(t)?this.fromHex(t):this.isHsl(t)?this.fromHsl(t):Object.keys(R).map((t=>t.toString())).includes(t)?this.fromName(t):g.throwException("Invalid color value")}static rgb2hex(t,e,n,r){var s="#"+((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1);if(void 0!==r){return s+Math.round(255*r).toString(16).padStart(2,"0")}return s}static isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static isRgb(t){return/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(t)}static isHsl(t){return/^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(t)}static isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)}static random(){let t=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),n=Math.floor(256*Math.random()),r=Math.random();return new M(t,e,n,r)}}const A=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],S={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let n=0,r=A.length;n<r;n++)if(A[n]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[4]&&e!==A[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[2]&&e!==A[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[0]&&e!==A[1])},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates:t=>t.geometry?t.geometry.coordinates:[],getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const r=t.geometry.coordinates;if(!r)return null;let s=0,o=0,i=0;switch(n){case"Point":s=r[0],o=r[1],i++;break;case"MultiPoint":case"LineString":for(let t=0,e=r.length;t<e;t++)s+=r[t][0],o+=r[t][1],i++;break;case"MultiLineString":case"Polygon":for(let t=0,e=r.length;t<e;t++)for(let n=0,a=r[t].length;n<a;n++)s+=r[t][n][0],o+=r[t][n][1],i++;break;case"MultiPolygon":for(let t=0,e=r.length;t<e;t++)for(let n=0,a=r[t].length;n<a;n++)for(let e=0,l=r[t][n].length;e<l;e++)s+=r[t][n][e][0],o+=r[t][n][e][1],i++}const a=s/i,l=o/i;return e?(e.x=a,e.y=l,e):{x:a,y:l}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},s=n.coordinates;if(!s)return null;const o=[];let i;switch(e){case"MultiPoint":i="Point";break;case"MultiLineString":i="LineString";break;case"MultiPolygon":i="Polygon"}if(i)for(let a=0,l=s.length;a<l;a++)o.push({type:"Feature",geometry:{type:i,coordinates:s[a]},properties:r});else o.push(t);return o},getGeoJsonByCoordinates(t){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let e;if(2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])e="Point";else if(Array.isArray(t[0])&&2===t[0].length)e="LineString";else{if(!Array.isArray(t[0])||!Array.isArray(t[0][0]))throw Error("coordinates 参数格式错误");{const n=t[0];if(n[0].join(",")===n[n.length-1].join(","))e="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");e="MultiPolygon"}}}return{type:"Feature",geometry:{type:e,coordinates:t}}}},_={assertEmpty(...t){t.forEach((t=>{p.isEmpty(t)&&g.throwEmptyException(t)}))},assertInteger(...t){t.forEach((t=>{p.isInteger(t)||g.throwIntegerException(t)}))},assertNumber(...t){t.forEach((t=>{p.isNumber(t)||g.throwNumberException(t)}))},assertArray(...t){t.forEach((t=>{p.isArray(t)||g.throwArrayException(t)}))},assertFunction(...t){t.forEach((t=>{p.isFunction(t)||g.throwFunctionException(t)}))},assertColor(...t){t.forEach((t=>{M.isColor(t)||g.throwColorException(t)}))},assertLnglat(...t){t.forEach((t=>{w.isLnglat(t.lng,t.lat)||g.throwCoordinateException(JSON.stringify(t))}))},assertGeoJson(...t){t.forEach((t=>{S.isGeoJson(t)||g.throwGeoJsonException(t)}))},assertContain(t,...e){let n=!1;for(let r=0,s=e.length||0;r<s;r++)n=t.indexOf(e[r])>=0;if(n)throw Error(i.STRING_CHECK_LOSS+" -> "+t)},assertStartWith(t,e){if(!t.startsWith(e))throw Error("字符串"+t+"开头不是 -> "+e)},assertEndWith(t,e){if(!t.endsWith(e))throw Error("字符串"+t+"结尾不是 -> "+e)}},b=Object.create(Array);b.prototype.groupBy=function(t){var e={};return this.forEach((function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)})),Object.keys(e).map((t=>e[t]))},b.prototype.distinct=function(t=t=>t){const e=[],n={};return this.forEach((r=>{const s=t(r),o=String(s);n[o]||(n[o]=!0,e.push(r))})),e},b.prototype.max=function(){return Math.max.apply({},this)},b.prototype.min=function(){return Math.min.apply({},this)},b.prototype.sum=function(){return this.length>0?this.reduce(((t=0,e=0)=>t+e)):0},b.prototype.avg=function(){return this.length?this.sum()/this.length:0},b.prototype.desc=function(t=t=>t){return this.sort(((e,n)=>t(n)-t(e)))},b.prototype.asc=function(t=t=>t){return this.sort(((e,n)=>t(e)-t(n)))},b.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},b.prototype.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this};const x={create:t=>[...new Array(t).keys()],union(...t){let e=[];return t.forEach((t=>{Array.isArray(t)&&(e=e.concat(t.filter((t=>!e.includes(t)))))})),e},intersection(...t){let e=t[0]||[];return t.forEach((t=>{Array.isArray(t)&&(e=e.filter((e=>t.includes(e))))})),e},unionAll:(...t)=>[...t].flat().filter((t=>!!t)),difference(...t){return 0===t.length?[]:this.union(...t).filter((e=>!this.intersection(...t).includes(e)))},zhSort:(t,e=t=>t,n)=>(t.sort((function(t,r){return n?e(t).localeCompare(e(r),"zh"):e(r).localeCompare(e(t),"zh")})),t)};class C{static getSystem(){var t,e,n,r,s,o,i,a,l;const c=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let h="",u="";if(c.includes("Android")||c.includes("Adr"))h="Android",u=(null==(e=c.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(c.includes("CrOS"))h="Chromium OS",u=(null==(n=c.match(/MSIE ([\d.]+)/))?void 0:n[1])||(null==(r=c.match(/rv:([\d.]+)/))?void 0:r[1])||"";else if(c.includes("Linux")||c.includes("X11"))h="Linux",u=(null==(s=c.match(/Linux ([\d.]+)/))?void 0:s[1])||"";else if(c.includes("Ubuntu"))h="Ubuntu",u=(null==(o=c.match(/Ubuntu ([\d.]+)/))?void 0:o[1])||"";else if(c.includes("Windows")){let t=(null==(i=c.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:i[1])||"",e={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};h="Windows",u=t in e?e[t]:t}else c.includes("like Mac OS X")?(h="IOS",u=(null==(a=c.match(/OS ([\d_]+) like/))?void 0:a[1].replace(/_/g,"."))||""):c.includes("Macintosh")&&(h="macOS",u=(null==(l=c.match(/Mac OS X -?([\d_]+)/))?void 0:l[1].replace(/_/g,"."))||"");return{type:h,version:u}}static getExplorer(){var t;const e=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let n="",r="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(n="IE",r=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(n="Edge",r=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(n="Chrome",r=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(n="Firefox",r=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(n="Safari",r=t[1])}return{type:n,version:r}}static isSupportWebGL(){if(!(null==this?void 0:this.document))return!1;const t=this.document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");return e&&e instanceof WebGLRenderingContext}static getGPU(){let t="unknown",e="unknown";if(null==this?void 0:this.document){let n=this.document.createElement("canvas"),r=n.getContext("webgl")||n.getContext("experimental-webgl");if(r instanceof WebGLRenderingContext){let n=r.getExtension("WEBGL_debug_renderer_info");if(n){let s=r.getParameter(n.UNMASKED_RENDERER_WEBGL);t=(s.match(/ANGLE \((.+?),/)||[])[1]||"",e=(s.match(/, (.+?) (\(|vs_)/)||[])[1]||""}return{type:t,model:e,spec:{maxTextureSize:r.getParameter(r.MAX_TEXTURE_SIZE),maxRenderBufferSize:r.getParameter(r.MAX_RENDERBUFFER_SIZE),maxTextureUnits:r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)}}}}return{type:t,model:e}}static getLanguage(){var t,e;let n=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof n)return"";let r=n.split("-");return r[1]&&(r[1]=r[1].toUpperCase()),r.join("_")}static getTimeZone(){var t,e;return null==(e=null==(t=null==Intl?void 0:Intl.DateTimeFormat())?void 0:t.resolvedOptions())?void 0:e.timeZone}static async getScreenFPS(){return new Promise((function(t){let e=0,n=1,r=[],s=function(o){if(e>0)if(n<12)r.push(o-e),e=o,n++,requestAnimationFrame(s);else{r.sort(),r=r.slice(1,11);let e=r.reduce(((t,e)=>t+e));const n=10*Math.round(1e4/e/10);t(n)}else e=o,requestAnimationFrame(s)};requestAnimationFrame(s)}))}static async getIPAddress(){const t=/\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/,e=/\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i;let n=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const r=new Set,s=n=>{var s;const o=null==(s=null==n?void 0:n.candidate)?void 0:s.candidate;if(o)for(const i of[t,e]){const t=o.match(i);t&&r.add(t[0])}};return new Promise((function(t,e){const o=new n({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});o.addEventListener("icecandidate",s),o.createDataChannel(""),o.createOffer().then((t=>o.setLocalDescription(t)),e);let i,a=20,l=function(){try{o.removeEventListener("icecandidate",s),o.close()}catch{}i&&clearInterval(i)};i=window.setInterval((function(){let e=[...r];e.length?(l(),t(e[0])):a?a--:(l(),t(""))}),100)}))}static async getNetwork(){var t,e;let n="unknown",r=null==(t=this.navigator)?void 0:t.connection;return r&&(n=r.type||r.effectiveType,"2"!=n&&"unknown"!=n||(n="wifi")),{network:n,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}s(C,"document",null==window?void 0:window.document),s(C,"navigator",null==window?void 0:window.navigator),s(C,"userAgent",null==(n=null==window?void 0:window.navigator)?void 0:n.userAgent),s(C,"screen",null==window?void 0:window.screen);class v{static delta(t,e){const n=6378245,r=.006693421622965943;let s=this.transformLat(e-105,t-35),o=this.transformLon(e-105,t-35);const i=t/180*this.PI;let a=Math.sin(i);a=1-r*a*a;const l=Math.sqrt(a);return s=180*s/(n*(1-r)/(a*l)*this.PI),o=180*o/(n/l*Math.cos(i)*this.PI),{lat:s,lng:o}}static outOfChina(t,e){return t<72.004||t>137.8347||(e<.8293||e>55.8271)}static gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}}static gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}}static gcjDecryptExact(t,e){let n=.01,r=.01,s=t-n,o=e-r,i=t+n,a=e+r,l=0,c=0,h=0;for(;;){l=(s+i)/2,c=(o+a)/2;const u=this.gcjEncrypt(l,c);if(n=u.lat-t,r=u.lng-e,Math.abs(n)<1e-9&&Math.abs(r)<1e-9)break;if(n>0?i=l:s=l,r>0?a=c:o=c,++h>1e4)break}return{lat:l,lng:c}}static bdEncrypt(t,e){const n=e,r=t,s=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),o=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),i=s*Math.cos(o)+.0065;return{lat:s*Math.sin(o)+.006,lng:i}}static bdDecrypt(t,e){const n=e-.0065,r=t-.006,s=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),o=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),i=s*Math.cos(o);return{lat:s*Math.sin(o),lng:i}}static mercatorEncrypt(t,e){const n=20037508.34*e/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=20037508.34*r/180,{lat:r,lng:n}}static mercatorDecrypt(t,e){const n=e/20037508.34*180;let r=t/20037508.34*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}}static transformLat(t,e){let n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3,n}static transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,n}static random({x:t,y:e},{x:n,y:r}){return{x:Math.random()*(n-t)+t,y:Math.random()*(r-e)+e}}static deCompose(t,e,n){const r=[];if(t instanceof Array&&!(t[0]instanceof Array))e(t);else if(t instanceof Array&&t[0]instanceof Array)for(let s=0;s<t.length;s++){const o=t[s];if(!p.isNil(o))if(o[0]instanceof Array){const t=n?this.deCompose(o,(t=>e(t)),n):this.deCompose(o,(t=>e(t)));r.push(t)}else{const t=n?e.call(n,o):e(o);r.push(t)}}return r}}s(v,"PI",3.141592653589793),s(v,"XPI",52.35987755982988);const T=Object.create(Date);T.prototype.format=function(t="yyyy-MM-dd hh:mm:ss"){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e){const r=new RegExp("("+n+")","g");r.test(t)&&(t=t.replace(r,(t=>(1===t.length?e[n]:("00"+e[n]).substr((""+e[n]).length)).toString())))}return t},T.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":default:n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e)}return n};class O{static parseDate(t){if("string"==typeof t){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/))&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/))&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null}static formatDateInterval(t,e){const n=new Date(t),r=new Date(e).getTime()-n.getTime(),s=Math.floor(r/864e5),o=r%864e5,i=Math.floor(o/36e5),a=o%36e5,l=Math.floor(a/6e4),c=a%6e4,h=Math.round(c/1e3);let u="";return s>0&&(u+=s+"天"),i>0&&(u+=i+"时"),l>0&&(u+=l+"分"),h>0&&(u+=h+"秒"),0===s&&0===i&&0===l&&0===h&&(u="少于1秒"),u}static formatterCounter(t){const e=function(t){return(t>10?"":"0")+(t||0)},n=t%3600,r=n%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(n/60))}:${e(Math.round(r))}`}static sleep(t){}}function I(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}s(O,"lastMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()-1,1)),s(O,"thisMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth(),1)),s(O,"nextMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()+1,1)),s(O,"lastWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay())),s(O,"thisWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay())),s(O,"nextWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay())),s(O,"lastDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1)),s(O,"thisDayDate",new Date((new Date).setHours(0,0,0,0))),s(O,"nextDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1));const P={getStyle(t,e){var n;let r=t.style[e];if(!r||"auto"===r){const s=null==(n=document.defaultView)?void 0:n.getComputedStyle(t,null);r=s?s[e]:null,"auto"===r&&(r=null)}return r},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass:t=>((null==t?void 0:t.host)||t).className.toString(),hasClass(t,e){var n;if(null==(n=t.classList)?void 0:n.contains(e))return!0;const r=this.getClass(t);return r.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(r)},addClass(t,e){if(void 0!==t.classList){const n=I(e);for(let e=0,r=n.length;e<r;e++)t.classList.add(n[e])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){if(void 0!==t.classList){I(e).forEach((e=>t.classList.remove(e)))}else this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach((e=>t.classList.add(e))))},parseFromString:t=>(new DOMParser).parseFromString(t,"text/xml").children[0]},D={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);const s=new Uint8Array(r);return new Blob([s],{type:e})},convertBase64ToFile(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/png",o=atob(n[1]),i=new Uint8Array(o.length);for(let a=0;a<o.length;a++)i[a]=o.charCodeAt(a);return new File([i],e,{type:s})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),n=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(n)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)},readFileFromUrl:(t,e)=>new Promise(((n,r)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="blob";const o=e.split(".");try{s.onload=function(){if(this.status>=200&&this.status<300){const t=s.response,i=URL.createObjectURL(t),a=new File([t],e,{type:o[1],lastModified:(new Date).getTime()}),l=new FileReader;l.readAsArrayBuffer(a),l.onload=function(t){var e;URL.revokeObjectURL(i),n(null==(e=t.target)?void 0:e.result)},l.onerror=function(t){r(t)}}},s.onerror=function(t){r(t)}}catch(i){r(i)}s.send()}))};class L{static resetWarned(){this.warned={}}static changeVoice(){this.isMute=!!Number(!this.isMute),localStorage.setItem("mute",Number(this.isMute).toString())}static _call(t,e,n){this.warned[e]||(t(e,n),this.warned[e]=!0)}static msg(t,e,n={}){if(this.isMute)return;const r=p.decodeDict(t,"success","恭喜","error","发生错误","warning","警告","info","友情提示")+":";this.speechSynthesisUtterance.text=r+e,this.speechSynthesisUtterance.lang=n.lang||"zh-CN",this.speechSynthesisUtterance.volume=n.volume||1,this.speechSynthesisUtterance.rate=n.rate||1,this.speechSynthesisUtterance.pitch=n.pitch||1,this.speechSynthesis.speak(this.speechSynthesisUtterance)}static stop(t){this.speechSynthesisUtterance.text=t,this.speechSynthesis.cancel()}static warning(t,e={}){console.warn(`Warning: %c${t}`,"color:#E6A23C;font-weight: bold;"),this.msg("warning",t,e)}static warningOnce(t,e={}){this._call(this.warning.bind(this),t,e)}static info(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.info(`Info: %c${t}`,"color:#909399;font-weight: bold;"),this.msg("info",t,e)}static infoOnce(t,e={}){this._call(this.info.bind(this),t,e)}static error(t,e={}){console.error(`Error: %c${t}`,"color:#F56C6C;font-weight: bold;"),this.msg("error",t,e)}static errorOnce(t,e={}){this._call(this.error.bind(this),t,e)}static success(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.log(`Success: %c${t}`,"color:#67C23A;font-weight: bold;"),this.msg("success",t,e)}static successOnce(t,e={}){this._call(this.success.bind(this),t,e)}}s(L,"warned",{}),s(L,"isMute",!!Number(localStorage.getItem("mute"))||!1),s(L,"speechSynthesis",window.speechSynthesis),s(L,"speechSynthesisUtterance",new SpeechSynthesisUtterance);const k={debounce(t,e,n=!0){let r,s,o=null;const i=()=>{const a=Date.now()-r;a<e&&a>0?o=setTimeout(i,e-a):(o=null,n||(s=t.apply(this,undefined)))};return(...a)=>{r=Date.now();const l=n&&!o;return o||(o=setTimeout(i,e)),l&&(s=t.apply(this,a),o||(a=null)),s}},throttle(t,e,n=1){let r=0,s=null;return(...o)=>{if(1===n){const n=Date.now();n-r>=e&&(t.apply(this,o),r=n)}else 2===n&&(s||(s=setTimeout((()=>{s=null,t.apply(this,o)}),e)))}},memoize(t){const e=new Map;return(...n)=>{const r=JSON.stringify(n);if(e.has(r))return e.get(r);{const s=t.apply(this,n);return e.set(r,s),s}}},recurve(t,e=500,n=5e3){let r=0;setTimeout((()=>{r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))}),e)},once(t){let e=!1;return function(...n){if(!e)return e=!0,t(...n)}}},U={changeCase(t,e){switch(e=e||c.LOWER_CASE){case c.REVERSE_CASE:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case c.UPPER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case c.LOWER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case c.UPPER_CASE:return t.toUpperCase();case c.LOWER_CASE:return t.toLowerCase();default:return t}},getByteLength:t=>t.replace(/[\u0391-\uFFE5]/g,"aa").length,subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var s=Math.floor(n/2);s<t.length;s++){let o=t.substring(e,s);if(o.replace(r,"mm").length>=n)return o}return t},string2Bytes(t){const e=[];let n;const r=t.length;for(let s=0;s<r;s++)n=t.charCodeAt(s),n>=65536&&n<=1114111?(e.push(n>>18&7|240),e.push(n>>12&63|128),e.push(n>>6&63|128),e.push(63&n|128)):n>=2048&&n<=65535?(e.push(n>>12&15|224),e.push(n>>6&63|128),e.push(63&n|128)):n>=128&&n<=2047?(e.push(n>>6&31|192),e.push(63&n|128)):e.push(255&n);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const n=t;for(let r=0;r<n.length;r++){const t=n[r].toString(2),s=t.match(/^1+?(?=0)/);if(s&&8==t.length){const t=s[0].length;let o=n[r].toString(2).slice(7-t);for(let e=1;e<t;e++)o+=n[e+r].toString(2).slice(2);e+=String.fromCharCode(parseInt(o,2)),r+=t-1}else e+=String.fromCharCode(n[r])}return e}},N={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var r=n,s=t[n];e.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}return e.join("&")},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:s}=new URL(t),o=[r,s];let i={};for(let a=0;a<o.length;a++){const t=o[a];if(t){const r=t.replace(/#|\//g,"").split("?");if(r.length>1)for(let t=1;t<r.length;t++){let s;for(;s=n.exec(r[t]);)i[s[1]]=e?decodeURIComponent(s[2]):s[2]}}}return i}},F={isUrl:t=>/^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(t),isExternal:t=>/^(https?:|mailto:|tel:)/.test(t),isPhone:t=>/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t),isTel:t=>/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t),isStrongPwd:t=>/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/.test(t),isEmail:t=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t),isIP:t=>/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(t),isEnglish:t=>/^[a-zA-Z]+$/.test(t),isChinese:t=>/^[\u4E00-\u9FA5]+$/.test(t),isHTML:t=>/<("[^"]*"|'[^']*'|[^'">])*>/.test(t),isXML:t=>/^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$/.test(t),isIDCard:t=>/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t)};class G{constructor(t){if(s(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");this.ctx=e.getContext("2d")}}drawLine({x:t,y:e},{x:n,y:r},s={}){this.ctx.beginPath();const o=s.width||1,i=s.color||"#000";this.ctx.lineWidth=o,this.ctx.strokeStyle=i,this.ctx.moveTo(t,e),this.ctx.lineTo(n,r),this.ctx.stroke()}drawArc({x:t,y:e},n,r,s,o,i,a){i?(this.ctx.fillStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,n,y.deg2Rad(r),y.deg2Rad(s),o),this.ctx.fill()):(this.ctx.strokeStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,n,y.deg2Rad(r),y.deg2Rad(s),o),this.ctx.stroke())}drawImage({x:t,y:e},n){const r=new Image;r.src=n,r.onload=()=>{const n=r.width,s=r.height;if(!this.ctx)throw new Error("Canvas context is null");this.ctx.drawImage(r,t,e,-n/2,-s/2)}}drawText({x:t,y:e},n,r){this.ctx.font=r.font||"10px sans-serif",this.ctx.strokeStyle=r.color||"#000",this.ctx.lineWidth=2,this.ctx.strokeText(n,t,e)}static createCanvas(t=1,e=1){const n=document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n}}class B{constructor(){s(this,"_listeners",{}),s(this,"_mutex",{}),s(this,"_context")}addEventListener(t,e,n,r){this._context=n;const s=this._mutex,o=this._listeners;return void 0===o[t]&&(o[t]=[]),-1===o[t].indexOf(e)&&(r&&(s[t]=e),o[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){const t=n.map((t=>t.toString())).indexOf(e.toString());-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);if(void 0!==this._mutex[t.type]){const e=n.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,r=n.length;e<r;e++){const r=n[e];"function"==typeof r&&r.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}on(t,e,n,r){return this.addEventListener.call(this,t,e,n,r)}off(t,e){return this.removeEventListener.call(this,t,e)}}const j=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],q=(()=>{if("undefined"==typeof document)return!1;const t=j[0],e={};for(const n of j){if((null==n?void 0:n[1])in document){for(const[r,s]of n.entries())e[t[r]]=s;return e}}return!1})(),$={change:q.fullscreenchange,error:q.fullscreenerror};let W={request:(t=document.documentElement,e)=>new Promise(((n,r)=>{const s=()=>{W.off("change",s),n()};W.on("change",s);const o=t[q.requestFullscreen](e);o instanceof Promise&&o.then(s).catch(r)})),exit:()=>new Promise(((t,e)=>{if(!W.isFullscreen)return void t();const n=()=>{W.off("change",n),t()};W.on("change",n);const r=document[q.exitFullscreen]();r instanceof Promise&&r.then(n).catch(e)})),toggle:(t,e)=>W.isFullscreen?W.exit():W.request(t,e),onchange(t){W.on("change",t)},onerror(t){W.on("error",t)},on(t,e){const n=$[t];n&&document.addEventListener(n,e,!1)},off(t,e){const n=$[t];n&&document.removeEventListener(n,e,!1)},raw:q};Object.defineProperties(W,{isFullscreen:{get:()=>Boolean(document[q.fullscreenElement])},element:{enumerable:!0,get:()=>document[q.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[q.fullscreenEnabled])}}),q||(W={isEnabled:!1});const J=W;class H extends Map{isEmpty(){return 0===this.size}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}static fromEntries(t=[]){const e=new H;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=f.parse(t);return new H(Object.entries(e))}}const z=class t extends B{constructor(n=`ws://${window.document.domain}:20007/mqtt`,r={}){super(),s(this,"state"),s(this,"url"),s(this,"context"),s(this,"options"),s(this,"client"),s(this,"topics"),s(this,"_timer"),this.context=f.assign(t.defaultContext,r),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:p.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0,rejectUnauthorized:this.context.REJECT_UNAUTHORIZED},this.url=n,this.client=e.connect(this.url,this.options);let i=0;this._timer=setInterval((()=>{i++,this.client.connected||(this.state=3,this.dispatchEvent({type:o.MQTT_ERROR,message:this}),this.client.end()),i>this.context.MQTT_MAX_RETRY&&(clearInterval(this._timer),this._onError())}),this.context.MQTT_TIMEOUTM),this._onConnect(),this._onMessage(),this.state=1,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=2,clearInterval(this._timer),console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:o.MQTT_CONNECT,message:this})})),this.client.on("error",this._onError)}_onError(){g.throwException("链接mqtt失败==>"+this.url),this.state=0,this.client.end()}_onMessage(){this.client.on("message",((t,e)=>{let n=e,r="";e instanceof Uint8Array&&(n=e.toString());try{r=f.parse(n)}catch(s){throw new Error(i.DATA_ERROR_JSON)}this.dispatchEvent({type:o.MQTT_MESSAGE,message:{topic:t,data:r}})}))}sendMsg(t,e){if(this.client.connected)return this.client.publish(t,e,{qos:1,retain:!0}),this;console.error("客户端未连接")}subscribe(t){return 2===this.state?this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=x.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(o.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=x.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=x.difference(this.topics,t),console.log(`取消订阅成功==>${t}`))})),this}unsubscribeAll(){return this.unsubscribe(this.topics),this}unconnect(){this.client.end(),this.client=null,this.dispatchEvent({type:o.MQTT_CLOSE,message:{}}),console.log("断开mqtt成功==>"+this.url)}};s(z,"defaultContext",{MQTT_TIMEOUTM:2e3,MQTT_MAX_RETRY:3,REJECT_UNAUTHORIZED:!0});let Y=z;const K=class t{static setLocal(t,e=null,n={}){var r=this._getPrefixedKey(t,n);try{const{expires:t}=n,s={data:e};t&&(s.expires=t),window.localStorage.setItem(r,JSON.stringify(s))}catch(s){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static setSession(t,e=null,n={}){var r=this._getPrefixedKey(t,n);try{const{expires:t}=n,s={data:e};t&&(s.expires=t),window.sessionStorage.setItem(r,JSON.stringify(s))}catch(s){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static getLocal(t,e,n){var r,s=this._getPrefixedKey(t,n);try{r=JSON.parse(window.localStorage.getItem(s)||"")}catch(o){r=window.localStorage[s]?{data:window.localStorage.getItem(s)}:null}if(!r)return e;if("object"==typeof r&&void 0!==r.data){const t=r.expires;return t&&Date.now()>t?e:r.data}}static getSession(t,e,n){var r,s=this._getPrefixedKey(t,n);try{r=JSON.parse(window.sessionStorage.getItem(s)||"")}catch(o){r=window.sessionStorage[s]?{data:window.sessionStorage.getItem(s)}:null}if(!r)return e;if("object"==typeof r&&void 0!==r.data){const t=r.expires;return t&&Date.now()>t?e:r.data}}static localkeys(){const e=[];var n=Object.keys(window.localStorage);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static sessionkeys(){const e=[];var n=Object.keys(window.sessionStorage);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static getAllLocal(e){var n=t.localkeys();if(e){const r=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.getLocal(n,null,null),r.push(e)}})),r}return n.map((e=>t.getLocal(e,null,null)))}static getAllSession(e){var n=t.sessionkeys();if(e){const r=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.getSession(n,null,null),r.push(e)}})),r}return n.map((e=>t.getSession(e,null,null)))}static remove(t,e){var n=this._getPrefixedKey(t,e);window.sessionStorage.removeItem(n),window.localStorage.removeItem(n)}static clearLocal(e){t.prefix.length?this.localkeys().forEach((t=>{window.localStorage.removeItem(this._getPrefixedKey(t,e))})):window.localStorage.clear()}static clearSession(e){t.prefix.length?this.sessionkeys().forEach((t=>{window.sessionStorage.removeItem(this._getPrefixedKey(t,e))})):window.sessionStorage.clear()}};s(K,"prefix",""),s(K,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:K.prefix+t}));let Q=K;t.AjaxUtil=E,t.ArrayUtil=x,t.AssertUtil=_,t.AudioPlayer=class{constructor(t){s(this,"audio"),this.audio=new Audio,this.audio.src=t}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(t){this.audio.muted=t}},t.BrowserUtil=C,t.CanvasDrawer=G,t.CaseType=c,t.Color=M,t.Cookie=class{static set(t,e,n=30){"string"==typeof t&&"number"==typeof n||g.throwException("Invalid arguments");const r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3),document.cookie=`${t}=${encodeURIComponent(e)};expires=${r.toUTCString()}`}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=v,t.DateUtil=O,t.DomUtil=P,t.ErrorType=i,t.EventDispatcher=B,t.EventType=o,t.ExceptionUtil=g,t.FileUtil=D,t.FormType=l,t.FullScreen=J,t.GeoJsonUtil=S,t.GeoUtil=w,t.GraphicType=h,t.HashMap=H,t.ImageUtil=m,t.LayerType=a,t.LineSymbol=u,t.MathUtil=y,t.MeasureMode=d,t.MessageUtil=L,t.MqttClient=Y,t.ObjectUtil=f,t.OptimizeUtil=k,t.Storage=Q,t.StringUtil=U,t.UrlUtil=N,t.Util=p,t.ValidateUtil=F,t.WebGL=class{constructor(t){if(s(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");if(this.ctx=e.getContext("webgl"),!this.ctx)throw new Error("WebGL cannot be initialized. Your browser may not support WebGL")}}initShaders(t,e,n){var r=this.createProgram(t,e,n);return r?(t.useProgram(r),!0):(console.log("Failed to create program"),!1)}createProgram(t,e,n){var r=this.loadShader(t,t.VERTEX_SHADER,e),s=this.loadShader(t,t.FRAGMENT_SHADER,n);if(!r||!s)return null;var o=t.createProgram();if(!o)return null;if(t.attachShader(o,r),t.attachShader(o,s),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS)){var i=t.getProgramInfoLog(o);return console.log("Failed to link program: "+i),t.deleteProgram(o),t.deleteShader(s),t.deleteShader(r),null}return o}loadShader(t,e,n){var r=t.createShader(e);if(null==r)return console.log("unable to create shader"),null;if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var s=t.getShaderInfoLog(r);return g.throwException("Failed to compile shader: "+s),t.deleteShader(r),null}return r}},t.WebSocketClient=class extends B{constructor(t="ws://127.0.0.1:10088"){super(),s(this,"maxCheckTimes",10),s(this,"url"),s(this,"checkTimes",0),s(this,"connectStatus",!1),s(this,"client",null),this.maxCheckTimes=10,this.url=t,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{const t=this;console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client&&(this.client.onopen=function(e){t.dispatchEvent({type:o.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:o.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:o.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:o.WEB_SOCKET_ERROR,message:e})}))}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}connCheckStatus(t){this.checkTimes>t||setTimeout((()=>{this.checkTimes++,this.state!==WebSocket.CONNECTING&&this.state!==WebSocket.OPEN&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&this.state===WebSocket.OPEN?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),this)}heartbeat(){setTimeout((()=>{this.state===WebSocket.OPEN&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}get state(){var t;return null==(t=this.client)?void 0:t.readyState}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mqtt-browser")):"function"==typeof define&&define.amd?define(["exports","mqtt-browser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={},t.mqttBrowser)}(this,(function(t,e){"use strict";var n,r=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),i=(t=>(t.MAP_RENDER="mapRender",t.MAP_READY="mapReady",t.MOUSE_CLICK="click",t.MOUSE_DOUBLE_CLICK="dblclick",t.MOUSE_MOVE="mousemove",t.MOUSE_IN="mousein",t.MOUSE_OUT="mouseout",t.MOUSE_RIGHT_CLICK="mouseRightClick",t.KEY_DOWN="keyDown",t.KEY_UP="keyUp",t.DRAW_ACTIVE="drawActive",t.DRAW_MOVE="drawMove",t.DRAW_COMPLETE="drawComplete",t.MQTT_CONNECT="mqttConnect",t.MQTT_ERROR="mqttError",t.MQTT_MESSAGE="mqttMessage",t.MQTT_CLOSE="mqttClose",t.WEB_SOCKET_CONNECT="webSocketConnect",t.WEB_SOCKET_ERROR="webSocketError",t.WEB_SOCKET_MESSAGE="webSocketMessage",t.WEB_SOCKET_CLOSE="webSocketClose",t))(i||{}),o=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="任务处理失败",t.PROCESS_TIMEOUT="任务处理超时",t.AUTH_VERIFY_ERROR="权限验证失败",t.INSTANCE_DUPLICATE="实例为单例模式,不允许重复构建",t.STRING_CHECK_LOSS="字符串缺少关键字",t.PARAMETER_ERROR="验证参数类型失败",t.PARAMETER_ERROR_ARRAY="验证参数类型失败,必须是数组",t.PARAMETER_ERROR_STRING="验证参数类型失败,必须是字符",t.PARAMETER_ERROR_FUNCTION="验证参数类型失败,必须是函数",t.PARAMETER_ERROR_OBJECT="验证参数类型失败,必须是对象",t.PARAMETER_ERROR_INTEGER="验证参数类型失败,必须是整型",t.PARAMETER_ERROR_NUMBER="验证参数类型失败,必须是数值",t.PARAMETER_ERROR_LACK="验证参数类型失败,必须非空",t.PARAMETER_ERROR_ENUM="验证参数类型失败,必须是指定的值",t.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_JSON="JSON解析失败,格式有误",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t.REQUEST_ERROR="请求资源失败",t.REQUEST_ERROR_CROSS="不允许跨站点访问资源",t.REQUEST_ERROR_TIMEOUT="请求超时,请检查网络",t.REQUEST_ERROR_NOT_FOUND="请求资源不存在",t.REQUEST_ERROR_FORBIDDEN="请求资源禁止访问",t.REQUEST_ERROR_EMPTY="请求数据记录为空",t))(o||{}),a=(t=>(t[t.SUPER_MAP_IMAGES=0]="SUPER_MAP_IMAGES",t[t.SUPER_MAP_DATA=1]="SUPER_MAP_DATA",t[t.ARC_GIS_MAP_IMAGES=2]="ARC_GIS_MAP_IMAGES",t[t.ARC_GIS_MAP_DATA=3]="ARC_GIS_MAP_DATA",t[t.OSGB_LAYER=4]="OSGB_LAYER",t[t.S3M_GROUP=5]="S3M_GROUP",t[t.TERRAIN_LAYER=6]="TERRAIN_LAYER",t))(a||{}),l=(t=>(t[t.ADD=0]="ADD",t[t.MODIFY=1]="MODIFY",t[t.DETAIL=2]="DETAIL",t))(l||{}),c=(t=>(t[t.REVERSE_CASE=0]="REVERSE_CASE",t[t.UPPER_CAMEL_CASE=1]="UPPER_CAMEL_CASE",t[t.LOWER_CAMEL_CASE=2]="LOWER_CAMEL_CASE",t[t.UPPER_CASE=3]="UPPER_CASE",t[t.LOWER_CASE=4]="LOWER_CASE",t))(c||{}),h=(t=>(t.POINT="Point",t.POLYLINE="Polyline",t.POLYGON="Polygon",t.RECTANGLE="Rectangle",t.BILLBOARD="Billboard",t.CYLINDER="Cylinder",t.ELLIPSOID="Ellipsoid",t.LABEL="Label",t.MODEL="Model",t.WALL="Wall",t.CIRCLE="Circle",t))(h||{}),u=(t=>(t[t.SOLID=0]="SOLID",t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(u||{}),d=(t=>(t[t.DISTANCE=0]="DISTANCE",t[t.AREA=1]="AREA",t[t.HEIGHT=2]="HEIGHT",t[t.ANGLE=3]="ANGLE",t))(d||{});const g={getException(t,e){const n=function(){Error.call(this,e),this.name=t,this.message=e,this.stack=(new Error).stack};return Error&&(n.__proto__=Error),(n.prototype=Object.create(Error&&Error.prototype)).constructor=n,n},throwException(t){throw new(this.getException("Exception",t))(t)},throwColorException(t){throw new(this.getException("ColorException",o.DATA_ERROR_COLOR+" -> "+(t||"")))(t)},throwCoordinateException(t){throw new(this.getException("CoordinateException",o.DATA_ERROR_COORDINATE+" -> "+(t||"")))(t)},throwGeoJsonException(t){throw new(this.getException("GeoJsonException",o.DATA_ERROR_GEOJSON+" -> "+(t||"")))(t)},throwEmptyException(t){throw new(this.getException("EmptyException",o.PARAMETER_ERROR_LACK+" -> "+(t||"")))(t)},throwIntegerException(t){throw new(this.getException("IntegerException",o.PARAMETER_ERROR_INTEGER+" -> "+(t||"")))(t)},throwNumberException(t){throw new(this.getException("NumberException",o.PARAMETER_ERROR_NUMBER+" -> "+(t||"")))(t)},throwArrayException(t){throw new(this.getException("ArrayException",o.PARAMETER_ERROR_ARRAY+" -> "+(t||"")))(t)},throwFunctionException(t){throw new(this.getException("FunctionException",o.PARAMETER_ERROR_FUNCTION+" -> "+(t||"")))(t)},throwProcessException(t){throw new(this.getException("ProcessException",o.PROCESS_FAIL+" -> "+(t||"")))(t)},throwNetworkException(t){throw new(this.getException("NetworkException",o.REQUEST_ERROR_TIMEOUT+" -> "+(t||"")))(t)}},p={getDataType:t=>Object.prototype.toString.call(t).slice(8,-1),asArray(t){return this.isEmpty(t)?[]:Array.isArray(t)?t:[t]},asNumber:t=>Number.isNaN(Number(t))?0:Number(t),asString(t){if(this.isEmpty(t))return"";switch(this.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},isEmpty(t){if(null==t)return!0;switch(this.getDataType(t)){case"String":return""===t.trim();case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},json2form(t){const e=new FormData;return this.isEmpty(t)||Object.keys(t).forEach((n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])})),e},guid(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2==0?t.length-1:t.length);for(let r=0;r<n.length;r+=2){const s=n[r];t[0]===s&&(e=n[r+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},convertToTree2(t,e="id",n="parentId",r="children"){const s=[];function i(o){const a=t.filter((t=>t[n]===o[e])).map((t=>(s.some((n=>n[e]===t[e]))||i(t),t)));a.length>0&&(o[r]=a)}return t.forEach((r=>{t.some((t=>t[n]===r[e]))||(i(r),s.push(r))})),s},asyncLoadScript:t=>new Promise(((e,n)=>{try{const r=document.querySelector(`script[src="${t}"]`);r&&r.remove();const s=document.createElement("script");s.type="text/javascript",s.src=t,"readyState"in s?s.onreadystatechange=function(){"complete"!==s.readyState&&"loaded"!==s.readyState||e(s)}:(s.onload=function(){e(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(s)}catch(r){n(r)}})),loadStyle(t){t.forEach((t=>{const e=document.querySelector(`link[href="${t}"]`);e&&e.remove();const n=document.createElement("link");n.href=t,n.rel="stylesheet",n.type="text/css",n.onerror=function(){g.throwException(`Style loading failed for URL: ${t}`)},document.head.appendChild(n)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,n)=>{const r=e[n];if(void 0!==r)return"function"==typeof r?r(e):r;g.throwException(`${o.DATA_ERROR_JSON}: ${t}`)})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[e]])))},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise(((t,n)=>{try{document.execCommand("copy"),t()}catch(r){n(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>"object"==typeof t&&null!==t,isNil:t=>void 0===t||"undefined"===t||null===t||"null"===t,isNumber:t=>"number"==typeof t&&!isNaN(t)||"string"==typeof t&&Number.isFinite(+t),isInteger:t=>parseInt(t)===t,isFunction(t){return!this.isNil(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)},isElement:t=>"object"==typeof t&&1===t.nodeType,checheVersion:(t,e)=>t.replace(/[^0-9]/gi,"")<e.replace(/[^0-9]/gi,"")},f={assign(t,...e){let n,r,s,i;for(p.isEmpty(t)&&(t={}),r=0,s=e.length;r<s;r++)for(n in i=e[r],i)i.hasOwnProperty(n)&&(t[n]=i[n]);return t},deepAssign(t,...e){const n=new WeakMap,r=(t,e)=>{if("object"!=typeof e||null===e)return e;if(n.has(e))return n.get(e);let s;s=Array.isArray(e)?Array.isArray(t)?t:[]:"object"!=typeof t||null===t||Array.isArray(t)?{}:t,n.set(e,s);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=r(s[n],e[n]));return s};let s=Object(t);for(const i of e)"object"==typeof i&&null!==i&&(s=r(s,i));return s},clone:t=>JSON.parse(JSON.stringify(t)),deepClone(t,e){return this.assign(t,e),Object.setPrototypeOf(t.__proto__,e.__proto__),t},isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse(t){if(p.isEmpty(t))return{};if(p.isObject(t))return t;try{return JSON.parse(t)}catch{g.throwException(o.DATA_ERROR_JSON+" -> "+t)}}},m={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",createCircle(t,e={}){const n=e.lineWidth||1,r=N.createCanvas(2*t,2*t),s=r.getContext("2d");return s.beginPath(),s.fillStyle=e.fillColor||"#f00",s.strokeStyle=e.color||"#f00",s.lineWidth=n,s.arc(t,t,t,0,2*Math.PI),s.stroke(),s.fill(),r.toDataURL("image/png")},createRectangle(t,e,n={}){const r=n.lineWidth||1,s=N.createCanvas(t,e),i=s.getContext("2d");return i.fillStyle=n.fillColor||"#f00",i.strokeStyle=n.color||"#f00",i.lineWidth=r,i.beginPath(),i.stroke(),i.fillRect(0,0,t,e),s.toDataURL("image/png")},getBase64(t){let e,n;if(t instanceof HTMLCanvasElement)n=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const r=e.getContext("2d");t instanceof ImageData?r.putImageData(t,0,0):t instanceof Image&&r.drawImage(t,0,0,t.width,t.height),n=e}return n.width>2048||n.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")},getBase64FromUrl(t){return new Promise(((e,n)=>{let r=new Image;r.setAttribute("crossOrigin","Anonymous"),r.src=t,r.onload=()=>{let t=this.getBase64(r);e(t)},r.onerror=n}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);if(e&&e.groups)return{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data};g.throwException("parseBase64: Invalid base64 string")},async copyImage(t){try{const e=await this.getBase64FromUrl(t),n=this.parseBase64(e);if(!n)throw new Error("Failed to parse base64 data.");let r=n.type,s=atob(n.data),i=new ArrayBuffer(s.length),o=new Uint8Array(i);for(let t=0;t<s.length;t++)o[t]=s.charCodeAt(t);let a=new Blob([i],{type:r});await navigator.clipboard.write([new ClipboardItem({[r]:a})])}catch(e){g.throwException("Failed to copy image to clipboard:")}}},E={jsonp(t,e){const n="_jsonp_"+p.guid(),r=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+n:t+="?callback="+n;let s=document.createElement("script");s.type="text/javascript",s.src=t,window[n]=function(t){e(null,t),r.removeChild(s),s=null,delete window[n]},r.appendChild(s)},get(t,e={},n){if(p.isFunction(e)){const t=n;n=e,e=t}const r=this._getClient(n);if(r.open("GET",t,!0),e){for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);r.withCredentials="include"===e.credentials,e.responseType&&(r.responseType=e.responseType)}return r.send(null),r},post(t,e={},n){let r;if("string"!=typeof t?(n=e.cb,r=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(n=e,e={}),r=e.postData),!n)throw new Error("Callback function is required");const s=this._getClient(n);return s.open("POST",t,!0),e.headers=e.headers||{},e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.keys(e.headers).forEach((t=>{s.setRequestHeader(t,e.headers[t])})),"string"!=typeof r&&(r=JSON.stringify(r)),s.send(r),s},_wrapCallback:(t,e)=>function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e(new Error("http status 200 returned without content.")):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e(new Error(t.statusText+","+t.status))},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch(n){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,n){if(p.isFunction(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,n)},getImage(t,e,n){return this.getArrayBuffer(e,n,((e,n)=>{if(e)t.onerror&&t.onerror(e);else if(n){const e=window.URL||window.webkitURL,r=t.onload;t.onload=()=>{r&&r(),e.revokeObjectURL(t.src)};const s=new Blob([new Uint8Array(n.data)],{type:n.contentType});t.cacheControl=n.cacheControl,t.expires=n.expires,t.src=n.data.byteLength?e.createObjectURL(s):m.emptyImageUrl}}))},getJSON(t,e={},n){if(p.isFunction(e)){const t=n;n=e,e=t}const r=function(t,e){const r=e?f.parse(e):null;n&&n(t,r)};return e&&e.jsonp?this.jsonp(t,r):this.get(t,e,r)}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:(t,e)=>t+Math.floor(Math.random()*(e-t+1)),randFloat:(t,e)=>t+Math.random()*(e-t),deg2Rad(t){return t*this.DEG2RAD},rad2Deg(t){return t*this.RAD2DEG},round:(t,e=2)=>p.isNumber(t)?Math.round(Number(t)*Math.pow(10,e))/Math.pow(10,e):0,clamp:(t,e,n)=>Math.max(e,Math.min(n,t))};class w{static isLnglat(t,e){return p.isNumber(t)&&p.isNumber(e)&&!!(+e>=-90&&+e<=90&&+t>=-180&&+t<=180)}static distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}static distanceByPoints(t,e){const{lng:n,lat:r}=t,{lng:s,lat:i}=e;let o=Math.cos(r*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-s)*Math.PI/180)+Math.sin(r*Math.PI/180)*Math.sin(i*Math.PI/180);o>1&&(o=1),o<-1&&(o=-1);return 6371e3*Math.acos(o)}static formatLnglat(t,e){let n="";function r(t){const e=Math.floor(t),n=Math.floor(60*(t-e));return`${e}°${n}′${(3600*(t-e)-60*n).toFixed(2)}″`}return this.isLnglat(t,e)?n=r(t)+","+r(e):isNaN(t)?isNaN(e)||(n=r(e)):n=r(t),n}static transformLnglat(t,e){function n(t){let e=/[sw]/i.test(t)?-1:1;const n=t.match(/[\d.]+/g)||[];let r=0;for(let s=0;s<n.length;s++)r+=parseFloat(n[s])/e,e*=60;return r}if(t&&e)return{lng:n(t),lat:n(e)}}static rayCasting(t,e){for(var n=t.x,r=t.y,s=!1,i=0,o=e.length,a=o-1;i<o;a=i,i++){var l=e[i].x,c=e[i].y,h=e[a].x,u=e[a].y;if(l===n&&c===r||h===n&&u===r)return"on";if(c<r&&u>=r||c>=r&&u<r){var d=l+(r-c)*(h-l)/(u-c);if(d===n)return"on";d>n&&(s=!s)}}return s?"in":"out"}static rotatePoint(t,e,n){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}}static calcBearAndDis(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,o=s-n,a=i-r,l=Math.sqrt(o*o+a*a);return{angle:(Math.atan2(a,o)*(180/Math.PI)+360+90)%360,distance:l}}static calcBearAndDisByPoints(t,e){var n=1*t.lat,r=1*t.lng,s=1*e.lat,i=1*e.lng,o=Math.sin((i-r)*this.toRadian)*Math.cos(s*this.toRadian),a=Math.cos(n*this.toRadian)*Math.sin(s*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.cos((i-r)*this.toRadian),l=Math.atan2(o,a)*(180/Math.PI),c=(s-n)*this.toRadian,h=(i-r)*this.toRadian,u=Math.sin(c/2)*Math.sin(c/2)+Math.cos(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.sin(h/2)*Math.sin(h/2),d=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return{angle:l,distance:this.R*d}}static distanceToSegment(t,e,n){const r=t.x,s=t.y,i=e.x,o=e.y,a=n.x,l=n.y,c=(a-i)*(r-i)+(l-o)*(s-o);if(c<=0)return Math.sqrt((r-i)*(r-i)+(s-o)*(s-o));const h=(a-i)*(a-i)+(l-o)*(l-o);if(c>=h)return Math.sqrt((r-a)*(r-a)+(s-l)*(s-l));const u=c/h,d=i+(a-i)*u,g=o+(l-o)*u;return Math.sqrt((r-d)*(r-d)+(s-g)*(s-g))}static calcPointByBearAndDis(t,e,n){const r=y.deg2Rad(1*t.lat),s=y.deg2Rad(1*t.lng),i=n/this.R;e=y.deg2Rad(e);const o=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),a=s+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(o));return{lat:y.rad2Deg(o),lng:y.rad2Deg(a)}}static mercatorTolonlat(t,e){const n=this.R_EQU;return{lng:t/n*(180/Math.PI),lat:Math.atan(Math.exp(e/n))*(180/Math.PI)*2-90}}static lonlatToMercator(t,e){var n=this.R_EQU;const r=t*Math.PI/180*n;var s=e*Math.PI/180;return{x:r,y:n/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))}}static interpolate({x:t,y:e,z:n=0},{x:r,y:s,z:i=0},o){return{x:t+(r-t)*o,y:e+(s-e)*o,z:n+(i-n)*o}}static getTraingleArea(t,e,n){let r=0;const s=[];if(s[0]=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow((t.z||0)-(e.z||0),2)),s[1]=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)+Math.pow((t.z||0)-(n.z||0),2)),s[2]=Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2)+Math.pow((n.z||0)-(e.z||0),2)),s[0]+s[1]<=s[2]||s[0]+s[2]<=s[1]||s[1]+s[2]<=s[0])return r;const i=(s[0]+s[1]+s[2])/2;return r=Math.sqrt(i*(i-s[0])*(i-s[1])*(i-s[2])),r}}s(w,"toRadian",Math.PI/180),s(w,"R",6371393),s(w,"R_EQU",6378137);const R={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class M{constructor(t,e,n,r){s(this,"_r"),s(this,"_g"),s(this,"_b"),s(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this._alpha=y.clamp(r||1,0,1)}_validateColorChannel(t){(t<0||t>255)&&g.throwException("Color channel must be between 0 and 255.")}toString(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}toJson(){return{r:this._r,g:this._g,b:this._b,a:this._alpha}}get rgba(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}get hex(){return M.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=y.clamp(t,0,1),this}setRgb(t,e,n){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this}static fromRgba(t){const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);if(!e)throw new Error("Invalid RGBA color value");const n=parseInt(e[1],10),r=parseInt(e[2],10),s=parseInt(e[3],10),i=e[5]?parseFloat(e[5]):1;return new M(n,r,s,i)}static fromHex(t,e=1){const n=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,n,r)=>e+e+n+n+r+r)),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!r)throw new Error("Invalid HEX color value");const s=parseInt(r[1],16),i=parseInt(r[2],16),o=parseInt(r[3],16);return new M(s,i,o,e)}static fromHsl(t){const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)throw new Error("Invalid HSL color value");const n=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function o(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}let a,l,c;if(0===r)a=l=c=s;else{const t=s<.5?s*(1+r):s+r-s*r,e=2*s-t;a=o(e,t,n+1/3),l=o(e,t,n),c=o(e,t,n-1/3)}return new M(Math.round(255*a),Math.round(255*l),Math.round(255*c),i)}static fromName(t){const e=R[t];return e||g.throwException(`Invalid color name: ${t}`),new M(e[0],e[1],e[2],e.length>3?e[3]:1)}static from(t){return this.isRgb(t)?this.fromRgba(t):this.isHex(t)?this.fromHex(t):this.isHsl(t)?this.fromHsl(t):Object.keys(R).map((t=>t.toString())).includes(t)?this.fromName(t):g.throwException("Invalid color value")}static rgb2hex(t,e,n,r){var s="#"+((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1);if(void 0!==r){return s+Math.round(255*r).toString(16).padStart(2,"0")}return s}static isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static isRgb(t){return/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(t)}static isHsl(t){return/^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(t)}static isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)}static random(){let t=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),n=Math.floor(256*Math.random()),r=Math.random();return new M(t,e,n,r)}}const A=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],S={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let n=0,r=A.length;n<r;n++)if(A[n]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[4]&&e!==A[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[2]&&e!==A[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[0]&&e!==A[1])},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates:t=>t.geometry?t.geometry.coordinates:[],getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const r=t.geometry.coordinates;if(!r)return null;let s=0,i=0,o=0;switch(n){case"Point":s=r[0],i=r[1],o++;break;case"MultiPoint":case"LineString":for(let t=0,e=r.length;t<e;t++)s+=r[t][0],i+=r[t][1],o++;break;case"MultiLineString":case"Polygon":for(let t=0,e=r.length;t<e;t++)for(let n=0,a=r[t].length;n<a;n++)s+=r[t][n][0],i+=r[t][n][1],o++;break;case"MultiPolygon":for(let t=0,e=r.length;t<e;t++)for(let n=0,a=r[t].length;n<a;n++)for(let e=0,l=r[t][n].length;e<l;e++)s+=r[t][n][e][0],i+=r[t][n][e][1],o++}const a=s/o,l=i/o;return e?(e.x=a,e.y=l,e):{x:a,y:l}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},s=n.coordinates;if(!s)return null;const i=[];let o;switch(e){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}if(o)for(let a=0,l=s.length;a<l;a++)i.push({type:"Feature",geometry:{type:o,coordinates:s[a]},properties:r});else i.push(t);return i},getGeoJsonByCoordinates(t){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let e;if(2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])e="Point";else if(Array.isArray(t[0])&&2===t[0].length)e="LineString";else{if(!Array.isArray(t[0])||!Array.isArray(t[0][0]))throw Error("coordinates 参数格式错误");{const n=t[0];if(n[0].join(",")===n[n.length-1].join(","))e="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");e="MultiPolygon"}}}return{type:"Feature",geometry:{type:e,coordinates:t}}}},_={assertEmpty(...t){t.forEach((t=>{p.isEmpty(t)&&g.throwEmptyException(t)}))},assertInteger(...t){t.forEach((t=>{p.isInteger(t)||g.throwIntegerException(t)}))},assertNumber(...t){t.forEach((t=>{p.isNumber(t)||g.throwNumberException(t)}))},assertArray(...t){t.forEach((t=>{p.isArray(t)||g.throwArrayException(t)}))},assertFunction(...t){t.forEach((t=>{p.isFunction(t)||g.throwFunctionException(t)}))},assertColor(...t){t.forEach((t=>{M.isColor(t)||g.throwColorException(t)}))},assertLnglat(...t){t.forEach((t=>{w.isLnglat(t.lng,t.lat)||g.throwCoordinateException(JSON.stringify(t))}))},assertGeoJson(...t){t.forEach((t=>{S.isGeoJson(t)||g.throwGeoJsonException(t)}))},assertContain(t,...e){let n=!1;for(let r=0,s=e.length||0;r<s;r++)n=t.indexOf(e[r])>=0;if(n)throw Error(o.STRING_CHECK_LOSS+" -> "+t)},assertStartWith(t,e){if(!t.startsWith(e))throw Error("字符串"+t+"开头不是 -> "+e)},assertEndWith(t,e){if(!t.endsWith(e))throw Error("字符串"+t+"结尾不是 -> "+e)}},b=Object.create(Array);b.prototype.groupBy=function(t){var e={};return this.forEach((function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)})),Object.keys(e).map((t=>e[t]))},b.prototype.distinct=function(t=t=>t){const e=[],n={};return this.forEach((r=>{const s=t(r),i=String(s);n[i]||(n[i]=!0,e.push(r))})),e},b.prototype.max=function(){return Math.max.apply({},this)},b.prototype.min=function(){return Math.min.apply({},this)},b.prototype.sum=function(){return this.length>0?this.reduce(((t=0,e=0)=>t+e)):0},b.prototype.avg=function(){return this.length?this.sum()/this.length:0},b.prototype.desc=function(t=t=>t){return this.sort(((e,n)=>t(n)-t(e)))},b.prototype.asc=function(t=t=>t){return this.sort(((e,n)=>t(e)-t(n)))},b.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},b.prototype.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this};const x={create:t=>[...new Array(t).keys()],union(...t){let e=[];return t.forEach((t=>{Array.isArray(t)&&(e=e.concat(t.filter((t=>!e.includes(t)))))})),e},intersection(...t){let e=t[0]||[];return t.forEach((t=>{Array.isArray(t)&&(e=e.filter((e=>t.includes(e))))})),e},unionAll:(...t)=>[...t].flat().filter((t=>!!t)),difference(...t){return 0===t.length?[]:this.union(...t).filter((e=>!this.intersection(...t).includes(e)))},zhSort:(t,e=t=>t,n)=>(t.sort((function(t,r){return n?e(t).localeCompare(e(r),"zh"):e(r).localeCompare(e(t),"zh")})),t)};class C{static getSystem(){var t,e,n,r,s,i,o,a,l;const c=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let h="",u="";if(c.includes("Android")||c.includes("Adr"))h="Android",u=(null==(e=c.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(c.includes("CrOS"))h="Chromium OS",u=(null==(n=c.match(/MSIE ([\d.]+)/))?void 0:n[1])||(null==(r=c.match(/rv:([\d.]+)/))?void 0:r[1])||"";else if(c.includes("Linux")||c.includes("X11"))h="Linux",u=(null==(s=c.match(/Linux ([\d.]+)/))?void 0:s[1])||"";else if(c.includes("Ubuntu"))h="Ubuntu",u=(null==(i=c.match(/Ubuntu ([\d.]+)/))?void 0:i[1])||"";else if(c.includes("Windows")){let t=(null==(o=c.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:o[1])||"",e={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};h="Windows",u=t in e?e[t]:t}else c.includes("like Mac OS X")?(h="IOS",u=(null==(a=c.match(/OS ([\d_]+) like/))?void 0:a[1].replace(/_/g,"."))||""):c.includes("Macintosh")&&(h="macOS",u=(null==(l=c.match(/Mac OS X -?([\d_]+)/))?void 0:l[1].replace(/_/g,"."))||"");return{type:h,version:u}}static getExplorer(){var t;const e=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let n="",r="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(n="IE",r=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(n="Edge",r=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(n="Chrome",r=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(n="Firefox",r=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(n="Safari",r=t[1])}return{type:n,version:r}}static isSupportWebGL(){if(!(null==this?void 0:this.document))return!1;const t=this.document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");return e&&e instanceof WebGLRenderingContext}static getGPU(){let t="unknown",e="unknown";if(null==this?void 0:this.document){let n=this.document.createElement("canvas"),r=n.getContext("webgl")||n.getContext("experimental-webgl");if(r instanceof WebGLRenderingContext){let n=r.getExtension("WEBGL_debug_renderer_info");if(n){let s=r.getParameter(n.UNMASKED_RENDERER_WEBGL);t=(s.match(/ANGLE \((.+?),/)||[])[1]||"",e=(s.match(/, (.+?) (\(|vs_)/)||[])[1]||""}return{type:t,model:e,spec:{maxTextureSize:r.getParameter(r.MAX_TEXTURE_SIZE),maxRenderBufferSize:r.getParameter(r.MAX_RENDERBUFFER_SIZE),maxTextureUnits:r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)}}}}return{type:t,model:e}}static getLanguage(){var t,e;let n=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof n)return"";let r=n.split("-");return r[1]&&(r[1]=r[1].toUpperCase()),r.join("_")}static getTimeZone(){var t,e;return null==(e=null==(t=null==Intl?void 0:Intl.DateTimeFormat())?void 0:t.resolvedOptions())?void 0:e.timeZone}static async getScreenFPS(){return new Promise((function(t){let e=0,n=1,r=[],s=function(i){if(e>0)if(n<12)r.push(i-e),e=i,n++,requestAnimationFrame(s);else{r.sort(),r=r.slice(1,11);let e=r.reduce(((t,e)=>t+e));const n=10*Math.round(1e4/e/10);t(n)}else e=i,requestAnimationFrame(s)};requestAnimationFrame(s)}))}static async getIPAddress(){const t=/\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/,e=/\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i;let n=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const r=new Set,s=n=>{var s;const i=null==(s=null==n?void 0:n.candidate)?void 0:s.candidate;if(i)for(const o of[t,e]){const t=i.match(o);t&&r.add(t[0])}};return new Promise((function(t,e){const i=new n({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});i.addEventListener("icecandidate",s),i.createDataChannel(""),i.createOffer().then((t=>i.setLocalDescription(t)),e);let o,a=20,l=function(){try{i.removeEventListener("icecandidate",s),i.close()}catch{}o&&clearInterval(o)};o=window.setInterval((function(){let e=[...r];e.length?(l(),t(e[0])):a?a--:(l(),t(""))}),100)}))}static async getNetwork(){var t,e;let n="unknown",r=null==(t=this.navigator)?void 0:t.connection;return r&&(n=r.type||r.effectiveType,"2"!=n&&"unknown"!=n||(n="wifi")),{network:n,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}s(C,"document",null==window?void 0:window.document),s(C,"navigator",null==window?void 0:window.navigator),s(C,"userAgent",null==(n=null==window?void 0:window.navigator)?void 0:n.userAgent),s(C,"screen",null==window?void 0:window.screen);class v{static delta(t,e){const n=6378245,r=.006693421622965943;let s=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const o=t/180*this.PI;let a=Math.sin(o);a=1-r*a*a;const l=Math.sqrt(a);return s=180*s/(n*(1-r)/(a*l)*this.PI),i=180*i/(n/l*Math.cos(o)*this.PI),{lat:s,lng:i}}static outOfChina(t,e){return t<72.004||t>137.8347||(e<.8293||e>55.8271)}static gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}}static gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}}static gcjDecryptExact(t,e){let n=.01,r=.01,s=t-n,i=e-r,o=t+n,a=e+r,l=0,c=0,h=0;for(;;){l=(s+o)/2,c=(i+a)/2;const u=this.gcjEncrypt(l,c);if(n=u.lat-t,r=u.lng-e,Math.abs(n)<1e-9&&Math.abs(r)<1e-9)break;if(n>0?o=l:s=l,r>0?a=c:i=c,++h>1e4)break}return{lat:l,lng:c}}static bdEncrypt(t,e){const n=e,r=t,s=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i)+.0065;return{lat:s*Math.sin(i)+.006,lng:o}}static bdDecrypt(t,e){const n=e-.0065,r=t-.006,s=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i);return{lat:s*Math.sin(i),lng:o}}static mercatorEncrypt(t,e){const n=20037508.34*e/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=20037508.34*r/180,{lat:r,lng:n}}static mercatorDecrypt(t,e){const n=e/20037508.34*180;let r=t/20037508.34*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}}static transformLat(t,e){let n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3,n}static transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,n}static random({x:t,y:e},{x:n,y:r}){return{x:Math.random()*(n-t)+t,y:Math.random()*(r-e)+e}}static deCompose(t,e,n){const r=[];if(t instanceof Array&&!(t[0]instanceof Array))e(t);else if(t instanceof Array&&t[0]instanceof Array)for(let s=0;s<t.length;s++){const i=t[s];if(!p.isNil(i))if(i[0]instanceof Array){const t=n?this.deCompose(i,(t=>e(t)),n):this.deCompose(i,(t=>e(t)));r.push(t)}else{const t=n?e.call(n,i):e(i);r.push(t)}}return r}}function T(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}s(v,"PI",3.141592653589793),s(v,"XPI",52.35987755982988);const O={getStyle(t,e){var n;let r=t.style[e];if(!r||"auto"===r){const s=null==(n=document.defaultView)?void 0:n.getComputedStyle(t,null);r=s?s[e]:null,"auto"===r&&(r=null)}return r},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass:t=>((null==t?void 0:t.host)||t).className.toString(),hasClass(t,e){var n;if(null==(n=t.classList)?void 0:n.contains(e))return!0;const r=this.getClass(t);return r.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(r)},addClass(t,e){if(void 0!==t.classList){const n=T(e);for(let e=0,r=n.length;e<r;e++)t.classList.add(n[e])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){if(void 0!==t.classList){T(e).forEach((e=>t.classList.remove(e)))}else this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach((e=>t.classList.add(e))))},parseFromString:t=>(new DOMParser).parseFromString(t,"text/xml").children[0]},I={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),r=new Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);const s=new Uint8Array(r);return new Blob([s],{type:e})},convertBase64ToFile(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/png",i=atob(n[1]),o=new Uint8Array(i.length);for(let a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return new File([o],e,{type:s})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),n=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(n)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)},readFileFromUrl:(t,e)=>new Promise(((n,r)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="blob";const i=e.split(".");try{s.onload=function(){if(this.status>=200&&this.status<300){const t=s.response,o=URL.createObjectURL(t),a=new File([t],e,{type:i[1],lastModified:(new Date).getTime()}),l=new FileReader;l.readAsArrayBuffer(a),l.onload=function(t){var e;URL.revokeObjectURL(o),n(null==(e=t.target)?void 0:e.result)},l.onerror=function(t){r(t)}}},s.onerror=function(t){r(t)}}catch(o){r(o)}s.send()}))};class P{static resetWarned(){this.warned={}}static changeVoice(){this.isMute=!!Number(!this.isMute),localStorage.setItem("mute",Number(this.isMute).toString())}static _call(t,e,n){this.warned[e]||(t(e,n),this.warned[e]=!0)}static msg(t,e,n={}){if(this.isMute)return;const r=p.decodeDict(t,"success","恭喜","error","发生错误","warning","警告","info","友情提示")+":";this.speechSynthesisUtterance.text=r+e,this.speechSynthesisUtterance.lang=n.lang||"zh-CN",this.speechSynthesisUtterance.volume=n.volume||1,this.speechSynthesisUtterance.rate=n.rate||1,this.speechSynthesisUtterance.pitch=n.pitch||1,this.speechSynthesis.speak(this.speechSynthesisUtterance)}static stop(t){this.speechSynthesisUtterance.text=t,this.speechSynthesis.cancel()}static warning(t,e={}){console.warn(`Warning: %c${t}`,"color:#E6A23C;font-weight: bold;"),this.msg("warning",t,e)}static warningOnce(t,e={}){this._call(this.warning.bind(this),t,e)}static info(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.info(`Info: %c${t}`,"color:#909399;font-weight: bold;"),this.msg("info",t,e)}static infoOnce(t,e={}){this._call(this.info.bind(this),t,e)}static error(t,e={}){console.error(`Error: %c${t}`,"color:#F56C6C;font-weight: bold;"),this.msg("error",t,e)}static errorOnce(t,e={}){this._call(this.error.bind(this),t,e)}static success(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.log(`Success: %c${t}`,"color:#67C23A;font-weight: bold;"),this.msg("success",t,e)}static successOnce(t,e={}){this._call(this.success.bind(this),t,e)}}s(P,"warned",{}),s(P,"isMute",!!Number(localStorage.getItem("mute"))||!1),s(P,"speechSynthesis",window.speechSynthesis),s(P,"speechSynthesisUtterance",new SpeechSynthesisUtterance);const L={debounce(t,e,n=!0){let r,s,i=null;const o=()=>{const a=Date.now()-r;a<e&&a>0?i=setTimeout(o,e-a):(i=null,n||(s=t.apply(this,undefined)))};return(...a)=>{r=Date.now();const l=n&&!i;return i||(i=setTimeout(o,e)),l&&(s=t.apply(this,a),i||(a=null)),s}},throttle(t,e,n=1){let r=0,s=null;return(...i)=>{if(1===n){const n=Date.now();n-r>=e&&(t.apply(this,i),r=n)}else 2===n&&(s||(s=setTimeout((()=>{s=null,t.apply(this,i)}),e)))}},memoize(t){const e=new Map;return(...n)=>{const r=JSON.stringify(n);if(e.has(r))return e.get(r);{const s=t.apply(this,n);return e.set(r,s),s}}},recurve(t,e=500,n=5e3){let r=0;setTimeout((()=>{r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))}),e)},once(t){let e=!1;return function(...n){if(!e)return e=!0,t(...n)}}},D={changeCase(t,e){switch(e=e||c.LOWER_CASE){case c.REVERSE_CASE:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case c.UPPER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case c.LOWER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case c.UPPER_CASE:return t.toUpperCase();case c.LOWER_CASE:return t.toLowerCase();default:return t}},getByteLength:t=>t.replace(/[\u0391-\uFFE5]/g,"aa").length,subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var s=Math.floor(n/2);s<t.length;s++){let i=t.substring(e,s);if(i.replace(r,"mm").length>=n)return i}return t},string2Bytes(t){const e=[];let n;const r=t.length;for(let s=0;s<r;s++)n=t.charCodeAt(s),n>=65536&&n<=1114111?(e.push(n>>18&7|240),e.push(n>>12&63|128),e.push(n>>6&63|128),e.push(63&n|128)):n>=2048&&n<=65535?(e.push(n>>12&15|224),e.push(n>>6&63|128),e.push(63&n|128)):n>=128&&n<=2047?(e.push(n>>6&31|192),e.push(63&n|128)):e.push(255&n);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const n=t;for(let r=0;r<n.length;r++){const t=n[r].toString(2),s=t.match(/^1+?(?=0)/);if(s&&8==t.length){const t=s[0].length;let i=n[r].toString(2).slice(7-t);for(let e=1;e<t;e++)i+=n[e+r].toString(2).slice(2);e+=String.fromCharCode(parseInt(i,2)),r+=t-1}else e+=String.fromCharCode(n[r])}return e}},k={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var r=n,s=t[n];e.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}return e.join("&")},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:s}=new URL(t),i=[r,s];let o={};for(let a=0;a<i.length;a++){const t=i[a];if(t){const r=t.replace(/#|\//g,"").split("?");if(r.length>1)for(let t=1;t<r.length;t++){let s;for(;s=n.exec(r[t]);)o[s[1]]=e?decodeURIComponent(s[2]):s[2]}}}return o}},U={isUrl:t=>/^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(t),isExternal:t=>/^(https?:|mailto:|tel:)/.test(t),isPhone:t=>/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t),isTel:t=>/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t),isStrongPwd:t=>/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/.test(t),isEmail:t=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t),isIP:t=>/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(t),isEnglish:t=>/^[a-zA-Z]+$/.test(t),isChinese:t=>/^[\u4E00-\u9FA5]+$/.test(t),isHTML:t=>/<("[^"]*"|'[^']*'|[^'">])*>/.test(t),isXML:t=>/^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$/.test(t),isIDCard:t=>/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t)};class N{constructor(t){if(s(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");this.ctx=e.getContext("2d")}}drawLine({x:t,y:e},{x:n,y:r},s={}){this.ctx.beginPath();const i=s.width||1,o=s.color||"#000";this.ctx.lineWidth=i,this.ctx.strokeStyle=o,this.ctx.moveTo(t,e),this.ctx.lineTo(n,r),this.ctx.stroke()}drawArc({x:t,y:e},n,r,s,i,o,a){o?(this.ctx.fillStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,n,y.deg2Rad(r),y.deg2Rad(s),i),this.ctx.fill()):(this.ctx.strokeStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,n,y.deg2Rad(r),y.deg2Rad(s),i),this.ctx.stroke())}drawImage({x:t,y:e},n){const r=new Image;r.src=n,r.onload=()=>{const n=r.width,s=r.height;if(!this.ctx)throw new Error("Canvas context is null");this.ctx.drawImage(r,t,e,-n/2,-s/2)}}drawText({x:t,y:e},n,r){this.ctx.font=r.font||"10px sans-serif",this.ctx.strokeStyle=r.color||"#000",this.ctx.lineWidth=2,this.ctx.strokeText(n,t,e)}static createCanvas(t=1,e=1){const n=document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n}}class F extends Date{constructor(...t){super(t.length?t:new Date)}format(t="yyyy-MM-dd hh:mm:ss"){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e){const r=new RegExp("("+n+")","g");r.test(t)&&(t=t.replace(r,(t=>(1===t.length?e[n]:("00"+e[n]).substr((""+e[n]).length)).toString())))}return t}addDate(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":default:n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e)}return n}static lastMonth(){return new F((new Date).getFullYear(),(new Date).getMonth(),1)}static thisMonth(){return new F((new Date).getFullYear(),(new Date).getMonth()+1,1)}static nextMonth(){return new F((new Date).getFullYear(),(new Date).getMonth()+2,1)}static lastWeek(){return new F((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay())}static thisWeek(){return new F((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay())}static nextWeek(){return new F((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay())}static lastDay(){return new F((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1)}static thisDay(){return new F((new Date).setHours(0,0,0,0))}static nextDay(){return new F((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1)}static parseDate(t){if("string"==typeof t){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/))&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/))&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null}static formatDateInterval(t,e){const n=new Date(t),r=new Date(e).getTime()-n.getTime(),s=Math.floor(r/864e5),i=r%864e5,o=Math.floor(i/36e5),a=i%36e5,l=Math.floor(a/6e4),c=a%6e4,h=Math.round(c/1e3);let u="";return s>0&&(u+=s+"天"),o>0&&(u+=o+"时"),l>0&&(u+=l+"分"),h>0&&(u+=h+"秒"),0===s&&0===o&&0===l&&0===h&&(u="少于1秒"),u}static formatterCounter(t){const e=function(t){return(t>10?"":"0")+(t||0)},n=t%3600,r=n%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(n/60))}:${e(Math.round(r))}`}static sleep(t){}}class G{constructor(){s(this,"_listeners",{}),s(this,"_mutex",{}),s(this,"_context")}addEventListener(t,e,n,r){this._context=n;const s=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(r&&(s[t]=e),i[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){const t=n.map((t=>t.toString())).indexOf(e.toString());-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);if(void 0!==this._mutex[t.type]){const e=n.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,r=n.length;e<r;e++){const r=n[e];"function"==typeof r&&r.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}on(t,e,n,r){return this.addEventListener.call(this,t,e,n,r)}off(t,e){return this.removeEventListener.call(this,t,e)}}const B=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],q=(()=>{if("undefined"==typeof document)return!1;const t=B[0],e={};for(const n of B){if((null==n?void 0:n[1])in document){for(const[r,s]of n.entries())e[t[r]]=s;return e}}return!1})(),$={change:q.fullscreenchange,error:q.fullscreenerror};let j={request:(t=document.documentElement,e)=>new Promise(((n,r)=>{const s=()=>{j.off("change",s),n()};j.on("change",s);const i=t[q.requestFullscreen](e);i instanceof Promise&&i.then(s).catch(r)})),exit:()=>new Promise(((t,e)=>{if(!j.isFullscreen)return void t();const n=()=>{j.off("change",n),t()};j.on("change",n);const r=document[q.exitFullscreen]();r instanceof Promise&&r.then(n).catch(e)})),toggle:(t,e)=>j.isFullscreen?j.exit():j.request(t,e),onchange(t){j.on("change",t)},onerror(t){j.on("error",t)},on(t,e){const n=$[t];n&&document.addEventListener(n,e,!1)},off(t,e){const n=$[t];n&&document.removeEventListener(n,e,!1)},raw:q};Object.defineProperties(j,{isFullscreen:{get:()=>Boolean(document[q.fullscreenElement])},element:{enumerable:!0,get:()=>document[q.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[q.fullscreenEnabled])}}),q||(j={isEnabled:!1});const W=j;class J extends Map{isEmpty(){return 0===this.size}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}static fromEntries(t=[]){const e=new J;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=f.parse(t);return new J(Object.entries(e))}}const H=class t extends G{constructor(n=`ws://${window.document.domain}:20007/mqtt`,r={}){super(),s(this,"state"),s(this,"url"),s(this,"context"),s(this,"options"),s(this,"client"),s(this,"topics"),s(this,"_timer"),this.context=f.assign(t.defaultContext,r),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:p.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0,rejectUnauthorized:this.context.REJECT_UNAUTHORIZED},this.url=n,this.client=e.connect(this.url,this.options);let o=0;this._timer=setInterval((()=>{o++,this.client.connected||(this.state=3,this.dispatchEvent({type:i.MQTT_ERROR,message:this}),this.client.end()),o>this.context.MQTT_MAX_RETRY&&(clearInterval(this._timer),this._onError())}),this.context.MQTT_TIMEOUTM),this._onConnect(),this._onMessage(),this.state=1,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=2,clearInterval(this._timer),console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:i.MQTT_CONNECT,message:this})})),this.client.on("error",this._onError)}_onError(){g.throwException("链接mqtt失败==>"+this.url),this.state=0,this.client.end()}_onMessage(){this.client.on("message",((t,e)=>{let n=e,r="";e instanceof Uint8Array&&(n=e.toString());try{r=f.parse(n)}catch(s){throw new Error(o.DATA_ERROR_JSON)}this.dispatchEvent({type:i.MQTT_MESSAGE,message:{topic:t,data:r}})}))}sendMsg(t,e){if(this.client.connected)return this.client.publish(t,e,{qos:1,retain:!0}),this;console.error("客户端未连接")}subscribe(t){return 2===this.state?this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=x.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(i.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=x.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=x.difference(this.topics,t),console.log(`取消订阅成功==>${t}`))})),this}unsubscribeAll(){return this.unsubscribe(this.topics),this}unconnect(){this.client.end(),this.client=null,this.dispatchEvent({type:i.MQTT_CLOSE,message:{}}),console.log("断开mqtt成功==>"+this.url)}};s(H,"defaultContext",{MQTT_TIMEOUTM:2e3,MQTT_MAX_RETRY:3,REJECT_UNAUTHORIZED:!0});let z=H;const Y=class t{static setLocal(t,e=null,n={}){var r=this._getPrefixedKey(t,n);try{const{expires:t}=n,s={data:e};t&&(s.expires=t),window.localStorage.setItem(r,JSON.stringify(s))}catch(s){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static setSession(t,e=null,n={}){var r=this._getPrefixedKey(t,n);try{const{expires:t}=n,s={data:e};t&&(s.expires=t),window.sessionStorage.setItem(r,JSON.stringify(s))}catch(s){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static getLocal(t,e,n){var r,s=this._getPrefixedKey(t,n);try{r=JSON.parse(window.localStorage.getItem(s)||"")}catch(i){r=window.localStorage[s]?{data:window.localStorage.getItem(s)}:null}if(!r)return e;if("object"==typeof r&&void 0!==r.data){const t=r.expires;return t&&Date.now()>t?e:r.data}}static getSession(t,e,n){var r,s=this._getPrefixedKey(t,n);try{r=JSON.parse(window.sessionStorage.getItem(s)||"")}catch(i){r=window.sessionStorage[s]?{data:window.sessionStorage.getItem(s)}:null}if(!r)return e;if("object"==typeof r&&void 0!==r.data){const t=r.expires;return t&&Date.now()>t?e:r.data}}static localkeys(){const e=[];var n=Object.keys(window.localStorage);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static sessionkeys(){const e=[];var n=Object.keys(window.sessionStorage);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static getAllLocal(e){var n=t.localkeys();if(e){const r=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.getLocal(n,null,null),r.push(e)}})),r}return n.map((e=>t.getLocal(e,null,null)))}static getAllSession(e){var n=t.sessionkeys();if(e){const r=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.getSession(n,null,null),r.push(e)}})),r}return n.map((e=>t.getSession(e,null,null)))}static remove(t,e){var n=this._getPrefixedKey(t,e);window.sessionStorage.removeItem(n),window.localStorage.removeItem(n)}static clearLocal(e){t.prefix.length?this.localkeys().forEach((t=>{window.localStorage.removeItem(this._getPrefixedKey(t,e))})):window.localStorage.clear()}static clearSession(e){t.prefix.length?this.sessionkeys().forEach((t=>{window.sessionStorage.removeItem(this._getPrefixedKey(t,e))})):window.sessionStorage.clear()}};s(Y,"prefix",""),s(Y,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:Y.prefix+t}));let K=Y;t.AjaxUtil=E,t.ArrayUtil=x,t.AssertUtil=_,t.AudioPlayer=class{constructor(t){s(this,"audio"),this.audio=new Audio,this.audio.src=t}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(t){this.audio.muted=t}},t.BrowserUtil=C,t.CanvasDrawer=N,t.CaseType=c,t.Color=M,t.Cookie=class{static set(t,e,n=30){"string"==typeof t&&"number"==typeof n||g.throwException("Invalid arguments");const r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3),document.cookie=`${t}=${encodeURIComponent(e)};expires=${r.toUTCString()}`}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=v,t.DateTime=F,t.DomUtil=O,t.ErrorType=o,t.EventDispatcher=G,t.EventType=i,t.ExceptionUtil=g,t.FileUtil=I,t.FormType=l,t.FullScreen=W,t.GeoJsonUtil=S,t.GeoUtil=w,t.GraphicType=h,t.HashMap=J,t.ImageUtil=m,t.LayerType=a,t.LineSymbol=u,t.MathUtil=y,t.MeasureMode=d,t.MessageUtil=P,t.MqttClient=z,t.ObjectUtil=f,t.OptimizeUtil=L,t.Storage=K,t.StringUtil=D,t.UrlUtil=k,t.Util=p,t.ValidateUtil=U,t.WebGL=class{constructor(t){if(s(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");if(this.ctx=e.getContext("webgl"),!this.ctx)throw new Error("WebGL cannot be initialized. Your browser may not support WebGL")}}initShaders(t,e,n){var r=this.createProgram(t,e,n);return r?(t.useProgram(r),!0):(console.log("Failed to create program"),!1)}createProgram(t,e,n){var r=this.loadShader(t,t.VERTEX_SHADER,e),s=this.loadShader(t,t.FRAGMENT_SHADER,n);if(!r||!s)return null;var i=t.createProgram();if(!i)return null;if(t.attachShader(i,r),t.attachShader(i,s),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)){var o=t.getProgramInfoLog(i);return console.log("Failed to link program: "+o),t.deleteProgram(i),t.deleteShader(s),t.deleteShader(r),null}return i}loadShader(t,e,n){var r=t.createShader(e);if(null==r)return console.log("unable to create shader"),null;if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var s=t.getShaderInfoLog(r);return g.throwException("Failed to compile shader: "+s),t.deleteShader(r),null}return r}},t.WebSocketClient=class extends G{constructor(t="ws://127.0.0.1:10088"){super(),s(this,"maxCheckTimes",10),s(this,"url"),s(this,"checkTimes",0),s(this,"connectStatus",!1),s(this,"client",null),this.maxCheckTimes=10,this.url=t,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{const t=this;console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client&&(this.client.onopen=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:i.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:i.WEB_SOCKET_ERROR,message:e})}))}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}connCheckStatus(t){this.checkTimes>t||setTimeout((()=>{this.checkTimes++,this.state!==WebSocket.CONNECTING&&this.state!==WebSocket.OPEN&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&this.state===WebSocket.OPEN?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),this)}heartbeat(){setTimeout((()=>{this.state===WebSocket.OPEN&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}get state(){var t;return null==(t=this.client)?void 0:t.readyState}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
package/dist/types.d.ts CHANGED
@@ -1,66 +1,66 @@
1
- export type Coordinate = {
1
+ export interface Coordinate {
2
2
  x: number;
3
3
  y: number;
4
4
  z?: number;
5
- };
6
- export type LngLat = {
5
+ }
6
+ export interface LngLat {
7
7
  lng: number;
8
8
  lat: number;
9
9
  alt?: number;
10
- };
11
- export type GeoJSONPoint = {
10
+ }
11
+ export interface GeoJSONPoint {
12
12
  type: 'Point';
13
13
  coordinates: Array<number>;
14
- };
15
- export type GeoJSONMultiPoint = {
14
+ }
15
+ export interface GeoJSONMultiPoint {
16
16
  type: 'MultiPoint';
17
17
  coordinates: Array<Array<number>>;
18
- };
19
- export type GeoJSONLineString = {
18
+ }
19
+ export interface GeoJSONLineString {
20
20
  type: 'LineString';
21
21
  coordinates: Array<Array<number>>;
22
- };
23
- export type GeoJSONMultiLineString = {
22
+ }
23
+ export interface GeoJSONMultiLineString {
24
24
  type: 'MultiLineString';
25
25
  coordinates: Array<Array<Array<number>>>;
26
- };
27
- export type GeoJSONPolygon = {
26
+ }
27
+ export interface GeoJSONPolygon {
28
28
  type: 'Polygon';
29
29
  coordinates: Array<Array<Array<number>>>;
30
- };
31
- export type GeoJSONMultiPolygon = {
30
+ }
31
+ export interface GeoJSONMultiPolygon {
32
32
  type: 'MultiPolygon';
33
33
  coordinates: Array<Array<Array<Array<number>>>>;
34
- };
35
- export type GeoJSONLineStringFeature = {
34
+ }
35
+ export interface GeoJSONLineStringFeature {
36
36
  type: 'Feature';
37
37
  geometry: GeoJSONLineString;
38
- properties: any;
39
- };
40
- export type GeoJSONMultiStringLineFeature = {
38
+ properties: Record<string, any>;
39
+ }
40
+ export interface GeoJSONMultiStringLineFeature {
41
41
  type: 'Feature';
42
42
  geometry: GeoJSONMultiLineString;
43
- properties: any;
44
- };
45
- export type GeoJSONPolygonFeature = {
43
+ properties: Record<string, any>;
44
+ }
45
+ export interface GeoJSONPolygonFeature {
46
46
  type: 'Feature';
47
47
  geometry: GeoJSONPolygon;
48
- properties: any;
49
- };
50
- export type GeoJSONMultiPolygonFeature = {
48
+ properties: Record<string, any>;
49
+ }
50
+ export interface GeoJSONMultiPolygonFeature {
51
51
  type: 'Feature';
52
52
  geometry: GeoJSONMultiPolygon;
53
- properties: any;
54
- };
55
- export type GeoJSONFeature = {
53
+ properties: Record<string, any>;
54
+ }
55
+ export interface GeoJSONFeature {
56
56
  type: 'Feature';
57
57
  geometry: GeoJSONPoint | GeoJSONMultiPoint | GeoJSONLineString | GeoJSONMultiLineString | GeoJSONPolygon | GeoJSONMultiPolygon;
58
- properties: any;
59
- };
60
- export type GeoJSONCollection = {
58
+ properties: Record<string, any>;
59
+ }
60
+ export interface GeoJSONCollection {
61
61
  type: 'FeatureCollection';
62
62
  features: GeoJSONFeature[];
63
- };
63
+ }
64
64
  export interface DispatcherEvent {
65
65
  type: string;
66
66
  message: Record<string, any>;
@@ -73,13 +73,13 @@ export interface ColorRGBA {
73
73
  b: number;
74
74
  a?: number;
75
75
  }
76
- export type MqttClientContext = {
76
+ export interface MqttClientContext {
77
77
  MQTT_USERNAME: string;
78
78
  MQTT_PASSWORD: string;
79
79
  MQTT_TIMEOUTM: number;
80
80
  MQTT_MAX_RETRY: number;
81
81
  REJECT_UNAUTHORIZED: boolean;
82
- };
82
+ }
83
83
  export interface CanvasStyle {
84
84
  color: string;
85
85
  fillColor: string;
@@ -3,7 +3,6 @@ export { default as AssertUtil } from './AssertUtil';
3
3
  export { default as ArrayUtil } from './ArrayUtil';
4
4
  export { default as BrowserUtil } from './BrowserUtil';
5
5
  export { default as CoordsUtil } from './CoordsUtil';
6
- export { default as DateUtil } from './DateUtil';
7
6
  export { default as DomUtil } from './DomUtil';
8
7
  export { default as ExceptionUtil } from './ExceptionUtil';
9
8
  export { default as GeoJsonUtil } from './GeoJsonUtil';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gis-common",
3
- "version": "5.0.5",
3
+ "version": "5.1.1",
4
4
  "author": "Guo.Yan <luv02@vip.qq.com>",
5
5
  "license": "MIT",
6
6
  "private": false,