@hpcc-js/comms 3.5.1 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var Bn=Object.create;var tt=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var Qn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty;var Gn=(r,e)=>{for(var t in e)tt(r,t,{get:e[t],enumerable:!0})},js=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Nn(e))!Ln.call(r,n)&&n!==t&&tt(r,n,{get:()=>e[n],enumerable:!(s=wn(e,n))||s.enumerable});return r};var N=(r,e,t)=>(t=r!=null?Bn(Qn(r)):{},js(e||!r||!r.__esModule?tt(t,"default",{value:r,enumerable:!0}):t,r)),kn=r=>js(tt({},"__esModule",{value:!0}),r);var Gr={};Gn(Gr,{AccessService:()=>rs,AccountService:()=>is,Activity:()=>Ts,Attr:()=>Ht,Attribute:()=>Y,BUILD_VERSION:()=>_n,BaseScope:()=>Et,ClientTools:()=>xe,CloudService:()=>os,CodesignService:()=>as,Connection:()=>rt,DFUArrayActions:()=>Kn,DFUChangeProtection:()=>$n,DFUChangeRestriction:()=>er,DFUDefFileFormat:()=>Zn,DFUService:()=>ge,DFUWorkunit:()=>ks,DFUWorkunitCache:()=>_t,DFUXRefService:()=>us,DaliService:()=>cs,Definition:()=>Ot,ECLGraph:()=>Ie,ECLScope:()=>ae,ESPConnection:()=>le,ESPExceptions:()=>_,EclService:()=>Fe,EclccErrors:()=>$e,ElkService:()=>ps,EnvchkErrors:()=>Kt,Errors:()=>Ze,Field:()=>jt,File:()=>Xt,FileSpray:()=>pe,FileSprayService:()=>H,FileSprayStates:()=>en,Folder:()=>qt,GlobalResultCache:()=>Ut,GraphCache:()=>Te,Import:()=>ze,LocalWorkunit:()=>$t,LogType:()=>rn,LogaccessService:()=>gs,LogicalFile:()=>Ms,LogicalFileCache:()=>Nt,Machine:()=>Oe,MachineCache:()=>Qt,MachineService:()=>k,PKG_NAME:()=>vn,PKG_VERSION:()=>Vn,PackageProcessService:()=>ds,PropertyType:()=>hn,Query:()=>Ls,QueryGraph:()=>Je,RelatedProperty:()=>fn,Resource:()=>we,ResourcesService:()=>ms,Result:()=>ve,ResultCache:()=>Ve,SMCService:()=>de,SashaService:()=>fs,Scope:()=>he,ScopeEdge:()=>Es,ScopeGraph:()=>Me,ScopeSubgraph:()=>ys,ScopeVertex:()=>Us,Service:()=>m,Source:()=>Yt,SourceFile:()=>_e,Store:()=>Gs,StoreCache:()=>Vt,StoreService:()=>me,TargetAudience:()=>on,TargetCluster:()=>te,TargetClusterCache:()=>Gt,Timer:()=>He,Topology:()=>Ye,TopologyCache:()=>vt,TopologyService:()=>y,ValueChangedMessage:()=>z,Version:()=>Re,WUStateID:()=>Rt,WUUpdate:()=>O,Workspace:()=>Jt,Workunit:()=>ee,WorkunitCache:()=>Tt,WorkunitsService:()=>A,WorkunitsServiceEx:()=>Pe,WsAccess:()=>ns,WsDfu:()=>$,WsLogaccess:()=>S,WsSMC:()=>Ds,WsSasha:()=>hs,WsTopology:()=>Cs,WsWorkunits:()=>E,XGMMLEdge:()=>Ws,XGMMLGraph:()=>xt,XGMMLSubgraph:()=>xs,XGMMLVertex:()=>As,XSDNode:()=>Ne,XSDSchema:()=>Ge,XSDSimpleType:()=>Le,XSDXMLNode:()=>Qe,attachWorkspace:()=>K,clearAllClientToolsCache:()=>Lr,createConnection:()=>Ue,createGraph:()=>Be,createXGMMLGraph:()=>Fs,defaultTargetCluster:()=>xr,deserializeResponse:()=>Xs,get:()=>Ks,hookSend:()=>Xn,instanceOfIConnection:()=>On,instanceOfIOptions:()=>Hn,isArray:()=>$s,isECLResult:()=>Ss,isExceptions:()=>Jn,isWUInfoWorkunit:()=>nr,isWUQueryECLWorkunit:()=>sr,jsonp:()=>qs,locateAllClientTools:()=>Pn,locateClientTools:()=>_s,parseXSD:()=>Wt,parseXSD2:()=>rr,post:()=>zs,qualifiedIDBoundary:()=>Qr,send:()=>Zs,serializeRequest:()=>v,setTransportFactory:()=>qn,splitMetric:()=>Dn,targetClusters:()=>Rr,walkXmlJson:()=>Zt});module.exports=kn(Gr);var b=require("@hpcc-js/util"),In=require("@xmldom/xmldom"),Z=N(require("node-fetch"),1),P=N(require("https"),1),et=require("undici"),Tn=N(require("abort-controller"),1);var Os=`
1
+ "use strict";var wn=Object.create;var st=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Qn=Object.getOwnPropertyNames;var Ln=Object.getPrototypeOf,Gn=Object.prototype.hasOwnProperty;var kn=(r,e)=>{for(var t in e)st(r,t,{get:e[t],enumerable:!0})},js=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Qn(e))!Gn.call(r,n)&&n!==t&&st(r,n,{get:()=>e[n],enumerable:!(s=Nn(e,n))||s.enumerable});return r};var N=(r,e,t)=>(t=r!=null?wn(Ln(r)):{},js(e||!r||!r.__esModule?st(t,"default",{value:r,enumerable:!0}):t,r)),vn=r=>js(st({},"__esModule",{value:!0}),r);var Hr={};kn(Hr,{AccessService:()=>rs,AccountService:()=>is,Activity:()=>Ts,Attr:()=>jt,Attribute:()=>Y,BUILD_VERSION:()=>Hn,BaseScope:()=>Ft,ClientTools:()=>Ae,CloudService:()=>os,CodesignService:()=>as,Connection:()=>it,DFUArrayActions:()=>sr,DFUChangeProtection:()=>rr,DFUChangeRestriction:()=>ir,DFUDefFileFormat:()=>nr,DFUService:()=>ge,DFUWorkunit:()=>ks,DFUWorkunitCache:()=>Ht,DFUXRefService:()=>us,DaliService:()=>cs,Definition:()=>Yt,ECLGraph:()=>Te,ECLScope:()=>ae,ESPConnection:()=>le,ESPExceptions:()=>_,EclService:()=>be,EclccErrors:()=>et,ElkService:()=>ps,EnvchkErrors:()=>Zt,Errors:()=>$e,Field:()=>Ot,File:()=>qt,FileSpray:()=>pe,FileSprayService:()=>H,FileSprayStates:()=>en,Folder:()=>Jt,GlobalResultCache:()=>Ut,GraphCache:()=>Me,Import:()=>Ke,LocalWorkunit:()=>es,LogType:()=>on,LogaccessService:()=>gs,LogicalFile:()=>Ms,LogicalFileCache:()=>Qt,Machine:()=>Ye,MachineCache:()=>Lt,MachineService:()=>k,PKG_NAME:()=>Vn,PKG_VERSION:()=>_n,PackageProcessService:()=>ds,PropertyType:()=>fn,Query:()=>Ls,QueryGraph:()=>ze,RelatedProperty:()=>Dn,Resource:()=>Ne,ResourcesService:()=>ms,Result:()=>Ve,ResultCache:()=>_e,SMCService:()=>de,SashaService:()=>fs,Scope:()=>he,ScopeEdge:()=>Us,ScopeGraph:()=>Be,ScopeSubgraph:()=>ys,ScopeVertex:()=>Es,Service:()=>h,Source:()=>Xt,SourceFile:()=>He,Store:()=>Gs,StoreCache:()=>_t,StoreService:()=>me,TargetAudience:()=>an,TargetCluster:()=>te,TargetClusterCache:()=>kt,Timer:()=>je,Topology:()=>Xe,TopologyCache:()=>Vt,TopologyService:()=>W,ValueChangedMessage:()=>z,Version:()=>xe,WUStateID:()=>xt,WUUpdate:()=>O,Workspace:()=>zt,Workunit:()=>ee,WorkunitCache:()=>Mt,WorkunitsService:()=>x,WorkunitsServiceEx:()=>Ie,WsAccess:()=>ns,WsDfu:()=>$,WsLogaccess:()=>C,WsSMC:()=>Ds,WsSasha:()=>hs,WsTopology:()=>Cs,WsWorkunits:()=>U,XGMMLEdge:()=>Ws,XGMMLGraph:()=>At,XGMMLSubgraph:()=>xs,XGMMLVertex:()=>As,XSDNode:()=>Qe,XSDSchema:()=>ke,XSDSimpleType:()=>Ge,XSDXMLNode:()=>Le,attachWorkspace:()=>K,clearAllClientToolsCache:()=>_r,createConnection:()=>Ue,createGraph:()=>we,createXGMMLGraph:()=>Fs,defaultTargetCluster:()=>Ur,deserializeResponse:()=>Xs,get:()=>Ks,hookSend:()=>qn,instanceOfIConnection:()=>Yn,instanceOfIOptions:()=>jn,isArray:()=>$s,isECLResult:()=>Ss,isExceptions:()=>zn,isWUInfoWorkunit:()=>cr,isWUQueryECLWorkunit:()=>ar,jsonp:()=>qs,locateAllClientTools:()=>In,locateClientTools:()=>_s,parseXSD:()=>yt,parseXSD2:()=>ur,post:()=>zs,qualifiedIDBoundary:()=>Vr,send:()=>Zs,serializeRequest:()=>v,setTransportFactory:()=>Jn,splitMetric:()=>Cn,targetClusters:()=>Er,walkXmlJson:()=>$t});module.exports=vn(Hr);var b=require("@hpcc-js/util"),Tn=require("@xmldom/xmldom"),Z=N(require("node-fetch"),1),I=N(require("https"),1),tt=require("undici"),Mn=N(require("abort-controller"),1);var Os=`
2
2
  Trustwave Secure Global Extended Validation CA, Level 1
3
3
  SecureTrust Corporation
4
4
  00F6F61CE4A3635BB0CA8AACEEFCB2D0F0
@@ -907,20 +907,20 @@ AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC
907
907
  MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu
908
908
  Sw==
909
909
  -----END CERTIFICATE-----
910
- `;var ts=require("safe-buffer");var vn="@hpcc-js/comms",Vn="3.5.1",_n="3.6.1";var Ee=require("@hpcc-js/util");var V=require("@hpcc-js/util"),Ys=(0,V.scopedLogger)("comms/connection.ts");function Hn(r){return"baseUrl"in r}var jn={type:"post",baseUrl:"",userID:"",password:"",rejectUnauthorized:!0,timeoutSecs:60};function On(r){return typeof r.opts=="function"&&typeof r.send=="function"&&typeof r.clone=="function"}function Q(r,e){return e===void 0||e===!0?encodeURIComponent(r):""+r}function v(r,e=!0,t=""){if(t&&(t+="."),typeof r!="object")return Q(r,e);let s=[];for(let n in r)if(r.hasOwnProperty(n))if(r[n]instanceof Array){let i=!1;r[n].forEach((o,a)=>{typeof o=="object"?(i=!0,s.push(v(o,e,t+Q(`${n}.${a}`,e)))):s.push(t+Q(`${n}_i${a}`,e)+"="+v(o,e))}),i&&s.push(t+Q(`${n}.itemcount`,e)+"="+r[n].length)}else typeof r[n]=="object"?r[n]&&r[n].Item instanceof Array?(s.push(v(r[n].Item,e,t+Q(n,e))),s.push(t+Q(`${n}.itemcount`,e)+"="+r[n].Item.length)):s.push(v(r[n],e,t+Q(n,e))):r[n]!==void 0?s.push(t+Q(n,e)+"="+Q(r[n],e)):s.push(t+Q(n,e));return s.join("&")}function Xs(r){return JSON.parse(r)}function qs(r,e,t={},s="json",n){return n&&console.warn("Header attributes ignored for JSONP connections"),new Promise((i,o)=>{let a=r.timeoutSecs*1e3,u=5e3,p="jsonp_callback_"+Math.round(Math.random()*999999);window[p]=function(w){a=0,D(),i(s==="json"&&typeof w=="string"?Xs(w):w)};let c=document.createElement("script"),l=(0,V.join)(r.baseUrl,e);l+=l.indexOf("?")>=0?"&":"?",c.src=l+"jsonp="+p+"&"+v(t,r.encodeRequest),document.body.appendChild(c);let g=setInterval(function(){a<=0?clearInterval(g):(a-=u,a<=0?(clearInterval(g),Ys.error("Request timeout: "+c.src),D(),o(Error("Request timeout: "+c.src))):Ys.debug("Request pending ("+a/1e3+" sec): "+c.src))},u);function D(){delete window[p],document.body.removeChild(c)}})}function Yn(r){return r.userID?{Authorization:`Basic ${btoa(`${r.userID}:${r.password}`)}`}:{}}var st={};function Js(r,e,t,s,n){s={...Yn(r),...s},t={credentials:st[r.baseUrl]?"omit":"include",...t,headers:s},fetch.__setGlobalDispatcher&&fetch.__setGlobalDispatcher(fetch.__defaultAgent),r.baseUrl.indexOf("https:")===0&&(r.rejectUnauthorized===!1&&fetch.__rejectUnauthorizedAgent?fetch.__setGlobalDispatcher?fetch.__setGlobalDispatcher(fetch.__rejectUnauthorizedAgent):t.agent=fetch.__rejectUnauthorizedAgent:fetch.__trustwaveAgent&&(t.agent=fetch.__trustwaveAgent));function i(o){if(o.ok)return n==="json"?o.json():o.text();throw new Error(o.statusText)}return(0,V.promiseTimeout)(r.timeoutSecs*1e3,fetch((0,V.join)(r.baseUrl,e),t).then(i).catch(o=>(t.credentials=st[r.baseUrl]?"include":"omit",fetch((0,V.join)(r.baseUrl,e),t).then(i).then(a=>(st[r.baseUrl]=!st[r.baseUrl],a)))))}function zs(r,e,t,s="json",n){t.upload_&&(delete t.upload_,e+="?upload_");let i;return t.abortSignal_&&(i=t.abortSignal_,delete t.abortSignal_),Js(r,e,{method:"post",body:v(t,r.encodeRequest),signal:i},{"Content-Type":"application/x-www-form-urlencoded",...n},s)}function Ks(r,e,t,s="json",n){let i;return t.abortSignal_&&(i=t.abortSignal_,delete t.abortSignal_),Js(r,`${e}?${v(t,r.encodeRequest)}`,{method:"get",signal:i},{...n},s)}function Zs(r,e,t,s="json",n){let i;switch(r.type){case"jsonp":i=qs(r,e,t,s,n);break;case"get":i=Ks(r,e,t,s,n);break;case"post":default:i=zs(r,e,t,s,n);break}return i}var nt=Zs;function Xn(r){let e=nt;return r&&(nt=r),e}var rt=class r{_opts;get baseUrl(){return this._opts.baseUrl}constructor(e){this.opts(e)}opts(e){return arguments.length===0?this._opts:(this._opts={...jn,...e},this)}send(e,t,s="json",n){return this._opts.hookSend?this._opts.hookSend(this._opts,e,t,s,nt,n):nt(this._opts,e,t,s,n)}clone(){return new r(this.opts())}},Ue=function(r){return new rt(r)};function qn(r){let e=Ue;return Ue=r,e}function $s(r){return Object.prototype.toString.call(r)==="[object Array]"}var _=class extends Error{isESPExceptions=!0;action;request;Source;Exception;constructor(e,t,s){super("ESPException: "+s.Source),this.action=e,this.request=t,this.Source=s.Source,this.Exception=s.Exception,s.Exception.length?this.message=`${s.Exception[0].Code}: ${s.Exception[0].Message}`:this.message=""}};function Jn(r){return r instanceof _||r.isESPExceptions&&Array.isArray(r.Exception)}function zn(r){return r.send!==void 0}var le=class r{_connection;get baseUrl(){return this._connection.opts().baseUrl}_service;_version;constructor(e,t,s){this._connection=zn(e)?e:Ue(e),this._service=t,this._version=s}service(e){return e===void 0?this._service:(this._service=e,this)}version(e){return e===void 0?this._version:(this._version=e,this)}toESPStringArray(e,t){if($s(e[t])){for(let s=0;s<e[t].length;++s)e[t+"_i"+s]=e[t][s];delete e[t]}return e}opts(e){return e===void 0?this._connection.opts():(this._connection.opts(e),this)}send(e,t={},s="json",n=!1,i,o){let a={...t,ver_:this._version};n&&(a.upload_=!0),i&&(a.abortSignal_=i);let u,p="json";switch(s){case"text":u=(0,Ee.join)(this._service,e),p="text";break;case"xsd":u=(0,Ee.join)(this._service,e+".xsd"),p="text";break;case"json2":u=(0,Ee.join)(this._service,e+"/json"),s="json",e=e.split("/").pop();break;default:u=(0,Ee.join)(this._service,e+".json")}return this._connection.send(u,a,p).then(c=>{if(s==="json"){let l;if(c&&c.Exceptions)throw new _(e,a,c.Exceptions);if(c&&(l=c[o||e+"Response"]),!l)throw new _(e,a,{Source:"ESPConnection.send",Exception:[{Code:0,Message:"Missing Response"}]});return l}return c})}clone(){return new r(this._connection.clone(),this._service,this._version)}},m=class{_connection;get baseUrl(){return this._connection.opts().baseUrl}constructor(e,t,s){this._connection=new le(e,t,s)}opts(){return this._connection.opts()}connection(){return this._connection.clone()}};var pe;(e=>{let r;(u=>(u.Delete="Delete",u.Protect="Protect",u.Unprotect="Unprotect",u.Restore="Restore",u.SetToFailed="SetToFailed",u.Archive="Archive"))(r=e.DFUWUActions||={})})(pe||={});var it=class extends m{constructor(e){super(e,"FileSpray","1.26")}AbortDFUWorkunit(e){return this._connection.send("AbortDFUWorkunit",e,"json",!1,void 0,"AbortDFUWorkunitResponse")}Copy(e){return this._connection.send("Copy",e,"json",!1,void 0,"CopyResponse")}CreateDFUPublisherWorkunit(e){return this._connection.send("CreateDFUPublisherWorkunit",e,"json",!1,void 0,"CreateDFUPublisherWorkunitResponse")}CreateDFUWorkunit(e){return this._connection.send("CreateDFUWorkunit",e,"json",!1,void 0,"CreateDFUWorkunitResponse")}DFUWUFile(e){return this._connection.send("DFUWUFile",e,"json",!1,void 0,"DFUWUFileResponse")}DFUWUSearch(e){return this._connection.send("DFUWUSearch",e,"json",!1,void 0,"DFUWUSearchResponse")}DFUWorkunitsAction(e){return this._connection.send("DFUWorkunitsAction",e,"json",!1,void 0,"DFUWorkunitsActionResponse")}DeleteDFUWorkunit(e){return this._connection.send("DeleteDFUWorkunit",e,"json",!1,void 0,"DeleteDFUWorkunitResponse")}DeleteDFUWorkunits(e){return this._connection.send("DeleteDFUWorkunits",e,"json",!1,void 0,"DeleteDFUWorkunitsResponse")}DeleteDropZoneFiles(e){return this._connection.send("DeleteDropZoneFiles",e,"json",!1,void 0,"DFUWorkunitsActionResponse")}Despray(e){return this._connection.send("Despray",e,"json",!1,void 0,"DesprayResponse")}DfuMonitor(e){return this._connection.send("DfuMonitor",e,"json",!1,void 0,"DfuMonitorResponse")}DropZoneFileSearch(e){return this._connection.send("DropZoneFileSearch",e,"json",!1,void 0,"DropZoneFileSearchResponse")}DropZoneFiles(e){return this._connection.send("DropZoneFiles",e,"json",!1,void 0,"DropZoneFilesResponse")}EchoDateTime(e){return this._connection.send("EchoDateTime",e,"json",!1,void 0,"EchoDateTimeResponse")}FileList(e){return this._connection.send("FileList",e,"json",!1,void 0,"FileListResponse")}GetDFUExceptions(e){return this._connection.send("GetDFUExceptions",e,"json",!1,void 0,"GetDFUExceptionsResponse")}GetDFUProgress(e){return this._connection.send("GetDFUProgress",e,"json",!1,void 0,"ProgressResponse")}GetDFUServerQueues(e){return this._connection.send("GetDFUServerQueues",e,"json",!1,void 0,"GetDFUServerQueuesResponse")}GetDFUWorkunit(e){return this._connection.send("GetDFUWorkunit",e,"json",!1,void 0,"GetDFUWorkunitResponse")}GetDFUWorkunits(e){return this._connection.send("GetDFUWorkunits",e,"json",!1,void 0,"GetDFUWorkunitsResponse")}GetRemoteTargets(e){return this._connection.send("GetRemoteTargets",e,"json",!1,void 0,"GetRemoteTargetsResponse")}GetSprayTargets(e){return this._connection.send("GetSprayTargets",e,"json",!1,void 0,"GetSprayTargetsResponse")}OpenSave(e){return this._connection.send("OpenSave",e,"json",!1,void 0,"OpenSaveResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"FileSprayPingResponse")}Rename(e){return this._connection.send("Rename",e,"json",!1,void 0,"RenameResponse")}Replicate(e){return this._connection.send("Replicate",e,"json",!1,void 0,"ReplicateResponse")}ShowResult(e){return this._connection.send("ShowResult",e,"json",!1,void 0,"ShowResultResponse")}SprayFixed(e){return this._connection.send("SprayFixed",e,"json",!1,void 0,"SprayFixedResponse")}SprayVariable(e){return this._connection.send("SprayVariable",e,"json",!1,void 0,"SprayResponse")}SubmitDFUWorkunit(e){return this._connection.send("SubmitDFUWorkunit",e,"json",!1,void 0,"SubmitDFUWorkunitResponse")}UpdateDFUWorkunit(e){return this._connection.send("UpdateDFUWorkunit",e,"json",!1,void 0,"UpdateDFUWorkunitResponse")}};var en=(c=>(c[c.unknown=0]="unknown",c[c.scheduled=1]="scheduled",c[c.queued=2]="queued",c[c.started=3]="started",c[c.aborted=4]="aborted",c[c.failed=5]="failed",c[c.finished=6]="finished",c[c.monitoring=7]="monitoring",c[c.aborting=8]="aborting",c[c.notfound=999]="notfound",c))(en||{}),H=class extends it{DFUWUFileEx(e){return this._connection.send("DFUWUFile",e,"text")}SprayFixedEx(e){return this._connection.send("SprayFixed",e)}SprayVariableEx(e){return this._connection.send("SprayVariable",e,"json",!1,null,"SprayResponse")}DesprayEx(e){return this._connection.send("Despray",e)}UpdateDFUWorkunitEx(e){return this._connection.send("UpdateDFUWorkunit",e,"json",!1,void 0,"UpdateDFUWorkunitResponse")}};var ns;(o=>{let r;(p=>(p.User="User",p.Group="Group"))(r=o.ViewMemberType||={});let e;(g=>(g.username="username",g.fullname="fullname",g.passwordexpiration="passwordexpiration",g.employeeID="employeeID",g.employeeNumber="employeeNumber"))(e=o.UserSortBy||={});let t;(p=>(p.Name="Name",p.ManagedBy="ManagedBy"))(t=o.GroupSortBy||={});let s;(c=>(c.Any="Any",c.User="User",c.Group="Group"))(s=o.AccountTypeReq||={});let n;(p=>(p.Name="Name",p.Type="Type"))(n=o.ResourcePermissionSortBy||={});let i;(u=>u.Name="Name")(i=o.ResourceSortBy||={})})(ns||={});var ot=class extends m{constructor(e){super(e,"ws_access","1.17")}AccountPermissions(e){return this._connection.send("AccountPermissions",e,"json",!1,void 0,"AccountPermissionsResponse")}AccountPermissionsV2(e){return this._connection.send("AccountPermissionsV2",e,"json",!1,void 0,"AccountPermissionsV2Response")}AddUser(e){return this._connection.send("AddUser",e,"json",!1,void 0,"AddUserResponse")}AddView(e){return this._connection.send("AddView",e,"json",!1,void 0,"AddViewResponse")}AddViewColumn(e){return this._connection.send("AddViewColumn",e,"json",!1,void 0,"AddViewColumnResponse")}AddViewMember(e){return this._connection.send("AddViewMember",e,"json",!1,void 0,"AddViewMemberResponse")}ClearPermissionsCache(e){return this._connection.send("ClearPermissionsCache",e,"json",!1,void 0,"ClearPermissionsCacheResponse")}DeleteView(e){return this._connection.send("DeleteView",e,"json",!1,void 0,"DeleteViewResponse")}DeleteViewColumn(e){return this._connection.send("DeleteViewColumn",e,"json",!1,void 0,"DeleteViewColumnResponse")}DeleteViewMember(e){return this._connection.send("DeleteViewMember",e,"json",!1,void 0,"DeleteViewMemberResponse")}DisableScopeScans(e){return this._connection.send("DisableScopeScans",e,"json",!1,void 0,"DisableScopeScansResponse")}EnableScopeScans(e){return this._connection.send("EnableScopeScans",e,"json",!1,void 0,"EnableScopeScansResponse")}FilePermission(e){return this._connection.send("FilePermission",e,"json",!1,void 0,"FilePermissionResponse")}GroupAction(e){return this._connection.send("GroupAction",e,"json",!1,void 0,"GroupActionResponse")}GroupAdd(e){return this._connection.send("GroupAdd",e,"json",!1,void 0,"GroupAddResponse")}GroupEdit(e){return this._connection.send("GroupEdit",e,"json",!1,void 0,"GroupEditResponse")}GroupMemberEdit(e){return this._connection.send("GroupMemberEdit",e,"json",!1,void 0,"GroupMemberEditResponse")}GroupMemberEditInput(e){return this._connection.send("GroupMemberEditInput",e,"json",!1,void 0,"GroupMemberEditInputResponse")}GroupMemberQuery(e){return this._connection.send("GroupMemberQuery",e,"json",!1,void 0,"GroupMemberQueryResponse")}GroupQuery(e){return this._connection.send("GroupQuery",e,"json",!1,void 0,"GroupQueryResponse")}Groups(e){return this._connection.send("Groups",e,"json",!1,void 0,"GroupResponse")}PermissionAction(e){return this._connection.send("PermissionAction",e,"json",!1,void 0,"PermissionActionResponse")}Permissions(e){return this._connection.send("Permissions",e,"json",!1,void 0,"BasednsResponse")}PermissionsReset(e){return this._connection.send("PermissionsReset",e,"json",!1,void 0,"PermissionsResetResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"ws_accessPingResponse")}QueryScopeScansEnabled(e){return this._connection.send("QueryScopeScansEnabled",e,"json",!1,void 0,"QueryScopeScansEnabledResponse")}QueryUserViewColumns(e){return this._connection.send("QueryUserViewColumns",e,"json",!1,void 0,"QueryUserViewColumnsResponse")}QueryViewColumns(e){return this._connection.send("QueryViewColumns",e,"json",!1,void 0,"QueryViewColumnsResponse")}QueryViewMembers(e){return this._connection.send("QueryViewMembers",e,"json",!1,void 0,"QueryViewMembersResponse")}QueryViews(e){return this._connection.send("QueryViews",e,"json",!1,void 0,"QueryViewsResponse")}ResourceAdd(e){return this._connection.send("ResourceAdd",e,"json",!1,void 0,"ResourceAddResponse")}ResourceDelete(e){return this._connection.send("ResourceDelete",e,"json",!1,void 0,"ResourceDeleteResponse")}ResourcePermissionQuery(e){return this._connection.send("ResourcePermissionQuery",e,"json",!1,void 0,"ResourcePermissionQueryResponse")}ResourcePermissions(e){return this._connection.send("ResourcePermissions",e,"json",!1,void 0,"ResourcePermissionsResponse")}ResourceQuery(e){return this._connection.send("ResourceQuery",e,"json",!1,void 0,"ResourceQueryResponse")}Resources(e){return this._connection.send("Resources",e,"json",!1,void 0,"ResourcesResponse")}UserAccountExport(e){return this._connection.send("UserAccountExport",e,"json",!1,void 0,"UserAccountExportResponse")}UserAction(e){return this._connection.send("UserAction",e,"json",!1,void 0,"UserActionResponse")}UserEdit(e){return this._connection.send("UserEdit",e,"json",!1,void 0,"UserEditResponse")}UserGroupEdit(e){return this._connection.send("UserGroupEdit",e,"json",!1,void 0,"UserGroupEditResponse")}UserGroupEditInput(e){return this._connection.send("UserGroupEditInput",e,"json",!1,void 0,"UserGroupEditInputResponse")}UserInfoEdit(e){return this._connection.send("UserInfoEdit",e,"json",!1,void 0,"UserInfoEditResponse")}UserInfoEditInput(e){return this._connection.send("UserInfoEditInput",e,"json",!1,void 0,"UserInfoEditInputResponse")}UserPosix(e){return this._connection.send("UserPosix",e,"json",!1,void 0,"UserPosixResponse")}UserPosixInput(e){return this._connection.send("UserPosixInput",e,"json",!1,void 0,"UserPosixInputResponse")}UserQuery(e){return this._connection.send("UserQuery",e,"json",!1,void 0,"UserQueryResponse")}UserResetPass(e){return this._connection.send("UserResetPass",e,"json",!1,void 0,"UserResetPassResponse")}UserResetPassInput(e){return this._connection.send("UserResetPassInput",e,"json",!1,void 0,"UserResetPassInputResponse")}UserSudoers(e){return this._connection.send("UserSudoers",e,"json",!1,void 0,"UserSudoersResponse")}UserSudoersInput(e){return this._connection.send("UserSudoersInput",e,"json",!1,void 0,"UserSudoersInputResponse")}Users(e){return this._connection.send("Users",e,"json",!1,void 0,"UserResponse")}};var rs=class extends ot{};var at=class extends m{constructor(e){super(e,"ws_account","1.06")}MyAccount(e){return this._connection.send("MyAccount",e,"json",!1,void 0,"MyAccountResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"ws_accountPingResponse")}UpdateUser(e){return this._connection.send("UpdateUser",e,"json",!1,void 0,"UpdateUserResponse")}UpdateUserInput(e){return this._connection.send("UpdateUserInput",e,"json",!1,void 0,"UpdateUserInputResponse")}VerifyUser(e){return this._connection.send("VerifyUser",e,"json",!1,void 0,"VerifyUserResponse")}};var is=class extends at{VerifyUser(e){return this._connection.send("VerifyUser",e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(s=>s.Code===20043))return{retcode:20043,Exceptions:{Source:"wsAccount",Exception:t.Exception}};throw t})}};var ct=class extends m{constructor(e){super(e,"WsCloud","1")}GetPODs(e){return this._connection.send("GetPODs",e)}Ping(e){return this._connection.send("Ping",e)}};var os=class extends ct{getPODs(){return super.GetPODs({}).then(e=>{try{return(typeof e.Result=="string"?JSON.parse(e.Result):e.Result)?.items??[]}catch{return[]}})}};var as=class{_connection;constructor(e){this._connection=new le(e,"ws_codesign","1.1")}connectionOptions(){return this._connection.opts()}ListUserIDs(e){return this._connection.send("ListUserIDs",e).then(t=>t.UserIDs.Item).catch(t=>[])}Sign(e){return this._connection.send("Sign",{SigningMethod:"gpg",...e})}Verify(e){return this._connection.send("Verify",e)}};var ut=class extends m{constructor(e){super(e,"WSDali","1.07")}Add(e){return this._connection.send("Add",e,"json",!1,void 0,"ResultResponse")}ClearTraceTransactions(e){return this._connection.send("ClearTraceTransactions",e,"json",!1,void 0,"ResultResponse")}Count(e){return this._connection.send("Count",e,"json",!1,void 0,"CountResponse")}DFSCheck(e){return this._connection.send("DFSCheck",e,"json",!1,void 0,"ResultResponse")}DFSExists(e){return this._connection.send("DFSExists",e,"json",!1,void 0,"BooleanResponse")}DFSLS(e){return this._connection.send("DFSLS",e,"json",!1,void 0,"ResultResponse")}Delete(e){return this._connection.send("Delete",e,"json",!1,void 0,"ResultResponse")}DisconnectClientConnection(e){return this._connection.send("DisconnectClientConnection",e,"json",!1,void 0,"ResultResponse")}GetClients(e){return this._connection.send("GetClients",e,"json",!1,void 0,"ResultResponse")}GetConnections(e){return this._connection.send("GetConnections",e,"json",!1,void 0,"ResultResponse")}GetDFSCSV(e){return this._connection.send("GetDFSCSV",e,"json",!1,void 0,"ResultResponse")}GetDFSMap(e){return this._connection.send("GetDFSMap",e,"json",!1,void 0,"ResultResponse")}GetDFSParents(e){return this._connection.send("GetDFSParents",e,"json",!1,void 0,"ResultResponse")}GetLogicalFile(e){return this._connection.send("GetLogicalFile",e,"json",!1,void 0,"ResultResponse")}GetLogicalFilePart(e){return this._connection.send("GetLogicalFilePart",e,"json",!1,void 0,"ResultResponse")}GetProtectedList(e){return this._connection.send("GetProtectedList",e,"json",!1,void 0,"ResultResponse")}GetSDSStats(e){return this._connection.send("GetSDSStats",e,"json",!1,void 0,"ResultResponse")}GetSDSSubscribers(e){return this._connection.send("GetSDSSubscribers",e,"json",!1,void 0,"ResultResponse")}GetValue(e){return this._connection.send("GetValue",e,"json",!1,void 0,"ResultResponse")}Import(e){return this._connection.send("Import",e,"json",!1,void 0,"ResultResponse")}ListSDSLocks(e){return this._connection.send("ListSDSLocks",e,"json",!1,void 0,"ResultResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WSDaliPingResponse")}SaveSDSStore(e){return this._connection.send("SaveSDSStore",e,"json",!1,void 0,"ResultResponse")}SetLogicalFilePartAttr(e){return this._connection.send("SetLogicalFilePartAttr",e,"json",!1,void 0,"ResultResponse")}SetProtected(e){return this._connection.send("SetProtected",e,"json",!1,void 0,"ResultResponse")}SetTraceSlowTransactions(e){return this._connection.send("SetTraceSlowTransactions",e,"json",!1,void 0,"ResultResponse")}SetTraceTransactions(e){return this._connection.send("SetTraceTransactions",e,"json",!1,void 0,"ResultResponse")}SetUnprotected(e){return this._connection.send("SetUnprotected",e,"json",!1,void 0,"ResultResponse")}SetValue(e){return this._connection.send("SetValue",e,"json",!1,void 0,"ResultResponse")}UnlockSDSLock(e){return this._connection.send("UnlockSDSLock",e,"json",!1,void 0,"ResultResponse")}};var cs=class extends ut{};var $;(a=>{let r;(g=>(g.Delete="Delete",g.AddToSuperfile="Add To Superfile",g.ChangeProtection="Change Protection",g.ChangeRestriction="Change Restriction"))(r=a.DFUArrayActions||={});let e;(g=>(g[g.NoChange=0]="NoChange",g[g.Protect=1]="Protect",g[g.Unprotect=2]="Unprotect",g[g.UnprotectAll=3]="UnprotectAll"))(e=a.DFUChangeProtection||={});let t;(l=>(l[l.NoChange=0]="NoChange",l[l.Restrict=1]="Restrict",l[l.Unrestricted=2]="Unrestricted"))(t=a.DFUChangeRestriction||={});let s;(c=>(c.xml="xml",c.def="def"))(s=a.DFUDefFileFormat||={});let n;(l=>(l.Token="Token",l.Engine="Engine",l.External="External"))(n=a.FileAccessRole||={});let i;(D=>(D.None="None",D.Access="Access",D.Read="Read",D.Write="Write",D.Full="Full"))(i=a.SecAccessType||={});let o;(C=>(C.Flat="Flat",C.Index="Index",C.Xml="Xml",C.Csv="Csv",C.Json="Json",C.IndexLocal="IndexLocal",C.IndexPartitioned="IndexPartitioned",C.Unset="Unset"))(o=a.DFUFileType||={})})($||={});var lt=class extends m{constructor(e){super(e,"WsDfu","1.65")}Add(e){return this._connection.send("Add",e,"json",!1,void 0,"AddResponse")}AddRemote(e){return this._connection.send("AddRemote",e,"json",!1,void 0,"AddRemoteResponse")}AddtoSuperfile(e){return this._connection.send("AddtoSuperfile",e,"json",!1,void 0,"AddtoSuperfileResponse")}DFUArrayAction(e){return this._connection.send("DFUArrayAction",e,"json",!1,void 0,"DFUArrayActionResponse")}DFUBrowseData(e){return this._connection.send("DFUBrowseData",e,"json",!1,void 0,"DFUBrowseDataResponse")}DFUDefFile(e){return this._connection.send("DFUDefFile",e,"json",!1,void 0,"DFUDefFileResponse")}DFUFileAccess(e){return this._connection.send("DFUFileAccess",e,"json",!1,void 0,"DFUFileAccessResponse")}DFUFileAccessV2(e){return this._connection.send("DFUFileAccessV2",e,"json",!1,void 0,"DFUFileAccessResponse")}DFUFileCreate(e){return this._connection.send("DFUFileCreate",e,"json",!1,void 0,"DFUFileCreateResponse")}DFUFileCreateV2(e){return this._connection.send("DFUFileCreateV2",e,"json",!1,void 0,"DFUFileCreateResponse")}DFUFilePublish(e){return this._connection.send("DFUFilePublish",e,"json",!1,void 0,"DFUFilePublishResponse")}DFUFileView(e){return this._connection.send("DFUFileView",e,"json",!1,void 0,"DFUFileViewResponse")}DFUGetDataColumns(e){return this._connection.send("DFUGetDataColumns",e,"json",!1,void 0,"DFUGetDataColumnsResponse")}DFUGetFileMetaData(e){return this._connection.send("DFUGetFileMetaData",e,"json",!1,void 0,"DFUGetFileMetaDataResponse")}DFUInfo(e){return this._connection.send("DFUInfo",e,"json",!1,void 0,"DFUInfoResponse")}DFUQuery(e){return this._connection.send("DFUQuery",e,"json",!1,void 0,"DFUQueryResponse")}DFURecordTypeInfo(e){return this._connection.send("DFURecordTypeInfo",e,"json",!1,void 0,"DFURecordTypeInfoResponse")}DFUSearch(e){return this._connection.send("DFUSearch",e,"json",!1,void 0,"DFUSearchResponse")}DFUSearchData(e){return this._connection.send("DFUSearchData",e,"json",!1,void 0,"DFUSearchDataResponse")}DFUSpace(e){return this._connection.send("DFUSpace",e,"json",!1,void 0,"DFUSpaceResponse")}EclRecordTypeInfo(e){return this._connection.send("EclRecordTypeInfo",e,"json",!1,void 0,"EclRecordTypeInfoResponse")}EraseHistory(e){return this._connection.send("EraseHistory",e,"json",!1,void 0,"EraseHistoryResponse")}ListHistory(e){return this._connection.send("ListHistory",e,"json",!1,void 0,"ListHistoryResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsDfuPingResponse")}Savexml(e){return this._connection.send("Savexml",e,"json",!1,void 0,"SavexmlResponse")}SuperfileAction(e){return this._connection.send("SuperfileAction",e,"json",!1,void 0,"SuperfileActionResponse")}SuperfileList(e){return this._connection.send("SuperfileList",e,"json",!1,void 0,"SuperfileListResponse")}};var Kn=$.DFUArrayActions,Zn=$.DFUDefFileFormat,$n=$.DFUChangeProtection,er=$.DFUChangeRestriction,ge=class extends lt{DFUFile(e){return this._connection.send("DFUDefFile",e,"text")}};var us=class extends m{constructor(e){super(e,"WsDFUXRef","1.01")}DFUXRefArrayAction(e){return this._connection.send("DFUXRefArrayAction",e)}DFUXRefBuild(e){return this._connection.send("DFUXRefBuild",e)}DFUXRefBuildCancel(e){return this._connection.send("DFUXRefBuildCancel",e)}DFUXRefCleanDirectories(e){return this._connection.send("DFUXRefCleanDirectories",e)}DFUXRefDirectories(e){return this._connection.send("DFUXRefDirectories",e,void 0,void 0,void 0,"DFUXRefDirectoriesQueryResponse")}DFUXRefFoundFiles(e){return this._connection.send("DFUXRefFoundFiles",e,void 0,void 0,void 0,"DFUXRefFoundFilesQueryResponse")}DFUXRefList(e={}){return this._connection.send("DFUXRefList",e)}DFUXRefLostFiles(e){return this._connection.send("DFUXRefLostFiles",e,void 0,void 0,void 0,"DFUXRefLostFilesQueryResponse")}DFUXRefMessages(e){return this._connection.send("DFUXRefMessages",e,void 0,void 0,void 0,"DFUXRefMessagesQueryResponse")}DFUXRefOrphanFiles(e){return this._connection.send("DFUXRefOrphanFiles",e,void 0,void 0,void 0,"DFUXRefOrphanFilesQueryResponse")}DFUXRefUnusedFiles(e){return this._connection.send("DFUXRefUnusedFiles",e)}};function tn(r,e){let t=typeof e;switch(t){case"boolean":case"number":case"string":return{id:r,type:t};case"object":if(e.Row instanceof Array&&(e=e.Row),e instanceof Array)return{id:r,type:"dataset",children:ls(e[0])};if(e instanceof Object){if(e.Item&&e.Item instanceof Array&&e.Item.length===1){let s=typeof e.Item[0];if(s==="string"||s==="number")return{id:r,type:"set",fieldType:s};throw new Error("Unknown field type")}return{id:r,type:"object",fields:tr(e)}}default:throw new Error("Unknown field type")}}function ls(r){r.Row&&r.Row instanceof Array&&(r=r.Row[0]);let e=[];for(let t in r)e.push(tn(t,r[t]));return e}function tr(r){let e={};for(let t in r)e[t]=tn(t,r[t]);return e}var Fe=class extends m{constructor(e){super(e,"WsEcl","0")}opts(){return this._connection.opts()}requestJson(e,t){return this._connection.send(`example/request/query/${e}/${t}/json`,{},"text").then(s=>{let n=JSON.parse(s);for(let i in n)return n[i];return{}}).then(ls)}responseJson(e,t){return this._connection.send(`example/response/query/${e}/${t}/json`,{},"text").then(s=>{let n=JSON.parse(s);for(let i in n)return n[i].Results;return{}}).then(s=>{let n={};for(let i in s)n[i]=ls(s[i]);return n})}submit(e,t,s){let n=`submit/query/${e}/${t}`;return this._connection.send(n,s,"json2").then(i=>{if(i.Results&&i.Results.Exception)throw new _(n,s,{Source:"wsEcl.submit",Exception:i.Results.Exception});return i.Results})}};var pt=class extends m{constructor(e){super(e,"ws_elk","1")}GetConfigDetails(e){return this._connection.send("GetConfigDetails",e)}Ping(e){return this._connection.send("Ping",e)}};var ps=class extends pt{};var nn=require("@hpcc-js/util");var S;(a=>{let r;(f=>(f.global="global",f.workunits="workunits",f.components="components",f.audience="audience",f.class="class",f.instance="instance",f.node="node",f.message="message",f.logid="logid",f.processid="processid",f.threadid="threadid",f.timestamp="timestamp",f.pod="pod"))(r=a.LogColumnType||={});let e;(g=>(g.string="string",g.numeric="numeric",g.datetime="datetime",g.enum="enum"))(e=a.LogColumnValueType||={});let t;(h=>(h[h.All=0]="All",h[h.ByJobID=1]="ByJobID",h[h.ByComponent=2]="ByComponent",h[h.ByLogType=3]="ByLogType",h[h.ByTargetAudience=4]="ByTargetAudience",h[h.BySourceInstance=5]="BySourceInstance",h[h.BySourceNode=6]="BySourceNode",h[h.ByFieldName=7]="ByFieldName",h[h.ByPod=8]="ByPod"))(t=a.LogAccessType||={});let s;(l=>(l[l.NONE=0]="NONE",l[l.AND=1]="AND",l[l.OR=2]="OR"))(s=a.LogAccessFilterOperator||={});let n;(g=>(g[g.MIN=0]="MIN",g[g.DEFAULT=1]="DEFAULT",g[g.ALL=2]="ALL",g[g.CUSTOM=3]="CUSTOM"))(n=a.LogSelectColumnMode||={});let i;(h=>(h[h.ByDate=0]="ByDate",h[h.ByJobID=1]="ByJobID",h[h.ByComponent=2]="ByComponent",h[h.ByLogType=3]="ByLogType",h[h.ByTargetAudience=4]="ByTargetAudience",h[h.BySourceInstance=5]="BySourceInstance",h[h.BySourceNode=6]="BySourceNode",h[h.ByFieldName=7]="ByFieldName",h[h.ByPod=8]="ByPod"))(i=a.SortColumType||={});let o;(c=>(c[c.ASC=0]="ASC",c[c.DSC=1]="DSC"))(o=a.SortDirection||={})})(S||={});var gt=class extends m{constructor(e){super(e,"ws_logaccess","1.05")}GetLogAccessInfo(e){return this._connection.send("GetLogAccessInfo",e,"json",!1,void 0,"GetLogAccessInfoResponse")}GetLogs(e){return this._connection.send("GetLogs",e,"json",!1,void 0,"GetLogsResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"ws_logaccessPingResponse")}};var sn=(0,nn.scopedLogger)("@hpcc-js/comms/services/wsLogaccess.ts");var rn=(o=>(o.Disaster="DIS",o.Error="ERR",o.Warning="WRN",o.Information="INF",o.Progress="PRO",o.Metric="MET",o))(rn||{}),on=(n=>(n.Operator="OPR",n.User="USR",n.Programmer="PRO",n.Audit="ADT",n))(on||{}),gs=class extends gt{_logAccessInfo;GetLogAccessInfo(e={}){return this._logAccessInfo||(this._logAccessInfo=super.GetLogAccessInfo(e)),this._logAccessInfo}GetLogs(e){return super.GetLogs(e)}async GetLogsEx(e){let t=await this.GetLogAccessInfo(),s={};t.Columns.Column.forEach(a=>s[a.LogType]=a.Name);let n=a=>{let u={};for(let p in s)a?.fields?u[p]=Object.assign({},...a.fields)[s[p]]??"":u[p]="";return u},i={Filter:{leftBinaryFilter:{BinaryLogFilter:[{leftFilter:{LogCategory:S.LogAccessType.All}}]}},Range:{StartDate:new Date(0).toISOString()},LogLineStartFrom:e.LogLineStartFrom??0,LogLineLimit:e.LogLineLimit??100,SelectColumnMode:S.LogSelectColumnMode.DEFAULT,Format:"JSON",SortBy:{SortCondition:[{BySortType:S.SortColumType.ByDate,ColumnName:"",Direction:0}]}},o=[];for(let a in e){let u;a in s&&(Object.values(S.LogColumnType).includes(a)?u=a:u=s[a]);let p;if(u){switch(u){case S.LogColumnType.workunits:case"hpcc.log.jobid":p=S.LogAccessType.ByJobID;break;case S.LogColumnType.audience:case"hpcc.log.audience":p=S.LogAccessType.ByTargetAudience;break;case S.LogColumnType.class:case"hpcc.log.class":p=S.LogAccessType.ByLogType;break;case S.LogColumnType.components:case"kubernetes.container.name":p=S.LogAccessType.ByComponent;break;default:p=S.LogAccessType.ByFieldName,u=s[a]}if(Array.isArray(e[a]))e[a].forEach(c=>{p===S.LogAccessType.ByComponent&&(c+="*"),o.push({LogCategory:p,SearchField:u,SearchByValue:c})});else{let c=e[a];p===S.LogAccessType.ByComponent&&(c+="*"),o.push({LogCategory:p,SearchField:u,SearchByValue:c})}}}if(o.length>2){let a=i.Filter.leftBinaryFilter.BinaryLogFilter[0];o.forEach((u,p)=>{let c=S.LogAccessFilterOperator.AND;p>0?(o[p-1].SearchField===u.SearchField&&(c=S.LogAccessFilterOperator.OR),p===o.length-1?(a.Operator=c,a.rightFilter=u):(a.Operator=c,a.rightBinaryFilter={BinaryLogFilter:[{leftFilter:u}]},a=a.rightBinaryFilter.BinaryLogFilter[0])):a.leftFilter=u})}else delete i.Filter.leftBinaryFilter,i.Filter.leftFilter={LogCategory:S.LogAccessType.All},o[0]?.SearchField&&(i.Filter.leftFilter={LogCategory:o[0]?.LogCategory,SearchField:o[0]?.SearchField,SearchByValue:o[0]?.SearchByValue}),o[1]?.SearchField&&(i.Filter.Operator=S.LogAccessFilterOperator.AND,o[0].SearchField===o[1].SearchField&&(i.Filter.Operator=S.LogAccessFilterOperator.OR),i.Filter.rightFilter={LogCategory:o[1]?.LogCategory,SearchField:o[1]?.SearchField,SearchByValue:o[1]?.SearchByValue});return e.StartDate&&(i.Range.StartDate=e.StartDate.toISOString()),e.EndDate&&(i.Range.EndDate=e.EndDate.toISOString()),this.GetLogs(i).then(a=>{try{let u=JSON.parse(a.LogLines),p=[];switch(t.RemoteLogManagerType){case"azureloganalyticscurl":case"elasticstack":case"grafanacurl":p=u.lines?.map(n)??[];break;default:sn.warning(`Unknown RemoteLogManagerType: ${t.RemoteLogManagerType}`),p=[]}return{lines:p,total:a.TotalLogLinesAvailable??1e4}}catch(u){sn.error(u.message??u)}return{lines:[],total:0}})}};var an=require("@hpcc-js/util"),j=require("d3-array");var dt=class extends m{constructor(e){super(e,"ws_machine","1.17")}GetComponentStatus(e){return this._connection.send("GetComponentStatus",e)}GetComponentUsage(e){return this._connection.send("GetComponentUsage",e)}GetMachineInfo(e){return this._connection.send("GetMachineInfo",e)}GetMachineInfoEx(e){return this._connection.send("GetMachineInfoEx",e)}GetMetrics(e){return this._connection.send("GetMetrics",e)}GetNodeGroupUsage(e){return this._connection.send("GetNodeGroupUsage",e)}GetTargetClusterInfo(e){return this._connection.send("GetTargetClusterInfo",e)}GetTargetClusterUsage(e){return this._connection.send("GetTargetClusterUsage",e)}Ping(e){return this._connection.send("Ping",e)}UpdateComponentStatus(e){return this._connection.send("UpdateComponentStatus",e)}};var k=class extends dt{GetTargetClusterUsageEx(e,t=!1){return this._connection.send("GetTargetClusterUsage",{TargetClusters:e?{Item:e}:{},BypassCachedResult:t}).then(s=>(0,an.exists)("TargetClusterUsages.TargetClusterUsage",s)?s.TargetClusterUsages.TargetClusterUsage:[]).then(s=>s.filter(n=>!!n.ComponentUsages).map(n=>{let i=n.ComponentUsages.ComponentUsage.map(o=>{let a=(o.MachineUsages&&o.MachineUsages.MachineUsage?o.MachineUsages.MachineUsage:[]).map(u=>{let p=u.DiskUsages&&u.DiskUsages.DiskUsage?u.DiskUsages.DiskUsage.map(c=>({...c,InUse:c.InUse*1024,Total:(c.InUse+c.Available)*1024,PercentUsed:100-c.PercentAvailable})):[];return{Name:u.Name,NetAddress:u.NetAddress,Description:u.Description,DiskUsages:p,mean:(0,j.mean)(p.filter(c=>!isNaN(c.PercentUsed)),c=>c.PercentUsed),max:(0,j.max)(p.filter(c=>!isNaN(c.PercentUsed)),c=>c.PercentUsed)}});return{Type:o.Type,Name:o.Name,Description:o.Description,MachineUsages:a,MachineUsagesDescription:a.reduce((u,p)=>u+(p.Description||""),""),mean:(0,j.mean)(a.filter(u=>!isNaN(u.mean)),u=>u.mean),max:(0,j.max)(a.filter(u=>!isNaN(u.max)),u=>u.max)}});return{Name:n.Name,Description:n.Description,ComponentUsages:i,ComponentUsagesDescription:i.reduce((o,a)=>o+(a.MachineUsagesDescription||""),""),mean:(0,j.mean)(i.filter(o=>!isNaN(o.mean)),o=>o.mean),max:(0,j.max)(i.filter(o=>!isNaN(o.max)),o=>o.max)}}))}};var mt=class extends m{constructor(e){super(e,"WsPackageProcess","1.04")}ActivatePackage(e){return this._connection.send("ActivatePackage",e)}AddPackage(e){return this._connection.send("AddPackage",e)}AddPartToPackageMap(e){return this._connection.send("AddPartToPackageMap",e)}CopyPackageMap(e){return this._connection.send("CopyPackageMap",e)}DeActivatePackage(e){return this._connection.send("DeActivatePackage",e)}DeletePackage(e){return this._connection.send("DeletePackage",e)}Echo(e){return this._connection.send("Echo",e)}GetPackage(e){return this._connection.send("GetPackage",e)}GetPackageMapById(e){return this._connection.send("GetPackageMapById",e)}GetPackageMapSelectOptions(e){return this._connection.send("GetPackageMapSelectOptions",e)}GetPartFromPackageMap(e){return this._connection.send("GetPartFromPackageMap",e)}GetQueryFileMapping(e){return this._connection.send("GetQueryFileMapping",e)}ListPackage(e){return this._connection.send("ListPackage",e)}ListPackages(e){return this._connection.send("ListPackages",e)}Ping(e){return this._connection.send("Ping",e)}RemovePartFromPackageMap(e){return this._connection.send("RemovePartFromPackageMap",e)}ValidatePackage(e){return this._connection.send("ValidatePackage",e)}};var ds=class extends mt{};var ht=class extends m{constructor(e){super(e,"WsResources","1.01")}Ping(e){return this._connection.send("Ping",e)}ServiceQuery(e){return this._connection.send("ServiceQuery",e)}WebLinksQuery(e){return this._connection.send("WebLinksQuery",e)}};var ms=class extends ht{};var hs;(e=>{let r;(n=>(n.ECL="ECL",n.DFU="DFU"))(r=e.WUTypes||={})})(hs||={});var ft=class extends m{constructor(e){super(e,"WSSasha","1.01")}ArchiveWU(e){return this._connection.send("ArchiveWU",e,"json",!1,void 0,"ResultResponse")}GetVersion(e){return this._connection.send("GetVersion",e,"json",!1,void 0,"ResultResponse")}ListWU(e){return this._connection.send("ListWU",e,"json",!1,void 0,"ResultResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WSSashaPingResponse")}RestoreWU(e){return this._connection.send("RestoreWU",e,"json",!1,void 0,"ResultResponse")}};var fs=class extends ft{};var Ds;(t=>{let r;(u=>(u.ALL="ALL",u.READ="READ",u.WRITE="WRITE",u.HOLD="HOLD",u.SUB="SUB"))(r=t.LockModes||={});let e;(l=>(l.Attach="Attach",l.Detach="Detach",l.State="State",l.Reload="Reload",l.ReloadRetry="ReloadRetry",l.MemLock="MemLock",l.MemUnlock="MemUnlock",l.GetMemLocked="GetMemLocked"))(e=t.RoxieControlCmdType||={})})(Ds||={});var Dt=class extends m{constructor(e){super(e,"WsSMC","1.27")}Activity(e){return this._connection.send("Activity",e,"json",!1,void 0,"ActivityResponse")}BrowseResources(e){return this._connection.send("BrowseResources",e,"json",!1,void 0,"BrowseResourcesResponse")}ClearQueue(e){return this._connection.send("ClearQueue",e,"json",!1,void 0,"SMCQueueResponse")}GetBuildInfo(e){return this._connection.send("GetBuildInfo",e,"json",!1,void 0,"GetBuildInfoResponse")}GetStatusServerInfo(e){return this._connection.send("GetStatusServerInfo",e,"json",!1,void 0,"GetStatusServerInfoResponse")}GetThorQueueAvailability(e){return this._connection.send("GetThorQueueAvailability",e,"json",!1,void 0,"GetThorQueueAvailabilityResponse")}Index(e){return this._connection.send("Index",e,"json",!1,void 0,"SMCIndexResponse")}LockQuery(e){return this._connection.send("LockQuery",e,"json",!1,void 0,"LockQueryResponse")}MoveJobBack(e){return this._connection.send("MoveJobBack",e,"json",!1,void 0,"SMCJobResponse")}MoveJobDown(e){return this._connection.send("MoveJobDown",e,"json",!1,void 0,"SMCJobResponse")}MoveJobFront(e){return this._connection.send("MoveJobFront",e,"json",!1,void 0,"SMCJobResponse")}MoveJobUp(e){return this._connection.send("MoveJobUp",e,"json",!1,void 0,"SMCJobResponse")}NotInCommunityEdition(e){return this._connection.send("NotInCommunityEdition",e,"json",!1,void 0,"NotInCommunityEditionResponse")}PauseQueue(e){return this._connection.send("PauseQueue",e,"json",!1,void 0,"SMCQueueResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsSMCPingResponse")}RemoveJob(e){return this._connection.send("RemoveJob",e,"json",!1,void 0,"SMCJobResponse")}ResumeQueue(e){return this._connection.send("ResumeQueue",e,"json",!1,void 0,"SMCQueueResponse")}RoxieControlCmd(e){return this._connection.send("RoxieControlCmd",e,"json",!1,void 0,"RoxieControlCmdResponse")}RoxieXrefCmd(e){return this._connection.send("RoxieXrefCmd",e,"json",!1,void 0,"RoxieXrefCmdResponse")}SetBanner(e){return this._connection.send("SetBanner",e,"json",!1,void 0,"SetBannerResponse")}SetJobPriority(e){return this._connection.send("SetJobPriority",e,"json",!1,void 0,"SMCPriorityResponse")}StopQueue(e){return this._connection.send("StopQueue",e,"json",!1,void 0,"SMCQueueResponse")}};var de=class extends Dt{connectionOptions(){return this._connection.opts()}Activity(e){return super.Activity(e).then(t=>({Running:{ActiveWorkunit:[]},...t}))}};var me=class extends m{constructor(e){super(e,"WsStore","1")}CreateStore(e){return this._connection.send("Fetch",e)}Delete(e){return this._connection.send("Delete",e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(s=>s.Code===-1))return{Exceptions:void 0,Success:!0};throw t})}DeleteNamespace(e){return this._connection.send("DeleteNamespace",e)}Fetch(e){return this._connection.send("Fetch",e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(s=>s.Code===-1))return{Exceptions:void 0,Value:void 0};throw t})}FetchAll(e){return this._connection.send("FetchAll",e)}FetchKeyMD(e){return this._connection.send("FetchKeyMD",e)}ListKeys(e){return this._connection.send("ListKeys",e)}ListNamespaces(e){return this._connection.send("ListNamespaces",e)}Set(e){return this._connection.send("Set",e)}};var Cs;(e=>{let r;(i=>(i.All="All",i.QueriesOnly="QueriesOnly",i.WorkunitsOnly="WorkunitsOnly"))(r=e.RoxieQueueFilter||={})})(Cs||={});var Ct=class extends m{constructor(e){super(e,"WsTopology","1.32")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsTopologyPingResponse")}SystemLog(e){return this._connection.send("SystemLog",e,"json",!1,void 0,"SystemLogResponse")}TpClusterInfo(e){return this._connection.send("TpClusterInfo",e,"json",!1,void 0,"TpClusterInfoResponse")}TpClusterQuery(e){return this._connection.send("TpClusterQuery",e,"json",!1,void 0,"TpClusterQueryResponse")}TpDropZoneQuery(e){return this._connection.send("TpDropZoneQuery",e,"json",!1,void 0,"TpDropZoneQueryResponse")}TpGetComponentFile(e){return this._connection.send("TpGetComponentFile",e,"json",!1,void 0,"TpGetComponentFileResponse")}TpGetServicePlugins(e){return this._connection.send("TpGetServicePlugins",e,"json",!1,void 0,"TpGetServicePluginsResponse")}TpGroupQuery(e){return this._connection.send("TpGroupQuery",e,"json",!1,void 0,"TpGroupQueryResponse")}TpListLogFiles(e){return this._connection.send("TpListLogFiles",e,"json",!1,void 0,"TpListLogFilesResponse")}TpListTargetClusters(e){return this._connection.send("TpListTargetClusters",e,"json",!1,void 0,"TpListTargetClustersResponse")}TpLogFile(e){return this._connection.send("TpLogFile",e,"json",!1,void 0,"TpLogFileResponse")}TpLogFileDisplay(e){return this._connection.send("TpLogFileDisplay",e,"json",!1,void 0,"TpLogFileResponse")}TpLogicalClusterQuery(e){return this._connection.send("TpLogicalClusterQuery",e,"json",!1,void 0,"TpLogicalClusterQueryResponse")}TpMachineInfo(e){return this._connection.send("TpMachineInfo",e,"json",!1,void 0,"TpMachineInfoResponse")}TpMachineQuery(e){return this._connection.send("TpMachineQuery",e,"json",!1,void 0,"TpMachineQueryResponse")}TpServiceQuery(e){return this._connection.send("TpServiceQuery",e,"json",!1,void 0,"TpServiceQueryResponse")}TpSetMachineStatus(e){return this._connection.send("TpSetMachineStatus",e,"json",!1,void 0,"TpSetMachineStatusResponse")}TpSwapNode(e){return this._connection.send("TpSwapNode",e,"json",!1,void 0,"TpSwapNodeResponse")}TpTargetClusterQuery(e){return this._connection.send("TpTargetClusterQuery",e,"json",!1,void 0,"TpTargetClusterQueryResponse")}TpThorStatus(e){return this._connection.send("TpThorStatus",e,"json",!1,void 0,"TpThorStatusResponse")}TpXMLFile(e){return this._connection.send("TpXMLFile",e,"json",!1,void 0,"TpXMLFileResponse")}};var y=class extends Ct{connectionOptions(){return this._connection.opts()}protocol(){return this._connection.opts().baseUrl.split("//")[0]}ip(){return this._connection.opts().baseUrl.split("//")[1].split(":")[0]}DefaultTpLogicalClusterQuery(e={}){return this.TpLogicalClusterQuery(e).then(t=>{if(t.default)return t.default;let s,n;return t.TpLogicalClusters.TpLogicalCluster.some((i,o)=>(o===0&&(n=i),i.Type==="hthor"?(s=i,!0):!1)),s||n})}};var St=require("@hpcc-js/util");var E;(C=>{let r;(B=>(B.Abort="Abort",B.Delete="Delete",B.Deschedule="Deschedule",B.Reschedule="Reschedule",B.Pause="Pause",B.PauseNow="PauseNow",B.Protect="Protect",B.Unprotect="Unprotect",B.Restore="Restore",B.Resume="Resume",B.SetToFailed="SetToFailed",B.Archive="Archive"))(r=C.ECLWUActions||={});let e;(f=>(f[f.MIN=0]="MIN",f[f.DEFAULT=1]="DEFAULT",f[f.ALL=2]="ALL",f[f.CUSTOM=3]="CUSTOM"))(e=C.LogSelectColumnMode||={});let t;(d=>(d[d.ASC=0]="ASC",d[d.DSC=1]="DSC"))(t=C.SortDirection||={});let s;(W=>(W.ALL="ALL",W.DIS="DIS",W.ERR="ERR",W.WRN="WRN",W.INF="INF",W.PRO="PRO",W.MET="MET",W.EVT="EVT"))(s=C.LogEventClass||={});let n;(x=>(x.Single="Single",x.List="List",x.Multi="Multi"))(n=C.WUDetailsAttrValueType||={});let i;(x=>(x.SyntaxCheck="SyntaxCheck",x.Deploy="Deploy",x.Publish="Publish"))(i=C.EclDefinitionActions||={});let o;(x=>(x.xml="xml",x.json="json",x.text="text"))(o=C.ErrorMessageFormat||={});let a;(x=>(x[x.XML=0]="XML",x[x.JSON=1]="JSON",x[x.CSV=2]="CSV"))(a=C.LogAccessLogFormat||={});let u;(f=>(f.info="info",f.warning="warning",f.error="error",f.alert="alert"))(u=C.WUExceptionSeverity||={});let p;(ue=>(ue.Allqueries="All queries",ue.Notsuspended="Not suspended",ue.Suspended="Suspended",ue.Suspendedbyuser="Suspended by user",ue.Suspendedbyfirstnode="Suspended by first node",ue.Suspendedbyanynode="Suspended by any node"))(p=C.WUQueryFilterSuspendedType||={});let c;(ye=>(ye.All="All",ye.Id="Id",ye.Name="Name",ye.Alias="Alias",ye.Status="Status"))(c=C.WUQuerySetFilterType||={});let l;(x=>(x.All="All",x.Protected="Protected",x.NotProtected="NotProtected"))(l=C.WUProtectFilter||={});let g;(Mn=>Mn.Deactivate="Deactivate")(g=C.QuerySetAliasActionTypes||={});let D;(d=>(d.None="None",d.ActivateImportedActive="ActivateImportedActive"))(D=C.QuerysetImportActivation||={});let w;(W=>(W.Suspend="Suspend",W.Unsuspend="Unsuspend",W.ToggleSuspend="ToggleSuspend",W.Activate="Activate",W.Delete="Delete",W.DeleteQueriesAndWUs="DeleteQueriesAndWUs",W.RemoveAllAliases="RemoveAllAliases",W.ResetQueryStats="ResetQueryStats"))(w=C.QuerySetQueryActionTypes||={});let ss;(f=>(f[f.DoNotActivateQuery=0]="DoNotActivateQuery",f[f.ActivateQuery=1]="ActivateQuery",f[f.ActivateQuerySuspendPrevious=2]="ActivateQuerySuspendPrevious",f[f.ActivateQueryDeletePrevious=3]="ActivateQueryDeletePrevious"))(ss=C.WUQueryActivationMode||={})})(E||={});var be=class extends m{constructor(e){super(e,"WsWorkunits","2")}GVCAjaxGraph(e){return this._connection.send("GVCAjaxGraph",e,"json",!1,void 0,"GVCAjaxGraphResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsWorkunitsPingResponse")}WUAbort(e){return this._connection.send("WUAbort",e,"json",!1,void 0,"WUAbortResponse")}WUAction(e){return this._connection.send("WUAction",e,"json",!1,void 0,"WUActionResponse")}WUAddLocalFileToWorkunit(e){return this._connection.send("WUAddLocalFileToWorkunit",e,"json",!1,void 0,"WUAddLocalFileToWorkunitResponse")}WUAnalyseHotspot(e){return this._connection.send("WUAnalyseHotspot",e,"json",!1,void 0,"WUAnalyseHotspotResponse")}WUCDebug(e){return this._connection.send("WUCDebug",e,"json",!1,void 0,"WUDebugResponse")}WUCheckFeatures(e){return this._connection.send("WUCheckFeatures",e,"json",!1,void 0,"WUCheckFeaturesResponse")}WUClusterJobQueueLOG(e){return this._connection.send("WUClusterJobQueueLOG",e,"json",!1,void 0,"WUClusterJobQueueLOGResponse")}WUClusterJobQueueXLS(e){return this._connection.send("WUClusterJobQueueXLS",e,"json",!1,void 0,"WUClusterJobQueueXLSResponse")}WUClusterJobSummaryXLS(e){return this._connection.send("WUClusterJobSummaryXLS",e,"json",!1,void 0,"WUClusterJobSummaryXLSResponse")}WUClusterJobXLS(e){return this._connection.send("WUClusterJobXLS",e,"json",!1,void 0,"WUClusterJobXLSResponse")}WUCompileECL(e){return this._connection.send("WUCompileECL",e,"json",!1,void 0,"WUCompileECLResponse")}WUCopyLogicalFiles(e){return this._connection.send("WUCopyLogicalFiles",e,"json",!1,void 0,"WUCopyLogicalFilesResponse")}WUCopyQuerySet(e){return this._connection.send("WUCopyQuerySet",e,"json",!1,void 0,"WUCopyQuerySetResponse")}WUCreate(e){return this._connection.send("WUCreate",e,"json",!1,void 0,"WUCreateResponse")}WUCreateAndUpdate(e){return this._connection.send("WUCreateAndUpdate",e,"json",!1,void 0,"WUUpdateResponse")}WUCreateZAPInfo(e){return this._connection.send("WUCreateZAPInfo",e,"json",!1,void 0,"WUCreateZAPInfoResponse")}WUDelete(e){return this._connection.send("WUDelete",e,"json",!1,void 0,"WUDeleteResponse")}WUDeployWorkunit(e){return this._connection.send("WUDeployWorkunit",e,"json",!1,void 0,"WUDeployWorkunitResponse")}WUDetails(e){return this._connection.send("WUDetails",e,"json",!1,void 0,"WUDetailsResponse")}WUDetailsMeta(e){return this._connection.send("WUDetailsMeta",e,"json",!1,void 0,"WUDetailsMetaResponse")}WUEclDefinitionAction(e){return this._connection.send("WUEclDefinitionAction",e,"json",!1,void 0,"WUEclDefinitionActionResponse")}WUExport(e){return this._connection.send("WUExport",e,"json",!1,void 0,"WUExportResponse")}WUFile(e){return this._connection.send("WUFile",e,"json",!1,void 0,"WULogFileResponse")}WUFullResult(e){return this._connection.send("WUFullResult",e,"json",!1,void 0,"WUFullResultResponse")}WUGVCGraphInfo(e){return this._connection.send("WUGVCGraphInfo",e,"json",!1,void 0,"WUGVCGraphInfoResponse")}WUGetArchiveFile(e){return this._connection.send("WUGetArchiveFile",e,"json",!1,void 0,"WUGetArchiveFileResponse")}WUGetDependancyTrees(e){return this._connection.send("WUGetDependancyTrees",e,"json",!1,void 0,"WUGetDependancyTreesResponse")}WUGetGraph(e){return this._connection.send("WUGetGraph",e,"json",!1,void 0,"WUGetGraphResponse")}WUGetGraphNameAndTypes(e){return this._connection.send("WUGetGraphNameAndTypes",e,"json",!1,void 0,"WUGetGraphNameAndTypesResponse")}WUGetNumFileToCopy(e){return this._connection.send("WUGetNumFileToCopy",e,"json",!1,void 0,"WUGetNumFileToCopyResponse")}WUGetPlugins(e){return this._connection.send("WUGetPlugins",e,"json",!1,void 0,"WUGetPluginsResponse")}WUGetStats(e){return this._connection.send("WUGetStats",e,"json",!1,void 0,"WUGetStatsResponse")}WUGetThorJobList(e){return this._connection.send("WUGetThorJobList",e,"json",!1,void 0,"WUGetThorJobListResponse")}WUGetThorJobQueue(e){return this._connection.send("WUGetThorJobQueue",e,"json",!1,void 0,"WUGetThorJobQueueResponse")}WUGetZAPInfo(e){return this._connection.send("WUGetZAPInfo",e,"json",!1,void 0,"WUGetZAPInfoResponse")}WUGraphInfo(e){return this._connection.send("WUGraphInfo",e,"json",!1,void 0,"WUGraphInfoResponse")}WUGraphTiming(e){return this._connection.send("WUGraphTiming",e,"json",!1,void 0,"WUGraphTimingResponse")}WUInfo(e){return this._connection.send("WUInfo",e,"json",!1,void 0,"WUInfoResponse")}WUInfoDetails(e){return this._connection.send("WUInfoDetails",e,"json",!1,void 0,"WUInfoResponse")}WUJobList(e){return this._connection.send("WUJobList",e,"json",!1,void 0,"WUJobListResponse")}WULightWeightQuery(e){return this._connection.send("WULightWeightQuery",e,"json",!1,void 0,"WULightWeightQueryResponse")}WUListArchiveFiles(e){return this._connection.send("WUListArchiveFiles",e,"json",!1,void 0,"WUListArchiveFilesResponse")}WUListLocalFileRequired(e){return this._connection.send("WUListLocalFileRequired",e,"json",!1,void 0,"WUListLocalFileRequiredResponse")}WUListQueries(e){return this._connection.send("WUListQueries",e,"json",!1,void 0,"WUListQueriesResponse")}WUListQueriesUsingFile(e){return this._connection.send("WUListQueriesUsingFile",e,"json",!1,void 0,"WUListQueriesUsingFileResponse")}WUMultiQuerysetDetails(e){return this._connection.send("WUMultiQuerysetDetails",e,"json",!1,void 0,"WUMultiQuerySetDetailsResponse")}WUProcessGraph(e){return this._connection.send("WUProcessGraph",e,"json",!1,void 0,"WUProcessGraphResponse")}WUProtect(e){return this._connection.send("WUProtect",e,"json",!1,void 0,"WUProtectResponse")}WUPublishWorkunit(e){return this._connection.send("WUPublishWorkunit",e,"json",!1,void 0,"WUPublishWorkunitResponse")}WUPushEvent(e){return this._connection.send("WUPushEvent",e,"json",!1,void 0,"WUPushEventResponse")}WUQuery(e){return this._connection.send("WUQuery",e,"json",!1,void 0,"WUQueryResponse")}WUQueryConfig(e){return this._connection.send("WUQueryConfig",e,"json",!1,void 0,"WUQueryConfigResponse")}WUQueryDetails(e){return this._connection.send("WUQueryDetails",e,"json",!1,void 0,"WUQueryDetailsResponse")}WUQueryDetailsLightWeight(e){return this._connection.send("WUQueryDetailsLightWeight",e,"json",!1,void 0,"WUQueryDetailsResponse")}WUQueryFiles(e){return this._connection.send("WUQueryFiles",e,"json",!1,void 0,"WUQueryFilesResponse")}WUQueryGetGraph(e){return this._connection.send("WUQueryGetGraph",e,"json",!1,void 0,"WUQueryGetGraphResponse")}WUQueryGetSummaryStats(e){return this._connection.send("WUQueryGetSummaryStats",e,"json",!1,void 0,"WUQueryGetSummaryStatsResponse")}WUQuerysetAliasAction(e){return this._connection.send("WUQuerysetAliasAction",e,"json",!1,void 0,"WUQuerySetAliasActionResponse")}WUQuerysetCopyQuery(e){return this._connection.send("WUQuerysetCopyQuery",e,"json",!1,void 0,"WUQuerySetCopyQueryResponse")}WUQuerysetDetails(e){return this._connection.send("WUQuerysetDetails",e,"json",!1,void 0,"WUQuerySetDetailsResponse")}WUQuerysetExport(e){return this._connection.send("WUQuerysetExport",e,"json",!1,void 0,"WUQuerysetExportResponse")}WUQuerysetImport(e){return this._connection.send("WUQuerysetImport",e,"json",!1,void 0,"WUQuerysetImportResponse")}WUQuerysetQueryAction(e){return this._connection.send("WUQuerysetQueryAction",e,"json",!1,void 0,"WUQuerySetQueryActionResponse")}WUQuerysets(e){return this._connection.send("WUQuerysets",e,"json",!1,void 0,"WUQuerysetsResponse")}WURecreateQuery(e){return this._connection.send("WURecreateQuery",e,"json",!1,void 0,"WURecreateQueryResponse")}WUResubmit(e){return this._connection.send("WUResubmit",e,"json",!1,void 0,"WUResubmitResponse")}WUResult(e){return this._connection.send("WUResult",e,"json",!1,void 0,"WUResultResponse")}WUResultBin(e){return this._connection.send("WUResultBin",e,"json",!1,void 0,"WUResultBinResponse")}WUResultSummary(e){return this._connection.send("WUResultSummary",e,"json",!1,void 0,"WUResultSummaryResponse")}WUResultView(e){return this._connection.send("WUResultView",e,"json",!1,void 0,"WUResultViewResponse")}WURun(e){return this._connection.send("WURun",e,"json",!1,void 0,"WURunResponse")}WUSchedule(e){return this._connection.send("WUSchedule",e,"json",!1,void 0,"WUScheduleResponse")}WUShowScheduled(e){return this._connection.send("WUShowScheduled",e,"json",!1,void 0,"WUShowScheduledResponse")}WUSubmit(e){return this._connection.send("WUSubmit",e,"json",!1,void 0,"WUSubmitResponse")}WUSyntaxCheckECL(e){return this._connection.send("WUSyntaxCheckECL",e,"json",!1,void 0,"WUSyntaxCheckResponse")}WUUpdate(e){return this._connection.send("WUUpdate",e,"json",!1,void 0,"WUUpdateResponse")}WUUpdateQueryEntry(e){return this._connection.send("WUUpdateQueryEntry",e,"json",!1,void 0,"WUUpdateQueryEntryResponse")}WUWaitCompiled(e){return this._connection.send("WUWaitCompiled",e,"json",!1,void 0,"WUWaitResponse")}WUWaitComplete(e){return this._connection.send("WUWaitComplete",e,"json",!1,void 0,"WUWaitResponse")}};var Rt=(d=>(d[d.Unknown=0]="Unknown",d[d.Compiled=1]="Compiled",d[d.Running=2]="Running",d[d.Completed=3]="Completed",d[d.Failed=4]="Failed",d[d.Archived=5]="Archived",d[d.Aborting=6]="Aborting",d[d.Aborted=7]="Aborted",d[d.Blocked=8]="Blocked",d[d.Submitted=9]="Submitted",d[d.Scheduled=10]="Scheduled",d[d.Compiling=11]="Compiling",d[d.Wait=12]="Wait",d[d.UploadingFiled=13]="UploadingFiled",d[d.DebugPaused=14]="DebugPaused",d[d.DebugRunning=15]="DebugRunning",d[d.Paused=16]="Paused",d[d.LAST=17]="LAST",d[d.NotFound=999]="NotFound",d))(Rt||{}),O;(e=>{let r;(g=>(g[g.Unknown=0]="Unknown",g[g.Compile=1]="Compile",g[g.Check=2]="Check",g[g.Run=3]="Run",g[g.ExecuteExisting=4]="ExecuteExisting",g[g.Pause=5]="Pause",g[g.PauseNow=6]="PauseNow",g[g.Resume=7]="Resume",g[g.Debug=8]="Debug",g[g.__size=9]="__size"))(r=e.Action||={})})(O||={});function Ss(r){return typeof r.Name=="string"}function sr(r){return r.TotalClusterTime!==void 0}function nr(r){return r.StateEx!==void 0}var A=class extends be{constructor(e){super(e)}Ping(){return this._connection.send("Ping",{},"json",!1,void 0,"WsWorkunitsPingResponse").then(()=>({result:!0}))}WUQuery(e={},t){return this._connection.send("WUQuery",e,"json",!1,t).then(s=>(0,St.deepMixin)({Workunits:{ECLWorkunit:[]}},s))}WUInfo(e){let t={Wuid:"",TruncateEclTo64k:!0,IncludeExceptions:!1,IncludeGraphs:!1,IncludeSourceFiles:!1,IncludeResults:!1,IncludeResultsViewNames:!1,IncludeVariables:!1,IncludeTimers:!1,IncludeDebugValues:!1,IncludeApplicationValues:!1,IncludeWorkflows:!1,IncludeXmlSchemas:!1,IncludeResourceURLs:!1,IncludeECL:!1,IncludeHelpers:!1,IncludeAllowedClusters:!1,IncludeTotalClusterTime:!1,IncludeServiceNames:!1,SuppressResultSchemas:!0,...e};return super.WUInfo(t)}WUCreate(){return super.WUCreate({})}WUUpdate(e){return this._connection.send("WUUpdate",e,"json",!0)}WUResubmit(e){return this._connection.toESPStringArray(e,"Wuids"),super.WUResubmit(e)}WUAction(e){return e.ActionType=e.WUActionType,super.WUAction(e)}WUResult(e,t){return this._connection.send("WUResult",e,"json",!1,t)}WUFileEx(e){return this._connection.send("WUFile",e,"text")}_WUDetailsMetaPromise;WUDetailsMeta(e){return this._WUDetailsMetaPromise||(this._WUDetailsMetaPromise=super.WUDetailsMeta(e)),this._WUDetailsMetaPromise}WUCDebugEx(e){return this._connection.send("WUCDebug",e,void 0,void 0,void 0,"WUDebug").then(t=>{let n=(0,St.xml2json)(t.Result).children();return n.length?n[0]:null})}},Pe=class extends be{WUPublishWorkunitEx(e){return this._connection.send("WUPublishWorkunit",e)}};var wt=require("@hpcc-js/util");var I=require("@hpcc-js/util"),mn=require("d3-format"),Mt=require("d3-time-format");var U=require("@hpcc-js/util"),Ie=class extends U.StateObject{wu;get properties(){return this.get()}get Name(){return this.get("Name")}get Label(){return this.get("Label")}get Type(){return this.get("Type")}get Complete(){return this.get("Complete")}get WhenStarted(){return this.get("WhenStarted")}get WhenFinished(){return this.get("WhenFinished")}get Time(){return this.get("Time")}get Running(){return this.get("Running")}get RunningId(){return this.get("RunningId")}get Failed(){return this.get("Failed")}constructor(e,t,s){super(),this.wu=e;let n=0;for(let i of s)if(i.GraphName===t.Name&&!i.HasSubGraphId){n=Math.round(i.Seconds*1e3)/1e3;break}this.set({Time:n,...t})}fetchScopeGraph(e){return e?this.wu.fetchGraphDetails([e],["subgraph"]).then(t=>Be(t)):this.wu.fetchGraphDetails([this.Name],["graph"]).then(t=>Be(t))}},Te=class extends U.Cache{constructor(){super(e=>U.Cache.hash([e.Name]))}};function un(r,e,t){t=t||[],t.push(r),e(r.name,r.$,r.children(),t),r.children().forEach(s=>{un(s,e,t)}),t.pop()}function Rs(r){let e={};return r.forEach(t=>{t.name==="att"&&(e[t.$.name]=t.$.value)}),e}var xt=class extends U.Graph{},xs=class extends U.Subgraph{},As=class extends U.Vertex{},Ws=class extends U.Edge{};function Fs(r,e){let t={},s={},n={},i=new xt(a=>a._.id),o=[i.root];return un(e,(a,u,p,c)=>{let l=o[o.length-1];switch(a){case"graph":break;case"node":if(p.length&&p[0].children().length&&p[0].children()[0].name==="graph"){let w=l.createSubgraph(Rs(p));o.push(w),t[u.id]=w}let g=l.createVertex(Rs(p));s[u.id]=g;break;case"edge":let D=l.createEdge(s[u.source],s[u.target],Rs(p));n[u.id]=D;break;default:}}),i}var Me=class extends U.Graph{},ys=class extends U.Subgraph{},Us=class extends U.Vertex{},Es=class extends U.Edge{};function Be(r){let e={},t={},s={},n;for(let i of r)switch(i.ScopeType){case"graph":n=new Me(c=>c._.Id,i),e[i.ScopeName]=n.root;break;case"subgraph":n||(n=new Me(c=>c._.Id,i),e[i.ScopeName]=n.root);let o=i.parentScope().split(":"),a=e[i.parentScope()];for(;o.length&&!a;)a=e[o.join(":")],o.pop();if(!a)console.warn(`Missing SG:Parent (${i.Id}): ${i.parentScope()}`);else{let c=a;e[i.ScopeName]=c.createSubgraph(i)}break;case"activity":let u=e[i.parentScope()];u?s[i.ScopeName]=u.createVertex(i):console.warn(`Missing A:Parent (${i.Id}): ${i.parentScope()}`);break;case"edge":t[i.ScopeName]=i;break;case"function":let p=s[i.parentScope()];p?p._.children().push(i):console.warn(`Missing F:Parent (${i.Id}): ${i.parentScope()}`);break}for(let i in t){let o=t[i],a=e[o.parentScope()];if(!a)console.warn(`Missing E:Parent (${o.Id}): ${o.parentScope()}`);else{let u=a;try{let p=n.vertex(o.attr("IdSource").RawValue),c=n.vertex(o.attr("IdTarget").RawValue);u.createEdge(p,c,o)}catch{console.warn(`Invalid Edge: ${i}`)}}}return n}var ln=require("@hpcc-js/util"),we=class extends ln.StateObject{wu;get properties(){return this.get()}get URL(){return this.get("URL")}get DisplayName(){return this.get("DisplayName")}get DisplayPath(){return this.get("DisplayPath")}constructor(e,t){super(),this.wu=e;let s=t.split("\\").join("/"),n=s.split("/"),i="res/"+this.wu.Wuid+"/",o="",a="";s.indexOf(i)===0&&(o=s.substr(i.length),a=n[n.length-1]),this.set({URL:t,DisplayName:a,DisplayPath:o})}};var L=require("@hpcc-js/util");var ke=require("@hpcc-js/util"),Ne=class{e;constructor(e){this.e=e}fix(){delete this.e}},Qe=class extends Ne{name;type;isSet=!1;attrs={};_children=[];constructor(e){super(e)}append(e){this._children.push(e),this.type||(this.type="hpcc:childDataset")}fix(){this.name=this.e.$.name,this.type=this.e.$.type;for(let t=this._children.length-1;t>=0;--t){let s=this._children[t];s.name==="Row"&&s.type===void 0&&(this._children.push(...s._children),this._children.splice(t,1))}let e=this.setOfType();e&&(this.type=e,this.isSet=!0,this._children=[])}children(){return this._children}isAll(e){return e.name==="All"&&e.type===void 0}setOfType(){let e=this.children();if(this.type===void 0&&e.length===2){if(this.isAll(e[0]))return e[1].type;if(this.isAll(e[1]))return e[0].type}}charWidth(){let e=-1;switch(this.type){case"xs:boolean":e=5;break;case"xs:integer":e=8;break;case"xs:nonNegativeInteger":e=8;break;case"xs:double":e=8;break;case"xs:string":e=32;break;default:let t="0123456789",s=this.type.lastIndexOf("_"),n=s>0?s:this.type.length,i=n-1;for(;i>=0&&t.indexOf(this.type.charAt(i))!==-1;--i);i+1<n&&(e=parseInt(this.type.substring(i+1,n),10)),this.type.indexOf("data")===0&&(e*=2);break}return e<this.name.length&&(e=this.name.length),e}},Le=class extends Ne{name;type;maxLength;_restricition;_maxLength;constructor(e){super(e)}append(e){switch(e.name){case"xs:restriction":this._restricition=e;break;case"xs:maxLength":this._maxLength=e;break;default:}}fix(){this.name=this.e.$.name,this.type=this._restricition.$.base,this.maxLength=this._maxLength?+this._maxLength.$.value:void 0,delete this._restricition,delete this._maxLength,super.fix()}},Ge=class{root;simpleTypes={};fields(){return this.root.children()}},At=class extends ke.SAXStackParser{schema=new Ge;simpleType;simpleTypes={};xsdStack=new ke.Stack;startXMLNode(e){switch(super.startXMLNode(e),e.name){case"xs:element":let t=new Qe(e);this.schema.root?this.xsdStack.depth()&&this.xsdStack.top().append(t):this.schema.root=t,this.xsdStack.push(t);break;case"xs:simpleType":this.simpleType=new Le(e);break;default:break}}endXMLNode(e){switch(e.name){case"xs:element":this.xsdStack.pop().fix();break;case"xs:simpleType":this.simpleType.fix(),this.simpleTypes[this.simpleType.name]=this.simpleType,delete this.simpleType;break;case"xs:appinfo":let s=this.xsdStack.top();for(let n in e.$)s.attrs[n]=e.$[n];break;default:this.simpleType&&this.simpleType.append(e)}super.endXMLNode(e)}};function Wt(r){let e=new At;return e.parse(r),e.schema}var bs=class extends At{_rootName;schema=new Ge;simpleTypes={};xsdStack=new ke.Stack;constructor(e){super(),this._rootName=e}startXMLNode(e){switch(super.startXMLNode(e),e.name){case"xsd:element":let t=new Qe(e);!this.schema.root&&this._rootName===e.$.name&&(this.schema.root=t),this.xsdStack.depth()&&this.xsdStack.top().append(t),this.xsdStack.push(t);break;case"xsd:simpleType":this.simpleType=new Le(e);break;default:break}}endXMLNode(e){switch(e.name){case"xsd:element":this.xsdStack.pop().fix();break;case"xsd:simpleType":break;default:break}super.endXMLNode(e)}};function rr(r,e){let t=new bs(e);return t.parse(r),t.schema}var Ut=class extends L.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}-${e.ResultName}`)}},yt=new Ut,ve=class r extends L.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}xsdSchema;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get ResultName(){return this.get("ResultName")}get ResultSequence(){return this.get("ResultSequence")}get LogicalFileName(){return this.get("LogicalFileName")}get Name(){return this.get("Name")}get Sequence(){return this.get("Sequence")}get Value(){return this.get("Value")}get Link(){return this.get("Link")}get FileName(){return this.get("FileName")}get IsSupplied(){return this.get("IsSupplied")}get ShowFileContent(){return this.get("ShowFileContent")}get Total(){return this.get("Total")}get ECLSchemas(){return this.get("ECLSchemas")}get NodeGroup(){return this.get("NodeGroup")}get ResultViews(){return this.get("ResultViews")}get XmlSchema(){return this.get("XmlSchema")}static attach(e,t,s,n){let i;return Array.isArray(n)?(i=yt.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:s.Name},()=>new r(e,t,s,n)),i.set(s)):typeof n>"u"&&(typeof s=="number"?i=yt.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:"Sequence_"+s},()=>new r(e,t,s)):typeof s=="string"&&(i=yt.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:s},()=>new r(e,t,s)))),i}static attachLogicalFile(e,t,s){return yt.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:s},()=>new r(e,t,s,!0))}constructor(e,t,s,n){super(),e instanceof A?this.connection=e:this.connection=new A(e),typeof n=="boolean"&&n===!0?this.set({NodeGroup:t,LogicalFileName:s}):Ss(s)&&Array.isArray(n)?this.set({...s,Wuid:t,ResultName:s.Name,ResultViews:n}):typeof n>"u"?typeof s=="number"?this.set({Wuid:t,ResultSequence:s}):typeof s=="string"?this.set({Wuid:t,ResultName:s}):console.warn("Unknown Result.attach (1)"):console.warn("Unknown Result.attach (2)")}isComplete(){return this.Total!==-1}_fetchXMLSchemaPromise;fetchXMLSchema(e=!1){return(!this._fetchXMLSchemaPromise||e)&&(this._fetchXMLSchemaPromise=this.WUResult().then(t=>t.Result?.XmlSchema?.xml?(this.xsdSchema=Wt(t.Result.XmlSchema.xml),this.xsdSchema):null)),this._fetchXMLSchemaPromise}async refresh(){return await this.fetchRows(0,1,!0),this}fetchRows(e=0,t=-1,s=!1,n={},i){return this.WUResult(e,t,!s,n,i).then(o=>{let a=o.Result;return delete o.Result,this.set({...o}),(0,L.exists)("XmlSchema.xml",a)&&(this.xsdSchema=Wt(a.XmlSchema.xml)),(0,L.exists)("Row",a)?a.Row:this.ResultName&&(0,L.exists)(this.ResultName,a)?a[this.ResultName].Row:[]})}rootField(){return this.xsdSchema?this.xsdSchema.root:null}fields(){return this.xsdSchema?this.xsdSchema.root.children():[]}WUResult(e=0,t=1,s=!1,n={},i){let o={NamedValue:{itemcount:0}};for(let u in n)o.NamedValue[o.NamedValue.itemcount++]={Name:u,Value:n[u]};let a={FilterBy:o};return this.Wuid&&this.ResultName!==void 0?(a.Wuid=this.Wuid,a.ResultName=this.ResultName):this.Wuid&&this.ResultSequence!==void 0?(a.Wuid=this.Wuid,a.Sequence=this.ResultSequence):this.LogicalFileName&&this.NodeGroup?(a.LogicalName=this.LogicalFileName,a.Cluster=this.NodeGroup):this.LogicalFileName&&(a.LogicalName=this.LogicalFileName),a.Start=e,a.Count=t,a.SuppressXmlSchema=s,this.connection.WUResult(a,i).then(u=>u)}},Ve=class extends L.Cache{constructor(){super(e=>L.Cache.hash([e.Sequence,e.Name,e.Value,e.FileName]))}};var Ps=require("@hpcc-js/util"),Y=class extends Ps.StateObject{scope;get properties(){return this.get()}get Name(){return this.get("Name")}get RawValue(){return this.get("RawValue")}get Formatted(){return this.get("Formatted")}get FormattedEnd(){return this.get("FormattedEnd")}get Measure(){return this.get("Measure")}get Creator(){return this.get("Creator")}get CreatorType(){return this.get("CreatorType")}constructor(e,t){super(),this.scope=e,this.set(t)}},Et=class extends Ps.StateObject{_attributeMap={};_children=[];get properties(){return this.get()}get ScopeName(){return this.get("ScopeName")}get Id(){return this.get("Id")}get ScopeType(){return this.get("ScopeType")}get Properties(){return this.get("Properties",{Property:[]})}get Notes(){return this.get("Notes",{Note:[]})}get SinkActivity(){return this.get("SinkActivity")}get CAttributes(){let e=[],t={start:null,end:null};return this.Properties.Property.forEach(s=>{s.Measure==="ts"&&s.Name.indexOf("Started")>=0?t.start=s:this.ScopeName&&s.Measure==="ts"&&s.Name.indexOf("Finished")>=0?t.end=s:e.push(new Y(this,s))}),t.start&&t.end?(t.start.FormattedEnd=t.end.Formatted,e.push(new Y(this,t.start))):t.start?e.push(new Y(this,t.start)):t.end&&e.push(new Y(this,t.end)),e}constructor(e){super(),this.update(e)}update(e){this.set(e),this.CAttributes.forEach(t=>{this._attributeMap[t.Name]=t}),this.Properties.Property=[];for(let t in this._attributeMap)this._attributeMap.hasOwnProperty(t)&&this.Properties.Property.push(this._attributeMap[t].properties)}parentScope(){let e=this.ScopeName.split(":");return e.pop(),e.join(":")}children(e){return arguments.length?(this._children=e,this):this._children}walk(e){if(e.start(this))return!0;for(let t of this.children())if(t.walk(e))return!0;return e.end(this)}formattedAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].Formatted||this._attributeMap[t].RawValue;return e}rawAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].RawValue;return e}hasAttr(e){return this._attributeMap[e]!==void 0}attr(e){return this._attributeMap[e]||new Y(this,{Creator:"",CreatorType:"",Formatted:"",Measure:"",Name:"",RawValue:""})}attrMeasure(e){return this._attributeMap[e].Measure}calcTooltip(e){let t="",s=[];t=this.Id,s.push(`<tr><td class="key">ID:</td><td class="value">${this.Id}</td></tr>`),e&&s.push(`<tr><td class="key">Parent ID:</td><td class="value">${e.Id}</td></tr>`),s.push(`<tr><td class="key">Scope:</td><td class="value">${this.ScopeName}</td></tr>`);let n=this.formattedAttrs();for(let i in n)i==="Label"?t=n[i]:s.push(`<tr><td class="key">${i}</td><td class="value">${n[i]}</td></tr>`);return`<div class="eclwatch_WUGraph_Tooltip" style="max-width:480px">
910
+ `;var ts=require("safe-buffer");var Vn="@hpcc-js/comms",_n="3.6.0",Hn="3.7.0";var Fe=require("@hpcc-js/util");var V=require("@hpcc-js/util"),Ys=(0,V.scopedLogger)("comms/connection.ts");function jn(r){return"baseUrl"in r}var On={type:"post",baseUrl:"",userID:"",password:"",rejectUnauthorized:!0,timeoutSecs:60};function Yn(r){return typeof r.opts=="function"&&typeof r.send=="function"&&typeof r.clone=="function"}function Q(r,e){return e===void 0||e===!0?encodeURIComponent(r):""+r}function v(r,e=!0,t=""){if(t&&(t+="."),typeof r!="object")return Q(r,e);let s=[];for(let n in r)if(r.hasOwnProperty(n))if(r[n]instanceof Array){let i=!1;r[n].forEach((o,a)=>{typeof o=="object"?(i=!0,s.push(v(o,e,t+Q(`${n}.${a}`,e)))):s.push(t+Q(`${n}_i${a}`,e)+"="+v(o,e))}),i&&s.push(t+Q(`${n}.itemcount`,e)+"="+r[n].length)}else typeof r[n]=="object"?r[n]&&r[n].Item instanceof Array?(s.push(v(r[n].Item,e,t+Q(n,e))),s.push(t+Q(`${n}.itemcount`,e)+"="+r[n].Item.length)):s.push(v(r[n],e,t+Q(n,e))):r[n]!==void 0?s.push(t+Q(n,e)+"="+Q(r[n],e)):s.push(t+Q(n,e));return s.join("&")}function Xs(r){return JSON.parse(r)}function qs(r,e,t={},s="json",n){return n&&console.warn("Header attributes ignored for JSONP connections"),new Promise((i,o)=>{let a=r.timeoutSecs*1e3,c=5e3,p="jsonp_callback_"+Math.round(Math.random()*999999);window[p]=function(E){a=0,f(),i(s==="json"&&typeof E=="string"?Xs(E):E)};let u=document.createElement("script"),l=(0,V.join)(r.baseUrl,e);l+=l.indexOf("?")>=0?"&":"?",u.src=l+"jsonp="+p+"&"+v(t,r.encodeRequest),document.body.appendChild(u);let g=setInterval(function(){a<=0?clearInterval(g):(a-=c,a<=0?(clearInterval(g),Ys.error("Request timeout: "+u.src),f(),o(Error("Request timeout: "+u.src))):Ys.debug("Request pending ("+a/1e3+" sec): "+u.src))},c);function f(){delete window[p],document.body.removeChild(u)}})}function Xn(r){return r.userID?{Authorization:`Basic ${btoa(`${r.userID}:${r.password}`)}`}:{}}var nt={};function Js(r,e,t,s,n){s={...Xn(r),...s},t={credentials:nt[r.baseUrl]?"omit":"include",...t,headers:s},fetch.__setGlobalDispatcher&&fetch.__setGlobalDispatcher(fetch.__defaultAgent),r.baseUrl.indexOf("https:")===0&&(r.rejectUnauthorized===!1&&fetch.__rejectUnauthorizedAgent?fetch.__setGlobalDispatcher?fetch.__setGlobalDispatcher(fetch.__rejectUnauthorizedAgent):t.agent=fetch.__rejectUnauthorizedAgent:fetch.__trustwaveAgent&&(t.agent=fetch.__trustwaveAgent));function i(o){if(o.ok)return n==="json"?o.json():o.text();throw new Error(o.statusText)}return(0,V.promiseTimeout)(r.timeoutSecs*1e3,fetch((0,V.join)(r.baseUrl,e),t).then(i).catch(o=>(t.credentials=nt[r.baseUrl]?"include":"omit",fetch((0,V.join)(r.baseUrl,e),t).then(i).then(a=>(nt[r.baseUrl]=!nt[r.baseUrl],a)))))}function zs(r,e,t,s="json",n){t.upload_&&(delete t.upload_,e+="?upload_");let i;return t.abortSignal_&&(i=t.abortSignal_,delete t.abortSignal_),Js(r,e,{method:"post",body:v(t,r.encodeRequest),signal:i},{"Content-Type":"application/x-www-form-urlencoded",...n},s)}function Ks(r,e,t,s="json",n){let i;return t.abortSignal_&&(i=t.abortSignal_,delete t.abortSignal_),Js(r,`${e}?${v(t,r.encodeRequest)}`,{method:"get",signal:i},{...n},s)}function Zs(r,e,t,s="json",n){let i;switch(r.type){case"jsonp":i=qs(r,e,t,s,n);break;case"get":i=Ks(r,e,t,s,n);break;case"post":default:i=zs(r,e,t,s,n);break}return i}var rt=Zs;function qn(r){let e=rt;return r&&(rt=r),e}var it=class r{_opts;get baseUrl(){return this._opts.baseUrl}constructor(e){this.opts(e)}opts(e){return arguments.length===0?this._opts:(this._opts={...On,...e},this)}send(e,t,s="json",n){return this._opts.hookSend?this._opts.hookSend(this._opts,e,t,s,rt,n):rt(this._opts,e,t,s,n)}clone(){return new r(this.opts())}},Ue=function(r){return new it(r)};function Jn(r){let e=Ue;return Ue=r,e}function $s(r){return Object.prototype.toString.call(r)==="[object Array]"}var _=class extends Error{isESPExceptions=!0;action;request;Source;Exception;constructor(e,t,s){super("ESPException: "+s.Source),this.action=e,this.request=t,this.Source=s.Source,this.Exception=s.Exception,s.Exception.length?this.message=`${s.Exception[0].Code}: ${s.Exception[0].Message}`:this.message=""}};function zn(r){return r instanceof _||r.isESPExceptions&&Array.isArray(r.Exception)}function Kn(r){return r.send!==void 0}var le=class r{_connection;get baseUrl(){return this._connection.opts().baseUrl}_service;_version;constructor(e,t,s){this._connection=Kn(e)?e:Ue(e),this._service=t,this._version=s}service(e){return e===void 0?this._service:(this._service=e,this)}version(e){return e===void 0?this._version:(this._version=e,this)}toESPStringArray(e,t){if($s(e[t])){for(let s=0;s<e[t].length;++s)e[t+"_i"+s]=e[t][s];delete e[t]}return e}opts(e){return e===void 0?this._connection.opts():(this._connection.opts(e),this)}send(e,t={},s="json",n=!1,i,o){let a={...t,ver_:this._version};n&&(a.upload_=!0),i&&(a.abortSignal_=i);let c,p="json";switch(s){case"text":c=(0,Fe.join)(this._service,e),p="text";break;case"xsd":c=(0,Fe.join)(this._service,e+".xsd"),p="text";break;case"json2":c=(0,Fe.join)(this._service,e+"/json"),s="json",e=e.split("/").pop();break;default:c=(0,Fe.join)(this._service,e+".json")}return this._connection.send(c,a,p).then(u=>{if(s==="json"){let l;if(u&&u.Exceptions)throw new _(e,a,u.Exceptions);if(u&&(l=u[o||e+"Response"]),!l)throw new _(e,a,{Source:"ESPConnection.send",Exception:[{Code:0,Message:"Missing Response"}]});return l}return u})}clone(){return new r(this._connection.clone(),this._service,this._version)}},h=class{_connection;get baseUrl(){return this._connection.opts().baseUrl}constructor(e,t,s){this._connection=new le(e,t,s)}opts(){return this._connection.opts()}connection(){return this._connection.clone()}};var pe;(e=>{let r;(c=>(c.Delete="Delete",c.Protect="Protect",c.Unprotect="Unprotect",c.Restore="Restore",c.SetToFailed="SetToFailed",c.Archive="Archive"))(r=e.DFUWUActions||={})})(pe||={});var ot=class extends h{constructor(e){super(e,"FileSpray","1.26")}AbortDFUWorkunit(e){return this._connection.send("AbortDFUWorkunit",e,"json",!1,void 0,"AbortDFUWorkunitResponse")}Copy(e){return this._connection.send("Copy",e,"json",!1,void 0,"CopyResponse")}CreateDFUPublisherWorkunit(e){return this._connection.send("CreateDFUPublisherWorkunit",e,"json",!1,void 0,"CreateDFUPublisherWorkunitResponse")}CreateDFUWorkunit(e){return this._connection.send("CreateDFUWorkunit",e,"json",!1,void 0,"CreateDFUWorkunitResponse")}DFUWUFile(e){return this._connection.send("DFUWUFile",e,"json",!1,void 0,"DFUWUFileResponse")}DFUWUSearch(e){return this._connection.send("DFUWUSearch",e,"json",!1,void 0,"DFUWUSearchResponse")}DFUWorkunitsAction(e){return this._connection.send("DFUWorkunitsAction",e,"json",!1,void 0,"DFUWorkunitsActionResponse")}DeleteDFUWorkunit(e){return this._connection.send("DeleteDFUWorkunit",e,"json",!1,void 0,"DeleteDFUWorkunitResponse")}DeleteDFUWorkunits(e){return this._connection.send("DeleteDFUWorkunits",e,"json",!1,void 0,"DeleteDFUWorkunitsResponse")}DeleteDropZoneFiles(e){return this._connection.send("DeleteDropZoneFiles",e,"json",!1,void 0,"DFUWorkunitsActionResponse")}Despray(e){return this._connection.send("Despray",e,"json",!1,void 0,"DesprayResponse")}DfuMonitor(e){return this._connection.send("DfuMonitor",e,"json",!1,void 0,"DfuMonitorResponse")}DropZoneFileSearch(e){return this._connection.send("DropZoneFileSearch",e,"json",!1,void 0,"DropZoneFileSearchResponse")}DropZoneFiles(e){return this._connection.send("DropZoneFiles",e,"json",!1,void 0,"DropZoneFilesResponse")}EchoDateTime(e){return this._connection.send("EchoDateTime",e,"json",!1,void 0,"EchoDateTimeResponse")}FileList(e){return this._connection.send("FileList",e,"json",!1,void 0,"FileListResponse")}GetDFUExceptions(e){return this._connection.send("GetDFUExceptions",e,"json",!1,void 0,"GetDFUExceptionsResponse")}GetDFUProgress(e){return this._connection.send("GetDFUProgress",e,"json",!1,void 0,"ProgressResponse")}GetDFUServerQueues(e){return this._connection.send("GetDFUServerQueues",e,"json",!1,void 0,"GetDFUServerQueuesResponse")}GetDFUWorkunit(e){return this._connection.send("GetDFUWorkunit",e,"json",!1,void 0,"GetDFUWorkunitResponse")}GetDFUWorkunits(e){return this._connection.send("GetDFUWorkunits",e,"json",!1,void 0,"GetDFUWorkunitsResponse")}GetRemoteTargets(e){return this._connection.send("GetRemoteTargets",e,"json",!1,void 0,"GetRemoteTargetsResponse")}GetSprayTargets(e){return this._connection.send("GetSprayTargets",e,"json",!1,void 0,"GetSprayTargetsResponse")}OpenSave(e){return this._connection.send("OpenSave",e,"json",!1,void 0,"OpenSaveResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"FileSprayPingResponse")}Rename(e){return this._connection.send("Rename",e,"json",!1,void 0,"RenameResponse")}Replicate(e){return this._connection.send("Replicate",e,"json",!1,void 0,"ReplicateResponse")}ShowResult(e){return this._connection.send("ShowResult",e,"json",!1,void 0,"ShowResultResponse")}SprayFixed(e){return this._connection.send("SprayFixed",e,"json",!1,void 0,"SprayFixedResponse")}SprayVariable(e){return this._connection.send("SprayVariable",e,"json",!1,void 0,"SprayResponse")}SubmitDFUWorkunit(e){return this._connection.send("SubmitDFUWorkunit",e,"json",!1,void 0,"SubmitDFUWorkunitResponse")}UpdateDFUWorkunit(e){return this._connection.send("UpdateDFUWorkunit",e,"json",!1,void 0,"UpdateDFUWorkunitResponse")}};var en=(u=>(u[u.unknown=0]="unknown",u[u.scheduled=1]="scheduled",u[u.queued=2]="queued",u[u.started=3]="started",u[u.aborted=4]="aborted",u[u.failed=5]="failed",u[u.finished=6]="finished",u[u.monitoring=7]="monitoring",u[u.aborting=8]="aborting",u[u.notfound=999]="notfound",u))(en||{}),H=class extends ot{DFUWUFileEx(e){return this._connection.send("DFUWUFile",e,"text")}SprayFixedEx(e){return this._connection.send("SprayFixed",e)}SprayVariableEx(e){return this._connection.send("SprayVariable",e,"json",!1,null,"SprayResponse")}DesprayEx(e){return this._connection.send("Despray",e)}UpdateDFUWorkunitEx(e){return this._connection.send("UpdateDFUWorkunit",e,"json",!1,void 0,"UpdateDFUWorkunitResponse")}};var ns;(o=>{let r;(p=>(p.User="User",p.Group="Group"))(r=o.ViewMemberType||={});let e;(g=>(g.username="username",g.fullname="fullname",g.passwordexpiration="passwordexpiration",g.employeeID="employeeID",g.employeeNumber="employeeNumber"))(e=o.UserSortBy||={});let t;(p=>(p.Name="Name",p.ManagedBy="ManagedBy"))(t=o.GroupSortBy||={});let s;(u=>(u.Any="Any",u.User="User",u.Group="Group"))(s=o.AccountTypeReq||={});let n;(p=>(p.Name="Name",p.Type="Type"))(n=o.ResourcePermissionSortBy||={});let i;(c=>c.Name="Name")(i=o.ResourceSortBy||={})})(ns||={});var at=class extends h{constructor(e){super(e,"ws_access","1.17")}AccountPermissions(e){return this._connection.send("AccountPermissions",e,"json",!1,void 0,"AccountPermissionsResponse")}AccountPermissionsV2(e){return this._connection.send("AccountPermissionsV2",e,"json",!1,void 0,"AccountPermissionsV2Response")}AddUser(e){return this._connection.send("AddUser",e,"json",!1,void 0,"AddUserResponse")}AddView(e){return this._connection.send("AddView",e,"json",!1,void 0,"AddViewResponse")}AddViewColumn(e){return this._connection.send("AddViewColumn",e,"json",!1,void 0,"AddViewColumnResponse")}AddViewMember(e){return this._connection.send("AddViewMember",e,"json",!1,void 0,"AddViewMemberResponse")}ClearPermissionsCache(e){return this._connection.send("ClearPermissionsCache",e,"json",!1,void 0,"ClearPermissionsCacheResponse")}DeleteView(e){return this._connection.send("DeleteView",e,"json",!1,void 0,"DeleteViewResponse")}DeleteViewColumn(e){return this._connection.send("DeleteViewColumn",e,"json",!1,void 0,"DeleteViewColumnResponse")}DeleteViewMember(e){return this._connection.send("DeleteViewMember",e,"json",!1,void 0,"DeleteViewMemberResponse")}DisableScopeScans(e){return this._connection.send("DisableScopeScans",e,"json",!1,void 0,"DisableScopeScansResponse")}EnableScopeScans(e){return this._connection.send("EnableScopeScans",e,"json",!1,void 0,"EnableScopeScansResponse")}FilePermission(e){return this._connection.send("FilePermission",e,"json",!1,void 0,"FilePermissionResponse")}GroupAction(e){return this._connection.send("GroupAction",e,"json",!1,void 0,"GroupActionResponse")}GroupAdd(e){return this._connection.send("GroupAdd",e,"json",!1,void 0,"GroupAddResponse")}GroupEdit(e){return this._connection.send("GroupEdit",e,"json",!1,void 0,"GroupEditResponse")}GroupMemberEdit(e){return this._connection.send("GroupMemberEdit",e,"json",!1,void 0,"GroupMemberEditResponse")}GroupMemberEditInput(e){return this._connection.send("GroupMemberEditInput",e,"json",!1,void 0,"GroupMemberEditInputResponse")}GroupMemberQuery(e){return this._connection.send("GroupMemberQuery",e,"json",!1,void 0,"GroupMemberQueryResponse")}GroupQuery(e){return this._connection.send("GroupQuery",e,"json",!1,void 0,"GroupQueryResponse")}Groups(e){return this._connection.send("Groups",e,"json",!1,void 0,"GroupResponse")}PermissionAction(e){return this._connection.send("PermissionAction",e,"json",!1,void 0,"PermissionActionResponse")}Permissions(e){return this._connection.send("Permissions",e,"json",!1,void 0,"BasednsResponse")}PermissionsReset(e){return this._connection.send("PermissionsReset",e,"json",!1,void 0,"PermissionsResetResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"ws_accessPingResponse")}QueryScopeScansEnabled(e){return this._connection.send("QueryScopeScansEnabled",e,"json",!1,void 0,"QueryScopeScansEnabledResponse")}QueryUserViewColumns(e){return this._connection.send("QueryUserViewColumns",e,"json",!1,void 0,"QueryUserViewColumnsResponse")}QueryViewColumns(e){return this._connection.send("QueryViewColumns",e,"json",!1,void 0,"QueryViewColumnsResponse")}QueryViewMembers(e){return this._connection.send("QueryViewMembers",e,"json",!1,void 0,"QueryViewMembersResponse")}QueryViews(e){return this._connection.send("QueryViews",e,"json",!1,void 0,"QueryViewsResponse")}ResourceAdd(e){return this._connection.send("ResourceAdd",e,"json",!1,void 0,"ResourceAddResponse")}ResourceDelete(e){return this._connection.send("ResourceDelete",e,"json",!1,void 0,"ResourceDeleteResponse")}ResourcePermissionQuery(e){return this._connection.send("ResourcePermissionQuery",e,"json",!1,void 0,"ResourcePermissionQueryResponse")}ResourcePermissions(e){return this._connection.send("ResourcePermissions",e,"json",!1,void 0,"ResourcePermissionsResponse")}ResourceQuery(e){return this._connection.send("ResourceQuery",e,"json",!1,void 0,"ResourceQueryResponse")}Resources(e){return this._connection.send("Resources",e,"json",!1,void 0,"ResourcesResponse")}UserAccountExport(e){return this._connection.send("UserAccountExport",e,"json",!1,void 0,"UserAccountExportResponse")}UserAction(e){return this._connection.send("UserAction",e,"json",!1,void 0,"UserActionResponse")}UserEdit(e){return this._connection.send("UserEdit",e,"json",!1,void 0,"UserEditResponse")}UserGroupEdit(e){return this._connection.send("UserGroupEdit",e,"json",!1,void 0,"UserGroupEditResponse")}UserGroupEditInput(e){return this._connection.send("UserGroupEditInput",e,"json",!1,void 0,"UserGroupEditInputResponse")}UserInfoEdit(e){return this._connection.send("UserInfoEdit",e,"json",!1,void 0,"UserInfoEditResponse")}UserInfoEditInput(e){return this._connection.send("UserInfoEditInput",e,"json",!1,void 0,"UserInfoEditInputResponse")}UserPosix(e){return this._connection.send("UserPosix",e,"json",!1,void 0,"UserPosixResponse")}UserPosixInput(e){return this._connection.send("UserPosixInput",e,"json",!1,void 0,"UserPosixInputResponse")}UserQuery(e){return this._connection.send("UserQuery",e,"json",!1,void 0,"UserQueryResponse")}UserResetPass(e){return this._connection.send("UserResetPass",e,"json",!1,void 0,"UserResetPassResponse")}UserResetPassInput(e){return this._connection.send("UserResetPassInput",e,"json",!1,void 0,"UserResetPassInputResponse")}UserSudoers(e){return this._connection.send("UserSudoers",e,"json",!1,void 0,"UserSudoersResponse")}UserSudoersInput(e){return this._connection.send("UserSudoersInput",e,"json",!1,void 0,"UserSudoersInputResponse")}Users(e){return this._connection.send("Users",e,"json",!1,void 0,"UserResponse")}};var rs=class extends at{};var ct=class extends h{constructor(e){super(e,"ws_account","1.06")}MyAccount(e){return this._connection.send("MyAccount",e,"json",!1,void 0,"MyAccountResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"ws_accountPingResponse")}UpdateUser(e){return this._connection.send("UpdateUser",e,"json",!1,void 0,"UpdateUserResponse")}UpdateUserInput(e){return this._connection.send("UpdateUserInput",e,"json",!1,void 0,"UpdateUserInputResponse")}VerifyUser(e){return this._connection.send("VerifyUser",e,"json",!1,void 0,"VerifyUserResponse")}};var is=class extends ct{VerifyUser(e){return this._connection.send("VerifyUser",e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(s=>s.Code===20043))return{retcode:20043,Exceptions:{Source:"wsAccount",Exception:t.Exception}};throw t})}};var tn=require("@hpcc-js/util");var ut=class extends h{constructor(e){super(e,"WsCloud","1.02")}GetPODs(e){return this._connection.send("GetPODs",e,"json",!1,void 0,"GetPODsResponse")}GetServices(e){return this._connection.send("GetServices",e,"json",!1,void 0,"GetServicesResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsCloudPingResponse")}};var Zn=(0,tn.scopedLogger)("@hpcc-js/comms/services/wsCloud.ts");function $n(r){return r?.Pods!==void 0}function er(r){return r.spec?.containers?.reduce((e,t)=>(t.ports?.forEach(s=>{e.push({ContainerPort:s.containerPort,Name:s.name,Protocol:s.protocol})}),e),[])??[]}function tr(r){return r.filter(e=>{let t=e?.metadata?.labels??{};return t.hasOwnProperty("app.kubernetes.io/part-of")&&t["app.kubernetes.io/part-of"]==="HPCC-Platform"}).map(e=>{let t=new Date(e.metadata?.creationTimestamp);return{Name:e.metadata.name,Status:e.status?.phase,CreationTimestamp:t.toISOString(),ContainerName:e.status?.containerStatuses?.reduce((s,n)=>(n.name&&s.push(n.name),s),[]).join(", ")??"",ContainerCount:e.spec?.containers?.length??0,ContainerReadyCount:e.status?.containerStatuses?.reduce((s,n)=>s+(n.ready?1:0),0),ContainerRestartCount:e.status?.containerStatuses?.reduce((s,n)=>s+n.restartCount,0),Ports:{Port:er(e)}}})}var os=class extends ut{getPODs(){return super.GetPODs({}).then(e=>{if($n(e))return e.Pods?.Pod??[];try{let t=typeof e.Result=="string"?JSON.parse(e.Result):e.Result;return tr(t?.items??[])}catch(t){return Zn.error(`Error parsing V1Pods json '${t instanceof Error?t.message:String(t)}'`),[]}})}};var as=class{_connection;constructor(e){this._connection=new le(e,"ws_codesign","1.1")}connectionOptions(){return this._connection.opts()}ListUserIDs(e){return this._connection.send("ListUserIDs",e).then(t=>t.UserIDs.Item).catch(t=>[])}Sign(e){return this._connection.send("Sign",{SigningMethod:"gpg",...e})}Verify(e){return this._connection.send("Verify",e)}};var lt=class extends h{constructor(e){super(e,"WSDali","1.07")}Add(e){return this._connection.send("Add",e,"json",!1,void 0,"ResultResponse")}ClearTraceTransactions(e){return this._connection.send("ClearTraceTransactions",e,"json",!1,void 0,"ResultResponse")}Count(e){return this._connection.send("Count",e,"json",!1,void 0,"CountResponse")}DFSCheck(e){return this._connection.send("DFSCheck",e,"json",!1,void 0,"ResultResponse")}DFSExists(e){return this._connection.send("DFSExists",e,"json",!1,void 0,"BooleanResponse")}DFSLS(e){return this._connection.send("DFSLS",e,"json",!1,void 0,"ResultResponse")}Delete(e){return this._connection.send("Delete",e,"json",!1,void 0,"ResultResponse")}DisconnectClientConnection(e){return this._connection.send("DisconnectClientConnection",e,"json",!1,void 0,"ResultResponse")}GetClients(e){return this._connection.send("GetClients",e,"json",!1,void 0,"ResultResponse")}GetConnections(e){return this._connection.send("GetConnections",e,"json",!1,void 0,"ResultResponse")}GetDFSCSV(e){return this._connection.send("GetDFSCSV",e,"json",!1,void 0,"ResultResponse")}GetDFSMap(e){return this._connection.send("GetDFSMap",e,"json",!1,void 0,"ResultResponse")}GetDFSParents(e){return this._connection.send("GetDFSParents",e,"json",!1,void 0,"ResultResponse")}GetLogicalFile(e){return this._connection.send("GetLogicalFile",e,"json",!1,void 0,"ResultResponse")}GetLogicalFilePart(e){return this._connection.send("GetLogicalFilePart",e,"json",!1,void 0,"ResultResponse")}GetProtectedList(e){return this._connection.send("GetProtectedList",e,"json",!1,void 0,"ResultResponse")}GetSDSStats(e){return this._connection.send("GetSDSStats",e,"json",!1,void 0,"ResultResponse")}GetSDSSubscribers(e){return this._connection.send("GetSDSSubscribers",e,"json",!1,void 0,"ResultResponse")}GetValue(e){return this._connection.send("GetValue",e,"json",!1,void 0,"ResultResponse")}Import(e){return this._connection.send("Import",e,"json",!1,void 0,"ResultResponse")}ListSDSLocks(e){return this._connection.send("ListSDSLocks",e,"json",!1,void 0,"ResultResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WSDaliPingResponse")}SaveSDSStore(e){return this._connection.send("SaveSDSStore",e,"json",!1,void 0,"ResultResponse")}SetLogicalFilePartAttr(e){return this._connection.send("SetLogicalFilePartAttr",e,"json",!1,void 0,"ResultResponse")}SetProtected(e){return this._connection.send("SetProtected",e,"json",!1,void 0,"ResultResponse")}SetTraceSlowTransactions(e){return this._connection.send("SetTraceSlowTransactions",e,"json",!1,void 0,"ResultResponse")}SetTraceTransactions(e){return this._connection.send("SetTraceTransactions",e,"json",!1,void 0,"ResultResponse")}SetUnprotected(e){return this._connection.send("SetUnprotected",e,"json",!1,void 0,"ResultResponse")}SetValue(e){return this._connection.send("SetValue",e,"json",!1,void 0,"ResultResponse")}UnlockSDSLock(e){return this._connection.send("UnlockSDSLock",e,"json",!1,void 0,"ResultResponse")}};var cs=class extends lt{};var $;(a=>{let r;(g=>(g.Delete="Delete",g.AddToSuperfile="Add To Superfile",g.ChangeProtection="Change Protection",g.ChangeRestriction="Change Restriction"))(r=a.DFUArrayActions||={});let e;(g=>(g[g.NoChange=0]="NoChange",g[g.Protect=1]="Protect",g[g.Unprotect=2]="Unprotect",g[g.UnprotectAll=3]="UnprotectAll"))(e=a.DFUChangeProtection||={});let t;(l=>(l[l.NoChange=0]="NoChange",l[l.Restrict=1]="Restrict",l[l.Unrestricted=2]="Unrestricted"))(t=a.DFUChangeRestriction||={});let s;(u=>(u.xml="xml",u.def="def"))(s=a.DFUDefFileFormat||={});let n;(l=>(l.Token="Token",l.Engine="Engine",l.External="External"))(n=a.FileAccessRole||={});let i;(f=>(f.None="None",f.Access="Access",f.Read="Read",f.Write="Write",f.Full="Full"))(i=a.SecAccessType||={});let o;(D=>(D.Flat="Flat",D.Index="Index",D.Xml="Xml",D.Csv="Csv",D.Json="Json",D.IndexLocal="IndexLocal",D.IndexPartitioned="IndexPartitioned",D.Unset="Unset"))(o=a.DFUFileType||={})})($||={});var pt=class extends h{constructor(e){super(e,"WsDfu","1.65")}Add(e){return this._connection.send("Add",e,"json",!1,void 0,"AddResponse")}AddRemote(e){return this._connection.send("AddRemote",e,"json",!1,void 0,"AddRemoteResponse")}AddtoSuperfile(e){return this._connection.send("AddtoSuperfile",e,"json",!1,void 0,"AddtoSuperfileResponse")}DFUArrayAction(e){return this._connection.send("DFUArrayAction",e,"json",!1,void 0,"DFUArrayActionResponse")}DFUBrowseData(e){return this._connection.send("DFUBrowseData",e,"json",!1,void 0,"DFUBrowseDataResponse")}DFUDefFile(e){return this._connection.send("DFUDefFile",e,"json",!1,void 0,"DFUDefFileResponse")}DFUFileAccess(e){return this._connection.send("DFUFileAccess",e,"json",!1,void 0,"DFUFileAccessResponse")}DFUFileAccessV2(e){return this._connection.send("DFUFileAccessV2",e,"json",!1,void 0,"DFUFileAccessResponse")}DFUFileCreate(e){return this._connection.send("DFUFileCreate",e,"json",!1,void 0,"DFUFileCreateResponse")}DFUFileCreateV2(e){return this._connection.send("DFUFileCreateV2",e,"json",!1,void 0,"DFUFileCreateResponse")}DFUFilePublish(e){return this._connection.send("DFUFilePublish",e,"json",!1,void 0,"DFUFilePublishResponse")}DFUFileView(e){return this._connection.send("DFUFileView",e,"json",!1,void 0,"DFUFileViewResponse")}DFUGetDataColumns(e){return this._connection.send("DFUGetDataColumns",e,"json",!1,void 0,"DFUGetDataColumnsResponse")}DFUGetFileMetaData(e){return this._connection.send("DFUGetFileMetaData",e,"json",!1,void 0,"DFUGetFileMetaDataResponse")}DFUInfo(e){return this._connection.send("DFUInfo",e,"json",!1,void 0,"DFUInfoResponse")}DFUQuery(e){return this._connection.send("DFUQuery",e,"json",!1,void 0,"DFUQueryResponse")}DFURecordTypeInfo(e){return this._connection.send("DFURecordTypeInfo",e,"json",!1,void 0,"DFURecordTypeInfoResponse")}DFUSearch(e){return this._connection.send("DFUSearch",e,"json",!1,void 0,"DFUSearchResponse")}DFUSearchData(e){return this._connection.send("DFUSearchData",e,"json",!1,void 0,"DFUSearchDataResponse")}DFUSpace(e){return this._connection.send("DFUSpace",e,"json",!1,void 0,"DFUSpaceResponse")}EclRecordTypeInfo(e){return this._connection.send("EclRecordTypeInfo",e,"json",!1,void 0,"EclRecordTypeInfoResponse")}EraseHistory(e){return this._connection.send("EraseHistory",e,"json",!1,void 0,"EraseHistoryResponse")}ListHistory(e){return this._connection.send("ListHistory",e,"json",!1,void 0,"ListHistoryResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsDfuPingResponse")}Savexml(e){return this._connection.send("Savexml",e,"json",!1,void 0,"SavexmlResponse")}SuperfileAction(e){return this._connection.send("SuperfileAction",e,"json",!1,void 0,"SuperfileActionResponse")}SuperfileList(e){return this._connection.send("SuperfileList",e,"json",!1,void 0,"SuperfileListResponse")}};var sr=$.DFUArrayActions,nr=$.DFUDefFileFormat,rr=$.DFUChangeProtection,ir=$.DFUChangeRestriction,ge=class extends pt{DFUFile(e){return this._connection.send("DFUDefFile",e,"text")}};var us=class extends h{constructor(e){super(e,"WsDFUXRef","1.01")}DFUXRefArrayAction(e){return this._connection.send("DFUXRefArrayAction",e)}DFUXRefBuild(e){return this._connection.send("DFUXRefBuild",e)}DFUXRefBuildCancel(e){return this._connection.send("DFUXRefBuildCancel",e)}DFUXRefCleanDirectories(e){return this._connection.send("DFUXRefCleanDirectories",e)}DFUXRefDirectories(e){return this._connection.send("DFUXRefDirectories",e,void 0,void 0,void 0,"DFUXRefDirectoriesQueryResponse")}DFUXRefFoundFiles(e){return this._connection.send("DFUXRefFoundFiles",e,void 0,void 0,void 0,"DFUXRefFoundFilesQueryResponse")}DFUXRefList(e={}){return this._connection.send("DFUXRefList",e)}DFUXRefLostFiles(e){return this._connection.send("DFUXRefLostFiles",e,void 0,void 0,void 0,"DFUXRefLostFilesQueryResponse")}DFUXRefMessages(e){return this._connection.send("DFUXRefMessages",e,void 0,void 0,void 0,"DFUXRefMessagesQueryResponse")}DFUXRefOrphanFiles(e){return this._connection.send("DFUXRefOrphanFiles",e,void 0,void 0,void 0,"DFUXRefOrphanFilesQueryResponse")}DFUXRefUnusedFiles(e){return this._connection.send("DFUXRefUnusedFiles",e)}};function sn(r,e){let t=typeof e;switch(t){case"boolean":case"number":case"string":return{id:r,type:t};case"object":if(e.Row instanceof Array&&(e=e.Row),e instanceof Array)return{id:r,type:"dataset",children:ls(e[0])};if(e instanceof Object){if(e.Item&&e.Item instanceof Array&&e.Item.length===1){let s=typeof e.Item[0];if(s==="string"||s==="number")return{id:r,type:"set",fieldType:s};throw new Error("Unknown field type")}return{id:r,type:"object",fields:or(e)}}default:throw new Error("Unknown field type")}}function ls(r){r.Row&&r.Row instanceof Array&&(r=r.Row[0]);let e=[];for(let t in r)e.push(sn(t,r[t]));return e}function or(r){let e={};for(let t in r)e[t]=sn(t,r[t]);return e}var be=class extends h{constructor(e){super(e,"WsEcl","0")}opts(){return this._connection.opts()}requestJson(e,t){return this._connection.send(`example/request/query/${e}/${t}/json`,{},"text").then(s=>{let n=JSON.parse(s);for(let i in n)return n[i];return{}}).then(ls)}responseJson(e,t){return this._connection.send(`example/response/query/${e}/${t}/json`,{},"text").then(s=>{let n=JSON.parse(s);for(let i in n)return n[i].Results;return{}}).then(s=>{let n={};for(let i in s)n[i]=ls(s[i]);return n})}submit(e,t,s){let n=`submit/query/${e}/${t}`;return this._connection.send(n,s,"json2").then(i=>{if(i.Results&&i.Results.Exception)throw new _(n,s,{Source:"wsEcl.submit",Exception:i.Results.Exception});return i.Results})}};var gt=class extends h{constructor(e){super(e,"ws_elk","1")}GetConfigDetails(e){return this._connection.send("GetConfigDetails",e)}Ping(e){return this._connection.send("Ping",e)}};var ps=class extends gt{};var rn=require("@hpcc-js/util");var C;(c=>{let r;(P=>(P.global="global",P.workunits="workunits",P.components="components",P.audience="audience",P.class="class",P.instance="instance",P.node="node",P.message="message",P.logid="logid",P.processid="processid",P.threadid="threadid",P.timestamp="timestamp",P.pod="pod",P.traceid="traceid",P.spanid="spanid"))(r=c.LogColumnType||={});let e;(E=>(E.string="string",E.numeric="numeric",E.datetime="datetime",E.enum="enum",E.epoch="epoch"))(e=c.LogColumnValueType||={});let t;(d=>(d[d.All=0]="All",d[d.ByJobID=1]="ByJobID",d[d.ByComponent=2]="ByComponent",d[d.ByLogType=3]="ByLogType",d[d.ByTargetAudience=4]="ByTargetAudience",d[d.BySourceInstance=5]="BySourceInstance",d[d.BySourceNode=6]="BySourceNode",d[d.ByFieldName=7]="ByFieldName",d[d.ByPod=8]="ByPod",d[d.ByTraceID=9]="ByTraceID",d[d.BySpanID=10]="BySpanID"))(t=c.LogAccessType||={});let s;(g=>(g[g.Success=0]="Success",g[g.Warning=1]="Warning",g[g.Fail=2]="Fail"))(s=c.LogAccessStatusCode||={});let n;(g=>(g[g.NONE=0]="NONE",g[g.AND=1]="AND",g[g.OR=2]="OR"))(n=c.LogAccessFilterOperator||={});let i;(f=>(f[f.MIN=0]="MIN",f[f.DEFAULT=1]="DEFAULT",f[f.ALL=2]="ALL",f[f.CUSTOM=3]="CUSTOM"))(i=c.LogSelectColumnMode||={});let o;(d=>(d[d.ByDate=0]="ByDate",d[d.ByJobID=1]="ByJobID",d[d.ByComponent=2]="ByComponent",d[d.ByLogType=3]="ByLogType",d[d.ByTargetAudience=4]="ByTargetAudience",d[d.BySourceInstance=5]="BySourceInstance",d[d.BySourceNode=6]="BySourceNode",d[d.ByFieldName=7]="ByFieldName",d[d.ByPod=8]="ByPod",d[d.ByTraceID=9]="ByTraceID",d[d.BySpanID=10]="BySpanID"))(o=c.SortColumType||={});let a;(l=>(l[l.ASC=0]="ASC",l[l.DSC=1]="DSC"))(a=c.SortDirection||={})})(C||={});var dt=class extends h{constructor(e){super(e,"ws_logaccess","1.08")}GetHealthReport(e){return this._connection.send("GetHealthReport",e,"json",!1,void 0,"GetHealthReportResponse")}GetLogAccessInfo(e){return this._connection.send("GetLogAccessInfo",e,"json",!1,void 0,"GetLogAccessInfoResponse")}GetLogs(e){return this._connection.send("GetLogs",e,"json",!1,void 0,"GetLogsResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"ws_logaccessPingResponse")}};var nn=(0,rn.scopedLogger)("@hpcc-js/comms/services/wsLogaccess.ts");var on=(o=>(o.Disaster="DIS",o.Error="ERR",o.Warning="WRN",o.Information="INF",o.Progress="PRO",o.Metric="MET",o))(on||{}),an=(n=>(n.Operator="OPR",n.User="USR",n.Programmer="PRO",n.Audit="ADT",n))(an||{}),gs=class extends dt{_logAccessInfo;GetLogAccessInfo(e={}){return this._logAccessInfo||(this._logAccessInfo=super.GetLogAccessInfo(e)),this._logAccessInfo}GetLogs(e){return super.GetLogs(e)}async GetLogsEx(e){let t=await this.GetLogAccessInfo(),s={};t.Columns.Column.forEach(a=>s[a.LogType]=a.Name);let n=a=>{let c={};for(let p in s)a?.fields?c[p]=Object.assign({},...a.fields)[s[p]]??"":c[p]="";return c},i={Filter:{leftBinaryFilter:{BinaryLogFilter:[{leftFilter:{LogCategory:C.LogAccessType.All}}]}},Range:{StartDate:new Date(0).toISOString()},LogLineStartFrom:e.LogLineStartFrom??0,LogLineLimit:e.LogLineLimit??100,SelectColumnMode:C.LogSelectColumnMode.DEFAULT,Format:"JSON",SortBy:{SortCondition:[{BySortType:C.SortColumType.ByDate,ColumnName:"",Direction:0}]}},o=[];for(let a in e){let c;a in s&&(Object.values(C.LogColumnType).includes(a)?c=a:c=s[a]);let p;if(c){switch(c){case C.LogColumnType.workunits:case"hpcc.log.jobid":p=C.LogAccessType.ByJobID;break;case C.LogColumnType.audience:case"hpcc.log.audience":p=C.LogAccessType.ByTargetAudience;break;case C.LogColumnType.class:case"hpcc.log.class":p=C.LogAccessType.ByLogType;break;case C.LogColumnType.components:case"kubernetes.container.name":p=C.LogAccessType.ByComponent;break;default:p=C.LogAccessType.ByFieldName,c=s[a]}if(Array.isArray(e[a]))e[a].forEach(u=>{p===C.LogAccessType.ByComponent&&(u+="*"),o.push({LogCategory:p,SearchField:c,SearchByValue:u})});else{let u=e[a];p===C.LogAccessType.ByComponent&&(u+="*"),o.push({LogCategory:p,SearchField:c,SearchByValue:u})}}}if(o.length>2){let a=i.Filter.leftBinaryFilter.BinaryLogFilter[0];o.forEach((c,p)=>{let u=C.LogAccessFilterOperator.AND;p>0?(o[p-1].SearchField===c.SearchField&&(u=C.LogAccessFilterOperator.OR),p===o.length-1?(a.Operator=u,a.rightFilter=c):(a.Operator=u,a.rightBinaryFilter={BinaryLogFilter:[{leftFilter:c}]},a=a.rightBinaryFilter.BinaryLogFilter[0])):a.leftFilter=c})}else delete i.Filter.leftBinaryFilter,i.Filter.leftFilter={LogCategory:C.LogAccessType.All},o[0]?.SearchField&&(i.Filter.leftFilter={LogCategory:o[0]?.LogCategory,SearchField:o[0]?.SearchField,SearchByValue:o[0]?.SearchByValue}),o[1]?.SearchField&&(i.Filter.Operator=C.LogAccessFilterOperator.AND,o[0].SearchField===o[1].SearchField&&(i.Filter.Operator=C.LogAccessFilterOperator.OR),i.Filter.rightFilter={LogCategory:o[1]?.LogCategory,SearchField:o[1]?.SearchField,SearchByValue:o[1]?.SearchByValue});return e.StartDate&&(i.Range.StartDate=e.StartDate.toISOString()),e.EndDate&&(i.Range.EndDate=e.EndDate.toISOString()),this.GetLogs(i).then(a=>{try{let c=JSON.parse(a.LogLines),p=[];switch(t.RemoteLogManagerType){case"azureloganalyticscurl":case"elasticstack":case"grafanacurl":p=c.lines?.map(n)??[];break;default:nn.warning(`Unknown RemoteLogManagerType: ${t.RemoteLogManagerType}`),p=[]}return{lines:p,total:a.TotalLogLinesAvailable??1e4}}catch(c){nn.error(c.message??c)}return{lines:[],total:0}})}};var cn=require("@hpcc-js/util"),j=require("d3-array");var mt=class extends h{constructor(e){super(e,"ws_machine","1.17")}GetComponentStatus(e){return this._connection.send("GetComponentStatus",e)}GetComponentUsage(e){return this._connection.send("GetComponentUsage",e)}GetMachineInfo(e){return this._connection.send("GetMachineInfo",e)}GetMachineInfoEx(e){return this._connection.send("GetMachineInfoEx",e)}GetMetrics(e){return this._connection.send("GetMetrics",e)}GetNodeGroupUsage(e){return this._connection.send("GetNodeGroupUsage",e)}GetTargetClusterInfo(e){return this._connection.send("GetTargetClusterInfo",e)}GetTargetClusterUsage(e){return this._connection.send("GetTargetClusterUsage",e)}Ping(e){return this._connection.send("Ping",e)}UpdateComponentStatus(e){return this._connection.send("UpdateComponentStatus",e)}};var k=class extends mt{GetTargetClusterUsageEx(e,t=!1){return this._connection.send("GetTargetClusterUsage",{TargetClusters:e?{Item:e}:{},BypassCachedResult:t}).then(s=>(0,cn.exists)("TargetClusterUsages.TargetClusterUsage",s)?s.TargetClusterUsages.TargetClusterUsage:[]).then(s=>s.filter(n=>!!n.ComponentUsages).map(n=>{let i=n.ComponentUsages.ComponentUsage.map(o=>{let a=(o.MachineUsages&&o.MachineUsages.MachineUsage?o.MachineUsages.MachineUsage:[]).map(c=>{let p=c.DiskUsages&&c.DiskUsages.DiskUsage?c.DiskUsages.DiskUsage.map(u=>({...u,InUse:u.InUse*1024,Total:(u.InUse+u.Available)*1024,PercentUsed:100-u.PercentAvailable})):[];return{Name:c.Name,NetAddress:c.NetAddress,Description:c.Description,DiskUsages:p,mean:(0,j.mean)(p.filter(u=>!isNaN(u.PercentUsed)),u=>u.PercentUsed),max:(0,j.max)(p.filter(u=>!isNaN(u.PercentUsed)),u=>u.PercentUsed)}});return{Type:o.Type,Name:o.Name,Description:o.Description,MachineUsages:a,MachineUsagesDescription:a.reduce((c,p)=>c+(p.Description||""),""),mean:(0,j.mean)(a.filter(c=>!isNaN(c.mean)),c=>c.mean),max:(0,j.max)(a.filter(c=>!isNaN(c.max)),c=>c.max)}});return{Name:n.Name,Description:n.Description,ComponentUsages:i,ComponentUsagesDescription:i.reduce((o,a)=>o+(a.MachineUsagesDescription||""),""),mean:(0,j.mean)(i.filter(o=>!isNaN(o.mean)),o=>o.mean),max:(0,j.max)(i.filter(o=>!isNaN(o.max)),o=>o.max)}}))}};var ht=class extends h{constructor(e){super(e,"WsPackageProcess","1.04")}ActivatePackage(e){return this._connection.send("ActivatePackage",e)}AddPackage(e){return this._connection.send("AddPackage",e)}AddPartToPackageMap(e){return this._connection.send("AddPartToPackageMap",e)}CopyPackageMap(e){return this._connection.send("CopyPackageMap",e)}DeActivatePackage(e){return this._connection.send("DeActivatePackage",e)}DeletePackage(e){return this._connection.send("DeletePackage",e)}Echo(e){return this._connection.send("Echo",e)}GetPackage(e){return this._connection.send("GetPackage",e)}GetPackageMapById(e){return this._connection.send("GetPackageMapById",e)}GetPackageMapSelectOptions(e){return this._connection.send("GetPackageMapSelectOptions",e)}GetPartFromPackageMap(e){return this._connection.send("GetPartFromPackageMap",e)}GetQueryFileMapping(e){return this._connection.send("GetQueryFileMapping",e)}ListPackage(e){return this._connection.send("ListPackage",e)}ListPackages(e){return this._connection.send("ListPackages",e)}Ping(e){return this._connection.send("Ping",e)}RemovePartFromPackageMap(e){return this._connection.send("RemovePartFromPackageMap",e)}ValidatePackage(e){return this._connection.send("ValidatePackage",e)}};var ds=class extends ht{};var ft=class extends h{constructor(e){super(e,"WsResources","1.01")}Ping(e){return this._connection.send("Ping",e)}ServiceQuery(e){return this._connection.send("ServiceQuery",e)}WebLinksQuery(e){return this._connection.send("WebLinksQuery",e)}};var ms=class extends ft{};var hs;(e=>{let r;(n=>(n.ECL="ECL",n.DFU="DFU"))(r=e.WUTypes||={})})(hs||={});var Dt=class extends h{constructor(e){super(e,"WSSasha","1.01")}ArchiveWU(e){return this._connection.send("ArchiveWU",e,"json",!1,void 0,"ResultResponse")}GetVersion(e){return this._connection.send("GetVersion",e,"json",!1,void 0,"ResultResponse")}ListWU(e){return this._connection.send("ListWU",e,"json",!1,void 0,"ResultResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WSSashaPingResponse")}RestoreWU(e){return this._connection.send("RestoreWU",e,"json",!1,void 0,"ResultResponse")}};var fs=class extends Dt{};var Ds;(t=>{let r;(c=>(c.ALL="ALL",c.READ="READ",c.WRITE="WRITE",c.HOLD="HOLD",c.SUB="SUB"))(r=t.LockModes||={});let e;(l=>(l.Attach="Attach",l.Detach="Detach",l.State="State",l.Reload="Reload",l.ReloadRetry="ReloadRetry",l.MemLock="MemLock",l.MemUnlock="MemUnlock",l.GetMemLocked="GetMemLocked"))(e=t.RoxieControlCmdType||={})})(Ds||={});var Ct=class extends h{constructor(e){super(e,"WsSMC","1.27")}Activity(e){return this._connection.send("Activity",e,"json",!1,void 0,"ActivityResponse")}BrowseResources(e){return this._connection.send("BrowseResources",e,"json",!1,void 0,"BrowseResourcesResponse")}ClearQueue(e){return this._connection.send("ClearQueue",e,"json",!1,void 0,"SMCQueueResponse")}GetBuildInfo(e){return this._connection.send("GetBuildInfo",e,"json",!1,void 0,"GetBuildInfoResponse")}GetStatusServerInfo(e){return this._connection.send("GetStatusServerInfo",e,"json",!1,void 0,"GetStatusServerInfoResponse")}GetThorQueueAvailability(e){return this._connection.send("GetThorQueueAvailability",e,"json",!1,void 0,"GetThorQueueAvailabilityResponse")}Index(e){return this._connection.send("Index",e,"json",!1,void 0,"SMCIndexResponse")}LockQuery(e){return this._connection.send("LockQuery",e,"json",!1,void 0,"LockQueryResponse")}MoveJobBack(e){return this._connection.send("MoveJobBack",e,"json",!1,void 0,"SMCJobResponse")}MoveJobDown(e){return this._connection.send("MoveJobDown",e,"json",!1,void 0,"SMCJobResponse")}MoveJobFront(e){return this._connection.send("MoveJobFront",e,"json",!1,void 0,"SMCJobResponse")}MoveJobUp(e){return this._connection.send("MoveJobUp",e,"json",!1,void 0,"SMCJobResponse")}NotInCommunityEdition(e){return this._connection.send("NotInCommunityEdition",e,"json",!1,void 0,"NotInCommunityEditionResponse")}PauseQueue(e){return this._connection.send("PauseQueue",e,"json",!1,void 0,"SMCQueueResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsSMCPingResponse")}RemoveJob(e){return this._connection.send("RemoveJob",e,"json",!1,void 0,"SMCJobResponse")}ResumeQueue(e){return this._connection.send("ResumeQueue",e,"json",!1,void 0,"SMCQueueResponse")}RoxieControlCmd(e){return this._connection.send("RoxieControlCmd",e,"json",!1,void 0,"RoxieControlCmdResponse")}RoxieXrefCmd(e){return this._connection.send("RoxieXrefCmd",e,"json",!1,void 0,"RoxieXrefCmdResponse")}SetBanner(e){return this._connection.send("SetBanner",e,"json",!1,void 0,"SetBannerResponse")}SetJobPriority(e){return this._connection.send("SetJobPriority",e,"json",!1,void 0,"SMCPriorityResponse")}StopQueue(e){return this._connection.send("StopQueue",e,"json",!1,void 0,"SMCQueueResponse")}};var de=class extends Ct{connectionOptions(){return this._connection.opts()}Activity(e){return super.Activity(e).then(t=>({Running:{ActiveWorkunit:[]},...t}))}};var me=class extends h{constructor(e){super(e,"WsStore","1")}CreateStore(e){return this._connection.send("Fetch",e)}Delete(e){return this._connection.send("Delete",e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(s=>s.Code===-1))return{Exceptions:void 0,Success:!0};throw t})}DeleteNamespace(e){return this._connection.send("DeleteNamespace",e)}Fetch(e){return this._connection.send("Fetch",e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(s=>s.Code===-1))return{Exceptions:void 0,Value:void 0};throw t})}FetchAll(e){return this._connection.send("FetchAll",e)}FetchKeyMD(e){return this._connection.send("FetchKeyMD",e)}ListKeys(e){return this._connection.send("ListKeys",e)}ListNamespaces(e){return this._connection.send("ListNamespaces",e)}Set(e){return this._connection.send("Set",e)}};var Cs;(e=>{let r;(i=>(i.All="All",i.QueriesOnly="QueriesOnly",i.WorkunitsOnly="WorkunitsOnly"))(r=e.RoxieQueueFilter||={})})(Cs||={});var St=class extends h{constructor(e){super(e,"WsTopology","1.32")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsTopologyPingResponse")}SystemLog(e){return this._connection.send("SystemLog",e,"json",!1,void 0,"SystemLogResponse")}TpClusterInfo(e){return this._connection.send("TpClusterInfo",e,"json",!1,void 0,"TpClusterInfoResponse")}TpClusterQuery(e){return this._connection.send("TpClusterQuery",e,"json",!1,void 0,"TpClusterQueryResponse")}TpDropZoneQuery(e){return this._connection.send("TpDropZoneQuery",e,"json",!1,void 0,"TpDropZoneQueryResponse")}TpGetComponentFile(e){return this._connection.send("TpGetComponentFile",e,"json",!1,void 0,"TpGetComponentFileResponse")}TpGetServicePlugins(e){return this._connection.send("TpGetServicePlugins",e,"json",!1,void 0,"TpGetServicePluginsResponse")}TpGroupQuery(e){return this._connection.send("TpGroupQuery",e,"json",!1,void 0,"TpGroupQueryResponse")}TpListLogFiles(e){return this._connection.send("TpListLogFiles",e,"json",!1,void 0,"TpListLogFilesResponse")}TpListTargetClusters(e){return this._connection.send("TpListTargetClusters",e,"json",!1,void 0,"TpListTargetClustersResponse")}TpLogFile(e){return this._connection.send("TpLogFile",e,"json",!1,void 0,"TpLogFileResponse")}TpLogFileDisplay(e){return this._connection.send("TpLogFileDisplay",e,"json",!1,void 0,"TpLogFileResponse")}TpLogicalClusterQuery(e){return this._connection.send("TpLogicalClusterQuery",e,"json",!1,void 0,"TpLogicalClusterQueryResponse")}TpMachineInfo(e){return this._connection.send("TpMachineInfo",e,"json",!1,void 0,"TpMachineInfoResponse")}TpMachineQuery(e){return this._connection.send("TpMachineQuery",e,"json",!1,void 0,"TpMachineQueryResponse")}TpServiceQuery(e){return this._connection.send("TpServiceQuery",e,"json",!1,void 0,"TpServiceQueryResponse")}TpSetMachineStatus(e){return this._connection.send("TpSetMachineStatus",e,"json",!1,void 0,"TpSetMachineStatusResponse")}TpSwapNode(e){return this._connection.send("TpSwapNode",e,"json",!1,void 0,"TpSwapNodeResponse")}TpTargetClusterQuery(e){return this._connection.send("TpTargetClusterQuery",e,"json",!1,void 0,"TpTargetClusterQueryResponse")}TpThorStatus(e){return this._connection.send("TpThorStatus",e,"json",!1,void 0,"TpThorStatusResponse")}TpXMLFile(e){return this._connection.send("TpXMLFile",e,"json",!1,void 0,"TpXMLFileResponse")}};var W=class extends St{connectionOptions(){return this._connection.opts()}protocol(){return this._connection.opts().baseUrl.split("//")[0]}ip(){return this._connection.opts().baseUrl.split("//")[1].split(":")[0]}DefaultTpLogicalClusterQuery(e={}){return this.TpLogicalClusterQuery(e).then(t=>{if(t.default)return t.default;let s,n;return t.TpLogicalClusters.TpLogicalCluster.some((i,o)=>(o===0&&(n=i),i.Type==="hthor"?(s=i,!0):!1)),s||n})}};var Rt=require("@hpcc-js/util");var U;(D=>{let r;(w=>(w.Abort="Abort",w.Delete="Delete",w.Deschedule="Deschedule",w.Reschedule="Reschedule",w.Pause="Pause",w.PauseNow="PauseNow",w.Protect="Protect",w.Unprotect="Unprotect",w.Restore="Restore",w.Resume="Resume",w.SetToFailed="SetToFailed",w.Archive="Archive"))(r=D.ECLWUActions||={});let e;(R=>(R[R.MIN=0]="MIN",R[R.DEFAULT=1]="DEFAULT",R[R.ALL=2]="ALL",R[R.CUSTOM=3]="CUSTOM"))(e=D.LogSelectColumnMode||={});let t;(m=>(m[m.ASC=0]="ASC",m[m.DSC=1]="DSC"))(t=D.SortDirection||={});let s;(A=>(A.ALL="ALL",A.DIS="DIS",A.ERR="ERR",A.WRN="WRN",A.INF="INF",A.PRO="PRO",A.MET="MET",A.EVT="EVT"))(s=D.LogEventClass||={});let n;(d=>(d.Single="Single",d.List="List",d.Multi="Multi"))(n=D.WUDetailsAttrValueType||={});let i;(d=>(d.SyntaxCheck="SyntaxCheck",d.Deploy="Deploy",d.Publish="Publish"))(i=D.EclDefinitionActions||={});let o;(d=>(d.xml="xml",d.json="json",d.text="text"))(o=D.ErrorMessageFormat||={});let a;(d=>(d[d.XML=0]="XML",d[d.JSON=1]="JSON",d[d.CSV=2]="CSV"))(a=D.LogAccessLogFormat||={});let c;(R=>(R.info="info",R.warning="warning",R.error="error",R.alert="alert"))(c=D.WUExceptionSeverity||={});let p;(ue=>(ue.Allqueries="All queries",ue.Notsuspended="Not suspended",ue.Suspended="Suspended",ue.Suspendedbyuser="Suspended by user",ue.Suspendedbyfirstnode="Suspended by first node",ue.Suspendedbyanynode="Suspended by any node"))(p=D.WUQueryFilterSuspendedType||={});let u;(Ee=>(Ee.All="All",Ee.Id="Id",Ee.Name="Name",Ee.Alias="Alias",Ee.Status="Status"))(u=D.WUQuerySetFilterType||={});let l;(d=>(d.All="All",d.Protected="Protected",d.NotProtected="NotProtected"))(l=D.WUProtectFilter||={});let g;(Bn=>Bn.Deactivate="Deactivate")(g=D.QuerySetAliasActionTypes||={});let f;(m=>(m.None="None",m.ActivateImportedActive="ActivateImportedActive"))(f=D.QuerysetImportActivation||={});let E;(A=>(A.Suspend="Suspend",A.Unsuspend="Unsuspend",A.ToggleSuspend="ToggleSuspend",A.Activate="Activate",A.Delete="Delete",A.DeleteQueriesAndWUs="DeleteQueriesAndWUs",A.RemoveAllAliases="RemoveAllAliases",A.ResetQueryStats="ResetQueryStats"))(E=D.QuerySetQueryActionTypes||={});let ss;(R=>(R[R.DoNotActivateQuery=0]="DoNotActivateQuery",R[R.ActivateQuery=1]="ActivateQuery",R[R.ActivateQuerySuspendPrevious=2]="ActivateQuerySuspendPrevious",R[R.ActivateQueryDeletePrevious=3]="ActivateQueryDeletePrevious"))(ss=D.WUQueryActivationMode||={})})(U||={});var Pe=class extends h{constructor(e){super(e,"WsWorkunits","2.02")}GVCAjaxGraph(e){return this._connection.send("GVCAjaxGraph",e,"json",!1,void 0,"GVCAjaxGraphResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsWorkunitsPingResponse")}WUAbort(e){return this._connection.send("WUAbort",e,"json",!1,void 0,"WUAbortResponse")}WUAction(e){return this._connection.send("WUAction",e,"json",!1,void 0,"WUActionResponse")}WUAddLocalFileToWorkunit(e){return this._connection.send("WUAddLocalFileToWorkunit",e,"json",!1,void 0,"WUAddLocalFileToWorkunitResponse")}WUAnalyseHotspot(e){return this._connection.send("WUAnalyseHotspot",e,"json",!1,void 0,"WUAnalyseHotspotResponse")}WUCDebug(e){return this._connection.send("WUCDebug",e,"json",!1,void 0,"WUDebugResponse")}WUCheckFeatures(e){return this._connection.send("WUCheckFeatures",e,"json",!1,void 0,"WUCheckFeaturesResponse")}WUClusterJobQueueLOG(e){return this._connection.send("WUClusterJobQueueLOG",e,"json",!1,void 0,"WUClusterJobQueueLOGResponse")}WUClusterJobQueueXLS(e){return this._connection.send("WUClusterJobQueueXLS",e,"json",!1,void 0,"WUClusterJobQueueXLSResponse")}WUClusterJobSummaryXLS(e){return this._connection.send("WUClusterJobSummaryXLS",e,"json",!1,void 0,"WUClusterJobSummaryXLSResponse")}WUClusterJobXLS(e){return this._connection.send("WUClusterJobXLS",e,"json",!1,void 0,"WUClusterJobXLSResponse")}WUCompileECL(e){return this._connection.send("WUCompileECL",e,"json",!1,void 0,"WUCompileECLResponse")}WUCopyLogicalFiles(e){return this._connection.send("WUCopyLogicalFiles",e,"json",!1,void 0,"WUCopyLogicalFilesResponse")}WUCopyQuerySet(e){return this._connection.send("WUCopyQuerySet",e,"json",!1,void 0,"WUCopyQuerySetResponse")}WUCreate(e){return this._connection.send("WUCreate",e,"json",!1,void 0,"WUCreateResponse")}WUCreateAndUpdate(e){return this._connection.send("WUCreateAndUpdate",e,"json",!1,void 0,"WUUpdateResponse")}WUCreateZAPInfo(e){return this._connection.send("WUCreateZAPInfo",e,"json",!1,void 0,"WUCreateZAPInfoResponse")}WUDelete(e){return this._connection.send("WUDelete",e,"json",!1,void 0,"WUDeleteResponse")}WUDeployWorkunit(e){return this._connection.send("WUDeployWorkunit",e,"json",!1,void 0,"WUDeployWorkunitResponse")}WUDetails(e){return this._connection.send("WUDetails",e,"json",!1,void 0,"WUDetailsResponse")}WUDetailsMeta(e){return this._connection.send("WUDetailsMeta",e,"json",!1,void 0,"WUDetailsMetaResponse")}WUEclDefinitionAction(e){return this._connection.send("WUEclDefinitionAction",e,"json",!1,void 0,"WUEclDefinitionActionResponse")}WUExport(e){return this._connection.send("WUExport",e,"json",!1,void 0,"WUExportResponse")}WUFile(e){return this._connection.send("WUFile",e,"json",!1,void 0,"WULogFileResponse")}WUFullResult(e){return this._connection.send("WUFullResult",e,"json",!1,void 0,"WUFullResultResponse")}WUGVCGraphInfo(e){return this._connection.send("WUGVCGraphInfo",e,"json",!1,void 0,"WUGVCGraphInfoResponse")}WUGetArchiveFile(e){return this._connection.send("WUGetArchiveFile",e,"json",!1,void 0,"WUGetArchiveFileResponse")}WUGetDependancyTrees(e){return this._connection.send("WUGetDependancyTrees",e,"json",!1,void 0,"WUGetDependancyTreesResponse")}WUGetGraph(e){return this._connection.send("WUGetGraph",e,"json",!1,void 0,"WUGetGraphResponse")}WUGetGraphNameAndTypes(e){return this._connection.send("WUGetGraphNameAndTypes",e,"json",!1,void 0,"WUGetGraphNameAndTypesResponse")}WUGetNumFileToCopy(e){return this._connection.send("WUGetNumFileToCopy",e,"json",!1,void 0,"WUGetNumFileToCopyResponse")}WUGetPlugins(e){return this._connection.send("WUGetPlugins",e,"json",!1,void 0,"WUGetPluginsResponse")}WUGetStats(e){return this._connection.send("WUGetStats",e,"json",!1,void 0,"WUGetStatsResponse")}WUGetThorJobList(e){return this._connection.send("WUGetThorJobList",e,"json",!1,void 0,"WUGetThorJobListResponse")}WUGetThorJobQueue(e){return this._connection.send("WUGetThorJobQueue",e,"json",!1,void 0,"WUGetThorJobQueueResponse")}WUGetZAPInfo(e){return this._connection.send("WUGetZAPInfo",e,"json",!1,void 0,"WUGetZAPInfoResponse")}WUGraphInfo(e){return this._connection.send("WUGraphInfo",e,"json",!1,void 0,"WUGraphInfoResponse")}WUGraphTiming(e){return this._connection.send("WUGraphTiming",e,"json",!1,void 0,"WUGraphTimingResponse")}WUInfo(e){return this._connection.send("WUInfo",e,"json",!1,void 0,"WUInfoResponse")}WUInfoDetails(e){return this._connection.send("WUInfoDetails",e,"json",!1,void 0,"WUInfoResponse")}WUJobList(e){return this._connection.send("WUJobList",e,"json",!1,void 0,"WUJobListResponse")}WULightWeightQuery(e){return this._connection.send("WULightWeightQuery",e,"json",!1,void 0,"WULightWeightQueryResponse")}WUListArchiveFiles(e){return this._connection.send("WUListArchiveFiles",e,"json",!1,void 0,"WUListArchiveFilesResponse")}WUListLocalFileRequired(e){return this._connection.send("WUListLocalFileRequired",e,"json",!1,void 0,"WUListLocalFileRequiredResponse")}WUListQueries(e){return this._connection.send("WUListQueries",e,"json",!1,void 0,"WUListQueriesResponse")}WUListQueriesUsingFile(e){return this._connection.send("WUListQueriesUsingFile",e,"json",!1,void 0,"WUListQueriesUsingFileResponse")}WUMultiQuerysetDetails(e){return this._connection.send("WUMultiQuerysetDetails",e,"json",!1,void 0,"WUMultiQuerySetDetailsResponse")}WUProcessGraph(e){return this._connection.send("WUProcessGraph",e,"json",!1,void 0,"WUProcessGraphResponse")}WUProtect(e){return this._connection.send("WUProtect",e,"json",!1,void 0,"WUProtectResponse")}WUPublishWorkunit(e){return this._connection.send("WUPublishWorkunit",e,"json",!1,void 0,"WUPublishWorkunitResponse")}WUPushEvent(e){return this._connection.send("WUPushEvent",e,"json",!1,void 0,"WUPushEventResponse")}WUQuery(e){return this._connection.send("WUQuery",e,"json",!1,void 0,"WUQueryResponse")}WUQueryConfig(e){return this._connection.send("WUQueryConfig",e,"json",!1,void 0,"WUQueryConfigResponse")}WUQueryDetails(e){return this._connection.send("WUQueryDetails",e,"json",!1,void 0,"WUQueryDetailsResponse")}WUQueryDetailsLightWeight(e){return this._connection.send("WUQueryDetailsLightWeight",e,"json",!1,void 0,"WUQueryDetailsResponse")}WUQueryFiles(e){return this._connection.send("WUQueryFiles",e,"json",!1,void 0,"WUQueryFilesResponse")}WUQueryGetGraph(e){return this._connection.send("WUQueryGetGraph",e,"json",!1,void 0,"WUQueryGetGraphResponse")}WUQueryGetSummaryStats(e){return this._connection.send("WUQueryGetSummaryStats",e,"json",!1,void 0,"WUQueryGetSummaryStatsResponse")}WUQuerysetAliasAction(e){return this._connection.send("WUQuerysetAliasAction",e,"json",!1,void 0,"WUQuerySetAliasActionResponse")}WUQuerysetCopyQuery(e){return this._connection.send("WUQuerysetCopyQuery",e,"json",!1,void 0,"WUQuerySetCopyQueryResponse")}WUQuerysetDetails(e){return this._connection.send("WUQuerysetDetails",e,"json",!1,void 0,"WUQuerySetDetailsResponse")}WUQuerysetExport(e){return this._connection.send("WUQuerysetExport",e,"json",!1,void 0,"WUQuerysetExportResponse")}WUQuerysetImport(e){return this._connection.send("WUQuerysetImport",e,"json",!1,void 0,"WUQuerysetImportResponse")}WUQuerysetQueryAction(e){return this._connection.send("WUQuerysetQueryAction",e,"json",!1,void 0,"WUQuerySetQueryActionResponse")}WUQuerysets(e){return this._connection.send("WUQuerysets",e,"json",!1,void 0,"WUQuerysetsResponse")}WURecreateQuery(e){return this._connection.send("WURecreateQuery",e,"json",!1,void 0,"WURecreateQueryResponse")}WUResubmit(e){return this._connection.send("WUResubmit",e,"json",!1,void 0,"WUResubmitResponse")}WUResult(e){return this._connection.send("WUResult",e,"json",!1,void 0,"WUResultResponse")}WUResultBin(e){return this._connection.send("WUResultBin",e,"json",!1,void 0,"WUResultBinResponse")}WUResultSummary(e){return this._connection.send("WUResultSummary",e,"json",!1,void 0,"WUResultSummaryResponse")}WUResultView(e){return this._connection.send("WUResultView",e,"json",!1,void 0,"WUResultViewResponse")}WURun(e){return this._connection.send("WURun",e,"json",!1,void 0,"WURunResponse")}WUSchedule(e){return this._connection.send("WUSchedule",e,"json",!1,void 0,"WUScheduleResponse")}WUShowScheduled(e){return this._connection.send("WUShowScheduled",e,"json",!1,void 0,"WUShowScheduledResponse")}WUSubmit(e){return this._connection.send("WUSubmit",e,"json",!1,void 0,"WUSubmitResponse")}WUSyntaxCheckECL(e){return this._connection.send("WUSyntaxCheckECL",e,"json",!1,void 0,"WUSyntaxCheckResponse")}WUUpdate(e){return this._connection.send("WUUpdate",e,"json",!1,void 0,"WUUpdateResponse")}WUUpdateQueryEntry(e){return this._connection.send("WUUpdateQueryEntry",e,"json",!1,void 0,"WUUpdateQueryEntryResponse")}WUWaitCompiled(e){return this._connection.send("WUWaitCompiled",e,"json",!1,void 0,"WUWaitResponse")}WUWaitComplete(e){return this._connection.send("WUWaitComplete",e,"json",!1,void 0,"WUWaitResponse")}};var xt=(m=>(m[m.Unknown=0]="Unknown",m[m.Compiled=1]="Compiled",m[m.Running=2]="Running",m[m.Completed=3]="Completed",m[m.Failed=4]="Failed",m[m.Archived=5]="Archived",m[m.Aborting=6]="Aborting",m[m.Aborted=7]="Aborted",m[m.Blocked=8]="Blocked",m[m.Submitted=9]="Submitted",m[m.Scheduled=10]="Scheduled",m[m.Compiling=11]="Compiling",m[m.Wait=12]="Wait",m[m.UploadingFiled=13]="UploadingFiled",m[m.DebugPaused=14]="DebugPaused",m[m.DebugRunning=15]="DebugRunning",m[m.Paused=16]="Paused",m[m.LAST=17]="LAST",m[m.NotFound=999]="NotFound",m))(xt||{}),O;(e=>{let r;(g=>(g[g.Unknown=0]="Unknown",g[g.Compile=1]="Compile",g[g.Check=2]="Check",g[g.Run=3]="Run",g[g.ExecuteExisting=4]="ExecuteExisting",g[g.Pause=5]="Pause",g[g.PauseNow=6]="PauseNow",g[g.Resume=7]="Resume",g[g.Debug=8]="Debug",g[g.__size=9]="__size"))(r=e.Action||={})})(O||={});function Ss(r){return typeof r.Name=="string"}function ar(r){return r.TotalClusterTime!==void 0}function cr(r){return r.StateEx!==void 0}var x=class extends Pe{constructor(e){super(e)}Ping(){return this._connection.send("Ping",{},"json",!1,void 0,"WsWorkunitsPingResponse").then(()=>({result:!0}))}WUQuery(e={},t){return this._connection.send("WUQuery",e,"json",!1,t).then(s=>(0,Rt.deepMixin)({Workunits:{ECLWorkunit:[]}},s))}WUInfo(e){let t={Wuid:"",TruncateEclTo64k:!0,IncludeExceptions:!1,IncludeGraphs:!1,IncludeSourceFiles:!1,IncludeResults:!1,IncludeResultsViewNames:!1,IncludeVariables:!1,IncludeTimers:!1,IncludeDebugValues:!1,IncludeApplicationValues:!1,IncludeWorkflows:!1,IncludeXmlSchemas:!1,IncludeResourceURLs:!1,IncludeECL:!1,IncludeHelpers:!1,IncludeAllowedClusters:!1,IncludeTotalClusterTime:!1,IncludeServiceNames:!1,SuppressResultSchemas:!0,...e};return super.WUInfo(t)}WUCreate(){return super.WUCreate({})}WUUpdate(e){return this._connection.send("WUUpdate",e,"json",!0)}WUResubmit(e){return this._connection.toESPStringArray(e,"Wuids"),super.WUResubmit(e)}WUAction(e){return e.ActionType=e.WUActionType,super.WUAction(e)}WUResult(e,t){return this._connection.send("WUResult",e,"json",!1,t)}WUFileEx(e){return this._connection.send("WUFile",e,"text")}_WUDetailsMetaPromise;WUDetailsMeta(e){return this._WUDetailsMetaPromise||(this._WUDetailsMetaPromise=super.WUDetailsMeta(e)),this._WUDetailsMetaPromise}WUCDebugEx(e){return this._connection.send("WUCDebug",e,void 0,void 0,void 0,"WUDebug").then(t=>{let n=(0,Rt.xml2json)(t.Result).children();return n.length?n[0]:null})}},Ie=class extends Pe{WUPublishWorkunitEx(e){return this._connection.send("WUPublishWorkunit",e)}};var Nt=require("@hpcc-js/util");var T=require("@hpcc-js/util"),hn=require("d3-format"),Bt=require("d3-time-format");var y=require("@hpcc-js/util"),Te=class extends y.StateObject{wu;get properties(){return this.get()}get Name(){return this.get("Name")}get Label(){return this.get("Label")}get Type(){return this.get("Type")}get Complete(){return this.get("Complete")}get WhenStarted(){return this.get("WhenStarted")}get WhenFinished(){return this.get("WhenFinished")}get Time(){return this.get("Time")}get Running(){return this.get("Running")}get RunningId(){return this.get("RunningId")}get Failed(){return this.get("Failed")}constructor(e,t,s){super(),this.wu=e;let n=0;for(let i of s)if(i.GraphName===t.Name&&!i.HasSubGraphId){n=Math.round(i.Seconds*1e3)/1e3;break}this.set({Time:n,...t})}fetchScopeGraph(e){return e?this.wu.fetchGraphDetails([e],["subgraph"]).then(t=>we(t)):this.wu.fetchGraphDetails([this.Name],["graph"]).then(t=>we(t))}},Me=class extends y.Cache{constructor(){super(e=>y.Cache.hash([e.Name]))}};function ln(r,e,t){t=t||[],t.push(r),e(r.name,r.$,r.children(),t),r.children().forEach(s=>{ln(s,e,t)}),t.pop()}function Rs(r){let e={};return r.forEach(t=>{t.name==="att"&&(e[t.$.name]=t.$.value)}),e}var At=class extends y.Graph{},xs=class extends y.Subgraph{},As=class extends y.Vertex{},Ws=class extends y.Edge{};function Fs(r,e){let t={},s={},n={},i=new At(a=>a._.id),o=[i.root];return ln(e,(a,c,p,u)=>{let l=o[o.length-1];switch(a){case"graph":break;case"node":if(p.length&&p[0].children().length&&p[0].children()[0].name==="graph"){let E=l.createSubgraph(Rs(p));o.push(E),t[c.id]=E}let g=l.createVertex(Rs(p));s[c.id]=g;break;case"edge":let f=l.createEdge(s[c.source],s[c.target],Rs(p));n[c.id]=f;break;default:}}),i}var Be=class extends y.Graph{},ys=class extends y.Subgraph{},Es=class extends y.Vertex{},Us=class extends y.Edge{};function we(r){let e={},t={},s={},n;for(let i of r)switch(i.ScopeType){case"graph":n=new Be(u=>u._.Id,i),e[i.ScopeName]=n.root;break;case"subgraph":n||(n=new Be(u=>u._.Id,i),e[i.ScopeName]=n.root);let o=i.parentScope().split(":"),a=e[i.parentScope()];for(;o.length&&!a;)a=e[o.join(":")],o.pop();if(!a)console.warn(`Missing SG:Parent (${i.Id}): ${i.parentScope()}`);else{let u=a;e[i.ScopeName]=u.createSubgraph(i)}break;case"activity":let c=e[i.parentScope()];c?s[i.ScopeName]=c.createVertex(i):console.warn(`Missing A:Parent (${i.Id}): ${i.parentScope()}`);break;case"edge":t[i.ScopeName]=i;break;case"function":let p=s[i.parentScope()];p?p._.children().push(i):console.warn(`Missing F:Parent (${i.Id}): ${i.parentScope()}`);break}for(let i in t){let o=t[i],a=e[o.parentScope()];if(!a)console.warn(`Missing E:Parent (${o.Id}): ${o.parentScope()}`);else{let c=a;try{let p=n.vertex(o.attr("IdSource").RawValue),u=n.vertex(o.attr("IdTarget").RawValue);c.createEdge(p,u,o)}catch{console.warn(`Invalid Edge: ${i}`)}}}return n}var pn=require("@hpcc-js/util"),Ne=class extends pn.StateObject{wu;get properties(){return this.get()}get URL(){return this.get("URL")}get DisplayName(){return this.get("DisplayName")}get DisplayPath(){return this.get("DisplayPath")}constructor(e,t){super(),this.wu=e;let s=t.split("\\").join("/"),n=s.split("/"),i="res/"+this.wu.Wuid+"/",o="",a="";s.indexOf(i)===0&&(o=s.substr(i.length),a=n[n.length-1]),this.set({URL:t,DisplayName:a,DisplayPath:o})}};var L=require("@hpcc-js/util");var ve=require("@hpcc-js/util"),Qe=class{e;constructor(e){this.e=e}fix(){delete this.e}},Le=class extends Qe{name;type;isSet=!1;attrs={};_children=[];constructor(e){super(e)}append(e){this._children.push(e),this.type||(this.type="hpcc:childDataset")}fix(){this.name=this.e.$.name,this.type=this.e.$.type;for(let t=this._children.length-1;t>=0;--t){let s=this._children[t];s.name==="Row"&&s.type===void 0&&(this._children.push(...s._children),this._children.splice(t,1))}let e=this.setOfType();e&&(this.type=e,this.isSet=!0,this._children=[])}children(){return this._children}isAll(e){return e.name==="All"&&e.type===void 0}setOfType(){let e=this.children();if(this.type===void 0&&e.length===2){if(this.isAll(e[0]))return e[1].type;if(this.isAll(e[1]))return e[0].type}}charWidth(){let e=-1;switch(this.type){case"xs:boolean":e=5;break;case"xs:integer":e=8;break;case"xs:nonNegativeInteger":e=8;break;case"xs:double":e=8;break;case"xs:string":e=32;break;default:let t="0123456789",s=this.type.lastIndexOf("_"),n=s>0?s:this.type.length,i=n-1;for(;i>=0&&t.indexOf(this.type.charAt(i))!==-1;--i);i+1<n&&(e=parseInt(this.type.substring(i+1,n),10)),this.type.indexOf("data")===0&&(e*=2);break}return e<this.name.length&&(e=this.name.length),e}},Ge=class extends Qe{name;type;maxLength;_restricition;_maxLength;constructor(e){super(e)}append(e){switch(e.name){case"xs:restriction":this._restricition=e;break;case"xs:maxLength":this._maxLength=e;break;default:}}fix(){this.name=this.e.$.name,this.type=this._restricition.$.base,this.maxLength=this._maxLength?+this._maxLength.$.value:void 0,delete this._restricition,delete this._maxLength,super.fix()}},ke=class{root;simpleTypes={};fields(){return this.root.children()}},Wt=class extends ve.SAXStackParser{schema=new ke;simpleType;simpleTypes={};xsdStack=new ve.Stack;startXMLNode(e){switch(super.startXMLNode(e),e.name){case"xs:element":let t=new Le(e);this.schema.root?this.xsdStack.depth()&&this.xsdStack.top().append(t):this.schema.root=t,this.xsdStack.push(t);break;case"xs:simpleType":this.simpleType=new Ge(e);break;default:break}}endXMLNode(e){switch(e.name){case"xs:element":this.xsdStack.pop().fix();break;case"xs:simpleType":this.simpleType.fix(),this.simpleTypes[this.simpleType.name]=this.simpleType,delete this.simpleType;break;case"xs:appinfo":let s=this.xsdStack.top();for(let n in e.$)s.attrs[n]=e.$[n];break;default:this.simpleType&&this.simpleType.append(e)}super.endXMLNode(e)}};function yt(r){let e=new Wt;return e.parse(r),e.schema}var bs=class extends Wt{_rootName;schema=new ke;simpleTypes={};xsdStack=new ve.Stack;constructor(e){super(),this._rootName=e}startXMLNode(e){switch(super.startXMLNode(e),e.name){case"xsd:element":let t=new Le(e);!this.schema.root&&this._rootName===e.$.name&&(this.schema.root=t),this.xsdStack.depth()&&this.xsdStack.top().append(t),this.xsdStack.push(t);break;case"xsd:simpleType":this.simpleType=new Ge(e);break;default:break}}endXMLNode(e){switch(e.name){case"xsd:element":this.xsdStack.pop().fix();break;case"xsd:simpleType":break;default:break}super.endXMLNode(e)}};function ur(r,e){let t=new bs(e);return t.parse(r),t.schema}var Ut=class extends L.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}-${e.ResultName}`)}},Et=new Ut,Ve=class r extends L.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}xsdSchema;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get ResultName(){return this.get("ResultName")}get ResultSequence(){return this.get("ResultSequence")}get LogicalFileName(){return this.get("LogicalFileName")}get Name(){return this.get("Name")}get Sequence(){return this.get("Sequence")}get Value(){return this.get("Value")}get Link(){return this.get("Link")}get FileName(){return this.get("FileName")}get IsSupplied(){return this.get("IsSupplied")}get ShowFileContent(){return this.get("ShowFileContent")}get Total(){return this.get("Total")}get ECLSchemas(){return this.get("ECLSchemas")}get NodeGroup(){return this.get("NodeGroup")}get ResultViews(){return this.get("ResultViews")}get XmlSchema(){return this.get("XmlSchema")}static attach(e,t,s,n){let i;return Array.isArray(n)?(i=Et.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:s.Name},()=>new r(e,t,s,n)),i.set(s)):typeof n>"u"&&(typeof s=="number"?i=Et.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:"Sequence_"+s},()=>new r(e,t,s)):typeof s=="string"&&(i=Et.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:s},()=>new r(e,t,s)))),i}static attachLogicalFile(e,t,s){return Et.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:s},()=>new r(e,t,s,!0))}constructor(e,t,s,n){super(),e instanceof x?this.connection=e:this.connection=new x(e),typeof n=="boolean"&&n===!0?this.set({NodeGroup:t,LogicalFileName:s}):Ss(s)&&Array.isArray(n)?this.set({...s,Wuid:t,ResultName:s.Name,ResultViews:n}):typeof n>"u"?typeof s=="number"?this.set({Wuid:t,ResultSequence:s}):typeof s=="string"?this.set({Wuid:t,ResultName:s}):console.warn("Unknown Result.attach (1)"):console.warn("Unknown Result.attach (2)")}isComplete(){return this.Total!==-1}_fetchXMLSchemaPromise;fetchXMLSchema(e=!1){return(!this._fetchXMLSchemaPromise||e)&&(this._fetchXMLSchemaPromise=this.WUResult().then(t=>t.Result?.XmlSchema?.xml?(this.xsdSchema=yt(t.Result.XmlSchema.xml),this.xsdSchema):null)),this._fetchXMLSchemaPromise}async refresh(){return await this.fetchRows(0,1,!0),this}fetchRows(e=0,t=-1,s=!1,n={},i){return this.WUResult(e,t,!s,n,i).then(o=>{let a=o.Result;return delete o.Result,this.set({...o}),(0,L.exists)("XmlSchema.xml",a)&&(this.xsdSchema=yt(a.XmlSchema.xml)),(0,L.exists)("Row",a)?a.Row:this.ResultName&&(0,L.exists)(this.ResultName,a)?a[this.ResultName].Row:[]})}rootField(){return this.xsdSchema?this.xsdSchema.root:null}fields(){return this.xsdSchema?this.xsdSchema.root.children():[]}WUResult(e=0,t=1,s=!1,n={},i){let o={NamedValue:{itemcount:0}};for(let c in n)o.NamedValue[o.NamedValue.itemcount++]={Name:c,Value:n[c]};let a={FilterBy:o};return this.Wuid&&this.ResultName!==void 0?(a.Wuid=this.Wuid,a.ResultName=this.ResultName):this.Wuid&&this.ResultSequence!==void 0?(a.Wuid=this.Wuid,a.Sequence=this.ResultSequence):this.LogicalFileName&&this.NodeGroup?(a.LogicalName=this.LogicalFileName,a.Cluster=this.NodeGroup):this.LogicalFileName&&(a.LogicalName=this.LogicalFileName),a.Start=e,a.Count=t,a.SuppressXmlSchema=s,this.connection.WUResult(a,i).then(c=>c)}},_e=class extends L.Cache{constructor(){super(e=>L.Cache.hash([e.Sequence,e.Name,e.Value,e.FileName]))}};var Ps=require("@hpcc-js/util"),Y=class extends Ps.StateObject{scope;get properties(){return this.get()}get Name(){return this.get("Name")}get RawValue(){return this.get("RawValue")}get Formatted(){return this.get("Formatted")}get FormattedEnd(){return this.get("FormattedEnd")}get Measure(){return this.get("Measure")}get Creator(){return this.get("Creator")}get CreatorType(){return this.get("CreatorType")}constructor(e,t){super(),this.scope=e,this.set(t)}},Ft=class extends Ps.StateObject{_attributeMap={};_children=[];get properties(){return this.get()}get ScopeName(){return this.get("ScopeName")}get Id(){return this.get("Id")}get ScopeType(){return this.get("ScopeType")}get Properties(){return this.get("Properties",{Property:[]})}get Notes(){return this.get("Notes",{Note:[]})}get SinkActivity(){return this.get("SinkActivity")}get CAttributes(){let e=[],t={start:null,end:null};return this.Properties.Property.forEach(s=>{s.Measure==="ts"&&s.Name.indexOf("Started")>=0?t.start=s:this.ScopeName&&s.Measure==="ts"&&s.Name.indexOf("Finished")>=0?t.end=s:e.push(new Y(this,s))}),t.start&&t.end?(t.start.FormattedEnd=t.end.Formatted,e.push(new Y(this,t.start))):t.start?e.push(new Y(this,t.start)):t.end&&e.push(new Y(this,t.end)),e}constructor(e){super(),this.update(e)}update(e){this.set(e),this.CAttributes.forEach(t=>{this._attributeMap[t.Name]=t}),this.Properties.Property=[];for(let t in this._attributeMap)this._attributeMap.hasOwnProperty(t)&&this.Properties.Property.push(this._attributeMap[t].properties)}parentScope(){let e=this.ScopeName.split(":");return e.pop(),e.join(":")}children(e){return arguments.length?(this._children=e,this):this._children}walk(e){if(e.start(this))return!0;for(let t of this.children())if(t.walk(e))return!0;return e.end(this)}formattedAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].Formatted||this._attributeMap[t].RawValue;return e}rawAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].RawValue;return e}hasAttr(e){return this._attributeMap[e]!==void 0}attr(e){return this._attributeMap[e]||new Y(this,{Creator:"",CreatorType:"",Formatted:"",Measure:"",Name:"",RawValue:""})}attrMeasure(e){return this._attributeMap[e].Measure}calcTooltip(e){let t="",s=[];t=this.Id,s.push(`<tr><td class="key">ID:</td><td class="value">${this.Id}</td></tr>`),e&&s.push(`<tr><td class="key">Parent ID:</td><td class="value">${e.Id}</td></tr>`),s.push(`<tr><td class="key">Scope:</td><td class="value">${this.ScopeName}</td></tr>`);let n=this.formattedAttrs();for(let i in n)i==="Label"?t=n[i]:s.push(`<tr><td class="key">${i}</td><td class="value">${n[i]}</td></tr>`);return`<div class="eclwatch_WUGraph_Tooltip" style="max-width:480px">
911
911
  <h4 align="center">${t}</h4>
912
912
  <table>
913
913
  ${s.join("")}
914
914
  </table>
915
- </div>`}},he=class extends Et{wu;constructor(e,t){super(t),this.wu=e}};var pn=require("@hpcc-js/util");var _e=class extends pn.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get FileCluster(){return this.get("FileCluster")}get Name(){return this.get("Name")}get IsSuperFile(){return this.get("IsSuperFile")}get Subs(){return this.get("Subs")}get Count(){return this.get("Count")}get ECLSourceFiles(){return this.get("ECLSourceFiles")}constructor(e,t,s){super(),e instanceof A?this.connection=e:this.connection=new A(e),this.set({Wuid:t,...s})}};var Ft=require("@hpcc-js/util");var He=class extends Ft.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get Name(){return this.get("Name")}get Value(){return this.get("Value")}get Seconds(){return this.get("Seconds")}get GraphName(){return this.get("GraphName")}get SubGraphId(){return this.get("SubGraphId")}get HasSubGraphId(){return this.get("HasSubGraphId")}get count(){return this.get("count")}get Timestamp(){return this.get("Timestamp")}get When(){return this.get("When")}constructor(e,t,s){super(),e instanceof A?this.connection=e:this.connection=new A(e);let n=(0,Ft.espTime2Seconds)(s.Value);this.set({Wuid:t,Seconds:Math.round(n*1e3)/1e3,HasSubGraphId:s.SubGraphId!==void 0,...s})}};var ir=(0,Mt.utcFormat)("%Y-%m-%dT%H:%M:%S.%LZ"),or=(0,Mt.utcParse)("%Y-%m-%dT%H:%M:%S.%LZ"),ar=(0,mn.format)(",");function cr(r){return r&&!isNaN(+r)?ar(+r):r}function gn(r,e,t){r[e]===void 0||r[e][t]===void 0||e==="__proto__"||e==="constructor"||e==="prototype"||delete r[e][t]}var je="DefinitionList",ur=/([a-zA-Z]:)?(.*[\\\/])(.*)(\((\d+),(\d+)\))/,hn=["Avg","Min","Max","Delta","StdDev"],fn=["SkewMin","SkewMax","NodeMin","NodeMax"],lr=/[A-Z][a-z]*/g;function pr(r){for(let t of fn){let s=r.indexOf(t);if(s===0){let n="",i=r.slice(s+t.length);return{measure:n,ext:t,label:i}}}let e=r.match(lr);if(e?.length){let t=e.shift(),s=e.join("");for(let n of hn){let i=s.indexOf(n);if(i===0)return s=s.slice(i+n.length),{measure:t,ext:n,label:s}}return{measure:t,ext:"",label:s}}return{measure:"",ext:"",label:r}}var dn={};function Dn(r){let e=dn[r];return e||(e=pr(r),dn[r]=e),e}function G(r,e){return r.__formattedProps?.[e]??r[e]}function bt(r){if(r===void 0)return;let e=parseFloat(r);return isNaN(e)?void 0:e}function gr(r,e,t){let s=Dn(e);if(!t[s.measure]){t[s.label]=!0;let n=bt(r[`${s.measure}Avg${s.label}`]),i=bt(r[`${s.measure}Min${s.label}`]),o=bt(r[`${s.measure}Max${s.label}`]),a=bt(r[`${s.measure}StdDev${s.label}`]),u=Math.max((n-i)/a,(o-n)/a);return{Key:`${s.measure}${s.label}`,Value:G(r,`${s.measure}${s.label}`),Avg:G(r,`${s.measure}Avg${s.label}`),Min:G(r,`${s.measure}Min${s.label}`),Max:G(r,`${s.measure}Max${s.label}`),Delta:G(r,`${s.measure}Delta${s.label}`),StdDev:G(r,`${s.measure}StdDev${s.label}`),StdDevs:isNaN(u)?void 0:u,SkewMin:G(r,`SkewMin${s.label}`),SkewMax:G(r,`SkewMax${s.label}`),NodeMin:G(r,`NodeMin${s.label}`),NodeMax:G(r,`NodeMax${s.label}`)}}return null}var Pt=(0,I.scopedLogger)("workunit.ts"),Tt=class extends I.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}`)}},It=new Tt,ee=class r extends I.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}_debugMode=!1;_debugAllGraph;_submitAction;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get Owner(){return this.get("Owner","")}get Cluster(){return this.get("Cluster","")}get Jobname(){return this.get("Jobname","")}get Description(){return this.get("Description","")}get ActionEx(){return this.get("ActionEx","")}get StateID(){return this.get("StateID",0)}get State(){return this.get("State")||Rt[this.StateID]}get Protected(){return this.get("Protected",!1)}get Exceptions(){return this.get("Exceptions",{ECLException:[]})}get ResultViews(){return this.get("ResultViews",{View:[]})}_resultCache=new Ve;get ResultCount(){return this.get("ResultCount",0)}get Results(){return this.get("Results",{ECLResult:[]})}get CResults(){return this.Results.ECLResult.map(e=>this._resultCache.get(e,()=>ve.attach(this.connection,this.Wuid,e,this.ResultViews.View)))}get SequenceResults(){let e={};return this.CResults.forEach(t=>{e[t.Sequence]=t}),e}get Timers(){return this.get("Timers",{ECLTimer:[]})}get CTimers(){return this.Timers.ECLTimer.map(e=>new He(this.connection,this.Wuid,e))}_graphCache=new Te;get GraphCount(){return this.get("GraphCount",0)}get Graphs(){return this.get("Graphs",{ECLGraph:[]})}get CGraphs(){return this.Graphs.ECLGraph.map(e=>this._graphCache.get(e,()=>new Ie(this,e,this.CTimers)))}get ThorLogList(){return this.get("ThorLogList")}get ResourceURLCount(){return this.get("ResourceURLCount",0)}get ResourceURLs(){return this.get("ResourceURLs",{URL:[]})}get CResourceURLs(){return this.ResourceURLs.URL.map(e=>new we(this,e))}get TotalClusterTime(){return this.get("TotalClusterTime","")}get DateTimeScheduled(){return this.get("DateTimeScheduled")}get IsPausing(){return this.get("IsPausing")}get ThorLCR(){return this.get("ThorLCR")}get ApplicationValues(){return this.get("ApplicationValues",{ApplicationValue:[]})}get HasArchiveQuery(){return this.get("HasArchiveQuery")}get StateEx(){return this.get("StateEx")}get PriorityClass(){return this.get("PriorityClass")}get PriorityLevel(){return this.get("PriorityLevel")}get Snapshot(){return this.get("Snapshot")}get ResultLimit(){return this.get("ResultLimit")}get EventSchedule(){return this.get("EventSchedule")}get Query(){return this.get("Query")}get HelpersCount(){return this.get("HelpersCount",0)}get Helpers(){return this.get("Helpers",{ECLHelpFile:[]})}get DebugValues(){return this.get("DebugValues")}get AllowedClusters(){return this.get("AllowedClusters")}get ErrorCount(){return this.get("ErrorCount",0)}get WarningCount(){return this.get("WarningCount",0)}get InfoCount(){return this.get("InfoCount",0)}get AlertCount(){return this.get("AlertCount",0)}get SourceFileCount(){return this.get("SourceFileCount",0)}get SourceFiles(){return this.get("SourceFiles",{ECLSourceFile:[]})}get CSourceFiles(){return this.SourceFiles.ECLSourceFile.map(e=>new _e(this.connection,this.Wuid,e))}get VariableCount(){return this.get("VariableCount",0)}get Variables(){return this.get("Variables",{ECLResult:[]})}get TimerCount(){return this.get("TimerCount",0)}get HasDebugValue(){return this.get("HasDebugValue")}get ApplicationValueCount(){return this.get("ApplicationValueCount",0)}get XmlParams(){return this.get("XmlParams")}get AccessFlag(){return this.get("AccessFlag")}get ClusterFlag(){return this.get("ClusterFlag")}get ResultViewCount(){return this.get("ResultViewCount",0)}get DebugValueCount(){return this.get("DebugValueCount",0)}get WorkflowCount(){return this.get("WorkflowCount",0)}get Archived(){return this.get("Archived")}get RoxieCluster(){return this.get("RoxieCluster")}get DebugState(){return this.get("DebugState",{})}get Queue(){return this.get("Queue")}get Active(){return this.get("Active")}get Action(){return this.get("Action")}get Scope(){return this.get("Scope")}get AbortBy(){return this.get("AbortBy")}get AbortTime(){return this.get("AbortTime")}get Workflows(){return this.get("Workflows")}get TimingData(){return this.get("TimingData")}get HelpersDesc(){return this.get("HelpersDesc")}get GraphsDesc(){return this.get("GraphsDesc")}get SourceFilesDesc(){return this.get("SourceFilesDesc")}get ResultsDesc(){return this.get("ResultsDesc")}get VariablesDesc(){return this.get("VariablesDesc")}get TimersDesc(){return this.get("TimersDesc")}get DebugValuesDesc(){return this.get("DebugValuesDesc")}get ApplicationValuesDesc(){return this.get("ApplicationValuesDesc")}get WorkflowsDesc(){return this.get("WorkflowsDesc")}get ServiceNames(){return this.get("ServiceNames")}get CompileCost(){return this.get("CompileCost")}get ExecuteCost(){return this.get("ExecuteCost")}get FileAccessCost(){return this.get("FileAccessCost")}get NoAccess(){return this.get("NoAccess")}get ECLWUProcessList(){return this.get("ECLWUProcessList")}static create(e){let t=new r(e);return t.connection.WUCreate().then(s=>(It.set(t),t.set(s.Workunit),t))}static attach(e,t,s){let n=It.get({BaseUrl:e.baseUrl,Wuid:t},()=>new r(e,t));return s&&n.set(s),n}static existsLocal(e,t){return It.has({BaseUrl:e,Wuid:t})}static submit(e,t,s,n=!1){return r.create(e).then(i=>i.update({QueryText:s})).then(i=>n?i.submit(t,O.Action.Compile):i.submit(t))}static compile(e,t,s){return r.submit(e,t,s,!0)}static query(e,t){return new A(e).WUQuery(t).then(n=>n.Workunits.ECLWorkunit.map(function(i){return r.attach(e,i.Wuid,i)}))}constructor(e,t){super(),this.connection=new A(e),this.topologyConnection=new y(e),this.clearState(t)}clearState(e){this.clear({Wuid:e,StateID:0})}update(e){return this.connection.WUUpdate({...e,Wuid:this.Wuid,StateOrig:this.StateID,JobnameOrig:this.Jobname,DescriptionOrig:this.Description,ProtectedOrig:this.Protected,ClusterOrig:this.Cluster}).then(t=>(this.set(t.Workunit),this))}submit(e,t=O.Action.Run,s){let n;return e!==void 0?n=Promise.resolve(e):n=this.topologyConnection.DefaultTpLogicalClusterQuery().then(i=>i.Name),this._debugMode=!1,t===O.Action.Debug&&(t=O.Action.Run,this._debugMode=!0),n.then(i=>this.connection.WUUpdate({Wuid:this.Wuid,Action:t,ResultLimit:s,DebugValues:{DebugValue:[{Name:"Debug",Value:this._debugMode?"1":""}]}}).then(o=>(this.set(o.Workunit),this._submitAction=t,this.connection.WUSubmit({Wuid:this.Wuid,Cluster:i})))).then(()=>this)}isComplete(){switch(this.StateID){case 1:return this.ActionEx==="compile"||this._submitAction===O.Action.Compile;case 3:case 4:case 7:case 999:return!0;default:}return!1}isFailed(){switch(this.StateID){case 7:case 4:return!0;default:}return!1}isDeleted(){switch(this.StateID){case 999:return!0;default:}return!1}isDebugging(){switch(this.StateID){case 14:case 15:return!0;default:}return this._debugMode}isRunning(){switch(this.StateID){case 1:case 2:case 6:case 8:case 14:case 15:return!0;default:}return!1}setToFailed(){return this.WUAction(E.ECLWUActions.SetToFailed)}pause(){return this.WUAction(E.ECLWUActions.Pause)}pauseNow(){return this.WUAction(E.ECLWUActions.PauseNow)}resume(){return this.WUAction(E.ECLWUActions.Resume)}abort(){return this.WUAction(E.ECLWUActions.Abort)}protect(){return this.WUAction(E.ECLWUActions.Protect)}unprotect(){return this.WUAction(E.ECLWUActions.Unprotect)}delete(){return this.WUAction(E.ECLWUActions.Delete)}restore(){return this.WUAction(E.ECLWUActions.Restore)}deschedule(){return this.WUAction(E.ECLWUActions.Deschedule)}reschedule(){return this.WUAction(E.ECLWUActions.Reschedule)}resubmit(){return this.WUResubmit({CloneWorkunit:!1,ResetWorkflow:!1}).then(()=>(this.clearState(this.Wuid),this.refresh().then(()=>(this._monitor(),this))))}clone(){return this.WUResubmit({CloneWorkunit:!0,ResetWorkflow:!1}).then(e=>r.attach(this.connection.opts(),e.WUs.WU[0].WUID).refresh())}async refreshState(){return await this.WUQuery(),this.StateID===1&&!this.ActionEx&&!this._submitAction&&await this.refreshInfo(),this}async refreshInfo(e){return await this.WUInfo(e),this}async refreshDebug(){return await this.debugStatus(),this}async refresh(e=!1,t){return e?await Promise.all([this.refreshInfo(t),this.refreshDebug()]):await this.refreshState(),this}eclExceptions(){return this.Exceptions.ECLException}fetchArchive(){return this.connection.WUFileEx({Wuid:this.Wuid,Type:"ArchiveQuery"})}fetchECLExceptions(){return this.WUInfo({IncludeExceptions:!0}).then(()=>this.eclExceptions())}fetchResults(){return this.WUInfo({IncludeResults:!0}).then(()=>this.CResults)}fetchGraphs(){return this.WUInfo({IncludeGraphs:!0}).then(()=>this.CGraphs)}fetchQuery(){return this.WUInfo({IncludeECL:!0,TruncateEclTo64k:!1}).then(()=>this.Query)}fetchHelpers(){return this.WUInfo({IncludeHelpers:!0}).then(()=>this.Helpers?.ECLHelpFile||[])}fetchAllowedClusters(){return this.WUInfo({IncludeAllowedClusters:!0}).then(()=>this.AllowedClusters?.AllowedCluster||[])}fetchTotalClusterTime(){return this.WUInfo({IncludeTotalClusterTime:!0}).then(()=>this.TotalClusterTime)}fetchServiceNames(){return this.WUInfo({IncludeServiceNames:!0}).then(()=>this.ServiceNames?.Item)}fetchDetailsMeta(e={}){return this.WUDetailsMeta(e)}fetchDetailsRaw(e={}){return this.WUDetails(e).then(t=>t.Scopes.Scope)}normalizeDetails(e,t){let s={id:{Measure:"label"},name:{Measure:"label"},type:{Measure:"label"}},n=[];for(let i of t){let o={},a={};if(i&&i.Id&&i.Properties&&i.Properties.Property)for(let c in i.Properties.Property){let l=i.Properties.Property[c];if(l.Measure==="ns"&&(l.Measure="s"),l.Name==="Kind"){let g=parseInt(l.RawValue,10);l.Formatted=e.Activities.Activity.filter(D=>D.Kind===g)[0].Name??l.RawValue}switch(s[l.Name]={...l},gn(s,l.Name,"RawValue"),gn(s,l.Name,"Formatted"),l.Measure){case"bool":o[l.Name]=!!+l.RawValue;break;case"sz":o[l.Name]=+l.RawValue;break;case"s":o[l.Name]=+l.RawValue/1e9;break;case"ns":o[l.Name]=+l.RawValue;break;case"ts":o[l.Name]=new Date(+l.RawValue/1e3).toISOString();break;case"cnt":o[l.Name]=+l.RawValue;break;case"cost":o[l.Name]=+l.RawValue/1e6;break;case"cpu":case"skw":case"node":case"ppm":case"ip":case"cy":case"en":case"txt":case"id":case"fname":default:o[l.Name]=l.RawValue}a[l.Name]=cr(l.Formatted??o[l.Name])}let u={id:i.Id,name:i.ScopeName,type:i.ScopeType,Kind:i.Kind,Label:i.Label,__formattedProps:a,__groupedProps:{},__groupedRawProps:{},__StdDevs:0,__StdDevsSource:"",...o};if(u[je])try{let c=JSON.parse(u[je].split("\\").join("\\\\"));u[je]=[],c.forEach((l,g)=>{let D=l.match(ur);if(D){let w=(D[1]??"")+D[2]+D[3],ss=parseInt(D[5]),C=parseInt(D[6]);u[je].push({filePath:w,line:ss,col:C})}})}catch{Pt.error(`Unexpected "DefinitionList": ${u[je]}`)}let p={};for(let c in u)if(c.indexOf("__")!==0){let l=gr(u,c,p);l&&(u.__groupedProps[l.Key]=l,!isNaN(l.StdDevs)&&u.__StdDevs<l.StdDevs&&(u.__StdDevs=l.StdDevs,u.__StdDevsSource=l.Key))}n.push(u)}return{meta:e,columns:s,data:n}}fetchDetailsNormalized(e={}){return Promise.all([this.fetchDetailsMeta(),this.fetchDetailsRaw(e)]).then(t=>this.normalizeDetails(t[0],t[1]))}fetchInfo(e={}){return this.WUInfo(e)}fetchDetails(e={}){return this.WUDetails(e).then(t=>t.Scopes.Scope.map(s=>new he(this,s)))}fetchDetailsHierarchy(e={}){return this.WUDetails(e).then(t=>{let s=[],n={};t.Scopes.Scope.forEach(i=>{if(n[i.ScopeName])return n[i.ScopeName].update(i),null;{let o=new he(this,i);return n[o.ScopeName]=o,o}});for(let i in n)if(n.hasOwnProperty(i)){let o=n[i],a=o.parentScope();a&&n[a]?n[a].children().push(o):s.push(o)}return s})}fetchGraphDetails(e=[],t){return this.fetchDetails({ScopeFilter:{MaxDepth:999999,Ids:e,ScopeTypes:t},NestedFilter:{Depth:999999,ScopeTypes:["graph","subgraph","activity","edge","function"]},PropertiesToReturn:{AllStatistics:!0,AllAttributes:!0,AllHints:!0,AllProperties:!0,AllScopes:!0},ScopeOptions:{IncludeId:!0,IncludeScope:!0,IncludeScopeType:!0},PropertyOptions:{IncludeName:!0,IncludeRawValue:!0,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}})}fetchScopeGraphs(e=[]){return this.fetchGraphDetails(e,["graph"]).then(t=>Be(t))}fetchTimeElapsed(){return this.fetchDetails({ScopeFilter:{PropertyFilters:{PropertyFilter:[{Name:"TimeElapsed"}]}}}).then(e=>{let t={};e.forEach(n=>{t[n.ScopeName]=t[n.ScopeName]||{scope:n.ScopeName,start:null,elapsed:null,finish:null},n.CAttributes.forEach(i=>{i.Name==="TimeElapsed"?t[n.ScopeName].elapsed=+i.RawValue:i.Measure==="ts"&&i.Name.indexOf("Started")>=0&&(t[n.ScopeName].start=i.Formatted)})});let s=[];for(let n in t){let i=t[n];if(i.start&&i.elapsed){let o=or(i.start);o.setMilliseconds(o.getMilliseconds()+i.elapsed/1e6),i.finish=ir(o),s.push(i)}}return s.sort((n,i)=>n.start<i.start?-1:n.start>i.start?1:0),s})}_monitor(){if(this.isComplete()){this._monitorTickCount=0;return}super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?1e3:this._monitorTickCount<=3?3e3:this._monitorTickCount<=5?5e3:this._monitorTickCount<=7?1e4:e}on(e,t,s){if(this.isCallback(t))switch(e){case"completed":super.on("propChanged","StateID",n=>{this.isComplete()&&t([n])});break;case"changed":super.on(e,t);break;default:}else switch(e){case"changed":super.on(e,t,s);break;default:}return this._monitor(),this}watchUntilComplete(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),this.isComplete()&&(n.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),(this.isComplete()||this.isRunning())&&(n.release(),t(this))})})}WUQuery(e={}){return this.connection.WUQuery({...e,Wuid:this.Wuid}).then(t=>(this.set(t.Workunits.ECLWorkunit[0]),t)).catch(t=>{if(!t.Exception.some(n=>n.Code===20081?(this.clearState(this.Wuid),this.set("StateID",999),!0):!1))throw Pt.warning(`Unexpected ESP exception: ${t.message}`),t;return{}})}WUCreate(){return this.connection.WUCreate().then(e=>(this.set(e.Workunit),It.set(this),e))}WUInfo(e={}){let t=e.IncludeResults||e.IncludeResultsViewNames;return this.connection.WUInfo({...e,Wuid:this.Wuid,IncludeResults:t,IncludeResultsViewNames:t,SuppressResultSchemas:!1}).then(s=>(this.set(s.Workunit),t&&this.set({ResultViews:s.ResultViews}),s)).catch(s=>{if(!s.Exception.some(i=>i.Code===20080?(this.clearState(this.Wuid),this.set("StateID",999),!0):!1))throw Pt.warning(`Unexpected ESP exception: ${s.message}`),s;return{}})}WUResubmit(e){return this.connection.WUResubmit((0,I.deepMixinT)({},e,{Wuids:{Item:[this.Wuid]}}))}WUDetailsMeta(e){return this.connection.WUDetailsMeta(e)}WUDetails(e){return this.connection.WUDetails((0,I.deepMixinT)({ScopeFilter:{MaxDepth:9999},ScopeOptions:{IncludeMatchedScopesInResults:!0,IncludeScope:!0,IncludeId:!1,IncludeScopeType:!1},PropertyOptions:{IncludeName:!0,IncludeRawValue:!1,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}},e,{WUID:this.Wuid})).then(t=>(0,I.deepMixinT)({Scopes:{Scope:[]}},t))}WUAction(e){return this.connection.WUAction({Wuids:{Item:[this.Wuid]},WUActionType:e}).then(t=>this.refresh().then(()=>(this._monitor(),t)))}publish(e){return this.connection.WUPublishWorkunit({Wuid:this.Wuid,Cluster:this.Cluster,JobName:e||this.Jobname,AllowForeignFiles:!0,Activate:E.WUQueryActivationMode.ActivateQuery,Wait:5e3})}publishEx(e){let t=new Pe({baseUrl:""}),s={Wuid:this.Wuid,Cluster:this.Cluster,JobName:this.Jobname,AllowForeignFiles:!0,Activate:1,Wait:5e3,...e};return t.WUPublishWorkunitEx(s)}WUCDebug(e,t={}){let s="";for(let n in t)t.hasOwnProperty(n)&&(s+=` ${n}='${t[n]}'`);return this.connection.WUCDebugEx({Wuid:this.Wuid,Command:`<debug:${e} uid='${this.Wuid}'${s}/>`}).then(n=>n)}debug(e,t){return this.isDebugging()?this.WUCDebug(e,t).then(s=>{let n=s.children(e);return n.length?n[0]:new I.XMLNode(e)}).catch(s=>(Pt.error(s),Promise.resolve(new I.XMLNode(e)))):Promise.resolve(new I.XMLNode(e))}debugStatus(){return this.isDebugging()?this.debug("status").then(e=>{let t={...this.DebugState,...e.$};return this.set({DebugState:t}),e}):Promise.resolve({DebugState:{state:"unknown"}})}debugContinue(e=""){return this.debug("continue",{mode:e})}debugStep(e){return this.debug("step",{mode:e})}debugPause(){return this.debug("interrupt")}debugQuit(){return this.debug("quit")}debugDeleteAllBreakpoints(){return this.debug("delete",{idx:0})}debugBreakpointResponseParser(e){return e.children().map(t=>{if(t.name==="break")return t.$})}debugBreakpointAdd(e,t,s){return this.debug("breakpoint",{id:e,mode:t,action:s}).then(n=>this.debugBreakpointResponseParser(n))}debugBreakpointList(){return this.debug("list").then(e=>this.debugBreakpointResponseParser(e))}debugGraph(){return this._debugAllGraph&&this.DebugState._prevGraphSequenceNum===this.DebugState.graphSequenceNum?Promise.resolve(this._debugAllGraph):this.debug("graph",{name:"all"}).then(e=>(this.DebugState._prevGraphSequenceNum=this.DebugState.graphSequenceNum,this._debugAllGraph=Fs(this.Wuid,e),this._debugAllGraph))}debugBreakpointValid(e){return this.debugGraph().then(t=>hr(t,e))}debugPrint(e,t=0,s=10){return this.debug("print",{edgeID:e,startRow:t,numRows:s}).then(n=>n.children().map(i=>{let o={};return i.children().forEach(a=>{o[a.name]=a.content}),o}))}},Is="definition";function dr(r){return r._[Is]!==void 0}function mr(r){let e=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(r._[Is]);if(e){let[,t,s,n]=e;return t.replace(/\/\.\//g,"/"),{id:r._.id,file:t,line:+s,column:+n}}throw new Error(`Bad definition: ${r._[Is]}`)}function hr(r,e){let t=[];for(let s of r.vertices)if(dr(s)){let n=mr(s);(n&&!e||e===n.file)&&t.push(n)}return t.sort((s,n)=>s.line-n.line)}var Bt,Ts=class r extends wt.StateObject{connection;get properties(){return this.get()}get Exceptions(){return this.get("Exceptions")}get Build(){return this.get("Build")}get ThorClusterList(){return this.get("ThorClusterList")}get RoxieClusterList(){return this.get("RoxieClusterList")}get HThorClusterList(){return this.get("HThorClusterList")}get DFUJobs(){return this.get("DFUJobs")}get Running(){return this.get("Running",{ActiveWorkunit:[]})}get BannerContent(){return this.get("BannerContent")}get BannerColor(){return this.get("BannerColor")}get BannerSize(){return this.get("BannerSize")}get BannerScroll(){return this.get("BannerScroll")}get ChatURL(){return this.get("ChatURL")}get ShowBanner(){return this.get("ShowBanner")}get ShowChatURL(){return this.get("ShowChatURL")}get SortBy(){return this.get("SortBy")}get Descending(){return this.get("Descending")}get SuperUser(){return this.get("SuperUser")}get AccessRight(){return this.get("AccessRight")}get ServerJobQueues(){return this.get("ServerJobQueues")}get ActivityTime(){return this.get("ActivityTime")}get DaliDetached(){return this.get("DaliDetached")}static attach(e,t){return Bt||(Bt=new r(e)),t&&Bt.set(t),Bt}constructor(e){super(),e instanceof de?this.connection=e:this.connection=new de(e),this.clear({})}runningWorkunits(e=""){return this.Running.ActiveWorkunit.filter(t=>e===""||t.ClusterName===e).map(t=>ee.attach(this.connection.connectionOptions(),t.Wuid,t))}setBanner(e){return this.connection.SetBanner({...e}).then(t=>(this.set(t),this))}lazyRefresh=(0,wt.debounce)(async()=>{let e=await this.connection.Activity({});return this.set(e),this});async refresh(){return this.lazyRefresh()}};var fe=require("@hpcc-js/util");var fr=(0,fe.scopedLogger)("logicalFile.ts"),Nt=class extends fe.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Cluster}-${e.Name}`)}},Dr=new Nt,Ms=class r extends fe.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get Cluster(){return this.get("Cluster")}get Name(){return this.get("Name")}get Filename(){return this.get("Filename")}get Prefix(){return this.get("Prefix")}get NodeGroup(){return this.get("NodeGroup")}get NumParts(){return this.get("NumParts")}get Description(){return this.get("Description")}get Dir(){return this.get("Dir")}get PathMask(){return this.get("PathMask")}get Filesize(){return this.get("Filesize")}get FileSizeInt64(){return this.get("FileSizeInt64")}get RecordSize(){return this.get("RecordSize")}get RecordCount(){return this.get("RecordCount")}get RecordSizeInt64(){return this.get("RecordSizeInt64")}get RecordCountInt64(){return this.get("RecordCountInt64")}get Wuid(){return this.get("Wuid")}get Owner(){return this.get("Owner")}get JobName(){return this.get("JobName")}get Persistent(){return this.get("Persistent")}get Format(){return this.get("Format")}get MaxRecordSize(){return this.get("MaxRecordSize")}get CsvSeparate(){return this.get("CsvSeparate")}get CsvQuote(){return this.get("CsvQuote")}get CsvTerminate(){return this.get("CsvTerminate")}get CsvEscape(){return this.get("CsvEscape")}get Modified(){return this.get("Modified")}get Ecl(){return this.get("Ecl")}get Stat(){return this.get("Stat")}get DFUFilePartsOnClusters(){return this.get("DFUFilePartsOnClusters")}get isSuperfile(){return this.get("isSuperfile")}get ShowFileContent(){return this.get("ShowFileContent")}get subfiles(){return this.get("subfiles")}get Superfiles(){return this.get("Superfiles")}get ProtectList(){return this.get("ProtectList")}get FromRoxieCluster(){return this.get("FromRoxieCluster")}get Graphs(){return this.get("Graphs")}get UserPermission(){return this.get("UserPermission")}get ContentType(){return this.get("ContentType")}get CompressedFileSize(){return this.get("CompressedFileSize")}get PercentCompressed(){return this.get("PercentCompressed")}get IsCompressed(){return this.get("IsCompressed")}get BrowseData(){return this.get("BrowseData")}get jsonInfo(){return this.get("jsonInfo")}get binInfo(){return this.get("binInfo")}get PackageID(){return this.get("PackageID")}get Partition(){return this.get("Partition")}get Blooms(){return this.get("Blooms")}get ExpireDays(){return this.get("ExpireDays")}get KeyType(){return this.get("KeyType")}get IsRestricted(){return this.get("IsRestricted")}get AtRestCost(){return this.get("AtRestCost")}get AccessCost(){return this.get("AccessCost")}get StateID(){return this.get("StateID")}get ExpirationDate(){return this.get("ExpirationDate")}get ExtendedIndexInfo(){return this.get("ExtendedIndexInfo")}get properties(){return this.get()}static attach(e,t,s,n){let i=Dr.get({BaseUrl:e.baseUrl,Cluster:t,Name:s},()=>new r(e,t,s));return n&&i.set(n),i}constructor(e,t,s){super(),e instanceof ge?this.connection=e:this.connection=new ge(e),this.clear({Cluster:t,Name:s})}filePartsOnCluster(){return[...this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[]]}fileParts(){let e=[];for(let t of this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[])for(let s of t?.DFUFileParts?.DFUPart||[]){let n={...t,...s};delete n.DFUFileParts,e.push(n)}return e}update(e){return this.connection.DFUInfo({...e,Cluster:this.Cluster,Name:this.Name}).then(t=>(this.set({Cluster:this.Cluster,...t.FileDetail}),t))}fetchInfo(){return this.connection.DFUInfo({Cluster:this.Cluster,Name:this.Name}).then(e=>(this.set({Cluster:this.Cluster,...e.FileDetail}),e.FileDetail)).catch(e=>{if(!e.Exception.some(s=>s.Code===20038?(this.set("Name",this.Name+" (Deleted)"),this.set("StateID",999),!0):!1))throw fr.warning(`Unexpected ESP exception: ${e.message}`),e;return{}})}fetchDefFile(e){return this.connection.DFUFile({Name:this.Name,Format:e})}fetchListHistory(){return this.connection.ListHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}eraseHistory(){return this.connection.EraseHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}};var Lt=require("@hpcc-js/util");var Qt=class extends Lt.Cache{constructor(){super(e=>e.Address)}},Cr=new Qt,Oe=class r extends Lt.StateObject{connection;get Address(){return this.get("Address")}get ConfigAddress(){return this.get("ConfigAddress")}get Name(){return this.get("Name")}get ProcessType(){return this.get("ProcessType")}get DisplayType(){return this.get("DisplayType")}get Description(){return this.get("Description")}get AgentVersion(){return this.get("AgentVersion")}get Contact(){return this.get("Contact")}get Location(){return this.get("Location")}get UpTime(){return this.get("UpTime")}get ComponentName(){return this.get("ComponentName")}get ComponentPath(){return this.get("ComponentPath")}get RoxieState(){return this.get("RoxieState")}get RoxieStateDetails(){return this.get("RoxieStateDetails")}get OS(){return this.get("OS")}get ProcessNumber(){return this.get("ProcessNumber")}get Channels(){return this.get("Channels")}get Processors(){return this.get("Processors")}get Storage(){return this.get("Storage")}get Running(){return this.get("Running")}get PhysicalMemory(){return this.get("PhysicalMemory")}get VirtualMemory(){return this.get("VirtualMemory")}get ComponentInfo(){return this.get("ComponentInfo")}get Exception(){return this.get("Exception")}static attach(e,t,s){let n=Cr.get({Address:t},()=>new r(e));return s&&n.set(s),n}constructor(e){super(),e instanceof k?this.connection=e:this.connection=new k(e)}};var ie=require("@hpcc-js/util"),Cn=require("d3-format");var se=require("@hpcc-js/util");var kt=require("@hpcc-js/util");var Gt=class extends kt.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}`)}},Sr=new Gt,te=class r extends kt.StateObject{connection;machineConnection;get BaseUrl(){return this.connection.baseUrl}get Name(){return this.get("Name")}get Prefix(){return this.get("Prefix")}get Type(){return this.get("Type")}get IsDefault(){return this.get("IsDefault")}get TpClusters(){return this.get("TpClusters")}get TpEclCCServers(){return this.get("TpEclCCServers")}get TpEclServers(){return this.get("TpEclServers")}get TpEclAgents(){return this.get("TpEclAgents")}get TpEclSchedulers(){return this.get("TpEclSchedulers")}get MachineInfoEx(){return this.get("MachineInfoEx",[])}get CMachineInfoEx(){return this.MachineInfoEx.map(e=>Oe.attach(this.machineConnection,e.Address,e))}static attach(e,t,s){let n=Sr.get({BaseUrl:e.baseUrl,Name:t},()=>new r(e,t));return s&&n.set(s),n}constructor(e,t){super(),e instanceof y?(this.connection=e,this.machineConnection=new k(e.connectionOptions())):(this.connection=new y(e),this.machineConnection=new k(e)),this.clear({Name:t})}fetchMachines(e={}){return this.machineConnection.GetTargetClusterInfo({TargetClusters:{Item:[`${this.Type}:${this.Name}`]},...e}).then(t=>{let s=[];for(let n of t.TargetClusterInfoList.TargetClusterInfo)for(let i of n.Processes.MachineInfoEx)s.push(i);return this.set("MachineInfoEx",s),this.CMachineInfoEx})}machineStats(){let e=0,t=0,s=0;for(let n of this.CMachineInfoEx)for(let i of n.Storage.StorageInfo){t+=i.Available,s+=i.Total;let o=1-i.Available/i.Total;o>e&&(e=o)}return{maxDisk:e,meanDisk:1-(s?t/s:1)}}fetchUsage(){return this.machineConnection.GetTargetClusterUsageEx([this.Name])}};function Rr(r){let e;return r instanceof y?e=r:e=new y(r),e.TpListTargetClusters({}).then(t=>t.TargetClusters.TpClusterNameType.map(s=>te.attach(r,s.Name,s)))}var Bs={};function xr(r){if(!Bs[r.baseUrl]){let e;r instanceof y?e=r:e=new y(r),Bs[r.baseUrl]=e.TpListTargetClusters({}).then(t=>{let s,n,i;t.TargetClusters.TpClusterNameType.forEach(a=>{s||(s=a),!n&&a.IsDefault===!0&&(n=a),!i&&a.Type==="hthor"&&(i=a)});let o=n||i||s;return te.attach(r,o.Name,o)})}return Bs[r.baseUrl]}var vt=class extends se.Cache{constructor(){super(e=>e.BaseUrl)}},Ar=new vt,Ye=class r extends se.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get TargetClusters(){return this.get("TargetClusters")}get CTargetClusters(){return this.TargetClusters.map(e=>te.attach(this.connection,e.Name,e))}get LogicalClusters(){return this.get("LogicalClusters")}get Services(){return this.get("Services")}static attach(e,t){let s=Ar.get({BaseUrl:e.baseUrl},()=>new r(e));return t&&s.set(t),s}constructor(e){super(),e instanceof y?this.connection=e:this.connection=new y(e)}GetESPServiceBaseURL(e=""){return this.connection.TpServiceQuery({}).then(t=>{let s=this.connection.protocol(),n=this.connection.ip(),i=s==="https:"?"18002":"8002";if((0,se.exists)("ServiceList.TpEspServers.TpEspServer",t)){for(let o of t.ServiceList.TpEspServers.TpEspServer)if((0,se.exists)("TpBindings.TpBinding",o))for(let a of o.TpBindings.TpBinding)a.Service===e&&a.Protocol+":"===s&&(i=a.Port)}return`${s}//${n}:${i}/`})}fetchTargetClusters(){return this.connection.TpTargetClusterQuery({Type:"ROOT"}).then(e=>(this.set({TargetClusters:e.TpTargetClusters?.TpTargetCluster??[]}),this.CTargetClusters))}fetchLogicalClusters(e={}){return this.connection.TpLogicalClusterQuery(e).then(t=>(this.set({LogicalClusters:t.TpLogicalClusters.TpLogicalCluster}),this.LogicalClusters))}fetchServices(e={}){return this.connection.TpServiceQuery(e).then(t=>(this.set({Services:t.ServiceList}),this.Services))}_prevRefresh;refresh(e=!1){return(!this._prevRefresh||e)&&(this._prevRefresh=Promise.all([this.fetchTargetClusters(),this.fetchLogicalClusters(),this.fetchServices()]).then(()=>this)),this._prevRefresh}on(e,t,s){if(this.isCallback(t))switch(e){case"changed":super.on(e,t);break;default:}else switch(e){case"changed":super.on(e,t,s);break;default:}return this._monitor(),this}};function X(r,e,t){e==="__proto__"||e==="constructor"||e==="prototype"||(r[e]=t)}function Xe(r){return r=""+r,r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;")}function Wr(r){if(r){if(!isNaN(+r))return parseFloat(r)}else return 0;let t=/(?:(?:(\d+).days.)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+\.\d+|\d+)s))|(?:(\d+\.\d+|\d+)ms|(\d+\.\d+|\d+)us|(\d+\.\d+|\d+)ns)/.exec(r);if(!t)return 0;let s=+t[1]||0,n=+t[2]||0,i=+t[3]||0,o=+t[4]||0,a=+t[5]||0,u=+t[6]||0,p=+t[7]||0;return s*24*60*60+n*60*60+i*60+o+a/1e3+u/1e6+p/1e9}function q(r,e){let t=r.indexOf(e);return t!==-1?parseFloat(r.substring(0,t)):-1}function yr(r){if(r){if(!isNaN(+r))return parseFloat(r)}else return 0;let e=q(r,"Kb");return e>=0?e*1024:(e=q(r,"Mb"),e>=0?e*Math.pow(1024,2):(e=q(r,"Gb"),e>=0?e*Math.pow(1024,3):(e=q(r,"Tb"),e>=0?e*Math.pow(1024,4):(e=q(r,"Pb"),e>=0?e*Math.pow(1024,5):(e=q(r,"Eb"),e>=0?e*Math.pow(1024,6):(e=q(r,"Zb"),e>=0?e*Math.pow(1024,7):(e=q(r,"b"),e>=0?e:0)))))))}function Ur(r){return r?parseFloat(r):0}var ws=class{graph;m_xgmml;m_visibleSubgraphs;m_visibleVertices;m_semiVisibleVertices;m_visibleEdges;noSpills;constructor(e){this.graph=e,this.m_xgmml="",this.m_visibleSubgraphs={},this.m_visibleVertices={},this.m_semiVisibleVertices={},this.m_visibleEdges={}}calcVisibility(e,t,s,n){this.noSpills=n,e.forEach(i=>{this.graph.isVertex(i)?(this.calcInVertexVisibility(i,s),this.calcOutVertexVisibility(i,s)):this.graph.isEdge(i)?(this.calcInVertexVisibility(i.getSource(),s-1),this.calcOutVertexVisibility(i.getTarget(),s-1)):this.graph.isSubgraph(i)&&(this.m_visibleSubgraphs[i.__hpcc_id]=i,this.calcSubgraphVisibility(i,t-1))}),this.calcVisibility2()}calcInVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getInEdges().forEach(s=>{this.calcInVertexVisibility(s.getSource(),t-1)})}calcOutVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getOutEdges().forEach(s=>{this.calcOutVertexVisibility(s.getTarget(),t-1)})}calcSubgraphVisibility(e,t){if(t<0)return;t>0&&e.__hpcc_subgraphs.forEach((n,i)=>{this.calcSubgraphVisibility(n,t-1)}),e.__hpcc_subgraphs.forEach((n,i)=>{this.m_visibleSubgraphs[n.__hpcc_id]=n}),e.__hpcc_vertices.forEach((n,i)=>{this.m_visibleVertices[n.__hpcc_id]=n});let s={};this.graph.edges.forEach((n,i)=>{n.getSource().__hpcc_parent!==n.getTarget().__hpcc_parent&&e===this.getCommonAncestor(n)&&(s[n.getSource().__hpcc_parent.__hpcc_id+"::"+n.getTarget().__hpcc_parent.__hpcc_id]||(s[n.getSource().__hpcc_parent.__hpcc_id+"::"+n.getTarget().__hpcc_parent.__hpcc_id]=!0,this.m_visibleEdges[n.__hpcc_id]=n))})}buildVertexString(e,t){let s="",n="",i=e.getProperties();for(let o in i)t&&o.indexOf("_kind")>=0?n+='<att name="_kind" value="point"/>':o==="id"||o==="label"?s+=" "+o+'="'+Xe(i[o])+'"':n+='<att name="'+o+'" value="'+Xe(i[o])+'"/>';return"<node"+s+">"+n+"</node>"}buildEdgeString(e){let t="",s="",n=e.getProperties();for(let i in n)i.toLowerCase()==="id"||i.toLowerCase()==="label"||i.toLowerCase()==="source"||i.toLowerCase()==="target"?t+=" "+i+'="'+Xe(n[i])+'"':s+='<att name="'+i+'" value="'+Xe(n[i])+'"/>';return"<edge"+t+">"+s+"</edge>"}getAncestors(e,t){let s=e.__hpcc_parent;for(;s;)t.push(s),s=s.__hpcc_parent}getCommonAncestorV(e,t){let s=[],n=[];this.getAncestors(e,s),this.getAncestors(t,n);let i=s.length-1,o=n.length-1,a=null;for(;i>=0&&o>=0&&s[i]===n[o];)a=s[i],--i,--o;return a}getCommonAncestor(e){return this.getCommonAncestorV(e.getSource(),e.getTarget())}calcAncestorVisibility(e){let t=[];this.getAncestors(e,t),t.forEach((s,n)=>{this.m_visibleSubgraphs[s.__hpcc_id]=s})}calcVisibility2(){for(let e in this.m_visibleVertices){let t=this.m_visibleVertices[e];t.getInEdges().forEach((s,n)=>{this.m_visibleEdges[s.__hpcc_id]=s}),t.getOutEdges().forEach((s,n)=>{this.m_visibleEdges[s.__hpcc_id]=s}),this.calcAncestorVisibility(t)}this.calcSemiVisibleVertices()}addSemiVisibleEdge(e){e&&!this.m_visibleEdges[e.__hpcc_id]&&(this.m_visibleEdges[e.__hpcc_id]=e)}addSemiVisibleVertex(e){this.m_visibleVertices[e.__hpcc_id]||(this.m_semiVisibleVertices[e.__hpcc_id]=e,this.calcAncestorVisibility(e))}calcSemiVisibleVertices(){for(let e in this.m_visibleEdges){let t=this.m_visibleEdges[e],s=t.getSource();for(this.addSemiVisibleVertex(s);this.noSpills&&s.isSpill();){let i=s.getInEdges();if(i.length)this.addSemiVisibleEdge(i[0]),s=i[0].getSource(),this.addSemiVisibleVertex(s);else break}let n=t.getTarget();for(this.addSemiVisibleVertex(n);this.noSpills&&n.isSpill();){let i=n.getOutEdges();if(i.length)this.addSemiVisibleEdge(i[0]),n=i[0].getTarget(),this.addSemiVisibleVertex(n);else break}}}writeXgmml(){this.subgraphVisited(this.graph.subgraphs[0],!0),this.graph.edges.forEach((e,t)=>{this.edgeVisited(e)})}subgraphVisited(e,t=!1){if(this.m_visibleSubgraphs[e.__hpcc_id]){let s="";this.m_xgmml+=t?"":'<node id="'+e.__hpcc_id+'"><att><graph>';let n=this.m_xgmml.length;if(e.walkSubgraphs(this),e.walkVertices(this),n===this.m_xgmml.length){let o=e.__hpcc_vertices[0];o&&(this.m_xgmml+=this.buildVertexString(o,!0))}let i=e.getProperties();for(let o in i)s+='<att name="'+o+'" value="'+Xe(i[o])+'"/>';this.m_xgmml+=t?"":"</graph></att>"+s+"</node>"}return!1}vertexVisited(e){this.m_visibleVertices[e.__hpcc_id]?this.m_xgmml+=this.buildVertexString(e,!1):this.m_semiVisibleVertices[e.__hpcc_id]&&(this.m_xgmml+=this.buildVertexString(e,!0))}edgeVisited(e){this.m_visibleEdges[e.__hpcc_id]&&(this.m_xgmml+=this.buildEdgeString(e))}},qe=class{__hpcc_graph;__hpcc_parent;__widget;__hpcc_id;_globalID;constructor(e,t){this.__hpcc_graph=e,this.__hpcc_id=t,this._globalID=t}getProperties(){let e={};for(let t in this)t.indexOf("__")!==0&&this.hasOwnProperty(t)&&(e[t]=this[t]);return e}},J=class extends qe{_globalType;__hpcc_subgraphs;__hpcc_vertices;__hpcc_edges;id;constructor(e,t){super(e,t),this._globalType=t==="0"?"Graph":"Cluster",this.__hpcc_subgraphs=[],this.__hpcc_vertices=[],this.__hpcc_edges=[],this.id=t}addSubgraph(e){e.__hpcc_parent=this,this.__hpcc_subgraphs.some(t=>e===t)||this.__hpcc_subgraphs.push(e)}addVertex(e){e.__hpcc_parent=this,this.__hpcc_vertices.some(t=>e===t)||this.__hpcc_vertices.push(e)}removeVertex(e){this.__hpcc_vertices=this.__hpcc_vertices.filter(t=>e!==t)}addEdge(e){e.__hpcc_parent=this,this.__hpcc_edges.some(t=>e===t)||this.__hpcc_edges.push(e)}removeEdge(e){this.__hpcc_edges=this.__hpcc_edges.filter(t=>e!==t)}remove(){this.__hpcc_subgraphs.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_vertices.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_edges.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),delete this.__hpcc_parent,this.__hpcc_graph.removeItem(this)}walkSubgraphs(e){this.__hpcc_subgraphs.forEach((t,s)=>{e.subgraphVisited(t)&&t.walkSubgraphs(e)})}walkVertices(e){this.__hpcc_vertices.forEach((t,s)=>{e.vertexVisited(t)})}},ne=class extends qe{_globalType="Vertex";_isSpill;constructor(e,t){super(e,t)}isSpill(){return this._isSpill}remove(){let e=this.getInVertices();e.length<=1&&console.warn(this.__hpcc_id+": remove only supports single or zero inputs activities..."),this.getInEdges().forEach(t=>{t.remove()}),this.getOutEdges().forEach(t=>{t.setSource(e[0])}),this.__hpcc_parent?.removeVertex(this),this.__hpcc_graph.removeItem(this)}getInVertices(){return this.getInEdges().map(e=>e.getSource())}getInEdges(){return this.__hpcc_graph.edges.filter(e=>e.getTarget()===this)}getOutVertices(){return this.getOutEdges().map(e=>e.getTarget())}getOutEdges(){return this.__hpcc_graph.edges.filter(e=>e.getSource()===this)}},re=class extends qe{_globalType="Edge";_sourceActivity;source;_targetActivity;target;constructor(e,t){super(e,t),this._globalType="Edge"}remove(){this.__hpcc_graph.subgraphs.forEach(e=>{e.removeEdge(this)}),this.__hpcc_graph.removeItem(this)}getSource(){return this.__hpcc_graph.idx[this._sourceActivity||this.source]}setSource(e){this._sourceActivity?this._sourceActivity=e.__hpcc_id:this.source&&(this.source=e.__hpcc_id),this.__widget&&this.__widget.setSource(this.getSource().__widget)}getTarget(){return this.__hpcc_graph.idx[this._targetActivity||this.target]}},Je=class r{idx={};subgraphs=[];vertices=[];edges=[];xgmml="";constructor(){this.clear()}clear(){this.xgmml="",this.idx={},this.subgraphs=[],this.vertices=[],this.edges=[]}load(e){this.clear(),this.merge(e)}merge(e){this.xgmml=e;let s=new DOMParser().parseFromString(e,"text/xml");this.walkDocument(s.documentElement,"0")}isSubgraph(e){return e instanceof J}isVertex(e){return e instanceof ne}isEdge(e){return e instanceof re}getGlobalType(e){return e instanceof ne?3:e instanceof re?4:e instanceof J?2:e instanceof r?1:0}getGlobalTypeString(e){return e instanceof ne?"Vertex":e instanceof re?"Edge":e instanceof J?"Cluster":e instanceof r?"Graph":"Unknown"}getItem(e,t){if(!this.idx[t])switch(e.tagName){case"graph":let n=new J(this,t);this.subgraphs.push(n),this.idx[t]=n;break;case"node":let i=new ne(this,t);this.vertices.push(i),this.idx[t]=i;break;case"edge":let o=new re(this,t);this.edges.push(o),this.idx[t]=o;break;default:console.warn("Graph.getItem - Unknown Node Type!");break}let s=this.idx[t];return Array.from(e.attributes).forEach(n=>{X(s,n.name,n.value)}),s}removeItem(e){delete this.idx[e.__hpcc_id],e instanceof J?this.subgraphs=this.subgraphs.filter(t=>e!==t):e instanceof ne?this.vertices=this.vertices.filter(t=>e!==t):e instanceof re&&(this.edges=this.edges.filter(t=>e!==t))}getChildByTagName(e,t){let s=null;return Array.from(e.childNodes).some(n=>{if(n.tagName===t)return s=n,!0}),s}walkDocument(e,t){let s=this.getItem(e,t);return e.childNodes.forEach(n=>{switch(n.nodeType){case 1:switch(n.tagName){case"graph":break;case"node":let i=!1,o=this.getChildByTagName(n,"att");if(o){let l=this.getChildByTagName(o,"graph");if(l){i=!0;let g=this.walkDocument(l,n.getAttribute("id"));s.addSubgraph(g)}}if(!i){let l=this.walkDocument(n,n.getAttribute("id"));s.addVertex(l)}break;case"att":let a=n.getAttribute("name"),u="_"+a,p=n.getAttribute("value");a.indexOf("Time")===0?(X(s,u,p),X(s,a,""+Wr(p))):a.indexOf("Size")===0?(X(s,u,p),X(s,a,""+yr(p))):a.indexOf("Skew")===0?(X(s,u,p),X(s,a,""+Ur(p))):X(s,a,p);break;case"edge":let c=this.walkDocument(n,n.getAttribute("id"));if(c.NumRowsProcessed!==void 0?c._eclwatchCount=c.NumRowsProcessed.replace(/\B(?=(\d{3})+(?!\d))/g,","):c.Count!==void 0?c._eclwatchCount=c.Count.replace(/\B(?=(\d{3})+(?!\d))/g,","):c.count!==void 0&&(c._eclwatchCount=c.count.replace(/\B(?=(\d{3})+(?!\d))/g,",")),c.inputProgress&&(c._eclwatchInputProgress="["+c.inputProgress.replace(/\B(?=(\d{3})+(?!\d))/g,",")+"]"),c.SkewMaxRowsProcessed&&c.SkewMinRowsProcessed&&(c._eclwatchSkew="+"+c.SkewMaxRowsProcessed+", "+c.SkewMinRowsProcessed),!c._dependsOn){if(!c._childGraph){if(c._sourceActivity||c._targetActivity){c._isSpill=!0;let l=c.getSource();l&&(l._isSpill=!0);let g=c.getTarget();g&&(g._isSpill=!0)}}}s.addEdge(c);break;default:break}break;case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:break;default:break}}),s}removeSubgraphs(){[...this.subgraphs].forEach(t=>{t.__hpcc_parent instanceof J&&t.remove()})}removeSpillVertices(){[...this.vertices].forEach(t=>{t.isSpill()&&t.remove()})}getLocalisedXGMML(e,t,s,n){let i=new ws(this);return i.calcVisibility(e,t,s,n),i.writeXgmml(),"<graph>"+i.m_xgmml+"</graph>"}};var Ns=(0,ie.scopedLogger)("@hpcc-js/comms/ecl/query.ts"),Er=(0,Cn.format)("~s");function Fr(r){return!isNaN(parseFloat(r))&&!isNaN(r-0)}var Qs=class extends ie.Cache{constructor(){super(e=>ie.Cache.hash([e.QueryId,e.QuerySet]))}},br=new Qs,Ls=class r extends ie.StateObject{wsWorkunitsService;get BaseUrl(){return this.wsWorkunitsService.baseUrl}topology;_requestSchema;_responseSchema;get properties(){return this.get()}get Exceptions(){return this.get("Exceptions")}get QueryId(){return this.get("QueryId")}get QuerySet(){return this.get("QuerySet")}get QueryName(){return this.get("QueryName")}get Wuid(){return this.get("Wuid")}get Dll(){return this.get("Dll")}get Suspended(){return this.get("Suspended")}get Activated(){return this.get("Activated")}get SuspendedBy(){return this.get("SuspendedBy")}get Clusters(){return this.get("Clusters")}get PublishedBy(){return this.get("PublishedBy")}get Comment(){return this.get("Comment")}get LogicalFiles(){return this.get("LogicalFiles")}get SuperFiles(){return this.get("SuperFiles")}get IsLibrary(){return this.get("IsLibrary")}get Priority(){return this.get("Priority")}get WUSnapShot(){return this.get("WUSnapShot")}get CompileTime(){return this.get("CompileTime")}get LibrariesUsed(){return this.get("LibrariesUsed")}get CountGraphs(){return this.get("CountGraphs")}get ResourceURLCount(){return this.get("ResourceURLCount")}get WsEclAddresses(){return this.get("WsEclAddresses")}get WUGraphs(){return this.get("WUGraphs")}get WUTimers(){return this.get("WUTimers")}get PriorityID(){return this.get("PriorityID")}constructor(e,t,s,n){super(),e instanceof A?this.wsWorkunitsService=e:this.wsWorkunitsService=new A(e),this.topology=Ye.attach(this.wsWorkunitsService.opts()),this.set({QuerySet:t,QueryId:s,...n})}static attach(e,t,s,n){let i=br.get({BaseUrl:e.baseUrl,QuerySet:t,QueryId:s},()=>new r(e,t,s));return n&&i.set(n),i}_eclService;async wsEclService(){return this._eclService||(this._eclService=this.topology.fetchServices({}).then(e=>{for(let t of e?.TpEspServers?.TpEspServer??[])for(let s of t?.TpBindings?.TpBinding??[])if(s?.Service==="ws_ecl"){let n=`${s.Protocol}://${globalThis.location.hostname}:${s.Port}`;return new Fe({baseUrl:n})}})),this._eclService}async fetchDetails(){let e=await this.wsWorkunitsService.WUQueryDetails({QuerySet:this.QuerySet,QueryId:this.QueryId,IncludeStateOnClusters:!0,IncludeSuperFiles:!0,IncludeWsEclAddresses:!0,CheckAllNodes:!1});this.set({...e})}async fetchRequestSchema(){let e=await this.wsEclService();try{this._requestSchema=await e?.requestJson(this.QuerySet,this.QueryId)??[]}catch(t){Ns.debug(t.message??t),this._requestSchema=[]}}async fetchResponseSchema(){let e=await this.wsEclService();try{this._responseSchema=await e?.responseJson(this.QuerySet,this.QueryId)??{}}catch(t){Ns.debug(t.message??t),this._responseSchema={}}}async fetchSchema(){await Promise.all([this.fetchRequestSchema(),this.fetchResponseSchema()])}fetchSummaryStats(){return this.wsWorkunitsService.WUQueryGetSummaryStats({Target:this.QuerySet,QueryId:this.QueryId})}fetchGraph(e="",t=""){return this.wsWorkunitsService.WUQueryGetGraph({Target:this.QuerySet,QueryId:this.QueryId,GraphName:e,SubGraphId:t}).then(s=>{let n=new Je,i=!0;for(let o of s?.Graphs?.ECLGraphEx||[])i?(n.load(o.Graph),i=!1):n.merge(o.Graph);return n})}fetchDetailsNormalized(e={}){let t=ee.attach(this.wsWorkunitsService,this.Wuid);return t?Promise.all([this.fetchGraph(),t.fetchDetailsMeta(),t.fetchDetailsRaw(e)]).then(s=>{let n=s[0],i=s[1],a=s[2].map(u=>{if(u.Id[0]==="a"||u.Id[0]==="e"){let p=n.idx[u.Id.substring(1)];for(let c in p)if(c.charAt(0)!=="_"&&c.charAt(0)===c.charAt(0).toUpperCase()&&(typeof p[c]=="string"||typeof p[c]=="number"||typeof p[c]=="boolean")&&!u.Properties.Property.some(l=>l.Name===c)){let g=Fr(p[c])?parseFloat(p[c]):p[c],D=p[c];c.indexOf("Time")>=0&&(g=g/1e9,D=Er(g)+"s"),u.Properties.Property.push({Name:c,RawValue:g,Formatted:D})}}return u});return t.normalizeDetails(i,a)}):Promise.resolve({meta:void 0,columns:void 0,data:void 0})}async submit(e){let t=await this.wsEclService();try{return t?.submit(this.QuerySet,this.QueryId,e).then(s=>{for(let n in s)s[n]=s[n].Row;return s})??[]}catch(s){return Ns.debug(s.message??s),[]}}async refresh(){return await Promise.all([this.fetchDetails(),this.fetchSchema()]),this}requestFields(){return this._requestSchema?this._requestSchema:[]}responseFields(){return this._responseSchema?this._responseSchema:{}}resultNames(){let e=[];for(let t in this.responseFields())e.push(t);return e}resultFields(e){return this._responseSchema[e]?this._responseSchema[e]:[]}};var De=require("@hpcc-js/util");var Vt=class extends De.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}:${e.UserSpecific}-${e.Namespace}`)}},Pr=new Vt,z=class extends De.Message{constructor(t,s,n){super();this.key=t;this.value=s;this.oldValue=n}get canConflate(){return!0}conflate(t){return this.key===t.key?(this.value=t.value,!0):!1}void(){return this.value===this.oldValue}},Gs=class r{connection;get BaseUrl(){return this.connection.baseUrl}Name;UserSpecific;Namespace;_dispatch=new De.Dispatch;static attach(e,t="HPCCApps",s,n=!0){return Pr.get({BaseUrl:e.baseUrl,Name:t,UserSpecific:n,Namespace:s},()=>new r(e,t,s,n))}constructor(e,t,s,n){e instanceof me?this.connection=e:this.connection=new me(e),this.Name=t,this.UserSpecific=n,this.Namespace=s}_knownValues={};create(){this.connection.CreateStore({Name:this.Name,UserSpecific:this.UserSpecific,Type:"",Description:""})}set(e,t,s=!0){return this.connection.Set({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e,Value:t}).then(n=>{let i=this._knownValues[e];this._knownValues[e]=t,s&&this._dispatch.post(new z(e,t,i))}).catch(n=>{console.error(`Store.set("${e}", "${t}") failed:`,n)})}get(e,t=!0){return this.connection.Fetch({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(s=>{let n=this._knownValues[e];return this._knownValues[e]=s.Value,t&&this._dispatch.post(new z(e,s.Value,n)),s.Value}).catch(s=>{console.error(`Store.get(${e}) failed:`,s)})}getAll(e=!0){return this.connection.FetchAll({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace}).then(t=>{let s={},n=this._knownValues;if(this._knownValues={},t.Pairs.Pair.forEach(i=>{let o=this._knownValues[i.Key];this._knownValues[i.Key]=i.Value,delete n[i.Key],s[i.Key]=i.Value,e&&this._dispatch.post(new z(i.Key,i.Value,o))}),e)for(let i in n)this._dispatch.post(new z(i,void 0,n[i]));return s}).catch(t=>(console.error("Store.getAll failed:",t),{}))}delete(e,t=!0){return this.connection.Delete({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(s=>{let n=this._knownValues[e];delete this._knownValues[e],t&&this._dispatch.post(new z(e,void 0,n))}).catch(s=>{console.error(`Store.delete(${e}) failed:`,s)})}monitor(e){return this._dispatch.attach(e)}};var Ce=require("@hpcc-js/util");var Ir=(0,Ce.scopedLogger)("@hpcc-js/comms/dfuWorkunit.ts");var _t=class extends Ce.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.ID}`)}},Sn=new _t,ks=class r extends Ce.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get ID(){return this.get("ID")}get DFUServerName(){return this.get("DFUServerName")}get ClusterName(){return this.get("ClusterName")}get JobName(){return this.get("JobName")}get Queue(){return this.get("Queue")}get User(){return this.get("User")}get isProtected(){return this.get("isProtected")}get Command(){return this.get("Command")}get CommandMessage(){return this.get("CommandMessage")}get PercentDone(){return this.get("PercentDone")}get SecsLeft(){return this.get("SecsLeft")}get ProgressMessage(){return this.get("ProgressMessage")}get SummaryMessage(){return this.get("SummaryMessage")}get State(){return this.get("State",0)}get SourceLogicalName(){return this.get("SourceLogicalName")}get SourceIP(){return this.get("SourceIP")}get SourceFilePath(){return this.get("SourceFilePath")}get SourceDali(){return this.get("SourceDali")}get SourceRecordSize(){return this.get("SourceRecordSize")}get SourceFormat(){return this.get("SourceFormat")}get RowTag(){return this.get("RowTag")}get SourceNumParts(){return this.get("SourceNumParts")}get SourceDirectory(){return this.get("SourceDirectory")}get DestLogicalName(){return this.get("DestLogicalName")}get DestGroupName(){return this.get("DestGroupName")}get DestDirectory(){return this.get("DestDirectory")}get DestIP(){return this.get("DestIP")}get DestFilePath(){return this.get("DestFilePath")}get DestFormat(){return this.get("DestFormat")}get DestNumParts(){return this.get("DestNumParts")}get DestRecordSize(){return this.get("DestRecordSize")}get Replicate(){return this.get("Replicate")}get Overwrite(){return this.get("Overwrite")}get Compress(){return this.get("Compress")}get SourceCsvSeparate(){return this.get("SourceCsvSeparate")}get SourceCsvQuote(){return this.get("SourceCsvQuote")}get SourceCsvTerminate(){return this.get("SourceCsvTerminate")}get SourceCsvEscape(){return this.get("SourceCsvEscape")}get TimeStarted(){return this.get("TimeStarted")}get TimeStopped(){return this.get("TimeStopped")}get StateMessage(){return this.get("StateMessage")}get MonitorEventName(){return this.get("MonitorEventName")}get MonitorSub(){return this.get("MonitorSub")}get MonitorShotLimit(){return this.get("MonitorShotLimit")}get SourceDiffKeyName(){return this.get("SourceDiffKeyName")}get DestDiffKeyName(){return this.get("DestDiffKeyName")}get Archived(){return this.get("Archived")}get encrypt(){return this.get("encrypt")}get decrypt(){return this.get("decrypt")}get failIfNoSourceFile(){return this.get("failIfNoSourceFile")}get recordStructurePresent(){return this.get("recordStructurePresent")}get quotedTerminator(){return this.get("quotedTerminator")}get preserveCompression(){return this.get("preserveCompression")}get expireDays(){return this.get("expireDays")}get PreserveFileParts(){return this.get("PreserveFileParts")}get FileAccessCost(){return this.get("FileAccessCost")}get KbPerSecAve(){return this.get("KbPerSecAve")}get KbPerSec(){return this.get("KbPerSec")}static create(e,t){let s=new r(e);return s.connection.CreateDFUWorkunit({DFUServerQueue:t}).then(n=>(Sn.set(s),s.set(n.result),s))}static attach(e,t,s){let n=Sn.get({BaseUrl:e.baseUrl,ID:t},()=>new r(e,t));return s&&n.set(s),n}static sprayFixed(e,t){let s=new H(e);return s.SprayFixedEx({...t}).then(n=>{let i=n.wuid;return s.GetDFUWorkunit({wuid:i}).then(o=>r.attach(e,i,o.result))})}static sprayVariable(e,t){let s=new H(e);return s.SprayVariableEx({...t}).then(n=>{let i=n.wuid;return s.GetDFUWorkunit({wuid:i}).then(o=>r.attach(e,i,o.result))})}static despray(e,t){let s=new H(e);return s.DesprayEx({...t}).then(n=>{let i=n.wuid;return s.GetDFUWorkunit({wuid:i}).then(o=>r.attach(e,i,o.result))})}update(e){return this.connection.UpdateDFUWorkunitEx({wu:{JobName:e?.wu?.JobName??this.JobName,isProtected:e?.wu?.isProtected??this.isProtected,ID:this.ID,State:this.State},ClusterOrig:this.ClusterName,JobNameOrig:this.JobName,isProtectedOrig:this.isProtected,StateOrig:this.State})}isComplete(){switch(this.State){case 6:case 5:case 4:case 999:return!0;default:}return!1}isFailed(){return!!(this.isComplete()&&this.State!==6)}isDeleted(){switch(this.State){case 999:return!0;default:}return!1}isRunning(){return!this.isComplete()}abort(){return this.connection.AbortDFUWorkunit({wuid:this.ID})}delete(){return this.DFUWUAction(pe.DFUWUActions.Delete).then(e=>this.refresh().then(()=>(this._monitor(),e)))}async refresh(e=!1){return await this.GetDFUWorkunit(),this}fetchXML(e){return this.DFUWUFile()}_monitor(){if(this.isComplete()){this._monitorTickCount=0;return}super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?3e3:this._monitorTickCount<=5?6e3:this._monitorTickCount<=7?12e3:e}DFUWUFile(e={}){return this.connection.DFUWUFileEx({...e,Wuid:this.ID}).then(t=>t).catch(t=>"")}DFUWUAction(e){return this.connection.DFUWorkunitsAction({wuids:{Item:[this.ID]},Type:e}).then(t=>e===pe.DFUWUActions.Delete?t:this.refresh().then(()=>(this._monitor(),t)))}on(e,t,s){if(this.isCallback(t))switch(e){case"finished":super.on("propChanged","State",n=>{this.isComplete()&&t([n])});break;case"changed":super.on(e,t);break;default:}else switch(e){case"changed":super.on(e,t,s);break;default:}return this._monitor(),this}watchUntilComplete(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),this.isComplete()&&(n.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),(this.isComplete()||this.isRunning())&&(n.release(),t(this))})})}constructor(e,t){super(),this.connection=new H(e),this.topologyConnection=new y(e),this.clearState(t)}clearState(e){this.clear({ID:e,State:0})}GetDFUWorkunit(e={}){return this.connection.GetDFUWorkunit({...e,wuid:this.ID}).then(t=>(this.set(t.result),t)).catch(t=>{if(!t.Exception.some(n=>n.Code===20080||n.Code===20081?(this.clearState(this.ID),this.set("State",999),!0):!1))throw Ir.warning(`Unexpected ESP exception: ${t.message}`),t;return{}})}};var Fn=N(require("child_process"),1),F=N(require("fs"),1),ce=N(require("os"),1),M=N(require("path"),1),bn=N(require("tmp"),1),Ae=require("@hpcc-js/util");var oe=N(require("fs"),1),R=N(require("path"),1),T=require("@hpcc-js/util");var Tr=(0,T.scopedLogger)("clienttools/eclmeta"),Mr=!1;function Se(r,e,t){if(Mr){for(let s in r){let n=`${e}.${s}`;s!=="$"&&t[s]===void 0&&t[s.toLowerCase()+"s"]===void 0&&Tr.debug(n)}r.$&&Se(r.$,e+".$",t)}}var Ht=class{__attrs;name;constructor(e){this.__attrs=e.$,this.name=e.$.name}},jt=class{__attrs;definition;get scope(){return this.definition}name;type;constructor(e,t){this.__attrs=t.$,this.definition=e,this.name=t.$.name,this.type=t.$.type}},ae=class{get scope(){return this}name;type;sourcePath;line;start;body;end;definitions;constructor(e,t,s,n,i=1,o=0,a=0,u=Number.MAX_VALUE){this.name=e,this.type=t,this.sourcePath=R.normalize(s),this.line=+i-1,this.start=+o,this.body=+a,this.end=+u,this.definitions=this.parseDefinitions(n)}parseDefinitions(e=[]){return e.map(t=>{let s=new Ot(this.sourcePath,t);return Se(t,"definition",s),s})}contains(e){return e>=this.start&&e<=this.end}scopeStackAt(e){let t=[];return this.contains(e)&&(t.push(this),this.definitions.forEach(s=>{t=s.scopeStackAt(e).concat(t)})),t}_resolve(e=[],t){let s=t.split("."),n=s.shift(),i=(0,T.find)(e,o=>typeof o.name=="string"&&typeof n=="string"&&o.name.toLowerCase()===n.toLowerCase());return i&&i.definitions.length&&s.length?this._resolve(i.definitions,s.join(".")):i}resolve(e){return this._resolve(this.definitions,e)}suggestions(){return this.definitions.map(e=>({name:e.name,type:this.type}))}},Ot=class extends ae{__attrs;exported;shared;fullname;inherittype;attrs;fields;constructor(e,t){super(t.$.name,t.$.type,e,t.children("Definition"),t.$.line,t.$.start,t.$.body,t.$.end),this.__attrs=t.$,this.exported=!!t.$.exported,this.shared=!!t.$.shared,this.fullname=t.$.fullname,this.inherittype=t.$.inherittype,this.attrs=this.parseAttrs(t.children("Attr")),this.fields=this.parseFields(t.children("Field"))}parseAttrs(e=[]){return e.map(t=>{let s=new Ht(t);return Se(t,"attr",s),s})}parseFields(e=[]){return e.map(t=>{let s=new jt(this,t);return Se(t,"field",s),s})}suggestions(){return super.suggestions().concat(this.fields.map(e=>({name:e.name,type:e.type})))}},ze=class{__attrs;name;ref;start;end;line;constructor(e){this.__attrs=e.$,this.name=e.$.name,this.ref=e.$.ref,this.start=e.$.start,this.end=e.$.end,this.line=e.$.line}},Yt=class extends ae{imports;__attrs;constructor(e){super(e.$.name,"source",e.$.sourcePath,e.children("Definition")),this.__attrs=e.$;let t=e.$.name.split(".");t.pop();let s=new T.XMLNode("");s.appendAttribute("name","$"),s.appendAttribute("ref",t.join(".")),this.imports=[new ze(s),...this.parseImports(e.children("Import"))]}parseImports(e=[]){return e.map(t=>{let s=new ze(t);return Se(t,"import",s),s})}resolve(e,t){let s;return!s&&t!==void 0&&this.scopeStackAt(t).some(i=>(s=i.resolve(e),!!s)),s||(s=super.resolve(e)),s}},Br=r=>R.basename(r).indexOf(".")===0,Rn=r=>oe.lstatSync(r).isDirectory()&&!Br(r),wr=r=>[".ecl",".ecllib"].indexOf(R.extname(r).toLowerCase())>=0,xn=r=>oe.readdirSync(r).map(e=>R.join(r,e)).filter(e=>Rn(e)||wr(e)),Xt=class extends ae{constructor(e,t){super(e,"file",t,[])}suggestions(){return[]}},qt=class extends ae{constructor(e,t){super(e,"folder",t,[])}suggestions(){return xn(this.sourcePath).map(e=>({name:R.basename(e,".ecl"),type:"folder"}))}},Jt=class{_workspacePath;_eclccPath;_clientTools;_sourceByID=new T.DictionaryNoCase;_sourceByPath=new T.Dictionary;_test=new T.DictionaryNoCase;constructor(e,t){this._workspacePath=e,this._eclccPath=t}refresh(){this.primeWorkspace(),this.primeClientTools()}primeClientTools(){return _s(this._eclccPath,"",this._workspacePath).then(e=>(this._clientTools=e,e.paths())).then(e=>{for(let t of["ECLCC_ECLLIBRARY_PATH","ECLCC_PLUGIN_PATH"])e[t]&&oe.existsSync(e[t])&&this.walkChildFolders(e[t],e[t]);return this})}primeWorkspace(){oe.existsSync(this._workspacePath)&&this.visitFolder(this._workspacePath,this._workspacePath)}walkChildFolders(e,t,s=!1){for(let n of xn(e))Rn(n)?this.visitFolder(n,t,s):this.visitFile(n,t,s)}visitFile(e,t,s=!1){let n=R.parse(e),i=R.join(n.dir,n.name),o=R.relative(t,i).split(R.sep).join(".");(s||!this._test.has(o))&&this._test.set(o,new Xt("",e))}visitFolder(e,t,s=!1){let n=R.relative(t,e).split(R.sep).join(".");(s||!this._test.has(n))&&(this._test.set(n,new qt(n,e)),this.walkChildFolders(e,t,s))}buildStack(e,t,s){let n=t.split(".");s&&e[e.length-1]===n[0]&&n.shift();let i=[...e,...n],o=i.join(".");return{stack:i,qid:o}}walkECLScope(e,t){let s=this.buildStack(e,t.name,!0);this._test.set(s.qid,t);for(let n of t.definitions)this.walkDefinition(s.stack,n)}walkField(e,t){let s=this.buildStack(e,t.name,!1);this._test.set(s.qid,t)}walkDefinition(e,t){let s=this.buildStack(e,t.name,!0);this.walkECLScope(e,t);for(let n of t.fields)this.walkField(s.stack,n)}walkSource(e){this.walkECLScope([],e)}parseSources(e=[]){for(let t of e)if(t.$.name){let s=new Yt(t);if(Se(t,"source",s),this._sourceByID.set(s.name,s),this._sourceByPath.set(s.sourcePath,s),s.name){let i=s.name.split(".").length;if(i>1){let o=s.sourcePath;for(;i>1;)o=R.dirname(o),--i;this.visitFolder(o,R.dirname(o))}}this.walkSource(s)}}parseMetaXML(e){let t=new Vs;return t.parse(e),this.parseSources(t.sources),t.sources.map(s=>R.normalize(s.$.sourcePath))}resolveQualifiedID(e,t,s){let n;if(!n&&this._test.has(t)&&(n=this._test.get(t).scope),!n&&this._sourceByPath.has(e)){let i=this._sourceByPath.get(e),o=t.split(".");for(let u of i.imports)if(u.name.toLowerCase()===o[0].toLowerCase()){u.ref?o[0]=u.ref:o.shift();break}let a=o.join(".");!n&&this._test.has(a)&&(n=this._test.get(a).scope),n||(a=[...i.name.split("."),...o].join("."),this._test.has(a)&&(n=this._test.get(a).scope))}return n}resolvePartialID(e,t,s){t=t.toLowerCase();let n=t.split(".");n.pop();let i=n.length===1?n[0]:n.join(".");return this.resolveQualifiedID(e,i,s)}},vs=new T.Dictionary;function K(r,e){let t=R.normalize(r);if(!vs.has(t)){let s=new Jt(t,e);vs.set(t,s),s.refresh()}return vs.get(t)}function Nr(r,e,t){if(e<0)return!1;let s=r.charAt(e);return(t?/[a-zA-Z\d_\.$]/:/[a-zA-Z\d_]/).test(s)}function Qr(r,e,t){for(;Nr(r,e,t);)e+=t?-1:1;return e+(t?1:-1)}var Vs=class extends T.SAXStackParser{sources=[];endXMLNode(e){switch(e.name){case"Source":this.sources.push(e);break;default:break}super.endXMLNode(e)}};var es=(0,Ae.scopedLogger)("clienttools/eclcc"),Hs=ce.type()==="Windows_NT"?".exe":"";function An(r){return r.split(`\r
915
+ </div>`}},he=class extends Ft{wu;constructor(e,t){super(t),this.wu=e}};var gn=require("@hpcc-js/util");var He=class extends gn.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get FileCluster(){return this.get("FileCluster")}get Name(){return this.get("Name")}get IsSuperFile(){return this.get("IsSuperFile")}get Subs(){return this.get("Subs")}get Count(){return this.get("Count")}get ECLSourceFiles(){return this.get("ECLSourceFiles")}constructor(e,t,s){super(),e instanceof x?this.connection=e:this.connection=new x(e),this.set({Wuid:t,...s})}};var bt=require("@hpcc-js/util");var je=class extends bt.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get Name(){return this.get("Name")}get Value(){return this.get("Value")}get Seconds(){return this.get("Seconds")}get GraphName(){return this.get("GraphName")}get SubGraphId(){return this.get("SubGraphId")}get HasSubGraphId(){return this.get("HasSubGraphId")}get count(){return this.get("count")}get Timestamp(){return this.get("Timestamp")}get When(){return this.get("When")}constructor(e,t,s){super(),e instanceof x?this.connection=e:this.connection=new x(e);let n=(0,bt.espTime2Seconds)(s.Value);this.set({Wuid:t,Seconds:Math.round(n*1e3)/1e3,HasSubGraphId:s.SubGraphId!==void 0,...s})}};var lr=(0,Bt.utcFormat)("%Y-%m-%dT%H:%M:%S.%LZ"),pr=(0,Bt.utcParse)("%Y-%m-%dT%H:%M:%S.%LZ"),gr=(0,hn.format)(",");function dr(r){return r&&!isNaN(+r)?gr(+r):r}function dn(r,e,t){r[e]===void 0||r[e][t]===void 0||e==="__proto__"||e==="constructor"||e==="prototype"||delete r[e][t]}var Oe="DefinitionList",mr=/([a-zA-Z]:)?(.*[\\\/])(.*)(\((\d+),(\d+)\))/,fn=["Avg","Min","Max","Delta","StdDev"],Dn=["SkewMin","SkewMax","NodeMin","NodeMax"],hr=/[A-Z][a-z]*/g;function fr(r){for(let t of Dn){let s=r.indexOf(t);if(s===0){let n="",i=r.slice(s+t.length);return{measure:n,ext:t,label:i}}}let e=r.match(hr);if(e?.length){let t=e.shift(),s=e.join("");for(let n of fn){let i=s.indexOf(n);if(i===0)return s=s.slice(i+n.length),{measure:t,ext:n,label:s}}return{measure:t,ext:"",label:s}}return{measure:"",ext:"",label:r}}var mn={};function Cn(r){let e=mn[r];return e||(e=fr(r),mn[r]=e),e}function G(r,e){return r.__formattedProps?.[e]??r[e]}function Pt(r){if(r===void 0)return;let e=parseFloat(r);return isNaN(e)?void 0:e}function Dr(r,e,t){let s=Cn(e);if(!t[s.measure]){t[s.label]=!0;let n=Pt(r[`${s.measure}Avg${s.label}`]),i=Pt(r[`${s.measure}Min${s.label}`]),o=Pt(r[`${s.measure}Max${s.label}`]),a=Pt(r[`${s.measure}StdDev${s.label}`]),c=Math.max((n-i)/a,(o-n)/a);return{Key:`${s.measure}${s.label}`,Value:G(r,`${s.measure}${s.label}`),Avg:G(r,`${s.measure}Avg${s.label}`),Min:G(r,`${s.measure}Min${s.label}`),Max:G(r,`${s.measure}Max${s.label}`),Delta:G(r,`${s.measure}Delta${s.label}`),StdDev:G(r,`${s.measure}StdDev${s.label}`),StdDevs:isNaN(c)?void 0:c,SkewMin:G(r,`SkewMin${s.label}`),SkewMax:G(r,`SkewMax${s.label}`),NodeMin:G(r,`NodeMin${s.label}`),NodeMax:G(r,`NodeMax${s.label}`)}}return null}var It=(0,T.scopedLogger)("workunit.ts"),Mt=class extends T.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}`)}},Tt=new Mt,ee=class r extends T.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}_debugMode=!1;_debugAllGraph;_submitAction;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get Owner(){return this.get("Owner","")}get Cluster(){return this.get("Cluster","")}get Jobname(){return this.get("Jobname","")}get Description(){return this.get("Description","")}get ActionEx(){return this.get("ActionEx","")}get StateID(){return this.get("StateID",0)}get State(){return this.get("State")||xt[this.StateID]}get Protected(){return this.get("Protected",!1)}get Exceptions(){return this.get("Exceptions",{ECLException:[]})}get ResultViews(){return this.get("ResultViews",{View:[]})}_resultCache=new _e;get ResultCount(){return this.get("ResultCount",0)}get Results(){return this.get("Results",{ECLResult:[]})}get CResults(){return this.Results.ECLResult.map(e=>this._resultCache.get(e,()=>Ve.attach(this.connection,this.Wuid,e,this.ResultViews.View)))}get SequenceResults(){let e={};return this.CResults.forEach(t=>{e[t.Sequence]=t}),e}get Timers(){return this.get("Timers",{ECLTimer:[]})}get CTimers(){return this.Timers.ECLTimer.map(e=>new je(this.connection,this.Wuid,e))}_graphCache=new Me;get GraphCount(){return this.get("GraphCount",0)}get Graphs(){return this.get("Graphs",{ECLGraph:[]})}get CGraphs(){return this.Graphs.ECLGraph.map(e=>this._graphCache.get(e,()=>new Te(this,e,this.CTimers)))}get ThorLogList(){return this.get("ThorLogList")}get ResourceURLCount(){return this.get("ResourceURLCount",0)}get ResourceURLs(){return this.get("ResourceURLs",{URL:[]})}get CResourceURLs(){return this.ResourceURLs.URL.map(e=>new Ne(this,e))}get TotalClusterTime(){return this.get("TotalClusterTime","")}get DateTimeScheduled(){return this.get("DateTimeScheduled")}get IsPausing(){return this.get("IsPausing")}get ThorLCR(){return this.get("ThorLCR")}get ApplicationValues(){return this.get("ApplicationValues",{ApplicationValue:[]})}get HasArchiveQuery(){return this.get("HasArchiveQuery")}get StateEx(){return this.get("StateEx")}get PriorityClass(){return this.get("PriorityClass")}get PriorityLevel(){return this.get("PriorityLevel")}get Snapshot(){return this.get("Snapshot")}get ResultLimit(){return this.get("ResultLimit")}get EventSchedule(){return this.get("EventSchedule")}get Query(){return this.get("Query")}get HelpersCount(){return this.get("HelpersCount",0)}get Helpers(){return this.get("Helpers",{ECLHelpFile:[]})}get DebugValues(){return this.get("DebugValues")}get AllowedClusters(){return this.get("AllowedClusters")}get ErrorCount(){return this.get("ErrorCount",0)}get WarningCount(){return this.get("WarningCount",0)}get InfoCount(){return this.get("InfoCount",0)}get AlertCount(){return this.get("AlertCount",0)}get SourceFileCount(){return this.get("SourceFileCount",0)}get SourceFiles(){return this.get("SourceFiles",{ECLSourceFile:[]})}get CSourceFiles(){return this.SourceFiles.ECLSourceFile.map(e=>new He(this.connection,this.Wuid,e))}get VariableCount(){return this.get("VariableCount",0)}get Variables(){return this.get("Variables",{ECLResult:[]})}get TimerCount(){return this.get("TimerCount",0)}get HasDebugValue(){return this.get("HasDebugValue")}get ApplicationValueCount(){return this.get("ApplicationValueCount",0)}get XmlParams(){return this.get("XmlParams")}get AccessFlag(){return this.get("AccessFlag")}get ClusterFlag(){return this.get("ClusterFlag")}get ResultViewCount(){return this.get("ResultViewCount",0)}get DebugValueCount(){return this.get("DebugValueCount",0)}get WorkflowCount(){return this.get("WorkflowCount",0)}get Archived(){return this.get("Archived")}get RoxieCluster(){return this.get("RoxieCluster")}get DebugState(){return this.get("DebugState",{})}get Queue(){return this.get("Queue")}get Active(){return this.get("Active")}get Action(){return this.get("Action")}get Scope(){return this.get("Scope")}get AbortBy(){return this.get("AbortBy")}get AbortTime(){return this.get("AbortTime")}get Workflows(){return this.get("Workflows")}get TimingData(){return this.get("TimingData")}get HelpersDesc(){return this.get("HelpersDesc")}get GraphsDesc(){return this.get("GraphsDesc")}get SourceFilesDesc(){return this.get("SourceFilesDesc")}get ResultsDesc(){return this.get("ResultsDesc")}get VariablesDesc(){return this.get("VariablesDesc")}get TimersDesc(){return this.get("TimersDesc")}get DebugValuesDesc(){return this.get("DebugValuesDesc")}get ApplicationValuesDesc(){return this.get("ApplicationValuesDesc")}get WorkflowsDesc(){return this.get("WorkflowsDesc")}get ServiceNames(){return this.get("ServiceNames")}get CompileCost(){return this.get("CompileCost")}get ExecuteCost(){return this.get("ExecuteCost")}get FileAccessCost(){return this.get("FileAccessCost")}get NoAccess(){return this.get("NoAccess")}get ECLWUProcessList(){return this.get("ECLWUProcessList")}static create(e){let t=new r(e);return t.connection.WUCreate().then(s=>(Tt.set(t),t.set(s.Workunit),t))}static attach(e,t,s){let n=Tt.get({BaseUrl:e.baseUrl,Wuid:t},()=>new r(e,t));return s&&n.set(s),n}static existsLocal(e,t){return Tt.has({BaseUrl:e,Wuid:t})}static submit(e,t,s,n=!1){return r.create(e).then(i=>i.update({QueryText:s})).then(i=>n?i.submit(t,O.Action.Compile):i.submit(t))}static compile(e,t,s){return r.submit(e,t,s,!0)}static query(e,t){return new x(e).WUQuery(t).then(n=>n.Workunits.ECLWorkunit.map(function(i){return r.attach(e,i.Wuid,i)}))}constructor(e,t){super(),this.connection=new x(e),this.topologyConnection=new W(e),this.clearState(t)}clearState(e){this.clear({Wuid:e,StateID:0})}update(e){return this.connection.WUUpdate({...e,Wuid:this.Wuid,StateOrig:this.StateID,JobnameOrig:this.Jobname,DescriptionOrig:this.Description,ProtectedOrig:this.Protected,ClusterOrig:this.Cluster}).then(t=>(this.set(t.Workunit),this))}submit(e,t=O.Action.Run,s){let n;return e!==void 0?n=Promise.resolve(e):n=this.topologyConnection.DefaultTpLogicalClusterQuery().then(i=>i.Name),this._debugMode=!1,t===O.Action.Debug&&(t=O.Action.Run,this._debugMode=!0),n.then(i=>this.connection.WUUpdate({Wuid:this.Wuid,Action:t,ResultLimit:s,DebugValues:{DebugValue:[{Name:"Debug",Value:this._debugMode?"1":""}]}}).then(o=>(this.set(o.Workunit),this._submitAction=t,this.connection.WUSubmit({Wuid:this.Wuid,Cluster:i})))).then(()=>this)}isComplete(){switch(this.StateID){case 1:return this.ActionEx==="compile"||this._submitAction===O.Action.Compile;case 3:case 4:case 7:case 999:return!0;default:}return!1}isFailed(){switch(this.StateID){case 7:case 4:return!0;default:}return!1}isDeleted(){switch(this.StateID){case 999:return!0;default:}return!1}isDebugging(){switch(this.StateID){case 14:case 15:return!0;default:}return this._debugMode}isRunning(){switch(this.StateID){case 1:case 2:case 6:case 8:case 14:case 15:return!0;default:}return!1}setToFailed(){return this.WUAction(U.ECLWUActions.SetToFailed)}pause(){return this.WUAction(U.ECLWUActions.Pause)}pauseNow(){return this.WUAction(U.ECLWUActions.PauseNow)}resume(){return this.WUAction(U.ECLWUActions.Resume)}abort(){return this.WUAction(U.ECLWUActions.Abort)}protect(){return this.WUAction(U.ECLWUActions.Protect)}unprotect(){return this.WUAction(U.ECLWUActions.Unprotect)}delete(){return this.WUAction(U.ECLWUActions.Delete)}restore(){return this.WUAction(U.ECLWUActions.Restore)}deschedule(){return this.WUAction(U.ECLWUActions.Deschedule)}reschedule(){return this.WUAction(U.ECLWUActions.Reschedule)}resubmit(){return this.WUResubmit({CloneWorkunit:!1,ResetWorkflow:!1}).then(()=>(this.clearState(this.Wuid),this.refresh().then(()=>(this._monitor(),this))))}clone(){return this.WUResubmit({CloneWorkunit:!0,ResetWorkflow:!1}).then(e=>r.attach(this.connection.opts(),e.WUs.WU[0].WUID).refresh())}async refreshState(){return await this.WUQuery(),this.StateID===1&&!this.ActionEx&&!this._submitAction&&await this.refreshInfo(),this}async refreshInfo(e){return await this.WUInfo(e),this}async refreshDebug(){return await this.debugStatus(),this}async refresh(e=!1,t){return e?await Promise.all([this.refreshInfo(t),this.refreshDebug()]):await this.refreshState(),this}eclExceptions(){return this.Exceptions.ECLException}fetchArchive(){return this.connection.WUFileEx({Wuid:this.Wuid,Type:"ArchiveQuery"})}fetchECLExceptions(){return this.WUInfo({IncludeExceptions:!0}).then(()=>this.eclExceptions())}fetchResults(){return this.WUInfo({IncludeResults:!0}).then(()=>this.CResults)}fetchGraphs(){return this.WUInfo({IncludeGraphs:!0}).then(()=>this.CGraphs)}fetchQuery(){return this.WUInfo({IncludeECL:!0,TruncateEclTo64k:!1}).then(()=>this.Query)}fetchHelpers(){return this.WUInfo({IncludeHelpers:!0}).then(()=>this.Helpers?.ECLHelpFile||[])}fetchAllowedClusters(){return this.WUInfo({IncludeAllowedClusters:!0}).then(()=>this.AllowedClusters?.AllowedCluster||[])}fetchTotalClusterTime(){return this.WUInfo({IncludeTotalClusterTime:!0}).then(()=>this.TotalClusterTime)}fetchServiceNames(){return this.WUInfo({IncludeServiceNames:!0}).then(()=>this.ServiceNames?.Item)}fetchDetailsMeta(e={}){return this.WUDetailsMeta(e)}fetchDetailsRaw(e={}){return this.WUDetails(e).then(t=>t.Scopes.Scope)}normalizeDetails(e,t){let s={id:{Measure:"label"},name:{Measure:"label"},type:{Measure:"label"}},n=[];for(let i of t){let o={},a={};if(i&&i.Id&&i.Properties&&i.Properties.Property)for(let u in i.Properties.Property){let l=i.Properties.Property[u];if(l.Measure==="ns"&&(l.Measure="s"),l.Name==="Kind"){let g=parseInt(l.RawValue,10);l.Formatted=e.Activities.Activity.filter(f=>f.Kind===g)[0].Name??l.RawValue}switch(s[l.Name]={...l},dn(s,l.Name,"RawValue"),dn(s,l.Name,"Formatted"),l.Measure){case"bool":o[l.Name]=!!+l.RawValue;break;case"sz":o[l.Name]=+l.RawValue;break;case"s":o[l.Name]=+l.RawValue/1e9;break;case"ns":o[l.Name]=+l.RawValue;break;case"ts":o[l.Name]=new Date(+l.RawValue/1e3).toISOString();break;case"cnt":o[l.Name]=+l.RawValue;break;case"cost":o[l.Name]=+l.RawValue/1e6;break;case"node":o[l.Name]=+l.RawValue;break;case"skw":o[l.Name]=+l.RawValue;break;case"cpu":case"ppm":case"ip":case"cy":case"en":case"txt":case"id":case"fname":default:o[l.Name]=l.RawValue}a[l.Name]=dr(l.Formatted??o[l.Name])}let c={id:i.Id,name:i.ScopeName,type:i.ScopeType,Kind:i.Kind,Label:i.Label,__formattedProps:a,__groupedProps:{},__groupedRawProps:{},__StdDevs:0,__StdDevsSource:"",...o};if(c[Oe])try{let u=JSON.parse(c[Oe].split("\\").join("\\\\"));c[Oe]=[],u.forEach((l,g)=>{let f=l.match(mr);if(f){let E=(f[1]??"")+f[2]+f[3],ss=parseInt(f[5]),D=parseInt(f[6]);c[Oe].push({filePath:E,line:ss,col:D})}})}catch{It.error(`Unexpected "DefinitionList": ${c[Oe]}`)}let p={};for(let u in c)if(u.indexOf("__")!==0){let l=Dr(c,u,p);l&&(c.__groupedProps[l.Key]=l,!isNaN(l.StdDevs)&&c.__StdDevs<l.StdDevs&&(c.__StdDevs=l.StdDevs,c.__StdDevsSource=l.Key))}n.push(c)}return{meta:e,columns:s,data:n}}fetchDetailsNormalized(e={}){return Promise.all([this.fetchDetailsMeta(),this.fetchDetailsRaw(e)]).then(t=>this.normalizeDetails(t[0],t[1]))}fetchInfo(e={}){return this.WUInfo(e)}fetchDetails(e={}){return this.WUDetails(e).then(t=>t.Scopes.Scope.map(s=>new he(this,s)))}fetchDetailsHierarchy(e={}){return this.WUDetails(e).then(t=>{let s=[],n={};t.Scopes.Scope.forEach(i=>{if(n[i.ScopeName])return n[i.ScopeName].update(i),null;{let o=new he(this,i);return n[o.ScopeName]=o,o}});for(let i in n)if(n.hasOwnProperty(i)){let o=n[i],a=o.parentScope();a&&n[a]?n[a].children().push(o):s.push(o)}return s})}fetchGraphDetails(e=[],t){return this.fetchDetails({ScopeFilter:{MaxDepth:999999,Ids:e,ScopeTypes:t},NestedFilter:{Depth:999999,ScopeTypes:["graph","subgraph","activity","edge","function"]},PropertiesToReturn:{AllStatistics:!0,AllAttributes:!0,AllHints:!0,AllProperties:!0,AllScopes:!0},ScopeOptions:{IncludeId:!0,IncludeScope:!0,IncludeScopeType:!0},PropertyOptions:{IncludeName:!0,IncludeRawValue:!0,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}})}fetchScopeGraphs(e=[]){return this.fetchGraphDetails(e,["graph"]).then(t=>we(t))}fetchTimeElapsed(){return this.fetchDetails({ScopeFilter:{PropertyFilters:{PropertyFilter:[{Name:"TimeElapsed"}]}}}).then(e=>{let t={};e.forEach(n=>{t[n.ScopeName]=t[n.ScopeName]||{scope:n.ScopeName,start:null,elapsed:null,finish:null},n.CAttributes.forEach(i=>{i.Name==="TimeElapsed"?t[n.ScopeName].elapsed=+i.RawValue:i.Measure==="ts"&&i.Name.indexOf("Started")>=0&&(t[n.ScopeName].start=i.Formatted)})});let s=[];for(let n in t){let i=t[n];if(i.start&&i.elapsed){let o=pr(i.start);o.setMilliseconds(o.getMilliseconds()+i.elapsed/1e6),i.finish=lr(o),s.push(i)}}return s.sort((n,i)=>n.start<i.start?-1:n.start>i.start?1:0),s})}_monitor(){if(this.isComplete()){this._monitorTickCount=0;return}super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?1e3:this._monitorTickCount<=3?3e3:this._monitorTickCount<=5?5e3:this._monitorTickCount<=7?1e4:e}on(e,t,s){if(this.isCallback(t))switch(e){case"completed":super.on("propChanged","StateID",n=>{this.isComplete()&&t([n])});break;case"changed":super.on(e,t);break;default:}else switch(e){case"changed":super.on(e,t,s);break;default:}return this._monitor(),this}watchUntilComplete(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),this.isComplete()&&(n.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),(this.isComplete()||this.isRunning())&&(n.release(),t(this))})})}WUQuery(e={}){return this.connection.WUQuery({...e,Wuid:this.Wuid}).then(t=>(t.Workunits.ECLWorkunit.length===0?(this.clearState(this.Wuid),this.set("StateID",999)):this.set(t.Workunits.ECLWorkunit[0]),t)).catch(t=>{if(!t.Exception.some(n=>n.Code===20081?(this.clearState(this.Wuid),this.set("StateID",999),!0):!1))throw It.warning(`Unexpected ESP exception: ${t.message}`),t;return{}})}WUCreate(){return this.connection.WUCreate().then(e=>(this.set(e.Workunit),Tt.set(this),e))}WUInfo(e={}){let t=e.IncludeResults||e.IncludeResultsViewNames;return this.connection.WUInfo({...e,Wuid:this.Wuid,IncludeResults:t,IncludeResultsViewNames:t,SuppressResultSchemas:!1}).then(s=>(this.set(s.Workunit),t&&this.set({ResultViews:s.ResultViews}),s)).catch(s=>{if(!s.Exception.some(i=>i.Code===20080?(this.clearState(this.Wuid),this.set("StateID",999),!0):!1))throw It.warning(`Unexpected ESP exception: ${s.message}`),s;return{}})}WUResubmit(e){return this.connection.WUResubmit((0,T.deepMixinT)({},e,{Wuids:{Item:[this.Wuid]}}))}WUDetailsMeta(e){return this.connection.WUDetailsMeta(e)}WUDetails(e){return this.connection.WUDetails((0,T.deepMixinT)({ScopeFilter:{MaxDepth:9999},ScopeOptions:{IncludeMatchedScopesInResults:!0,IncludeScope:!0,IncludeId:!1,IncludeScopeType:!1},PropertyOptions:{IncludeName:!0,IncludeRawValue:!1,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}},e,{WUID:this.Wuid})).then(t=>(0,T.deepMixinT)({Scopes:{Scope:[]}},t))}WUAction(e){return this.connection.WUAction({Wuids:{Item:[this.Wuid]},WUActionType:e}).then(t=>this.refresh().then(()=>(this._monitor(),t)))}publish(e){return this.connection.WUPublishWorkunit({Wuid:this.Wuid,Cluster:this.Cluster,JobName:e||this.Jobname,AllowForeignFiles:!0,Activate:U.WUQueryActivationMode.ActivateQuery,Wait:5e3})}publishEx(e){let t=new Ie({baseUrl:""}),s={Wuid:this.Wuid,Cluster:this.Cluster,JobName:this.Jobname,AllowForeignFiles:!0,Activate:1,Wait:5e3,...e};return t.WUPublishWorkunitEx(s)}WUCDebug(e,t={}){let s="";for(let n in t)t.hasOwnProperty(n)&&(s+=` ${n}='${t[n]}'`);return this.connection.WUCDebugEx({Wuid:this.Wuid,Command:`<debug:${e} uid='${this.Wuid}'${s}/>`}).then(n=>n)}debug(e,t){return this.isDebugging()?this.WUCDebug(e,t).then(s=>{let n=s.children(e);return n.length?n[0]:new T.XMLNode(e)}).catch(s=>(It.error(s),Promise.resolve(new T.XMLNode(e)))):Promise.resolve(new T.XMLNode(e))}debugStatus(){return this.isDebugging()?this.debug("status").then(e=>{let t={...this.DebugState,...e.$};return this.set({DebugState:t}),e}):Promise.resolve({DebugState:{state:"unknown"}})}debugContinue(e=""){return this.debug("continue",{mode:e})}debugStep(e){return this.debug("step",{mode:e})}debugPause(){return this.debug("interrupt")}debugQuit(){return this.debug("quit")}debugDeleteAllBreakpoints(){return this.debug("delete",{idx:0})}debugBreakpointResponseParser(e){return e.children().map(t=>{if(t.name==="break")return t.$})}debugBreakpointAdd(e,t,s){return this.debug("breakpoint",{id:e,mode:t,action:s}).then(n=>this.debugBreakpointResponseParser(n))}debugBreakpointList(){return this.debug("list").then(e=>this.debugBreakpointResponseParser(e))}debugGraph(){return this._debugAllGraph&&this.DebugState._prevGraphSequenceNum===this.DebugState.graphSequenceNum?Promise.resolve(this._debugAllGraph):this.debug("graph",{name:"all"}).then(e=>(this.DebugState._prevGraphSequenceNum=this.DebugState.graphSequenceNum,this._debugAllGraph=Fs(this.Wuid,e),this._debugAllGraph))}debugBreakpointValid(e){return this.debugGraph().then(t=>Rr(t,e))}debugPrint(e,t=0,s=10){return this.debug("print",{edgeID:e,startRow:t,numRows:s}).then(n=>n.children().map(i=>{let o={};return i.children().forEach(a=>{o[a.name]=a.content}),o}))}},Is="definition";function Cr(r){return r._[Is]!==void 0}function Sr(r){let e=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(r._[Is]);if(e){let[,t,s,n]=e;return t.replace(/\/\.\//g,"/"),{id:r._.id,file:t,line:+s,column:+n}}throw new Error(`Bad definition: ${r._[Is]}`)}function Rr(r,e){let t=[];for(let s of r.vertices)if(Cr(s)){let n=Sr(s);(n&&!e||e===n.file)&&t.push(n)}return t.sort((s,n)=>s.line-n.line)}var wt,Ts=class r extends Nt.StateObject{connection;get properties(){return this.get()}get Exceptions(){return this.get("Exceptions")}get Build(){return this.get("Build")}get ThorClusterList(){return this.get("ThorClusterList")}get RoxieClusterList(){return this.get("RoxieClusterList")}get HThorClusterList(){return this.get("HThorClusterList")}get DFUJobs(){return this.get("DFUJobs")}get Running(){return this.get("Running",{ActiveWorkunit:[]})}get BannerContent(){return this.get("BannerContent")}get BannerColor(){return this.get("BannerColor")}get BannerSize(){return this.get("BannerSize")}get BannerScroll(){return this.get("BannerScroll")}get ChatURL(){return this.get("ChatURL")}get ShowBanner(){return this.get("ShowBanner")}get ShowChatURL(){return this.get("ShowChatURL")}get SortBy(){return this.get("SortBy")}get Descending(){return this.get("Descending")}get SuperUser(){return this.get("SuperUser")}get AccessRight(){return this.get("AccessRight")}get ServerJobQueues(){return this.get("ServerJobQueues")}get ActivityTime(){return this.get("ActivityTime")}get DaliDetached(){return this.get("DaliDetached")}static attach(e,t){return wt||(wt=new r(e)),t&&wt.set(t),wt}constructor(e){super(),e instanceof de?this.connection=e:this.connection=new de(e),this.clear({})}runningWorkunits(e=""){return this.Running.ActiveWorkunit.filter(t=>e===""||t.ClusterName===e).map(t=>ee.attach(this.connection.connectionOptions(),t.Wuid,t))}setBanner(e){return this.connection.SetBanner({...e}).then(t=>(this.set(t),this))}lazyRefresh=(0,Nt.debounce)(async()=>{let e=await this.connection.Activity({});return this.set(e),this});async refresh(){return this.lazyRefresh()}};var fe=require("@hpcc-js/util");var xr=(0,fe.scopedLogger)("logicalFile.ts"),Qt=class extends fe.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Cluster}-${e.Name}`)}},Ar=new Qt,Ms=class r extends fe.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get Cluster(){return this.get("Cluster")}get Name(){return this.get("Name")}get Filename(){return this.get("Filename")}get Prefix(){return this.get("Prefix")}get NodeGroup(){return this.get("NodeGroup")}get NumParts(){return this.get("NumParts")}get Description(){return this.get("Description")}get Dir(){return this.get("Dir")}get PathMask(){return this.get("PathMask")}get Filesize(){return this.get("Filesize")}get FileSizeInt64(){return this.get("FileSizeInt64")}get RecordSize(){return this.get("RecordSize")}get RecordCount(){return this.get("RecordCount")}get RecordSizeInt64(){return this.get("RecordSizeInt64")}get RecordCountInt64(){return this.get("RecordCountInt64")}get Wuid(){return this.get("Wuid")}get Owner(){return this.get("Owner")}get JobName(){return this.get("JobName")}get Persistent(){return this.get("Persistent")}get Format(){return this.get("Format")}get MaxRecordSize(){return this.get("MaxRecordSize")}get CsvSeparate(){return this.get("CsvSeparate")}get CsvQuote(){return this.get("CsvQuote")}get CsvTerminate(){return this.get("CsvTerminate")}get CsvEscape(){return this.get("CsvEscape")}get Modified(){return this.get("Modified")}get Ecl(){return this.get("Ecl")}get Stat(){return this.get("Stat")}get DFUFilePartsOnClusters(){return this.get("DFUFilePartsOnClusters")}get isSuperfile(){return this.get("isSuperfile")}get ShowFileContent(){return this.get("ShowFileContent")}get subfiles(){return this.get("subfiles")}get Superfiles(){return this.get("Superfiles")}get ProtectList(){return this.get("ProtectList")}get FromRoxieCluster(){return this.get("FromRoxieCluster")}get Graphs(){return this.get("Graphs")}get UserPermission(){return this.get("UserPermission")}get ContentType(){return this.get("ContentType")}get CompressedFileSize(){return this.get("CompressedFileSize")}get PercentCompressed(){return this.get("PercentCompressed")}get IsCompressed(){return this.get("IsCompressed")}get BrowseData(){return this.get("BrowseData")}get jsonInfo(){return this.get("jsonInfo")}get binInfo(){return this.get("binInfo")}get PackageID(){return this.get("PackageID")}get Partition(){return this.get("Partition")}get Blooms(){return this.get("Blooms")}get ExpireDays(){return this.get("ExpireDays")}get KeyType(){return this.get("KeyType")}get IsRestricted(){return this.get("IsRestricted")}get AtRestCost(){return this.get("AtRestCost")}get AccessCost(){return this.get("AccessCost")}get StateID(){return this.get("StateID")}get ExpirationDate(){return this.get("ExpirationDate")}get ExtendedIndexInfo(){return this.get("ExtendedIndexInfo")}get properties(){return this.get()}static attach(e,t,s,n){let i=Ar.get({BaseUrl:e.baseUrl,Cluster:t,Name:s},()=>new r(e,t,s));return n&&i.set(n),i}constructor(e,t,s){super(),e instanceof ge?this.connection=e:this.connection=new ge(e),this.clear({Cluster:t,Name:s})}filePartsOnCluster(){return[...this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[]]}fileParts(){let e=[];for(let t of this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[])for(let s of t?.DFUFileParts?.DFUPart||[]){let n={...t,...s};delete n.DFUFileParts,e.push(n)}return e}update(e){return this.connection.DFUInfo({...e,Cluster:this.Cluster,Name:this.Name}).then(t=>(this.set({Cluster:this.Cluster,...t.FileDetail}),t))}fetchInfo(){return this.connection.DFUInfo({Cluster:this.Cluster,Name:this.Name}).then(e=>(this.set({Cluster:this.Cluster,...e.FileDetail}),e.FileDetail)).catch(e=>{if(!e.Exception.some(s=>s.Code===20038?(this.set("Name",this.Name+" (Deleted)"),this.set("StateID",999),!0):!1))throw xr.warning(`Unexpected ESP exception: ${e.message}`),e;return{}})}fetchDefFile(e){return this.connection.DFUFile({Name:this.Name,Format:e})}fetchListHistory(){return this.connection.ListHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}eraseHistory(){return this.connection.EraseHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}};var Gt=require("@hpcc-js/util");var Lt=class extends Gt.Cache{constructor(){super(e=>e.Address)}},Wr=new Lt,Ye=class r extends Gt.StateObject{connection;get Address(){return this.get("Address")}get ConfigAddress(){return this.get("ConfigAddress")}get Name(){return this.get("Name")}get ProcessType(){return this.get("ProcessType")}get DisplayType(){return this.get("DisplayType")}get Description(){return this.get("Description")}get AgentVersion(){return this.get("AgentVersion")}get Contact(){return this.get("Contact")}get Location(){return this.get("Location")}get UpTime(){return this.get("UpTime")}get ComponentName(){return this.get("ComponentName")}get ComponentPath(){return this.get("ComponentPath")}get RoxieState(){return this.get("RoxieState")}get RoxieStateDetails(){return this.get("RoxieStateDetails")}get OS(){return this.get("OS")}get ProcessNumber(){return this.get("ProcessNumber")}get Channels(){return this.get("Channels")}get Processors(){return this.get("Processors")}get Storage(){return this.get("Storage")}get Running(){return this.get("Running")}get PhysicalMemory(){return this.get("PhysicalMemory")}get VirtualMemory(){return this.get("VirtualMemory")}get ComponentInfo(){return this.get("ComponentInfo")}get Exception(){return this.get("Exception")}static attach(e,t,s){let n=Wr.get({Address:t},()=>new r(e));return s&&n.set(s),n}constructor(e){super(),e instanceof k?this.connection=e:this.connection=new k(e)}};var ie=require("@hpcc-js/util"),Sn=require("d3-format");var se=require("@hpcc-js/util");var vt=require("@hpcc-js/util");var kt=class extends vt.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}`)}},yr=new kt,te=class r extends vt.StateObject{connection;machineConnection;get BaseUrl(){return this.connection.baseUrl}get Name(){return this.get("Name")}get Prefix(){return this.get("Prefix")}get Type(){return this.get("Type")}get IsDefault(){return this.get("IsDefault")}get TpClusters(){return this.get("TpClusters")}get TpEclCCServers(){return this.get("TpEclCCServers")}get TpEclServers(){return this.get("TpEclServers")}get TpEclAgents(){return this.get("TpEclAgents")}get TpEclSchedulers(){return this.get("TpEclSchedulers")}get MachineInfoEx(){return this.get("MachineInfoEx",[])}get CMachineInfoEx(){return this.MachineInfoEx.map(e=>Ye.attach(this.machineConnection,e.Address,e))}static attach(e,t,s){let n=yr.get({BaseUrl:e.baseUrl,Name:t},()=>new r(e,t));return s&&n.set(s),n}constructor(e,t){super(),e instanceof W?(this.connection=e,this.machineConnection=new k(e.connectionOptions())):(this.connection=new W(e),this.machineConnection=new k(e)),this.clear({Name:t})}fetchMachines(e={}){return this.machineConnection.GetTargetClusterInfo({TargetClusters:{Item:[`${this.Type}:${this.Name}`]},...e}).then(t=>{let s=[];for(let n of t.TargetClusterInfoList.TargetClusterInfo)for(let i of n.Processes.MachineInfoEx)s.push(i);return this.set("MachineInfoEx",s),this.CMachineInfoEx})}machineStats(){let e=0,t=0,s=0;for(let n of this.CMachineInfoEx)for(let i of n.Storage.StorageInfo){t+=i.Available,s+=i.Total;let o=1-i.Available/i.Total;o>e&&(e=o)}return{maxDisk:e,meanDisk:1-(s?t/s:1)}}fetchUsage(){return this.machineConnection.GetTargetClusterUsageEx([this.Name])}};function Er(r){let e;return r instanceof W?e=r:e=new W(r),e.TpListTargetClusters({}).then(t=>t.TargetClusters.TpClusterNameType.map(s=>te.attach(r,s.Name,s)))}var Bs={};function Ur(r){if(!Bs[r.baseUrl]){let e;r instanceof W?e=r:e=new W(r),Bs[r.baseUrl]=e.TpListTargetClusters({}).then(t=>{let s,n,i;t.TargetClusters.TpClusterNameType.forEach(a=>{s||(s=a),!n&&a.IsDefault===!0&&(n=a),!i&&a.Type==="hthor"&&(i=a)});let o=n||i||s;return te.attach(r,o.Name,o)})}return Bs[r.baseUrl]}var Vt=class extends se.Cache{constructor(){super(e=>e.BaseUrl)}},Fr=new Vt,Xe=class r extends se.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get TargetClusters(){return this.get("TargetClusters")}get CTargetClusters(){return this.TargetClusters.map(e=>te.attach(this.connection,e.Name,e))}get LogicalClusters(){return this.get("LogicalClusters")}get Services(){return this.get("Services")}static attach(e,t){let s=Fr.get({BaseUrl:e.baseUrl},()=>new r(e));return t&&s.set(t),s}constructor(e){super(),e instanceof W?this.connection=e:this.connection=new W(e)}GetESPServiceBaseURL(e=""){return this.connection.TpServiceQuery({}).then(t=>{let s=this.connection.protocol(),n=this.connection.ip(),i=s==="https:"?"18002":"8002";if((0,se.exists)("ServiceList.TpEspServers.TpEspServer",t)){for(let o of t.ServiceList.TpEspServers.TpEspServer)if((0,se.exists)("TpBindings.TpBinding",o))for(let a of o.TpBindings.TpBinding)a.Service===e&&a.Protocol+":"===s&&(i=a.Port)}return`${s}//${n}:${i}/`})}fetchTargetClusters(){return this.connection.TpTargetClusterQuery({Type:"ROOT"}).then(e=>(this.set({TargetClusters:e.TpTargetClusters?.TpTargetCluster??[]}),this.CTargetClusters))}fetchLogicalClusters(e={}){return this.connection.TpLogicalClusterQuery(e).then(t=>(this.set({LogicalClusters:t.TpLogicalClusters.TpLogicalCluster}),this.LogicalClusters))}fetchServices(e={}){return this.connection.TpServiceQuery(e).then(t=>(this.set({Services:t.ServiceList}),this.Services))}_prevRefresh;refresh(e=!1){return(!this._prevRefresh||e)&&(this._prevRefresh=Promise.all([this.fetchTargetClusters(),this.fetchLogicalClusters(),this.fetchServices()]).then(()=>this)),this._prevRefresh}on(e,t,s){if(this.isCallback(t))switch(e){case"changed":super.on(e,t);break;default:}else switch(e){case"changed":super.on(e,t,s);break;default:}return this._monitor(),this}};function X(r,e,t){e==="__proto__"||e==="constructor"||e==="prototype"||(r[e]=t)}function qe(r){return r=""+r,r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;")}function br(r){if(r){if(!isNaN(+r))return parseFloat(r)}else return 0;let t=/(?:(?:(\d+).days.)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+\.\d+|\d+)s))|(?:(\d+\.\d+|\d+)ms|(\d+\.\d+|\d+)us|(\d+\.\d+|\d+)ns)/.exec(r);if(!t)return 0;let s=+t[1]||0,n=+t[2]||0,i=+t[3]||0,o=+t[4]||0,a=+t[5]||0,c=+t[6]||0,p=+t[7]||0;return s*24*60*60+n*60*60+i*60+o+a/1e3+c/1e6+p/1e9}function q(r,e){let t=r.indexOf(e);return t!==-1?parseFloat(r.substring(0,t)):-1}function Pr(r){if(r){if(!isNaN(+r))return parseFloat(r)}else return 0;let e=q(r,"Kb");return e>=0?e*1024:(e=q(r,"Mb"),e>=0?e*Math.pow(1024,2):(e=q(r,"Gb"),e>=0?e*Math.pow(1024,3):(e=q(r,"Tb"),e>=0?e*Math.pow(1024,4):(e=q(r,"Pb"),e>=0?e*Math.pow(1024,5):(e=q(r,"Eb"),e>=0?e*Math.pow(1024,6):(e=q(r,"Zb"),e>=0?e*Math.pow(1024,7):(e=q(r,"b"),e>=0?e:0)))))))}function Ir(r){return r?parseFloat(r):0}var ws=class{graph;m_xgmml;m_visibleSubgraphs;m_visibleVertices;m_semiVisibleVertices;m_visibleEdges;noSpills;constructor(e){this.graph=e,this.m_xgmml="",this.m_visibleSubgraphs={},this.m_visibleVertices={},this.m_semiVisibleVertices={},this.m_visibleEdges={}}calcVisibility(e,t,s,n){this.noSpills=n,e.forEach(i=>{this.graph.isVertex(i)?(this.calcInVertexVisibility(i,s),this.calcOutVertexVisibility(i,s)):this.graph.isEdge(i)?(this.calcInVertexVisibility(i.getSource(),s-1),this.calcOutVertexVisibility(i.getTarget(),s-1)):this.graph.isSubgraph(i)&&(this.m_visibleSubgraphs[i.__hpcc_id]=i,this.calcSubgraphVisibility(i,t-1))}),this.calcVisibility2()}calcInVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getInEdges().forEach(s=>{this.calcInVertexVisibility(s.getSource(),t-1)})}calcOutVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getOutEdges().forEach(s=>{this.calcOutVertexVisibility(s.getTarget(),t-1)})}calcSubgraphVisibility(e,t){if(t<0)return;t>0&&e.__hpcc_subgraphs.forEach((n,i)=>{this.calcSubgraphVisibility(n,t-1)}),e.__hpcc_subgraphs.forEach((n,i)=>{this.m_visibleSubgraphs[n.__hpcc_id]=n}),e.__hpcc_vertices.forEach((n,i)=>{this.m_visibleVertices[n.__hpcc_id]=n});let s={};this.graph.edges.forEach((n,i)=>{n.getSource().__hpcc_parent!==n.getTarget().__hpcc_parent&&e===this.getCommonAncestor(n)&&(s[n.getSource().__hpcc_parent.__hpcc_id+"::"+n.getTarget().__hpcc_parent.__hpcc_id]||(s[n.getSource().__hpcc_parent.__hpcc_id+"::"+n.getTarget().__hpcc_parent.__hpcc_id]=!0,this.m_visibleEdges[n.__hpcc_id]=n))})}buildVertexString(e,t){let s="",n="",i=e.getProperties();for(let o in i)t&&o.indexOf("_kind")>=0?n+='<att name="_kind" value="point"/>':o==="id"||o==="label"?s+=" "+o+'="'+qe(i[o])+'"':n+='<att name="'+o+'" value="'+qe(i[o])+'"/>';return"<node"+s+">"+n+"</node>"}buildEdgeString(e){let t="",s="",n=e.getProperties();for(let i in n)i.toLowerCase()==="id"||i.toLowerCase()==="label"||i.toLowerCase()==="source"||i.toLowerCase()==="target"?t+=" "+i+'="'+qe(n[i])+'"':s+='<att name="'+i+'" value="'+qe(n[i])+'"/>';return"<edge"+t+">"+s+"</edge>"}getAncestors(e,t){let s=e.__hpcc_parent;for(;s;)t.push(s),s=s.__hpcc_parent}getCommonAncestorV(e,t){let s=[],n=[];this.getAncestors(e,s),this.getAncestors(t,n);let i=s.length-1,o=n.length-1,a=null;for(;i>=0&&o>=0&&s[i]===n[o];)a=s[i],--i,--o;return a}getCommonAncestor(e){return this.getCommonAncestorV(e.getSource(),e.getTarget())}calcAncestorVisibility(e){let t=[];this.getAncestors(e,t),t.forEach((s,n)=>{this.m_visibleSubgraphs[s.__hpcc_id]=s})}calcVisibility2(){for(let e in this.m_visibleVertices){let t=this.m_visibleVertices[e];t.getInEdges().forEach((s,n)=>{this.m_visibleEdges[s.__hpcc_id]=s}),t.getOutEdges().forEach((s,n)=>{this.m_visibleEdges[s.__hpcc_id]=s}),this.calcAncestorVisibility(t)}this.calcSemiVisibleVertices()}addSemiVisibleEdge(e){e&&!this.m_visibleEdges[e.__hpcc_id]&&(this.m_visibleEdges[e.__hpcc_id]=e)}addSemiVisibleVertex(e){this.m_visibleVertices[e.__hpcc_id]||(this.m_semiVisibleVertices[e.__hpcc_id]=e,this.calcAncestorVisibility(e))}calcSemiVisibleVertices(){for(let e in this.m_visibleEdges){let t=this.m_visibleEdges[e],s=t.getSource();for(this.addSemiVisibleVertex(s);this.noSpills&&s.isSpill();){let i=s.getInEdges();if(i.length)this.addSemiVisibleEdge(i[0]),s=i[0].getSource(),this.addSemiVisibleVertex(s);else break}let n=t.getTarget();for(this.addSemiVisibleVertex(n);this.noSpills&&n.isSpill();){let i=n.getOutEdges();if(i.length)this.addSemiVisibleEdge(i[0]),n=i[0].getTarget(),this.addSemiVisibleVertex(n);else break}}}writeXgmml(){this.subgraphVisited(this.graph.subgraphs[0],!0),this.graph.edges.forEach((e,t)=>{this.edgeVisited(e)})}subgraphVisited(e,t=!1){if(this.m_visibleSubgraphs[e.__hpcc_id]){let s="";this.m_xgmml+=t?"":'<node id="'+e.__hpcc_id+'"><att><graph>';let n=this.m_xgmml.length;if(e.walkSubgraphs(this),e.walkVertices(this),n===this.m_xgmml.length){let o=e.__hpcc_vertices[0];o&&(this.m_xgmml+=this.buildVertexString(o,!0))}let i=e.getProperties();for(let o in i)s+='<att name="'+o+'" value="'+qe(i[o])+'"/>';this.m_xgmml+=t?"":"</graph></att>"+s+"</node>"}return!1}vertexVisited(e){this.m_visibleVertices[e.__hpcc_id]?this.m_xgmml+=this.buildVertexString(e,!1):this.m_semiVisibleVertices[e.__hpcc_id]&&(this.m_xgmml+=this.buildVertexString(e,!0))}edgeVisited(e){this.m_visibleEdges[e.__hpcc_id]&&(this.m_xgmml+=this.buildEdgeString(e))}},Je=class{__hpcc_graph;__hpcc_parent;__widget;__hpcc_id;_globalID;constructor(e,t){this.__hpcc_graph=e,this.__hpcc_id=t,this._globalID=t}getProperties(){let e={};for(let t in this)t.indexOf("__")!==0&&this.hasOwnProperty(t)&&(e[t]=this[t]);return e}},J=class extends Je{_globalType;__hpcc_subgraphs;__hpcc_vertices;__hpcc_edges;id;constructor(e,t){super(e,t),this._globalType=t==="0"?"Graph":"Cluster",this.__hpcc_subgraphs=[],this.__hpcc_vertices=[],this.__hpcc_edges=[],this.id=t}addSubgraph(e){e.__hpcc_parent=this,this.__hpcc_subgraphs.some(t=>e===t)||this.__hpcc_subgraphs.push(e)}addVertex(e){e.__hpcc_parent=this,this.__hpcc_vertices.some(t=>e===t)||this.__hpcc_vertices.push(e)}removeVertex(e){this.__hpcc_vertices=this.__hpcc_vertices.filter(t=>e!==t)}addEdge(e){e.__hpcc_parent=this,this.__hpcc_edges.some(t=>e===t)||this.__hpcc_edges.push(e)}removeEdge(e){this.__hpcc_edges=this.__hpcc_edges.filter(t=>e!==t)}remove(){this.__hpcc_subgraphs.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_vertices.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_edges.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),delete this.__hpcc_parent,this.__hpcc_graph.removeItem(this)}walkSubgraphs(e){this.__hpcc_subgraphs.forEach((t,s)=>{e.subgraphVisited(t)&&t.walkSubgraphs(e)})}walkVertices(e){this.__hpcc_vertices.forEach((t,s)=>{e.vertexVisited(t)})}},ne=class extends Je{_globalType="Vertex";_isSpill;constructor(e,t){super(e,t)}isSpill(){return this._isSpill}remove(){let e=this.getInVertices();e.length<=1&&console.warn(this.__hpcc_id+": remove only supports single or zero inputs activities..."),this.getInEdges().forEach(t=>{t.remove()}),this.getOutEdges().forEach(t=>{t.setSource(e[0])}),this.__hpcc_parent?.removeVertex(this),this.__hpcc_graph.removeItem(this)}getInVertices(){return this.getInEdges().map(e=>e.getSource())}getInEdges(){return this.__hpcc_graph.edges.filter(e=>e.getTarget()===this)}getOutVertices(){return this.getOutEdges().map(e=>e.getTarget())}getOutEdges(){return this.__hpcc_graph.edges.filter(e=>e.getSource()===this)}},re=class extends Je{_globalType="Edge";_sourceActivity;source;_targetActivity;target;constructor(e,t){super(e,t),this._globalType="Edge"}remove(){this.__hpcc_graph.subgraphs.forEach(e=>{e.removeEdge(this)}),this.__hpcc_graph.removeItem(this)}getSource(){return this.__hpcc_graph.idx[this._sourceActivity||this.source]}setSource(e){this._sourceActivity?this._sourceActivity=e.__hpcc_id:this.source&&(this.source=e.__hpcc_id),this.__widget&&this.__widget.setSource(this.getSource().__widget)}getTarget(){return this.__hpcc_graph.idx[this._targetActivity||this.target]}},ze=class r{idx={};subgraphs=[];vertices=[];edges=[];xgmml="";constructor(){this.clear()}clear(){this.xgmml="",this.idx={},this.subgraphs=[],this.vertices=[],this.edges=[]}load(e){this.clear(),this.merge(e)}merge(e){this.xgmml=e;let s=new DOMParser().parseFromString(e,"text/xml");this.walkDocument(s.documentElement,"0")}isSubgraph(e){return e instanceof J}isVertex(e){return e instanceof ne}isEdge(e){return e instanceof re}getGlobalType(e){return e instanceof ne?3:e instanceof re?4:e instanceof J?2:e instanceof r?1:0}getGlobalTypeString(e){return e instanceof ne?"Vertex":e instanceof re?"Edge":e instanceof J?"Cluster":e instanceof r?"Graph":"Unknown"}getItem(e,t){if(!this.idx[t])switch(e.tagName){case"graph":let n=new J(this,t);this.subgraphs.push(n),this.idx[t]=n;break;case"node":let i=new ne(this,t);this.vertices.push(i),this.idx[t]=i;break;case"edge":let o=new re(this,t);this.edges.push(o),this.idx[t]=o;break;default:console.warn("Graph.getItem - Unknown Node Type!");break}let s=this.idx[t];return Array.from(e.attributes).forEach(n=>{X(s,n.name,n.value)}),s}removeItem(e){delete this.idx[e.__hpcc_id],e instanceof J?this.subgraphs=this.subgraphs.filter(t=>e!==t):e instanceof ne?this.vertices=this.vertices.filter(t=>e!==t):e instanceof re&&(this.edges=this.edges.filter(t=>e!==t))}getChildByTagName(e,t){let s=null;return Array.from(e.childNodes).some(n=>{if(n.tagName===t)return s=n,!0}),s}walkDocument(e,t){let s=this.getItem(e,t);return e.childNodes.forEach(n=>{switch(n.nodeType){case 1:switch(n.tagName){case"graph":break;case"node":let i=!1,o=this.getChildByTagName(n,"att");if(o){let l=this.getChildByTagName(o,"graph");if(l){i=!0;let g=this.walkDocument(l,n.getAttribute("id"));s.addSubgraph(g)}}if(!i){let l=this.walkDocument(n,n.getAttribute("id"));s.addVertex(l)}break;case"att":let a=n.getAttribute("name"),c="_"+a,p=n.getAttribute("value");a.indexOf("Time")===0?(X(s,c,p),X(s,a,""+br(p))):a.indexOf("Size")===0?(X(s,c,p),X(s,a,""+Pr(p))):a.indexOf("Skew")===0?(X(s,c,p),X(s,a,""+Ir(p))):X(s,a,p);break;case"edge":let u=this.walkDocument(n,n.getAttribute("id"));if(u.NumRowsProcessed!==void 0?u._eclwatchCount=u.NumRowsProcessed.replace(/\B(?=(\d{3})+(?!\d))/g,","):u.Count!==void 0?u._eclwatchCount=u.Count.replace(/\B(?=(\d{3})+(?!\d))/g,","):u.count!==void 0&&(u._eclwatchCount=u.count.replace(/\B(?=(\d{3})+(?!\d))/g,",")),u.inputProgress&&(u._eclwatchInputProgress="["+u.inputProgress.replace(/\B(?=(\d{3})+(?!\d))/g,",")+"]"),u.SkewMaxRowsProcessed&&u.SkewMinRowsProcessed&&(u._eclwatchSkew="+"+u.SkewMaxRowsProcessed+", "+u.SkewMinRowsProcessed),!u._dependsOn){if(!u._childGraph){if(u._sourceActivity||u._targetActivity){u._isSpill=!0;let l=u.getSource();l&&(l._isSpill=!0);let g=u.getTarget();g&&(g._isSpill=!0)}}}s.addEdge(u);break;default:break}break;case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:break;default:break}}),s}removeSubgraphs(){[...this.subgraphs].forEach(t=>{t.__hpcc_parent instanceof J&&t.remove()})}removeSpillVertices(){[...this.vertices].forEach(t=>{t.isSpill()&&t.remove()})}getLocalisedXGMML(e,t,s,n){let i=new ws(this);return i.calcVisibility(e,t,s,n),i.writeXgmml(),"<graph>"+i.m_xgmml+"</graph>"}};var Ns=(0,ie.scopedLogger)("@hpcc-js/comms/ecl/query.ts"),Tr=(0,Sn.format)("~s");function Mr(r){return!isNaN(parseFloat(r))&&!isNaN(r-0)}var Qs=class extends ie.Cache{constructor(){super(e=>ie.Cache.hash([e.QueryId,e.QuerySet]))}},Br=new Qs,Ls=class r extends ie.StateObject{wsWorkunitsService;get BaseUrl(){return this.wsWorkunitsService.baseUrl}topology;_requestSchema;_responseSchema;get properties(){return this.get()}get Exceptions(){return this.get("Exceptions")}get QueryId(){return this.get("QueryId")}get QuerySet(){return this.get("QuerySet")}get QueryName(){return this.get("QueryName")}get Wuid(){return this.get("Wuid")}get Dll(){return this.get("Dll")}get Suspended(){return this.get("Suspended")}get Activated(){return this.get("Activated")}get SuspendedBy(){return this.get("SuspendedBy")}get Clusters(){return this.get("Clusters")}get PublishedBy(){return this.get("PublishedBy")}get Comment(){return this.get("Comment")}get LogicalFiles(){return this.get("LogicalFiles")}get SuperFiles(){return this.get("SuperFiles")}get IsLibrary(){return this.get("IsLibrary")}get Priority(){return this.get("Priority")}get WUSnapShot(){return this.get("WUSnapShot")}get CompileTime(){return this.get("CompileTime")}get LibrariesUsed(){return this.get("LibrariesUsed")}get CountGraphs(){return this.get("CountGraphs")}get ResourceURLCount(){return this.get("ResourceURLCount")}get WsEclAddresses(){return this.get("WsEclAddresses")}get WUGraphs(){return this.get("WUGraphs")}get WUTimers(){return this.get("WUTimers")}get PriorityID(){return this.get("PriorityID")}constructor(e,t,s,n){super(),e instanceof x?this.wsWorkunitsService=e:this.wsWorkunitsService=new x(e),this.topology=Xe.attach(this.wsWorkunitsService.opts()),this.set({QuerySet:t,QueryId:s,...n})}static attach(e,t,s,n){let i=Br.get({BaseUrl:e.baseUrl,QuerySet:t,QueryId:s},()=>new r(e,t,s));return n&&i.set(n),i}_eclService;async wsEclService(){return this._eclService||(this._eclService=this.topology.fetchServices({}).then(e=>{for(let t of e?.TpEspServers?.TpEspServer??[])for(let s of t?.TpBindings?.TpBinding??[])if(s?.Service==="ws_ecl"){let n=`${s.Protocol}://${globalThis.location.hostname}:${s.Port}`;return new be({baseUrl:n})}})),this._eclService}async fetchDetails(){let e=await this.wsWorkunitsService.WUQueryDetails({QuerySet:this.QuerySet,QueryId:this.QueryId,IncludeStateOnClusters:!0,IncludeSuperFiles:!0,IncludeWsEclAddresses:!0,CheckAllNodes:!1});this.set({...e})}async fetchRequestSchema(){let e=await this.wsEclService();try{this._requestSchema=await e?.requestJson(this.QuerySet,this.QueryId)??[]}catch(t){Ns.debug(t.message??t),this._requestSchema=[]}}async fetchResponseSchema(){let e=await this.wsEclService();try{this._responseSchema=await e?.responseJson(this.QuerySet,this.QueryId)??{}}catch(t){Ns.debug(t.message??t),this._responseSchema={}}}async fetchSchema(){await Promise.all([this.fetchRequestSchema(),this.fetchResponseSchema()])}fetchSummaryStats(){return this.wsWorkunitsService.WUQueryGetSummaryStats({Target:this.QuerySet,QueryId:this.QueryId})}fetchGraph(e="",t=""){return this.wsWorkunitsService.WUQueryGetGraph({Target:this.QuerySet,QueryId:this.QueryId,GraphName:e,SubGraphId:t}).then(s=>{let n=new ze,i=!0;for(let o of s?.Graphs?.ECLGraphEx||[])i?(n.load(o.Graph),i=!1):n.merge(o.Graph);return n})}fetchDetailsNormalized(e={}){let t=ee.attach(this.wsWorkunitsService,this.Wuid);return t?Promise.all([this.fetchGraph(),t.fetchDetailsMeta(),t.fetchDetailsRaw(e)]).then(s=>{let n=s[0],i=s[1],a=s[2].map(c=>{if(c.Id[0]==="a"||c.Id[0]==="e"){let p=n.idx[c.Id.substring(1)];for(let u in p)if(u.charAt(0)!=="_"&&u.charAt(0)===u.charAt(0).toUpperCase()&&(typeof p[u]=="string"||typeof p[u]=="number"||typeof p[u]=="boolean")&&!c.Properties.Property.some(l=>l.Name===u)){let g=Mr(p[u])?parseFloat(p[u]):p[u],f=p[u];u.indexOf("Time")>=0&&(g=g/1e9,f=Tr(g)+"s"),c.Properties.Property.push({Name:u,RawValue:g,Formatted:f})}}return c});return t.normalizeDetails(i,a)}):Promise.resolve({meta:void 0,columns:void 0,data:void 0})}async submit(e){let t=await this.wsEclService();try{return t?.submit(this.QuerySet,this.QueryId,e).then(s=>{for(let n in s)s[n]=s[n].Row;return s})??[]}catch(s){return Ns.debug(s.message??s),[]}}async refresh(){return await Promise.all([this.fetchDetails(),this.fetchSchema()]),this}requestFields(){return this._requestSchema?this._requestSchema:[]}responseFields(){return this._responseSchema?this._responseSchema:{}}resultNames(){let e=[];for(let t in this.responseFields())e.push(t);return e}resultFields(e){return this._responseSchema[e]?this._responseSchema[e]:[]}};var De=require("@hpcc-js/util");var _t=class extends De.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}:${e.UserSpecific}-${e.Namespace}`)}},wr=new _t,z=class extends De.Message{constructor(t,s,n){super();this.key=t;this.value=s;this.oldValue=n}get canConflate(){return!0}conflate(t){return this.key===t.key?(this.value=t.value,!0):!1}void(){return this.value===this.oldValue}},Gs=class r{connection;get BaseUrl(){return this.connection.baseUrl}Name;UserSpecific;Namespace;_dispatch=new De.Dispatch;static attach(e,t="HPCCApps",s,n=!0){return wr.get({BaseUrl:e.baseUrl,Name:t,UserSpecific:n,Namespace:s},()=>new r(e,t,s,n))}constructor(e,t,s,n){e instanceof me?this.connection=e:this.connection=new me(e),this.Name=t,this.UserSpecific=n,this.Namespace=s}_knownValues={};create(){this.connection.CreateStore({Name:this.Name,UserSpecific:this.UserSpecific,Type:"",Description:""})}set(e,t,s=!0){return this.connection.Set({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e,Value:t}).then(n=>{let i=this._knownValues[e];this._knownValues[e]=t,s&&this._dispatch.post(new z(e,t,i))}).catch(n=>{console.error(`Store.set("${e}", "${t}") failed:`,n)})}get(e,t=!0){return this.connection.Fetch({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(s=>{let n=this._knownValues[e];return this._knownValues[e]=s.Value,t&&this._dispatch.post(new z(e,s.Value,n)),s.Value}).catch(s=>{console.error(`Store.get(${e}) failed:`,s)})}getAll(e=!0){return this.connection.FetchAll({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace}).then(t=>{let s={},n=this._knownValues;if(this._knownValues={},t.Pairs.Pair.forEach(i=>{let o=this._knownValues[i.Key];this._knownValues[i.Key]=i.Value,delete n[i.Key],s[i.Key]=i.Value,e&&this._dispatch.post(new z(i.Key,i.Value,o))}),e)for(let i in n)this._dispatch.post(new z(i,void 0,n[i]));return s}).catch(t=>(console.error("Store.getAll failed:",t),{}))}delete(e,t=!0){return this.connection.Delete({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(s=>{let n=this._knownValues[e];delete this._knownValues[e],t&&this._dispatch.post(new z(e,void 0,n))}).catch(s=>{console.error(`Store.delete(${e}) failed:`,s)})}monitor(e){return this._dispatch.attach(e)}};var Ce=require("@hpcc-js/util");var Nr=(0,Ce.scopedLogger)("@hpcc-js/comms/dfuWorkunit.ts");var Ht=class extends Ce.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.ID}`)}},Rn=new Ht,ks=class r extends Ce.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get ID(){return this.get("ID")}get DFUServerName(){return this.get("DFUServerName")}get ClusterName(){return this.get("ClusterName")}get JobName(){return this.get("JobName")}get Queue(){return this.get("Queue")}get User(){return this.get("User")}get isProtected(){return this.get("isProtected")}get Command(){return this.get("Command")}get CommandMessage(){return this.get("CommandMessage")}get PercentDone(){return this.get("PercentDone")}get SecsLeft(){return this.get("SecsLeft")}get ProgressMessage(){return this.get("ProgressMessage")}get SummaryMessage(){return this.get("SummaryMessage")}get State(){return this.get("State",0)}get SourceLogicalName(){return this.get("SourceLogicalName")}get SourceIP(){return this.get("SourceIP")}get SourceFilePath(){return this.get("SourceFilePath")}get SourceDali(){return this.get("SourceDali")}get SourceRecordSize(){return this.get("SourceRecordSize")}get SourceFormat(){return this.get("SourceFormat")}get RowTag(){return this.get("RowTag")}get SourceNumParts(){return this.get("SourceNumParts")}get SourceDirectory(){return this.get("SourceDirectory")}get DestLogicalName(){return this.get("DestLogicalName")}get DestGroupName(){return this.get("DestGroupName")}get DestDirectory(){return this.get("DestDirectory")}get DestIP(){return this.get("DestIP")}get DestFilePath(){return this.get("DestFilePath")}get DestFormat(){return this.get("DestFormat")}get DestNumParts(){return this.get("DestNumParts")}get DestRecordSize(){return this.get("DestRecordSize")}get Replicate(){return this.get("Replicate")}get Overwrite(){return this.get("Overwrite")}get Compress(){return this.get("Compress")}get SourceCsvSeparate(){return this.get("SourceCsvSeparate")}get SourceCsvQuote(){return this.get("SourceCsvQuote")}get SourceCsvTerminate(){return this.get("SourceCsvTerminate")}get SourceCsvEscape(){return this.get("SourceCsvEscape")}get TimeStarted(){return this.get("TimeStarted")}get TimeStopped(){return this.get("TimeStopped")}get StateMessage(){return this.get("StateMessage")}get MonitorEventName(){return this.get("MonitorEventName")}get MonitorSub(){return this.get("MonitorSub")}get MonitorShotLimit(){return this.get("MonitorShotLimit")}get SourceDiffKeyName(){return this.get("SourceDiffKeyName")}get DestDiffKeyName(){return this.get("DestDiffKeyName")}get Archived(){return this.get("Archived")}get encrypt(){return this.get("encrypt")}get decrypt(){return this.get("decrypt")}get failIfNoSourceFile(){return this.get("failIfNoSourceFile")}get recordStructurePresent(){return this.get("recordStructurePresent")}get quotedTerminator(){return this.get("quotedTerminator")}get preserveCompression(){return this.get("preserveCompression")}get expireDays(){return this.get("expireDays")}get PreserveFileParts(){return this.get("PreserveFileParts")}get FileAccessCost(){return this.get("FileAccessCost")}get KbPerSecAve(){return this.get("KbPerSecAve")}get KbPerSec(){return this.get("KbPerSec")}static create(e,t){let s=new r(e);return s.connection.CreateDFUWorkunit({DFUServerQueue:t}).then(n=>(Rn.set(s),s.set(n.result),s))}static attach(e,t,s){let n=Rn.get({BaseUrl:e.baseUrl,ID:t},()=>new r(e,t));return s&&n.set(s),n}static sprayFixed(e,t){let s=new H(e);return s.SprayFixedEx({...t}).then(n=>{let i=n.wuid;return s.GetDFUWorkunit({wuid:i}).then(o=>r.attach(e,i,o.result))})}static sprayVariable(e,t){let s=new H(e);return s.SprayVariableEx({...t}).then(n=>{let i=n.wuid;return s.GetDFUWorkunit({wuid:i}).then(o=>r.attach(e,i,o.result))})}static despray(e,t){let s=new H(e);return s.DesprayEx({...t}).then(n=>{let i=n.wuid;return s.GetDFUWorkunit({wuid:i}).then(o=>r.attach(e,i,o.result))})}update(e){return this.connection.UpdateDFUWorkunitEx({wu:{JobName:e?.wu?.JobName??this.JobName,isProtected:e?.wu?.isProtected??this.isProtected,ID:this.ID,State:this.State},ClusterOrig:this.ClusterName,JobNameOrig:this.JobName,isProtectedOrig:this.isProtected,StateOrig:this.State})}isComplete(){switch(this.State){case 6:case 5:case 4:case 999:return!0;default:}return!1}isFailed(){return!!(this.isComplete()&&this.State!==6)}isDeleted(){switch(this.State){case 999:return!0;default:}return!1}isRunning(){return!this.isComplete()}abort(){return this.connection.AbortDFUWorkunit({wuid:this.ID})}delete(){return this.DFUWUAction(pe.DFUWUActions.Delete).then(e=>this.refresh().then(()=>(this._monitor(),e)))}async refresh(e=!1){return await this.GetDFUWorkunit(),this}fetchXML(e){return this.DFUWUFile()}_monitor(){if(this.isComplete()){this._monitorTickCount=0;return}super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?3e3:this._monitorTickCount<=5?6e3:this._monitorTickCount<=7?12e3:e}DFUWUFile(e={}){return this.connection.DFUWUFileEx({...e,Wuid:this.ID}).then(t=>t).catch(t=>"")}DFUWUAction(e){return this.connection.DFUWorkunitsAction({wuids:{Item:[this.ID]},Type:e}).then(t=>e===pe.DFUWUActions.Delete?t:this.refresh().then(()=>(this._monitor(),t)))}on(e,t,s){if(this.isCallback(t))switch(e){case"finished":super.on("propChanged","State",n=>{this.isComplete()&&t([n])});break;case"changed":super.on(e,t);break;default:}else switch(e){case"changed":super.on(e,t,s);break;default:}return this._monitor(),this}watchUntilComplete(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),this.isComplete()&&(n.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,s)=>{let n=this.watch(i=>{e&&e(i),(this.isComplete()||this.isRunning())&&(n.release(),t(this))})})}constructor(e,t){super(),this.connection=new H(e),this.topologyConnection=new W(e),this.clearState(t)}clearState(e){this.clear({ID:e,State:0})}GetDFUWorkunit(e={}){return this.connection.GetDFUWorkunit({...e,wuid:this.ID}).then(t=>(this.set(t.result),t)).catch(t=>{if(!t.Exception.some(n=>n.Code===20080||n.Code===20081?(this.clearState(this.ID),this.set("State",999),!0):!1))throw Nr.warning(`Unexpected ESP exception: ${t.message}`),t;return{}})}};var bn=N(require("child_process"),1),F=N(require("fs"),1),ce=N(require("os"),1),B=N(require("path"),1),Pn=N(require("tmp"),1),We=require("@hpcc-js/util");var oe=N(require("fs"),1),S=N(require("path"),1),M=require("@hpcc-js/util");var Qr=(0,M.scopedLogger)("clienttools/eclmeta"),Lr=!1;function Se(r,e,t){if(Lr){for(let s in r){let n=`${e}.${s}`;s!=="$"&&t[s]===void 0&&t[s.toLowerCase()+"s"]===void 0&&Qr.debug(n)}r.$&&Se(r.$,e+".$",t)}}var jt=class{__attrs;name;constructor(e){this.__attrs=e.$,this.name=e.$.name}},Ot=class{__attrs;definition;get scope(){return this.definition}name;type;constructor(e,t){this.__attrs=t.$,this.definition=e,this.name=t.$.name,this.type=t.$.type}},ae=class{get scope(){return this}name;type;sourcePath;line;start;body;end;definitions;constructor(e,t,s,n,i=1,o=0,a=0,c=Number.MAX_VALUE){this.name=e,this.type=t,this.sourcePath=S.normalize(s),this.line=+i-1,this.start=+o,this.body=+a,this.end=+c,this.definitions=this.parseDefinitions(n)}parseDefinitions(e=[]){return e.map(t=>{let s=new Yt(this.sourcePath,t);return Se(t,"definition",s),s})}contains(e){return e>=this.start&&e<=this.end}scopeStackAt(e){let t=[];return this.contains(e)&&(t.push(this),this.definitions.forEach(s=>{t=s.scopeStackAt(e).concat(t)})),t}_resolve(e=[],t){let s=t.split("."),n=s.shift(),i=(0,M.find)(e,o=>typeof o.name=="string"&&typeof n=="string"&&o.name.toLowerCase()===n.toLowerCase());return i&&i.definitions.length&&s.length?this._resolve(i.definitions,s.join(".")):i}resolve(e){return this._resolve(this.definitions,e)}suggestions(){return this.definitions.map(e=>({name:e.name,type:this.type}))}},Yt=class extends ae{__attrs;exported;shared;fullname;inherittype;attrs;fields;constructor(e,t){super(t.$.name,t.$.type,e,t.children("Definition"),t.$.line,t.$.start,t.$.body,t.$.end),this.__attrs=t.$,this.exported=!!t.$.exported,this.shared=!!t.$.shared,this.fullname=t.$.fullname,this.inherittype=t.$.inherittype,this.attrs=this.parseAttrs(t.children("Attr")),this.fields=this.parseFields(t.children("Field"))}parseAttrs(e=[]){return e.map(t=>{let s=new jt(t);return Se(t,"attr",s),s})}parseFields(e=[]){return e.map(t=>{let s=new Ot(this,t);return Se(t,"field",s),s})}suggestions(){return super.suggestions().concat(this.fields.map(e=>({name:e.name,type:e.type})))}},Ke=class{__attrs;name;ref;start;end;line;constructor(e){this.__attrs=e.$,this.name=e.$.name,this.ref=e.$.ref,this.start=e.$.start,this.end=e.$.end,this.line=e.$.line}},Xt=class extends ae{imports;__attrs;constructor(e){super(e.$.name,"source",e.$.sourcePath,e.children("Definition")),this.__attrs=e.$;let t=e.$.name.split(".");t.pop();let s=new M.XMLNode("");s.appendAttribute("name","$"),s.appendAttribute("ref",t.join(".")),this.imports=[new Ke(s),...this.parseImports(e.children("Import"))]}parseImports(e=[]){return e.map(t=>{let s=new Ke(t);return Se(t,"import",s),s})}resolve(e,t){let s;return!s&&t!==void 0&&this.scopeStackAt(t).some(i=>(s=i.resolve(e),!!s)),s||(s=super.resolve(e)),s}},Gr=r=>S.basename(r).indexOf(".")===0,xn=r=>oe.lstatSync(r).isDirectory()&&!Gr(r),kr=r=>[".ecl",".ecllib"].indexOf(S.extname(r).toLowerCase())>=0,An=r=>oe.readdirSync(r).map(e=>S.join(r,e)).filter(e=>xn(e)||kr(e)),qt=class extends ae{constructor(e,t){super(e,"file",t,[])}suggestions(){return[]}},Jt=class extends ae{constructor(e,t){super(e,"folder",t,[])}suggestions(){return An(this.sourcePath).map(e=>({name:S.basename(e,".ecl"),type:"folder"}))}},zt=class{_workspacePath;_eclccPath;_clientTools;_sourceByID=new M.DictionaryNoCase;_sourceByPath=new M.Dictionary;_test=new M.DictionaryNoCase;constructor(e,t){this._workspacePath=e,this._eclccPath=t}refresh(){this.primeWorkspace(),this.primeClientTools()}primeClientTools(){return _s(this._eclccPath,"",this._workspacePath).then(e=>(this._clientTools=e,e.paths())).then(e=>{for(let t of["ECLCC_ECLLIBRARY_PATH","ECLCC_PLUGIN_PATH"])e[t]&&oe.existsSync(e[t])&&this.walkChildFolders(e[t],e[t]);return this})}primeWorkspace(){oe.existsSync(this._workspacePath)&&this.visitFolder(this._workspacePath,this._workspacePath)}walkChildFolders(e,t,s=!1){for(let n of An(e))xn(n)?this.visitFolder(n,t,s):this.visitFile(n,t,s)}visitFile(e,t,s=!1){let n=S.parse(e),i=S.join(n.dir,n.name),o=S.relative(t,i).split(S.sep).join(".");(s||!this._test.has(o))&&this._test.set(o,new qt("",e))}visitFolder(e,t,s=!1){let n=S.relative(t,e).split(S.sep).join(".");(s||!this._test.has(n))&&(this._test.set(n,new Jt(n,e)),this.walkChildFolders(e,t,s))}buildStack(e,t,s){let n=t.split(".");s&&e[e.length-1]===n[0]&&n.shift();let i=[...e,...n],o=i.join(".");return{stack:i,qid:o}}walkECLScope(e,t){let s=this.buildStack(e,t.name,!0);this._test.set(s.qid,t);for(let n of t.definitions)this.walkDefinition(s.stack,n)}walkField(e,t){let s=this.buildStack(e,t.name,!1);this._test.set(s.qid,t)}walkDefinition(e,t){let s=this.buildStack(e,t.name,!0);this.walkECLScope(e,t);for(let n of t.fields)this.walkField(s.stack,n)}walkSource(e){this.walkECLScope([],e)}parseSources(e=[]){for(let t of e)if(t.$.name){let s=new Xt(t);if(Se(t,"source",s),this._sourceByID.set(s.name,s),this._sourceByPath.set(s.sourcePath,s),s.name){let i=s.name.split(".").length;if(i>1){let o=s.sourcePath;for(;i>1;)o=S.dirname(o),--i;this.visitFolder(o,S.dirname(o))}}this.walkSource(s)}}parseMetaXML(e){let t=new Vs;return t.parse(e),this.parseSources(t.sources),t.sources.map(s=>S.normalize(s.$.sourcePath))}resolveQualifiedID(e,t,s){let n;if(!n&&this._test.has(t)&&(n=this._test.get(t).scope),!n&&this._sourceByPath.has(e)){let i=this._sourceByPath.get(e),o=t.split(".");for(let c of i.imports)if(c.name.toLowerCase()===o[0].toLowerCase()){c.ref?o[0]=c.ref:o.shift();break}let a=o.join(".");!n&&this._test.has(a)&&(n=this._test.get(a).scope),n||(a=[...i.name.split("."),...o].join("."),this._test.has(a)&&(n=this._test.get(a).scope))}return n}resolvePartialID(e,t,s){t=t.toLowerCase();let n=t.split(".");n.pop();let i=n.length===1?n[0]:n.join(".");return this.resolveQualifiedID(e,i,s)}},vs=new M.Dictionary;function K(r,e){let t=S.normalize(r);if(!vs.has(t)){let s=new zt(t,e);vs.set(t,s),s.refresh()}return vs.get(t)}function vr(r,e,t){if(e<0)return!1;let s=r.charAt(e);return(t?/[a-zA-Z\d_\.$]/:/[a-zA-Z\d_]/).test(s)}function Vr(r,e,t){for(;vr(r,e,t);)e+=t?-1:1;return e+(t?1:-1)}var Vs=class extends M.SAXStackParser{sources=[];endXMLNode(e){switch(e.name){case"Source":this.sources.push(e);break;default:break}super.endXMLNode(e)}};var Re=(0,We.scopedLogger)("clienttools/eclcc"),Hs=ce.type()==="Windows_NT"?".exe":"";function Wn(r){return r.split(`\r
916
916
  `).join(`
917
917
  `).split("\r").join(`
918
- `)}var Re=class{prefix="";major=0;minor=0;patch=0;postfix="";constructor(e){let t=e.split(" ");if(t.length){let s=/(?:(\w+)_)?(\d+)\.(\d+)\.(\d+)(?:-(.*))?/.exec(t[t.length-1]);s&&(this.prefix=s[1]||"",this.major=+s[2]||0,this.minor=+s[3]||0,this.patch=+s[4]||0,this.postfix=s[5]||"")}}parse(e){}exists(){return this.major!==0||this.minor!==0||this.patch!==0||this.postfix!==""}compare(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch?-1:this.postfix===""&&e.postfix!==""?1:this.postfix.localeCompare(e.postfix)}toString(){return`${this.prefix}_${this.major}.${this.minor}.${this.patch}-${this.postfix}`}},Wn="error",yn="warning",Ze=class{_checked;errWarn=[];errOther=[];constructor(e){this._checked=e}checked(){return this._checked}all(){return this.errWarn}errors(){return this.errWarn.filter(e=>e.severity===Wn)}hasError(){return this.errors().length>0}warnings(){return this.errWarn.filter(e=>e.severity===yn)}hasWarning(){return this.warnings().length>0}info(){return this.errWarn.filter(e=>[Wn,yn].indexOf(e.severity)<0)}hasOther(){return this.info().length>0}unknown(){return this.errOther}hasUnknown(){return this.unknown().length>0}},$e=class extends Ze{constructor(e,t){if(super(t),e&&e.length)for(let s of e.split(ce.EOL)){let n=/([a-zA-Z]:\\(?:[- \w\.\d]+\\)*(?:[- \w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\) ?: ?(error|warning|info) C(\d*) ?: ?(.*)/.exec(s);if(n){let[,i,o,a,u,p,c]=n,l=+o,g=+a,D=p+": "+c;this.errWarn.push({filePath:i,line:l,col:g,msg:D,severity:u});continue}if(n=/(error|warning|info): (.*)/i.exec(s),n){let[,i,o]=n;this.errWarn.push({filePath:"",line:0,col:0,msg:o,severity:i});continue}n=/\d error(s?), \d warning(s?)/.exec(s),!n&&(es.warning(`parseECLErrors: Unable to parse "${s}"`),this.errOther.push(s))}this._checked=t}},Kt=class extends Ze{_lines;constructor(e,t,s){super(s);let n=F.readFileSync(e,"utf8");if(n=n.replace(/\r\n/g,`
918
+ `)}var xe=class{prefix="";major=0;minor=0;patch=0;postfix="";constructor(e){let t=e.split(" ");if(t.length){let s=/(?:(\w+)_)?(\d+)\.(\d+)\.(\d+)(?:-(.*))?/.exec(t[t.length-1]);s&&(this.prefix=s[1]||"",this.major=+s[2]||0,this.minor=+s[3]||0,this.patch=+s[4]||0,this.postfix=s[5]||"")}}parse(e){}exists(){return this.major!==0||this.minor!==0||this.patch!==0||this.postfix!==""}compare(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch?-1:this.postfix===""&&e.postfix!==""?1:this.postfix.localeCompare(e.postfix)}toString(){return`${this.prefix}_${this.major}.${this.minor}.${this.patch}-${this.postfix}`}},yn="error",En="warning",$e=class{_checked;errWarn=[];errOther=[];constructor(e){this._checked=e}checked(){return this._checked}all(){return this.errWarn}errors(){return this.errWarn.filter(e=>e.severity===yn)}hasError(){return this.errors().length>0}warnings(){return this.errWarn.filter(e=>e.severity===En)}hasWarning(){return this.warnings().length>0}info(){return this.errWarn.filter(e=>[yn,En].indexOf(e.severity)<0)}hasOther(){return this.info().length>0}unknown(){return this.errOther}hasUnknown(){return this.unknown().length>0}},et=class extends $e{constructor(e,t){if(super(t),e&&e.length)for(let s of e.split(ce.EOL)){let n=/([a-zA-Z]:\\(?:[- \w\.\d]+\\)*(?:[- \w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\) ?: ?(error|warning|info) C(\d*) ?: ?(.*)/.exec(s);if(n){let[,i,o,a,c,p,u]=n,l=+o,g=+a,f=p+": "+u;this.errWarn.push({filePath:i,line:l,col:g,msg:f,severity:c});continue}if(n=/(error|warning|info): (.*)/i.exec(s),n){let[,i,o]=n;this.errWarn.push({filePath:"",line:0,col:0,msg:o,severity:i});continue}n=/\d error(s?), \d warning(s?)/.exec(s),!n&&(Re.warning(`parseECLErrors: Unable to parse "${s}"`),this.errOther.push(s))}this._checked=t}},Zt=class extends $e{_lines;constructor(e,t,s){super(s);let n=F.readFileSync(e,"utf8");if(n=n.replace(/\r\n/g,`
919
919
  `),this._lines=n.split(`
920
- `),t&&t.length)for(let i of t.split(ce.EOL)){let o=/(Warning|Error) : Path\=(\S*?)(\[\S*\])? Message\=(.*)/.exec(i);if(o){let[,a,u,p,c]=o,l=`${u} ${p||""}: ${c}`,[g,D]=this.locate(u);this.errWarn.push({filePath:e,line:g,col:D,msg:l,severity:a});continue}o||(es.warning(`parseECLErrors: Unable to parse "${i}"`),this.errOther.push(i))}this._checked=s}locate(e){let t=e.split("/");if(t.length&&t[0]===""&&t.shift(),t.length>0){let s=0;for(let n of this._lines){let i="<"+t[0];if((n.indexOf(i+" ")>=0||n.indexOf(i+">")>=0)&&(t.shift(),t.length===0))return[s+1,n.indexOf(i)+1];++s}}return[0,0]}};function Zt(r,e,t){t=t||[],t.push(r);for(let s in r)if(r.hasOwnProperty(s)){let n=r[s];e(s,n,t),n instanceof Array?n.forEach(i=>{Zt(i,e,t)}):typeof n=="object"&&Zt(n,e,t)}t.pop()}var $t=class{jsonWU;constructor(e){this.jsonWU=e}bpGetValidLocations(e){let t=[];if((0,Ae.exists)("W_LOCAL.Graphs",this.jsonWU)){let s="";Zt(this.jsonWU.W_LOCAL.Graphs,(n,i,o)=>{if(n==="$"&&i.id&&(s=i.id),n==="$"&&i.name==="definition"){let a=/([a-z,A-Z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(i.value);if(a){let[,u,p,c]=a,l=+p,g=+c;e===u&&t.push({file:u,line:l,col:g,id:s})}}})}return t}},xe=class r{eclccPath;envchkPath;eclBundlePath;binPath;cwd;includeFolders;_legacyMode;_args;_version;constructor(e,t,s=[],n=!1,i=[],o){this.eclccPath=e,this.binPath=M.dirname(this.eclccPath),this.envchkPath=M.join(this.binPath,"envchk"+Hs),this.eclBundlePath=M.join(this.binPath,"ecl-bundle"+Hs),this.cwd=M.normalize(t||this.binPath),this.includeFolders=s,this._legacyMode=n,this._args=i,this._version=o}clone(e,t,s=!1,n=[]){return new r(this.eclccPath,e,t,s,n,this._version)}exists(e){try{return F.accessSync(e),!0}catch{}return!1}args(e=[]){let t=[...this._args];return this._legacyMode&&t.push("-legacy"),t.concat(this.includeFolders.map(s=>"-I"+M.normalize(s))).concat(e)}version(){return this._version?Promise.resolve(this._version):this.execFile(this.eclccPath,this.binPath,this.args(["--version"]),"eclcc",`Cannot find ${this.eclccPath}`).then(e=>(this._version=new Re(e.stdout),this._version))}versionSync(){return this._version}_paths={};paths(){return this.execFile(this.eclccPath,this.cwd,this.args(["-showpaths"]),"eclcc",`Cannot find ${this.eclccPath}`).then(e=>{if(e&&e.stdout&&e.stdout.length){let t=e.stdout.split(/\r?\n/);for(let s of t){let n=s.split("=");n.length===2&&(this._paths[n[0]]=n[1])}}return this._paths})}loadXMLDoc(e,t){return new Promise((s,n)=>{let i=F.readFileSync(e,"ascii"),o=(0,Ae.xml2json)(i);t&&F.unlink(e,a=>{}),s(o)})}createWU(e){let t=bn.tmpNameSync({prefix:"eclcc-wu-tmp",postfix:""}),s=["-o"+t,"-wu"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(s),"eclcc",`Cannot find ${this.eclccPath}`).then(n=>{let i=M.normalize(t+".xml");return(this.exists(i)?this.loadXMLDoc(i,!0):Promise.resolve({})).then(a=>new $t(a))})}createArchive(e){let t=["-E"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(t),"eclcc",`Cannot find ${this.eclccPath}`).then(s=>({content:s.stdout,err:new $e(s.stderr,[])}))}attachWorkspace(){return K(this.cwd)}fetchMeta(e){return Promise.all([K(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args(["-M",e]),"eclcc",`Cannot find ${this.eclccPath}`)]).then(([t,s])=>(s&&s.stdout&&s.stdout.length&&t.parseMetaXML(s.stdout),t))}syntaxCheck(e,t=["-syntax"]){return Promise.all([K(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args([...t,"-M",e]),"eclcc",`Cannot find ${this.eclccPath}`)]).then(([s,n])=>{let i=[];return n&&n.stdout&&n.stdout.length&&(i=s.parseMetaXML(n.stdout)),new $e(n?n.stderr:"",i)})}envCheck(e,t=[]){return Promise.all([K(this.cwd),this.execFile(this.envchkPath,this.cwd,this.args([...t,e]),"envchk",`Cannot find ${this.envchkPath}`)]).then(([s,n])=>new Kt(e,n?n.stderr:"",[]))}bundleList(){let e=/\|(.*)\|(.*)\|(.*)\|/g;return Promise.all([fetch("https://raw.githubusercontent.com/hpcc-systems/ecl-bundles/master/README.rst").then(t=>t.text()).then(t=>{let s=[],n=e.exec(t);for(;n;)s.push({name:n[1].trim(),description:n[2].trim(),url:n[3].trim()}),n=e.exec(t);return s}),this.execFile(this.eclBundlePath,this.cwd,this.args(["list"]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`).then(t=>An(t.stdout).split(`
921
- `)).then(t=>{let s={};return Promise.all(t.filter(n=>!!n).map(n=>this.execFile(this.eclBundlePath,this.cwd,this.args(["info",n]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`).then(i=>An(i.stdout).split(`
922
- `)).then(i=>{let o={};i.forEach(a=>{let u=a.split(":");o[u.shift().trim()]=u.join(":").trim()}),s[n]={name:n,props:o}}))).then(()=>s)})]).then(([t,s])=>{t.forEach(n=>{s[n.name]&&(n.props=s[n.name].props,delete s[n.name])});for(let n in s)t.push({name:n,url:"",description:"",props:s[n].props});return t}).catch(t=>[])}bundleInstall(e){return Promise.all([K(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args(["install",e]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`)]).then(([t,s])=>s)}bundleUninstall(e){return Promise.all([K(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args(["uninstall",e]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`)]).then(([t,s])=>s)}execFile(e,t,s,n,i){return new Promise((o,a)=>{es.debug(`${e} ${s.join(" ")}`);let u=Fn.spawn(e,s,{cwd:t}),p="",c="";u.stdout.on("data",l=>{p+=l.toString()}),u.stderr.on("data",l=>{c+=l.toString()}),u.on("close",(l,g)=>{o({code:l,stdout:p.trim(),stderr:c.trim()})})})}};function zt(r,e){if(r){let t=M.join(r,"HPCCSystems");if(F.existsSync(t)&&F.statSync(t).isDirectory()){if(ce.type()!=="Windows_NT"){let s=M.join(t,"bin","eclcc");F.existsSync(s)&&e.push(new xe(s))}F.readdirSync(t).forEach(s=>{let n=M.join(t,s,"clienttools","bin","eclcc"+Hs);if(F.existsSync(n)){let i=M.basename(s);new Re(i).exists()&&e.push(new xe(n))}})}}}var Ke;function Lr(){Ke=void 0}function Pn(){if(Ke)return Ke;let r=[];switch(ce.type()){case"Windows_NT":let e=process.env["ProgramFiles(x86)"]||"";e&&zt(e,r);let t=process.env.ProgramFiles||"";t&&zt(t,r),!e&&!t&&zt("c:\\Program Files (x86)",r);break;case"Linux":case"Darwin":zt("/opt",r);break;default:break}return Ke=Promise.all(r.map(e=>e.version())).then(()=>(r.sort((e,t)=>t.versionSync().compare(e.versionSync())),r)),Ke}var Un="";function En(r){let e=`Using eclccPath setting: ${r}`;Un!==e&&(es.info(e),Un=e)}function _s(r="",e="",t=".",s=[],n=!1,i=[]){return r&&F.existsSync(r)?(En(r),Promise.resolve(new xe(r,t,s,n,i))):Pn().then(o=>{if(!o.length)throw new Error("Unable to locate ECL Client Tools.");let a=new Re(e),u,p;for(let l of o){let g=l.versionSync();if(g.exists()&&(u||(u=l),!p&&a.major===g.major&&(p=l),a.major===g.major&&a.minor===g.minor))return l.clone(t,s,n,i)}let c=p||u;return En(c.eclccPath),c.clone(t,s,n,i)})}b.root.DOMParser=In.DOMParser;typeof b.root.fetch>"u"?(b.root.fetch=Z.default,b.root.Headers=Z.Headers,b.root.Request=Z.Request,b.root.Response=Z.Response,b.root.fetch.__rejectUnauthorizedAgent=new P.Agent({rejectUnauthorized:!1})):(b.root.fetch.__defaultAgent=new et.Agent,b.root.fetch.__rejectUnauthorizedAgent=new et.Agent({connect:{rejectUnauthorized:!1}}),b.root.fetch.__setGlobalDispatcher=et.setGlobalDispatcher);typeof b.root.AbortController>"u"&&(b.root.AbortController=Tn.default);var We="";P.globalAgent.options.ca!==void 0&&(Array.isArray(P.globalAgent.options.ca)&&P.globalAgent.options.ca.length?typeof P.globalAgent.options.ca[0]=="string"?We=P.globalAgent.options.ca.join(`
923
- `):P.globalAgent.options.ca[0]instanceof ts.Buffer&&(We=P.globalAgent.options.ca.map(r=>r.toString()).join(`
924
- `)):typeof P.globalAgent.options.ca=="string"?We=P.globalAgent.options.ca:P.globalAgent.options.ca instanceof ts.Buffer&&(We=P.globalAgent.options.ca.toString()),We+=`
925
- `);b.root.fetch.__trustwaveAgent=new P.Agent({ca:We+Os});typeof b.root.btoa>"u"&&(b.root.btoa=function(r){return ts.Buffer.from(r||"","utf8").toString("base64")});0&&(module.exports={AccessService,AccountService,Activity,Attr,Attribute,BUILD_VERSION,BaseScope,ClientTools,CloudService,CodesignService,Connection,DFUArrayActions,DFUChangeProtection,DFUChangeRestriction,DFUDefFileFormat,DFUService,DFUWorkunit,DFUWorkunitCache,DFUXRefService,DaliService,Definition,ECLGraph,ECLScope,ESPConnection,ESPExceptions,EclService,EclccErrors,ElkService,EnvchkErrors,Errors,Field,File,FileSpray,FileSprayService,FileSprayStates,Folder,GlobalResultCache,GraphCache,Import,LocalWorkunit,LogType,LogaccessService,LogicalFile,LogicalFileCache,Machine,MachineCache,MachineService,PKG_NAME,PKG_VERSION,PackageProcessService,PropertyType,Query,QueryGraph,RelatedProperty,Resource,ResourcesService,Result,ResultCache,SMCService,SashaService,Scope,ScopeEdge,ScopeGraph,ScopeSubgraph,ScopeVertex,Service,Source,SourceFile,Store,StoreCache,StoreService,TargetAudience,TargetCluster,TargetClusterCache,Timer,Topology,TopologyCache,TopologyService,ValueChangedMessage,Version,WUStateID,WUUpdate,Workspace,Workunit,WorkunitCache,WorkunitsService,WorkunitsServiceEx,WsAccess,WsDfu,WsLogaccess,WsSMC,WsSasha,WsTopology,WsWorkunits,XGMMLEdge,XGMMLGraph,XGMMLSubgraph,XGMMLVertex,XSDNode,XSDSchema,XSDSimpleType,XSDXMLNode,attachWorkspace,clearAllClientToolsCache,createConnection,createGraph,createXGMMLGraph,defaultTargetCluster,deserializeResponse,get,hookSend,instanceOfIConnection,instanceOfIOptions,isArray,isECLResult,isExceptions,isWUInfoWorkunit,isWUQueryECLWorkunit,jsonp,locateAllClientTools,locateClientTools,parseXSD,parseXSD2,post,qualifiedIDBoundary,send,serializeRequest,setTransportFactory,splitMetric,targetClusters,walkXmlJson});
920
+ `),t&&t.length)for(let i of t.split(ce.EOL)){let o=/(Warning|Error) : Path\=(\S*?)(\[\S*\])? Message\=(.*)/.exec(i);if(o){let[,a,c,p,u]=o,l=`${c} ${p||""}: ${u}`,[g,f]=this.locate(c);this.errWarn.push({filePath:e,line:g,col:f,msg:l,severity:a});continue}o||(Re.warning(`parseECLErrors: Unable to parse "${i}"`),this.errOther.push(i))}this._checked=s}locate(e){let t=e.split("/");if(t.length&&t[0]===""&&t.shift(),t.length>0){let s=0;for(let n of this._lines){let i="<"+t[0];if((n.indexOf(i+" ")>=0||n.indexOf(i+">")>=0)&&(t.shift(),t.length===0))return[s+1,n.indexOf(i)+1];++s}}return[0,0]}};function $t(r,e,t){t=t||[],t.push(r);for(let s in r)if(r.hasOwnProperty(s)){let n=r[s];e(s,n,t),n instanceof Array?n.forEach(i=>{$t(i,e,t)}):typeof n=="object"&&$t(n,e,t)}t.pop()}var es=class{jsonWU;constructor(e){this.jsonWU=e}bpGetValidLocations(e){let t=[];if((0,We.exists)("W_LOCAL.Graphs",this.jsonWU)){let s="";$t(this.jsonWU.W_LOCAL.Graphs,(n,i,o)=>{if(n==="$"&&i.id&&(s=i.id),n==="$"&&i.name==="definition"){let a=/([a-z,A-Z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(i.value);if(a){let[,c,p,u]=a,l=+p,g=+u;e===c&&t.push({file:c,line:l,col:g,id:s})}}})}return t}},Ae=class r{eclccPath;envchkPath;eclBundlePath;binPath;cwd;includeFolders;_legacyMode;_args;_version;constructor(e,t,s=[],n=!1,i=[],o){this.eclccPath=e,this.binPath=B.dirname(this.eclccPath),this.envchkPath=B.join(this.binPath,"envchk"+Hs),this.eclBundlePath=B.join(this.binPath,"ecl-bundle"+Hs),this.cwd=B.normalize(t||this.binPath),this.includeFolders=s,this._legacyMode=n,this._args=i,this._version=o}clone(e,t,s=!1,n=[]){return new r(this.eclccPath,e,t,s,n,this._version)}exists(e){try{return F.accessSync(e),!0}catch{}return!1}args(e=[]){let t=[...this._args];return this._legacyMode&&t.push("-legacy"),t.concat(this.includeFolders.map(s=>"-I"+B.normalize(s))).concat(e)}version(){return this._version?Promise.resolve(this._version):this.execFile(this.eclccPath,this.binPath,this.args(["--version"]),"eclcc",`Cannot find ${this.eclccPath}`).then(e=>(this._version=new xe(e.stdout),this._version))}versionSync(){return this._version}_paths={};paths(){return this.execFile(this.eclccPath,this.cwd,this.args(["-showpaths"]),"eclcc",`Cannot find ${this.eclccPath}`).then(e=>{if(e&&e.stdout&&e.stdout.length){let t=e.stdout.split(/\r?\n/);for(let s of t){let n=s.split("=");n.length===2&&(this._paths[n[0]]=n[1])}}return this._paths})}loadXMLDoc(e,t){return new Promise((s,n)=>{let i=F.readFileSync(e,"ascii"),o=(0,We.xml2json)(i);t&&F.unlink(e,a=>{}),s(o)})}createWU(e){let t=Pn.tmpNameSync({prefix:"eclcc-wu-tmp",postfix:""}),s=["-o"+t,"-wu"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(s),"eclcc",`Cannot find ${this.eclccPath}`).then(n=>{let i=B.normalize(t+".xml");return(this.exists(i)?this.loadXMLDoc(i,!0):Promise.resolve({})).then(a=>new es(a))})}createArchive(e){let t=["-E"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(t),"eclcc",`Cannot find ${this.eclccPath}`).then(s=>({content:s.stdout,err:new et(s.stderr,[])}))}attachWorkspace(){return K(this.cwd)}fetchMeta(e){return Promise.all([K(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args(["-M",e]),"eclcc",`Cannot find ${this.eclccPath}`)]).then(([t,s])=>{try{s&&s.stdout&&s.stdout.length&&t.parseMetaXML(s.stdout)}catch(n){Re.error(`fetchMeta: Error parsing XML - ${n?.message??"unknown"}`)}return t})}syntaxCheck(e,t=["-syntax"]){return Promise.all([K(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args([...t,"-M",e]),"eclcc",`Cannot find ${this.eclccPath}`)]).then(([s,n])=>{let i=[];try{n&&n.stdout&&n.stdout.length&&(i=s.parseMetaXML(n.stdout))}catch(o){Re.error(`syntaxCheck: Error parsing XML - ${o?.message??"unknown"}`)}return new et(n?n.stderr:"",i)})}envCheck(e,t=[]){return Promise.all([K(this.cwd),this.execFile(this.envchkPath,this.cwd,this.args([...t,e]),"envchk",`Cannot find ${this.envchkPath}`)]).then(([s,n])=>new Zt(e,n?n.stderr:"",[]))}bundleList(){let e=/\|(.*)\|(.*)\|(.*)\|/g;return Promise.all([fetch("https://raw.githubusercontent.com/hpcc-systems/ecl-bundles/master/README.rst").then(t=>t.text()).then(t=>{let s=[],n=e.exec(t);for(;n;)s.push({name:n[1].trim(),description:n[2].trim(),url:n[3].trim()}),n=e.exec(t);return s}),this.execFile(this.eclBundlePath,this.cwd,this.args(["list"]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`).then(t=>Wn(t.stdout).split(`
921
+ `)).then(t=>{let s={};return Promise.all(t.filter(n=>!!n).map(n=>this.execFile(this.eclBundlePath,this.cwd,this.args(["info",n]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`).then(i=>Wn(i.stdout).split(`
922
+ `)).then(i=>{let o={};i.forEach(a=>{let c=a.split(":");o[c.shift().trim()]=c.join(":").trim()}),s[n]={name:n,props:o}}))).then(()=>s)})]).then(([t,s])=>{t.forEach(n=>{s[n.name]&&(n.props=s[n.name].props,delete s[n.name])});for(let n in s)t.push({name:n,url:"",description:"",props:s[n].props});return t}).catch(t=>[])}bundleInstall(e){return Promise.all([K(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args(["install",e]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`)]).then(([t,s])=>s)}bundleUninstall(e){return Promise.all([K(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args(["uninstall",e]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`)]).then(([t,s])=>s)}execFile(e,t,s,n,i){return new Promise((o,a)=>{Re.debug(`${e} ${s.join(" ")}`);let c=bn.spawn(e,s,{cwd:t}),p="",u="";c.stdout.on("data",l=>{p+=l.toString()}),c.stderr.on("data",l=>{u+=l.toString()}),c.on("close",(l,g)=>{o({code:l,stdout:p.trim(),stderr:u.trim()})})})}};function Kt(r,e){if(r){let t=B.join(r,"HPCCSystems");if(F.existsSync(t)&&F.statSync(t).isDirectory()){if(ce.type()!=="Windows_NT"){let s=B.join(t,"bin","eclcc");F.existsSync(s)&&e.push(new Ae(s))}F.readdirSync(t).forEach(s=>{let n=B.join(t,s,"clienttools","bin","eclcc"+Hs);if(F.existsSync(n)){let i=B.basename(s);new xe(i).exists()&&e.push(new Ae(n))}})}}}var Ze;function _r(){Ze=void 0}function In(){if(Ze)return Ze;let r=[];switch(ce.type()){case"Windows_NT":let e=process.env["ProgramFiles(x86)"]||"";e&&Kt(e,r);let t=process.env.ProgramFiles||"";t&&Kt(t,r),!e&&!t&&Kt("c:\\Program Files (x86)",r);break;case"Linux":case"Darwin":Kt("/opt",r);break;default:break}return Ze=Promise.all(r.map(e=>e.version())).then(()=>(r.sort((e,t)=>t.versionSync().compare(e.versionSync())),r)),Ze}var Un="";function Fn(r){let e=`Using eclccPath setting: ${r}`;Un!==e&&(Re.info(e),Un=e)}function _s(r="",e="",t=".",s=[],n=!1,i=[]){return r&&F.existsSync(r)?(Fn(r),Promise.resolve(new Ae(r,t,s,n,i))):In().then(o=>{if(!o.length)throw new Error("Unable to locate ECL Client Tools.");let a=new xe(e),c,p;for(let l of o){let g=l.versionSync();if(g.exists()&&(c||(c=l),!p&&a.major===g.major&&(p=l),a.major===g.major&&a.minor===g.minor))return l.clone(t,s,n,i)}let u=p||c;return Fn(u.eclccPath),u.clone(t,s,n,i)})}b.root.DOMParser=Tn.DOMParser;typeof b.root.fetch>"u"?(b.root.fetch=Z.default,b.root.Headers=Z.Headers,b.root.Request=Z.Request,b.root.Response=Z.Response,b.root.fetch.__rejectUnauthorizedAgent=new I.Agent({rejectUnauthorized:!1})):(b.root.fetch.__defaultAgent=new tt.Agent,b.root.fetch.__rejectUnauthorizedAgent=new tt.Agent({connect:{rejectUnauthorized:!1}}),b.root.fetch.__setGlobalDispatcher=tt.setGlobalDispatcher);typeof b.root.AbortController>"u"&&(b.root.AbortController=Mn.default);var ye="";I.globalAgent.options.ca!==void 0&&(Array.isArray(I.globalAgent.options.ca)&&I.globalAgent.options.ca.length?typeof I.globalAgent.options.ca[0]=="string"?ye=I.globalAgent.options.ca.join(`
923
+ `):I.globalAgent.options.ca[0]instanceof ts.Buffer&&(ye=I.globalAgent.options.ca.map(r=>r.toString()).join(`
924
+ `)):typeof I.globalAgent.options.ca=="string"?ye=I.globalAgent.options.ca:I.globalAgent.options.ca instanceof ts.Buffer&&(ye=I.globalAgent.options.ca.toString()),ye+=`
925
+ `);b.root.fetch.__trustwaveAgent=new I.Agent({ca:ye+Os});typeof b.root.btoa>"u"&&(b.root.btoa=function(r){return ts.Buffer.from(r||"","utf8").toString("base64")});0&&(module.exports={AccessService,AccountService,Activity,Attr,Attribute,BUILD_VERSION,BaseScope,ClientTools,CloudService,CodesignService,Connection,DFUArrayActions,DFUChangeProtection,DFUChangeRestriction,DFUDefFileFormat,DFUService,DFUWorkunit,DFUWorkunitCache,DFUXRefService,DaliService,Definition,ECLGraph,ECLScope,ESPConnection,ESPExceptions,EclService,EclccErrors,ElkService,EnvchkErrors,Errors,Field,File,FileSpray,FileSprayService,FileSprayStates,Folder,GlobalResultCache,GraphCache,Import,LocalWorkunit,LogType,LogaccessService,LogicalFile,LogicalFileCache,Machine,MachineCache,MachineService,PKG_NAME,PKG_VERSION,PackageProcessService,PropertyType,Query,QueryGraph,RelatedProperty,Resource,ResourcesService,Result,ResultCache,SMCService,SashaService,Scope,ScopeEdge,ScopeGraph,ScopeSubgraph,ScopeVertex,Service,Source,SourceFile,Store,StoreCache,StoreService,TargetAudience,TargetCluster,TargetClusterCache,Timer,Topology,TopologyCache,TopologyService,ValueChangedMessage,Version,WUStateID,WUUpdate,Workspace,Workunit,WorkunitCache,WorkunitsService,WorkunitsServiceEx,WsAccess,WsDfu,WsLogaccess,WsSMC,WsSasha,WsTopology,WsWorkunits,XGMMLEdge,XGMMLGraph,XGMMLSubgraph,XGMMLVertex,XSDNode,XSDSchema,XSDSimpleType,XSDXMLNode,attachWorkspace,clearAllClientToolsCache,createConnection,createGraph,createXGMMLGraph,defaultTargetCluster,deserializeResponse,get,hookSend,instanceOfIConnection,instanceOfIOptions,isArray,isECLResult,isExceptions,isWUInfoWorkunit,isWUQueryECLWorkunit,jsonp,locateAllClientTools,locateClientTools,parseXSD,parseXSD2,post,qualifiedIDBoundary,send,serializeRequest,setTransportFactory,splitMetric,targetClusters,walkXmlJson});
926
926
  //# sourceMappingURL=index.cjs.map