gis-common 4.1.8 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/EventDispatcher.d.ts +1 -1
- package/dist/core/MqttClient.d.ts +33 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/gis-common.es.js +514 -420
- package/dist/gis-common.umd.js +1 -1
- package/dist/utils/ArrayUtil.d.ts +0 -1
- package/dist/utils/CommUtil.d.ts +14 -0
- package/package.json +4 -1
package/dist/gis-common.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(d,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(d=typeof globalThis<"u"?globalThis:d||self,g(d["gis-common"]={}))})(this,function(d){"use strict";var V=Object.defineProperty;var Z=(d,g,R)=>g in d?V(d,g,{enumerable:!0,configurable:!0,writable:!0,value:R}):d[g]=R;var m=(d,g,R)=>Z(d,typeof g!="symbol"?g+"":g,R);var g=(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))(g||{}),R=(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.COORDINATE_ERROR="坐标验证失败",t.JSON_PARSE_ERROR="JSON解析失败,格式有误",t.JSON_VALUE_ERROR="JSON无此键",t.PARAMETER_ERROR="验证数据类型失败",t.PARAMETER_ERROR_ARRAY="格式类型验证失败:必须是数组",t.PARAMETER_ERROR_STRING="格式类型验证失败:必须是字符",t.PARAMETER_ERROR_FUNCTION="格式类型验证失败:必须是函数",t.PARAMETER_ERROR_OBJECT="格式类型验证失败:必须是对象",t.PARAMETER_ERROR_LACK="参数缺失",t.STRING_CHECK_LOSS="字符缺少关键字",t))(R||{}),x=(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))(x||{}),D=(t=>(t.POINT="point",t.POLYLINE="polyline",t.POLYGON="polygon",t.BILLBOARD="billboard",t.CYLINDER="cylinder",t.ELLIPSOID="ellipsoid",t.LABEL="label",t.MODEL="model",t.WALL="wall",t))(D||{}),O=(t=>(t.DISTANCE="distance",t.AREA="area",t.HEIGHT="height",t))(O||{}),I=(t=>(t.ADD="add",t.REMOVE="remove",t.INIT="init",t))(I||{});class U{constructor(e){m(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}const M={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)},minMax(t,e,n){return Math.min(Math.max(t,e),n)},maxMin(t,e,n){return Math.max(Math.min(t,n),e)}};class T{constructor(e){m(this,"context",null);if(typeof e=="string"&&(e=document.querySelector("#"+e),!e))throw new Error("Element not found");if(e instanceof HTMLElement){const n=e;if(n.getContext)this.context=n.getContext("2d");else throw new Error("getContext is not available on this element")}else throw new Error("Element is not an HTMLElement")}drawLine({x:e,y:n},{x:r,y:s},i={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const a=i.width||1,o=i.color||"#000";this.context.lineWidth=a,this.context.strokeStyle=o,this.context.moveTo(e,n),this.context.lineTo(r,s),this.context.stroke()}drawArc({x:e,y:n},r,s,i,a,o,l){if(!this.context)throw new Error("Canvas context is null or undefined");o?(this.context.fillStyle=l,this.context.beginPath(),this.context.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(i),a),this.context.fill()):(this.context.strokeStyle=l,this.context.beginPath(),this.context.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(i),a),this.context.stroke())}static createCanvas(e=1,n=1){let r;if(typeof document<"u")return r=document.createElement("canvas"),e&&(r.width=e),n&&(r.height=n),r}}class _{constructor(){m(this,"_listeners");m(this,"_mutex",{});m(this,"_context")}addEventListener(e,n,r,s=!1){this._listeners===void 0&&(this._listeners={}),this._context=r;const i=this._mutex,a=this._listeners;return a[e]===void 0&&(a[e]=[]),a[e].indexOf(n)===-1&&(s&&(i[e]=n),a[e].push(n)),this}hasEventListener(e,n){if(this._listeners===null||this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const s=this._listeners[e];if(this._mutex[e]===n&&(this._mutex[e]=null),s!==void 0){const i=s.map(a=>a.toString()).indexOf(n.toString());i!==-1&&s.splice(i,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const s=r.slice(0);if(this._mutex[e.type]!==void 0){const i=s.find(a=>a===this._mutex[e.type]);if(i){i.call(this._context||this,e);return}}for(let i=0,a=s.length;i<a;i++){const o=s[i];typeof o=="function"&&o.call(this._context||this,e)}}}removeAllListener(){this._mutex={};for(const e in this._listeners)this._listeners[e]=[]}}class C extends Map{isEmpty(){return this.size===0}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}fromEntries(){}}C.prototype.fromEntries=function(t=[]){const e=new C;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class k extends _{constructor(n="ws://127.0.0.1:10088"){super();m(this,"maxCheckTimes",10);m(this,"url");m(this,"checkTimes",0);m(this,"connectStatus",!1);m(this,"client",null);this.maxCheckTimes=10,this.url=n,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const n=this;this.client.onopen=function(r){n.dispatchEvent({type:g.WEB_SOCKET_CONNECT,message:r})},this.client.onmessage=function(r){n.connectStatus=!0,n.dispatchEvent({type:g.WEB_SOCKET_MESSAGE,message:r})},this.client.onclose=function(r){n.dispatchEvent({type:g.WEB_SOCKET_CLOSE,message:r})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(r){n.dispatchEvent({type:g.WEB_SOCKET_ERROR,message:r})})}}catch(n){console.error("创建ws连接失败"+this.url+":"+n)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(n){this.checkTimes>n||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(n)},2e3)}send(n){return this.client&&this.client.readyState===1?(this.client.send(n),!0):(console.error(this.url+"消息发送失败:"+n),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}}const w={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},guid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const s=n[r];t[0]===s&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,s,i;for(r=0,s=e.length;r<s;r++){i=e[r];for(n in i)t[n]=i[n]}return t},convertToTree2(t,e="id",n="parentId",r="children"){const s=[];function i(a){const o=t.filter(l=>l[n]===a[e]).map(l=>(s.some(h=>h[e]===l[e])||i(l),l));o.length>0&&(a[r]=o)}return t.forEach(a=>{t.some(o=>o[n]===a[e])||(i(a),s.push(a))}),s},asyncLoadScript(t){return new Promise((e,n)=>{try{const r=document.createElement("script");r.type="text/javascript",r.src=t,"readyState"in r?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:(r.onload=function(){e(r)},r.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(r)}catch(r){n(r)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${e}`)},document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,(r,s)=>{const i=e[s];if(i===void 0)throw new Error(`${R.JSON_VALUE_ERROR}: ${r}`);return typeof i=="function"?i(e):i})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(t,...e){(typeof t!="object"||t===null)&&(t={});for(const n of e)if(typeof n=="object"&&n!==null)for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(typeof n[r]=="object"&&n[r]!==null?(t[r]||(t[r]=Array.isArray(n[r])?[]:{}),this.deepAssign(t[r],n[r])):t[r]=n[r]);return t},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,r)=>{try{document.execCommand("copy"),n()}catch{r(new Error("copy failed"))}finally{e.remove()}})}},isArray(t){return Array.isArray(t)},isObject(t){return Object.prototype.toString.call(t).indexOf("Object")>-1},isNil(t){return t===void 0||t==="undefined"||t===null||t==="null"},isNumber(t){return typeof t=="number"&&!isNaN(t)||typeof t=="string"&&Number.isFinite(+t)},isFunction(t){return this.isNil(t)?!1:typeof t=="function"||t.constructor!==null&&t.constructor===Function}},P={deepClone(t){return structuredClone(t)},isEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)},parse(t){return!t||typeof t!="string"?t:JSON.parse(t)}},L={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",getURL(t){let e;if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{e===void 0&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const r=e.getContext("2d");r&&(t instanceof ImageData?r.putImageData(t,0,0):r.drawImage(t,0,0,t.width,t.height)),n=e}return n.width>2048||n.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")},getBase64(t){return new Promise((e,n)=>{let r=new Image;r.setAttribute("crossOrigin","Anonymous"),r.src=t,r.onload=()=>{let s=this.getURL(r);e(s)},r.onerror=n})},parseBase64(t){let n=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);return n&&n.groups?{type:n.groups.type,ext:n.groups.type.split("/").slice(-1)[0],data:n.groups.data}:null},async copyImage(t){try{const e=await this.getBase64(t),n=this.parseBase64(e.dataURL);if(!n)throw new Error("Failed to parse base64 data.");let r=n.type,s=atob(n.data),i=new ArrayBuffer(s.length),a=new Uint8Array(i);for(let l=0;l<s.length;l++)a[l]=s.charCodeAt(l);let o=new Blob([i],{type:r});await navigator.clipboard.write([new ClipboardItem({[r]:o})])}catch(e){console.error("Failed to copy image to clipboard:",e)}}},A={jsonp(t,e){const n="_jsonp_"+w.guid(),r=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+n:t+="?callback="+n;let s=document.createElement("script");s.type="text/javascript",s.src=t,window[n]=function(i){e(null,i),r.removeChild(s),s=null,delete window[n]},r.appendChild(s)},get(t,e,n){if(w.isFunction(e)){const s=n;n=e,e=s}const r=A._getClient(n);if(r.open("GET",t,!0),e){for(const s in e.headers)r.setRequestHeader(s,e.headers[s]);r.withCredentials=e.credentials==="include",e.responseType&&(r.responseType=e.responseType)}return r.send(null),r},post(t,e={},n){let r;if(typeof t!="string"?(n=e.cb,r=e.postData,e={...e},delete e.cb,delete e.postData,t=e.url):(typeof e=="function"&&(n=e,e={}),r=e.postData),!n)throw new Error("Callback function is required");const s=A._getClient(n);return s.open("POST",t,!0),e.headers=e.headers||{},e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.keys(e.headers).forEach(i=>{s.setRequestHeader(i,e.headers[i])}),typeof r!="string"&&(r=JSON.stringify(r)),s.send(r),s},_wrapCallback(t,e){return function(){t.readyState===4&&(t.status===200?t.responseType==="arraybuffer"?t.response.byteLength===0?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")}):e(null,t.responseText):e(new Error(t.statusText+","+t.status)))}},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch{throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=A._wrapCallback(e,t)),e},getArrayBuffer(t,e,n){if(w.isFunction(e)){const r=n;n=e,e=r}return e||(e={}),e.responseType="arraybuffer",A.get(t,e,n)},getImage(t,e,n){return A.getArrayBuffer(e,n,(r,s)=>{if(r)t.onerror&&t.onerror(r);else if(s){const i=window.URL||window.webkitURL,a=t.onload;t.onload=()=>{a&&a(),i.revokeObjectURL(t.src)};const o=new Blob([new Uint8Array(s.data)],{type:s.contentType});t.cacheControl=s.cacheControl,t.expires=s.expires,t.src=s.data.byteLength?i.createObjectURL(o):L.emptyImageUrl}})},getJSON(t,e,n){if(w.isFunction(e)){const s=n;n=e,e=s}const r=function(s,i){const a=i?P.parse(i):null;n&&n(s,a)};return e&&e.jsonp?A.jsonp(t,r):A.get(t,e,r)}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const s=t(r),i=String(s);n[i]||(n[i]=!0,e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this},Array.prototype.clear=function(){return this.length=0,this};const N={asArray(t){return w.isEmpty(t)?[]:Array.isArray(t)?t:[t]},create(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},F={getExplorer(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||/Trident\//.test(t)?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0&&t.indexOf("Chrome")===-1?"Safari":"Unknown"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,s=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":s&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():"msRequestFullscreen"in e?e.msRequestFullscreen():"mozRequestFullScreen"in e?e.mozRequestFullScreen():"webkitRequestFullscreen"in e&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth||0,e=document.documentElement.clientHeight||0,n=document.getElementById("app");if(!n)return;const r=n.style,s=t/e,i=16/9;let a=t/1920;s>i&&(a=e/1080),r.transformOrigin="left top",r.transform=`scale(${a}) translateX(-49.99%)`,r.width=`${t/a}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e&&(e.style.fontSize=t/192+"px")}},B={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},$={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let s=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const a=t/180*this.PI;let o=Math.sin(a);o=1-r*o*o;const l=Math.sqrt(o);return s=s*180/(6378245*(1-r)/(o*l)*this.PI),i=i*180/(6378245/l*Math.cos(a)*this.PI),{lat:s,lng:i}},outOfChina(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let s=.01,i=.01,a=t-s,o=e-i,l=t+s,h=e+i,c=0,u=0,f=0;for(;;){c=(a+l)/2,u=(o+h)/2;const y=this.gcjEncrypt(c,u);if(s=y.lat-t,i=y.lng-e,Math.abs(s)<1e-9&&Math.abs(i)<1e-9||(s>0?l=c:a=c,i>0?h=u:o=u,++f>1e4))break}return{lat:c,lng:u}},bdEncrypt(t,e){const n=e,r=t,s=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),a=s*Math.cos(i)+.0065;return{lat:s*Math.sin(i)+.006,lng:a}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,s=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),a=s*Math.cos(i);return{lat:s*Math.sin(i),lng:a}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},random({x:t,y:e},{x:n,y:r}){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}},deCompose(t,e,n){if(!Array.isArray(t))return n?e.call(n,t):e(t);const r=[];let s,i;for(let a=0,o=t.length;a<o;a++){if(s=t[a],w.isNil(s)){r.push(null);continue}Array.isArray(s)?r.push(this.deCompose(s,e,n)):(i=n?e.call(n,s):e(s),r.push(i))}return r}},G={random(){let t=Math.floor(Math.random()*256).toString(16),e=Math.floor(Math.random()*256).toString(16),n=Math.floor(Math.random()*256).toString(16);return t=t.length===1?"0"+t:t,e=e.length===1?"0"+e:e,n=n.length===1?"0"+n:n,"#"+t+e+n},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},rgbToRgba(t){const e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?`rgba(${e[1]}, 1)`:t},hexToRgba(t){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,n=t.replace(e,(l,h,c,u)=>h+h+c+c+u+u),s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!s)return t;const i=parseInt(s[1],16),a=parseInt(s[2],16),o=parseInt(s[3],16);return`rgba(${i},${a},${o},1)`},hslToRgba(t){if(!t)return null;const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)return null;const n=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function a(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}let o,l,h;if(r===0)o=l=h=s;else{const c=s<.5?s*(1+r):s+r-s*r,u=2*s-c;o=a(u,c,n+1/3),l=a(u,c,n),h=a(u,c,n-1/3)}return`rgba(${Math.round(o*255)},${Math.round(l*255)},${Math.round(h*255)},${i})`},isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},isRgb(t){return/^rgb/.test(t)},isHsl(t){return/^hsl/.test(t)},isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)},colorToRgb(t){if(this.isRgb(t))return this.rgbToRgba(t);if(this.isHex(t))return this.hexToRgba(t);if(this.isHsl(t))return this.hslToRgba(t)}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)if(new RegExp("("+n+")").test(t)){const r=n.length===1?1:Number(n.slice(1));t=t.replace(RegExp.$1,("00"+e[n]).substr((""+e[n]).length+r-(e[n]+"").length))}return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const J={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),s=new Date(e).getTime()-n.getTime(),i=Math.floor(s/(24*3600*1e3)),a=s%(24*3600*1e3),o=Math.floor(a/(3600*1e3)),l=a%(3600*1e3),h=Math.floor(l/(60*1e3)),c=l%(60*1e3),u=Math.round(c/1e3);let f="";return i>0&&(f+=i+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),u>0&&(f+=u+"秒"),i===0&&o===0&&h===0&&u===0&&(f="少于1秒"),f},formatterCounter(t){const e=function(o){return(o>10?"":"0")+(o||0)},n=e(Math.floor(t/3600)),r=t%3600,s=e(Math.floor(r/60)),i=r%60,a=e(Math.round(i));return`${n}:${s}:${a}`},sleep(t){}};function j(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function v(t){return j(t).split(/\s+/)}const H={getStyle(t,e){var r;let n=t.style[e];if(!n||n==="auto"){const s=(r=document.defaultView)==null?void 0:r.getComputedStyle(t,null);n=s?s[e]:null,n==="auto"&&(n=null)}return n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return((t==null?void 0:t.host)||t).className.toString()},hasClass(t,e){var r;if((r=t.classList)!=null&&r.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(t.classList!==void 0){const n=v(e);for(let r=0,s=n.length;r<s;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?v(e).forEach(r=>t.classList.remove(r)):this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach(n=>t.classList.add(n)))},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},E=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],q={getGeoJsonType(t){return t.geometry?t.geometry.type:null},isGeoJson(t){const e=this.getGeoJsonType(t);if(e){for(let n=0,r=E.length;n<r;n++)if(E[n]===e)return!0}return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!!(e&&(e===E[4]||e===E[5]))},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!!(e&&(e===E[2]||e===E[3]))},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!!(e&&(e===E[0]||e===E[1]))},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates(t){return t.geometry?t.geometry.coordinates:[]},getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const s=t.geometry.coordinates;if(!s)return null;let i=0,a=0,o=0;switch(n){case"Point":{i=s[0],a=s[1],o++;break}case"MultiPoint":case"LineString":{for(let c=0,u=s.length;c<u;c++)i+=s[c][0],a+=s[c][1],o++;break}case"MultiLineString":case"Polygon":{for(let c=0,u=s.length;c<u;c++)for(let f=0,y=s[c].length;f<y;f++)i+=s[c][f][0],a+=s[c][f][1],o++;break}case"MultiPolygon":{for(let c=0,u=s.length;c<u;c++)for(let f=0,y=s[c].length;f<y;f++)for(let S=0,Q=s[c][f].length;S<Q;S++)i+=s[c][f][S][0],a+=s[c][f][S][1],o++;break}}const l=i/o,h=a/o;return e?(e.x=l,e.y=h,e):{x:l,y:h}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},s=n.coordinates;if(!s)return null;const i=[];let a;switch(e){case"MultiPoint":{a="Point";break}case"MultiLineString":{a="LineString";break}case"MultiPolygon":{a="Polygon";break}}if(a)for(let o=0,l=s.length;o<l;o++)i.push({type:"Feature",geometry:{type:a,coordinates:s[o]},properties:r});else i.push(t);return i},getGeoJsonByCoordinates(t){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let e;if(t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number")e="Point";else if(Array.isArray(t[0])&&t[0].length===2)e="LineString";else if(Array.isArray(t[0])&&Array.isArray(t[0][0])){const n=t[0];if(n[0].join(",")===n[n.length-1].join(","))e="Polygon";else if(t.length>1)e="MultiPolygon";else throw Error("coordinates 参数格式错误")}else throw Error("coordinates 参数格式错误");return{type:"Feature",geometry:{type:e,coordinates:t}}}},W={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return!isNaN(t)&&!isNaN(e)&&+e>-90&&+e<90&&+t>-180&&+t<180},distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},distanceByPoints(t,e){const{lng:n,lat:r}=t,{lng:s,lat:i}=e,a=6371e3,o=Math.cos(r*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-s)*Math.PI/180),l=Math.sin(r*Math.PI/180)*Math.sin(i*Math.PI/180);let h=o+l;return h>1&&(h=1),h<-1&&(h=-1),Math.acos(h)*a},formatLnglat(t,e){let n="";function r(s){const i=Math.floor(s),a=Math.floor((s-i)*60),o=(s-i)*3600-a*60;return`${i}°${a}′${o.toFixed(2)}″`}return this.isLnglat(t,e)?n=r(t)+","+r(e):isNaN(t)?isNaN(e)||(n=r(e)):n=r(t),n},transformLnglat(t,e){function n(r){let i=/[sw]/i.test(r)?-1:1;const a=r.match(/[\d.]+/g)||[];let o=0;for(let l=0;l<a.length;l++)o+=parseFloat(a[l])/i,i*=60;return o}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,s=!1,i=0,a=e.length,o=a-1;i<a;o=i,i++){var l=e[i].x,h=e[i].y,c=e[o].x,u=e[o].y;if(l===n&&h===r||c===n&&u===r)return"on";if(h<r&&u>=r||h>=r&&u<r){var f=l+(r-h)*(c-l)/(u-h);if(f===n)return"on";f>n&&(s=!s)}}return s?"in":"out"},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,s=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:s}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,a=s-n,o=i-r,l=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:l}},calcBearAndDisByPoints(t,e){var n=t.lat*1,r=t.lng*1,s=e.lat*1,i=e.lng*1,a=Math.sin((i-r)*this.toRadian)*Math.cos(s*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(s*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.cos((i-r)*this.toRadian),l=Math.atan2(a,o)*(180/Math.PI),h=(s-n)*this.toRadian,c=(i-r)*this.toRadian,u=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.sin(c/2)*Math.sin(c/2),f=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),y=this.R*f;return{angle:l,distance:y}},distanceToSegment(t,e,n){const r=t.x,s=t.y,i=e.x,a=e.y,o=n.x,l=n.y,h=(o-i)*(r-i)+(l-a)*(s-a);if(h<=0)return Math.sqrt((r-i)*(r-i)+(s-a)*(s-a));const c=(o-i)*(o-i)+(l-a)*(l-a);if(h>=c)return Math.sqrt((r-o)*(r-o)+(s-l)*(s-l));const u=h/c,f=i+(o-i)*u,y=a+(l-a)*u;return Math.sqrt((r-f)*(r-f)+(s-y)*(s-y))},calcPointByBearAndDis(t,e,n){const r=M.toRadians(t.lat*1),s=M.toRadians(t.lng*1),i=n/this.R;e=M.toRadians(e);const a=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),o=s+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(a));return{lat:M.toDegrees(a),lng:M.toDegrees(o)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const s=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:s}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var s=e*Math.PI/180;const i=n/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)));return{x:r,y:i}},interpolate({x:t,y:e,z:n=0},{x:r,y:s,z:i=0},a){const o=r-t,l=s-e,h=i-n;return{x:t+o*a,y:e+l*a,z:n+h*a}}},K={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),r=new Array(n.length);for(let a=0;a<n.length;a++)r[a]=n.charCodeAt(a);const s=new Uint8Array(r);return new Blob([s],{type:e})},convertBase64ToFile(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/png",i=atob(n[1]),a=new Uint8Array(i.length);for(let l=0;l<i.length;l++)a[l]=i.charCodeAt(l);return new File([a],e,{type:s})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),s=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(s)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},Y={debounce(t,e,n=!0){let r=null,s,i,a;const o=()=>{const l=Date.now()-i;l<e&&l>0?r=setTimeout(o,e-l):(r=null,n||(a=t.apply(this,s)))};return(...l)=>{i=Date.now();const h=n&&!r;return r||(r=setTimeout(o,e)),h&&(a=t.apply(this,l),r||(l=null)),a}},throttle(t,e,n=1){let r=0,s=null;return(...i)=>{if(n===1){const a=Date.now();a-r>=e&&(t.apply(this,i),r=a)}else n===2&&(s||(s=setTimeout(()=>{s=null,t.apply(this,i)},e)))}},memoize(t){const e=new Map;return(...n)=>{const r=JSON.stringify(n);if(e.has(r))return e.get(r);{const s=t.apply(this,n);return e.set(r,s),s}}},recurve(t,e=500,n=5e3){let r=0;setTimeout(()=>{r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))},e)}},z={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(w.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,s)=>`${n}${e[s-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var s=Math.floor(n/2),i=s;i<t.length;i++){let a=t.substring(e,i);if(a.replace(r,"mm").length>=n)return a}return t},asString(t){if(w.isEmpty(t))return"";switch(w.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},replaceAll(t,e,n){if(!t)return t;for(;t.indexOf(e)>-1;)t=t.replace(e,n);return t}},p=class p{static set(e,n=null,r=null){var s=this._getPrefixedKey(e,r);try{localStorage.setItem(s,JSON.stringify({data:n}))}catch{console&&console.warn("StoreUtil didn't successfully save the '{"+e+": "+n+"}' pair, because the localStorage is full.")}}static get(e,n,r){var s=this._getPrefixedKey(e,r),i;try{i=JSON.parse(localStorage.getItem(s)||"")}catch{localStorage[s]?i={data:localStorage.getItem(s)}:i=null}if(i){if(typeof i=="object"&&typeof i.data<"u")return i.data}else return n}static keys(){const e=[];var n=Object.keys(localStorage);return p.prefix.length===0?n:(n.forEach(function(r){r.indexOf(p.prefix)!==-1&&e.push(r.replace(p.prefix,""))}),e)}static getAll(e){var n=p.keys();if(e){const r=[];return n.forEach(s=>{if(e.includes(s)){const i={};i[s]=p.get(s,null,null),r.push(i)}}),r}return n.map(r=>p.get(r,null,null))}static remove(e,n){var r=this._getPrefixedKey(e,n);localStorage.removeItem(r)}static clear(e){p.prefix.length?this.keys().forEach(n=>{localStorage.removeItem(this._getPrefixedKey(n,e))}):localStorage.clear()}};m(p,"prefix",""),m(p,"_getPrefixedKey",function(e,n){return n=n||{},n.noPrefix?e:p.prefix+e});let b=p;const X={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var r=n,s=t[n];e.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}var i=e.join("&");return i},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:s}=new URL(t),i=[r,s];let a={};for(let o=0;o<i.length;o++){const l=i[o];if(l){const c=l.replace(/#|\//g,"").split("?");if(c.length>1)for(let u=1;u<c.length;u++){let f;for(;f=n.exec(c[u]);)a[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return a}};d.AjaxUtil=A,d.ArrayUtil=N,d.AudioPlayer=U,d.BrowserUtil=F,d.CanvasDrawer=T,d.ColorUtil=G,d.Cookie=B,d.CoordsUtil=$,d.DateUtil=J,d.DomUtil=H,d.ErrorType=R,d.EventDispatcher=_,d.EventType=g,d.FileUtil=K,d.GeoJsonUtil=q,d.GeoUtil=W,d.GraphicType=D,d.HashMap=C,d.ImageUtil=L,d.LayerType=x,d.MathUtil=M,d.MeasureMode=O,d.ObjectState=I,d.ObjectUtil=P,d.OptimizeUtil=Y,d.StoreUtil=b,d.StringUtil=z,d.UrlUtil=X,d.Util=w,d.WebSocketClient=k,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(u,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("mqtt-browser")):typeof define=="function"&&define.amd?define(["exports","mqtt-browser"],y):(u=typeof globalThis<"u"?globalThis:u||self,y(u["gis-common"]={},u.mqttBrowser))})(this,function(u,y){"use strict";var nt=Object.defineProperty;var st=(u,y,p)=>y in u?nt(u,y,{enumerable:!0,configurable:!0,writable:!0,value:p}):u[y]=p;var m=(u,y,p)=>st(u,typeof y!="symbol"?y+"":y,p);var p=(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))(p||{}),b=(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.COORDINATE_ERROR="坐标验证失败",t.JSON_PARSE_ERROR="JSON解析失败,格式有误",t.JSON_VALUE_ERROR="JSON无此键",t.PARAMETER_ERROR="验证数据类型失败",t.PARAMETER_ERROR_ARRAY="格式类型验证失败:必须是数组",t.PARAMETER_ERROR_STRING="格式类型验证失败:必须是字符",t.PARAMETER_ERROR_FUNCTION="格式类型验证失败:必须是函数",t.PARAMETER_ERROR_OBJECT="格式类型验证失败:必须是对象",t.PARAMETER_ERROR_LACK="参数缺失",t.STRING_CHECK_LOSS="字符缺少关键字",t))(b||{}),v=(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))(v||{}),L=(t=>(t.POINT="point",t.POLYLINE="polyline",t.POLYGON="polygon",t.BILLBOARD="billboard",t.CYLINDER="cylinder",t.ELLIPSOID="ellipsoid",t.LABEL="label",t.MODEL="model",t.WALL="wall",t))(L||{}),U=(t=>(t.DISTANCE="distance",t.AREA="area",t.HEIGHT="height",t))(U||{}),N=(t=>(t.ADD="add",t.REMOVE="remove",t.INIT="init",t))(N||{});class B{constructor(e){m(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}const E={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)},minMax(t,e,n){return Math.min(Math.max(t,e),n)},maxMin(t,e,n){return Math.max(Math.min(t,n),e)}};class ${constructor(e){m(this,"context",null);if(typeof e=="string"&&(e=document.querySelector("#"+e),!e))throw new Error("Element not found");if(e instanceof HTMLElement){const n=e;if(n.getContext)this.context=n.getContext("2d");else throw new Error("getContext is not available on this element")}else throw new Error("Element is not an HTMLElement")}drawLine({x:e,y:n},{x:r,y:i},o={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const a=o.width||1,c=o.color||"#000";this.context.lineWidth=a,this.context.strokeStyle=c,this.context.moveTo(e,n),this.context.lineTo(r,i),this.context.stroke()}drawArc({x:e,y:n},r,i,o,a,c,l){if(!this.context)throw new Error("Canvas context is null or undefined");c?(this.context.fillStyle=l,this.context.beginPath(),this.context.arc(e,n,r,E.degreesToRadians(i),E.degreesToRadians(o),a),this.context.fill()):(this.context.strokeStyle=l,this.context.beginPath(),this.context.arc(e,n,r,E.degreesToRadians(i),E.degreesToRadians(o),a),this.context.stroke())}static createCanvas(e=1,n=1){let r;if(typeof document<"u")return r=document.createElement("canvas"),e&&(r.width=e),n&&(r.height=n),r}}class D{constructor(){m(this,"_listeners");m(this,"_mutex",{});m(this,"_context")}addEventListener(e,n,r,i){this._listeners===void 0&&(this._listeners={}),this._context=r;const o=this._mutex,a=this._listeners;return a[e]===void 0&&(a[e]=[]),a[e].indexOf(n)===-1&&(i&&(o[e]=n),a[e].push(n)),this}hasEventListener(e,n){if(this._listeners===null||this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(this._mutex[e]===n&&(this._mutex[e]=null),i!==void 0){const o=i.map(a=>a.toString()).indexOf(n.toString());o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);if(this._mutex[e.type]!==void 0){const o=i.find(a=>a===this._mutex[e.type]);if(o){o.call(this._context||this,e);return}}for(let o=0,a=i.length;o<a;o++){const c=i[o];typeof c=="function"&&c.call(this._context||this,e)}}}removeAllListener(){this._mutex={};for(const e in this._listeners)this._listeners[e]=[]}}class I extends Map{isEmpty(){return this.size===0}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}fromEntries(){}}I.prototype.fromEntries=function(t=[]){const e=new I;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class q extends D{constructor(n="ws://127.0.0.1:10088"){super();m(this,"maxCheckTimes",10);m(this,"url");m(this,"checkTimes",0);m(this,"connectStatus",!1);m(this,"client",null);this.maxCheckTimes=10,this.url=n,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const n=this;this.client.onopen=function(r){n.dispatchEvent({type:p.WEB_SOCKET_CONNECT,message:r})},this.client.onmessage=function(r){n.connectStatus=!0,n.dispatchEvent({type:p.WEB_SOCKET_MESSAGE,message:r})},this.client.onclose=function(r){n.dispatchEvent({type:p.WEB_SOCKET_CLOSE,message:r})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(r){n.dispatchEvent({type:p.WEB_SOCKET_ERROR,message:r})})}}catch(n){console.error("创建ws连接失败"+this.url+":"+n)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(n){this.checkTimes>n||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(n)},2e3)}send(n){return this.client&&this.client.readyState===1?(this.client.send(n),!0):(console.error(this.url+"消息发送失败:"+n),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}}const w={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},asArray(t){return this.isEmpty(t)?[]:Array.isArray(t)?t:[t]},asNumber(t){return Number.isNaN(Number(t))?0:Number(t)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},guid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const i=n[r];t[0]===i&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,i,o;for(r=0,i=e.length;r<i;r++){o=e[r];for(n in o)t[n]=o[n]}return t},convertToTree2(t,e="id",n="parentId",r="children"){const i=[];function o(a){const c=t.filter(l=>l[n]===a[e]).map(l=>(i.some(d=>d[e]===l[e])||o(l),l));c.length>0&&(a[r]=c)}return t.forEach(a=>{t.some(c=>c[n]===a[e])||(o(a),i.push(a))}),i},asyncLoadScript(t){return new Promise((e,n)=>{try{const r=document.createElement("script");r.type="text/javascript",r.src=t,"readyState"in r?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:(r.onload=function(){e(r)},r.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(r)}catch(r){n(r)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${e}`)},document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,(r,i)=>{const o=e[i];if(o===void 0)throw new Error(`${b.JSON_VALUE_ERROR}: ${r}`);return typeof o=="function"?o(e):o})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(t,...e){(typeof t!="object"||t===null)&&(t={});for(const n of e)if(typeof n=="object"&&n!==null)for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(typeof n[r]=="object"&&n[r]!==null?(t[r]||(t[r]=Array.isArray(n[r])?[]:{}),this.deepAssign(t[r],n[r])):t[r]=n[r]);return t},handleCopyValue(t){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,r)=>{try{document.execCommand("copy"),n()}catch{r(new Error("copy failed"))}finally{e.remove()}})}},isArray(t){return Array.isArray(t)},isObject(t){return Object.prototype.toString.call(t).indexOf("Object")>-1},isNil(t){return t===void 0||t==="undefined"||t===null||t==="null"},isNumber(t){return typeof t=="number"&&!isNaN(t)||typeof t=="string"&&Number.isFinite(+t)},isFunction(t){return this.isNil(t)?!1:typeof t=="function"||t.constructor!==null&&t.constructor===Function}},_={deepClone(t){return structuredClone(t)},isEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)},parse(t){return!t||typeof t!="string"?t:JSON.parse(t)}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const i=t(r),o=String(i);n[o]||(n[o]=!0,e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this},Array.prototype.clear=function(){return this.length=0,this};const C={create(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},x=class x extends D{constructor(n={}){super();m(this,"state");m(this,"context");m(this,"options");m(this,"client");m(this,"topics");this.context=w.extend(x.defaultContext,n),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:w.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0},this.client=y.connect(this.context.MQTT_SERVICE,this.options),this._onConnect(),this._onMessage(),this.state=0,this.topics=[]}_onConnect(){this.client.on("connect",()=>{this.state=1,console.log("链接mqtt成功==>"+this.context.MQTT_SERVICE),this.dispatchEvent({type:p.MQTT_CONNECT,message:this})}),this.client.on("error",n=>{console.log("链接mqtt报错",n),this.state=-1,this.dispatchEvent({type:p.MQTT_ERROR,message:this}),this.client.end(),this.client.reconnect()})}_onMessage(){this.client.on("message",(n,r)=>{let i=r,o="";r instanceof Uint8Array&&(i=r.toString());try{o=_.parse(i)}catch{throw new Error(b.JSON_PARSE_ERROR)}this.dispatchEvent({type:p.MQTT_MESSAGE,message:{topic:n,data:o}})})}sendMsg(n,r){if(!this.client.connected){console.error("客户端未连接");return}this.client.publish(n,r,{qos:1,retain:!0})}subscribe(n){return this.state===1?this.client.subscribe(n,{qos:1},(r,i)=>{r instanceof Error?console.error("订阅失败==>"+n,r):(this.topics=C.union(this.topics,n),console.log("订阅成功==>"+n))}):this.addEventListener(p.MQTT_CONNECT,r=>{this.client.subscribe(n,{qos:1},(i,o)=>{i instanceof Error?console.error("订阅失败==>"+n,i):(this.topics=C.union(this.topics,n),console.log("订阅成功==>"+n))})}),this}unsubscribe(n){return this.client.unsubscribe(n,{qos:1},(r,i)=>{r instanceof Error?console.error(`取消订阅失败==>${n}`,r):(this.topics=C.difference(this.topics,s),console.log(`取消订阅成功==>${n}`))}),this}unsubscribeAll(){this.unsubscribe(this.topics)}unconnect(){this.client.end(),this.client=null,this.dispatchEvent({type:p.MQTT_CLOSE,message:null}),console.log("断开mqtt成功==>"+this.context.MQTT_SERVICE)}};m(x,"defaultContext",{MQTT_USERNAME:"iRVMS-WEB",MQTT_PASSWORD:"novasky888",MQTT_SERVICE:`ws://${window.document.domain}:20007/mqtt`,MQTT_TIMEOUTM:2e4});let T=x;const k={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",getURL(t){let e;if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{e===void 0&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const r=e.getContext("2d");r&&(t instanceof ImageData?r.putImageData(t,0,0):r.drawImage(t,0,0,t.width,t.height)),n=e}return n.width>2048||n.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")},getBase64(t){return new Promise((e,n)=>{let r=new Image;r.setAttribute("crossOrigin","Anonymous"),r.src=t,r.onload=()=>{let i=this.getURL(r);e(i)},r.onerror=n})},parseBase64(t){let n=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);return n&&n.groups?{type:n.groups.type,ext:n.groups.type.split("/").slice(-1)[0],data:n.groups.data}:null},async copyImage(t){try{const e=await this.getBase64(t),n=this.parseBase64(e.dataURL);if(!n)throw new Error("Failed to parse base64 data.");let r=n.type,i=atob(n.data),o=new ArrayBuffer(i.length),a=new Uint8Array(o);for(let l=0;l<i.length;l++)a[l]=i.charCodeAt(l);let c=new Blob([o],{type:r});await navigator.clipboard.write([new ClipboardItem({[r]:c})])}catch(e){console.error("Failed to copy image to clipboard:",e)}}},A={jsonp(t,e){const n="_jsonp_"+w.guid(),r=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+n:t+="?callback="+n;let i=document.createElement("script");i.type="text/javascript",i.src=t,window[n]=function(o){e(null,o),r.removeChild(i),i=null,delete window[n]},r.appendChild(i)},get(t,e,n){if(w.isFunction(e)){const i=n;n=e,e=i}const r=A._getClient(n);if(r.open("GET",t,!0),e){for(const i in e.headers)r.setRequestHeader(i,e.headers[i]);r.withCredentials=e.credentials==="include",e.responseType&&(r.responseType=e.responseType)}return r.send(null),r},post(t,e={},n){let r;if(typeof t!="string"?(n=e.cb,r=e.postData,e={...e},delete e.cb,delete e.postData,t=e.url):(typeof e=="function"&&(n=e,e={}),r=e.postData),!n)throw new Error("Callback function is required");const i=A._getClient(n);return i.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(o=>{i.setRequestHeader(o,e.headers[o])}),typeof r!="string"&&(r=JSON.stringify(r)),i.send(r),i},_wrapCallback(t,e){return function(){t.readyState===4&&(t.status===200?t.responseType==="arraybuffer"?t.response.byteLength===0?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")}):e(null,t.responseText):e(new Error(t.statusText+","+t.status)))}},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch{throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=A._wrapCallback(e,t)),e},getArrayBuffer(t,e,n){if(w.isFunction(e)){const r=n;n=e,e=r}return e||(e={}),e.responseType="arraybuffer",A.get(t,e,n)},getImage(t,e,n){return A.getArrayBuffer(e,n,(r,i)=>{if(r)t.onerror&&t.onerror(r);else if(i){const o=window.URL||window.webkitURL,a=t.onload;t.onload=()=>{a&&a(),o.revokeObjectURL(t.src)};const c=new Blob([new Uint8Array(i.data)],{type:i.contentType});t.cacheControl=i.cacheControl,t.expires=i.expires,t.src=i.data.byteLength?o.createObjectURL(c):k.emptyImageUrl}})},getJSON(t,e,n){if(w.isFunction(e)){const i=n;n=e,e=i}const r=function(i,o){const a=o?_.parse(o):null;n&&n(i,a)};return e&&e.jsonp?A.jsonp(t,r):A.get(t,e,r)}},G={getExplorer(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||/Trident\//.test(t)?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0&&t.indexOf("Chrome")===-1?"Safari":"Unknown"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,i=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":i&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():"msRequestFullscreen"in e?e.msRequestFullscreen():"mozRequestFullScreen"in e?e.mozRequestFullScreen():"webkitRequestFullscreen"in e&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth||0,e=document.documentElement.clientHeight||0,n=document.getElementById("app");if(!n)return;const r=n.style,i=t/e,o=16/9;let a=t/1920;i>o&&(a=e/1080),r.transformOrigin="left top",r.transform=`scale(${a}) translateX(-49.99%)`,r.width=`${t/a}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e&&(e.style.fontSize=t/192+"px")}},J={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},j={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let i=this.transformLat(e-105,t-35),o=this.transformLon(e-105,t-35);const a=t/180*this.PI;let c=Math.sin(a);c=1-r*c*c;const l=Math.sqrt(c);return i=i*180/(6378245*(1-r)/(c*l)*this.PI),o=o*180/(6378245/l*Math.cos(a)*this.PI),{lat:i,lng:o}},outOfChina(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let i=.01,o=.01,a=t-i,c=e-o,l=t+i,d=e+o,h=0,f=0,g=0;for(;;){h=(a+l)/2,f=(c+d)/2;const R=this.gcjEncrypt(h,f);if(i=R.lat-t,o=R.lng-e,Math.abs(i)<1e-9&&Math.abs(o)<1e-9||(i>0?l=h:a=h,o>0?d=f:c=f,++g>1e4))break}return{lat:h,lng:f}},bdEncrypt(t,e){const n=e,r=t,i=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),o=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),a=i*Math.cos(o)+.0065;return{lat:i*Math.sin(o)+.006,lng:a}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,i=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),o=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),a=i*Math.cos(o);return{lat:i*Math.sin(o),lng:a}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},random({x:t,y:e},{x:n,y:r}){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}},deCompose(t,e,n){if(!Array.isArray(t))return n?e.call(n,t):e(t);const r=[];let i,o;for(let a=0,c=t.length;a<c;a++){if(i=t[a],w.isNil(i)){r.push(null);continue}Array.isArray(i)?r.push(this.deCompose(i,e,n)):(o=n?e.call(n,i):e(i),r.push(o))}return r}},H={random(){let t=Math.floor(Math.random()*256).toString(16),e=Math.floor(Math.random()*256).toString(16),n=Math.floor(Math.random()*256).toString(16);return t=t.length===1?"0"+t:t,e=e.length===1?"0"+e:e,n=n.length===1?"0"+n:n,"#"+t+e+n},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},rgbToRgba(t){const e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?`rgba(${e[1]}, 1)`:t},hexToRgba(t){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,n=t.replace(e,(l,d,h,f)=>d+d+h+h+f+f),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!i)return t;const o=parseInt(i[1],16),a=parseInt(i[2],16),c=parseInt(i[3],16);return`rgba(${o},${a},${c},1)`},hslToRgba(t){if(!t)return null;const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)return null;const n=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100,o=e[4]?parseFloat(e[4]):1;function a(h,f,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?h+(f-h)*6*g:g<1/2?f:g<2/3?h+(f-h)*(2/3-g)*6:h}let c,l,d;if(r===0)c=l=d=i;else{const h=i<.5?i*(1+r):i+r-i*r,f=2*i-h;c=a(f,h,n+1/3),l=a(f,h,n),d=a(f,h,n-1/3)}return`rgba(${Math.round(c*255)},${Math.round(l*255)},${Math.round(d*255)},${o})`},isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},isRgb(t){return/^rgb/.test(t)},isHsl(t){return/^hsl/.test(t)},isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)},colorToRgb(t){if(this.isRgb(t))return this.rgbToRgba(t);if(this.isHex(t))return this.hexToRgba(t);if(this.isHsl(t))return this.hslToRgba(t)}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)if(new RegExp("("+n+")").test(t)){const r=n.length===1?1:Number(n.slice(1));t=t.replace(RegExp.$1,("00"+e[n]).substr((""+e[n]).length+r-(e[n]+"").length))}return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const W={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),i=new Date(e).getTime()-n.getTime(),o=Math.floor(i/(24*3600*1e3)),a=i%(24*3600*1e3),c=Math.floor(a/(3600*1e3)),l=a%(3600*1e3),d=Math.floor(l/(60*1e3)),h=l%(60*1e3),f=Math.round(h/1e3);let g="";return o>0&&(g+=o+"天"),c>0&&(g+=c+"时"),d>0&&(g+=d+"分"),f>0&&(g+=f+"秒"),o===0&&c===0&&d===0&&f===0&&(g="少于1秒"),g},formatterCounter(t){const e=function(c){return(c>10?"":"0")+(c||0)},n=e(Math.floor(t/3600)),r=t%3600,i=e(Math.floor(r/60)),o=r%60,a=e(Math.round(o));return`${n}:${i}:${a}`},sleep(t){}};function Q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function F(t){return Q(t).split(/\s+/)}const K={getStyle(t,e){var r;let n=t.style[e];if(!n||n==="auto"){const i=(r=document.defaultView)==null?void 0:r.getComputedStyle(t,null);n=i?i[e]:null,n==="auto"&&(n=null)}return n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return((t==null?void 0:t.host)||t).className.toString()},hasClass(t,e){var r;if((r=t.classList)!=null&&r.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(t.classList!==void 0){const n=F(e);for(let r=0,i=n.length;r<i;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?F(e).forEach(r=>t.classList.remove(r)):this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach(n=>t.classList.add(n)))},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},S=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Y={getGeoJsonType(t){return t.geometry?t.geometry.type:null},isGeoJson(t){const e=this.getGeoJsonType(t);if(e){for(let n=0,r=S.length;n<r;n++)if(S[n]===e)return!0}return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!!(e&&(e===S[4]||e===S[5]))},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!!(e&&(e===S[2]||e===S[3]))},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!!(e&&(e===S[0]||e===S[1]))},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates(t){return t.geometry?t.geometry.coordinates:[]},getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const i=t.geometry.coordinates;if(!i)return null;let o=0,a=0,c=0;switch(n){case"Point":{o=i[0],a=i[1],c++;break}case"MultiPoint":case"LineString":{for(let h=0,f=i.length;h<f;h++)o+=i[h][0],a+=i[h][1],c++;break}case"MultiLineString":case"Polygon":{for(let h=0,f=i.length;h<f;h++)for(let g=0,R=i[h].length;g<R;g++)o+=i[h][g][0],a+=i[h][g][1],c++;break}case"MultiPolygon":{for(let h=0,f=i.length;h<f;h++)for(let g=0,R=i[h].length;g<R;g++)for(let O=0,et=i[h][g].length;O<et;O++)o+=i[h][g][O][0],a+=i[h][g][O][1],c++;break}}const l=o/c,d=a/c;return e?(e.x=l,e.y=d,e):{x:l,y:d}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},i=n.coordinates;if(!i)return null;const o=[];let a;switch(e){case"MultiPoint":{a="Point";break}case"MultiLineString":{a="LineString";break}case"MultiPolygon":{a="Polygon";break}}if(a)for(let c=0,l=i.length;c<l;c++)o.push({type:"Feature",geometry:{type:a,coordinates:i[c]},properties:r});else o.push(t);return o},getGeoJsonByCoordinates(t){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let e;if(t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number")e="Point";else if(Array.isArray(t[0])&&t[0].length===2)e="LineString";else if(Array.isArray(t[0])&&Array.isArray(t[0][0])){const n=t[0];if(n[0].join(",")===n[n.length-1].join(","))e="Polygon";else if(t.length>1)e="MultiPolygon";else throw Error("coordinates 参数格式错误")}else throw Error("coordinates 参数格式错误");return{type:"Feature",geometry:{type:e,coordinates:t}}}},z={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return!isNaN(t)&&!isNaN(e)&&+e>-90&&+e<90&&+t>-180&&+t<180},distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},distanceByPoints(t,e){const{lng:n,lat:r}=t,{lng:i,lat:o}=e,a=6371e3,c=Math.cos(r*Math.PI/180)*Math.cos(o*Math.PI/180)*Math.cos((n-i)*Math.PI/180),l=Math.sin(r*Math.PI/180)*Math.sin(o*Math.PI/180);let d=c+l;return d>1&&(d=1),d<-1&&(d=-1),Math.acos(d)*a},formatLnglat(t,e){let n="";function r(i){const o=Math.floor(i),a=Math.floor((i-o)*60),c=(i-o)*3600-a*60;return`${o}°${a}′${c.toFixed(2)}″`}return this.isLnglat(t,e)?n=r(t)+","+r(e):isNaN(t)?isNaN(e)||(n=r(e)):n=r(t),n},transformLnglat(t,e){function n(r){let o=/[sw]/i.test(r)?-1:1;const a=r.match(/[\d.]+/g)||[];let c=0;for(let l=0;l<a.length;l++)c+=parseFloat(a[l])/o,o*=60;return c}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,i=!1,o=0,a=e.length,c=a-1;o<a;c=o,o++){var l=e[o].x,d=e[o].y,h=e[c].x,f=e[c].y;if(l===n&&d===r||h===n&&f===r)return"on";if(d<r&&f>=r||d>=r&&f<r){var g=l+(r-d)*(h-l)/(f-d);if(g===n)return"on";g>n&&(i=!i)}}return i?"in":"out"},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,i=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:i}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:i,y:o}=e,a=i-n,c=o-r,l=Math.sqrt(a*a+c*c);return{angle:(Math.atan2(c,a)*(180/Math.PI)+360+90)%360,distance:l}},calcBearAndDisByPoints(t,e){var n=t.lat*1,r=t.lng*1,i=e.lat*1,o=e.lng*1,a=Math.sin((o-r)*this.toRadian)*Math.cos(i*this.toRadian),c=Math.cos(n*this.toRadian)*Math.sin(i*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.cos((o-r)*this.toRadian),l=Math.atan2(a,c)*(180/Math.PI),d=(i-n)*this.toRadian,h=(o-r)*this.toRadian,f=Math.sin(d/2)*Math.sin(d/2)+Math.cos(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.sin(h/2)*Math.sin(h/2),g=2*Math.atan2(Math.sqrt(f),Math.sqrt(1-f)),R=this.R*g;return{angle:l,distance:R}},distanceToSegment(t,e,n){const r=t.x,i=t.y,o=e.x,a=e.y,c=n.x,l=n.y,d=(c-o)*(r-o)+(l-a)*(i-a);if(d<=0)return Math.sqrt((r-o)*(r-o)+(i-a)*(i-a));const h=(c-o)*(c-o)+(l-a)*(l-a);if(d>=h)return Math.sqrt((r-c)*(r-c)+(i-l)*(i-l));const f=d/h,g=o+(c-o)*f,R=a+(l-a)*f;return Math.sqrt((r-g)*(r-g)+(i-R)*(i-R))},calcPointByBearAndDis(t,e,n){const r=E.toRadians(t.lat*1),i=E.toRadians(t.lng*1),o=n/this.R;e=E.toRadians(e);const a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(e)),c=i+Math.atan2(Math.sin(e)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a));return{lat:E.toDegrees(a),lng:E.toDegrees(c)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const i=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:i}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var i=e*Math.PI/180;const o=n/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)));return{x:r,y:o}},interpolate({x:t,y:e,z:n=0},{x:r,y:i,z:o=0},a){const c=r-t,l=i-e,d=o-n;return{x:t+c*a,y:e+l*a,z:n+d*a}}},X={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),r=new Array(n.length);for(let a=0;a<n.length;a++)r[a]=n.charCodeAt(a);const i=new Uint8Array(r);return new Blob([i],{type:e})},convertBase64ToFile(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),i=r?r[1]:"image/png",o=atob(n[1]),a=new Uint8Array(o.length);for(let l=0;l<o.length;l++)a[l]=o.charCodeAt(l);return new File([a],e,{type:i})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),i=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(i)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},V={debounce(t,e,n=!0){let r=null,i,o,a;const c=()=>{const l=Date.now()-o;l<e&&l>0?r=setTimeout(c,e-l):(r=null,n||(a=t.apply(this,i)))};return(...l)=>{o=Date.now();const d=n&&!r;return r||(r=setTimeout(c,e)),d&&(a=t.apply(this,l),r||(l=null)),a}},throttle(t,e,n=1){let r=0,i=null;return(...o)=>{if(n===1){const a=Date.now();a-r>=e&&(t.apply(this,o),r=a)}else n===2&&(i||(i=setTimeout(()=>{i=null,t.apply(this,o)},e)))}},memoize(t){const e=new Map;return(...n)=>{const r=JSON.stringify(n);if(e.has(r))return e.get(r);{const i=t.apply(this,n);return e.set(r,i),i}}},recurve(t,e=500,n=5e3){let r=0;setTimeout(()=>{r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))},e)}},Z={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(w.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,i)=>`${n}${e[i-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var i=Math.floor(n/2),o=i;o<t.length;o++){let a=t.substring(e,o);if(a.replace(r,"mm").length>=n)return a}return t},asString(t){if(w.isEmpty(t))return"";switch(w.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},replaceAll(t,e,n){if(!t)return t;for(;t.indexOf(e)>-1;)t=t.replace(e,n);return t}},M=class M{static set(e,n=null,r=null){var i=this._getPrefixedKey(e,r);try{localStorage.setItem(i,JSON.stringify({data:n}))}catch{console&&console.warn("StoreUtil didn't successfully save the '{"+e+": "+n+"}' pair, because the localStorage is full.")}}static get(e,n,r){var i=this._getPrefixedKey(e,r),o;try{o=JSON.parse(localStorage.getItem(i)||"")}catch{localStorage[i]?o={data:localStorage.getItem(i)}:o=null}if(o){if(typeof o=="object"&&typeof o.data<"u")return o.data}else return n}static keys(){const e=[];var n=Object.keys(localStorage);return M.prefix.length===0?n:(n.forEach(function(r){r.indexOf(M.prefix)!==-1&&e.push(r.replace(M.prefix,""))}),e)}static getAll(e){var n=M.keys();if(e){const r=[];return n.forEach(i=>{if(e.includes(i)){const o={};o[i]=M.get(i,null,null),r.push(o)}}),r}return n.map(r=>M.get(r,null,null))}static remove(e,n){var r=this._getPrefixedKey(e,n);localStorage.removeItem(r)}static clear(e){M.prefix.length?this.keys().forEach(n=>{localStorage.removeItem(this._getPrefixedKey(n,e))}):localStorage.clear()}};m(M,"prefix",""),m(M,"_getPrefixedKey",function(e,n){return n=n||{},n.noPrefix?e:M.prefix+e});let P=M;const tt={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var r=n,i=t[n];e.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}var o=e.join("&");return o},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:i}=new URL(t),o=[r,i];let a={};for(let c=0;c<o.length;c++){const l=o[c];if(l){const h=l.replace(/#|\//g,"").split("?");if(h.length>1)for(let f=1;f<h.length;f++){let g;for(;g=n.exec(h[f]);)a[g[1]]=e?decodeURIComponent(g[2]):g[2]}}}return a}};u.AjaxUtil=A,u.ArrayUtil=C,u.AudioPlayer=B,u.BrowserUtil=G,u.CanvasDrawer=$,u.ColorUtil=H,u.Cookie=J,u.CoordsUtil=j,u.DateUtil=W,u.DomUtil=K,u.ErrorType=b,u.EventDispatcher=D,u.EventType=p,u.FileUtil=X,u.GeoJsonUtil=Y,u.GeoUtil=z,u.GraphicType=L,u.HashMap=I,u.ImageUtil=k,u.LayerType=v,u.MathUtil=E,u.MeasureMode=U,u.MqttClient=T,u.ObjectState=N,u.ObjectUtil=_,u.OptimizeUtil=V,u.StoreUtil=P,u.StringUtil=Z,u.UrlUtil=tt,u.Util=w,u.WebSocketClient=q,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/dist/utils/CommUtil.d.ts
CHANGED
|
@@ -6,8 +6,22 @@ declare const _default: {
|
|
|
6
6
|
* @returns 返回数据类型字符串
|
|
7
7
|
*/
|
|
8
8
|
getDataType(data: any): any;
|
|
9
|
+
asArray(obj: any): any[];
|
|
10
|
+
asNumber(a: any): number;
|
|
11
|
+
/**
|
|
12
|
+
* 判断传入的值是否为空
|
|
13
|
+
*
|
|
14
|
+
* @param value 待判断的值
|
|
15
|
+
* @returns 返回布尔值,表示是否为空
|
|
16
|
+
*/
|
|
9
17
|
isEmpty(value: any): boolean;
|
|
10
18
|
isNotEmpty(val: any): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 将JSON对象转换为FormData对象
|
|
21
|
+
*
|
|
22
|
+
* @param json 待转换的JSON对象,其属性值为字符串或Blob类型
|
|
23
|
+
* @returns 转换后的FormData对象
|
|
24
|
+
*/
|
|
11
25
|
json2form(json: {
|
|
12
26
|
[x: string]: string | Blob;
|
|
13
27
|
}): FormData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gis-common",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"author": "Guo.Yan <luv02@vip.qq.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"type": "git",
|
|
27
27
|
"url": ""
|
|
28
28
|
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"mqtt-browser": "^4.3.7"
|
|
31
|
+
},
|
|
29
32
|
"devDependencies": {
|
|
30
33
|
"typescript": "^5.5.4",
|
|
31
34
|
"vite": "^5.4.0",
|