gis-common 4.2.17 → 4.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gis-common.es.js +14 -23
- package/dist/gis-common.umd.js +1 -1
- package/dist/utils/MessageUtil.d.ts +1 -1
- package/package.json +1 -1
package/dist/gis-common.es.js
CHANGED
|
@@ -2751,7 +2751,7 @@ const FileUtil = {
|
|
|
2751
2751
|
window.URL.revokeObjectURL(link.href);
|
|
2752
2752
|
}
|
|
2753
2753
|
};
|
|
2754
|
-
class
|
|
2754
|
+
class MessageUtil {
|
|
2755
2755
|
static resetWarned() {
|
|
2756
2756
|
this.warned = {};
|
|
2757
2757
|
}
|
|
@@ -2762,15 +2762,6 @@ class GlobalMsg {
|
|
|
2762
2762
|
static _call(method, message) {
|
|
2763
2763
|
if (!this.warned[message]) {
|
|
2764
2764
|
method(message);
|
|
2765
|
-
if (method instanceof this.warning) {
|
|
2766
|
-
this.msg("warning", message);
|
|
2767
|
-
} else if (method instanceof this.info) {
|
|
2768
|
-
this.msg("info", message);
|
|
2769
|
-
} else if (method instanceof this.error) {
|
|
2770
|
-
this.msg("error", message);
|
|
2771
|
-
} else if (method instanceof this.success) {
|
|
2772
|
-
this.msg("success", message);
|
|
2773
|
-
}
|
|
2774
2765
|
this.warned[message] = true;
|
|
2775
2766
|
}
|
|
2776
2767
|
}
|
|
@@ -2798,46 +2789,46 @@ class GlobalMsg {
|
|
|
2798
2789
|
this.speechSynthesis.cancel();
|
|
2799
2790
|
}
|
|
2800
2791
|
static warning(message) {
|
|
2801
|
-
if (process.env.NODE_ENV
|
|
2792
|
+
if (process.env.NODE_ENV === "development" && console !== void 0) {
|
|
2802
2793
|
console.warn(`Warning: ${message}`);
|
|
2803
2794
|
}
|
|
2804
2795
|
this.msg("warning", message);
|
|
2805
2796
|
}
|
|
2806
2797
|
static warningOnce(message) {
|
|
2807
|
-
this._call(this.warning, message);
|
|
2798
|
+
this._call(this.warning.bind(this), message);
|
|
2808
2799
|
}
|
|
2809
2800
|
static info(message) {
|
|
2810
|
-
if (process.env.NODE_ENV
|
|
2801
|
+
if (process.env.NODE_ENV === "development" && console !== void 0) {
|
|
2811
2802
|
console.info(`Info: ${message}`);
|
|
2812
2803
|
}
|
|
2813
2804
|
this.msg("info", message);
|
|
2814
2805
|
}
|
|
2815
2806
|
static infoOnce(message) {
|
|
2816
|
-
this._call(this.info, message);
|
|
2807
|
+
this._call(this.info.bind(this), message);
|
|
2817
2808
|
}
|
|
2818
2809
|
static error(message) {
|
|
2819
|
-
if (process.env.NODE_ENV
|
|
2810
|
+
if (process.env.NODE_ENV === "development" && console !== void 0) {
|
|
2820
2811
|
console.error(`Error: ${message}`);
|
|
2821
2812
|
}
|
|
2822
2813
|
this.msg("error", message);
|
|
2823
2814
|
}
|
|
2824
2815
|
static errorOnce(message) {
|
|
2825
|
-
this._call(this.error, message);
|
|
2816
|
+
this._call(this.error.bind(this), message);
|
|
2826
2817
|
}
|
|
2827
2818
|
static success(message) {
|
|
2828
|
-
if (process.env.NODE_ENV
|
|
2819
|
+
if (process.env.NODE_ENV === "development" && console !== void 0) {
|
|
2829
2820
|
console.log(`Success: ${message}`);
|
|
2830
2821
|
}
|
|
2831
2822
|
this.msg("success", message);
|
|
2832
2823
|
}
|
|
2833
2824
|
static successOnce(message) {
|
|
2834
|
-
this._call(this.success, message);
|
|
2825
|
+
this._call(this.success.bind(this), message);
|
|
2835
2826
|
}
|
|
2836
2827
|
}
|
|
2837
|
-
__publicField(
|
|
2838
|
-
__publicField(
|
|
2839
|
-
__publicField(
|
|
2840
|
-
__publicField(
|
|
2828
|
+
__publicField(MessageUtil, "warned", {});
|
|
2829
|
+
__publicField(MessageUtil, "isMute", !!Number(localStorage.getItem("mute")) || false);
|
|
2830
|
+
__publicField(MessageUtil, "speechSynthesis", window.speechSynthesis);
|
|
2831
|
+
__publicField(MessageUtil, "speechSynthesisUtterance", new SpeechSynthesisUtterance());
|
|
2841
2832
|
const OptimizeUtil = {
|
|
2842
2833
|
/**
|
|
2843
2834
|
* 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。适用于像搜索输入框这种需要用户停止输入后才调用的场景
|
|
@@ -3702,7 +3693,7 @@ export {
|
|
|
3702
3693
|
LineSymbol,
|
|
3703
3694
|
MathUtils as MathUtil,
|
|
3704
3695
|
MeasureMode,
|
|
3705
|
-
|
|
3696
|
+
MessageUtil,
|
|
3706
3697
|
MqttClient,
|
|
3707
3698
|
ObjectState,
|
|
3708
3699
|
ObjectUtil,
|
package/dist/gis-common.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("element-ui"),require("mqtt-browser")):"function"==typeof define&&define.amd?define(["exports","element-ui","mqtt-browser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={},t.elementUi,t.mqttBrowser)}(this,(function(t,e,s){"use strict";var n,r=Object.defineProperty,i=(t,e,s)=>((t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),a=(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))(a||{}),o=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.CROSS_ERROR="跨域访问",t.UNEXIST_RESOURCE="资源不存在",t.TIMEOUT="请求超时",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="处理失败",t.AUTH_VERIFY_ERROR="权限验证失败",t.NO_DATA_FOUND="未找到数据",t.DUPLICATE_INSTANCE="实例为单例模式,不允许重复构建",t.JSON_PARSE_ERROR="JSON解析失败,格式有误",t.JSON_VALUE_ERROR="JSON无此键",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.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t))(o||{}),c=(t=>(t.SUPER_MAP_IMAGES="SuperMapImages",t.SUPER_MAP_DATA="SuperMapData",t.ARC_GIS_MAP_IMAGES="ArcGisMapImages",t.ARC_GIS_MAP_DATA="ArcGisMapData",t.OSGB_LAYER="OSGBLayer",t.S3M_GROUP="S3MGroup",t.TERRAIN_LAYER="TerrainFileLayer",t))(c||{}),l=(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))(l||{}),h=(t=>(t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(h||{}),u=(t=>(t.DISTANCE="distance",t.AREA="area",t.HEIGHT="height",t))(u||{}),d=(t=>(t.ADD="add",t.REMOVE="remove",t.INIT="init",t))(d||{});const g={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((s=>{e.append(s,t[s]instanceof Object?JSON.stringify(t[s]):t[s])})),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 s=t.slice(1,t.length%2==0?t.length-1:t.length);for(let n=0;n<s.length;n+=2){const r=s[n];t[0]===r&&(e=s[n+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let s,n,r,i;for(n=0,r=e.length;n<r;n++)for(s in i=e[n],i)t[s]=i[s];return t},convertToTree2(t,e="id",s="parentId",n="children"){const r=[];function i(a){const o=t.filter((t=>t[s]===a[e])).map((t=>(r.some((s=>s[e]===t[e]))||i(t),t)));o.length>0&&(a[n]=o)}return t.forEach((n=>{t.some((t=>t[s]===n[e]))||(i(n),r.push(n))})),r},asyncLoadScript:t=>new Promise(((e,s)=>{try{const n=document.createElement("script");n.type="text/javascript",n.src=t,"readyState"in n?n.onreadystatechange=function(){"complete"!==n.readyState&&"loaded"!==n.readyState||e(n)}:(n.onload=function(){e(n)},n.onerror=function(){s(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(n)}catch(n){s(n)}})),loadStyle(t){t.forEach((t=>{const e=document.createElement("link");e.href=t,e.rel="stylesheet",e.type="text/css",e.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(e)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,s)=>{const n=e[s];if(void 0===n)throw new Error(`${o.JSON_VALUE_ERROR}: ${t}`);return"function"==typeof n?n(e):n})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[e]])))},deepAssign(t,...e){"object"==typeof t&&null!==t||(t={});for(const s of e)if("object"==typeof s&&null!==s)for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&("object"==typeof s[e]&&null!==s[e]?(t[e]||(t[e]=Array.isArray(s[e])?[]:{}),this.deepAssign(t[e],s[e])):t[e]=s[e]);return t},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise(((t,s)=>{try{document.execCommand("copy"),t()}catch(n){s(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>Object.prototype.toString.call(t).indexOf("Object")>-1,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,"")},p={deepClone:t=>structuredClone(t),isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse:t=>"string"==typeof t&&t.startsWith("{")&&t.endsWith("}")?JSON.parse(t):g.isEmpty(t)?{}:g.isObject(t)?t:void 0},f={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",getURL(t){let e,s;if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)s=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const n=e.getContext("2d");n&&(t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height)),s=e}return s.width>2048||s.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),s.toDataURL("image/jpeg",.6)):s.toDataURL("image/png")},getBase64(t){return new Promise(((e,s)=>{let n=new Image;n.setAttribute("crossOrigin","Anonymous"),n.src=t,n.onload=()=>{let t=this.getURL(n);e(t)},n.onerror=s}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);return e&&e.groups?{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data}:null},async copyImage(t){try{const e=await this.getBase64(t),s=this.parseBase64(e.dataURL);if(!s)throw new Error("Failed to parse base64 data.");let n=s.type,r=atob(s.data),i=new ArrayBuffer(r.length),a=new Uint8Array(i);for(let t=0;t<r.length;t++)a[t]=r.charCodeAt(t);let o=new Blob([i],{type:n});await navigator.clipboard.write([new ClipboardItem({[n]:o})])}catch(e){console.error("Failed to copy image to clipboard:",e)}}},m={jsonp(t,e){const s="_jsonp_"+g.guid(),n=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+s:t+="?callback="+s;let r=document.createElement("script");r.type="text/javascript",r.src=t,window[s]=function(t){e(null,t),n.removeChild(r),r=null,delete window[s]},n.appendChild(r)},get(t,e={},s){if(g.isFunction(e)){const t=s;s=e,e=t}const n=this._getClient(s);if(n.open("GET",t,!0),e){for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);n.withCredentials="include"===e.credentials,e.responseType&&(n.responseType=e.responseType)}return n.send(null),n},post(t,e={},s){let n;if("string"!=typeof t?(s=e.cb,n=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(s=e,e={}),n=e.postData),!s)throw new Error("Callback function is required");const r=this._getClient(s);return r.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=>{r.setRequestHeader(t,e.headers[t])})),"string"!=typeof n&&(n=JSON.stringify(n)),r.send(n),r},_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(s){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,s){if(g.isFunction(e)){const t=s;s=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,s)},getImage(t,e,s){return this.getArrayBuffer(e,s,((e,s)=>{if(e)t.onerror&&t.onerror(e);else if(s){const e=window.URL||window.webkitURL,n=t.onload;t.onload=()=>{n&&n(),e.revokeObjectURL(t.src)};const r=new Blob([new Uint8Array(s.data)],{type:s.contentType});t.cacheControl=s.cacheControl,t.expires=s.expires,t.src=s.data.byteLength?e.createObjectURL(r):f.emptyImageUrl}}))},getJSON(t,e,s){if(g.isFunction(e)){const t=s;s=e,e=t}const n=function(t,e){const n=e?p.parse(e):null;s&&s(t,n)};return e&&e.jsonp?this.jsonp(t,n):this.get(t,e,n)}},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)=>Math.round(t*Math.pow(10,e))/Math.pow(10,e),clamp:(t,e,s)=>Math.max(e,Math.min(s,t))};class E{static isLnglat(t,e){return!isNaN(t)&&!isNaN(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:s,lat:n}=t,{lng:r,lat:i}=e;let a=Math.cos(n*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((s-r)*Math.PI/180)+Math.sin(n*Math.PI/180)*Math.sin(i*Math.PI/180);a>1&&(a=1),a<-1&&(a=-1);return 6371e3*Math.acos(a)}static formatLnglat(t,e){let s="";function n(t){const e=Math.floor(t),s=Math.floor(60*(t-e));return`${e}°${s}′${(3600*(t-e)-60*s).toFixed(2)}″`}return this.isLnglat(t,e)?s=n(t)+","+n(e):isNaN(t)?isNaN(e)||(s=n(e)):s=n(t),s}static transformLnglat(t,e){function s(t){let e=/[sw]/i.test(t)?-1:1;const s=t.match(/[\d.]+/g)||[];let n=0;for(let r=0;r<s.length;r++)n+=parseFloat(s[r])/e,e*=60;return n}if(t&&e)return{lng:s(t),lat:s(e)}}static rayCasting(t,e){for(var s=t.x,n=t.y,r=!1,i=0,a=e.length,o=a-1;i<a;o=i,i++){var c=e[i].x,l=e[i].y,h=e[o].x,u=e[o].y;if(c===s&&l===n||h===s&&u===n)return"on";if(l<n&&u>=n||l>=n&&u<n){var d=c+(n-l)*(h-c)/(u-l);if(d===s)return"on";d>s&&(r=!r)}}return r?"in":"out"}static rotatePoint(t,e,s){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-s)-(t.y-e.y)*Math.sin(Math.PI/180*-s)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-s)+(t.y-e.y)*Math.cos(Math.PI/180*-s)+e.y}}static calcBearAndDis(t,e){const{x:s,y:n}=t,{x:r,y:i}=e,a=r-s,o=i-n,c=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:c}}static calcBearAndDisByPoints(t,e){var s=1*t.lat,n=1*t.lng,r=1*e.lat,i=1*e.lng,a=Math.sin((i-n)*this.toRadian)*Math.cos(r*this.toRadian),o=Math.cos(s*this.toRadian)*Math.sin(r*this.toRadian)-Math.sin(s*this.toRadian)*Math.cos(r*this.toRadian)*Math.cos((i-n)*this.toRadian),c=Math.atan2(a,o)*(180/Math.PI),l=(r-s)*this.toRadian,h=(i-n)*this.toRadian,u=Math.sin(l/2)*Math.sin(l/2)+Math.cos(s*this.toRadian)*Math.cos(r*this.toRadian)*Math.sin(h/2)*Math.sin(h/2),d=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return{angle:c,distance:this.R*d}}static distanceToSegment(t,e,s){const n=t.x,r=t.y,i=e.x,a=e.y,o=s.x,c=s.y,l=(o-i)*(n-i)+(c-a)*(r-a);if(l<=0)return Math.sqrt((n-i)*(n-i)+(r-a)*(r-a));const h=(o-i)*(o-i)+(c-a)*(c-a);if(l>=h)return Math.sqrt((n-o)*(n-o)+(r-c)*(r-c));const u=l/h,d=i+(o-i)*u,g=a+(c-a)*u;return Math.sqrt((n-d)*(n-d)+(r-g)*(r-g))}static calcPointByBearAndDis(t,e,s){const n=y.deg2Rad(1*t.lat),r=y.deg2Rad(1*t.lng),i=s/this.R;e=y.deg2Rad(e);const a=Math.asin(Math.sin(n)*Math.cos(i)+Math.cos(n)*Math.sin(i)*Math.cos(e)),o=r+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(n),Math.cos(i)-Math.sin(n)*Math.sin(a));return{lat:y.rad2Deg(a),lng:y.rad2Deg(o)}}static mercatorTolonlat(t,e){var s=e/20037508.34*180;return{lng:t/20037508.34*180,lat:180/Math.PI*(2*Math.atan(Math.exp(s*Math.PI/180))-Math.PI/2)}}static lonlatToMercator(t,e){var s=6378137;const n=t*Math.PI/180*s;var r=e*Math.PI/180;return{x:n,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}}static interpolate({x:t,y:e,z:s=0},{x:n,y:r,z:i=0},a){return{x:t+(n-t)*a,y:e+(r-e)*a,z:s+(i-s)*a}}}i(E,"toRadian",Math.PI/180),i(E,"R",6371393);const w={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4){case 1:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case 2:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case 3:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag:(t,...e)=>(e=e.map((t=>{switch(g.getDataType(t)){case"Object":return t||"{}";case"Array":return t||"[]";default:return t||""}})),t.reduce(((t,s,n)=>`${t}${e[n-1]}${s}`))),getByteLength:t=>t.replace(/[\u0391-\uFFE5]/g,"aa").length,subStringByte(t,e,s){var n=/[^\x00-\xff]/g;if(t.replace(n,"mm").length<=s)return t;for(var r=Math.floor(s/2);r<t.length;r++){let i=t.substring(e,r);if(i.replace(n,"mm").length>=s)return i}return t},string2Bytes(t){const e=[];let s;const n=t.length;for(let r=0;r<n;r++)s=t.charCodeAt(r),s>=65536&&s<=1114111?(e.push(s>>18&7|240),e.push(s>>12&63|128),e.push(s>>6&63|128),e.push(63&s|128)):s>=2048&&s<=65535?(e.push(s>>12&15|224),e.push(s>>6&63|128),e.push(63&s|128)):s>=128&&s<=2047?(e.push(s>>6&31|192),e.push(63&s|128)):e.push(255&s);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const s=t;for(let n=0;n<s.length;n++){const t=s[n].toString(2),r=t.match(/^1+?(?=0)/);if(r&&8==t.length){const t=r[0].length;let i=s[n].toString(2).slice(7-t);for(let e=1;e<t;e++)i+=s[e+n].toString(2).slice(2);e+=String.fromCharCode(parseInt(i,2)),n+=t-1}else e+=String.fromCharCode(s[n])}return e}},M=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],R={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let s=0,n=M.length;s<n;s++)if(M[s]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==M[4]&&e!==M[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==M[2]&&e!==M[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==M[0]&&e!==M[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 s=this.getGeoJsonType(t);if(!s||!t.geometry)return null;const n=t.geometry.coordinates;if(!n)return null;let r=0,i=0,a=0;switch(s){case"Point":r=n[0],i=n[1],a++;break;case"MultiPoint":case"LineString":for(let t=0,e=n.length;t<e;t++)r+=n[t][0],i+=n[t][1],a++;break;case"MultiLineString":case"Polygon":for(let t=0,e=n.length;t<e;t++)for(let s=0,o=n[t].length;s<o;s++)r+=n[t][s][0],i+=n[t][s][1],a++;break;case"MultiPolygon":for(let t=0,e=n.length;t<e;t++)for(let s=0,o=n[t].length;s<o;s++)for(let e=0,c=n[t][s].length;e<c;e++)r+=n[t][s][e][0],i+=n[t][s][e][1],a++}const o=r/a,c=i/a;return e?(e.x=o,e.y=c,e):{x:o,y:c}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const s=t.geometry,n=t.properties||{},r=s.coordinates;if(!r)return null;const i=[];let a;switch(e){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}if(a)for(let o=0,c=r.length;o<c;o++)i.push({type:"Feature",geometry:{type:a,coordinates:r[o]},properties:n});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 s=t[0];if(s[0].join(",")===s[s.length-1].join(","))e="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");e="MultiPolygon"}}}return{type:"Feature",geometry:{type:e,coordinates:t}}}},A={assertEmpty(...t){t.forEach((t=>{if(g.isEmpty(t))throw Error(o.PARAMETER_ERROR_LACK+" -> "+t)}))},assertInteger(...t){t.forEach((t=>{if(!g.isInteger(t))throw Error(o.PARAMETER_ERROR_INTEGER+" -> "+t)}))},assertNumber(...t){t.forEach((t=>{if(!g.isNumber(t))throw Error(o.PARAMETER_ERROR_NUMBER+" -> "+t)}))},assertArray(...t){t.forEach((t=>{if(!g.isArray(t))throw Error(o.PARAMETER_ERROR_ARRAY+" -> "+t)}))},assertFunction(...t){t.forEach((t=>{if(!g.isFunction(t))throw Error(o.PARAMETER_ERROR_FUNCTION+" -> "+t)}))},assertObject(...t){t.forEach((t=>{if(!g.isObject(t))throw Error(o.PARAMETER_ERROR_OBJECT+" -> "+t)}))},assertColor(...t){t.forEach((t=>{if(!N.isColor(t))throw Error(o.DATA_ERROR_COLOR+" -> "+t)}))},assertLnglat(...t){t.forEach((t=>{if(!E.isLnglat(t.lng,t.lat))throw Error(o.DATA_ERROR_COORDINATE+" -> "+t)}))},assertGeoJson(...t){t.forEach((t=>{if(!R.isGeoJson(t))throw Error(o.DATA_ERROR_GEOJSON+" -> "+t)}))},assertContain(t,...e){let s=!1;for(let n=0,r=e.length||0;n<r;n++)s=t.indexOf(e[n])>=0;if(s)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)},assertLegal(t,e){const s=w.checkStr(t,e);let n="";switch(e){case"phone":n="电话";break;case"tel":n="座机";break;case"card":n="身份证";break;case"pwd":n="密码";break;case"postal":n="邮政编码";break;case"QQ":n="QQ";break;case"email":n="邮箱";break;case"money":n="金额";break;case"URL":n="网址";break;case"IP":n="IP";break;case"date":n="日期时间";break;case"number":n="数字";break;case"english":n="英文";break;case"chinese":n="中文";break;case"lower":n="小写";break;case"upper":n="大写";break;case"HTML":n="HTML标记"}if(!s)throw Error(o.DATA_ERROR+" -> 不是"+n)}},b=Object.create(Array);b.groupBy=function(t){var e={};return this.forEach((function(s){var n=JSON.stringify(t(s));e[n]=e[n]||[],e[n].push(s)})),Object.keys(e).map((t=>e[t]))},b.distinct=function(t=t=>t){const e=[],s={};return this.forEach((n=>{const r=t(n),i=String(r);s[i]||(s[i]=!0,e.push(n))})),e},b.prototype.max=function(){return Math.max.apply({},this)},b.prototype.min=function(){return Math.min.apply({},this)},b.sum=function(){return this.length>0?this.reduce(((t=0,e=0)=>t+e)):0},b.avg=function(){return this.length?this.sum()/this.length:0},b.desc=function(t=t=>t){return this.sort(((e,s)=>t(s)-t(e)))},b.asc=function(t=t=>t){return this.sort(((e,s)=>t(e)-t(s)))},b.random=function(){return this[Math.floor(Math.random()*this.length)]},b.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this};const _={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,s)=>(t.sort((function(t,n){return s?e(t).localeCompare(e(n),"zh"):e(n).localeCompare(e(t),"zh")})),t)};class S{static getSystem(){var t,e,s,n,r,i,a,o,c;const l=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let h="",u="";if(l.includes("Android")||l.includes("Adr"))h="Android",u=(null==(e=l.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(l.includes("CrOS"))h="Chromium OS",u=(null==(s=l.match(/MSIE ([\d.]+)/))?void 0:s[1])||(null==(n=l.match(/rv:([\d.]+)/))?void 0:n[1])||"";else if(l.includes("Linux")||l.includes("X11"))h="Linux",u=(null==(r=l.match(/Linux ([\d.]+)/))?void 0:r[1])||"";else if(l.includes("Ubuntu"))h="Ubuntu",u=(null==(i=l.match(/Ubuntu ([\d.]+)/))?void 0:i[1])||"";else if(l.includes("Windows")){let t=(null==(a=l.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:a[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 l.includes("like Mac OS X")?(h="IOS",u=(null==(o=l.match(/OS ([\d_]+) like/))?void 0:o[1].replace(/_/g,"."))||""):l.includes("Macintosh")&&(h="macOS",u=(null==(c=l.match(/Mac OS X -?([\d_]+)/))?void 0:c[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 s="",n="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(s="IE",n=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(s="Edge",n=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(s="Chrome",n=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(s="Firefox",n=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(s="Safari",n=t[1])}return{type:s,version:n}}static switchFullScreen(t){if(t){const t=document.documentElement;t.requestFullscreen?t.requestFullscreen():"msRequestFullscreen"in t?t.msRequestFullscreen():"mozRequestFullScreen"in t?t.mozRequestFullScreen():"webkitRequestFullscreen"in t&&t.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()}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="",e="";if(null==this?void 0:this.document){let s=this.document.createElement("canvas"),n=s.getContext("webgl")||s.getContext("experimental-webgl");if(n instanceof WebGLRenderingContext){let s=n.getExtension("WEBGL_debug_renderer_info");if(s){let r=n.getParameter(s.UNMASKED_RENDERER_WEBGL);t=(r.match(/ANGLE \((.+?),/)||[])[1]||"",e=(r.match(/, (.+?) (\(|vs_)/)||[])[1]||""}}}return{type:t,model:e}}static getLanguage(){var t,e;let s=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof s)return"";let n=s.split("-");return n[1]&&(n[1]=n[1].toUpperCase()),n.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,s=1,n=[],r=function(i){if(e>0)if(s<12)n.push(i-e),e=i,s++,requestAnimationFrame(r);else{n.sort(),n=n.slice(1,11);let e=n.reduce(((t,e)=>t+e));const s=10*Math.round(1e4/e/10);t(s)}else e=i,requestAnimationFrame(r)};requestAnimationFrame(r)}))}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 s=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const n=new Set,r=s=>{var r;const i=null==(r=null==s?void 0:s.candidate)?void 0:r.candidate;if(i)for(const a of[t,e]){const t=i.match(a);t&&n.add(t[0])}};return new Promise((function(t,e){const i=new s({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});i.addEventListener("icecandidate",r),i.createDataChannel(""),i.createOffer().then((t=>i.setLocalDescription(t)),e);let a,o=20,c=function(){try{i.removeEventListener("icecandidate",r),i.close()}catch{}a&&clearInterval(a)};a=window.setInterval((function(){let e=[...n];e.length?(c(),t(e[0])):o?o--:(c(),t(""))}),100)}))}static async getNetwork(){var t,e;let s="unknown",n=null==(t=this.navigator)?void 0:t.connection;return n&&(s=n.type||n.effectiveType,"2"!=s&&"unknown"!=s||(s="wifi")),{network:s,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}i(S,"document",null==window?void 0:window.document),i(S,"navigator",null==window?void 0:window.navigator),i(S,"userAgent",null==(n=null==window?void 0:window.navigator)?void 0:n.userAgent),i(S,"screen",null==window?void 0:window.screen);class C{static delta(t,e){const s=6378245,n=.006693421622965943;let r=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const a=t/180*this.PI;let o=Math.sin(a);o=1-n*o*o;const c=Math.sqrt(o);return r=180*r/(s*(1-n)/(o*c)*this.PI),i=180*i/(s/c*Math.cos(a)*this.PI),{lat:r,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 s=this.delta(t,e);return{lat:t+s.lat,lng:e+s.lng}}static gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const s=this.delta(t,e);return{lat:t-s.lat,lng:e-s.lng}}static gcjDecryptExact(t,e){let s=.01,n=.01,r=t-s,i=e-n,a=t+s,o=e+n,c=0,l=0,h=0;for(;;){c=(r+a)/2,l=(i+o)/2;const u=this.gcjEncrypt(c,l);if(s=u.lat-t,n=u.lng-e,Math.abs(s)<1e-9&&Math.abs(n)<1e-9)break;if(s>0?a=c:r=c,n>0?o=l:i=l,++h>1e4)break}return{lat:c,lng:l}}static bdEncrypt(t,e){const s=e,n=t,r=Math.sqrt(s*s+n*n)+2e-5*Math.sin(n*this.XPI),i=Math.atan2(n,s)+3e-6*Math.cos(s*this.XPI),a=r*Math.cos(i)+.0065;return{lat:r*Math.sin(i)+.006,lng:a}}static bdDecrypt(t,e){const s=e-.0065,n=t-.006,r=Math.sqrt(s*s+n*n)-2e-5*Math.sin(n*this.XPI),i=Math.atan2(n,s)-3e-6*Math.cos(s*this.XPI),a=r*Math.cos(i);return{lat:r*Math.sin(i),lng:a}}static mercatorEncrypt(t,e){const s=20037508.34*e/180;let n=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return n=20037508.34*n/180,{lat:n,lng:s}}static mercatorDecrypt(t,e){const s=e/20037508.34*180;let n=t/20037508.34*180;return n=180/this.PI*(2*Math.atan(Math.exp(n*this.PI/180))-this.PI/2),{lat:n,lng:s}}static transformLat(t,e){let s=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return s+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,s+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,s+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3,s}static transformLon(t,e){let s=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return s+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,s+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,s+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,s}static random({x:t,y:e},{x:s,y:n}){return{x:Math.random()*(s-t)+t,y:Math.random()*(n-e)+e}}static deCompose(t,e,s){if(!Array.isArray(t))return s?e.call(s,t):e(t);const n=[];let r,i;for(let a=0,o=t.length;a<o;a++)r=t[a],g.isNil(r)?n.push(null):Array.isArray(r)?n.push(this.deCompose(r,e,s)):(i=s?e.call(s,r):e(r),n.push(i));return n}}i(C,"PI",3.141592653589793),i(C,"XPI",52.35987755982988);const v=Object.create(Date);v.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 s in e){const n=new RegExp("("+s+")","g");n.test(t)&&(t=t.replace(n,(t=>(1===t.length?e[s]:("00"+e[s]).substr((""+e[s]).length)).toString())))}return t},v.prototype.addDate=function(t,e){const s=new Date(this);switch(t){case"y":s.setFullYear(this.getFullYear()+e);break;case"q":s.setMonth(this.getMonth()+3*e);break;case"M":s.setMonth(this.getMonth()+e);break;case"w":s.setDate(this.getDate()+7*e);break;case"d":default:s.setDate(this.getDate()+e);break;case"h":s.setHours(this.getHours()+e);break;case"m":s.setMinutes(this.getMinutes()+e);break;case"s":s.setSeconds(this.getSeconds()+e)}return s};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 s=new Date(t),n=new Date(e).getTime()-s.getTime(),r=Math.floor(n/864e5),i=n%864e5,a=Math.floor(i/36e5),o=i%36e5,c=Math.floor(o/6e4),l=o%6e4,h=Math.round(l/1e3);let u="";return r>0&&(u+=r+"天"),a>0&&(u+=a+"时"),c>0&&(u+=c+"分"),h>0&&(u+=h+"秒"),0===r&&0===a&&0===c&&0===h&&(u="少于1秒"),u}static formatterCounter(t){const e=function(t){return(t>10?"":"0")+(t||0)},s=t%3600,n=s%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(s/60))}:${e(Math.round(n))}`}static sleep(t){}}function T(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}i(O,"lastMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()-1,1)),i(O,"thisMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth(),1)),i(O,"nextMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()+1,1)),i(O,"lastWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay())),i(O,"thisWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay())),i(O,"nextWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay())),i(O,"lastDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1)),i(O,"thisDayDate",new Date((new Date).setHours(0,0,0,0))),i(O,"nextDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1));const x={getStyle(t,e){var s;let n=t.style[e];if(!n||"auto"===n){const r=null==(s=document.defaultView)?void 0:s.getComputedStyle(t,null);n=r?r[e]:null,"auto"===n&&(n=null)}return n},create(t,e,s){const n=document.createElement(t);return n.className=e||"",s&&s.appendChild(n),n},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 s;if(null==(s=t.classList)?void 0:s.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(void 0!==t.classList){const s=T(e);for(let e=0,n=s.length;e<n;e++)t.classList.add(s[e])}else if(!this.hasClass(t,e)){const s=this.getClass(t);this.setClass(t,(s?s+" ":"")+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],s=atob(t.split(",")[1]),n=new Array(s.length);for(let i=0;i<s.length;i++)n[i]=s.charCodeAt(i);const r=new Uint8Array(n);return new Blob([r],{type:e})},convertBase64ToFile(t,e){const s=t.split(","),n=s[0].match(/:(.*?);/),r=n?n[1]:"image/png",i=atob(s[1]),a=new Uint8Array(i.length);for(let o=0;o<i.length;o++)a[o]=i.charCodeAt(o);return new File([a],e,{type:r})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),s=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(s)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var s=document.createElement("a");s.href=t,s.download=e||"",s.click(),window.URL.revokeObjectURL(s.href)}};class D{static resetWarned(){this.warned={}}static changeVoice(){this.isMute=!!Number(!this.isMute),localStorage.setItem("mute",Number(this.isMute).toString())}static _call(t,e){this.warned[e]||(t(e),t instanceof this.warning?this.msg("warning",e):t instanceof this.info?this.msg("info",e):t instanceof this.error?this.msg("error",e):t instanceof this.success&&this.msg("success",e),this.warned[e]=!0)}static msg(t,s,n={}){if(e.Message({type:t,message:s}),this.isMute)return;const r=g.decodeDict(t,"success","恭喜:","error","发生错误:","warning","警告:","info","友情提示:")+":";this.speechSynthesisUtterance.text=r+s,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){"development"!==process.env.NODE_ENV&&void 0!==console&&console.warn(`Warning: ${t}`),this.msg("warning",t)}static warningOnce(t){this._call(this.warning,t)}static info(t){"development"!==process.env.NODE_ENV&&void 0!==console&&console.info(`Info: ${t}`),this.msg("info",t)}static infoOnce(t){this._call(this.info,t)}static error(t){"development"!==process.env.NODE_ENV&&void 0!==console&&console.error(`Error: ${t}`),this.msg("error",t)}static errorOnce(t){this._call(this.error,t)}static success(t){"development"!==process.env.NODE_ENV&&void 0!==console&&console.log(`Success: ${t}`),this.msg("success",t)}static successOnce(t){this._call(this.success,t)}}i(D,"warned",{}),i(D,"isMute",!!Number(localStorage.getItem("mute"))||!1),i(D,"speechSynthesis",window.speechSynthesis),i(D,"speechSynthesisUtterance",new SpeechSynthesisUtterance);const P={debounce(t,e,s=!0){let n,r,i=null;const a=()=>{const o=Date.now()-n;o<e&&o>0?i=setTimeout(a,e-o):(i=null,s||(r=t.apply(this,undefined)))};return(...o)=>{n=Date.now();const c=s&&!i;return i||(i=setTimeout(a,e)),c&&(r=t.apply(this,o),i||(o=null)),r}},throttle(t,e,s=1){let n=0,r=null;return(...i)=>{if(1===s){const s=Date.now();s-n>=e&&(t.apply(this,i),n=s)}else 2===s&&(r||(r=setTimeout((()=>{r=null,t.apply(this,i)}),e)))}},memoize(t){const e=new Map;return(...s)=>{const n=JSON.stringify(s);if(e.has(n))return e.get(n);{const r=t.apply(this,s);return e.set(n,r),r}}},recurve(t,e=500,s=5e3){let n=0;setTimeout((()=>{n++,n<Math.floor(s/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,s),e))}),e)},once(t){let e=!1;return function(...s){if(!e)return e=!0,t(...s)}}},L={json2Query(t){var e=[];for(var s in t)if(t.hasOwnProperty(s)){var n=s,r=t[s];e.push(encodeURIComponent(n)+"="+encodeURIComponent(r))}return e.join("&")},query2Json(t=window.location.href,e=!0){const s=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:n,hash:r}=new URL(t),i=[n,r];let a={};for(let o=0;o<i.length;o++){const t=i[o];if(t){const n=t.replace(/#|\//g,"").split("?");if(n.length>1)for(let t=1;t<n.length;t++){let r;for(;r=s.exec(n[t]);)a[r[1]]=e?decodeURIComponent(r[2]):r[2]}}}return a}};class N{constructor(t,e,s,n){i(this,"_r"),i(this,"_g"),i(this,"_b"),i(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(s),this._r=t,this._g=e,this._b=s,this._alpha=y.clamp(n||1,0,1)}_validateColorChannel(t){if(t<0||t>255)throw new Error("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 N.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=y.clamp(t,0,1),this}setRgb(t,e,s){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(s),this._r=t,this._g=e,this._b=s,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 s=parseInt(e[1],10),n=parseInt(e[2],10),r=parseInt(e[3],10),i=e[5]?parseFloat(e[5]):1;return new N(s,n,r,i)}static fromHex(t,e=1){const s=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,s,n)=>e+e+s+s+n+n)),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);if(!n)throw new Error("Invalid HEX color value");const r=parseInt(n[1],16),i=parseInt(n[2],16),a=parseInt(n[3],16);return new N(r,i,a,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 s=parseInt(e[1],10)/360,n=parseInt(e[2],10)/100,r=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function a(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t}let o,c,l;if(0===n)o=c=l=r;else{const t=r<.5?r*(1+n):r+n-r*n,e=2*r-t;o=a(e,t,s+1/3),c=a(e,t,s),l=a(e,t,s-1/3)}return new N(Math.round(255*o),Math.round(255*c),Math.round(255*l),i)}static from(t){if(this.isRgb(t))return this.fromRgba(t);if(this.isHex(t))return this.fromHex(t);if(this.isHsl(t))return this.fromHsl(t);throw new Error("Invalid color value")}static rgb2hex(t,e,s,n){var r="#"+((1<<24)+(t<<16)+(e<<8)+s).toString(16).slice(1);if(void 0!==n){return r+Math.round(255*n).toString(16).padStart(2,"0")}return r}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()),s=Math.floor(256*Math.random()),n=Math.random();return new N(t,e,s,n)}}class U{constructor(){i(this,"_listeners"),i(this,"_mutex",{}),i(this,"_context")}addEventListener(t,e,s,n){void 0===this._listeners&&(this._listeners={}),this._context=s;const r=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(n&&(r[t]=e),i[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const s=this._listeners;return void 0!==s[t]&&-1!==s[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const s=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==s){const t=s.map((t=>t.toString())).indexOf(e.toString());-1!==t&&s.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 s=e.slice(0);if(void 0!==this._mutex[t.type]){const e=s.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,n=s.length;e<n;e++){const n=s[e];"function"==typeof n&&n.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}class k 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 k;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=p.parse(t);return new k(Object.entries(e))}}const F=class t extends U{constructor(e=`ws://${window.document.domain}:20007/mqtt`,n={}){super(),i(this,"state"),i(this,"url"),i(this,"context"),i(this,"options"),i(this,"client"),i(this,"topics"),this.context=g.extend(t.defaultContext,n),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:g.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0},this.url=e,this.client=s.connect(this.url,this.options),this._onConnect(),this._onMessage(),this.state=0,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=1,console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:a.MQTT_CONNECT,message:this})})),this.client.on("error",(t=>{console.log("链接mqtt报错",t),this.state=-1,this.dispatchEvent({type:a.MQTT_ERROR,message:this}),this.client.end(),this.client.reconnect()}))}_onMessage(){this.client.on("message",((t,e)=>{let s=e,n="";e instanceof Uint8Array&&(s=e.toString());try{n=p.parse(s)}catch(r){throw new Error(o.JSON_PARSE_ERROR)}this.dispatchEvent({type:a.MQTT_MESSAGE,message:{topic:t,data:n}})}))}sendMsg(t,e){if(this.client.connected)return this.client.publish(t,e,{qos:1,retain:!0}),this;console.error("客户端未连接")}subscribe(t){return 1===this.state?this.client.subscribe(t,{qos:1},((e,s)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=_.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(a.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,s)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=_.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,s)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=_.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:a.MQTT_CLOSE,message:null}),console.log("断开mqtt成功==>"+this.url)}};i(F,"defaultContext",{MQTT_USERNAME:"iRVMS-WEB",MQTT_PASSWORD:"novasky888",MQTT_TIMEOUTM:2e4});let $=F;const G=class t{static useLocal(){this.store=window.localStorage}static useSession(){this.store=window.sessionStorage}static set(t,e=null,s={}){var n=this._getPrefixedKey(t,s);try{const{expires:t}=s,r={data:e};t&&(r.expires=t),this.store.setItem(n,JSON.stringify(r))}catch(r){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static get(t,e,s){var n,r=this._getPrefixedKey(t,s);try{n=JSON.parse(this.store.getItem(r)||"")}catch(i){n=this.store[r]?{data:this.store.getItem(r)}:null}if(!n)return e;if("object"==typeof n&&void 0!==n.data){const t=n.expires;return t&&Date.now()>t?e:n.data}}static keys(){const e=[];var s=Object.keys(this.store);return 0===t.prefix.length?s:(s.forEach((function(s){-1!==s.indexOf(t.prefix)&&e.push(s.replace(t.prefix,""))})),e)}static getAll(e){var s=t.keys();if(e){const n=[];return s.forEach((s=>{if(e.includes(s)){const e={};e[s]=t.get(s,null,null),n.push(e)}})),n}return s.map((e=>t.get(e,null,null)))}static remove(t,e){var s=this._getPrefixedKey(t,e);this.store.removeItem(s)}static clear(e){t.prefix.length?this.keys().forEach((t=>{this.store.removeItem(this._getPrefixedKey(t,e))})):this.store.clear()}};i(G,"store",window.localStorage),i(G,"prefix",""),i(G,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:G.prefix+t}));let B=G;t.AjaxUtil=m,t.ArrayUtil=_,t.AssertUtil=A,t.AudioPlayer=class{constructor(t){i(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=S,t.CanvasDrawer=class{constructor(t){if(i(this,"context",null),"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.context=e.getContext("2d")}}drawLine({x:t,y:e},{x:s,y:n},r={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const i=r.width||1,a=r.color||"#000";this.context.lineWidth=i,this.context.strokeStyle=a,this.context.moveTo(t,e),this.context.lineTo(s,n),this.context.stroke()}drawArc({x:t,y:e},s,n,r,i,a,o){if(!this.context)throw new Error("Canvas context is null or undefined");a?(this.context.fillStyle=o,this.context.beginPath(),this.context.arc(t,e,s,y.deg2Rad(n),y.deg2Rad(r),i),this.context.fill()):(this.context.strokeStyle=o,this.context.beginPath(),this.context.arc(t,e,s,y.deg2Rad(n),y.deg2Rad(r),i),this.context.stroke())}static createCanvas(t=1,e=1){const s=document.createElement("canvas");return t&&(s.width=t),e&&(s.height=e),s}},t.Color=N,t.Cookie=class{static set(t,e,s=30){if("string"!=typeof t||"string"!=typeof e||"number"!=typeof s)throw new Error("Invalid arguments");const n=new Date;n.setTime(n.getTime()+24*s*60*60*1e3),document.cookie=`${t}=${encodeURIComponent(e)};expires=${n.toUTCString()}`}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var s=this.get(t);null!=s&&(document.cookie=t+"="+s+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=C,t.DateUtil=O,t.DomUtil=x,t.ErrorType=o,t.EventDispatcher=U,t.EventType=a,t.FileUtil=I,t.GeoJsonUtil=R,t.GeoUtil=E,t.GraphicType=l,t.HashMap=k,t.ImageUtil=f,t.LayerType=c,t.LineSymbol=h,t.MathUtil=y,t.MeasureMode=u,t.MessageUtil=D,t.MqttClient=$,t.ObjectState=d,t.ObjectUtil=p,t.OptimizeUtil=P,t.Storage=B,t.StringUtil=w,t.UrlUtil=L,t.Util=g,t.WebSocketClient=class extends U{constructor(t="ws://127.0.0.1:10088"){super(),i(this,"maxCheckTimes",10),i(this,"url"),i(this,"checkTimes",0),i(this,"connectStatus",!1),i(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{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const t=this;this.client.onopen=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:a.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:a.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.client&&0!==this.client.readyState&&1!==this.client.readyState&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&1===this.client.readyState?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),this)}heartbeat(){setTimeout((()=>{this.client&&1===this.client.readyState&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("element-ui"),require("mqtt-browser")):"function"==typeof define&&define.amd?define(["exports","element-ui","mqtt-browser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={},t.elementUi,t.mqttBrowser)}(this,(function(t,e,s){"use strict";var n,r=Object.defineProperty,i=(t,e,s)=>((t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),a=(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))(a||{}),o=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.CROSS_ERROR="跨域访问",t.UNEXIST_RESOURCE="资源不存在",t.TIMEOUT="请求超时",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="处理失败",t.AUTH_VERIFY_ERROR="权限验证失败",t.NO_DATA_FOUND="未找到数据",t.DUPLICATE_INSTANCE="实例为单例模式,不允许重复构建",t.JSON_PARSE_ERROR="JSON解析失败,格式有误",t.JSON_VALUE_ERROR="JSON无此键",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.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t))(o||{}),c=(t=>(t.SUPER_MAP_IMAGES="SuperMapImages",t.SUPER_MAP_DATA="SuperMapData",t.ARC_GIS_MAP_IMAGES="ArcGisMapImages",t.ARC_GIS_MAP_DATA="ArcGisMapData",t.OSGB_LAYER="OSGBLayer",t.S3M_GROUP="S3MGroup",t.TERRAIN_LAYER="TerrainFileLayer",t))(c||{}),l=(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))(l||{}),h=(t=>(t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(h||{}),u=(t=>(t.DISTANCE="distance",t.AREA="area",t.HEIGHT="height",t))(u||{}),d=(t=>(t.ADD="add",t.REMOVE="remove",t.INIT="init",t))(d||{});const g={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((s=>{e.append(s,t[s]instanceof Object?JSON.stringify(t[s]):t[s])})),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 s=t.slice(1,t.length%2==0?t.length-1:t.length);for(let n=0;n<s.length;n+=2){const r=s[n];t[0]===r&&(e=s[n+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let s,n,r,i;for(n=0,r=e.length;n<r;n++)for(s in i=e[n],i)t[s]=i[s];return t},convertToTree2(t,e="id",s="parentId",n="children"){const r=[];function i(a){const o=t.filter((t=>t[s]===a[e])).map((t=>(r.some((s=>s[e]===t[e]))||i(t),t)));o.length>0&&(a[n]=o)}return t.forEach((n=>{t.some((t=>t[s]===n[e]))||(i(n),r.push(n))})),r},asyncLoadScript:t=>new Promise(((e,s)=>{try{const n=document.createElement("script");n.type="text/javascript",n.src=t,"readyState"in n?n.onreadystatechange=function(){"complete"!==n.readyState&&"loaded"!==n.readyState||e(n)}:(n.onload=function(){e(n)},n.onerror=function(){s(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(n)}catch(n){s(n)}})),loadStyle(t){t.forEach((t=>{const e=document.createElement("link");e.href=t,e.rel="stylesheet",e.type="text/css",e.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(e)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,s)=>{const n=e[s];if(void 0===n)throw new Error(`${o.JSON_VALUE_ERROR}: ${t}`);return"function"==typeof n?n(e):n})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[e]])))},deepAssign(t,...e){"object"==typeof t&&null!==t||(t={});for(const s of e)if("object"==typeof s&&null!==s)for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&("object"==typeof s[e]&&null!==s[e]?(t[e]||(t[e]=Array.isArray(s[e])?[]:{}),this.deepAssign(t[e],s[e])):t[e]=s[e]);return t},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise(((t,s)=>{try{document.execCommand("copy"),t()}catch(n){s(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>Object.prototype.toString.call(t).indexOf("Object")>-1,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,"")},p={deepClone:t=>structuredClone(t),isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse:t=>"string"==typeof t&&t.startsWith("{")&&t.endsWith("}")?JSON.parse(t):g.isEmpty(t)?{}:g.isObject(t)?t:void 0},f={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",getURL(t){let e,s;if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)s=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const n=e.getContext("2d");n&&(t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height)),s=e}return s.width>2048||s.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),s.toDataURL("image/jpeg",.6)):s.toDataURL("image/png")},getBase64(t){return new Promise(((e,s)=>{let n=new Image;n.setAttribute("crossOrigin","Anonymous"),n.src=t,n.onload=()=>{let t=this.getURL(n);e(t)},n.onerror=s}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);return e&&e.groups?{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data}:null},async copyImage(t){try{const e=await this.getBase64(t),s=this.parseBase64(e.dataURL);if(!s)throw new Error("Failed to parse base64 data.");let n=s.type,r=atob(s.data),i=new ArrayBuffer(r.length),a=new Uint8Array(i);for(let t=0;t<r.length;t++)a[t]=r.charCodeAt(t);let o=new Blob([i],{type:n});await navigator.clipboard.write([new ClipboardItem({[n]:o})])}catch(e){console.error("Failed to copy image to clipboard:",e)}}},m={jsonp(t,e){const s="_jsonp_"+g.guid(),n=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+s:t+="?callback="+s;let r=document.createElement("script");r.type="text/javascript",r.src=t,window[s]=function(t){e(null,t),n.removeChild(r),r=null,delete window[s]},n.appendChild(r)},get(t,e={},s){if(g.isFunction(e)){const t=s;s=e,e=t}const n=this._getClient(s);if(n.open("GET",t,!0),e){for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);n.withCredentials="include"===e.credentials,e.responseType&&(n.responseType=e.responseType)}return n.send(null),n},post(t,e={},s){let n;if("string"!=typeof t?(s=e.cb,n=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(s=e,e={}),n=e.postData),!s)throw new Error("Callback function is required");const r=this._getClient(s);return r.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=>{r.setRequestHeader(t,e.headers[t])})),"string"!=typeof n&&(n=JSON.stringify(n)),r.send(n),r},_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(s){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,s){if(g.isFunction(e)){const t=s;s=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,s)},getImage(t,e,s){return this.getArrayBuffer(e,s,((e,s)=>{if(e)t.onerror&&t.onerror(e);else if(s){const e=window.URL||window.webkitURL,n=t.onload;t.onload=()=>{n&&n(),e.revokeObjectURL(t.src)};const r=new Blob([new Uint8Array(s.data)],{type:s.contentType});t.cacheControl=s.cacheControl,t.expires=s.expires,t.src=s.data.byteLength?e.createObjectURL(r):f.emptyImageUrl}}))},getJSON(t,e,s){if(g.isFunction(e)){const t=s;s=e,e=t}const n=function(t,e){const n=e?p.parse(e):null;s&&s(t,n)};return e&&e.jsonp?this.jsonp(t,n):this.get(t,e,n)}},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)=>Math.round(t*Math.pow(10,e))/Math.pow(10,e),clamp:(t,e,s)=>Math.max(e,Math.min(s,t))};class E{static isLnglat(t,e){return!isNaN(t)&&!isNaN(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:s,lat:n}=t,{lng:r,lat:i}=e;let a=Math.cos(n*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((s-r)*Math.PI/180)+Math.sin(n*Math.PI/180)*Math.sin(i*Math.PI/180);a>1&&(a=1),a<-1&&(a=-1);return 6371e3*Math.acos(a)}static formatLnglat(t,e){let s="";function n(t){const e=Math.floor(t),s=Math.floor(60*(t-e));return`${e}°${s}′${(3600*(t-e)-60*s).toFixed(2)}″`}return this.isLnglat(t,e)?s=n(t)+","+n(e):isNaN(t)?isNaN(e)||(s=n(e)):s=n(t),s}static transformLnglat(t,e){function s(t){let e=/[sw]/i.test(t)?-1:1;const s=t.match(/[\d.]+/g)||[];let n=0;for(let r=0;r<s.length;r++)n+=parseFloat(s[r])/e,e*=60;return n}if(t&&e)return{lng:s(t),lat:s(e)}}static rayCasting(t,e){for(var s=t.x,n=t.y,r=!1,i=0,a=e.length,o=a-1;i<a;o=i,i++){var c=e[i].x,l=e[i].y,h=e[o].x,u=e[o].y;if(c===s&&l===n||h===s&&u===n)return"on";if(l<n&&u>=n||l>=n&&u<n){var d=c+(n-l)*(h-c)/(u-l);if(d===s)return"on";d>s&&(r=!r)}}return r?"in":"out"}static rotatePoint(t,e,s){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-s)-(t.y-e.y)*Math.sin(Math.PI/180*-s)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-s)+(t.y-e.y)*Math.cos(Math.PI/180*-s)+e.y}}static calcBearAndDis(t,e){const{x:s,y:n}=t,{x:r,y:i}=e,a=r-s,o=i-n,c=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:c}}static calcBearAndDisByPoints(t,e){var s=1*t.lat,n=1*t.lng,r=1*e.lat,i=1*e.lng,a=Math.sin((i-n)*this.toRadian)*Math.cos(r*this.toRadian),o=Math.cos(s*this.toRadian)*Math.sin(r*this.toRadian)-Math.sin(s*this.toRadian)*Math.cos(r*this.toRadian)*Math.cos((i-n)*this.toRadian),c=Math.atan2(a,o)*(180/Math.PI),l=(r-s)*this.toRadian,h=(i-n)*this.toRadian,u=Math.sin(l/2)*Math.sin(l/2)+Math.cos(s*this.toRadian)*Math.cos(r*this.toRadian)*Math.sin(h/2)*Math.sin(h/2),d=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return{angle:c,distance:this.R*d}}static distanceToSegment(t,e,s){const n=t.x,r=t.y,i=e.x,a=e.y,o=s.x,c=s.y,l=(o-i)*(n-i)+(c-a)*(r-a);if(l<=0)return Math.sqrt((n-i)*(n-i)+(r-a)*(r-a));const h=(o-i)*(o-i)+(c-a)*(c-a);if(l>=h)return Math.sqrt((n-o)*(n-o)+(r-c)*(r-c));const u=l/h,d=i+(o-i)*u,g=a+(c-a)*u;return Math.sqrt((n-d)*(n-d)+(r-g)*(r-g))}static calcPointByBearAndDis(t,e,s){const n=y.deg2Rad(1*t.lat),r=y.deg2Rad(1*t.lng),i=s/this.R;e=y.deg2Rad(e);const a=Math.asin(Math.sin(n)*Math.cos(i)+Math.cos(n)*Math.sin(i)*Math.cos(e)),o=r+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(n),Math.cos(i)-Math.sin(n)*Math.sin(a));return{lat:y.rad2Deg(a),lng:y.rad2Deg(o)}}static mercatorTolonlat(t,e){var s=e/20037508.34*180;return{lng:t/20037508.34*180,lat:180/Math.PI*(2*Math.atan(Math.exp(s*Math.PI/180))-Math.PI/2)}}static lonlatToMercator(t,e){var s=6378137;const n=t*Math.PI/180*s;var r=e*Math.PI/180;return{x:n,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}}static interpolate({x:t,y:e,z:s=0},{x:n,y:r,z:i=0},a){return{x:t+(n-t)*a,y:e+(r-e)*a,z:s+(i-s)*a}}}i(E,"toRadian",Math.PI/180),i(E,"R",6371393);const w={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4){case 1:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case 2:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case 3:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag:(t,...e)=>(e=e.map((t=>{switch(g.getDataType(t)){case"Object":return t||"{}";case"Array":return t||"[]";default:return t||""}})),t.reduce(((t,s,n)=>`${t}${e[n-1]}${s}`))),getByteLength:t=>t.replace(/[\u0391-\uFFE5]/g,"aa").length,subStringByte(t,e,s){var n=/[^\x00-\xff]/g;if(t.replace(n,"mm").length<=s)return t;for(var r=Math.floor(s/2);r<t.length;r++){let i=t.substring(e,r);if(i.replace(n,"mm").length>=s)return i}return t},string2Bytes(t){const e=[];let s;const n=t.length;for(let r=0;r<n;r++)s=t.charCodeAt(r),s>=65536&&s<=1114111?(e.push(s>>18&7|240),e.push(s>>12&63|128),e.push(s>>6&63|128),e.push(63&s|128)):s>=2048&&s<=65535?(e.push(s>>12&15|224),e.push(s>>6&63|128),e.push(63&s|128)):s>=128&&s<=2047?(e.push(s>>6&31|192),e.push(63&s|128)):e.push(255&s);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const s=t;for(let n=0;n<s.length;n++){const t=s[n].toString(2),r=t.match(/^1+?(?=0)/);if(r&&8==t.length){const t=r[0].length;let i=s[n].toString(2).slice(7-t);for(let e=1;e<t;e++)i+=s[e+n].toString(2).slice(2);e+=String.fromCharCode(parseInt(i,2)),n+=t-1}else e+=String.fromCharCode(s[n])}return e}},M=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],R={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let s=0,n=M.length;s<n;s++)if(M[s]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==M[4]&&e!==M[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==M[2]&&e!==M[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==M[0]&&e!==M[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 s=this.getGeoJsonType(t);if(!s||!t.geometry)return null;const n=t.geometry.coordinates;if(!n)return null;let r=0,i=0,a=0;switch(s){case"Point":r=n[0],i=n[1],a++;break;case"MultiPoint":case"LineString":for(let t=0,e=n.length;t<e;t++)r+=n[t][0],i+=n[t][1],a++;break;case"MultiLineString":case"Polygon":for(let t=0,e=n.length;t<e;t++)for(let s=0,o=n[t].length;s<o;s++)r+=n[t][s][0],i+=n[t][s][1],a++;break;case"MultiPolygon":for(let t=0,e=n.length;t<e;t++)for(let s=0,o=n[t].length;s<o;s++)for(let e=0,c=n[t][s].length;e<c;e++)r+=n[t][s][e][0],i+=n[t][s][e][1],a++}const o=r/a,c=i/a;return e?(e.x=o,e.y=c,e):{x:o,y:c}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const s=t.geometry,n=t.properties||{},r=s.coordinates;if(!r)return null;const i=[];let a;switch(e){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}if(a)for(let o=0,c=r.length;o<c;o++)i.push({type:"Feature",geometry:{type:a,coordinates:r[o]},properties:n});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 s=t[0];if(s[0].join(",")===s[s.length-1].join(","))e="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");e="MultiPolygon"}}}return{type:"Feature",geometry:{type:e,coordinates:t}}}},A={assertEmpty(...t){t.forEach((t=>{if(g.isEmpty(t))throw Error(o.PARAMETER_ERROR_LACK+" -> "+t)}))},assertInteger(...t){t.forEach((t=>{if(!g.isInteger(t))throw Error(o.PARAMETER_ERROR_INTEGER+" -> "+t)}))},assertNumber(...t){t.forEach((t=>{if(!g.isNumber(t))throw Error(o.PARAMETER_ERROR_NUMBER+" -> "+t)}))},assertArray(...t){t.forEach((t=>{if(!g.isArray(t))throw Error(o.PARAMETER_ERROR_ARRAY+" -> "+t)}))},assertFunction(...t){t.forEach((t=>{if(!g.isFunction(t))throw Error(o.PARAMETER_ERROR_FUNCTION+" -> "+t)}))},assertObject(...t){t.forEach((t=>{if(!g.isObject(t))throw Error(o.PARAMETER_ERROR_OBJECT+" -> "+t)}))},assertColor(...t){t.forEach((t=>{if(!N.isColor(t))throw Error(o.DATA_ERROR_COLOR+" -> "+t)}))},assertLnglat(...t){t.forEach((t=>{if(!E.isLnglat(t.lng,t.lat))throw Error(o.DATA_ERROR_COORDINATE+" -> "+t)}))},assertGeoJson(...t){t.forEach((t=>{if(!R.isGeoJson(t))throw Error(o.DATA_ERROR_GEOJSON+" -> "+t)}))},assertContain(t,...e){let s=!1;for(let n=0,r=e.length||0;n<r;n++)s=t.indexOf(e[n])>=0;if(s)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)},assertLegal(t,e){const s=w.checkStr(t,e);let n="";switch(e){case"phone":n="电话";break;case"tel":n="座机";break;case"card":n="身份证";break;case"pwd":n="密码";break;case"postal":n="邮政编码";break;case"QQ":n="QQ";break;case"email":n="邮箱";break;case"money":n="金额";break;case"URL":n="网址";break;case"IP":n="IP";break;case"date":n="日期时间";break;case"number":n="数字";break;case"english":n="英文";break;case"chinese":n="中文";break;case"lower":n="小写";break;case"upper":n="大写";break;case"HTML":n="HTML标记"}if(!s)throw Error(o.DATA_ERROR+" -> 不是"+n)}},b=Object.create(Array);b.groupBy=function(t){var e={};return this.forEach((function(s){var n=JSON.stringify(t(s));e[n]=e[n]||[],e[n].push(s)})),Object.keys(e).map((t=>e[t]))},b.distinct=function(t=t=>t){const e=[],s={};return this.forEach((n=>{const r=t(n),i=String(r);s[i]||(s[i]=!0,e.push(n))})),e},b.prototype.max=function(){return Math.max.apply({},this)},b.prototype.min=function(){return Math.min.apply({},this)},b.sum=function(){return this.length>0?this.reduce(((t=0,e=0)=>t+e)):0},b.avg=function(){return this.length?this.sum()/this.length:0},b.desc=function(t=t=>t){return this.sort(((e,s)=>t(s)-t(e)))},b.asc=function(t=t=>t){return this.sort(((e,s)=>t(e)-t(s)))},b.random=function(){return this[Math.floor(Math.random()*this.length)]},b.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this};const _={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,s)=>(t.sort((function(t,n){return s?e(t).localeCompare(e(n),"zh"):e(n).localeCompare(e(t),"zh")})),t)};class S{static getSystem(){var t,e,s,n,r,i,a,o,c;const l=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let h="",u="";if(l.includes("Android")||l.includes("Adr"))h="Android",u=(null==(e=l.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(l.includes("CrOS"))h="Chromium OS",u=(null==(s=l.match(/MSIE ([\d.]+)/))?void 0:s[1])||(null==(n=l.match(/rv:([\d.]+)/))?void 0:n[1])||"";else if(l.includes("Linux")||l.includes("X11"))h="Linux",u=(null==(r=l.match(/Linux ([\d.]+)/))?void 0:r[1])||"";else if(l.includes("Ubuntu"))h="Ubuntu",u=(null==(i=l.match(/Ubuntu ([\d.]+)/))?void 0:i[1])||"";else if(l.includes("Windows")){let t=(null==(a=l.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:a[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 l.includes("like Mac OS X")?(h="IOS",u=(null==(o=l.match(/OS ([\d_]+) like/))?void 0:o[1].replace(/_/g,"."))||""):l.includes("Macintosh")&&(h="macOS",u=(null==(c=l.match(/Mac OS X -?([\d_]+)/))?void 0:c[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 s="",n="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(s="IE",n=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(s="Edge",n=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(s="Chrome",n=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(s="Firefox",n=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(s="Safari",n=t[1])}return{type:s,version:n}}static switchFullScreen(t){if(t){const t=document.documentElement;t.requestFullscreen?t.requestFullscreen():"msRequestFullscreen"in t?t.msRequestFullscreen():"mozRequestFullScreen"in t?t.mozRequestFullScreen():"webkitRequestFullscreen"in t&&t.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()}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="",e="";if(null==this?void 0:this.document){let s=this.document.createElement("canvas"),n=s.getContext("webgl")||s.getContext("experimental-webgl");if(n instanceof WebGLRenderingContext){let s=n.getExtension("WEBGL_debug_renderer_info");if(s){let r=n.getParameter(s.UNMASKED_RENDERER_WEBGL);t=(r.match(/ANGLE \((.+?),/)||[])[1]||"",e=(r.match(/, (.+?) (\(|vs_)/)||[])[1]||""}}}return{type:t,model:e}}static getLanguage(){var t,e;let s=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof s)return"";let n=s.split("-");return n[1]&&(n[1]=n[1].toUpperCase()),n.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,s=1,n=[],r=function(i){if(e>0)if(s<12)n.push(i-e),e=i,s++,requestAnimationFrame(r);else{n.sort(),n=n.slice(1,11);let e=n.reduce(((t,e)=>t+e));const s=10*Math.round(1e4/e/10);t(s)}else e=i,requestAnimationFrame(r)};requestAnimationFrame(r)}))}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 s=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const n=new Set,r=s=>{var r;const i=null==(r=null==s?void 0:s.candidate)?void 0:r.candidate;if(i)for(const a of[t,e]){const t=i.match(a);t&&n.add(t[0])}};return new Promise((function(t,e){const i=new s({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});i.addEventListener("icecandidate",r),i.createDataChannel(""),i.createOffer().then((t=>i.setLocalDescription(t)),e);let a,o=20,c=function(){try{i.removeEventListener("icecandidate",r),i.close()}catch{}a&&clearInterval(a)};a=window.setInterval((function(){let e=[...n];e.length?(c(),t(e[0])):o?o--:(c(),t(""))}),100)}))}static async getNetwork(){var t,e;let s="unknown",n=null==(t=this.navigator)?void 0:t.connection;return n&&(s=n.type||n.effectiveType,"2"!=s&&"unknown"!=s||(s="wifi")),{network:s,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}i(S,"document",null==window?void 0:window.document),i(S,"navigator",null==window?void 0:window.navigator),i(S,"userAgent",null==(n=null==window?void 0:window.navigator)?void 0:n.userAgent),i(S,"screen",null==window?void 0:window.screen);class C{static delta(t,e){const s=6378245,n=.006693421622965943;let r=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const a=t/180*this.PI;let o=Math.sin(a);o=1-n*o*o;const c=Math.sqrt(o);return r=180*r/(s*(1-n)/(o*c)*this.PI),i=180*i/(s/c*Math.cos(a)*this.PI),{lat:r,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 s=this.delta(t,e);return{lat:t+s.lat,lng:e+s.lng}}static gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const s=this.delta(t,e);return{lat:t-s.lat,lng:e-s.lng}}static gcjDecryptExact(t,e){let s=.01,n=.01,r=t-s,i=e-n,a=t+s,o=e+n,c=0,l=0,h=0;for(;;){c=(r+a)/2,l=(i+o)/2;const u=this.gcjEncrypt(c,l);if(s=u.lat-t,n=u.lng-e,Math.abs(s)<1e-9&&Math.abs(n)<1e-9)break;if(s>0?a=c:r=c,n>0?o=l:i=l,++h>1e4)break}return{lat:c,lng:l}}static bdEncrypt(t,e){const s=e,n=t,r=Math.sqrt(s*s+n*n)+2e-5*Math.sin(n*this.XPI),i=Math.atan2(n,s)+3e-6*Math.cos(s*this.XPI),a=r*Math.cos(i)+.0065;return{lat:r*Math.sin(i)+.006,lng:a}}static bdDecrypt(t,e){const s=e-.0065,n=t-.006,r=Math.sqrt(s*s+n*n)-2e-5*Math.sin(n*this.XPI),i=Math.atan2(n,s)-3e-6*Math.cos(s*this.XPI),a=r*Math.cos(i);return{lat:r*Math.sin(i),lng:a}}static mercatorEncrypt(t,e){const s=20037508.34*e/180;let n=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return n=20037508.34*n/180,{lat:n,lng:s}}static mercatorDecrypt(t,e){const s=e/20037508.34*180;let n=t/20037508.34*180;return n=180/this.PI*(2*Math.atan(Math.exp(n*this.PI/180))-this.PI/2),{lat:n,lng:s}}static transformLat(t,e){let s=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return s+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,s+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,s+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3,s}static transformLon(t,e){let s=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return s+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,s+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,s+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,s}static random({x:t,y:e},{x:s,y:n}){return{x:Math.random()*(s-t)+t,y:Math.random()*(n-e)+e}}static deCompose(t,e,s){if(!Array.isArray(t))return s?e.call(s,t):e(t);const n=[];let r,i;for(let a=0,o=t.length;a<o;a++)r=t[a],g.isNil(r)?n.push(null):Array.isArray(r)?n.push(this.deCompose(r,e,s)):(i=s?e.call(s,r):e(r),n.push(i));return n}}i(C,"PI",3.141592653589793),i(C,"XPI",52.35987755982988);const v=Object.create(Date);v.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 s in e){const n=new RegExp("("+s+")","g");n.test(t)&&(t=t.replace(n,(t=>(1===t.length?e[s]:("00"+e[s]).substr((""+e[s]).length)).toString())))}return t},v.prototype.addDate=function(t,e){const s=new Date(this);switch(t){case"y":s.setFullYear(this.getFullYear()+e);break;case"q":s.setMonth(this.getMonth()+3*e);break;case"M":s.setMonth(this.getMonth()+e);break;case"w":s.setDate(this.getDate()+7*e);break;case"d":default:s.setDate(this.getDate()+e);break;case"h":s.setHours(this.getHours()+e);break;case"m":s.setMinutes(this.getMinutes()+e);break;case"s":s.setSeconds(this.getSeconds()+e)}return s};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 s=new Date(t),n=new Date(e).getTime()-s.getTime(),r=Math.floor(n/864e5),i=n%864e5,a=Math.floor(i/36e5),o=i%36e5,c=Math.floor(o/6e4),l=o%6e4,h=Math.round(l/1e3);let u="";return r>0&&(u+=r+"天"),a>0&&(u+=a+"时"),c>0&&(u+=c+"分"),h>0&&(u+=h+"秒"),0===r&&0===a&&0===c&&0===h&&(u="少于1秒"),u}static formatterCounter(t){const e=function(t){return(t>10?"":"0")+(t||0)},s=t%3600,n=s%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(s/60))}:${e(Math.round(n))}`}static sleep(t){}}function T(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}i(O,"lastMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()-1,1)),i(O,"thisMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth(),1)),i(O,"nextMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()+1,1)),i(O,"lastWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay())),i(O,"thisWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay())),i(O,"nextWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay())),i(O,"lastDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1)),i(O,"thisDayDate",new Date((new Date).setHours(0,0,0,0))),i(O,"nextDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1));const x={getStyle(t,e){var s;let n=t.style[e];if(!n||"auto"===n){const r=null==(s=document.defaultView)?void 0:s.getComputedStyle(t,null);n=r?r[e]:null,"auto"===n&&(n=null)}return n},create(t,e,s){const n=document.createElement(t);return n.className=e||"",s&&s.appendChild(n),n},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 s;if(null==(s=t.classList)?void 0:s.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(void 0!==t.classList){const s=T(e);for(let e=0,n=s.length;e<n;e++)t.classList.add(s[e])}else if(!this.hasClass(t,e)){const s=this.getClass(t);this.setClass(t,(s?s+" ":"")+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],s=atob(t.split(",")[1]),n=new Array(s.length);for(let i=0;i<s.length;i++)n[i]=s.charCodeAt(i);const r=new Uint8Array(n);return new Blob([r],{type:e})},convertBase64ToFile(t,e){const s=t.split(","),n=s[0].match(/:(.*?);/),r=n?n[1]:"image/png",i=atob(s[1]),a=new Uint8Array(i.length);for(let o=0;o<i.length;o++)a[o]=i.charCodeAt(o);return new File([a],e,{type:r})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),s=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(s)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var s=document.createElement("a");s.href=t,s.download=e||"",s.click(),window.URL.revokeObjectURL(s.href)}};class D{static resetWarned(){this.warned={}}static changeVoice(){this.isMute=!!Number(!this.isMute),localStorage.setItem("mute",Number(this.isMute).toString())}static _call(t,e){this.warned[e]||(t(e),this.warned[e]=!0)}static msg(t,s,n={}){if(e.Message({type:t,message:s}),this.isMute)return;const r=g.decodeDict(t,"success","恭喜:","error","发生错误:","warning","警告:","info","友情提示:")+":";this.speechSynthesisUtterance.text=r+s,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){"development"===process.env.NODE_ENV&&void 0!==console&&console.warn(`Warning: ${t}`),this.msg("warning",t)}static warningOnce(t){this._call(this.warning.bind(this),t)}static info(t){"development"===process.env.NODE_ENV&&void 0!==console&&console.info(`Info: ${t}`),this.msg("info",t)}static infoOnce(t){this._call(this.info.bind(this),t)}static error(t){"development"===process.env.NODE_ENV&&void 0!==console&&console.error(`Error: ${t}`),this.msg("error",t)}static errorOnce(t){this._call(this.error.bind(this),t)}static success(t){"development"===process.env.NODE_ENV&&void 0!==console&&console.log(`Success: ${t}`),this.msg("success",t)}static successOnce(t){this._call(this.success.bind(this),t)}}i(D,"warned",{}),i(D,"isMute",!!Number(localStorage.getItem("mute"))||!1),i(D,"speechSynthesis",window.speechSynthesis),i(D,"speechSynthesisUtterance",new SpeechSynthesisUtterance);const P={debounce(t,e,s=!0){let n,r,i=null;const a=()=>{const o=Date.now()-n;o<e&&o>0?i=setTimeout(a,e-o):(i=null,s||(r=t.apply(this,undefined)))};return(...o)=>{n=Date.now();const c=s&&!i;return i||(i=setTimeout(a,e)),c&&(r=t.apply(this,o),i||(o=null)),r}},throttle(t,e,s=1){let n=0,r=null;return(...i)=>{if(1===s){const s=Date.now();s-n>=e&&(t.apply(this,i),n=s)}else 2===s&&(r||(r=setTimeout((()=>{r=null,t.apply(this,i)}),e)))}},memoize(t){const e=new Map;return(...s)=>{const n=JSON.stringify(s);if(e.has(n))return e.get(n);{const r=t.apply(this,s);return e.set(n,r),r}}},recurve(t,e=500,s=5e3){let n=0;setTimeout((()=>{n++,n<Math.floor(s/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,s),e))}),e)},once(t){let e=!1;return function(...s){if(!e)return e=!0,t(...s)}}},L={json2Query(t){var e=[];for(var s in t)if(t.hasOwnProperty(s)){var n=s,r=t[s];e.push(encodeURIComponent(n)+"="+encodeURIComponent(r))}return e.join("&")},query2Json(t=window.location.href,e=!0){const s=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:n,hash:r}=new URL(t),i=[n,r];let a={};for(let o=0;o<i.length;o++){const t=i[o];if(t){const n=t.replace(/#|\//g,"").split("?");if(n.length>1)for(let t=1;t<n.length;t++){let r;for(;r=s.exec(n[t]);)a[r[1]]=e?decodeURIComponent(r[2]):r[2]}}}return a}};class N{constructor(t,e,s,n){i(this,"_r"),i(this,"_g"),i(this,"_b"),i(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(s),this._r=t,this._g=e,this._b=s,this._alpha=y.clamp(n||1,0,1)}_validateColorChannel(t){if(t<0||t>255)throw new Error("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 N.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=y.clamp(t,0,1),this}setRgb(t,e,s){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(s),this._r=t,this._g=e,this._b=s,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 s=parseInt(e[1],10),n=parseInt(e[2],10),r=parseInt(e[3],10),i=e[5]?parseFloat(e[5]):1;return new N(s,n,r,i)}static fromHex(t,e=1){const s=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,s,n)=>e+e+s+s+n+n)),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);if(!n)throw new Error("Invalid HEX color value");const r=parseInt(n[1],16),i=parseInt(n[2],16),a=parseInt(n[3],16);return new N(r,i,a,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 s=parseInt(e[1],10)/360,n=parseInt(e[2],10)/100,r=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function a(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t}let o,c,l;if(0===n)o=c=l=r;else{const t=r<.5?r*(1+n):r+n-r*n,e=2*r-t;o=a(e,t,s+1/3),c=a(e,t,s),l=a(e,t,s-1/3)}return new N(Math.round(255*o),Math.round(255*c),Math.round(255*l),i)}static from(t){if(this.isRgb(t))return this.fromRgba(t);if(this.isHex(t))return this.fromHex(t);if(this.isHsl(t))return this.fromHsl(t);throw new Error("Invalid color value")}static rgb2hex(t,e,s,n){var r="#"+((1<<24)+(t<<16)+(e<<8)+s).toString(16).slice(1);if(void 0!==n){return r+Math.round(255*n).toString(16).padStart(2,"0")}return r}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()),s=Math.floor(256*Math.random()),n=Math.random();return new N(t,e,s,n)}}class U{constructor(){i(this,"_listeners"),i(this,"_mutex",{}),i(this,"_context")}addEventListener(t,e,s,n){void 0===this._listeners&&(this._listeners={}),this._context=s;const r=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(n&&(r[t]=e),i[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const s=this._listeners;return void 0!==s[t]&&-1!==s[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const s=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==s){const t=s.map((t=>t.toString())).indexOf(e.toString());-1!==t&&s.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 s=e.slice(0);if(void 0!==this._mutex[t.type]){const e=s.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,n=s.length;e<n;e++){const n=s[e];"function"==typeof n&&n.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}class k 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 k;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=p.parse(t);return new k(Object.entries(e))}}const F=class t extends U{constructor(e=`ws://${window.document.domain}:20007/mqtt`,n={}){super(),i(this,"state"),i(this,"url"),i(this,"context"),i(this,"options"),i(this,"client"),i(this,"topics"),this.context=g.extend(t.defaultContext,n),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:g.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0},this.url=e,this.client=s.connect(this.url,this.options),this._onConnect(),this._onMessage(),this.state=0,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=1,console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:a.MQTT_CONNECT,message:this})})),this.client.on("error",(t=>{console.log("链接mqtt报错",t),this.state=-1,this.dispatchEvent({type:a.MQTT_ERROR,message:this}),this.client.end(),this.client.reconnect()}))}_onMessage(){this.client.on("message",((t,e)=>{let s=e,n="";e instanceof Uint8Array&&(s=e.toString());try{n=p.parse(s)}catch(r){throw new Error(o.JSON_PARSE_ERROR)}this.dispatchEvent({type:a.MQTT_MESSAGE,message:{topic:t,data:n}})}))}sendMsg(t,e){if(this.client.connected)return this.client.publish(t,e,{qos:1,retain:!0}),this;console.error("客户端未连接")}subscribe(t){return 1===this.state?this.client.subscribe(t,{qos:1},((e,s)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=_.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(a.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,s)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=_.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,s)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=_.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:a.MQTT_CLOSE,message:null}),console.log("断开mqtt成功==>"+this.url)}};i(F,"defaultContext",{MQTT_USERNAME:"iRVMS-WEB",MQTT_PASSWORD:"novasky888",MQTT_TIMEOUTM:2e4});let $=F;const G=class t{static useLocal(){this.store=window.localStorage}static useSession(){this.store=window.sessionStorage}static set(t,e=null,s={}){var n=this._getPrefixedKey(t,s);try{const{expires:t}=s,r={data:e};t&&(r.expires=t),this.store.setItem(n,JSON.stringify(r))}catch(r){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static get(t,e,s){var n,r=this._getPrefixedKey(t,s);try{n=JSON.parse(this.store.getItem(r)||"")}catch(i){n=this.store[r]?{data:this.store.getItem(r)}:null}if(!n)return e;if("object"==typeof n&&void 0!==n.data){const t=n.expires;return t&&Date.now()>t?e:n.data}}static keys(){const e=[];var s=Object.keys(this.store);return 0===t.prefix.length?s:(s.forEach((function(s){-1!==s.indexOf(t.prefix)&&e.push(s.replace(t.prefix,""))})),e)}static getAll(e){var s=t.keys();if(e){const n=[];return s.forEach((s=>{if(e.includes(s)){const e={};e[s]=t.get(s,null,null),n.push(e)}})),n}return s.map((e=>t.get(e,null,null)))}static remove(t,e){var s=this._getPrefixedKey(t,e);this.store.removeItem(s)}static clear(e){t.prefix.length?this.keys().forEach((t=>{this.store.removeItem(this._getPrefixedKey(t,e))})):this.store.clear()}};i(G,"store",window.localStorage),i(G,"prefix",""),i(G,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:G.prefix+t}));let B=G;t.AjaxUtil=m,t.ArrayUtil=_,t.AssertUtil=A,t.AudioPlayer=class{constructor(t){i(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=S,t.CanvasDrawer=class{constructor(t){if(i(this,"context",null),"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.context=e.getContext("2d")}}drawLine({x:t,y:e},{x:s,y:n},r={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const i=r.width||1,a=r.color||"#000";this.context.lineWidth=i,this.context.strokeStyle=a,this.context.moveTo(t,e),this.context.lineTo(s,n),this.context.stroke()}drawArc({x:t,y:e},s,n,r,i,a,o){if(!this.context)throw new Error("Canvas context is null or undefined");a?(this.context.fillStyle=o,this.context.beginPath(),this.context.arc(t,e,s,y.deg2Rad(n),y.deg2Rad(r),i),this.context.fill()):(this.context.strokeStyle=o,this.context.beginPath(),this.context.arc(t,e,s,y.deg2Rad(n),y.deg2Rad(r),i),this.context.stroke())}static createCanvas(t=1,e=1){const s=document.createElement("canvas");return t&&(s.width=t),e&&(s.height=e),s}},t.Color=N,t.Cookie=class{static set(t,e,s=30){if("string"!=typeof t||"string"!=typeof e||"number"!=typeof s)throw new Error("Invalid arguments");const n=new Date;n.setTime(n.getTime()+24*s*60*60*1e3),document.cookie=`${t}=${encodeURIComponent(e)};expires=${n.toUTCString()}`}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var s=this.get(t);null!=s&&(document.cookie=t+"="+s+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=C,t.DateUtil=O,t.DomUtil=x,t.ErrorType=o,t.EventDispatcher=U,t.EventType=a,t.FileUtil=I,t.GeoJsonUtil=R,t.GeoUtil=E,t.GraphicType=l,t.HashMap=k,t.ImageUtil=f,t.LayerType=c,t.LineSymbol=h,t.MathUtil=y,t.MeasureMode=u,t.MessageUtil=D,t.MqttClient=$,t.ObjectState=d,t.ObjectUtil=p,t.OptimizeUtil=P,t.Storage=B,t.StringUtil=w,t.UrlUtil=L,t.Util=g,t.WebSocketClient=class extends U{constructor(t="ws://127.0.0.1:10088"){super(),i(this,"maxCheckTimes",10),i(this,"url"),i(this,"checkTimes",0),i(this,"connectStatus",!1),i(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{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const t=this;this.client.onopen=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:a.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:a.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.client&&0!==this.client.readyState&&1!==this.client.readyState&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&1===this.client.readyState?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),this)}heartbeat(){setTimeout((()=>{this.client&&1===this.client.readyState&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|