UNPKG

@senx/discovery-plugin-marauder

Version:

Discovery plugin - Marauder's map

2 lines 5.37 kB
import{l as e,G as t}from"./p-1117c627.js";class s{constructor(){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}}class r{static clone(t){return e.exports.cloneDeep(t)}static throttle(e,t,s){let r;return(...a)=>{const n=s||this;if(!r){r=true;e.apply(n,a);setTimeout((()=>r=false),t)}}}static httpPost(e,t,s){return new Promise(((r,a)=>{const n=new XMLHttpRequest;const i={};n.onreadystatechange=()=>{n.getAllResponseHeaders().split("\n").forEach((e=>{if(e.trim()!==""){const t=e.split(":");i[t[0].trim()]=t[1].trim().replace("\r","")}}));if(n.readyState===4&&n.status===200){r({data:n.responseText,headers:i,status:{ops:parseInt(i["x-warp10-ops"],10),elapsed:parseInt(i["x-warp10-elapsed"],10),fetched:parseInt(i["x-warp10-fetched"],10)}})}else if(n.readyState===4&&n.status>=400){a({statusText:n.statusText,status:n.status,url:e,headers:i,message:`line #${i["x-warp10-error-line"]}: ${i["x-warp10-error-message"]}`,detail:{mess:i["x-warp10-error-message"],line:i["x-warp10-error-line"]}})}else if(n.readyState===4&&n.status===0){a({statusText:e+" is unreachable",status:404,url:e,headers:i,message:e+" is unreachable",detail:{mess:e+" is unreachable",line:-1}})}};n.open("POST",e,true);n.setRequestHeader("Content-Type","text/plain; charset=utf-8");Object.keys(s||{}).filter((e=>e.toLowerCase()!=="accept"&&e.toLowerCase()!=="content-type")).forEach((e=>n.setRequestHeader(e,s[e])));n.send(t)}))}static merge(e,t){if(typeof e==="string"){e=JSON.parse(e)}return Object.assign(Object.assign(Object.assign({},new s),e),t)}static sanitize(e){if(typeof e==="string")return'["'+e+'"]';else return e}static mergeDeep(e,t){const s=Object.assign({},e);const a=Object.assign({},t);for(const e in a||{}){if(Object.prototype.toString.call(a[e])==="[object Object]"){s[e]=r.mergeDeep(s[e],a[e])}else{s[e]=a[e]}}return s}static getLabelColor(e){return r.getCSSColor(e,"--warp-view-chart-label-color","#8e8e8e").trim()}static getGridColor(e){return r.getCSSColor(e,"--warp-view-chart-grid-color","#8e8e8e").trim()}static getCSSColor(e,t,s){const r=getComputedStyle(e).getPropertyValue(t).trim();return r===""?s:r}static getContentBounds(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)}}static unsescape(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}static parseEventData(e,s,r){const a={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(s&&e.source!==r){let r=".*";let n=".*";s.split(",").forEach((e=>{if(e.startsWith("tag")){r=e.split("=")[1]}if(e.startsWith("type")){n=e.split("=")[1]}}));const i=new RegExp("^"+r+"$");if(e.tags&&typeof e.tags==="string"){e.tags=[e.tags]}if((e.tags||[]).some((e=>i.test(e)))&&new RegExp(n).test(e.type||"")){switch(e.type){case"data":a.data=t.getData(e.value);a.hasEvent=true;break;case"style":a.style=e.value;a.hasEvent=true;break;case"xpath":a.xpath={selector:e.selector,value:e.value};a.hasEvent=true;break;case"popup":a.popup=e.value;a.hasEvent=true;break;case"variable":a.vars=e.value;a.hasEvent=true;break;case"audio":a.audio=e.value;a.hasEvent=true;break;case"zoom":a.zoom=e.value;if(e.selector){const t={};t[e.selector]=e.value;a.vars=t}a.hasEvent=true;break;case"focus":a.focus=e.value;if(e.selector){const t={};t[e.selector]=e.value;a.vars=t}a.hasEvent=true;break;case"margin":a.margin=e.value;a.hasEvent=true;break;case"bounds":a.bounds=e.value;if(e.selector){const t={};t[e.selector]=e.value;a.vars=t}a.hasEvent=true;break;case"title":a.title=e.value;a.hasEvent=true;break;case"description":a.description=e.value;a.hasEvent=true;break;case"link":a.link=typeof e.value==="string"?{link:e.value,target:"self"}:Object.assign({},e.value);a.hasEvent=true;break;case"selected":a.selected=a.selected||{};a.selected[e.selector]=e.value;a.hasEvent=true;break;case"poi":a.poi=e.value;if(e.selector){const t={};t[e.selector]=e.value;a.vars=t}a.hasEvent=true;break}}}return a}static parseXML(e,t){const s=new DOMParser;const r=s.parseFromString("INVALID",t);const a=r.getElementsByTagName("parsererror")[0].namespaceURI;const n=s.parseFromString(e,t);if(n.getElementsByTagNameNS(a,"parsererror").length>0){throw new Error("Error parsing XML")}return n}static getUrl(e){if(!e.toLowerCase().startsWith("http")&&!e.toLowerCase().startsWith("ws")){const{host:t,pathname:s,port:r,protocol:a,search:n}=window.location;let i=a+"//"+t+(r!==""?":"+r:"");i+=e.startsWith("/")?e:s+(s.endsWith("/")?"":"/")+e;return i+n}else{return e}}}export{s as P,r as U}; //# sourceMappingURL=p-9fd389a9.js.map