gis-common 3.1.1 → 3.1.2
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/resource.min.js +1 -1
- package/package.json +5 -2
- package/src/assets/images/location.png +0 -0
- package/src/constant/ErrorTypeConstant.js +22 -0
- package/src/constant/EventTypeConstant.js +23 -0
- package/src/constant/GraphicConstant.js +16 -0
- package/src/constant/LayerType.js +9 -0
- package/src/constant/index.js +4 -0
- package/src/core/AudioPlayer.js +30 -0
- package/src/core/CanvasDrawer.js +51 -0
- package/src/core/DevicePixelRatio.js +86 -0
- package/src/core/ElQuery.js +88 -0
- package/src/core/EventDispatcher.js +93 -0
- package/src/core/HashMap.js +26 -0
- package/src/core/MqttClient.js +108 -0
- package/src/core/WebSocketClient.js +104 -0
- package/src/core/WebStorage.js +73 -0
- package/src/index.js +10 -0
- package/src/utils/AnimateUtils.js +78 -0
- package/src/utils/ArrayUtils.js +82 -0
- package/src/utils/AssertUtils.js +112 -0
- package/src/utils/BrowserUtils.js +107 -0
- package/src/utils/CommUtils.js +236 -0
- package/src/utils/Cookie.js +23 -0
- package/src/utils/CoordsUtils.js +145 -0
- package/src/utils/DateUtils.js +144 -0
- package/src/utils/DomUtils.js +94 -0
- package/src/utils/FileUtils.js +104 -0
- package/src/utils/GeoUtils.js +253 -0
- package/src/utils/MathUtils.js +49 -0
- package/src/utils/OptimizeUtils.js +94 -0
- package/src/utils/StringUtils.js +148 -0
- package/src/utils/index.js +14 -0
package/dist/resource.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Gis",[],e):"object"==typeof exports?exports.Gis=e():t.Gis=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"AnimateUtils",(function(){return r})),n.d(e,"ArrayUtils",(function(){return h})),n.d(e,"BrowserUtils",(function(){return f})),n.d(e,"Cookie",(function(){return d})),n.d(e,"CoordsUtils",(function(){return p})),n.d(e,"DateUtils",(function(){return g})),n.d(e,"DomUtils",(function(){return m})),n.d(e,"GeoUtils",(function(){return w})),n.d(e,"FileUtils",(function(){return R})),n.d(e,"MathUtils",(function(){return M})),n.d(e,"OptimizeUtils",(function(){return b})),n.d(e,"StringUtils",(function(){return O})),n.d(e,"AssertUtils",(function(){return S})),n.d(e,"Utils",(function(){return u})),n.d(e,"EventType",(function(){return a})),n.d(e,"ErrorType",(function(){return i})),n.d(e,"LayerType",(function(){return o})),n.d(e,"GraphicType",(function(){return s})),n.d(e,"MeasureMode",(function(){return c})),n.d(e,"AudioPlayer",(function(){return D})),n.d(e,"CanvasDrawer",(function(){return x})),n.d(e,"EventDispatcher",(function(){return T})),n.d(e,"HashMap",(function(){return C})),n.d(e,"WebSocketClient",(function(){return N})),n.d(e,"WebStorage",(function(){return j})),n.d(e,"DevicePixelRatio",(function(){return G}));var r={animate:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"swing",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;for(var i in e)e[i]={target:"opacity"===i?parseInt(100*e[i]):e[i],iNow:"opacity"===i?parseInt(100*getComputedStyle(t)[i]):parseInt(getComputedStyle(t)[i])};"liner"===r&&(a=e[i].iNow<e[i].target?Math.abs(a):-Math.abs(a)),clearInterval(t.timer),t.timer=setInterval((function(){for(var i in e){var o=e[i].target,s=e[i].iNow;if("swing"===r&&(a=(a=(o-s)/20)>0?Math.ceil(a):Math.floor(a)),Math.abs(o-s)<=Math.abs(a)){for(var c in t.style[i]="opacity"===i?o/100:o+"px",delete e[i],e)return!1;clearInterval(t.timer),"function"==typeof n&&n()}else e[i].iNow+=a,t.style[i]="opacity"===i?e[i].iNow/100:e[i].iNow+"px"}}),30)}},a={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"},i={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:"字符缺少关键字"},o={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"},s={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},c={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},u={getDataType:function(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty:function(t){if(null==t)return!0;switch(this.getDataType(t)){case"String":return""===t.trim();case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty:function(t){return!this.isEmpty(t)},json2form:function(t){var e=new FormData;return Object.keys(t).forEach((function(n){e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])})),e},json2Query:function(t){var e=[];for(var n in t){var r=n,a=t[n];e.push(r+"="+a)}return e.join("&")},generateGuid:function(){var t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict:function(){for(var t="",e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];if(n.length>1){for(var a=n.slice(1,n.length%2==0?n.length-1:n.length),i=0;i<a.length;i+=2){var o=a[i];n[0]===o&&(t=a[i+1])}t||n.length%2!=0||(t=n[n.length-1])}else t=n[0];return t},extend:function(t){for(var e=void 0,n=void 0,r=void 0,a=void 0,i=arguments.length,o=Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];for(n=0,r=o.length;n<r;n++)for(e in a=o[n])t[e]=a[e];return t},rgb2hex:function(t){return"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1)},convertToTree2:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"parentId",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"children",a=[];function i(a){var o=a[e],s=t.filter((function(t){return t.hasOwnProperty(n)&&t[n]===o}));s.length>0&&(s.forEach(i),a[r]=s)}var o=function(r){-1===t.findIndex((function(t){return t[e]===r[n]}))&&(i(r),a.push(r))},s=!0,c=!1,u=void 0;try{for(var l,h=t[Symbol.iterator]();!(s=(l=h.next()).done);s=!0){var f=l.value;o(f)}}catch(t){c=!0,u=t}finally{try{!s&&h.return&&h.return()}finally{if(c)throw u}}return a},asyncLoadScript:function(t){return new Promise((function(e,n){try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){"complete"!==r.readyState&&"loaded"!==r.readyState||e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(t){n(t)}}))},loadStyle:function(t){t.forEach((function(t){var e=document.createElement("link");e.href=t,e.rel="stylesheet",e.type="text/css",document.head.appendChild(e)}))},template:function(t,e){return t.replace(/\{ *([\w_-]+) *\}/g,(function(t,n){var r=e[n];if(void 0===r)throw new Error(i.JSON_VALUE_ERROR+t);return"function"==typeof r&&(r=r(e)),r}))},deleteEmptyProperty:function(t){var e=this;return Object.fromEntries(Object.keys(t).filter((function(n){return!e.isEmpty(t[n])})).map((function(e){return[e,t[e]]})))},deepAssign:function(){var t=arguments.length,e=arguments[0];"Object"!==this.getDataType(e)&&(e={});for(var n=1;n<t;n++){var r=arguments[n];if("Object"===this.getDataType(r))for(var a in r)"__proto__"!==a&&e!==r[a]&&("Object"===this.getDataType(r[a])?e[a]=this.deepAssign(e[a],r[a]):e[a]=r[a])}return e},handleCopyValue:function(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);var 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((function(t,n){document.execCommand("copy")?t():n(new Error("copy failed")),e.remove()}))}};function l(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(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((function(t){return e[t]}))},Array.prototype.distinct=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},e=[],n={};return this.forEach((function(r){var a=t(r);!n[a]&&(n[a]=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((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t+e})):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return this.sort((function(e,n){return t(n)-t(e)}))},Array.prototype.asc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return this.sort((function(e,n){return t(e)-t(n)}))},Array.prototype.clear=function(){return this.length=0,this};var h={asArray:function(t){return u.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray:function(t){return[].concat(l(new Array(t).keys()))},union:function(){for(var t=[],e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.forEach((function(e){Array.isArray(e)&&(t=t.concat(e.filter((function(e){return!t.includes(e)}))))})),t},intersection:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0]||[];return e.forEach((function(t){Array.isArray(t)&&(r=r.filter((function(e){return t.includes(e)})))})),r},unionAll:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return[].concat(l(e)).flat().filter((function(t){return!!t}))},difference:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.union.apply(this,l(n)).filter((function(e){return!t.intersection.apply(t,l(n)).includes(e)}))}},f={getUrlParams:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,r=new URL(t),a=r.search,i=r.hash,o=[a,i],s={},c=0;c<o.length;c++){var u=o[c];if(u){var l=u.replace(/#|\//g,""),h=l.split("?");if(h.length>1)for(var f=1;f<h.length;f++)for(var d=void 0;d=n.exec(h[f]);)s[d[1]]=e?decodeURIComponent(d[2]):d[2]}}return s},getExplorer:function(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0?"Safari":void 0},detectOS:function(){var t="",e=-1!=navigator.userAgent.indexOf("Windows",0)?1:0,n=-1!=navigator.userAgent.indexOf("mac",0)?1:0,r=-1!=navigator.userAgent.indexOf("Linux",0)?1:0,a=-1!=navigator.userAgent.indexOf("X11",0)?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":a&&(t="Unix"),t},switchFullScreen:function(t){if(t){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale:function(){var t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/1920;t/e>16/9&&(r=e/1080),n.transformOrigin="left top",n.transform="scale("+r+") translateX(-49.99%)",n.width=t/r+"px"},getHtmlFontSize:function(){var t=document.documentElement.clientWidth||document.body.clientWidth;document.querySelector("html").style.fontSize=t/192+"px"}},d={set:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toGMTString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toGMTString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},p={PI:3.141592653589793,XPI:52.35987755982988,delta:function(t,e){var n=6378245,r=.006693421622965943,a=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35),o=t/180*this.PI,s=Math.sin(o);s=1-r*s*s;var c=Math.sqrt(s);return{lat:a=180*a/(n*(1-r)/(s*c)*this.PI),lng:i=180*i/(n/c*Math.cos(o)*this.PI)}},gcjEncrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};var n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};var n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact:function(t,e){for(var n=.01,r=.01,a=t-n,i=e-r,o=t+n,s=e+r,c=void 0,u=void 0,l=0;;){c=(a+o)/2,u=(i+s)/2;var h=this.gcj_encrypt(c,u);if(n=h.lat-t,r=h.lng-e,Math.abs(n)<1e-9&&Math.abs(r)<1e-9)break;if(n>0?o=c:a=c,r>0?s=u:i=u,++l>1e4)break}return{lat:c,lng:u}},bdEncrypt:function(t,e){var n=e,r=t,a=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),o=a*Math.cos(i)+.0065;return{lat:a*Math.sin(i)+.006,lng:o}},bdDecrypt:function(t,e){var n=e-.0065,r=t-.006,a=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),o=a*Math.cos(i);return{lat:a*Math.sin(i),lng:o}},mercatorEncrypt:function(t,e){var n=20037508.34*e/180,r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return{lat:r=20037508.34*r/180,lng:n}},mercatorDecrypt:function(t,e){var n=e/20037508.34*180,r=t/20037508.34*180;return{lat:r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),lng:n}},distance:function(t,e,n,r){var a=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180)+Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);a>1&&(a=1),a<-1&&(a=-1);var i=6371e3*Math.acos(a);return i},outOfChina:function(t,e){return e<72.004||e>137.8347||(t<.8293||t>55.8271)},transformLat:function(t,e){var n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},transformLon:function(t,e){var n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},randomCoordinate:function(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var n in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1===RegExp.$1.length?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){var n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":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)}return n};var g={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:function(t){if("string"==typeof t){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/))&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/))&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval:function(t,e){var n=new Date(t),r=new Date(e).getTime()-n.getTime(),a=Math.floor(r/864e5),i=r%864e5,o=Math.floor(i/36e5),s=i%36e5,c=Math.floor(s/6e4),u=s%6e4,l=Math.round(u/1e3),h="";return a>0&&(h+=a+"天"),o>0&&(h+=o+"时"),c>0&&(h+=c+"分"),l>0&&(h+=l+"秒"),0===a&&0===o&&0===c&&0===l&&(h="少于1秒"),h},formatterCounter:function(t){var e=function(t){return(t>10?"":"0")+(t||0)},n=t%3600,r=n%60;return e(Math.floor(t/3600))+":"+e(Math.floor(n/60))+":"+e(Math.round(r))},sleep:function(t){for(var e=Date.now();Date.now()-e<=t;);}};function v(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function y(t){return v(t).split(/\s+/)}var m={getStyle:function(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||"auto"===n)&&document.defaultView){var r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return"auto"===n?null:n},create:function(t,e,n){var r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove:function(t){var e=t.parentNode;e&&e.removeChild(t)},empty:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront:function(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack:function(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass:function(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal},hasClass:function(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass:function(t,e){if(void 0!==t.classList)for(var n=y(e),r=0,a=n.length;r<a;r++)t.classList.add(n[r]);else if(!this.hasClass(t,e)){var i=this.getClass(t);this.setClass(t,(i?i+" ":"")+e)}},removeClass:function(t,e){void 0!==t.classList?y(e).forEach((function(e){return t.classList.remove(e)})):this.setClass(t,v((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass:function(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e},parseFromString:function(t){return(new DOMParser).parseFromString(t,"text/xml").children[0]}},M={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},degreesToRadians:function(t){return t*this.DEG2RAD},toRadians:function(t){return t*this.DEG2RAD},radiansToDegrees:function(t){return t*this.RAD2DEG},toDegrees:function(t){return t*this.RAD2DEG},formatFloat:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},w={toRadian:Math.PI/180,R:6371393,isLnglat:function(t,e){return t&&e&&!!(+e>-90&&+e<90&&+t>-180&&+t<180)},formatLnglat:function(t,e){var n="";function r(t){var e=parseFloat(t),n=parseInt(e),r=parseInt(60*(e-n));return n+"°"+r+"′"+(3600*(e-n)-60*r).toFixed(2)+"″"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat:function(t,e){function n(t){for(var e=/[sw]/i.test(t)?-1:1,n=t.match(/[\d.]+/g),r=0,a=0,i=n.length;a<i;a++)r+=n[a]/e,e*=60;return r}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting:function(t,e){for(var n=t.x,r=t.y,a=!1,i=0,o=e.length,s=o-1;i<o;s=i,i++){var c=e[i].x,u=e[i].y,l=e[s].x,h=e[s].y;if(c===n&&u===r||l===n&&h===r)return"on";if(u<r&&h>=r||u>=r&&h<r){var f=c+(r-u)*(l-c)/(h-u);if(f===n)return"on";f>n&&(a=!a)}}return a?"in":"out"},wgs84PointsDistance:function(t,e){var n=Math.PI;function r(t){return t*n/180}if(2!=arguments.length)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var a,i=6378137,o=6356752.3142,s=1/298.257223563,c=r(lon2-lon1),u=Math.atan((1-s)*Math.tan(r(lat1))),l=Math.atan((1-s)*Math.tan(r(lat2))),h=Math.sin(u),f=Math.cos(u),d=Math.sin(l),p=Math.cos(l),g=c,v=100;do{var y=Math.sin(g),m=Math.cos(g),M=Math.sqrt(p*y*(p*y)+(f*d-h*p*m)*(f*d-h*p*m));if(0==M)return 0;var w=h*d+f*p*m,E=Math.atan2(M,w),R=f*p*y/M,b=1-R*R,O=w-2*h*d/b;isNaN(O)&&(O=0);var S=s/16*b*(4+s*(4-3*b));a=g,g=c+(1-S)*s*R*(E+S*M*(O+S*w*(2*O*O-1)))}while(Math.abs(g-a)>1e-12&&--v>0);if(0==v)return NaN;var A=b*(i*i-o*o)/(o*o),D=1+A/16384*(4096+A*(A*(320-175*A)-768)),_=A/1024*(256+A*(A*(74-47*A)-128)),x=_*M*(O+_/4*(w*(2*O*O-1)-_/6*O*(4*M*M-3)*(4*O*O-3))),I=o*D*(E-x);Math.atan2(p*y,f*d-h*p*m),Math.atan2(f*y,-h*p+f*d*m);return I},rotatePoint:function(t,e,n){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}},calcBearAndDisByPoints:function(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),a=parseFloat(e.lat),i=parseFloat(e.lng),o=Math.sin((i-r)*this.toRadian)*Math.cos(a*this.toRadian),s=Math.cos(n*this.toRadian)*Math.sin(a*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.cos((i-r)*this.toRadian),c=Math.atan2(o,s)*(180/Math.PI),u=(a-n)*this.toRadian,l=(i-r)*this.toRadian,h=Math.sin(u/2)*Math.sin(u/2)+Math.cos(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.sin(l/2)*Math.sin(l/2),f=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h));return{angle:c,distance:this.R*f}},calcPointByBearAndDis:function(t,e,n){var r=M.toRadians(parseFloat(t.lat)),a=M.toRadians(parseFloat(t.lng));e=parseFloat(e);var i=(n=parseFloat(n))/this.R;e=M.toRadians(e);var o=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),s=a+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(o));return{lat:M.toDegrees(o),lng:M.toDegrees(s)}},mercatorTolonlat:function(t,e){var n=e/20037508.34*180;return{lng:t/20037508.34*180,lat:180/Math.PI*(2*Math.atan(Math.exp(n*Math.PI/180))-Math.PI/2)}},lonlatToMercator:function(t,e){var n=t*Math.PI/180*6378137,r=e*Math.PI/180;return{x:n,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}}},E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R={convertBase64ToBlob:function(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);var o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return o?((o=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder)).append(r),o.getBlob(e)):o=new Blob([r],{type:e})},convertUrlToBase64:function(t,e,n){return new Promise((function(r,a){var i=new Image;i.crossOrigin="Anonymous",i.src=t,i.onload=function(){var t=document.createElement("canvas");t.width=e||i.width,t.height=n||i.height,t.getContext("2d").drawImage(i,0,0,i.width,i.height);var a=i.src.substring(i.src.lastIndexOf(".")+1).toLowerCase(),o=t.toDataURL("image/"+a);r({dataURL:o,type:"image/"+a,ext:a})}}))},convertBase64ToFile:function(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],a=atob(n[1]),i=a.length,o=new Uint8Array(i);i--;)o[i]=a.charCodeAt(i);return new File([o],e,{type:r})},downloadFromFile:function(t,e){if("object"==(void 0===t?"undefined":E(t)))if(t instanceof Blob)t=URL.createObjectURL(t);else{var n=JSON.stringify(t),r=new Blob([n],{type:"text/json"});t=window.URL.createObjectURL(r)}else if("string"==typeof t&&-1===t.indexOf("http")){var a=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(a)}var i=document.createElement("a");i.href=t,i.download=e||"",i.click(),window.URL.revokeObjectURL(i.href)}},b={debounce:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=void 0,a=void 0,i=void 0,o=void 0,s=void 0,c=function c(){var u=+new Date-o;u<e&&u>0?r=setTimeout(c,e-u):(r=null,n||(s=t.apply(i,a),r||(i=a=null)))};return function(){for(var a=arguments.length,u=Array(a),l=0;l<a;l++)u[l]=arguments[l];i=this,o=+new Date;var h=n&&!r;return r||(r=setTimeout(c,e)),h&&(s=t.apply(i,u),i=u=null),s}},throttle:function(t,e,n){if(1===n)var r=0;else if(2===n)var a;return function(){var i=this,o=arguments;if(1===n){var s=Date.now();s-r>e&&(t.apply(i,o),r=s)}else 2===n&&(a||(a=setTimeout((function(){a=null,t.apply(i,o)}),e)))}},recurve:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=0;setTimeout((function a(){++r<Math.floor(n/e)&&(t.call(this),setTimeout(a,e))}))}},O={checkStr:function(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:function(t,e){switch(e=e||4){case 1:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case 2:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case 3:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n=n.map((function(t){switch(u.getDataType(t)){case"Object":return t||"{}";case"Array":return t||"[]";default:return t||""}})),t.reduce((function(t,e,r){return""+t+n[r-1]+e}))},getByteLength:function(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte:function(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var a=Math.floor(n/2);a<t.length;a++){var i=t.substring(e,a);if(i.replace(r,"mm").length>=n)return i}return t},asString:function(t){if(u.isEmpty(t))return"";switch(u.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},S={notNull:function(t){if(u.isEmpty(t))throw Error("不能为空:>>>"+t)},legalLnglat:function(t,e){if(!w.isLnglat(t,e))throw Error(i.COORDINATE_ERROR)},contain:function(t){for(var e=!1,n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];for(var o=r.length||0,s=0,c=o;s<c;s++)e=t.indexOf(r[s])>=0;if(e)throw Error(i.STRING_CHECK_LOSS)},verify:{array:function(t){if("Array"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_ARRAY+":>>>"+t)},function:function(t){if("Function"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object:function(t){if("Object"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON:function(t){try{JSON.parse(t)}catch(e){throw Error(i.JSON_PARSE_ERROR+":>>>"+t)}},legalData:function(t,e){var n=O.checkStr(t,e),r="";switch(e){case"phone":r="电话";break;case"tel":r="座机";break;case"card":r="身份证";break;case"pwd":r="密码";break;case"postal":r="邮政编码";break;case"QQ":r="QQ";break;case"email":r="邮箱";break;case"money":r="金额";break;case"URL":r="网址";break;case"IP":r="IP";break;case"date":r="日期时间";break;case"number":r="数字";break;case"english":r="英文";break;case"chinese":r="中文";break;case"lower":r="小写";break;case"upper":r="大写";break;case"HTML":r="HTML标记"}if(!n)throw Error(i.PARAMETER_ERROR+":>>>不是"+r)}},A=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var D=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.audio=new Audio,this.audio.src=e}return A(t,[{key:"play",value:function(){!this.muted&&this.audio.play()}},{key:"pause",value:function(){this.audio.pause()}},{key:"muted",get:function(){return this.audio.muted},set:function(t){this.audio.muted=t}}]),t}(),_=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var x=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"String"===u.getDataType(e)&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}return _(t,[{key:"drawLine",value:function(t,e,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};this.cxt.beginPath();var i=a.width||1,o=a.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(t,e),this.cxt.lineTo(n,r),this.cxt.closePath(),this.cxt.fill()}},{key:"drawArc",value:function(t,e,n,r,a,i,o,s){o?(this.cxt.fillStyle=s,this.cxt.beginPath(),this.cxt.arc(t,e,n,M.degreesToRadians(r),M.degreesToRadians(a),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=s,this.cxt.beginPath(),this.cxt.arc(t,e,n,M.degreesToRadians(r),M.degreesToRadians(a),i),this.cxt.stroke())}}]),t}();function I(){}Object.assign(I.prototype,{addEventListener:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];void 0===this._listeners&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;var a=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(r&&(a[t]=e),i[t].push(e)),this},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){var r=n.map((function(t){return t.toString()})).indexOf(e.toString());-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){var e=this;if(void 0!==this._listeners){var n=this._listeners[t.type];if(void 0!==n){t.target=this;var r=n.slice(0);if(this._mutex[t.type])return void r.find((function(n){return n===e._mutex[t.type]})).call(this._context||this,t);for(var a=0,i=r.length;a<i;a++)r[a].call(this._context||this,t)}}},removeAllListener:function(){for(var t in this._mutex={},this._listeners)this._listeners[t]=[]}});var T=I;function C(){return new Map}Object.assign(Map.prototype,{isEmpty:function(){return 0===this.size},_values:function(){return Array.from(Map.prototype.values.call(this))},_keys:function(){return Array.from(Map.prototype.keys.call(this))},_entries:function(){return Array.from(Map.prototype.entries.call(this))}}),C.fromEntries=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=new C;return t.forEach((function(t){Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e};var P=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var N=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ws://127.0.0.1:10088";k(this,e);var n=L(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.maxCheckTimes=10,n.url=t,n.checkTimes=0,n.connectStatus=!1,n.connect(),n.connCheckStatus(n.maxCheckTimes),e.instance=n,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),P(e,[{key:"connect",value:function(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){var t=this;this.client.onopen=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:a.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:a.WEB_SOCKET_ERROR,message:e})})}}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}},{key:"disconnect",value:function(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}},{key:"connCheckStatus",value:function(t){var e=this;this.checkTimes>t||setTimeout((function(){e.checkTimes++,e.client&&0!==e.client.readyState&&1!==e.client.readyState&&e.connect(),e.connCheckStatus(t)}),2e3)}},{key:"send",value:function(t){return this.client&&1===this.client.readyState?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),!1)}},{key:"heartbeat",value:function(){var t=this;setTimeout((function(){t.client&&1===t.client.readyState&&t.send("HeartBeat"),console.log("HeartBeat,"+t.url),setTimeout(t.heartbeat,3e4)}),1e3)}}],[{key:"getInstance",value:function(){return e.instance?e.instance:Object.freeze(new e)}},{key:"_instance",get:function(){return this.getInstance()}}]),e}(T),F=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function U(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var j=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(U(this,t),this.cacheType=e,1===e)this.storage=window.localStorage;else{if(2!==e)throw new Error(i.PARAMETER_ERROR);this.storage=window.sessionStorage}}return F(t,[{key:"setItem",value:function(t,e,n){var r={key:t,value:e};if(1===this.cacheType){var a=Date.now();n&&(r.expired=a+1e3*n)}return this.storage[t]=JSON.stringify(r),r}},{key:"getItem",value:function(t){var e=this.storage.getItem(t)||null,n=JSON.parse(e)||{};if(1===this.cacheType){var r=n.expired||Date.now();if(Date.now()>r)return this.remove(t),null}return n.value}},{key:"remove",value:function(t){var e=this;t&&(t.indexOf(",")>-1?t.split(",").forEach((function(t){e.storage.removeItem(t)})):this.storage.removeItem(t))}},{key:"clear",value:function(){this.storage.clear()}}]),t}(),B=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function W(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var G=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;W(this,t),this.magnification=e}return B(t,[{key:"_getSystem",value:function(){if(navigator.userAgent.toLowerCase().indexOf("windows")>=0)return!0}},{key:"_addHandler",value:function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}},{key:"_correct",value:function(){var t=window.innerWidth;if("number"!=typeof t&&(t="CSS1Compat"==document.compatMode?document.documentElement.clientWidth:document.body.clientWidth),t<=750){var e=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=75*this.magnification*Math.min(e,2)+"px"}else if(t>750&&t<=1200){var n=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=85*this.magnification*Math.min(n,2)+"px"}else{var r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=100*this.magnification*Math.min(r,2)+"px"}}},{key:"_watch",value:function(){var t=this;t._addHandler(window,"resize",(function(){t._correct()}))}},{key:"init",value:function(){var t=this;t._getSystem()&&(t._correct(),t._watch())}}]),t}()}])}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Gis",[],e):"object"==typeof exports?exports.Gis=e():t.Gis=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"AnimateUtils",(function(){return r})),n.d(e,"ArrayUtils",(function(){return h})),n.d(e,"BrowserUtils",(function(){return f})),n.d(e,"Cookie",(function(){return d})),n.d(e,"CoordsUtils",(function(){return p})),n.d(e,"DateUtils",(function(){return g})),n.d(e,"DomUtils",(function(){return m})),n.d(e,"GeoUtils",(function(){return w})),n.d(e,"FileUtils",(function(){return R})),n.d(e,"MathUtils",(function(){return M})),n.d(e,"OptimizeUtils",(function(){return b})),n.d(e,"StringUtils",(function(){return O})),n.d(e,"AssertUtils",(function(){return S})),n.d(e,"Utils",(function(){return u})),n.d(e,"EventType",(function(){return a})),n.d(e,"ErrorType",(function(){return i})),n.d(e,"LayerType",(function(){return o})),n.d(e,"GraphicType",(function(){return s})),n.d(e,"MeasureMode",(function(){return c})),n.d(e,"AudioPlayer",(function(){return D})),n.d(e,"CanvasDrawer",(function(){return x})),n.d(e,"EventDispatcher",(function(){return T})),n.d(e,"HashMap",(function(){return C})),n.d(e,"WebSocketClient",(function(){return N})),n.d(e,"WebStorage",(function(){return j})),n.d(e,"DevicePixelRatio",(function(){return G}));var r={animate:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"swing",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;for(var i in e)e[i]={target:"opacity"===i?parseInt(100*e[i]):e[i],iNow:"opacity"===i?parseInt(100*getComputedStyle(t)[i]):parseInt(getComputedStyle(t)[i])};"liner"===r&&(a=e[i].iNow<e[i].target?Math.abs(a):-Math.abs(a)),clearInterval(t.timer),t.timer=setInterval((function(){for(var i in e){var o=e[i].target,s=e[i].iNow;if("swing"===r&&(a=(a=(o-s)/20)>0?Math.ceil(a):Math.floor(a)),Math.abs(o-s)<=Math.abs(a)){for(var c in t.style[i]="opacity"===i?o/100:o+"px",delete e[i],e)return!1;clearInterval(t.timer),"function"==typeof n&&n()}else e[i].iNow+=a,t.style[i]="opacity"===i?e[i].iNow/100:e[i].iNow+"px"}}),30)}},a={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"},i={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:"字符缺少关键字"},o={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"},s={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},c={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},u={getDataType:function(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty:function(t){if(null==t)return!0;switch(this.getDataType(t)){case"String":return""===t.trim();case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty:function(t){return!this.isEmpty(t)},json2form:function(t){var e=new FormData;return Object.keys(t).forEach((function(n){e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])})),e},json2Query:function(t){var e=[];for(var n in t){var r=n,a=t[n];e.push(r+"="+a)}return e.join("&")},generateGuid:function(){var t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict:function(){for(var t="",e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];if(n.length>1){for(var a=n.slice(1,n.length%2==0?n.length-1:n.length),i=0;i<a.length;i+=2){var o=a[i];n[0]===o&&(t=a[i+1])}t||n.length%2!=0||(t=n[n.length-1])}else t=n[0];return t},extend:function(t){for(var e=void 0,n=void 0,r=void 0,a=void 0,i=arguments.length,o=Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];for(n=0,r=o.length;n<r;n++)for(e in a=o[n])t[e]=a[e];return t},rgb2hex:function(t){return"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1)},convertToTree2:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"parentId",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"children",a=[];function i(a){var o=a[e],s=t.filter((function(t){return t.hasOwnProperty(n)&&t[n]===o}));s.length>0&&(s.forEach(i),a[r]=s)}var o=function(r){-1===t.findIndex((function(t){return t[e]===r[n]}))&&(i(r),a.push(r))},s=!0,c=!1,u=void 0;try{for(var l,h=t[Symbol.iterator]();!(s=(l=h.next()).done);s=!0){var f=l.value;o(f)}}catch(t){c=!0,u=t}finally{try{!s&&h.return&&h.return()}finally{if(c)throw u}}return a},asyncLoadScript:function(t){return new Promise((function(e,n){try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){"complete"!==r.readyState&&"loaded"!==r.readyState||e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(t){n(t)}}))},loadStyle:function(t){t.forEach((function(t){var e=document.createElement("link");e.href=t,e.rel="stylesheet",e.type="text/css",document.head.appendChild(e)}))},template:function(t,e){return t.replace(/\{ *([\w_-]+) *\}/g,(function(t,n){var r=e[n];if(void 0===r)throw new Error(i.JSON_VALUE_ERROR+t);return"function"==typeof r&&(r=r(e)),r}))},deleteEmptyProperty:function(t){var e=this;return Object.fromEntries(Object.keys(t).filter((function(n){return!e.isEmpty(t[n])})).map((function(e){return[e,t[e]]})))},deepAssign:function(){var t=arguments.length,e=arguments[0];"Object"!==this.getDataType(e)&&(e={});for(var n=1;n<t;n++){var r=arguments[n];if("Object"===this.getDataType(r))for(var a in r)"__proto__"!==a&&e!==r[a]&&("Object"===this.getDataType(r[a])?e[a]=this.deepAssign(e[a],r[a]):e[a]=r[a])}return e},handleCopyValue:function(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);var 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((function(t,n){document.execCommand("copy")?t():n(new Error("copy failed")),e.remove()}))}};function l(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(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((function(t){return e[t]}))},Array.prototype.distinct=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},e=[],n={};return this.forEach((function(r){var a=t(r);!n[a]&&(n[a]=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((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t+e})):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return this.sort((function(e,n){return t(n)-t(e)}))},Array.prototype.asc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return this.sort((function(e,n){return t(e)-t(n)}))},Array.prototype.clear=function(){return this.length=0,this};var h={asArray:function(t){return u.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray:function(t){return[].concat(l(new Array(t).keys()))},union:function(){for(var t=[],e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.forEach((function(e){Array.isArray(e)&&(t=t.concat(e.filter((function(e){return!t.includes(e)}))))})),t},intersection:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0]||[];return e.forEach((function(t){Array.isArray(t)&&(r=r.filter((function(e){return t.includes(e)})))})),r},unionAll:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return[].concat(l(e)).flat().filter((function(t){return!!t}))},difference:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.union.apply(this,l(n)).filter((function(e){return!t.intersection.apply(t,l(n)).includes(e)}))}},f={getUrlParams:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,r=new URL(t),a=r.search,i=r.hash,o=[a,i],s={},c=0;c<o.length;c++){var u=o[c];if(u){var l=u.replace(/#|\//g,""),h=l.split("?");if(h.length>1)for(var f=1;f<h.length;f++)for(var d=void 0;d=n.exec(h[f]);)s[d[1]]=e?decodeURIComponent(d[2]):d[2]}}return s},getExplorer:function(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0?"Safari":void 0},detectOS:function(){var t="",e=-1!=navigator.userAgent.indexOf("Windows",0)?1:0,n=-1!=navigator.userAgent.indexOf("mac",0)?1:0,r=-1!=navigator.userAgent.indexOf("Linux",0)?1:0,a=-1!=navigator.userAgent.indexOf("X11",0)?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":a&&(t="Unix"),t},switchFullScreen:function(t){if(t){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale:function(){var t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/1920;t/e>16/9&&(r=e/1080),n.transformOrigin="left top",n.transform="scale("+r+") translateX(-49.99%)",n.width=t/r+"px"},getHtmlFontSize:function(){var t=document.documentElement.clientWidth||document.body.clientWidth;document.querySelector("html").style.fontSize=t/192+"px"}},d={set:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toGMTString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toGMTString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},p={PI:3.141592653589793,XPI:52.35987755982988,delta:function(t,e){var n=6378245,r=.006693421622965943,a=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35),o=t/180*this.PI,s=Math.sin(o);s=1-r*s*s;var c=Math.sqrt(s);return{lat:a=180*a/(n*(1-r)/(s*c)*this.PI),lng:i=180*i/(n/c*Math.cos(o)*this.PI)}},gcjEncrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};var n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};var n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact:function(t,e){for(var n=.01,r=.01,a=t-n,i=e-r,o=t+n,s=e+r,c=void 0,u=void 0,l=0;;){c=(a+o)/2,u=(i+s)/2;var h=this.gcj_encrypt(c,u);if(n=h.lat-t,r=h.lng-e,Math.abs(n)<1e-9&&Math.abs(r)<1e-9)break;if(n>0?o=c:a=c,r>0?s=u:i=u,++l>1e4)break}return{lat:c,lng:u}},bdEncrypt:function(t,e){var n=e,r=t,a=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),o=a*Math.cos(i)+.0065;return{lat:a*Math.sin(i)+.006,lng:o}},bdDecrypt:function(t,e){var n=e-.0065,r=t-.006,a=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),o=a*Math.cos(i);return{lat:a*Math.sin(i),lng:o}},mercatorEncrypt:function(t,e){var n=20037508.34*e/180,r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return{lat:r=20037508.34*r/180,lng:n}},mercatorDecrypt:function(t,e){var n=e/20037508.34*180,r=t/20037508.34*180;return{lat:r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),lng:n}},distance:function(t,e,n,r){var a=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180)+Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);a>1&&(a=1),a<-1&&(a=-1);var i=6371e3*Math.acos(a);return i},outOfChina:function(t,e){return e<72.004||e>137.8347||(t<.8293||t>55.8271)},transformLat:function(t,e){var n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},transformLon:function(t,e){var n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},randomCoordinate:function(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var n in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1===RegExp.$1.length?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){var n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":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)}return n};var g={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:function(t){if("string"==typeof t){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/))&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/))&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval:function(t,e){var n=new Date(t),r=new Date(e).getTime()-n.getTime(),a=Math.floor(r/864e5),i=r%864e5,o=Math.floor(i/36e5),s=i%36e5,c=Math.floor(s/6e4),u=s%6e4,l=Math.round(u/1e3),h="";return a>0&&(h+=a+"天"),o>0&&(h+=o+"时"),c>0&&(h+=c+"分"),l>0&&(h+=l+"秒"),0===a&&0===o&&0===c&&0===l&&(h="少于1秒"),h},formatterCounter:function(t){var e=function(t){return(t>10?"":"0")+(t||0)},n=t%3600,r=n%60;return e(Math.floor(t/3600))+":"+e(Math.floor(n/60))+":"+e(Math.round(r))},sleep:function(t){for(var e=Date.now();Date.now()-e<=t;);}};function v(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function y(t){return v(t).split(/\s+/)}var m={getStyle:function(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||"auto"===n)&&document.defaultView){var r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return"auto"===n?null:n},create:function(t,e,n){var r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove:function(t){var e=t.parentNode;e&&e.removeChild(t)},empty:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront:function(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack:function(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass:function(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal},hasClass:function(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass:function(t,e){if(void 0!==t.classList)for(var n=y(e),r=0,a=n.length;r<a;r++)t.classList.add(n[r]);else if(!this.hasClass(t,e)){var i=this.getClass(t);this.setClass(t,(i?i+" ":"")+e)}},removeClass:function(t,e){void 0!==t.classList?y(e).forEach((function(e){return t.classList.remove(e)})):this.setClass(t,v((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass:function(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e},parseFromString:function(t){return(new DOMParser).parseFromString(t,"text/xml").children[0]}},M={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},degreesToRadians:function(t){return t*this.DEG2RAD},toRadians:function(t){return t*this.DEG2RAD},radiansToDegrees:function(t){return t*this.RAD2DEG},toDegrees:function(t){return t*this.RAD2DEG},formatFloat:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},w={toRadian:Math.PI/180,R:6371393,isLnglat:function(t,e){return t&&e&&!!(+e>-90&&+e<90&&+t>-180&&+t<180)},formatLnglat:function(t,e){var n="";function r(t){var e=parseFloat(t),n=parseInt(e),r=parseInt(60*(e-n));return n+"°"+r+"′"+(3600*(e-n)-60*r).toFixed(2)+"″"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat:function(t,e){function n(t){for(var e=/[sw]/i.test(t)?-1:1,n=t.match(/[\d.]+/g),r=0,a=0,i=n.length;a<i;a++)r+=n[a]/e,e*=60;return r}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting:function(t,e){for(var n=t.x,r=t.y,a=!1,i=0,o=e.length,s=o-1;i<o;s=i,i++){var c=e[i].x,u=e[i].y,l=e[s].x,h=e[s].y;if(c===n&&u===r||l===n&&h===r)return"on";if(u<r&&h>=r||u>=r&&h<r){var f=c+(r-u)*(l-c)/(h-u);if(f===n)return"on";f>n&&(a=!a)}}return a?"in":"out"},wgs84PointsDistance:function(t,e){var n=Math.PI;function r(t){return t*n/180}if(2!=arguments.length)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var a,i=6378137,o=6356752.3142,s=1/298.257223563,c=r(lon2-lon1),u=Math.atan((1-s)*Math.tan(r(lat1))),l=Math.atan((1-s)*Math.tan(r(lat2))),h=Math.sin(u),f=Math.cos(u),d=Math.sin(l),p=Math.cos(l),g=c,v=100;do{var y=Math.sin(g),m=Math.cos(g),M=Math.sqrt(p*y*(p*y)+(f*d-h*p*m)*(f*d-h*p*m));if(0==M)return 0;var w=h*d+f*p*m,E=Math.atan2(M,w),R=f*p*y/M,b=1-R*R,O=w-2*h*d/b;isNaN(O)&&(O=0);var S=s/16*b*(4+s*(4-3*b));a=g,g=c+(1-S)*s*R*(E+S*M*(O+S*w*(2*O*O-1)))}while(Math.abs(g-a)>1e-12&&--v>0);if(0==v)return NaN;var A=b*(i*i-o*o)/(o*o),D=1+A/16384*(4096+A*(A*(320-175*A)-768)),_=A/1024*(256+A*(A*(74-47*A)-128)),x=_*M*(O+_/4*(w*(2*O*O-1)-_/6*O*(4*M*M-3)*(4*O*O-3))),I=o*D*(E-x);Math.atan2(p*y,f*d-h*p*m),Math.atan2(f*y,-h*p+f*d*m);return I},rotatePoint:function(t,e,n){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}},calcBearAndDis:function(t,e){var n=t.x,r=t.y,a=e.x-n,i=e.y-r,o=Math.sqrt(a*a+i*i);return{angle:(Math.atan2(i,a)*(180/Math.PI)+360+90)%360,distance:o}},calcBearAndDisByPoints:function(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),a=parseFloat(e.lat),i=parseFloat(e.lng),o=Math.sin((i-r)*this.toRadian)*Math.cos(a*this.toRadian),s=Math.cos(n*this.toRadian)*Math.sin(a*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.cos((i-r)*this.toRadian),c=Math.atan2(o,s)*(180/Math.PI),u=(a-n)*this.toRadian,l=(i-r)*this.toRadian,h=Math.sin(u/2)*Math.sin(u/2)+Math.cos(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.sin(l/2)*Math.sin(l/2),f=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h));return{angle:c,distance:this.R*f}},calcPointByBearAndDis:function(t,e,n){var r=M.toRadians(parseFloat(t.lat)),a=M.toRadians(parseFloat(t.lng));e=parseFloat(e);var i=(n=parseFloat(n))/this.R;e=M.toRadians(e);var o=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),s=a+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(o));return{lat:M.toDegrees(o),lng:M.toDegrees(s)}},mercatorTolonlat:function(t,e){var n=e/20037508.34*180;return{lng:t/20037508.34*180,lat:180/Math.PI*(2*Math.atan(Math.exp(n*Math.PI/180))-Math.PI/2)}},lonlatToMercator:function(t,e){var n=t*Math.PI/180*6378137,r=e*Math.PI/180;return{x:n,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}}},E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R={convertBase64ToBlob:function(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);var o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return o?((o=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder)).append(r),o.getBlob(e)):o=new Blob([r],{type:e})},convertUrlToBase64:function(t,e,n){return new Promise((function(r,a){var i=new Image;i.crossOrigin="Anonymous",i.src=t,i.onload=function(){var t=document.createElement("canvas");t.width=e||i.width,t.height=n||i.height,t.getContext("2d").drawImage(i,0,0,i.width,i.height);var a=i.src.substring(i.src.lastIndexOf(".")+1).toLowerCase(),o=t.toDataURL("image/"+a);r({dataURL:o,type:"image/"+a,ext:a})}}))},convertBase64ToFile:function(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],a=atob(n[1]),i=a.length,o=new Uint8Array(i);i--;)o[i]=a.charCodeAt(i);return new File([o],e,{type:r})},downloadFromFile:function(t,e){if("object"==(void 0===t?"undefined":E(t)))if(t instanceof Blob)t=URL.createObjectURL(t);else{var n=JSON.stringify(t),r=new Blob([n],{type:"text/json"});t=window.URL.createObjectURL(r)}else if("string"==typeof t&&-1===t.indexOf("http")){var a=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(a)}var i=document.createElement("a");i.href=t,i.download=e||"",i.click(),window.URL.revokeObjectURL(i.href)}},b={debounce:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=void 0,a=void 0,i=void 0,o=void 0,s=void 0,c=function c(){var u=+new Date-o;u<e&&u>0?r=setTimeout(c,e-u):(r=null,n||(s=t.apply(i,a),r||(i=a=null)))};return function(){for(var a=arguments.length,u=Array(a),l=0;l<a;l++)u[l]=arguments[l];i=this,o=+new Date;var h=n&&!r;return r||(r=setTimeout(c,e)),h&&(s=t.apply(i,u),i=u=null),s}},throttle:function(t,e,n){if(1===n)var r=0;else if(2===n)var a;return function(){var i=this,o=arguments;if(1===n){var s=Date.now();s-r>e&&(t.apply(i,o),r=s)}else 2===n&&(a||(a=setTimeout((function(){a=null,t.apply(i,o)}),e)))}},recurve:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=0;setTimeout((function a(){++r<Math.floor(n/e)&&(t.call(this),setTimeout(a,e))}))}},O={checkStr:function(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:function(t,e){switch(e=e||4){case 1:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case 2:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case 3:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n=n.map((function(t){switch(u.getDataType(t)){case"Object":return t||"{}";case"Array":return t||"[]";default:return t||""}})),t.reduce((function(t,e,r){return""+t+n[r-1]+e}))},getByteLength:function(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte:function(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var a=Math.floor(n/2);a<t.length;a++){var i=t.substring(e,a);if(i.replace(r,"mm").length>=n)return i}return t},asString:function(t){if(u.isEmpty(t))return"";switch(u.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},S={notNull:function(t){if(u.isEmpty(t))throw Error("不能为空:>>>"+t)},legalLnglat:function(t,e){if(!w.isLnglat(t,e))throw Error(i.COORDINATE_ERROR)},contain:function(t){for(var e=!1,n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];for(var o=r.length||0,s=0,c=o;s<c;s++)e=t.indexOf(r[s])>=0;if(e)throw Error(i.STRING_CHECK_LOSS)},verify:{array:function(t){if("Array"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_ARRAY+":>>>"+t)},function:function(t){if("Function"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object:function(t){if("Object"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON:function(t){try{JSON.parse(t)}catch(e){throw Error(i.JSON_PARSE_ERROR+":>>>"+t)}},legalData:function(t,e){var n=O.checkStr(t,e),r="";switch(e){case"phone":r="电话";break;case"tel":r="座机";break;case"card":r="身份证";break;case"pwd":r="密码";break;case"postal":r="邮政编码";break;case"QQ":r="QQ";break;case"email":r="邮箱";break;case"money":r="金额";break;case"URL":r="网址";break;case"IP":r="IP";break;case"date":r="日期时间";break;case"number":r="数字";break;case"english":r="英文";break;case"chinese":r="中文";break;case"lower":r="小写";break;case"upper":r="大写";break;case"HTML":r="HTML标记"}if(!n)throw Error(i.PARAMETER_ERROR+":>>>不是"+r)}},A=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var D=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.audio=new Audio,this.audio.src=e}return A(t,[{key:"play",value:function(){!this.muted&&this.audio.play()}},{key:"pause",value:function(){this.audio.pause()}},{key:"muted",get:function(){return this.audio.muted},set:function(t){this.audio.muted=t}}]),t}(),_=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var x=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"String"===u.getDataType(e)&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}return _(t,[{key:"drawLine",value:function(t,e,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};this.cxt.beginPath();var i=a.width||1,o=a.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(t,e),this.cxt.lineTo(n,r),this.cxt.closePath(),this.cxt.fill()}},{key:"drawArc",value:function(t,e,n,r,a,i,o,s){o?(this.cxt.fillStyle=s,this.cxt.beginPath(),this.cxt.arc(t,e,n,M.degreesToRadians(r),M.degreesToRadians(a),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=s,this.cxt.beginPath(),this.cxt.arc(t,e,n,M.degreesToRadians(r),M.degreesToRadians(a),i),this.cxt.stroke())}}]),t}();function I(){}Object.assign(I.prototype,{addEventListener:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];void 0===this._listeners&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;var a=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(r&&(a[t]=e),i[t].push(e)),this},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){var r=n.map((function(t){return t.toString()})).indexOf(e.toString());-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){var e=this;if(void 0!==this._listeners){var n=this._listeners[t.type];if(void 0!==n){t.target=this;var r=n.slice(0);if(this._mutex[t.type])return void r.find((function(n){return n===e._mutex[t.type]})).call(this._context||this,t);for(var a=0,i=r.length;a<i;a++)r[a].call(this._context||this,t)}}},removeAllListener:function(){for(var t in this._mutex={},this._listeners)this._listeners[t]=[]}});var T=I;function C(){return new Map}Object.assign(Map.prototype,{isEmpty:function(){return 0===this.size},_values:function(){return Array.from(Map.prototype.values.call(this))},_keys:function(){return Array.from(Map.prototype.keys.call(this))},_entries:function(){return Array.from(Map.prototype.entries.call(this))}}),C.fromEntries=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=new C;return t.forEach((function(t){Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e};var P=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var N=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ws://127.0.0.1:10088";k(this,e);var n=L(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.maxCheckTimes=10,n.url=t,n.checkTimes=0,n.connectStatus=!1,n.connect(),n.connCheckStatus(n.maxCheckTimes),e.instance=n,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),P(e,[{key:"connect",value:function(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){var t=this;this.client.onopen=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:a.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:a.WEB_SOCKET_ERROR,message:e})})}}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}},{key:"disconnect",value:function(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}},{key:"connCheckStatus",value:function(t){var e=this;this.checkTimes>t||setTimeout((function(){e.checkTimes++,e.client&&0!==e.client.readyState&&1!==e.client.readyState&&e.connect(),e.connCheckStatus(t)}),2e3)}},{key:"send",value:function(t){return this.client&&1===this.client.readyState?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),!1)}},{key:"heartbeat",value:function(){var t=this;setTimeout((function(){t.client&&1===t.client.readyState&&t.send("HeartBeat"),console.log("HeartBeat,"+t.url),setTimeout(t.heartbeat,3e4)}),1e3)}}],[{key:"getInstance",value:function(){return e.instance?e.instance:Object.freeze(new e)}},{key:"_instance",get:function(){return this.getInstance()}}]),e}(T),F=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function U(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var j=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(U(this,t),this.cacheType=e,1===e)this.storage=window.localStorage;else{if(2!==e)throw new Error(i.PARAMETER_ERROR);this.storage=window.sessionStorage}}return F(t,[{key:"setItem",value:function(t,e,n){var r={key:t,value:e};if(1===this.cacheType){var a=Date.now();n&&(r.expired=a+1e3*n)}return this.storage[t]=JSON.stringify(r),r}},{key:"getItem",value:function(t){var e=this.storage.getItem(t)||null,n=JSON.parse(e)||{};if(1===this.cacheType){var r=n.expired||Date.now();if(Date.now()>r)return this.remove(t),null}return n.value}},{key:"remove",value:function(t){var e=this;t&&(t.indexOf(",")>-1?t.split(",").forEach((function(t){e.storage.removeItem(t)})):this.storage.removeItem(t))}},{key:"clear",value:function(){this.storage.clear()}}]),t}(),B=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function W(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var G=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;W(this,t),this.magnification=e}return B(t,[{key:"_getSystem",value:function(){if(navigator.userAgent.toLowerCase().indexOf("windows")>=0)return!0}},{key:"_addHandler",value:function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}},{key:"_correct",value:function(){var t=window.innerWidth;if("number"!=typeof t&&(t="CSS1Compat"==document.compatMode?document.documentElement.clientWidth:document.body.clientWidth),t<=750){var e=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=75*this.magnification*Math.min(e,2)+"px"}else if(t>750&&t<=1200){var n=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=85*this.magnification*Math.min(n,2)+"px"}else{var r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=100*this.magnification*Math.min(r,2)+"px"}}},{key:"_watch",value:function(){var t=this;t._addHandler(window,"resize",(function(){t._correct()}))}},{key:"init",value:function(){var t=this;t._getSystem()&&(t._correct(),t._watch())}}]),t}()}])}));
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "gis-common",
|
|
3
3
|
"description": "gis-common",
|
|
4
4
|
"main": "dist/resource.min.js",
|
|
5
|
-
"version": "3.1.
|
|
5
|
+
"version": "3.1.2",
|
|
6
6
|
"author": "Guo.Yan <luv02@vip.qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
"dev": "cross-env NODE_ENV=development webpack-dev-server --hot --port 7000",
|
|
11
11
|
"build": "cross-env NODE_ENV=production webpack --progress"
|
|
12
12
|
},
|
|
13
|
-
"files": [
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
14
17
|
"browserslist": [
|
|
15
18
|
"> 1%",
|
|
16
19
|
"last 2 versions",
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
LOGIN_EXPIRED: '登录信息过期,请重新登录',
|
|
3
|
+
CROSS_ERROR: '跨域访问',
|
|
4
|
+
UNEXIST_RESOURCE: '资源不存在',
|
|
5
|
+
TIMEOUT: '请求超时',
|
|
6
|
+
INTERNAL_ERROR: '内部错误',
|
|
7
|
+
NETWORK_ERROR: '请求失败,请检查网络是否已连接',
|
|
8
|
+
PROCESS_FAIL: '处理失败',
|
|
9
|
+
AUTH_VERIFY_ERROR: '权限验证失败',
|
|
10
|
+
NO_DATA_FOUND: '未找到数据',
|
|
11
|
+
DUPLICATE_INSTANCE: '实例为单例模式,不允许重复构建',
|
|
12
|
+
COORDINATE_ERROR: '坐标验证失败',
|
|
13
|
+
JSON_PARSE_ERROR: 'JSON解析失败,格式有误',
|
|
14
|
+
JSON_VALUE_ERROR: 'JSON无此键',
|
|
15
|
+
PARAMETER_ERROR: '验证数据类型失败',
|
|
16
|
+
PARAMETER_ERROR_ARRAY: '格式类型验证失败:必须是数组',
|
|
17
|
+
PARAMETER_ERROR_STRING: '格式类型验证失败:必须是字符',
|
|
18
|
+
PARAMETER_ERROR_FUNCTION: '格式类型验证失败:必须是函数',
|
|
19
|
+
PARAMETER_ERROR_OBJECT: '格式类型验证失败:必须是对象',
|
|
20
|
+
PARAMETER_ERROR_LACK: '参数缺失',
|
|
21
|
+
STRING_CHECK_LOSS: '字符缺少关键字',
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
MAP_RENDER: "mapRender",
|
|
3
|
+
MAP_READY: "mapReady",
|
|
4
|
+
MOUSE_CLICK: "click",
|
|
5
|
+
MOUSE_DOUBLE_CLICK: "dblclick",
|
|
6
|
+
MOUSE_MOVE: "mousemove",
|
|
7
|
+
MOUSE_IN: "mousein",
|
|
8
|
+
MOUSE_OUT: "mouseout",
|
|
9
|
+
MOUSE_RIGHT_CLICK: "mouseRightClick",
|
|
10
|
+
KEY_DOWN: "keyDown",
|
|
11
|
+
KEY_UP: "keyUp",
|
|
12
|
+
DRAW_ACTIVE: "drawActive",
|
|
13
|
+
DRAW_MOVE: "drawMove",
|
|
14
|
+
DRAW_COMPLETE: "drawComplete",
|
|
15
|
+
MQTT_CONNECT: "mqttConnect",
|
|
16
|
+
MQTT_ERROR: "mqttError",
|
|
17
|
+
MQTT_MESSAGE: "mqttMessage",
|
|
18
|
+
MQTT_CLOSE: "mqttClose",
|
|
19
|
+
WEB_SOCKET_CONNECT: "webSocketConnect",
|
|
20
|
+
WEB_SOCKET_ERROR: "webSocketError",
|
|
21
|
+
WEB_SOCKET_MESSAGE: "webSocketMessage",
|
|
22
|
+
WEB_SOCKET_CLOSE: "webSocketClose"
|
|
23
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const GraphicType = {
|
|
2
|
+
POINT: 'point',
|
|
3
|
+
POLYLINE: 'polyline',
|
|
4
|
+
POLYGON: 'polygon',
|
|
5
|
+
BILLBOARD: 'billboard',
|
|
6
|
+
CYLINDER: 'cylinder',
|
|
7
|
+
ELLIPSOID: 'ellipsoid',
|
|
8
|
+
LABEL: 'label',
|
|
9
|
+
MODEL: 'model',
|
|
10
|
+
WALL: 'wall',
|
|
11
|
+
}
|
|
12
|
+
export const MeasureMode = {
|
|
13
|
+
DISTANCE: 'distance',
|
|
14
|
+
AREA: 'area',
|
|
15
|
+
HEIGHT: 'height',
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
SUPER_MAP_IMAGES: "SuperMapImages", // 超图影像服务 栅格数据
|
|
3
|
+
SUPER_MAP_DATA: "SuperMapData", // 超图服务 矢量数据
|
|
4
|
+
ARC_GIS_MAP_IMAGES: "ArcGisMapImages", // arcGis影像图层 栅格数据
|
|
5
|
+
ARC_GIS_MAP_DATA: "ArcGisMapData", // arcGis图层 矢量数据
|
|
6
|
+
OSGB_LAYER: "OSGBLayer",
|
|
7
|
+
S3M_GROUP: "S3MGroup", // addS3MGroupLayer(url, options, index) 添加S3M分组图层。
|
|
8
|
+
TERRAIN_LAYER: "TerrainFileLayer" // 地形图层, 需要单独处理
|
|
9
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 声音播放类
|
|
3
|
+
* @export
|
|
4
|
+
* @class AudioPlayer
|
|
5
|
+
*/
|
|
6
|
+
export default class AudioPlayer {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of AudioPlayer.
|
|
9
|
+
* @param {*} url
|
|
10
|
+
*/
|
|
11
|
+
constructor(url) {
|
|
12
|
+
this.audio = new Audio()
|
|
13
|
+
this.audio.src = url
|
|
14
|
+
}
|
|
15
|
+
play() {
|
|
16
|
+
!this.muted && this.audio.play()
|
|
17
|
+
}
|
|
18
|
+
pause() {
|
|
19
|
+
this.audio.pause()
|
|
20
|
+
}
|
|
21
|
+
get muted() {
|
|
22
|
+
return this.audio.muted
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @description 设置静音状态,如果静音,autoplay属性将失效
|
|
26
|
+
*/
|
|
27
|
+
set muted(val) {
|
|
28
|
+
this.audio.muted = val
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import CommUtils from '../utils/CommUtils'
|
|
2
|
+
import MathUtils from '../utils/MathUtils';
|
|
3
|
+
export default class CanvasDrawer {
|
|
4
|
+
constructor(el) {
|
|
5
|
+
if (CommUtils.getDataType(el) === 'String') {
|
|
6
|
+
el = document.querySelector('#' + el)
|
|
7
|
+
}
|
|
8
|
+
this.ctx = el.getContext('2d')
|
|
9
|
+
}
|
|
10
|
+
drawLine(startX, startY, endX, endY, options = {}) {
|
|
11
|
+
this.cxt.beginPath();
|
|
12
|
+
const width = options.width || 1
|
|
13
|
+
const color = options.color || '#000'
|
|
14
|
+
this.cxt.lineWidth = width;
|
|
15
|
+
this.cxt.fillStyle = color;// 经过测试不管是fillStyle还是StrokeStyle都是一样的
|
|
16
|
+
this.cxt.moveTo(startX, startY);
|
|
17
|
+
this.cxt.lineTo(endX, endY);
|
|
18
|
+
this.cxt.closePath();
|
|
19
|
+
this.cxt.fill();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 绘制圆弧
|
|
23
|
+
* @param {*} x 圆心X坐标
|
|
24
|
+
* @param {*} y 圆心Y坐标
|
|
25
|
+
* @param {*} radius 半径
|
|
26
|
+
* @param {*} startAngle 开始的弧度
|
|
27
|
+
* @param {*} endAngle 结束的弧度
|
|
28
|
+
* @param {*} anticlockwise true为逆时针,false为顺时针
|
|
29
|
+
* @param {boolean} isOnlyArc
|
|
30
|
+
* @param {boolean} isFill 是否是填充,false为绘制边框,true为绘制填充
|
|
31
|
+
* @param {*} bgColor 圆弧的颜色
|
|
32
|
+
* @memberof CanvasDrawer
|
|
33
|
+
*/
|
|
34
|
+
drawArc(x, y, radius, startAngle, endAngle, anticlockwise, isFill, bgColor) {
|
|
35
|
+
if (isFill) {
|
|
36
|
+
//为true绘制填充圆弧
|
|
37
|
+
this.cxt.fillStyle = bgColor
|
|
38
|
+
this.cxt.beginPath()
|
|
39
|
+
this.cxt.arc(x, y, radius, MathUtils.degreesToRadians(startAngle), MathUtils.degreesToRadians(endAngle), anticlockwise)
|
|
40
|
+
this.cxt.closePath()
|
|
41
|
+
this.cxt.fill()
|
|
42
|
+
} else {
|
|
43
|
+
//为false绘制边框圆弧
|
|
44
|
+
this.cxt.strokeStyle = bgColor
|
|
45
|
+
this.cxt.beginPath()
|
|
46
|
+
this.cxt.arc(x, y, radius, MathUtils.degreesToRadians(startAngle), MathUtils.degreesToRadians(endAngle), anticlockwise)
|
|
47
|
+
|
|
48
|
+
this.cxt.stroke()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export default class DevicePixelRatio {
|
|
2
|
+
constructor(magnification = 1) {
|
|
3
|
+
this.magnification = magnification
|
|
4
|
+
}
|
|
5
|
+
// 获取系统类型
|
|
6
|
+
_getSystem() {
|
|
7
|
+
// let flag = false;
|
|
8
|
+
var agent = navigator.userAgent.toLowerCase()
|
|
9
|
+
// var isMac = /macintosh|mac os x/i.test(navigator.userAgent);
|
|
10
|
+
// if(isMac) {
|
|
11
|
+
// return false;
|
|
12
|
+
// }
|
|
13
|
+
// 现只针对windows处理,其它系统暂无该情况,如有,继续在此添加
|
|
14
|
+
if (agent.indexOf('windows') >= 0) {
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// 获取页面缩放比例
|
|
19
|
+
// _getDevicePixelRatio() {
|
|
20
|
+
// let t = this;
|
|
21
|
+
// }
|
|
22
|
+
// 监听方法兼容写法
|
|
23
|
+
_addHandler(element, type, handler) {
|
|
24
|
+
if (element.addEventListener) {
|
|
25
|
+
element.addEventListener(type, handler, false)
|
|
26
|
+
} else if (element.attachEvent) {
|
|
27
|
+
element.attachEvent('on' + type, handler)
|
|
28
|
+
} else {
|
|
29
|
+
element['on' + type] = handler
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// 校正浏览器缩放比例
|
|
33
|
+
_correct() {
|
|
34
|
+
// 配合px2rem插件进行自适应布局
|
|
35
|
+
let pageWidth = window.innerWidth
|
|
36
|
+
//为了ie也能拿到可视窗口宽度
|
|
37
|
+
if (typeof pageWidth != 'number') {
|
|
38
|
+
//标准模式
|
|
39
|
+
if (document.compatMode == 'CSS1Compat') {
|
|
40
|
+
pageWidth = document.documentElement.clientWidth
|
|
41
|
+
//怪异模式
|
|
42
|
+
} else {
|
|
43
|
+
pageWidth = document.body.clientWidth
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (pageWidth <= 750) {
|
|
47
|
+
const baseSize = 75
|
|
48
|
+
// 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
|
|
49
|
+
const scale = document.documentElement.clientWidth / pageWidth
|
|
50
|
+
// 设置页面根节点字体大小
|
|
51
|
+
document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + 'px'
|
|
52
|
+
} else if (pageWidth > 750 && pageWidth <= 1200) {
|
|
53
|
+
const baseSize = 85
|
|
54
|
+
// 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
|
|
55
|
+
const scale = document.documentElement.clientWidth / pageWidth
|
|
56
|
+
// 设置页面根节点字体大小
|
|
57
|
+
document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + 'px'
|
|
58
|
+
} else {
|
|
59
|
+
const baseSize = 100
|
|
60
|
+
// 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
|
|
61
|
+
const scale = document.documentElement.clientWidth / 1920
|
|
62
|
+
// 设置页面根节点字体大小
|
|
63
|
+
document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + 'px'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// 监听页面缩放
|
|
67
|
+
_watch() {
|
|
68
|
+
let t = this
|
|
69
|
+
t._addHandler(window, 'resize', function () {
|
|
70
|
+
// 注意这个方法是解决全局有两个window.resize
|
|
71
|
+
// 重新校正
|
|
72
|
+
t._correct()
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
// 初始化页面比例
|
|
76
|
+
init() {
|
|
77
|
+
let t = this
|
|
78
|
+
if (t._getSystem()) {
|
|
79
|
+
// 判断设备,目前只在windows系统下校正浏览器缩放比例
|
|
80
|
+
// 初始化页面校正浏览器缩放比例
|
|
81
|
+
t._correct()
|
|
82
|
+
// 开启监听页面缩放
|
|
83
|
+
t._watch()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export default class ElQuery {
|
|
2
|
+
constructor(selector, el = document) {
|
|
3
|
+
if (typeof selector == 'string') {
|
|
4
|
+
if (selector.charAt(0) == '<' && selector.slice(-1) == '>') {
|
|
5
|
+
var ele = selector.slice(1, -1)
|
|
6
|
+
this[0] = document.createElement(ele)
|
|
7
|
+
this.length = 1
|
|
8
|
+
} else {
|
|
9
|
+
var all = el.querySelectorAll(selector)
|
|
10
|
+
for (var i = 0; i < all.length; i++) {
|
|
11
|
+
this[i] = all[i]
|
|
12
|
+
}
|
|
13
|
+
this.length = all.length
|
|
14
|
+
}
|
|
15
|
+
} else if (typeof selector == 'undefined') {
|
|
16
|
+
return this
|
|
17
|
+
} else if (typeof selector == 'function') {
|
|
18
|
+
this.ready(selector)
|
|
19
|
+
} else if (selector.nodeType == 1) {
|
|
20
|
+
this[0] = selector
|
|
21
|
+
this.length = 1
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
each(callback) {
|
|
25
|
+
for (var i = 0; i < this.length; i++) {
|
|
26
|
+
callback(this[i], i)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
html(val) {
|
|
30
|
+
this.each(function (obj) {
|
|
31
|
+
obj.innerHTML = val
|
|
32
|
+
})
|
|
33
|
+
return this
|
|
34
|
+
}
|
|
35
|
+
css(attr, val) {
|
|
36
|
+
this.each(function (obj) {
|
|
37
|
+
if (typeof attr == 'object') {
|
|
38
|
+
for (var i in attr) {
|
|
39
|
+
if (i == 'width' || i == 'height' || i == 'margin' || i == 'fontSize') {
|
|
40
|
+
obj.style[i] = parseInt(attr[i]) + 'px'
|
|
41
|
+
}
|
|
42
|
+
obj.style[i] = attr[i]
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
obj.style[attr] = val
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
return this
|
|
49
|
+
}
|
|
50
|
+
ready(callback) {
|
|
51
|
+
document.addEventListener('DOMContentLoaded', (e) => {
|
|
52
|
+
callback.call(this, e)
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
click(callback) {
|
|
56
|
+
this.each(function (obj) {
|
|
57
|
+
obj.onclick = (e) => {
|
|
58
|
+
callback.call(this, e, obj)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
return this
|
|
62
|
+
}
|
|
63
|
+
on(type, callback) {
|
|
64
|
+
this.each((obj) => {
|
|
65
|
+
obj.removeEventListener(type, (e) => {
|
|
66
|
+
callback.call(this, e)
|
|
67
|
+
})
|
|
68
|
+
obj.addEventListener(type, (e) => {
|
|
69
|
+
callback.call(this, e)
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
appendTo(dom) {
|
|
74
|
+
if (typeof dom == 'string') {
|
|
75
|
+
var all = document.querySelectorAll(dom)
|
|
76
|
+
var ele = this[0]
|
|
77
|
+
for (var i = 0; i < all.length; i++) {
|
|
78
|
+
this[i] = ele.cloneNode(true)
|
|
79
|
+
all[i].appendChild(this[i])
|
|
80
|
+
this.length = all.length
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
dom.appendChild(this[0])
|
|
84
|
+
}
|
|
85
|
+
return this
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
window.$ = (selector, el) => new ElQuery(selector, el)
|