gis-common 3.1.11 → 3.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["gis-common"]={}))})(this,function(l){"use strict";var ft=Object.defineProperty;var mt=(l,m,p)=>m in l?ft(l,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[m]=p;var g=(l,m,p)=>mt(l,typeof m!="symbol"?m+"":m,p);const m={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},p={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},z={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},j={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},H={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},q={ADD:"add",REMOVE:"remove",INIT:"init"},Y={animate(e,t,n,s="swing",i=5){for(var r in t)t[r]={target:r==="opacity"?parseInt(t[r]*100):t[r],iNow:parseInt(r==="opacity"?getComputedStyle(e)[r]*100:getComputedStyle(e)[r])};s==="liner"&&(i=t[r].iNow<t[r].target?Math.abs(i):-Math.abs(i)),clearInterval(e.timer),e.timer=setInterval(function(){for(var a in t){var o=t[a].target,c=t[a].iNow;if(s==="swing"&&(i=(o-c)/20,i=i>0?Math.ceil(i):Math.floor(i)),Math.abs(o-c)<=Math.abs(i)){a==="opacity"?e.style[a]=o/100:e.style[a]=o+"px",delete t[a];for(var h in t)return!1;clearInterval(e.timer),typeof n=="function"&&n()}else t[a].iNow+=i,a==="opacity"?e.style[a]=t[a].iNow/100:e.style[a]=t[a].iNow+"px"}},30)}},M={getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)},isEmpty(e){if(e==null)return!0;switch(this.getDataType(e)){case"String":return e.trim()==="";case"Array":return!e.length;case"Object":return!Object.keys(e).length;case"Boolean":return!e;default:return!1}},isNotEmpty(e){return!this.isEmpty(e)},json2form(e){const t=new FormData;return Object.keys(e).forEach(n=>{t.append(n,e[n]instanceof Object?JSON.stringify(e[n]):e[n])}),t},json2Query(e){var t=[];for(var n in e){var s=n,i=e[n];t.push(s+"="+i)}var r=t.join("&");return r},generateGuid(){const e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()+e()+e()},decodeDict(...e){let t="";if(e.length>1){const n=e.slice(1,e.length%2===0?e.length-1:e.length);for(let s=0;s<n.length;s=s+2){const i=n[s];e[0]===i&&(t=n[s+1])}!t&&e.length%2===0&&(t=e[e.length-1])}else t=e[0];return t},extend(e,...t){let n,s,i,r;for(s=0,i=t.length;s<i;s++){r=t[s];for(n in r)e[n]=r[n]}return e},rgb2hex(e){var t="#"+(16777216+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1);return t},convertToTree2(e,t="id",n="parentId",s="children"){const i=[];function r(a){const o=e.filter(c=>c[n]===a[t]).map(c=>(i.some(h=>h[t]===c[t])||r(c),c));o.length>0&&(a[s]=o)}return e.forEach(a=>{e.some(o=>o[n]===a[t])||(r(a),i.push(a))}),i},asyncLoadScript(e){return new Promise((t,n)=>{try{const s=document.createElement("script");s.type="text/javascript",s.src=e,"readyState"in s?s.onreadystatechange=function(){(s.readyState==="complete"||s.readyState==="loaded")&&t(s)}:(s.onload=function(){t(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+e))}),document.body.appendChild(s)}catch(s){n(s)}})},loadStyle(e){e.forEach(t=>{const n=document.createElement("link");n.href=t,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(n)})},template(e,t){const n=/\{ *([\w_-]+) *\}/g;return e.replace(n,(s,i)=>{const r=t[i];if(r===void 0)throw new Error(`${p.JSON_VALUE_ERROR}: ${s}`);return typeof r=="function"?r(t):r})},deleteEmptyProperty(e){return Object.fromEntries(Object.keys(e).filter(t=>!this.isEmpty(e[t])).map(t=>[t,e[t]]))},deepAssign(e,...t){(typeof e!="object"||e===null)&&(e={});for(const n of t)if(typeof n=="object"&&n!==null)for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(typeof n[s]=="object"&&n[s]!==null?(e[s]||(e[s]=Array.isArray(n[s])?[]:{}),this.deepAssign(e[s],n[s])):e[s]=n[s]);return e},handleCopyValue(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e);{const t=document.createElement("textarea");return t.style.position="fixed",t.style.top=t.style.left="-100vh",t.style.opacity="0",t.value=e,document.body.appendChild(t),t.focus(),t.select(),new Promise((n,s)=>{try{document.execCommand("copy"),n()}catch{s(new Error("copy failed"))}finally{t.remove()}})}}};Array.prototype.groupBy=function(e){var t={};return this.forEach(function(n){var s=JSON.stringify(e(n));t[s]=t[s]||[],t[s].push(n)}),Object.keys(t).map(n=>t[n])},Array.prototype.distinct=function(e=t=>t){const t=[],n={};return this.forEach(s=>{const i=e(s);!n[i]&&(n[i]=t.push(s))}),t},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((e=0,t=0)=>e+t):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(e=t=>t){return this.sort((t,n)=>e(n)-e(t))},Array.prototype.asc=function(e=t=>t){return this.sort((t,n)=>e(t)-e(n))},Array.prototype.clear=function(){return this.length=0,this};const K={asArray(e){return M.isEmpty(e)?[]:Array.isArray(e)?e:[e]},generateArray(e){return[...new Array(e).keys()]},union(...e){let t=[];return e.forEach(n=>{Array.isArray(n)&&(t=t.concat(n.filter(s=>!t.includes(s))))}),t},intersection(...e){let t=e[0]||[];return e.forEach(n=>{Array.isArray(n)&&(t=t.filter(s=>n.includes(s)))}),t},unionAll(...e){return[...e].flat().filter(t=>!!t)},difference(...e){return this.union(...e).filter(t=>!this.intersection(...e).includes(t))}},J={getUrlParams(e=window.location.href,t=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:s,hash:i}=new URL(e),r=[s,i];let a={};for(let o=0;o<r.length;o++){const c=r[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)a[f[1]]=t?decodeURIComponent(f[2]):f[2]}}}return a},getExplorer(){var e=window.navigator.userAgent;if(e.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window)return"IE";if(e.indexOf("Firefox")>=0)return"Firefox";if(e.indexOf("Chrome")>=0)return"Chrome";if(e.indexOf("Opera")>=0)return"Opera";if(e.indexOf("Safari")>=0)return"Safari"},detectOS(){let e="";const t=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,s=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,i=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return t?e="MS Windows":n?e="Apple mac":s?e="Linux":i&&(e="Unix"),e},switchFullScreen(e){if(e){const t=document.documentElement;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale(){const e=document.documentElement.clientWidth,t=document.documentElement.clientHeight,n=document.getElementById("app").style,s=e/t,i=16/9;let r=e/1920;s>i&&(r=t/1080),n.transformOrigin="left top",n.transform=`scale(${r}) translateX(-49.99%)`,n.width=`${e/r}px`},getHtmlFontSize(){const e=document.documentElement.clientWidth||document.body.clientWidth,t=document.querySelector("html");t.style.fontSize=e/192+"px"}},Q={set:function(e,t,n=30){var s=new Date;s.setTime(s.getTime()+n*24*60*60*1e3),document.cookie=e+"="+escape(t)+";expires="+s.toUTCString()},remove:function(e){var t=new Date;t.setTime(t.getTime()-1);var n=this.get(e);n!=null&&(document.cookie=e+"="+n+";expires="+t.toUTCString())},get:function(e){var t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]*)(;|$)"));return t!=null?t[2]:""}},X={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(e,t){const s=.006693421622965943;let i=this.transformLat(t-105,e-35),r=this.transformLon(t-105,e-35);const a=e/180*this.PI;let o=Math.sin(a);o=1-s*o*o;const c=Math.sqrt(o);return i=i*180/(6378245*(1-s)/(o*c)*this.PI),r=r*180/(6378245/c*Math.cos(a)*this.PI),{lat:i,lng:r}},gcjEncrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e+n.lat,lng:t+n.lng}},gcjDecrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e-n.lat,lng:t-n.lng}},gcjDecryptExact(e,t){let i=.01,r=.01,a=e-i,o=t-r,c=e+i,h=t+r,u=0,d=0,f=0;for(;;){u=(a+c)/2,d=(o+h)/2;const w=this.gcjEncrypt(u,d);if(i=w.lat-e,r=w.lng-t,Math.abs(i)<1e-9&&Math.abs(r)<1e-9||(i>0?c=u:a=u,r>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(e,t){const n=t,s=e,i=Math.sqrt(n*n+s*s)+2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)+3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r)+.0065;return{lat:i*Math.sin(r)+.006,lng:a}},bdDecrypt(e,t){const n=t-.0065,s=e-.006,i=Math.sqrt(n*n+s*s)-2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)-3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r);return{lat:i*Math.sin(r),lng:a}},mercatorEncrypt(e,t){const n=t*2003750834e-2/180;let s=Math.log(Math.tan((90+e)*this.PI/360))/(this.PI/180);return s=s*2003750834e-2/180,{lat:s,lng:n}},mercatorDecrypt(e,t){const n=t/2003750834e-2*180;let s=e/2003750834e-2*180;return s=180/this.PI*(2*Math.atan(Math.exp(s*this.PI/180))-this.PI/2),{lat:s,lng:n}},distance(e,t,n,s){const r=Math.cos(e*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((t-s)*this.PI/180),a=Math.sin(e*this.PI/180)*Math.sin(n*this.PI/180);let o=r+a;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(e,t){return t<72.004||t>137.8347||e<.8293||e>55.8271},transformLat(e,t){let n=-100+2*e+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(160*Math.sin(t/12*this.PI)+320*Math.sin(t*this.PI/30))*2/3,n},transformLon(e,t){let n=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(150*Math.sin(e/12*this.PI)+300*Math.sin(e/30*this.PI))*2/3,n},randomCoordinate(e,t,n,s){return{lat:Math.random()*(s-t)+t,lng:Math.random()*(n-e)+e}}};Date.prototype.format=function(e){const t={"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(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in t)if(new RegExp("("+n+")").test(e)){const s=n.length===1?1:Number(n.slice(1));e=e.replace(RegExp.$1,("00"+t[n]).substr((""+t[n]).length+s-(t[n]+"").length))}return e},Date.prototype.addDate=function(e,t){const n=new Date(this);switch(e){case"y":n.setFullYear(this.getFullYear()+t);break;case"q":n.setMonth(this.getMonth()+t*3);break;case"M":n.setMonth(this.getMonth()+t);break;case"w":n.setDate(this.getDate()+t*7);break;case"d":n.setDate(this.getDate()+t);break;case"h":n.setHours(this.getHours()+t);break;case"m":n.setMinutes(this.getMinutes()+t);break;case"s":n.setSeconds(this.getSeconds()+t);break;default:n.setDate(this.getDate()+t);break}return n};const V={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(e){if(typeof e=="string"){var t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(t&&t.length>3)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),t&&t.length>6)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),t&&t.length>7)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]),parseInt(t[7]))}return null},formatDateInterval(e,t){const n=new Date(e),i=new Date(t).getTime()-n.getTime(),r=Math.floor(i/(24*3600*1e3)),a=i%(24*3600*1e3),o=Math.floor(a/(3600*1e3)),c=a%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return r>0&&(f+=r+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),r===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(e){const t=function(o){return(o>10?"":"0")+(o||0)},n=t(Math.floor(e/3600)),s=e%3600,i=t(Math.floor(s/60)),r=s%60,a=t(Math.round(r));return`${n}:${i}:${a}`},sleep(e){}};function Z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function N(e){return Z(e).split(/\s+/)}const tt={getStyle(e,t){var s;let n=e.style[t];if(!n||n==="auto"){const i=(s=document.defaultView)==null?void 0:s.getComputedStyle(e,null);n=i?i[t]:null,n==="auto"&&(n=null)}return n},create(e,t,n){const s=document.createElement(e);return s.className=t||"",n&&n.appendChild(s),s},remove(e){const t=e.parentNode;t&&t.removeChild(e)},empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)},toFront(e){const t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)},toBack(e){const t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)},getClass(e){return((e==null?void 0:e.host)||e).className.toString()},hasClass(e,t){var s;if((s=e.classList)!=null&&s.contains(t))return!0;const n=this.getClass(e);return n.length>0&&new RegExp(`(^|\\s)${t}(\\s|$)`).test(n)},addClass(e,t){if(e.classList!==void 0){const n=N(t);for(let s=0,i=n.length;s<i;s++)e.classList.add(n[s])}else if(!this.hasClass(e,t)){const n=this.getClass(e);this.setClass(e,(n?n+" ":"")+t)}},removeClass(e,t){e.classList!==void 0?N(t).forEach(s=>e.classList.remove(s)):this.setClass(e,(" "+this.getClass(e)+" ").replace(" "+t+" "," ").trim())},setClass(e,t){"classList"in e&&(e.classList.value="",t.split(" ").forEach(n=>e.classList.add(n)))},parseFromString(e){return new DOMParser().parseFromString(e,"text/xml").children[0]}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat(e,t){return e+Math.random()*(t-e)},degreesToRadians(e){return e*this.DEG2RAD},toRadians(e){return e*this.DEG2RAD},radiansToDegrees(e){return e*this.RAD2DEG},toDegrees(e){return e*this.RAD2DEG},formatFloat(e,t=2){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}},k={toRadian:Math.PI/180,R:6371393,isLnglat(e,t){return!isNaN(e)&&!isNaN(t)&&+t>-90&&+t<90&&+e>-180&&+e<180},formatLnglat(e,t){let n="";function s(i){const r=Math.floor(i),a=Math.floor((i-r)*60),o=(i-r)*3600-a*60;return`${r}°${a}′${o.toFixed(2)}″`}return this.isLnglat(e,t)?n=s(e)+","+s(t):isNaN(e)?isNaN(t)||(n=s(t)):n=s(e),n},transformLnglat(e,t){function n(s){let r=/[sw]/i.test(s)?-1:1;const a=s.match(/[\d.]+/g)||[];let o=0;for(let c=0;c<a.length;c++)o+=parseFloat(a[c])/r,r*=60;return o}if(e&&t)return{lng:n(e),lat:n(t)}},rayCasting(e,t){for(var n=e.x,s=e.y,i=!1,r=0,a=t.length,o=a-1;r<a;o=r,r++){var c=t[r].x,h=t[r].y,u=t[o].x,d=t[o].y;if(c===n&&h===s||u===n&&d===s)return"on";if(h<s&&d>=s||h>=s&&d<s){var f=c+(s-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(i=!i)}}return i?"in":"out"},wgs84PointsDistance(e,t){var n=Math.PI;function s(dt){return dt*n/180}if(arguments.length!=2)return 0;const i=e.x,r=e.y,a=t.x,o=t.y;var c=6378137,h=63567523142e-4,u=1/298.257223563,d=s(a-i),f=Math.atan((1-u)*Math.tan(s(r))),w=Math.atan((1-u)*Math.tan(s(o))),A=Math.sin(f),S=Math.cos(f),b=Math.sin(w),v=Math.cos(w),O=d,B,W=100;do{var _=Math.sin(O),x=Math.cos(O),D=Math.sqrt(v*_*(v*_)+(S*b-A*v*x)*(S*b-A*v*x));if(D==0)return 0;var T=A*b+S*v*x,G=Math.atan2(D,T),P=S*v*_/D,I=1-P*P,E=T-2*A*b/I;isNaN(E)&&(E=0);var L=u/16*I*(4+u*(4-3*I));B=O,O=d+(1-L)*u*P*(G+L*D*(E+L*T*(-1+2*E*E)))}while(Math.abs(O-B)>1e-12&&--W>0);if(W==0)return NaN;var R=I*(c*c-h*h)/(h*h),lt=1+R/16384*(4096+R*(-768+R*(320-175*R))),U=R/1024*(256+R*(-128+R*(74-47*R))),ht=U*D*(E+U/4*(T*(-1+2*E*E)-U/6*E*(-3+4*D*D)*(-3+4*E*E))),ut=h*lt*(G-ht);return ut},rotatePoint(e,t,n){const s=(e.x-t.x)*Math.cos(Math.PI/180*-n)-(e.y-t.y)*Math.sin(Math.PI/180*-n)+t.x,i=(e.x-t.x)*Math.sin(Math.PI/180*-n)+(e.y-t.y)*Math.cos(Math.PI/180*-n)+t.y;return{x:s,y:i}},calcBearAndDis(e,t){const{x:n,y:s}=e,{x:i,y:r}=t,a=i-n,o=r-s,c=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(e,t){var n=e.lat*1,s=e.lng*1,i=t.lat*1,r=t.lng*1,a=Math.sin((r-s)*this.toRadian)*Math.cos(i*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(i*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.cos((r-s)*this.toRadian),c=Math.atan2(a,o)*(180/Math.PI),h=(i-n)*this.toRadian,u=(r-s)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),w=this.R*f;return{angle:c,distance:w}},calcPointByBearAndDis(e,t,n){const s=y.toRadians(e.lat*1),i=y.toRadians(e.lng*1),r=n/this.R;t=y.toRadians(t);const a=Math.asin(Math.sin(s)*Math.cos(r)+Math.cos(s)*Math.sin(r)*Math.cos(t)),o=i+Math.atan2(Math.sin(t)*Math.sin(r)*Math.cos(s),Math.cos(r)-Math.sin(s)*Math.sin(a));return{lat:y.toDegrees(a),lng:y.toDegrees(o)}},mercatorTolonlat(e,t){const n=e/2003750834e-2*180;var s=t/2003750834e-2*180;const i=180/Math.PI*(2*Math.atan(Math.exp(s*Math.PI/180))-Math.PI/2);return{lng:n,lat:i}},lonlatToMercator(e,t){var n=6378137;const s=e*Math.PI/180*n;var i=t*Math.PI/180;const r=n/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)));return{x:s,y:r}}},et={convertBase64ToBlob(e){const t=e.split(",")[0].split(":")[1].split(";")[0],n=atob(e.split(",")[1]),s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=n.charCodeAt(a);const i=new Uint8Array(s);return new Blob([i],{type:t})},convertUrlToBase64(e,t,n){return new Promise((s,i)=>{var r=new Image;r.crossOrigin="Anonymous",r.src=e,r.onload=function(){var a=document.createElement("canvas");a.width=t||r.width,a.height=n||r.height;var o=a.getContext("2d");if(!o){i(new Error("Failed to get canvas context"));return}o.drawImage(r,0,0,r.width,r.height);var c=r.src.substring(r.src.lastIndexOf(".")+1).toLowerCase(),h=a.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};s(u)},r.onerror=i})},convertBase64ToFile(e,t){const n=e.split(","),s=n[0].match(/:(.*?);/),i=s?s[1]:"image/png",r=atob(n[1]),a=new Uint8Array(r.length);for(let c=0;c<r.length;c++)a[c]=r.charCodeAt(c);return new File([a],t,{type:i})},downloadFromFile(e,t){if(typeof e=="object")if(e instanceof Blob)e=URL.createObjectURL(e);else{const s=JSON.stringify(e),i=new Blob([s],{type:"text/json"});e=window.URL.createObjectURL(i)}else if(typeof e=="string"&&e.indexOf("http")===-1){const s=new Blob([e],{type:"text/json"});e=window.URL.createObjectURL(s)}var n=document.createElement("a");n.href=e,n.download=t||"",n.click(),window.URL.revokeObjectURL(n.href)}},nt={debounce(e,t,n=!0){let s=null,i,r,a,o;const c=function(){const h=Date.now()-a;h<t&&h>0?s=setTimeout(c,t-h):(s=null,n||(o=e.apply(r,i)))};return function(...h){r=this,a=Date.now();const u=n&&!s;return s||(s=setTimeout(c,t)),u&&(o=e.apply(r,h),s||(r=h=null)),o}},throttle(e,t,n){let s=0,i=null;return function(...r){const a=this;if(n===1){const o=Date.now();o-s>t&&(e.apply(a,r),s=o)}else n===2&&(i||(i=setTimeout(()=>{i=null,e.apply(a,r)},t)))}},recurve(e,t=500,n=5e3){let s=0;setTimeout(()=>{s++,s<Math.floor(n/t)&&(e.call(this),setTimeout(this.recurve.bind(this,e,t,n),t))},t)}},F={checkStr(e,t){switch(t){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(e);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(e);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(e);case"postal":return/[1-9]\d{5}(?!\d)/.test(e);case"QQ":return/^[1-9][0-9]{4,9}$/.test(e);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(e);case"money":return/^\d*(?:\.\d{0,2})?$/.test(e);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);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(e);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(e)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(e);case"number":return/^[0-9]$/.test(e);case"english":return/^[a-zA-Z]+$/.test(e);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(e);case"lower":return/^[a-z]+$/.test(e);case"upper":return/^[A-Z]+$/.test(e);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(e);default:return!0}},changeCase(e,t){switch(t=t||4,t){case 1:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return e.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return e.toUpperCase();case 5:return e.toLowerCase();default:return e}},tag(e,...t){return t=t.map(n=>{switch(M.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),e.reduce((n,s,i)=>`${n}${t[i-1]}${s}`)},getByteLength(e){return e.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(e,t,n){var s=/[^\x00-\xff]/g;if(e.replace(s,"mm").length<=n)return e;for(var i=Math.floor(n/2),r=i;r<e.length;r++){let a=e.substring(t,r);if(a.replace(s,"mm").length>=n)return a}return e},asString(e){if(M.isEmpty(e))return"";switch(M.getDataType(e)){case"Object":case"Array":return JSON.stringify(e);default:return e}}},st={notNull(e){if(M.isEmpty(e))throw Error("不能为空:>>>"+e)},legalLnglat(e,t){if(!k.isLnglat(e,t))throw Error(p.COORDINATE_ERROR)},contain(e,...t){let n=!1;const s=t.length||0;for(let i=0,r=s;i<r;i++)n=e.indexOf(t[i])>=0;if(n)throw Error(p.STRING_CHECK_LOSS)},verify:{array(e){if(M.getDataType(e)!=="Array")throw Error(p.PARAMETER_ERROR_ARRAY+":>>>"+e)},function(e){if(M.getDataType(e)!=="Function")throw Error(p.PARAMETER_ERROR_FUNCTION+":>>>"+e)},object(e){if(M.getDataType(e)!=="Object")throw Error(p.PARAMETER_ERROR_OBJECT+":>>>"+e)}},legalJSON(e){try{JSON.parse(e)}catch{throw Error(p.JSON_PARSE_ERROR+":>>>"+e)}},legalData(e,t){const n=F.checkStr(e,t);let s="";switch(t){case"phone":s="电话";break;case"tel":s="座机";break;case"card":s="身份证";break;case"pwd":s="密码";break;case"postal":s="邮政编码";break;case"QQ":s="QQ";break;case"email":s="邮箱";break;case"money":s="金额";break;case"URL":s="网址";break;case"IP":s="IP";break;case"date":s="日期时间";break;case"number":s="数字";break;case"english":s="英文";break;case"chinese":s="中文";break;case"lower":s="小写";break;case"upper":s="大写";break;case"HTML":s="HTML标记";break}if(!n)throw Error(p.PARAMETER_ERROR+":>>>不是"+s)}};class rt{constructor(t){g(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}}class it{constructor(t){M.getDataType(t)==="String"&&(t=document.querySelector("#"+t)),this.ctx=t.getContext("2d")}drawLine(t,n,s,i,r={}){this.cxt.beginPath();const a=r.width||1,o=r.color||"#000";this.cxt.lineWidth=a,this.cxt.fillStyle=o,this.cxt.moveTo(t,n),this.cxt.lineTo(s,i),this.cxt.closePath(),this.cxt.fill()}drawArc(t,n,s,i,r,a,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.stroke())}}class at{constructor(t=1){this.magnification=t}_getSystem(){var t=navigator.userAgent.toLowerCase();if(t.indexOf("windows")>=0)return!0}_addHandler(t,n,s){t.addEventListener?t.addEventListener(n,s,!1):t.attachEvent?t.attachEvent("on"+n,s):t["on"+n]=s}_correct(){let t=window.innerWidth;if(typeof t!="number"&&(document.compatMode=="CSS1Compat"?t=document.documentElement.clientWidth:t=document.body.clientWidth),t<=750){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*75*Math.min(s,2)+"px"}else if(t>750&&t<=1200){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*85*Math.min(s,2)+"px"}else{const s=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(s,2)+"px"}}_watch(){let t=this;t._addHandler(window,"resize",function(){t._correct()})}init(){let t=this;t._getSystem()&&(t._correct(),t._watch())}}class ${constructor(){g(this,"_listeners");g(this,"_mutex",{});g(this,"_context")}addEventListener(t,n,s,i=!1){this._listeners===void 0&&(this._listeners={}),this._context=s;const r=this._mutex,a=this._listeners;return a[t]===void 0&&(a[t]=[]),a[t].indexOf(n)===-1&&(i&&(r[t]=n),a[t].push(n)),this}hasEventListener(t,n){if(this._listeners===null||this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(n)!==-1}removeEventListener(t,n){if(this._listeners===void 0)return;const i=this._listeners[t];if(this._mutex[t]===n&&(this._mutex[t]=null),i!==void 0){const r=i.map(a=>a.toString()).indexOf(n.toString());r!==-1&&i.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const s=this._listeners[t.type];if(s!==void 0){t.target=this;const i=s.slice(0);if(this._mutex[t.type]!==void 0){const r=i.find(a=>a===this._mutex[t.type]);if(r){r.call(this._context||this,t);return}}for(let r=0,a=i.length;r<a;r++){const o=i[r];typeof o=="function"&&o.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}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(e=[]){const t=new C;return e.forEach(n=>{Array.isArray(n)&&n.length===2&&t.set(n[0],n[1])}),t};class ot extends ${constructor(n="ws://127.0.0.1:10088"){super();g(this,"maxCheckTimes",10);g(this,"url");g(this,"checkTimes",0);g(this,"connectStatus",!1);g(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(s){n.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:s})},this.client.onmessage=function(s){n.connectStatus=!0,n.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:s})},this.client.onclose=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:s})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(s){n.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:s})})}}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)}}class ct{constructor(t=1){g(this,"cacheType");g(this,"storage");if(this.cacheType=t,t===1)this.storage=window.localStorage;else if(t===2)this.storage=window.sessionStorage;else throw new Error(p.PARAMETER_ERROR)}setItem(t,n,s){const i={key:t,value:n};if(this.cacheType===1){const r=Date.now();s&&(i.expired=r+s*1e3)}return this.storage[t]=JSON.stringify(i),i}getItem(t){const n=this.storage.getItem(t);if(n===null)return null;const s=JSON.parse(n)||{};if(this.cacheType===1){const i=s.expired?new Date(s.expired).getTime():Date.now();if(Date.now()>i)return this.remove(t),null}return s.value}remove(t){t&&(t.indexOf(",")>-1?t.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(t))}clear(){this.storage.clear()}}l.AnimateUtils=Y,l.ArrayUtils=K,l.AssertUtils=st,l.AudioPlayer=rt,l.BrowserUtils=J,l.CanvasDrawer=it,l.Cookie=Q,l.CoordsUtils=X,l.DateUtils=V,l.DevicePixelRatio=at,l.DomUtils=tt,l.ErrorType=p,l.EventDispatcher=$,l.EventType=m,l.FileUtils=et,l.GeoUtils=k,l.GraphicType=j,l.HashMap=C,l.LayerType=z,l.MathUtils=y,l.MeasureMode=H,l.ObjectState=q,l.OptimizeUtils=nt,l.StringUtils=F,l.Utils=M,l.WebSocketClient=ot,l.WebStorage=ct,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["gis-common"]={}))})(this,function(l){"use strict";var ft=Object.defineProperty;var mt=(l,m,p)=>m in l?ft(l,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[m]=p;var g=(l,m,p)=>mt(l,typeof m!="symbol"?m+"":m,p);const m={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},p={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},z={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},H={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},j={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},q={ADD:"add",REMOVE:"remove",INIT:"init"};class Y{constructor(t){g(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}}const M={getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)},isEmpty(e){if(e==null)return!0;switch(this.getDataType(e)){case"String":return e.trim()==="";case"Array":return!e.length;case"Object":return!Object.keys(e).length;case"Boolean":return!e;default:return!1}},isNotEmpty(e){return!this.isEmpty(e)},json2form(e){const t=new FormData;return Object.keys(e).forEach(n=>{t.append(n,e[n]instanceof Object?JSON.stringify(e[n]):e[n])}),t},json2Query(e){var t=[];for(var n in e){var s=n,i=e[n];t.push(s+"="+i)}var r=t.join("&");return r},generateGuid(){const e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()+e()+e()},decodeDict(...e){let t="";if(e.length>1){const n=e.slice(1,e.length%2===0?e.length-1:e.length);for(let s=0;s<n.length;s=s+2){const i=n[s];e[0]===i&&(t=n[s+1])}!t&&e.length%2===0&&(t=e[e.length-1])}else t=e[0];return t},extend(e,...t){let n,s,i,r;for(s=0,i=t.length;s<i;s++){r=t[s];for(n in r)e[n]=r[n]}return e},rgb2hex(e){var t="#"+(16777216+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1);return t},convertToTree2(e,t="id",n="parentId",s="children"){const i=[];function r(a){const o=e.filter(c=>c[n]===a[t]).map(c=>(i.some(h=>h[t]===c[t])||r(c),c));o.length>0&&(a[s]=o)}return e.forEach(a=>{e.some(o=>o[n]===a[t])||(r(a),i.push(a))}),i},asyncLoadScript(e){return new Promise((t,n)=>{try{const s=document.createElement("script");s.type="text/javascript",s.src=e,"readyState"in s?s.onreadystatechange=function(){(s.readyState==="complete"||s.readyState==="loaded")&&t(s)}:(s.onload=function(){t(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+e))}),document.body.appendChild(s)}catch(s){n(s)}})},loadStyle(e){e.forEach(t=>{const n=document.createElement("link");n.href=t,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(n)})},template(e,t){const n=/\{ *([\w_-]+) *\}/g;return e.replace(n,(s,i)=>{const r=t[i];if(r===void 0)throw new Error(`${p.JSON_VALUE_ERROR}: ${s}`);return typeof r=="function"?r(t):r})},deleteEmptyProperty(e){return Object.fromEntries(Object.keys(e).filter(t=>!this.isEmpty(e[t])).map(t=>[t,e[t]]))},deepAssign(e,...t){(typeof e!="object"||e===null)&&(e={});for(const n of t)if(typeof n=="object"&&n!==null)for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(typeof n[s]=="object"&&n[s]!==null?(e[s]||(e[s]=Array.isArray(n[s])?[]:{}),this.deepAssign(e[s],n[s])):e[s]=n[s]);return e},handleCopyValue(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e);{const t=document.createElement("textarea");return t.style.position="fixed",t.style.top=t.style.left="-100vh",t.style.opacity="0",t.value=e,document.body.appendChild(t),t.focus(),t.select(),new Promise((n,s)=>{try{document.execCommand("copy"),n()}catch{s(new Error("copy failed"))}finally{t.remove()}})}}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat(e,t){return e+Math.random()*(t-e)},degreesToRadians(e){return e*this.DEG2RAD},toRadians(e){return e*this.DEG2RAD},radiansToDegrees(e){return e*this.RAD2DEG},toDegrees(e){return e*this.RAD2DEG},formatFloat(e,t=2){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}};class K{constructor(t){M.getDataType(t)==="String"&&(t=document.querySelector("#"+t)),this.ctx=t.getContext("2d")}drawLine(t,n,s,i,r={}){this.cxt.beginPath();const a=r.width||1,o=r.color||"#000";this.cxt.lineWidth=a,this.cxt.fillStyle=o,this.cxt.moveTo(t,n),this.cxt.lineTo(s,i),this.cxt.closePath(),this.cxt.fill()}drawArc(t,n,s,i,r,a,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.stroke())}}class J{constructor(t=1){this.magnification=t}_getSystem(){var t=navigator.userAgent.toLowerCase();if(t.indexOf("windows")>=0)return!0}_addHandler(t,n,s){t.addEventListener?t.addEventListener(n,s,!1):t.attachEvent?t.attachEvent("on"+n,s):t["on"+n]=s}_correct(){let t=window.innerWidth;if(typeof t!="number"&&(document.compatMode=="CSS1Compat"?t=document.documentElement.clientWidth:t=document.body.clientWidth),t<=750){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*75*Math.min(s,2)+"px"}else if(t>750&&t<=1200){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*85*Math.min(s,2)+"px"}else{const s=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(s,2)+"px"}}_watch(){let t=this;t._addHandler(window,"resize",function(){t._correct()})}init(){let t=this;t._getSystem()&&(t._correct(),t._watch())}}class k{constructor(){g(this,"_listeners");g(this,"_mutex",{});g(this,"_context")}addEventListener(t,n,s,i=!1){this._listeners===void 0&&(this._listeners={}),this._context=s;const r=this._mutex,a=this._listeners;return a[t]===void 0&&(a[t]=[]),a[t].indexOf(n)===-1&&(i&&(r[t]=n),a[t].push(n)),this}hasEventListener(t,n){if(this._listeners===null||this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(n)!==-1}removeEventListener(t,n){if(this._listeners===void 0)return;const i=this._listeners[t];if(this._mutex[t]===n&&(this._mutex[t]=null),i!==void 0){const r=i.map(a=>a.toString()).indexOf(n.toString());r!==-1&&i.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const s=this._listeners[t.type];if(s!==void 0){t.target=this;const i=s.slice(0);if(this._mutex[t.type]!==void 0){const r=i.find(a=>a===this._mutex[t.type]);if(r){r.call(this._context||this,t);return}}for(let r=0,a=i.length;r<a;r++){const o=i[r];typeof o=="function"&&o.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}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(e=[]){const t=new I;return e.forEach(n=>{Array.isArray(n)&&n.length===2&&t.set(n[0],n[1])}),t};class Q extends k{constructor(n="ws://127.0.0.1:10088"){super();g(this,"maxCheckTimes",10);g(this,"url");g(this,"checkTimes",0);g(this,"connectStatus",!1);g(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(s){n.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:s})},this.client.onmessage=function(s){n.connectStatus=!0,n.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:s})},this.client.onclose=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:s})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(s){n.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:s})})}}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)}}class V{constructor(t=1){g(this,"cacheType");g(this,"storage");if(this.cacheType=t,t===1)this.storage=window.localStorage;else if(t===2)this.storage=window.sessionStorage;else throw new Error(p.PARAMETER_ERROR)}setItem(t,n,s){const i={key:t,value:n};if(this.cacheType===1){const r=Date.now();s&&(i.expired=r+s*1e3)}return this.storage[t]=JSON.stringify(i),i}getItem(t){const n=this.storage.getItem(t);if(n===null)return null;const s=JSON.parse(n)||{};if(this.cacheType===1){const i=s.expired?new Date(s.expired).getTime():Date.now();if(Date.now()>i)return this.remove(t),null}return s.value}remove(t){t&&(t.indexOf(",")>-1?t.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(t))}clear(){this.storage.clear()}}const X={animate(e,t,n,s="swing",i=5){for(var r in t)t[r]={target:r==="opacity"?parseInt(t[r]*100):t[r],iNow:parseInt(r==="opacity"?getComputedStyle(e)[r]*100:getComputedStyle(e)[r])};s==="liner"&&(i=t[r].iNow<t[r].target?Math.abs(i):-Math.abs(i)),clearInterval(e.timer),e.timer=setInterval(function(){for(var a in t){var o=t[a].target,c=t[a].iNow;if(s==="swing"&&(i=(o-c)/20,i=i>0?Math.ceil(i):Math.floor(i)),Math.abs(o-c)<=Math.abs(i)){a==="opacity"?e.style[a]=o/100:e.style[a]=o+"px",delete t[a];for(var h in t)return!1;clearInterval(e.timer),typeof n=="function"&&n()}else t[a].iNow+=i,a==="opacity"?e.style[a]=t[a].iNow/100:e.style[a]=t[a].iNow+"px"}},30)}};Array.prototype.groupBy=function(e){var t={};return this.forEach(function(n){var s=JSON.stringify(e(n));t[s]=t[s]||[],t[s].push(n)}),Object.keys(t).map(n=>t[n])},Array.prototype.distinct=function(e=t=>t){const t=[],n={};return this.forEach(s=>{const i=e(s),r=String(i);n[r]||(n[r]=!0,t.push(s))}),t},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((e=0,t=0)=>e+t):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(e=t=>t){return this.sort((t,n)=>e(n)-e(t))},Array.prototype.asc=function(e=t=>t){return this.sort((t,n)=>e(t)-e(n))},Array.prototype.clear=function(){return this.length=0,this};const Z={asArray(e){return M.isEmpty(e)?[]:Array.isArray(e)?e:[e]},generateArray(e){return[...new Array(e).keys()]},union(...e){let t=[];return e.forEach(n=>{Array.isArray(n)&&(t=t.concat(n.filter(s=>!t.includes(s))))}),t},intersection(...e){let t=e[0]||[];return e.forEach(n=>{Array.isArray(n)&&(t=t.filter(s=>n.includes(s)))}),t},unionAll(...e){return[...e].flat().filter(t=>!!t)},difference(...e){return this.union(...e).filter(t=>!this.intersection(...e).includes(t))}},tt={getUrlParams(e=window.location.href,t=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:s,hash:i}=new URL(e),r=[s,i];let a={};for(let o=0;o<r.length;o++){const c=r[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)a[f[1]]=t?decodeURIComponent(f[2]):f[2]}}}return a},getExplorer(){var e=window.navigator.userAgent;return e.indexOf("MSIE")>=0||/Trident\//.test(e)?"IE":e.indexOf("Firefox")>=0?"Firefox":e.indexOf("Chrome")>=0?"Chrome":e.indexOf("Opera")>=0?"Opera":e.indexOf("Safari")>=0&&e.indexOf("Chrome")===-1?"Safari":"Unknown"},detectOS(){let e="";const t=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,s=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,i=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return t?e="MS Windows":n?e="Apple mac":s?e="Linux":i&&(e="Unix"),e},switchFullScreen(e){if(e){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()},refreshScale(){const e=document.documentElement.clientWidth||0,t=document.documentElement.clientHeight||0,n=document.getElementById("app");if(!n)return;const s=n.style,i=e/t,r=16/9;let a=e/1920;i>r&&(a=t/1080),s.transformOrigin="left top",s.transform=`scale(${a}) translateX(-49.99%)`,s.width=`${e/a}px`},getHtmlFontSize(){const e=document.documentElement.clientWidth||document.body.clientWidth,t=document.querySelector("html");t&&(t.style.fontSize=e/192+"px")}},et={set:function(e,t,n=30){var s=new Date;s.setTime(s.getTime()+n*24*60*60*1e3),document.cookie=e+"="+escape(t)+";expires="+s.toUTCString()},remove:function(e){var t=new Date;t.setTime(t.getTime()-1);var n=this.get(e);n!=null&&(document.cookie=e+"="+n+";expires="+t.toUTCString())},get:function(e){var t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]*)(;|$)"));return t!=null?t[2]:""}},nt={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(e,t){const s=.006693421622965943;let i=this.transformLat(t-105,e-35),r=this.transformLon(t-105,e-35);const a=e/180*this.PI;let o=Math.sin(a);o=1-s*o*o;const c=Math.sqrt(o);return i=i*180/(6378245*(1-s)/(o*c)*this.PI),r=r*180/(6378245/c*Math.cos(a)*this.PI),{lat:i,lng:r}},gcjEncrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e+n.lat,lng:t+n.lng}},gcjDecrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e-n.lat,lng:t-n.lng}},gcjDecryptExact(e,t){let i=.01,r=.01,a=e-i,o=t-r,c=e+i,h=t+r,u=0,d=0,f=0;for(;;){u=(a+c)/2,d=(o+h)/2;const w=this.gcjEncrypt(u,d);if(i=w.lat-e,r=w.lng-t,Math.abs(i)<1e-9&&Math.abs(r)<1e-9||(i>0?c=u:a=u,r>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(e,t){const n=t,s=e,i=Math.sqrt(n*n+s*s)+2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)+3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r)+.0065;return{lat:i*Math.sin(r)+.006,lng:a}},bdDecrypt(e,t){const n=t-.0065,s=e-.006,i=Math.sqrt(n*n+s*s)-2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)-3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r);return{lat:i*Math.sin(r),lng:a}},mercatorEncrypt(e,t){const n=t*2003750834e-2/180;let s=Math.log(Math.tan((90+e)*this.PI/360))/(this.PI/180);return s=s*2003750834e-2/180,{lat:s,lng:n}},mercatorDecrypt(e,t){const n=t/2003750834e-2*180;let s=e/2003750834e-2*180;return s=180/this.PI*(2*Math.atan(Math.exp(s*this.PI/180))-this.PI/2),{lat:s,lng:n}},distance(e,t,n,s){const r=Math.cos(e*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((t-s)*this.PI/180),a=Math.sin(e*this.PI/180)*Math.sin(n*this.PI/180);let o=r+a;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(e,t){return t<72.004||t>137.8347||e<.8293||e>55.8271},transformLat(e,t){let n=-100+2*e+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(160*Math.sin(t/12*this.PI)+320*Math.sin(t*this.PI/30))*2/3,n},transformLon(e,t){let n=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(150*Math.sin(e/12*this.PI)+300*Math.sin(e/30*this.PI))*2/3,n},randomCoordinate(e,t,n,s){return{lat:Math.random()*(s-t)+t,lng:Math.random()*(n-e)+e}}};Date.prototype.format=function(e){const t={"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(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in t)if(new RegExp("("+n+")").test(e)){const s=n.length===1?1:Number(n.slice(1));e=e.replace(RegExp.$1,("00"+t[n]).substr((""+t[n]).length+s-(t[n]+"").length))}return e},Date.prototype.addDate=function(e,t){const n=new Date(this);switch(e){case"y":n.setFullYear(this.getFullYear()+t);break;case"q":n.setMonth(this.getMonth()+t*3);break;case"M":n.setMonth(this.getMonth()+t);break;case"w":n.setDate(this.getDate()+t*7);break;case"d":n.setDate(this.getDate()+t);break;case"h":n.setHours(this.getHours()+t);break;case"m":n.setMinutes(this.getMinutes()+t);break;case"s":n.setSeconds(this.getSeconds()+t);break;default:n.setDate(this.getDate()+t);break}return n};const st={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(e){if(typeof e=="string"){var t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(t&&t.length>3)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),t&&t.length>6)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),t&&t.length>7)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]),parseInt(t[7]))}return null},formatDateInterval(e,t){const n=new Date(e),i=new Date(t).getTime()-n.getTime(),r=Math.floor(i/(24*3600*1e3)),a=i%(24*3600*1e3),o=Math.floor(a/(3600*1e3)),c=a%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return r>0&&(f+=r+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),r===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(e){const t=function(o){return(o>10?"":"0")+(o||0)},n=t(Math.floor(e/3600)),s=e%3600,i=t(Math.floor(s/60)),r=s%60,a=t(Math.round(r));return`${n}:${i}:${a}`},sleep(e){}};function rt(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function N(e){return rt(e).split(/\s+/)}const it={getStyle(e,t){var s;let n=e.style[t];if(!n||n==="auto"){const i=(s=document.defaultView)==null?void 0:s.getComputedStyle(e,null);n=i?i[t]:null,n==="auto"&&(n=null)}return n},create(e,t,n){const s=document.createElement(e);return s.className=t||"",n&&n.appendChild(s),s},remove(e){const t=e.parentNode;t&&t.removeChild(e)},empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)},toFront(e){const t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)},toBack(e){const t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)},getClass(e){return((e==null?void 0:e.host)||e).className.toString()},hasClass(e,t){var s;if((s=e.classList)!=null&&s.contains(t))return!0;const n=this.getClass(e);return n.length>0&&new RegExp(`(^|\\s)${t}(\\s|$)`).test(n)},addClass(e,t){if(e.classList!==void 0){const n=N(t);for(let s=0,i=n.length;s<i;s++)e.classList.add(n[s])}else if(!this.hasClass(e,t)){const n=this.getClass(e);this.setClass(e,(n?n+" ":"")+t)}},removeClass(e,t){e.classList!==void 0?N(t).forEach(s=>e.classList.remove(s)):this.setClass(e,(" "+this.getClass(e)+" ").replace(" "+t+" "," ").trim())},setClass(e,t){"classList"in e&&(e.classList.value="",t.split(" ").forEach(n=>e.classList.add(n)))},parseFromString(e){return new DOMParser().parseFromString(e,"text/xml").children[0]}},F={toRadian:Math.PI/180,R:6371393,isLnglat(e,t){return!isNaN(e)&&!isNaN(t)&&+t>-90&&+t<90&&+e>-180&&+e<180},formatLnglat(e,t){let n="";function s(i){const r=Math.floor(i),a=Math.floor((i-r)*60),o=(i-r)*3600-a*60;return`${r}°${a}′${o.toFixed(2)}″`}return this.isLnglat(e,t)?n=s(e)+","+s(t):isNaN(e)?isNaN(t)||(n=s(t)):n=s(e),n},transformLnglat(e,t){function n(s){let r=/[sw]/i.test(s)?-1:1;const a=s.match(/[\d.]+/g)||[];let o=0;for(let c=0;c<a.length;c++)o+=parseFloat(a[c])/r,r*=60;return o}if(e&&t)return{lng:n(e),lat:n(t)}},rayCasting(e,t){for(var n=e.x,s=e.y,i=!1,r=0,a=t.length,o=a-1;r<a;o=r,r++){var c=t[r].x,h=t[r].y,u=t[o].x,d=t[o].y;if(c===n&&h===s||u===n&&d===s)return"on";if(h<s&&d>=s||h>=s&&d<s){var f=c+(s-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(i=!i)}}return i?"in":"out"},wgs84PointsDistance(e,t){var n=Math.PI;function s(dt){return dt*n/180}if(arguments.length!=2)return 0;const i=e.x,r=e.y,a=t.x,o=t.y;var c=6378137,h=63567523142e-4,u=1/298.257223563,d=s(a-i),f=Math.atan((1-u)*Math.tan(s(r))),w=Math.atan((1-u)*Math.tan(s(o))),A=Math.sin(f),S=Math.cos(f),b=Math.sin(w),v=Math.cos(w),O=d,B,W=100;do{var _=Math.sin(O),x=Math.cos(O),D=Math.sqrt(v*_*(v*_)+(S*b-A*v*x)*(S*b-A*v*x));if(D==0)return 0;var T=A*b+S*v*x,G=Math.atan2(D,T),P=S*v*_/D,C=1-P*P,E=T-2*A*b/C;isNaN(E)&&(E=0);var L=u/16*C*(4+u*(4-3*C));B=O,O=d+(1-L)*u*P*(G+L*D*(E+L*T*(-1+2*E*E)))}while(Math.abs(O-B)>1e-12&&--W>0);if(W==0)return NaN;var R=C*(c*c-h*h)/(h*h),lt=1+R/16384*(4096+R*(-768+R*(320-175*R))),U=R/1024*(256+R*(-128+R*(74-47*R))),ht=U*D*(E+U/4*(T*(-1+2*E*E)-U/6*E*(-3+4*D*D)*(-3+4*E*E))),ut=h*lt*(G-ht);return ut},rotatePoint(e,t,n){const s=(e.x-t.x)*Math.cos(Math.PI/180*-n)-(e.y-t.y)*Math.sin(Math.PI/180*-n)+t.x,i=(e.x-t.x)*Math.sin(Math.PI/180*-n)+(e.y-t.y)*Math.cos(Math.PI/180*-n)+t.y;return{x:s,y:i}},calcBearAndDis(e,t){const{x:n,y:s}=e,{x:i,y:r}=t,a=i-n,o=r-s,c=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(e,t){var n=e.lat*1,s=e.lng*1,i=t.lat*1,r=t.lng*1,a=Math.sin((r-s)*this.toRadian)*Math.cos(i*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(i*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.cos((r-s)*this.toRadian),c=Math.atan2(a,o)*(180/Math.PI),h=(i-n)*this.toRadian,u=(r-s)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),w=this.R*f;return{angle:c,distance:w}},calcPointByBearAndDis(e,t,n){const s=y.toRadians(e.lat*1),i=y.toRadians(e.lng*1),r=n/this.R;t=y.toRadians(t);const a=Math.asin(Math.sin(s)*Math.cos(r)+Math.cos(s)*Math.sin(r)*Math.cos(t)),o=i+Math.atan2(Math.sin(t)*Math.sin(r)*Math.cos(s),Math.cos(r)-Math.sin(s)*Math.sin(a));return{lat:y.toDegrees(a),lng:y.toDegrees(o)}},mercatorTolonlat(e,t){const n=e/2003750834e-2*180;var s=t/2003750834e-2*180;const i=180/Math.PI*(2*Math.atan(Math.exp(s*Math.PI/180))-Math.PI/2);return{lng:n,lat:i}},lonlatToMercator(e,t){var n=6378137;const s=e*Math.PI/180*n;var i=t*Math.PI/180;const r=n/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)));return{x:s,y:r}}},at={convertBase64ToBlob(e){const t=e.split(",")[0].split(":")[1].split(";")[0],n=atob(e.split(",")[1]),s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=n.charCodeAt(a);const i=new Uint8Array(s);return new Blob([i],{type:t})},convertUrlToBase64(e,t,n){return new Promise((s,i)=>{var r=new Image;r.crossOrigin="Anonymous",r.src=e,r.onload=function(){var a=document.createElement("canvas");a.width=t||r.width,a.height=n||r.height;var o=a.getContext("2d");if(!o){i(new Error("Failed to get canvas context"));return}o.drawImage(r,0,0,r.width,r.height);var c=r.src.substring(r.src.lastIndexOf(".")+1).toLowerCase(),h=a.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};s(u)},r.onerror=i})},convertBase64ToFile(e,t){const n=e.split(","),s=n[0].match(/:(.*?);/),i=s?s[1]:"image/png",r=atob(n[1]),a=new Uint8Array(r.length);for(let c=0;c<r.length;c++)a[c]=r.charCodeAt(c);return new File([a],t,{type:i})},downloadFromFile(e,t){if(typeof e=="object")if(e instanceof Blob)e=URL.createObjectURL(e);else{const s=JSON.stringify(e),i=new Blob([s],{type:"text/json"});e=window.URL.createObjectURL(i)}else if(typeof e=="string"&&e.indexOf("http")===-1){const s=new Blob([e],{type:"text/json"});e=window.URL.createObjectURL(s)}var n=document.createElement("a");n.href=e,n.download=t||"",n.click(),window.URL.revokeObjectURL(n.href)}},ot={debounce(e,t,n=!0){let s=null,i,r,a,o;const c=function(){const h=Date.now()-a;h<t&&h>0?s=setTimeout(c,t-h):(s=null,n||(o=e.apply(r,i)))};return function(...h){r=this,a=Date.now();const u=n&&!s;return s||(s=setTimeout(c,t)),u&&(o=e.apply(r,h),s||(r=h=null)),o}},throttle(e,t,n){let s=0,i=null;return function(...r){const a=this;if(n===1){const o=Date.now();o-s>t&&(e.apply(a,r),s=o)}else n===2&&(i||(i=setTimeout(()=>{i=null,e.apply(a,r)},t)))}},recurve(e,t=500,n=5e3){let s=0;setTimeout(()=>{s++,s<Math.floor(n/t)&&(e.call(this),setTimeout(this.recurve.bind(this,e,t,n),t))},t)}},$={checkStr(e,t){switch(t){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(e);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(e);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(e);case"postal":return/[1-9]\d{5}(?!\d)/.test(e);case"QQ":return/^[1-9][0-9]{4,9}$/.test(e);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(e);case"money":return/^\d*(?:\.\d{0,2})?$/.test(e);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);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(e);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(e)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(e);case"number":return/^[0-9]$/.test(e);case"english":return/^[a-zA-Z]+$/.test(e);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(e);case"lower":return/^[a-z]+$/.test(e);case"upper":return/^[A-Z]+$/.test(e);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(e);default:return!0}},changeCase(e,t){switch(t=t||4,t){case 1:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return e.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return e.toUpperCase();case 5:return e.toLowerCase();default:return e}},tag(e,...t){return t=t.map(n=>{switch(M.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),e.reduce((n,s,i)=>`${n}${t[i-1]}${s}`)},getByteLength(e){return e.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(e,t,n){var s=/[^\x00-\xff]/g;if(e.replace(s,"mm").length<=n)return e;for(var i=Math.floor(n/2),r=i;r<e.length;r++){let a=e.substring(t,r);if(a.replace(s,"mm").length>=n)return a}return e},asString(e){if(M.isEmpty(e))return"";switch(M.getDataType(e)){case"Object":case"Array":return JSON.stringify(e);default:return e}}},ct={notNull(e){if(M.isEmpty(e))throw Error("不能为空:>>>"+e)},legalLnglat(e,t){if(!F.isLnglat(e,t))throw Error(p.COORDINATE_ERROR)},contain(e,...t){let n=!1;const s=t.length||0;for(let i=0,r=s;i<r;i++)n=e.indexOf(t[i])>=0;if(n)throw Error(p.STRING_CHECK_LOSS)},verify:{array(e){if(M.getDataType(e)!=="Array")throw Error(p.PARAMETER_ERROR_ARRAY+":>>>"+e)},function(e){if(M.getDataType(e)!=="Function")throw Error(p.PARAMETER_ERROR_FUNCTION+":>>>"+e)},object(e){if(M.getDataType(e)!=="Object")throw Error(p.PARAMETER_ERROR_OBJECT+":>>>"+e)}},legalJSON(e){try{JSON.parse(e)}catch{throw Error(p.JSON_PARSE_ERROR+":>>>"+e)}},legalData(e,t){const n=$.checkStr(e,t);let s="";switch(t){case"phone":s="电话";break;case"tel":s="座机";break;case"card":s="身份证";break;case"pwd":s="密码";break;case"postal":s="邮政编码";break;case"QQ":s="QQ";break;case"email":s="邮箱";break;case"money":s="金额";break;case"URL":s="网址";break;case"IP":s="IP";break;case"date":s="日期时间";break;case"number":s="数字";break;case"english":s="英文";break;case"chinese":s="中文";break;case"lower":s="小写";break;case"upper":s="大写";break;case"HTML":s="HTML标记";break}if(!n)throw Error(p.PARAMETER_ERROR+":>>>不是"+s)}};l.AnimateUtils=X,l.ArrayUtils=Z,l.AssertUtils=ct,l.AudioPlayer=Y,l.BrowserUtils=tt,l.CanvasDrawer=K,l.Cookie=et,l.CoordsUtils=nt,l.DateUtils=st,l.DevicePixelRatio=J,l.DomUtils=it,l.ErrorType=p,l.EventDispatcher=k,l.EventType=m,l.FileUtils=at,l.GeoUtils=F,l.GraphicType=H,l.HashMap=I,l.LayerType=z,l.MathUtils=y,l.MeasureMode=j,l.ObjectState=q,l.OptimizeUtils=ot,l.StringUtils=$,l.Utils=M,l.WebSocketClient=Q,l.WebStorage=V,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { AnimateUtils, ArrayUtils, AssertUtils, BrowserUtils, Utils, Cookie, CoordsUtils, DateUtils, DomUtils, FileUtils, GeoUtils, MathUtils, OptimizeUtils, StringUtils } from './utils/index';
2
- import { AudioPlayer, CanvasDrawer, DevicePixelRatio, EventDispatcher, HashMap, WebSocketClient, WebStorage } from './core/index';
3
1
  export * from './constant';
4
- export { AnimateUtils, ArrayUtils, AssertUtils, BrowserUtils, Utils, Cookie, CoordsUtils, DateUtils, DomUtils, FileUtils, GeoUtils, MathUtils, OptimizeUtils, StringUtils, AudioPlayer, CanvasDrawer, DevicePixelRatio, EventDispatcher, HashMap, WebSocketClient, WebStorage, };
2
+ export * from './core';
3
+ export * from './utils';
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ asArray(obj: any): any[];
3
+ generateArray(length: any): number[];
4
+ union(...args: any[]): any[];
5
+ intersection(...args: never[][]): any[];
6
+ unionAll(...args: any[]): any[];
7
+ difference(...args: any[]): any;
8
+ };
9
+ export default _default;
@@ -0,0 +1,41 @@
1
+ declare const _default: {
2
+ /**
3
+ * 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
4
+ *
5
+ * @param href 需要解析的 URL 链接,默认为当前窗口的 URL
6
+ * @param needDecode 是否需要解码参数值,默认为 true
7
+ * @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
8
+ */
9
+ getUrlParams(href?: string, needDecode?: boolean): Record<string, string>;
10
+ /**
11
+ * 获取浏览器类型
12
+ *
13
+ * @returns 返回浏览器类型字符串,可能的值为 'IE'、'Firefox'、'Chrome'、'Opera'、'Safari' 或 'Unknown'
14
+ */
15
+ getExplorer(): string;
16
+ /**
17
+ * 检测操作系统类型
18
+ *
19
+ * @returns 返回操作系统类型字符串,可能的值有:'MS Windows'、'Apple mac'、'Linux'、'Unix'
20
+ */
21
+ detectOS(): string;
22
+ /**
23
+ * 切换全屏状态
24
+ *
25
+ * @param status 是否全屏
26
+ */
27
+ switchFullScreen(status: boolean): void;
28
+ /**
29
+ * 刷新缩放比例
30
+ *
31
+ * @returns 无返回值
32
+ */
33
+ refreshScale(): void;
34
+ /**
35
+ * 获取HTML字体大小
36
+ *
37
+ * @returns 无返回值,该函数会直接修改HTML元素的字体大小
38
+ */
39
+ getHtmlFontSize(): void;
40
+ };
41
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gis-common",
3
- "version": "3.1.11",
3
+ "version": "3.1.12",
4
4
  "author": "Guo.Yan <luv02@vip.qq.com>",
5
5
  "license": "MIT",
6
6
  "private": false,