@senx/discovery-plugin-marauder
Version:
Discovery plugin - Marauder's map
2 lines • 5.7 kB
JavaScript
import{l as lodash,G as GTSLib}from"./lodash-d98cd4b5.js";var Param=function(){function e(){this.scheme="WARP10";this.datasetNoAlpha=false;this.timeZone="UTC";this.showRangeSelector=false;this.showDots=false;this.timeUnit="us";this.hideYAxis=false;this.hideXAxis=false;this.showLegend=false;this.showValues=false;this.fullDateDisplay=false;this.showControls=false;this.expandAnnotation=false;this.displayExpander=true;this.leftMargin=0;this.showLoader=false;this.noDataLabel="No data";this.poiLine="dotted";this.dotSize=5;this.strokeWidth=1}return e}();var Utils=function(){function e(){}e.clone=function(e){return lodash.exports.cloneDeep(e)};e.throttle=function(e,t,r){var n=this;var a;return function(){var i=[];for(var s=0;s<arguments.length;s++){i[s]=arguments[s]}var u=r||n;if(!a){a=true;e.apply(u,i);setTimeout((function(){return a=false}),t)}}};e.httpPost=function(e,t,r){return new Promise((function(n,a){var i=new XMLHttpRequest;var s={};i.onreadystatechange=function(){i.getAllResponseHeaders().split("\n").forEach((function(e){if(e.trim()!==""){var t=e.split(":");s[t[0].trim()]=t[1].trim().replace("\r","")}}));if(i.readyState===4&&i.status===200){n({data:i.responseText,headers:s,status:{ops:parseInt(s["x-warp10-ops"],10),elapsed:parseInt(s["x-warp10-elapsed"],10),fetched:parseInt(s["x-warp10-fetched"],10)}})}else if(i.readyState===4&&i.status>=400){a({statusText:i.statusText,status:i.status,url:e,headers:s,message:"line #".concat(s["x-warp10-error-line"],": ").concat(s["x-warp10-error-message"]),detail:{mess:s["x-warp10-error-message"],line:s["x-warp10-error-line"]}})}else if(i.readyState===4&&i.status===0){a({statusText:e+" is unreachable",status:404,url:e,headers:s,message:e+" is unreachable",detail:{mess:e+" is unreachable",line:-1}})}};i.open("POST",e,true);i.setRequestHeader("Content-Type","text/plain; charset=utf-8");Object.keys(r||{}).filter((function(e){return e.toLowerCase()!=="accept"&&e.toLowerCase()!=="content-type"})).forEach((function(e){return i.setRequestHeader(e,r[e])}));i.send(t)}))};e.merge=function(e,t){if(typeof e==="string"){e=JSON.parse(e)}return Object.assign(Object.assign(Object.assign({},new Param),e),t)};e.sanitize=function(e){if(typeof e==="string")return'["'+e+'"]';else return e};e.mergeDeep=function(t,r){var n=Object.assign({},t);var a=Object.assign({},r);for(var i in a||{}){if(Object.prototype.toString.call(a[i])==="[object Object]"){n[i]=e.mergeDeep(n[i],a[i])}else{n[i]=a[i]}}return n};e.getLabelColor=function(t){return e.getCSSColor(t,"--warp-view-chart-label-color","#8e8e8e").trim()};e.getGridColor=function(t){return e.getCSSColor(t,"--warp-view-chart-grid-color","#8e8e8e").trim()};e.getCSSColor=function(e,t,r){var n=getComputedStyle(e).getPropertyValue(t).trim();return n===""?r:n};e.getContentBounds=function(e){return{h:e.clientHeight-parseInt(getComputedStyle(e,null).getPropertyValue("padding-top"),10)-parseInt(getComputedStyle(e,null).getPropertyValue("padding-bottom"),10),w:e.clientWidth-parseInt(getComputedStyle(e,null).getPropertyValue("padding-left"),10)-parseInt(getComputedStyle(e,null).getPropertyValue("padding-right"),10)}};e.unsescape=function(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")};e.parseEventData=function(e,t,r){var n={style:undefined,data:undefined,xpath:undefined,popup:undefined,vars:undefined,audio:undefined,zoom:undefined,focus:undefined,margin:undefined,bounds:undefined,title:undefined,description:undefined,selected:undefined,link:undefined,hasEvent:false,poi:[]};if(t&&e.source!==r){var a=".*";var i=".*";t.split(",").forEach((function(e){if(e.startsWith("tag")){a=e.split("=")[1]}if(e.startsWith("type")){i=e.split("=")[1]}}));var s=new RegExp("^"+a+"$");if(e.tags&&typeof e.tags==="string"){e.tags=[e.tags]}if((e.tags||[]).some((function(e){return s.test(e)}))&&new RegExp(i).test(e.type||"")){switch(e.type){case"data":n.data=GTSLib.getData(e.value);n.hasEvent=true;break;case"style":n.style=e.value;n.hasEvent=true;break;case"xpath":n.xpath={selector:e.selector,value:e.value};n.hasEvent=true;break;case"popup":n.popup=e.value;n.hasEvent=true;break;case"variable":n.vars=e.value;n.hasEvent=true;break;case"audio":n.audio=e.value;n.hasEvent=true;break;case"zoom":n.zoom=e.value;if(e.selector){var u={};u[e.selector]=e.value;n.vars=u}n.hasEvent=true;break;case"focus":n.focus=e.value;if(e.selector){var u={};u[e.selector]=e.value;n.vars=u}n.hasEvent=true;break;case"margin":n.margin=e.value;n.hasEvent=true;break;case"bounds":n.bounds=e.value;if(e.selector){var u={};u[e.selector]=e.value;n.vars=u}n.hasEvent=true;break;case"title":n.title=e.value;n.hasEvent=true;break;case"description":n.description=e.value;n.hasEvent=true;break;case"link":n.link=typeof e.value==="string"?{link:e.value,target:"self"}:Object.assign({},e.value);n.hasEvent=true;break;case"selected":n.selected=n.selected||{};n.selected[e.selector]=e.value;n.hasEvent=true;break;case"poi":n.poi=e.value;if(e.selector){var u={};u[e.selector]=e.value;n.vars=u}n.hasEvent=true;break}}}return n};e.parseXML=function(e,t){var r=new DOMParser;var n=r.parseFromString("INVALID",t);var a=n.getElementsByTagName("parsererror")[0].namespaceURI;var i=r.parseFromString(e,t);if(i.getElementsByTagNameNS(a,"parsererror").length>0){throw new Error("Error parsing XML")}return i};e.getUrl=function(e){if(!e.toLowerCase().startsWith("http")&&!e.toLowerCase().startsWith("ws")){var t=window.location,r=t.host,n=t.pathname,a=t.port,i=t.protocol,s=t.search;var u=i+"//"+r+(a!==""?":"+a:"");u+=e.startsWith("/")?e:n+(n.endsWith("/")?"":"/")+e;return u+s}else{return e}};return e}();export{Param as P,Utils as U};
//# sourceMappingURL=utils-2db7dc60.js.map